@hyperfixi/core 2.3.1 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/dom-processor.d.ts +8 -4
- package/dist/api/hyperscript-api.d.ts +5 -1
- package/dist/ast-utils/index.js +25320 -94
- package/dist/ast-utils/index.mjs +25320 -94
- package/dist/ast-utils/interchange/types.d.ts +7 -1
- package/dist/behaviors/index.js +54 -100
- package/dist/behaviors/index.mjs +54 -100
- package/dist/bundle-generator/index.js +19 -2
- package/dist/bundle-generator/index.mjs +19 -2
- package/dist/bundle-generator/parser-templates.d.ts +1 -1
- package/dist/bundle-generator/template-capabilities.d.ts +1 -1
- package/dist/chunks/bridge-Ce2mO-nk.js +2 -0
- package/dist/chunks/browser-modular-D5vPrb2X.js +2 -0
- package/dist/chunks/feature-eventsource-BpZvPy_K.js +2 -0
- package/dist/chunks/{feature-sockets-ClOH7vk7.js → feature-sockets-CrYvjZ4j.js} +2 -2
- package/dist/chunks/feature-webworker-BSYguEIW.js +2 -0
- package/dist/chunks/index-DsBHN4zW.js +2 -0
- package/dist/commands/advanced/async.d.ts +6 -2
- package/dist/commands/advanced/js.d.ts +1 -1
- package/dist/commands/animation/start-view-transition.d.ts +24 -0
- package/dist/commands/async/fetch.d.ts +6 -1
- package/dist/commands/control-flow/repeat.d.ts +2 -0
- package/dist/commands/data/clear.d.ts +23 -0
- package/dist/commands/data/set.d.ts +6 -0
- package/dist/commands/dom/close.d.ts +19 -0
- package/dist/commands/dom/empty.d.ts +19 -0
- package/dist/commands/dom/open.d.ts +21 -0
- package/dist/commands/dom/reset.d.ts +19 -0
- package/dist/commands/dom/select.d.ts +19 -0
- package/dist/commands/dom/swap.d.ts +7 -4
- package/dist/commands/events/trigger.d.ts +1 -1
- package/dist/commands/execution/blur.d.ts +19 -0
- package/dist/commands/execution/call.d.ts +1 -2
- package/dist/commands/execution/focus.d.ts +19 -0
- package/dist/commands/helpers/element-resolution.d.ts +2 -2
- package/dist/commands/helpers/event-waiting.d.ts +1 -1
- package/dist/commands/helpers/numeric-target-parser.d.ts +7 -0
- package/dist/commands/index.d.ts +34 -2
- package/dist/commands/index.js +19353 -4845
- package/dist/commands/index.mjs +19321 -4846
- package/dist/commands/navigation/go.d.ts +3 -0
- package/dist/commands/navigation/scroll-to.d.ts +26 -0
- package/dist/commands/utility/beep.d.ts +2 -2
- package/dist/commands/utility/breakpoint.d.ts +19 -0
- package/dist/commands/utility/pick.d.ts +11 -2
- package/dist/compatibility/browser-bundle-modular.d.ts +2 -2
- package/dist/compatibility/browser-bundle-multilingual.d.ts +1 -1
- package/dist/compatibility/browser-bundle-semantic-complete.d.ts +3 -3
- package/dist/compatibility/browser-bundle.d.ts +13 -6
- package/dist/compatibility/browser-modular.d.ts +1 -3
- package/dist/core/expression-evaluator.d.ts +4 -4
- package/dist/core/expression-registry.d.ts +8 -0
- package/dist/expressions/bundles/common-expressions.d.ts +2 -2
- package/dist/expressions/bundles/core-expressions.d.ts +2 -2
- package/dist/expressions/bundles/full-expressions.d.ts +2 -2
- package/dist/expressions/bundles/index.d.ts +3 -3
- package/dist/expressions/collection/index.d.ts +35 -0
- package/dist/expressions/conversion/impl/index.d.ts +1 -1
- package/dist/expressions/index.d.ts +4 -3
- package/dist/expressions/index.js +1117 -1590
- package/dist/expressions/index.mjs +1113 -1586
- package/dist/expressions/logical/index.d.ts +2 -0
- package/dist/expressions/mathematical/index.d.ts +11 -0
- package/dist/expressions/shared/index.d.ts +1 -1
- package/dist/expressions/shared/number-utils.d.ts +1 -0
- package/dist/htmx/htmx-attribute-processor.d.ts +37 -1
- package/dist/htmx/htmx-translator.d.ts +2 -0
- package/dist/htmx/i18n-hooks.d.ts +15 -0
- package/dist/htmx/i18n-orchestrator.d.ts +15 -0
- package/dist/htmx/lang-resolver.d.ts +3 -0
- package/dist/htmx/sse.d.ts +60 -0
- package/dist/htmx/ws.d.ts +59 -0
- package/dist/hyperfixi-browser-classic-i18n.js +2 -0
- package/dist/hyperfixi-browser-minimal.js +1 -0
- package/dist/hyperfixi-browser-standard.js +2 -0
- package/dist/hyperfixi-browser.js +2 -0
- package/dist/hyperfixi-classic-i18n.js +1 -1
- package/dist/hyperfixi-hx-v4.js +1 -0
- package/dist/hyperfixi-hx.js +1 -1
- package/dist/hyperfixi-hybrid-complete.js +1 -1
- package/dist/hyperfixi-hybrid-hx.js +1 -0
- 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.d.ts +2 -0
- package/dist/index.js +43592 -45060
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +43589 -45061
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/morph-adapter.d.ts +0 -13
- package/dist/lib/swap-executor.d.ts +0 -10
- package/dist/lib/view-transitions.d.ts +1 -30
- 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-complete.js +1 -1
- package/dist/lokascript-hybrid-hx.js +1 -1
- package/dist/lokascript-multilingual.js +1 -1
- package/dist/lsp-metadata.d.ts +9 -4
- package/dist/lsp-metadata.js +187 -3
- package/dist/lsp-metadata.mjs +185 -4
- package/dist/metadata.d.ts +1 -1
- package/dist/metadata.js +3 -3
- package/dist/metadata.mjs +3 -3
- package/dist/multilingual/bridge.d.ts +1 -1
- package/dist/multilingual/index.js +79 -22
- package/dist/multilingual/index.mjs +79 -22
- package/dist/parser/command-parsers/animation-commands.d.ts +1 -0
- package/dist/parser/command-parsers/utility-commands.d.ts +1 -0
- package/dist/parser/extensions.d.ts +51 -0
- package/dist/parser/full-parser.js +1223 -897
- package/dist/parser/full-parser.mjs +1223 -897
- package/dist/parser/helpers/ast-helpers.d.ts +1 -0
- package/dist/parser/helpers/parsing-helpers.d.ts +4 -0
- package/dist/parser/parser-types.d.ts +8 -28
- package/dist/parser/parser.d.ts +3 -7
- package/dist/parser/pratt-parser.d.ts +0 -3
- package/dist/parser/runtime.d.ts +4 -0
- package/dist/parser/semantic-integration.d.ts +17 -0
- package/dist/parser/types.d.ts +7 -1
- package/dist/reference/index.js +91 -0
- package/dist/reference/index.mjs +91 -0
- package/dist/registry/index.js +12867 -5876
- package/dist/registry/index.mjs +12867 -5876
- package/dist/registry/universal-types.d.ts +2 -1
- package/dist/runtime/command-adapter.d.ts +23 -16
- package/dist/runtime/plugin.d.ts +14 -0
- package/dist/runtime/runtime-base.d.ts +32 -7
- package/dist/runtime/runtime-factory.d.ts +3 -3
- package/dist/runtime/runtime.d.ts +2 -2
- package/dist/test-setup.d.ts +1 -0
- package/dist/types/base-types.d.ts +3 -0
- package/dist/types/feature-types.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/package.json +29 -23
- package/vocab/htmx/ar.js +60 -0
- package/vocab/htmx/bn.js +49 -0
- package/vocab/htmx/de.js +60 -0
- package/vocab/htmx/en.js +21 -0
- package/vocab/htmx/es.js +60 -0
- package/vocab/htmx/fr.js +59 -0
- package/vocab/htmx/he.js +40 -0
- package/vocab/htmx/hi.js +60 -0
- package/vocab/htmx/id.js +57 -0
- package/vocab/htmx/it.js +58 -0
- package/vocab/htmx/ja.js +60 -0
- package/vocab/htmx/ko.js +60 -0
- package/vocab/htmx/ms.js +35 -0
- package/vocab/htmx/pl.js +60 -0
- package/vocab/htmx/pt.js +60 -0
- package/vocab/htmx/qu.js +60 -0
- package/vocab/htmx/ru.js +60 -0
- package/vocab/htmx/sw.js +59 -0
- package/vocab/htmx/th.js +49 -0
- package/vocab/htmx/tl.js +33 -0
- package/vocab/htmx/tr.js +60 -0
- package/vocab/htmx/uk.js +60 -0
- package/vocab/htmx/vi.js +51 -0
- package/vocab/htmx/zh.js +60 -0
- package/dist/bundles/test-minimal.d.ts +0 -3
- package/dist/bundles/test-standard.d.ts +0 -3
- package/dist/chunks/bridge-Clbh_xAj.js +0 -2
- package/dist/chunks/browser-modular-DIOxQqhV.js +0 -2
- package/dist/chunks/feature-eventsource-B5F2-H1r.js +0 -2
- package/dist/chunks/feature-webworker-3bAp0ac9.js +0 -2
- package/dist/chunks/index-DcxoRUBe.js +0 -2
- package/dist/compatibility/browser-bundle-minimal.d.ts +0 -8
- package/dist/compatibility/browser-bundle-standard.d.ts +0 -8
- package/dist/compatibility/hyperscript-tests/test-adapter.d.ts +0 -13
- package/dist/core/base-expression-evaluator.d.ts +0 -74
- package/dist/core/binary-expression-evaluator.d.ts +0 -7
- package/dist/core/call-expression-evaluator.d.ts +0 -7
- package/dist/core/configurable-expression-evaluator.d.ts +0 -5
- package/dist/core/lazy-expression-evaluator.d.ts +0 -22
- package/dist/core/parser.d.ts +0 -21
- package/dist/core/selector-evaluator.d.ts +0 -15
- package/dist/core/template-literal-evaluator.d.ts +0 -5
- package/dist/expressions/comparison/index.d.ts +0 -80
- package/dist/expressions/comparison/utils.d.ts +0 -2
- package/dist/expressions/conversion/impl/bridge.d.ts +0 -117
- package/dist/expressions/logical/impl/pattern-matching.d.ts +0 -58
- package/dist/expressions/positional/impl/bridge.d.ts +0 -95
- package/dist/expressions/property/index.d.ts +0 -55
- package/dist/expressions/references/impl/bridge.d.ts +0 -54
- package/dist/extensions/index.d.ts +0 -3
- package/dist/extensions/tailwind.d.ts +0 -22
- package/dist/mod.d.ts +0 -63
- package/dist/parser/expression-parser.d.ts +0 -6
- package/dist/runtime/runtime-experimental.d.ts +0 -18
- package/dist/scripts/code-generator.d.ts +0 -64
- package/dist/scripts/generate-missing-commands.d.ts +0 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e){"use strict";function t(e){return e instanceof Error&&("isHalt"in e||"isExit"in e||"isBreak"in e||"isContinue"in e||"isReturn"in e)?e:null}function n(e){return{ok:1,value:e}}function r(e){return{ok:0,error:e}}function i(e){return 1==e.ok}const a="then",o="else",s="end",l="and",c="for",u="while",p="until",m="forever",d="times",f="index",y="in",h="to",v="from",g="with",b="of",w="on",k="event",z="behavior",x="global",E="the",S="start",T=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"]),j=new Set(["put","trigger","send","remove","take","toggle","set","show","hide","add","halt","measure","js","tell","pick","start","swap","morph","push","replace","process"]),A=(new Set(["if","unless","repeat","wait","for","while"]),"at start of"),L="at end of",O=["into","before","after","at",A,L,"at the start of","at the end of"],C=new Set(["if","else","unless","for","while","until","end","and","or","not","in","to","from","into","with","without","as","matches","contains","then","on","when","every","init","def","behavior","the","of","first","last"]),N=new Set(["hsl","hsla","rgb","rgba","hwb","lab","lch","oklch","oklab","color","color-mix","calc","min","max","clamp","var","url","linear-gradient","radial-gradient","conic-gradient","repeating-linear-gradient","repeating-radial-gradient","repeating-conic-gradient"]),P=new Set(["me","it","you","result","my","its","your"]),R=new Set(["and","or","not","no"]),$=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"]),I=new Set(["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","focus","blur","change","input","submit","reset","select","load","unload","resize","scroll","keydown","keyup","keypress","touchstart","touchend","touchmove","touchcancel","drag","drop","dragover","dragenter","dragleave","cut","copy","paste","toggle"]),M=new Set(["on","init","behavior","def","if","else","unless","for","while","until","end","and","or","not","in","to","from","into","with","as","then","when","where","after","before","by","at","between","async","no","start","of","the","new","global","local","equal","equals","greater","less","than","really","catch","finally","throw","return"]),q=new Set(["then","end","to","into","on","with","from","in","by","for","while","until","unless","else","catch","finally"]),_=new Set([")","]","}",","]);function D(e,t){return{infix:{bp:[e,e+1],handler:t??((t,n,r)=>{const i=r.parseExpr(e+1);return{type:"binaryExpression",operator:n.value,left:t,right:i,start:t.start,end:i.end??n.end,line:t.line??n.line,column:t.column??n.column}})}}}function V(e,t){return{infix:{bp:[e+1,e],handler:(t,n,r)=>{const i=r.parseExpr(e);return{type:"binaryExpression",operator:n.value,left:t,right:i,start:t.start,end:i.end??n.end,line:t.line??n.line,column:t.column??n.column}}}}}function H(e,t){return{prefix:{bp:e,handler:t??((t,n)=>{const r=n.parseExpr(e);return{type:"unaryExpression",operator:t.value,operand:r,argument:r,prefix:1,start:t.start,end:r.end??t.end,line:t.line,column:t.column}})}}}function F(e){return(t,n,r)=>{const i=r.advance();if(!i||!i.value)throw Error(`Type check requires a type name after 'is ${e?"not ":""}a/an', got: <end>`);let a=1;const o=r.peek();return o&&"!"===o.value&&(r.advance(),a=0),{type:"typeCheckExpression",value:t,typeName:i.value,nullOk:a,negated:e,start:t.start,end:i.end}}}const B=function(...e){const t=new Map;for(const n of e)for(const[e,r]of n){const n=t.get(e);t.set(e,n?{prefix:r.prefix??n.prefix,infix:r.infix??n.infix}:{...r})}return t}(new Map([["or",D(10)],["||",D(10)],["and",D(20)],["&&",D(20)],["==",D(30)],["!=",D(30)],["<",D(30)],[">",D(30)],["<=",D(30)],[">=",D(30)],["is",D(30)],["matches",D(30)],["contains",D(30)],["starts with",D(30)],["ends with",D(30)],["does not start with",D(30)],["does not end with",D(30)],["is between",D(30,(e,t,n)=>{const r=n.parseExpr(31),i=n.peek();if(!i||"and"!==i.value.toLowerCase())throw Error("between requires 'and' between min and max operands, got: "+(i?.value??"<end>"));n.advance();const a=n.parseExpr(31);return{type:"betweenExpression",value:e,min:r,max:a,negated:0,start:e.start,end:a.end}})],["is not between",D(30,(e,t,n)=>{const r=n.parseExpr(31),i=n.peek();if(!i||"and"!==i.value.toLowerCase())throw Error("between requires 'and' between min and max operands, got: "+(i?.value??"<end>"));n.advance();const a=n.parseExpr(31);return{type:"betweenExpression",value:e,min:r,max:a,negated:1,start:e.start,end:a.end}})],["ignoring case",{infix:{bp:[25,26],handler:(e,t,n)=>(e.ignoringCase=1,e)}}],["where",D(28,(e,t,n)=>{const r=n.parseExpr(29);return{type:"collectionExpression",operator:"where",collection:e,right:r,start:e.start,end:r.end}})],["sorted by",D(28,(e,t,n)=>{const r=n.parseExpr(29);let i="asc";const a=n.peek();if(a&&"string"==typeof a.value){const e=a.value.toLowerCase();"asc"===e||"ascending"===e?(n.advance(),i="asc"):"desc"!==e&&"descending"!==e||(n.advance(),i="desc")}return{type:"collectionExpression",operator:"sorted by",collection:e,right:r,order:i,start:e.start,end:r.end}})],["mapped to",D(28,(e,t,n)=>{const r=n.parseExpr(29);return{type:"collectionExpression",operator:"mapped to",collection:e,right:r,start:e.start,end:r.end}})],["split by",D(28,(e,t,n)=>{const r=n.parseExpr(29);return{type:"collectionExpression",operator:"split by",collection:e,right:r,start:e.start,end:r.end}})],["joined by",D(28,(e,t,n)=>{const r=n.parseExpr(29);return{type:"collectionExpression",operator:"joined by",collection:e,right:r,start:e.start,end:r.end}})],["+",{...D(40),...H(80)}],["-",{...D(40),...H(80)}],["*",D(50)],["/",D(50)],["%",D(50)],["mod",D(50)],["^",V(60)],["**",V(60)],["as",D(70,(e,t,n)=>{const r=n.parseExpr(71),i=n.peek();if(i&&":"===i.value&&r&&"identifier"===r.type){n.advance();const e=n.advance();e&&void 0!==e.value&&(r.name=`${r.name}:${e.value}`,r.end=e.end)}return{type:"asExpression",expression:e,targetType:r,start:e.start,end:r.end??t.end,line:e.line??t.line,column:e.column??t.column}})],["not",H(80)],["!",H(80)],["no",H(80)]]),new Map([["===",D(30)],["!==",D(30)],["is not",D(30)],["am",D(30)],["is in",D(30)],["is not in",D(30)],["precedes",D(30)],["does not precede",D(30)],["follows",D(30)],["does not follow",D(30)],["is a",D(30,F(0))],["is an",D(30,F(0))],["is not a",D(30,F(1))],["is not an",D(30,F(1))],["has",D(30)],["have",D(30)],["match",D(30)],["include",D(30)],["includes",D(30)],["equals",D(30)],["does not contain",D(30)],["does not include",D(30)],["is equal to",D(30)],["is not equal to",D(30)],["is really equal to",D(30)],["is not really equal to",D(30)],["really equals",D(30)],["is greater than",D(30)],["is less than",D(30)],["is greater than or equal to",D(30)],["is less than or equal to",D(30)],["in",D(30)],["of",D(30)],["really",D(30)],["exists",{prefix:{bp:80,handler:(e,t)=>({type:"unaryExpression",operator:e.value,operand:t.parseExpr(80),start:e.start})},infix:{bp:[30,31],handler:(e,t)=>({type:"unaryExpression",operator:t.value,operand:e,prefix:0,start:e.start})}}],["does not exist",{infix:{bp:[30,31],handler:(e,t)=>({type:"unaryExpression",operator:t.value,operand:e,prefix:0,start:e.start})}}],["is empty",{infix:{bp:[30,31],handler:(e,t)=>({type:"unaryExpression",operator:t.value,operand:e,prefix:0,start:e.start})}}],["is not empty",{infix:{bp:[30,31],handler:(e,t)=>({type:"unaryExpression",operator:t.value,operand:e,prefix:0,start:e.start})}}],["some",H(80)]]),new Map([["=",V(5)]])),U=new Map,G=new Map,W=new Map,K=new Set,J=new Set,Z=new Set,Y=new Set;function X(e){return U.get(e.toLowerCase())}function Q(e){return W.get(e)}function ee(e,t){if(0!==J.size)for(const n of J)try{n(e,t)}catch(e){void 0!==console&&console.error("[hyperfixi] globalReadHook threw:",e)}}function te(e,t,n){if(0!==Z.size)for(const r of Z)try{r(e,t,n)}catch(e){void 0!==console&&console.error("[hyperfixi] localWriteHook threw:",e)}}function ne(e,t){if(0!==Y.size)for(const n of Y)try{n(e,t)}catch(e){void 0!==console&&console.error("[hyperfixi] localReadHook threw:",e)}}const re=new class{registerCommand(e){T.add(e.toLowerCase())}registerCompoundOperator(e){$.add(e.toLowerCase())}registerInfixOperator(e,t,n,r){const i=e.toLowerCase(),a=B.get(i);B.set(i,{...a??{},infix:{bp:[t,n],handler:r}})}registerPrefixOperator(e,t,n){const r=e.toLowerCase(),i=B.get(r);B.set(r,{...i??{},prefix:{bp:t,handler:n}})}hasCommand(e){return T.has(e.toLowerCase())}registerFeature(e,t){U.set(e.toLowerCase(),t)}hasFeature(e){return U.has(e.toLowerCase())}registerNodeEvaluator(e,t){G.set(e,t)}registerNodeWriter(e,t){W.set(e,t)}registerGlobalWriteHook(e){return K.add(e),()=>K.delete(e)}registerGlobalReadHook(e){return J.add(e),()=>J.delete(e)}registerLocalWriteHook(e){return Z.add(e),()=>Z.delete(e)}registerLocalReadHook(e){return Y.add(e),()=>Y.delete(e)}snapshot(){return{commands:Array.from(T),operators:Array.from($),prattEntries:Array.from(B.entries()).map(([e,t])=>[e,{...t}]),features:Array.from(U.entries()),nodeEvaluators:Array.from(G.entries()),nodeWriters:Array.from(W.entries()),globalWriteHooks:Array.from(K),globalReadHooks:Array.from(J),localWriteHooks:Array.from(Z),localReadHooks:Array.from(Y)}}restore(e){T.clear();for(const t of e.commands)T.add(t);$.clear();for(const t of e.operators)$.add(t);B.clear();for(const[t,n]of e.prattEntries)B.set(t,n);U.clear();for(const[t,n]of e.features)U.set(t,n);G.clear();for(const[t,n]of e.nodeEvaluators)G.set(t,n);W.clear();for(const[t,n]of e.nodeWriters??[])W.set(t,n);K.clear();for(const t of e.globalWriteHooks)K.add(t);J.clear();for(const t of e.globalReadHooks??[])J.add(t);Z.clear();for(const t of e.localWriteHooks??[])Z.add(t);Y.clear();for(const t of e.localReadHooks??[])Y.add(t)}},ie="__hyperfixi_parser_extension_registry__";function ae(){if("undefined"!=typeof globalThis){const e=globalThis,t=e[ie];if(t&&"object"==typeof t&&"function"==typeof t.registerFeature)return t;e[ie]=re}return re}function oe(e,t,n){if(e.globals.set(t,n),0!==K.size)for(const r of K)try{r(t,n,e)}catch(e){void 0!==console&&console.error("[hyperfixi] globalWriteHook threw:",e)}}const se=new class{constructor(e={}){this.types=new Map,this.coercionCache=new Map,this.config={strictMode:0,cacheCoercions:1,...e},this.registerBuiltinTypes()}register(e){this.types.has(e.name)&&console.warn(`ExpressionTypeRegistry: Overwriting existing type '${e.name}'`),this.types.set(e.name,e)}get(e){return this.types.get(e)}has(e){return this.types.has(e)}getTypeNames(){return Array.from(this.types.keys())}inferType(e){for(const[t,n]of this.types)if(n.isType(e))return t;return"Unknown"}getHyperScriptType(e){const t=this.inferType(e),n=this.types.get(t);return n?.hyperscriptType??"unknown"}coerce(e,t,n){const r=this.types.get(t);if(!r){if(this.config.strictMode)throw Error("Unknown target type: "+t);return null}if(r.isType(e))return e;if(this.config.cacheCoercions){const n=`${this.inferType(e)}:${t}:${JSON.stringify(e)}`;if(this.coercionCache.has(n))return this.coercionCache.get(n)}const i=this.inferType(e),a=r.coerceFrom?.[i];if(a){const r=a(e,n);if(this.config.cacheCoercions&&null!==r){const n=`${i}:${t}:${JSON.stringify(e)}`;this.coercionCache.set(n,r)}return r}return r.defaultValue}canCoerce(e,t){const n=this.types.get(t);if(!n)return 0;if(n.isType(e))return 1;const r=this.inferType(e);return void 0!==n.coerceFrom?.[r]}getCoercionInfo(e,t){const n=this.types.get(t);return n&&(e===t||n.coerceFrom?.[e])?{possible:1,direct:1}:{possible:0,direct:0}}clearCache(){this.coercionCache.clear()}getStats(){return{typeCount:this.types.size,cacheSize:this.coercionCache.size,typeNames:this.getTypeNames()}}registerBuiltinTypes(){this.register({name:"String",hyperscriptType:"string",tsType:"string",isType:e=>"string"==typeof e,defaultValue:"",description:"Text string value",examples:["hello","world",""],coerceFrom:{Number:e=>e+"",Boolean:e=>e+"",Null:()=>"",Undefined:()=>"",Array:e=>Array.isArray(e)?e.join(", "):null,Object:e=>{try{return JSON.stringify(e)}catch{return e+""}},Element:e=>e instanceof Element?e.textContent??e.outerHTML:null}}),this.register({name:"Number",hyperscriptType:"number",tsType:"number",isType:e=>"number"==typeof e&&!isNaN(e),defaultValue:0,description:"Numeric value (integer or float)",examples:[0,1,3.14,-42],coerceFrom:{String:e=>{const t=parseFloat(e);return isNaN(t)?null:t},Boolean:e=>e?1:0,Null:()=>0,Undefined:()=>null}}),this.register({name:"Boolean",hyperscriptType:"boolean",tsType:"boolean",isType:e=>"boolean"==typeof e,defaultValue:0,description:"True or false value",examples:[1,0],coerceFrom:{String:e=>{const t=e.toLowerCase().trim();return"true"===t||"yes"===t||"1"===t?1:"false"===t||"no"===t||"0"===t||""===t?0:t.length>0},Number:e=>0!==e,Null:()=>0,Undefined:()=>0,Array:e=>Array.isArray(e)?e.length>0:0,Element:e=>e instanceof Element,ElementList:e=>Array.isArray(e)&&e.length>0}}),this.register({name:"Element",hyperscriptType:"element",tsType:"Element | HTMLElement",isType:e=>e instanceof Element,defaultValue:null,description:"DOM Element",coerceFrom:{String:(e,t)=>{const n=e;if(n.startsWith("#")||n.startsWith(".")||n.match(/^[\w-]+$/))try{return document.querySelector(n)}catch{return null}return null},ElementList:e=>Array.isArray(e)&&e.length>0?e[0]:null,NodeList:e=>e.length>0?e[0]:null}}),this.register({name:"ElementList",hyperscriptType:"element-list",tsType:"Element[]",isType:e=>Array.isArray(e)&&e.length>0&&e.every(e=>e instanceof Element),defaultValue:[],description:"Array of DOM Elements",coerceFrom:{Element:e=>e instanceof Element?[e]:[],NodeList:e=>Array.from(e),String:e=>{try{return Array.from(document.querySelectorAll(e))}catch{return[]}},Array:e=>{const t=e;return t.every(e=>e instanceof Element)?t:[]}}}),this.register({name:"Array",hyperscriptType:"array",tsType:"unknown[]",isType:e=>Array.isArray(e),defaultValue:[],description:"Array of values",coerceFrom:{String:e=>{const t=e;try{const e=JSON.parse(t);if(Array.isArray(e))return e}catch{}return t.split(",").map(e=>e.trim())},ElementList:e=>e,NodeList:e=>Array.from(e),Object:e=>Object.values(e)}}),this.register({name:"Object",hyperscriptType:"object",tsType:"Record<string, unknown>",isType:e=>!("object"!=typeof e||null===e||Array.isArray(e)||e instanceof Element),defaultValue:{},description:"Plain JavaScript object",coerceFrom:{String:e=>{try{const t=JSON.parse(e);if("object"==typeof t&&null!==t&&!Array.isArray(t))return t}catch{}return null},Array:e=>{const t={};return e.forEach((e,n)=>{t[n+""]=e}),t}}}),this.register({name:"Null",hyperscriptType:"null",tsType:"null",isType:e=>null===e,defaultValue:null,description:"Null value"}),this.register({name:"Undefined",hyperscriptType:"undefined",tsType:"undefined",isType:e=>void 0===e,defaultValue:void 0,description:"Undefined value"}),this.register({name:"Function",hyperscriptType:"function",tsType:"Function",isType:e=>"function"==typeof e,defaultValue:null,description:"JavaScript function"}),this.register({name:"Event",hyperscriptType:"event",tsType:"Event",isType:e=>e instanceof Event,defaultValue:null,description:"DOM Event"}),this.register({name:"NodeList",hyperscriptType:"element-list",tsType:"NodeList",isType:e=>e instanceof NodeList,defaultValue:null,description:"DOM NodeList (typically from querySelectorAll)",coerceFrom:{Array:e=>null}}),this.register({name:"Unknown",hyperscriptType:"unknown",tsType:"unknown",isType:e=>1,defaultValue:null,description:"Unknown/any value type"})}};function le(e){const t=se.get("String");return t?t.isType(e):"string"==typeof e}function ce(e){const t=se.get("Number");return t?t.isType(e):"number"==typeof e}function ue(e){const t=se.get("Boolean");return t?t.isType(e):"boolean"==typeof e}function pe(e){const t=se.get("Object");return t?t.isType(e):"object"==typeof e&&null!==e}function me(e){const t=se.get("Function");return t?t.isType(e):"function"==typeof e}function de(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&1===e.nodeType&&"style"in e}const fe=new Set(["disabled","readonly","required","checked","selected","hidden","open","autofocus","autoplay","controls","loop","muted","multiple","reversed","defer","async","novalidate","formnovalidate","ismap"]);function ye(e,t){return fe.has(t.toLowerCase())?e.hasAttribute(t):e.getAttribute(t)}const he={id:e=>e.id,classname:e=>e.className,class:e=>e.className,tagname:e=>e.tagName.toLowerCase(),innertext:e=>e.textContent?.trim(),innerHTML:e=>e.innerHTML,outerhtml:e=>e.outerHTML,value:e=>function(e){if(null===e||"object"!=typeof e||!("tagName"in e))return 0;const t=e.tagName;return"INPUT"===t||"SELECT"===t||"TEXTAREA"===t}(e)?e.value:void 0,checked:e=>function(e){return null!==e&&"object"==typeof e&&"tagName"in e&&"INPUT"===e.tagName}(e)?e.checked:void 0,disabled:e=>"disabled"in e?e.disabled:void 0,selected:e=>function(e){return null!=e&&"object"==typeof e&&"tagName"in e&&"OPTION"===e.tagName}(e)?e.selected:void 0,tabindex:e=>de(e)?e.tabIndex:void 0,hidden:e=>de(e)?e.hidden:void 0,style:e=>getComputedStyle(e),children:e=>Array.from(e.children),parent:e=>e.parentElement,firstchild:e=>e.firstElementChild,lastchild:e=>e.lastElementChild,nextsibling:e=>e.nextElementSibling,previoussibling:e=>e.previousElementSibling,values:e=>function(e){if(e instanceof HTMLFormElement)return new FormData(e);const t=new FormData;return e.querySelectorAll("input, select, textarea").forEach(e=>{const n=e.getAttribute("name");n&&"value"in e&&t.append(n,e.value)}),t}(e)};function ve(e,t){if(t.startsWith("computed-")){const n=t.slice(9);return function(e){return e instanceof HTMLElement}(e)?getComputedStyle(e).getPropertyValue(n):void 0}if(t.startsWith("@"))return ye(e,t.slice(1));const n=he[t.toLowerCase()];if(n)return n(e);if(function(e,t){return e.hasAttribute(t)}(e,t))return ye(e,t);const r=e[t];return me(r)?r.bind(e):r}function ge(e){return Array.isArray(e)?e:null==e?[]:"string"==typeof e?[e]:e instanceof NodeList||e instanceof HTMLCollection||"number"==typeof e.length?Array.from(e):[e]}var be;!function(e){e.IDENTIFIER="identifier",e.STRING="string",e.NUMBER="number",e.SELECTOR="selector",e.OPERATOR="operator",e.TIME="time",e.TEMPLATE="template",e.COMMENT="comment",e.SYMBOL="symbol",e.UNKNOWN="unknown"}(be||(be={}));const we=new Set(["+","-","*","/","mod"]),ke=new Set(["ms","s","seconds","minutes","hours","days"]);function ze(e){const t={input:"",position:0,line:1,column:1,tokens:[]};t.input=e;const n=e.length;for(;n>t.position&&(Se(t),n>t.position);){const n=e[t.position];if("-"!==n||"-"!==xe(t,1))if('"'!==n){if("'"===n||"'"===n){const e=xe(t,1),n=t.tokens[t.tokens.length-1];if("s"!==e||!n||n.kind!==be.IDENTIFIER&&n.kind!==be.SELECTOR&&"]"!==n.value&&")"!==n.value&&"}"!==n.value)Le(t);else{const e=t.position;Ee(t),Ee(t),Te(t,be.OPERATOR,"'s",e)}continue}if("`"!==n)if("<"!==n)if("#"!==n){if("."===n){if("."===xe(t,1)){const e=t.position;Ee(t),Ee(t),Te(t,be.OPERATOR,"..",e);continue}const e=t.tokens[t.tokens.length-1],n=new Set(["from","to","into","on","in","at","first","last","next","previous","closest","random"]),r=e&&e.kind===be.IDENTIFIER&&T.has(e.value.toLowerCase()),i=e&&e.kind===be.IDENTIFIER&&n.has(e.value.toLowerCase());if((!e||e.kind===be.OPERATOR&&")"!==e.value&&"]"!==e.value||r||i||"("===e.value||"["===e.value||"{"===e.value||","===e.value||";"===e.value)&&(!e||e.end!==t.position)&&(qe(xe(t))||"{"===xe(t))){Ce(t);continue}}if("@"!==n)if("{"!==n)if("}"!==n){if("["===n){const e=t.tokens[t.tokens.length-1],n=e&&e.kind===be.IDENTIFIER&&I.has(e.value)&&t.tokens.length>=2&&"on"===t.tokens[t.tokens.length-2]?.value;(!e||e.kind!==be.IDENTIFIER&&")"!==e.value&&"]"!==e.value||n)&&n?(Te(t,be.SYMBOL,"["),Ee(t)):(Te(t,be.OPERATOR,"["),Ee(t));continue}if("]"!==n){if("$"===n){const e=xe(t,1);if(e>="a"&&"z">=e||e>="A"&&"Z">=e||"_"===e){Me(t);continue}}Ve(n)?Re(t):"0">n||n>"9"?("a">n||n>"z")&&("A">n||n>"Z")&&"_"!==n?(Te(t,be.UNKNOWN,n),Ee(t)):Ie(t):$e(t)}else Te(t,be.OPERATOR,"]"),Ee(t)}else Te(t,be.OPERATOR,"}"),Ee(t);else Te(t,be.OPERATOR,"{"),Ee(t);else Pe(t)}else Ce(t);else De(t)?Ne(t):Re(t);else Oe(t)}else Le(t);else Ae(t)}return t.tokens}function xe(e,t=1){const n=e.position+t;return e.input.length>n?e.input[n]:""}function Ee(e){const t=e.input[e.position];return e.position++,"\n"===t?(e.line++,e.column=1):"\r"===t?("\n"===(e.input.length>e.position?e.input[e.position]:"")&&e.position++,e.line++,e.column=1):e.column++,t}function Se(e){const t=e.input,n=t.length;for(;n>e.position;){const n=t[e.position];if(" "!==n&&"\t"!==n&&"\r"!==n&&"\n"!==n)break;Ee(e)}}function Te(e,t,n,r,i){const a=r??e.position-n.length,o=e.position;let s=e.column-n.length;if(void 0!==r){s=1;let t=-1;for(let n=0;r>n;n++)"\n"!==e.input[n]&&"\r"!==e.input[n]||(t=n);s=r-t}const l={kind:t,value:n,start:a,end:o,line:je(e,a),column:s};e.tokens.push(l)}function je(e,t){let n=1;for(let r=0;t>r&&e.input.length>r;r++){const t=e.input[r];"\n"===t?n++:"\r"===t&&(n++,e.input.length>r+1&&"\n"===e.input[r+1]&&r++)}return n}function Ae(e){const t=e.position;let n="";for(Ee(e),Ee(e);e.input.length>e.position&&"\n"!==e.input[e.position];)n+=Ee(e);Te(e,be.COMMENT,"--"+n,t)}function Le(e){const t=e.position,n=Ee(e);let r=n;for(;e.input.length>e.position;){const t=Ee(e);if(r+=t,t===n)break;"\\"===t&&e.input.length>e.position&&(r+=Ee(e))}Te(e,be.STRING,r,t)}function Oe(e){const t=e.position;Ee(e);let n="";for(;e.input.length>e.position;){const t=e.input[e.position];if("`"===t){Ee(e);break}if("\\"===t){if(Ee(e),e.input.length>e.position){const t=Ee(e);switch(t){case"n":n+="\n";break;case"t":n+="\t";break;case"r":n+="\r";break;case"\\":n+="\\";break;case"`":n+="`";break;default:n+=t}}}else n+=Ee(e)}if(e.position>=e.input.length&&!e.input.endsWith("`"))throw Error(`Unterminated template literal at line ${e.line}, column ${e.column-n.length}`);Te(e,be.TEMPLATE,n,t)}function Ce(e){const t=e.position;let n=Ee(e);if(e.input.length>e.position&&"{"===e.input[e.position]){for(n+=Ee(e);e.input.length>e.position;){const t=e.input[e.position];if(n+=Ee(e),"}"===t)break}Te(e,be.SELECTOR,n,t)}else{for(;e.input.length>e.position;){const t=e.input[e.position];if(!_e(t)&&"-"!==t&&"_"!==t&&":"!==t)break;n+=Ee(e)}Te(e,be.SELECTOR,n,t)}}function Ne(e){const t=e.position;let n="";for(n+=Ee(e);e.input.length-1>e.position;){const t=e.input[e.position],r=e.input[e.position+1];if(n+=Ee(e),"/"===t&&">"===r){n+=Ee(e);break}}Te(e,be.SELECTOR,n,t)}function Pe(e){const t=e.position;let n=Ee(e);for(;e.input.length>e.position;){const t=e.input[e.position];if(!_e(t)&&"_"!==t&&"-"!==t)break;n+=Ee(e)}Te(e,be.SYMBOL,n,t)}function Re(e){const t=e.position;let n="";const r=e.input[e.position];if(("'"===r||"'"===r)&&"s"===xe(e,1))return n="'s",Ee(e),Ee(e),void Te(e,be.OPERATOR,n,t);const i=e.input.substring(e.position,e.position+2),a=e.input.substring(e.position,e.position+3);["===","!=="].includes(a)?(n=a,Ee(e),Ee(e),Ee(e)):["==","!=","<=",">=","&&","||","**","~=","|=","^=","$=","*=","?."].includes(i)?(n=i,Ee(e),Ee(e)):n=Ee(e),Te(e,be.OPERATOR,n,t)}function $e(e){const t=e.position,n=e.input,r=n.length;let i="";for(;r>e.position;){const t=n[e.position];if("0">t||t>"9")break;i+=Ee(e)}if(r>e.position&&"."===n[e.position]&&(e.position+1>=r||"."!==n[e.position+1]))for(i+=Ee(e);r>e.position;){const t=n[e.position];if("0">t||t>"9")break;i+=Ee(e)}if(r>e.position){const t=n[e.position];if("e"===t||"E"===t){const t=r>e.position+1?n[e.position+1]:"",a=r>e.position+2?n[e.position+2]:"";if(t>="0"&&"9">=t||!("+"!==t&&"-"!==t||"0">a||a>"9"))for(i+=Ee(e),"+"!==n[e.position]&&"-"!==n[e.position]||(i+=Ee(e));r>e.position;){const t=n[e.position];if("0">t||t>"9")break;i+=Ee(e)}}}const a=e.position;let o="";for(;r>e.position;){const t=n[e.position];if(("a">t||t>"z")&&("A">t||t>"Z"))break;o+=Ee(e)}ke.has(o)?Te(e,be.TIME,i+o,t):(e.position=a,Te(e,be.NUMBER,i,t))}function Ie(e){const t=e.position,n=e.input,r=n.length;let i="";for(;r>e.position;){const t=n[e.position];if(("a">t||t>"z")&&("A">t||t>"Z")&&("0">t||t>"9")&&"_"!==t&&"-"!==t)break;i+=Ee(e)}const a=function(e,t,n){const r=t.toLowerCase(),i=e.position;if("'s"===t||"'s"===t)return 0;const a=e.tokens[e.tokens.length-1];if(a&&(a.kind===be.IDENTIFIER||a.kind===be.SELECTOR)){const t=e.input.length>e.position?e.input[e.position]:"";if("'"===t||"'"===t)return 0}Se(e);let o="";for(;e.input.length>e.position;){const t=e.input[e.position];if(("a">t||t>"z")&&("A">t||t>"Z")&&("0">t||t>"9")&&"_"!==t&&"-"!==t)break;o+=Ee(e)}if(o){const t=o.toLowerCase(),i=`${r} ${t}`,a=function(e,t,n,r){const i=t.toLowerCase(),a=n.toLowerCase();if("at"===i){const t=e.position;if("the"===a){Se(e);let n="";for(;e.input.length>e.position;){const t=e.input[e.position];if(("a">t||t>"z")&&("A">t||t>"Z")&&("0">t||t>"9")&&"_"!==t&&"-"!==t)break;n+=Ee(e)}const i=n.toLowerCase();if("start"===i||"end"===i){Se(e);let t="";for(;e.input.length>e.position;){const n=e.input[e.position];if(("a">n||n>"z")&&("A">n||n>"Z")&&("0">n||n>"9")&&"_"!==n&&"-"!==n)break;t+=Ee(e)}if("of"===t.toLowerCase())return Te(e,be.IDENTIFIER,`at the ${i} of`,r),1}return e.position=t,0}if("start"===a||"end"===a){Se(e);let n="";for(;e.input.length>e.position;){const t=e.input[e.position];if(("a">t||t>"z")&&("A">t||t>"Z")&&("0">t||t>"9")&&"_"!==t&&"-"!==t)break;n+=Ee(e)}return"of"===n.toLowerCase()?(Te(e,be.IDENTIFIER,`at ${a} of`,r),1):(e.position=t,0)}}return 0}(e,r,t,n);if(a)return 1;const s=function(e,t,n){const r=e.position;let i=`${t} ${n}`,a=e.position;const o=[t,n];for(;8>o.length&&(Se(e),e.input.length>e.position);){let t="";for(;e.input.length>e.position;){const n=e.input[e.position];if(("a">n||n>"z")&&("A">n||n>"Z"))break;t+=Ee(e)}if(!t)break;o.push(t.toLowerCase());const n=o.join(" ");$.has(n)&&(i=n,a=e.position)}return $.has(i)&&i!==`${t} ${n}`?(e.position=a,i):(e.position=r,null)}(e,r,t);if(s)return Te(e,be.OPERATOR,s,n),1;if($.has(i))return Te(e,be.OPERATOR,i,n),1}return $.has(r)?(e.position=i,Te(e,be.OPERATOR,t,n),1):(e.position=i,0)}(e,i,t);if(a)return;const o=function(e){const t=e.toLowerCase();return"include"===t||"includes"===t||R.has(t)||we.has(e)||we.has(t)||$.has(t)?be.OPERATOR:be.IDENTIFIER}(i);Te(e,o,i,t)}function Me(e){const t=e.position,n=e.input,r=n.length;Ee(e);let i="$";for(;r>e.position;){const t=n[e.position];if(("a">t||t>"z")&&("A">t||t>"Z")&&("0">t||t>"9")&&"_"!==t)break;i+=Ee(e)}Te(e,be.IDENTIFIER,i,t)}function qe(e){return/[a-zA-Z]/.test(e)}function _e(e){return/[a-zA-Z0-9]/.test(e)}function De(e){let t=e.position+1,n=0;for(;e.input.length>t;){const r=e.input[t];if("/"===r&&e.input.length>t+1&&">"===e.input[t+1])return n;if(_e(r)||"."===r||"#"===r||"["===r||"]"===r||":"===r||"-"===r||"_"===r||" "===r||"="===r||'"'===r||"'"===r||"("===r||")"===r||"*"===r||"^"===r||"$"===r||"~"===r||"|"===r||">"===r||"+"===r||","===r)n=1,t++;else{if(" "!==r&&"\t"!==r)return 0;t++}if(t-e.position>50)return 0}return 0}function Ve(e){return"+-*/^%=!<>&|(){}[],.;:?''~$".includes(e)}const He=function(){if("undefined"!=typeof localStorage)try{const e=localStorage,t=e.getItem("hyperfixi:debug")||e.getItem("lokascript:debug");if("*"===t||"true"===t)return 1}catch{}return"undefined"!=typeof window&&window.__HYPERFIXI_DEBUG__||"undefined"!=typeof process&&"true"===process.env?.HYPERFIXI_DEBUG?1:0}(),Fe=He,Be=He,Ue=He,Ge=He,We=He,Ke=He,Je=He,Ze=He,Ye={command:(...e)=>{Fe&&console.log("🔧",...e)},event:(...e)=>{Be&&console.log("🎯",...e)},parse:(...e)=>{Ue&&console.log("📝",...e)},expr:(...e)=>{Ge&&console.log("🔍",...e)},expressions:(...e)=>{Ge&&console.log("🔍",...e)},style:(...e)=>{We&&console.log("🎨",...e)},runtime:(...e)=>{Ke&&console.log("🚀",...e)},loop:(...e)=>{Je&&console.log("🔁",...e)},async:(...e)=>{Ze&&console.log("⏳",...e)}},Xe={enable(){if("undefined"!=typeof localStorage)try{localStorage.setItem("hyperfixi:debug","*"),console.log("HyperFixi debug logging enabled. Reload page to see detailed logs.")}catch(e){console.warn("⚠️ Could not enable debug logging (localStorage unavailable):",e)}else console.warn("⚠️ localStorage not available. Set window.__HYPERFIXI_DEBUG__ = true instead.")},disable(){if("undefined"!=typeof localStorage)try{localStorage.removeItem("hyperfixi:debug"),localStorage.removeItem("lokascript:debug"),console.log("HyperFixi debug logging disabled. Reload page.")}catch(e){console.warn("⚠️ Could not disable debug logging:",e)}else console.warn("⚠️ localStorage not available. Set window.__HYPERFIXI_DEBUG__ = false instead.")},isEnabled:()=>He,status(){if("undefined"!=typeof localStorage)try{const e=localStorage;if(e.getItem("hyperfixi:debug")||e.getItem("lokascript:debug"))return{enabled:1,source:"localStorage"}}catch{}return"undefined"!=typeof window&&window.__HYPERFIXI_DEBUG__?{enabled:1,source:"window.__HYPERFIXI_DEBUG__"}:"undefined"!=typeof process&&"true"===process.env?.HYPERFIXI_DEBUG?{enabled:1,source:"process.env.HYPERFIXI_DEBUG"}:{enabled:0,source:"none"}}};let Qe=0,et=null;if("undefined"!=typeof window&&"undefined"!=typeof URLSearchParams)try{"semantic"===new URLSearchParams(window.location.search).get("debug")&&(Qe=1,et=window,console.log("%c[HyperFixi] Semantic debug auto-enabled via URL param","color: #667eea; font-weight: bold"))}catch{}function tt(){return Qe}let nt={totalParses:0,semanticSuccesses:0,semanticFallbacks:0,traditionalParses:0,averageConfidence:0,confidenceHistory:[]},rt=[];class it{constructor(e){this.analyzer=e.analyzer,this.language=e.language,this.confidenceThreshold=e.confidenceThreshold??.5,this.debugEnabled=e.debug??0}isAvailable(){return this.analyzer.supportsLanguage(this.language)}shouldSkipSemantic(e){const t=e.trim().split(/\s+/)[0]?.toLowerCase();if(it.SKIP_SEMANTIC_COMMANDS.has(t))return 1;const n=e.toLowerCase();return/\bjs\b/.test(n)||/\btell\b/.test(n)||/\*[a-zA-Z]/.test(e)?1:0}trySemanticParse(e){const t=performance.now();if(this.shouldSkipSemantic(e))return{success:0,confidence:0,errors:["Command skipped for semantic parsing - using traditional parser"]};if(!this.isAvailable())return{success:0,confidence:0,errors:[`Semantic parsing not available for language '${this.language}'`]};try{const r=this.analyzer.analyze(e,this.language),i=performance.now()-t;this.debugEnabled&&console.log("[SemanticIntegration] Analysis result:",{input:e,language:this.language,confidence:r.confidence,command:r.command?.name,threshold:this.confidenceThreshold});const a=r.confidence>=this.confidenceThreshold&&!!r.command,o=!a&&r.confidence>0;if(tt()){const t={};if(r.command?.roles)for(const[e,n]of r.command.roles)t[e]=n.value;const s={input:e.substring(0,100),language:this.language,confidence:r.confidence,threshold:this.confidenceThreshold,semanticSuccess:a,fallbackTriggered:o,command:r.command?.name,roles:Object.keys(t).length>0?t:void 0,errors:r.errors,timestamp:Date.now(),duration:i};!function(e){if(!Qe)return;rt.push(e),rt.length>50&&rt.shift();const t=e.semanticSuccess?"semantic":e.fallbackTriggered?"fallback":"traditional",n=Math.round(100*e.confidence),r=Math.round(100*e.threshold),i=e.semanticSuccess?"color: #4caf50; font-weight: bold":e.fallbackTriggered?"color: #ff9800; font-weight: bold":"color: #9e9e9e";if(console.groupCollapsed(`%c[Semantic] ${t.toUpperCase()} %c${e.input.substring(0,50)}${e.input.length>50?"...":""}`,i,"color: #888"),console.log(`Confidence: ${n}% (threshold: ${r}%)`),e.command&&console.log("Command: "+e.command),e.roles&&Object.keys(e.roles).length>0&&console.log("Roles:",e.roles),e.duration&&console.log(`Duration: ${e.duration.toFixed(2)}ms`),e.errors?.length&&console.log("Errors:",e.errors),console.groupEnd(),et){const t=new CustomEvent("lokascript:semantic:parse",{detail:e,bubbles:1});et.dispatchEvent(t)}}(s),n=s,nt.totalParses++,n.semanticSuccess?nt.semanticSuccesses++:n.fallbackTriggered?nt.semanticFallbacks++:nt.traditionalParses++,nt.confidenceHistory.push(n.confidence),nt.confidenceHistory.length>100&&nt.confidenceHistory.shift(),nt.averageConfidence=nt.confidenceHistory.reduce((e,t)=>e+t,0)/nt.confidenceHistory.length}return a?{success:1,node:this.buildCommandNode(r),confidence:r.confidence,tokensConsumed:r.tokensConsumed}:{success:0,confidence:r.confidence,tokensConsumed:r.tokensConsumed,errors:r.errors}}catch(e){return{success:0,confidence:0,errors:[e instanceof Error?e.message:e+""]}}var n}buildCommandNode(e){const{command:t}=e;if(!t)throw Error("Cannot build command node without command data");if("repeat"===t.name)return this.buildRepeatCommandNode(t);if("for"===t.name)return this.buildRepeatCommandNode(t);if("set"===t.name)return this.buildSetCommandNode(t);if("if"===t.name||"unless"===t.name)return this.buildIfCommandNode(t);const n=[],r={};for(const[e,i]of t.roles){const a=this.semanticValueToExpression(i);switch(e){case"patient":case"event":n.push(a);break;case"destination":"put"===t.name?r.into=a:"add"===t.name||"append"===t.name||"prepend"===t.name?r.to=a:r.on=a;break;case"source":"fetch"===t.name?n.push(a):r.from=a;break;case"quantity":r.by=a;break;case"duration":r.over=a;break;case"responseType":r.as=a;break;case"method":r.method=a;break;case"style":r.with=a;break;case"condition":r.when=a;break;default:r[e]=a}}return{type:"command",name:t.name,args:n,modifiers:Object.keys(r).length>0?r:void 0,isBlocking:0,start:0,end:0,line:1,column:0}}buildRepeatCommandNode(e){const t=[],n={},r=e.roles.get("loopType");r&&t.push({type:"identifier",name:r.value+"",start:0,end:0,line:1,column:0});const i=e.roles.get("patient");"for"==(r?r.value+"":"")&&i&&t.push({type:"identifier",name:"expression"===i.type&&i.raw||i.value+"",start:0,end:0,line:1,column:0});const a=e.roles.get("event");a&&t.push({type:"string",value:a.value+"",start:0,end:0,line:1,column:0});const o=e.roles.get("source");o&&t.push(this.semanticValueToExpression(o));const s=e.roles.get("quantity");s&&t.push(this.semanticValueToExpression(s));const l=e.roles.get("condition");return l&&(n.condition=this.semanticValueToExpression(l)),{type:"command",name:"repeat",args:t,modifiers:Object.keys(n).length>0?n:void 0,isBlocking:0,start:0,end:0,line:1,column:0}}buildSetCommandNode(e){const t=[],n=e.roles.get("destination");if(n)if("property-path"===n.type){const e=n;t.push({type:"possessiveExpression",object:this.semanticValueToExpression(e.object),property:this.createPropertyNode(e.property),start:0,end:0,line:1,column:0})}else t.push(this.semanticValueToExpression(n));t.push({type:"identifier",name:"to",start:0,end:0,line:1,column:0});const r=e.roles.get("patient");return r&&t.push(this.semanticValueToExpression(r)),{type:"command",name:"set",args:t,isBlocking:0,start:0,end:0,line:1,column:0}}createPropertyNode(e){return e.startsWith("*")?{type:"cssProperty",name:e.substring(1),start:0,end:0,line:1,column:0}:{type:"identifier",name:e,start:0,end:0,line:1,column:0}}buildIfCommandNode(e){const t=[],n=e.roles.get("condition");return n&&t.push(this.semanticValueToExpression(n)),{type:"command",name:e.name,args:t,isBlocking:0,start:0,end:0,line:1,column:0}}semanticValueToExpression(e){switch(e.type){case"selector":return{type:"selector",value:e.value,start:0,end:0,line:1,column:0};case"reference":return{type:"identifier",name:e.value,start:0,end:0,line:1,column:0};case"literal":return"string"==typeof e.value&&e.value.includes("${")&&e.value.includes("}")?{type:"templateLiteral",value:e.value,start:0,end:0,line:1,column:0}:{type:"literal",value:e.value,raw:e.raw??e.value,start:0,end:0,line:1,column:0};case"property-path":{const t=e;return{type:"memberExpression",object:this.semanticValueToExpression(t.object),property:{type:"identifier",name:t.property,start:0,end:0,line:1,column:0},computed:0,start:0,end:0,line:1,column:0}}default:return this.parseExpressionString(e.raw||"")}}parseExpressionString(e){let t=0;const n=()=>{for(;e.length>t&&/\s/.test(e[t]);)t++},r=()=>{n();const r=t;for(;e.length>t&&/[a-zA-Z0-9_$]/.test(e[t]);)t++;return e.slice(r,t)},i=()=>{const r=[];if(t++,n(),")"!==e[t])for(r.push(a()),n();","===e[t];)t++,n(),r.push(a()),n();return")"===e[t]&&t++,r},a=()=>{n();const a=r();if(!a)return{type:"identifier",name:e.trim(),start:0,end:0,line:1,column:0};let o={type:"identifier",name:a,start:0,end:0,line:1,column:0};for(;e.length>t;){n();const a=e[t];if("."===a){t++;const e=r();e&&(o={type:"memberExpression",object:o,property:{type:"identifier",name:e,start:0,end:0,line:1,column:0},computed:0,start:0,end:0,line:1,column:0})}else{if("("!==a)break;o={type:"callExpression",callee:o,arguments:i(),start:0,end:0,line:1,column:0}}}return o};return a()}getLanguage(){return this.language}getConfidenceThreshold(){return this.confidenceThreshold}}function at(e){return{analyze(t,n){if(!e.isRegistered(n))return{confidence:0,errors:[`Language '${n}' is not supported for semantic parsing`]};const r=e.parse(t,n);return{confidence:r.confidence,...void 0!==r.tokensConsumed?{tokensConsumed:r.tokensConsumed}:{},...r.node?{command:{name:r.node.action,roles:r.node.roles}}:{},...r.error?{errors:[r.error]}:{}}},supportsLanguage:t=>e.isRegistered(t),supportedLanguages:()=>e.registered()}}function ot(e){return e.kind!==be.IDENTIFIER?0:T.has(e.value.toLowerCase())}function st(e){return e.kind!==be.IDENTIFIER?0:M.has(e.value.toLowerCase())}function lt(e){return e.kind!==be.IDENTIFIER?0:I.has(e.value.toLowerCase())}function ct(e){return e.kind!==be.IDENTIFIER?0:P.has(e.value.toLowerCase())}function ut(e){return $.has(e.value.toLowerCase())}function pt(e){return e.kind===be.IDENTIFIER}function mt(e){return e.kind===be.SELECTOR}function dt(e){return e.kind!==be.SELECTOR?0:!e.value.startsWith("<")}function ft(e){return e.kind===be.STRING||e.kind===be.NUMBER||e.kind===be.TEMPLATE}function yt(e){return e.kind===be.IDENTIFIER}function ht(e){return e.kind===be.TIME}function vt(e){return e.kind===be.SYMBOL}function gt(e){return e.kind===be.COMMENT}function bt(e){if(e.kind!==be.IDENTIFIER)return 0;const t=e.value.toLowerCase();return!(T.has(t)||M.has(t)||I.has(t)||P.has(t))}function wt(e){return e.kind===be.STRING}function kt(e){return e.kind===be.NUMBER}function zt(e){if(e.kind===be.IDENTIFIER){const t=e.value;return"true"===t||"false"===t||"null"===t||"undefined"===t}return 0}function xt(e){return e.kind===be.TEMPLATE}function Et(e){return e.kind===be.SELECTOR&&e.value.startsWith("<")}function St(e){return e.kind===be.SELECTOR&&e.value.startsWith("#")}function Tt(e){return e.kind===be.SELECTOR&&e.value.startsWith(".")}function jt(e){return e.kind!==be.SELECTOR?0:!e.value.startsWith("#")&&!e.value.startsWith(".")}function At(e){if(e.kind!==be.OPERATOR)return 0;const t=e.value.toLowerCase();return!R.has(t)&&!$.has(t)}function Lt(e){const t=e.value.toLowerCase();return"then"===t||"and"===t||"else"===t||"end"===t||"on"===t}function Ot(e,t,n){return{type:"literal",value:e,raw:t,start:n.start,end:n.end,line:n.line,column:n.column}}function Ct(e,t){return{type:"identifier",name:e,start:t.start,end:t.end,line:t.line,column:t.column}}function Nt(e,t,n,r){return{type:"binaryExpression",operator:e,left:t,right:n,start:r.start,end:r.end,line:r.line,column:r.column}}function Pt(e,t){return{type:"block",commands:e,start:t.start,end:t.end,line:t.line,column:t.column}}function Rt(e,t){return{type:"string",value:e,start:t.start,end:t.end,line:t.line,column:t.column}}function $t(e,t){return{type:"objectLiteral",properties:e,start:t.start,end:t.end,line:t.line,column:t.column}}function It(e,t){return{type:"arrayLiteral",elements:e,start:t.start,end:t.end,line:t.line,column:t.column}}function Mt(e,t,n){return{type:"propertyOfExpression",property:e,target:t,start:n.start,end:n.end,line:n.line,column:n.column}}function qt(e,t,n){return{type:"command",name:"__ERROR__",args:[],diagnostics:[{message:t,severity:"error",code:"parse-error",line:e.line,column:e.column,...n&&{source:n}}],start:e.start,end:e.end,line:e.line,column:e.column}}it.SKIP_SEMANTIC_COMMANDS=new Set(["swap","morph","js","tell"]);const _t=[{command:"append",keywords:["to"],syntax:"append <value> [to <target>]"},{command:"make",keywords:["a","an"],syntax:"make (a|an) <type>"},{command:"send",keywords:["to"],syntax:"send <event> to <target>"},{command:"throw",keywords:[],syntax:"throw <error>"}];function Dt(e,t){return e?t.some(t=>e.value===t||e.value.toLowerCase()===t):0}const Vt=[a,l,o,s];function Ht(e,t=[]){if(e.isAtEnd())return 1;for(const t of Vt)if(e.check(t))return 1;for(const n of t)if(e.check(n))return 1;return e.checkIsCommand()?1:0}function Ft(e,t=[]){if(!Ht(e,t))return e.parseExpression()}function Bt(e,t,n){return e.check(t)?(e.advance(),n.push(e.createIdentifier(t)),1):0}function Ut(e,t,n){for(const r of t)if(e.check(r))return e.advance(),n.push(e.createIdentifier(r)),r;return null}function Gt(e,t){return e.check(t)?(e.advance(),1):0}function Wt(e){const t=e.savePosition();let n;if(e.checkIdentifierLike()){const r=e.peek().value;e.advance(),e.check(":")?(e.advance(),n=r):e.restorePosition(t)}const r=e.parseExpression();return void 0!==n?{name:n,value:r}:{value:r}}class Kt{constructor(e){this.args=[],this.isBlocking=0,this.name=e}static from(e){const t=new Kt(e.value);return t.startPos={start:e.start??0,end:e.end??0,line:e.line??1,column:e.column??1},t}static fromIdentifier(e){const t=new Kt(e.name);return void 0!==e.start&&(t.startPos={start:e.start,end:e.end??0,line:e.line??1,column:e.column??1}),t}static named(e){return new Kt(e)}withArgs(...e){return this.args.push(...e),this}withBody(e){return this.body=e,this}withImplicitTarget(e){return this.implicitTarget=e,this}withModifier(e,t){return this.modifiers||(this.modifiers={}),this.modifiers[e]=t,this}withModifiers(e){return this.modifiers={...this.modifiers,...e},this}withName(e){return this.name=e,this}withOriginalCommand(e){return this.originalCmd=e,this}blocking(e=1){return this.isBlocking=e,this}startingAt(e){return this.startPos={start:e.start??0,end:e.end??0,line:e.line??1,column:e.column??1},this}endingAt(e){return this.endPos={start:e.start??this.startPos?.start??0,end:e.end,line:e.line??this.startPos?.line??1,column:e.column??this.startPos?.column??1},this}build(){const e={type:"command",name:this.name,args:this.args,isBlocking:this.isBlocking,start:this.startPos?.start??0,end:this.endPos?.end??this.startPos?.end??0,line:this.startPos?.line??1,column:this.startPos?.column??1};return this.body&&(e.body=this.body),this.implicitTarget&&(e.implicitTarget=this.implicitTarget),this.modifiers&&(e.modifiers=this.modifiers),this.originalCmd&&(e.originalCommand=this.originalCmd),e}clone(){const e=new Kt(this.name);return e.args=[...this.args],e.body=this.body?[...this.body]:void 0,e.implicitTarget=this.implicitTarget,e.isBlocking=this.isBlocking,e.modifiers=this.modifiers?{...this.modifiers}:void 0,e.originalCmd=this.originalCmd,e.startPos=this.startPos?{...this.startPos}:void 0,e.endPos=this.endPos?{...this.endPos}:void 0,e}}function Jt(e,t){const n=[];let r="";const i=e.peek().start||0,a=e.peek().line||1,o=e.peek().column||1;if(e.checkIdentifierLike()){for(r=e.advance().value;e.check(":")&&!e.isAtEnd();)e.advance(),r+=":",e.checkIdentifierLike()&&(r+=e.advance().value);if(e.check("(")){e.advance();const t=[];for(;!e.isAtEnd()&&!e.check(")");){const{name:n,value:r}=Wt(e);if(t.push(void 0!==n?{type:"objectLiteral",properties:[{key:{type:"identifier",name:n},value:r}],start:r.start,end:r.end,line:r.line,column:r.column}:r),e.check(","))e.advance();else if(!e.check(")"))break}e.check(")")&&e.advance(),n.push({type:"functionCall",name:r,args:t,start:i,end:e.getPosition().end,line:a,column:o})}else n.push({type:"string",value:r,start:i,end:e.getPosition().end,line:a,column:o})}const s=[...n];for(;!Ht(e);){if(e.check("on")||e.check("to")){const t=e.advance().value;s.push(e.createIdentifier(t));continue}s.push(e.parsePrimary())}return Kt.fromIdentifier(t).withArgs(...s).endingAt(e.getPosition()).build()}function Zt(e,t){const n=[];if(e.check(E)){const t=e.advance();if(n.push({type:"identifier",name:E,start:t.start,end:t.end,line:t.line,column:t.column}),e.check(k)){const t=e.advance();n.push({type:"identifier",name:k,start:t.start,end:t.end,line:t.line,column:t.column})}}return Kt.fromIdentifier(t).withArgs(...n).endingAt(e.getPosition()).build()}function Yt(e,t){const n=[];let r=0;const i=e.savePosition();for(let t=0;500>t&&!e.isAtEnd();t++){const t=e.peek();if(t.value===a){r=1;break}if(t.value===s||t.value===z||"def"===t.value||t.value===w)break;e.advance()}e.restorePosition(i);let l=0;if(!r){const n=e.savePosition(),r=t.line,i=100;for(;!e.isAtEnd()&&i>e.current-n;){const t=e.peek(),n=t.value?.toLowerCase();if(n===z||"def"===n||n===w)break;if(n===o||n===s){t.line===r&&(l=1);break}if((e.checkIsCommand()||e.isCommand(n))&&void 0!==t.line&&t.line!==r){l=1;break}e.advance()}e.restorePosition(n)}const c=r||l;let u;if(c)u=e.parseExpression();else{const n=[],r=20;let i=0;for(;!e.isAtEnd()&&!e.checkIsCommand()&&!e.isCommand(e.peek().value)&&!e.check(a)&&r>i;){const t=e.savePosition();n.push(e.parseLogicalAnd()),e.savePosition()===t&&e.advance(),i++}if(0===n.length)throw Error("Expected condition after if/unless");u=1===n.length?n[0]:{type:"expression",tokens:n,start:n[0].start,end:n[n.length-1].end,line:t.line,column:t.column}}if(n.push(u),c){r&&e.advance();const i=[];for(;!e.isAtEnd()&&!e.check(o)&&!e.check(s)&&(e.checkIsCommand()||e.isCommand(e.peek().value));){e.advance();const t=e.parseCommand();t&&i.push(t)}if(0===i.length&&e.isAtEnd())throw Error("Expected command after 'then' in if statement - incomplete conditional");n.push(Pt(i,{start:t.start,end:e.getPosition().end,line:t.line,column:t.column}));let a=0;if(e.check(o))if(e.advance(),e.check("if")){const t=e.peek();e.advance();const r=Yt(e,t);n.push(Pt([r],{start:t.start,end:e.getPosition().end,line:t.line,column:t.column})),a=1}else{const r=[];for(;!e.isAtEnd()&&!e.check(s)&&(e.checkIsCommand()||e.isCommand(e.peek().value));){e.advance();const t=e.parseCommand();t&&r.push(t)}n.push(Pt(r,{start:t.start,end:e.getPosition().end,line:t.line,column:t.column}))}a||e.consume(s,"Expected 'end' after if block")}else{if(!e.checkIsCommand()&&!e.isCommand(e.peek().value))throw Error("Expected command after if condition in single-line form");{e.advance();const r=e.parseCommand();n.push(Pt([r],{start:t.start,end:e.getPosition().end,line:t.line,column:t.column}))}}return Kt.from(t).withArgs(...n).endingAt(e.getPosition()).build()}function Xt(e,t){const n=[],r={};if(e.checkAnySelector()||e.checkContextVar()||e.match("<")){const t=e.parsePrimary();if(n.push(t),e.match("*")){if(e.checkIdentifierLike()){const t=e.advance();n.push({type:"identifier",name:"*"+t.value,start:t.start-1,end:t.end,line:t.line,column:t.column})}}else if(e.checkIdentifierLike()){const t=e.parsePrimary();n.push(t)}}else if(e.checkIdentifierLike()){const t=e.parsePrimary();n.push(t)}if(e.match("and")&&e.match("set")&&e.checkIdentifierLike()){const t=e.advance();r.set={type:"identifier",name:t.value,start:t.start,end:t.end,line:t.line,column:t.column}}const i=Kt.fromIdentifier(t).withArgs(...n).endingAt(e.getPosition());return Object.keys(r).length>0&&i.withModifiers(r),i.build()}function Qt(e,t){const n=[],r=Ft(e,[v]);r&&n.push(r),Bt(e,v,n);const i=Ft(e);return i&&n.push(i),Kt.fromIdentifier(t).withArgs(...n).endingAt(e.getPosition()).build()}function en(e,t){const n=[];if(e.check("between")){e.advance(),n.push(e.createIdentifier("between"));const r=Ft(e,[l]);r&&n.push(r),Bt(e,l,n);const i=Ft(e,[v,w,c]);if(i&&n.push(i),Ut(e,[v,w],n)){const t=Ft(e);t&&n.push(t)}return Kt.fromIdentifier(t).withArgs(...n).endingAt(e.getPosition()).build()}const r=Ft(e,[v,w]);if(r&&n.push(r),Ut(e,[v,w],n)){const t=Ft(e);t&&n.push(t)}return Kt.fromIdentifier(t).withArgs(...n).endingAt(e.getPosition()).build()}function tn(e,t){const n=e.parseExpression();if(!n)return e.addError("Put command requires content expression"),null;const r=e.peek();if(!r||!O.includes(r.value))return e.addError(`Expected operation keyword (${O.join(", ")}) after put expression, got: ${r?.value}`),null;let i=e.advance().value;const a=i.toLowerCase();"at start of"===a||"at the start of"===a?i=A:"at end of"===a||"at the end of"===a?i=L:"at"===i&&(e.check(S)||e.check(E)?(Gt(e,E),e.check(S)&&(e.advance(),e.check(b)&&(e.advance(),i=A))):e.check(s)&&(e.advance(),e.check(b)&&(e.advance(),i=L)));const o=e.parseExpression();return o?Kt.fromIdentifier(t).withArgs(n,e.createIdentifier(i),o).endingAt(e.getPosition()).build():(e.addError("Put command requires target expression after operation keyword"),null)}const nn=["innerhtml","outerhtml","into","over","delete","morph","morphouter"];function rn(e,t){const n=e.savePosition();let r=null,i=[];try{r=function(e){if(!e.check(":"))return null;if(e.advance(),e.check(":")){e.advance();const t=e.advance();return{type:"identifier",name:t.value,scope:"global",start:t.start-2,end:t.end}}const t=e.advance();return{type:"identifier",name:t.value,scope:"local",start:t.start-1,end:t.end}}(e)??function(e){if(!e.check(x)&&!e.check("local"))return null;const t=e.advance(),n=e.advance();return{type:"identifier",name:n.value,scope:t.value,start:t.start,end:n.end}}(e)??function(e){if(!e.check(E))return null;const t=e.savePosition();e.advance();const n=e.parseExpression();if(!n)return e.restorePosition(t),null;if("binaryExpression"===n.type&&n.operator===b){const e=n.left,t=n.right;return Mt(e,t,{start:e.start??0,end:t.end??0,line:e.line??1,column:e.column??1})}return e.check(h)?n:(e.restorePosition(t),null)}(e),r||(r=e.parseExpression())}catch{e.restorePosition(n),r=null}if(!r){const t=function(e){if(e.match(":")){const t=e.advance();return{expression:{type:"identifier",name:t.value,scope:"local",start:t.start,end:t.end},tokens:[]}}const t=[];for(;!(e.isAtEnd()||e.check(h)||e.check(a)||e.check(l)||e.check(o)||e.check(s));)t.push(e.parsePrimary());if(0===t.length)return{expression:null,tokens:[]};if(t.length>=4){const e=(e,t)=>e[t];if(e(t[0],"value")===E&&e(t[2],"value")===b){const n=t[1],r=t[3];return{expression:Mt(Ct(e(n,"value")||e(n,"name")||"",{start:n.start??0,end:n.end??0,line:n.line??1,column:n.column??1}),{type:"idSelector"===r.type?"idSelector":"cssSelector",value:e(r,"value")||e(r,"name")||"",start:r.start??0,end:r.end??0,line:r.line,column:r.column},{start:t[0].start??0,end:r.end??0,line:t[0].line??1,column:t[0].column??1}),tokens:[]}}}return 1===t.length?{expression:t[0],tokens:[]}:{expression:null,tokens:t}}(e);r=t.expression,i=t.tokens}if(!e.check(h)){const t=e.isAtEnd()?"end of input":e.peek().value;throw Error("Expected 'to' in set command, found: "+t)}e.advance();const c=e.parseExpression()??e.parsePrimary(),u=[];return r?u.push(r):i.length>0&&u.push(...i),u.push(e.createIdentifier(h)),c&&u.push(c),Kt.fromIdentifier(t).withArgs(...u).endingAt(e.getPosition()).build()}function an(e,t){const n=[];for(;!Ht(e,["catch","finally"])&&(e.checkIdentifierLike()||e.checkSelector()||e.checkLiteral()||e.checkTimeExpression()||e.match("<"));)n.push(e.parsePrimary());return Kt.fromIdentifier(t).withArgs(...n).endingAt(e.getPosition()).build()}function on(e){if(e.isAtEnd())return 1;const t=e.peek().value;return["as","with","{","then","end","else","otherwise",")"].includes(t)||Ht(e)}function sn(e){if(e.check("{"))return 0;if(!e.checkIdentifierLike())return 0;const t=e.peekAt(1);return null!==t&&":"===t.value}function ln(e){const t=[],n=e.getPosition();do{if(!e.checkIdentifierLike())break;const n=e.advance(),r={type:"identifier",name:n.value,start:n.start,end:n.end,line:n.line,column:n.column};e.consume(":","Expected ':' after property name in fetch named arguments");const i=e.parsePrimary();i&&t.push({key:r,value:i})}while(e.match(",")&&!e.isAtEnd());const r=e.getPosition();return{type:"objectLiteral",properties:t,start:n.start,end:r.end,line:n.line,column:n.column}}class cn{constructor(e,t,n){this.current=0,this.errors=[],this.warnings=[],this.prattCache=new Map,this.tokens=e,this.keywordResolver=t?.keywords,this.registryIntegration=t?.registryIntegration,t?.semanticAnalyzer&&t?.language&&(this.semanticAdapter=new it({analyzer:t.semanticAnalyzer,language:t.language,confidenceThreshold:t.semanticConfidenceThreshold??.5})),this.originalInput=n||e.map(e=>e.value).join(" ")}resolveKeyword(e){return this.keywordResolver?this.keywordResolver.resolve(e)??e:e}addWarning(e){this.warnings.push(e)}parse(){this.prattCache.clear();const e=this.parseInternal();return this.errors.length>0&&(e.errors=[...this.errors]),e}parseInternal(){try{if(0===this.tokens.length)return this.addError("Cannot parse empty input"),{success:0,node:this.createErrorNode(),tokens:this.tokens,error:this.error,warnings:this.warnings};if(this.check("behavior")){const e=[];for(;this.check("behavior");){this.advance();const t=this.parseBehaviorDefinition();if(t&&e.push(t),this.error)break}return this.error?{success:0,node:1===e.length?e[0]:this.createProgramNode(e),tokens:this.tokens,error:this.error,warnings:this.warnings}:{success:1,node:1===e.length?e[0]:this.createProgramNode(e),tokens:this.tokens,warnings:this.warnings}}const e=this.peek(),t=e&&X(e.value)?e.value:null;if(this.check("init")||this.check("on")||this.check("def")||this.checkComment()||null!==t){const e=[];for(;!this.isAtEnd();)if(this.checkComment())this.advance();else if(this.check("init")){this.advance();const t=this.parseTopLevelInitBlock();t&&e.push(t)}else if(this.check("on")){this.advance();const t=this.parseEventHandler();t&&e.push(t)}else{if(!this.check("def")){const t=this.peek(),n=t?X(t.value):void 0;if(n){const t=this.advance(),r=n(this.getContext(),t);r&&e.push(r);continue}break}{this.advance();const t=this.parseDefFeature();t&&e.push(t)}}return this.isAtEnd()?this.error?{success:0,node:this.createProgramNode(e),tokens:this.tokens,error:this.error,warnings:this.warnings}:{success:1,node:this.createProgramNode(e),tokens:this.tokens,warnings:this.warnings}:(this.addError("Unexpected token: "+this.peek().value),{success:0,node:this.createProgramNode(e),tokens:this.tokens,error:this.error,warnings:this.warnings})}if(this.checkIsCommand()||this.isCommand(this.peek().value)&&!this.isKeyword(this.peek().value)){const e=this.parseCommandSequence();if(e){if(!this.isAtEnd()&&this.check("on")){Ye.parse("✅ PARSER: Found event handlers after command sequence, parsing as program");const t=[e];Ye.parse(`✅ PARSER: Starting with ${t.length} statement(s) from command sequence`);let n=0;for(;!this.isAtEnd()&&this.check("on");){Ye.parse(`✅ PARSER: Parsing event handler #${n+1}, current token: ${this.peek().value}`),this.advance();const e=this.parseEventHandler();if(Ye.parse("✅ PARSER: parseEventHandler returned:",e?`type=${e.type}, event=${e.event}`:"null"),e&&(t.push(e),n++,Ye.parse(`✅ PARSER: Added event handler, now have ${t.length} statements total`)),Ye.parse(`✅ PARSER: After parsing event handler, current token: ${this.isAtEnd()?"END":this.peek().value}, isAtEnd=${this.isAtEnd()}, check('on')=${this.check("on")}`),!this.isAtEnd()&&!this.check("on")){if(!this.isAtEnd())return Ye.parse("⚠️ PARSER: Unexpected token after event handlers: "+this.peek().value),this.addError("Unexpected token after event handlers: "+this.peek().value),{success:0,node:this.createProgramNode(t),tokens:this.tokens,error:this.error};Ye.parse("✅ PARSER: No more event handlers, at end of input");break}}return Ye.parse(`✅ PARSER: Finished parsing, creating Program node with ${t.length} statements`),this.error?{success:0,node:this.createProgramNode(t),tokens:this.tokens,error:this.error,warnings:this.warnings}:{success:1,node:this.createProgramNode(t),tokens:this.tokens,warnings:this.warnings}}return this.isAtEnd()?this.error?{success:0,node:e,tokens:this.tokens,error:this.error,warnings:this.warnings}:{success:1,node:e,tokens:this.tokens,warnings:this.warnings}:(this.addError("Unexpected token: "+this.peek().value),{success:0,node:e||this.createErrorNode(),tokens:this.tokens,error:this.error})}}const n=this.parseExpression();if(this.error)return{success:0,node:n||this.createErrorNode(),tokens:this.tokens,error:this.error};if(!this.isAtEnd()){const e=this.peek();return n&&["number","string","identifier"].includes(e.kind)?this.addError(`Unexpected token: ${e.value} (missing operator between values? expected one of +, -, *, /, etc.)`):this.addError("Unexpected token: "+e.value),{success:0,node:n||this.createErrorNode(),tokens:this.tokens,error:this.error,warnings:this.warnings}}return{success:1,node:n,tokens:this.tokens,warnings:this.warnings}}catch(e){return this.addError(e instanceof Error?e.message:"Unknown parsing error"),{success:0,node:this.createErrorNode(),tokens:this.tokens,error:this.error,warnings:this.warnings}}}parseExpression(){return this.parseExpressionPratt(0)}parseExpressionPratt(e){const t=`${this.current}:${e}`,n=this.prattCache.get(t);if(n)return this.current=n.endPos,n.node;if(this.isAtEnd())return this.addError("Unexpected end of expression"),this.createErrorNode();const r=this.peek(),i=cn.PRATT_TABLE.get(r.value);let a;if(i?.prefix){const e=this.advance();if(this.isAtEnd())return this.addError(`Expected expression after '${e.value}' operator`),this.createErrorNode();a=i.prefix.handler(e,this.makePrattContext())}else a=this.parseCall();for(;!this.isAtEnd();){const t=this.peek(),n=cn.PRATT_TABLE.get(t.value);if(!n?.infix){if(q.has(t.value)||_.has(t.value))break;break}const[r]=n.infix.bp;if(e>r)break;if("="===t.value&&this.tokens.length>this.current+1&&">"===this.tokens[this.current+1].value){if(this.advance(),this.advance(),this.addError('Arrow functions (=>) are not supported in hyperscript. Use "js ... end" blocks for JavaScript callbacks.'),!this.isAtEnd())try{this.parseExpressionPratt(0)}catch(e){Ye.parse("arrow body discarded after error:",e instanceof Error?e.message:e+"")}return this.createErrorNode()}if("+"===t.value||"-"===t.value){const e=this.tokens.length>this.current+1?this.tokens[this.current+1]:null;if(e&&("+"===e.value||"-"===e.value))return this.addError(`Invalid operator combination: ${t.value}${e.value}`),a}if("*"===t.value||"/"===t.value||"%"===t.value){const e=this.tokens.length>this.current+1?this.tokens[this.current+1]:null;if(e&&("*"===e.value||"/"===e.value||"%"===e.value||"+"===e.value||"-"===e.value))return this.addError("*"===t.value&&"*"===e.value?"Unexpected token: "+e.value:`Invalid operator combination: ${t.value}${e.value}`),a}const i=this.advance();if(this.isAtEnd()&&!cn.POSTFIX_UNARY_OPERATORS.has(i.value))return this.addError(`Expected expression after '${i.value}' operator`),a;a=n.infix.handler(a,i,this.makePrattContext())}return this.prattCache.set(t,{node:a,endPos:this.current}),a}makePrattContext(){const e=this;return{peek:()=>e.tokens.length>e.current?e.tokens[e.current]:void 0,advance:()=>{const t=e.tokens[e.current];return e.current++,t},parseExpr:t=>e.parseExpressionPratt(t),isStopToken:()=>{const t=e.tokens[e.current];return t?q.has(t.value)||_.has(t.value):1},atEnd:()=>e.current>=e.tokens.length}}parseLogicalAnd(){return this.parseExpressionPratt(11)}parseImplicitBinary(){let e=this.parseCall();for(;!(this.isAtEnd()||this.checkBasicOperator()||this.check("then")||this.check("and")||this.check("else")||this.check(")")||this.check("]")||this.check(","));){if("identifier"!==e.type){if("literal"===e.type&&(this.checkNumber()||this.checkIdentifier())){const t=this.peek();return this.addError(`Missing operator between '${e.raw||e.value}' and '${t.value}'`),e}break}if(this.isCommand(e.name))if(this.isCompoundCommand(e.name.toLowerCase())){if(!(this.checkCssSelector()||this.checkIdSelector()||this.checkClassSelector()||this.checkTimeExpression()||this.checkString()||this.checkNumber()||this.checkContextVar()||this.checkIdentifier()||this.checkKeyword()))break;{const t=this.createCommandFromIdentifier(e);t&&(e=t)}}else if("wait"===e.name.toLowerCase()&&(this.checkTimeExpression()||this.checkNumber()||this.checkIdentifier()||this.checkContextVar()||this.check("("))){const t=this.createCommandFromIdentifier(e);t&&(e=t)}else{if(!this.checkSelector())break;{const t=this.parseCall();e=this.createBinaryExpression(" ",e,t)}}else{if(!this.checkSelector())break;{const t=this.parseCall();e=this.createBinaryExpression(" ",e,t)}}}return e}isCommand(e){return this.keywordResolver?this.keywordResolver.isCommand(e):(e=>T.has(e.toLowerCase()))(e)}isKeyword(e){return this.keywordResolver?this.keywordResolver.isKeyword(e):(e=>C.has(e.toLowerCase()))(e)}createCommandFromIdentifier(e){const t=[],n=this.resolveKeyword(e.name.toLowerCase());if(this.isCompoundCommand(n))return this.parseCompoundCommand(e);for(;!(this.isAtEnd()||this.check("then")||this.check("and")||this.check("else")||this.checkIsCommand())&&(this.checkContextVar()||this.checkIdentifier()||this.checkKeyword()||this.checkEvent()||this.checkCssSelector()||this.checkIdSelector()||this.checkClassSelector()||this.checkString()||this.checkNumber()||this.checkTimeExpression()||this.match("<"));)t.push(this.parsePrimary());return{type:"command",name:e.name,args:t,isBlocking:0,...void 0!==e.start&&{start:e.start},end:this.getPosition().end,...void 0!==e.line&&{line:e.line},...void 0!==e.column&&{column:e.column}}}isCompoundCommand(e){return j.has(e.toLowerCase())}parseCompoundCommand(e){return function(e,t){switch(t.name.toLowerCase()){case"put":return tn(e,t);case"trigger":case"send":return Jt(e,t);case"remove":return Qt(e,t);case"toggle":return en(e,t);case"set":return rn(e,t);case"halt":return Zt(e,t);case"measure":return Xt(e,t);case"js":return function(e,t){const n=[];if(e.match("(")){for(;!e.check(")")&&!e.isAtEnd();)e.checkIdentifierLike()&&n.push(e.advance().value),e.match(",");e.consume(")","Expected ) after js parameters")}const r=e.peek().start,i=function(e,t){const n=e.getInputSlice(t);if(!n)return t;let r=0;for(;n.length>r;){const e=n[r];if("'"!==e&&"’"!==e&&"‘"!==e)if('"'!==e)if("`"!==e)if("/"===e&&n.length>r+1&&"/"===n[r+1])for(r+=2;n.length>r&&"\n"!==n[r];)r++;else if("/"===e&&n.length>r+1&&"*"===n[r+1]){for(r+=2;n.length>r&&("*"!==n[r]||r+1>=n.length||"/"!==n[r+1]);)r++;r+=2}else{if(!("e"!==e&&"E"!==e||r+3>n.length||"end"!==n.slice(r,r+3).toLowerCase()||0!==r&&/[a-zA-Z0-9_]/.test(n[r-1])||n.length>r+3&&/[a-zA-Z0-9_]/.test(n[r+3])))return t+r;r++}else{for(r++;n.length>r&&"`"!==n[r];)"\\"===n[r]&&r++,r++;r++}else{for(r++;n.length>r&&'"'!==n[r];)"\\"===n[r]&&r++,r++;r++}else{for(r++;n.length>r&&n[r]!==e;)"\\"===n[r]&&r++,r++;r++}}return t+n.length}(e,r);for(;!e.isAtEnd()&&!e.check(s)&&e.peek().start<i;)e.advance();e.consume(s,"Expected end after js code body");const a={type:"literal",value:e.getInputSlice(r,i).trim(),start:t.start,end:e.getPosition().end},o={type:"arrayLiteral",elements:n.map(e=>({type:"literal",value:e,start:t.start,end:t.end})),start:t.start,end:e.getPosition().end};return Kt.fromIdentifier(t).withArgs(a,o).endingAt(e.getPosition()).build()}(e,t);case"tell":return function(e,t){const n=e.parseExpression();if(!n)throw Error("tell command requires a target expression");const r=[];for(;!e.isAtEnd();){if(e.checkIsCommand()){try{e.advance();const t=e.parseCommand();if(!t)break;r.push(t)}catch{break}if(e.match(l))continue;if(e.check(a)||e.check(o)||e.check(s))break;if(e.checkIsCommand())continue;break}break}if(0===r.length)throw Error("tell command requires at least one command after the target");return Kt.fromIdentifier(t).withArgs(n,...r).endingAt(e.getPosition()).build()}(e,t);case"pick":return function(e,t){const n=Kt.fromIdentifier(t);Gt(e,E);const r=e.peek().value,i=e=>({type:"literal",value:e,start:t.start,end:t.end}),a=()=>{if(!e.match("of","from"))throw Error("pick: expected 'of' or 'from' before source expression");return e.parseExpression()};if("first"===r){e.advance();const t=e.parsePrimary(),r=a();return n.withArgs(r).withModifier("variant",i("first")).withModifier("count",t).endingAt(e.getPosition()).build()}if("last"===r){e.advance();const t=e.parsePrimary(),r=a();return n.withArgs(r).withModifier("variant",i("last")).withModifier("count",t).endingAt(e.getPosition()).build()}if("random"===r){let t;e.advance(),e.check("of")||e.check("from")||(t=e.parsePrimary());const r=a(),o=n.withArgs(r).withModifier("variant",i("random"));return t&&o.withModifier("count",t),o.endingAt(e.getPosition()).build()}if("item"===r||"items"===r||"character"===r||"characters"===r){let t,r;e.advance(),e.match("at","from"),t=e.match("start")?i("start"):e.parsePrimary();let o=0;(e.match("to")||e.match(".."))&&(e.match("end")?o=1:r=e.parsePrimary());let s="default";e.match("inclusive")?s="inclusive":e.match("exclusive")&&(s="exclusive");const l=a(),c=n.withArgs(l).withModifier("variant",i("range")).withModifier("rangeStart",t).withModifier("rangeMode",i(s));return o?c.withModifier("rangeEnd",i("end")):r&&c.withModifier("rangeEnd",r),c.endingAt(e.getPosition()).build()}if("match"===r||"matches"===r){e.advance(),e.match("of");const t=e.parsePrimary();let o;e.matchOperator("|")&&(o=e.advance().value);const s=a(),l=n.withArgs(s).withModifier("variant",i("match"===r?"match":"matches")).withModifier("regex",t);return o&&l.withModifier("flags",i(o)),l.endingAt(e.getPosition()).build()}return an(e,t)}(e,t);case"start":return function(e,t){if(!e.match("view"))throw Error("start: expected 'view transition' (only `start view transition ... end` is supported)");if(!e.match("transition"))throw Error("start view: expected 'transition'");const n={};if(e.match("using")){const t=e.parsePrimary();n.transitionName=t}const r=e.parseCommandListUntilEnd();return Kt.fromIdentifier(t).withArgs(...r).withModifiers(n).endingAt(e.getPosition()).build()}(e,t);case"swap":case"morph":return function(e,t){const n=[];let r=null;if(!e.isAtEnd()){const t=e.peek();if(t&&t.value){const i=t.value.toLowerCase();nn.includes(i)&&(r=i,e.advance(),n.push(e.createIdentifier(r)))}}if("delete"===r){const r=e.parseExpression();return r&&n.push(r),Kt.fromIdentifier(t).withArgs(...n).endingAt(e.getPosition()).build()}!e.isAtEnd()&&e.check(b)&&(e.advance(),n.push(e.createIdentifier("of")));const i=e.parseExpression();if(i&&n.push(i),!e.isAtEnd()&&e.check(g)){e.advance(),n.push(e.createIdentifier("with"));const t=e.parseExpression();t&&n.push(t)}return Kt.fromIdentifier(t).withArgs(...n).endingAt(e.getPosition()).build()}(e,t);default:return an(e,t)}}(this.getContext(),e)}parsePutCommand(e){return tn(this.getContext(),e)}parseSetCommand(e){return rn(this.getContext(),e)}parseHaltCommand(e){return Zt(this.getContext(),e)}parseMeasureCommand(e){return Xt(this.getContext(),e)}parseTriggerCommand(e){return Jt(this.getContext(),e)}parseCommandListUntilTerminator(e){const t=[],n=()=>this.check("end")||e.some(e=>this.check(e));for(Ye.parse("🔄 parseCommandListUntilTerminator: Starting (extraStops:",e.join(","),")");!this.isAtEnd()&&!n();){Ye.parse("📍 Loop iteration, current token:",this.peek().value,"kind:",this.peek().kind);let e=0;const r=this.checkIsCommand(),i=!r&&this.checkIdentifier()&&this.isCommand(this.peek().value);if(r||i){Ye.parse(r?"✅ Found COMMAND token:":"✅ Found IDENTIFIER that is a command:",this.peek().value),this.advance();const n=this.error;try{const r=this.parseCommand();this.error&&this.error!==n&&(Ye.parse("⚠️ parseCommandListUntilTerminator: Command parsing added error, restoring. Error was:",this.error.message),this.error=n),r&&(Ye.parse("✅ Parsed command:",r.name),t.push(r),e=1)}catch(e){Ye.parse("⚠️ parseCommandListUntilTerminator: Command parsing threw, restoring:",e instanceof Error?e.message:e+""),this.error=n}}else this.checkIdentifier()&&Ye.parse("❌ IDENTIFIER is not a command:",this.peek().value);if(!e){Ye.parse("❌ No command parsed, breaking. Current token:",this.peek().value);break}for(Ye.parse("📍 After parsing command, current token:",this.peek().value);!(this.isAtEnd()||n()||this.checkIsCommand()||this.isCommand(this.peek().value)||this.check("then")||this.check("and")||this.check(","));)Ye.parse("⚠️ Skipping unexpected token:",this.peek().value),this.advance();if(this.match("then","and",","))Ye.parse("✅ Found separator, continuing");else{if(!this.checkIsCommand()&&!this.isCommand(this.peek().value)){Ye.parse("📍 No separator and no command, breaking. Current token:",this.peek().value);break}Ye.parse("✅ Next token is a command, continuing without separator")}}let r="end";for(const t of e)if(this.check(t)){r=t;break}return this.check("end")||e.some(e=>this.check(e))||(r=""),Ye.parse("✅ parseCommandListUntilTerminator: parsed",t.length,"commands (terminator:",r,")"),{commands:t,terminator:r}}parseCommandListUntilEnd(){const{commands:e}=this.parseCommandListUntilTerminator([]);if(Ye.parse('🔍 After loop, checking for "end". Current token:',this.peek().value),!this.check("end"))throw Ye.parse('❌ ERROR: Expected "end" but got:',this.peek().value,"at position:",this.peek().start),Error('Expected "end" to close repeat block');return Ye.parse('✅ Found "end", consuming it'),this.advance(),e}parseCommandListUntilEndOrElse(){const{commands:e,terminator:t}=this.parseCommandListUntilTerminator(["else"]),n="else"===t;if(!n){if(!this.check("end"))throw Error('Expected "end" to close repeat block');this.advance()}return{commands:e,hasElse:n}}parseRepeatBody(){const{commands:e,terminator:t}=this.parseCommandListUntilTerminator(["else","until","while"]);if("end"===t)this.advance();else if(""===t)throw Error('Expected "end", "else", "until", or "while" to close repeat block');return{commands:e,terminator:t}}parseRepeatCommand(e){return function(e,t){const n=[];let r="forever",i=null,a=null,o=null,s=null,l=null,h=null;if(e.check(c)){e.advance(),r=c;const t=e.peek();pt(t)&&(l=t.value,e.advance()),e.check(y)&&(e.advance(),s=e.parseExpression())}else if(e.check(y))e.advance(),r=c,l="it",s=e.parseExpression();else if(e.check(u))e.advance(),r=u,o=e.parseExpression();else if(e.check(p))if(e.advance(),r=p,e.check(k)){e.advance(),r="until-event";const t=e.peek();if(Ye.parse("📍 Parsing event name, current token:",{value:t.value,kind:t.kind}),!pt(t)&&!lt(t))throw Error('Expected event name after "event"');if(i=t.value,e.advance(),Ye.parse("✅ Got event name:",i,"Next token:",e.peek().value),Ye.parse('🔍 Checking for "from", current token:',e.peek().value),e.check(v)){Ye.parse('✅ Found "from", advancing...'),e.advance(),Ye.parse('📍 After consuming "from", current token:',e.peek().value),Gt(e,E)&&Ye.parse('✅ Found "the", advancing...');const t=e.peek();Ye.parse("🔍 Before parsePrimary for event target:",{value:t.value,kind:t.kind,position:t.start}),a=e.parsePrimary(),Ye.parse("✅ After parsePrimary, eventTarget:",a)}else Ye.parse('❌ No "from" found, skipping target parsing')}else o=e.parseExpression();else e.check(m)?(e.advance(),r=m):(h=e.parseExpression(),e.check(d)&&(e.advance(),r=d));let b,w=null;if(e.check(g)){const t=e.peekAt(1);t&&t.value.toLowerCase()===f&&(e.advance(),e.advance(),w=f)}else if(e.check(f)){e.advance();const t=e.peek();pt(t)?(w=t.value,e.advance()):w=f}let z=null,x=0;if(r===m){const t=e.parseRepeatBody();if(b=t.commands,"else"===t.terminator)e.advance(),z=e.parseCommandListUntilEnd();else if("until"===t.terminator||"while"===t.terminator){if(x=1,r=t.terminator,e.advance(),o=e.parseExpression(),!e.check("end"))throw Error('Expected "end" to close repeat block');e.advance()}}else{const t=e.parseCommandListUntilEndOrElse();b=t.commands,t.hasElse&&(e.advance(),z=e.parseCommandListUntilEnd())}n.push({type:"identifier",name:r,start:t.start,end:t.end,line:t.line,column:t.column});const S={start:t.start,end:t.end,line:t.line,column:t.column};l&&n.push(Rt(l,S)),s&&n.push(s),o&&n.push(o),h&&n.push(h),i&&n.push(Rt(i,S)),a&&n.push(a),w&&n.push(Rt(w,S)),n.push(Pt(b,{...S,end:S.end||0})),null!==z&&n.push(Pt(z,{...S,end:S.end||0}));const T=Kt.from(t).withArgs(...n);return x&&T.withModifier("bottomTested",{type:"literal",value:1,...S}),T.endingAt(e.getPosition()).build()}(this.getContext(),e)}parseForCommand(e){return function(e,t){const n=[];let r=null,i=null;e.check("each")&&e.advance();const a=e.peek();if(!pt(a))throw Error('Expected variable name after "for"');if(r=a.value,e.advance(),!e.check(y))throw Error('Expected "in" after variable name in for loop');if(e.advance(),i=e.parseExpression(),!i)throw Error('Expected collection expression after "in"');let o=null;if(e.check(g)){const t=e.peekAt(1);t&&t.value.toLowerCase()===f&&(e.advance(),e.advance(),o=f)}else if(e.check(f)){e.advance();const t=e.peek();pt(t)?(o=t.value,e.advance()):o=f}const s=e.parseCommandListUntilEnd();n.push({type:"identifier",name:"for",start:t.start,end:t.end,line:t.line,column:t.column});const l={start:t.start,end:t.end,line:t.line,column:t.column};return n.push(Rt(r,l)),n.push(i),o&&n.push(Rt(o,l)),n.push(Pt(s,{...l,end:l.end||0})),Kt.from({...t,value:"repeat"}).withArgs(...n).endingAt(e.getPosition()).build()}(this.getContext(),e)}parseWaitCommand(e){return function(e,t){const n=[];if(e.checkTimeExpression()||e.checkLiteral()||e.checkContextVar()||e.check("(")||e.checkIdentifierLike()&&!e.check("for")&&!Ht(e)){const r=e.parseExpression();return n.push(r),Kt.from(t).withArgs(...n).blocking().endingAt(e.getPosition()).build()}if(e.check("for")){e.advance();const r=[];do{const t=e.peek();if(!pt(t))throw Error('Expected event name after "for"');const n=t.value;e.advance();const i=[];if(e.check("(")){for(e.advance();!e.isAtEnd()&&!e.check(")");){const t=e.peek();if(!pt(t))break;i.push(t.value),e.advance(),e.check(",")&&e.advance()}if(!e.check(")"))throw Error('Expected ")" after event parameters');e.advance()}if(r.push({name:n,params:i}),!e.check("or"))break;e.advance()}while(!e.isAtEnd());let i=null;e.check(v)&&(e.advance(),Gt(e,E),i=e.parsePrimary());const a={start:t.start,end:e.getPosition().end,line:t.line,column:t.column};n.push(It(r.map(e=>$t([{key:Ct("name",a),value:Ot(e.name,`"${e.name}"`,a)},{key:Ct("args",a),value:It(e.params.map(e=>Ot(e,`"${e}"`,a)),a)}],a)),a)),i&&n.push(i)}return Kt.from(t).withArgs(...n).blocking().endingAt(e.getPosition()).build()}(this.getContext(),e)}parseInstallCommand(e){return function(e,t){const n=[];if(!e.checkIdentifierLike())throw Error('Expected behavior name after "install"');const r=e.advance().value,i=e.previous();if(n.push(Ct(r,{start:i.start,end:i.end,line:i.line,column:i.column})),e.check("(")){e.advance();const r=[];for(;!e.isAtEnd()&&!e.check(")");)if(r.push(Wt(e)),e.check(","))e.advance();else if(!e.check(")"))break;if(!e.check(")"))throw Error('Expected ")" after behavior parameters');if(e.advance(),r.length>0){const i={start:t.start,end:e.getPosition().end,line:t.line,column:t.column};n.push($t(r.map(e=>({key:e.name?Ct(e.name,i):Ot("_positional","_positional",i),value:e.value})),i))}}return Kt.from(t).withArgs(...n).endingAt(e.getPosition()).build()}(this.getContext(),e)}parseTransitionCommand(e){return function(e,t){const n=[],r={};let i=null;const a=e.peek();if(pt(a)||"*"===a.value){let t="";e.check("*")&&(t="*",e.advance());const n=function(e){if(!e.checkIdentifierLike())return"";let t=e.advance().value;for(;e.check("-")&&!e.isAtEnd();)t+="-",e.advance(),e.checkIdentifierLike()&&(t+=e.advance().value);return t}(e);n&&(t+=n,i={type:"string",value:t,start:a.start||0,end:e.getPosition().end,line:a.line,column:a.column})}if(!i)throw Error("Transition command requires a CSS property");if(n.push(i),!e.check(h))throw Error('Expected "to" keyword after property in transition command');e.advance();const o=e.parsePrimary();if(r.to=o,e.check("over")){e.advance();const t=e.parsePrimary();r.over=t}if(e.check(g)){e.advance();const t=e.parsePrimary();r.with=t}return Kt.from(t).withArgs(...n).withModifiers(r).endingAt(e.getPosition()).build()}(this.getContext(),e)}parseAddCommand(e){return function(e,t){const n=[];if(e.match("{"))n.push(e.parseCSSObjectLiteral());else{const t=Ft(e,[h]);t&&n.push(t)}if(e.check(h)){e.advance();const t=Ft(e);t&&n.push(t)}return Kt.from(t).withArgs(...n).endingAt(e.getPosition()).build()}(this.getContext(),e)}parseIfCommand(e){return Yt(this.getContext(),e)}parseRemoveCommand(e){return Qt(this.getContext(),e)}parseToggleCommand(e){return en(this.getContext(),e)}parseRegularCommand(e){return an(this.getContext(),e)}parseCall(){let e=this.parsePrimary();for(;;)if(this.match("("))e=this.finishCall(e);else if(this.match(".")){const t=this.consumeIdentifierLike("Expected property name after '.' - malformed member access");e=this.createMemberExpression(e,this.createIdentifier(t.value),0)}else if(this.match("?.")){const t=this.consumeIdentifierLike("Expected property name after '?.' - malformed optional access"),n=this.createMemberExpression(e,this.createIdentifier(t.value),0);n.optional=1,e=n}else if(this.match("[")){const t=this.parseExpression();this.consume("]","Expected ']' after array index"),e=this.createMemberExpression(e,t,1)}else{if(!this.check("'s"))break;{let t;this.advance(),this.check("*")?(this.advance(),t="*"+this.consumeIdentifier("Expected property name after * in CSS property syntax").value):t=vt(this.peek())&&this.peek().value.startsWith("@")?this.advance().value:this.consumeIdentifier("Expected property name after possessive").value,e=this.createPossessiveExpression(e,this.createIdentifier(t))}}return e}parsePrimary(){if(this.check("*")){const e=this.current;if(this.advance(),!this.isAtEnd()&&pt(this.peek())){const e=this.advance().value;return this.createSelector("*"+e)}this.current=e}if(this.check("*")||this.check("/")||this.check("%")||this.check("mod")){const e=this.peek();return this.addError(`Binary operator '${e.value}' requires a left operand`),this.createErrorNode()}if(this.matchNumber()){const e=parseFloat(this.previous().value);return this.createLiteral(e,this.previous().value)}if(this.matchString()){const e=this.previous().value;if(2>e.length||e.startsWith('"')&&!e.endsWith('"')||e.startsWith("'")&&!e.endsWith("'"))return this.addError("Unclosed string literal - string not properly closed"),this.createErrorNode();const t=e.slice(1,-1),n=this.processEscapeSequences(t);return this.createLiteral(n,e)}if(this.matchTemplateLiteral()){const e=this.previous();return{type:"templateLiteral",value:e.value,start:e.start||0,end:e.end||0,line:e.line,column:e.column}}if(this.matchBoolean()){const e=this.previous().value;let t;switch(e){case"true":t=1;break;case"false":t=0;break;case"null":t=null;break;case"undefined":t=void 0;break;default:t="true"===e}return this.createLiteral(t,e)}if(this.matchTimeExpression()){const e=this.previous().value;return this.createLiteral(e,e)}if(this.matchQueryReference()){const e=this.previous().value.slice(1,-2).trim(),t=this.createSelector(e);return t.fromQuery=1,t}if(this.matchSelector())return this.createSelector(this.previous().value);if(this.match("<"))return this.parseHyperscriptSelector();if(this.match("(")){if(this.isAtEnd())return this.addError("Expected expression inside parentheses"),this.createErrorNode();const e=this.parseExpression();return this.consume(")","Expected closing parenthesis ')' after expression - unclosed parentheses"),e}if(this.match("{"))return this.parseObjectLiteral();if(this.match("["))return this.parseAttributeOrArrayLiteral();if(this.check(":")){if(this.advance(),this.check(":")){this.advance();const e=this.advance();return{type:"identifier",name:e.value,scope:"global",start:e.start-2,end:e.end,line:e.line,column:e.column}}{const e=this.advance();return{type:"identifier",name:e.value,scope:"local",start:e.start-1,end:e.end,line:e.line,column:e.column}}}if(this.matchBasicOperator()){const e=this.previous();return this.createIdentifier(e.value)}const e=this.peek();if((!e||"end"!==e.value&&"else"!==e.value&&"then"!==e.value)&&(this.matchPredicate(bt)||this.matchPredicate(st)||this.matchPredicate(ct)||this.matchPredicate(ot)||this.matchPredicate(lt))){const e=this.previous();if("new"===e.value)return this.parseConstructorCall();if("on"===e.value)return this.parseEventHandler();if("if"===e.value)return this.parseConditional();if("closest"===e.value||"first"===e.value||"last"===e.value||"previous"===e.value||"next"===e.value){if(this.check("(")||this.checkCssSelector()||this.checkClassSelector()||this.checkIdSelector()||this.check("<")||this.checkQueryReference())return this.parseNavigationFunction(e.value);if(this.check(".")){const t=this.current;if(this.advance(),this.checkIdentifier()){const t=this.advance().value,n=this.createSelector("."+t);return this.createCallExpression(this.createIdentifier(e.value),[n])}this.current=t}if(this.check("#")){const t=this.current;if(this.advance(),this.checkIdentifier()){const t=this.advance().value,n=this.createSelector("#"+t);return this.createCallExpression(this.createIdentifier(e.value),[n])}this.current=t}return this.isAtEnd()||this.checkBasicOperator()||this.check("then")||this.check("else")||this.check("end")?this.createIdentifier(e.value):this.parseNavigationFunction(e.value)}const t=this.check(".")||this.check("?.");return"my"!==e.value||t?"its"!==e.value||t?"your"!==e.value||t?"the"===e.value?this.parseTheXofY():"values"===e.value&&this.check("of")?(this.advance(),{type:"propertyOfExpression",property:{type:"identifier",name:"values"},target:this.parsePrimary(),line:e.line,column:e.column}):this.createIdentifier(e.value):this.parseContextPropertyAccess("you"):this.parseContextPropertyAccess("it"):this.parseContextPropertyAccess("me")}if(this.match("$"))return this.parseDollarExpression();if(vt(this.peek())&&this.peek().value.startsWith("@")){const e=this.advance();return{type:"attributeAccess",attributeName:e.value.substring(1),start:e.start,end:e.end,line:e.line,column:e.column}}const t=this.peek();return this.addError(`Unexpected token: ${t.value} at line ${t.line}, column ${t.column}`),this.advance(),this.createErrorNode()}parseDollarExpression(){if(this.checkNumber()){const e=this.advance().value;return this.createLiteral(e,"$"+e)}if(this.checkIdentifier()){const e=this.advance();let t=this.createIdentifier(e.value);for(;this.match(".");){if(!this.checkIdentifier())return this.addError("Expected property name after '.' in dollar expression"),this.createErrorNode();{const e=this.advance();t=this.createMemberExpression(t,this.createIdentifier(e.value),0)}}return{type:"dollarExpression",expression:t,raw:`$${e.value}${this.previous().value||""}`,line:e.line,column:e.column-1}}return this.addError("Expected identifier or number after '$'"),this.createErrorNode()}parseHyperscriptSelector(){let e="";for(;!this.check("/")&&!this.isAtEnd();)e+=this.advance().value;return this.consume("/","Expected '/' in hyperscript selector"),this.consume(">","Expected '>' after '/' in hyperscript selector"),this.createSelector(e)}parseObjectLiteral(){const e=[],t=this.getPosition();if(this.check("}"))return this.advance(),{type:"objectLiteral",properties:e,start:t.start,end:this.getPosition().end,line:t.line,column:t.column};do{let t;if(this.matchPredicate(bt))t=this.createIdentifier(this.previous().value);else{if(!this.matchString())return this.addError("Expected property name in object literal"),this.createErrorNode();{const e=this.previous().value,n=e.slice(1,-1);t=this.createLiteral(n,e)}}this.consume(":","Expected ':' after property name in object literal");const n=this.parseExpression();if(e.push({key:t,value:n}),!this.match(","))break;if(this.check("}"))break}while(!this.isAtEnd());return this.consume("}","Expected '}' after object literal properties"),{type:"objectLiteral",properties:e,start:t.start,end:this.getPosition().end,line:t.line,column:t.column}}parseCSSObjectLiteral(){const e=this.getPosition(),t=[];do{if(this.check("}"))break;let n;if(this.matchPredicate(bt))n=this.createIdentifier(this.previous().value);else{if(!this.matchString())return this.addError("Expected CSS property name"),this.createErrorNode();{const e=this.previous().value,t=e.slice(1,-1);n=this.createLiteral(t,e)}}if(!this.consume(":","Expected ':' after CSS property name"))return this.createErrorNode();const r=[];let i=0,a=0;for(;!this.isAtEnd()&&(0!==a||!this.check(";")&&!this.check("}"));){const e=this.advance();r.push(e.value),"$"===e.value&&this.check("{")&&(i=1),"{"===e.value&&a++,"}"===e.value&&a--}const o=r.join(""),s=i?{type:"templateLiteral",value:o,start:e.start,end:this.getPosition().end,line:e.line,column:e.column}:this.createLiteral(o,o);if(t.push({key:n,value:s}),this.check(";")&&this.advance(),this.check("}"))break}while(!this.isAtEnd());return this.consume("}","Expected '}' after CSS object literal properties"),{type:"objectLiteral",properties:t,start:e.start,end:this.getPosition().end,line:e.line,column:e.column}}parseConstructorCall(){const e=this.previous();if(!this.checkIdentifier())return this.addError('Expected constructor name after "new"'),this.createErrorNode();const t=this.advance(),n=t.value;if(!this.check("("))return this.addError('Expected "(" after constructor name'),this.createErrorNode();this.advance();const r=[];if(!this.check(")"))do{r.push(this.parseExpression())}while(this.match(","));return this.consume(")","Expected ')' after constructor arguments"),{type:"callExpression",callee:{type:"identifier",name:n,start:t.start,end:t.end,line:t.line,column:t.column},arguments:r,isConstructor:1,start:e.start,end:this.previous().end,line:e.line,column:e.column}}parseTopLevelInitBlock(){const e=this.getPosition(),t=this.parseCommandBlock(["end"]);return this.consume("end","Expected 'end' after init block"),{type:"initBlock",commands:t,start:e.start,end:this.getPosition().end,line:e.line,column:e.column}}parseDefFeature(){const e=this.getPosition();let t="";if(!this.checkIdentifier())return this.addError("Expected function name after 'def'"),{type:"def",name:"",params:[],body:[],start:e.start,end:this.getPosition().end,line:e.line,column:e.column};for(t=this.advance().value;this.check(".");)this.advance(),this.checkIdentifier()&&(t+="."+this.advance().value);const n=[];if(this.check("(")){if(this.advance(),!this.check(")"))for(this.checkIdentifier()&&n.push(this.advance().value);this.check(",");)this.advance(),this.checkIdentifier()&&n.push(this.advance().value);this.consume(")","Expected ')' after parameter list")}const r=this.parseCommandBlock(["end","catch","finally"]);let i,a,o;return this.check("catch")&&(this.advance(),this.checkIdentifier()&&(i=this.advance().value),a=this.parseCommandBlock(["end","finally"])),this.check("finally")&&(this.advance(),o=this.parseCommandBlock(["end"])),this.consume("end","Expected 'end' after function definition"),{type:"def",name:t,params:n,body:r,...void 0!==i&&{errorSymbol:i},...void 0!==a&&{errorHandler:a},...void 0!==o&&{finallyHandler:o},start:e.start,end:this.getPosition().end,line:e.line,column:e.column}}parseEventNameWithNamespace(e){let t;t=this.checkEvent()||this.checkIdentifier()||this.checkIsCommand()||this.checkIdentifierLike()?this.advance():this.consumeEvent(e);let n=t.value;return this.check(":")&&(this.advance(),n=`${n}:${this.advance().value}`),n}callExprToCommandNode(e,t){return{type:"command",name:e.callee.name,args:e.arguments,isBlocking:0,...void 0!==t.start&&{start:t.start},...void 0!==t.end&&{end:t.end},...void 0!==t.line&&{line:t.line},...void 0!==t.column&&{column:t.column}}}createPseudoCommandNode(e,t,n,r,i){return{type:"command",name:"pseudo-command",args:[{type:"objectLiteral",properties:[{key:{type:"identifier",name:"methodName"},value:{type:"literal",value:e,raw:`"${e}"`}},{key:{type:"identifier",name:"methodArgs"},value:{type:"literal",value:t.arguments,raw:JSON.stringify(t.arguments)}},...n?[{key:{type:"identifier",name:"preposition"},value:{type:"literal",value:n,raw:`"${n}"`}}]:[],{key:{type:"identifier",name:"targetExpression"},value:r}]}],isBlocking:0,...void 0!==i.start&&{start:i.start},...void 0!==i.end&&{end:i.end},...void 0!==i.line&&{line:i.line},...void 0!==i.column&&{column:i.column}}}tryParsePseudoCommand(e,t){const n=e.callee.name,r=this.peek();if(!(cn.PSEUDO_COMMAND_PREPOSITIONS.includes(r.value.toLowerCase())||bt(r)&&!this.isCommand(r.value)||ct(r)))return{node:this.callExprToCommandNode(e,t),isPseudo:0,targetFailed:0};let i,a;this.isCommand(n)&&this.addWarning({type:"command-shadow",message:`Method '${n}' shadows hyperscript command`,suggestions:[`Rename method to avoid confusion (e.g., '${n}Fn', 'my${n.charAt(0).toUpperCase()+n.slice(1)}')`,`Use 'call' command instead: call ${n}(...)`,"This works but may cause ambiguity"],severity:"warning",code:"PSEUDO_CMD_SHADOW",...void 0!==t.line&&{line:t.line},...void 0!==t.column&&{column:t.column}}),cn.PSEUDO_COMMAND_PREPOSITIONS.includes(this.peek().value.toLowerCase())&&(i=this.advance().value.toLowerCase());try{a=this.parseExpression()}catch{return{node:this.callExprToCommandNode(e,t),isPseudo:0,targetFailed:1}}return{node:this.createPseudoCommandNode(n,e,i,a,t),isPseudo:1,targetFailed:0}}parseCommandWithErrorRecovery(){this.advance();const e=this.error;try{const t=this.parseCommand();return this.error&&this.error!==e&&(Ye.parse("⚠️ Command parsing added error, restoring error state. Error was:",this.error.message),this.error=e),t}catch(t){return Ye.parse("⚠️ Command parsing threw exception, restoring error state:",t instanceof Error?t.message:t+""),this.error=e,null}}parseEventHandler(){Ye.parse("🔧 parseEventHandler: ENTRY - parsing event handler");const e=[];let t=0;if(this.check("first")&&!this.checkIsCommand()&&this.tokens.length>this.current+1){const e=this.tokens[this.current+1],n=e?.value?.toLowerCase();n&&"of"!==n&&"in"!==n&&"from"!==n&&(this.advance(),t=1,Ye.parse("🔧 parseEventHandler: Parsed 'first' as .once alias"))}const n=this.parseEventNameWithNamespace("Expected event name after 'on'");for(e.push(n),Ye.parse("🔧 parseEventHandler: Parsed first event name: "+n);this.check("or");){this.advance(),Ye.parse("🔧 parseEventHandler: Found 'or', parsing additional event name");const t=this.parseEventNameWithNamespace("Expected event name after 'or'");e.push(t),Ye.parse("🔧 parseEventHandler: Parsed additional event name: "+t)}let r;if(Ye.parse("🔧 parseEventHandler: Total events parsed: "+e.join(", ")),this.registryIntegration){const t=e[0];if(this.registryIntegration.hasEventSource(t)){const e=this.registryIntegration.getEventSource(t);r=e?.name,Ye.parse(`🔧 parseEventHandler: Detected custom event source '${r}' for event '${t}'`)}}const i=[];if(this.match("(")){if(!this.check(")"))do{const e=this.advance();i.push(e.value)}while(this.match(","));this.consume(")","Expected ')' after event parameters"),Ye.parse("🔧 parseEventHandler: Parsed event parameters: "+i.join(", "))}const a={};for(;this.check(".");){this.advance();const e=this.advance().value.toLowerCase();if("once"===e)a.once=1,Ye.parse("🔧 parseEventHandler: Parsed modifier '.once'");else if("prevent"===e)a.prevent=1,Ye.parse("🔧 parseEventHandler: Parsed modifier '.prevent'");else if("stop"===e)a.stop=1,Ye.parse("🔧 parseEventHandler: Parsed modifier '.stop'");else if("debounce"===e||"throttle"===e){if(!this.check("("))throw Error(`Expected '(' after '.${e}'`);{this.advance();const t=this.advance(),n=parseInt(t.value,10);if(isNaN(n))throw Error(`Expected number for ${e} delay, got: ${t.value}`);"debounce"===e?(a.debounce=n,Ye.parse(`🔧 parseEventHandler: Parsed modifier '.debounce(${n})'`)):(a.throttle=n,Ye.parse(`🔧 parseEventHandler: Parsed modifier '.throttle(${n})'`)),this.consume(")",`Expected ')' after ${e} delay`)}}else Ye.parse(`🔧 parseEventHandler: Warning - unknown modifier '.${e}'`)}if(this.check("debounced")||this.check("throttled")){const e=this.advance().value.toLowerCase(),t="debounced"===e?"debounce":"throttle";if(this.match("at"))if(this.checkTimeExpression()){const n=this.advance(),r=(o=n.value).endsWith("ms")?parseInt(o,10):o.endsWith("seconds")||o.endsWith("s")?1e3*parseFloat(o):o.endsWith("minutes")?6e4*parseFloat(o):o.endsWith("hours")?36e5*parseFloat(o):o.endsWith("days")?864e5*parseFloat(o):parseInt(o,10);a[t]=r,Ye.parse(`🔧 parseEventHandler: Parsed '${e} at ${n.value}' (${r}ms)`)}else if(this.matchNumber()){const n=parseInt(this.previous().value,10);a[t]=n,Ye.parse(`🔧 parseEventHandler: Parsed '${e} at ${n}'`)}else this.addError(`Expected time expression after '${e} at', got: ${this.peek().value}`);else this.addError(`Expected 'at' after '${e}'`)}var o;let s,l,c,u;if(t&&(a.once=1),Object.keys(a).length>0&&Ye.parse("🔧 parseEventHandler: Parsed modifiers:",a),this.match("[")&&(s=this.parseExpression(),this.consume("]","Expected ']' after event condition")),this.match("from")){const e=this.advance();l=e.value,Ye.parse(`🔧 parseEventHandler: Parsed 'from' target: ${l} (kind: ${e.kind})`)}if(this.match("of")){const e=this.advance();c=e.value.startsWith("@")?e.value.substring(1):e.value,Ye.parse("🔧 parseEventHandler: Parsed attribute name: "+c)}this.match("in")&&(Ye.parse("🔧 parseEventHandler: Found 'in' keyword, parsing watch target"),u=this.parseExpression(),Ye.parse("🔧 parseEventHandler: Parsed watch target expression"));const p=[];for(Ye.parse(`✅ parseEventHandler: About to parse commands, current token: ${this.isAtEnd()?"END":this.peek().value}, isAtEnd: ${this.isAtEnd()}`);!this.isAtEnd();){if(Ye.parse(`✅ parseEventHandler: Loop iteration, current token: ${this.peek().value}, kind: ${this.peek().kind}`),this.check("on")){Ye.parse("✅ parseEventHandler: Stopping command parsing, found next event handler 'on'");break}if(this.checkComment())Ye.parse("✅ parseEventHandler: Skipping comment token: "+this.peek().value),this.advance();else{if(this.check("end")){Ye.parse("✅ parseEventHandler: Stopping command parsing, found 'end' keyword"),this.advance();break}if(this.checkIsCommand()){const e="("===this.tokens[this.current+1]?.value,t=this.peek().value.toLowerCase();if(e&&"js"!==t&&"tell"!==t){let e;const t=this.error;try{e=this.parseExpression()}catch(e){this.error=t,this.advance();const n=this.parseCommand();p.push(n);continue}if(e&&"callExpression"===e.type){const t=this.tryParsePseudoCommand(e,e);if(p.push(t.node),t.isPseudo||t.targetFailed)continue}}else{const e=this.parseCommandWithErrorRecovery();e&&(p.push(e),Ye.parse("✅ parseEventHandler: Parsed command, next token: "+(this.isAtEnd()?"END":this.peek().value)))}}else{if(!this.checkIdentifier())break;{const e=this.peek();if(this.isCommand(e.value)){const e=this.parseCommandWithErrorRecovery();e&&p.push(e)}else{let e;const t=this.error;try{e=this.parseExpression()}catch(e){Ye.parse("⚠️ Expression parsing error, restoring error state:",e instanceof Error?e.message:e+""),this.error=t;break}if(e&&"callExpression"===e.type){const t=this.tryParsePseudoCommand(e,e);if(p.push(t.node),t.targetFailed)continue}else{if(!e||"binaryExpression"!==e.type||" "!==e.operator)break;{const t=e;if(!t.left||"identifier"!==t.left.type||!this.isCommand(t.left.name))break;{const n={type:"command",name:t.left.name,args:[t.right],isBlocking:0,...void 0!==e.start&&{start:e.start},...void 0!==e.end&&{end:e.end},...void 0!==e.line&&{line:e.line},...void 0!==e.column&&{column:e.column}};p.push(n)}}}}}}for(;!(this.isAtEnd()||this.checkIsCommand()||this.isCommand(this.peek().value)||this.check("then")||this.check("and")||this.check(",")||this.check("on"));)this.advance();if(!this.match("then","and",",")&&!this.checkIsCommand()&&!this.isCommand(this.peek().value))break}}const m=this.getPosition(),d={type:"eventHandler",event:1===e.length?e[0]:e.join("|"),events:e,commands:p,...i.length>0&&{params:i},...s&&{condition:s},...l&&{target:l},...c&&{attributeName:c},...u&&{watchTarget:u},...r&&{customEventSource:r},...Object.keys(a).length>0&&{modifiers:a},start:m.start,end:m.end,line:m.line,column:m.column};return Ye.parse(`🔧 parseEventHandler: Created node with events: ${e.join(", ")}, attributeName: ${c||"none"}, watchTarget: ${u?"yes":"none"}`),d}parseBehaviorDefinition(){const e=this.getPosition(),t=this.consumeIdentifier("Expected behavior name after 'behavior' keyword").value;/^[A-Z]/.test(t)||this.addError(`Behavior name must start with uppercase letter (got "${t}")`);const n=[];if(this.match("(")){if(!this.check(")"))do{const e=this.consumeIdentifierLike("Expected parameter name");n.push(e.value)}while(this.match(","));this.consume(")","Expected ')' after behavior parameters")}const r=new Set(n),i=[];let a;for(;!this.isAtEnd()&&!this.check("end");)if(this.match("on")){const e=this.getPosition(),t=this.parseEventNameWithNamespace("Expected event name after 'on'"),n=[];if(this.check("(")){for(this.advance();!this.isAtEnd()&&!this.check(")");){const e=this.peek();bt(e)?(n.push(e.value),this.advance(),this.check(",")&&this.advance()):this.advance()}this.check(")")&&this.advance()}let a;if(this.check("from")){this.advance();const e=[];if(this.check("the")&&this.advance(),!this.isAtEnd()){const t=this.peek(),n=r.has(t.value);this.checkIsCommand()&&!n||(e.push(t.value),a=t.value,this.advance())}}const o={type:"eventHandler",event:t,commands:this.parseCommandListUntilEnd(),...void 0!==a&&{target:a},...n.length>0&&{args:n},start:e.start,end:this.getPosition().end,line:e.line,column:e.column};i.push(o)}else{if(!this.match("init")){this.addError("Unexpected token in behavior body: "+this.peek().value);break}a={type:"initBlock",commands:this.parseCommandBlock(["end"]),start:e.start,end:this.getPosition().end,line:e.line,column:e.column},this.consume("end","Expected 'end' after init block")}return this.consume("end","Expected 'end' to close behavior definition"),{type:"behavior",name:t,parameters:n,eventHandlers:i,...void 0!==a?{initBlock:a}:{},start:e.start,end:this.getPosition().end,line:e.line,column:e.column}}parseCommandSequence(){const e=[];for(;!this.isAtEnd();){if(this.checkIsCommand()||this.isCommand(this.peek().value)&&!this.isKeyword(this.peek().value)){this.advance();const t=this.error,n=this.parseCommand();for(this.error&&this.error!==t&&(this.error.message.includes("Expected closing parenthesis")||this.error.message.includes("Expected ')'")||this.error.message.includes("unclosed parenthes")||this.error.message.includes("Unclosed parenthes")||(Ye.parse("⚠️ parseCommandSequence: Command parsing added non-critical error, restoring error state. Error was:",this.error.message),this.error=t)),e.push(n);!(this.isAtEnd()||this.checkIsCommand()||this.isCommand(this.peek().value)||this.check("then")||this.check("on"));)Ye.parse("⚠️ parseCommandSequence: Skipping unexpected token:",this.peek().value),this.advance();if(this.check("on")){Ye.parse('✅ parseCommandSequence: Found "on" token, stopping command sequence to allow event handler parsing');break}if(this.match("then"))continue;if(this.checkIsCommand()||this.isCommand(this.peek().value)&&!this.isKeyword(this.peek().value))continue;break}{const t=this.peek(),n=this.getPosition(),r="Expected command, got: "+t.value;this.addError(r);const i=qt(n,r,t.value);if(e.push(i),this.synchronizeToCommandBoundary(),this.isAtEnd())break;if(this.match("then"))continue;if(this.check("end")||this.check("on"))break;if(this.checkIsCommand()||this.isCommand(this.peek().value)&&!this.isKeyword(this.peek().value))continue;break}}return 1===e.length?e[0]:function(e){return{type:"CommandSequence",commands:e,start:e[0]?.start||0,end:e[e.length-1]?.end||0,line:e[0]?.line||1,column:e[0]?.column||1}}(e)}getMultiWordPattern(e){return function(e){return _t.find(t=>t.command===e.toLowerCase())||null}(e)}isTokenKeyword(e,t){return Dt(e,t)}parseMultiWordCommand(e,t){return function(e,t,n){const r=e.getMultiWordPattern(n);if(!r)return null;const i=[],a={};for(;!Ht(e,["catch","finally",...r.keywords])&&!Dt(e.peek(),r.keywords);){const t=e.parsePrimary();if(!t)break;if(i.push(t),!e.match(",")&&Dt(e.peek(),r.keywords))break}for(;!e.isAtEnd()&&Dt(e.peek(),r.keywords);){const t=e.advance().value,n=e.parseExpression();if(n&&(a[t]=n),!Dt(e.peek(),r.keywords))break}const o=Kt.from(t).withArgs(...i).endingAt(e.getPosition());return Object.keys(a).length>0&&o.withModifiers(a),o.build()}(this.getContext(),e,t)}parseCommandBlock(e){const t=[];for(;!this.isAtEnd()&&!e.some(e=>this.check(e));)if(this.checkComment())this.advance();else{if(!this.checkIsCommand()&&!this.isCommand(this.peek().value))break;{this.advance();const e=this.parseCommand();t.push(e)}}return t}trySemanticParse(e){if(!this.semanticAdapter||!this.semanticAdapter.isAvailable())return null;try{const t=this.semanticAdapter.trySemanticParse(e);return t.success&&t.node?(Ye.parse(`[Semantic] Successfully parsed with confidence ${t.confidence}:`,t.node.name),t.node):(Ye.parse(`[Semantic] Low confidence (${t.confidence}), falling back to traditional parser`),null)}catch(e){return Ye.parse("[Semantic] Error during semantic parse:",e),null}}getRemainingInput(){if(!this.originalInput)return this.tokens.slice(this.current>0?this.current-1:0).map(e=>e.value).join(" ");const e=this.current>0?this.tokens[this.current-1]:this.tokens[0];return e&&void 0!==e.start?this.originalInput.slice(e.start):this.originalInput}skipToCommandBoundary(){const e=["then","and","else","end"];for(;!this.isAtEnd();){const t=this.peek(),n=t.value.toLowerCase();if(e.includes(n))break;if(ot(t))break;this.advance()}}parseCommand(){const e=this.previous();let t=e.value;if(this.semanticAdapter&&!["install","wait","repeat","for","set","put","increment","decrement","add","toggle","if","unless","make","measure","trigger","halt","remove","exit","return","closest","js","tell"].includes(t.toLowerCase())){const e=this.getRemainingInput(),t=this.trySemanticParse(e);if(t)return this.skipToCommandBoundary(),t}if("beep"===t&&this.check("!")&&(this.advance(),t="beep!"),"fetch"===t)return function(e,t){const n={};let r=null;if(!e.isAtEnd()&&e.check("/")&&(r=function(e){const t=e.savePosition();let n="";for(;!e.isAtEnd()&&!on(e);)n+=e.advance().value;return n&&"/"!==n?{type:"literal",value:n,raw:n,start:t,end:e.savePosition()}:(e.restorePosition(t),null)}(e)),r||(r=e.parsePrimary()),!r)return e.addError("fetch requires a URL"),Kt.from(t).endingAt(e.getPosition()).build();!e.isAtEnd()&&e.check("{")&&(n.with=e.parsePrimary());for(let t=0;3>t&&!e.isAtEnd();t++)if(!e.check("as")||n.as){if(!e.check("with")||n.with){if(e.check("do")&&!n.doNotThrow){const t=e.peekAt(1),r=e.peekAt(2);if("not"===t?.value&&"throw"===r?.value){const t=e.advance();e.advance();const r=e.advance();n.doNotThrow={type:"literal",value:1,start:t.start,end:r.end,line:t.line,column:t.column};continue}}break}e.advance(),n.with=sn(e)?ln(e):e.parsePrimary()}else e.advance(),e.isAtEnd()||Gt(e,"a")||Gt(e,"an"),n.as=e.parsePrimary();const i=Kt.from(t).withArgs(r).endingAt(e.getPosition());return Object.keys(n).length>0&&i.withModifiers(n),i.build()}(this.getContext(),e);const n=this.parseMultiWordCommand(e,t);if(n)return n;const r=t.toLowerCase();if("repeat"===r)return this.parseRepeatCommand(e);if("for"===r)return this.parseForCommand(e);if("if"===r||"unless"===r)return this.parseIfCommand(e);if("wait"===r)return this.parseWaitCommand(e);if("install"===r)return this.parseInstallCommand(e);if("transition"===r)return this.parseTransitionCommand(e);if("add"===r)return this.parseAddCommand(e);if(this.isCompoundCommand(r))return this.parseCompoundCommand({type:"identifier",name:r,start:e.start||0,end:e.end||0,line:e.line,column:e.column})||function(e,t){return{type:"command",name:e,args:[],partial:1,start:t.start,end:t.end,line:t.line,column:t.column}}(r,this.getPosition());const i=[];if(("increment"===t||"decrement"===t)&&!this.isAtEnd())return function(e,t){const n=t.value,r="increment"===n?"+":"-";let i=0;e.check(x)&&(i=1,e.advance());const a=e.parseExpression();if(!a)throw Error("Expected variable or expression after "+n);let o;if(e.check("by")){e.advance();const t=e.parseExpression();if(!t)throw Error(`Expected amount after 'by' in ${n} command`);o=t}else o=Ot(1,"1",{start:t.start,end:e.previous().end,line:t.line,column:t.column});let s=a;i&&"identifier"===a.type&&(s={...a,scope:"global"});const l={start:t.start,end:e.previous().end,line:t.line,column:t.column},c=Nt(r,a,o,l),u=[s,Ct(h,l),c];return Kt.from(t).withName("set").withArgs(...u).withOriginalCommand(n).endingAt({end:e.previous().end}).build()}(this.getContext(),e);for(;!(this.isAtEnd()||this.check("then")||this.check("and")||this.check("else")||this.check("end")||this.checkIsCommand());){const e=this.parseExpression();if(i.push(e||this.parsePrimary()),this.match(","))continue;const t=["into","from","to","with","by","at","before","after","over"];if(t.some(e=>this.check(e)))continue;const n=i[i.length-1];if(!n||"identifier"!==n.type&&"keyword"!==n.type||!t.includes(n.name??n.value))break}const a=this.getPosition();return{type:"command",name:t,args:i,isBlocking:0,start:a.start,end:a.end,line:a.line,column:a.column}}parseConditional(){const e=this.parseExpression();this.consume("then","Expected 'then' after if condition");const t=this.parseConditionalBranch();let n;this.match("else")&&(n=this.parseConditionalBranch());const r=this.getPosition();return{type:"conditionalExpression",test:e,consequent:t,alternate:n,start:r.start,end:r.end,line:r.line,column:r.column}}parseConditionalBranch(){if(this.checkIsCommand()){const e=this.advance(),t=this.createIdentifier(e.value);return this.createCommandFromIdentifier(t)||t}if(this.checkIdentifier()||this.checkKeyword()){const e=this.peek();if(this.isCommand(e.value)){const e=this.advance(),t=this.createIdentifier(e.value);return this.createCommandFromIdentifier(t)||t}}return this.parseExpression()}parseNavigationFunction(e){const t=[];if(this.match("of"))t.push(this.parseExpression());else{if(this.check("("))return this.finishCall(this.createIdentifier(e));this.isAtEnd()||this.checkBasicOperator()||this.check("then")||this.check("else")||t.push(this.parsePrimary())}return this.createCallExpression(this.createIdentifier(e),t)}parseTheXofY(){if(!this.checkIdentifier())return this.createIdentifier("the");const e=this.peek(),t=e.value;return["first","last","next","previous","random","closest"].includes(t)?(this.advance(),this.parseNavigationFunction(t)):(this.advance(),this.check("of")?(this.advance(),{type:"propertyOfExpression",property:{type:"identifier",name:t},target:this.parsePrimary(),line:e.line,column:e.column}):this.createIdentifier(t))}parseContextPropertyAccess(e){if("me"===e&&this.match("*")){let t="";if(!this.checkIdentifier())return this.addError("Expected property name after 'my *'"),this.createMemberExpression(this.createIdentifier(e),this.createIdentifier(""),0);for(t=this.advance().value;this.check("-")&&!this.isAtEnd();){if(t+="-",this.advance(),!this.checkIdentifier()){this.addError("Expected identifier after hyphen in CSS property name");break}t+=this.advance().value}const n="computed-"+t;return this.createMemberExpression(this.createIdentifier(e),this.createIdentifier(n),0)}{if(vt(this.peek())&&this.peek().value.startsWith("@")){const t=this.advance();return this.createMemberExpression(this.createIdentifier(e),this.createIdentifier(t.value),0)}const t=this.consumeIdentifier(`Expected property name after '${{me:"my",it:"its",you:"your"}[e]}'`);return this.createMemberExpression(this.createIdentifier(e),this.createIdentifier(t.value),0)}}parseMyPropertyAccess(){return this.parseContextPropertyAccess("me")}finishCall(e){const t=[];if(!this.check(")"))do{if(this.check(","))return this.addError("Unexpected token in function arguments"),this.createCallExpression(e,[this.createErrorNode()]);t.push(this.parseExpression())}while(this.match(","));if(!this.check(")")&&"identifier"===e.type){const t=e.name;N.has(t.toLowerCase())&&Ye.parse(`💡 Tip: CSS functions like ${t}() should be quoted for clean parsing. Use '${t}(...)' or \`${t}(...)\` instead.`)}return this.consume(")","Expected ')' after arguments"),this.createCallExpression(e,t)}createLiteral(e,t){return Ot(e,t,this.getPosition())}createIdentifier(e){return Ct(e,this.getPosition())}createBinaryExpression(e,t,n){return Nt(e,t,n,this.getPosition())}createUnaryExpression(e,t,n){return function(e,t,n,r){return{type:"unaryExpression",operator:e,argument:t,prefix:n,start:r.start,end:r.end,line:r.line,column:r.column}}(e,t,n,this.getPosition())}createCallExpression(e,t){return function(e,t,n){return{type:"callExpression",callee:e,arguments:t,start:n.start,end:n.end,line:n.line,column:n.column}}(e,t,this.getPosition())}createMemberExpression(e,t,n){return function(e,t,n,r){return{type:"memberExpression",object:e,property:t,computed:n,start:r.start,end:r.end,line:r.line,column:r.column}}(e,t,n,this.getPosition())}createSelector(e){return function(e,t){return{type:"selector",value:e,start:t.start,end:t.end,line:t.line,column:t.column}}(e,this.getPosition())}createPossessiveExpression(e,t){return function(e,t,n){return{type:"possessiveExpression",object:e,property:t,start:n.start,end:n.end,line:n.line,column:n.column}}(e,t,this.getPosition())}createErrorNode(){return function(e){return{type:"identifier",name:"__ERROR__",start:e.start,end:e.end,line:e.line,column:e.column}}(this.getPosition())}processEscapeSequences(e){return e.replace(/\\(.)/g,(e,t)=>{switch(t){case"n":return"\n";case"t":return"\t";case"r":return"\r";case"b":return"\b";case"f":return"\f";case"v":return"\v";case"0":return"\0";case"\\":return"\\";case'"':return'"';case"'":return"'";default:return t}})}createProgramNode(e){return function(e){if(Ye.parse(`✅ createProgramNode: Called with ${e.length} statements`),0===e.length)return Ye.parse("✅ createProgramNode: Returning error node (0 statements)"),{type:"identifier",name:"__ERROR__",start:0,end:0,line:1,column:1};if(1===e.length)return Ye.parse(`✅ createProgramNode: Returning single statement (type=${e[0].type})`),e[0];const t={type:"Program",statements:e,start:e[0]?.start||0,end:e[e.length-1]?.end||0,line:e[0]?.line||1,column:e[0]?.column||1};return Ye.parse(`✅ createProgramNode: Returning Program node with ${e.length} statements, type=${t.type}`),t}(e)}match(...e){for(const t of e)if(this.check(t))return this.advance(),1;return 0}matchOperator(e){if(this.isAtEnd())return 0;const t=this.peek();return At(t)&&t.value===e?(this.advance(),1):0}check(e){if(this.isAtEnd())return 0;const t=this.peek().value;return this.resolveKeyword(t)===e}checkPredicate(e){return this.isAtEnd()?0:e(this.peek())}matchPredicate(e){return this.checkPredicate(e)?(this.advance(),1):0}checkSelector(){return this.checkPredicate(dt)}matchSelector(){return this.matchPredicate(dt)}checkAnySelector(){return this.checkPredicate(mt)}checkLiteral(){return this.checkPredicate(ft)}checkIdentifierLike(){return this.checkPredicate(pt)}checkIsCommand(){return this.checkPredicate(ot)}checkCommandTerminator(){return this.checkPredicate(Lt)}checkReference(){return this.checkPredicate(yt)}checkTimeExpression(){return this.checkPredicate(ht)}checkEvent(){return this.checkPredicate(lt)}checkContextVar(){return this.checkPredicate(ct)}checkComment(){return this.checkPredicate(gt)}checkIdentifier(){return this.checkPredicate(bt)}checkKeyword(){return this.checkPredicate(st)}checkString(){return this.checkPredicate(wt)}matchString(){return this.matchPredicate(wt)}checkNumber(){return this.checkPredicate(kt)}matchNumber(){return this.matchPredicate(kt)}checkBoolean(){return this.checkPredicate(zt)}matchBoolean(){return this.matchPredicate(zt)}checkTemplateLiteral(){return this.checkPredicate(xt)}matchTemplateLiteral(){return this.matchPredicate(xt)}checkQueryReference(){return this.checkPredicate(Et)}matchQueryReference(){return this.matchPredicate(Et)}checkIdSelector(){return this.checkPredicate(St)}checkClassSelector(){return this.checkPredicate(Tt)}checkCssSelector(){return this.checkPredicate(jt)}checkBasicOperator(){return this.checkPredicate(At)}matchBasicOperator(){return this.matchPredicate(At)}matchTimeExpression(){return this.matchPredicate(ht)}matchIdentifierLike(){return this.matchPredicate(pt)}matchComparisonOperator(){return this.matchPredicate(ut)}consumePredicate(e,t){return this.checkPredicate(e)?this.advance():(this.addError(t),this.peek())}consumeIdentifier(e){return this.consumePredicate(bt,e)}consumeIdentifierLike(e){return this.consumePredicate(pt,e)}consumeEvent(e){return this.consumePredicate(lt,e)}advance(){return this.isAtEnd()||this.current++,this.previous()}isAtEnd(){return this.current>=this.tokens.length}peek(){return this.isAtEnd()?{kind:"unknown",value:"",start:0,end:0,line:1,column:1}:this.tokens[this.current]}previous(){return this.tokens[this.current-1]}consume(e,t){return this.check(e)?this.advance():(this.addError(t),this.peek())}addError(e){const t=this.peek();let n=t.start||0,r=t.line||1,i=t.column||1;if(e.includes("property name after '.'")){const e=this.current>0?this.previous():t;n=e.end||e.start||0,r=e.line||1,i=e.column||1}if(e.includes("parenthes")){const e=this.current>0?this.previous():t;n=e.end||e.start||0,r=e.line||1,i=e.column||1,0===n&&this.current>0&&(n=this.current)}if(e.includes("Expected expression after")){const e=this.current>0?this.previous():t;n=e.start||0,r=e.line||1,i=e.column||1,0===n&&(n=Math.max(1,this.current-1))}if(e.includes("Missing operand")){let e=t;for(let t=this.current-1;t>=0;t--){const n=this.tokens[t];if(n&&("+"===n.value||"-"===n.value)){e=n;break}}n=e.start||0,r=e.line||1,i=e.column||1}this.error={message:e,line:Math.max(1,r),column:Math.max(1,i),position:Math.max(0,n)},this.errors.push(this.error)}synchronizeToCommandBoundary(){for(;!this.isAtEnd();){const e=this.peek();if("then"===e.value||"end"===e.value||"on"===e.value)return;if(this.checkIsCommand()||this.isCommand(e.value)&&!this.isKeyword(e.value))return;Ye.parse("⚠️ synchronize: Skipping token:",e.value),this.advance()}}parseAttributeOrArrayLiteral(){const e=this.previous().start,t=this.previous().line,n=this.previous().column;if(!this.isAtEnd()&&this.peek().value.startsWith("@")){const r=[];for(;!this.check("]")&&!this.isAtEnd();){const e=this.advance();r.push(e.value)}this.consume("]","Expected ']' after attribute literal");const i="["+r.join("")+"]";return{type:"literal",value:i,raw:i,start:e,end:this.previous().end,line:t,column:n}}const r=new Set(["=","~=","|=","^=","$=","*="]),i=this.tokens[this.current],a=this.tokens[this.current+1];if("identifier"===i?.kind&&("]"===a?.value||a&&r.has(a.value)&&"string"===this.tokens[this.current+2]?.kind)){let e="["+this.advance().value;if(this.check("]"))this.advance(),e+="]";else{const t=this.advance().value,n=this.advance().value;e+=t+'"'+(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'")?n.slice(1,-1):n)+'"',this.consume("]","Expected ']' after attribute selector"),e+="]"}return this.createSelector(e)}const o=[];if(!this.check("]"))do{if(this.check("]"))break;o.push(this.parseExpression())}while(this.match(","));return this.consume("]","Expected ']' after array elements"),{type:"arrayLiteral",elements:o,start:e,end:this.previous().end,line:t,column:n}}getPosition(){const e=this.current>0?this.previous():this.peek();return{start:e.start||0,end:e.end||0,line:e.line||1,column:e.column||1}}getContext(){const e=this,t={tokens:this.tokens,advance:this.advance.bind(this),peek:this.peek.bind(this),previous:this.previous.bind(this),consume:this.consume.bind(this),check:this.check.bind(this),checkIdentifierLike:this.checkIdentifierLike.bind(this),checkSelector:this.checkSelector.bind(this),checkAnySelector:this.checkAnySelector.bind(this),checkLiteral:this.checkLiteral.bind(this),checkReference:this.checkReference.bind(this),checkTimeExpression:this.checkTimeExpression.bind(this),checkEvent:this.checkEvent.bind(this),checkIsCommand:this.checkIsCommand.bind(this),checkContextVar:this.checkContextVar.bind(this),match:this.match.bind(this),matchOperator:this.matchOperator.bind(this),isAtEnd:this.isAtEnd.bind(this),createIdentifier:this.createIdentifier.bind(this),parseExpression:this.parseExpression.bind(this),parsePrimary:this.parsePrimary.bind(this),parseLogicalAnd:this.parseLogicalAnd.bind(this),parseCSSObjectLiteral:this.parseCSSObjectLiteral.bind(this),parseCommand:this.parseCommand.bind(this),parseCommandSequence:this.parseCommandSequence.bind(this),parseCommandListUntilEnd:this.parseCommandListUntilEnd.bind(this),parseCommandListUntilEndOrElse:this.parseCommandListUntilEndOrElse.bind(this),parseRepeatBody:this.parseRepeatBody.bind(this),getPosition:this.getPosition.bind(this),addError:this.addError.bind(this),addWarning:this.addWarning.bind(this),isCommand:this.isCommand.bind(this),isCompoundCommand:this.isCompoundCommand.bind(this),isKeyword:this.isKeyword.bind(this),getMultiWordPattern:this.getMultiWordPattern.bind(this),resolveKeyword:this.resolveKeyword.bind(this),savePosition:()=>e.current,restorePosition:t=>{e.current=t},peekAt:t=>{const n=e.current+t;return n>=0&&e.tokens.length>n?e.tokens[n]:null},getInputSlice:(e,t)=>this.originalInput?0>e||e>=this.originalInput.length?"":void 0!==t?this.originalInput.slice(e,t):this.originalInput.slice(e):""};return Object.defineProperty(t,"current",{get:()=>e.current,set:t=>{e.current=t},enumerable:1,configurable:1}),t}}function un(e,t){const n=ze(e);return new cn(n,t,e).parse()}function pn(e,t){const n=e.registry?.get(t);if(!n)throw Error(`Expression '${t}' not in ExecutionContext.registry. The bundle's ExpressionRegistry must include this expression's category. Use createExpressionRegistry() with the relevant category objects (referencesExpressions, logicalExpressions, conversionExpressions, positionalExpressions, propertiesExpressions, specialExpressions, mathematicalExpressions).`);return n}function mn(e){if(e&&"object"==typeof e&&"success"in e){if(e.success)return"value"in e?e.value:void 0;const t=e.errors||[];throw Error(t.length>0?t[0].message:"Expression evaluation failed")}return e}async function dn(e,t){if(!e)throw Error("Cannot evaluate null or undefined AST node");if("literal"===e.type)return e.value;if("identifier"===e.type)return vn(e,t);const n=e;switch(e.type){case"literal":return function(e){return e.value}(n);case"identifier":return vn(n,t);case"binaryExpression":return async function(e,t){const n=e.operator,r=e.right,i=e.left;if("has"===n||"have"===n){const n=await dn(e.left,t);return n instanceof Element&&"selector"===r.type&&"string"==typeof r.value&&r.value.startsWith(".")?n.classList.contains(r.value.slice(1)):0}if("in"===n||"is in"===n){const n="callExpression"===i?.type&&"identifier"===i.callee?.type?i.callee.name:null;if(("first"===n||"last"===n)&&Array.isArray(i.arguments)){const r=i.arguments[0];if("selector"===r?.type&&"string"==typeof r.value){const i=await dn(e.right,t);if(i&&"function"==typeof i.querySelectorAll){const e=Array.from(i.querySelectorAll(r.value));return 0===e.length?null:"first"===n?e[0]:e[e.length-1]}}}if("selector"===i?.type&&i.fromQuery&&"string"==typeof i.value){const n=await dn(e.right,t),r=n&&"function"==typeof n.querySelectorAll?n:null;if(r)return Array.from(r.querySelectorAll(i.value))}}const a=await dn(e.left,t);if("and"===n){if(!a)return a;const n=await dn(e.right,t);return pn(t,"and").evaluate(t,a,n)}if("or"===n){if(a)return a;const n=await dn(e.right,t);return pn(t,"or").evaluate(t,a,n)}const o=await dn(e.right,t),s=e=>"string"==typeof e?e.toLowerCase():e,l=e.ignoringCase?s(a):a,c=e.ignoringCase?s(o):o;switch(n){case"+":return"string"==typeof a||"string"==typeof o?(a??"")+""+(o??""):mn(await pn(t,"addition").evaluate(t,{left:a,right:o}));case"-":return mn(await pn(t,"subtraction").evaluate(t,{left:a,right:o}));case"*":return mn(await pn(t,"multiplication").evaluate(t,{left:a,right:o}));case"/":return mn(await pn(t,"division").evaluate(t,{left:a,right:o}));case"%":case"mod":return mn(await pn(t,"modulo").evaluate(t,{left:a,right:o}));case"^":case"**":return mn(await pn(t,"power").evaluate(t,{left:a,right:o}));case">":case"is greater than":return pn(t,"greaterThan").evaluate(t,a,o);case"<":case"is less than":return pn(t,"lessThan").evaluate(t,a,o);case">=":case"is greater than or equal to":return pn(t,"greaterThanOrEqual").evaluate(t,a,o);case"<=":case"is less than or equal to":return pn(t,"lessThanOrEqual").evaluate(t,a,o);case"==":case"is":case"am":case"equals":case"is equal to":return pn(t,"equals").evaluate(t,l,c);case"!=":case"is not":case"is not equal to":return pn(t,"notEquals").evaluate(t,l,c);case"===":case"really equals":case"is really equal to":return pn(t,"strictEquals").evaluate(t,l,c);case"!==":case"is not really equal to":return pn(t,"strictNotEquals").evaluate(t,l,c);case"as":return pn(t,"as").evaluate(t,a,wn(o));case"contains":return pn(t,"contains").evaluate(t,l,c);case"does not contain":case"does not include":return pn(t,"doesNotContain").evaluate(t,l,c);case"starts with":return pn(t,"startsWith").evaluate(t,l,c);case"ends with":return pn(t,"endsWith").evaluate(t,l,c);case"does not start with":return!await pn(t,"startsWith").evaluate(t,l,c);case"does not end with":return!await pn(t,"endsWith").evaluate(t,l,c);case"match":case"matches":return pn(t,"matches").evaluate(t,l,c);case"in":case"is in":return gn(a,o);case"is not in":return!gn(a,o);case"of":return o&&"object"==typeof o?o[a]:void 0;case"precedes":return bn(a,o,Node.DOCUMENT_POSITION_FOLLOWING);case"does not precede":return!bn(a,o,Node.DOCUMENT_POSITION_FOLLOWING);case"follows":return bn(a,o,Node.DOCUMENT_POSITION_PRECEDING);case"does not follow":return!bn(a,o,Node.DOCUMENT_POSITION_PRECEDING);default:throw Error("Unknown binary operator: "+n)}}(n,t);case"asExpression":return async function(e,t){const n=await dn(e.expression,t),r=wn(e.targetType);return pn(t,"as").evaluate(t,n,r)}(n,t);case"betweenExpression":return async function(e,t){const n=await dn(e.value,t),r=await dn(e.min,t),i=await dn(e.max,t),a=e=>"string"==typeof e?e.toLowerCase():e,[o,s,l]=e.ignoringCase?[a(n),a(r),a(i)]:[n,r,i],c=await pn(t,"between").evaluate(t,o,s,l);return e.negated?!c:c}(n,t);case"typeCheckExpression":return async function(e,t){const n=function(e,t,n){if(null==e&&n)return 1;if(Object.prototype.toString.call(e).slice(8,-1)===t)return 1;const r=globalThis[t];return"function"==typeof r&&e instanceof r}(await dn(e.value,t),e.typeName+"",0!=e.nullOk);return e.negated?!n:n}(n,t);case"collectionExpression":return async function(e,t){const n=await dn(e.collection,t),r=async(e,n)=>dn(e,{...t,it:n});switch(e.operator){case"where":return async function(e,t,n){const r=ge(e),i=[];for(const e of r)await n(t,e)&&i.push(e);return i}(n,e.right,r);case"sorted by":return async function(e,t,n,r){const i=[...ge(e)],a=await Promise.all(i.map(e=>r(t,e))),o=i.map((e,t)=>t);o.sort((e,t)=>{const n=a[e],r=a[t];return n===r?0:null==n?1:null==r||r>n?-1:1});const s=o.map(e=>i[e]);return"desc"===n?s.reverse():s}(n,e.right,e.order??"asc",r);case"mapped to":return async function(e,t,n){const r=ge(e);return Promise.all(r.map(e=>n(t,e)))}(n,e.right,r);case"split by":return a=await dn(e.right,t),null==(i=n)?[]:(i+"").split(null==a?"":a+"");case"joined by":return function(e,t){const n=null==t?"":t+"";return ge(e).map(e=>null==e?"":e+"").join(n)}(n,await dn(e.right,t));default:throw Error("Unknown collection operator: "+e.operator)}var i,a}(n,t);case"unaryExpression":return async function(e,t){const n=e.operand??e.argument;if(!n)throw Error(`Unary expression has no operand (operator: ${e.operator})`);const r=await dn(n,t);switch(e.operator){case"not":case"!":return pn(t,"not").evaluate(t,r);case"no":return pn(t,"no").evaluate(t,r);case"-":return-r;case"+":return+r;case"exists":case"some":return pn(t,"exists").evaluate(t,r);case"does not exist":return pn(t,"doesNotExist").evaluate(t,r);case"is empty":return pn(t,"isEmpty").evaluate(t,r);case"is not empty":return pn(t,"isNotEmpty").evaluate(t,r);default:throw Error("Unknown unary operator: "+e.operator)}}(n,t);case"memberExpression":return async function(e,t){const n=await dn(e.object,t);if(e.computed){const r=await dn(e.property,t);return n?.[r]}{const t=e.property.name;if("string"==typeof t&&t.startsWith("@")){const e=t.substring(1);return n&&"function"==typeof n.getAttribute?n.getAttribute(e):void 0}return n instanceof Element&&"string"==typeof t?ve(n,t):n?.[t]}}(n,t);case"callExpression":return async function(e,t){const n=await dn(e.callee,t);if(e.isConstructor&&"function"==typeof n)return new n(...await Promise.all(e.arguments.map(e=>dn(e,t))));if("identifier"===e.callee.type){const r=e.callee.name,i=await async function(e,t,n){return xn.has(t)?Promise.all(e.map(e=>"identifier"===e.type&&e.name?e.name:"selector"===e.type&&e.value?e.value:dn(e,n))):Promise.all(e.map(e=>dn(e,n)))}(e.arguments,r,t);switch(r){case"closest":return pn(t,"closest").evaluate(t,...i);case"previous":return pn(t,"previous").evaluate(t,...i);case"next":return pn(t,"next").evaluate(t,...i);case"first":return pn(t,"first").evaluate(t,...i);case"last":return pn(t,"last").evaluate(t,...i);default:if("function"==typeof n)return n(...i);throw Error("Cannot call non-function: "+r)}}if("function"==typeof n){const r=await Promise.all(e.arguments.map(e=>dn(e,t)));if("memberExpression"===e.callee.type&&e.callee.object){const i=await dn(e.callee.object,t);return n.apply(i,r)}return n(...r)}throw Error("Cannot call non-function")}(n,t);case"selector":return async function(e,t){const n=e.value,r="string"==typeof n?function(e){return e.replace(En,"$1\\:")}(n):n,i=await pn(t,"elementWithSelector").evaluate(t,r);return!e.fromQuery&&"string"==typeof n&&n.startsWith("#")&&Array.isArray(i)?i[0]??null:i}(n,t);case"possessiveExpression":return async function(e,t){const n=await dn(e.object,t),r=e.property.name;return pn(t,"possessive").evaluate(t,n,r)}(n,t);case"eventHandler":return async function(e,t){return{event:e.event,selector:e.selector,commands:e.commands,handler:async n=>{const r={...t,event:n,target:n.target,currentTarget:n.currentTarget};for(const t of e.commands)await dn(t,r)}}}(n,t);case"conditionalExpression":return async function(e,t){return await dn(e.test,t)?dn(e.consequent,t):e.alternate?dn(e.alternate,t):void 0}(n,t);case"string":return n.value;case"arrayLiteral":return async function(e,t){const n=[];for(const r of e.elements)n.push(await dn(r,t));return n}(n,t);case"objectLiteral":return async function(e,t){const n={};for(const r of e.properties){const e=r.key;let i;i="identifier"===e.type?e.name:"literal"===e.type&&"string"===e.valueType?e.value:await dn(e,t)+"",n[i]=await dn(r.value,t)}return n}(n,t);case"attributeAccess":return async function(e,t){const n=e.attributeName;return t.me&&t.me instanceof Element?t.me.getAttribute(n):"@"+n}(n,t);case"propertyOfExpression":return async function(e,t){const n=e.property;if("identifier"!==n?.type)throw Error('Property name must be an identifier in "the X of Y" pattern');const r=n.name,i=await dn(e.target,t);if(null==i)throw Error(`Cannot access property "${r}" of ${i}`);if(function(e){return e instanceof Element}(i))return ve(i,r);const a=i[r];return"function"==typeof a?a.bind(i):a}(n,t);case"templateLiteral":return async function(e,t){let n=e.value;return n=await zn(n,/\$([a-zA-Z_$][a-zA-Z0-9_.$]*|\d+)/g,async(e,n)=>{try{if(/^\d+$/.test(n))return n;if(n.includes(".")){const e=n.split(".");let r=kn(e[0],t);for(let t=1;e.length>t&&null!=r;t++)r=r[e[t]];return(r??"")+""}return(kn(n,t)??"")+""}catch{return""}}),n=await zn(n,/\$(?:\{([^}]+)\}|\(([^)]+)\))/g,async(e,n,r)=>{const i=n||r;try{return await fn(i,t)+""}catch{return"undefined"}}),n}(n,t);default:{const n=G.get(e.type);if(n)return n(e,t);throw Error("Unknown AST node type: "+e.type)}}}async function fn(e,t){const n=un(e);if(!n.success||!n.node){const e=n.error??n.errors?.[0];throw Error("Failed to parse expression: "+(e?.message??"unknown error"))}const r=t.registry?t:{...t,registry:await hn()};return dn(n.node,r)}cn.POSTFIX_UNARY_OPERATORS=new Set(["exists","does not exist","is empty","is not empty","ignoring case"]),cn.PRATT_TABLE=B,cn.PSEUDO_COMMAND_PREPOSITIONS=["from","on","with","into","at","to"];let yn=null;async function hn(){if(!yn){const e=await Promise.resolve().then(function(){return Mi});yn=e.createFullExpressionRegistry()}return yn}async function vn(e,t){const n=e.name;return"me"===n||"my"===n||"I"===n?pn(t,"me").evaluate(t):"you"===n||"your"===n||"yourself"===n?pn(t,"you").evaluate(t):"it"===n||"its"===n?pn(t,"it").evaluate(t):"window"===n?pn(t,"window").evaluate(t):"document"===n?pn(t,"document").evaluate(t):t.locals&&t.locals.has(n)?(ne(n,t),t.locals.get(n)):t.globals&&t.globals.has(n)?(n.startsWith("$")&&ee(n.slice(1),t),t.globals.get(n)):n.startsWith("$")&&t.globals&&t.globals.has(n.slice(1))?(ee(n.slice(1),t),t.globals.get(n.slice(1))):void 0!==t[n]?t[n]:"undefined"!=typeof globalThis&&n in globalThis?globalThis[n]:void 0}function gn(e,t){return Array.isArray(t)?t.includes(e):"string"==typeof t?t.includes(e+""):e instanceof Node&&t instanceof Node?e===t||t.contains(e):null!=t&&"object"==typeof t&&e in t}function bn(e,t,n){return e instanceof Node&&t instanceof Node&&0!==(e.compareDocumentPosition(t)&n)}function wn(e){if("string"==typeof e)return e;if(e&&"object"==typeof e){if("string"==typeof e.name)return e.name;if("string"==typeof e.value)return e.value}return e+""}function kn(e,t){return t.locals?.has(e)?(ne(e,t),t.locals.get(e)):"me"===e&&t.me?t.me:"you"===e&&t.you?t.you:"it"===e&&t.it?t.it:"result"===e&&t.result?t.result:"undefined"!=typeof window&&"window"===e?window:t.globals?.has(e)?t.globals.get(e):void 0}async function zn(e,t,n){const r=[];let i;for(;null!==(i=t.exec(e));)r.push({index:i.index,length:i[0].length,replacement:await n(i[0],...i.slice(1))});let a=e;for(let e=r.length-1;e>=0;e--){const{index:t,length:n,replacement:i}=r[e];a=a.substring(0,t)+i+a.substring(t+n)}return a}const xn=new Set(["closest","previous","next"]),En=RegExp("(\\.[a-zA-Z0-9_-]+):(?!(hover|active|focus|visited|link|focus-within|focus-visible|first-child|last-child|only-child|nth-child|nth-last-child|nth-of-type|nth-last-of-type|first-of-type|last-of-type|only-of-type|empty|root|target|lang|dir|not|has|is|where|matches|before|after|first-letter|first-line|selection|placeholder|marker|backdrop|enabled|disabled|checked|indeterminate|required|optional|valid|invalid|in-range|out-of-range|read-only|read-write|default|defined|fullscreen|modal|picture-in-picture|autofill)(?![a-zA-Z0-9_-]))","g");class Sn{constructor(){this.hooks=new Map,this.beforeExecuteHooks=[],this.afterExecuteHooks=[],this.onErrorHooks=[],this.interceptCommandHooks=[]}register(e,t){this.unregister(e),this.hooks.set(e,t),t.beforeExecute&&this.beforeExecuteHooks.push(t.beforeExecute),t.afterExecute&&this.afterExecuteHooks.push(t.afterExecute),t.onError&&this.onErrorHooks.push(t.onError),t.interceptCommand&&this.interceptCommandHooks.push(t.interceptCommand)}unregister(e){const t=this.hooks.get(e);if(!t)return 0;if(t.beforeExecute){const e=this.beforeExecuteHooks.indexOf(t.beforeExecute);e>-1&&this.beforeExecuteHooks.splice(e,1)}if(t.afterExecute){const e=this.afterExecuteHooks.indexOf(t.afterExecute);e>-1&&this.afterExecuteHooks.splice(e,1)}if(t.onError){const e=this.onErrorHooks.indexOf(t.onError);e>-1&&this.onErrorHooks.splice(e,1)}if(t.interceptCommand){const e=this.interceptCommandHooks.indexOf(t.interceptCommand);e>-1&&this.interceptCommandHooks.splice(e,1)}return this.hooks.delete(e)}has(e){return this.hooks.has(e)}async runBeforeExecute(e){for(const t of this.beforeExecuteHooks)await t(e)}async runAfterExecute(e,t){for(const n of this.afterExecuteHooks)await n(e,t)}async runOnError(e,t){let n=t;for(const t of this.onErrorHooks){const r=await t(e,n);r instanceof Error&&(n=r)}return n}shouldIntercept(e,t){for(const n of this.interceptCommandHooks)if(n(e,t))return 1;return 0}getRegisteredNames(){return Array.from(this.hooks.keys())}clear(){this.hooks.clear(),this.beforeExecuteHooks=[],this.afterExecuteHooks=[],this.onErrorHooks=[],this.interceptCommandHooks=[]}}class Tn{constructor(e){this.elementCleanups=new WeakMap,this.elementCount=0,this.typeCounts={listener:0,observer:0,interval:0,timeout:0,custom:0},this.globalCleanups=[],this.debugMode=e?.debug??0}registerListener(e,t,n,r,i){this.addCleanup(e,{type:"listener",target:t,eventName:n,cleanup:()=>{t.removeEventListener(n,r,i),this.debugMode&&Ye.runtime(`CleanupRegistry: Removed listener '${n}'`)},description:n+" listener"})}registerObserver(e,t){this.addCleanup(e,{type:"observer",cleanup:()=>{t.disconnect(),this.debugMode&&Ye.runtime("CleanupRegistry: Disconnected MutationObserver")},description:"MutationObserver"})}registerInterval(e,t){this.addCleanup(e,{type:"interval",cleanup:()=>{clearInterval(t),this.debugMode&&Ye.runtime("CleanupRegistry: Cleared interval")},description:"Interval"})}registerTimeout(e,t){this.addCleanup(e,{type:"timeout",cleanup:()=>{clearTimeout(t),this.debugMode&&Ye.runtime("CleanupRegistry: Cleared timeout")},description:"Timeout"})}registerCustom(e,t,n){this.addCleanup(e,{type:"custom",cleanup:t,description:n||"Custom cleanup"})}registerGlobal(e,t="custom",n){this.globalCleanups.push({type:t,cleanup:e,description:n||"Global cleanup"}),this.debugMode&&Ye.runtime("CleanupRegistry: Registered global cleanup: "+(n||t))}addCleanup(e,t){const n=this.elementCleanups.get(e);n?n.push(t):(this.elementCleanups.set(e,[t]),this.elementCount++),this.typeCounts[t.type]++,this.debugMode&&Ye.runtime(`CleanupRegistry: Registered ${t.type} for element`,e)}cleanupElement(e){const t=this.elementCleanups.get(e);if(!t||0===t.length)return 0;let n=0;for(const e of t){try{e.cleanup(),n++}catch(e){this.debugMode&&Ye.runtime("CleanupRegistry: Error during cleanup:",e)}this.typeCounts[e.type]--}return this.elementCleanups.delete(e),this.elementCount--,this.debugMode&&Ye.runtime(`CleanupRegistry: Cleaned up ${n} resources for element`),n}cleanupElementTree(e){let t=this.cleanupElement(e);const n=e.querySelectorAll("*");for(const e of n)t+=this.cleanupElement(e);return t}cleanupGlobal(){let e=0;for(const t of this.globalCleanups)try{t.cleanup(),e++}catch(e){this.debugMode&&Ye.runtime("CleanupRegistry: Error during global cleanup:",e)}return this.globalCleanups=[],this.debugMode&&Ye.runtime(`CleanupRegistry: Cleaned up ${e} global resources`),e}cleanupAll(){return this.cleanupGlobal()}hasCleanups(e){const t=this.elementCleanups.get(e);return void 0!==t&&t.length>0}getCleanupCount(e){const t=this.elementCleanups.get(e);return t?.length??0}getStats(){let e=0,t=0,n=0,r=0,i=0;for(const a of this.globalCleanups)switch(a.type){case"listener":e++;break;case"observer":t++;break;case"interval":n++;break;case"timeout":r++;break;case"custom":i++}return{elementsTracked:this.elementCount,listeners:this.typeCounts.listener+e,observers:this.typeCounts.observer+t,intervals:this.typeCounts.interval+n,timeouts:this.typeCounts.timeout+r,custom:this.typeCounts.custom+i,global:this.globalCleanups.length}}setDebugMode(e){this.debugMode=e}}const jn=new Map;function An(e,t){return{me:e??null,it:null,you:null,result:null,locals:new Map,globals:jn,flags:{halted:0,breaking:0,continuing:0,returning:0,async:0}}}function Ln(){return jn}class On{constructor(){this.sources=new Map,this.subscriptions=new Map,this.nextId=1}register(e,t){const n=e.toLowerCase();this.sources.has(n)&&Ye.runtime("[EventSourceRegistry] Overwriting existing event source: "+e),this.sources.set(n,t)}unregister(e){const t=e.toLowerCase(),n=this.sources.get(t);if(n){for(const[e,n]of this.subscriptions.entries())n.source===t&&(n.unsubscribe(),this.subscriptions.delete(e));return n.destroy?.(),this.sources.delete(t)}return 0}get(e){return this.sources.get(e.toLowerCase())}has(e){return this.sources.has(e.toLowerCase())}subscribe(e,t,n){const r=this.get(e);if(!r)return void Ye.runtime("[EventSourceRegistry] Unknown event source: "+e);r.initialize?.();const i=r.subscribe(t,n);return this.subscriptions.set(i.id,i),i}unsubscribe(e){const t=this.subscriptions.get(e);return t?(t.unsubscribe(),this.subscriptions.delete(e)):0}getSourceNames(){return Array.from(this.sources.keys())}getSubscriptions(){return Array.from(this.subscriptions.values())}findSourceForEvent(e){for(const[t,n]of this.sources.entries())if(n.supports?.(e)??n.supportedEvents?.includes(e))return t}generateId(){return`sub_${this.nextId++}_${Date.now().toString(36)}`}destroy(){for(const e of this.subscriptions.values())e.unsubscribe();this.subscriptions.clear();for(const e of this.sources.values())e.destroy?.();this.sources.clear()}}class Cn{constructor(){this.providers=new Map,this.globalProviders=new Map}register(e,t,n){const r=e.toLowerCase();this.providers.set(r,"function"==typeof t?{name:r,provide:t,cache:n?.cache??1,description:n?.description,dependencies:n?.dependencies}:t)}registerGlobal(e,t,n){const r=e.toLowerCase();this.globalProviders.set(r,"function"==typeof t?{name:r,provide:t,cache:n?.cache??1,description:n?.description,dependencies:n?.dependencies}:t)}unregister(e){return this.providers.delete(e.toLowerCase())}unregisterGlobal(e){return this.globalProviders.delete(e.toLowerCase())}get(e){const t=e.toLowerCase();return this.providers.get(t)??this.globalProviders.get(t)}has(e){const t=e.toLowerCase();return this.providers.has(t)||this.globalProviders.has(t)}async resolve(e,t,n){const r=this.get(e);if(!r)return;const i="__provider_"+r.name;if(r.cache&&n?.has(i))return n.get(i);if(r.dependencies)for(const e of r.dependencies)await this.resolve(e,t,n);const a=await r.provide(t);return r.cache&&n&&n.set(i,a),a}resolveSync(e,t,n){const r=this.get(e);if(!r)return;const i="__provider_"+r.name;if(r.cache&&n?.has(i))return n.get(i);const a=r.provide(t);if(a instanceof Promise)throw Error(`Context provider '${e}' is async. Use resolve() instead of resolveSync().`);return r.cache&&n&&n.set(i,a),a}enhance(e){const t=this,n=new Map;return new Proxy(e,{get(e,r,i){if("string"==typeof r&&t.get(r))try{return t.resolveSync(r,e,n)}catch{return t.resolve(r,e,n)}return Reflect.get(e,r,i)},has:(e,n)=>"string"==typeof n&&t.has(n)?1:Reflect.has(e,n)})}async resolveAll(e){const t=new Map,n={},r=[...this.globalProviders.entries(),...this.providers.entries()];for(const[i,a]of r)try{n[i]=await this.resolve(i,e,t)}catch(e){Ye.runtime(`[ContextProviderRegistry] Failed to resolve '${i}':`,e),n[i]=void 0}return n}getProviderNames(){return[...new Set([...this.globalProviders.keys(),...this.providers.keys()])]}clear(){this.providers.clear(),this.globalProviders.clear()}}const Nn={evaluate:(e,t)=>dn(e,t)};class Pn{static toTyped(e){return{me:e.me,it:e.it,you:e.you,result:e.result,...void 0!==e.event&&{event:e.event},variables:e.variables||new Map,locals:e.locals||new Map,globals:e.globals||new Map,...void 0!==e.events&&{events:e.events},meta:e.meta||{},...void 0!==e.registry&&{registry:e.registry},expressionStack:[],evaluationDepth:0,validationMode:"strict",evaluationHistory:[]}}static fromTyped(e,t){return{...t,me:e.me,it:e.it,you:e.you,result:e.result,...void 0!==e.event&&{event:e.event},...void 0!==e.variables&&{variables:e.variables},locals:e.locals,globals:e.globals,...void 0!==e.events&&{events:e.events},...void 0!==e.meta&&{meta:e.meta}}}}class Rn{constructor(e,t,n){this.impl=e,this.hookRegistry=n??null}setHookRegistry(e){this.hookRegistry=e}createHookContext(e,t,n={}){return{commandName:this.name,element:e.me instanceof Element?e.me:null,args:t,modifiers:n,event:e.event??void 0,executionContext:e}}get name(){const e=this.impl.name;if(e)return e;const t=this.impl.metadata?.name;return"string"==typeof t?t:""}get metadata(){const e=this.impl.metadata?.syntax;return{description:this.impl.metadata?.description||"",examples:this.impl.metadata?.examples||[],syntax:Array.isArray(e)?e.join(" | "):e||""}}async execute(e,...t){const n=t[0],r=this.createHookContext(e,t,n&&"object"==typeof n&&"modifiers"in n&&n.modifiers||{});try{if(Ye.command(`CommandAdapterV2: Executing '${this.name}' with args:`,t),this.hookRegistry&&await this.hookRegistry.runBeforeExecute(r),this.hookRegistry?.shouldIntercept(this.name,r))return void Ye.command(`CommandAdapterV2: '${this.name}' intercepted by hook`);const i=Pn.toTyped(e);let a,o;if(this.impl.parseInput&&"function"==typeof this.impl.parseInput)if(Ye.command(`CommandAdapterV2: '${this.name}' has parseInput(), calling it`),n&&"object"==typeof n&&("args"in n||"modifiers"in n)){const t=n.modifiers,r=t?.when||t?.where;if(r&&!await dn(r,e))return void Ye.command(`CommandAdapterV2: '${this.name}' skipped - when/where condition evaluated to false`);a=await this.impl.parseInput({args:n.args||[],modifiers:t||{},commandName:n.commandName},Nn,e)}else a=t;else Ye.command(`CommandAdapterV2: '${this.name}' has no parseInput(), using args as-is`),a=t;if(Ye.command("CommandAdapterV2: Calling execute with parsed input:",a),2===this.impl.execute.length)o=await this.impl.execute(a,i);else{const e=Array.isArray(a)?a:[a];o=await this.impl.execute(i,...e)}return Ye.command("CommandAdapterV2: Command result:",o),Object.assign(e,Pn.fromTyped(i,e)),this.hookRegistry&&await this.hookRegistry.runAfterExecute(r,o),o}catch(e){if(Dn(e)||Ye.command(`CommandAdapterV2: Error executing '${this.name}':`,e),this.hookRegistry&&e instanceof Error)throw await this.hookRegistry.runOnError(r,e);throw e}}validate(e){return this.impl.validate?this.impl.validate(e):{isValid:1,errors:[],suggestions:[]}}}class $n{constructor(e,t){this.adapters=new Map,this.implementations=new Map,this.hookRegistry=t}setHookRegistry(e){this.hookRegistry=e;for(const t of this.adapters.values())t.setHookRegistry(e);Ye.runtime(`CommandRegistryV2: Hook registry set and propagated to ${this.adapters.size} adapters`)}getHookRegistry(){return this.hookRegistry}register(e){const t=e.name||e.metadata?.name;if(!t||"string"!=typeof t)throw Error("Cannot register command: no name found. Provide a 'name' property or 'metadata.name' on the implementation.");const n=t.toLowerCase();Ye.runtime(`CommandRegistryV2: Registering command '${n}'`),this.implementations.set(n,e);const r=new Rn(e,void 0,this.hookRegistry);this.adapters.set(n,r),T.add(n);const i=e.metadata?.aliases;if(i&&Array.isArray(i))for(const t of i){const n=t.toLowerCase();this.implementations.set(n,e),this.adapters.set(n,r),T.add(n)}}getAdapter(e){return this.adapters.get(e.toLowerCase())}has(e){return this.adapters.has(e.toLowerCase())}getCommandNames(){return Array.from(this.adapters.keys())}getImplementation(e){return this.implementations.get(e.toLowerCase())}getAdapters(){return new Map(this.adapters)}validateCommand(e,t){const n=this.getAdapter(e);return n?n.validate(t):{isValid:0,errors:[{type:"runtime-error",message:"Unknown command: "+e,suggestions:["Available commands: "+this.getCommandNames().join(", ")]}],suggestions:["Available commands: "+this.getCommandNames().join(", ")]}}}let In=null;function Mn(){return In||(In=function(){const e=new $n,t=new On,n=new Cn,r=new Set,i={commands:e,eventSources:t,context:n,use(a){if(r.has(a.name))Ye.runtime(`[LokaScriptRegistry] Plugin '${a.name}' is already installed`);else{if(a.commands)for(const t of a.commands)e.register(t);if(a.eventSources)for(const e of a.eventSources)t.register(e.name,e);if(a.contextProviders)for(const{name:e,provide:t,options:r}of a.contextProviders)n.register(e,t,r);a.setup?.(i),r.add(a.name)}},reset(){r.clear()}};return i}()),In}class qn{constructor(e={}){this.contextCache=new WeakMap;const t=Mn();this.options={enableContextProviders:e.enableContextProviders??1,enableEventSources:e.enableEventSources??1,registry:e.registry??{}},this.contextRegistry=this.options.registry.context??t.context,this.eventSourceRegistry=this.options.registry.eventSources??t.eventSources,Ye.runtime(`[RegistryIntegration] Initialized (context=${this.options.enableContextProviders}, events=${this.options.enableEventSources})`)}enhanceContext(e){if(!this.options.enableContextProviders)return e;const t=this.contextCache.get(e);if(t)return t;try{const t=this.contextRegistry.enhance(e);return this.contextCache.set(e,t),Ye.runtime(`[RegistryIntegration] Enhanced context with ${this.contextRegistry.getProviderNames().length} providers`),t}catch(t){return Ye.runtime("[RegistryIntegration] Failed to enhance context: "+(t instanceof Error?t.message:t+"")),e}}getEventSource(e){if(!this.options.enableEventSources)return;const t=this.eventSourceRegistry.get(e);if(t)return Ye.runtime(`[RegistryIntegration] Found event source for '${e}'`),t;const n=this.eventSourceRegistry.findSourceForEvent(e);if(n){const t=this.eventSourceRegistry.get(n);return Ye.runtime(`[RegistryIntegration] Found event source '${n}' supporting '${e}'`),t}}hasEventSource(e){return void 0!==this.getEventSource(e)}subscribeToEventSource(e,t,n){if(!this.options.enableEventSources)throw Error("Event sources are disabled in this runtime");const r=this.eventSourceRegistry.subscribe(e,t,n);if(!r)throw Error(`Failed to subscribe to event source '${e}'`);return Ye.runtime(`[RegistryIntegration] Subscribed to '${e}' event '${t.event}' (id: ${r.id})`),r}getEventSourceNames(){return this.eventSourceRegistry.getSourceNames()}getContextProviderNames(){return this.contextRegistry.getProviderNames()}destroy(){this.eventSourceRegistry.destroy(),this.contextCache=new WeakMap,Ye.runtime("[RegistryIntegration] Destroyed")}}function _n(e){const t=Error(e.type.toUpperCase()+"_EXECUTION");return t["is"+e.type.charAt(0).toUpperCase()+e.type.slice(1)]=1,"returnValue"in e&&(t.returnValue=e.returnValue),t}function Dn(e){return e instanceof Error?null!==t(e)||"HALT_EXECUTION"===e.message||"EXIT_COMMAND"===e.message||"EXIT_EXECUTION"===e.message:0}function Vn(e){if(void 0===e)return;let t=e;if(t&&"object"==typeof t){const e=t;if("result"in e&&"wasAsync"in e)t=e.result;else if("result"in e&&"executed"in e){if(t=e.result,e.preserveArrayResult)return void 0!==t?t:void 0}else if("lastResult"in e&&"type"in e)t=e.lastResult;else if("conditionResult"in e&&"executedBranch"in e){if(void 0===e.result)return;t=e.result}else"value"in e&&1===Object.keys(e).length||"value"in e&&"target"in e&&"targetType"in e?t=e.value:"data"in e&&"status"in e&&"headers"in e&&(t=e.data)}return Array.isArray(t)&&t.length>0&&(t=t[0]),t}function Hn(e){return null!==e&&"object"==typeof e&&"command"in e&&"selector"in e}const Fn=new WeakMap;class Bn{constructor(e){this.autoCleanupObserver=null,this.registryIntegration=null,this.runtimeWarnings=[],this.options={commandTimeout:1e4,enableErrorReporting:1,enableResultPattern:1,enableAutoCleanup:1,...e},this.registry=e.registry,this.expressionRegistry=e.expressionRegistry,this.behaviorRegistry=new Map,this.globalVariables=Ln(),this.hookRegistry=new Sn,e.hooks&&this.hookRegistry.register("default",e.hooks),this.registry.setHookRegistry(this.hookRegistry),this.cleanupRegistry=new Tn,this.options.enableAutoCleanup&&this.setupAutoCleanup(),0!=e.registryIntegration&&(this.registryIntegration=new qn("object"==typeof e.registryIntegration?e.registryIntegration:{}),Ye.runtime("RuntimeBase: Registry integration enabled")),this.behaviorAPI={has:e=>this.behaviorRegistry.has(e),get:e=>this.behaviorRegistry.get(e),set:(e,t)=>this.behaviorRegistry.set(e,t),resolve:null,install:async(e,t,n)=>await this.installBehaviorOnElement(e,t,n)}}setupAutoCleanup(){"undefined"!=typeof MutationObserver&&"undefined"!=typeof document&&(this.autoCleanupObserver=new MutationObserver(e=>{const t=[];for(const n of e)for(const e of n.removedNodes)e instanceof Element&&t.push(e);t.length>0&&queueMicrotask(()=>{for(const e of t)if(!e.isConnected){const t=this.cleanupRegistry.cleanupElementTree(e);t>0&&Ye.runtime(`RuntimeBase: Auto-cleaned ${t} resources for removed element`)}})}),document.body?this.autoCleanupObserver.observe(document.body,{childList:1,subtree:1}):document.addEventListener("DOMContentLoaded",()=>{this.autoCleanupObserver?.observe(document.body,{childList:1,subtree:1})},{once:1}))}registerHooks(e,t){this.hookRegistry.register(e,t)}unregisterHooks(e){return this.hookRegistry.unregister(e)}getRegisteredHooks(){return this.hookRegistry.getRegisteredNames()}cleanup(e){return this.cleanupRegistry.cleanupElement(e)}trackListener(e,t,n,r,i){this.cleanupRegistry.registerListener(e,t,n,r,i)}cleanupTree(e){return this.cleanupRegistry.cleanupElementTree(e)}getCleanupStats(){return this.cleanupRegistry.getStats()}getCleanupRegistry(){return this.cleanupRegistry}logError(...e){this.options.enableErrorReporting&&console.error(...e)}logWarn(...e){this.options.enableErrorReporting&&console.warn(...e)}destroy(){this.autoCleanupObserver&&(this.autoCleanupObserver.disconnect(),this.autoCleanupObserver=null),this.cleanupRegistry.cleanupAll(),this.hookRegistry.clear(),this.behaviorRegistry.clear(),Ye.runtime("RuntimeBase: Destroyed")}hasErrorDiagnostics(e){const t=e.diagnostics;return!!t?.some(e=>"error"===e.severity)}getWarnings(){return this.runtimeWarnings}async execute(e,t){Ye.runtime(`RUNTIME BASE: execute() called with node type: '${e.type}'`),t.registry||(t.registry=this.expressionRegistry),t.locals.has("_behaviors")||t.locals.set("_behaviors",this.behaviorAPI),t.locals.has("_runtimeExecute")||t.locals.set("_runtimeExecute",(e,n)=>this.execute(e,n||t));try{if(this.hasErrorDiagnostics(e)){const t=e.diagnostics?.[0];return Ye.runtime("⚠️ RUNTIME: Skipping error node: "+(t?.message||"unknown error")),void this.runtimeWarnings.push(t?.message||"Skipped error node")}switch(e.type){case"command":if(this.options.enableResultPattern)try{const n=await this.processCommandWithResult(e,t);if(!i(n))throw _n(n.error);return n.value}catch(e){throw e}return await this.processCommand(e,t);case"eventHandler":return await this.executeEventHandler(e,t);case"event":{const n={type:"eventHandler",event:e.event,events:[e.event],commands:e.body||[],target:e.filter,modifiers:e.modifiers||{}};return await this.executeEventHandler(n,t)}case"behavior":return await this.executeBehaviorDefinition(e,t);case"Program":return await this.executeProgram(e,t);case"initBlock":case"block":return await this.executeBlock(e,t);case"sequence":case"CommandSequence":if(this.options.enableResultPattern){const n=e,r=await this.executeCommandSequenceWithResult(n.commands||[],t);if(!i(r))throw _n(r.error);return r.value}return await this.executeCommandSequence(e,t);case"objectLiteral":return await this.executeObjectLiteral(e,t);default:if(this.options.enableResultPattern){const n=await this.evaluateExpressionWithResult(e,t);if(!i(n))throw _n(n.error);return n.value}return await this.evaluateExpression(e,t)}}catch(e){throw e}}async processCommand(e,t){const{name:n,args:r,modifiers:i}=e,a=n.toLowerCase();if(Ye.command(`RUNTIME BASE: Processing command '${a}'`),this.registry.has(a)){const e=await this.registry.getAdapter(a);if(!e)throw Error(`Command '${a}' is registered but failed to load adapter.`);try{return await e.execute(t,{args:r||[],modifiers:i||{},commandName:a,runtime:this})}catch(e){throw Dn(e)||this.logError(`Error executing command '${a}':`,e),e}}const o=`Unknown command: ${n}. Ensure it is registered in the Runtime options.`;throw this.logWarn(o),Error(o)}toSignal(e){const n=t(e);if(n){if(n.isHalt||"HALT_EXECUTION"===n.message)return{type:"halt"};if(n.isExit||"EXIT_COMMAND"===n.message)return{type:"exit",returnValue:n.returnValue};if(n.isBreak)return{type:"break"};if(n.isContinue)return{type:"continue"};if(n.isReturn)return{type:"return",returnValue:n.returnValue}}if(e instanceof Error){if("HALT_EXECUTION"===e.message)return{type:"halt"};if("EXIT_COMMAND"===e.message)return{type:"exit"}}return null}async processCommandWithResult(e,t){const{name:i,args:a,modifiers:o}=e,s=i.toLowerCase();if(Ye.command(`RUNTIME BASE (Result): Processing command '${s}'`),!this.registry.has(s)){const e=`Unknown command: ${i}. Ensure it is registered in the Runtime options.`;throw this.logWarn(e),Error(e)}const l=await this.registry.getAdapter(s);if(!l)throw Error(`Command '${s}' is registered but failed to load adapter.`);try{return n(await l.execute(t,{args:a||[],modifiers:o||{},commandName:s,runtime:this}))}catch(e){const t=this.toSignal(e);if(t)return r(t);throw this.logError(`Error executing command '${s}':`,e),e}}async executeCommandSequenceWithResult(e,t){let r;for(const a of e){if(this.hasErrorDiagnostics(a)){const e=a.diagnostics?.[0];Ye.runtime("⚠️ RUNTIME: Skipping error node: "+(e?.message||"unknown error")),this.runtimeWarnings.push(e?.message||"Skipped error node");continue}if("command"===a.type){const e=await this.processCommandWithResult(a,t);if(!i(e)){const r=e.error;switch(r.type){case"halt":case"exit":case"break":case"continue":return e;case"return":return void 0!==r.returnValue&&Object.assign(t,{it:r.returnValue,result:r.returnValue}),n(r.returnValue)}}r=e.value}else{const e=await this.evaluateExpressionWithResult(a,t);if(!i(e))return e;r=e.value}}return n(r)}async evaluateExpression(e,t){const n=t.registry?t:{...t,registry:this.expressionRegistry},r=await dn(e,n);return Hn(r)?await this.executeCommandFromPattern(r.command,r.selector,t):r}async evaluateExpressionWithResult(e,t){const a=t.registry?t:{...t,registry:this.expressionRegistry},o=await async function(e,t){try{return n(await dn(e,t))}catch(e){if(e instanceof Error){const t=e;if(t.isHalt||"HALT_EXECUTION"===t.message)return r({type:"halt"});if(t.isExit||"EXIT_COMMAND"===t.message)return r({type:"exit",returnValue:t.returnValue});if(t.isBreak)return r({type:"break"});if(t.isContinue)return r({type:"continue"});if(t.isReturn)return r({type:"return",returnValue:t.returnValue})}throw e}}(e,a);if(!i(o))return o;const s=o.value;if(Hn(s)){if(this.options.enableResultPattern)return this.processCommandWithResult({type:"command",name:s.command,args:[{type:"literal",value:s.selector}]},t);try{return n(await this.executeCommandFromPattern(s.command,s.selector,t))}catch(e){const t=this.toSignal(e);if(t)return r(t);throw e}}return n(s)}async executeCommandFromPattern(e,t,n){return this.processCommand({type:"command",name:e,args:[{type:"literal",value:t}]},n)}async executeProgram(e,t){if(!e.statements||!Array.isArray(e.statements))return;let n;const r=[],i=[],a=[];for(const t of e.statements)"eventHandler"===t.type?r.push(t):"initBlock"===t.type?i.push(t):a.push(t);for(const e of r)try{await this.execute(e,t)}catch(e){if(Dn(e)&&(e.isHalt||e.isExit))break;throw e}for(const e of i)try{n=await this.execute(e,t)}catch(e){if(Dn(e)&&(e.isHalt||e.isExit))break;throw e}for(const e of a)try{n=await this.execute(e,t)}catch(e){if(Dn(e)&&(e.isHalt||e.isExit))break;throw e}return n}async executeBlock(e,t){if(e.commands&&Array.isArray(e.commands))for(const n of e.commands)try{await this.execute(n,t)}catch(e){if(Dn(e)&&e.isHalt)break;throw e}}async executeCommandSequence(e,t){if(!e.commands||!Array.isArray(e.commands))return;let n;for(const r of e.commands)try{n=await this.execute(r,t)}catch(e){if(Dn(e)){if(e.isHalt||e.isExit)break;if(e.isReturn){if(void 0!==e.returnValue)return Object.assign(t,{it:e.returnValue,result:e.returnValue}),e.returnValue;break}if(e.isBreak)throw e}throw e}return n}async executeObjectLiteral(e,t){const n={};if(!e.properties)return n;for(const r of e.properties){let e;e="identifier"===r.key.type?r.key.name:"literal"===r.key.type?r.key.value+"":await this.execute(r.key,t)+"";const i=await this.execute(r.value,t);n[e]=i}return n}enhanceContext(e){return this.registryIntegration?this.registryIntegration.enhanceContext(e):e}async executeBehaviorDefinition(e,t){const{name:n,parameters:r=[],eventHandlers:i=[],initBlock:a}=e,o=e.imperativeInstaller;"function"==typeof o?(this.behaviorRegistry.set(n,{name:n,parameters:r,type:"imperative",install:o}),Ye.runtime(`RUNTIME BASE: Registered imperative behavior '${n}'`)):(this.behaviorRegistry.set(n,{name:n,parameters:r,eventHandlers:i,initBlock:a}),Ye.runtime(`RUNTIME BASE: Registered behavior '${n}'`))}async installBehaviorOnElement(e,t,n){Ye.runtime("BEHAVIOR: installBehaviorOnElement called: "+e);let r=this.behaviorRegistry.get(e);if(!r&&(this.behaviorAPI.resolve&&this.behaviorAPI.resolve(e)&&(r=this.behaviorRegistry.get(e)),!r))throw Error(`Behavior "${e}" not found`);if("imperative"===r.type)return void("function"==typeof r.install&&(Ye.runtime(`BEHAVIOR: Installing imperative behavior '${e}'`),r.install(t,n),Ye.runtime(`BEHAVIOR: Finished installing imperative behavior '${e}'`)));Ye.runtime("BEHAVIOR: Found behavior, eventHandlers count: "+(r.eventHandlers?.length||0));const i={me:t,you:null,it:null,result:null,locals:new Map,globals:this.globalVariables,registry:this.expressionRegistry,halted:0,returned:0,broke:0,continued:0,async:0},a=this.enhanceContext(i);if(r.parameters)for(const e of r.parameters)a.locals.set(e,e in n?n[e]:void 0);for(const[e,t]of Object.entries(n))r.parameters?.includes(e)||a.locals.set(e,t);if(r.initBlock){Ye.runtime("BEHAVIOR: Running init block for "+e);const t=this.options.commandTimeout??1e4;try{await Promise.race([this.execute(r.initBlock,a),new Promise((n,r)=>setTimeout(()=>r(Error(`Behavior "${e}" init block timed out after ${t}ms`)),t))]),Ye.runtime("BEHAVIOR: Init block completed for "+e)}catch(t){if(Ye.runtime(`BEHAVIOR: Init block error for ${e}:`,t),!(t instanceof Error&&Dn(t)))throw t}}if(Ye.runtime(`BEHAVIOR: About to attach ${r.eventHandlers?.length||0} handlers for ${e}`),r.eventHandlers){const t=this.options.commandTimeout??1e4;for(const n of r.eventHandlers)await Promise.race([this.executeEventHandler(n,a),new Promise((n,r)=>setTimeout(()=>r(Error(`Behavior "${e}" handler attachment timed out after ${t}ms`)),t))])}Ye.runtime("BEHAVIOR: Finished installing "+e)}async executeEventHandler(e,t){const{event:n,events:r,commands:i,target:a,args:o,selector:s,attributeName:l,watchTarget:c,modifiers:u}=e,p=r&&r.length>0?r:[n];Ye.runtime(`BEHAVIOR: executeEventHandler: event='${n}', target='${a}'`);let m=[],d=null;if(a){const e="string"==typeof a?a.toLowerCase():"";if("window"===e||"the window"===e)d=window;else if("document"===e||"the document"===e||"body"===e)d=document;else if("me"===e||"myself"===e)m=t.me?[t.me]:[];else if("string"==typeof a&&t.locals.has(a)){const e=t.locals.get(a);Ye.runtime(`BEHAVIOR: Target resolution: found local '${a}', isElement: ${this.isElement(e)}`),this.isElement(e)?m=[e]:Array.isArray(e)?m=e.filter(e=>this.isElement(e)):"string"==typeof e&&(m=this.queryElements(e,t))}else Ye.runtime(`BEHAVIOR: Target resolution: querying for '${a}'`),m=this.queryElements(a,t)}else m=t.me?[t.me]:[];if(0===m.length&&!d)return void Ye.runtime(`BEHAVIOR: executeEventHandler - No targets found for event '${n}', returning early`);if("mutation"===n&&l)return void this.setupMutationObserver(m,l,i,t);if("change"===n&&c)return void this.setupChangeObserver(c,i,t);const f=e.customEventSource;if(f&&this.registryIntegration){Ye.runtime(`BEHAVIOR: executeEventHandler - Using custom event source '${f}' for event '${n}'`);const e=async e=>{const r=new Map(t.locals),a={...t,locals:r,it:e,event:e},o=this.enhanceContext(a);Ye.runtime(`CUSTOM EVENT: Executing commands for event '${n}'`);try{await this.execute({type:"program",commands:i},o)}catch(e){this.logError(`[HyperFixi] Error executing commands for custom event '${n}':`,e)}};try{const r=this.registryIntegration.subscribeToEventSource(f,{event:n,handler:e,target:a,selector:s},t);Ye.runtime(`BEHAVIOR: Subscribed to custom event source '${f}' (id: ${r.id})`),this.cleanupRegistry.registerGlobal(()=>r.unsubscribe(),"listener",`Custom event source '${f}' subscription ${r.id}`)}catch(e){this.logError(`[HyperFixi] Failed to subscribe to custom event source '${f}':`,e)}return}const y=Bn.createEventHandler(this,i,t,s,o);let h,v=null;if(u){let e=y;if(u.prevent){const t=e;e=async e=>(e.preventDefault(),t(e))}if(u.stop){const t=e;e=async e=>(e.stopPropagation(),t(e))}if(u.debounce){const t=u.debounce;let n;h=r=>{n&&clearTimeout(n),n=setTimeout(()=>e(r),t)},v=()=>{n&&(clearTimeout(n),n=void 0)}}else if(u.throttle){const t=u.throttle;let n=0;h=r=>{const i=Date.now();t>i-n||(n=i,e(r))}}else h=e}else h=y;const g=u?.once?{once:1}:void 0;if(d){for(const e of p)d.addEventListener(e,h,g),m.length>0?this.cleanupRegistry.registerListener(m[0],d,e,h):this.cleanupRegistry.registerGlobal(()=>d.removeEventListener(e,h),"listener",`Global ${e} listener`);v&&(m.length>0?this.cleanupRegistry.registerCustom(m[0],v,"debounce-timeout"):this.cleanupRegistry.registerGlobal(v,"timeout","debounce-timeout"))}else for(const e of m){for(const t of p){if("resize"===t&&"undefined"!=typeof ResizeObserver){const t=new ResizeObserver(e=>{for(const n of e){const e=new CustomEvent("resize",{detail:n,bubbles:0,cancelable:0});if(e.synthetic=1,h(e),g?.once){t.disconnect();break}}});t.observe(e),this.cleanupRegistry.registerCustom(e,()=>t.disconnect(),"resize-observer");continue}e.addEventListener(t,h,g),this.cleanupRegistry.registerListener(e,e,t,h)}v&&this.cleanupRegistry.registerCustom(e,v,"debounce-timeout")}}static createEventHandler(e,t,n,r,i){return async a=>{const o=Fn.get(a)??0;if(o>=100)return;if(Fn.set(a,o+1),r&&a.target instanceof Element)try{if(!a.target.matches(r)&&!a.target.closest(r))return}catch{Ye.runtime(`Event delegation: invalid CSS selector '${r}', skipping filter`)}const s=new Map(n.locals),l={...n,locals:s,it:a,event:a};s.has("target")||l.locals.set("target",a.target);const c=e.enhanceContext(l);if(i&&i.length>0){const e=a,t=e.detail;for(const n of i)c.locals.set(n,e[n]??t?.[n]??null)}for(const n of t)try{const t=Vn(await e.execute(n,c));void 0!==t&&Object.assign(c,{it:t,result:t})}catch(t){if(Dn(t)){if(t.isHalt||t.isExit)break;if(t.isReturn){void 0!==t.returnValue&&Object.assign(c,{it:t.returnValue,result:t.returnValue});break}}throw e.logError("COMMAND FAILED:",t),t}}}setupMutationObserver(e,t,n,r){Ye.runtime(`RUNTIME BASE: Setting up MutationObserver for attribute '${t}' on ${e.length} elements`);for(const i of e){const e=new MutationObserver(async e=>{for(const a of e)if("attributes"===a.type&&a.attributeName===t){Ye.event(`MUTATION DETECTED: attribute '${t}' changed on`,i);const e={...r,me:i,it:a,locals:new Map(r.locals)},o=a.oldValue,s=i.getAttribute(t);e.locals.set("oldValue",o),e.locals.set("newValue",s);const l=this.enhanceContext(e);for(const e of n)try{await this.execute(e,l)}catch(e){if(Dn(e)){if(e.isHalt||e.isExit||e.isReturn)break}else this.logError("Error executing mutation handler command:",e)}}});e.observe(i,{attributes:1,attributeOldValue:1,attributeFilter:[t]}),this.cleanupRegistry.registerObserver(i,e),Ye.runtime("RUNTIME BASE: MutationObserver attached to",i,`for attribute '${t}'`)}}async setupChangeObserver(e,t,n){Ye.runtime("RUNTIME BASE: Setting up MutationObserver for content changes on watch target");const r=await this.execute(e,n);let i=[];this.isElement(r)?i=[r]:Array.isArray(r)&&(i=r.filter(e=>this.isElement(e))),Ye.runtime(`RUNTIME BASE: Watching ${i.length} target elements for content changes`);for(const e of i){const r=new MutationObserver(async r=>{for(const i of r)if("childList"===i.type||"characterData"===i.type){Ye.event("CONTENT CHANGE DETECTED on",e,"mutation type:",i.type);const r={...n,me:n.me,it:i,locals:new Map(n.locals)};r.locals.set("target",e);const a=i.oldValue,o=e.textContent;null!==a&&r.locals.set("oldValue",a),r.locals.set("newValue",o);const s=this.enhanceContext(r);for(const e of t)try{await this.execute(e,s)}catch(e){if(Dn(e)){if(e.isHalt||e.isExit||e.isReturn)break}else this.logError("Error executing change handler command:",e)}}});r.observe(e,{childList:1,characterData:1,subtree:1,characterDataOldValue:1}),this.cleanupRegistry.registerObserver(e,r),Ye.runtime("RUNTIME BASE: MutationObserver attached to",e,"for content changes")}}queryElements(e,t){const n=t.me,r=(n instanceof Element?n.ownerDocument:null)??("undefined"!=typeof document?document:null);if(!r)return[];let i=e;i.startsWith("<")&&i.endsWith("/>")&&(i=i.slice(1,-2).trim());try{return Array.from(r.querySelectorAll(i))}catch{return Ye.runtime(`queryElements: invalid CSS selector '${i}'`),[]}}isElement(e){return"undefined"!=typeof HTMLElement&&e instanceof HTMLElement?1:e&&"object"==typeof e?!!e.style&&!!e.classList:0}}function Un(...e){const t=new Map;for(const n of e)for(const[e,r]of Object.entries(n))t.set(e,r);return t}const Gn={1:"one",2:"two",3:"three",4:"four",5:"five"};function Wn(e,t,n,r){return e.length!==t?`${n} requires exactly ${i=t,Gn[i]??i+""} argument${1===t?"":"s"}${r?` (${r})`:""}`:null;var i}function Kn(e,t,n,r){return"string"!=typeof e[t]?`${n} ${r||"argument "+(t+1)} must be a string`:null}function Jn(e,t,n){return Wn(e,1,t,n)??Kn(e,0,t,n)}function Zn(e,t){return Wn(e,2,t,"left, right")}function Yn(){return null}function Xn(e,t,n,r){return e.length>t?`${n} expression takes at most ${1===t?"one":t+""} argument${1===t?"":"s"}${r?` (${r})`:""}`:null}function Qn(e,t,n,r,i){return t>e.length||e.length>n?`${r} requires ${t}-${n} arguments${i?` (${i})`:""}`:null}function er(e,t,n,r=[]){return{type:e,message:t,suggestions:r,...n&&{path:n}}}const tr=("undefined"!=typeof process?"production"===process.env.NODE_ENV:0)||"undefined"!=typeof process&&"true"===process.env.HYPERFIXI_SKIP_VALIDATION||"undefined"!=typeof globalThis&&"true"===globalThis.HYPERFIXI_SKIP_VALIDATION;let nr;function rr(){return nr({validate:e=>({success:1,data:e})})}function ir(e,t){if(tr)return rr();const n=nr({validate:n=>{if("object"!=typeof n||null===n||Array.isArray(n))return{success:0,error:er("type-mismatch","Expected object, received "+typeof n)};const r=n,i={};if(t?.strict){const t=Object.keys(e),n=Object.keys(r).filter(e=>!t.includes(e));if(n.length>0)return{success:0,error:er("runtime-error","Unexpected properties: "+n.join(", "))}}for(const[t,n]of Object.entries(e)){const e=r[t];if(!(t in r)&&!n.t)return{success:0,error:er("missing-argument",`Required field "${t}" is missing`,t)};const a=n.validate(e);if(!a.success)return{success:0,error:er("validation-error",a.error.message||`Field "${t}" validation failed`,a.error.path?`${t}.${a.error.path}`:t)};void 0!==a.data&&(i[t]=a.data)}return{success:1,data:i}}});return n.strict=()=>ir(e,{strict:1}),n}nr=function(e){return e.describe||(e.describe=function(e){return this.description=e,this}),e.safeParse||(e.safeParse=function(e){const t=this.validate(e);return t.success?{success:1,data:t.data}:{success:0,error:{errors:t.error?[t.error]:[]}}}),e.parse||(e.parse=function(e){const t=this.validate(e);if(t.success&&void 0!==t.data)return t.data;throw Error(t.error?.message||"Validation failed")}),e.optional||(e.optional=function(){const e=this.validate.bind(this),t={...this,t:1,validate:t=>null==t?{success:1,data:void 0}:e(t)};return nr(t)}),e.min||(e.min=function(e){const t=this.validate.bind(this),n={...this,validate:n=>{const r=t(n);return r.success&&"string"==typeof r.data&&e>r.data.length?{success:0,error:er("runtime-error",`String must be at least ${e} characters long`)}:r}};return nr(n)}),e.max||(e.max=function(e){const t=this.validate.bind(this),n={...this,validate:n=>{const r=t(n);return r.success&&"string"==typeof r.data&&r.data.length>e?{success:0,error:er("runtime-error",`String must be at most ${e} characters long`)}:r}};return nr(n)}),e.default||(e.default=function(e){const t=this.validate.bind(this),n={...this,i:e,o:1,validate:n=>void 0===n?{success:1,data:e}:t(n)};return nr(n)}),e.rest||(e.rest=function(e){return this}),e.refine||(e.refine=function(e,t){const n=this.validate.bind(this),r={...this,validate:r=>{const i=n(r);return i.success?e(i.data)?i:{success:0,error:er("runtime-error",t||"Refinement validation failed")}:i}};return nr(r)}),new Proxy(e,{get:(e,t,n)=>t in e||"string"!=typeof t||t.startsWith("_")||"constructor"===t||"validate"===t||"then"===t?Reflect.get(e,t,n):function(...e){return n}})};const ar=e=>function(e={}){return tr?rr():nr({validate:t=>e.optional&&null==t?{success:1,data:void 0}:"string"!=typeof t?{success:0,error:er("type-mismatch","Expected string, received "+typeof t)}:void 0!==e.minLength&&e.minLength>t.length?{success:0,error:er("runtime-error",`String must be at least ${e.minLength} characters long`)}:void 0!==e.maxLength&&t.length>e.maxLength?{success:0,error:er("runtime-error",`String must be at most ${e.maxLength} characters long`)}:e.pattern&&!e.pattern.test(t)?e.pattern.source.startsWith("^")&&e.pattern.source.endsWith("$")?{success:0,error:er("runtime-error",`Expected "${e.pattern.source.slice(1,-1)}", received "${t}"`)}:{success:0,error:er("missing-argument","String does not match required pattern")}:{success:1,data:t},...e.description&&{description:e.description}})}(e||{}),or=e=>function(e={}){return tr?rr():nr({validate:t=>{const n=Number(t);return isNaN(n)?{success:0,error:er("type-mismatch","Expected number, received "+typeof t)}:void 0!==e.min&&e.min>n?{success:0,error:er("runtime-error","Number must be at least "+e.min)}:void 0!==e.max&&n>e.max?{success:0,error:er("runtime-error","Number must be at most "+e.max)}:{success:1,data:n}}})}(e||{}),sr=()=>tr?rr():nr({validate:e=>"boolean"!=typeof e?{success:0,error:er("type-mismatch","Expected boolean, received "+typeof e)}:{success:1,data:e}}),lr=e=>ir(e),cr=e=>function(e){return tr?rr():nr({validate:t=>{if(!Array.isArray(t))return{success:0,error:er("type-mismatch","Expected array, received "+typeof t)};if(t.length!==e.length)return{success:0,error:er("runtime-error",`Expected tuple of length ${e.length}, received length ${t.length}`)};const n=[];for(let r=0;e.length>r;r++){const i=e[r].validate(t[r]);if(!i.success)return{success:0,error:er("runtime-error",i.error.message,i.error.path?`${r}.${i.error.path}`:""+r)};n.push(i.data)}return{success:1,data:n}}})}(e),ur=()=>rr(),pr=()=>rr(),mr=()=>function(e,t="Custom validation failed"){return tr?rr():nr({validate:n=>e(n)?{success:1,data:n}:{success:0,error:er("runtime-error",t)}})}(e=>void 0===e,"Expected undefined");class dr{trackPerformance(e,t,n,r){e.evaluationHistory&&e.evaluationHistory.push({expressionName:this.name,category:this.category,input:t,output:n.success?n.value:n.error,timestamp:r,duration:Date.now()-r,success:n.success})}trackSimple(e,t,n,r=(n?"success":"error")){e.evaluationHistory&&e.evaluationHistory.push({expressionName:this.name,category:this.category,input:"operation",output:r,timestamp:t,duration:Date.now()-t,success:n})}toBoolean(e){return 0==e||0===e||0n===e||""===e||null==e||ce(e)&&isNaN(e)?0:1}success(e,t){return{success:1,value:e,type:t}}failure(e,t,n,r,i=[]){return{success:0,error:{name:e,type:t,message:n,code:r,suggestions:i}}}validationSuccess(){return{isValid:1,errors:[],suggestions:[]}}validationFailure(e,t,n=[]){return{isValid:0,errors:[{type:e,message:t,suggestions:n}],suggestions:n}}isElement(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&1===e.nodeType&&"tagName"in e&&"string"==typeof e.tagName}inferType(e){return null===e?"null":void 0===e?"undefined":this.isElement(e)?"element":Array.isArray(e)?"array":pe(e)?"object":typeof e}inferEvaluationType(e){return void 0===e?"Undefined":null===e?"Null":le(e)?"String":ce(e)?"Number":ue(e)?"Boolean":Array.isArray(e)?"Array":this.isElement(e)?"Element":"Object"}normalizeCollection(e){return Array.isArray(e)?e:e instanceof NodeList?Array.from(e):le(e)?e.split(""):null==e?[]:pe(e)&&Symbol.iterator in e?Array.from(e):[]}toNumber(e){if(ce(e)&&Number.isFinite(e))return e;if(le(e)){const t=Number(e);return Number.isFinite(t)?t:null}return ue(e)?e?1:0:null}}const fr=lr({selector:ar().min(1),single:sr().optional().default(0)});new class extends dr{constructor(){super(...arguments),this.name="me",this.category="Reference",this.syntax="me",this.description="References the current element in the execution context",this.inputSchema=mr(),this.outputType="Element",this.metadata={category:"Reference",complexity:"simple"}}async evaluate(e,t){const n=Date.now();try{const r=e.me,i=this.isElement(r)?r:null,a=this.success(i,"element");return this.trackPerformance(e,t,a,n),a}catch(r){const i=this.failure("MeExpressionError","runtime-error",r instanceof Error?r.message:'Failed to evaluate "me"',"ME_EVALUATION_FAILED",["Ensure element context is properly set",'Check if "me" is available in current scope']);return this.trackPerformance(e,t,i,n),i}}validate(e){return void 0!==e?this.validationFailure("type-mismatch",'"me" expression takes no arguments',['Use "me" without any parameters']):this.validationSuccess()}},new class extends dr{constructor(){super(...arguments),this.name="you",this.category="Reference",this.syntax="you",this.description="References the target element (usually event target or command target)",this.inputSchema=mr(),this.outputType="Element",this.metadata={category:"Reference",complexity:"simple"}}async evaluate(e,t){const n=Date.now();try{const r=e.you,i=this.isElement(r)?r:null,a=this.success(i,"element");return this.trackPerformance(e,t,a,n),a}catch(r){const i=this.failure("YouExpressionError","runtime-error",r instanceof Error?r.message:'Failed to evaluate "you"',"YOU_EVALUATION_FAILED",["Ensure target element is available in context",'Check if "you" is set by event or command']);return this.trackPerformance(e,t,i,n),i}}validate(e){return void 0!==e?this.validationFailure("type-mismatch",'"you" expression takes no arguments',['Use "you" without any parameters']):this.validationSuccess()}},new class extends dr{constructor(){super(...arguments),this.name="it",this.category="Reference",this.syntax="it",this.description="References the current context variable (result of previous operation or loop item)",this.inputSchema=mr(),this.outputType="Any",this.metadata={category:"Reference",complexity:"simple"}}async evaluate(e,t){const n=Date.now();try{const r=e.it,i={success:1,value:r,type:this.inferType(r)};return this.trackPerformance(e,t,i,n),i}catch(r){const i=this.failure("ItExpressionError","runtime-error",r instanceof Error?r.message:'Failed to evaluate "it"',"IT_EVALUATION_FAILED",['Ensure "it" is set by previous operation',"Check if context variable is available"]);return this.trackPerformance(e,t,i,n),i}}validate(e){return void 0!==e?this.validationFailure("type-mismatch",'"it" expression takes no arguments',['Use "it" without any parameters']):this.validationSuccess()}},new class extends dr{constructor(){super(...arguments),this.name="css-selector",this.category="Reference",this.syntax="<selector/> or <selector/> (single)",this.description="Queries DOM elements using CSS selectors with validation",this.inputSchema=fr,this.outputType="ElementList",this.metadata={category:"Reference",complexity:"medium"}}async evaluate(e,t){const n=Date.now();try{if(!this.isValidCSSSelector(t.selector)){const r=this.failure("CSSSelectorError","invalid-argument",`Invalid CSS selector: "${t.selector}"`,"INVALID_CSS_SELECTOR",["Check selector syntax","Use valid CSS selector patterns like .class, #id, tag[attr]","Avoid special characters that need escaping"]);return this.trackPerformance(e,t,r,n),r}let r;if(t.single)r=document.querySelector(t.selector);else{const e=Array.from(document.querySelectorAll(t.selector));r=e.length>0?e:null}const i={success:1,value:r,type:Array.isArray(r)?"element-list":"element"};return this.trackPerformance(e,t,i,n),i}catch(r){const i=this.failure("CSSSelectorError","runtime-error",r instanceof Error?r.message:"CSS selector evaluation failed","CSS_SELECTOR_EVALUATION_FAILED",["Check if selector is valid CSS","Ensure DOM is ready when query executes","Verify elements exist in document"]);return this.trackPerformance(e,t,i,n),i}}validate(e){try{const t=this.inputSchema.safeParse(e);if(!t.success)return{isValid:0,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:"Invalid input: "+e.message,suggestions:this.getValidationSuggestion(e.code??"unknown")}))??[],suggestions:["Provide valid CSS selector string","Check selector syntax"]};const{selector:n}=t.data;return this.isValidCSSSelector(n)?this.validationSuccess():this.validationFailure("syntax-error",`Invalid CSS selector syntax: "${n}"`,["Use .class for class selectors","Use #id for ID selectors","Use tag for element selectors","Use [attr] for attribute selectors"])}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Ensure input matches expected format"])}}isValidCSSSelector(e){try{return document.querySelector(e),1}catch{return 0}}getValidationSuggestion(e){return[{too_small:"CSS selector cannot be empty",invalid_type:"Selector must be a string",required:"CSS selector is required"}[e]||"Check input format and types"]}};const yr={me:{name:"me",category:"Reference",evaluatesTo:"Element",evaluate:async e=>e.me??null,validate:Yn},you:{name:"you",category:"Reference",evaluatesTo:"Element",evaluate:async e=>e.you??null,validate:Yn},it:{name:"it",category:"Reference",evaluatesTo:"Any",evaluate:async e=>e.it,validate:Yn},its:{name:"its",category:"Reference",evaluatesTo:"Any",evaluate:async e=>e.it,validate:Yn},result:{name:"result",category:"Reference",evaluatesTo:"Any",evaluate:async e=>e.result,validate:Yn},querySelector:{name:"querySelector",category:"Reference",evaluatesTo:"Element",async evaluate(e,...t){const[n]=t;if("string"!=typeof n)throw Error("querySelector requires a string selector");return document.querySelector(n)},validate:e=>Jn(e,"querySelector","selector")},querySelectorAll:{name:"querySelectorAll",category:"Reference",evaluatesTo:"Array",async evaluate(e,...t){const n=t[0];if("string"!=typeof n)throw Error("querySelectorAll requires a string selector");const r=document.querySelectorAll(n);return Array.from(r)},validate:e=>Jn(e,"querySelectorAll","selector")},getElementById:{name:"getElementById",category:"Reference",evaluatesTo:"Element",async evaluate(e,...t){const n=t[0];if("string"!=typeof n)throw Error("getElementById requires a string ID");return document.getElementById(n)},validate:e=>Jn(e,"getElementById","ID")},getElementsByClassName:{name:"getElementsByClassName",category:"Reference",evaluatesTo:"Array",async evaluate(e,...t){const n=t[0];if("string"!=typeof n)throw Error("getElementsByClassName requires a string class name");const r=document.getElementsByClassName(n);return Array.from(r)},validate:e=>Jn(e,"getElementsByClassName","className")},closest:{name:"closest",category:"Reference",evaluatesTo:"Element",async evaluate(e,...t){let n=t[0];if(n&&"object"==typeof n&&"type"in n){const e=n;"identifier"===e.type&&e.name?n=e.name:"literal"===e.type&&"string"==typeof e.value&&(n=e.value)}if("string"!=typeof n)throw Error("closest requires a string selector");return e.me?e.me.closest(n):null},validate(e){if(1!==e.length)return"closest requires exactly 1 argument (selector)";const t=e[0];return"string"==typeof t||t&&"object"==typeof t&&"type"in t&&("identifier"===t.type||"literal"===t.type)?null:"closest selector must be a string or identifier"}},parent:{name:"parent",category:"Reference",evaluatesTo:"Element",evaluate:async e=>e.me?e.me.parentElement:null,validate:Yn},window:{name:"window",category:"Reference",evaluatesTo:"Object",evaluate:async e=>window,validate:Yn},document:{name:"document",category:"Reference",evaluatesTo:"Object",evaluate:async e=>document,validate:Yn},elementWithSelector:{name:"elementWithSelector",category:"Reference",evaluatesTo:"Array",async evaluate(e,...t){const n=t[0];if("string"!=typeof n)throw Error("Selector must be a string");const r=document.querySelectorAll(n);return Array.from(r)},validate:e=>Jn(e,"elementWithSelector","selector")},styleRef:{name:"styleRef",category:"Reference",evaluatesTo:"String",async evaluate(e,...t){const n=t[0],r=t[1];if("string"!=typeof n)throw Error("StyleRef requires a string property name");const i=r||e.me;if(i&&i instanceof HTMLElement){if(n.startsWith("computed-")){const e=n.substring(9);return getComputedStyle(i).getPropertyValue(e)||""}return i.style.getPropertyValue(n)||void 0}},validate:e=>Qn(e,1,2,"styleRef","property, optional element")??Kn(e,0,"styleRef","property")??(2===e.length&&e[1]&&"object"!=typeof e[1]?"styleRef element must be an HTMLElement":null)},possessiveStyleRef:{name:"possessiveStyleRef",category:"Reference",evaluatesTo:"String",async evaluate(e,...t){const n=t[0],r=t[1];if("string"!=typeof n||"string"!=typeof r)throw Error("Possessive styleRef requires possessor and property strings");let i=null;if("my"===n&&e.me?i=e.me instanceof HTMLElement?e.me:null:"its"===n&&e.it&&(i=e.it instanceof HTMLElement?e.it:null),i){if(r.startsWith("computed-")){const e=r.substring(9);return getComputedStyle(i).getPropertyValue(e)||""}return i.style.getPropertyValue(r)||void 0}},validate:e=>Wn(e,2,"possessiveStyleRef","possessor, property")??Kn(e,0,"possessiveStyleRef","possessor")??Kn(e,1,"possessiveStyleRef","property")},ofStyleRef:{name:"ofStyleRef",category:"Reference",evaluatesTo:"String",async evaluate(e,...t){const n=t[0],r=t[1];if("string"!=typeof n||"string"!=typeof r)throw Error("Of styleRef requires property and reference strings");let i=null;if("me"===r&&e.me?i=e.me instanceof HTMLElement?e.me:null:"it"===r&&e.it&&(i=e.it instanceof HTMLElement?e.it:null),i){if(n.startsWith("computed-")){const e=n.substring(9);return getComputedStyle(i).getPropertyValue(e)||""}return i.style.getPropertyValue(n)||void 0}},validate:e=>Wn(e,2,"ofStyleRef","property, reference")??Kn(e,0,"ofStyleRef","property")??Kn(e,1,"ofStyleRef","reference")}};class hr{constructor(e=100,t=5e3){this.maxSize=e,this.ttl=t,this.cache=new Map,this.accessOrder=new Map,this.accessCounter=0}get(e){const t=this.cache.get(e);if(t){if(this.ttl>=Date.now()-t.timestamp)return t.accessCount++,this.accessOrder.set(e,++this.accessCounter),t.result;this.delete(e)}}set(e,t){this.maxSize>this.cache.size||this.cache.has(e)||this.evictLRU(),this.cache.set(e,{result:t,timestamp:Date.now(),accessCount:1}),this.accessOrder.set(e,++this.accessCounter)}delete(e){return this.accessOrder.delete(e),this.cache.delete(e)}clear(){this.cache.clear(),this.accessOrder.clear(),this.accessCounter=0}size(){return this.cache.size}evictLRU(){let e,t=1/0;for(const[n,r]of this.accessOrder)t>r&&(t=r,e=n);void 0!==e&&this.delete(e)}getStats(){const e=Array.from(this.cache.values()),t=Date.now();return{size:this.cache.size,maxSize:this.maxSize,hitRate:e.length>0?e.filter(e=>e.accessCount>1).length/e.length:0,avgAge:e.length>0?e.reduce((e,n)=>e+(t-n.timestamp),0)/e.length:0,totalAccesses:e.reduce((e,t)=>e+t.accessCount,0)}}}const vr=new class{constructor(){this.domQueryCache=new hr(200,3e3),this.exprResultCache=new hr(500,2e3),this.cssMatchCache=new hr(100,5e3),this.formValueCache=new hr(50,1e3),this.hits=0,this.misses=0}querySelector(e){const t="querySelector:"+e,n=this.domQueryCache.get(t);if(void 0!==n)return this.hits++,n;this.misses++;const r=document.querySelector(e);return this.domQueryCache.set(t,r),r}querySelectorAll(e){const t="querySelectorAll:"+e,n=this.domQueryCache.get(t);if(void 0!==n)return this.hits++,n;this.misses++;const r=Array.from(document.querySelectorAll(e));return this.domQueryCache.set(t,r),r}getElementById(e){const t="getElementById:"+e,n=this.domQueryCache.get(t);if(void 0!==n)return this.hits++,n;this.misses++;const r=document.getElementById(e);return this.domQueryCache.set(t,r),r}getElementsByClassName(e){const t="getElementsByClassName:"+e,n=this.domQueryCache.get(t);if(void 0!==n)return this.hits++,n;this.misses++;const r=Array.from(document.getElementsByClassName(e));return this.domQueryCache.set(t,r),r}matches(e,t){const n=`matches:${this.getElementCacheKey(e)}:${t}`,r=this.cssMatchCache.get(n);if(void 0!==r)return this.hits++,r;this.misses++;const i=e.matches(t);return this.cssMatchCache.set(n,i),i}getExpressionResult(e){const t=this.exprResultCache.get(e);if(void 0!==t)return this.hits++,t;this.misses++}setExpressionResult(e,t){this.exprResultCache.set(e,t)}getFormValue(e){const t=this.getElementCacheKey(e),n=this.formValueCache.get("formValue:"+t);if(void 0!==n)return this.hits++,n;this.misses++}setFormValue(e,t){const n=this.getElementCacheKey(e);this.formValueCache.set("formValue:"+n,t)}invalidateElementCache(e){const t=this.getElementCacheKey(e);for(const e of[this.domQueryCache,this.cssMatchCache,this.formValueCache])for(const n of Array.from(e.cache.keys()))"string"==typeof n&&n.includes(t)&&e.delete(n)}invalidateAll(){this.domQueryCache.clear(),this.exprResultCache.clear(),this.cssMatchCache.clear(),this.formValueCache.clear(),this.hits=0,this.misses=0}getElementCacheKey(e){if(e.id)return"#"+e.id;const t=Array.from(e.classList).sort().join("."),n=this.getElementPosition(e);return`${e.tagName.toLowerCase()}${t?"."+t:""}@${n}`}getElementPosition(e){return""+Array.from(e.parentElement?.children||[]).indexOf(e)}getPerformanceStats(){const e=this.hits+this.misses;return{hits:this.hits,misses:this.misses,hitRate:Math.round(100*(e>0?this.hits/e*100:0))/100,domQueryCache:this.domQueryCache.getStats(),exprResultCache:this.exprResultCache.getStats(),cssMatchCache:this.cssMatchCache.getStats(),formValueCache:this.formValueCache.getStats()}}cleanup(){const e=Date.now();[this.domQueryCache,this.exprResultCache,this.cssMatchCache,this.formValueCache].forEach(t=>{Array.from(t.cache.entries()).forEach(([n,r])=>{e-r.timestamp>t.ttl&&t.delete(n)})})}};"undefined"!=typeof window&&setInterval(()=>{vr.cleanup()},1e4);const gr=new class{constructor(){this.metrics={tokenizationTime:0,evaluationTime:0,cacheHitRate:0,memoryUsage:0,domOperations:0},this.startTimes=new Map}startTimer(e){this.startTimes.set(e,performance.now())}endTimer(e){const t=this.startTimes.get(e);if(t){const n=performance.now()-t;return this.startTimes.delete(e),n}return 0}recordTokenization(e){this.metrics.tokenizationTime+=e}recordEvaluation(e){this.metrics.evaluationTime+=e}updateCacheMetrics(){const e=vr.getPerformanceStats();this.metrics.cacheHitRate=e.hitRate}getMetrics(){return this.updateCacheMetrics(),{...this.metrics}}reset(){this.metrics={tokenizationTime:0,evaluationTime:0,cacheHitRate:0,memoryUsage:0,domOperations:0}}};function br(){vr.cleanup(),gr.getMetrics().memoryUsage>52428800&&gr.reset()}let wr=null;function kr(e,t){if("number"==typeof e){if(!Number.isFinite(e))throw Error(`${t} must be a finite number, got ${e}`);return e}if("string"==typeof e){const n=e.trim();if(""===n)return 0;const r=parseFloat(n);if(isNaN(r))throw Error(`${t} cannot be converted to number: "${e}"`);return r}if("boolean"==typeof e)return e?1:0;if(null==e)return 0;if("object"==typeof e&&null!==e){if(Array.isArray(e)&&1===e.length){const n=e[0];if(Array.isArray(n))throw Error(t+" is a nested array, cannot convert to number");return kr(n,t)}if("string"==typeof e.textContent||"value"in e){const t=e.value??e.textContent;if(null!=t){const e=(t+"").trim();if(""===e)return 0;const n=parseFloat(e);if(!isNaN(n))return n}}const n=e.valueOf();if("number"==typeof n&&Number.isFinite(n))return n}throw Error(`${t} cannot be converted to number: ${typeof e}`)}function zr(e){if("number"==typeof e)return Number.isFinite(e)?e:null;if("string"==typeof e){const t=e.trim();if(""===t)return 0;const n=parseFloat(t);return isNaN(n)?null:n}return"boolean"==typeof e?e?1:0:null==e?0:null}function xr(e,t){if(!Number.isFinite(e)){if(Number.isNaN(e))throw Error(t+" resulted in non-finite value: NaN");throw Error(`${t} resulted in non-finite value: ${e>0?"Infinity":"-Infinity"}`)}return e}function Er(e){try{return kr(e,"_"),1}catch{return 0}}function Sr(e,t,n){if("==="===n)return e===t;if("!=="===n)return e!==t;if(null==e||null==t)return function(e,t,n){if(null==e&&null==t)switch(n){case"==":case">=":case"<=":return 1;default:return 0}switch(n){case"==":case">":case"<":case">=":case"<=":default:return 0;case"!=":return 1}}(e,t,n);const[r,i]=function(e,t){if("number"==typeof e&&"number"==typeof t)return[e,t];if("string"==typeof e&&"string"==typeof t){const n=parseFloat(e),r=parseFloat(t);return isNaN(n)||isNaN(r)?[e,t]:[n,r]}const n=zr(e),r=zr(t);return null!==n&&null!==r?[n,r]:[e+"",t+""]}(e,t);switch(n){case">":return r>i;case"<":return i>r;case">=":return r>=i;case"<=":return i>=r;case"==":return Tr(e,t);case"!=":return!Tr(e,t);default:return 0}}function Tr(e,t){if(e===t)return 1;if(typeof e==typeof t)return"string"==typeof e||"number"==typeof e?e===t:0;if("number"==typeof e&&"string"==typeof t){const n=parseFloat(t);return!isNaN(n)&&e===n}if("string"==typeof e&&"number"==typeof t){const n=parseFloat(e);return!isNaN(n)&&n===t}return"boolean"==typeof e?Tr(e?1:0,t):"boolean"==typeof t?Tr(e,t?1:0):e+""==t+""}function jr(e,t=[]){return{isValid:0,errors:e,suggestions:t}}function Ar(e,t,n=[],r="error"){return{type:e,message:t,suggestions:n,severity:r}}function Lr(e,t,n,r,i,a=1,o){return t&&"object"==typeof t&&"evaluationHistory"in t&&Array.isArray(t.evaluationHistory)&&t.evaluationHistory.push({expressionName:e.name,category:e.category,input:n,output:r,timestamp:i,duration:Date.now()-i,success:a,...void 0!==o&&{error:o}}),r}"undefined"!=typeof window&&function(e=3e4){wr&&clearInterval(wr),wr=setInterval(br,e)}();const Or=lr({left:ur().describe("Left operand value"),right:ur().describe("Right operand value")}).strict(),Cr=lr({operand:ur().describe("Operand value to negate")}).strict();function Nr(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&1===e.nodeType}new class extends dr{constructor(){super(...arguments),this.name="and",this.category="Logical",this.syntax="left and right",this.description="Logical AND operation with comprehensive boolean type coercion",this.inputSchema=Or,this.outputType="Boolean",this.metadata={category:"Logical",complexity:"simple"}}async evaluate(e,t){const n=Date.now();try{const r=this.validate(t);if(!r.isValid)return{success:0,error:r.errors[0]};const i=this.toBoolean(t.left);if(!i)return this.trackSimple(e,n,1,"boolean"),this.success(0,"boolean");const a=this.toBoolean(t.right),o=i&&a;return this.trackSimple(e,n,1,"boolean"),this.success(o,"boolean")}catch(t){return this.trackSimple(e,n,0),this.failure("AndExpressionError","runtime-error","Logical AND operation failed: "+(t instanceof Error?t.message:t+""),"AND_EVALUATION_FAILED")}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:0,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:"Invalid AND operation input: "+e.message,suggestions:[]}))??[],suggestions:["Provide both left and right operands","Ensure operands are valid values"]}}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}},new class extends dr{constructor(){super(...arguments),this.name="or",this.category="Logical",this.syntax="left or right",this.description="Logical OR operation with comprehensive boolean type coercion",this.inputSchema=Or,this.outputType="Boolean",this.metadata={category:"Logical",complexity:"simple"}}async evaluate(e,t){const n=Date.now();try{const r=this.validate(t);if(!r.isValid)return{success:0,error:r.errors[0]};const i=this.toBoolean(t.left);if(i)return this.trackSimple(e,n,1,"boolean"),this.success(1,"boolean");const a=this.toBoolean(t.right),o=i||a;return this.trackSimple(e,n,1,"boolean"),this.success(o,"boolean")}catch(t){return this.trackSimple(e,n,0),this.failure("OrExpressionError","runtime-error","Logical OR operation failed: "+(t instanceof Error?t.message:t+""),"OR_EVALUATION_FAILED")}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:0,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:"Invalid OR operation input: "+e.message,suggestions:[]}))??[],suggestions:["Provide both left and right operands","Ensure operands are valid values"]}}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}},new class extends dr{constructor(){super(...arguments),this.name="not",this.category="Logical",this.syntax="not operand",this.description="Logical NOT operation with comprehensive boolean type coercion",this.inputSchema=Cr,this.outputType="Boolean",this.metadata={category:"Logical",complexity:"simple"}}async evaluate(e,t){const n=Date.now();try{const r=this.validate(t);if(!r.isValid)return{success:0,error:r.errors[0]};const i=!this.toBoolean(t.operand);return this.trackSimple(e,n,1,"boolean"),this.success(i,"boolean")}catch(t){return this.trackSimple(e,n,0),this.failure("NotExpressionError","runtime-error","Logical NOT operation failed: "+(t instanceof Error?t.message:t+""),"NOT_EVALUATION_FAILED")}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:0,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:"Invalid NOT operation input: "+e.message,suggestions:[]}))??[],suggestions:["Provide a single operand","Ensure operand is a valid value"]}}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}};const Pr=cr([ur(),ur()]),Rr=cr([ur(),ar()]),$r={name:"equals",category:"Comparison",evaluatesTo:"Boolean",precedence:10,associativity:"Left",operators:["is","==","equals"],async evaluate(e,t,n){const r=Date.now();try{return Lr(this,e,[t,n],t==n,r)}catch(i){throw Lr(this,e,[t,n],0,r,0,i instanceof Error?i:Error(i+"")),i}},validate:e=>Zn(e,"equals"),inputSchema:Pr,metadata:{category:"Logical",complexity:"simple",sideEffects:[],dependencies:[],returnTypes:["Boolean"],examples:[{input:"value is 5",description:"Check if value equals 5 using loose equality",expectedOutput:1,context:{result:5}},{input:'"5" == 5',description:'String "5" equals number 5 with type coercion',expectedOutput:1}],relatedExpressions:["strictEquals","notEquals"],performance:{averageTime:.001,complexity:"O(1)"}},documentation:{summary:"Compares two values for loose equality, allowing type coercion",parameters:[{name:"left",type:"unknown",description:"Left operand for comparison",optional:0,examples:["5",'"hello"',"true","null"]},{name:"right",type:"unknown",description:"Right operand for comparison",optional:0,examples:["5",'"hello"',"true","null"]}],returns:{type:"Boolean",description:"True if values are loosely equal, false otherwise",examples:["true","false"]},examples:[{title:"Basic equality check",code:"if my.value is 10",explanation:"Check if element value equals 10",output:"Boolean result"},{title:"Type coercion",code:'if "5" == 5',explanation:'String "5" equals number 5 with automatic type conversion',output:"true"},{title:"Null checks",code:"if value is null",explanation:"Check if value is null or undefined",output:"Boolean result"}],seeAlso:["strictEquals","notEquals","matches"],tags:["comparison","equality","logic","type-coercion"]}},Ir={name:"strictEquals",category:"Comparison",evaluatesTo:"Boolean",precedence:10,associativity:"Left",operators:["==="],async evaluate(e,t,n){const r=e.evaluationHistory,i=t===n;return r&&Lr(this,e,[t,n],i,r?Date.now():0),i},validate:e=>Zn(e,"strictEquals")},Mr={name:"notEquals",category:"Comparison",evaluatesTo:"Boolean",precedence:10,associativity:"Left",operators:["!=","is not","does not equal"],async evaluate(e,t,n){const r=e.evaluationHistory,i=t!=n;return r&&Lr(this,e,[t,n],i,r?Date.now():0),i},validate:e=>Zn(e,"notEquals")},qr={name:"strictNotEquals",category:"Comparison",evaluatesTo:"Boolean",precedence:10,associativity:"Left",operators:["!=="],async evaluate(e,t,n){const r=e.evaluationHistory,i=t!==n;return r&&Lr(this,e,[t,n],i,r?Date.now():0),i},validate:e=>Zn(e,"strictNotEquals")},_r={name:"lessThan",category:"Comparison",evaluatesTo:"Boolean",precedence:12,associativity:"Left",operators:["<","is less than"],async evaluate(e,t,n){const r=e.evaluationHistory,i=r?Date.now():0,a=Sr(t,n,"<");return r&&Lr(this,e,[t,n],a,i),a},validate:e=>Zn(e,"lessThan")},Dr={name:"lessThanOrEqual",category:"Comparison",evaluatesTo:"Boolean",precedence:12,associativity:"Left",operators:["<=","is less than or equal to"],async evaluate(e,t,n){const r=e.evaluationHistory,i=r?Date.now():0,a=Sr(t,n,"<=");return r&&Lr(this,e,[t,n],a,i),a},validate:e=>Zn(e,"lessThanOrEqual")},Vr={name:"greaterThan",category:"Comparison",evaluatesTo:"Boolean",precedence:12,associativity:"Left",operators:[">","is greater than"],async evaluate(e,t,n){const r=e.evaluationHistory,i=r?Date.now():0,a=Sr(t,n,">");return r&&Lr(this,e,[t,n],a,i),a},validate:e=>Zn(e,"greaterThan")},Hr={name:"greaterThanOrEqual",category:"Comparison",evaluatesTo:"Boolean",precedence:12,associativity:"Left",operators:[">=","is greater than or equal to"],async evaluate(e,t,n){const r=e.evaluationHistory,i=r?Date.now():0,a=Sr(t,n,">=");return r&&Lr(this,e,[t,n],a,i),a},validate:e=>Zn(e,"greaterThanOrEqual")},Fr={name:"and",category:"Logical",evaluatesTo:"Boolean",precedence:6,associativity:"Left",operators:["and","&&"],async evaluate(e,t,n){const r=Date.now();try{return Lr(this,e,[t,n],t&&n,r)}catch(i){throw Lr(this,e,[t,n],0,r,0,i instanceof Error?i:Error(i+"")),i}},validate:e=>Zn(e,"and"),inputSchema:Pr,metadata:{category:"Logical",complexity:"simple",sideEffects:[],dependencies:[],returnTypes:["Boolean"],examples:[{input:"true and false",description:"Logical AND of boolean values",expectedOutput:0},{input:"name and age",description:"Both name and age must be truthy",expectedOutput:1,context:{variables:new Map([["name","John"],["age",25]])}}],relatedExpressions:["or","not"],performance:{averageTime:.001,complexity:"O(1)"}},documentation:{summary:"Logical AND operation that returns true only if both operands are truthy",parameters:[{name:"left",type:"unknown",description:"Left operand (evaluated for truthiness)",optional:0,examples:["true","name","5",'"hello"']},{name:"right",type:"unknown",description:"Right operand (evaluated for truthiness)",optional:0,examples:["false","age","0",'""']}],returns:{type:"Boolean",description:"True if both operands are truthy, false otherwise",examples:["true","false"]},examples:[{title:"Form validation",code:"if name and email",explanation:"Check if both name and email have values",output:"Boolean result"},{title:"Multiple conditions",code:"if age > 18 and hasLicense",explanation:"Combine multiple conditions",output:"Boolean result"},{title:"Short-circuit evaluation",code:"if element and element.value",explanation:"Check element exists before accessing properties",output:"Boolean result"}],seeAlso:["or","not","exists"],tags:["logic","boolean","conditions","validation"]}},Br={name:"or",category:"Logical",evaluatesTo:"Boolean",precedence:5,associativity:"Left",operators:["or","||"],async evaluate(e,t,n){const r=e.evaluationHistory,i=t||n;return r&&Lr(this,e,[t,n],i,r?Date.now():0),i},validate:e=>Zn(e,"or")},Ur={name:"not",category:"Logical",evaluatesTo:"Boolean",precedence:15,associativity:"Right",operators:["not","!"],async evaluate(e,t){const n=e.evaluationHistory,r=!t;return n&&Lr(this,e,[t],r,n?Date.now():0),r},validate:e=>Wn(e,1,"not","operand")},Gr={name:"isEmpty",category:"Logical",evaluatesTo:"Boolean",operators:["is empty","isEmpty"],async evaluate(e,t){const n=e.evaluationHistory,r=n?Date.now():0;let i;return i=null==t?1:le(t)||Array.isArray(t)||t instanceof NodeList?0===t.length:t instanceof Node||t instanceof Element?0:pe(t)?0===Object.keys(t).length:0,n&&Lr(this,e,[t],i,r),i},validate:e=>Wn(e,1,"isEmpty","value")},Wr={name:"no",category:"Logical",evaluatesTo:"Boolean",operators:["no"],async evaluate(e,t){const n=e.evaluationHistory,r=n?Date.now():0;let i;return i=null==t||0==t?1:Array.isArray(t)||t instanceof NodeList?0===t.length:(le(t),0),n&&Lr(this,e,[t],i,r),i},validate:e=>Wn(e,1,"no","value")},Kr={name:"isNotEmpty",category:"Logical",evaluatesTo:"Boolean",operators:["is not empty","isNotEmpty"],async evaluate(e,t){const n=e.evaluationHistory,r=n?Date.now():0,i=!await Gr.evaluate(e,t);return n&&Lr(this,e,[t],i,r),i},validate:e=>Wn(e,1,"isNotEmpty","value")},Jr={name:"exists",category:"Logical",evaluatesTo:"Boolean",operators:["exists"],async evaluate(e,t){const n=e.evaluationHistory,r=null!=t;return n&&Lr(this,e,[t],r,n?Date.now():0),r},validate:e=>Wn(e,1,"exists","value")},Zr={name:"doesNotExist",category:"Logical",evaluatesTo:"Boolean",operators:["does not exist","doesNotExist"],async evaluate(e,t){const n=e.evaluationHistory,r=null==t;return n&&Lr(this,e,[t],r,n?Date.now():0),r},validate:e=>Wn(e,1,"doesNotExist","value")},Yr={name:"contains",category:"Logical",evaluatesTo:"Boolean",operators:["contains","includes","include"],async evaluate(e,t,n){const r=e.evaluationHistory,i=r?Date.now():0;let a;if(t&&n){if(Nr(t)&&Nr(n))return a=t.contains(n),r&&Lr(this,e,[t,n],a,i),a;if(le(t)&&t.match(/^[.#][\w-]+$/)){const o=document.querySelector(t);if(o&&Nr(n))return a=o.contains(n),r&&Lr(this,e,[t,n],a,i),a;if(o&&le(n)&&n.match(/^[.#][\w-]+$/)){const s=document.querySelector(n);return a=s?o.contains(s):0,r&&Lr(this,e,[t,n],a,i),a}}if(le(n)&&n.match(/^[.#][\w-]+$/)&&Nr(t)){const o=document.querySelector(n);return a=o?t.contains(o):0,r&&Lr(this,e,[t,n],a,i),a}}return a=le(t)&&le(n)||Array.isArray(t)?t.includes(n):"undefined"!=typeof NodeList&&t instanceof NodeList?Array.from(t).includes(n):pe(t)&&le(n)?n in t:0,r&&Lr(this,e,[t,n],a,i),a},validate:e=>Wn(e,2,"contains","container, value")},Xr={name:"doesNotContain",category:"Logical",evaluatesTo:"Boolean",operators:["does not contain","doesNotContain","does not include","doesNotInclude"],async evaluate(e,t,n){const r=e.evaluationHistory,i=r?Date.now():0,a=!await Yr.evaluate(e,t,n);return r&&Lr(this,e,[t,n],a,i),a},validate:e=>Wn(e,2,"doesNotContain","container, value")},Qr={name:"startsWith",category:"Logical",evaluatesTo:"Boolean",operators:["starts with","startsWith"],async evaluate(e,t,n){const r=e.evaluationHistory,i=r?Date.now():0,a=le(t)&&le(n)?t.startsWith(n):0;return r&&Lr(this,e,[t,n],a,i),a},validate:e=>Wn(e,2,"startsWith","str, prefix")},ei={name:"endsWith",category:"Logical",evaluatesTo:"Boolean",operators:["ends with","endsWith"],async evaluate(e,t,n){const r=e.evaluationHistory,i=r?Date.now():0,a=le(t)&&le(n)?t.endsWith(n):0;return r&&Lr(this,e,[t,n],a,i),a},validate:e=>Wn(e,2,"endsWith","str, suffix")},ti={name:"between",category:"Logical",evaluatesTo:"Boolean",operators:["is between","between"],async evaluate(e,t,n,r){const i=e.evaluationHistory;let a=n,o=r;if(null!=a&&null!=o&&a>o){const e=a;a=o,o=e}const s=null!=a&&null!=o&&t>=a&&o>=t;return i&&Lr(this,e,[t,n,r],s,i?Date.now():0),s},validate:e=>Wn(e,3,"between","value, min, max")},ni={name:"matches",category:"Logical",evaluatesTo:"Boolean",operators:["matches"],async evaluate(e,t,n){const r=Date.now();try{let i;if(t instanceof Element&&le(n)){const e=n;if(e.startsWith(".")||e.startsWith("#")||e.startsWith(":")||e.startsWith("[")||/^[a-zA-Z][\w-]*$/.test(e))try{i=function(e,t){return vr.matches(e,t)}(t,e)}catch(e){i=0}else i=0}else if(le(t)&&le(n)){const e=t,r=n;try{i=(r.startsWith("/")&&r.endsWith("/")?RegExp(r.slice(1,-1)):RegExp(r)).test(e)}catch(t){i=e.includes(r)}}else i=0;return Lr(this,e,[t,n],i,r)}catch(i){throw Lr(this,e,[t,n],0,r,0,i instanceof Error?i:Error(i+"")),i}},validate:e=>Wn(e,2,"matches","element, selector"),inputSchema:Rr,metadata:{category:"Logical",complexity:"medium",sideEffects:["dom-query"],dependencies:[],returnTypes:["Boolean"],examples:[{input:'element matches ".active"',description:"Check if element has active class",expectedOutput:1},{input:'text matches "/^hello/"',description:'Check if text starts with "hello" using regex',expectedOutput:1,context:{variables:new Map([["text","hello world"]])}}],relatedExpressions:["contains","startsWith","endsWith"],performance:{averageTime:.5,complexity:"O(n)"}},documentation:{summary:"Tests if element matches CSS selector or string matches regex pattern",parameters:[{name:"element",type:"Element | string",description:"DOM element or string to test",optional:0,examples:["<div>",'"hello world"',"me","target"]},{name:"selector",type:"string",description:"CSS selector or regex pattern to match against",optional:0,examples:['".active"','"#navbar"','"/^hello/"','"\\\\d+"']}],returns:{type:"Boolean",description:"True if element matches selector/pattern",examples:["true","false"]},examples:[{title:"CSS class matching",code:'if me matches ".active"',explanation:'Check if current element has "active" class',output:"Boolean result"},{title:"Attribute matching",code:'if target matches "[data-role=\\"button\\"]"',explanation:"Check if element has specific data attribute",output:"Boolean result"},{title:"Regex pattern matching",code:'if email matches "/^[^@]+@[^@]+\\\\.[^@]+$/"',explanation:"Validate email format with regex",output:"Boolean result"},{title:"Complex CSS selector",code:'if element matches ".card:hover .button"',explanation:"Match complex CSS selector with pseudo-classes",output:"Boolean result"}],seeAlso:["contains","startsWith","endsWith","querySelector"],tags:["pattern","css","regex","validation","dom"]}},ri={name:"has",category:"Logical",evaluatesTo:"Boolean",operators:["has","have"],async evaluate(e,t,n){const r=e.evaluationHistory,i=r?Date.now():0;let a=0;if(t instanceof Element&&le(n)){const e=n;e.startsWith(".")?a=t.classList.contains(e.slice(1)):e.startsWith("[")&&e.endsWith("]")&&(a=t.hasAttribute(e.slice(1,-1)))}return r&&Lr(this,e,[t,n],a,i),a},validate:e=>Wn(e,2,"has","element, selector")},ii={name:"doesNotHave",category:"Logical",evaluatesTo:"Boolean",operators:["does not have"],async evaluate(e,t,n){const r=e.evaluationHistory,i=r?Date.now():0,a=!await ri.evaluate(e,t,n);return r&&Lr(this,e,[t,n],a,i),a},validate:e=>Wn(e,2,"doesNotHave","element, selector")},ai={equals:$r,strictEquals:Ir,notEquals:Mr,strictNotEquals:qr,lessThan:_r,lessThanOrEqual:Dr,greaterThan:Vr,greaterThanOrEqual:Hr,and:Fr,or:Br,not:Ur,no:Wr,isEmpty:Gr,isNotEmpty:Kr,exists:Jr,doesNotExist:Zr,contains:Yr,doesNotContain:Xr,startsWith:Qr,endsWith:ei,between:ti,matches:ni,has:ri,doesNotHave:ii},oi=lr({value:ar().describe("String literal value")}).strict(),si=lr({value:or().describe("Number literal value")}).strict(),li=lr({value:sr().describe("Boolean literal value")}).strict(),ci=lr({left:ur().describe("Left operand"),right:ur().describe("Right operand")}).strict(),ui={stringLiteral:new class extends dr{constructor(){super(...arguments),this.name="stringLiteral",this.category="Special",this.syntax="\"string\" or 'string'",this.description="String literals with template interpolation support",this.outputType="String",this.inputSchema=oi,this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const n=Date.now();try{const r=this.validate(t);if(!r.isValid){const t=this.failure("ValidationError","validation-error",r.errors.map(e=>e.message).join(", "),"VALIDATION_FAILED",r.suggestions);return this.trackSimple(e,n,0),t}let i=t.value;(i.includes("${")||i.includes("$"))&&(i=this.interpolateString(i,e));const a=this.success(i,"string");return this.trackSimple(e,n,1,i),a}catch(t){return this.trackSimple(e,n,0),this.failure("StringEvaluationError","runtime-error","String literal evaluation failed: "+(t instanceof Error?t.message:t+""),"STRING_EVALUATION_FAILED")}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():this.validationFailure("type-mismatch",t.error?.errors.map(e=>e.message).join(", ")||"Invalid string literal input",["Provide a value parameter","Ensure value is a string"])}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}interpolateString(e,t){let n=e.replace(/\$\{([^}]+)\}/g,(e,n)=>{try{const e=this.resolveExpression(n.trim(),t);return void 0!==e?e+"":""}catch(e){return""}});return n=n.replace(/\$([a-zA-Z_$][a-zA-Z0-9_.$]*)/g,(e,n)=>{try{const e=this.resolveVariable(n,t);return void 0!==e?e+"":""}catch(e){return""}}),n}resolveExpression(e,t){if(e.includes(".")){const n=e.split(".");let r=this.resolveVariable(n[0],t);for(let e=1;n.length>e&&null!=r;e++)r=r[n[e]];return r}return this.resolveVariable(e,t)}resolveVariable(e,t){return"me"===e&&t.me?t.me:"you"===e&&t.you?t.you:"it"===e&&t.it?t.it:"result"===e&&t.result?t.result:t.locals?.has(e)?(ne(e,t),t.locals.get(e)):t.globals?.has(e)?t.globals.get(e):void 0}},numberLiteral:new class extends dr{constructor(){super(...arguments),this.name="numberLiteral",this.category="Special",this.syntax="123 or 3.14",this.description="Numeric literal with validation",this.inputSchema=si,this.outputType="Number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const n=Date.now();try{const r=this.validate(t);return r.isValid?Number.isFinite(t.value)?(this.trackSimple(e,n,1,t.value),this.success(t.value,"number")):(this.trackSimple(e,n,0),this.failure("NumberValidationError","invalid-argument","Number literal must be finite","NUMBER_NOT_FINITE")):(this.trackSimple(e,n,0),this.failure("ValidationError","validation-error",r.errors.map(e=>e.message).join(", "),"VALIDATION_FAILED",r.suggestions))}catch(t){return this.trackSimple(e,n,0),this.failure("NumberEvaluationError","runtime-error","Number literal evaluation failed: "+(t instanceof Error?t.message:t+""),"NUMBER_EVALUATION_FAILED")}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?Number.isFinite(t.data.value)?this.validationSuccess():this.validationFailure("invalid-argument","Number literal value must be finite",["Use finite numbers only","Avoid Infinity and NaN values"]):this.validationFailure("type-mismatch",t.error?.errors.map(e=>e.message).join(", ")||"Invalid number literal input",["Provide a value parameter","Ensure value is a number"])}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}},booleanLiteral:new class extends dr{constructor(){super(...arguments),this.name="booleanLiteral",this.category="Special",this.syntax="true or false",this.description="Boolean literal values",this.inputSchema=li,this.outputType="Boolean",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const n=Date.now();try{const r=this.validate(t);return r.isValid?(this.trackSimple(e,n,1,t.value),this.success(t.value,"boolean")):(this.trackSimple(e,n,0),this.failure("ValidationError","validation-error",r.errors.map(e=>e.message).join(", "),"VALIDATION_FAILED",r.suggestions))}catch(t){return this.trackSimple(e,n,0),this.failure("BooleanEvaluationError","runtime-error","Boolean literal evaluation failed: "+(t instanceof Error?t.message:t+""),"BOOLEAN_EVALUATION_FAILED")}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():this.validationFailure("type-mismatch",t.error?.errors.map(e=>e.message).join(", ")||"Invalid boolean literal input",["Provide a value parameter","Ensure value is a boolean"])}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}},addition:new class extends dr{constructor(){super(...arguments),this.name="addition",this.category="Special",this.syntax="left + right",this.description="Addition of two numeric values",this.inputSchema=ci,this.outputType="Number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const n=Date.now();try{const r=this.validate(t);if(!r.isValid)return this.trackSimple(e,n,0),this.failure("ValidationError","validation-error",r.errors.map(e=>e.message).join(", "),"VALIDATION_FAILED",r.suggestions);const i=kr(t.left,"left operand")+kr(t.right,"right operand");return this.trackSimple(e,n,1,i),this.success(i,"number")}catch(t){return this.trackSimple(e,n,0),this.failure("AdditionError","runtime-error","Addition failed: "+(t instanceof Error?t.message:t+""),"ADDITION_FAILED")}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():this.validationFailure("type-mismatch",t.error?.errors.map(e=>e.message).join(", ")||"Invalid addition input",["Provide left and right operands"])}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}},stringConcatenation:new class extends dr{constructor(){super(...arguments),this.name="stringConcatenation",this.category="Special",this.syntax="left + right (string concatenation)",this.description="Concatenation of two values into a string",this.inputSchema=ci,this.outputType="String",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const n=Date.now();try{const r=this.validate(t);if(!r.isValid)return this.trackSimple(e,n,0),this.failure("ValidationError","validation-error",r.errors[0]?.message||"Invalid input","STRING_CONCATENATION_VALIDATION_FAILED",r.suggestions);const i=this.convertToString(t.left)+this.convertToString(t.right);return this.trackSimple(e,n,1,i),this.success(i,"string")}catch(t){return this.trackSimple(e,n,0),this.failure("StringConcatenationError","runtime-error",t instanceof Error?t.message:"String concatenation failed","STRING_CONCATENATION_ERROR",["Check that operands can be converted to strings"])}}validate(e){const t=ci.safeParse(e);return t.success?this.validationSuccess():this.validationFailure("type-mismatch",t.error?.errors.map(e=>e.message).join(", ")||"Invalid string concatenation input",["Provide left and right operands for concatenation"])}convertToString(e){if(null===e)return"null";if(void 0===e)return"undefined";if(le(e))return e;if(ce(e))return""+e;if(ue(e))return""+e;if(e instanceof Date)return""+e;try{return e+""}catch{return"[object Object]"}}},multiplication:new class extends dr{constructor(){super(...arguments),this.name="multiplication",this.category="Special",this.syntax="left * right",this.description="Multiplication of two numeric values",this.inputSchema=ci,this.outputType="Number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const n=Date.now();try{const r=this.validate(t);if(!r.isValid)return this.trackSimple(e,n,0),this.failure("ValidationError","validation-error",r.errors.map(e=>e.message).join(", "),"VALIDATION_FAILED",r.suggestions);const i=kr(t.left,"left operand")*kr(t.right,"right operand");return this.trackSimple(e,n,1,i),this.success(i,"number")}catch(t){return this.trackSimple(e,n,0),this.failure("MultiplicationError","runtime-error","Multiplication failed: "+(t instanceof Error?t.message:t+""),"MULTIPLICATION_FAILED")}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():this.validationFailure("type-mismatch",t.error?.errors.map(e=>e.message).join(", ")||"Invalid multiplication input",["Provide left and right operands"])}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}}};function pi(e,t,n,r,i="runtime-error"){return{success:0,error:{name:e+"ConversionError",type:i,message:n,code:t,suggestions:r}}}function mi(e,t){return{success:1,value:e,type:t}}function di(e,t){return`${e}: ${t instanceof Error?t.message:t+""}`}const fi={Array:(e,t)=>{try{return Array.isArray(e)?mi(e,"array"):e instanceof NodeList?mi(Array.from(e),"array"):mi(null==e?[]:[e],"array")}catch(e){return pi("Array","ARRAY_CONVERSION_FAILED",di("Failed to convert value to Array",e),["Check if value is iterable","Ensure value is not circular reference"])}},String:(e,t)=>{try{return null==e?mi("","string"):le(e)?mi(e,"string"):pe(e)?mi(JSON.stringify(e),"string"):mi(e+"","string")}catch(e){return pi("String","STRING_CONVERSION_FAILED",di("Failed to convert value to String",e),["Check if object has circular references","Ensure value is serializable"])}},Boolean:(e,t)=>{try{if(ue(e))return mi(e,"boolean");if(null==e)return mi(0,"boolean");if(le(e)){const t=e.toLowerCase().trim();return mi("false"!==t&&"0"!==t&&""!==t,"boolean")}return ce(e)?mi(0!==e&&!isNaN(e),"boolean"):mi(!!e,"boolean")}catch(e){return pi("Boolean","BOOLEAN_CONVERSION_FAILED",di("Failed to convert value to Boolean",e),["Use explicit true/false values","Check for unexpected data types"])}},Number:(e,t)=>{try{if(ce(e))return mi(e,"number");if(null==e)return mi(0,"number");const t=Number(e);return isNaN(t)?pi("Number","INVALID_NUMBER",`Cannot convert "${e}" to a valid number`,["Check if value contains non-numeric characters","Use a valid numeric format"],"invalid-argument"):mi(t,"number")}catch(e){return pi("Number","NUMBER_CONVERSION_FAILED",di("Failed to convert value to Number",e),["Ensure value is convertible to number","Check for special characters"])}},Int:(e,t)=>{const n=fi.Number(e,t);return n.success?mi(Math.trunc(n.value),"number"):n},Float:(e,t)=>{const n=fi.Number(e,t);return n.success?mi(parseFloat(""+n.value),"number"):n},Date:(e,t)=>{try{if(e instanceof Date)return mi(e,"object");if(null==e)return mi(new Date(""),"object");if(le(e)&&/^\d{4}-\d{2}-\d{2}$/.test(e)){const[t,n,r]=e.split("-").map(Number);return mi(new Date(t,n-1,r),"object")}const t=new Date(e);return isNaN(t.getTime())?pi("Date","INVALID_DATE",`Cannot convert "${e}" to a valid date`,["Use ISO 8601 format (YYYY-MM-DD)","Check date string format","Ensure date values are valid"],"invalid-argument"):mi(t,"object")}catch(e){return pi("Date","DATE_CONVERSION_FAILED",di("Failed to convert value to Date",e),["Check date format","Ensure value is a valid date string or timestamp"])}},JSON:(e,t)=>{if(!le(e))return mi(e,"object");try{return mi(JSON.parse(e),"object")}catch(e){return pi("JSON","JSON_PARSE_FAILED",di("Failed to parse value as JSON",e),["Check JSON syntax and escaping","Use `as JSONString` to stringify a value instead"],"syntax-error")}},JSONString:(e,t)=>{try{return mi(JSON.stringify(e),"string")}catch(e){return pi("JSONString","JSON_STRINGIFY_FAILED",di("Failed to stringify value as JSON",e),["Check for circular references","Ensure all properties are serializable","Remove functions and undefined values"])}},Object:(e,t)=>{try{if(pe(e))return mi(e,"object");if(le(e))try{return mi(JSON.parse(e),"object")}catch(e){return pi("Object","JSON_PARSE_FAILED",di("Cannot parse JSON string",e),["Check JSON syntax","Ensure proper escaping of quotes","Validate JSON format"],"syntax-error")}return mi({},"object")}catch(e){return pi("Object","OBJECT_CONVERSION_FAILED",di("Failed to convert value to Object",e),["Ensure value is valid JSON string or object","Check for syntax errors"])}},Values:(e,t)=>{try{if(e instanceof HTMLFormElement)return mi(gi(e),"object");if(e instanceof HTMLElement){const t=e.querySelectorAll("input, select, textarea"),n={};return t.forEach(e=>{const t=e;if(t.name){const e=bi(t);void 0!==e&&(n[t.name]=e)}}),mi(n,"object")}return mi({},"object")}catch(e){return pi("FormValues","FORM_VALUES_EXTRACTION_FAILED",di("Failed to extract form values",e),["Ensure element is a form or contains form inputs","Check form structure","Verify input names are set"])}},FormEncoded:(e,t)=>{try{let n=e;if(e instanceof HTMLElement){const r=fi.Values(e,t);if(!r.success)return r;n=r.value}if(!pe(n))return mi("","string");const r=new URLSearchParams;for(const[e,t]of Object.entries(n))if(null!=t)if(Array.isArray(t))for(const n of t)r.append(e,n+"");else r.append(e,t+"");return mi(""+r,"string")}catch(e){return pi("FormEncoded","FORM_ENCODE_FAILED",di("Failed to URL-encode values",e),["Ensure input is a form element or plain object of scalar/array values"])}}},yi=lr({value:pr(),type:ar().min(1)}),hi=lr({value:pr(),type:ar().min(1)});new class extends dr{constructor(){super(...arguments),this.name="as",this.category="Conversion",this.syntax="value as Type",this.description='Converts values between different types using the "as" keyword',this.outputType="Any",this.inputSchema=yi,this.metadata={category:"Conversion",complexity:"medium",sideEffects:[],dependencies:[],returnTypes:["Any"],examples:[{input:'"123" as Int',description:"Convert string to integer",expectedOutput:123},{input:"form as Values",description:"Extract form values as object",expectedOutput:{name:"John",age:"25"}},{input:"[1,2,3] as JSONString",description:"Convert array to JSON string (upstream 0.9.90: use JSONString, not JSON)",expectedOutput:"[1,2,3]"},{input:"'{\"a\":1}' as JSON",description:"Parse a JSON string (upstream 0.9.90: as JSON now parses)",expectedOutput:{a:1}},{input:'"2023-12-25" as Date',description:"Parse date string",expectedOutput:new Date(2023,11,25)}],relatedExpressions:["is","Object","Array"],performance:{averageTime:1,complexity:"O(n)"}},this.documentation={summary:'Converts values between different types using the "as" keyword with comprehensive type safety',parameters:[{name:"value",type:"object",description:"The value to convert",optional:0,examples:['"123"',"form","[1,2,3]","true","null"]},{name:"type",type:"string",description:"Target conversion type",optional:0,examples:["Int","String","Boolean","Array","JSON","Object","Date","Values","HTML","Fragment"]}],returns:{type:"object",description:"Structured result with converted value or detailed error information",examples:['{ success: true, value: 123, type: "number" }',"{ success: false, error: { ... } }"]},examples:[{title:"String to number conversion",code:"if my.value as Int > 100",explanation:"Convert form input to integer for comparison",output:"Boolean result"},{title:"Form data extraction",code:"put closest <form /> as Values into result",explanation:"Extract all form values as structured object",output:'{ name: "John", age: "25", ... }'},{title:"Array to JSON serialization",code:"put items as JSONString into storage",explanation:"Convert array to JSON string for storage (upstream 0.9.90: use `as JSONString`)",output:'"[1,2,3]"'},{title:"Date parsing with validation",code:"put my.dateInput as Date into event.detail.date",explanation:"Parse date input with automatic validation",output:"Date object or validation error"},{title:"Boolean conversion with smart parsing",code:'if "false" as Boolean then hide else show',explanation:"Parse string boolean values correctly",output:"false (not true like naive conversion)"}],seeAlso:["is","Values","JSON","Array","Object"],tags:["conversion","types","validation","forms","json","parsing"]}}async evaluate(e,t){const n=Date.now();try{const r=this.validate(t);if(!r.isValid)return{success:0,error:{name:"AsExpressionValidationError",type:"validation-error",message:r.errors[0]?.message||"Invalid input",code:"VALIDATION_FAILED",suggestions:r.suggestions}};const{value:i,type:a}=t;if(a.startsWith("Fixed")){const r=a.match(/^Fixed:(\d+)$/),o=r?parseInt(r[1],10):2,s=fi.Number(i,e);if(!s.success)return s;const l={success:1,value:s.value.toFixed(o),type:"string"};return this.trackPerformance(e,t,l,n),l}let o=fi[a];if(o){const r=o(i,e);return this.trackPerformance(e,t,r,n),r}const s={boolean:"Boolean",bool:"Boolean",string:"String",str:"String",number:"Number",num:"Number",int:"Int",integer:"Int",float:"Float",array:"Array",object:"Object",obj:"Object",date:"Date",json:"JSON",jsonstring:"JSONString",formencoded:"FormEncoded"}[a.toLowerCase()];if(s&&(o=fi[s],o)){const r=o(i,e);return this.trackPerformance(e,t,r,n),r}const l={success:0,error:{name:"UnknownConversionTypeError",type:"validation-error",message:"Unknown conversion type: "+a,code:"UNKNOWN_CONVERSION_TYPE",suggestions:["Use supported types: String, Number, Boolean, Array, Object, Date, JSON, Values","Check type spelling and capitalization","See documentation for complete list of conversion types"]}};return this.trackPerformance(e,t,l,n),l}catch(r){const i={success:0,error:{name:"AsExpressionError",type:"runtime-error",message:"Conversion failed: "+(r instanceof Error?r.message:r+""),code:"CONVERSION_FAILED",suggestions:["Check value and type compatibility","Ensure value is convertible to target type"]}};return this.trackPerformance(e,t,i,n),i}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?{isValid:1,errors:[],suggestions:[]}:{isValid:0,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:e.message,suggestions:["Expected valid input structure, got: "+e.code]}))??[],suggestions:["Provide both value and type parameters","Ensure type is a non-empty string","Check parameter structure: { value: any, type: string }"]}}catch(e){return this.validationFailure("runtime-error","Validation failed",["Check input structure"])}}},new class extends dr{constructor(){super(...arguments),this.name="is",this.category="Conversion",this.syntax="value is Type",this.description="Checks if a value is of a specific type",this.outputType="Boolean",this.inputSchema=hi,this.metadata={category:"Conversion",complexity:"simple",sideEffects:[],dependencies:[],returnTypes:["Boolean"],examples:[{input:"42 is number",description:"Check if value is a number",expectedOutput:1},{input:"null is empty",description:"Check if value is empty/null",expectedOutput:1},{input:"element is Element",description:"Check if value is DOM element",expectedOutput:1,context:{element:"<div>...</div>"}}],relatedExpressions:["as","empty","exists"],performance:{averageTime:.1,complexity:"O(1)"}},this.documentation={summary:"Checks if a value is of a specific type with comprehensive type detection",parameters:[{name:"value",type:"object",description:"The value to check",optional:0,examples:["42","null","element",'"text"',"[]"]},{name:"type",type:"string",description:"Type name to check against",optional:0,examples:["number","string","boolean","array","object","element","empty","null"]}],returns:{type:"object",description:"Boolean result indicating type match",examples:['{ success: true, value: true, type: "boolean" }']},examples:[{title:"Number validation",code:"if my.age is number then proceed",explanation:"Check if form input is valid number",output:"Boolean result"},{title:"Empty check",code:"if result is empty then show message",explanation:"Check if result is null, undefined, or empty",output:"Boolean result"},{title:"Element validation",code:"if target is element then addClass",explanation:"Ensure target is valid DOM element before manipulation",output:"Boolean result"}],seeAlso:["as","empty","exists","null"],tags:["validation","types","checking","guards"]}}async evaluate(e,t){const n=Date.now();try{const r=this.validate(t);if(!r.isValid)return{success:0,error:{name:"IsExpressionValidationError",type:"validation-error",message:r.errors[0]?.message||"Invalid input",code:"VALIDATION_FAILED",suggestions:r.suggestions}};const{value:i,type:a}=t,o=a.toLowerCase();let s;switch(o){case"null":s=null===i;break;case"undefined":s=void 0===i;break;case"string":s=le(i);break;case"number":s=ce(i)&&!isNaN(i);break;case"boolean":s=ue(i);break;case"object":s=pe(i);break;case"array":s=Array.isArray(i);break;case"function":s=me(i);break;case"date":s=i instanceof Date;break;case"element":s=i instanceof Element;break;case"node":s=i instanceof Node;break;case"node-list":s=i instanceof NodeList;break;case"empty":s=null==i||""===i||Array.isArray(i)&&0===i.length||pe(i)&&0===Object.keys(i).length;break;default:s=i?.constructor?.name?.toLowerCase()===o}const l=this.success(s,"boolean");return this.trackPerformance(e,t,l,n),l}catch(r){const i=this.failure("IsExpressionError","type-mismatch","Type check failed: "+(r instanceof Error?r.message:r+""),"TYPE_CHECK_FAILED",["Check type name spelling","Ensure value is accessible"]);return this.trackPerformance(e,t,i,n),i}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:0,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:e.message,suggestions:["Expected valid input structure, got: "+e.code]}))??[],suggestions:["Provide both value and type parameters","Ensure type is a non-empty string","Check parameter structure: { value: any, type: string }"]}}catch(e){return this.validationFailure("runtime-error","Validation failed",["Check input structure"])}}};const vi={Array:e=>Array.isArray(e)?e:e instanceof NodeList?Array.from(e):null==e?[]:[e],String:e=>null==e?"":le(e)?e:pe(e)?JSON.stringify(e):e+"",Boolean:e=>{if(ue(e))return e;if(null==e)return 0;if(le(e)){const t=e.toLowerCase().trim();return"false"===t||"0"===t||""===t?0:1}return ce(e)?0!==e&&!isNaN(e):!!e},Number:e=>{if(ce(e))return e;if(null==e)return 0;const t=Number(e);return isNaN(t)?0:t},Math:e=>{if(ce(e))return e;if(null==e)return 0;const t=(e+"").trim();if(!t)return 0;try{return function(e){if(e=e.replace(/\s/g,""),!/^[0-9+\-*/().]+$/.test(e))throw Error("Invalid characters in math expression");try{const t=Function(`"use strict"; return (${e})`)();if(!ce(t)||!isFinite(t))throw Error("Expression did not evaluate to a finite number");return t}catch(e){throw Error("Math expression evaluation failed: "+(e instanceof Error?e.message:e+""))}}(t)}catch(e){return console.warn("Math conversion failed:",e),0}},Int:e=>{const t=vi.Number(e);return Math.trunc(t)},Float:e=>{const t=vi.Number(e);return parseFloat(""+t)},Date:e=>{if(e instanceof Date)return e;if(null==e)return new Date(NaN);if(le(e)&&/^\d{4}-\d{2}-\d{2}$/.test(e)){const[t,n,r]=e.split("-").map(Number);return new Date(t,n-1,r)}return new Date(e)},JSON:e=>{if(!le(e))return e;try{return JSON.parse(e)}catch{return e}},JSONString:e=>{try{return JSON.stringify(e)}catch{return"{}"}},Object:e=>{if(pe(e))return e;if(le(e))try{return JSON.parse(e)}catch(e){return{}}return{}},Fragment:e=>{le(e)||(e=vi.String(e));const t=document.createElement("template");return t.innerHTML=e+"",t.content},HTML:e=>le(e)?e:e instanceof NodeList?Array.from(e).map(e=>e instanceof Element?e.outerHTML:e.textContent||"").join(""):Array.isArray(e)?e.map(e=>e instanceof Element?e.outerHTML:vi.String(e)).join(""):e instanceof Element?e.outerHTML:vi.String(e),Values:(e,t)=>{if(e instanceof HTMLFormElement)return gi(e);if(e instanceof HTMLElement){const t=e.querySelectorAll("input, select, textarea"),n={};return t.forEach(e=>{e.name&&(n[e.name]=bi(e))}),n}return{}},FormEncoded:(e,t)=>{const n=e instanceof HTMLElement?vi.Values(e,t):e;if(!pe(n))return"";const r=new URLSearchParams;for(const[e,t]of Object.entries(n))if(null!=t)if(Array.isArray(t))for(const n of t)r.append(e,n+"");else r.append(e,t+"");return""+r},"Values:Form":(e,t)=>{const n=vi.Values(e,t);return vi.FormEncoded(n,t)},"Values:JSON":(e,t)=>{const n=vi.Values(e,t);return JSON.stringify(n)}};function gi(e){const t={};return e.querySelectorAll("input, select, textarea").forEach(e=>{const n=e;if(n.name){const e=bi(n);void 0!==e&&(void 0!==t[n.name]?(Array.isArray(t[n.name])||(t[n.name]=[t[n.name]]),t[n.name].push(e)):t[n.name]=e)}}),t}function bi(e){if(e instanceof HTMLInputElement)switch(e.type){case"checkbox":return e.checked;case"radio":return e.checked?e.value:void 0;case"number":case"range":return e.valueAsNumber;case"date":case"datetime-local":return e.valueAsDate;case"file":return e.files;default:return e.value}return e instanceof HTMLSelectElement&&e.multiple?Array.from(e.selectedOptions).map(e=>e.value):e.value}const wi={as:{name:"as",category:"Conversion",evaluatesTo:"Any",precedence:20,associativity:"Left",operators:["as"],async evaluate(e,...t){const[n,r]=t;if("string"!=typeof r)throw Error("Conversion type must be a string");if(r.startsWith("Fixed")){const{precision:e}=function(e){const t=e.match(/^Fixed(?::(\d+))?$/);return t?{precision:t[1]?parseInt(t[1],10):2}:{}}(r);return vi.Number(n).toFixed(e||2)}let i=vi[r];if(i)return i(n,e);const a={boolean:"Boolean",bool:"Boolean",string:"String",str:"String",number:"Number",num:"Number",int:"Int",integer:"Int",float:"Float",array:"Array",object:"Object",obj:"Object",date:"Date",json:"JSON",jsonstring:"JSONString",formencoded:"FormEncoded"}[r.toLowerCase()];return a&&(i=vi[a],i)?i(n,e):(console.warn("Unknown conversion type: "+r),n)},validate:e=>Wn(e,2,"as","value, type")??Kn(e,1,"as","conversion type")},is:{name:"is",category:"Conversion",evaluatesTo:"Boolean",precedence:10,associativity:"Left",operators:["is a","is an"],async evaluate(e,...t){const[n,r]=t;if(!le(r))throw Error("Type check requires a string type");switch(r.toLowerCase()){case"null":return null===n;case"undefined":return void 0===n;case"string":return le(n);case"number":return ce(n)&&!isNaN(n);case"boolean":return ue(n);case"object":return pe(n);case"array":return Array.isArray(n);case"function":return me(n);case"date":return n instanceof Date;case"element":return n instanceof Element;case"node":return n instanceof Node;case"nodelist":return n instanceof NodeList;case"empty":return null==n||""===n||Array.isArray(n)&&0===n.length||pe(n)&&0===Object.keys(n).length;default:return n?.constructor?.name?.toLowerCase()===r.toLowerCase()}},validate:e=>Wn(e,2,"is","value, type")??Kn(e,1,"is","type")},async:{name:"async",category:"Conversion",evaluatesTo:"Any",precedence:25,associativity:"Right",operators:["async"],evaluate:async(e,t)=>t,validate:e=>Wn(e,1,"async","expression")}},ki={String:"string",Number:"number",Boolean:"boolean",Element:"element",ElementList:"element-list",Array:"array",Object:"object",Promise:"promise",Context:"object",Null:"null",Undefined:"undefined",Any:"object"},zi=lr({collection:ur().describe("Collection to operate on (array, NodeList, or string)")}).strict(),xi=lr({collection:ur().describe("Collection to access"),index:or().describe("Index position to access")}).strict(),Ei=lr({collection:ur().describe("Collection to select random item from")}).strict();new class extends dr{constructor(){super(...arguments),this.name="first",this.category="Positional",this.syntax="first in collection",this.description="Gets the first element from a collection",this.inputSchema=zi,this.outputType="Any",this.metadata={category:"Positional",complexity:"simple"}}async evaluate(e,t){const n=Date.now();try{const r=this.validate(t);if(!r.isValid)return{success:0,error:r.errors[0]};const i=this.normalizeCollection(t.collection),a=i.length>0?i[0]:void 0,o={success:1,value:a,type:ki[this.inferEvaluationType(a)]};return this.trackPerformance(e,t,o,n),o}catch(r){const i=this.failure("FirstExpressionError","runtime-error","First operation failed: "+(r instanceof Error?r.message:r+""),"FIRST_OPERATION_FAILED");return this.trackPerformance(e,t,i,n),i}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:0,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:"Invalid first input: "+e.message,suggestions:[]}))??[],suggestions:["Provide a collection parameter","Ensure collection is array, NodeList, or string"]}}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}},new class extends dr{constructor(){super(...arguments),this.name="last",this.category="Positional",this.syntax="last in collection",this.description="Gets the last element from a collection",this.inputSchema=zi,this.outputType="Any",this.metadata={category:"Positional",complexity:"simple"}}async evaluate(e,t){const n=Date.now();try{const r=this.validate(t);if(!r.isValid)return{success:0,error:r.errors[0]};const i=this.normalizeCollection(t.collection),a=i.length>0?i[i.length-1]:void 0,o={success:1,value:a,type:ki[this.inferEvaluationType(a)]};return this.trackPerformance(e,t,o,n),o}catch(r){const i=this.failure("LastExpressionError","runtime-error","Last operation failed: "+(r instanceof Error?r.message:r+""),"LAST_OPERATION_FAILED");return this.trackPerformance(e,t,i,n),i}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:0,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:"Invalid last input: "+e.message,suggestions:[]}))??[],suggestions:["Provide a collection parameter","Ensure collection is array, NodeList, or string"]}}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}},new class extends dr{constructor(){super(...arguments),this.name="at",this.category="Positional",this.syntax="collection[index] or collection at index",this.description="Gets element at specific index from a collection",this.inputSchema=xi,this.outputType="Any",this.metadata={category:"Positional",complexity:"simple"}}async evaluate(e,t){const n=Date.now();try{const r=this.validate(t);if(!r.isValid)return{success:0,error:r.errors[0]};const i=this.normalizeCollection(t.collection),a=this.normalizeIndex(t.index,i.length),o=a>=0&&i.length>a?i[a]:void 0,s={success:1,value:o,type:ki[this.inferEvaluationType(o)]};return this.trackPerformance(e,t,s,n),s}catch(r){const i=this.failure("AtExpressionError","runtime-error","At operation failed: "+(r instanceof Error?r.message:r+""),"AT_OPERATION_FAILED");return this.trackPerformance(e,t,i,n),i}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:0,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:"Invalid at input: "+e.message,suggestions:[]}))??[],suggestions:["Provide collection and index parameters","Ensure index is a number"]}}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}normalizeIndex(e,t){return 0>e?t+e:e}},new class extends dr{constructor(){super(...arguments),this.name="random",this.category="Positional",this.syntax="random in collection",this.description="Gets a random element from a collection",this.inputSchema=Ei,this.outputType="Any",this.metadata={category:"Positional",complexity:"simple"}}async evaluate(e,t){const n=Date.now();try{const r=this.validate(t);if(!r.isValid)return{success:0,error:r.errors[0]};const i=this.normalizeCollection(t.collection);if(0===i.length){const r={success:1,value:void 0,type:"undefined"};return this.trackPerformance(e,t,r,n),r}const a=i[this.getSecureRandomIndex(i.length)],o={success:1,value:a,type:ki[this.inferEvaluationType(a)]};return this.trackPerformance(e,t,o,n),o}catch(r){const i=this.failure("RandomExpressionError","runtime-error","Random operation failed: "+(r instanceof Error?r.message:r+""),"RANDOM_OPERATION_FAILED");return this.trackPerformance(e,t,i,n),i}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:0,errors:t.error?.errors.map(e=>({type:"type-mismatch",message:"Invalid random input: "+e.message,suggestions:[]}))??[],suggestions:["Provide a collection parameter","Ensure collection is array, NodeList, or string"]}}catch(e){return this.validationFailure("runtime-error","Validation failed with exception",["Check input structure and types"])}}getSecureRandomIndex(e){if("undefined"!=typeof crypto&&crypto.getRandomValues){const t=new Uint32Array(1);return crypto.getRandomValues(t),t[0]%e}return Math.floor(Math.random()*e)}};const Si={name:"first",category:"Reference",evaluatesTo:"Any",operators:["first"],async evaluate(e,t){const n=void 0!==t?t:e.it;return null==n?null:Array.isArray(n)||n instanceof NodeList||n instanceof HTMLCollection?n.length>0?n[0]:null:n instanceof Element?n.children.length>0?n.children[0]:null:le(n)?n.length>0?n[0]:null:pe(n)&&"length"in n&&ce(n.length)&&n.length>0?n[0]:null},validate:e=>Xn(e,1,"first","collection")},Ti={name:"last",category:"Reference",evaluatesTo:"Any",operators:["last"],async evaluate(e,t){const n=void 0!==t?t:e.it;if(null==n)return null;if(Array.isArray(n))return n.length>0?n[n.length-1]:null;if(n instanceof NodeList||n instanceof HTMLCollection)return n.length>0?n[n.length-1]:null;if(n instanceof Element){const e=n.children;return e.length>0?e[e.length-1]:null}return le(n)?n.length>0?n[n.length-1]:null:pe(n)&&"length"in n&&ce(n.length)&&n.length>0?n[n.length-1]:null},validate:e=>Xn(e,1,"last","collection")},ji={name:"at",category:"Reference",evaluatesTo:"Any",operators:["at"],async evaluate(e,...t){const[n,r]=t;if(!ce(n))throw Error("Index must be a number");const i=n,a=void 0!==r?r:e.it;if(null==a)return null;if(Array.isArray(a)){const e=0>i?a.length+i:i;return e>=0&&a.length>e?a[e]:null}if(a instanceof NodeList||a instanceof HTMLCollection){const e=0>i?a.length+i:i;return e>=0&&a.length>e?a[e]:null}if(a instanceof Element){const e=a.children,t=0>i?e.length+i:i;return t>=0&&e.length>t?e[t]:null}if(le(a)){const e=0>i?a.length+i:i;return e>=0&&a.length>e?a[e]:null}if(pe(a)&&"length"in a&&ce(a.length)){const e=0>i?a.length+i:i;return e>=0&&a.length>e?a[e]:null}return null},validate:e=>Qn(e,1,2,"at","index, optional collection")??function(e){return"number"!=typeof e[0]?"at index must be a number":null}(e)};function Ai(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;const e=n.querySelector(t);if(e)return e;n=n.nextElementSibling}const r=e.parentElement;return r&&r!==document.documentElement?Ai(r,t):null}function Li(e,t){let n=e.previousElementSibling;for(;n;){const e=Array.from(n.querySelectorAll(t)).reverse();if(e.length>0)return e[0];if(n.matches(t))return n;n=n.previousElementSibling}const r=e.parentElement;return r&&r!==document.documentElement?Li(r,t):null}function Oi(e){let t=0,n=e;for(;n&&n.parentElement;)t+=Array.from(n.parentElement.children).indexOf(n),n=n.parentElement,t+=1e3;return t}const Ci={first:Si,last:Ti,at:ji,next:{name:"next",category:"Reference",evaluatesTo:"Element",operators:["next"],async evaluate(e,...t){const[n,r]=t,i=r||e.me;return i&&i instanceof Element?n?Ai(i,n):i.nextElementSibling:null},validate:e=>Xn(e,2,"next","optional selector, optional fromElement")||(1>e.length||null==e[0]||"string"==typeof e[0]?2>e.length||null==e[1]||e[1]instanceof Element?null:"fromElement must be an Element":"selector must be a string")},previous:{name:"previous",category:"Reference",evaluatesTo:"Element",operators:["previous","prev"],async evaluate(e,...t){const[n,r]=t,i=r||e.me;return i&&i instanceof Element?n?Li(i,n):i.previousElementSibling:null},validate:e=>Xn(e,2,"previous","optional selector, optional fromElement")||(1>e.length||null==e[0]||"string"==typeof e[0]?2>e.length||null==e[1]||e[1]instanceof Element?null:"fromElement must be an Element":"selector must be a string")},nextWithin:{name:"nextWithin",category:"Reference",evaluatesTo:"Element",operators:["next within"],async evaluate(e,...t){const[n,r,i]=t,a=i||e.me;if(!(a&&a instanceof Element))return null;const o=a.closest(r);return o?function(e,t,n){const r=Array.from(n.querySelectorAll(t)),i=Oi(e);for(const e of r)if(Oi(e)>i)return e;return null}(a,n,o):null},validate:e=>Qn(e,2,3,"nextWithin","selector, withinSelector, optional fromElement")||("string"!=typeof e[0]?"selector must be a string":"string"!=typeof e[1]?"withinSelector must be a string":3>e.length||null==e[2]||e[2]instanceof Element?null:"fromElement must be an Element")},previousWithin:{name:"previousWithin",category:"Reference",evaluatesTo:"Element",operators:["previous within"],async evaluate(e,...t){const[n,r,i]=t,a=i||e.me;if(!(a&&a instanceof Element))return null;const o=a.closest(r);return o?function(e,t,n){const r=Array.from(n.querySelectorAll(t)),i=Oi(e);for(let e=r.length-1;e>=0;e--){const t=r[e];if(i>Oi(t))return t}return null}(a,n,o):null},validate:e=>Qn(e,2,3,"previousWithin","selector, withinSelector, optional fromElement")||("string"!=typeof e[0]?"selector must be a string":"string"!=typeof e[1]?"withinSelector must be a string":3>e.length||null==e[2]||e[2]instanceof Element?null:"fromElement must be an Element")}},Ni=new Set(["__proto__","constructor","prototype"]),Pi={possessive:{name:"possessive",category:"Reference",evaluatesTo:"Any",operators:["'s","s"],async evaluate(e,...t){const[n,r]=t;if(null!=n){if("string"!=typeof r)throw Error("Property name must be a string");if(n instanceof Element)return ve(n,r);if(pe(n)){if(Ni.has(r))return;return n[r]}return n[r]}},validate:e=>Wn(e,2,"possessive","element, property")??Kn(e,1,"possessive","property name")},my:{name:"my",category:"Reference",evaluatesTo:"Any",operators:["my"],async evaluate(e,...t){const[n]=t;if(e.me){if("string"!=typeof n)throw Error("Property name must be a string");if(e.me instanceof Element)return ve(e.me,n);if(pe(e.me)){if(Ni.has(n))return;return e.me[n]}return e.me[n]}},validate:e=>Jn(e,"my","property")},its:{name:"its",category:"Reference",evaluatesTo:"Any",operators:["its"],async evaluate(e,...t){const[n]=t;if(null==e.it)return;if("string"!=typeof n)throw Error("Property name must be a string");const r=e.it;if(r instanceof Element)return ve(r,n);if(pe(r)){if(Ni.has(n))return;return r[n]}return r[n]},validate:e=>Jn(e,"its","property")},your:{name:"your",category:"Reference",evaluatesTo:"Any",operators:["your"],async evaluate(e,...t){const[n]=t;if(e.you){if("string"!=typeof n)throw Error("Property name must be a string");if(e.you instanceof Element)return ve(e.you,n);if(pe(e.you)){if(Ni.has(n))return;return e.you[n]}return e.you[n]}},validate:e=>Jn(e,"your","property")},of:{name:"of",category:"Reference",evaluatesTo:"Any",operators:["of"],async evaluate(e,...t){const[n,r]=t;if(null!=r){if("string"!=typeof n)throw Error("Property name must be a string");if(r instanceof Element)return ve(r,n);if(pe(r)){if(Ni.has(n))return;return r[n]}return r[n]}},validate:e=>Wn(e,2,"of","property, object")??Kn(e,0,"of","property name")},attribute:{name:"attribute",category:"Reference",evaluatesTo:"String",operators:["@"],async evaluate(e,...t){const[n,r]=t;if("string"!=typeof n)throw Error("Attribute name must be a string");const i=r||e.me;return i&&i instanceof Element?i.getAttribute(n):null},validate:e=>Qn(e,1,2,"attribute","attributeName, optional element")??Kn(e,0,"attribute","attribute name")??(2>e.length||null==e[1]||e[1]instanceof Element?null:"attribute element must be an Element")},attributeWithValue:{name:"attributeWithValue",category:"Reference",evaluatesTo:"Boolean",operators:["@="],async evaluate(e,...t){const[n,r,i]=t;if("string"!=typeof n)throw Error("Attribute name must be a string");if("string"!=typeof r)throw Error("Expected value must be a string");const a=i||e.me;return a&&a instanceof Element?a.getAttribute(n)===r:0},validate:e=>Qn(e,2,3,"attributeWithValue","attributeName, expectedValue, optional element")??Kn(e,0,"attributeWithValue","attribute name")??Kn(e,1,"attributeWithValue","expected value")??(3>e.length||null==e[2]||e[2]instanceof Element?null:"attributeWithValue element must be an Element")},classReference:{name:"classReference",category:"Reference",evaluatesTo:"Array",operators:["."],async evaluate(e,...t){const[n]=t;if("string"!=typeof n)throw Error("Class name must be a string");const r=n.startsWith(".")?n.slice(1):n,i=document.getElementsByClassName(r);return Array.from(i)},validate:e=>Jn(e,"classReference","className")},idReference:{name:"idReference",category:"Reference",evaluatesTo:"Element",operators:["#"],async evaluate(e,...t){const[n]=t;if("string"!=typeof n)throw Error("ID value must be a string");const r=n.startsWith("#")?n.slice(1):n;return document.getElementById(r)},validate:e=>Jn(e,"idReference","idValue")}};class Ri{constructor(){this.name="addition",this.category="Special",this.syntax="left + right",this.outputType="number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const n=this.validate(t);if(!n.isValid)return{success:0,errors:n.errors,suggestions:n.suggestions};try{const{left:e,right:n}=t;return{success:1,value:xr(kr(e,"left operand")+kr(n,"right operand"),"addition"),type:"number"}}catch(e){return{success:0,errors:[Ar("runtime-error","Addition failed: "+(e instanceof Error?e.message:e+""))],suggestions:["Ensure both operands are numeric"]}}}validate(e){const t=function(e){if(null==e)return jr([Ar("missing-argument","Input is null or undefined")],["Provide an object with left and right operands"]);if("object"!=typeof e)return jr([Ar("type-mismatch","Expected object, got "+typeof e)],["Provide an object with left and right operands"]);const t=e;if(!("left"in t)||!("right"in t)){const e=[];return"left"in t||e.push("left"),"right"in t||e.push("right"),jr([Ar("missing-argument",`Missing ${e.join(" and ")} operand${e.length>1?"s":""}`)],["Provide { left: value, right: value }"])}return{isValid:1,errors:[],suggestions:[]}}(e);if(!t.isValid)return t;const{left:n,right:r}=e;return Er(n)?Er(r)?{isValid:1,errors:[],suggestions:[]}:{isValid:0,errors:[Ar("type-mismatch","Right operand cannot be converted to number: "+r)],suggestions:["Provide a numeric value for right operand"]}:{isValid:0,errors:[Ar("type-mismatch","Left operand cannot be converted to number: "+n)],suggestions:["Provide a numeric value for left operand"]}}}const $i={addition:new Ri,subtraction:new class{constructor(){this.name="subtraction",this.category="Special",this.syntax="left - right",this.outputType="number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const n=this.validate(t);if(!n.isValid)return{success:0,errors:n.errors,suggestions:n.suggestions};try{const{left:e,right:n}=t;return{success:1,value:xr(kr(e,"left operand")-kr(n,"right operand"),"subtraction"),type:"number"}}catch(e){return{success:0,errors:[Ar("runtime-error","Subtraction failed: "+(e instanceof Error?e.message:e+""))],suggestions:["Ensure both operands are numeric"]}}}validate(e){return(new Ri).validate(e)}},multiplication:new class{constructor(){this.name="multiplication",this.category="Special",this.syntax="left * right",this.outputType="number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const n=this.validate(t);if(!n.isValid)return{success:0,errors:n.errors,suggestions:n.suggestions};try{const{left:e,right:n}=t;return{success:1,value:xr(kr(e,"left operand")*kr(n,"right operand"),"multiplication"),type:"number"}}catch(e){return{success:0,errors:[Ar("runtime-error","Multiplication failed: "+(e instanceof Error?e.message:e+""))],suggestions:["Ensure both operands are numeric"]}}}validate(e){return(new Ri).validate(e)}},division:new class{constructor(){this.name="division",this.category="Special",this.syntax="left / right",this.outputType="number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const n=this.validate(t);if(!n.isValid)return{success:0,errors:n.errors,suggestions:n.suggestions};try{const{left:e,right:n}=t,r=function(e,t,n=1){if(0===t){if(n)return 0===e?NaN:e>0?1/0:-1/0;throw Error("Division by zero")}return e/t}(kr(e,"left operand"),kr(n,"right operand"),1);return{success:1,value:r,type:"number"}}catch(e){return{success:0,errors:[Ar("runtime-error","Division failed: "+(e instanceof Error?e.message:e+""))],suggestions:["Ensure both operands are numeric"]}}}validate(e){return(new Ri).validate(e)}},modulo:new class{constructor(){this.name="modulo",this.category="Special",this.syntax="left mod right",this.outputType="number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const n=this.validate(t);if(!n.isValid)return{success:0,errors:n.errors,suggestions:n.suggestions};try{const{left:e,right:n}=t,r=function(e,t){if(0===t)throw Error("Modulo by zero");return e%t}(kr(e,"left operand"),kr(n,"right operand"));return{success:1,value:r,type:"number"}}catch(e){return{success:0,errors:[Ar("runtime-error","Modulo failed: "+(e instanceof Error?e.message:e+""))],suggestions:["Ensure both operands are numeric and divisor is not zero"]}}}validate(e){return(new Ri).validate(e)}},power:new class{constructor(){this.name="power",this.category="Special",this.syntax="left ** right",this.outputType="number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const n=this.validate(t);if(!n.isValid)return{success:0,errors:n.errors,suggestions:n.suggestions};try{const{left:e,right:n}=t,r=kr(e,"left operand"),i=kr(n,"right operand");return{success:1,value:xr(Math.pow(r,i),"power"),type:"number"}}catch(e){return{success:0,errors:[Ar("runtime-error","Power failed: "+(e instanceof Error?e.message:e+""))],suggestions:["Ensure both operands are numeric"]}}}validate(e){return(new Ri).validate(e)}}};function Ii(){return Un(yr,ai,wi,Ci,Pi,ui,$i)}var Mi=Object.freeze({__proto__:null,conversion:wi,conversionExpressions:wi,createCommonRegistry:function(){return Un(yr,ai,ui,wi,Ci)},createCoreRegistry:function(){return Un(yr,ai,ui)},createExpressionRegistry:Un,createFullExpressionRegistry:Ii,createFullRegistry:function(){return Un(yr,ai,ui,wi,Ci,Pi)},logical:ai,logicalExpressions:ai,positional:Ci,positionalExpressions:Ci,properties:Pi,propertiesExpressions:Pi,references:yr,referencesExpressions:yr,special:ui,specialExpressions:ui});function qi(e,t,n,r,i,a){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,l=r.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?r.static?e:e.prototype:null,p=t||(u?Object.getOwnPropertyDescriptor(u,r.name):{}),m=0,d=n.length-1;d>=0;d--){var f={};for(var y in r)f[y]="access"===y?{}:r[y];for(var y in r.access)f.access[y]=r.access[y];f.addInitializer=function(e){if(m)throw new TypeError("Cannot add initializers after decoration has completed");a.push(o(e||null))};var h=(0,n[d])("accessor"===l?{get:p.get,set:p.set}:p[c],f);if("accessor"===l){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw new TypeError("Object expected");(s=o(h.get))&&(p.get=s),(s=o(h.set))&&(p.set=s),(s=o(h.init))&&i.unshift(s)}else(s=o(h))&&("field"===l?i.unshift(s):p[c]=s)}u&&Object.defineProperty(u,r.name,p),m=1}function _i(e,t,n){for(var r=arguments.length>2,i=0;t.length>i;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0}function Di(e,t,n){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:1,value:n?"".concat(n," ",t):t})}"function"==typeof SuppressedError&&SuppressedError;const Vi=Symbol("command:name"),Hi=Symbol("command:category"),Fi=Symbol("command:metadata");function Bi(e){return function(t,n){const r=t;r[Vi]=e.name,r[Hi]=e.category,Object.defineProperty(t.prototype,"name",{value:e.name,writable:0,enumerable:1})}}function Ui(e){return function(t,n){const r=t,i=r[Hi];if(!i)throw Error("@meta decorator requires @command decorator to be applied first on "+t.name);const a={description:e.description,syntax:e.syntax,examples:e.examples,category:i,sideEffects:e.sideEffects,deprecated:e.deprecated,deprecationMessage:e.deprecationMessage,aliases:e.aliases,relatedCommands:e.relatedCommands,isBlocking:e.isBlocking??0,hasBody:e.hasBody??0,version:"1.0.0",compatibility:e.compatibility};r[Fi]=a,Object.defineProperty(t,"metadata",{value:a,writable:0,enumerable:1,configurable:0}),Object.defineProperty(t.prototype,"metadata",{get:()=>a,enumerable:1,configurable:0})}}function Gi(e){return()=>new e}function Wi(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&1===e.nodeType&&"tagName"in e&&"string"==typeof e.tagName&&"classList"in e}function Ki(e,t){return e?`[${e}] ${t}`:t}function Ji(e,t,n){if(Wi(e))return e;if(!e){const e=t.me;if(!e)throw Error(Ki(n,"No target element — provide explicit target or ensure context.me is set"));return Yi(e)}if("string"==typeof e){const r=e.trim();if("me"===r){if(!t.me)throw Error(Ki(n,'Context reference "me" is not available'));return Yi(t.me)}if("it"===r){if(!Wi(t.it))throw Error(Ki(n,'Context reference "it" is not an HTMLElement'));return t.it}if("you"===r){if(!t.you)throw Error(Ki(n,'Context reference "you" is not available'));return Yi(t.you)}const i=t.me?.ownerDocument??("undefined"!=typeof document?document:null);if(!i)throw Error(Ki(n,"DOM not available — cannot resolve element selector"));const a=i.querySelector(r);if(!a)throw Error(Ki(n,"Element not found with selector: "+r));if(!Wi(a))throw Error(Ki(n,"Element found but is not an HTMLElement: "+r));return a}throw Error(Ki(n,"Invalid target type: "+typeof e))}function Zi(e,t){if(Array.isArray(e))return e.filter(Wi);if(e instanceof NodeList)return Array.from(e).filter(Wi);if(Wi(e))return[e];if(!e){const e=t.me;return e&&Wi(e)?[e]:[]}if("string"==typeof e){const n=e.trim();if("me"===n)return t.me&&Wi(t.me)?[t.me]:[];if("it"===n)return Wi(t.it)?[t.it]:[];if("you"===n)return t.you&&Wi(t.you)?[t.you]:[];const r=t.me?.ownerDocument??("undefined"!=typeof document?document:null);if(r){let e=n;e.startsWith("<")&&e.endsWith("/>")&&(e=e.slice(1,-2).trim());const t=r.querySelectorAll(e);return Array.from(t).filter(Wi)}}return[]}function Yi(e){if(Wi(e))return e;throw Error("Value is not an HTMLElement")}function Xi(e,t,n){switch(e.toLowerCase()){case"my":case"me":if(!t.me)throw Error(Ki(n,'No "me" element in context'));if(!Wi(t.me))throw Error(Ki(n,"context.me is not an HTMLElement"));return t.me;case"its":case"it":if(!t.it)throw Error(Ki(n,'No "it" value in context'));if(!Wi(t.it))throw Error(Ki(n,"context.it is not an HTMLElement"));return t.it;case"your":case"you":if(!t.you)throw Error(Ki(n,'No "you" element in context'));if(!Wi(t.you))throw Error(Ki(n,"context.you is not an HTMLElement"));return t.you;default:throw Error(Ki(n,"Unknown possessive: "+e))}}const Qi=["on","from","to","in","with","at"];async function ea(e,t,n,r,i={},a){let o=e;if(i.filterPrepositions&&e&&(o=e.filter(e=>{const t=e;return"identifier"===t?.type&&"string"==typeof t.name?!Qi.includes(t.name.toLowerCase()):1})),(!o||0===o.length)&&i.fallbackModifierKey&&a){const e=a[i.fallbackModifierKey];e&&(o=[e])}if(!o||0===o.length){if(!n.me)throw Error(r+" command: no target specified and context.me is null");if(!Wi(n.me))throw Error(r+" command: context.me must be an HTMLElement");return[n.me]}const s=[];for(const e of o){const i=await t.evaluate(e,n);if(""!==i&&("string"!=typeof i||""!==i.trim()))if(Wi(i))s.push(i);else if(i instanceof NodeList){const e=Array.from(i).filter(Wi);s.push(...e)}else if(Array.isArray(i)){const e=i.filter(Wi);s.push(...e)}else{if("string"!=typeof i)throw Error(`Invalid ${r} target: expected HTMLElement or CSS selector, got ${typeof i}`);try{let e=i;e.startsWith("<")&&e.endsWith("/>")&&(e=e.slice(1,-2).trim());const t=n.me?.ownerDocument??("undefined"!=typeof document?document:null);if(!t)throw Error("DOM not available - cannot resolve element selector");const r=t.querySelectorAll(e),a=Array.from(r).filter(Wi);s.push(...a)}catch(e){throw Error(`Invalid CSS selector: "${i}" - ${e instanceof Error?e.message:e+""}`)}}}if(0===s.length){if(!n.me)throw Error(r+" command: no target specified and context.me is null");if(!Wi(n.me))throw Error(r+" command: context.me must be an HTMLElement");return[n.me]}return s}class ta{async parseInput(e,t,n){const{targets:r}=await async function(e,t,n,r){return{targets:await ea(e.args,t,n,r)}}(e,t,n,this.mode);return{targets:r,mode:this.mode,defaultDisplay:"show"===this.mode?"block":void 0}}validate(e){if("object"!=typeof e||null===e)return 0;const t=e;return Array.isArray(t.targets)&&t.targets.every(e=>Wi(e))?"show"!==t.mode&&"hide"!==t.mode||"show"===t.mode&&"string"!=typeof t.defaultDisplay?0:1:0}showElement(e,t="block"){const n=e.dataset.originalDisplay;void 0!==n?(e.style.display=n||t,delete e.dataset.originalDisplay):"none"===e.style.display&&(e.style.display=t),e.classList.add("show")}hideElement(e){if(!e.dataset.originalDisplay){const t=e.style.display;e.dataset.originalDisplay="none"===t?"":t}e.style.display="none",e.classList.remove("show")}}let na=(()=>{let e,t,n=[Ui({description:"Hide elements by setting display to none",syntax:"hide [<target>]",examples:["hide me","hide #modal","hide .warnings","hide <button/>"],sideEffects:["dom-mutation"]}),Bi({name:"hide",category:"dom"})],r=[],i=ta;return t=class extends i{constructor(){super(...arguments),this.mode="hide"}async execute(e,t){for(const t of e.targets)this.hideElement(t)}validate(e){if("object"!=typeof e||null===e)return 0;const t=e;return Array.isArray(t.targets)&&t.targets.every(e=>Wi(e))?1:0}},Di(t,"HideCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:a},null,r),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:a}),_i(t,r)})(),t})();const ra=Gi(na);let ia=(()=>{let e,t,n=[Ui({description:"Show elements by restoring display property",syntax:"show [<target>]",examples:["show me","show #modal","show .hidden","show <button/>"],sideEffects:["dom-mutation"]}),Bi({name:"show",category:"dom"})],r=[],i=ta;return t=class extends i{constructor(){super(...arguments),this.mode="show"}async execute(e,t){const n=e.defaultDisplay||"block";for(const t of e.targets)this.showElement(t,n)}validate(e){if("object"!=typeof e||null===e)return 0;const t=e;return Array.isArray(t.targets)&&t.targets.every(e=>Wi(e))?"string"!=typeof t.defaultDisplay?0:1:0}},Di(t,"ShowCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:a},null,r),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:a}),_i(t,r)})(),t})();const aa=Gi(ia);function oa(e){const t=e.trim();return t.startsWith("[@")&&t.endsWith("]")||t.startsWith("@")?1:0}function sa(e){const t=e.trim();if(t.startsWith("[@")&&t.endsWith("]")){const e=t.slice(2,-1),n=e.indexOf("=");if(-1===n)return{name:e.trim()};const r=e.slice(0,n).trim();let i=e.slice(n+1).trim();return(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),{name:r,value:i}}if(t.startsWith("@"))return{name:t.substring(1).trim()};throw Error("Invalid attribute syntax: "+e)}function la(e,t){for(const n of e)t(n);return e}function ca(e,t,n){for(const r of e)for(const e of t)n(r,e);return e}function ua(e,t,n){const r=e.hasAttribute(t);void 0!==n?r&&e.getAttribute(t)===n?e.removeAttribute(t):e.setAttribute(t,n):r?e.removeAttribute(t):e.setAttribute(t,"")}function pa(e){if(!e)return[];if("string"==typeof e)return e.trim().split(/[\s,]+/).map(e=>{const t=e.trim();return t.startsWith(".")?t.substring(1):t}).filter(e=>e.length>0&&da(e));if(Array.isArray(e))return e.map(e=>{const t=(e+"").trim();return t.startsWith(".")?t.substring(1):t}).filter(e=>e.length>0&&da(e));const t=(e+"").trim(),n=t.startsWith(".")?t.substring(1):t;return n.length>0&&da(n)?[n]:[]}function ma(e){const t=e.trim();return/^\{[^}]+\}$/.test(t)}function da(e){if(!e||0===e.trim().length)return 0;const t=e.trim();return ma(t)?1:/^[a-zA-Z_-][a-zA-Z0-9_-]*$/.test(t)}function fa(e,t){return e.map(e=>{if(ma(e)){const n=function(e){const t=e.trim(),n=t.match(/^\{(.+)\}$/);return n?n[1].trim():t}(e),r=t.locals.get(n)??t.globals.get(n);return null!=r?r+"":(Ye.command(`Dynamic class variable '${n}' not found in context`),"")}return e}).filter(e=>e.length>0)}function ya(e){return"string"==typeof e&&e.trim().startsWith("*")}function ha(e){const t=function(e){const t=e.trim();if(!t.startsWith("*"))return null;const n=t.substring(1).trim();return n?{property:n}:null}(e);if(!t)return null;const n=t.property.toLowerCase();return["display","visibility","opacity"].includes(n)?n:null}function va(e,t,n){e.style.setProperty(t,n)}const ga=["dialog","details","summary","select"];function ba(e){return e&&"object"==typeof e?"string"==typeof e.selector?e.selector:"string"==typeof e.value?e.value:"string"==typeof e.name?e.name:null:null}async function wa(e,t,n){return function(e){if(!e||"object"!=typeof e)return 0;const t=e.type;if("selector"!==t&&"cssSelector"!==t&&"classSelector"!==t)return 0;const n=ba(e);return"string"==typeof n&&n.startsWith(".")}(e)||function(e){if(!e||"object"!=typeof e)return 0;const t=e.type;if("selector"!==t&&"cssSelector"!==t&&"cssProperty"!==t)return 0;const n=ba(e);return"string"==typeof n&&n.startsWith("*")}(e)?{value:ba(e),extractedFromNode:1}:function(e){if(!e||"object"!=typeof e)return 0;if("attributeAccess"===e.type)return 1;if("selector"===e.type||"cssSelector"===e.type){const t=ba(e);return"string"==typeof t&&t.startsWith("@")}return 0}(e)?{value:(r=e,"attributeAccess"===r.type?"@"+r.attributeName:ba(r)),extractedFromNode:1}:{value:await t.evaluate(e,n),extractedFromNode:0};var r}class ka{async resolveTargets(e,t,n,r){return ea(e,t,n,this.mode,{filterPrepositions:1,fallbackModifierKey:this.preposition},r)}async evaluateFirst(e,t,n){return wa(e,t,n)}parseClassNames(e){return pa(e)}isAttribute(e){return oa(e.trim())}isCSSProperty(e){return ya(e.trim())}validateTargets(e){return Array.isArray(e)&&function(e){return Array.isArray(e)&&e.length>0&&e.every(e=>Wi(e))}(e)}validateType(e,t){return function(e,t){return"string"==typeof e&&t.includes(e)}(e,t)}validateStringArray(e,t=1){return Array.isArray(e)&&function(e,t=1){return Array.isArray(e)&&e.length>=t&&e.every(e=>"string"==typeof e&&e.length>0)}(e,t)}}let za=(()=>{let e,t,n=[Ui({description:"Add CSS classes, attributes, or styles to elements",syntax:"add <classes|@attr|{styles}> [to <target>]",examples:["add .active to me",'add "active selected" to <button/>',"add .highlighted to #modal",'add [@data-test="value"] to #element'],sideEffects:["dom-mutation"]}),Bi({name:"add",category:"dom"})],r=[],i=ka;return t=class extends i{constructor(){super(...arguments),this.mode="add",this.preposition="to"}async parseInput(e,t,n){if(!e.args||0===e.args.length)throw Error("add command requires an argument");const{value:r}=await this.evaluateFirst(e.args[0],t,n);if("object"==typeof r&&null!==r&&!Array.isArray(r))return{type:"styles",styles:r,targets:await this.resolveTargets(e.args.slice(1),t,n,e.modifiers)};if("string"==typeof r){const i=r.trim();if(this.isAttribute(i)){const{name:r,value:a}=function(e){const t=sa(e);return{name:t.name,value:t.value??""}}(i);return{type:"attribute",name:r,value:a,targets:await this.resolveTargets(e.args.slice(1),t,n,e.modifiers)}}if(this.isCSSProperty(i)){const r=i.substring(1).trim();if(2>e.args.length)throw Error("add *property requires a value argument");const a=await t.evaluate(e.args[1],n);return{type:"styles",styles:{[r]:a+""},targets:await this.resolveTargets(e.args.slice(2),t,n,e.modifiers)}}}const i=this.parseClassNames(r);if(0===i.length)throw Error("add command: no valid class names found");return{type:"classes",classes:i,targets:await this.resolveTargets(e.args.slice(1),t,n,e.modifiers)}}async execute(e,t){switch(e.type){case"classes":{const n=fa(e.classes,t);n.length>0&&ca(e.targets,n,(e,t)=>{e.classList.contains(t)||e.classList.add(t)});break}case"attribute":n=e.name,r=e.value,la(e.targets,e=>{e.setAttribute(n,r)});break;case"styles":ca(e.targets,Object.entries(e.styles),(e,[t,n])=>{e.style.setProperty(t,n)})}var n,r}validate(e){if("object"!=typeof e||null===e)return 0;const t=e;if(!this.validateType(t.type,["classes","attribute","styles"]))return 0;if(!this.validateTargets(t.targets))return 0;if("classes"===t.type){if(!this.validateStringArray(e.classes,1))return 0}else if("attribute"===t.type){if("string"!=typeof e.name||0===e.name.length)return 0;if("string"!=typeof e.value)return 0}else if("styles"===t.type){const t=e;if("object"!=typeof t.styles||null===t.styles)return 0;if(Array.isArray(t.styles))return 0;const n=t.styles;if(0===Object.keys(n).length)return 0;if(!Object.values(n).every(e=>"string"==typeof e))return 0}return 1}},Di(t,"AddCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:a},null,r),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:a}),_i(t,r)})(),t})();const xa=Gi(za);function Ea(e){return e.parentNode?(e.remove(),1):0}let Sa=(()=>{let e,t,n=[Ui({description:"Remove CSS classes, attributes, styles, or elements from the DOM",syntax:"remove <classes|@attr|*prop|element> [from <target>]",examples:["remove .active from me",'remove "active selected" from <button/>',"remove .highlighted from #modal","remove me","remove closest .item"],sideEffects:["dom-mutation"]}),Bi({name:"remove",category:"dom"})],r=[],i=ka;return t=class extends i{constructor(){super(...arguments),this.mode="remove",this.preposition="from"}async parseInput(e,t,n){if(!e.args||0===e.args.length)throw Error("remove command requires an argument");const{value:r}=await this.evaluateFirst(e.args[0],t,n);if(Wi(r))return{type:"element",targets:[r]};if(Array.isArray(r)&&r.length>0&&Wi(r[0]))return{type:"element",targets:r.filter(e=>Wi(e))};if("string"==typeof r){const i=r.trim();if(this.isAttribute(i))return{type:"attribute",name:sa(i).name,targets:await this.resolveTargets(e.args.slice(1),t,n,e.modifiers)};if(this.isCSSProperty(i))return{type:"styles",properties:[i.substring(1).trim()],targets:await this.resolveTargets(e.args.slice(1),t,n,e.modifiers)}}const i=this.parseClassNames(r);if(0===i.length)throw Error("remove command: no valid class names found");return{type:"classes",classes:i,targets:await this.resolveTargets(e.args.slice(1),t,n,e.modifiers)}}execute(e,t){switch(e.type){case"classes":{const n=fa(e.classes,t);n.length>0&&ca(e.targets,n,(e,t)=>{e.classList.remove(t)});break}case"attribute":n=e.name,la(e.targets,e=>{e.removeAttribute(n)});break;case"styles":ca(e.targets,e.properties,(e,t)=>{e.style.removeProperty(t)});break;case"element":for(const t of e.targets)Ea(t)}var n}validate(e){if("object"!=typeof e||null===e)return 0;const t=e;if(!this.validateType(t.type,["classes","attribute","styles","element"]))return 0;if(!this.validateTargets(t.targets))return 0;if("classes"===t.type){if(!this.validateStringArray(e.classes,1))return 0}else if("attribute"===t.type){if("string"!=typeof e.name||0===e.name.length)return 0}else if("styles"===t.type&&!this.validateStringArray(e.properties,1))return 0;return 1}},Di(t,"RemoveCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:a},null,r),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:a}),_i(t,r)})(),t})();const Ta=Gi(Sa);function ja(e){const t=e.trim().match(/^(\d+(?:\.\d+)?)\s*(s|ms|sec|seconds?|milliseconds?)?$/i);if(!t)return null;const n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();return"ms"===r||"millisecond"===r||"milliseconds"===r?{number:n,milliseconds:Math.floor(n)}:"s"===r||"sec"===r||"second"===r||"seconds"===r?{number:n,milliseconds:Math.floor(1e3*n)}:null}function Aa(e,t=300){if("number"==typeof e)return Math.max(0,Math.floor(e));if("string"==typeof e){const n=ja(e);return n?n.milliseconds:t}return t}function La(e){if("number"==typeof e){if(0>e)throw Error("Duration must be >= 0");return Math.floor(e)}if("string"==typeof e){const t=ja(e);if(!t)throw Error(`Invalid duration format: "${e}"`);return t.milliseconds}throw Error("Invalid duration type: "+typeof e)}function Oa(e){return e&&"none"!==e?e.split(",").map(e=>{const t=parseFloat(e.trim());return isNaN(t)?0:e.includes("s")&&!e.includes("ms")?1e3*t:t}):[0]}function Ca(e,t){let n=0;for(let r=0;e.length>r;r++)n=Math.max(n,(e[r]||0)+(t[r]||0));return n}function Na(e){return 0===e.length?[]:"SUMMARY"===e[0].tagName?e.map(e=>e.closest("details")).filter(e=>null!==e):e}function Pa(e){return"DIALOG"===e.tagName}function Ra(e){return"DETAILS"===e.tagName}function $a(e,t,n){return()=>{"class"===t?e.classList.toggle(n):"attribute"===t&&ua(e,n)}}function Ia(e,t,n,r){const i=$a(e,t,n),a=setTimeout(i,r);return()=>{clearTimeout(a)}}function Ma(e,t,n,r){const i=$a(e,t,n),a=()=>{i(),e.removeEventListener(r,a)};return e.addEventListener(r,a,{once:1}),()=>{e.removeEventListener(r,a)}}function qa(e,t,n){if(t.startsWith("@")){const r=t.substring(1);return void(0==n?e.removeAttribute(r):e.setAttribute(r,1==n?"":n+""))}const r=n+"";switch(t){case"textContent":return void(e.textContent=r);case"innerHTML":return void(e.innerHTML=r);case"innerText":return void(e.innerText=r);case"id":return void(e.id=r);case"className":return void(e.className=r);case"value":return void("value"in e&&(e.value=r));case"checked":return void("checked"in e&&(e.checked=!!n))}if(t.includes(".")){const r=t.split(".");let i=e;for(let e=0;r.length-1>e;e++)if(i=i[r[e]],null==i)return;return void(i[r[r.length-1]]=n)}if(t.includes("-")||t in e.style)e.style.setProperty(t,r);else try{e[t]=n}catch(e){if(!(e instanceof TypeError&&(e.message.includes("only a getter")||e.message.includes("read only"))))throw Error(`Cannot set property '${t}': ${e instanceof Error?e.message:"Unknown error"}`)}}function _a(e){return null==e||""===e}const Da=/^the\s+(.+?)\s+of\s+(.+)$/i,Va=new Set(["disabled","checked","hidden","readOnly","readonly","required","multiple","selected","autofocus","autoplay","controls","loop","muted","open","reversed","async","defer","noValidate","novalidate","formNoValidate","formnovalidate","draggable","spellcheck","contentEditable"]);function Ha(e){return"string"==typeof e&&Da.test(e)}function Fa(e,t){const n=e.match(Da);if(!n)return null;try{return{element:Ji(n[2].trim(),t),property:n[1].trim()}}catch{return null}}async function Ba(e,t,n){if(function(e){return e&&"object"==typeof e?"propertyOfExpression"===e.type&&"object"==typeof e.property&&null!==e.property:0}(e))return async function(e,t,n){const r=e.property?.name;if(!r)return null;let i=await t.evaluate(e.target,n);return Array.isArray(i)&&(i=i[0]),Wi(i)?{element:i,property:r}:null}(e,t,n);if(function(e){return e&&"object"==typeof e?"propertyAccess"!==e.type?0:"string"==typeof e.property||"object"==typeof e.property&&null!==e.property&&"string"==typeof e.property.name:0}(e))return async function(e,t,n){const r="string"==typeof e.property?e.property:e.property?.name;if(!r)return null;let i=await t.evaluate(e.object,n);return Array.isArray(i)&&(i=i[0]),Wi(i)?{element:i,property:r}:null}(e,t,n);const r=e;if("possessiveExpression"===r?.type||"memberExpression"===r?.type){const e=r.object,i=r.property;let a=await t.evaluate(e,n);if(Array.isArray(a)&&(a=a[0]),!Wi(a))return null;const o=i?.name||i?.value;return o?{element:a,property:o}:null}return null}function Ua(e,t){const{element:n,property:r}=e;r.startsWith("*")?va(n,r.substring(1),t+""):qa(n,r,t)}async function Ga(e,t,n){let r,i;if(e?.for){const i=await t.evaluate(e.for,n);r="number"==typeof i?i:"string"==typeof i?Aa(i):void 0}if(e?.until){const r=await t.evaluate(e.until,n);"string"==typeof r&&(i=r)}return{duration:r,untilEvent:i}}let Wa=(()=>{let e,t,n=[Ui({description:"Toggle classes, attributes, or interactive elements",syntax:["toggle <class> [on <target>]","toggle @attr","toggle <element> [as modal]","toggle <expr> for <duration>"],examples:["toggle .active on me","toggle @disabled","toggle #myDialog as modal","toggle .loading for 2s"],sideEffects:["dom-mutation"]}),Bi({name:"toggle",category:"dom"})],r=[];return t=class{async parseInput(e,t,n){if(!e.args?.length)throw Error("toggle command requires an argument");const r=e.args[0],i=r?.name;if("between"===i&&e.args.length>=4){const{duration:r,untilEvent:i}=await Ga(e.modifiers,t,n),a=await t.evaluate(e.args[1],n),o=await t.evaluate(e.args[3],n),s=[];for(let t=4;e.args.length>t;t++){const n=e.args[t]?.name;"on"!==n&&"from"!==n&&s.push(e.args[t])}const l={filterPrepositions:1,fallbackModifierKey:"on"},c=await ea(s,t,n,"toggle",l,e.modifiers);return{type:"classes-between",classA:(a+"").replace(/^\./,""),classB:(o+"").replace(/^\./,""),targets:c,duration:r,untilEvent:i}}const a=await Ba(r,t,n);if(a)return{type:"property",target:a};if("selector"===r.type&&"string"==typeof r.value&&r.value.startsWith("*")){let i=r.value,a=1;if("*"===i&&e.args.length>1&&"identifier"===e.args[1].type&&(i="*"+e.args[1].name,a=2),"*"===i&&e.modifiers?.on){const r=e.modifiers.on?.name;if(r&&["display","visibility","opacity"].includes(r)){i="*"+r;const{duration:a,untilEvent:o}=await Ga(e.modifiers,t,n),s=ha(i);if(s){const e=n.me;return{type:"css-property",property:s,targets:e?[e]:[],duration:a,untilEvent:o}}}}const o=ha(i);if(o){const{duration:r,untilEvent:i}=await Ga(e.modifiers,t,n),s={filterPrepositions:1,fallbackModifierKey:"on"};return{type:"css-property",property:o,targets:await ea(e.args.slice(a),t,n,"toggle",s,e.modifiers),duration:r,untilEvent:i}}}const{duration:o,untilEvent:s}=await Ga(e.modifiers,t,n),{value:l}=await wa(r,t,n);if(Ha(l)){const e=Fa(l,n);if(e)return{type:"property",target:e}}const{type:c,expression:u}=function(e,t){const n=t?.name,r=function(e){if(!e||"object"!=typeof e)return 0;if("identifier"!==e.type)return 0;const t=e.name;return"string"==typeof t&&function(e){if("string"!=typeof e)return 0;const t=e.toLowerCase();return ga.includes(t)}(t)}(t);if(Wi(e)||Array.isArray(e)&&e.every(e=>Wi(e)))return{type:"element",expression:""};if(r&&n)return{type:"element",expression:n};if("string"==typeof e){const t=e.trim();return t.startsWith("@")||t.startsWith("[@")?{type:"attribute",expression:t}:t.startsWith("*")?{type:"css-property",expression:t}:t.startsWith(".")?{type:"class",expression:t}:t.startsWith("#")||function(e){if("string"!=typeof e)return 0;const t=e.toLowerCase();return ga.some(e=>t.includes(e))}(t)?{type:"element",expression:t}:{type:"class",expression:t}}return{type:"class",expression:""}}(l,r),p={filterPrepositions:1,fallbackModifierKey:"on"};switch(c){case"attribute":{const{name:r,value:i}=sa(u);return{type:"attribute",name:r,value:i,targets:await ea(e.args.slice(1),t,n,"toggle",p,e.modifiers),duration:o,untilEvent:s}}case"css-property":{const r=ha(u);if(!r)throw Error("Invalid CSS property: "+u);return{type:"css-property",property:r,targets:await ea(e.args.slice(1),t,n,"toggle",p,e.modifiers)}}case"element":{let i;if(Wi(l))i=[l];else if(Array.isArray(l)&&l.every(e=>Wi(e)))i=l;else if(u){const e=document.querySelectorAll(u);i=Array.from(e).filter(e=>Wi(e))}else i=await ea([r],t,n,"toggle",p,e.modifiers);const a=function(e){if(0===e.length)return null;const t=e[0].tagName;if(!e.every(e=>e.tagName===t))return null;switch(t){case"DIALOG":return"dialog";case"DETAILS":return"details";case"SELECT":return"select";case"SUMMARY":return e.map(e=>e.closest("details")).filter(e=>null!==e).length>0?"details":null;default:return null}}(i);if("dialog"===a){const r=await async function(e,t,n,r){if(t?.as){const e=await n.evaluate(t.as,r);if("string"==typeof e&&"modal"===e.toLowerCase())return"modal"}if(e.length>=2){const t=await n.evaluate(e[1],r);if("string"==typeof t){const i=t.toLowerCase();if("modal"===i||"as modal"===i)return"modal";if("as"===i&&e.length>=3){const t=await n.evaluate(e[2],r);if("string"==typeof t&&"modal"===t.toLowerCase())return"modal"}}}return"non-modal"}(e.args,e.modifiers,t,n);return{type:"dialog",mode:r,targets:i}}return"details"===a?{type:"details",targets:Na(i)}:"select"===a?{type:"select",targets:i}:{type:"classes",classes:pa(u),targets:i,duration:o,untilEvent:s}}default:{const r=pa(u||l);if(!r.length)throw Error("toggle command: no valid class names found");return{type:"classes",classes:r,targets:await ea(e.args.slice(1),t,n,"toggle",p,e.modifiers),duration:o,untilEvent:s}}}}async execute(e,t){switch(e.type){case"classes":{const n=fa(e.classes,t);if(0===n.length)return[...e.targets];if(ca(e.targets,n,(e,t)=>{e.classList.toggle(t)}),(e.duration||e.untilEvent)&&n.length)for(const t of e.targets)e.duration&&Ia(t,"class",n[0],e.duration),e.untilEvent&&Ma(t,"class",n[0],e.untilEvent);return[...e.targets]}case"attribute":if(n=e.name,r=e.value,la(e.targets,e=>{ua(e,n,r)}),e.duration||e.untilEvent)for(const t of e.targets)e.duration&&Ia(t,"attribute",e.name,e.duration),e.untilEvent&&Ma(t,"attribute",e.name,e.untilEvent);return[...e.targets];case"css-property":return la(e.targets,t=>function(e,t){const n=window.getComputedStyle(e);switch(t){case"display":"none"===n.display?(e.style.display=e.dataset.previousDisplay||"block",delete e.dataset.previousDisplay):(e.dataset.previousDisplay=n.display,e.style.display="none");break;case"visibility":e.style.visibility="hidden"===n.visibility?"visible":"hidden";break;case"opacity":e.style.opacity=0===parseFloat(n.opacity)?"1":"0"}}(t,e.property));case"property":return function(e){const t=function(e){const{element:t,property:n}=e;return n.startsWith("*")?function(e,t){return window.getComputedStyle(e).getPropertyValue(t)}(t,n.substring(1)):ve(t,n)}(e),n=e.property,r=n.startsWith("@")?n.substring(1):n;if("boolean"==typeof t||Va.has(r)||Va.has(r.toLowerCase())){const n=!t;return Ua(e,n),n}if("number"==typeof t){const n=0===t?1:0;return Ua(e,n),n}if("string"==typeof t){const r="__ht_"+n,i=e.element[r];return""===t&&void 0!==i?(Ua(e,i),i):(e.element[r]=t,Ua(e,""),"")}Ua(e,!t)}(e.target),[e.target.element];case"dialog":return la(e.targets,t=>{return r=e.mode,void((n=t).open?n.close():"modal"===r?n.showModal():n.show());var n,r});case"details":return la(e.targets,e=>{var t;(t=e).open=!t.open});case"select":return la(e.targets,e=>function(e){if(document.activeElement===e)e.blur();else{if(e.focus(),"showPicker"in e&&"function"==typeof e.showPicker)try{return void e.showPicker()}catch{}const t=new MouseEvent("click",{view:window,bubbles:1,cancelable:1});e.dispatchEvent(t)}}(e));case"classes-between":for(const t of e.targets){const n=t.classList.contains(e.classA),r=t.classList.contains(e.classB);n?(t.classList.remove(e.classA),t.classList.add(e.classB)):r?(t.classList.remove(e.classB),t.classList.add(e.classA)):t.classList.add(e.classA)}if(e.duration||e.untilEvent)for(const t of e.targets)e.duration&&Ia(t,"class",e.classA,e.duration),e.untilEvent&&Ma(t,"class",e.classA,e.untilEvent);return[...e.targets]}var n,r}},Di(t,"ToggleCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})();const Ka=Gi(Wa);let Ja=(()=>{let e,t,n=[Ui({description:"Insert content into elements or properties",syntax:["put <value> into <target>","put <value> before <target>","put <value> after <target>"],examples:['put "Hello World" into me',"put <div>Content</div> before #target","put value into #elem's innerHTML"],sideEffects:["dom-mutation"]}),Bi({name:"put",category:"dom"})],r=[];return t=class{async parseInput(e,t,n){if(!e.args?.length)throw Error("put requires arguments");const r=e=>e?.type||"unknown",i=["into","before","after","at","at start of","at end of"];let a=-1,o=null;for(let t=0;e.args.length>t;t++){const n=e.args[t],s=r(n),l="literal"===s?n.value:n.name;if(("literal"===s||"identifier"===s)&&i.includes(l)){a=t,o=l;break}}let s=null,l=null;if(-1===a)if(e.modifiers.into||e.modifiers.before||e.modifiers.after){const t=e.modifiers.into?"into":e.modifiers.before?"before":"after";s=e.args[0],o=t,l=e.modifiers[t]}else if(3>e.args.length){if(2>e.args.length)throw Error("put requires content and position");s=e.args[0],o=e.args[1]?.value||e.args[1]?.name||"into"}else s=e.args[0],o=e.args[1]?.value||e.args[1]?.name||null,l=e.args[2];else s=e.args.slice(0,a)[0]||null,l=e.args.slice(a+1)[0]||null;if(!s)throw Error("put requires content");if(!o)throw Error("put requires position keyword");const c=await t.evaluate(s,n),u=this.mapPosition(o);let p,m,d=null;if(l){const e=r(l),i=await Ba(l,t,n);if(i)return{value:c,targets:[i.element],position:"replace",memberPath:i.property};if("memberExpression"===e){const e=l.object,r=l.property;if("selector"===e?.type)d=e.value;else if("identifier"===e?.type){const i=e.name;if("my"===i||"me"===i||"I"===i){if(n.me&&r?.name)return{value:c,targets:[n.me],position:"replace",memberPath:r.name}}else if("its"===i||"it"===i){const e=await t.evaluate(l,n);"string"==typeof e&&(d=e)}else d=i}if(d&&r?.name)p=r.name;else if(!d&&!p){const e=await t.evaluate(l,n);"string"==typeof e&&(d=e)}}else if("identifier"===e&&"me"===l.name)d=null;else if("selector"===e||"cssSelector"===e)d=l.value||l.selector;else if("literal"===e){const e=l.value;if("string"==typeof e&&Ha(e)){const t=Fa(e,n);if(t)return{value:c,targets:[t.element],position:"replace",memberPath:t.property}}"string"==typeof e&&this.looksLikeCss(e)?d=e:m=e+""}else if("identifier"===e){const e=l.name;if(this.looksLikeCss(e))d=e;else{const r=await t.evaluate(l,n),i=this.resolveEvaluatedAsElements(r);if(i)return{value:c,targets:i,position:u,memberPath:p};m=e}}else{const e=await t.evaluate(l,n),r=this.resolveEvaluatedAsElements(e);if(r)return{value:c,targets:r,position:u,memberPath:p};"string"==typeof e&&(this.looksLikeCss(e)?d=e:m=e)}}return m?{value:c,targets:[],position:u,memberPath:p,variableName:m}:{value:c,targets:await this.resolveTargets(d,n),position:u,memberPath:p}}async execute(e,t){const{value:n,targets:r,position:i,memberPath:a,variableName:o}=e;if(o)return t.locals&&t.locals.set(o,n),t[o]=n,void Object.assign(t,{it:n});if(a)for(const e of r)this.setProperty(e,a,n);else for(const e of r){const t=this.parseValue(n);this.insertContent(e,t,i)}return r}mapPosition(e){switch(e){case"into":return"replace";case"before":return"beforebegin";case"after":return"afterend";case"at start of":return"afterbegin";case"at end of":return"beforeend";default:throw Error("Invalid position: "+e)}}async resolveTargets(e,t){if(!e||"me"===e){if(!t.me||!Wi(t.me))throw Error("put: no target and context.me is null");return[t.me]}const n=Array.from(document.querySelectorAll(e)).filter(e=>Wi(e));if(!n.length)throw Error(`No elements: "${e}"`);return n}parseValue(e){return Wi(e)?e:null==e?"":e+""}insertContent(e,t,n){if("replace"!==n)if(Wi(t)){const r=t;switch(n){case"beforebegin":e.parentElement?.insertBefore(r,e);break;case"afterbegin":e.insertBefore(r,e.firstChild);break;case"beforeend":e.appendChild(r);break;case"afterend":e.parentElement?.insertBefore(r,e.nextSibling)}}else t.includes("<")&&t.includes(">")?e.insertAdjacentHTML(n,t):e.insertAdjacentText(n,t);else Wi(t)?(e.innerHTML="",e.appendChild(t)):t.includes("<")&&t.includes(">")?e.innerHTML=t:e.textContent=t}resolveEvaluatedAsElements(e){if(Wi(e))return[e];if(Array.isArray(e)){const t=e.filter(Wi);return t.length>0?t:null}if("undefined"!=typeof NodeList&&e instanceof NodeList){const t=Array.from(e).filter(Wi);return t.length>0?t:null}return null}looksLikeCss(e){return e?/^[#.\[]/.test(e)||/[>+~\s]/.test(e)&&e.length>1?1:["div","span","p","a","button","input","form","ul","li","ol","table","tr","td","th","img","h1","h2","h3","h4","h5","h6","section","article","header","footer","nav","main","aside","dialog","label","select","option","textarea"].includes(e.toLowerCase()):0}setProperty(e,t,n){const r=t.split(".");let i=e;for(let e=0;r.length-1>e;e++){if(!i[r[e]])throw Error(`Property path "${t}" does not exist`);i=i[r[e]]}i[r[r.length-1]]=n}},Di(t,"PutCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})();const Za=Gi(Ja);function Ya(e){if(null==e)return 0;if("number"==typeof e)return isFinite(e)?e:0;if("string"==typeof e)return parseFloat(e);if("boolean"==typeof e)return e?1:0;if(Array.isArray(e))return e.length;if("object"==typeof e){if("length"in e&&"number"==typeof e.length)return e.length;if("function"==typeof e.valueOf){const t=e.valueOf();if("number"==typeof t)return t}return NaN}return 0}function Xa(e,t,n){return"global"===n&&t.globals&&t.globals.has(e)?t.globals.get(e):"global"!==n&&t.locals&&t.locals.has(e)?(ne(e,t),t.locals.get(e)):t.globals&&t.globals.has(e)?t.globals.get(e):t.variables&&t.variables.has(e)?t.variables.get(e):"global"===n&&t.locals&&t.locals.has(e)?(ne(e,t),t.locals.get(e)):"undefined"!=typeof window&&e in window?window[e]:"undefined"!=typeof globalThis&&e in globalThis?globalThis[e]:void 0}function Qa(e,t,n,r){if("global"===r)return oe(n,e,t),void("undefined"!=typeof window&&(window[e]=t));if(e.startsWith("$"))oe(n,e.slice(1),t);else{if(n.locals&&n.locals.has(e))return n.locals.set(e,t),void te(e,t,n);if(n.globals&&n.globals.has(e))return oe(n,e,t),void("undefined"!=typeof window&&e in window&&(window[e]=t));if(n.variables&&n.variables.has(e))n.variables.set(e,t);else{if("undefined"!=typeof window&&e in window)return window[e]=t,void oe(n,e,t);n.locals.set(e,t),te(e,t,n)}}}function eo(e,t){return"me"===e?t.me:"it"===e?t.it:"you"===e?t.you:Xa(e,t)}const to=Gi((()=>{let e,t,n=[Ui({description:"Create DOM elements or class instances",syntax:["make a <tag#id.class1.class2/>","make a <ClassName> from <args> called <identifier>"],examples:["make an <a.navlink/> called linkElement",'make a URL from "/path/", "https://origin.example.com"'],sideEffects:["dom-creation","data-mutation"]}),Bi({name:"make",category:"dom"})],r=[];return t=class{async parseInput(e,t,n){const r=e.args.length>0?await t.evaluate(e.args[0],n):void 0;if(!r)throw Error("Make command requires class name or DOM element expression");const i=void 0!==e.modifiers.an?"an":"a",a=await async function(e,t,n){if(!e)return[];if("arrayLiteral"===e.type&&Array.isArray(e.args)){const r=[];for(const i of e.args)r.push(await t.evaluate(i,n));return r}const r=await t.evaluate(e,n);return Array.isArray(r)?r:[r]}(e.modifiers.from,t,n),o=await async function(e,t,n){if(!e)return;if("symbol"===e.type&&"string"==typeof e.name)return e.name;const r=await t.evaluate(e,n);return"string"==typeof r?r:r+""}(e.modifiers.called,t,n);return{article:i,expression:r,constructorArgs:a,variableName:o}}async execute(e,t){const{expression:n,constructorArgs:r=[],variableName:i}=e,a="string"==typeof n&&n.startsWith("<")&&n.endsWith("/>")?function(e){const t=e.slice(1,-2);let n="div",r=t;const i=t.match(/^([a-zA-Z][a-zA-Z0-9]*)/);i&&(n=i[1],r=t.slice(i[0].length));const a=document.createElement(n),o=r.split(/(?=[.#])/);for(const e of o)if(e.startsWith("#")){const t=e.slice(1);t&&(a.id=t)}else if(e.startsWith(".")){const t=e.slice(1);t&&a.classList.add(t)}return a}(n):function(e,t,n){if(Wi(e))return e;const r=e+"";let i;if("undefined"!=typeof window&&(i=window[r]),i||"undefined"==typeof global||(i=global[r]),!i&&n.variables?.has(r)&&(i=n.variables.get(r)),!i||"function"!=typeof i)throw Error(`Constructor '${r}' not found or is not a function`);return 0===t.length?new i:new i(...t)}(n,r,t);return Object.assign(t,{it:a}),i&&Qa(i,a,t),a}},Di(t,"MakeCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),no=Gi((()=>{let e,t,n=[Ui({description:"Remove all children from an element (sets innerHTML to empty)",syntax:["empty","empty <target>","empty the <target>"],examples:["empty me","empty #list","empty .results"],sideEffects:["dom-mutation"]}),Bi({name:"empty",category:"dom"})],r=[];return t=class{async parseInput(e,t,n){return{targets:await ea(e.args,t,n,"empty",{filterPrepositions:1,fallbackModifierKey:"on"},e.modifiers)}}async execute(e,t){for(const t of e.targets)t.innerHTML=""}validate(e){if("object"!=typeof e||null===e)return 0;const t=e;return Array.isArray(t.targets)?t.targets.every(e=>Wi(e)):0}},Di(t,"EmptyCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})());function ro(e){return e.hasAttribute("popover")}let io=(()=>{let e,t,n=[Ui({description:"Open a dialog, details element, or popover",syntax:["open [<target>]","open <dialog> as modal","open <dialog> as non-modal"],examples:["open","open #myDialog","open #details","open #popup as non-modal"],sideEffects:["dom-mutation"]}),Bi({name:"open",category:"dom"})],r=[];return t=class{async parseInput(e,t,n){const r=(e.args??[]).filter(e=>{const t=e;if("identifier"!==t?.type)return 1;const n=t.name?.toLowerCase();return"as"!==n&&"modal"!==n&&"non-modal"!==n&&"nonmodal"!==n}),i=Na(await ea(r,t,n,"open",{filterPrepositions:1,fallbackModifierKey:"on"},e.modifiers)),a=await async function(e,t,n,r){if(t?.as){const e=await n.evaluate(t.as,r);if("string"==typeof e){const t=e.toLowerCase().trim();if("non-modal"===t||"nonmodal"===t)return"non-modal";if("modal"===t)return"modal"}}for(let t=0;e.length-1>t;t++){const i=e[t];if("identifier"===i?.type&&"as"===i.name?.toLowerCase()){const i=await n.evaluate(e[t+1],r);if("string"==typeof i){const e=i.toLowerCase().trim();if("non-modal"===e||"nonmodal"===e)return"non-modal";if("modal"===e)return"modal"}}}return"modal"}(e.args??[],e.modifiers??{},t,n);return{targets:i,dialogMode:a}}async execute(e,t){for(const t of e.targets)if(Pa(t))t.open||("modal"===e.dialogMode?t.showModal():t.show());else if(Ra(t))t.open=1;else if(ro(t)){const e=t;if("function"==typeof e.showPopover)try{e.showPopover()}catch{}}}validate(e){if("object"!=typeof e||null===e)return 0;const t=e;return Array.isArray(t.targets)&&t.targets.every(e=>Wi(e))?"modal"===t.dialogMode||"non-modal"===t.dialogMode:0}},Di(t,"OpenCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})();const ao=Gi(io);function oo(e){return e.hasAttribute("popover")}const so=Gi((()=>{let e,t,n=[Ui({description:"Close a dialog, details element, or popover",syntax:["close","close <target>"],examples:["close","close #myDialog","close #details","close #popup"],sideEffects:["dom-mutation"]}),Bi({name:"close",category:"dom"})],r=[];return t=class{async parseInput(e,t,n){return{targets:Na(await ea(e.args,t,n,"close",{filterPrepositions:1,fallbackModifierKey:"on"},e.modifiers))}}async execute(e,t){for(const t of e.targets)if(Pa(t))t.open&&t.close();else if(Ra(t))t.open=0;else if(oo(t)){const e=t;if("function"==typeof e.hidePopover)try{e.hidePopover()}catch{}}}validate(e){if("object"!=typeof e||null===e)return 0;const t=e;return Array.isArray(t.targets)?t.targets.every(e=>Wi(e)):0}},Di(t,"CloseCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})());function lo(e){const t=e.tagName;return"INPUT"===t||"TEXTAREA"===t}const co=Gi((()=>{let e,t,n=[Ui({description:"Select the contents of a text field, or select the contents of a DOM element",syntax:["select","select <target>"],examples:["select #search","select <textarea/>","select me"],sideEffects:["focus","dom-mutation"]}),Bi({name:"select",category:"dom"})],r=[];return t=class{async parseInput(e,t,n){return{targets:await ea(e.args,t,n,"select",{filterPrepositions:1,fallbackModifierKey:"on"},e.modifiers)}}async execute(e,t){if(0!==e.targets.length)for(const t of e.targets){if(lo(t)){t.select();continue}const e=t.ownerDocument??("undefined"!=typeof document?document:null),n=e?.defaultView;if(!e||!n)continue;const r=n.getSelection?.();if(r)try{const n=e.createRange();n.selectNodeContents(t),r.removeAllRanges(),r.addRange(n)}catch{}}}validate(e){if("object"!=typeof e||null===e)return 0;const t=e;return Array.isArray(t.targets)?t.targets.every(e=>Wi(e)):0}},Di(t,"SelectCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})());function uo(e){return"FORM"===e.tagName}const po=Gi((()=>{let e,t,n=[Ui({description:"Reset a <form> element to its default values (HTMLFormElement.reset())",syntax:["reset","reset <target>"],examples:["reset","reset #myForm","reset <form/>"],sideEffects:["dom-mutation"]}),Bi({name:"reset",category:"dom"})],r=[];return t=class{async parseInput(e,t,n){return{targets:await ea(e.args,t,n,"reset",{filterPrepositions:1,fallbackModifierKey:"on"},e.modifiers)}}async execute(e,t){for(const t of e.targets)uo(t)&&t.reset()}validate(e){if("object"!=typeof e||null===e)return 0;const t=e;return Array.isArray(t.targets)?t.targets.every(e=>Wi(e)):0}},Di(t,"ResetCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})());var mo="moveBefore"in Element.prototype,fo=[0,1,0,0,0,0,0,0,0,1,0,1,0],yo=new Set,ho=new Set,vo=new Set,go=new Set,bo=new Set,wo=new Set;function ko(e){for(const t of e.querySelectorAll("input"))(t.name&&t.value!==t.defaultValue||t.checked!==t.defaultChecked)&&t.setAttribute("morphlex-dirty","");for(const t of e.querySelectorAll("option"))t.value&&t.selected!==t.defaultSelected&&t.setAttribute("morphlex-dirty","");for(const t of e.querySelectorAll("textarea"))t.value!==t.defaultValue&&t.setAttribute("morphlex-dirty","")}function zo(e){const t=document.createElement("template");return t.innerHTML=e.trim(),t.content}function xo(e,t,n){if(t!==n){if(t.parentNode===e){if(t.nextSibling===n)return;if(mo)return void e.moveBefore(t,n)}e.insertBefore(t,n)}}class Eo{#e=new WeakMap;#t=new WeakMap;#n;constructor(e={}){this.#n=e}morph(e,t){jo(e)&&this.#r(e),t instanceof NodeList?(this.#i(t),this.#a(e,t)):jo(t)&&(this.#o(t),this.#s(e,t))}#a(e,t){const n=t.length;if(0===n)this.#l(e);else if(1===n)this.#s(e,t[0]);else if(n>1){const n=[...t];this.#s(e,n.shift());const r=e.nextSibling,i=e.parentNode||document;for(let e=0;n.length>e;e++){const t=n[e];(this.#n.beforeNodeAdded?.(i,t,r)??1)&&(i.insertBefore(t,r),this.#n.afterNodeAdded?.(t))}}}#s(e,t){e!==t&&(e.isEqualNode(t)||(1===e.nodeType&&1===t.nodeType?e.localName===t.localName?this.#c(e,t):this.#u(e,t):this.#p(e,t)))}#c(e,t){(this.#n.beforeNodeVisited?.(e,t)??1)&&((e.hasAttributes()||t.hasAttributes())&&this.#m(e,t),"textarea"===e.localName&&"textarea"===t.localName?this.#d(e,t):(e.hasChildNodes()||t.hasChildNodes())&&this.visitChildNodes(e,t),this.#n.afterNodeVisited?.(e,t))}#u(e,t){(this.#n.beforeNodeVisited?.(e,t)??1)&&(this.#f(e,t),this.#n.afterNodeVisited?.(e,t))}#p(e,t){(this.#n.beforeNodeVisited?.(e,t)??1)&&(e.nodeType===t.nodeType&&null!==e.nodeValue&&null!==t.nodeValue?e.nodeValue=t.nodeValue:this.#f(e,t),this.#n.afterNodeVisited?.(e,t))}#m(e,t){e.hasAttribute("morphlex-dirty")&&e.removeAttribute("morphlex-dirty");for(const{name:n,value:r}of t.attributes){"value"===n&&So(e)&&e.value!==r&&(this.#n.preserveChanges&&e.value!==e.defaultValue||(e.value=r)),"selected"===n&&To(e)&&!e.selected&&(this.#n.preserveChanges&&e.selected!==e.defaultSelected||(e.selected=1)),"checked"===n&&So(e)&&!e.checked&&(this.#n.preserveChanges&&e.checked!==e.defaultChecked||(e.checked=1));const t=e.getAttribute(n);t!==r&&(this.#n.beforeAttributeUpdated?.(e,n,r)??1)&&(e.setAttribute(n,r),this.#n.afterAttributeUpdated?.(e,n,t))}for(const{name:n,value:r}of e.attributes)t.hasAttribute(n)||("selected"===n&&To(e)&&e.selected&&(this.#n.preserveChanges&&e.selected!==e.defaultSelected||(e.selected=0)),"checked"===n&&So(e)&&e.checked&&(this.#n.preserveChanges&&e.checked!==e.defaultChecked||(e.checked=0)),(this.#n.beforeAttributeUpdated?.(e,n,null)??1)&&(e.removeAttribute(n),this.#n.afterAttributeUpdated?.(e,n,r)))}#d(e,t){const n=t.textContent||"",r=e.value!==e.defaultValue;e.textContent!==n&&(e.textContent=n),this.#n.preserveChanges&&r||(e.value=e.defaultValue)}visitChildNodes(e,t){if(!(this.#n.beforeChildrenVisited?.(e)??1))return;const n=e,r=[...e.childNodes],i=[...t.childNodes];yo.clear(),ho.clear(),vo.clear(),go.clear(),bo.clear(),wo.clear();const a=[],o=[],s=[],l=[],c=[],u=[];for(let e=0;r.length>e;e++){const t=r[e],n=t.nodeType;l[e]=n,1===n?(u[e]=t.localName,""!==t.id?vo.add(e):ho.add(e)):3===n&&""===t.textContent?.trim()?wo.add(e):yo.add(e)}for(let e=0;i.length>e;e++){const t=i[e],n=t.nodeType;if(s[e]=n,1===n)c[e]=t.localName,bo.add(e);else{if(3===n&&""===t.textContent?.trim())continue;go.add(e)}}for(const e of bo){const t=c[e],n=i[e];for(const i of ho)if(t===u[i]&&r[i].isEqualNode(n)){a[e]=i,o[e]=0,ho.delete(i),bo.delete(e);break}}for(const e of bo){const t=i[e],n=t.id,s=this.#e.get(t);if(""!==n||s)e:for(const t of vo){const i=r[t];if(c[e]===u[t]){if(""!==n&&n===i.id){a[e]=t,o[e]=1,vo.delete(t),bo.delete(e);break e}if(s){const n=this.#t.get(i);if(n)for(let r=0;s.length>r;r++)if(n.has(s[r])){a[e]=t,o[e]=1,vo.delete(t),bo.delete(e);break e}}}}}for(const e of bo){const t=i[e],n=t.getAttribute("name"),s=t.getAttribute("href"),l=t.getAttribute("src");for(const t of ho){const i=r[t];if(c[e]===u[t]&&(n&&n===i.getAttribute("name")||s&&s===i.getAttribute("href")||l&&l===i.getAttribute("src"))){a[e]=t,o[e]=1,ho.delete(t),bo.delete(e);break}}}for(const e of bo){const t=i[e],n=c[e];for(const i of ho)if(n===u[i]){if("input"===n&&r[i].type!==t.type)continue;a[e]=i,o[e]=1,ho.delete(i),bo.delete(e);break}}for(const e of go){const t=i[e];for(const n of yo)if(r[n].isEqualNode(t)){a[e]=n,o[e]=0,yo.delete(n),go.delete(e);break}}for(const e of go){const t=s[e];for(const n of yo)if(t===l[n]){a[e]=n,o[e]=2,yo.delete(n),go.delete(e);break}}for(const e of yo)this.#l(r[e]);for(const e of wo)this.#l(r[e]);for(const e of ho)this.#l(r[e]);for(const e of vo)this.#l(r[e]);const p=function(e){const t=e.length;if(0===t)return[];const n=[],r=[],i=Array(t);for(let a=0;t>a;a++){const t=e[a];if(void 0===t)continue;let o=0,s=n.length;for(;s>o;){const e=Math.floor((o+s)/2);t>n[e]?o=e+1:s=e}i[a]=o>0?r[o-1]:-1,o===n.length?(n.push(t),r.push(a)):(n[o]=t,r[o]=a)}const a=[];if(0===r.length)return a;let o=r[r.length-1];for(;void 0!==o&&-1!==o;)a.unshift(o),o=i[o];return a}(a),m=Array(r.length);for(let e=0;p.length>e;e++)m[a[p[e]]]=1;let d=n.firstChild;for(let e=0;i.length>e;e++){const t=i[e],s=a[e];if(void 0!==s){const i=r[s],a=o[e];m[s]||xo(n,i,d),0===a||(1===a?this.#c(i,t):this.#s(i,t)),d=i.nextSibling}else(this.#n.beforeNodeAdded?.(n,t,d)??1)&&(n.insertBefore(t,d),this.#n.afterNodeAdded?.(t),d=t.nextSibling)}this.#n.afterChildrenVisited?.(e)}#f(e,t){const n=e.parentNode||document,r=e;(this.#n.beforeNodeRemoved?.(e)??1)&&(this.#n.beforeNodeAdded?.(n,t,r)??1)&&(n.insertBefore(t,r),this.#n.afterNodeAdded?.(t),e.remove(),this.#n.afterNodeRemoved?.(e))}#l(e){(this.#n.beforeNodeRemoved?.(e)??1)&&(e.remove(),this.#n.afterNodeRemoved?.(e))}#i(e){for(const t of e)jo(t)&&this.#o(t)}#o(e){const t=this.#e;for(const n of e.querySelectorAll("[id]")){const r=n.id;if(""===r)continue;let i=n;for(;i;){const n=t.get(i);if(n?n.push(r):t.set(i,[r]),i===e)break;i=i.parentElement}}}#r(e){const t=this.#t;for(const n of e.querySelectorAll("[id]")){const r=n.id;if(""===r)continue;let i=n;for(;i;){const n=t.get(i);if(n?n.add(r):t.set(i,new Set([r])),i===e)break;i=i.parentElement}}}}function So(e){return"input"===e.localName}function To(e){return"option"===e.localName}function jo(e){return!!fo[e.nodeType]}function Ao(e){return{preserveChanges:e?.preserveChanges??1}}const Lo={morph(e,t,n){!function(e,t,n={}){"string"==typeof t&&(t=zo(t).childNodes),!n.preserveChanges&&jo(e)&&ko(e),new Eo(n).morph(e,t)}(e,t,Ao(n))},morphInner(e,t,n){let r;if("string"==typeof t){const n=document.createElement(e.tagName);n.innerHTML=t,r=n}else r=t;!function(e,t,n={}){if("string"==typeof t){const e=zo(t);if(!e.firstChild||1!==e.childNodes.length||1!==e.firstChild.nodeType)throw Error("[Morphlex] The string was not a valid HTML element.");t=e.firstChild}if(1!==e.nodeType||1!==t.nodeType||e.localName!==t.localName)throw Error("[Morphlex] You can only do an inner morph with matching elements.");jo(e)&&ko(e),new Eo(n).visitChildNodes(e,t)}(e,r,Ao(n))}};function Oo(){if("undefined"!=typeof document)return document.startViewTransition}function Co(){return"function"==typeof Oo()}const No=[];let Po=0;async function Ro(e){const t=Oo();if(!t)return void await e();const n=t(async()=>{await e()});await n.finished}function $o(e){return new Promise((t,n)=>{No.push({callback:e,resolve:t,reject:n}),async function(){if(!Po){Po=1;try{for(;No.length>0;){const e=No.shift();try{await Ro(e.callback),e.resolve()}catch(t){e.reject(t)}}}finally{Po=0}}}().catch(n)})}const Io={into:"innerHTML",over:"outerHTML",innerhtml:"innerHTML",outerhtml:"outerHTML",beforebegin:"beforeBegin",afterbegin:"afterBegin",beforeend:"beforeEnd",afterend:"afterEnd",delete:"delete",none:"none",morph:"morph",innermorph:"morph",outermorph:"morphOuter"};function Mo(e,t,n,r){const i=null===t||Wi(t)?"":t,a=Wi(t)?t:null;switch(n){case"morph":if(null!==t)try{Lo.morphInner(e,a||i,r)}catch(t){console.warn("[HyperFixi] Morph failed, falling back to innerHTML:",t),a?(e.innerHTML="",e.appendChild(a)):e.innerHTML=i}break;case"morphOuter":if(null!==t)try{Lo.morph(e,a||i,r)}catch(t){console.warn("[HyperFixi] Morph failed, falling back to outerHTML:",t),a?e.replaceWith(a):e.outerHTML=i}break;case"innerHTML":a?(e.innerHTML="",e.appendChild(a)):e.innerHTML=i;break;case"outerHTML":a?e.replaceWith(a):e.outerHTML=i;break;case"beforeBegin":a?e.parentElement?.insertBefore(a,e):e.insertAdjacentHTML("beforebegin",i);break;case"afterBegin":a?e.insertBefore(a,e.firstChild):e.insertAdjacentHTML("afterbegin",i);break;case"beforeEnd":a?e.appendChild(a):e.insertAdjacentHTML("beforeend",i);break;case"afterEnd":a?e.parentElement?.insertBefore(a,e.nextSibling):e.insertAdjacentHTML("afterend",i);break;case"delete":e.remove();break;case"none":break;default:throw Error(`[HyperFixi] swap: unknown strategy "${n}"`)}}async function qo(e,t,n,r={}){const{morphOptions:i,useViewTransition:a=0}=r,o=()=>{for(const r of e)Mo(r,t,n,i)};a&&Co()?await $o(o):o()}function _o(e){if(null==e)return null;if(Wi(e))return e;if(function(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&11===e.nodeType&&"childNodes"in e}(e)){const t=e,n=document.createElement("div");return n.appendChild(t.cloneNode(1)),n.innerHTML}return e+""}async function Do(e,t){const n=Zi(e||void 0,t);if(0===n.length)throw Error("[HyperFixi] swap: no elements found"+(e?` matching "${e}"`:""));return n}let Vo=(()=>{let e,t,n=[Ui({description:"Swap content into target elements with intelligent morphing support",syntax:["swap <target> with <content>","swap [strategy] of <target> with <content>","swap into <target> with <content>","swap over <target> with <content>","swap delete <target>","swap <target> with <content> using view transition"],examples:["swap #target with it","swap innerHTML of #target with it","swap over #modal with fetchedContent","swap delete #notification"],sideEffects:["dom-mutation"]}),Bi({name:"swap",category:"dom"})],r=[];return t=class{async parseInput(e,t,n){const r=e.args;if(!r||0===r.length)throw Error("[HyperFixi] swap: command requires arguments");const i=r.map(e=>{if(!e||"object"!=typeof e)return null;const t=e,n=t.type;return"literal"===n&&"string"==typeof t.value?t.value.toLowerCase():"identifier"===n&&"string"==typeof t.name?t.name.toLowerCase():null}),a=i.findIndex(e=>"with"===e),o=i.findIndex(e=>"of"===e),s=i.findIndex(e=>"delete"===e),l=i.findIndex(e=>"using"===e);if(3===r.length&&1===a&&-1===o&&-1===s&&-1===l){const e=r[0],t=r[2],n="identifier"===e?.type&&"string"==typeof e.name,i="identifier"===t?.type&&"string"==typeof t.name,a=new Set(["me","you","it","result","window","document"]);if(n&&i&&!a.has(e.name.toLowerCase())&&!a.has(t.name.toLowerCase())&&!Io[e.name.toLowerCase()])return{variant:"variable",leftName:e.name,rightName:t.name}}let c=0;if(-1!==l){const e=i.slice(l+1);e.includes("view")&&e.includes("transition")&&(c=1)}let u="morph",p=null,m=null;if(-1!==s)u="delete",p=r[s+1],m=null;else if(-1!==o&&-1!==a){const e=i[0];e&&Io[e]&&(u=Io[e]),p=r[o+1],m=r[a+1]}else if(-1!==a){const e=i.slice(0,a),t=e.findIndex(e=>"into"===e),n=e.findIndex(e=>"over"===e);if(-1!==t)u="innerHTML",p=r[t+1];else if(-1!==n)u="outerHTML",p=r[n+1];else{const e=i[0];e&&Io[e]?(u=Io[e],p=r[1]||r[a-1]):p=r[a-1]}m=r[a+1]}else{if(2>r.length)throw Error('[HyperFixi] swap: could not parse arguments. Expected "swap <target> with <content>"');{const e=i[0];e&&Io[e]&&(u=Io[e]),p=r[r.length-2],m=r[r.length-1]}}let d=null,f=null;if(p){const e=p.type,r=p.value;if("selector"===e&&"string"==typeof r)d=r;else if("binaryExpression"===e&&"of"===p.operator){const e=p.left,r=p.right;if(e&&"identifier"===e.type&&"string"==typeof e.name){const t=e.name.toLowerCase();Io[t]&&(u=Io[t])}r&&"selector"===r.type&&"string"==typeof r.value?d=r.value:r&&(d=await t.evaluate(r,n))}else d=await t.evaluate(p,n)}m&&(f=await t.evaluate(m,n));let y=null;if("string"==typeof d)y=d;else if(Wi(d))return{targets:[d],content:_o(f),strategy:u,morphOptions:{preserveChanges:1},useViewTransition:c};return{targets:await Do(y,n),content:_o(f),strategy:u,morphOptions:{preserveChanges:1},useViewTransition:c}}async execute(e,t){if("variable"===e.variant){const{leftName:n,rightName:r}=e,i=e=>t.locals?.has(e)?t.locals.get(e):t.globals?.has(e)?t.globals.get(e):void 0,a=(e,n)=>{t.locals?.has(e)?t.locals.set(e,n):t.globals?.has(e)?t.globals.set(e,n):t.locals&&t.locals.set(e,n)},o=i(n);return a(n,i(r)),void a(r,o)}const{targets:n,content:r,strategy:i,morphOptions:a,useViewTransition:o}=e;if(!n||!i)throw Error("[HyperFixi] swap: DOM swap requires targets and strategy");await qo(n,r??null,i,{morphOptions:a,useViewTransition:o})}},Di(t,"SwapCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})(),Ho=(()=>{let e,t,n=[Ui({description:"Morph content into target elements (intelligent diffing, preserves state)",syntax:["morph <target> with <content>","morph over <target> with <content>"],examples:["morph #target with it","morph over #modal with fetchedContent"],sideEffects:["dom-mutation"]}),Bi({name:"morph",category:"dom"})],r=[];return t=class{async parseInput(e,t,n){const r=e.args;if(!r||0===r.length)throw Error("[HyperFixi] morph: command requires arguments");const i=r.map(e=>"identifier"===e.type&&"string"==typeof e.name?e.name.toLowerCase():null),a=i.findIndex(e=>"with"===e),o=i.findIndex(e=>"over"===e),s=i.findIndex(e=>"using"===e);let l=0;if(-1!==s){const e=i.slice(s+1);e.includes("view")&&e.includes("transition")&&(l=1)}let c="morph",u=null,p=null;if(-1!==o&&(-1===a?1/0:a)>o?(c="morphOuter",u=r[o+1],-1!==a&&(p=r[a+1])):-1!==a?(u=r[a-1],p=r[a+1]):2>r.length||(u=r[0],p=r[1]),!u)throw Error("[HyperFixi] morph: could not determine target");let m=null;m="selector"===u.type&&"string"==typeof u.value?u.value:await t.evaluate(u,n);let d,f=null;if(p&&(f=await t.evaluate(p,n)),!m)throw Error("[HyperFixi] morph: could not determine target");if("string"==typeof m)d=await Do(m,n);else{if(!Wi(m))throw Error("[HyperFixi] morph: target must be a selector or element");d=[m]}return{targets:d,content:_o(f),strategy:c,morphOptions:{preserveChanges:1},useViewTransition:l}}async execute(e,t){const{targets:n,content:r,strategy:i,morphOptions:a,useViewTransition:o}=e;if(!n||!i)throw Error("[HyperFixi] morph: requires targets and strategy");await qo(n,r??null,i,{morphOptions:a,useViewTransition:o})}},Di(t,"MorphCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})();const Fo=Gi(Vo),Bo=Gi(Ho);Fo(),Bo();const Uo={html:{category:"document-root",message:"The <html> element is the document root and cannot be part of a partial",suggestion:"Remove the <html> element. Return only the content that should replace the target."},body:{category:"document-root",message:"The <body> element is the document body and cannot be part of a partial",suggestion:"Remove the <body> element. Return only the content for the target."},head:{category:"document-root",message:"The <head> element contains document metadata and cannot be part of a partial",suggestion:"Remove the <head> element. Styles/scripts should be loaded separately."}},Go={header:{category:"semantic-landmark",message:"The <header> element is a semantic landmark. Swapping may create duplicate landmarks.",suggestion:"Consider if <header> is appropriate in this partial, or if the page already has this landmark."},footer:{category:"semantic-landmark",message:"The <footer> element is a semantic landmark. Swapping may create duplicate landmarks.",suggestion:"Consider if <footer> is appropriate in this partial, or if the page already has this landmark."},main:{category:"semantic-landmark",message:"The <main> element should be unique per page. Swapping may create duplicates.",suggestion:"Consider if <main> is appropriate. Pages should have exactly one <main> element."},nav:{category:"semantic-landmark",message:"The <nav> element is a semantic landmark. Consider if navigation should be in a partial.",suggestion:"Consider if <nav> is appropriate in this partial, or if navigation should be static."},aside:{category:"semantic-landmark",message:"The <aside> element is a semantic landmark. Swapping may affect accessibility.",suggestion:"Consider if <aside> is appropriate in this partial."}},Wo={title:{category:"metadata",message:"The <title> element should only appear in <head>. This may be ignored by browsers.",suggestion:"Move <title> to the document <head> or remove from partial."},meta:{category:"metadata",message:"The <meta> element should only appear in <head>. This may be ignored by browsers.",suggestion:"Move <meta> to the document <head> or remove from partial."},link:{category:"metadata",message:"The <link> element for stylesheets should typically be in <head>.",suggestion:"Consider if <link> should be in document <head> for proper loading order."},base:{category:"metadata",message:"The <base> element should only appear once in <head>.",suggestion:"Remove <base> from partial. It must be in document <head>."}};let Ko={enabled:"undefined"!=typeof window&&window.__HYPERFIXI_PROD__||"undefined"!=typeof process&&"production"===process.env?.NODE_ENV?0:1,showWarnings:1,strictness:"standard",additionalCriticalElements:[],additionalStructuralElements:[],ignoredElements:[],ignoredTargets:[],targetOverrides:[]};function Jo(e,t){if("*"===t)return 1;if(t.includes("*")){const n=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return RegExp("^"+n+"$").test(e)}return e===t}function Zo(e,t=""){const n=function(e){const t={...Ko};if(Ko.targetOverrides)for(const n of Ko.targetOverrides)if(Jo(e,n.target))return{...t,...n.config};return t}(t);if(!n.enabled)return{valid:1,issues:[],bySeverity:{critical:[],structural:[],warning:[]},totalIssues:0,shouldProceed:1};if(n.ignoredTargets?.some(e=>Jo(t,e)))return{valid:1,issues:[],bySeverity:{critical:[],structural:[],warning:[]},totalIssues:0,shouldProceed:1};const r=[];if(e.match(/<!DOCTYPE[^>]*>/i)&&!n.ignoredElements?.includes("doctype")&&r.push({severity:"critical",category:"document-root",element:"DOCTYPE",message:"DOCTYPE declarations cannot be part of a partial",suggestion:"Remove DOCTYPE declaration. Partials should only contain content fragments.",targetSelector:t,count:1}),"undefined"==typeof document)return function(e,t,n){const r=[];for(const[i,a]of Object.entries(Uo)){if(n.ignoredElements?.includes(i))continue;const o=RegExp(`<${i}[\\s>]`,"gi"),s=e.match(o),l=s?.length||0;l>0&&r.push({severity:"critical",category:a.category,element:i,message:a.message,suggestion:a.suggestion||`Remove the <${i}> element from the partial.`,targetSelector:t,count:l})}if("relaxed"!==n.strictness)for(const[i,a]of Object.entries(Go)){if(n.ignoredElements?.includes(i))continue;const o=RegExp(`<${i}[\\s>]`,"gi"),s=e.match(o),l=s?.length||0;l>0&&r.push({severity:"strict"===n.strictness?"critical":"structural",category:a.category,element:i,message:a.message,suggestion:a.suggestion||`Consider if <${i}> is appropriate in this partial.`,targetSelector:t,count:l})}return Yo(r)}(e,t,n);for(const[i,a]of Object.entries(Uo)){if(n.ignoredElements?.includes(i))continue;const o=RegExp(`<${i}[\\s>]`,"gi"),s=e.match(o),l=s?.length||0;l>0&&r.push({severity:"critical",category:a.category,element:i,message:a.message,suggestion:a.suggestion||`Remove the <${i}> element from the partial.`,targetSelector:t,count:l})}const i=document.createElement("div");if(i.innerHTML=e,"relaxed"!==n.strictness)for(const[e,a]of Object.entries(Go)){if(n.ignoredElements?.includes(e))continue;const o=i.querySelectorAll(e).length;o>0&&r.push({severity:"strict"===n.strictness?"critical":"structural",category:a.category,element:e,message:a.message,suggestion:a.suggestion||`Consider if <${e}> is appropriate in this partial.`,targetSelector:t,count:o})}if("strict"===n.strictness)for(const[e,a]of Object.entries(Wo)){if(n.ignoredElements?.includes(e))continue;const o=i.querySelectorAll(e).length;o>0&&r.push({severity:"warning",category:a.category,element:e,message:a.message,suggestion:a.suggestion||`Move <${e}> to document <head> or remove from partial.`,targetSelector:t,count:o})}if(n.additionalCriticalElements)for(const e of n.additionalCriticalElements){if(n.ignoredElements?.includes(e))continue;const a=i.querySelectorAll(e).length;a>0&&r.push({severity:"critical",category:"document-root",element:e,message:`The <${e}> element is configured as a critical layout element.`,suggestion:`Remove <${e}> from the partial content.`,targetSelector:t,count:a})}if(n.additionalStructuralElements)for(const e of n.additionalStructuralElements){if(n.ignoredElements?.includes(e))continue;const a=i.querySelectorAll(e).length;a>0&&r.push({severity:"structural",category:"semantic-landmark",element:e,message:`The <${e}> element is configured as a structural element.`,suggestion:`Consider if <${e}> is appropriate in this partial.`,targetSelector:t,count:a})}if(n.customValidator){const i=n.customValidator(e,t);r.push(...i)}return Yo(r)}function Yo(e){const t={critical:e.filter(e=>"critical"===e.severity),structural:e.filter(e=>"structural"===e.severity),warning:e.filter(e=>"warning"===e.severity)};return{valid:0===t.critical.length,issues:e,bySeverity:t,totalIssues:e.length,shouldProceed:1}}const Xo="color: #dc2626; font-weight: bold;",Qo="color: #ea580c; font-weight: bold;",es="color: #ca8a04; font-weight: bold;",ts="color: inherit;",ns={critical:"🚨",structural:"⚠️",warning:"💡"},rs={critical:"CRITICAL",structural:"STRUCTURAL",warning:"WARNING"};function is(e){0!==e.totalIssues&&("undefined"!=typeof window&&void 0!==console?function(e){if(console.groupCollapsed(`%c[HyperFixi] Partial Template Validation: ${e.totalIssues} issue(s) found`,"font-weight: bold; font-size: 13px; color: #6366f1;"),function(e){const t=[],n=[];e.bySeverity.critical.length>0&&(t.push(`%c${e.bySeverity.critical.length} critical%c`),n.push(Xo,ts)),e.bySeverity.structural.length>0&&(t.length>0&&t.push(", "),t.push(`%c${e.bySeverity.structural.length} structural%c`),n.push(Qo,ts)),e.bySeverity.warning.length>0&&(t.length>0&&t.push(", "),t.push(`%c${e.bySeverity.warning.length} warning(s)%c`),n.push(es,ts)),t.length>0&&console.log("Found: "+t.join(""),...n)}(e),e.bySeverity.critical.length>0){console.group(`%c🚨 Critical Issues (${e.bySeverity.critical.length})`,Xo);for(const t of e.bySeverity.critical)as(t);console.groupEnd()}if(e.bySeverity.structural.length>0){console.group(`%c⚠️ Structural Issues (${e.bySeverity.structural.length})`,Qo);for(const t of e.bySeverity.structural)as(t);console.groupEnd()}if(e.bySeverity.warning.length>0){console.group(`%c💡 Warnings (${e.bySeverity.warning.length})`,es);for(const t of e.bySeverity.warning)as(t);console.groupEnd()}console.groupEnd()}(e):function(e){console.warn(`[HyperFixi] Partial Template Validation: ${e.totalIssues} issue(s) found`);const t=[];e.bySeverity.critical.length>0&&t.push(e.bySeverity.critical.length+" critical"),e.bySeverity.structural.length>0&&t.push(e.bySeverity.structural.length+" structural"),e.bySeverity.warning.length>0&&t.push(e.bySeverity.warning.length+" warning(s)"),console.warn(" Found: "+t.join(", "));for(const t of e.issues)console.warn(` ${ns[t.severity]} [${rs[t.severity]}] <${t.element}>${t.count>1?` (${t.count}x)`:""}${t.targetSelector?` [target: ${t.targetSelector}]`:""}`),console.warn(" "+t.message),console.warn(" Fix: "+t.suggestion)}(e))}function as(e){console.log(` %c<${e.element}>${e.count>1?` %c(${e.count} instances)%c`:""}: %c${e.message}`,"color: #7c3aed; font-weight: bold;",...e.count>1?["color: #6b7280;",ts]:[],ts),console.log(" %c💡 "+e.suggestion,"color: #16a34a; font-style: italic;"),e.targetSelector&&console.log(" %cTarget: %c"+e.targetSelector,ts,"color: #0891b2;")}function os(e){return`${ns[e.severity]} [${rs[e.severity]}] <${e.element}>${e.count>1?` (${e.count}x)`:""}${e.targetSelector?` [target: ${e.targetSelector}]`:""}: ${e.message}`}function ss(e){return e.issues.map(os)}function ls(e,t,n={}){return new CustomEvent(e,{detail:void 0!==t?t:{},bubbles:void 0!==n.bubbles?n.bubbles:1,cancelable:void 0!==n.cancelable?n.cancelable:1,composed:void 0!==n.composed?n.composed:0})}function cs(e){const t=e.trim();return/^\d+$/.test(t)?parseInt(t,10):/^\d*\.\d+$/.test(t)?parseFloat(t):"true"===t?1:"false"===t?0:"null"===t?null:"undefined"!==t?t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t:void 0}function us(e,t,n={},r={}){const i=ls(t,n,r);return e.dispatchEvent(i),i}function ps(e,t,n={},r={}){return{lokascript:us(e,"lokascript:"+t,n,r),hyperfixi:us(e,"hyperfixi:"+t,n,r)}}const ms={morph:"morph",morphouter:"morphOuter",innerhtml:"innerHTML",outerhtml:"outerHTML",beforebegin:"beforeBegin",afterbegin:"afterBegin",beforeend:"beforeEnd",afterend:"afterEnd",delete:"delete",none:"none"};function ds(e,t){const{target:n,strategy:r,content:i}=e,a=document.querySelector(n);if(!a||!Wi(a))return{success:0,error:`Target "${n}" not found`};try{switch(r){case"morph":Lo.morphInner(a,i,t);break;case"morphOuter":Lo.morph(a,i,t);break;case"innerHTML":a.innerHTML=i;break;case"outerHTML":a.outerHTML=i;break;case"beforeBegin":a.insertAdjacentHTML("beforebegin",i);break;case"afterBegin":a.insertAdjacentHTML("afterbegin",i);break;case"beforeEnd":a.insertAdjacentHTML("beforeend",i);break;case"afterEnd":a.insertAdjacentHTML("afterend",i);break;case"delete":a.remove();break;case"none":break;default:return{success:0,error:`Unknown strategy "${r}"`}}return{success:1}}catch(e){return{success:0,error:e+""}}}const fs=Gi((()=>{let e,t,n=[Ui({description:"Process <hx-partial> elements for multi-target swaps",syntax:["process partials in <content>","process partials in <content> using view transition"],examples:["process partials in it","process partials in fetchedHtml","process partials in it using view transition"],sideEffects:["dom-mutation"]}),Bi({name:"process",category:"dom"})],r=[];return t=class{async parseInput(e,t,n){const r=e.args;if(!r||0===r.length)throw Error("process partials command requires content argument");const i=[],a=[];for(const e of r){const r=await t.evaluate(e,n);i.push(r),"string"==typeof r&&a.push(r.toLowerCase())}const o=a.findIndex(e=>"partials"===e);if(-1===o)throw Error('process command expects "partials" keyword: process partials in <content>');const s=a.findIndex(e=>"in"===e);if(-1===s||o>=s)throw Error('process partials command expects "in" keyword: process partials in <content>');const l=i[s+1];let c;if("string"==typeof l)c=l;else if(Wi(l))c=l.outerHTML;else{if(!l||"function"!=typeof l.text)throw Error("process partials: content must be an HTML string or element");c=await l.text()}const u=a.findIndex(e=>"using"===e);let p=0;if(-1!==u){const e=a.slice(u+1).join(" ");e.includes("view")&&e.includes("transition")&&(p=1)}return{html:c,useViewTransition:p,morphOptions:{preserveChanges:1}}}async execute(e,t){const{html:n,useViewTransition:r,morphOptions:i}=e,a=()=>function(e,t){const n=function(e){const t=[],n=document.createElement("div");n.innerHTML=e;const r=n.querySelectorAll("hx-partial");for(const e of r){const n=e.getAttribute("target");if(!n){Ye.command("process partials: hx-partial element missing target attribute, skipping");continue}const r=e.getAttribute("strategy")?.toLowerCase()||"morph";t.push({target:n,strategy:ms[r]||"morph",content:e.innerHTML})}return t}(e),r={...Ko},i={count:0,targets:[],errors:[],validationWarnings:[],validationDetails:{}};for(const e of n){if(r.enabled){const t=Zo(e.content,e.target);t.totalIssues>0&&(r.showWarnings&&is(t),i.validationWarnings.push(...ss(t)),i.validationDetails[e.target]=t)}const n=ds(e,t);n.success?(i.count++,i.targets.push(e.target)):n.error&&i.errors.push(`${e.target}: ${n.error}`)}return i}(n,i);let o;return r&&Co()?await $o(()=>{o=a()}):o=a(),t.it=o,ps(window,"partials",o),o}},Di(t,"ProcessPartialsCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})());function ys(e,t,n,r){return e?new Promise(n=>{const i=()=>{a({event:null,timedOut:0,cancelled:1})},a=vs(()=>{e.removeEventListener(t,o),r&&r.removeEventListener("abort",i)},n),o=e=>{a({event:e,timedOut:0,cancelled:0})};r?.aborted?n({event:null,timedOut:0,cancelled:1}):(e.addEventListener(t,o),r&&r.addEventListener("abort",i))}):Promise.reject(Error("waitForEvent: no target provided"))}function hs(e){return new Promise(t=>setTimeout(t,e))}function vs(e,t){let n=0;return r=>{n||(n=1,e(),t(r))}}fs();const gs=Gi((()=>{let e,t,n=[Ui({description:"Wait for time delay, event, or race condition",syntax:["wait <time>","wait for <event>","wait for <event> or <condition>"],examples:["wait 2s","wait for click","wait for click or 1s","wait for mousemove(clientX, clientY)"],sideEffects:["time","event-listening"]}),Bi({name:"wait",category:"async"})],r=[];return t=class{async parseInput(e,t,n){if(!e.args?.length)throw Error("wait command requires an argument");if(e.modifiers.or)return this.parseRaceCondition(e,t,n);if(e.modifiers.for)return this.parseEventWait(e.modifiers.for,e.modifiers.from,t,n);const r=e.args[0];return"arrayLiteral"===r.type&&r.elements?this.parseEventArrayWait(r.elements,e.args[1],t,n):this.parseTimeWait(e.args[0],t,n)}async execute(e,t){const n=Date.now();if("time"===e.type)return await hs(e.milliseconds),{type:"time",result:e.milliseconds,duration:Date.now()-n};if("event"===e.type){const r=e.target??t.me??document,i=(await ys(r,e.eventName)).event;if(Object.assign(t,{it:i}),e.destructure)for(const n of e.destructure)n in i&&t.locals.set(n,i[n]);return{type:"event",result:i,duration:Date.now()-n}}const{result:r,winningCondition:i}=await this.executeRace(e.conditions,t);if(Object.assign(t,{it:r}),r instanceof Event&&"event"===i?.type&&i.destructure)for(const e of i.destructure)e in r&&t.locals.set(e,r[e]);return{type:r instanceof Event?"event":"time",result:r,duration:Date.now()-n}}async parseTimeWait(e,t,n){return{type:"time",milliseconds:La(await t.evaluate(e,n))}}async parseEventWait(e,t,n,r){const i=await n.evaluate(e,r);if("string"!=typeof i)throw Error("wait for: event name must be a string");const a=i.match(/^(\w+)\(([^)]+)\)$/),o=a?a[1]:i,s=a?a[2].split(",").map(e=>e.trim()):void 0;let l;if(t){const e=await n.evaluate(t,r);if(!e||"object"!=typeof e||!("addEventListener"in e))throw Error("wait for from: target must be an EventTarget");l=e}else l=r.me??void 0;return{type:"event",eventName:o,target:l,destructure:s}}async parseEventArrayWait(e,t,n,r){const i=[];for(const t of e){const e=t;if("objectLiteral"===e.type&&e.properties){let t="",n=[];for(const r of e.properties){const e=r.key?.name||r.key?.value;"name"===e&&r.value?t=r.value.value||"":"args"===e&&r.value?.elements&&(n=r.value.elements.map(e=>e.value||e.name||""))}t&&i.push({name:t,params:n})}}let a;if(t){const e=await n.evaluate(t,r);e&&"object"==typeof e&&"addEventListener"in e&&(a=e)}return a||(a=r.me??void 0),1===i.length?{type:"event",eventName:i[0].name,target:a,destructure:i[0].params.length>0?i[0].params:void 0}:{type:"race",conditions:i.map(e=>({type:"event",eventName:e.name,target:a,destructure:e.params.length>0?e.params:void 0}))}}async parseRaceCondition(e,t,n){const r=[];e.modifiers.for?r.push(await this.parseEventWait(e.modifiers.for,e.modifiers.from,t,n)):e.args[0]&&r.push(await this.parseTimeWait(e.args[0],t,n));const i=await t.evaluate(e.modifiers.or,n),a=Array.isArray(i)?i:[i];for(const e of a)try{r.push({type:"time",milliseconds:La(e)})}catch{if("string"==typeof e){const t=e.match(/^(\w+)\(([^)]+)\)$/);r.push(t?{type:"event",eventName:t[1],target:n.me??void 0,destructure:t[2].split(",").map(e=>e.trim())}:{type:"event",eventName:e,target:n.me??void 0})}}if(2>r.length)throw Error("wait: race requires at least 2 conditions");return{type:"race",conditions:r}}async executeRace(e,t){const n=new AbortController,r=n.signal,i=e.map(e=>"time"===e.type?hs(e.milliseconds).then(()=>({result:e.milliseconds,winningCondition:e})):ys(e.target??t.me??document,e.eventName,0,r).then(t=>({result:t.event,winningCondition:e})));try{return await Promise.race(i)}finally{n.abort()}}},Di(t,"WaitCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),bs=new Map;let ws=[/^4\d{2}$/,/^5\d{2}$/],ks=(()=>{let e,t,n=[Ui({description:"Make HTTP requests with lifecycle event support",syntax:["fetch <url>","fetch <url> as <type>","fetch <url> with <options>"],examples:['fetch "/api/data"','fetch "/api/users" as json','fetch "/api/save" with { method:"POST" }'],sideEffects:["network","event-dispatching"]}),Bi({name:"fetch",category:"async"})],r=[];return t=class{async parseInput(e,t,n){if(!e.args?.length)throw Error("fetch requires a URL");const r=await this.parseURL(e.args[0],t,n),i=this.parseResponseType(e.modifiers.as);return{url:r,responseType:i,options:await this.parseRequestOptions(e.modifiers.with,t,n),throwOnError:!e.modifiers.doNotThrow&&"response"!==i}}async execute(e,t){const n=Date.now(),{url:r,responseType:i,options:a}=e,o=new AbortController;let s;t.me&&(s=()=>o.abort(),t.me.addEventListener("fetch:abort",s,{once:1}));const l={...a,signal:o.signal},c=bs.get(i);if(c?.accept){const e=new Headers(l.headers);e.has("Accept")||e.set("Accept",c.accept),l.headers=e}if(t.me){const e={...l,sender:t.me,headers:l.headers||{}};this.dispatchEvent(t.me,"fetch:beforeRequest",e),l.headers=e.headers}let u;a.timeout&&(u=setTimeout(()=>o.abort(),a.timeout));try{let a=await fetch(r,l);if(t.me){const e={response:a};this.dispatchEvent(t.me,"fetch:afterResponse",e),a=e.response}if(e.throwOnError&&function(e){const t=e+"";return ws.some(e=>e.test(t))}(a.status)){const e=Error(`Fetch failed for ${r}: HTTP ${a.status} ${a.statusText}`.trim());throw e.response=a,e.isFetchStatusError=1,e}const o=await this.handleResponse(a,i,t);t.me&&this.dispatchEvent(t.me,"fetch:afterRequest",{result:o});const s={status:a.status,statusText:a.statusText,headers:a.headers,data:o,url:a.url,duration:Date.now()-n};return Object.assign(t,{it:o}),s}catch(e){if(t.me&&this.dispatchEvent(t.me,"fetch:error",{reason:e instanceof Error?e.message:e+"",error:e}),e instanceof Error&&"AbortError"===e.name)throw Error("Fetch aborted for "+r);if(e instanceof Error&&1==e.isFetchStatusError)throw e;throw Error(`Fetch failed for ${r}: ${e instanceof Error?e.message:e+""}`)}finally{u&&clearTimeout(u),t.me&&s&&t.me.removeEventListener("fetch:abort",s)}}async parseURL(e,t,n){const r=await t.evaluate(e,n);if("string"!=typeof r||!r)throw Error("fetch: URL must be a non-empty string");return r}parseResponseType(e){if(!e)return"text";if(("identifier"===e.type||"expression"===e.type)&&e.name){const t=e.name.toLowerCase();if("object"===t)return"json";if(["text","json","html","response","blob","arraybuffer"].includes(t))return"arraybuffer"===t?"arrayBuffer":t;if(bs.has(t))return t;throw Error(`fetch: invalid response type "${t}"`)}return"text"}async parseRequestOptions(e,t,n){if(!e)return{};const r=await t.evaluate(e,n);if("object"!=typeof r||null===r)throw Error('fetch: "with" options must be an object');const i={};return"method"in r&&(i.method=(r.method+"").toUpperCase()),"headers"in r&&(i.headers=this.parseHeaders(r.headers)),"body"in r&&(i.body=this.parseBody(r.body)),"credentials"in r&&(i.credentials=r.credentials),"mode"in r&&(i.mode=r.mode),"cache"in r&&(i.cache=r.cache),i}parseHeaders(e){if(e instanceof Headers)return e;const t=new Headers;if("object"==typeof e&&null!==e)for(const[n,r]of Object.entries(e))t.set(n,r+"");return t}parseBody(e){return null==e?null:e instanceof FormData||e instanceof Blob||e instanceof ArrayBuffer||e instanceof URLSearchParams||"string"==typeof e?e:"object"==typeof e?JSON.stringify(e):e+""}async handleResponse(e,t,n){switch(t){case"response":return e;case"json":return e.json();case"html":return this.parseHTML(await e.text());case"blob":return e.blob();case"arrayBuffer":return e.arrayBuffer();case"text":return e.text();default:{const r=bs.get(t);return r?r.handler(e,n):e.text()}}}parseHTML(e){const t=(new DOMParser).parseFromString(e,"text/html"),n=document.createDocumentFragment();return Array.from(t.body.childNodes).forEach(e=>n.appendChild(e.cloneNode(1))),1===n.childNodes.length&&Wi(n.firstChild)?n.firstChild:n}dispatchEvent(e,t,n){e.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:1,cancelable:1}))}},Di(t,"FetchCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})();const zs=Gi(ks),xs=Gi((()=>{let e,t,n=[Ui({description:"Set values to variables, attributes, or properties",syntax:["set <target> to <value>"],examples:['set myVar to "value"','set @data-theme to "dark"','set my innerHTML to "content"'],sideEffects:["state-mutation","dom-mutation"]}),Bi({name:"set",category:"data"})],r=[];return t=class{async parseInput(e,t,n){if(!e.args?.length)throw Error("set command requires a target");const r=e.args[0],i=r?.name||r?.value,a=r?.type;if(a){const i=Q(a);if(i)return{type:"node-write",node:r,value:await this.extractValue(e,t,n),writer:i}}const o=await Ba(r,t,n);if(o){const r=await this.extractValue(e,t,n);if(o.property.startsWith("*")){const e=o.property.substring(1);return{type:"style",element:o.element,property:e,value:r+""}}return{type:"property",element:o.element,property:o.property,value:r}}if("memberExpression"===r?.type||"propertyAccess"===r?.type){const i=await this.tryParseMemberExpression(r,e,t,n);if(i)return i}let s;if(s="identifier"!==r?.type&&"variable"!==r?.type||"string"!=typeof i?await t.evaluate(r,n):i,function(e){if("object"!=typeof e||null===e||Array.isArray(e))return 0;if(Wi(e)||e instanceof Node)return 0;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(s))return{type:"object-literal",properties:s,targets:await this.resolveTargets(e.modifiers.on,t,n)};if(Ha(s)){const r=Fa(s,n);if(r){const i=await this.extractValue(e,t,n);return{type:"property",element:r.element,property:r.property,value:i}}return this.parseTheXofY(s,e,t,n)}if("string"==typeof s&&ya(s)){const r=s.substring(1).trim(),i=await this.extractValue(e,t,n);return{type:"style",element:await this.resolveElement(e.modifiers.on,t,n),property:r,value:i+""}}if("string"==typeof s&&oa(s)){const r=s.substring(1).trim(),i=await this.extractValue(e,t,n);return{type:"attribute",element:await this.resolveElement(e.modifiers.on,t,n),name:r,value:i}}if("string"==typeof s){const r=s.match(/^(my|me|its?|your?)\s+(.+)$/i);if(r){const i=Xi(r[1],n),a=await this.extractValue(e,t,n);return{type:"property",element:i,property:r[2],value:a}}}if(Wi(s))return{type:"property",element:s,property:"textContent",value:await this.extractValue(e,t,n)};if(Array.isArray(s)&&s.length>0&&Wi(s[0])){const r=await this.extractValue(e,t,n);return{type:"property",element:s[0],property:"textContent",value:r}}if("string"!=typeof s)throw Error("set command target must be a string or object literal"+("memberExpression"===r?.type||"propertyAccess"===r?.type?` (a property chain evaluated to ${null===s?"null":typeof s} — check that all intermediate objects exist)`:""));return{type:"variable",name:s,value:await this.extractValue(e,t,n)}}async execute(e,t){switch(e.type){case"variable":return Qa(e.name,e.value,t),"result"!==e.name&&"it"!==e.name||Object.assign(t,{[e.name]:e.value}),Object.assign(t,{it:e.value}),{target:e.name,value:e.value,targetType:"variable"};case"attribute":return e.element.setAttribute(e.name,e.value+""),Object.assign(t,{it:e.value}),{target:"@"+e.name,value:e.value,targetType:"attribute"};case"property":return qa(e.element,e.property,e.value),Object.assign(t,{it:e.value}),{target:e.element,value:e.value,targetType:"property"};case"style":return va(e.element,e.property,e.value),Object.assign(t,{it:e.value}),{target:e.element,value:e.value,targetType:"property"};case"object-literal":for(const t of e.targets)for(const[n,r]of Object.entries(e.properties))qa(t,n,r);return Object.assign(t,{it:e.properties}),{target:e.targets[0]||"unknown",value:e.properties,targetType:"property"};case"member-assignment":return e.container[e.property]=e.value,Object.assign(t,{it:e.value}),{target:e.property,value:e.value,targetType:"property"};case"node-write":return await e.writer(e.node,e.value,t),Object.assign(t,{it:e.value}),{target:e.node.name??"",value:e.value,targetType:"variable"};default:throw Error("Unknown input type: "+e.type)}}async tryParseMemberExpression(e,t,n,r){const i=e.object,a=e.property;if(i?.name&&a?.name){const e=i.name.toLowerCase();if(["me","my","it","its","you","your"].includes(e)){const i=Xi(e,r),o=await this.extractValue(t,n,r);return{type:"property",element:i,property:a.name,value:o}}}const o=e.object,s=e.computed;if(o){const i=await n.evaluate(o,r);if(null!=i&&"object"==typeof i){const o=s?await n.evaluate(e.property,r)+"":a?.name||"";if(o)return{type:"member-assignment",container:i,property:o,value:await this.extractValue(t,n,r)}}}return null}async extractValue(e,t,n){if(e.modifiers.to)return t.evaluate(e.modifiers.to,n);const r=e.args.findIndex(e=>"identifier"===e.type&&"to"===e.name);if(r>=0&&e.args.length>r+1)return t.evaluate(e.args[r+1],n);if(e.args.length>=2)return t.evaluate(e.args[1],n);throw Error('set command requires a value (use "to" keyword)')}async resolveElement(e,t,n){return Ji(e?await t.evaluate(e,n):void 0,n)}async resolveTargets(e,t,n){return Zi(e?await t.evaluate(e,n):void 0,n)}async parseTheXofY(e,t,n,r){const i=e.match(/^the\s+(.+?)\s+of\s+(.+)$/i);if(!i)throw Error('Invalid "the X of Y" syntax');const[,a,o]=i,s=Ji(o,r),l=await this.extractValue(t,n,r);return{type:"property",element:s,property:a.trim(),value:l}}validate(e){if(!e||"object"!=typeof e)return 0;const t=e;if(!t.type||"string"!=typeof t.type)return 0;if(!["variable","attribute","property","style","object-literal"].includes(t.type))return 0;switch(t.type){case"variable":return"string"==typeof t.name&&"value"in t;case"attribute":return"string"==typeof t.name&&Wi(t.element)&&"value"in t;case"property":return"string"==typeof t.property&&Wi(t.element)&&"value"in t;case"style":return"string"==typeof t.property&&""!==t.property&&Wi(t.element)&&"string"==typeof t.value;case"object-literal":return null!==t.properties&&"object"==typeof t.properties&&Array.isArray(t.targets)&&t.targets.length>0;default:return 0}}},Di(t,"SetCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),Es=Gi((()=>{let e,t,n=[Ui({description:"Evaluate an expression and store the result in it",syntax:"get <expression>",examples:["get #my-dialog","get <button/>","get me.parentElement"],sideEffects:["context-mutation"]}),Bi({name:"get",category:"data"})],r=[];return t=class{async parseInput(e,t,n){if(!e.args||0===e.args.length)throw Error("get command requires an expression argument");const r=e.args[0],i=await t.evaluate(r,n);return i instanceof NodeList&&1===i.length||Array.isArray(i)&&1===i.length?{value:i[0]}:{value:i}}execute(e,t){return t.it=e.value,Object.assign(t,{result:e.value}),{value:e.value}}validate(e){return"object"!=typeof e||null===e?0:"value"in e}},Di(t,"GetCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})());let Ss=(()=>{let e,t,n=[Ui({description:"Modify a variable or property by a specified amount (default: 1)",syntax:["increment <target> [by <number>]","decrement <target> [by <number>]"],examples:["increment counter","increment counter by 5","decrement counter","decrement counter by 5"],sideEffects:["data-mutation","context-modification"],aliases:["decrement"]}),Bi({name:"increment",category:"data"})],r=[];return t=class{async parseInput(e,t,n){const r="decrement"===e.commandName?.toLowerCase()?"decrement":"increment",i=await async function(e,t,n,r){if(!e.args||0===e.args.length)throw Error(r+" command requires a target");const i=e.args[0];let a,o,s;const l=(c=i)&&"object"==typeof c&&c.type||"unknown";var c;if("identifier"===l)a=i.name,i.scope&&(o=i.scope);else if("literal"===l)a=i.value;else{const e=Q(l);if(e){const r=await t.evaluate(i,n),o="number"==typeof r?r:null==r?0:Number(r)||0;a=o,s={node:i,writer:e,currentValue:o}}else{const e=await t.evaluate(i,n);a=Array.isArray(e)&&e.length>0?e[0]:e}}let u=1,p=o;for(let r=1;e.args.length>r;r++){const i=e.args[r];if(i&&"literal"===i.type){const e=i.value;"global"===e?p="global":"number"==typeof e&&(u=e)}else if(i&&"literal"!==i.type){const e=await t.evaluate(i,n);"number"==typeof e&&(u=e)}}return{target:a,amount:u,...p&&{scope:p},...s&&{customWrite:s}}}(e,t,n,r);return{...i,operation:r}}async execute(e,t){const{target:n,property:r,scope:i,amount:a=1,operation:o="increment",customWrite:s}=e;if(s){const e=isFinite(a)?a:1,n="increment"===o?s.currentValue+e:s.currentValue-e;return await s.writer(s.node,n,t),Object.assign(t,{it:n}),n}const l=function(e,t,n,r){if("number"==typeof e)return e;if(Wi(e)){const n=e;return t?t.startsWith("data-")||["id","class","title","alt","src","href"].includes(t)?Ya(n.getAttribute(t)):Ya(n[t]):Ya(n.value||n.textContent)}return"string"==typeof e?"global"===n?Ya(Xa(e,r,"global")):e.includes(".")?function(e,t){const n=e.split("."),r=n[1],i=eo(n[0],t);return i?Ya(i[r]):0}(e,r):Ya("me"===e&&r.me?r.me.value||0:"it"===e?r.it||0:"you"===e&&r.you?r.you.value||0:Xa(e,r)):Ya(e)}(n,r,i,t);let c;if(isNaN(l))c=NaN;else{const e=isFinite(a)?a:1;c="increment"===o?l+e:l-e}return function(e,t,n,r,i){if(Wi(e)){const n=e;return void(t?t.startsWith("data-")||["id","class","title","alt","src","href"].includes(t)?n.setAttribute(t,r+""):n[t]=r:"value"in n&&void 0!==n.value?n.value=r+"":n.textContent=r+"")}if("string"==typeof e){if("global"===n)return void Qa(e,r,i,"global");if(e.includes("."))return void function(e,t,n){const r=e.split("."),i=r[1],a=eo(r[0],n);a&&(a[i]=t)}(e,r,i);if("me"===e&&i.me)return void(i.me.value=r);if("it"===e)return void Object.assign(i,{it:r});if("you"===e&&i.you)return void(i.you.value=r);Qa(e,r,i)}}(n,r,i,c,t),Object.assign(t,{it:c}),c}},Di(t,"NumericModifyCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})();const Ts=Gi(Ss),js=Gi(Ss);function As(e){const t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t}const Ls=Gi((()=>{let e,t,n=[Ui({description:"Reset a variable to null or clear the value of a form field (<input>, <textarea>, <select>)",syntax:["clear <var>","clear :var","clear <target>"],examples:["clear :count","clear myVar","clear #search","clear <textarea/>"],sideEffects:["state-mutation","dom-mutation"]}),Bi({name:"clear",category:"data"})],r=[];return t=class{async parseInput(e,t,n){const r=e.args?.[0],i=r?.type,a=r?.name;if(r&&("variable"===i||"identifier"===i&&"string"==typeof a))try{const e=await t.evaluate(r,n);if(!Wi(e)&&!Array.isArray(e))return{type:"variable",name:a}}catch{return{type:"variable",name:a}}return{type:"form-fields",targets:await ea(e.args,t,n,"clear",{filterPrepositions:1,fallbackModifierKey:"on"},e.modifiers)}}async execute(e,t){if("variable"===e.type)return t.locals.set(e.name,null),void Object.assign(t,{it:null});for(const t of e.targets)As(t)&&("SELECT"===t.tagName?t.selectedIndex=-1:t.value="")}validate(e){if("object"!=typeof e||null===e)return 0;if("variable"===e.type)return"string"==typeof e.name;if("form-fields"===e.type){const t=e.targets;return Array.isArray(t)&&t.every(e=>Wi(e))}return 0}},Di(t,"ClearCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),Os=Gi((()=>{let e,t,n=[Ui({description:"Log values to the console",syntax:"log [<values...>]",examples:['log "Hello World"',"log me.value","log x y z",'log "Result:" result'],sideEffects:["console-output"]}),Bi({name:"log",category:"utility"})],r=[];return t=class{async parseInput(e,t,n){return e.args&&0!==e.args.length?{values:await Promise.all(e.args.map(e=>t.evaluate(e,n)))}:{values:[]}}async execute(e,t){const n="undefined"!=typeof window?window.console:console;0===e.values.length?n.log():n.log(...e.values)}validate(e){return"object"!=typeof e||null===e?0:Array.isArray(e.values)}},Di(t,"LogCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})());let Cs=(()=>{let e,t,n=[Ui({description:"Dispatch events on elements",syntax:["trigger <event> on <target>","trigger <event>(<detail>) on <target>","send <event> to <target>","send <event>(<detail>) to <target>"],examples:["trigger click on #button","trigger customEvent on me","send dataEvent to #target","send myEvent(count: 42) to me"],sideEffects:["event-dispatch"],aliases:["send"]}),Bi({name:"trigger",category:"event"})],r=[];return t=class{async parseInput(e,t,n){const r="send"===e.commandName?.toLowerCase()?"send":"trigger",i=r;if(!e.args?.length)throw Error(i+" command requires an event name");const a=e=>e?.type||"unknown",o=e.args[0];let s,l,c;if("functionCall"===a(o)||"callExpression"===a(o)){s=o.name||o.callee?.name;const e=o.args||o.arguments;e?.length&&(l=await this.parseEventDetail(e,t,n))}else if("identifier"===a(o)||"keyword"===a(o))s=o.name;else{const e=await t.evaluate(o,n);s="string"==typeof e?e:e+""}const u=e.modifiers?.on||e.modifiers?.to;if(u)c=await this.resolveTargets([u],t,n,i);else{const r=e.args.findIndex((e,t)=>{if(0===t)return 0;const n=e.name||e.value;return"on"===n||"to"===n});if(-1!==r&&e.args.length-1>r){const a=e.args.slice(r+1),o=a.findIndex(e=>"with"===(e.name||e.value)),s=-1===o?a:a.slice(0,o);c=await this.resolveTargets(s,t,n,i)}else{if(!n.me)throw Error(i+": no target specified and context.me is null");c=[n.me]}}return{eventName:s,detail:l,targets:c,options:await this.parseEventOptions(e.args,t,n),mode:r}}async execute(e,t){const n=ls(e.eventName,e.detail,e.options);for(const t of e.targets)t.dispatchEvent(n);t.it=n}async resolveTargets(e,t,n,r){const i=[];for(const r of e){const e=await t.evaluate(r,n);if("window"!==e&&e!==window)if("document"!==e&&e!==document)if("me"===e&&n.me)i.push(n.me);else if("you"===e&&n.you)i.push(n.you);else if("it"===e&&n.it)i.push(n.it);else if(Wi(e))i.push(e);else if(e instanceof NodeList)i.push(...Array.from(e).filter(Wi));else if(Array.isArray(e))i.push(...e.filter(Wi));else{if("string"==typeof e){const t=document.querySelectorAll(e);if(0===t.length)throw Error(`No elements found: "${e}"`);i.push(...Array.from(t).filter(Wi));continue}if(!e||"object"!=typeof e||!("addEventListener"in e))throw Error("Invalid target: "+typeof e);i.push(e)}else i.push(document);else i.push(window)}if(!i.length)throw Error(r+": no valid targets");return i}async parseEventDetail(e,t,n){if(!e?.length)return;if(1===e.length){const r=e[0];if("objectLiteral"!==r?.type)return await t.evaluate(r,n)}const r={};for(const i of e){const e=await t.evaluate(i,n);if("object"!=typeof e||null===e||Array.isArray(e)){if("string"==typeof e&&e.includes(":")){const[t,n]=e.split(":",2);r[t.trim()]=cs(n.trim())}}else Object.assign(r,e)}return Object.keys(r).length?r:void 0}async parseEventOptions(e,t,n){const r={bubbles:1,cancelable:1,composed:0},i=e.findIndex(e=>"with"===(e.name||e.value));if(-1===i)return r;for(const a of e.slice(i+1)){const e=await t.evaluate(a,n);if("string"==typeof e){const t=e.toLowerCase();"bubbles"===t?r.bubbles=1:"nobubbles"===t?r.bubbles=0:"cancelable"===t?r.cancelable=1:"nocancelable"===t?r.cancelable=0:"composed"===t&&(r.composed=1)}}return r}},Di(t,"EventDispatchCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})();const Ns=Gi(Cs),Ps=Gi(Cs);let Rs=(()=>{let e,t,n=[Ui({description:"Navigation functionality including URL navigation, element scrolling, and browser history",syntax:["go back","go to url <url> [in new window]","go to [position] [of] <element>"],examples:["go back",'go to url "https://example.com"',"go to top of #header"],sideEffects:["navigation","scrolling"]}),Bi({name:"go",category:"navigation"})],r=[];return t=class{async parseInput(e,t,n){return e.args&&0!==e.args.length?{args:await Promise.all(e.args.map(e=>t.evaluate(e,n)))}:{args:[]}}async execute(e,t){const{args:n}=e;if(0===n.length)throw Error("Go command requires arguments");if("string"==typeof n[0]&&"back"===n[0].toLowerCase())return await this.goBack(),{result:"back",type:"back"};if(this.isUrlNavigation(n))return{result:await this.navigateToUrl(n,t),type:"url"};const r=this.findBareUrl(n);return null!==r?{result:await this.navigateToBareUrl(r,n),type:"url"}:{result:await this.scrollToElement(n,t),type:"scroll"}}isUrlNavigation(e){return-1!==e.findIndex(e=>"url"===e)}isBareUrl(e){return e.startsWith("/")?1:/^[a-z][a-z0-9+.-]*:/i.test(e)}findBareUrl(e){for(const t of e)if("to"!==t&&"the"!==t)return"string"==typeof t&&this.isBareUrl(t)?t:null;return null}async navigateToBareUrl(e,t){if(t.includes("new")&&t.includes("window")){if("undefined"!=typeof window&&window.open){const t=window.open(e,"_blank");t?.focus&&t.focus()}}else e.startsWith("#")?"undefined"!=typeof window&&(window.location.hash=e):"undefined"!=typeof window&&(window.location.assign?.(e)??(window.location.href=e));return e}async goBack(){if("undefined"==typeof window||!window.history)throw Error("Browser history API not available");window.history.back()}async navigateToUrl(e,t){const n=e.findIndex(e=>"url"===e),r=e[n+1];if(!r)throw Error('URL is required after "url" keyword');const i="string"==typeof r?r:r+"",a=e.includes("new")&&e.includes("window");if(!this.isValidUrl(i))throw Error(`Invalid URL: "${i}"`);if(a){if("undefined"!=typeof window&&window.open){const e=window.open(i,"_blank");e?.focus&&e.focus()}}else i.startsWith("#")?"undefined"!=typeof window&&(window.location.hash=i):"undefined"!=typeof window&&(window.location.assign?.(i)??(window.location.href=i));return i}isValidUrl(e){try{return e.startsWith("/")||e.startsWith("#")||new URL(e),1}catch{return 0}}async scrollToElement(e,t){const n=this.parseScrollPosition(e),r=this.parseScrollTarget(e),i=this.parseScrollOffset(e),a=!e.includes("instantly"),o=this.resolveScrollTarget(r,t);if(!o)throw Error("Target element not found: "+r);if("undefined"!=typeof window){const e=a?"smooth":"instant",t=this.mapVerticalPosition(n.vertical),r=this.mapHorizontalPosition(n.horizontal);if(0!==i){o.scrollIntoView?.({behavior:e,block:t,inline:r});const{x:a,y:s}=this.calculateScrollPosition(o,n,i);window.scrollTo?.({left:a,top:s,behavior:e})}else o.scrollIntoView?.({behavior:e,block:t,inline:r})}return o}mapVerticalPosition(e){return{top:"start",middle:"center",bottom:"end",nearest:"nearest"}[e]||"start"}mapHorizontalPosition(e){return{left:"start",center:"center",right:"end",nearest:"nearest"}[e]||"nearest"}parseScrollPosition(e){const t={vertical:"top",horizontal:"nearest"},n=["top","middle","bottom"],r=["left","center","right"];let i=0,a=0;for(const o of e)"string"==typeof o&&(n.includes(o)?(t.vertical=o,i=1):r.includes(o)&&(t.horizontal=o,a=1));return a&&!i&&(t.vertical="nearest"),t}parseScrollTarget(e){const t=e.findIndex(e=>"of"===e);if(-1!==t&&e.length>t+1){let n=e[t+1];return"the"===n&&e.length>t+2&&(n=e[t+2]),n}for(const t of e)if("object"==typeof t&&t&&t.nodeType)return t;const n=["top","middle","bottom","left","center","right","of","the","to","smoothly","instantly"];for(const t of e)if("string"==typeof t&&!n.includes(t)&&(t.startsWith("#")||t.startsWith(".")||t.includes("[")||/^[a-zA-Z][a-zA-Z0-9-]*$/.test(t)))return t;return"body"}parseScrollOffset(e){for(let t=0;e.length>t;t++){const n=e[t];if("string"==typeof n){const e=n.match(/^([+-]?\d+)(px)?$/);if(e)return parseInt(e[1],10)}if(("+"===n||"-"===n)&&e.length>t+1){const r=e[t+1],i="number"==typeof r?r:parseInt((r+"").replace("px",""),10);if(!isNaN(i))return"-"===n?-i:i}}return 0}resolveScrollTarget(e,t){if("object"==typeof e&&e&&e.nodeType)return e;const n="string"==typeof e?e:e+"";if("body"===n&&"undefined"!=typeof document)return document.body;if("html"===n&&"undefined"!=typeof document)return document.documentElement;if("me"===n&&Wi(t.me))return t.me;if("it"===n&&Wi(t.it))return t.it;if("you"===n&&Wi(t.you))return t.you;const r=Xa(n,t);if(Wi(r))return r;if("undefined"!=typeof document)try{const e=document.querySelector(n);if(e)return e}catch{try{const e=document.getElementsByTagName(n);if(e.length>0)return e[0]}catch{}}return null}calculateScrollPosition(e,t,n){if("undefined"==typeof window||!e.getBoundingClientRect)return{x:0,y:0};const r=e.getBoundingClientRect(),i=window.pageXOffset||document.documentElement?.scrollLeft||0,a=window.pageYOffset||document.documentElement?.scrollTop||0,o=window.innerWidth||800,s=window.innerHeight||600;let l=i,c=a;switch(t.horizontal){case"left":l=r.left+i;break;case"center":l=r.left+i+r.width/2-o/2;break;case"right":l=r.right+i-o}switch(t.vertical){case"top":c=r.top+a+n;break;case"middle":c=r.top+a+r.height/2-s/2+n;break;case"bottom":c=r.bottom+a-s+n}return{x:Math.max(0,l),y:Math.max(0,c)}}},Di(t,"GoCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})();const $s=Gi(Rs),Is=["url","with","title"];async function Ms(e,t,n,r){if(!e||0===e.length)throw Error(r+" command requires a URL argument");const i=[],a=[];for(let r=0;e.length>r;r++){const o=e[r],s=o,l=s?.type||"unknown",c=s?.name;if("identifier"===l&&c&&Is.includes(c.toLowerCase()))i.push(c.toLowerCase()),a.push(c.toLowerCase());else{const e=await t.evaluate(o,n);i.push(e),"string"==typeof e&&a.push(e.toLowerCase())}}const o=a.findIndex(e=>"url"===e),s=a.findIndex(e=>"with"===e),l=a.findIndex(e=>"title"===e),c=`urlKeywordIndex=${o}, argCount=${i.length}`;let u,p;if(-1!==o&&i.length>o+1)u=i[o+1]+"";else{if(1>i.length)throw Error(`${r} command: URL is required. Debug: ${c}`);u=i[0]+""}-1!==s&&-1!==l&&l>s&&i.length>l+1&&(p=i[l+1]+"");const m=function(e,t,n){const r=n?" Debug: "+n:"";if(null==e)throw Error(`[HyperFixi] ${t}: URL is required.${r}`);if("string"!=typeof e)throw Error(`[HyperFixi] ${t}: URL must be a string (got ${typeof e}: ${e+""}).${r}`);if(""===e.trim())throw Error(`[HyperFixi] ${t}: URL cannot be empty.${r}`);if("undefined"===e)throw Error(`[HyperFixi] ${t}: URL evaluated to string 'undefined' - check your expression.${r}`);if("null"===e)throw Error(`[HyperFixi] ${t}: URL evaluated to string 'null' - check your expression.${r}`);return e}(u,r,c);return{url:m,title:p}}let qs=(()=>{let e,t,n=[Ui({description:"Modify browser history URL without page reload",syntax:["push url <url>","push url <url> with title <title>","replace url <url>","replace url <url> with title <title>"],examples:['push url "/page/2"','push url "/search" with title "Search Results"','replace url "/search?q=test"','replace url "/page" with title "Updated Page"'],sideEffects:["navigation"],aliases:["replace"]}),Bi({name:"push",category:"navigation"})],r=[];return t=class{async parseInput(e,t,n){const r=e.commandName?.toLowerCase().includes("replace")?"replace":"push";return{...await Ms(e.args,t,n,r+" url"),mode:r}}async execute(e,t){const{url:n,title:r,state:i,mode:a}=e;return"push"===a?window.history.pushState(i||null,"",n):window.history.replaceState(i||null,"",n),r&&(document.title=r),ps(window,"push"===a?"pushurl":"replaceurl",{url:n,title:r,state:i}),{url:n,title:r,mode:a}}},Di(t,"HistoryCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})();const _s=Gi(qs),Ds=Gi(qs),Vs=Gi((()=>{let e,t,n=[Ui({description:"Scroll an element into view (upstream _hyperscript 0.9.90)",syntax:["scroll to <target>","scroll to top of <target>","scroll to <target> smoothly"],examples:["scroll to #top","scroll to bottom of #chat","scroll to me smoothly"],sideEffects:["scrolling"]}),Bi({name:"scroll",category:"navigation"})],r=[];return t=class{async parseInput(e,t,n){if(!e.args||0===e.args.length)throw Error("scroll command requires a target");return{args:await Promise.all(e.args.map(e=>t.evaluate(e,n)))}}async execute(e,t){const{args:n}=e,r=this.parsePosition(n),i=!n.includes("instantly"),a=this.resolveTarget(n,t);if(!a)throw Error("scroll: target element not found");return"function"==typeof a.scrollIntoView&&a.scrollIntoView({block:r,behavior:i?"smooth":"instant"}),{element:a,position:r,smooth:i}}parsePosition(e){for(const t of e){if("top"===t)return"start";if("bottom"===t)return"end";if("middle"===t||"center"===t)return"center";if("nearest"===t)return"nearest"}return"start"}resolveTarget(e,t){const n=new Set(["to","of","the","top","bottom","middle","center","left","right","nearest","smoothly","instantly"]);for(const r of e){if("object"==typeof r&&r&&r.nodeType)return r;if("string"!=typeof r||n.has(r))continue;if("me"===r&&Wi(t.me))return t.me;if("it"===r&&Wi(t.it))return t.it;if("you"===r&&Wi(t.you))return t.you;if("body"===r&&"undefined"!=typeof document)return document.body;if("html"===r&&"undefined"!=typeof document)return document.documentElement;const e=Xa(r,t);if(Wi(e))return e;if("undefined"!=typeof document)try{const e=document.querySelector(r);if(e)return e}catch{try{const e=document.getElementsByTagName(r);if(e.length>0)return e[0]}catch{}}}return null}},Di(t,"ScrollCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})());function Hs(e,t){if("boolean"==typeof e)return e;if("function"==typeof e)return 1;if(e instanceof Promise)throw Error("Condition must be awaited - use await in the condition expression");if("string"==typeof e){if("me"===e)return!!t.me;if("it"===e)return!!t.it;if("you"===e)return!!t.you;const n=Xa(e,t);return void 0!==n?!!n:!!e}return!!e}const Fs=Gi((()=>{let e,t,n=[Ui({description:"Conditional execution based on boolean expressions",syntax:["if <condition> then <commands>","if <condition> then <commands> else <commands>","unless <condition> <commands>"],examples:["if x > 5 then add .active","if user.isAdmin then show #adminPanel else hide #adminPanel","unless user.isLoggedIn showLoginForm"],sideEffects:["conditional-execution"],aliases:["unless"]}),Bi({name:"if",category:"control-flow"})],r=[];return t=class{async parseInput(e,t,n){const r="unless"===e.commandName?.toLowerCase()?"unless":"if";if(!e.args||0===e.args.length)throw Error(r+" command requires a condition to evaluate");let i,a;if("unless"===r){if(2>e.args.length)throw Error("unless command requires a condition and at least one command");i=e.args.slice(1)}else if(e.args.length>=2&&e.args[1]?(i=e.args[1],a=3>e.args.length?void 0:e.args[2]):e.modifiers?.then&&(i=e.modifiers.then,a=e.modifiers.else),!i)throw Error('if command requires "then" branch with commands');return{mode:r,condition:await t.evaluate(e.args[0],n),thenCommands:i,elseCommands:a}}async execute(e,t){const{mode:n,condition:r,thenCommands:i,elseCommands:a}=e,o=Hs(r,t);let s,l;return("unless"===n?!o:o)?(s="then",l=await this.executeCommandsOrBlock(i,t),"unless"===n&&Object.assign(t,{it:l})):a&&"if"===n?(s="else",l=await this.executeCommandsOrBlock(a,t)):s="none",{mode:n,conditionResult:o,executedBranch:s,result:l}}async executeCommandsOrBlock(e,t){return"block"===e?.type?this.executeBlock(e,t):Array.isArray(e)?this.executeCommands(e,t):e}async executeBlock(e,t){const n=t.locals.get("_runtimeExecute");if(!n)throw Error("Runtime execute function not available");let r;if(e.commands?.length)for(const i of e.commands)r=await n(i,t);return r}async executeCommands(e,t){let n;for(const r of e)n=r?.execute?await r.execute(t):"function"==typeof r?await r():r;return n}},Di(t,"ConditionalCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),Bs=Fs,Us=Fs;let Gs=(()=>{let e,t,n=[Ui({description:"Iteration in hyperscript - for-in, counted, conditional, event-driven, and infinite loops",syntax:["repeat for <var> in <collection> { <commands> }","repeat <count> times { <commands> }","repeat while <condition> { <commands> }","repeat until <condition> { <commands> }","repeat forever { <commands> }"],examples:["repeat for item in items { log item }",'repeat 5 times { log "hello" }'],sideEffects:["iteration","conditional-execution"]}),Bi({name:"repeat",category:"control-flow"})],r=[];return t=class{async parseInput(e,t,n){let r;if(e.modifiers?.index){const i=await t.evaluate(e.modifiers.index,n);"string"==typeof i&&(r=i)}let i,a=e.modifiers?.block||e.modifiers?.commands;if(!a){const t=[];for(let n=e.args.length-1;n>=0;n--){const r=e.args[n];if("block"===r?.type&&r.commands&&(t.unshift(r),2===t.length))break}2===t.length?(a=t[0],i=t[1]):1===t.length&&(a=t[0])}const o=e.args[0],s="identifier"===o?.type?o.name:null,l=e.modifiers?.bottomTested?await t.evaluate(e.modifiers.bottomTested,n):0;if("for"===s||e.modifiers?.for){const o=e.args[1],s=o?.value||o?.name,l=e.args[2]?await t.evaluate(e.args[2],n):void 0;if(!s||void 0===l)throw Error("for loops require variable and collection");return{type:"for",variable:s,collection:Array.isArray(l)?l:[l],indexVariable:r,commands:a,elseCommands:i}}if("times"===s||e.modifiers?.times){const o=e.args[1],s=o?await t.evaluate(o,n):void 0,l="number"==typeof s?s:parseInt(s+"",10);if(isNaN(l))throw Error("times loops require a count number");return{type:"times",count:l,indexVariable:r,commands:a,elseCommands:i}}if("while"===s||e.modifiers?.while){const t=e.args[1]||e.modifiers?.while;if(!t)throw Error("while loops require a condition");return{type:"while",condition:t,indexVariable:r,commands:a,elseCommands:i,bottomTested:l}}if("until"===s&&e.modifiers?.from||"until-event"===s){const o=e.args[1],s=o?.value||o?.name;if(!s)throw Error("until-event loops require an event name");let l=n.me;if(e.args[2]){const r=await t.evaluate(e.args[2],n);r instanceof EventTarget?l=r:"document"===r&&(l=document)}return{type:"until-event",eventName:s,eventTarget:l,indexVariable:r,commands:a,elseCommands:i}}if("until"===s||e.modifiers?.until){const t=e.args[1]||e.modifiers?.until;if(!t)throw Error("until loops require a condition");return{type:"until",condition:t,indexVariable:r,commands:a,elseCommands:i,bottomTested:l}}if("forever"===s||e.modifiers?.forever)return{type:"forever",indexVariable:r,commands:a,elseCommands:i};throw Error("repeat command requires a loop type (for/times/while/until/forever)")}async execute(e,t){const{type:n,variable:r,collection:i,condition:a,count:o,indexVariable:s,commands:l,elseCommands:c,bottomTested:u,eventName:p,eventTarget:m}=e;let d,f;switch(n){case"for":({config:d,iterCtx:f}=function(e,t,n){return{config:{type:"for",shouldContinue:e=>(e.collection?.length??0)>e.index,beforeIteration:(e,t)=>{e.item=e.collection?.[e.index],e.itemVariable&&t.locals&&t.locals.set(e.itemVariable,e.item)}},iterCtx:{index:0,collection:e,itemVariable:t,indexVariable:n}}}(i,r,s));break;case"times":({config:d,iterCtx:f}=function(e,t){return{config:{type:"times",shouldContinue:e=>(e.count??0)>e.index,beforeIteration:(e,t)=>{Object.assign(t,{it:e.index+1})}},iterCtx:{index:0,count:e,indexVariable:t}}}(o,s));break;case"while":({config:d,iterCtx:f}=function(e,t,n,r){return{config:{type:"while",shouldContinue:()=>t(e,n)},iterCtx:{index:0,conditionExpr:e,indexVariable:r}}}(a,Hs,t,s));break;case"until":({config:d,iterCtx:f}=function(e,t,n,r){return{config:{type:"until",shouldContinue:()=>!t(e,n)},iterCtx:{index:0,conditionExpr:e,indexVariable:r}}}(a,Hs,t,s));break;case"until-event":({config:d,iterCtx:f}=function(e,t,n){const r={index:0,eventFired:0,indexVariable:n};return{config:{type:"until-event",shouldContinue:e=>!e.eventFired,eventSetup:{eventName:e,target:t,onEvent:()=>{r.eventFired=1}}},iterCtx:r}}(p,m,s));break;case"forever":({config:d,iterCtx:f}=function(e,t=1e4){return{config:{type:"forever",maxIterations:t,shouldContinue:()=>1},iterCtx:{index:0,indexVariable:e}}}(s));break;default:throw Error("Unknown repeat type: "+n)}if(u){const e=d.shouldContinue;d.shouldContinue=async t=>0===t.index?1:await e(t)}try{const e=await async function(e,t,n,r,i){const a=e.maxIterations??1e4;let o,s=0,l=0;e.eventSetup&&e.eventSetup.target.addEventListener(e.eventSetup.eventName,e.eventSetup.onEvent,{once:1});try{for(;a>s&&await e.shouldContinue(r);){e.beforeIteration&&await e.beforeIteration(r,n),r.indexVariable&&n.locals&&n.locals.set(r.indexVariable,s);try{o=await i(t,n)}catch(t){if(t instanceof Error){if(t.message.includes("BREAK")){l=1;break}if(t.message.includes("CONTINUE")){s++,r.index=s,"until-event"===e.type&&await new Promise(e=>setTimeout(e,0));continue}}throw t}s++,r.index=s,"until-event"===e.type&&await new Promise(e=>setTimeout(e,0))}}finally{e.eventSetup&&!r.eventFired&&e.eventSetup.target.removeEventListener(e.eventSetup.eventName,e.eventSetup.onEvent)}return{iterations:s,lastResult:o,interrupted:l}}(d,l,t,f,this.executeCommands.bind(this));if(0===e.iterations&&!e.interrupted&&c){const e=await this.executeCommands(c,t);return Object.assign(t,{it:e}),{type:n,iterations:0,completed:1,lastResult:e}}return Object.assign(t,{it:e.lastResult}),{type:n,iterations:e.iterations,completed:!e.interrupted,lastResult:e.lastResult,interrupted:e.interrupted}}catch(e){if(e instanceof Error&&(e.message.includes("BREAK")||e.message.includes("CONTINUE")))return{type:n,iterations:0,completed:1,interrupted:e.message.includes("BREAK")};throw e}}async executeCommands(e,t){if(e&&"object"==typeof e&&"block"===e.type){const n=e,r=t.locals.get("_runtimeExecute");if(!r)throw Error("Runtime execute function not available");let i;if(n.commands)for(const e of n.commands)i=await r(e,t);return i}if(Array.isArray(e)){let n;for(const r of e)n="function"==typeof r?await r(t):r&&"function"==typeof r.execute?await r.execute(t):r;return n}return"function"==typeof e?await e(t):e}},Di(t,"RepeatCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})();const Ws=Gi(Gs);class Ks{async parseInput(e,t,n){return{signalType:this.signalType}}async execute(e,t){const n=Error(this.errorMessage);throw n[this.errorFlag]=1,"exit"===this.signalType&&(n.returnValue=void 0,n.timestamp=Date.now()),n}}let Js=(()=>{let e,t,n=[Ui({description:"Exit from the current loop (repeat, for, while, until)",syntax:["break"],examples:["break","if found then break","repeat for item in items { if item == target then break }"],sideEffects:["control-flow"]}),Bi({name:"break",category:"control-flow"})],r=[],i=Ks;return t=class extends i{constructor(){super(...arguments),this.signalType="break",this.errorMessage="BREAK_LOOP",this.errorFlag="isBreak"}},Di(t,"BreakCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:a},null,r),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:a}),_i(t,r)})(),t})();const Zs=Gi(Js);let Ys=(()=>{let e,t,n=[Ui({description:"Skip to the next iteration of the current loop",syntax:["continue"],examples:["continue","if item.isInvalid then continue","repeat for item in items { if item.skip then continue; process item }"],sideEffects:["control-flow"]}),Bi({name:"continue",category:"control-flow"})],r=[],i=Ks;return t=class extends i{constructor(){super(...arguments),this.signalType="continue",this.errorMessage="CONTINUE_LOOP",this.errorFlag="isContinue"}},Di(t,"ContinueCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:a},null,r),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:a}),_i(t,r)})(),t})();const Xs=Gi(Ys),Qs=Gi((()=>{let e,t,n=[Ui({description:"Stop command execution or prevent event defaults",syntax:["halt","halt the event"],examples:["halt","halt the event","if error then halt",'on click halt the event then log "clicked"'],sideEffects:["control-flow","event-prevention"]}),Bi({name:"halt",category:"control-flow"})],r=[];return t=class{async parseInput(e,t,n){if(e.args&&e.args.length>0){const r=e.args[0],i=e.args.length>1?e.args[1]:null;return"identifier"===r.type&&"the"===r.name&&i&&"identifier"===i.type&&"event"===i.name?{target:n.event}:{target:await t.evaluate(e.args[0],n)}}return{}}async execute(e,t){let n=e.target;if(("the"===n&&t.event||"object"==typeof n&&null!==n&&"the"===n.target&&t.event)&&(n=t.event),this.isEvent(n)){const e=n;return e.preventDefault(),e.stopPropagation(),{halted:1,timestamp:Date.now(),eventHalted:1}}"halted"in t&&(t.halted=1);const r=Error("HALT_EXECUTION");throw r.isHalt=1,r}isEvent(e){return null!==e&&"object"==typeof e&&"preventDefault"in e&&"stopPropagation"in e}},Di(t,"HaltCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),el=Gi((()=>{let e,t,n=[Ui({description:"Return a value from a command sequence or function, terminating execution",syntax:["return","return <value>"],examples:["return","return 42","return user.name","if found then return result"],sideEffects:["control-flow","context-mutation"]}),Bi({name:"return",category:"control-flow"})],r=[];return t=class{async parseInput(e,t,n){return e.args&&0!==e.args.length?{value:await t.evaluate(e.args[0],n)}:{value:void 0}}async execute(e,t){const{value:n}=e;"returnValue"in t&&(t.returnValue=n),Object.assign(t,{it:n});const r=Error("RETURN_VALUE");throw r.isReturn=1,r.returnValue=n,r}},Di(t,"ReturnCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})());let tl=(()=>{let e,t,n=[Ui({description:"Immediately terminate execution of the current event handler or behavior",syntax:["exit"],examples:["exit","if no draggedItem exit","on click if disabled exit"],sideEffects:["control-flow"]}),Bi({name:"exit",category:"control-flow"})],r=[],i=Ks;return t=class extends i{constructor(){super(...arguments),this.signalType="exit",this.errorMessage="EXIT_COMMAND",this.errorFlag="isExit"}},Di(t,"ExitCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:a},null,r),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:a}),_i(t,r)})(),t})();const nl=Gi(tl),rl=Gi((()=>{let e,t,n=[Ui({description:"Evaluate an expression and store the result in the it variable",syntax:["call <expression>"],examples:["call myFunction()",'call fetch("/api/data")',"call element.focus()"],sideEffects:["function-execution","context-mutation"]}),Bi({name:"call",category:"execution"})],r=[];return t=class{parseInput(e,t,n){if(!e.args?.length)throw Error("call command requires an expression");return Promise.resolve({expression:e.args[0]})}async execute(e,t){const{expression:n}=e,r=t.locals?.get("__evaluator"),i=r?await r.evaluate(n,t):await dn(n,t);let a,o,s=0;return"function"==typeof i?(o="function",a=i(),a instanceof Promise&&(s=1,a=await a)):i instanceof Promise?(o="promise",s=1,a=await i):(o="value",a=i),Object.assign(t,{it:a,result:a}),{result:a,wasAsync:s,expressionType:o}}},Di(t,"CallCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),il=Gi((()=>{let e,t,n=[Ui({description:"Focus an element (calls HTMLElement.focus())",syntax:["focus","focus <target>","focus on <target>"],examples:["focus","focus #search","focus on <input/>"],sideEffects:["focus"]}),Bi({name:"focus",category:"execution"})],r=[];return t=class{async parseInput(e,t,n){return{targets:await ea(e.args,t,n,"focus",{filterPrepositions:1,fallbackModifierKey:"on"},e.modifiers)}}async execute(e,t){for(const t of e.targets)t.focus()}validate(e){if("object"!=typeof e||null===e)return 0;const t=e;return Array.isArray(t.targets)?t.targets.every(e=>Wi(e)):0}},Di(t,"FocusCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),al=Gi((()=>{let e,t,n=[Ui({description:"Remove focus from an element (calls HTMLElement.blur())",syntax:["blur","blur <target>","blur on <target>"],examples:["blur","blur #search","blur on <input/>"],sideEffects:["focus"]}),Bi({name:"blur",category:"execution"})],r=[];return t=class{async parseInput(e,t,n){return{targets:await ea(e.args,t,n,"blur",{filterPrepositions:1,fallbackModifierKey:"on"},e.modifiers)}}async execute(e,t){for(const t of e.targets)t.blur()}validate(e){if("object"!=typeof e||null===e)return 0;const t=e;return Array.isArray(t.targets)?t.targets.every(e=>Wi(e)):0}},Di(t,"BlurCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),ol=Gi((()=>{let e,t,n=[Ui({description:"Add content to the end of a string, array, or HTML element",syntax:["append <content>","append <content> to <target>"],examples:['append "Hello"','append "World" to greeting',"append item to myArray",'append "<p>New</p>" to #content'],sideEffects:["data-mutation","dom-mutation"]}),Bi({name:"append",category:"content"})],r=[];return t=class{async parseInput(e,t,n){if(!e.args?.length)throw Error("append requires content");const r=await t.evaluate(e.args[0],n);let i;return e.modifiers?.to?i=await t.evaluate(e.modifiers.to,n):e.target&&(i=e.target),{content:r,target:i}}async execute(e,t){const{content:n,target:r}=e,i=n+"";if(!r)return Object.assign(t,void 0===t.it?{it:i}:{it:t.it+""+i}),{result:t.it,targetType:"result"};if("string"==typeof r){if(r.startsWith("#")||r.startsWith(".")||r.includes("[")){const e=this.resolveDOMElement(r);return e.innerHTML+=i,{result:e,targetType:"element",target:e}}if("me"===r||"it"===r||"you"===r){const e=this.resolveContextRef(r,t);if(Wi(e))return e.innerHTML+=i,{result:e,targetType:"element",target:e}}const e=Xa(r,t);if(void 0!==e){if(Array.isArray(e))return e.push(n),{result:e,targetType:"array",target:r};const a=(null==e?"":e+"")+i;return Qa(r,a,t),{result:a,targetType:"variable",target:r}}return Qa(r,i,t),{result:i,targetType:"variable",target:r}}if(Array.isArray(r))return r.push(n),{result:r,targetType:"array"};if(Wi(r))return r.innerHTML+=i,{result:r,targetType:"element",target:r};{const e=r+""+i;return Object.assign(t,{it:e}),{result:e,targetType:"string"}}}resolveDOMElement(e){if("undefined"==typeof document)throw Error("DOM not available");const t=document.querySelector(e);if(!t)throw Error("Element not found: "+e);return t}resolveContextRef(e,t){switch(e){case"me":return t.me;case"it":return t.it;case"you":return t.you;default:throw Error("Unknown context ref: "+e)}}},Di(t,"AppendCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),sl=Gi((()=>{let e,t,n=[Ui({description:"Animate CSS properties using CSS transitions",syntax:"transition <property> to <value> [over <duration>] [with <timing>]",examples:["transition opacity to 0.5","transition left to 100px over 500ms","transition background-color to red over 1s with ease-in-out"],sideEffects:["style-change","timing"]}),Bi({name:"transition",category:"animation"})],r=[];return t=class{async parseInput(e,t,n){if(!e.args?.length)throw Error("transition requires property and value");let r,i;const a=await t.evaluate(e.args[0],n);if(Wi(a)||"string"==typeof a&&/^[#.]|^(?:me|it|you)$/.test(a)?(i=a,r=await t.evaluate(e.args[1],n)+""):r=a+"",!r)throw Error("transition requires a CSS property");if(!e.modifiers?.to)throw Error('transition requires "to <value>"');let o=await t.evaluate(e.modifiers.to,n);void 0===o&&"identifier"===e.modifiers.to.type&&(o=e.modifiers.to.name);const s={property:r,value:o};return void 0!==i&&(s.target=i),e.modifiers?.over&&(s.duration=await t.evaluate(e.modifiers.over,n)),e.modifiers?.with&&(s.timingFunction=await t.evaluate(e.modifiers.with,n)+""),s}async execute(e,t){let{property:n}=e;const{target:r,value:i,duration:a,timingFunction:o}=e;n.startsWith("*")&&(n=n.substring(1)),n=n.replace(/([A-Z])/g,"-$1").toLowerCase();const s=Ji(r,t,"transition"),l=Aa(a,300),c=getComputedStyle(s).getPropertyValue(n),u=s.style.transition,p=`${n} ${l}ms ${o||"ease"}`;s.style.transition=u?`${u}, ${p}`:p;let m=i+"",d=0;if("initial"===m||"inherit"===m||"unset"===m||"revert"===m){const e=s.style.getPropertyValue(n);s.style.removeProperty(n),m=getComputedStyle(s).getPropertyValue(n),e&&s.style.setProperty(n,e),d=1}s.style.setProperty(n,m);const f=await function(e,t,n){return new Promise(r=>{const i=n=>{n.target===e&&n.propertyName===t&&o({completed:1,cancelled:0})},a=n=>{n.target===e&&n.propertyName===t&&o({completed:0,cancelled:1})},o=vs(()=>{e.removeEventListener("transitionend",i),e.removeEventListener("transitioncancel",a),clearTimeout(s)},r);e.addEventListener("transitionend",i),e.addEventListener("transitioncancel",a);const s=setTimeout(()=>{o({completed:1,cancelled:0})},n+50)})}(s,n,l);return s.style.transition=u,d&&s.style.removeProperty(n),Object.assign(t,{it:s}),{element:s,property:n,fromValue:c,toValue:m,duration:l,completed:f.completed}}},Di(t,"TransitionCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),ll=Gi((()=>{let e,t,n=[Ui({description:"Measure DOM element dimensions, positions, and properties",syntax:["measure","measure <property>","measure <target> <property>"],examples:["measure","measure width","measure #element height","measure x and set dragX"],sideEffects:["data-mutation"]}),Bi({name:"measure",category:"animation"})],r=[];return t=class{async parseInput(e,t,n){let r,i,a;if(e.args?.length){const a=e.args[0];if("identifier"===a.type&&a.name){const o=a.name.toLowerCase();if("me"===o||"it"===o||"you"===o){const o=await t.evaluate(a,n);if(Wi(o)&&(r=o,e.args.length>1)){const r=e.args[1];i="identifier"===r.type?r.name:await t.evaluate(r,n)+""}}else i=a.name}else{const o=await t.evaluate(a,n);if(Wi(o)||"string"==typeof o&&/^[#.]/.test(o)){if(r=o,e.args.length>1){const r=e.args[1];i="identifier"===r.type?r.name:await t.evaluate(r,n)+""}}else"string"==typeof o&&(i=o)}}e.modifiers?.set&&(a=await t.evaluate(e.modifiers.set,n)+"");const o={};return void 0!==r&&(o.target=r),void 0!==i&&(o.property=i),void 0!==a&&(o.variable=a),o}async execute(e,t){const n=Ji(e.target,t,"measure"),r=e.property||"width",i=this.getMeasurement(n,r);return e.variable&&t.locals&&t.locals.set(e.variable,i.value),Object.assign(t,{it:i.value}),{result:i.value,wasAsync:0,element:n,property:r,value:i.value,unit:i.unit,stored:!!e.variable}}getMeasurement(e,t){const n=getComputedStyle(e);if(t.startsWith("*")){const e=n.getPropertyValue(t.substring(1)),r=parseFloat(e);if(!isNaN(r)){const t=e.match(/([a-zA-Z%]+)$/);return{value:r,unit:t?t[1]:""}}return{value:e,unit:""}}const r=t.toLowerCase(),i=e.getBoundingClientRect(),a={width:()=>i.width,height:()=>i.height,top:()=>i.top,left:()=>i.left,right:()=>i.right,bottom:()=>i.bottom,x:()=>e.offsetLeft,y:()=>e.offsetTop,clientwidth:()=>e.clientWidth,"client-width":()=>e.clientWidth,clientheight:()=>e.clientHeight,"client-height":()=>e.clientHeight,offsetwidth:()=>e.offsetWidth,"offset-width":()=>e.offsetWidth,offsetheight:()=>e.offsetHeight,"offset-height":()=>e.offsetHeight,scrollwidth:()=>e.scrollWidth,"scroll-width":()=>e.scrollWidth,scrollheight:()=>e.scrollHeight,"scroll-height":()=>e.scrollHeight,scrolltop:()=>e.scrollTop,"scroll-top":()=>e.scrollTop,scrollleft:()=>e.scrollLeft,"scroll-left":()=>e.scrollLeft,offsettop:()=>e.offsetTop,"offset-top":()=>e.offsetTop,offsetleft:()=>e.offsetLeft,"offset-left":()=>e.offsetLeft};if(a[r])return{value:a[r](),unit:"px"};const o=n.getPropertyValue(t),s=parseFloat(o);if(!isNaN(s)){const e=o.match(/([a-zA-Z%]+)$/);return{value:s,unit:e?e[1]:"px"}}return{value:0,unit:"px"}}},Di(t,"MeasureCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),cl=Gi((()=>{let e,t,n=[Ui({description:"Wait for CSS transitions and animations to complete",syntax:"settle [<target>] [for <timeout>]",examples:["settle","settle #animated-element","settle for 3000"],sideEffects:["timing"]}),Bi({name:"settle",category:"animation"})],r=[];return t=class{async parseInput(e,t,n){let r,i;if(e.args&&e.args.length>0){const i=await t.evaluate(e.args[0],n);(Wi(i)||"string"==typeof i&&(i.startsWith("#")||i.startsWith(".")||"me"===i||"it"===i||"you"===i))&&(r=i)}e.modifiers?.for&&(i=await t.evaluate(e.modifiers.for,n));const a={};return void 0!==r&&(a.target=r),void 0!==i&&(a.timeout=i),a}async execute(e,t){const{target:n,timeout:r}=e,i=Ji(n,t,"settle"),a=Aa(r,5e3),o=Date.now(),s=getComputedStyle(i),l=Oa(s.transitionDuration),c=Oa(s.transitionDelay),u=Oa(s.animationDuration),p=Oa(s.animationDelay),m=Ca(l,c),d=Ca(u,p),f=Math.max(m,d),y=await(h=i,v=f,g=a,v>0?new Promise(e=>{const t=e=>{e.target===h&&r({completed:1,type:"transition"})},n=e=>{e.target===h&&r({completed:1,type:"animation"})},r=vs(()=>{h.removeEventListener("transitionend",t),h.removeEventListener("animationend",n),clearTimeout(i),clearTimeout(a)},e);h.addEventListener("transitionend",t),h.addEventListener("animationend",n);const i=setTimeout(()=>{r({completed:1,type:"timeout"})},v+50),a=setTimeout(()=>{r({completed:0,type:"timeout"})},g)}):Promise.resolve({completed:1,type:"timeout"}));var h,v,g;const b=Date.now()-o;return Object.assign(t,{it:i}),{element:i,settled:y.completed,timeout:a,duration:b}}},Di(t,"SettleCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),ul=Gi((()=>{let e,t,n=[Ui({description:"Wrap a block of commands in document.startViewTransition()",syntax:["start view transition [using <type>] <body> end"],examples:["start view transition add .highlight to me end",'start view transition using "slide" then put result into #panel end'],sideEffects:["animation","dom-mutation"]}),Bi({name:"start",category:"animation"})],r=[];return t=class{async parseInput(e,t,n){const r=e.args??[];let i;if(e.modifiers?.transitionName){const r=await t.evaluate(e.modifiers.transitionName,n);i="string"==typeof r?r:(r??"")+""}return{transitionName:i,body:r}}async execute(e,t){const n=t.locals.get("_runtimeExecute");let r=0;const i=async()=>{for(const i of e.body)n?await n(i,t):i&&"function"==typeof i.execute?await i.execute(t):"function"==typeof i&&await i(t),r++};return Co()?(await $o(i),{usedViewTransition:1,commandsExecuted:r}):(await i(),{usedViewTransition:0,commandsExecuted:r})}},Di(t,"StartViewTransitionCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),pl=Gi((()=>{let e,t,n=[Ui({description:"Execute inline JavaScript code with access to hyperscript context",syntax:["js <code> end","js(param1, param2) <code> end"],examples:['js console.log("Hello") end',"js(x, y) return x + y end",'js me.style.color = "red" end'],sideEffects:["code-execution","data-mutation"]}),Bi({name:"js",category:"advanced"})],r=[];return t=class{async parseInput(e,t,n){let r,i;if(0===e.args.length)throw Error("js command requires JavaScript code");const a=e.args[0],o=e.args[1];if(a&&"literal"===a.type&&"string"==typeof a.value)r=a.value;else{if(!a||void 0===a.value)throw Error("js command requires JavaScript code");r=a.value+""}o&&"arrayLiteral"===o.type&&Array.isArray(o.elements)&&(i=o.elements.map(e=>"string"==typeof e.value?e.value:e.value+"").filter(e=>e&&e.length>0));const s={code:r};return i&&i.length>0&&(s.parameters=i),s}async execute(e,t){const{code:n,parameters:r=[]}=e;if(!n.trim())return{result:void 0,executed:0,codeLength:n.length,parameters:r,preserveArrayResult:1};try{const e=this.createExecutionContext(t,r),i=Function(...Object.keys(e),n),a=await i(...Object.values(e));return void 0!==a&&Object.assign(t,{it:a}),{result:a,executed:1,codeLength:n.length,parameters:r,preserveArrayResult:1}}catch(e){throw Error("JavaScript execution failed: "+(e instanceof Error?e.message:"Unknown error"))}}createExecutionContext(e,t){return{me:e.me,it:e.it,you:e.you,locals:e.locals,globals:e.globals,variables:e.variables,console,document:"undefined"!=typeof document?document:void 0,window:"undefined"!=typeof window?window:void 0,...t.reduce((t,n)=>{let r=e.locals?.get(n);return void 0===r&&(r=e.variables?.get(n)),void 0===r&&(r=e[n]),t[n]=r,t},{})}}},Di(t,"JsCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),ml=Gi((()=>{let e,t,n=[Ui({description:"Execute commands asynchronously without blocking",syntax:["async <command> [<command> ...]"],examples:["async command1 command2","async fetchData processData","async animateIn showContent"],sideEffects:["async-execution"]}),Bi({name:"async",category:"advanced"})],r=[];return t=class{async parseInput(e,t,n){if(1>e.args.length)throw Error("async command requires at least one command to execute");return{commands:e.args}}async execute(e,t){const{commands:n}=e,r=Date.now();try{const e=await this.executeCommandsAsync(t,n),i=Date.now()-r;return e.length>0&&Object.assign(t,{it:e[e.length-1]}),{commandCount:n.length,results:e,executed:1,duration:i}}catch(e){throw Error("Async command execution failed: "+(e instanceof Error?e.message:"Unknown error"))}}async executeCommandsAsync(e,t){const n=[];for(let r=0;t.length>r;r++){const i=t[r];try{const t=await this.executeCommand(i,e);n.push(t),Object.assign(e,{it:t})}catch(e){const n=this.getCommandName(i);throw Error(`Command '${n}' (${r+1}/${t.length}) failed: ${e instanceof Error?e.message:"Unknown error"}`)}}return n}async executeCommand(e,t){if("function"==typeof e)return await e(t);if(e&&"object"==typeof e&&"execute"in e&&"function"==typeof e.execute)return await e.execute(t);throw Error("Invalid command: must be a function or object with execute method")}getCommandName(e){return"function"==typeof e?e.name||"anonymous function":e&&"object"==typeof e?e.name||"unnamed command":"unknown"}},Di(t,"AsyncCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),dl=Gi((()=>{let e,t,n=[Ui({description:"Set a value only if it doesn't already exist",syntax:["default <expression> to <expression>"],examples:['default myVar to "fallback"','default @data-theme to "light"','default my innerHTML to "No content"'],sideEffects:["data-mutation","dom-mutation"]}),Bi({name:"default",category:"data"})],r=[];return t=class{async parseInput(e,t,n){if(1>e.args.length)throw Error("default command requires a target");const r=await t.evaluate(e.args[0],n);let i;if(e.modifiers?.to)i=await t.evaluate(e.modifiers.to,n);else{if(2>e.args.length)throw Error('default command requires a value (use "to <value>")');i=await t.evaluate(e.args[1],n)}return{target:r,value:i}}async execute(e,t){const{target:n,value:r}=e;if("string"==typeof n){if(n.startsWith("@"))return this.defaultAttribute(t,n.substring(1),r);const e=n.match(/^(my|its?|your?)\s+(.+)$/);if(e){const[,n,i]=e;return this.defaultElementProperty(t,n,i,r)}return this.defaultVariable(t,n,r)}if(Wi(n))return this.defaultElementValue(t,n,r);throw Error("Invalid target type: "+typeof n)}defaultVariable(e,t,n){const r=Xa(t,e);return null!=r?{target:t,value:n,wasSet:0,existingValue:r,targetType:"variable"}:(Qa(t,n,e),Object.assign(e,{it:n}),{target:t,value:n,wasSet:1,targetType:"variable"})}defaultAttribute(e,t,n){if(!e.me)throw Error("No element context available for attribute default");const r=e.me.getAttribute(t);return null!==r?{target:"@"+t,value:n,wasSet:0,existingValue:r,targetType:"attribute"}:(e.me.setAttribute(t,n+""),Object.assign(e,{it:n}),{target:"@"+t,value:n,wasSet:1,targetType:"attribute"})}defaultElementProperty(e,t,n,r){const i=Xi(t,e,"default"),a=function(e,t){if(t.startsWith("@"))return e.getAttribute(t.substring(1));switch(t){case"textContent":return e.textContent;case"innerHTML":return e.innerHTML;case"innerText":return e.innerText;case"id":return e.id;case"className":return e.className;case"value":return"value"in e?e.value:void 0;case"checked":return"checked"in e?e.checked:void 0}if(t.includes(".")){const n=t.split(".");let r=e;for(const e of n){if(null==r)break;r=r[e]}return r}return t.includes("-")||t in e.style?e.style.getPropertyValue(t)||e.style[t]:e[t]}(i,n),o=`${t} ${n}`;return _a(a)?(qa(i,n,r),Object.assign(e,{it:r}),{target:o,value:r,wasSet:1,targetType:"property"}):{target:o,value:r,wasSet:0,existingValue:a,targetType:"property"}}defaultElementValue(e,t,n){const r=function(e){return"value"in e?e.value:e.textContent}(t);return _a(r)?(function(e,t){"value"in e?e.value=t+"":e.textContent=t+""}(t,n),Object.assign(e,{it:n}),{target:"element",value:n,wasSet:1,targetType:"element"}):{target:"element",value:n,wasSet:0,existingValue:r,targetType:"element"}}},Di(t,"DefaultCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})());class fl{constructor(){this.name="pseudo-command"}get metadata(){return fl.metadata}async parseInput(e,t,n){if(1===e.args.length&&"objectLiteral"===e.args[0].type){const r=e.args[0].properties||[];let i,a,o="",s=[];for(const e of r){const r=e.value;switch(e.key?.name||e.key?.value){case"methodName":o=r?.value||await t.evaluate(r,n)+"";break;case"methodArgs":"arrayLiteral"===r?.type&&r.elements?s=await Promise.all(r.elements.map(e=>t.evaluate(e,n))):"literal"===r?.type&&Array.isArray(r.value)&&(s=await Promise.all(r.value.map(e=>t.evaluate(e,n))));break;case"preposition":const e=r?.value;e&&"null"!==e&&(i=e);break;case"target":case"targetExpression":a=await t.evaluate(r,n)}}if(!o)throw Error("pseudo-command requires method name");if(null==a)throw Error("pseudo-command requires a target expression");return{methodName:o,methodArgs:s,preposition:i,targetExpression:a}}if(2>e.args.length)throw Error("pseudo-command requires method name and target expression");const r=await t.evaluate(e.args[0],n)+"",i=Array.isArray(e.args[1])?await Promise.all(e.args[1].map(e=>t.evaluate(e,n))):[];let a,o;const s=["from","on","with","into","at","to"];for(const r of s)if(e.modifiers?.[r]){o=r,a=await t.evaluate(e.modifiers[r],n);break}if(a||3>e.args.length||(a=await t.evaluate(e.args[2],n)),!a)throw Error("pseudo-command requires a target expression");return{methodName:r,methodArgs:i,preposition:o,targetExpression:a}}async execute(e,t){const{methodName:n,methodArgs:r,targetExpression:i}=e;try{const e=await this.resolveTarget(i,t);if(null==e)throw Error("Target expression resolved to "+e);const a=this.resolveMethod(e,n);if(!a)throw Error(`Method "${n}" not found on target object`);if("function"!=typeof a)throw Error(`"${n}" is not a function (it's a ${typeof a})`);const o=await this.executeMethod(a,e,r);return t.locals.set("result",o),Object.assign(t,{it:o}),{result:o,methodName:n,target:e}}catch(e){throw Error("Pseudo-command failed: "+(e instanceof Error?e.message:e+""))}}async resolveTarget(e,t){return"object"==typeof e&&null!==e?e:"string"==typeof e?t.locals.has(e)?t.locals.get(e):t.variables?.has(e)?t.variables.get(e):t.globals.has(e)?t.globals.get(e):"me"===e&&t.me?t.me:"it"===e&&t.it?t.it:"document"===e?"undefined"!=typeof document?document:null:"window"===e?"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:null:this.resolvePropertyPath(e,t):e}resolvePropertyPath(e,t){const n=e.split(".");let r="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:null;t.locals.has(n[0])?(r=t.locals.get(n[0]),n.shift()):t.variables?.has(n[0])?(r=t.variables.get(n[0]),n.shift()):t.globals.has(n[0])&&(r=t.globals.get(n[0]),n.shift());for(const e of n){if(null==r)return null;r=r[e]}return r}resolveMethod(e,t){if(!e)return null;if(t in e)return e[t];const n=t.split(".");let r=e;for(let e=0;n.length>e;e++){const t=n[e];if(null==r)return null;if(!(t in r))return null;if(r=r[t],e===n.length-1&&"function"==typeof r)return r}return null}async executeMethod(e,t,n){try{const r=e.apply(t,n);return r&&"object"==typeof r&&"then"in r?await r:r}catch(e){throw Error("Method execution failed: "+(e instanceof Error?e.message:e+""))}}}fl.metadata={description:"Treat a method on an object as a top-level command",syntax:["<method>(<args>) [(to|on|with|into|from|at)] <expression>"],examples:['getElementById("d1") from the document',"reload() the location of the window",'setAttribute("foo", "bar") on me',"foo() on me"],category:"execution",sideEffects:["method-execution"]};const yl=Gi((()=>{let e,t,n=[Ui({description:"Execute commands in the context of target elements",syntax:["tell <target> <command> [<command> ...]"],examples:["tell #sidebar hide","tell .buttons add .disabled","tell closest <form/> submit"],sideEffects:["context-switching","command-execution"]}),Bi({name:"tell",category:"utility"})],r=[];return t=class{async parseInput(e,t,n){if(2>e.args.length)throw Error("tell command requires a target and at least one command");return{target:await t.evaluate(e.args[0],n),commands:e.args.slice(1)}}async execute(e,t){const{target:n,commands:r}=e,i=Zi(n,t);if(0===i.length)throw Error("tell command found no target elements");const a=t.locals.get("_runtimeExecute"),o=[];for(const e of i){const n={...t,me:e,you:e};for(const e of r)try{const t=await this.executeCommand(e,n,a);o.push(t),Object.assign(n,{it:t})}catch(e){throw Error("Command execution failed in tell block: "+(e instanceof Error?e.message:"Unknown error"))}}return{targetElements:i,commandResults:o,executionCount:i.length*r.length}}async executeCommand(e,t,n){if(e&&"object"==typeof e&&"command"===e.type&&n)return await n(e,t);if("function"==typeof e)return await e(t);if(e&&"object"==typeof e&&"function"==typeof e.execute)return await e.execute(t);throw Error("Invalid command: must be a function or object with execute method")}},Di(t,"TellCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})());let hl=(()=>{let e,t,n=[Ui({description:"Copy text or element content to the clipboard",syntax:["copy <source>","copy <source> to clipboard"],examples:['copy "Hello World"',"copy #code-snippet","copy my textContent"],sideEffects:["clipboard-write","custom-events"]}),Bi({name:"copy",category:"utility"})],r=[];return t=class{async parseInput(e,t,n){if(1>e.args.length)throw Error("copy command requires a source (text or element)");const r=await t.evaluate(e.args[0],n);let i="text";if(e.modifiers?.format){const r=await t.evaluate(e.modifiers.format,n);"html"!==r&&"text"!==r||(i=r)}return{source:r,format:i}}async execute(e,t){const{source:n,format:r="text"}=e,i=this.extractText(n,r,t);if("undefined"!=typeof navigator&&navigator.clipboard)try{return await navigator.clipboard.writeText(i),this.dispatchCopyEvent(t,"copy:success",{text:i,method:"clipboard-api"}),{success:1,text:i,format:r,method:"clipboard-api"}}catch{}try{if(this.copyUsingExecCommand(i))return this.dispatchCopyEvent(t,"copy:success",{text:i,method:"execCommand"}),{success:1,text:i,format:r,method:"execCommand"}}catch{}return this.dispatchCopyEvent(t,"copy:error",{text:i,error:"All copy methods failed"}),{success:0,text:i,format:r,method:"fallback"}}extractText(e,t,n){if("string"==typeof e)return e;if(Wi(e))return"html"===t?e.outerHTML:e.textContent||"";if(e===n.me&&Wi(n.me)){const e=n.me;return"html"===t?e.outerHTML:e.textContent||""}return e+""}copyUsingExecCommand(e){if("undefined"==typeof document)return 0;const t=document.createElement("textarea");t.value=e,t.style.cssText="position:fixed;top:0;left:-9999px",t.setAttribute("readonly",""),document.body.appendChild(t);try{t.select(),t.setSelectionRange(0,e.length);const n=document.execCommand("copy");return document.body.removeChild(t),n}catch{return t.parentNode?.removeChild(t),0}}dispatchCopyEvent(e,t,n){if(Wi(e.me)){const r=new CustomEvent(t,{detail:n,bubbles:1,cancelable:0});e.me.dispatchEvent(r)}}},Di(t,"CopyCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})();const vl=Gi(hl),gl=Gi((()=>{let e,t,n=[Ui({description:"Select from a collection (first/last/random/range/regex match)",syntax:["pick first <count> of <expr>","pick last <count> of <expr>","pick random [<count>] of <expr>","pick items <i> to <j> of <expr>","pick match of <regex> from <expr>","pick from <array>","pick <item1>, <item2>, ..."],examples:["pick first 3 of items","pick last 2 of items","pick random 2 of items","pick items 1 to 3 of items",'pick match of "[0-9]+" from text',"pick from colors",'pick "red", "green", "blue"'],sideEffects:["random-selection"]}),Bi({name:"pick",category:"utility"})],r=[];return t=class{async parseInput(e,t,n){const r=e.modifiers?.variant,i=r?.value;if("first"===i||"last"===i){const r=await t.evaluate(e.args[0],n),a=await t.evaluate(e.modifiers.count,n);if(!Array.isArray(r))throw Error(`pick ${i}: source must be an array, got ${typeof r}`);if("number"!=typeof a||!Number.isFinite(a))throw Error(`pick ${i}: count must be a number, got ${typeof a}`);return{variant:i,array:r,count:a}}if("random"===i){const r=await t.evaluate(e.args[0],n);if(!Array.isArray(r))throw Error("pick random: source must be an array");let i;if(e.modifiers.count){const r=await t.evaluate(e.modifiers.count,n);if("number"!=typeof r||!Number.isFinite(r))throw Error("pick random: count must be a number, got "+typeof r);i=r}return{variant:"random",array:r,count:i}}if("range"===i){const r=await t.evaluate(e.args[0],n);if(!Array.isArray(r)&&"string"!=typeof r)throw Error("pick items: source must be an array or string");const i=e.modifiers.rangeStart,a="start"===i?.value?"start":await t.evaluate(e.modifiers.rangeStart,n),o="start"===a?"start":Number(a);let s;if(e.modifiers.rangeEnd)if("end"===e.modifiers.rangeEnd.value)s="end";else{const r=await t.evaluate(e.modifiers.rangeEnd,n);s=Number(r)}const l=e.modifiers.rangeMode;return{variant:"range",array:r,rangeStart:o,rangeEnd:s,rangeMode:l?.value??"default"}}if("match"===i||"matches"===i){const r=await t.evaluate(e.args[0],n);if("string"!=typeof r)throw Error(`pick ${i}: source must be a string, got ${typeof r}`);const a=await t.evaluate(e.modifiers.regex,n),o="string"==typeof a?a:a+"",s=e.modifiers.flags,l=s?.value;return{variant:i,source:r,regex:o,flags:l}}if(e.modifiers?.from){const r=await t.evaluate(e.modifiers.from,n);if(!Array.isArray(r))throw Error("pick from requires an array");if(0===r.length)throw Error("Cannot pick from empty array");return{variant:"random",array:r}}if(0===e.args.length)throw Error("pick command requires items to choose from");return{variant:"random",items:await Promise.all(e.args.map(e=>t.evaluate(e,n)))}}async execute(e,t){const n=e.variant??"random";if("first"===n){const n=e.array??[],r=n.slice(0,e.count??0);return Object.assign(t,{it:r}),{selectedItem:r,sourceLength:n.length,sourceType:"array",variant:"first"}}if("last"===n){const n=e.array??[],r=e.count??0,i=r>0?n.slice(-r):[];return Object.assign(t,{it:i}),{selectedItem:i,sourceLength:n.length,sourceType:"array",variant:"last"}}if("range"===n){const n=e.array??[];let r="start"===e.rangeStart?0:e.rangeStart??0,i=void 0===e.rangeEnd?r+1:"end"===e.rangeEnd?n.length:e.rangeEnd;"inclusive"===e.rangeMode?i++:"exclusive"===e.rangeMode&&r++;const a=n.slice(r,i);return Object.assign(t,{it:a}),{selectedItem:a,sourceLength:n.length,sourceType:"array",variant:"range"}}if("match"===n){const n=e.source??"",r=RegExp(e.regex??"",e.flags).exec(n);return Object.assign(t,{it:r}),{selectedItem:r,sourceLength:n.length,sourceType:"string",variant:"match"}}if("matches"===n){const n=e.source??"",r=e.flags??"g",i=RegExp(e.regex??"",r.includes("g")?r:"g"+r),a=Array.from(n.matchAll(i));return Object.assign(t,{it:a}),{selectedItem:a,sourceLength:n.length,sourceType:"string",variant:"matches"}}const r=e.items??e.array??[];if(0===r.length)throw Error("Cannot pick from empty collection");if(void 0===e.count){const n=Math.floor(Math.random()*r.length),i=r[n];return Object.assign(t,{it:i}),{selectedItem:i,selectedIndex:n,sourceLength:r.length,sourceType:e.items?"items":"array",variant:"random"}}const i=r.slice(),a=[];for(let t=0;e.count>t&&i.length>0;t++){const e=Math.floor(Math.random()*i.length);a.push(i.splice(e,1)[0])}return Object.assign(t,{it:a}),{selectedItem:a,sourceLength:r.length,sourceType:e.items?"items":"array",variant:"random"}}},Di(t,"PickCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),bl=Gi((()=>{let e,t,n=[Ui({description:"Throw an error with a specified message",syntax:["throw <message>"],examples:['throw "Invalid input"','if not valid then throw "Validation failed"'],sideEffects:["error-throwing","execution-termination"]}),Bi({name:"throw",category:"control-flow"})],r=[];return t=class{async parseInput(e,t,n){if(1>e.args.length)throw Error("throw command requires a message or error object");return{message:await t.evaluate(e.args[0],n)}}async execute(e,t){const{message:n}=e;let r;throw r=n instanceof Error?n:Error("string"==typeof n?n:n+""),r}},Di(t,"ThrowCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),wl=Gi((()=>{let e,t,n=[Ui({description:"Debug output for expressions with type information",syntax:["beep!","beep! <expression>","beep! <expression>, <expression>, ..."],examples:["beep!","beep! myValue","beep! me.id, me.className"],sideEffects:["console-output","debugging"]}),Bi({name:"beep",category:"utility"})],r=[];return t=class{async parseInput(e,t,n){return 0===e.args.length?{expressions:[]}:{expressions:await Promise.all(e.args.map(e=>t.evaluate(e,n)))}}async execute(e,t){const n=e.expressions||[];if(0===n.length)return this.debugContext(t),{expressionCount:0,debugged:1,outputs:[]};const r=[];console.group("🔔 beep! Debug Output");for(const e of n){const t=this.debugExpression(e);r.push(t),console.log("Value:",e),console.log("Type:",t.type),console.log("Representation:",t.representation),console.log("---")}return console.groupEnd(),{expressionCount:n.length,debugged:1,outputs:r}}debugContext(e){console.group("🔔 beep! Context Debug"),console.log("me:",e.me),console.log("it:",e.it),console.log("you:",e.you),console.log("locals:",e.locals),console.log("globals:",e.globals),console.log("variables:",e.variables),console.groupEnd()}debugExpression(e){return{value:e,type:this.getType(e),representation:this.getRepresentation(e)}}getType(e){return null===e?"null":void 0===e?"undefined":Array.isArray(e)?"array":Wi(e)?"HTMLElement":e instanceof Element?"Element":e instanceof Node?"Node":e instanceof Error?"Error":e instanceof Date?"Date":e instanceof RegExp?"RegExp":typeof e}getRepresentation(e){if(null===e)return"null";if(void 0===e)return"undefined";if(Array.isArray(e))return`Array(${e.length}) [${e.slice(0,3).map(e=>this.getRepresentation(e)).join(", ")}${e.length>3?"...":""}]`;if(Wi(e)){const t=e;return`<${t.tagName.toLowerCase()}${t.id?"#"+t.id:""}${t.className?"."+t.className.split(" ").join("."):""}/>`}if(e instanceof Error)return"Error: "+e.message;if("string"==typeof e)return e.length>50?`"${e.substring(0,47)}..."`:`"${e}"`;if("object"==typeof e)try{const t=Object.keys(e);return`Object {${t.slice(0,3).join(", ")}${t.length>3?"...":""}}`}catch{return"[Object]"}return e+""}},Di(t,"BeepCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})()),kl=Gi((()=>{let e,t,n=[Ui({description:"Drop into the debugger (emits a debugger; statement)",syntax:["breakpoint"],examples:["breakpoint","on click breakpoint"],sideEffects:["debugging"]}),Bi({name:"breakpoint",category:"utility"})],r=[];return t=class{async parseInput(e,t,n){return{}}async execute(e,t){}validate(e){return"object"==typeof e&&null!==e}},Di(t,"BreakpointCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})());class zl{constructor(){this.name="install"}get metadata(){return zl.metadata}async parseInput(e,t,n){if(1>e.args.length)throw Error("install command requires a behavior name");const r=e.args[0];let i,a,o;if(i="identifier"===r?.type&&"string"==typeof r.name?r.name:await t.evaluate(r,n)+"",!/^[A-Z][a-zA-Z0-9_]*$/.test(i))throw Error(`Behavior name must be PascalCase (start with uppercase): "${i}"`);if(e.args.length>=2){const r=await t.evaluate(e.args[1],n);if(r&&"object"==typeof r&&!Array.isArray(r)){a=r;for(const e of Object.keys(a))if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e))throw Error(`Invalid parameter name: "${e}"`)}}return e.modifiers?.on&&(o=await t.evaluate(e.modifiers.on,n)),{behaviorName:i,parameters:a,target:o}}async execute(e,t){const{behaviorName:n,parameters:r={},target:i}=e;try{const e=this.resolveTarget(i,t);if(0===e.length)throw Error("No target elements found to install behavior on");if(!this.behaviorExists(n,t))throw Error(`Behavior "${n}" is not defined. Define it using the 'behavior' keyword before installing.`);const a=[];for(const i of e){const e=await this.installBehavior(n,i,r,t);a.push(e)}return{success:1,behaviorName:n,installedCount:a.length,instances:a}}catch(e){throw Error(`Failed to install behavior "${n}": ${e instanceof Error?e.message:e+""}`)}}resolveTarget(e,t){if(null==e){const e=t.me||t.locals.get("me");if(Wi(e))return[e];throw Error('No target specified and "me" is not available in context')}if(Wi(e))return[e];if(Array.isArray(e)){const t=e.filter(e=>Wi(e));if(0===t.length)throw Error("Target array contains no valid HTMLElements");return t}if("string"==typeof e){if("me"===e){const e=t.me||t.locals.get("me");if(Wi(e))return[e];throw Error('"me" is not available in context')}if("undefined"!=typeof document){const t=document.querySelectorAll(e),n=Array.from(t).filter(e=>Wi(e));if(0===n.length)throw Error(`No elements found matching selector: "${e}"`);return n}throw Error("document is not available (not in browser environment)")}if(e&&"object"==typeof e&&"length"in e){const t=Array.from(e).filter(e=>Wi(e));if(0===t.length)throw Error("Target collection contains no valid HTMLElements");return t}if("object"==typeof e&&"element"in e){const t=e.element;if(Wi(t))return[t]}throw Error("Cannot resolve target to HTMLElement(s): "+e)}behaviorExists(e,t){const n=t.locals.get("_behaviors");if(n&&"object"==typeof n){const t=n;if(t.has(e))return 1;if(t.resolve&&t.resolve(e))return 1}if("undefined"!=typeof globalThis){const t=globalThis.l;if(t?.behaviors){if(t.behaviors.has(e))return 1;if(t.behaviors.resolve&&t.behaviors.resolve(e))return 1}}return 0}async installBehavior(e,t,n,r){const i=r.locals.get("_behaviors");if(i&&"object"==typeof i){const r=i;if(r.install&&"function"==typeof r.install)return await r.install(e,t,n)}if("undefined"!=typeof globalThis){const r=globalThis.l;if(r?.behaviors?.install)return await r.behaviors.install(e,t,n)}throw Error("Behavior system not available in context")}}zl.metadata={description:"Install a behavior on an element with optional parameters",syntax:["install <BehaviorName>","install <BehaviorName> on <element>","install <BehaviorName>(param: value)","install <BehaviorName>(param: value) on <element>"],examples:["install Removable","install Draggable on #box",'install Tooltip(text: "Help", position: "top")','install Sortable(axis: "y") on .list',"install MyBehavior(foo: 42) on the first <div/>"],category:"behaviors",sideEffects:["behavior-installation","element-modification"]};const xl=Gi((()=>{let e,t,n=[Ui({description:"Move classes, attributes, and properties from one element to another",syntax:["take <property> from <source>","take <property> from <source> and put it on <target>"],examples:["take class from <#source/>","take @data-value from <.source/> and put it on <#target/>"],sideEffects:["dom-mutation","property-transfer"]}),Bi({name:"take",category:"animation"})],r=[];return t=class{async parseInput(e,t,n){if(3>e.args.length)throw Error('take requires property, "from", and source');const r=await t.evaluate(e.args[0],n)+"";if("from"!==await t.evaluate(e.args[1],n))throw Error("take syntax: take <property> from <source>");const i=await t.evaluate(e.args[2],n);let a;if(8>e.args.length)e.args.length>3&&(a=await t.evaluate(e.args[3],n));else{const r=await Promise.all([3,4,5,6].map(r=>t.evaluate(e.args[r],n)));"and"===r[0]&&"put"===r[1]&&"it"===r[2]&&"on"===r[3]&&e.args[7]&&(a=await t.evaluate(e.args[7],n))}return!a&&e.modifiers?.on&&(a=await t.evaluate(e.modifiers.on,n)),{property:r,source:i,target:a}}async execute(e,t){const n=Ji(e.source,t,"take"),r=Ji(e.target?e.target:void 0,t,"take"),i=this.takeProperty(n,e.property);return this.putProperty(r,e.property,i),{targetElement:r,property:e.property,value:i}}takeProperty(e,t){const n=t.trim(),r=n.toLowerCase();if("class"===r||"classes"===r){const t=Array.from(e.classList);return e.className="",t}if(n.startsWith(".")){const t=n.substring(1);return e.classList.contains(t)?(e.classList.remove(t),t):null}if(n.startsWith("@")){const t=n.substring(1),r=e.getAttribute(t);return e.removeAttribute(t),r}if(n.startsWith("data-")){const t=e.getAttribute(n);return e.removeAttribute(n),t}if("id"===r){const t=e.id;return e.id="",t}if("title"===r){const t=e.title;return e.title="",t}if("value"===r&&"value"in e){const t=e.value;return e.value="",t}const i=n.replace(/-([a-z])/g,(e,t)=>t.toUpperCase());if(n.includes("-")||i in e.style||n in e.style){let t;return i in e.style?(t=e.style[i],e.style[i]=""):n in e.style?(t=e.style[n],e.style[n]=""):(t=e.style.getPropertyValue(n),e.style.removeProperty(n)),t}const a=e.getAttribute(t);return null!==a?(e.removeAttribute(t),a):null}putProperty(e,t,n){if(null==n)return;const r=t.trim(),i=r.toLowerCase();if("class"===i||"classes"===i)return void(Array.isArray(n)?n.forEach(t=>t&&"string"==typeof t&&e.classList.add(t)):"string"==typeof n&&(e.className=n));if(r.startsWith("."))return void(n&&e.classList.add(r.substring(1)));if(r.startsWith("@"))return void e.setAttribute(r.substring(1),n+"");if(r.startsWith("data-"))return void e.setAttribute(r,n+"");if("id"===i)return void(e.id=n+"");if("title"===i)return void(e.title=n+"");if("value"===i&&"value"in e)return void(e.value=n+"");const a=r.replace(/-([a-z])/g,(e,t)=>t.toUpperCase());r.includes("-")||a in e.style||r in e.style?a in e.style?e.style[a]=n+"":r in e.style?e.style[r]=n+"":e.style.setProperty(r,n+""):e.setAttribute(t,n+"")}},Di(t,"TakeCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;qi(null,e={value:t},n,{kind:"class",name:t.name,metadata:i},null,r),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:1,configurable:1,writable:1,value:i}),_i(t,r)})(),t})());class El{constructor(){this.name="render"}get metadata(){return El.metadata}async parseInput(e,t,n){if(1>e.args.length)throw Error("render command requires a template");const r=await t.evaluate(e.args[0],n);let i;if(e.args.length>=3&&"with"===await t.evaluate(e.args[1],n)){const r=await t.evaluate(e.args[2],n);r&&"object"==typeof r&&(i=r)}if(!i&&e.modifiers?.with){const r=await t.evaluate(e.modifiers.with,n);r&&"object"==typeof r&&(i=r)}return{template:r,variables:i}}async execute(e,t){const{template:n,variables:r={}}=e,i=this.extractTemplateContent(n,t),a=this.createTemplateContext(t,r),o=[],s=await this.processTemplate(i,a,o),l=this.createDOMElement(s);return Object.assign(t,{it:l}),{element:l,rendered:s,directivesProcessed:o}}extractTemplateContent(e,t){if(e instanceof HTMLTemplateElement)return e.innerHTML;if("string"==typeof e){let n=e;if(!n.includes("<")&&!n.includes("$")){const e=this.resolveVariable(n,t);if(e instanceof HTMLTemplateElement)return e.innerHTML;"string"==typeof e&&(n=e)}const r=n.match(/<template[^>]*>([\s\S]*?)<\/template>/i);return r?r[1]:n}if(e&&"object"==typeof e&&"innerHTML"in e)return e.innerHTML;throw Error("Invalid template format")}createTemplateContext(e,t){return{...e,locals:new Map([...Array.from(e.locals.entries()),...Object.entries(t)])}}async processTemplate(e,t,n){const r=e.split("\n"),i=[];let a=0;for(;r.length>a;){const e=r[a].trim();if(e.startsWith("@repeat ")){const{nextIndex:e,rendered:o}=await this.processRepeatDirective(r,a,t);i.push(o),a=e,n.push("@repeat")}else if(e.startsWith("@if ")){const{nextIndex:e,rendered:o}=await this.processIfDirective(r,a,t,n);i.push(o),a=e,n.push("@if")}else if("@else"===e||"@end"===e)a++;else{const n=this.processVariableInterpolation(e,t);i.push(n),a++}}return i.join("\n")}async processRepeatDirective(e,t,n){const r=e[t].trim(),i=r.match(/^@repeat\s+in\s+(.+)$/);if(!i)throw Error("Invalid @repeat syntax: "+r);const a=this.evaluateExpression(i[1],n),{endIndex:o,blockContent:s}=this.extractDirectiveBlock(e,t+1),l=[];if(Array.isArray(a))for(const e of a){const t={...n,locals:new Map([...n.locals.entries(),["it",e]])},r=await this.processTemplate(s.join("\n"),t,[]);l.push(r)}return{nextIndex:o+1,rendered:l.join("\n")}}async processIfDirective(e,t,n,r){const i=e[t].trim(),a=i.match(/^@if\s+(.+)$/);if(!a)throw Error("Invalid @if syntax: "+i);const o=!!this.evaluateExpression(a[1],n),{endIndex:s,blockContent:l,elseContent:c}=this.extractIfElseBlock(e,t+1);let u="";return o?u=await this.processTemplate(l.join("\n"),n,[]):c.length>0&&(u=await this.processTemplate(c.join("\n"),n,[]),r.push("@else")),{nextIndex:s+1,rendered:u}}extractDirectiveBlock(e,t){const n=[];let r=1,i=t;for(;e.length>i&&r>0;){const t=e[i].trim();t.startsWith("@repeat ")||t.startsWith("@if ")?(r++,n.push(e[i])):"@end"===t?(r--,r>0&&n.push(e[i])):n.push(e[i]),i++}return{endIndex:i-1,blockContent:n}}extractIfElseBlock(e,t){const n=[],r=[];let i=1,a=t,o=0;for(;e.length>a&&i>0;){const t=e[a].trim();if(t.startsWith("@if "))i++;else{if("@else"===t&&1===i){o=1,a++;continue}if("@end"===t&&(i--,0===i))break}o?r.push(e[a]):n.push(e[a]),a++}return{endIndex:a,blockContent:n,elseContent:r}}processVariableInterpolation(e,t){return e.replace(/\$\{([^}]+)\}/g,(e,n)=>{try{const e=n.trim();if(e.startsWith("unescaped ")){const n=e.substring(10).trim();return(this.evaluateExpression(n,t)||"")+""}const r=this.evaluateExpression(e,t);return this.escapeHtml((r||"")+"")}catch(t){return Ye.command(`render: template interpolation error for ${n}:`,t),e}})}evaluateExpression(e,t){if("true"===e)return 1;if("false"===e)return 0;if("null"===e)return null;if("undefined"===e)return;const n=Number(e);if(!isNaN(n)&&""!==e.trim())return n;if(e.startsWith("[")&&e.endsWith("]"))try{return JSON.parse(e)}catch{}if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1);if(e.includes(".")){const n=e.split(".");let r=this.resolveVariable(n[0],t);for(let e=1;n.length>e&&null!=r;e++){if("object"!=typeof r||null===r)return;r=r[n[e]]}return r}return this.resolveVariable(e,t)}resolveVariable(e,t){return t.locals?.has(e)?t.locals.get(e):"me"===e?t.me:"it"===e?t.it:"you"===e?t.you:"result"===e?t.result:t.globals?.has(e)?t.globals.get(e):void 0}escapeHtml(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}createDOMElement(e){if("undefined"==typeof document)return null;const t=document.createElement("div");return t.innerHTML=e,1===t.children.length?t.firstElementChild:t}}El.metadata={description:"Render templates with @if, @else, and @repeat directives",syntax:["render <template>","render <template> with <variables>","render <template> with (key: value, ...)"],examples:["render myTemplate",'render myTemplate with (name: "Alice")','render "<template>Hello ${name}!</template>" with (name: "World")',"render template with (items: data)"],category:"templates",sideEffects:["dom-creation","template-execution"]};class Sl extends Bn{constructor(e={}){const t=e.registry||new $n;e.registry||(t.register(ra()),t.register(aa()),t.register(xa()),t.register(Ta()),t.register(Ka()),t.register(Za()),t.register(to()),t.register(no()),t.register(ao()),t.register(so()),t.register(co()),t.register(po()),t.register(Fo()),t.register(Bo()),t.register(fs()),t.register(gs()),t.register(zs()),t.register(xs()),t.register(Es()),t.register(Ts()),t.register(js()),t.register(Ls()),t.register(Os()),t.register(Ns()),t.register(Ps()),t.register($s()),t.register(_s()),t.register(Ds()),t.register(Vs()),t.register(Bs()),t.register(Ws()),t.register(Zs()),t.register(Xs()),t.register(Qs()),t.register(el()),t.register(nl()),t.register(rl()),t.register(ol()),t.register(il()),t.register(al()),t.register(sl()),t.register(ll()),t.register(cl()),t.register(ul()),t.register(pl()),t.register(ml()),t.register(Us()),t.register(dl()),t.register(new fl),t.register(yl()),t.register(vl()),t.register(gl()),t.register(bl()),t.register(wl()),t.register(kl()),t.register(new zl),t.register(xl()),t.register(new El));const n={registry:t,expressionRegistry:e.expressionRegistry??Ii()};void 0!==e.enableAsyncCommands&&(n.enableAsyncCommands=e.enableAsyncCommands),void 0!==e.commandTimeout&&(n.commandTimeout=e.commandTimeout),void 0!==e.enableErrorReporting&&(n.enableErrorReporting=e.enableErrorReporting),super(n)}getRegistry(){return this.registry}}function Tl(e,t){return t?{type:"literal",value:e,dataType:t}:{type:"literal",value:e}}function jl(e,t){return t?{type:"selector",value:e,selectorKind:t}:{type:"selector",value:e}}function Al(e){return{type:"reference",value:e}}function Ll(e,t){return{type:"property-path",object:e,property:t}}function Ol(e){return{type:"expression",raw:e}}function Cl(e,t=1){return{type:"flag",name:e,enabled:t}}function Nl(e,t,n){const r={kind:"command",action:e,roles:t instanceof Map?t:new Map(Object.entries(t))};return n?{...r,metadata:n}:r}function Pl(e,t,n,r,i){return{kind:"event-handler",action:e,roles:t instanceof Map?t:new Map(Object.entries(t)),body:n,...i&&{eventModifiers:i},...r&&{metadata:r}}}function Rl(e,t,n,r,i){return{kind:"conditional",action:e,roles:t instanceof Map?t:new Map(Object.entries(t)),thenBranch:n,...r&&{elseBranch:r},...i&&{metadata:i}}}function $l(e,t="sequential",n){const r={kind:"compound",action:"compound",roles:new Map,statements:e,chainType:t};return n?{...r,metadata:n}:r}function Il(e,t,n,r,i,a,o){return{kind:"loop",action:e,roles:t instanceof Map?t:new Map(Object.entries(t)),loopVariant:n,body:r,...i&&{loopVariable:i},...a&&{indexVariable:a},...o&&{metadata:o}}}function Ml(e,t,n,r){return{kind:"command",action:"try",roles:new Map,body:e,...t&&t.length>0?{catchBranch:t}:{},...n&&n.length>0?{finallyBranch:n}:{},...r?{metadata:r}:{}}}function ql(e,t,n){return{kind:"command",action:e,roles:new Map,asyncVariant:e,asyncBody:t,...n?{metadata:n}:{}}}function _l(e,t,n,r){return{kind:"command",action:"match",roles:e instanceof Map?e:new Map(Object.entries(e)),arms:t,...n&&n.length>0?{defaultArm:n}:{},...r?{metadata:r}:{}}}function Dl(e){return"flag"===e.type?e.name:"raw"in e&&void 0!==e.raw?e.raw+"":"value"in e&&void 0!==e.value?e.value+"":"property-path"===e.type?`${Dl(e.object)}.${e.property}`:""}function Vl(e,t){const n=e.roles.get(t);return n?Dl(n):""}var Hl=new Set(["me","you","it","result","event","target","body"]);function Fl(e,t=Hl){return t.has(e)}var Bl=new Set(["body","then","else","condition","loop-body","variable","catch","finally"]);function Ul(e){const t=e.slice(1,-1);let n=0;for(const e of t)if("["===e)n++;else if("]"===e)n--;else if(0===n&&(" "===e||":"===e))return 1;return 0}function Gl(e,t={}){const n=e.trim(),r=1==t.collectDiagnostics,i=[];if(!n.startsWith("[")||!n.endsWith("]"))throw Error("Explicit syntax must be wrapped in brackets: [command role:value ...]");const a=n.slice(1,-1).trim();if(!a)throw Error("Empty explicit statement");const o=function(e){const t=[];let n="",r=0,i="",a=0;for(let o=0;e.length>o;o++){const s=e[o];r?(n+=s,s===i&&"\\"!==e[o-1]&&(r=0)):'"'!==s&&"'"!==s?"["!==s?"]"!==s?" "!==s||0!==a?n+=s:n&&(t.push(n),n=""):(a--,n+=s):(a++,n+=s):(r=1,i=s,n+=s)}return n&&t.push(n),t}(a);if(0===o.length)throw Error("No command specified in explicit statement");const s=o[0].toLowerCase(),l=new Map,c=t.referenceSet??Hl,u=t.schemaLookup?.getSchema(s),p=u?new Set(u.roles.map(e=>e.role)):null;for(let e=1;o.length>e;e++){const t=o[e];if(t.startsWith("+")||t.startsWith("~")){const e=t.startsWith("+"),n=t.slice(1);if(!n){if(r){i.push({severity:"error",code:"EMPTY_FLAG",message:`Empty flag name: "${t}"`,source:"schema"});continue}throw Error(`Empty flag name: "${t}"`)}if(p&&!p.has(n)){if(r){i.push({severity:"error",code:"UNKNOWN_FLAG",message:`Unknown flag "${n}" for command "${s}"`,source:"schema",suggestions:[...p].map(e=>"+"+e)}),l.set(n,Cl(n,e));continue}throw Error(`Unknown flag "${n}" for command "${s}". Valid roles: ${[...p].join(", ")}`)}l.set(n,Cl(n,e));continue}const n=t.indexOf(":");if(-1===n){if(r){i.push({severity:"error",code:"INVALID_ROLE_FORMAT",message:`Invalid role format: "${t}". Expected role:value or +flag`,source:"schema"});continue}throw Error(`Invalid role format: "${t}". Expected role:value or +flag`)}const a=t.slice(0,n);if(p&&!Bl.has(a)&&!p.has(a)){if(!r)throw Error(`Unknown role "${a}" for command "${s}". Valid roles: ${[...p].join(", ")}`);i.push({severity:"error",code:"UNKNOWN_ROLE",message:`Unknown role "${a}" for command "${s}"`,source:"schema",suggestions:[...p]})}const u=a,m=t.slice(n+1);if(Bl.has(a)&&m.startsWith("[")&&Ul(m)){const e=ec(t,n+1),r=t.slice(n+1,e+1);l.set(u,{type:"expression",raw:r});continue}const d=Ql(m,c);l.set(u,d)}if(u&&"on"!==s)for(const e of u.roles)if(e.required&&!l.has(e.role)&&!e.default){if(!r)throw Error(`Missing required role "${e.role}" for command "${s}": ${e.description}`);i.push({severity:"error",code:"MISSING_REQUIRED_ROLE",message:`Missing required role "${e.role}" for command "${s}": ${e.description}`,source:"schema"})}const m=e=>0===i.length?e:{...e,diagnostics:i};switch(s){case"on":{if(!l.get("event")){if(r)return i.push({severity:"error",code:"MISSING_EVENT_ROLE",message:"Event handler requires event role: [on event:click ...]",source:"schema"}),m(Pl("on",l,[],{sourceLanguage:"explicit"}));throw Error("Event handler requires event role: [on event:click ...]")}const e=Xl(l,"body",t);return l.delete("body"),m(Pl("on",l,e,{sourceLanguage:"explicit"}))}case"if":{const e=Xl(l,"then",t),n=Xl(l,"else",t);return l.delete("then"),l.delete("else"),m(Rl(s,l,e,n.length>0?n:void 0,{sourceLanguage:"explicit"}))}case"repeat":{const e=Xl(l,"loop-body",t),n=l.get("loop-variant"),r=l.get("variable"),i=l.get("index-variable");let a;return l.delete("loop-body"),l.delete("loop-variant"),l.delete("variable"),l.delete("index-variable"),a=n&&"literal"===n.type&&"string"==typeof n.value?n.value:l.has("quantity")?"times":l.has("source")?"for":l.has("condition")?"while":"forever",m(Il(s,l,a,e,"literal"===r?.type&&"string"==typeof r.value?r.value:"expression"===r?.type?r.raw:void 0,"literal"===i?.type&&"string"==typeof i.value?i.value:void 0,{sourceLanguage:"explicit"}))}default:return m(Nl(s,l,{sourceLanguage:"explicit"}))}}function Wl(e){const t=e.trim();return t.startsWith("[")&&t.endsWith("]")}var Kl=new Set(["then","and","async","sequential"]);function Jl(e){const t=[];let n=null,r="",i=0,a=0,o="";for(let s=0;e.length>s;s++){const l=e[s];if(a)r+=l,l===o&&"\\"!==e[s-1]&&(a=0);else if('"'!==l&&"'"!==l)if("["!==l){if("]"!==l)r+=l;else if(i--,r+=l,0===i){const i=e.slice(s+1),a=i.match(/^\s*\|>\s*/);if(a){t.push(r.trim()),r="",n??(n="pipe"),s+=a[0].length;continue}const o=i.match(/^\s+(then|and|async|sequential)\s+/);if(o&&Kl.has(o[1])){t.push(r.trim()),r="",n??(n=o[1]),s+=o[0].length;continue}}}else i++,r+=l;else a=1,o=l,r+=l}return r.trim()&&t.push(r.trim()),{segments:t,chainType:n}}function Zl(e,t){const n=e.trim(),{annotations:r,remainder:i}=function(e){const t=[];let n=0;for(;e.length>n;){for(;e.length>n&&(" "===e[n]||"\t"===e[n]);)n++;if(n>=e.length||"@"!==e[n])break;n++;const r=n;for(;e.length>n&&/[A-Za-z0-9\-_]/.test(e[n]);)n++;const i=e.slice(r,n);if(!i)break;let a;if(e.length>n&&"("===e[n]){n++;const t=n;if(n>=e.length||'"'!==e[n]&&"'"!==e[n]){for(;e.length>n&&")"!==e[n];)n++;a=e.slice(t,n)}else{const r=e[n];for(n++;e.length>n&&e[n]!==r;)"\\"===e[n]&&n++,n++;n++,a=e.slice(t+1,n-1)}e.length>n&&")"===e[n]&&n++}t.push(void 0!==a?{name:i,value:a}:{name:i})}return{annotations:t,remainder:e.slice(n).trim()}}(n),{segments:a,chainType:o}=Jl(i);let s;return s=a.length>1?$l(a.map(e=>Gl(e,t)),o??"sequential"):Gl(a[0]||i,t),r.length>0?{...s,annotations:r}:s}var Yl=/^#!lse\s+(\d+\.\d+(?:\.\d+)?)\s*$/;function Xl(e,t,n){const r=e.get(t);return r&&"expression"===r.type?[Gl(r.raw,n)]:[]}function Ql(e,t){if(e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("@")||e.startsWith("*"))return jl(e,function(e){if(e)return e.startsWith("#")?"id":e.startsWith(".")?"class":e.startsWith("[")?"attribute":e.startsWith("<")||e.startsWith("*")?"element":/[>+~ ]/.test(e)&&e.length>1?"complex":void 0}(e));if(e.startsWith('"')||e.startsWith("'"))return Tl(e.slice(1,-1),"string");if("true"===e)return Tl(1,"boolean");if("false"===e)return Tl(0,"boolean");const n=e.toLowerCase();if(Fl(n,t))return Al(n);const r=e.match(/^(-?\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(r){const t=parseFloat(r[1]);return r[2]?Tl(e,"duration"):Tl(t,"number")}return Tl(e)}function ec(e,t){let n=0;for(let r=t;e.length>r;r++)if("["===e[r])n++;else if("]"===e[r]&&(n--,0===n))return r;return e.length-1}function tc(e){let t;if("compound"===e.kind){const n=e;t=n.statements.map(e=>tc(e)).join(` ${n.chainType} `)}else t=function(e){const t=[e.action];for(const[n,r]of e.roles)t.push("flag"===r.type?r.enabled?"+"+r.name:"~"+r.name:`${n}:${nc(r)}`);if("event-handler"===e.kind&&e.body&&e.body.length>0&&t.push("body:"+e.body.map(e=>tc(e)).join(" ")),"conditional"===e.kind){const n=e;n.thenBranch&&n.thenBranch.length>0&&t.push("then:"+n.thenBranch.map(e=>tc(e)).join(" ")),n.elseBranch&&n.elseBranch.length>0&&t.push("else:"+n.elseBranch.map(e=>tc(e)).join(" "))}if("loop"===e.kind){const n=e;n.loopVariant&&t.push("loop-variant:"+n.loopVariant),n.loopVariable&&t.push("variable:"+n.loopVariable),n.indexVariable&&t.push("index-variable:"+n.indexVariable),n.body&&n.body.length>0&&t.push("loop-body:"+n.body.map(e=>tc(e)).join(" "))}if("command"===e.kind){const n=e;n.body&&n.body.length>0&&t.push("body:"+n.body.map(e=>tc(e)).join(" ")),n.catchBranch&&n.catchBranch.length>0&&t.push("catch:"+n.catchBranch.map(e=>tc(e)).join(" ")),n.finallyBranch&&n.finallyBranch.length>0&&t.push("finally:"+n.finallyBranch.map(e=>tc(e)).join(" ")),n.asyncVariant&&t.push("async-variant:"+n.asyncVariant),n.asyncBody&&n.asyncBody.length>0&&t.push("async-body:"+n.asyncBody.map(e=>tc(e)).join(" "))}return`[${t.join(" ")}]`}(e);return e.annotations&&e.annotations.length>0?e.annotations.map(e=>void 0!==e.value?`@${e.name}(${e.value})`:"@"+e.name).join(" ")+" "+t:t}function nc(e){switch(e.type){case"literal":return"string"==typeof e.value?"string"===e.dataType||/\s/.test(e.value)?`"${e.value}"`:e.value:e.value+"";case"selector":case"reference":return e.value;case"property-path":return`${nc(e.object)}'s ${e.property}`;case"expression":return e.raw;case"flag":return e.name}}function rc(e){const t=ic(e.roles);let n;switch(e.kind){case"command":{const r=e;n={kind:"command",action:e.action,roles:t},r.body&&r.body.length>0&&(n.body=r.body.map(rc)),r.catchBranch&&r.catchBranch.length>0&&(n.catchBranch=r.catchBranch.map(rc)),r.finallyBranch&&r.finallyBranch.length>0&&(n.finallyBranch=r.finallyBranch.map(rc)),r.asyncVariant&&(n.asyncVariant=r.asyncVariant),r.asyncBody&&r.asyncBody.length>0&&(n.asyncBody=r.asyncBody.map(rc)),r.arms&&r.arms.length>0&&(n.arms=r.arms.map(e=>({pattern:ac(e.pattern),body:e.body.map(rc)}))),r.defaultArm&&r.defaultArm.length>0&&(n.defaultArm=r.defaultArm.map(rc));break}case"event-handler":{const r=e;if(function(e){if(!e.body||1!==e.body.length)return 0;const t=e.body[0];if("command"!==t.kind)return 0;const n=t;if(n.body&&n.body.length>0)return 0;if(n.catchBranch&&n.catchBranch.length>0)return 0;if(n.finallyBranch&&n.finallyBranch.length>0)return 0;if(n.asyncVariant)return 0;if(n.asyncBody&&n.asyncBody.length>0)return 0;if(n.arms&&n.arms.length>0)return 0;if(n.defaultArm&&n.defaultArm.length>0)return 0;const r=e.roles.get("event");return r&&"literal"===r.type?"string"!=typeof r.value||n.roles.has("event")||e.additionalEvents&&e.additionalEvents.length>0||e.parameterNames&&e.parameterNames.length>0||e.annotations&&e.annotations.length>0||e.diagnostics&&e.diagnostics.length>0||n.annotations&&n.annotations.length>0||n.diagnostics&&n.diagnostics.length>0?0:1:0}(r)){const e=r.body[0],t={event:r.roles.get("event").value},i=function(e){if(!e)return;const t={};return e.once&&(t.once=1),"number"==typeof e.debounce&&(t.debounce=e.debounce),"number"==typeof e.throttle&&(t.throttle=e.throttle),e.queue&&(t.queue=e.queue),Object.keys(t).length>0?t:void 0}(r.eventModifiers);i&&(t.modifiers=i),n={action:e.action,roles:ic(e.roles),trigger:t};break}n={kind:"event-handler",action:e.action,roles:t,body:r.body.map(rc)};break}case"compound":{const t=e;n={kind:"compound",action:"compound",statements:t.statements.map(rc),chainType:t.chainType};break}case"conditional":{const r=e;n={kind:"command",action:e.action,roles:t},n.thenBranch=r.thenBranch.map(rc),r.elseBranch&&r.elseBranch.length>0&&(n.elseBranch=r.elseBranch.map(rc));break}case"loop":{const r=e;n={kind:"command",action:e.action,roles:t},n.loopVariant=r.loopVariant,n.loopBody=r.body.map(rc),r.loopVariable&&(n.loopVariable=r.loopVariable),r.indexVariable&&(n.indexVariable=r.indexVariable);break}}return e.annotations&&e.annotations.length>0&&(n.annotations=e.annotations.map(e=>void 0!==e.value?{name:e.name,value:e.value}:{name:e.name})),e.diagnostics&&e.diagnostics.length>0&&(n.diagnostics=e.diagnostics.map(e=>{const t={level:e.severity,message:e.message};return e.code&&(t.code=e.code),e.source&&(t.source=e.source),e.suggestions&&e.suggestions.length>0&&(t.suggestions=[...e.suggestions]),t})),n}function ic(e){const t={};for(const[n,r]of e)t[n]=ac(r);return t}function ac(e){switch(e.type){case"selector":{const t="selectorKind"in e?e.selectorKind:void 0,n={type:"selector",value:e.value};return t&&new Set(["id","class","attribute","element","complex"]).has(t)&&(n.selectorKind=t),n}case"literal":return e.dataType?{type:"literal",value:e.value,dataType:e.dataType}:{type:"literal",value:e.value};case"reference":return{type:"reference",value:e.value};case"expression":return{type:"expression",raw:e.raw};case"property-path":return{type:"expression",raw:Dl(e)};case"flag":return{type:"flag",name:e.name,enabled:e.enabled}}}function oc(e){const t=new Map(Object.entries(e.roles??{}).map(([e,t])=>[e,lc(t)])),n=e.annotations?.map(e=>void 0!==e.value?{name:e.name,value:e.value}:{name:e.name}),r=e.diagnostics?.map(e=>({severity:e.level,message:e.message,...e.code?{code:e.code}:{},...e.source?{source:e.source}:{},...e.suggestions&&e.suggestions.length>0?{suggestions:e.suggestions}:{}}));if(e.trigger){t.set("event",Tl(e.trigger.event,"string"));const i=new Map(t);return i.delete("event"),sc(Pl("on",t,[Nl(e.action,i)],{sourceLanguage:"json"},e.trigger.modifiers??{}),n,r)}const i=e.kind??"command";if("event-handler"===i){const i=(e.body??[]).map(oc);return sc(Pl(e.action,t,i),n,r)}if("compound"===i)return sc($l((e.statements??[]).map(oc),e.chainType??"sequential"),n,r);if(e.thenBranch&&e.thenBranch.length>0){const i=e.thenBranch.map(oc),a=e.elseBranch?e.elseBranch.map(oc):void 0;return sc(Rl(e.action,t,i,a),n,r)}if(e.loopVariant){const i=(e.loopBody??[]).map(oc);return sc(Il(e.action,t,e.loopVariant,i,e.loopVariable,e.indexVariable),n,r)}if(e.catchBranch||e.finallyBranch)return sc(Ml((e.body??[]).map(oc),e.catchBranch?e.catchBranch.map(oc):void 0,e.finallyBranch?e.finallyBranch.map(oc):void 0),n,r);if(e.asyncVariant){const t=(e.asyncBody??[]).map(oc);return sc(ql(e.asyncVariant,t),n,r)}return sc(e.arms&&e.arms.length>0?_l(t,e.arms.map(e=>({pattern:lc(e.pattern),body:e.body.map(oc)})),e.defaultArm?e.defaultArm.map(oc):void 0):e.body&&e.body.length>0&&"command"===i?Ml(e.body.map(oc)):Nl(e.action,t),n,r)}function sc(e,t,n){return t&&0!==t.length||n&&0!==n.length?{...e,...t&&t.length>0?{annotations:t}:{},...n&&n.length>0?{diagnostics:n}:{}}:e}function lc(e){switch(e.type){case"selector":return jl((e.value??"")+"",e.selectorKind);case"literal":return Tl(void 0!==e.value?e.value:"",e.dataType);case"reference":return Al((e.value??"")+"");case"expression":return Ol(e.raw??(e.value??"")+"");case"flag":return Cl(e.name??(e.value??"")+"",e.enabled??("boolean"==typeof e.value?e.value:1));case"property-path":return Ol((e.value??e.raw??"")+"")}}var cc=new Set(["command","event-handler","compound"]),uc=new Set(["selector","literal","reference","expression","property-path","flag"]),pc=new Set(["then","and","async","sequential","pipe"]),mc=new Set(["all","race"]),dc=new Set(["error","warning","info"]),fc=class{constructor(e){this.namespace=e,this.enabled=this.checkEnabled()}checkEnabled(){if("undefined"!=typeof process&&process.env){const e=process.env.DEBUG||"";return"*"===e||e.includes("framework:*")||e.includes("framework:"+this.namespace)}return 0}log(e,t,...n){if(!this.enabled)return;const r=`[framework:${this.namespace}]`,i=(new Date).toISOString();switch(e){case"debug":console.debug(`${i} ${r} DEBUG:`,t,...n);break;case"info":console.info(`${i} ${r} INFO:`,t,...n);break;case"warn":console.warn(`${i} ${r} WARN:`,t,...n);break;case"error":console.error(`${i} ${r} ERROR:`,t,...n)}}debug(e,...t){this.log("debug",e,...t)}info(e,...t){this.log("info",e,...t)}warn(e,...t){this.log("warn",e,...t)}error(e,...t){this.log("error",e,...t)}isEnabled(){return this.enabled}enable(){this.enabled=1}disable(){this.enabled=0}};function yc(e,t){return t&&0!==t.length?t.includes(e)||t.includes("expression")?1:"property-path"===e?t.some(e=>["selector","reference","expression"].includes(e)):0:1}function hc(e,t){return e?.possessive?.keywords?.[t]}var vc=class e{constructor(){this.logger=new fc("pattern-matcher"),this.stemMatchCount=0,this.totalKeywordMatches=0}safeToLowerCase(e){return"string"==typeof e?e.toLowerCase():null==e?"":(e+"").toLowerCase()}matchPattern(e,t,n){const r=e.mark(),i=new Map;if(this.logger.debug("========================================"),this.logger.debug("matchPattern ENTRY"),this.logger.debug("Pattern ID:",t.id),this.logger.debug("Pattern command:",t.command),this.logger.debug("Pattern language:",t.language),this.logger.debug("Pattern template:",JSON.stringify(t.template,null,2)),this.logger.isEnabled()){const t=[];for(let n=0;10>n;n++){const r=e.peek(n);if(!r)break;t.push({type:r.type,value:r.value,kind:r.kind})}this.logger.debug("Input tokens (first 10):",t),this.logger.debug("Profile code:",n?.code)}this.currentProfile=n,this.stemMatchCount=0,this.totalKeywordMatches=0,this.logger.debug("--- Calling matchTokenSequence ---"),this.logger.debug("Pattern tokens to match:",JSON.stringify(t.template.tokens,null,2));const a=this.matchTokenSequence(e,t.template.tokens,i);if(this.logger.debug("matchTokenSequence returned:",a),this.logger.debug("Captured roles:",Array.from(i.entries()).map(([e,t])=>[e,JSON.stringify(t)])),!a)return this.logger.debug(">>> MATCH FAILED - resetting token position"),e.reset(r),null;const o=this.calculateConfidence(t,i);return this.applyExtractionRules(t,i),{pattern:t,captured:i,consumedTokens:e.position()-r.position,confidence:o}}matchBest(e,t,n){const r=[];for(const i of t){const t=e.mark(),a=this.matchPattern(e,i,n);a&&r.push(a),e.reset(t)}if(0===r.length)return null;r.sort((e,t)=>{const n=t.pattern.priority-e.pattern.priority;if(0!==n)return n;const r=t.confidence-e.confidence;return Math.abs(r)>.001?r:t.consumedTokens-e.consumedTokens});const i=r[0];return this.matchPattern(e,i.pattern),i}matchTokenSequence(e,t,n,r){const i=t[0],a="literal"===i?.type&&("and"===i.value||"then"===i.value||i.alternatives?.includes("and")||i.alternatives?.includes("then"));if("ar"===this.currentProfile?.code&&!a)for(;"conjunction"===e.peek()?.kind;)e.advance();let o=null,s=null;for(let i=0;t.length>i;i++){const a=t[i];this.logger.debug(" >> Matching pattern token:",JSON.stringify(a,null,2));const l=e.peek();if(this.logger.debug(" >> Current input token:",l?JSON.stringify({type:l.type,value:l.value,kind:l.kind}):"EOF"),"role"===a.type&&a.greedy){const l=this.collectStopMarkers(t,i+1);if(r)for(const e of r)l.add(e);const c=[];for(;!e.isAtEnd();){const t=e.peek();if(!t)break;if(this.isStopMarker(t,l))break;c.push(t.value),e.advance()}if(c.length>0){n.set(a.role,{type:"expression",raw:c.join(" ")}),o=null,s=null;continue}if(a.optional)continue;return 0}if("group"===a.type){const l=this.collectStopMarkers(t,i+1);if(r)for(const e of r)l.add(e);if(this.matchGroupToken(e,a,n,l)){o=null,s=null;continue}if(this.isOptional(a))continue;return 0}const c="role"===a.type&&1==a.optional,u=c?e.mark():null;if("role"===a.type&&!c){const r=t.length>i+1?t[i+1]:null;if("literal"===r?.type){const t=e.peek();if(t&&"none"!==this.getMatchType(t,r.value)){if(this.logger.debug(" >> MARKER-STEAL GUARD: current token matches next literal, skipping role"),this.logger.debug(" >> Token match FAILED"),this.isOptional(a))continue;if(o&&s){this.logger.debug(" >> BACKTRACKING: undoing optional role",s),e.reset(o),n.delete(s),o=null,s=null;const t=this.matchPatternToken(e,a,n);if(this.logger.debug(" >> Backtrack retry result:",t),t)continue}return 0}}}const p=this.matchPatternToken(e,a,n);if(this.logger.debug(" >> Match result:",p),p)c?(o=u,s=a.role):(o=null,s=null);else if(this.logger.debug(" >> Token match FAILED"),!this.isOptional(a)){if(o&&s){this.logger.debug(" >> BACKTRACKING: undoing optional role",s),e.reset(o),n.delete(s),o=null,s=null;const t=this.matchPatternToken(e,a,n);if(this.logger.debug(" >> Backtrack retry result:",t),t)continue}return 0}}return 1}matchPatternToken(e,t,n){switch(t.type){case"literal":return this.matchLiteralToken(e,t);case"role":return this.matchRoleToken(e,t,n);case"group":return this.matchGroupToken(e,t,n);default:return 0}}matchLiteralToken(e,t){const n=e.peek();if(this.logger.debug(" >>> matchLiteralToken: expecting",t.value),this.logger.debug(" >>> matchLiteralToken: got token",n?JSON.stringify({type:n.type,value:n.value,kind:n.kind}):"null"),!n)return this.logger.debug(" >>> matchLiteralToken: FAIL - no token"),0;const r=this.getMatchType(n,t.value);if(this.logger.debug(" >>> matchType for",n.value,"vs",t.value,":",r),"none"!==r)return this.totalKeywordMatches++,"stem"===r&&this.stemMatchCount++,e.advance(),1;if(t.alternatives)for(const r of t.alternatives){const t=this.getMatchType(n,r);if("none"!==t)return this.totalKeywordMatches++,"stem"===t&&this.stemMatchCount++,e.advance(),1}return 0}matchRoleToken(e,t,n){this.logger.debug(" >>> matchRoleToken ENTRY: capturing role",t.role),this.logger.debug(" >>> matchRoleToken: expected types",t.expectedTypes),this.logger.debug(" >>> matchRoleToken: optional?",t.optional),this.skipNoiseWords(e);const r=e.peek();if(this.logger.debug(" >>> After skipNoiseWords, current token:",r?JSON.stringify({value:r.value,kind:r.kind}):"null"),!r)return t.optional||0;const i=this.tryMatchPossessiveExpression(e);if(i)return t.expectedTypes&&t.expectedTypes.length>0&&!yc(i.type,t.expectedTypes)?t.optional||0:(n.set(t.role,i),1);const a=this.tryMatchMethodCallExpression(e);if(a)return t.expectedTypes&&t.expectedTypes.length>0&&!yc(a.type,t.expectedTypes)?t.optional||0:(n.set(t.role,a),1);const o=this.tryMatchPossessiveSelectorExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!yc(o.type,t.expectedTypes)?t.optional||0:(n.set(t.role,o),1);const s=this.tryMatchPropertyAccessExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!yc(s.type,t.expectedTypes)?t.optional||0:(n.set(t.role,s),1);const l=this.tryMatchSelectorPropertyExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!yc(l.type,t.expectedTypes)?t.optional||0:(n.set(t.role,l),1);this.logger.debug(" >>> Trying tokenToSemanticValue for token:",r?JSON.stringify({value:r.value,kind:r.kind}):"null");const c=this.tokenToSemanticValue(r);return this.logger.debug(" >>> tokenToSemanticValue returned:",c?JSON.stringify(c):"null"),c?(this.logger.debug(" >>> Validating type:",c.type,"against expected:",t.expectedTypes),t.expectedTypes&&t.expectedTypes.length>0&&!yc(c.type,t.expectedTypes)?(this.logger.debug(" >>> TYPE MISMATCH - returning",t.optional||0),t.optional||0):(this.logger.debug(" >>> Type validation PASSED"),n.set(t.role,c),e.advance(),1)):t.optional||0}tryMatchPossessiveExpression(e){const t=e.peek();if(!t)return null;if(!this.currentProfile)return null;const n=this.safeToLowerCase(t.normalized||t.value),r=hc(this.currentProfile,n);if(!r)return null;const i=e.mark();e.advance();const a=e.peek();if(!a)return e.reset(i),null;if("identifier"===a.kind||"keyword"===a.kind&&!this.isStructuralKeyword(a.value)||"selector"===a.kind&&a.value.startsWith("*")||"selector"===a.kind&&a.value.startsWith("@")||"selector"===a.kind&&a.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(a.value)){e.advance();let t=a.value;"selector"===a.kind&&t.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(t)&&(t=t.substring(1));let n=t;for(;"selector"===e.peek()?.kind&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)n+=e.peek().value,e.advance();const i=e.peek();return"literal"===i?.kind&&i.value.startsWith("(")&&(n+=i.value,e.advance()),Ll(Al(r),n)}return e.reset(i),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(t){const n=t.peek();if(!n||"selector"!==n.kind)return null;const r=t.mark();t.advance();const i=t.peek();if(!i||"operator"!==i.kind||"."!==i.value)return t.reset(r),null;t.advance();const a=t.peek();if(!a||"identifier"!==a.kind)return t.reset(r),null;t.advance();const o=t.peek();if(!o||"punctuation"!==o.kind||"("!==o.value)return t.reset(r),null;t.advance();const s=[];for(;!t.isAtEnd()&&e.MAX_METHOD_ARGS>s.length;){const e=t.peek();if(!e)break;if("punctuation"===e.kind&&")"===e.value){t.advance();break}"punctuation"!==e.kind||","!==e.value?(s.push(e.value),t.advance()):t.advance()}return{type:"expression",raw:`${n.value}.${a.value}(${s.join(", ")})`}}tryMatchPropertyAccessExpression(t){const n=t.peek();if(!n)return null;if("identifier"!==n.kind&&"keyword"!==n.kind)return null;const r=t.mark();t.advance();const i=t.peek();if(!i||"operator"!==i.kind||"."!==i.value)return t.reset(r),null;t.advance();const a=t.peek();if(!a||"identifier"!==a.kind)return t.reset(r),null;t.advance();let o=`${n.value}.${a.value}`,s=1;for(;!t.isAtEnd()&&e.MAX_PROPERTY_DEPTH>s;){const e=t.peek();if(!e||"operator"!==e.kind||"."!==e.value)break;t.advance();const n=t.peek();if(!n||"identifier"!==n.kind)break;t.advance(),o+="."+n.value,s++}const l=t.peek();if(l&&"punctuation"===l.kind&&"("===l.value){t.advance();const n=[];let r=0;for(;!t.isAtEnd()&&e.MAX_METHOD_ARGS>n.length;){const e=t.peek();if(!e)break;if("punctuation"===e.kind&&")"===e.value){if(0===r){t.advance();break}r--}"punctuation"===e.kind&&"("===e.value&&r++,"punctuation"!==e.kind||","!==e.value?(n.push(e.value),t.advance()):t.advance()}return{type:"expression",raw:`${o}(${n.join(", ")})`}}return{type:"expression",raw:o}}tryMatchPossessiveSelectorExpression(e){const t=e.peek();if(!t||"selector"!==t.kind)return null;const n=e.mark();e.advance();const r=e.peek();if(!r||"punctuation"!==r.kind||"'s"!==r.value)return e.reset(n),null;e.advance();const i=e.peek();return i?"selector"!==i.kind&&"identifier"!==i.kind?(e.reset(n),null):(e.advance(),Ll(jl(t.value),i.value)):(e.reset(n),null)}tryMatchSelectorPropertyExpression(e){const t=e.peek();if(!t||"selector"!==t.kind)return null;if("string"!=typeof t.value||!t.value.startsWith("#"))return null;const n=e.mark();e.advance();const r=e.peek();if(!r||"selector"!==r.kind)return e.reset(n),null;if(!r.value.startsWith("."))return e.reset(n),null;e.peek(1),e.advance();const i=r.value.slice(1);return Ll(jl(t.value),i)}matchGroupToken(t,n,r,i){const a=t.mark(),o=new Set(r.keys());if(this.matchTokenSequence(t,n.tokens,r,i))return 1;t.reset(a);for(const e of r.keys())o.has(e)||r.delete(e);if(!n.optional)return 0;const s=this.getGroupLeadingMarker(n);if(s)for(let l=1;e.MAX_MARKER_SCAN>=l;l++){const e=t.peek(l);if(!e)break;if((e.normalized||e.value).toLowerCase()===s){this.logger.debug(" >> MARKER SCAN: found",s,"at offset",l,"- skipping intervening tokens");for(let e=0;l>e;e++)t.advance();if(this.matchTokenSequence(t,n.tokens,r,i))return 1;t.reset(a);for(const e of r.keys())o.has(e)||r.delete(e);break}}return 1}getGroupLeadingMarker(e){const t=e.tokens[0];return"literal"===t?.type?t.value.toLowerCase():null}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem!==t||void 0===e.stemConfidence||.7>e.stemConfidence?"keyword"===e.kind&&this.safeToLowerCase(e.value)===t.toLowerCase()?"case-insensitive":"none":"stem"}collectStopMarkers(e,t){const n=new Set;for(let r=t;e.length>r;r++){const t=e[r];if("literal"===t.type){if(n.add(t.value.toLowerCase()),t.alternatives)for(const e of t.alternatives)n.add(e.toLowerCase());break}if("group"===t.type){for(const e of t.tokens)if("literal"===e.type){if(n.add(e.value.toLowerCase()),e.alternatives)for(const t of e.alternatives)n.add(t.toLowerCase());break}if(!t.optional)break}}return n}isStopMarker(e,t){return 0===t.size?0:t.has(e.value.toLowerCase())||e.normalized&&t.has(e.normalized.toLowerCase())?1:0}tokenToSemanticValue(e){switch(e.kind){case"selector":return jl(e.value);case"literal":return this.parseLiteralValue(e.value);case"keyword":return this.safeToLowerCase(e.normalized||e.value),Tl(e.normalized||e.value);case"identifier":return"string"==typeof e.value&&e.value.startsWith(":")?Al(e.value):(this.safeToLowerCase(e.value),{type:"expression",raw:e.value});case"url":return Tl(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("「"))return Tl(e.slice(1,-1),"string");if("true"===e)return Tl(1,"boolean");if("false"===e)return Tl(0,"boolean");const t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){const n=parseFloat(t[1]);return t[2]?Tl(e,"duration"):Tl(n,"number")}const n=parseFloat(e);return isNaN(n)?Tl(e,"string"):Tl(n,"number")}applyExtractionRules(e,t){for(const[n,r]of Object.entries(e.extraction))t.has(n)||(void 0!==r.value?t.set(n,{type:"literal",value:r.value}):r.default&&t.set(n,r.default))}isOptional(e){return"literal"!==e.type&&1==e.optional}calculateConfidence(e,t){let n=0,r=0;const i=t=>void 0!==e.extraction?.[t]?.default;for(const a of e.template.tokens)if("role"===a.type)r+=1,t.has(a.role)&&(n+=1);else if("group"===a.type)for(const e of a.tokens)if("role"===e.type){const a=i(e.role),o=.8;r+=o,t.has(e.role)?n+=o:a&&(n+=.6*o)}let a=r>0?n/r:1;this.stemMatchCount>0&&this.totalKeywordMatches>0&&(a=Math.max(.5,a-this.stemMatchCount/this.totalKeywordMatches*.15));const o=this.calculateVSOConfidenceBoost(e);a=Math.min(1,a+o);const s=this.arabicPrepositionDisambiguation(e,t);return a=Math.max(0,Math.min(1,a+s)),a}calculateVSOConfidenceBoost(e){if("ar"!==e.language)return 0;const t=e.template.tokens[0];if(!t||"literal"!==t.type)return 0;const n=new Set(["بدل","غير","أضف","أزل","ضع","اجعل","عين","زد","انقص","سجل","أظهر","أخف","شغل","أرسل","ركز","شوش","توقف","انسخ","احذف","اصنع","انتظر","انتقال","أو"]);if(n.has(t.value))return.15;if(t.alternatives)for(const e of t.alternatives)if(n.has(e))return.15;return 0}arabicPrepositionDisambiguation(e,t){if("ar"!==e.language)return 0;let n=0;const r={patient:["على"],destination:["إلى","الى"],source:["من"],agent:["من"],manner:["ب"],style:["ب"],goal:["إلى","الى"],method:["ب"]};for(const[e,i]of t.entries()){const t=r[e];if(!t||0===t.length)continue;const a="metadata"in i?i.metadata:void 0;a&&"string"==typeof a.prepositionValue&&(t.includes(a.prepositionValue)?n+=.1:n-=.1)}return Math.max(-.1,Math.min(.1,n))}skipNoiseWords(t){const n=t.peek();if(!n)return;const r=this.safeToLowerCase(n.value);if(e.ENGLISH_NOISE_WORDS.has(r)){const e=t.mark();t.advance();const n=t.peek();if(n&&"selector"===n.kind)return;t.reset(e)}"class"===r&&t.advance()}extractEventModifiers(e){const t={};let n=0;for(;!e.isAtEnd();){const r=e.peek();if(!r||"event-modifier"!==r.kind)break;const i=r.metadata;if(!i)break;switch(n=1,i.modifierName){case"once":t.once=1;break;case"debounce":"number"==typeof i.value&&(t.debounce=i.value);break;case"throttle":"number"==typeof i.value&&(t.throttle=i.value);break;case"queue":"first"!==i.value&&"last"!==i.value&&"all"!==i.value&&"none"!==i.value||(t.queue=i.value)}e.advance()}return n?t:void 0}};vc.MAX_MARKER_SCAN=3,vc.MAX_PROPERTY_DEPTH=10,vc.MAX_METHOD_ARGS=20,vc.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var gc=vc,bc=new gc,wc={basePriority:100,includeOptionalVariants:1};function kc(e,t,n=wc){const r=`${e.action}-${t.code}-generated`,i=n.basePriority??100,a=t.keywords[e.action];if(!a)throw Error(`No keyword translation for '${e.action}' in ${t.code}`);const o=function(e,t,n,r){const i=[],a={type:"literal",value:n,...r?.length&&{alternatives:r}},o=function(e,t){const n=[...e];return"SVO"===t?n.sort((e,t)=>(t.svoPosition??0)-(e.svoPosition??0)):"SOV"===t&&n.sort((e,t)=>(t.sovPosition??0)-(e.sovPosition??0)),n}(e.roles,t.wordOrder);if("SVO"===t.wordOrder){i.push(a);for(const e of o)zc(i,e,t)}else if("SOV"===t.wordOrder){for(const e of o)zc(i,e,t);i.push(a)}else if("VSO"===t.wordOrder){i.push(a);for(const e of o)zc(i,e,t)}else{i.push(a);for(const e of o)zc(i,e,t)}return i}(e,t,a.primary,a.alternatives),s=function(e,t){const n={};for(const r of e.roles){const e=xc(r,t),i={...void 0!==r.default&&{default:r.default},...e&&{marker:e}};n[r.role]=i}return n}(e,t),l=function(e,t,n){const r=[];"SVO"!==t.wordOrder&&"VSO"!==t.wordOrder||r.push(n);for(const n of e.roles){const e=xc(n,t),i=`{${n.role}}`;if(e){const a=t.roleMarkers?.[n.role];r.push("after"===a?.position?`${i} ${e}`:`${e} ${i}`)}else r.push(i)}return"SOV"===t.wordOrder&&r.push(n),r.join(" ")}(e,t,a.primary);return{id:r,language:t.code,command:e.action,priority:i,template:{format:l,tokens:o},extraction:s}}function zc(e,t,n){const r=xc(t,n),i=!t.required,a={type:"role",role:t.role,optional:i,expectedTypes:t.expectedTypes,...t.greedy&&{greedy:1}};if(r){const o=n.roleMarkers?.[t.role],s="SOV"===n.wordOrder?"after":"before",l=t.markerPosition??o?.position??s;i?e.push("before"===l?{type:"group",optional:1,tokens:[{type:"literal",value:r},a]}:{type:"group",optional:1,tokens:[a,{type:"literal",value:r}]}):"before"===l?(e.push({type:"literal",value:r}),e.push(a)):(e.push(a),e.push({type:"literal",value:r}))}else e.push(a)}function xc(e,t){return e.markerOverride?.[t.code]?e.markerOverride[t.code]:t.roleMarkers?.[e.role]?.primary}function Ec(e,t){const n=[],r=new Set;for(const i of t){const t=e.get(i);t&&(n.push(t),r.add(i))}for(const[t,i]of e)r.has(t)||n.push(i);return n}function Sc(e,t,n){const r=[];for(const i of e){const e=t.find(e=>e.role===i.role);e?"preposition"===n?(e.form&&r.push(e.form),r.push(i.translated||i.value)):"postposition"===n?(r.push(i.translated||i.value),e.form&&r.push(e.form)):r.push(i.translated||i.value):r.push(i.translated||i.value)}return r}function Tc(e){if(0===e.length)return"";let t="";for(let n=0;e.length>n;n++){const r=e[n],i=e[n+1],a=r.endsWith("-"),o=r.startsWith("-");let s=r;if(a&&(s=r.slice(0,-1)),o&&(s=r.substring(1)),t+=s,i){const e=i.startsWith("-");a||e||(t+=" ")}}return t}var jc=class{constructor(e){this.dictionary=e.dictionary,this.profileProvider=e.profileProvider}transform(e,t,n){const r=this.profileProvider.getProfile(t),i=this.profileProvider.getProfile(n);if(!r)throw Error("No profile found for language: "+t);if(!i)throw Error("No profile found for language: "+n);const a=this.parseStatement(e,t,r);return Tc(Sc(Ec(this.translateRoles(a,t,n),i.canonicalOrder),i.markers,i.adpositionType))}parseStatement(e,t,n){const r=new Map,i=e.split(/\s+/);let a=0;for(;i.length>a;){const e=i[a],o=n.markers.find(t=>t.form===e);if(o)i.length>a+1?(r.set(o.role,i[a+1]),a+=2):a++;else{const n=this.dictionary.lookup(e,t);n?r.set("action",n):(e.startsWith("#")||e.startsWith("."),r.set("patient",e)),a++}}return r}translateRoles(e,t,n){const r=new Map;for(const[t,i]of e){const e=this.dictionary.translate(i,n);r.set(t,{role:t,value:i,translated:e??i})}return r}},Ac=class{constructor(e){this.translations=e}lookup(e,t){const n=this.translations[t];if(!n)return;const r=e.toLowerCase();for(const[e,t]of Object.entries(n))if(t.toLowerCase()===r)return e}translate(e,t){return this.translations[t]?.[e]}getAllTranslations(e,t){const n=this.lookup(e,t);if(!n)return{};const r={};for(const[e,t]of Object.entries(this.translations)){const i=t[n];i&&(r[e]=i)}return r}},Lc=class{constructor(e){this.profiles=e}getProfile(e){return this.profiles[e]}getSupportedLanguages(){return Object.keys(this.profiles)}hasLanguage(e){return e in this.profiles}},Oc=class{constructor(){this.name="string-literal"}canExtract(e,t){const n=e[t];return'"'===n||"'"===n||"`"===n||"“"===n||"‘"===n}extract(e,t){const n=e[t];if("“"===n){let n=1;for(;e.length>t+n;){if("”"===e[t+n])return n++,{value:e.substring(t,t+n),length:n};n++}return null}if("‘"===n){let n=1;for(;e.length>t+n;){if("’"===e[t+n])return n++,{value:e.substring(t,t+n),length:n};n++}return null}let r=1,i=0;for(;e.length>t+r;){const a=e[t+r];if(i)i=0,r++;else if("\\"!==a){if(a===n)return r++,{value:e.substring(t,t+r),length:r};r++}else i=1,r++}return null}},Cc=class{constructor(){this.name="number"}canExtract(e,t){return/\d/.test(e[t])}extract(e,t){let n=0,r=0;for(;e.length>t+n;){const i=e[t+n];if(/\d/.test(i))n++;else{if("."!==i||r)break;r=1,n++}}if(0===n)return null;const i=e.substring(t,t+n),a=t+n;if(e.length>a){const t=e.slice(a),r=[{pattern:"毫秒",suffix:"ms"},{pattern:"分钟",suffix:"m"},{pattern:"小时",suffix:"h"},{pattern:"ミリ秒",suffix:"ms"},{pattern:"時間",suffix:"h"}];for(const e of r)if(t.startsWith(e.pattern))return{value:i+e.suffix,length:n+e.pattern.length,metadata:{hasTimeUnit:1}};if(t.startsWith("ms"))return{value:i+"ms",length:n+2,metadata:{hasTimeUnit:1}};const o=[{pattern:"秒",suffix:"s"},{pattern:"分",suffix:"m"}];for(const e of o)if(t.startsWith(e.pattern))return{value:i+e.suffix,length:n+1,metadata:{hasTimeUnit:1}};if(/^[smh](?![a-zA-Z])/.test(t))return{value:i+t[0],length:n+1,metadata:{hasTimeUnit:1}}}return{value:i,length:n}}},Nc=class{constructor(){this.name="identifier"}canExtract(e,t){return/[a-zA-Z_]/.test(e[t])}extract(e,t){let n=0;for(;e.length>t+n&&/[a-zA-Z0-9_]/.test(e[t+n]);)n++;return n>0?{value:e.substring(t,t+n),length:n}:null}},Pc=class{constructor(){this.name="unicode-identifier"}canExtract(e,t){return 128>e.charCodeAt(t)?0:/\p{L}/u.test(e[t])}extract(e,t){let n=0;for(;e.length>t+n&&/[\p{L}\p{N}\p{M}]/u.test(e[t+n]);)n++;return n>0?{value:e.substring(t,t+n),length:n}:null}};function Rc(e){return"setContext"in e&&"function"==typeof e.setContext}function $c(e){const t={language:e.language,direction:e.direction,lookupKeyword:e.lookupKeyword.bind(e),isKeyword:e.isKeyword.bind(e),isKeywordStart:e.isKeywordStart.bind(e)};return e.normalizer?{...t,normalizer:e.normalizer}:t}var Ic=new Set(["selector","literal","reference","expression","property-path","flag"]);function Mc(e){switch(e.type){case"selector":return jl(e.value+"",(t=e.value+"").startsWith("#")?"id":t.startsWith(".")?"class":t.startsWith("[")?"attribute":"complex");case"literal":return Tl(e.value,"number"==typeof e.value?"number":"boolean"==typeof e.value?"boolean":"string");case"reference":return Al(e.value+"");case"expression":case"property-path":return Ol(e.value+"");case"flag":return Cl(e.value+"",1);default:return Tl(e.value+"","string")}var t}function qc(e){switch(e.type){case"selector":return{type:"selector",value:e.value};case"literal":return{type:"literal",value:e.value};case"reference":return{type:"reference",value:e.value};case"expression":return{type:"expression",value:e.raw};case"property-path":return{type:"property-path",value:`${qc(e.object).value}.${e.property}`};case"flag":return{type:"flag",value:e.enabled}}}function _c(e){if(!e||"object"!=typeof e)return Nl("unknown",{});switch(e.type){case"event":return function(e){const t=(e.event??"click")+"",n=(Array.isArray(e.body)?e.body:[]).map(_c),r={event:Tl(t)};e.target&&"object"==typeof e.target&&(r.source=Vc(e.target));const i=e.modifiers;let a;return i&&(a=function(e){const t=1==e.once?1:void 0,n="number"==typeof e.debounce?e.debounce:void 0,r="number"==typeof e.throttle?e.throttle:void 0,i="string"==typeof e.from?function(e){if(Hl.has(e))return Al(e);const t=Wc(e);return t?jl(e,t):Tl(e)}(e.from):void 0;if(void 0!==t||void 0!==n||void 0!==r||void 0!==i)return{...void 0!==t?{once:t}:{},...void 0!==n?{debounce:n}:{},...void 0!==r?{throttle:r}:{},...void 0!==i?{from:i}:{}}}(i),i.prevent&&(r.prevent=Tl(1)),i.stop&&(r.stop=Tl(1)),i.passive&&(r.passive=Tl(1)),i.capture&&(r.capture=Tl(1))),Pl("on",r,n,void 0,a)}(e);case"command":return function(e){const t=(e.name??"unknown")+"",n=Array.isArray(e.args)?e.args:[],r=e.target&&"object"==typeof e.target?e.target:void 0,i=e.roles,a=e.modifiers;let o;if(i&&"object"==typeof i&&Object.keys(i).length>0){o={};for(const[e,t]of Object.entries(i))t&&"object"==typeof t&&"type"in t&&(o[e]=Vc(t))}else o=function(e,t,n,r){const i={};switch(e){case"set":{t[0]&&(i.destination=Vc(t[0]));const e=n?.to;e&&"object"==typeof e&&"type"in e?i.patient=Vc(e):t[1]&&(i.patient=Vc(t[1]));break}case"put":if(t[0]&&(i.patient=Vc(t[0])),n)for(const e of["into","before","after"]){const t=n[e];if(t&&"object"==typeof t&&"type"in t){i.destination=Vc(t),i.method=Tl(e);break}}!i.destination&&r&&(i.destination=Vc(r));break;case"increment":case"decrement":{t[0]&&(i.destination=Vc(t[0]));const e=n?.by;e&&"object"==typeof e&&"type"in e?i.quantity=Vc(e):t[1]&&(i.quantity=Vc(t[1]));break}case"fetch":{t[0]&&(i.source=Vc(t[0]));const e=n?.as;e&&"object"==typeof e&&"type"in e?i.responseType=Vc(e):"string"==typeof e&&(i.responseType=Tl(e));break}case"wait":case"settle":t[0]&&(i.duration=Vc(t[0]));break;case"toggle":case"add":case"show":case"hide":case"send":case"trigger":default:t[0]&&(i.patient=Vc(t[0])),r&&(i.destination=Vc(r));break;case"remove":t[0]&&(i.patient=Vc(t[0])),r&&(i.source=Vc(r));break;case"log":t[0]&&(i.patient=Vc(t[0]));break;case"scroll":{const e=Gc(t,Fc);e&&(i.destination=Vc(e));break}case"push":case"replace":{const e=Gc(t,Bc);e&&(i.patient=Vc(e));break}case"process":{const e=Gc(t,Uc);e&&(i.patient=Vc(e));break}}return i}(t,n,a,r);return Nl(t,o)}(e);case"if":return function(e){const t=e.condition&&"object"==typeof e.condition?Vc(e.condition):Ol("true"),n=(Array.isArray(e.thenBranch)?e.thenBranch:[]).map(_c);let r;const i=e.elseIfBranches;return i&&i.length>0?r=[Dc(i,e.elseBranch)]:Array.isArray(e.elseBranch)&&e.elseBranch.length>0&&(r=e.elseBranch.map(_c)),Rl("if",{condition:t},n,r)}(e);case"repeat":return function(e){const t=(Array.isArray(e.body)?e.body:[]).map(_c),n={};let r;return null!=e.count?(r="times","number"==typeof e.count?n.quantity=Tl(e.count,"number"):"object"==typeof e.count&&(n.quantity=Vc(e.count))):e.whileCondition&&"object"==typeof e.whileCondition?(r="while",n.condition=Vc(e.whileCondition)):"string"==typeof e.untilEvent?(r="until",n.condition=Tl(e.untilEvent)):r="forever",Il("repeat",n,r,t)}(e);case"foreach":return function(e){const t=(Array.isArray(e.body)?e.body:[]).map(_c),n={};return e.collection&&"object"==typeof e.collection&&(n.source=Vc(e.collection)),Il("repeat",n,"for",t,"string"==typeof e.itemName?e.itemName:void 0,"string"==typeof e.indexName?e.indexName:void 0)}(e);case"while":return function(e){const t=(Array.isArray(e.body)?e.body:[]).map(_c),n={};return e.condition&&"object"==typeof e.condition&&(n.condition=Vc(e.condition)),Il("repeat",n,"while",t)}(e);default:return Nl("get",{patient:Vc(e)})}}function Dc(e,t){const[n,...r]=e,i=Vc(n.condition),a=n.body.map(_c);let o;return r.length>0?o=[Dc(r,t)]:t&&t.length>0&&(o=t.map(_c)),Rl("if",{condition:i},a,o)}function Vc(e){switch(e.type){case"literal":return function(e){const t=e.value;return null==t?Tl("null"):Tl(t,"number"==typeof t?"number":"boolean"==typeof t?"boolean":void 0)}(e);case"selector":return jl((e.value??"")+"",Wc((e.value??"")+""));case"identifier":return function(e){const t=(e.value??"")+"";return Hl.has(t)?Al(t):Tl(t)}(e);case"variable":return function(e){const t=(e.name??"")+"";switch((e.scope??"local")+""){case"element":return Ol(":"+t);case"global":return Ol("$"+t);default:return Ol(t)}}(e);case"possessive":return Ll(e.object&&"object"==typeof e.object?Vc(e.object):Al("me"),(e.property??"")+"");case"binary":case"unary":case"member":case"call":case"positional":return Ol(Hc(e));default:return"value"in e?Tl((e.value??"")+""):Ol(Hc(e))}}function Hc(e){if(!e||"object"!=typeof e)return"";switch(e.type){case"literal":{const t=e.value;return null==t?"null":"string"==typeof t?/\s/.test(t)?`"${t}"`:t:t+""}case"identifier":case"selector":return(e.value??"")+"";case"variable":{const t=(e.name??"")+"",n=(e.scope??"local")+"";return"element"===n?":"+t:"global"===n?"$"+t:t}case"binary":{const t=e.left&&"object"==typeof e.left?Hc(e.left):"",n=e.right&&"object"==typeof e.right?Hc(e.right):"";return`${t} ${e.operator??""} ${n}`}case"unary":{const t=e.operand&&"object"==typeof e.operand?Hc(e.operand):"";return`${e.operator??""} ${t}`}case"member":{const t=e.object&&"object"==typeof e.object?Hc(e.object):"";return e.computed&&e.property&&"object"==typeof e.property?`${t}[${Hc(e.property)}]`:`${t}.${"string"==typeof e.property?e.property:e.property&&"object"==typeof e.property?Hc(e.property):""}`}case"possessive":return`${e.object&&"object"==typeof e.object?Hc(e.object):""}'s ${e.property??""}`;case"call":return`${e.callee&&"object"==typeof e.callee?Hc(e.callee):""}(${Array.isArray(e.args)?e.args.map(e=>Hc(e)).join(", "):""})`;case"positional":{const t=e.target&&"object"==typeof e.target?Hc(e.target):"";return t?`${e.position??""} ${t}`:(e.position??"")+""}default:return"value"in e?(e.value??"")+"":""}}var Fc=new Set(["to","of","the","top","bottom","middle","center","nearest","left","right","smoothly","instantly"]),Bc=new Set(["url"]),Uc=new Set(["partials","in"]);function Gc(e,t){for(const n of e){if("identifier"===n.type){const e="string"==typeof n.name?n.name:n.value;if("string"==typeof e&&t.has(e))continue}return n}}function Wc(e){if(e)return e.startsWith("#")?"id":e.startsWith(".")?"class":e.startsWith("[")?"attribute":e.startsWith("<")||e.startsWith("*")?"element":/[>\+~ ]/.test(e)&&e.length>1?"complex":void 0}function Kc(e){switch(e.type){case"selector":return{type:"selector",value:e.value};case"reference":return{type:"identifier",value:e.value};case"literal":{const t=e;if("duration"===t.dataType){const e=/^(\d+(?:\.\d+)?)(ms|s)$/.exec(t.value+"");if(e)return{type:"literal",value:"s"===e[2]?1e3*parseFloat(e[1]):parseFloat(e[1])}}return{type:"literal",value:t.value}}case"property-path":{const t=e;return{type:"member",object:Kc(t.object),property:t.property}}case"expression":return{type:"expression",value:e.raw};case"flag":return{type:"literal",value:e.enabled};default:return{type:"literal",value:(e.value??"")+""}}}var Jc=class{constructor(e){this.patterns=new Map,this.tokenizers=new Map,this.schemas=e.schemas;for(const t of e.languages)this.registerLanguage(t)}registerLanguage(e){this.tokenizers.set(e.code,e.tokenizer);const t=[];for(const n of this.schemas){const r=kc(n,e.patternProfile);t.push(r)}this.patterns.set(e.code,t)}getPatterns(e){return this.patterns.get(e)||[]}getTokenizer(e){return this.tokenizers.get(e)}getSupportedLanguages(){return Array.from(this.patterns.keys())}},Zc=class{constructor(e,t,n){this.registry=t,this.matcher=new gc,this.transformer=n,e.codeGenerator&&(this.codeGenerator=e.codeGenerator);const r=new Map(e.schemas.map(e=>[e.action,e]));this.schemaLookup={getSchema:e=>r.get(e)}}parse(e,t){return this.parseWithConfidence(e,t).node}parseWithConfidence(e,t){if(Wl(e)){const t=Gl(e,{schemaLookup:this.schemaLookup});if(!this.schemaLookup.getSchema(t.action))throw Error(`No schema for action "${t.action}" in this DSL`);return{node:t,confidence:1}}const n=this.registry.getTokenizer(t);if(!n)throw Error("No tokenizer registered for language: "+t);const r=n.tokenize(e),i=this.registry.getPatterns(t),a={code:t};for(const n of i){const i=this.matcher.matchPattern(r,n,a);if(i)return{node:{kind:"command",action:n.command,roles:i.captured,metadata:{sourceLanguage:t,sourceText:e,patternId:n.id,confidence:i.confidence}},confidence:i.confidence}}throw Error("No pattern matched for input: "+e)}validate(e,t){try{return{valid:1,node:this.parseWithConfidence(e,t).node}}catch(e){return{valid:0,errors:[e instanceof Error?e.message:e+""]}}}translate(e,t,n){return Wl(e)?e:this.transformer.transform(e,t,n)}compile(e,t){if(!this.codeGenerator)return{ok:0,errors:["No code generator configured for this DSL"]};try{const n=this.parseWithConfidence(e,t);return{ok:1,code:this.codeGenerator.generate(n.node),node:n.node,metadata:{parser:"semantic",confidence:n.confidence}}}catch(e){return{ok:0,errors:[e instanceof Error?e.message:e+""]}}}getSupportedLanguages(){return this.registry.getSupportedLanguages()}};function Yc(e){const t=e.outputFormat??"both",n=e.examplesPerCommand??2,r=[Qc(),eu(),tu(e.schemas,t,n),nu(t),ru()];let i=r;e.maxTokens&&e.maxTokens>0&&(i=function(e,t){const n=[];let r=t;for(const t of e){if(t.approximateTokens>r){const e=t.content.slice(0,Math.max(4*r,40))+"\n\n*(truncated)*";n.push({...t,content:e,approximateTokens:lu(e)});break}n.push(t),r-=t.approximateTokens}return n}(r,e.maxTokens));const a=i.map(e=>`## ${e.title}\n\n${e.content}`).join("\n\n---\n\n"),o=e.schemas.reduce((e,t)=>e+t.roles.length,0),s=lu(a);return{text:a,sections:i,metadata:{domain:e.domain,commandCount:e.schemas.length,roleCount:o,approximateTokens:s}}}function Xc(e,t=2){const n=function(e){const t=e.roles.filter(e=>e.required),n=e.roles.filter(e=>!e.required),r=[];t.length>0&&r.push(t);for(const e of n)r.push([...t,e]);return 2>n.length||r.push([...t,...n]),0===r.length&&r.push(e.roles.slice()),r}(e),r=[];for(let i=0;Math.min(t,n.length)>i;i++){const t=n[i],a=new Map;for(const e of t){const t=ou(e);a.set(e.role,t)}const o=new Map;for(const[e,t]of a)o.set(e,su(t));const s=tc(Nl(e.action,o)),l={};for(const[e,t]of a)l[e]=t;r.push({explicit:s,json:{action:e.action,roles:l}})}return r}function Qc(){const e='LokaScript Explicit Syntax (LSE) is a bracket-based format for imperative commands.\n\n### Syntax\n\n```\n[command role1:value1 role2:value2 +flag1 ~flag2]\n```\n\n- **Command**: The first token inside brackets (lowercased)\n- **Role pair**: `name:value` — a named semantic role with a typed value (no space around colon)\n- **Enabled flag**: `+name` — boolean attribute present\n- **Disabled flag**: `~name` — boolean attribute negated\n- **Nested body**: `body:[command ...]` — a bracket command inside a role value\n\n### Rules\n\n1. Commands are always lowercased\n2. Role names preserve their original case\n3. No spaces around the colon in role:value pairs\n4. Strings with spaces must be quoted: `patient:"hello world"`\n5. Selectors start with `#`, `.`, `[`, `@`, or `*`\n6. Output must be valid bracket syntax: `[action role:value ...]`';return{id:"protocol",title:"LSE Protocol",content:e,approximateTokens:lu(e)}}function eu(){const e="Values in LSE are classified by their syntactic form (first match wins):\n\n| Type | Syntax | Example |\n|------|--------|---------|\n| Selector | Starts with `#` `.` `[` `@` `*` | `#button`, `.active`, `[data-id]` |\n| String | Quoted with `\"` or `'` | `\"hello world\"`, `'json'` |\n| Boolean | Exact: `true` / `false` | `visible:true` |\n| Reference | Built-in name | `me`, `you`, `it`, `result`, `event`, `target`, `body` |\n| Duration | Number + suffix | `500ms`, `2s`, `1m`, `1h` |\n| Number | Digits with optional decimal | `5`, `3.14`, `-1` |\n| Plain | Fallback (any non-whitespace) | `/api/users`, `json`, `production` |\n\n**Important**: Classification is by prefix, not by intent. `#true` is a selector (not boolean). `event` as a value is a reference (not plain text).";return{id:"value-types",title:"Value Types",content:e,approximateTokens:lu(e)}}function tu(e,t,n){const r=[];for(const i of e)r.push(iu(i,t,n));const i=r.join("\n\n");return{id:"commands",title:"Available Commands",content:i,approximateTokens:lu(i)}}function nu(e){let t;return t="explicit"===e?"Output valid LSE bracket syntax. Each command must be wrapped in brackets:\n\n```\n[command role:value ...]\n```\n\nDo NOT output JSON. Only use bracket syntax.":"json"===e?'Output valid JSON in the LLM-simplified format:\n\n```json\n{\n "action": "command-name",\n "roles": {\n "roleName": { "type": "valueType", "value": "theValue" }\n }\n}\n```\n\nValid value types: `selector`, `literal`, `reference`, `expression`.\nDo NOT output bracket syntax. Only use JSON.':'You may output EITHER format:\n\n**Bracket syntax** (preferred for single commands):\n```\n[command role:value ...]\n```\n\n**JSON format** (preferred when structured data is needed):\n```json\n{\n "action": "command-name",\n "roles": {\n "roleName": { "type": "valueType", "value": "theValue" }\n }\n}\n```\n\nBoth formats are equally valid. Use whichever is more natural for the context.',{id:"output-format",title:"Output Format",content:t,approximateTokens:lu(t)}}function ru(){const e="If you're unsure about a command or role:\n\n1. **Unknown command**: Use the closest matching command from the Available Commands section. Do not invent commands.\n2. **Unknown role**: Use only the roles listed for each command. Do not add roles not in the schema.\n3. **Ambiguous value type**: When in doubt, use `expression` type (it's the most permissive).\n4. **Missing required role**: Always include all required roles. Check the Required/Optional labels.\n5. **Selector vs plain value**: If a value starts with `#`, `.`, `[`, `@`, or `*`, it's a selector. URLs like `/api/data` are plain values.\n\nWhen generating LSE, prefer explicit role labeling over positional guessing. Every value should have a role name.";return{id:"error-recovery",title:"Error Recovery",content:e,approximateTokens:lu(e)}}function iu(e,t,n){const r=[];r.push(`### \`${e.action}\` — ${e.description}`),r.push("");const i=e.roles.filter(e=>e.required),a=e.roles.filter(e=>!e.required);if(i.length>0){r.push("**Required roles:**");for(const e of i)r.push(`- \`${e.role}\`: ${e.description} (type: ${au(e)})`)}if(a.length>0){r.push("**Optional roles:**");for(const e of a)r.push(`- \`${e.role}\`: ${e.description} (type: ${au(e)})`)}const o=Xc(e,n);if(o.length>0){if(r.push(""),"explicit"===t||"both"===t){r.push("**Bracket syntax:**");for(const e of o)r.push(`\`\`\`\n${e.explicit}\n\`\`\``)}if("json"===t||"both"===t){r.push("**JSON format:**");for(const e of o)r.push(`\`\`\`json\n${JSON.stringify(e.json,null,2)}\n\`\`\``)}}return r.join("\n")}function au(e){return e.expectedTypes.join(" | ")}function ou(e){switch(e.expectedTypes[0]||"expression"){case"selector":return{type:"selector",value:{patient:".active",destination:"#output",source:"#input",target:"#target"}[t=e.role]||"#"+t};case"literal":return function(e){return{type:"literal",value:{duration:"30s",interval:"5s",delay:"500ms",timeout:"10s",quantity:5,limit:10,style:"json",manner:"rolling",format:"html"}[e]||e}}(e.role);case"reference":return{type:"reference",value:"me"};case"expression":return function(e){return{type:"expression",value:{source:"/api/data",destination:"#output",patient:".active",instrument:"toUpperCase",condition:"age > 18",style:"json",duration:"5s",url:"/api/users"}[e]||"/api/"+e}}(e.role);case"flag":return{type:"flag",value:1};default:return{type:"literal",value:"example"}}var t}function su(e){switch(e.type){case"selector":return{type:"selector",value:e.value+"",selectorKind:(t=e.value+"",t.startsWith("#")?"id":t.startsWith(".")?"class":t.startsWith("[")?"attribute":"complex")};case"literal":return{type:"literal",value:e.value,dataType:"number"==typeof e.value?"number":"boolean"==typeof e.value?"boolean":"string"};case"reference":return{type:"reference",value:e.value+""};case"expression":return{type:"expression",value:e.value+"",raw:e.value+""};case"flag":return{type:"flag",value:e.value};default:return{type:"literal",value:e.value+"",dataType:"string"}}var t}function lu(e){return Math.ceil(e.length/4)}function cu(e,t){const n=t.maxPairsPerCommand??5,r=t.minQuality??.5,i=t.shuffleRoles??1,a=t.languages??["en"],o=[];let s=0;for(const l of e){const e=uu(l);for(const c of a){let a=0;for(const u of e){if(a>=n)break;const e=pu(l,u,c,t.domain,`${t.domain}-synth-${s++}`);if(r>e.quality||(o.push(e),a++),i&&u.length>=2&&n>a){const e=pu(l,[...u].reverse(),c,t.domain,`${t.domain}-synth-${s++}`);r>e.quality||(o.push(e),a++)}}}}return{pairs:o,metadata:{domain:t.domain,commandCount:e.length,pairCount:o.length,bySource:{synthetic:o.length},languages:a}}}function uu(e){const t=e.roles.filter(e=>e.required),n=e.roles.filter(e=>!e.required),r=[];t.length>0&&r.push(t);for(const e of n)r.push([...t,e]);return 2>n.length||r.push([...t,...n]),0===r.length&&r.push(e.roles.slice()),r}function pu(e,t,n,r,i){const a=new Map;for(const e of t)a.set(e.role,mu(e));const o=new Map;for(const[e,t]of a)o.set(e,du(t));const s=tc(Nl(e.action,o)),l={};for(const[e,t]of a)l[e]=t;const c={action:e.action,roles:l},u=function(e,t,n){const r=[e.action];for(const i of e.roles){const e=t.get(i.role);if(!e)continue;const a=i.markerOverride?.[n];a&&r.push(a),r.push(e.value+"")}return r.join(" ")}(e,a,n),p=e.roles.filter(e=>e.required).length,m=t.filter(e=>e.required).length;return{id:i,natural:u,language:n,explicit:s,json:c,domain:r,action:e.action,source:"synthetic",quality:p>0?m/p:.8}}function mu(e){switch(e.expectedTypes[0]||"expression"){case"selector":return{type:"selector",value:{patient:".active",destination:"#output",source:"#input",target:"#target"}[t=e.role]||"#"+t};case"literal":return function(e){return{type:"literal",value:{duration:"30s",interval:"5s",delay:"500ms",timeout:"10s",quantity:5,limit:10,style:"json",manner:"rolling",format:"html"}[e]||e}}(e.role);case"reference":return{type:"reference",value:"me"};case"expression":return function(e){return{type:"expression",value:{source:"/api/data",destination:"#output",patient:".active",instrument:"toUpperCase",condition:"age > 18",style:"json",duration:"5s",url:"/api/users"}[e]||"/api/"+e}}(e.role);case"flag":return{type:"flag",value:1};default:return{type:"literal",value:"example"}}var t}function du(e){switch(e.type){case"selector":return{type:"selector",value:e.value+"",selectorKind:(t=e.value+"",t.startsWith("#")?"id":t.startsWith(".")?"class":t.startsWith("[")?"attribute":"complex")};case"literal":return{type:"literal",value:e.value,dataType:"number"==typeof e.value?"number":"boolean"==typeof e.value?"boolean":"string"};case"reference":return{type:"reference",value:e.value+""};case"expression":return{type:"expression",value:e.value+"",raw:e.value+""};case"flag":return{type:"flag",value:e.value};default:return{type:"literal",value:e.value+"",dataType:"string"}}var t}function fu(e,t,n,r,i){const a=n.some(e=>"error"===e.severity),o=n.map(e=>function(e){const t=function(e){const t=(e.code||"").toLowerCase(),n=e.message.toLowerCase();return t.includes("missing-role")||t.includes("missing_role")||n.includes("required role")||n.includes("missing role")?"missing_role":t.includes("invalid-type")||t.includes("invalid_type")||t.includes("type-mismatch")||n.includes("invalid type")||n.includes("expected type")?"invalid_type":t.includes("unknown-command")||t.includes("unknown_command")||n.includes("unknown command")||n.includes("not recognized")&&n.includes("command")?"unknown_command":t.includes("unknown-role")||t.includes("unknown_role")||n.includes("unknown role")||n.includes("not recognized")&&n.includes("role")?"unknown_role":t.includes("parse")||t.includes("syntax")||n.includes("syntax error")||n.includes("parse error")||n.includes("unexpected")?"syntax_error":void 0}(e);return{severity:e.severity,code:e.code||"unknown",message:e.message,...e.suggestions?.[0]&&{suggestion:e.suggestions[0]},...t&&{fixType:t}}}(e)),s=function(e,t,n){const r=[],i=n&&t?t.getSchema(n):void 0;for(const t of e)if("error"===t.severity)switch(t.fixType){case"missing_role":if(i){const e=i.roles.filter(e=>e.required).map(e=>`'${e.role}' (${e.description}, type: ${e.expectedTypes.join("|")})`).join(", ");r.push(`Required roles for '${n}': ${e}`)}else r.push("Check that all required roles are present.");break;case"unknown_command":r.push("Command not recognized. Ensure you're using a valid command from the domain schema.");break;case"unknown_role":if(i){const e=i.roles.map(e=>`'${e.role}'`).join(", ");r.push(`Valid roles for '${n}': ${e}`)}else r.push("Use only roles defined in the command schema.");break;case"invalid_type":r.push("Check value types: selectors start with #.[@*, strings use quotes, numbers are plain digits.");break;case"syntax_error":r.push("Ensure bracket syntax: [command role:value ...]. No spaces around the colon.");break;default:t.suggestion&&r.push(t.suggestion)}return[...new Set(r)]}(o,r,i);let l,c;if(i&&r){const e=r.getSchema(i);e&&(l=function(e){const t=[],n=[],r={};for(const i of e.roles)i.required?t.push(i.role):n.push(i.role),r[i.role]=i.description;return{action:e.action,requiredRoles:t,optionalRoles:n,roleDescriptions:r}}(e),a&&(c=function(e){const t=new Map,n={};for(const r of e.roles){if(!r.required)continue;const e=yu(r.role,r.expectedTypes[0]||"expression");t.set(r.role,hu(e)),n[r.role]=e}return{explicit:tc(Nl(e.action,t)),json:{action:e.action,roles:n}}}(e)))}return{accepted:!a,input:{format:t,text:e},diagnostics:o,hints:s,...l&&{schema:l},...c&&{correctedExample:c}}}function yu(e,t){switch(t){case"selector":return{type:"selector",value:"#"+e};case"expression":default:return{type:"expression",value:`<${e}-value>`};case"literal":return{type:"literal",value:`<${e}-value>`};case"reference":return{type:"reference",value:"me"}}}function hu(e){switch(e.type){case"selector":return{type:"selector",value:e.value,selectorKind:"id"};case"expression":return{type:"expression",value:e.value,raw:e.value};case"literal":default:return{type:"literal",value:e.value,dataType:"string"};case"reference":return{type:"reference",value:e.value}}}function vu(e){const t=[],n=e.tools??["parse","compile","validate","translate"],r=e.languages.join(", ");for(const i of n)switch(i){case"parse":t.push({name:"parse_"+e.name,description:`Parse a ${e.description} input into a semantic representation (action, roles, confidence). Supports: ${r}.`,inputSchema:{type:"object",properties:{[e.inputLabel]:{type:"string",description:e.inputDescription},language:{type:"string",description:"Language code: "+r,default:"en"}},required:[e.inputLabel]}});break;case"compile":t.push({name:"compile_"+e.name,description:`Compile a ${e.description} input to ${e.outputDescription??"target code"}. Supports: ${r}.`,inputSchema:{type:"object",properties:{[e.inputLabel]:{type:"string",description:e.inputDescription},language:{type:"string",description:"Language code: "+r,default:"en"}},required:[e.inputLabel]}});break;case"validate":t.push({name:"validate_"+e.name,description:`Check ${e.description} syntax for errors. Returns {valid, errors[]}. Supports: ${r}.`,inputSchema:{type:"object",properties:{[e.inputLabel]:{type:"string",description:e.inputDescription+" to validate"},language:{type:"string",description:"Language code: "+r,default:"en"}},required:[e.inputLabel]}});break;case"translate":t.push({name:"translate_"+e.name,description:`Translate ${e.description} input between natural languages (requires 'from' and 'to' codes). Supports: ${r}.`,inputSchema:{type:"object",properties:{[e.inputLabel]:{type:"string",description:e.inputDescription+" to translate"},from:{type:"string",description:"Source language code: "+r},to:{type:"string",description:"Target language code: "+r}},required:[e.inputLabel,"from","to"]}})}return t}function gu(e){const t=e.match(/^(parse|compile|validate|translate)_(.+)$/);return t?{operation:t[1],domain:t[2]}:null}function bu(e,t,n=""){const r=e[t];return"string"==typeof r?r:n}function wu(e,t){return{content:[{type:"text",text:JSON.stringify(e,null,2)}],...t&&{isError:1}}}function ku(e){return wu({error:"Missing required parameter: "+e},1)}var zu=/^\s*(\/\/|--|#)/;function xu(e){const t=e.trim();return""===t||zu.test(t)}function Eu(e){const t=[];for(const n of e){const e=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t.push(RegExp(e+'\\s*=\\s*"([^"]+)"',"g")),t.push(RegExp(e+"\\s*=\\s*'([^']+)'","g")),t.push(RegExp(e+"\\s*=\\s*`([^`]+)`","g"))}return t}function Su(e){return e.map(e=>{const t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return RegExp(`<script[^>]*type=["']?${t}["']?[^>]*>([\\s\\S]*?)<\\/script>`,"gi")})}function Tu(e,t){let n=1;for(let r=0;t>r&&e.length>r;r++)"\n"===e[r]&&n++;return n}function ju(e,t){const n=e.lastIndexOf("<",t);if(-1===n)return;const r=e.slice(n,t+200).match(/\bid=["']([^"']+)["']/);return r?.[1]}function Au(e,t){const n=e.lastIndexOf("<",t);if(-1===n)return;const r=e.slice(n,t+200).match(/\blang=["']([^"']+)["']/);return r?.[1]}var Lu=class{constructor(e){this.configs=e}extract(e,t){const n=[];for(const r of this.configs){const i=r.defaultLanguage??"en",a=Eu(r.attributes);for(const o of a){let a;for(o.lastIndex=0;a=o.exec(e);){const o=a[1].trim();if(!o)continue;const s=Tu(e,a.index),l=ju(e,a.index),c=Au(e,a.index);n.push({domain:r.domain,code:o,language:c??i,file:t,line:s,column:1,...null!=l&&{elementId:l}})}}if(r.scriptTypes){const a=Su(r.scriptTypes);for(const o of a){let a;for(o.lastIndex=0;a=o.exec(e);){const o=a[1].trim();if(!o)continue;const s=Tu(e,a.index);n.push({domain:r.domain,code:o,language:i,file:t,line:s,column:1})}}}}return n}async extractFromFiles(e,t){const n=[];for(const r of e)try{const e=await t(r),i=this.extract(e,r);n.push(...i)}catch{}return n}};function Ou(e,t,n){return e[t]?.[n]??t}function Cu(...e){return e.filter(Boolean).join(" ")}function Nu(e,t){const n={},r={};for(const e of t)for(const[t,r]of Object.entries(e.keywords))n[t]||(n[t]={}),n[t][e.code]=r.primary;for(const t of e)for(const e of t.roles)if(e.markerOverride){const t=e.role;r[t]||(r[t]={});for(const[n,i]of Object.entries(e.markerOverride))r[t][n]=i}for(const e of t)if(e.roleMarkers)for(const[t,n]of Object.entries(e.roleMarkers))r[t]||(r[t]={}),r[t][e.code]=n.primary;return{keywords:n,markers:r}}function Pu(e){const t=new Set,n=new Set;for(const r of e)"SOV"===r.wordOrder&&t.add(r.code),"VSO"===r.wordOrder&&n.add(r.code);return{sovLanguages:t,vsoLanguages:n}}var Ru=class{constructor(e,t){this.pos=0,this.tokens=e,this.language=t}peek(e=0){const t=this.pos+e;return 0>t||t>=this.tokens.length?null:this.tokens[t]}advance(){if(this.isAtEnd())throw Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return{position:this.pos}}reset(e){this.pos=e.position}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(e){const t=[];for(;!this.isAtEnd()&&e(this.peek());)t.push(this.advance());return t}skipWhile(e){for(;!this.isAtEnd()&&e(this.peek());)this.advance()}};function $u(e,t){return{start:e,end:t}}function Iu(e,t,n,r){if("object"==typeof e){const{value:t,kind:n,position:r,normalized:i,stem:a,stemConfidence:o,metadata:s}=e;return{value:t,kind:n,position:r,...void 0!==i&&{normalized:i},...void 0!==a&&{stem:a},...void 0!==o&&{stemConfidence:o},...void 0!==s&&{metadata:s}}}const i=e;if(!t||!n)throw Error("createToken requires kind and position parameters");if("string"==typeof r)return{value:i,kind:t,position:n,normalized:r};if(r){const{normalized:e,stem:a,stemConfidence:o,metadata:s}=r;return{value:i,kind:t,position:n,...void 0!==e&&{normalized:e},...void 0!==a&&{stem:a},...void 0!==o&&{stemConfidence:o},...void 0!==s&&{metadata:s}}}return{value:i,kind:t,position:n}}function Mu(e){return/\s/.test(e)}function qu(e){return"#"===e||"."===e||"["===e||"@"===e||"*"===e||"<"===e}function _u(e){return'"'===e||"'"===e||"`"===e||"「"===e||"」"===e}function Du(e){return/\d/.test(e)}function Vu(e){return/[a-zA-Z]/.test(e)}function Hu(e){return/[a-zA-Z0-9_-]/.test(e)}function Fu(e,t){if(t>=e.length)return null;const n=e[t];if(!qu(n))return null;let r=t,i="";if("#"===n||"."===n){for(i+=e[r++];e.length>r&&Hu(e[r]);)i+=e[r++];if(1>=i.length)return null;if(e.length>r&&"."===e[r]&&"#"===n){let t=r+1;for(;e.length>t&&Hu(e[t]);)t++;if(e.length>t&&"("===e[t])return i}}else if("["===n){let t=1,n=0,a=null,o=0;for(i+=e[r++];e.length>r&&t>0;){const s=e[r];i+=s,o?o=0:"\\"===s?o=1:n?s===a&&(n=0,a=null):'"'===s||"'"===s||"`"===s?(n=1,a=s):"["===s?t++:"]"===s&&t--,r++}if(0!==t)return null}else if("@"===n){for(i+=e[r++];e.length>r&&Hu(e[r]);)i+=e[r++];if(1>=i.length)return null}else if("*"===n){for(i+=e[r++];e.length>r&&Hu(e[r]);)i+=e[r++];if(1>=i.length)return null}else if("<"===n){if(i+=e[r++],r>=e.length||!Vu(e[r]))return null;for(;e.length>r&&Hu(e[r]);)i+=e[r++];for(;e.length>r;){const t=e[r];if("."===t){if(i+=e[r++],r>=e.length||!Hu(e[r]))return null;for(;e.length>r&&Hu(e[r]);)i+=e[r++]}else if("#"===t){if(i+=e[r++],r>=e.length||!Hu(e[r]))return null;for(;e.length>r&&Hu(e[r]);)i+=e[r++]}else{if("["!==t)break;{let t=1,n=0,a=null,o=0;for(i+=e[r++];e.length>r&&t>0;){const s=e[r];i+=s,o?o=0:"\\"===s?o=1:n?s===a&&(n=0,a=null):'"'===s||"'"===s||"`"===s?(n=1,a=s):"["===s?t++:"]"===s&&t--,r++}if(0!==t)return null}}}for(;e.length>r&&Mu(e[r]);)i+=e[r++];if(e.length>r&&"/"===e[r])for(i+=e[r++];e.length>r&&Mu(e[r]);)i+=e[r++];if(r>=e.length||">"!==e[r])return null;i+=e[r++]}return i||null}function Bu(e,t){if(t>=e.length||"'"!==e[t])return 0;if(t+1>=e.length)return 0;if("s"!==e[t+1].toLowerCase())return 0;if(t+2>=e.length)return 1;const n=e[t+2];return Mu(n)||"*"===n||!Hu(n)}function Uu(e,t){if(t>=e.length)return null;const n=e[t];if(!_u(n))return null;if("'"===n&&Bu(e,t))return null;const r={'"':'"',"'":"'","`":"`","「":"」"}[n];if(!r)return null;let i=t+1,a=n,o=0;for(;e.length>i;){const t=e[i];if(a+=t,o)o=0;else if("\\"===t)o=1;else if(t===r)return a;i++}return a}function Gu(e,t){if(t>=e.length)return 0;const n=e[t],r=e[t+1]||"",i=e[t+2]||"";if("/"===n&&"/"!==r&&/[a-zA-Z0-9._-]/.test(r))return 1;if("/"===n&&"/"===r&&/[a-zA-Z]/.test(i))return 1;if("."===n&&("/"===r||"."===r&&"/"===i))return 1;const a=e.slice(t,t+8).toLowerCase();return a.startsWith("http://")||a.startsWith("https://")?1:0}function Wu(e,t){if(!Gu(e,t))return null;let n=t,r="";const i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;e.length>n;){const t=e[n];if("#"===t){if(r.length>0&&/[a-zA-Z0-9/.]$/.test(r))for(r+=t,n++;e.length>n&&/[a-zA-Z0-9_-]/.test(e[n]);)r+=e[n++];break}if(!i.test(t))break;r+=t,n++}return 2>r.length?null:r}function Ku(e,t){if(t>=e.length)return null;const n=e[t];if(!Du(n)&&"-"!==n&&"+"!==n)return null;let r=t,i="";if("-"!==e[r]&&"+"!==e[r]||(i+=e[r++]),r>=e.length||!Du(e[r]))return null;for(;e.length>r&&Du(e[r]);)i+=e[r++];if(e.length>r&&"."===e[r])for(i+=e[r++];e.length>r&&Du(e[r]);)i+=e[r++];return e.length>r&&("ms"===e.slice(r,r+2)?i+="ms":"s"!==e[r]&&"m"!==e[r]&&"h"!==e[r]||(i+=e[r])),i}var Ju=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Zu=class{constructor(e=Ju){this.operators=e,this.name="operator",this.operators=[...e].sort((e,t)=>t.length-e.length)}canExtract(e,t){return this.operators.some(n=>e.startsWith(n,t))}extract(e,t){for(const n of this.operators)if(e.startsWith(n,t))return{value:n,length:n.length};return null}},Yu="()[]{},:;",Xu=class{constructor(e=Yu){this.punctuation=e,this.name="punctuation"}canExtract(e,t){return this.punctuation.includes(e[t])}extract(e,t){const n=e[t];return this.punctuation.includes(n)?{value:n,length:1}:null}};function Qu(){return[new Oc,new Cc,new Zu,new Xu,new Nc,new Pc]}function ep(e){return t=>{const n=t.charCodeAt(0);return e.some(([e,t])=>n>=e&&t>=n)}}var tp=new Set(Ju),np=class e{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map,this.extractors=[]}tokenize(e){if(this.isUsingExtractors())return this.tokenizeWithExtractors(e);throw Error(this.constructor.name+": tokenize() not implemented and no extractors registered. Either register extractors or override tokenize() method.")}registerExtractor(e){Rc(e)&&e.setContext($c(this)),this.extractors.push(e)}registerExtractors(e){for(const t of e)this.registerExtractor(t)}clearExtractors(){this.extractors=[]}isUsingExtractors(){return this.extractors.length>0}tokenizeWithExtractors(e){const t=[];let n=0;for(;e.length>n;){for(;e.length>n&&Mu(e[n]);)n++;if(n>=e.length)break;let r=0;for(const i of this.extractors)if(i.canExtract(e,n)){const a=i.extract(e,n);if(a){const e=a.metadata?.normalized,i=a.metadata?.stem,o=a.metadata?.stemConfidence,s={};if(a.metadata)for(const[e,t]of Object.entries(a.metadata))"normalized"!==e&&"stem"!==e&&"stemConfidence"!==e&&(s[e]=t);const l={};e&&(l.normalized=e),i&&(l.stem=i),void 0!==o&&(l.stemConfidence=o),Object.keys(s).length>0&&(l.metadata=s),t.push(Iu(a.value,this.classifyToken(a.value),$u(n,n+a.length),Object.keys(l).length>0?l:void 0)),n+=a.length,r=1;break}}if(!r){const r=e[n],i=this.classifyUnknownChar(r);t.push(Iu(r,i,$u(n,n+1))),n++}}return new Ru(t,this.language)}classifyUnknownChar(e){return"()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,t,n){if("."!==e[t])return 0;const r=n[n.length-1];if(r&&(!r||r.position.end>=t)&&("identifier"===r.kind||"keyword"===r.kind||"selector"===r.kind))return n.push(Iu(".","operator",$u(t,t+1))),1;let i=t+1;for(;e.length>i&&Hu(e[i]);)i++;return e.length>i&&"("===e[i]?(n.push(Iu(".","operator",$u(t,t+1))),1):0}initializeKeywordsFromProfile(e,t=[]){const n=new Map;if(e.keywords)for(const[t,r]of Object.entries(e.keywords))if(n.set(r.primary,{native:r.primary,normalized:r.normalized||t}),r.alternatives)for(const e of r.alternatives)n.set(e,{native:e,normalized:r.normalized||t});if(e.references){for(const[t,r]of Object.entries(e.references))n.set(r,{native:r,normalized:t});for(const t of Object.keys(e.references))n.has(t)||n.set(t,{native:t,normalized:t})}if(e.roleMarkers)for(const[t,r]of Object.entries(e.roleMarkers))if(r.primary&&n.set(r.primary,{native:r.primary,normalized:t}),r.alternatives)for(const e of r.alternatives)n.set(e,{native:e,normalized:t});if(e.possessive?.keywords)for(const[t,r]of Object.entries(e.possessive.keywords))n.set(t,{native:t,normalized:r});for(const e of t)n.set(e.native,e);this.profileKeywords=Array.from(n.values()).sort((e,t)=>t.native.length-e.native.length),this.profileKeywordMap=new Map;for(const e of this.profileKeywords){this.profileKeywordMap.set(e.native.toLowerCase(),e);const t=this.removeDiacritics(e.native);t===e.native||this.profileKeywordMap.has(t.toLowerCase())||this.profileKeywordMap.set(t.toLowerCase(),e)}}removeDiacritics(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(e,t){for(const n of this.profileKeywords)if(e.slice(t).startsWith(n.native))return Iu(n.native,"keyword",$u(t,t+n.native.length),n.normalized);return null}isKeywordStart(e,t){const n=e.slice(t);return this.profileKeywords.some(e=>n.startsWith(e.native))}lookupKeyword(e){return this.profileKeywordMap.get(e.toLowerCase())}isKeyword(e){return this.profileKeywordMap.has(e.toLowerCase())}setNormalizer(e){this.normalizer=e}tryNormalize(e){if(!this.normalizer)return null;const t=this.normalizer.normalize(e);return t.stem===e||.7>t.confidence?null:t}tryMorphKeywordMatch(e,t,n){const r=this.tryNormalize(e);if(!r)return null;const i=this.lookupKeyword(r.stem);if(!i)return null;const a={normalized:i.normalized,stem:r.stem,stemConfidence:r.confidence};return Iu(e,"keyword",$u(t,n),a)}trySelector(e,t){const n=Fu(e,t);return n?Iu(n,"selector",$u(t,t+n.length)):null}tryEventModifier(e,t){if("."!==e[t])return null;const n=e.slice(t).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!n)return null;const r=n[0].replace(/(\s|\.)$/,""),i=r.slice(1).split("(")[0],a=n[1];return{...Iu(r,"event-modifier",$u(t,t+r.length)),metadata:{modifierName:i,value:a?"queue"===i?a:parseInt(a,10):void 0}}}tryString(e,t){const n=Uu(e,t);return n?Iu(n,"literal",$u(t,t+n.length)):null}tryNumber(e,t){const n=Ku(e,t);return n?Iu(n,"literal",$u(t,t+n.length)):null}tryMatchTimeUnit(e,t,n,r=0){let i=t;if(r)for(;e.length>i&&Mu(e[i]);)i++;const a=e.slice(i);for(const e of n){const t=a.slice(0,e.length);if(e.caseInsensitive?t.toLowerCase()===e.pattern.toLowerCase():t===e.pattern){if(e.notFollowedBy&&(a[e.length]||"")===e.notFollowedBy)continue;if(e.checkBoundary&&Hu(a[e.length]||""))continue;return{suffix:e.suffix,endPos:i+e.length}}}return null}parseBaseNumber(e,t,n=1){let r=t,i="";if(!n||"-"!==e[r]&&"+"!==e[r]||(i+=e[r++]),r>=e.length||!Du(e[r]))return null;for(;e.length>r&&Du(e[r]);)i+=e[r++];if(e.length>r&&"."===e[r])for(i+=e[r++];e.length>r&&Du(e[r]);)i+=e[r++];return i&&"-"!==i&&"+"!==i?{number:i,endPos:r}:null}tryNumberWithTimeUnits(t,n,r,i={}){const{allowSign:a=1,skipWhitespace:o=0}=i,s=this.parseBaseNumber(t,n,a);if(!s)return null;let{number:l,endPos:c}=s;const u=[...r,...e.STANDARD_TIME_UNITS],p=this.tryMatchTimeUnit(t,c,u,o);return p&&(l+=p.suffix,c=p.endPos),Iu(l,"literal",$u(n,c))}tryUrl(e,t){const n=Wu(e,t);return n?Iu(n,"url",$u(t,t+n.length)):null}tryVariableRef(e,t){if(":"!==e[t])return null;if(t+1>=e.length)return null;if(!Hu(e[t+1]))return null;let n=t+1;for(;e.length>n&&Hu(e[n]);)n++;return Iu(e.slice(t,n),"identifier",$u(t,n))}tryOperator(e,t){const n=e.slice(t,t+2);if(["==","!=","<=",">=","&&","||","->"].includes(n))return Iu(n,"operator",$u(t,t+2));const r=e[t];return["<",">","!","+","-","*","/","="].includes(r)?Iu(r,"operator",$u(t,t+1)):["(",")","{","}",",",";",":"].includes(r)?Iu(r,"punctuation",$u(t,t+1)):null}tryMultiCharParticle(e,t,n){for(const r of n)if(e.slice(t,t+r.length)===r)return Iu(r,"particle",$u(t,t+r.length));return null}};np.STANDARD_TIME_UNITS=[{pattern:"ms",suffix:"ms",length:2},{pattern:"s",suffix:"s",length:1,checkBoundary:1},{pattern:"m",suffix:"m",length:1,checkBoundary:1,notFollowedBy:"s"},{pattern:"h",suffix:"h",length:1,checkBoundary:1}];var rp=np;function ip(e){return{stem:e,confidence:1}}function ap(e,t,n){return n?{stem:e,confidence:t,metadata:n}:{stem:e,confidence:t}}var op=class{constructor(e){this.language=e.language,this.config={minWordLength:3,minStemLength:2,...e}}normalize(e){const t=e.toLowerCase();if(this.isAlreadyNormalized(t))return ip(e);if(this.config.reflexiveSuffixes){const e=this.tryReflexiveNormalization(t);if(e)return e}if(this.config.endings){const e=this.tryConjugationEndings(t);if(e)return e}if(this.config.suffixRules){const e=this.trySuffixRules(t);if(e)return e}if(this.config.prefixRules){const e=this.tryPrefixRules(t);if(e)return e}return ip(e)}isAlreadyNormalized(e){return this.config.infinitiveEndings?this.config.infinitiveEndings.some(t=>e.endsWith(t)):0}tryReflexiveNormalization(e){const t=this.config.reflexiveSuffixes;if(!t)return null;for(const n of t){if(!e.endsWith(n))continue;const t=e.slice(0,-n.length);if(this.isAlreadyNormalized(t))return ap(t,.88,{removedSuffixes:[n],conjugationType:"reflexive"});const r=this.tryConjugationEndings(t)||this.trySuffixRules(t);if(r&&r.stem!==t)return ap(r.stem,.95*r.confidence,{removedSuffixes:[n,...r.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}tryConjugationEndings(e){const t=this.config.endings;if(!t)return null;const n=this.config.minStemLength??2;for(const r of t){if(!e.endsWith(r.ending))continue;const t=e.slice(0,-r.ending.length);if(t.length>=n)return ap(t+r.stem,r.confidence,{removedSuffixes:[r.ending],conjugationType:r.type})}return null}trySuffixRules(e){const t=this.config.suffixRules;if(!t)return null;const n=this.config.minStemLength??2;for(const r of t){if(!e.endsWith(r.pattern))continue;const t=e.slice(0,-r.pattern.length);if(t.length>=(r.minStemLength??n))return ap(t+(r.replacement||""),r.confidence,{removedSuffixes:[r.pattern],...r.conjugationType&&{conjugationType:r.conjugationType}})}return null}tryPrefixRules(e){const t=this.config.prefixRules;if(!t)return null;for(const n of t){if(!e.startsWith(n.pattern))continue;const t=e.slice(n.pattern.length);if(t.length>=(n.minRemaining??this.config.minStemLength??2))return ap(t,1-n.confidencePenalty,{removedPrefixes:[n.pattern]})}return null}};function sp(e){return{id:e.id,prompt:e.natural,completion:e.explicit,metadata:{domain:e.domain,action:e.action,language:e.language,source:e.source,quality:e.quality,...void 0!==e.confidence&&{confidence:e.confidence}}}}var lp,cp,up,pp,mp,dp=class{constructor(e,t){this.dsl=e,this.config=t}parse(e,t){const n=this.splitStatements(e,t),r=[],i=[];let a;for(const e of n){const n=this.classifyLine(e.text,t);let o=e.text;if(this.config.continuation){const n=this.resolveContinuation(e.text,t,a?.category);null!==n&&(o=n)}if(this.config.preprocessor){const r=this.config.preprocessor(o,n,t,{...null!=a&&{previous:a},lineNumber:e.line,indent:e.indent});if(null===r)continue;o=r}try{const i={node:this.dsl.parse(o,t),source:e.text,line:e.line,...null!=n&&{category:n},indent:e.indent};r.push(i),a=i}catch(t){i.push({message:t instanceof Error?t.message:t+"",line:e.line,source:e.text,code:"parse-error"})}}return{statements:r,errors:i}}splitStatements(e,t){const{mode:n,trim:r=1,commentPrefixes:i=["--","//"]}=this.config.split;if("delimiter"===n)return this.splitByDelimiter(e,t,r,i);const a=e.split("\n"),o=[];for(let e=0;a.length>e;e++){const t=a[e],n=t.length-t.trimStart().length,s=r?t.trim():t;s&&(i.some(e=>s.startsWith(e))||o.push({text:s,line:e+1,indent:n}))}return o}splitByDelimiter(e,t,n,r){const i=e.split(this.config.split.delimiters?.[t]??this.config.split.defaultDelimiter??/,\s*|\n\s*/),a=[];for(let e=0;i.length>e;e++){const t=i[e],o=n?t.trim():t;o&&(r.some(e=>o.startsWith(e))||a.push({text:o,line:e+1,indent:0}))}return a}classifyLine(e,t){if(!this.config.keywords)return;const n=e.toLowerCase(),r=this.config.keywords.wordOrders?.[t]??"SVO";for(const[e,i]of Object.entries(this.config.keywords.categories)){const a=i[t]??i.en??[];for(const t of a){const i=t.toLowerCase();if("SOV"===r){if(n.endsWith(i)||n.startsWith(i))return e}else if(n.startsWith(i))return e}}}resolveContinuation(e,t,n){if(!this.config.continuation||!n)return null;const r=this.config.continuation.keywords[t]??this.config.continuation.keywords.en??[],i=e.toLowerCase();for(const a of r){const r=a.toLowerCase();if(i.startsWith(r)){const r=e.slice(a.length).trim();if(!r)return null;if(this.config.continuation.resolve)return this.config.continuation.resolve(r,n,t,this.config.keywords?.categories??{});const i=this.config.keywords?.categories[n]?.[t]??this.config.keywords?.categories[n]?.en;return i?.[0]?i[0]+" "+r:null}}return null}},fp=Object.freeze({__proto__:null,AOTOrchestrator:class{constructor(e){this.backends=new Map,this.options={confidenceThreshold:e?.confidenceThreshold??.7,continueOnError:e?.continueOnError??1,debug:e?.debug??0}}registerBackend(e){if(this.backends.has(e.domain))throw Error("Backend already registered for domain: "+e.domain);this.backends.set(e.domain,e)}async compileFiles(e,t){const n=Array.from(this.backends.values()).map(e=>e.scanConfig),r=new Lu(n),i=await r.extractFromFiles(e,t);this.options.debug&&console.log(`[aot] Extracted ${i.length} snippets from ${e.length} files`);const a=[],o=[],s={};for(const e of i){s[e.domain]=(s[e.domain]??0)+1;const t=this.compileSnippet(e);if("error"in t){if(o.push({domain:e.domain,source:e.code,file:e.file,line:e.line,message:t.error}),!this.options.continueOnError)break}else a.push(t)}return{compiled:a,errors:o,stats:{totalSnippets:i.length,compiledCount:a.length,errorCount:o.length,domainBreakdown:s}}}compileSnippet(e){const t=this.backends.get(e.domain);if(!t)return{error:"No backend registered for domain: "+e.domain};try{const n=t.dsl.compile(e.code,e.language);return n.ok&&n.code?{domain:e.domain,source:e.code,compiled:n.code,language:e.language,file:e.file,line:e.line}:{error:n.errors?.join("; ")??"Compilation failed"}}catch(e){return{error:e instanceof Error?e.message:e+""}}}generateOutput(e,t){const n=t?.format??"esm",r=t?.includeComments??1,i=t?.groupByDomain??1,a=[];if(r&&(a.push("// Generated by @lokascript/framework AOT compiler"),a.push(`// ${e.stats.compiledCount} snippets compiled, ${e.stats.errorCount} errors`),a.push("")),i){const t=new Map;for(const n of e.compiled){const e=t.get(n.domain)??[];e.push(n),t.set(n.domain,e)}for(const[e,n]of t){r&&(a.push(`// === Domain: ${e} ===`),a.push(""));for(const e of n)r&&(a.push(`// Source: ${e.file}:${e.line}`),a.push("// Language: "+e.language)),a.push(e.compiled),a.push("")}}else for(const t of e.compiled)r&&a.push(`// [${t.domain}] ${t.file}:${t.line}`),a.push(t.compiled),a.push("");const o=a.join("\n").trimEnd();switch(n){case"cjs":return`'use strict';\n\n${o}\n`;case"iife":return`(function() {\n${o}\n})();\n`;default:return o+"\n"}}},BaseMorphologicalNormalizer:op,BaseTokenizer:rp,CrossDomainDispatcher:class{constructor(e,t){this.registry=e,this.minConfidence=t?.minConfidence??.5,this.priority=t?.priority??[]}async detect(e,t="en"){const n=this.registry.getDomainNames();if(0===n.length)return null;const r=[];for(const i of n)try{const n=await this.registry.getDSLForDomain(i);if(!n)continue;const{node:a,confidence:o}=n.parseWithConfidence(e,t);this.minConfidence>o||r.push({domain:i,node:a,confidence:o,dsl:n})}catch{}return 0===r.length?null:(r.sort(this.priority.length>0?(e,t)=>{const n=this.getPriorityIndex(e.domain),r=this.getPriorityIndex(t.domain);return n!==r?n-r:t.confidence-e.confidence}:(e,t)=>t.confidence-e.confidence),r[0])}async parseComposite(e,t="en"){const n=e.split("\n"),r=[],i=[];for(let e=0;n.length>e;e++){const a=n[e];if(xu(a))continue;const o=a.trim(),s=await this.detect(o,t);s?r.push({line:e+1,input:o,domain:s.domain,node:s.node,confidence:s.confidence}):i.push({line:e+1,input:o,message:"No domain matched this input"})}return{statements:r,errors:i}}async compile(e,t="en"){const n=await this.detect(e,t);return n?{...n.dsl.compile(e,t),domain:n.domain}:null}async compileComposite(e,t="en"){const n=e.split("\n"),r=[],i=[];for(let e=0;n.length>e;e++){const a=n[e];if(xu(a))continue;const o=a.trim(),s=await this.detect(o,t);if(s){const n=s.dsl.compile(o,t);r.push({line:e+1,input:o,domain:s.domain,ok:n.ok,code:n.code,errors:n.errors})}else i.push({line:e+1,input:o,message:"No domain matched this input"})}return{statements:r,errors:i}}async validate(e,t="en"){const n=await this.detect(e,t);return n?{...n.dsl.validate(e,t),domain:n.domain}:{valid:0,errors:["No domain matched this input"]}}getPriorityIndex(e){const t=this.priority.indexOf(e);return-1===t?this.priority.length:t}},DEFAULT_OPERATORS:Ju,DEFAULT_PUNCTUATION:Yu,DEFAULT_REFERENCES:Hl,DomainAwareScanner:Lu,DomainRegistry:class{constructor(){this.descriptors=new Map,this.dslCache=new Map,this.rendererCache=new Map}register(e){if(this.descriptors.has(e.name))throw Error("Domain already registered: "+e.name);this.descriptors.set(e.name,e)}setSchemas(e,t){const n=this.descriptors.get(e);if(!n)throw Error("Domain not registered: "+e);this.descriptors.set(e,{...n,schemas:t})}getDomainNames(){return Array.from(this.descriptors.keys())}getDescriptor(e){return this.descriptors.get(e)}getToolDefinitions(){const e=[];for(const t of this.descriptors.values())e.push(...vu(t));return e}canHandle(e){const t=gu(e);return t?this.descriptors.has(t.domain):0}async handleToolCall(e,t){const n=gu(e);if(!n)return null;const r=this.descriptors.get(n.domain);if(!r)return null;try{const e=await this.getDSL(r);switch(n.operation){case"parse":return await this.handleParse(r,e,t);case"compile":return await this.handleCompile(r,e,t);case"validate":return await this.handleValidate(r,e,t);case"translate":return await this.handleTranslate(r,e,t);default:return wu({error:"Unknown operation: "+n.operation},1)}}catch(e){return wu({error:`${r.name} tool error: ${e instanceof Error?e.message:e+""}`},1)}}async getDSLForDomain(e){const t=this.descriptors.get(e);return t?this.getDSL(t):null}generatePrompt(e,t){const n=this.descriptors.get(e);return n?.schemas&&0!==n.schemas.length?Yc({domain:e,description:n.description,schemas:n.schemas,...t}):null}generateTrainingData(e,t){const n=this.descriptors.get(e);return n?.schemas&&0!==n.schemas.length?cu(n.schemas,{domain:e,...t}):null}buildFeedback(e,t,n,r){const i=this.descriptors.get(e);if(!i?.schemas||0===i.schemas.length)return null;const a=this.createSchemaLookup(i.schemas);let o;try{"explicit"===n&&(o=Gl(t,{schemaLookup:a}).action)}catch{}return fu(t,n,r,a,o)}getSchemas(e){const t=this.descriptors.get(e);return t?.schemas?t.schemas:null}createSchemaLookup(e){const t=new Map;for(const n of e)t.set(n.action,n);return{getSchema:e=>t.get(e)}}async getDSL(e){const t=this.dslCache.get(e.name);if(t)return t;const n=await e.getDSL();return this.dslCache.set(e.name,n),n}async getRenderer(e){if(!e.getRenderer)return null;const t=this.rendererCache.get(e.name);if(t)return t;const n=await e.getRenderer();return this.rendererCache.set(e.name,n),n}async handleParse(e,t,n){const r=bu(n,e.inputLabel);if(!r)return ku(e.inputLabel);const i=bu(n,"language","en"),a=t.parse(r,i),o={};for(const[e,t]of a.roles)o[e]=t;return wu({action:a.action,roles:o,language:i,[e.inputLabel]:r})}async handleCompile(e,t,n){const r=bu(n,e.inputLabel);if(!r)return ku(e.inputLabel);const i=bu(n,"language","en"),a=t.compile(r,i);return wu({ok:a.ok,code:a.code,errors:a.errors,language:i,input:r})}async handleValidate(e,t,n){const r=bu(n,e.inputLabel);if(!r)return ku(e.inputLabel);const i=bu(n,"language","en"),a=t.validate(r,i);return wu({valid:a.valid,errors:a.errors,language:i,[e.inputLabel]:r})}async handleTranslate(e,t,n){const r=bu(n,e.inputLabel);if(!r)return ku(e.inputLabel);const i=bu(n,"from");if(!i)return ku("from");const a=bu(n,"to");if(!a)return ku("to");const o=t.parse(r,i),s=t.compile(r,i);let l=null;const c=await this.getRenderer(e);if(c)try{l="function"==typeof c?c(o,a):c.render(o,a)}catch{}const u={};for(const[e,t]of o.roles)u[e]=t;return wu({input:{[e.inputLabel]:r,language:i},...null!=l&&{rendered:{text:l,language:a}},semantic:{action:o.action,roles:u},...s.ok&&null!=s.code&&{compiled:s.code}})}},GrammarTransformer:jc,IdentifierExtractor:Nc,InMemoryDictionary:Ac,InMemoryProfileProvider:Lc,LatinExtendedIdentifierExtractor:class{constructor(){this.name="latin-extended-identifier"}canExtract(e,t){return/\p{L}/u.test(e[t])}extract(e,t){let n=t;for(;e.length>n&&/[\p{L}\p{N}_-]/u.test(e[n]);)n++;return n===t?null:{value:e.slice(t,n),length:n-t}}},NullDictionary:class{lookup(e,t){return e}translate(e,t){return e}getAllTranslations(e,t){return{en:e}}},NullProfileProvider:class{getProfile(e){}getSupportedLanguages(){return[]}hasLanguage(e){return 0}},NumberExtractor:Cc,OperatorExtractor:Zu,PatternMatcher:gc,PatternTracker:class{constructor(e=1e3){this.events=[],this.maxEvents=e}record(e){this.events.push(e),this.events.length>this.maxEvents&&(this.events=this.events.slice(this.events.length-this.maxEvents))}getHitRateByCommand(){return this.computeHitRate(e=>e.action)}getHitRateByLanguage(){return this.computeHitRate(e=>e.language)}getTopFailures(e=10){const t=new Map;for(const e of this.events)if("rejected"===e.outcome&&e.diagnosticCodes)for(const n of e.diagnosticCodes){const r=t.get(n)||{count:0,actions:new Set};r.count++,r.actions.add(e.action),t.set(n,r)}return Array.from(t.entries()).map(([e,{count:t,actions:n}])=>({code:e,count:t,actions:Array.from(n)})).sort((e,t)=>t.count-e.count).slice(0,e)}getSummary(){const e={};for(const t of this.events)e[t.outcome]=(e[t.outcome]||0)+1;return{totalEvents:this.events.length,byOutcome:e,byCommand:this.getHitRateByCommand(),byLanguage:this.getHitRateByLanguage(),topFailures:this.getTopFailures()}}exportJSONL(){return this.events.map(e=>JSON.stringify(e)).join("\n")}get size(){return this.events.length}clear(){this.events=[]}computeHitRate(e){const t=new Map;for(const n of this.events){const r=e(n),i=t.get(r)||{attempts:0,successes:0};i.attempts++,"accepted"===n.outcome&&i.successes++,t.set(r,i)}const n={};for(const[e,{attempts:r,successes:i}]of t)n[e]={attempts:r,successes:i,rate:r>0?i/r:0};return n}},PunctuationExtractor:Xu,StringLiteralExtractor:Oc,TokenStreamImpl:Ru,UnicodeIdentifierExtractor:Pc,WhitespaceExtractor:class{constructor(){this.name="whitespace"}canExtract(e,t){return/\s/.test(e[t])}extract(e,t){let n=0;for(;e.length>t+n&&/\s/.test(e[t+n]);)n++;return n>0?{value:e.substring(t,t+n),length:n}:null}},accumulateBlocks:function(e,t){return"flat"===t.nesting?function(e,t){const n=[],r=[];let i=null;const a=()=>{i&&(n.push({type:i.type,...null!=i.name&&{name:i.name},statements:i.stmts,children:[],line:i.line,indent:i.indent}),i=null)};for(const n of e)if(n.category&&t.blockTypes.includes(n.category)){a();const e=t.extractName?.(n.source,n.category);i={type:n.category,...null!=e&&{name:e},stmts:[n],line:n.line,indent:n.indent}}else i?i.stmts.push(n):r.push(n);return a(),{blocks:n,orphans:r}}(e,t):function(e,t){const n=[],r=[],i=[],a=e=>{for(;i.length>0;){const t=i[i.length-1];if(e>t.indent)break;{i.pop();const e={type:t.type,...null!=t.name&&{name:t.name},statements:t.stmts,children:t.children,line:t.line,indent:t.indent};i.length>0?i[i.length-1].children.push(e):n.push(e)}}};for(const n of e)if(n.category&&t.blockTypes.includes(n.category)){a(n.indent);const e=t.extractName?.(n.source,n.category);i.push({type:n.category,...null!=e&&{name:e},stmts:[n],children:[],line:n.line,indent:n.indent})}else i.length>0?i[i.length-1].stmts.push(n):r.push(n);return a(-1),{blocks:n,orphans:r}}(e,t)},buildDisambiguation:function(e,t){const n=[...t].sort((e,t)=>t.confidence-e.confidence),r=n.map((e,t)=>({action:e.action,confidence:e.confidence,explicit:tc(e.node),description:e.description||`${e.action} (option ${String.fromCharCode(97+t)})`})),i=r.map((e,t)=>` (${String.fromCharCode(97+t)}) ${e.explicit} — ${e.description} (conf: ${e.confidence.toFixed(2)})`);return{input:e,candidates:r,question:[`Your input parsed with confidence ${n[0]?.confidence.toFixed(2)??"?"}.`,...i,"Which did you mean?"].join("\n")}},buildFeedback:fu,buildPhrase:Cu,buildTablesFromProfiles:Nu,combineClassifiers:function(...e){return t=>e.some(e=>e(t))},convertValue:Vc,createAsyncNode:ql,createCommandNode:Nl,createCompoundNode:$l,createConditionalNode:Rl,createDiagnosticCollector:function(){const e=[];function t(t,n,r){const i={message:n,severity:t,...null!=r?.code&&{code:r.code},...null!=r?.line&&{line:r.line},...null!=r?.column&&{column:r.column},...null!=r?.source&&{source:r.source},...null!=r?.suggestions&&r.suggestions.length>0&&{suggestions:r.suggestions}};e.push(i)}return{error(e,n,r){"string"==typeof n?t("error",n,{...r,code:e}):t("error",e,n)},warning(e,n){t("warning",e,n)},info(e,n){t("info",e,n)},add(t){e.push(t)},hasErrors:()=>e.some(e=>"error"===e.severity),getDiagnostics:()=>e,toResult(){let t=0,n=0,r=0;for(const i of e)"error"===i.severity?t++:"warning"===i.severity?n++:r++;return{ok:0===t,diagnostics:e,summary:{errors:t,warnings:n,infos:r}}}}},createEventHandlerNode:Pl,createExpression:Ol,createFlag:Cl,createLatinCharClassifiers:function(e){const t=t=>e.test(t);return{isLetter:t,isIdentifierChar:e=>t(e)||/[0-9_-]/.test(e)}},createLiteral:Tl,createLoopNode:Il,createMatchNode:_l,createMultiStatementParser:function(e,t){return new dp(e,t)},createMultilingualDSL:function(e){const t=e.dictionary??function(e){const t={};for(const n of e.languages){const e={};for(const[t,r]of Object.entries(n.patternProfile.keywords))e[t]=r.primary;t[n.code]=e}return new Ac(t)}(e),n=e.profileProvider??function(e){const t={};for(const n of e.languages)n.grammarProfile&&(t[n.code]=n.grammarProfile);return new Lc(t)}(e),r=new jc({dictionary:t,profileProvider:n}),i=new Jc(e);return new Zc(e,i,r)},createPosition:$u,createPropertyPath:Ll,createReference:Al,createSchemaRenderer:function(e,t){const{keywords:n,markers:r}=Nu(e,t),{sovLanguages:i}=Pu(t),a=new Map;for(const t of e)a.set(t.action,t);return{render(e,t){const o=a.get(e.action);if(!o)return e.action;const s=Ou(n,e.action,t),l=i.has(t),c=[];for(const n of o.roles){const i=Vl(e,n.role);if(!i&&!n.required)continue;const a=n.markerOverride?.[t]??r[n.role]?.[t]??void 0;c.push({...null!=a&&{marker:a},value:i||"",role:n})}const u=[];if(l){for(const e of c)e.value&&u.push(e.value),e.marker&&u.push(e.marker);u.push(s)}else{u.push(s);for(const e of c)e.marker&&u.push(e.marker),e.value&&u.push(e.value)}return Cu(...u)}}},createSelector:jl,createSimpleTokenizer:function(e){const{language:t,direction:n="ltr",keywords:r,keywordExtras:i,keywordProfile:a,includeOperators:o=0,caseInsensitive:s=1,customExtractors:l}=e,c=new Set(s?r.map(e=>e.toLowerCase()):r);return new class extends rp{constructor(){super(),this.language=t,this.direction=n,l&&this.registerExtractors(l),this.registerExtractors(Qu()),a&&this.initializeKeywordsFromProfile(a,i)}classifyToken(e){const t=s?e.toLowerCase():e;return c.has(t)||this.isKeyword(e)?"keyword":/^\d/.test(e)||/^['"]/.test(e)?"literal":o&&tp.has(e)?"operator":"identifier"}}},createToken:Iu,createTokenizerContext:$c,createTryNode:Ml,createUnicodeRangeClassifier:ep,defineCommand:function(e){return{description:e.description||e.action+" command",category:e.category||"general",primaryRole:e.primaryRole||e.roles[0]?.role||"patient",...e,action:e.action,roles:e.roles}},defineRole:function(e){return{description:e.description||e.role+" role",...e,role:e.role,required:e.required,expectedTypes:e.expectedTypes}},detectWordOrders:Pu,extractCssSelector:Fu,extractNumber:Ku,extractRoleValue:Vl,extractStringLiteral:Uu,extractUrl:Wu,extractValue:Dl,filterBySeverity:function(e,t){return e.filter(e=>e.severity===t)},fromEnvelopeJSON:function(e){return{lseVersion:e.lseVersion,...e.features&&e.features.length>0?{features:e.features}:{},nodes:e.nodes.map(oc)}},fromError:function(e,t){return{message:e instanceof Error?e.message:e+"",severity:"error",...null!=t?.code&&{code:t.code},...null!=t?.line&&{line:t.line},...null!=t?.column&&{column:t.column},...null!=t?.source&&{source:t.source},...null!=t?.suggestions&&t.suggestions.length>0&&{suggestions:t.suggestions}}},fromInterchangeNode:_c,fromProtocolJSON:oc,generateExamples:Xc,generatePattern:kc,generatePatternVariants:function(e,t,n=wc){const r=[];return r.push(kc(e,t,n)),r},generatePrompt:Yc,generateProtocolReference:function(){const e=Qc(),t=eu();return`# LokaScript Explicit Syntax (LSE) Quick Reference\n\n${e.content}\n\n${t.content}`},getAllPossessiveKeywords:function(e){return e?.possessive?.keywords??{}},getDefaultExtractors:Qu,getPossessiveReference:hc,getRoleSpec:function(e,t){return e.roles.find(e=>e.role===t)},getRoleValue:function(e,t){return e.roles.get(t)},insertMarkers:Sc,isAsciiIdentifierChar:Hu,isAsciiLetter:Vu,isBuiltInReference:function(e){return new Set(["me","you","it","result","event","target","body"]).has(e.toLowerCase())},isCSSPropertyRef:function(e){return e.startsWith("*")},isCSSSelector:function(e){return e.startsWith(".")||e.startsWith("#")||e.startsWith("<")},isClassName:function(e){return e.startsWith(".")},isCompoundSyntax:function(e){const{segments:t}=Jl(e.trim());return t.length>1},isContextAwareExtractor:Rc,isDigit:Du,isDocumentSyntax:function(e){const t=e.trim();return t.includes("\n")||Yl.test(t)||t.startsWith("//")||t.startsWith("#")&&!t.startsWith("#!")?1:0},isEnvelope:function(e){return"object"==typeof e&&null!==e&&"lseVersion"in e&&"nodes"in e&&Array.isArray(e.nodes)},isExplicitSyntax:Wl,isIdSelector:function(e){return e.startsWith("#")},isNumericValue:function(e){if(e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/))return 1;const t=parseFloat(e);return!isNaN(t)&&isFinite(t)},isPossessiveKeyword:function(e,t){return void 0!==e?.possessive?.keywords?.[t]},isPossessiveMarker:Bu,isPropertyName:function(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)},isQuote:_u,isSelectorStart:qu,isTypeCompatible:yc,isUrlStart:Gu,isValidReference:Fl,isVariableRef:function(e){return e.startsWith(":")},isWhitespace:Mu,joinTokens:Tc,jsonToSemanticNode:function(e){const t=new Map;if(e.roles)for(const[n,r]of Object.entries(e.roles))t.set(n,Mc(r));if(e.trigger){t.set("event",Tl(e.trigger.event,"string"));const n=new Map(t);return n.delete("event"),Pl("on",t,[Nl(e.action,n)],{sourceLanguage:"json"},e.trigger.modifiers??{})}return Nl(e.action,t,{sourceLanguage:"json"})},lookupKeyword:Ou,lookupMarker:function(e,t,n){return e[t]?.[n]??t},matchBest:function(e,t){return bc.matchBest(e,t)},matchPattern:function(e,t){return bc.matchPattern(e,t)},needsDisambiguation:function(e,t=.5,n=.7){return e>=t&&n>e},noChange:ip,normalized:ap,parseCompound:Zl,parseDocument:function(e,t){const n=e.split("\n");let r="1.0";const i=[];let a=0;for(let e=0;n.length>e;e++){const t=n[e].trim();if(!t)continue;const i=t.match(Yl);i&&(r=i[1],a=e+1);break}for(let e=a;n.length>e;e++){const r=n[e].trim();r&&(r.startsWith("//")||r.startsWith("#")&&!r.startsWith("#!")||i.push(Zl(r,t)))}return{lseVersion:r,nodes:i}},parseExplicit:Gl,parseJSONL:function(e){return e.split("\n").filter(e=>e.trim().length>0).map(e=>JSON.parse(e))},patternMatcher:bc,registryToAOTBackends:async function(e){const t=[];for(const n of e.getDomainNames()){const r=e.getDescriptor(n);if(!r?.scanConfig)continue;const i=await e.getDSLForDomain(n);if(!i)continue;const a={domain:n,attributes:[...r.scanConfig.attributes],...r.scanConfig.scriptTypes?{scriptTypes:[...r.scanConfig.scriptTypes]}:{},defaultLanguage:r.scanConfig.defaultLanguage??"en"};t.push({domain:n,dsl:i,codeGenerator:{generate:e=>JSON.stringify({action:e.action,roles:Object.fromEntries(e.roles)})},scanConfig:a})}return t},renderDocument:function(e){const t=[];e.lseVersion&&"1.0"!==e.lseVersion&&t.push("#!lse "+e.lseVersion);for(const n of e.nodes)t.push(tc(n));return t.join("\n")},renderExplicit:tc,renderExpr:Hc,reorderRoles:Ec,semanticNodeToJSON:function e(t){if("compound"===t.kind)return t.statements.length>0?e(t.statements[0]):{action:"compound",roles:{}};if("event-handler"===t.kind){const e=t,n=e.body?.[0]?.action??t.action,r={};if(e.body?.[0])for(const[t,n]of e.body[0].roles)r[t]=qc(n);const i=t.roles.get("event"),a=i?"value"in i?i.value+"":"raw"in i?i.raw:"unknown":"unknown",o={action:"on"===n?e.body?.[0]?.action??"on":n,roles:r,trigger:{event:a}};return e.eventModifiers&&Object.keys(e.eventModifiers).length>0&&(o.trigger.modifiers=e.eventModifiers),o}const n={};for(const[e,r]of t.roles)n[e]=qc(r);return{action:t.action,roles:n}},semanticNodeToRuntimeAST:function e(t){switch(t.kind){case"event-handler":return function(t){const n=t.roles.get("event"),r=n&&"value"in n?n.value+"":"click",i={};return t.eventModifiers&&(t.eventModifiers.once&&(i.once=1),t.eventModifiers.debounce&&(i.debounce=t.eventModifiers.debounce),t.eventModifiers.throttle&&(i.throttle=t.eventModifiers.throttle),t.eventModifiers.queue&&(i.queue=t.eventModifiers.queue)),{type:"event",event:r,modifiers:i,body:(t.body??[]).map(e)}}(t);case"conditional":return function(t){const n=t.roles.get("condition");return{type:"command",name:"if",args:n?[Kc(n)]:[],condition:n?Kc(n):void 0,thenBranch:(t.thenBranch??[]).map(e),elseBranch:(t.elseBranch??[]).map(e)}}(t);case"loop":return function(t){const n=t.roles.get("patient")||t.roles.get("count");return{type:"command",name:"repeat",args:n?[Kc(n)]:[],loopVariant:t.loopVariant??"forever",body:(t.body??[]).map(e),loopVariable:t.loopVariable,indexVariable:t.indexVariable}}(t);case"compound":return{type:"CommandSequence",commands:(t.statements??[]).map(e)};default:return function(e){const t={},n=[];for(const[r,i]of e.roles){const e=Kc(i);t[r]=e,n.push(e)}return{type:"command",name:e.action,args:n,roles:t}}(t)}},semanticValueToAST:Kc,synthesizeFromSchemas:cu,toEnvelopeJSON:function(e){const t={lseVersion:e.lseVersion,nodes:e.nodes.map(rc)};return e.features&&e.features.length>0&&(t.features=[...e.features]),t},toJSONL:function(e){return e.map(e=>JSON.stringify(sp(e))).join("\n")},toJSONLRow:sp,toProtocolJSON:rc,validateProtocolJSON:function(e){const t=[];if("object"!=typeof e||null===e)return[{severity:"error",code:"INVALID_ROOT",message:"Root must be a JSON object"}];const n=e,r="kind"in n?n.kind+"":"command";if("kind"in n&&!cc.has(r)&&t.push({severity:"error",code:"INVALID_KIND",message:`Invalid kind "${n.kind}". Must be one of: command, event-handler, compound`}),"action"in n?"string"==typeof n.action&&0!==n.action.length||t.push({severity:"error",code:"INVALID_ACTION",message:"action must be a non-empty string"}):t.push({severity:"error",code:"MISSING_ACTION",message:"Missing required field: action"}),"roles"in n||"compound"===r){if("roles"in n&&("object"!=typeof n.roles||null===n.roles||Array.isArray(n.roles)))t.push({severity:"error",code:"INVALID_ROLES",message:"roles must be a plain object"});else if("roles"in n&&n.roles)for(const[e,r]of Object.entries(n.roles)){if("object"!=typeof r||null===r){t.push({severity:"error",code:"INVALID_ROLE_VALUE",message:`Role "${e}" value must be an object`});continue}const n=r;"type"in n&&uc.has(n.type+"")||t.push({severity:"error",code:"INVALID_VALUE_TYPE",message:`Role "${e}" has invalid type "${n.type}"`}),"flag"===n.type&&("string"==typeof n.name||"value"in n||t.push({severity:"error",code:"MISSING_FLAG_NAME",message:`Flag role "${e}" missing required field: name (or value)`}),"boolean"==typeof n.enabled||"value"in n||t.push({severity:"error",code:"MISSING_FLAG_ENABLED",message:`Flag role "${e}" missing required field: enabled (or value)`})),"expression"!==n.type||"string"==typeof n.raw||"value"in n||t.push({severity:"error",code:"MISSING_EXPRESSION_RAW",message:`Expression role "${e}" missing required field: raw (or value)`})}}else t.push({severity:"error",code:"MISSING_ROLES",message:"Missing required field: roles"});if("trigger"in n&&n.trigger){const e=n.trigger;"object"!=typeof e||null===e?t.push({severity:"error",code:"INVALID_TRIGGER",message:"trigger must be an object"}):e.event&&"string"==typeof e.event||t.push({severity:"error",code:"INVALID_TRIGGER",message:"trigger.event is required and must be a non-empty string"})}if("event-handler"!==r||"trigger"in n||"body"in n&&Array.isArray(n.body)||t.push({severity:"error",code:"MISSING_BODY",message:"event-handler node requires a body array"}),"compound"===r&&("statements"in n&&Array.isArray(n.statements)||t.push({severity:"error",code:"MISSING_STATEMENTS",message:"compound node requires a statements array"}),"chainType"in n&&!pc.has(n.chainType+"")&&t.push({severity:"error",code:"INVALID_CHAIN_TYPE",message:`Invalid chainType "${n.chainType}"`})),"diagnostics"in n&&!Array.isArray(n.diagnostics)&&t.push({severity:"error",code:"INVALID_DIAGNOSTICS",message:"diagnostics must be an array"}),"annotations"in n)if(Array.isArray(n.annotations))for(let e=0;n.annotations.length>e;e++){const r=n.annotations[e];r&&"object"==typeof r?"string"==typeof r.name&&0!==r.name.length||t.push({severity:"error",code:"MISSING_ANNOTATION_NAME",message:`annotations[${e}] missing required field: name`}):t.push({severity:"error",code:"INVALID_ANNOTATION_ENTRY",message:`annotations[${e}] must be an object`})}else t.push({severity:"error",code:"INVALID_ANNOTATIONS",message:"annotations must be an array"});if("asyncVariant"in n&&!mc.has(n.asyncVariant+"")&&t.push({severity:"error",code:"INVALID_ASYNC_VARIANT",message:`Invalid asyncVariant "${n.asyncVariant}". Must be "all" or "race"`}),"arms"in n)if(Array.isArray(n.arms))for(let e=0;n.arms.length>e;e++){const r=n.arms[e];r&&"object"==typeof r?(r.pattern&&"object"==typeof r.pattern||t.push({severity:"error",code:"MISSING_ARM_PATTERN",message:`arms[${e}] missing required field: pattern`}),Array.isArray(r.body)||t.push({severity:"error",code:"MISSING_ARM_BODY",message:`arms[${e}] missing required field: body (array)`})):t.push({severity:"error",code:"INVALID_ARM_ENTRY",message:`arms[${e}] must be an object`})}else t.push({severity:"error",code:"INVALID_ARMS",message:"arms must be an array"});if("diagnostics"in n&&Array.isArray(n.diagnostics))for(let e=0;n.diagnostics.length>e;e++){const r=n.diagnostics[e];r&&"object"==typeof r?(dc.has(r.level+"")||t.push({severity:"error",code:"INVALID_DIAGNOSTIC_LEVEL",message:`diagnostics[${e}].level must be "error", "warning", or "info"`}),"string"!=typeof r.message&&t.push({severity:"error",code:"MISSING_DIAGNOSTIC_MESSAGE",message:`diagnostics[${e}] missing required field: message`})):t.push({severity:"error",code:"INVALID_DIAGNOSTIC_ENTRY",message:`diagnostics[${e}] must be an object`})}return t},validateSemanticJSON:function(e){const t=[];if(!e.action||"string"!=typeof e.action)return t.push({severity:"error",code:"INVALID_ACTION",message:'Field "action" is required and must be a string.',suggestion:'Provide a command name like "toggle", "add", "set", etc.'}),t;if(e.roles&&"object"==typeof e.roles)for(const[n,r]of Object.entries(e.roles)){if(!r||"object"!=typeof r){t.push({severity:"error",code:"INVALID_ROLE_VALUE",message:`Role "${n}" must be an object with "type" and "value" fields.`,suggestion:'Use: { "type": "selector", "value": ".active" }'});continue}const e=r;Ic.has(e.type)||t.push({severity:"error",code:"INVALID_VALUE_TYPE",message:`Role "${n}" has invalid type "${e.type}".`,suggestion:"Valid types: selector, literal, reference, expression, property-path."}),null==e.value&&t.push({severity:"error",code:"MISSING_VALUE",message:`Role "${n}" is missing the "value" field.`})}return e.trigger&&(e.trigger.event&&"string"==typeof e.trigger.event||t.push({severity:"error",code:"INVALID_TRIGGER",message:'Trigger "event" is required and must be a string.',suggestion:'Use an event name like "click", "mouseover", "keydown".'})),t},validateValueType:function(e,t){return t&&0!==t.length?yc(e.type,t):1},withDefaultExtractors:function(e){return e.registerExtractors(Qu()),e}}),yp=Object.defineProperty,hp=Object.getOwnPropertyNames,vp=(e,t)=>function(){return e&&(t=(0,e[hp(e)[0]])(e=0)),t},gp=(e,t)=>{for(var n in t)yp(e,n,{get:t[n],enumerable:1})};function bp(e,t){const n={...e};for(const r of Object.keys(t)){const i=t[r],a=e[r];void 0!==i&&(n[r]="object"!=typeof i||null===i||Array.isArray(i)||"object"!=typeof a||null===a||Array.isArray(a)?i:bp(a,i))}return n}function wp(e,t){return bp(e,t)}function kp(e){if(!e.extends)return e;const t=cp.get(e.extends);return t?wp(kp(t),e):(console.warn(`[Registry] Profile '${e.code}' extends '${e.extends}' but base is not registered. Make sure to import the base language before the variant.`),e)}function zp(e,t,n){lp.set(e,t),cp.set(e,n),up.delete(e)}function xp(e,t){mp.set(e,t),up.delete(e)}function Ep(e){return e.split("-")[0]}function Sp(e){return e.includes("-")}function Tp(e){let t=cp.get(e);return!t&&Sp(e)&&(t=cp.get(Ep(e))),t?kp(t):void 0}function jp(){return Array.from(lp.keys())}function Ap(e){if(lp.has(e)&&cp.has(e))return 1;if(Sp(e)){const t=Ep(e);return lp.has(t)&&cp.has(t)}return 0}function Lp(e){let t=up.get(e);if(!t&&Sp(e)&&(t=up.get(Ep(e))),t)return t;let n=mp.get(e);if(!n&&Sp(e)&&(n=mp.get(Ep(e))),n)return up.set(e,n),n;if(!pp)throw Error(`No patterns registered for language '${e}'. Either import the language module or set a pattern generator.`);const r=function(e){let t=cp.get(e);if(!t&&Sp(e)){const n=Ep(e);t=cp.get(n)}if(!t){const t=Array.from(cp.keys()).join(", ");throw Error(`Language profile '${e}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${e}';`)}return kp(t)}(e),i=pp(r);return up.set(e,i),i}var Op,Cp=vp({"src/registry.ts"(){lp=new Map,cp=new Map,up=new Map,pp=null,mp=new Map}}),Np={};gp(Np,{arabicProfile:()=>Op});var Pp,Rp=vp({"src/generators/profiles/arabic.ts"(){Op={code:"ar",name:"Arabic",nativeName:"العربية",regions:["priority"],direction:"rtl",script:"arabic",wordOrder:"VSO",markingStrategy:"preposition",usesSpaces:1,verb:{position:"start",subjectDrop:1},references:{me:"أنا",it:"هو",you:"أنت",result:"النتيجة",event:"الحدث",target:"الهدف",body:"الجسم"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:1,specialForms:{me:"لي",it:"له",you:"لك"},keywords:{لي:"me",لك:"you",له:"it",لها:"it"}},roleMarkers:{destination:{primary:"على",alternatives:["في","إلى","ب","قبل","بعد"],position:"before"},source:{primary:"من",position:"before"},patient:{primary:"",position:"before"},style:{primary:"بـ",alternatives:["باستخدام"],position:"before"}},keywords:{toggle:{primary:"بدّل",alternatives:["بدل","غيّر","غير"],normalized:"toggle"},add:{primary:"أضف",alternatives:["اضف"],normalized:"add"},remove:{primary:"احذف",alternatives:["أزل","امسح"],normalized:"remove"},put:{primary:"ضع",alternatives:["اجعل"],normalized:"put"},append:{primary:"ألحق",normalized:"append"},prepend:{primary:"سبق",normalized:"prepend"},take:{primary:"خذ",normalized:"take"},make:{primary:"اصنع",alternatives:["أنشئ"],normalized:"make"},clone:{primary:"استنسخ",normalized:"clone"},swap:{primary:"استبدل",alternatives:["تبادل"],normalized:"swap"},morph:{primary:"حوّل",normalized:"morph"},set:{primary:"اضبط",alternatives:["عيّن","حدد"],normalized:"set"},get:{primary:"احصل",normalized:"get"},increment:{primary:"زِد",alternatives:["زد","ارفع"],normalized:"increment"},decrement:{primary:"أنقص",alternatives:["انقص","قلل"],normalized:"decrement"},log:{primary:"سجل",normalized:"log"},show:{primary:"اظهر",alternatives:["أظهر","اعرض"],normalized:"show"},hide:{primary:"اخف",alternatives:["أخفِ","اخفي","أخف"],normalized:"hide"},transition:{primary:"انتقال",alternatives:["انتقل"],normalized:"transition"},on:{primary:"على",alternatives:["عند","لدى","حين"],normalized:"on"},trigger:{primary:"تشغيل",alternatives:["أطلق","فعّل"],normalized:"trigger"},send:{primary:"أرسل",normalized:"send"},focus:{primary:"تركيز",alternatives:["ركز"],normalized:"focus"},blur:{primary:"ضبابية",alternatives:["شوش"],normalized:"blur"},empty:{primary:"إفراغ",normalized:"empty"},open:{primary:"افتح",normalized:"open"},close:{primary:"أغلق",normalized:"close"},select:{primary:"ظلل",normalized:"select"},clear:{primary:"نظّف",normalized:"clear"},reset:{primary:"إعادة-ضبط",alternatives:["أعد-تعيين"],normalized:"reset"},breakpoint:{primary:"نقطة-توقف",normalized:"breakpoint"},go:{primary:"اذهب",normalized:"go"},scroll:{primary:"مرر",alternatives:["تمرير"],normalized:"scroll"},push:{primary:"ادفع",alternatives:["دفع"],normalized:"push"},replace:{primary:"استبدل_عنوان",alternatives:["أعد_تعيين_عنوان"],normalized:"replace"},process:{primary:"عالج",alternatives:["معالجة"],normalized:"process"},wait:{primary:"انتظر",normalized:"wait"},fetch:{primary:"احضر",alternatives:["جلب"],normalized:"fetch"},settle:{primary:"استقر",normalized:"settle"},if:{primary:"إذا",normalized:"if"},when:{primary:"عندما",normalized:"when"},where:{primary:"أين",normalized:"where"},else:{primary:"وإلا",alternatives:["خلاف ذلك"],normalized:"else"},repeat:{primary:"كرر",normalized:"repeat"},for:{primary:"لكل",normalized:"for"},while:{primary:"بينما",normalized:"while"},continue:{primary:"واصل",normalized:"continue"},halt:{primary:"أوقف",normalized:"halt"},throw:{primary:"ارم",alternatives:["ارمِ"],normalized:"throw"},call:{primary:"استدع",alternatives:["نادِ"],normalized:"call"},return:{primary:"ارجع",alternatives:["عُد"],normalized:"return"},then:{primary:"ثم",alternatives:["بعدها","ثمّ"],normalized:"then"},and:{primary:"وأيضاً",alternatives:["أيضاً"],normalized:"and"},end:{primary:"نهاية",alternatives:["انتهى","آخر"],normalized:"end"},js:{primary:"جافاسكربت",alternatives:["js"],normalized:"js"},async:{primary:"متزامن",normalized:"async"},tell:{primary:"أخبر",normalized:"tell"},default:{primary:"افتراضي",normalized:"default"},init:{primary:"تهيئة",alternatives:["بدء"],normalized:"init"},behavior:{primary:"سلوك",normalized:"behavior"},install:{primary:"تثبيت",alternatives:["ثبّت"],normalized:"install"},measure:{primary:"قياس",alternatives:["قِس"],normalized:"measure"},beep:{primary:"صفّر",normalized:"beep"},break:{primary:"توقف",normalized:"break"},copy:{primary:"انسخ",normalized:"copy"},exit:{primary:"اخرج",normalized:"exit"},pick:{primary:"اختر",normalized:"pick"},render:{primary:"ارسم",normalized:"render"},into:{primary:"في",alternatives:["إلى"],normalized:"into"},before:{primary:"قبل",normalized:"before"},after:{primary:"بعد",normalized:"after"},until:{primary:"حتى",normalized:"until"},event:{primary:"حدث",normalized:"event"},from:{primary:"من",normalized:"from"},connect:{primary:"اتصل",alternatives:["اتصال"],normalized:"connect"},stream:{primary:"تدفق",alternatives:["بث"],normalized:"stream"},live:{primary:"مباشر",alternatives:["حي"],normalized:"live"},socket:{primary:"مقبس",alternatives:["websocket"],normalized:"socket"}},tokenization:{prefixes:["ال","و","ف","ب","ك","ل"]},eventHandler:{eventMarker:{primary:"عند",alternatives:["في","لدى","عندما","حين","حينما","لمّا","لما"],position:"before"},temporalMarkers:["عندما","حين","لمّا"],negationMarker:{primary:"عدم",alternatives:["عدم"],position:"before"}}}}}),$p={};gp($p,{bengaliProfile:()=>Pp});var Ip,Mp=vp({"src/generators/profiles/bengali.ts"(){Pp={code:"bn",name:"Bengali",nativeName:"বাংলা",direction:"ltr",script:"bengali",wordOrder:"SOV",markingStrategy:"postposition",usesSpaces:1,defaultVerbForm:"imperative",verb:{position:"end",suffixes:["ুন","ো","া","ে","ি"],subjectDrop:1},references:{me:"আমি",it:"এটি",you:"আপনি",result:"ফলাফল",event:"ঘটনা",target:"লক্ষ্য",body:"বডি"},possessive:{marker:"র",markerPosition:"between",keywords:{আমার:"me",তোমার:"you",আপনার:"you",তার:"it",এর:"it"}},roleMarkers:{patient:{primary:"কে",position:"after"},destination:{primary:"তে",alternatives:["এ"],position:"after"},source:{primary:"থেকে",position:"after"},style:{primary:"দিয়ে",position:"after"},event:{primary:"তে",position:"after"}},keywords:{toggle:{primary:"টগল",normalized:"toggle"},add:{primary:"যোগ",alternatives:["যোগ করুন"],normalized:"add"},remove:{primary:"সরান",alternatives:["সরিয়ে ফেলুন","মুছুন"],normalized:"remove"},put:{primary:"রাখুন",alternatives:["রাখ"],normalized:"put"},append:{primary:"শেষে যোগ",alternatives:[],normalized:"append"},prepend:{primary:"শুরুতে যোগ",alternatives:[],normalized:"prepend"},take:{primary:"নিন",alternatives:["নে"],normalized:"take"},make:{primary:"তৈরি করুন",alternatives:["বানান"],normalized:"make"},clone:{primary:"ক্লোন",alternatives:["প্রতিলিপি"],normalized:"clone"},swap:{primary:"বদল",alternatives:[],normalized:"swap"},morph:{primary:"রূপান্তর",alternatives:[],normalized:"morph"},set:{primary:"সেট",alternatives:["নির্ধারণ"],normalized:"set"},get:{primary:"পান",normalized:"get"},increment:{primary:"বৃদ্ধি",alternatives:["বাড়ান"],normalized:"increment"},decrement:{primary:"হ্রাস",alternatives:["কমান"],normalized:"decrement"},log:{primary:"লগ",alternatives:["রেকর্ড"],normalized:"log"},show:{primary:"দেখান",alternatives:["দেখাও"],normalized:"show"},hide:{primary:"লুকান",alternatives:["লুকাও"],normalized:"hide"},transition:{primary:"সংক্রমণ",alternatives:[],normalized:"transition"},on:{primary:"তে",alternatives:["এ"],normalized:"on"},trigger:{primary:"ট্রিগার",alternatives:[],normalized:"trigger"},send:{primary:"পাঠান",alternatives:["পাঠাও"],normalized:"send"},focus:{primary:"ফোকাস",alternatives:["মনোযোগ"],normalized:"focus"},blur:{primary:"ঝাপসা",alternatives:["ফোকাস_সরান"],normalized:"blur"},empty:{primary:"খালি-করুন",normalized:"empty"},open:{primary:"খুলুন",normalized:"open"},close:{primary:"বন্ধ",normalized:"close"},select:{primary:"নির্বাচন",normalized:"select"},clear:{primary:"পরিষ্কার",normalized:"clear"},reset:{primary:"রিসেট",normalized:"reset"},breakpoint:{primary:"ব্রেকপয়েন্ট",normalized:"breakpoint"},click:{primary:"ক্লিক",normalized:"click"},hover:{primary:"হোভার",alternatives:["উপরে_রাখুন"],normalized:"hover"},submit:{primary:"সাবমিট",alternatives:["জমা"],normalized:"submit"},input:{primary:"ইনপুট",alternatives:["প্রবেশ"],normalized:"input"},change:{primary:"পরিবর্তন",normalized:"change"},go:{primary:"যান",alternatives:["যাও"],normalized:"go"},scroll:{primary:"স্ক্রোল",normalized:"scroll"},push:{primary:"পুশ",alternatives:["ঠেলুন"],normalized:"push"},replace:{primary:"প্রতিস্থাপন",normalized:"replace"},process:{primary:"প্রসেস",alternatives:["প্রক্রিয়া"],normalized:"process"},wait:{primary:"অপেক্ষা",normalized:"wait"},fetch:{primary:"আনুন",alternatives:[],normalized:"fetch"},settle:{primary:"স্থির",alternatives:[],normalized:"settle"},if:{primary:"যদি",alternatives:[],normalized:"if"},when:{primary:"যখন",normalized:"when"},where:{primary:"কোথায়",normalized:"where"},else:{primary:"নতুবা",alternatives:["না হলে"],normalized:"else"},repeat:{primary:"পুনরাবৃত্তি",alternatives:["বার বার"],normalized:"repeat"},for:{primary:"জন্য",alternatives:[],normalized:"for"},while:{primary:"যতক্ষণ",alternatives:[],normalized:"while"},continue:{primary:"চালিয়ে যান",alternatives:[],normalized:"continue"},halt:{primary:"থামুন",alternatives:["থামাও"],normalized:"halt"},throw:{primary:"নিক্ষেপ",alternatives:["ছুঁড়ে দিন"],normalized:"throw"},call:{primary:"কল",alternatives:["ডাকুন"],normalized:"call"},return:{primary:"ফিরুন",alternatives:["ফেরত দিন"],normalized:"return"},then:{primary:"তারপর",alternatives:["তখন"],normalized:"then"},and:{primary:"এবং",alternatives:[],normalized:"and"},end:{primary:"শেষ",alternatives:["সমাপ্ত"],normalized:"end"},js:{primary:"জেএস",alternatives:["js"],normalized:"js"},async:{primary:"অ্যাসিঙ্ক",alternatives:[],normalized:"async"},tell:{primary:"বলুন",alternatives:["বল"],normalized:"tell"},default:{primary:"ডিফল্ট",alternatives:[],normalized:"default"},init:{primary:"শুরু",alternatives:[],normalized:"init"},behavior:{primary:"আচরণ",alternatives:[],normalized:"behavior"},install:{primary:"ইনস্টল",alternatives:[],normalized:"install"},measure:{primary:"মাপুন",alternatives:[],normalized:"measure"},beep:{primary:"বীপ",alternatives:[],normalized:"beep"},break:{primary:"ভাঙুন",alternatives:[],normalized:"break"},copy:{primary:"কপি",alternatives:[],normalized:"copy"},exit:{primary:"বের",alternatives:[],normalized:"exit"},pick:{primary:"বাছুন",alternatives:[],normalized:"pick"},render:{primary:"রেন্ডার",alternatives:[],normalized:"render"},into:{primary:"ভিতরে",normalized:"into"},before:{primary:"আগে",alternatives:[],normalized:"before"},after:{primary:"পরে",alternatives:[],normalized:"after"},until:{primary:"পর্যন্ত",alternatives:[],normalized:"until"},event:{primary:"ঘটনা",alternatives:[],normalized:"event"},from:{primary:"থেকে",normalized:"from"},connect:{primary:"কানেক্ট",alternatives:["সংযোগ","যুক্ত"],normalized:"connect"},stream:{primary:"স্ট্রিম",alternatives:["স্রোত","প্রবাহ"],normalized:"stream"},live:{primary:"লাইভ",alternatives:["সরাসরি","প্রত্যক্ষ"],normalized:"live"},socket:{primary:"সকেট",alternatives:["ওয়েবসকেট"],normalized:"socket"}},tokenization:{particles:["কে","তে","থেকে","র","এর","দিয়ে","জন্য","পর্যন্ত"],boundaryStrategy:"space"},eventHandler:{keyword:{primary:"তে",alternatives:["এ","যখন"],normalized:"on"},sourceMarker:{primary:"থেকে",position:"after"},eventMarker:{primary:"তে",alternatives:["এ"],position:"after"},temporalMarkers:["যখন","যখনই"]}}}}),qp={};gp(qp,{germanProfile:()=>Ip});var _p,Dp=vp({"src/generators/profiles/german.ts"(){Ip={code:"de",name:"German",nativeName:"Deutsch",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:1,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:0},references:{me:"ich",it:"es",you:"du",result:"Ergebnis",event:"Ereignis",target:"Ziel",body:"Körper"},possessive:{marker:"",markerPosition:"before-property",usePossessiveAdjectives:1,specialForms:{me:"mein",it:"sein",you:"dein"},keywords:{mein:"me",meine:"me",meinen:"me",dein:"you",deine:"you",deinen:"you",sein:"it",seine:"it",seinen:"it"}},roleMarkers:{destination:{primary:"auf",alternatives:["zu","in"],position:"before"},source:{primary:"von",alternatives:["aus"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"mit",position:"before"}},keywords:{toggle:{primary:"umschalten",alternatives:["wechseln"],normalized:"toggle"},add:{primary:"hinzufügen",normalized:"add"},remove:{primary:"entfernen",alternatives:["löschen"],normalized:"remove"},put:{primary:"setzen",alternatives:["stellen","platzieren"],normalized:"put"},append:{primary:"anhängen",normalized:"append"},prepend:{primary:"voranstellen",normalized:"prepend"},take:{primary:"nehmen",normalized:"take"},make:{primary:"machen",alternatives:["erstellen","erzeugen"],normalized:"make"},clone:{primary:"klonen",alternatives:["duplizieren"],normalized:"clone"},swap:{primary:"austauschen",alternatives:["tauschen","vertauschen"],normalized:"swap"},morph:{primary:"verwandeln",alternatives:["transformieren"],normalized:"morph"},set:{primary:"festlegen",alternatives:["definieren"],normalized:"set"},get:{primary:"holen",alternatives:["bekommen"],normalized:"get"},increment:{primary:"erhöhen",normalized:"increment"},decrement:{primary:"verringern",alternatives:["vermindern"],normalized:"decrement"},log:{primary:"protokollieren",alternatives:["ausgeben"],normalized:"log"},show:{primary:"zeigen",alternatives:["anzeigen"],normalized:"show"},hide:{primary:"verbergen",alternatives:["verstecken"],normalized:"hide"},transition:{primary:"übergang",alternatives:["animieren"],normalized:"transition"},on:{primary:"bei",alternatives:["auf"],normalized:"on"},trigger:{primary:"auslösen",normalized:"trigger"},send:{primary:"senden",alternatives:["schicken"],normalized:"send"},focus:{primary:"fokussieren",normalized:"focus"},blur:{primary:"defokussieren",alternatives:["entfokussieren"],normalized:"blur"},empty:{primary:"leeren",normalized:"empty"},open:{primary:"öffnen",alternatives:["oeffnen"],normalized:"open"},close:{primary:"schließen",alternatives:["schliessen"],normalized:"close"},select:{primary:"markieren",normalized:"select"},clear:{primary:"bereinigen",normalized:"clear"},reset:{primary:"zurücksetzen",alternatives:["zuruecksetzen"],normalized:"reset"},breakpoint:{primary:"haltepunkt",normalized:"breakpoint"},go:{primary:"gehen",alternatives:["navigieren"],normalized:"go"},scroll:{primary:"scrollen",normalized:"scroll"},push:{primary:"drücken",alternatives:["push"],normalized:"push"},replace:{primary:"ersetzen",normalized:"replace"},process:{primary:"verarbeiten",normalized:"process"},wait:{primary:"warten",normalized:"wait"},fetch:{primary:"abrufen",alternatives:["laden"],normalized:"fetch"},settle:{primary:"stabilisieren",normalized:"settle"},if:{primary:"falls",alternatives:["sofern"],normalized:"if"},when:{primary:"wenn",normalized:"when"},where:{primary:"wo",normalized:"where"},else:{primary:"sonst",alternatives:["ansonsten"],normalized:"else"},repeat:{primary:"wiederholen",normalized:"repeat"},for:{primary:"für",normalized:"for"},while:{primary:"solange",alternatives:["während"],normalized:"while"},continue:{primary:"fortfahren",alternatives:["weiter"],normalized:"continue"},halt:{primary:"anhalten",alternatives:["stoppen"],normalized:"halt"},throw:{primary:"werfen",normalized:"throw"},call:{primary:"aufrufen",normalized:"call"},return:{primary:"zurückgeben",normalized:"return"},then:{primary:"dann",alternatives:["danach","anschließend"],normalized:"then"},and:{primary:"und",alternatives:["sowie","auch"],normalized:"and"},end:{primary:"ende",alternatives:["fertig"],normalized:"end"},js:{primary:"js",alternatives:["javascript"],normalized:"js"},async:{primary:"asynchron",normalized:"async"},tell:{primary:"sagen",normalized:"tell"},default:{primary:"standard",normalized:"default"},init:{primary:"initialisieren",normalized:"init"},behavior:{primary:"verhalten",normalized:"behavior"},install:{primary:"installieren",normalized:"install"},measure:{primary:"messen",normalized:"measure"},beep:{primary:"piepton",normalized:"beep"},break:{primary:"unterbrechen",normalized:"break"},copy:{primary:"kopieren",normalized:"copy"},exit:{primary:"beenden",normalized:"exit"},pick:{primary:"auswählen",normalized:"pick"},render:{primary:"rendern",normalized:"render"},into:{primary:"hinein",normalized:"into"},before:{primary:"vor",normalized:"before"},after:{primary:"nach",normalized:"after"},click:{primary:"Klick",alternatives:["Klicken"],normalized:"click"},hover:{primary:"Hover",alternatives:["Schweben"],normalized:"hover"},submit:{primary:"Absenden",alternatives:["Senden"],normalized:"submit"},input:{primary:"Eingabe",normalized:"input"},change:{primary:"Änderung",alternatives:["Ändern"],normalized:"change"},until:{primary:"bis",normalized:"until"},event:{primary:"Ereignis",alternatives:["Event"],normalized:"event"},from:{primary:"von",alternatives:["aus"],normalized:"from"},connect:{primary:"verbinden",alternatives:["Verbindung"],normalized:"connect"},stream:{primary:"stream",alternatives:["Strom"],normalized:"stream"},live:{primary:"direkt",alternatives:["live","echtzeit"],normalized:"live"},socket:{primary:"socket",alternatives:["websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"bei",alternatives:["auf"],normalized:"on"},sourceMarker:{primary:"von",alternatives:["aus"],position:"before"},conditionalKeyword:{primary:"wenn",alternatives:["falls"]},eventMarker:{primary:"bei",alternatives:["beim"],position:"before"},temporalMarkers:["wenn","bei"]}}}}),Vp={};gp(Vp,{englishProfile:()=>_p});var Hp,Fp=vp({"src/generators/profiles/english.ts"(){_p={code:"en",name:"English",nativeName:"English",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:1,defaultVerbForm:"base",verb:{position:"start",subjectDrop:0},references:{me:"me",it:"it",you:"you",result:"result",event:"event",target:"target",body:"body"},possessive:{marker:"'s",markerPosition:"after-object",specialForms:{me:"my",it:"its",you:"your"},keywords:{my:"me",your:"you",its:"it"}},roleMarkers:{destination:{primary:"on",alternatives:["to","from"],position:"before"},source:{primary:"from",position:"before"},patient:{primary:"",position:"before"},style:{primary:"with",alternatives:["by","using"],position:"before"},responseType:{primary:"as",position:"before"},method:{primary:"via",alternatives:["using"],position:"before"}},keywords:{toggle:{primary:"toggle"},add:{primary:"add"},remove:{primary:"remove"},put:{primary:"put"},append:{primary:"append"},prepend:{primary:"prepend"},take:{primary:"take"},make:{primary:"make"},clone:{primary:"clone"},swap:{primary:"swap"},morph:{primary:"morph"},set:{primary:"set"},get:{primary:"get"},increment:{primary:"increment"},decrement:{primary:"decrement"},log:{primary:"log"},show:{primary:"show"},hide:{primary:"hide"},transition:{primary:"transition"},on:{primary:"on"},trigger:{primary:"trigger"},send:{primary:"send"},focus:{primary:"focus"},blur:{primary:"blur"},empty:{primary:"empty",normalized:"empty"},open:{primary:"open",normalized:"open"},close:{primary:"close",normalized:"close"},select:{primary:"select",normalized:"select"},clear:{primary:"clear",normalized:"clear"},reset:{primary:"reset",normalized:"reset"},breakpoint:{primary:"breakpoint",normalized:"breakpoint"},go:{primary:"go"},scroll:{primary:"scroll",normalized:"scroll"},push:{primary:"push",normalized:"push"},replace:{primary:"replace",normalized:"replace"},process:{primary:"process",normalized:"process"},wait:{primary:"wait"},fetch:{primary:"fetch"},settle:{primary:"settle"},if:{primary:"if"},when:{primary:"when",normalized:"when"},where:{primary:"where",normalized:"where"},else:{primary:"else"},repeat:{primary:"repeat"},for:{primary:"for"},while:{primary:"while"},continue:{primary:"continue"},halt:{primary:"halt"},throw:{primary:"throw"},call:{primary:"call"},return:{primary:"return"},then:{primary:"then"},and:{primary:"and"},end:{primary:"end"},js:{primary:"js"},async:{primary:"async"},tell:{primary:"tell"},default:{primary:"default"},init:{primary:"init"},behavior:{primary:"behavior"},install:{primary:"install"},measure:{primary:"measure"},beep:{primary:"beep"},break:{primary:"break"},copy:{primary:"copy"},exit:{primary:"exit"},pick:{primary:"pick"},render:{primary:"render"},into:{primary:"into"},before:{primary:"before"},after:{primary:"after"},until:{primary:"until"},event:{primary:"event"},from:{primary:"from"},connect:{primary:"connect",normalized:"connect"},stream:{primary:"stream",normalized:"stream"},live:{primary:"live",normalized:"live"},socket:{primary:"socket",alternatives:["websocket"],normalized:"socket"}}}}}),Bp={};gp(Bp,{spanishProfile:()=>Hp});var Up,Gp=vp({"src/generators/profiles/spanish.ts"(){Hp={code:"es",name:"Spanish",nativeName:"Español",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:1,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:1},references:{me:"yo",it:"ello",you:"tú",result:"resultado",event:"evento",target:"objetivo",body:"cuerpo"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:1,specialForms:{me:"mi",it:"su",you:"tu"},keywords:{mi:"me",tu:"you",su:"it"}},roleMarkers:{destination:{primary:"en",alternatives:["sobre","a"],position:"before"},source:{primary:"de",alternatives:["desde"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"con",position:"before"}},keywords:{toggle:{primary:"alternar",alternatives:["conmutar","toggle"],normalized:"toggle"},add:{primary:"agregar",alternatives:["añadir"],normalized:"add"},remove:{primary:"quitar",alternatives:["eliminar","remover","sacar","borrar"],normalized:"remove"},put:{primary:"poner",alternatives:["colocar","pon"],normalized:"put"},append:{primary:"anexar",normalized:"append"},prepend:{primary:"anteponer",normalized:"prepend"},take:{primary:"tomar",normalized:"take"},make:{primary:"hacer",alternatives:["crear"],normalized:"make"},clone:{primary:"clonar",alternatives:["duplicar"],normalized:"clone"},swap:{primary:"intercambiar",alternatives:["permutar"],normalized:"swap"},morph:{primary:"transformar",alternatives:["convertir"],normalized:"morph"},set:{primary:"establecer",alternatives:["fijar","definir"],normalized:"set"},get:{primary:"obtener",alternatives:["conseguir"],normalized:"get"},increment:{primary:"incrementar",alternatives:["aumentar"],normalized:"increment"},decrement:{primary:"decrementar",alternatives:["disminuir"],normalized:"decrement"},log:{primary:"registrar",alternatives:["imprimir"],normalized:"log"},show:{primary:"mostrar",alternatives:["enseñar"],normalized:"show"},hide:{primary:"ocultar",alternatives:["esconder"],normalized:"hide"},transition:{primary:"transición",alternatives:["animar"],normalized:"transition"},on:{primary:"en",alternatives:["al"],normalized:"on"},trigger:{primary:"disparar",alternatives:["activar"],normalized:"trigger"},send:{primary:"enviar",normalized:"send"},focus:{primary:"enfocar",alternatives:["enfoque"],normalized:"focus"},blur:{primary:"desenfocar",alternatives:["desenfoque"],normalized:"blur"},open:{primary:"abrir",normalized:"open"},close:{primary:"cerrar",normalized:"close"},select:{primary:"seleccionar",normalized:"select"},clear:{primary:"limpiar",normalized:"clear"},reset:{primary:"reiniciar",alternatives:["restablecer"],normalized:"reset"},breakpoint:{primary:"punto-interrupción",alternatives:["punto-interrupcion"],normalized:"breakpoint"},click:{primary:"clic",alternatives:["hacer clic","click"],normalized:"click"},hover:{primary:"sobrevolar",alternatives:["pasar por encima"],normalized:"hover"},submit:{primary:"envío",alternatives:["envio","someter"],normalized:"submit"},input:{primary:"entrada",alternatives:["introducir"],normalized:"input"},change:{primary:"cambio",alternatives:["cambiar"],normalized:"change"},load:{primary:"carga",normalized:"load"},scroll:{primary:"desplazar",alternatives:["desplazamiento"],normalized:"scroll"},keydown:{primary:"tecla abajo",normalized:"keydown"},keyup:{primary:"tecla arriba",normalized:"keyup"},mouseover:{primary:"ratón encima",alternatives:["raton encima"],normalized:"mouseover"},mouseout:{primary:"ratón fuera",alternatives:["raton fuera"],normalized:"mouseout"},go:{primary:"ir",alternatives:["navegar"],normalized:"go"},push:{primary:"empujar",alternatives:["push"],normalized:"push"},replace:{primary:"reemplazar",alternatives:["sustituir"],normalized:"replace"},process:{primary:"procesar",normalized:"process"},wait:{primary:"esperar",normalized:"wait"},fetch:{primary:"buscar",alternatives:["recuperar"],normalized:"fetch"},settle:{primary:"estabilizar",normalized:"settle"},if:{primary:"si",normalized:"if"},when:{primary:"cuando",normalized:"when"},where:{primary:"donde",normalized:"where"},else:{primary:"sino",alternatives:["de lo contrario"],normalized:"else"},repeat:{primary:"repetir",normalized:"repeat"},for:{primary:"para",normalized:"for"},while:{primary:"mientras",normalized:"while"},continue:{primary:"continuar",normalized:"continue"},halt:{primary:"detener",alternatives:["parar"],normalized:"halt"},throw:{primary:"lanzar",alternatives:["arrojar"],normalized:"throw"},call:{primary:"llamar",normalized:"call"},return:{primary:"retornar",alternatives:["devolver"],normalized:"return"},then:{primary:"entonces",alternatives:["luego"],normalized:"then"},and:{primary:"y",alternatives:["además","también"],normalized:"and"},or:{primary:"o",normalized:"or"},not:{primary:"no",normalized:"not"},is:{primary:"es",normalized:"is"},exists:{primary:"existe",normalized:"exists"},empty:{primary:"vacío",alternatives:["vacio"],normalized:"empty"},end:{primary:"fin",alternatives:["final","terminar"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"asíncrono",alternatives:["asincrono"],normalized:"async"},tell:{primary:"decir",normalized:"tell"},default:{primary:"predeterminar",alternatives:["por defecto"],normalized:"default"},init:{primary:"iniciar",alternatives:["inicializar"],normalized:"init"},behavior:{primary:"comportamiento",normalized:"behavior"},install:{primary:"instalar",normalized:"install"},measure:{primary:"medir",normalized:"measure"},beep:{primary:"pitido",normalized:"beep"},break:{primary:"romper",normalized:"break"},copy:{primary:"copiar",normalized:"copy"},exit:{primary:"salir",normalized:"exit"},pick:{primary:"escoger",normalized:"pick"},render:{primary:"renderizar",normalized:"render"},first:{primary:"primero",alternatives:["primera"],normalized:"first"},last:{primary:"último",alternatives:["ultima"],normalized:"last"},next:{primary:"siguiente",normalized:"next"},previous:{primary:"anterior",normalized:"previous"},closest:{primary:"cercano",normalized:"closest"},parent:{primary:"padre",normalized:"parent"},into:{primary:"dentro",alternatives:["adentro","dentro de"],normalized:"into"},before:{primary:"antes",alternatives:["antes de"],normalized:"before"},after:{primary:"después",alternatives:["despues","después de","despues de"],normalized:"after"},out:{primary:"fuera",alternatives:["fuera de"],normalized:"out"},until:{primary:"hasta",alternatives:["hasta que"],normalized:"until"},event:{primary:"evento",normalized:"event"},from:{primary:"de",alternatives:["desde"],normalized:"from"},connect:{primary:"conectar",alternatives:["conectarse"],normalized:"connect"},stream:{primary:"transmitir",alternatives:["flujo"],normalized:"stream"},live:{primary:"en-vivo",alternatives:["vivo","directo"],normalized:"live"},socket:{primary:"socket",alternatives:["websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"al",alternatives:["cuando","en"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["desde"],position:"before"},eventMarker:{primary:"al",alternatives:["cuando"],position:"before"},temporalMarkers:["cuando","al"]}}}}),Wp={};gp(Wp,{frenchProfile:()=>Up});var Kp,Jp=vp({"src/generators/profiles/french.ts"(){Up={code:"fr",name:"French",nativeName:"Français",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:1,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:0},references:{me:"moi",it:"il",you:"toi",result:"résultat",event:"événement",target:"cible",body:"corps"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:1,specialForms:{me:"ma",it:"sa",you:"ta"},keywords:{mon:"me",ma:"me",mes:"me",ton:"you",ta:"you",tes:"you",son:"it",sa:"it",ses:"it"}},roleMarkers:{destination:{primary:"sur",alternatives:["à","dans"],position:"before"},source:{primary:"de",alternatives:["depuis"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"avec",position:"before"}},keywords:{toggle:{primary:"basculer",alternatives:["alterner"],normalized:"toggle"},add:{primary:"ajouter",normalized:"add"},remove:{primary:"supprimer",alternatives:["enlever","retirer"],normalized:"remove"},put:{primary:"mettre",alternatives:["placer"],normalized:"put"},append:{primary:"annexer",normalized:"append"},prepend:{primary:"préfixer",normalized:"prepend"},take:{primary:"prendre",normalized:"take"},make:{primary:"faire",alternatives:["créer"],normalized:"make"},clone:{primary:"cloner",alternatives:["dupliquer"],normalized:"clone"},swap:{primary:"échanger",alternatives:["permuter"],normalized:"swap"},morph:{primary:"transformer",alternatives:["métamorphoser"],normalized:"morph"},set:{primary:"définir",alternatives:["établir"],normalized:"set"},get:{primary:"obtenir",normalized:"get"},increment:{primary:"incrémenter",alternatives:["augmenter"],normalized:"increment"},decrement:{primary:"décrémenter",alternatives:["diminuer"],normalized:"decrement"},log:{primary:"enregistrer",alternatives:["journaliser"],normalized:"log"},show:{primary:"montrer",alternatives:["afficher"],normalized:"show"},hide:{primary:"cacher",alternatives:["masquer"],normalized:"hide"},transition:{primary:"transition",alternatives:["animer"],normalized:"transition"},on:{primary:"sur",alternatives:["lors"],normalized:"on"},trigger:{primary:"déclencher",normalized:"trigger"},send:{primary:"envoyer",normalized:"send"},focus:{primary:"focaliser",alternatives:["concentrer"],normalized:"focus"},blur:{primary:"défocaliser",normalized:"blur"},empty:{primary:"vider",normalized:"empty"},open:{primary:"ouvrir",normalized:"open"},close:{primary:"fermer",normalized:"close"},select:{primary:"sélectionner",alternatives:["selectionner"],normalized:"select"},clear:{primary:"effacer",normalized:"clear"},reset:{primary:"réinitialiser",alternatives:["reinitialiser"],normalized:"reset"},breakpoint:{primary:"point-arrêt",alternatives:["point-arret"],normalized:"breakpoint"},go:{primary:"aller",alternatives:["naviguer"],normalized:"go"},scroll:{primary:"défiler",alternatives:["faire-défiler"],normalized:"scroll"},push:{primary:"pousser",normalized:"push"},replace:{primary:"remplacer",normalized:"replace"},process:{primary:"traiter",normalized:"process"},wait:{primary:"attendre",normalized:"wait"},fetch:{primary:"chercher",alternatives:["récupérer"],normalized:"fetch"},settle:{primary:"stabiliser",normalized:"settle"},if:{primary:"si",normalized:"if"},when:{primary:"quand",normalized:"when"},where:{primary:"où",normalized:"where"},else:{primary:"sinon",normalized:"else"},repeat:{primary:"répéter",normalized:"repeat"},for:{primary:"pour",normalized:"for"},while:{primary:"pendant",normalized:"while"},continue:{primary:"continuer",normalized:"continue"},halt:{primary:"arrêter",alternatives:["stopper"],normalized:"halt"},throw:{primary:"lancer",normalized:"throw"},call:{primary:"appeler",normalized:"call"},return:{primary:"retourner",alternatives:["renvoyer"],normalized:"return"},then:{primary:"puis",alternatives:["ensuite","alors"],normalized:"then"},and:{primary:"et",alternatives:["aussi","également"],normalized:"and"},end:{primary:"fin",alternatives:["terminer","finir"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"asynchrone",normalized:"async"},tell:{primary:"dire",normalized:"tell"},default:{primary:"défaut",normalized:"default"},init:{primary:"initialiser",normalized:"init"},behavior:{primary:"comportement",normalized:"behavior"},install:{primary:"installer",normalized:"install"},measure:{primary:"mesurer",normalized:"measure"},beep:{primary:"bip",normalized:"beep"},break:{primary:"interrompre",normalized:"break"},copy:{primary:"copier",normalized:"copy"},exit:{primary:"sortir",normalized:"exit"},pick:{primary:"choisir",normalized:"pick"},render:{primary:"rendu",normalized:"render"},into:{primary:"dans",normalized:"into"},before:{primary:"avant",normalized:"before"},after:{primary:"après",normalized:"after"},click:{primary:"clic",alternatives:["clique"],normalized:"click"},hover:{primary:"survol",alternatives:["survoler"],normalized:"hover"},submit:{primary:"soumission",alternatives:["soumettre"],normalized:"submit"},input:{primary:"saisie",alternatives:["entrée"],normalized:"input"},change:{primary:"changement",alternatives:["modifier"],normalized:"change"},until:{primary:"jusqu'à",alternatives:["jusque"],normalized:"until"},event:{primary:"événement",normalized:"event"},from:{primary:"de",alternatives:["depuis"],normalized:"from"},connect:{primary:"connecter",alternatives:["connexion"],normalized:"connect"},stream:{primary:"flux",alternatives:["streaming"],normalized:"stream"},live:{primary:"en-direct",alternatives:["direct"],normalized:"live"},socket:{primary:"socket",alternatives:["websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"sur",alternatives:["lors"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["depuis"],position:"before"},conditionalKeyword:{primary:"quand",alternatives:["lorsque"]},eventMarker:{primary:"au",alternatives:["lors du","lors de"],position:"before"},temporalMarkers:["quand","lorsque"]}}}}),Zp={};gp(Zp,{hebrewProfile:()=>Kp});var Yp,Xp=vp({"src/generators/profiles/he.ts"(){Kp={code:"he",name:"Hebrew",nativeName:"עברית",direction:"rtl",script:"hebrew",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:1,verb:{position:"second",subjectDrop:1},references:{me:"אני",it:"זה",you:"אתה",result:"תוצאה",event:"אירוע",target:"יעד",body:"גוף"},possessive:{marker:"של",markerPosition:"before-property",usePossessiveAdjectives:1,specialForms:{me:"שלי",it:"שלו",you:"שלך"},keywords:{שלי:"me",שלך:"you",שלו:"it",שלה:"it"}},roleMarkers:{destination:{primary:"על",alternatives:["ב","אל","ל"],position:"before"},source:{primary:"מ",alternatives:["מן","מאת"],position:"before"},patient:{primary:"את",position:"before"},style:{primary:"עם",alternatives:["ב"],position:"before"}},keywords:{toggle:{primary:"מתג",alternatives:["הדלק כבה"],normalized:"toggle"},add:{primary:"הוסף",normalized:"add"},remove:{primary:"הסר",alternatives:["מחק","הורד"],normalized:"remove"},put:{primary:"שים",alternatives:["הנח","הכנס"],normalized:"put"},append:{primary:"צרף",alternatives:["הוסף בסוף"],normalized:"append"},prepend:{primary:"הקדם",alternatives:["הוסף בהתחלה"],normalized:"prepend"},take:{primary:"קח",normalized:"take"},make:{primary:"צור",alternatives:["הכן"],normalized:"make"},clone:{primary:"שכפל",normalized:"clone"},swap:{primary:"החלף",alternatives:["המר"],normalized:"swap"},morph:{primary:"הפוך",alternatives:["עצב מחדש"],normalized:"morph"},set:{primary:"קבע",alternatives:["הגדר"],normalized:"set"},get:{primary:"קבל",alternatives:["השג"],normalized:"get"},increment:{primary:"הגדל",alternatives:["הוסף אחד"],normalized:"increment"},decrement:{primary:"הקטן",alternatives:["הפחת"],normalized:"decrement"},log:{primary:"רשום",normalized:"log"},show:{primary:"הראה",alternatives:["הצג"],normalized:"show"},hide:{primary:"הסתר",alternatives:["החבא"],normalized:"hide"},transition:{primary:"מעבר",alternatives:["הנפש"],normalized:"transition"},on:{primary:"ב",alternatives:["עם"],normalized:"on"},trigger:{primary:"הפעל",alternatives:["שגר"],normalized:"trigger"},send:{primary:"שלח",normalized:"send"},focus:{primary:"מקד",alternatives:["התמקד"],normalized:"focus"},blur:{primary:"טשטש",alternatives:["הסר מיקוד"],normalized:"blur"},empty:{primary:"רוקן",normalized:"empty"},open:{primary:"פתח",normalized:"open"},close:{primary:"סגור",normalized:"close"},select:{primary:"סמן",normalized:"select"},clear:{primary:"נקה",normalized:"clear"},reset:{primary:"אפס",normalized:"reset"},breakpoint:{primary:"נקודת-עצירה",normalized:"breakpoint"},go:{primary:"לך",alternatives:["נווט"],normalized:"go"},scroll:{primary:"גלול",normalized:"scroll"},push:{primary:"דחוף",alternatives:["הוסף-להיסטוריה"],normalized:"push"},replace:{primary:"החלף_כתובת",alternatives:["שנה_כתובת"],normalized:"replace"},process:{primary:"עבד",alternatives:["עיבוד"],normalized:"process"},wait:{primary:"חכה",alternatives:["המתן"],normalized:"wait"},fetch:{primary:"הבא",alternatives:["טען"],normalized:"fetch"},settle:{primary:"התייצב",normalized:"settle"},if:{primary:"אם",normalized:"if"},when:{primary:"כאשר",alternatives:["כש"],normalized:"when"},where:{primary:"איפה",alternatives:["היכן"],normalized:"where"},else:{primary:"אחרת",alternatives:["אם לא"],normalized:"else"},repeat:{primary:"חזור",normalized:"repeat"},for:{primary:"עבור",alternatives:["לכל"],normalized:"for"},while:{primary:"כל עוד",alternatives:["בזמן"],normalized:"while"},continue:{primary:"המשך",normalized:"continue"},halt:{primary:"עצור",alternatives:["הפסק"],normalized:"halt"},throw:{primary:"זרוק",normalized:"throw"},call:{primary:"קרא",alternatives:["זמן"],normalized:"call"},return:{primary:"החזר",normalized:"return"},then:{primary:"אז",alternatives:["ואז"],normalized:"then"},and:{primary:"וגם",alternatives:["גם"],normalized:"and"},end:{primary:"סוף",alternatives:["סיום"],normalized:"end"},js:{primary:"js",alternatives:["ג׳אווהסקריפט"],normalized:"js"},async:{primary:"אסינכרוני",normalized:"async"},tell:{primary:"אמור",normalized:"tell"},default:{primary:"ברירת מחדל",normalized:"default"},init:{primary:"אתחל",alternatives:["התחל"],normalized:"init"},behavior:{primary:"התנהגות",normalized:"behavior"},install:{primary:"התקן",normalized:"install"},measure:{primary:"מדוד",normalized:"measure"},beep:{primary:"ביפ",normalized:"beep"},break:{primary:"שבור",normalized:"break"},copy:{primary:"העתק",normalized:"copy"},exit:{primary:"צא",normalized:"exit"},pick:{primary:"בחר",normalized:"pick"},render:{primary:"רנדר",normalized:"render"},into:{primary:"לתוך",alternatives:["אל"],normalized:"into"},before:{primary:"לפני",normalized:"before"},after:{primary:"אחרי",normalized:"after"},click:{primary:"לחיצה",alternatives:["קליק"],normalized:"click"},hover:{primary:"ריחוף",normalized:"hover"},submit:{primary:"שליחה",alternatives:["הגשה"],normalized:"submit"},input:{primary:"קלט",alternatives:["הזנה"],normalized:"input"},change:{primary:"שינוי",alternatives:["עדכון"],normalized:"change"},until:{primary:"עד",normalized:"until"},event:{primary:"אירוע",normalized:"event"},from:{primary:"מ",alternatives:["מאת"],normalized:"from"},connect:{primary:"התחבר",alternatives:["חבר","התחברות"],normalized:"connect"},stream:{primary:"הזרם",alternatives:["סטרים","שידור"],normalized:"stream"},live:{primary:"חי",alternatives:["בזמן-אמת","לייב"],normalized:"live"},socket:{primary:"שקע",alternatives:["סוקט","ווב-סוקט"],normalized:"socket"}},tokenization:{prefixes:["ה","ו","ב","כ","ל","מ","ש"]},eventHandler:{keyword:{primary:"ב",alternatives:["עם"],normalized:"on"},sourceMarker:{primary:"מ",alternatives:["מאת"],position:"before"},conditionalKeyword:{primary:"כאשר",alternatives:["כש","אם"]},eventMarker:{primary:"ב",alternatives:["כש","עם"],position:"before"},temporalMarkers:["כאשר","כש","עם"]}}}}),Qp={};gp(Qp,{hindiProfile:()=>Yp});var em,tm=vp({"src/generators/profiles/hindi.ts"(){Yp={code:"hi",name:"Hindi",nativeName:"हिन्दी",direction:"ltr",script:"devanagari",wordOrder:"SOV",markingStrategy:"postposition",usesSpaces:1,defaultVerbForm:"imperative",verb:{position:"end",suffixes:["ें","ा","ी","े","ो"],subjectDrop:1},references:{me:"मैं",it:"यह",you:"आप",result:"परिणाम",event:"घटना",target:"लक्ष्य",body:"बॉडी"},possessive:{marker:"का",markerPosition:"between",keywords:{मेरा:"me",मेरी:"me",मेरे:"me",तेरा:"you",तेरी:"you",तेरे:"you",आपका:"you",आपकी:"you",आपके:"you",उसका:"it",उसकी:"it",उसके:"it",इसका:"it",इसकी:"it",इसके:"it"}},roleMarkers:{patient:{primary:"को",position:"after"},destination:{primary:"में",alternatives:["को","पर"],position:"after"},source:{primary:"से",position:"after"},style:{primary:"से",position:"after"},event:{primary:"पर",position:"after"}},keywords:{toggle:{primary:"टॉगल",alternatives:["बदलें","बदल"],normalized:"toggle"},add:{primary:"जोड़ें",alternatives:["जोड़"],normalized:"add"},remove:{primary:"हटाएं",alternatives:["हटा","मिटाएं"],normalized:"remove"},put:{primary:"रखें",alternatives:["रख","डालें","डाल"],normalized:"put"},append:{primary:"जोड़ें_अंत",alternatives:[],normalized:"append"},prepend:{primary:"जोड़ें_शुरू",alternatives:[],normalized:"prepend"},take:{primary:"लें",alternatives:["ले"],normalized:"take"},make:{primary:"बनाएं",alternatives:["बना"],normalized:"make"},clone:{primary:"क्लोन",alternatives:["प्रतिलिपि"],normalized:"clone"},swap:{primary:"बदलें_स्थान",alternatives:[],normalized:"swap"},morph:{primary:"रूपांतर",alternatives:[],normalized:"morph"},set:{primary:"सेट",alternatives:["निर्धारित"],normalized:"set"},get:{primary:"प्राप्त",alternatives:["पाएं"],normalized:"get"},increment:{primary:"बढ़ाएं",alternatives:["बढ़ा"],normalized:"increment"},decrement:{primary:"घटाएं",alternatives:["घटा"],normalized:"decrement"},log:{primary:"लॉग",alternatives:["दर्ज"],normalized:"log"},show:{primary:"दिखाएं",alternatives:["दिखा"],normalized:"show"},hide:{primary:"छिपाएं",alternatives:["छिपा"],normalized:"hide"},transition:{primary:"संक्रमण",alternatives:[],normalized:"transition"},on:{primary:"पर",alternatives:[],normalized:"on"},trigger:{primary:"ट्रिगर",alternatives:[],normalized:"trigger"},send:{primary:"भेजें",alternatives:["भेज"],normalized:"send"},focus:{primary:"फोकस",alternatives:["केंद्रित"],normalized:"focus"},blur:{primary:"धुंधला",alternatives:["फोकस_हटाएं"],normalized:"blur"},empty:{primary:"खाली-करें",normalized:"empty"},open:{primary:"खोलें",normalized:"open"},close:{primary:"बंद-करें",normalized:"close"},select:{primary:"चिह्नित-करें",normalized:"select"},clear:{primary:"साफ़-करें",alternatives:["साफ-करें"],normalized:"clear"},reset:{primary:"रीसेट",normalized:"reset"},breakpoint:{primary:"ब्रेकप्वाइंट",normalized:"breakpoint"},click:{primary:"क्लिक",normalized:"click"},hover:{primary:"होवर",alternatives:["ऊपर_रखें"],normalized:"hover"},submit:{primary:"सबमिट",alternatives:["जमा"],normalized:"submit"},input:{primary:"इनपुट",alternatives:[],normalized:"input"},change:{primary:"बदलाव",alternatives:["परिवर्तन"],normalized:"change"},go:{primary:"जाएं",alternatives:["जा"],normalized:"go"},scroll:{primary:"स्क्रॉल",normalized:"scroll"},push:{primary:"धकेलें",alternatives:["पुश"],normalized:"push"},replace:{primary:"बदलें_यूआरएल",alternatives:["प्रतिस्थापित"],normalized:"replace"},process:{primary:"संसाधित",alternatives:["प्रसंस्कृत"],normalized:"process"},wait:{primary:"प्रतीक्षा",alternatives:["रुकें"],normalized:"wait"},fetch:{primary:"लाएं",alternatives:[],normalized:"fetch"},settle:{primary:"स्थिर",alternatives:[],normalized:"settle"},if:{primary:"अगर",alternatives:["यदि"],normalized:"if"},when:{primary:"जब",normalized:"when"},where:{primary:"कहाँ",normalized:"where"},else:{primary:"वरना",alternatives:["नहीं तो"],normalized:"else"},repeat:{primary:"दोहराएं",alternatives:["दोहरा"],normalized:"repeat"},for:{primary:"के लिए",alternatives:[],normalized:"for"},while:{primary:"जब तक",alternatives:[],normalized:"while"},continue:{primary:"जारी",alternatives:[],normalized:"continue"},halt:{primary:"रोकें",alternatives:["रोक"],normalized:"halt"},throw:{primary:"फेंकें",alternatives:["फेंक"],normalized:"throw"},call:{primary:"कॉल",alternatives:["बुलाएं"],normalized:"call"},return:{primary:"लौटाएं",alternatives:["लौटा"],normalized:"return"},then:{primary:"फिर",alternatives:["तब"],normalized:"then"},and:{primary:"और",alternatives:[],normalized:"and"},end:{primary:"समाप्त",alternatives:["अंत"],normalized:"end"},js:{primary:"जेएस",alternatives:["js"],normalized:"js"},async:{primary:"असिंक",alternatives:[],normalized:"async"},tell:{primary:"बताएं",alternatives:["बता"],normalized:"tell"},default:{primary:"डिफ़ॉल्ट",alternatives:[],normalized:"default"},init:{primary:"प्रारंभ",alternatives:[],normalized:"init"},behavior:{primary:"व्यवहार",alternatives:[],normalized:"behavior"},install:{primary:"इंस्टॉल",alternatives:[],normalized:"install"},measure:{primary:"मापें",alternatives:[],normalized:"measure"},beep:{primary:"बीप",alternatives:[],normalized:"beep"},break:{primary:"तोड़ें",alternatives:[],normalized:"break"},copy:{primary:"कॉपी",alternatives:[],normalized:"copy"},exit:{primary:"बाहर",alternatives:[],normalized:"exit"},pick:{primary:"चुनें",alternatives:[],normalized:"pick"},render:{primary:"रेंडर",alternatives:[],normalized:"render"},into:{primary:"में",alternatives:["को"],normalized:"into"},before:{primary:"से पहले",alternatives:["पहले"],normalized:"before"},after:{primary:"के बाद",alternatives:["बाद"],normalized:"after"},until:{primary:"तक",alternatives:[],normalized:"until"},event:{primary:"घटना",alternatives:[],normalized:"event"},from:{primary:"से",normalized:"from"},connect:{primary:"कनेक्ट",alternatives:["संयोजित"],normalized:"connect"},stream:{primary:"स्ट्रीम",alternatives:["धारा","प्रवाह"],normalized:"stream"},live:{primary:"लाइव",alternatives:["सजीव","प्रत्यक्ष"],normalized:"live"},socket:{primary:"सॉकेट",alternatives:["वेबसॉकेट"],normalized:"socket"}},tokenization:{particles:["को","में","पर","से","का","की","के","तक","ने"],boundaryStrategy:"space"},eventHandler:{keyword:{primary:"पर",alternatives:[],normalized:"on"},sourceMarker:{primary:"से",position:"after"},eventMarker:{primary:"पर",alternatives:["में"],position:"after"},temporalMarkers:["जब","जब भी"]}}}}),nm={};gp(nm,{indonesianProfile:()=>em});var rm,im=vp({"src/generators/profiles/indonesian.ts"(){em={code:"id",name:"Indonesian",nativeName:"Bahasa Indonesia",regions:["priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:1,verb:{position:"start",subjectDrop:1},references:{me:"saya",it:"itu",you:"anda",result:"hasil",event:"peristiwa",target:"target",body:"tubuh"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:1,specialForms:{me:"saya",it:"nya",you:"anda"},keywords:{saya:"me",aku:"me",ku:"me",anda:"you",kamu:"you",mu:"you",nya:"it",dia:"it"}},roleMarkers:{destination:{primary:"pada",alternatives:["ke","di"],position:"before"},source:{primary:"dari",position:"before"},patient:{primary:"",position:"before"},style:{primary:"dengan",position:"before"}},keywords:{toggle:{primary:"alihkan",normalized:"toggle"},add:{primary:"tambah",alternatives:["tambahkan"],normalized:"add"},remove:{primary:"hapus",alternatives:["buang","hilangkan"],normalized:"remove"},put:{primary:"taruh",alternatives:["letakkan","masukkan"],normalized:"put"},append:{primary:"sisipkan",normalized:"append"},prepend:{primary:"awali",normalized:"prepend"},take:{primary:"ambil",normalized:"take"},make:{primary:"buat",alternatives:["bikin","ciptakan"],normalized:"make"},clone:{primary:"klon",alternatives:["tiru"],normalized:"clone"},swap:{primary:"tukar",alternatives:["ganti"],normalized:"swap"},morph:{primary:"ubah",alternatives:["transformasi"],normalized:"morph"},set:{primary:"atur",alternatives:["tetapkan"],normalized:"set"},get:{primary:"dapatkan",alternatives:["peroleh"],normalized:"get"},increment:{primary:"tingkatkan",alternatives:["naikkan"],normalized:"increment"},decrement:{primary:"turunkan",alternatives:["kurangi"],normalized:"decrement"},log:{primary:"catat",alternatives:["rekam","cetak"],normalized:"log"},show:{primary:"tampilkan",alternatives:["perlihatkan"],normalized:"show"},hide:{primary:"sembunyikan",alternatives:["tutup"],normalized:"hide"},transition:{primary:"transisi",alternatives:["animasikan"],normalized:"transition"},on:{primary:"pada",alternatives:["saat"],normalized:"on"},trigger:{primary:"picu",alternatives:["jalankan"],normalized:"trigger"},send:{primary:"kirim",alternatives:["kirimkan"],normalized:"send"},focus:{primary:"fokus",alternatives:["fokuskan"],normalized:"focus"},blur:{primary:"blur",normalized:"blur"},empty:{primary:"kosongkan",normalized:"empty"},open:{primary:"buka",normalized:"open"},close:{primary:"tutupkan",normalized:"close"},select:{primary:"tandai",normalized:"select"},clear:{primary:"bersihkan",normalized:"clear"},reset:{primary:"setel-ulang",alternatives:["reset"],normalized:"reset"},breakpoint:{primary:"titik-henti",normalized:"breakpoint"},go:{primary:"pergi",alternatives:["pindah","navigasi"],normalized:"go"},scroll:{primary:"gulir",alternatives:["gulung"],normalized:"scroll"},push:{primary:"dorong",alternatives:["push"],normalized:"push"},replace:{primary:"ganti_url",alternatives:["gantikan_url"],normalized:"replace"},process:{primary:"proses",normalized:"process"},wait:{primary:"tunggu",normalized:"wait"},fetch:{primary:"muat",normalized:"fetch"},settle:{primary:"stabilkan",normalized:"settle"},if:{primary:"jika",alternatives:["kalau","bila"],normalized:"if"},when:{primary:"ketika",normalized:"when"},where:{primary:"di_mana",normalized:"where"},else:{primary:"selainnya",normalized:"else"},repeat:{primary:"ulangi",normalized:"repeat"},for:{primary:"untuk",normalized:"for"},while:{primary:"selama",normalized:"while"},continue:{primary:"lanjutkan",alternatives:["terus"],normalized:"continue"},halt:{primary:"hentikan",alternatives:["berhenti"],normalized:"halt"},throw:{primary:"lempar",normalized:"throw"},call:{primary:"panggil",normalized:"call"},return:{primary:"kembalikan",alternatives:["kembali"],normalized:"return"},then:{primary:"lalu",alternatives:["kemudian","setelah itu"],normalized:"then"},and:{primary:"dan",alternatives:["juga","serta"],normalized:"and"},end:{primary:"selesai",alternatives:["akhir","tamat"],normalized:"end"},js:{primary:"js",alternatives:["javascript"],normalized:"js"},async:{primary:"asinkron",normalized:"async"},tell:{primary:"katakan",alternatives:["beritahu"],normalized:"tell"},default:{primary:"bawaan",normalized:"default"},init:{primary:"inisialisasi",alternatives:["mulai"],normalized:"init"},behavior:{primary:"perilaku",normalized:"behavior"},install:{primary:"pasang",alternatives:["instal"],normalized:"install"},measure:{primary:"ukur",normalized:"measure"},beep:{primary:"bunyi",normalized:"beep"},break:{primary:"putuskan",normalized:"break"},copy:{primary:"salin",normalized:"copy"},exit:{primary:"keluar",normalized:"exit"},pick:{primary:"pilih",normalized:"pick"},render:{primary:"olah",normalized:"render"},into:{primary:"ke dalam",normalized:"into"},before:{primary:"sebelum",normalized:"before"},after:{primary:"sesudah",alternatives:["setelah"],normalized:"after"},click:{primary:"klik",alternatives:["tekan"],normalized:"click"},hover:{primary:"hover",alternatives:["arahkan"],normalized:"hover"},submit:{primary:"ajukan",normalized:"submit"},input:{primary:"masuk",alternatives:["input"],normalized:"input"},change:{primary:"berubah",normalized:"change"},until:{primary:"sampai",normalized:"until"},event:{primary:"peristiwa",alternatives:["event"],normalized:"event"},from:{primary:"dari",normalized:"from"},connect:{primary:"sambungkan",alternatives:["hubungkan","koneksi"],normalized:"connect"},stream:{primary:"alirkan",alternatives:["streaming"],normalized:"stream"},live:{primary:"langsung",alternatives:["live"],normalized:"live"},socket:{primary:"soket",alternatives:["socket","websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"pada",alternatives:["ketika","saat"],normalized:"on"},sourceMarker:{primary:"dari",position:"before"},conditionalKeyword:{primary:"ketika",alternatives:["saat","waktu"]},eventMarker:{primary:"saat",alternatives:["ketika"],position:"before"},temporalMarkers:["ketika","saat"]}}}}),am={};gp(am,{italianProfile:()=>rm});var om,sm=vp({"src/generators/profiles/italian.ts"(){rm={code:"it",name:"Italian",nativeName:"Italiano",regions:["western"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:1,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:1},references:{me:"io",it:"esso",you:"tu",result:"risultato",event:"evento",target:"obiettivo",body:"corpo"},possessive:{marker:"di",markerPosition:"before-property",usePossessiveAdjectives:1,specialForms:{me:"mio",it:"suo",you:"tuo"},keywords:{mio:"me",mia:"me",miei:"me",mie:"me",tuo:"you",tua:"you",tuoi:"you",tue:"you",suo:"it",sua:"it",suoi:"it",sue:"it"}},roleMarkers:{destination:{primary:"in",alternatives:["su","a"],position:"before"},source:{primary:"da",alternatives:["di"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"con",position:"before"}},keywords:{toggle:{primary:"commutare",alternatives:["alternare"],normalized:"toggle"},add:{primary:"aggiungere",alternatives:["aggiungi"],normalized:"add"},remove:{primary:"rimuovere",alternatives:["eliminare","togliere"],normalized:"remove"},put:{primary:"mettere",alternatives:["inserire"],normalized:"put"},append:{primary:"accodare",normalized:"append"},prepend:{primary:"anteporre",normalized:"prepend"},take:{primary:"prendere",normalized:"take"},make:{primary:"fare",alternatives:["creare"],normalized:"make"},clone:{primary:"clonare",normalized:"clone"},swap:{primary:"scambiare",normalized:"swap"},morph:{primary:"trasformare",alternatives:["convertire"],normalized:"morph"},set:{primary:"impostare",alternatives:["definire"],normalized:"set"},get:{primary:"ottenere",normalized:"get"},increment:{primary:"incrementare",alternatives:["aumentare"],normalized:"increment"},decrement:{primary:"decrementare",alternatives:["diminuire"],normalized:"decrement"},log:{primary:"registrare",normalized:"log"},show:{primary:"mostrare",alternatives:["visualizzare"],normalized:"show"},hide:{primary:"nascondere",normalized:"hide"},transition:{primary:"transizione",alternatives:["animare"],normalized:"transition"},on:{primary:"su",alternatives:["al"],normalized:"on"},trigger:{primary:"scatenare",alternatives:["attivare"],normalized:"trigger"},send:{primary:"inviare",normalized:"send"},focus:{primary:"focalizzare",normalized:"focus"},blur:{primary:"sfuocare",normalized:"blur"},empty:{primary:"svuotare",normalized:"empty"},open:{primary:"aprire",normalized:"open"},close:{primary:"chiudere",normalized:"close"},select:{primary:"selezionare",normalized:"select"},clear:{primary:"cancellare",normalized:"clear"},reset:{primary:"reimpostare",normalized:"reset"},breakpoint:{primary:"punto-interruzione",normalized:"breakpoint"},go:{primary:"andare",alternatives:["navigare","vai"],normalized:"go"},scroll:{primary:"scorrere",alternatives:["scroll"],normalized:"scroll"},push:{primary:"spingere",alternatives:["push"],normalized:"push"},replace:{primary:"sostituire",normalized:"replace"},process:{primary:"elaborare",alternatives:["processare"],normalized:"process"},wait:{primary:"aspettare",alternatives:["attendere"],normalized:"wait"},fetch:{primary:"recuperare",normalized:"fetch"},settle:{primary:"stabilizzare",normalized:"settle"},if:{primary:"se",normalized:"if"},when:{primary:"quando",normalized:"when"},where:{primary:"dove",normalized:"where"},else:{primary:"altrimenti",normalized:"else"},repeat:{primary:"ripetere",normalized:"repeat"},for:{primary:"per",normalized:"for"},while:{primary:"mentre",normalized:"while"},continue:{primary:"continuare",normalized:"continue"},halt:{primary:"fermare",normalized:"halt"},throw:{primary:"lanciare",normalized:"throw"},call:{primary:"chiamare",normalized:"call"},return:{primary:"ritornare",normalized:"return"},then:{primary:"allora",alternatives:["poi","quindi"],normalized:"then"},and:{primary:"e",alternatives:["anche"],normalized:"and"},end:{primary:"fine",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"asincrono",normalized:"async"},tell:{primary:"dire",normalized:"tell"},default:{primary:"predefinito",normalized:"default"},init:{primary:"inizializzare",alternatives:["inizia"],normalized:"init"},behavior:{primary:"comportamento",normalized:"behavior"},install:{primary:"installare",normalized:"install"},measure:{primary:"misurare",normalized:"measure"},beep:{primary:"beep",normalized:"beep"},break:{primary:"interrompere",normalized:"break"},copy:{primary:"copiare",normalized:"copy"},exit:{primary:"uscire",normalized:"exit"},pick:{primary:"scegliere",normalized:"pick"},render:{primary:"renderizzare",normalized:"render"},into:{primary:"in",alternatives:["dentro"],normalized:"into"},before:{primary:"prima",normalized:"before"},after:{primary:"dopo",normalized:"after"},click:{primary:"clic",alternatives:["clicca"],normalized:"click"},hover:{primary:"passaggio",alternatives:["sorvolo"],normalized:"hover"},submit:{primary:"invio",alternatives:["sottomettere"],normalized:"submit"},input:{primary:"inserimento",alternatives:["input"],normalized:"input"},change:{primary:"cambio",alternatives:["cambiamento"],normalized:"change"},until:{primary:"fino",normalized:"until"},event:{primary:"evento",normalized:"event"},from:{primary:"da",alternatives:["di"],normalized:"from"},connect:{primary:"connettere",alternatives:["connettersi","collegare"],normalized:"connect"},stream:{primary:"trasmettere",alternatives:["flusso","streaming"],normalized:"stream"},live:{primary:"in-diretta",alternatives:["diretta","dal-vivo"],normalized:"live"},socket:{primary:"socket",alternatives:["presa","websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"su",alternatives:["al"],normalized:"on"},sourceMarker:{primary:"da",alternatives:["di"],position:"before"},conditionalKeyword:{primary:"quando",alternatives:["se"]},eventMarker:{primary:"al",alternatives:["allo","alla"],position:"before"},temporalMarkers:["quando","al"]}}}}),lm={};gp(lm,{japaneseProfile:()=>om});var cm,um=vp({"src/generators/profiles/japanese.ts"(){om={code:"ja",name:"Japanese",nativeName:"日本語",regions:["east-asian","priority"],direction:"ltr",script:"cjk",wordOrder:"SOV",markingStrategy:"particle",usesSpaces:0,defaultVerbForm:"base",verb:{position:"end",suffixes:["る","て","た","ます","ない"],subjectDrop:1},references:{me:"自分",it:"それ",you:"あなた",result:"結果",event:"イベント",target:"ターゲット",body:"ボディ"},possessive:{marker:"の",markerPosition:"between",keywords:{私の:"me",あなたの:"you",その:"it"}},roleMarkers:{patient:{primary:"を",position:"after"},destination:{primary:"に",alternatives:["へ","で","の"],position:"after"},source:{primary:"から",position:"after"},style:{primary:"で",position:"after"},event:{primary:"を",position:"after"}},keywords:{toggle:{primary:"切り替え",alternatives:["切り替える","トグル","トグルする"],normalized:"toggle"},add:{primary:"追加",alternatives:["追加する","加える"],normalized:"add"},remove:{primary:"削除",alternatives:["削除する","取り除く"],normalized:"remove"},put:{primary:"置く",alternatives:["入れる"],normalized:"put"},append:{primary:"末尾追加",alternatives:["末尾に追加","アペンド"],normalized:"append"},prepend:{primary:"先頭追加",alternatives:["先頭に追加","プリペンド"],normalized:"prepend"},take:{primary:"取る",normalized:"take"},make:{primary:"作る",alternatives:["作成"],normalized:"make"},clone:{primary:"複製",alternatives:["クローン"],normalized:"clone"},swap:{primary:"交換",alternatives:["スワップ","入れ替え"],normalized:"swap"},morph:{primary:"変形",alternatives:["モーフ","変換"],normalized:"morph"},set:{primary:"設定",alternatives:["設定する"],normalized:"set"},get:{primary:"取得",alternatives:["取得する","ゲット"],normalized:"get"},increment:{primary:"増加",alternatives:["増やす","インクリメント"],normalized:"increment"},decrement:{primary:"減少",alternatives:["減らす","デクリメント"],normalized:"decrement"},log:{primary:"記録",alternatives:["ログ","出力"],normalized:"log"},show:{primary:"表示",alternatives:["表示する","見せる"],normalized:"show"},hide:{primary:"隠す",alternatives:["非表示","非表示にする"],normalized:"hide"},transition:{primary:"遷移",alternatives:["トランジション","アニメーション"],normalized:"transition"},on:{primary:"で",alternatives:["時"],normalized:"on"},trigger:{primary:"引き金",alternatives:["発火","トリガー"],normalized:"trigger"},send:{primary:"送る",alternatives:["送信"],normalized:"send"},focus:{primary:"フォーカス",alternatives:["集中"],normalized:"focus"},blur:{primary:"ぼかし",alternatives:["フォーカス解除","ブラー"],normalized:"blur"},empty:{primary:"空に",alternatives:["空にする"],normalized:"empty"},open:{primary:"開く",alternatives:["オープン"],normalized:"open"},close:{primary:"閉じる",alternatives:["クローズ"],normalized:"close"},select:{primary:"選ぶ",alternatives:["セレクト"],normalized:"select"},clear:{primary:"クリア",alternatives:["消去"],normalized:"clear"},reset:{primary:"リセット",alternatives:["再設定"],normalized:"reset"},breakpoint:{primary:"ブレークポイント",normalized:"breakpoint"},go:{primary:"移動",alternatives:["行く","ナビゲート"],normalized:"go"},scroll:{primary:"スクロール",normalized:"scroll"},push:{primary:"プッシュ",normalized:"push"},replace:{primary:"置換",alternatives:["置き換え"],normalized:"replace"},process:{primary:"処理",normalized:"process"},wait:{primary:"待つ",alternatives:["待機"],normalized:"wait"},fetch:{primary:"フェッチ",normalized:"fetch"},settle:{primary:"安定",alternatives:["落ち着く"],normalized:"settle"},if:{primary:"もし",normalized:"if"},when:{primary:"とき",alternatives:["ときに"],normalized:"when"},where:{primary:"どこ",normalized:"where"},else:{primary:"そうでなければ",alternatives:["それ以外"],normalized:"else"},repeat:{primary:"繰り返し",alternatives:["繰り返す","リピート"],normalized:"repeat"},for:{primary:"ために",alternatives:["各"],normalized:"for"},while:{primary:"の間",alternatives:["間"],normalized:"while"},continue:{primary:"続ける",alternatives:["継続"],normalized:"continue"},halt:{primary:"停止",alternatives:["止める","ハルト"],normalized:"halt"},throw:{primary:"投げる",alternatives:["スロー"],normalized:"throw"},call:{primary:"呼び出し",alternatives:["コール","呼ぶ"],normalized:"call"},return:{primary:"戻る",alternatives:["返す","リターン"],normalized:"return"},then:{primary:"それから",alternatives:["次に","ならば","なら"],normalized:"then"},and:{primary:"また",alternatives:["と","そして"],normalized:"and"},end:{primary:"終わり",alternatives:["終了","おわり"],normalized:"end"},js:{primary:"JS実行",alternatives:["js"],normalized:"js"},async:{primary:"非同期",alternatives:["アシンク"],normalized:"async"},tell:{primary:"伝える",alternatives:["テル"],normalized:"tell"},default:{primary:"既定",alternatives:["デフォルト"],normalized:"default"},init:{primary:"初期化",alternatives:["イニット"],normalized:"init"},behavior:{primary:"振る舞い",alternatives:["ビヘイビア"],normalized:"behavior"},install:{primary:"インストール",alternatives:["導入"],normalized:"install"},measure:{primary:"測定",alternatives:["計測","メジャー"],normalized:"measure"},beep:{primary:"ビープ",normalized:"beep"},break:{primary:"中断",normalized:"break"},copy:{primary:"コピー",normalized:"copy"},exit:{primary:"退出",normalized:"exit"},pick:{primary:"選択",normalized:"pick"},render:{primary:"描画",normalized:"render"},into:{primary:"へ",alternatives:["に"],normalized:"into"},before:{primary:"前に",alternatives:["前"],normalized:"before"},after:{primary:"後に",alternatives:["後"],normalized:"after"},until:{primary:"まで",alternatives:["迄"],normalized:"until"},event:{primary:"イベント",alternatives:["事象"],normalized:"event"},from:{primary:"から",normalized:"from"},connect:{primary:"接続",alternatives:["接続する"],normalized:"connect"},stream:{primary:"ストリーム",alternatives:["配信"],normalized:"stream"},live:{primary:"ライブ",alternatives:["実時間"],normalized:"live"},socket:{primary:"ソケット",alternatives:["websocket"],normalized:"socket"}},tokenization:{particles:["を","に","で","から","の","が","は","も","へ","と"],boundaryStrategy:"particle"},eventHandler:{eventMarker:{primary:"で",position:"after"},temporalMarkers:["時","とき"]}}}}),pm={};gp(pm,{koreanProfile:()=>cm});var mm,dm=vp({"src/generators/profiles/korean.ts"(){cm={code:"ko",name:"Korean",nativeName:"한국어",regions:["east-asian","priority"],direction:"ltr",script:"hangul",wordOrder:"SOV",markingStrategy:"particle",usesSpaces:1,verb:{position:"end",suffixes:["다","요","니다","세요"],subjectDrop:1},references:{me:"나",it:"그것",you:"너",result:"결과",event:"이벤트",target:"대상",body:"본문"},possessive:{marker:"의",markerPosition:"between",specialForms:{me:"내",it:"그것의",you:"네"},keywords:{내:"me",네:"you",그의:"it"}},roleMarkers:{patient:{primary:"을",alternatives:["를"],position:"after"},destination:{primary:"에",alternatives:["으로","로","에서","의"],position:"after"},source:{primary:"에서",alternatives:["부터"],position:"after"},style:{primary:"로",alternatives:["으로"],position:"after"},event:{primary:"을",alternatives:["를"],position:"after"}},keywords:{toggle:{primary:"토글",normalized:"toggle"},add:{primary:"추가",normalized:"add"},remove:{primary:"제거",alternatives:["삭제"],normalized:"remove"},put:{primary:"넣다",alternatives:["넣기","놓기"],normalized:"put"},append:{primary:"덧붙이다",alternatives:["끝에추가"],normalized:"append"},prepend:{primary:"앞에추가",alternatives:["선두추가"],normalized:"prepend"},take:{primary:"가져오다",normalized:"take"},make:{primary:"만들다",normalized:"make"},clone:{primary:"복제",normalized:"clone"},swap:{primary:"교환",alternatives:["바꾸다"],normalized:"swap"},morph:{primary:"변형",alternatives:["변환"],normalized:"morph"},set:{primary:"설정",normalized:"set"},get:{primary:"얻다",normalized:"get"},increment:{primary:"증가",normalized:"increment"},decrement:{primary:"감소",normalized:"decrement"},log:{primary:"로그",normalized:"log"},show:{primary:"보이다",alternatives:["표시","보이기"],normalized:"show"},hide:{primary:"숨기다",alternatives:["숨기기"],normalized:"hide"},transition:{primary:"트랜지션",normalized:"transition"},on:{primary:"에",alternatives:["시","할 때"],normalized:"on"},trigger:{primary:"트리거",normalized:"trigger"},send:{primary:"보내다",normalized:"send"},focus:{primary:"포커스",normalized:"focus"},blur:{primary:"블러",normalized:"blur"},empty:{primary:"비우기",normalized:"empty"},open:{primary:"열기",normalized:"open"},close:{primary:"닫기",normalized:"close"},select:{primary:"고르기",normalized:"select"},clear:{primary:"지우기",normalized:"clear"},reset:{primary:"재설정",normalized:"reset"},breakpoint:{primary:"중단점",normalized:"breakpoint"},click:{primary:"클릭",normalized:"click"},hover:{primary:"호버",normalized:"hover"},submit:{primary:"제출",normalized:"submit"},input:{primary:"입력",normalized:"input"},change:{primary:"변경",normalized:"change"},go:{primary:"이동",normalized:"go"},scroll:{primary:"스크롤",normalized:"scroll"},push:{primary:"푸시",normalized:"push"},replace:{primary:"교체",alternatives:["바꾸기"],normalized:"replace"},process:{primary:"처리",normalized:"process"},wait:{primary:"대기",normalized:"wait"},fetch:{primary:"패치",normalized:"fetch"},settle:{primary:"안정",normalized:"settle"},if:{primary:"만약",normalized:"if"},when:{primary:"때",normalized:"when"},where:{primary:"어디",normalized:"where"},else:{primary:"아니면",normalized:"else"},repeat:{primary:"반복",normalized:"repeat"},for:{primary:"각각",normalized:"for"},while:{primary:"동안",normalized:"while"},continue:{primary:"계속",normalized:"continue"},halt:{primary:"정지",normalized:"halt"},throw:{primary:"던지다",normalized:"throw"},call:{primary:"호출",normalized:"call"},return:{primary:"반환",normalized:"return"},then:{primary:"그다음",alternatives:["그런후"],normalized:"then"},and:{primary:"그리고",alternatives:["또한","및"],normalized:"and"},end:{primary:"끝",alternatives:["마침"],normalized:"end"},js:{primary:"JS실행",alternatives:["js"],normalized:"js"},async:{primary:"비동기",normalized:"async"},tell:{primary:"말하다",normalized:"tell"},default:{primary:"기본값",normalized:"default"},init:{primary:"초기화",normalized:"init"},behavior:{primary:"동작",normalized:"behavior"},install:{primary:"설치",normalized:"install"},measure:{primary:"측정",normalized:"measure"},beep:{primary:"비프",normalized:"beep"},break:{primary:"중단",normalized:"break"},copy:{primary:"복사",normalized:"copy"},exit:{primary:"나가기",normalized:"exit"},pick:{primary:"선택",normalized:"pick"},render:{primary:"렌더링",normalized:"render"},into:{primary:"으로",normalized:"into"},before:{primary:"전에",normalized:"before"},after:{primary:"후에",normalized:"after"},until:{primary:"까지",normalized:"until"},event:{primary:"이벤트",normalized:"event"},from:{primary:"에서",normalized:"from"},connect:{primary:"연결",alternatives:["접속"],normalized:"connect"},stream:{primary:"스트림",alternatives:["스트리밍"],normalized:"stream"},live:{primary:"실시간",alternatives:["라이브"],normalized:"live"},socket:{primary:"소켓",alternatives:["websocket"],normalized:"socket"}},tokenization:{particles:["을","를","이","가","은","는","에","에서","으로","로","와","과","도"],boundaryStrategy:"space"},eventHandler:{eventMarker:{primary:"할 때",alternatives:["할때","때","에"],position:"after"},temporalMarkers:["할 때","할때","때"]}}}}),fm={};gp(fm,{malayProfile:()=>mm});var ym,hm=vp({"src/generators/profiles/ms.ts"(){mm={code:"ms",name:"Malay",nativeName:"Melayu",direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:1,defaultVerbForm:"base",verb:{position:"start",subjectDrop:1},references:{me:"saya",it:"ia",you:"kamu",result:"hasil",event:"peristiwa",target:"sasaran",body:"badan"},possessive:{marker:"",markerPosition:"after-object",keywords:{saya:"me",aku:"me",awak:"you",kamu:"you",anda:"you",dia:"it",ia:"it","-ku":"me","-mu":"you","-nya":"it"}},roleMarkers:{destination:{primary:"ke",alternatives:["pada"],position:"before"},source:{primary:"dari",position:"before"},patient:{primary:"",position:"before"},style:{primary:"dengan",position:"before"}},keywords:{toggle:{primary:"togol",alternatives:["tukar"],normalized:"toggle"},add:{primary:"tambah",normalized:"add"},remove:{primary:"buang",alternatives:["padam"],normalized:"remove"},put:{primary:"letak",alternatives:["letakkan"],normalized:"put"},append:{primary:"tambah_hujung",normalized:"append"},prepend:{primary:"tambah_mula",normalized:"prepend"},take:{primary:"ambil",normalized:"take"},make:{primary:"buat",alternatives:["cipta"],normalized:"make"},clone:{primary:"klon",alternatives:[],normalized:"clone"},swap:{primary:"tukar_tempat",normalized:"swap"},morph:{primary:"ubah_bentuk",normalized:"morph"},set:{primary:"tetapkan",alternatives:["setkan"],normalized:"set"},get:{primary:"dapatkan",alternatives:[],normalized:"get"},increment:{primary:"tambah_satu",normalized:"increment"},decrement:{primary:"kurang_satu",normalized:"decrement"},log:{primary:"catat",alternatives:["log"],normalized:"log"},show:{primary:"tunjuk",alternatives:[],normalized:"show"},hide:{primary:"sembunyi",alternatives:["sorok"],normalized:"hide"},transition:{primary:"peralihan",normalized:"transition"},on:{primary:"apabila",alternatives:["ketika"],normalized:"on"},trigger:{primary:"cetuskan",normalized:"trigger"},send:{primary:"hantar",normalized:"send"},focus:{primary:"fokus",normalized:"focus"},blur:{primary:"kabur",normalized:"blur"},empty:{primary:"kosongkan",normalized:"empty"},open:{primary:"buka",normalized:"open"},close:{primary:"tutup",normalized:"close"},select:{primary:"tandai",normalized:"select"},clear:{primary:"bersihkan",normalized:"clear"},reset:{primary:"set-semula",alternatives:["reset"],normalized:"reset"},breakpoint:{primary:"titik-henti",normalized:"breakpoint"},go:{primary:"pergi",alternatives:["pindah"],normalized:"go"},scroll:{primary:"tatal",alternatives:["skrol"],normalized:"scroll"},push:{primary:"tolak",alternatives:["push"],normalized:"push"},replace:{primary:"ganti_url",alternatives:["gantikan_url"],normalized:"replace"},process:{primary:"proses",normalized:"process"},wait:{primary:"tunggu",normalized:"wait"},fetch:{primary:"ambil_dari",alternatives:["muat"],normalized:"fetch"},settle:{primary:"selesai",normalized:"settle"},if:{primary:"jika",alternatives:["kalau"],normalized:"if"},when:{primary:"bila",normalized:"when"},where:{primary:"di_mana",normalized:"where"},else:{primary:"kalau_tidak",alternatives:["jika_tidak"],normalized:"else"},repeat:{primary:"ulang",normalized:"repeat"},for:{primary:"untuk",normalized:"for"},while:{primary:"selagi",alternatives:["semasa"],normalized:"while"},continue:{primary:"teruskan",normalized:"continue"},halt:{primary:"henti",alternatives:["berhenti"],normalized:"halt"},throw:{primary:"lempar",normalized:"throw"},call:{primary:"panggil",normalized:"call"},return:{primary:"pulang",alternatives:["kembali"],normalized:"return"},then:{primary:"kemudian",alternatives:["lepas_itu"],normalized:"then"},and:{primary:"dan",normalized:"and"},end:{primary:"tamat",alternatives:["habis"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"tak_segerak",normalized:"async"},tell:{primary:"beritahu",normalized:"tell"},default:{primary:"lalai",normalized:"default"},init:{primary:"mula",alternatives:["mulakan"],normalized:"init"},behavior:{primary:"kelakuan",normalized:"behavior"},install:{primary:"pasang",normalized:"install"},measure:{primary:"ukur",normalized:"measure"},beep:{primary:"bunyi",normalized:"beep"},break:{primary:"pecah",normalized:"break"},copy:{primary:"salin",normalized:"copy"},exit:{primary:"keluar",normalized:"exit"},pick:{primary:"pilih",normalized:"pick"},render:{primary:"papar",normalized:"render"},into:{primary:"ke_dalam",normalized:"into"},before:{primary:"sebelum",normalized:"before"},after:{primary:"selepas",alternatives:["lepas"],normalized:"after"},until:{primary:"sehingga",alternatives:["sampai"],normalized:"until"},event:{primary:"peristiwa",normalized:"event"},from:{primary:"dari",normalized:"from"},connect:{primary:"sambung",alternatives:["hubungkan"],normalized:"connect"},stream:{primary:"strim",alternatives:["penstriman","aliran"],normalized:"stream"},live:{primary:"langsung",alternatives:["siaran-langsung"],normalized:"live"},socket:{primary:"soket",alternatives:["websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"apabila",alternatives:["ketika"],normalized:"on"},sourceMarker:{primary:"dari",position:"before"}}}}}),vm={};gp(vm,{polishProfile:()=>ym});var gm,bm=vp({"src/generators/profiles/polish.ts"(){ym={code:"pl",name:"Polish",nativeName:"Polski",direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:1,defaultVerbForm:"imperative",verb:{position:"start",subjectDrop:1,suffixes:["ać","eć","ić","yć","ąć","ować"]},references:{me:"ja",it:"to",you:"ty",result:"wynik",event:"zdarzenie",target:"cel",body:"body"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:1,specialForms:{me:"mój",it:"jego",you:"twój"},keywords:{mój:"me",moja:"me",moje:"me",twój:"you",twoja:"you",twoje:"you",jego:"it",jej:"it"}},roleMarkers:{destination:{primary:"do",alternatives:["w","na"],position:"before"},source:{primary:"z",alternatives:["od","ze"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"z",alternatives:["ze"],position:"before"}},keywords:{toggle:{primary:"przełącz",alternatives:["przelacz"],normalized:"toggle",form:"imperative"},add:{primary:"dodaj",normalized:"add",form:"imperative"},remove:{primary:"usuń",alternatives:["usun","wyczyść","wyczysc"],normalized:"remove",form:"imperative"},put:{primary:"umieść",alternatives:["umiesc","wstaw"],normalized:"put",form:"imperative"},append:{primary:"dołącz",alternatives:["dolacz"],normalized:"append",form:"imperative"},prepend:{primary:"poprzedź",alternatives:["poprzedz"],normalized:"prepend",form:"imperative"},take:{primary:"weź",alternatives:["wez"],normalized:"take",form:"imperative"},make:{primary:"utwórz",alternatives:["utworz","stwórz","stworz"],normalized:"make",form:"imperative"},clone:{primary:"sklonuj",normalized:"clone",form:"imperative"},swap:{primary:"zamień",alternatives:["zamien"],normalized:"swap",form:"imperative"},morph:{primary:"przekształć",alternatives:["przeksztalc"],normalized:"morph",form:"imperative"},set:{primary:"ustaw",alternatives:["określ","okresl"],normalized:"set",form:"imperative"},get:{primary:"uzyskaj",normalized:"get",form:"imperative"},increment:{primary:"zwiększ",alternatives:["zwieksz"],normalized:"increment",form:"imperative"},decrement:{primary:"zmniejsz",normalized:"decrement",form:"imperative"},log:{primary:"loguj",alternatives:["wypisz"],normalized:"log",form:"imperative"},show:{primary:"pokaż",alternatives:["pokaz","wyświetl","wyswietl"],normalized:"show",form:"imperative"},hide:{primary:"ukryj",alternatives:["schowaj"],normalized:"hide",form:"imperative"},transition:{primary:"animuj",alternatives:["przejście","przejscie"],normalized:"transition",form:"imperative"},on:{primary:"gdy",alternatives:["przy","na"],normalized:"on"},trigger:{primary:"wyzwól",alternatives:["wyzwol"],normalized:"trigger",form:"imperative"},send:{primary:"wyślij",alternatives:["wyslij"],normalized:"send",form:"imperative"},focus:{primary:"skup",alternatives:["skupienie"],normalized:"focus",form:"imperative"},blur:{primary:"rozmyj",alternatives:["odskup"],normalized:"blur",form:"imperative"},empty:{primary:"opróżnij",alternatives:["oproznij"],normalized:"empty"},open:{primary:"otwórz",alternatives:["otworz"],normalized:"open"},close:{primary:"zamknij",normalized:"close"},select:{primary:"zaznacz",normalized:"select"},clear:{primary:"zeruj",normalized:"clear"},reset:{primary:"zresetuj",normalized:"reset"},breakpoint:{primary:"punkt-przerwania",normalized:"breakpoint"},go:{primary:"idź",alternatives:["idz","przejdź","przejdz","nawiguj"],normalized:"go",form:"imperative"},scroll:{primary:"przewiń",alternatives:["przewin"],normalized:"scroll",form:"imperative"},push:{primary:"wepchnij",alternatives:["push"],normalized:"push",form:"imperative"},replace:{primary:"nadpisz",alternatives:["zamień_url","zamien_url"],normalized:"replace",form:"imperative"},process:{primary:"przetwórz",alternatives:["przetworz"],normalized:"process",form:"imperative"},wait:{primary:"czekaj",alternatives:["poczekaj"],normalized:"wait",form:"imperative"},fetch:{primary:"pobierz",alternatives:["załaduj","zaladuj"],normalized:"fetch",form:"imperative"},settle:{primary:"ustabilizuj",normalized:"settle",form:"imperative"},if:{primary:"jeśli",alternatives:["jesli","jeżeli","jezeli"],normalized:"if"},when:{primary:"kiedy",normalized:"when"},where:{primary:"gdzie",normalized:"where"},else:{primary:"inaczej",alternatives:["wpp"],normalized:"else"},repeat:{primary:"powtórz",alternatives:["powtorz"],normalized:"repeat",form:"imperative"},for:{primary:"dla",alternatives:["każdy","kazdy"],normalized:"for"},while:{primary:"dopóki",alternatives:["dopoki","podczas"],normalized:"while"},continue:{primary:"kontynuuj",alternatives:["dalej"],normalized:"continue",form:"imperative"},halt:{primary:"zatrzymaj",alternatives:["stop"],normalized:"halt",form:"imperative"},throw:{primary:"rzuć",alternatives:["rzuc"],normalized:"throw",form:"imperative"},call:{primary:"wywołaj",alternatives:["wywolaj"],normalized:"call",form:"imperative"},return:{primary:"zwróć",alternatives:["zwroc"],normalized:"return",form:"imperative"},then:{primary:"wtedy",alternatives:["potem","następnie","nastepnie"],normalized:"then"},and:{primary:"i",alternatives:["oraz"],normalized:"and"},end:{primary:"koniec",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"async",alternatives:["asynchronicznie"],normalized:"async"},tell:{primary:"powiedz",normalized:"tell",form:"imperative"},default:{primary:"domyślnie",alternatives:["domyslnie"],normalized:"default"},init:{primary:"inicjuj",normalized:"init",form:"imperative"},behavior:{primary:"zachowanie",normalized:"behavior"},install:{primary:"zainstaluj",normalized:"install",form:"imperative"},measure:{primary:"zmierz",normalized:"measure",form:"imperative"},beep:{primary:"sygnał",normalized:"beep"},break:{primary:"przerwij",normalized:"break"},copy:{primary:"kopiuj",normalized:"copy"},exit:{primary:"wyjdź",normalized:"exit"},pick:{primary:"wybierz",normalized:"pick"},render:{primary:"renderuj",normalized:"render"},into:{primary:"do",alternatives:["w"],normalized:"into"},before:{primary:"przed",normalized:"before"},after:{primary:"po",normalized:"after"},click:{primary:"kliknięciu",alternatives:["klikniecie","klik"],normalized:"click"},hover:{primary:"najechaniu",alternatives:["hover"],normalized:"hover"},submit:{primary:"wysłaniu",alternatives:["wyslaniu","submit"],normalized:"submit"},input:{primary:"wprowadzeniu",alternatives:["input"],normalized:"input"},change:{primary:"zmianie",alternatives:["zmiana"],normalized:"change"},until:{primary:"aż",alternatives:["az"],normalized:"until"},event:{primary:"zdarzenie",normalized:"event"},from:{primary:"z",alternatives:["od","ze"],normalized:"from"},connect:{primary:"połącz",alternatives:["podłącz"],normalized:"connect"},stream:{primary:"transmituj",alternatives:["strumień","streamuj"],normalized:"stream"},live:{primary:"na-żywo",alternatives:["na-bieżąco","live"],normalized:"live"},socket:{primary:"gniazdo",alternatives:["socket","websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"gdy",alternatives:["przy","na"],normalized:"on"},sourceMarker:{primary:"na",alternatives:["w","przy"],position:"before"},conditionalKeyword:{primary:"kiedy",alternatives:["gdy","jeśli"]},eventMarker:{primary:"przy",alternatives:["na"],position:"before"},temporalMarkers:["kiedy","gdy","przy"]}}}}),wm={};gp(wm,{portugueseProfile:()=>gm});var km,zm=vp({"src/generators/profiles/portuguese.ts"(){gm={code:"pt",name:"Portuguese",nativeName:"Português",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:1,verb:{position:"start",subjectDrop:1},references:{me:"eu",it:"ele",you:"você",result:"resultado",event:"evento",target:"alvo",body:"corpo"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:1,specialForms:{me:"meu",it:"seu",you:"teu"},keywords:{meu:"me",minha:"me",teu:"you",tua:"you",seu:"it",sua:"it"}},roleMarkers:{destination:{primary:"em",alternatives:["para","a"],position:"before"},source:{primary:"de",alternatives:["desde"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"com",position:"before"}},keywords:{toggle:{primary:"alternar",alternatives:[],normalized:"toggle"},add:{primary:"adicionar",alternatives:["acrescentar"],normalized:"add"},remove:{primary:"remover",alternatives:["eliminar","apagar"],normalized:"remove"},put:{primary:"colocar",alternatives:["pôr","por"],normalized:"put"},append:{primary:"anexar",normalized:"append"},prepend:{primary:"preceder",normalized:"prepend"},take:{primary:"pegar",normalized:"take"},make:{primary:"fazer",alternatives:["criar"],normalized:"make"},clone:{primary:"clonar",alternatives:[],normalized:"clone"},swap:{primary:"trocar",alternatives:["substituir"],normalized:"swap"},morph:{primary:"transformar",alternatives:["converter"],normalized:"morph"},set:{primary:"definir",alternatives:["configurar"],normalized:"set"},get:{primary:"obter",normalized:"get"},increment:{primary:"incrementar",alternatives:["aumentar"],normalized:"increment"},decrement:{primary:"decrementar",alternatives:["diminuir"],normalized:"decrement"},log:{primary:"registrar",alternatives:["imprimir"],normalized:"log"},show:{primary:"mostrar",alternatives:["exibir"],normalized:"show"},hide:{primary:"ocultar",alternatives:["esconder"],normalized:"hide"},transition:{primary:"transição",alternatives:["animar"],normalized:"transition"},on:{primary:"em",alternatives:["ao"],normalized:"on"},trigger:{primary:"disparar",alternatives:["ativar"],normalized:"trigger"},send:{primary:"enviar",normalized:"send"},focus:{primary:"focar",normalized:"focus"},blur:{primary:"desfocar",normalized:"blur"},empty:{primary:"esvaziar",normalized:"empty"},open:{primary:"abrir",normalized:"open"},close:{primary:"fechar",normalized:"close"},select:{primary:"selecionar",normalized:"select"},clear:{primary:"limpar",normalized:"clear"},reset:{primary:"redefinir",alternatives:["resetar"],normalized:"reset"},breakpoint:{primary:"ponto-interrupção",alternatives:["ponto-interrupcao"],normalized:"breakpoint"},go:{primary:"ir",alternatives:["navegar"],normalized:"go"},scroll:{primary:"rolar",alternatives:["scroll"],normalized:"scroll"},push:{primary:"empurrar",alternatives:["push"],normalized:"push"},replace:{primary:"repor",alternatives:["recolocar"],normalized:"replace"},process:{primary:"processar",normalized:"process"},wait:{primary:"esperar",alternatives:["aguardar"],normalized:"wait"},fetch:{primary:"buscar",normalized:"fetch"},settle:{primary:"estabilizar",normalized:"settle"},if:{primary:"se",normalized:"if"},when:{primary:"quando",normalized:"when"},where:{primary:"onde",normalized:"where"},else:{primary:"senão",normalized:"else"},repeat:{primary:"repetir",normalized:"repeat"},for:{primary:"para",normalized:"for"},while:{primary:"enquanto",normalized:"while"},continue:{primary:"continuar",normalized:"continue"},halt:{primary:"parar",normalized:"halt"},throw:{primary:"lançar",normalized:"throw"},call:{primary:"chamar",normalized:"call"},return:{primary:"retornar",alternatives:["devolver"],normalized:"return"},then:{primary:"então",alternatives:["logo"],normalized:"then"},and:{primary:"e",alternatives:["também","além disso"],normalized:"and"},end:{primary:"fim",alternatives:["final","término"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"assíncrono",normalized:"async"},tell:{primary:"dizer",normalized:"tell"},default:{primary:"padrão",normalized:"default"},init:{primary:"iniciar",alternatives:["inicializar"],normalized:"init"},behavior:{primary:"comportamento",normalized:"behavior"},install:{primary:"instalar",normalized:"install"},measure:{primary:"medir",normalized:"measure"},beep:{primary:"apitar",normalized:"beep"},break:{primary:"interromper",normalized:"break"},copy:{primary:"copiar",normalized:"copy"},exit:{primary:"sair",normalized:"exit"},pick:{primary:"escolher",normalized:"pick"},render:{primary:"renderizar",normalized:"render"},into:{primary:"dentro",alternatives:["dentro de"],normalized:"into"},before:{primary:"antes",normalized:"before"},after:{primary:"depois",normalized:"after"},click:{primary:"clique",alternatives:["clicar"],normalized:"click"},hover:{primary:"sobrevoar",alternatives:["passar"],normalized:"hover"},submit:{primary:"envio",alternatives:["submeter"],normalized:"submit"},input:{primary:"entrada",alternatives:["inserção"],normalized:"input"},change:{primary:"alteração",alternatives:["mudança"],normalized:"change"},until:{primary:"até",normalized:"until"},event:{primary:"evento",normalized:"event"},from:{primary:"de",alternatives:["desde"],normalized:"from"},connect:{primary:"conectar",alternatives:["conexão"],normalized:"connect"},stream:{primary:"transmitir",alternatives:["fluxo"],normalized:"stream"},live:{primary:"ao-vivo",alternatives:["vivo","direto"],normalized:"live"},socket:{primary:"soquete",alternatives:["websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"em",alternatives:["ao"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["desde"],position:"before"},conditionalKeyword:{primary:"quando",alternatives:["se"]},eventMarker:{primary:"ao",alternatives:["no"],position:"before"},temporalMarkers:["quando","ao"]}}}}),xm={};gp(xm,{quechuaProfile:()=>km});var Em,Sm=vp({"src/generators/profiles/quechua.ts"(){km={code:"qu",name:"Quechua",nativeName:"Runasimi",direction:"ltr",script:"latin",wordOrder:"SOV",markingStrategy:"postposition",usesSpaces:1,verb:{position:"end",subjectDrop:1},references:{me:"ñuqa",it:"pay",you:"qam",result:"rurasqa",event:"ruwakuq",target:"ñawpaqman",body:"ukhu"},possessive:{marker:"-pa",markerPosition:"after-object",keywords:{ñuqapa:"me",ñuqaypa:"me",qampa:"you",paypa:"it"}},roleMarkers:{patient:{primary:"ta",position:"after"},destination:{primary:"man",alternatives:["pa"],position:"after"},source:{primary:"manta",position:"after"},style:{primary:"wan",position:"after"},event:{primary:"pi",position:"after"}},keywords:{toggle:{primary:"t'ikray",alternatives:["tikray"],normalized:"toggle"},add:{primary:"yapay",alternatives:["yapaykuy"],normalized:"add"},remove:{primary:"qichuy",alternatives:["hurquy","anchuchiy"],normalized:"remove"},put:{primary:"churay",alternatives:["tiyachiy"],normalized:"put"},append:{primary:"qatichiy",alternatives:["qhipaman_yapay"],normalized:"append"},prepend:{primary:"ñawpachiy",normalized:"prepend"},take:{primary:"hapiy",normalized:"take"},make:{primary:"ruray",alternatives:["kamay"],normalized:"make"},clone:{primary:"kikinchay",alternatives:[],normalized:"clone"},swap:{primary:"t'inkuy",alternatives:["rantikunakuy","rantin_tikray"],normalized:"swap"},morph:{primary:"tukunay",alternatives:[],normalized:"morph"},set:{primary:"churanay",alternatives:["kamaykuy"],normalized:"set"},get:{primary:"taripay",normalized:"get"},increment:{primary:"yapachiy",normalized:"increment"},decrement:{primary:"pisiyachiy",normalized:"decrement"},log:{primary:"qillqakuy",alternatives:["willakuy"],normalized:"log"},show:{primary:"rikuchiy",alternatives:["qawachiy"],normalized:"show"},hide:{primary:"pakay",alternatives:["pakakuy"],normalized:"hide"},transition:{primary:"pasay",alternatives:[],normalized:"transition"},on:{primary:"chaypim",alternatives:["kaypi"],normalized:"on"},trigger:{primary:"kuyuchiy",alternatives:["kichay"],normalized:"trigger"},send:{primary:"kachay",alternatives:["apachiy"],normalized:"send"},focus:{primary:"qhawachiy",alternatives:["qhaway"],normalized:"focus"},blur:{primary:"paqariy",alternatives:["mana qhawachiy"],normalized:"blur"},empty:{primary:"ch'usaq",normalized:"empty"},open:{primary:"paskay",normalized:"open"},close:{primary:"wichqay",normalized:"close"},select:{primary:"marcay",normalized:"select"},clear:{primary:"pichay",normalized:"clear"},reset:{primary:"musuqchay",normalized:"reset"},breakpoint:{primary:"sayachinay",normalized:"breakpoint"},go:{primary:"riy",alternatives:["puriy"],normalized:"go"},scroll:{primary:"kunray",alternatives:[],normalized:"scroll"},push:{primary:"tanqay",normalized:"push"},replace:{primary:"tikray_url",alternatives:[],normalized:"replace"},process:{primary:"rurariy",normalized:"process"},wait:{primary:"suyay",normalized:"wait"},fetch:{primary:"apamuy",alternatives:["taripakaramuy"],normalized:"fetch"},settle:{primary:"tiyakuy",normalized:"settle"},if:{primary:"sichus",normalized:"if"},when:{primary:"maykama",normalized:"when"},where:{primary:"maypi",normalized:"where"},else:{primary:"manachus",alternatives:["hukniraq"],normalized:"else"},repeat:{primary:"kutipay",alternatives:["muyu"],normalized:"repeat"},for:{primary:"sapankaq",normalized:"for"},while:{primary:"kaykamaqa",normalized:"while"},continue:{primary:"qatipay",normalized:"continue"},halt:{primary:"sayay",alternatives:[],normalized:"halt"},throw:{primary:"chanqay",normalized:"throw"},call:{primary:"waqyay",alternatives:["qayay"],normalized:"call"},return:{primary:"kutichiy",alternatives:["kutimuy"],normalized:"return"},then:{primary:"chaymantataq",alternatives:["hinaspa","chaymanta"],normalized:"then"},and:{primary:"hinallataq",alternatives:["ima","chaymantawan"],normalized:"and"},end:{primary:"tukukuy",alternatives:["tukuy","puchukay"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"mana waqtalla",normalized:"async"},tell:{primary:"niy",alternatives:[],normalized:"tell"},default:{primary:"qallariy",normalized:"default"},init:{primary:"qallarichiy",normalized:"init"},behavior:{primary:"ruwana",normalized:"behavior"},install:{primary:"tarpuy",normalized:"install"},measure:{primary:"tupuy",normalized:"measure"},beep:{primary:"waqay",normalized:"beep"},break:{primary:"p'akiy",normalized:"break"},copy:{primary:"qillqay",normalized:"copy"},exit:{primary:"lluqsiy",normalized:"exit"},pick:{primary:"akllay",normalized:"pick"},render:{primary:"rikurichiy",normalized:"render"},into:{primary:"ukuman",normalized:"into"},before:{primary:"ñawpaq",normalized:"before"},after:{primary:"qhipa",normalized:"after"},until:{primary:"kama",alternatives:["-kama"],normalized:"until"},event:{primary:"ruwakuq",alternatives:["imayna"],normalized:"event"},from:{primary:"manta",alternatives:["-manta"],normalized:"from"},click:{primary:"ñitiy",normalized:"click"},load:{primary:"apakuy",normalized:"load"},submit:{primary:"apaykachay",normalized:"submit"},hover:{primary:"hawachiy",normalized:"hover"},input:{primary:"yaykuchiy",normalized:"input"},change:{primary:"kambiay",normalized:"change"},connect:{primary:"tinkiy",alternatives:["watay","hukllachay"],normalized:"connect"},stream:{primary:"phawachiy",alternatives:["sururichiy","ch'uquchiy"],normalized:"stream"},live:{primary:"kawsachkaq",alternatives:["kunan-pacha","kawsay"],normalized:"live"},socket:{primary:"tinkina",alternatives:["t'oqo","tinkiy-tinkina"],normalized:"socket"}},eventHandler:{keyword:{primary:"pi",alternatives:["kaqtin"]},sourceMarker:{primary:"manta",position:"after"},eventMarker:{primary:"pi",alternatives:["kaqtin","kaqpi"],position:"after"}}}}}),Tm={};gp(Tm,{russianProfile:()=>Em});var jm,Am=vp({"src/generators/profiles/russian.ts"(){Em={code:"ru",name:"Russian",nativeName:"Русский",direction:"ltr",script:"cyrillic",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:1,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:1,suffixes:["ть","ться","ить","иться","ать","аться","еть","еться"]},references:{me:"я",it:"это",you:"ты",result:"результат",event:"событие",target:"цель",body:"body"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:1,specialForms:{me:"мой",it:"его",you:"твой"},keywords:{мой:"me",моя:"me",моё:"me",мои:"me",твой:"you",твоя:"you",твоё:"you",твои:"you",его:"it",её:"it"}},roleMarkers:{destination:{primary:"в",alternatives:["на","к"],position:"before"},source:{primary:"из",alternatives:["от","с"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"с",alternatives:["со"],position:"before"}},keywords:{toggle:{primary:"переключить",alternatives:["переключи"],normalized:"toggle",form:"infinitive"},add:{primary:"добавить",alternatives:["добавь"],normalized:"add",form:"infinitive"},remove:{primary:"удалить",alternatives:["удали","убрать","убери"],normalized:"remove",form:"infinitive"},put:{primary:"положить",alternatives:["положи","поместить","помести","вставить","вставь"],normalized:"put",form:"infinitive"},append:{primary:"добавить_в_конец",alternatives:["дописать"],normalized:"append",form:"infinitive"},prepend:{primary:"добавить_в_начало",normalized:"prepend",form:"infinitive"},take:{primary:"взять",alternatives:["возьми"],normalized:"take",form:"infinitive"},make:{primary:"создать",alternatives:["создай"],normalized:"make",form:"infinitive"},clone:{primary:"клонировать",alternatives:["клонируй"],normalized:"clone",form:"infinitive"},swap:{primary:"поменять",alternatives:["поменяй"],normalized:"swap",form:"infinitive"},morph:{primary:"трансформировать",alternatives:["трансформируй"],normalized:"morph",form:"infinitive"},set:{primary:"установить",alternatives:["установи","задать","задай"],normalized:"set",form:"infinitive"},get:{primary:"получить",alternatives:["получи"],normalized:"get",form:"infinitive"},increment:{primary:"увеличить",alternatives:["увеличь"],normalized:"increment",form:"infinitive"},decrement:{primary:"уменьшить",alternatives:["уменьши"],normalized:"decrement",form:"infinitive"},log:{primary:"записать",alternatives:["запиши"],normalized:"log",form:"infinitive"},show:{primary:"показать",alternatives:["покажи"],normalized:"show",form:"infinitive"},hide:{primary:"скрыть",alternatives:["скрой","спрятать","спрячь"],normalized:"hide",form:"infinitive"},transition:{primary:"анимировать",alternatives:["анимируй"],normalized:"transition",form:"infinitive"},on:{primary:"при",normalized:"on"},trigger:{primary:"инициировать",alternatives:["запустить","запусти"],normalized:"trigger",form:"infinitive"},send:{primary:"отправить",alternatives:["отправь"],normalized:"send",form:"infinitive"},focus:{primary:"сфокусировать",alternatives:["сфокусируй","фокус"],normalized:"focus",form:"infinitive"},blur:{primary:"размыть",alternatives:["размой"],normalized:"blur",form:"infinitive"},empty:{primary:"опустошить",normalized:"empty"},open:{primary:"открыть",normalized:"open"},close:{primary:"закрыть",normalized:"close"},select:{primary:"выделить",normalized:"select"},clear:{primary:"очистить",normalized:"clear"},reset:{primary:"сбросить",normalized:"reset"},breakpoint:{primary:"точка-останова",normalized:"breakpoint"},click:{primary:"клик",alternatives:["клике","нажатии"],normalized:"click"},hover:{primary:"наведении",alternatives:["наведение"],normalized:"hover"},submit:{primary:"отправке",alternatives:["отправка"],normalized:"submit"},input:{primary:"вводе",alternatives:["ввод"],normalized:"input"},change:{primary:"изменении",alternatives:["изменение"],normalized:"change"},go:{primary:"перейти",alternatives:["перейди","идти","иди"],normalized:"go",form:"infinitive"},scroll:{primary:"прокрутить",alternatives:["прокрути"],normalized:"scroll",form:"infinitive"},push:{primary:"втолкнуть",alternatives:["толкнуть"],normalized:"push",form:"infinitive"},replace:{primary:"заменить",alternatives:["замени"],normalized:"replace",form:"infinitive"},process:{primary:"обработать",alternatives:["обработай"],normalized:"process",form:"infinitive"},wait:{primary:"ждать",alternatives:["жди","подожди"],normalized:"wait",form:"infinitive"},fetch:{primary:"загрузить",alternatives:["загрузи"],normalized:"fetch",form:"infinitive"},settle:{primary:"стабилизировать",normalized:"settle",form:"infinitive"},if:{primary:"если",normalized:"if"},when:{primary:"когда",normalized:"when"},where:{primary:"где",normalized:"where"},else:{primary:"иначе",normalized:"else"},repeat:{primary:"повторить",alternatives:["повтори"],normalized:"repeat",form:"infinitive"},for:{primary:"для",alternatives:["каждый"],normalized:"for"},while:{primary:"пока",normalized:"while"},continue:{primary:"продолжить",alternatives:["продолжи"],normalized:"continue",form:"infinitive"},halt:{primary:"остановить",alternatives:["остановись","стоп"],normalized:"halt",form:"infinitive"},throw:{primary:"бросить",alternatives:["брось"],normalized:"throw",form:"infinitive"},call:{primary:"вызвать",alternatives:["вызови"],normalized:"call",form:"infinitive"},return:{primary:"вернуть",alternatives:["верни"],normalized:"return",form:"infinitive"},then:{primary:"затем",alternatives:["потом","тогда"],normalized:"then"},and:{primary:"и",normalized:"and"},end:{primary:"конец",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"асинхронно",alternatives:["async"],normalized:"async"},tell:{primary:"сказать",alternatives:["скажи"],normalized:"tell",form:"infinitive"},default:{primary:"по_умолчанию",normalized:"default"},init:{primary:"инициализировать",alternatives:["инициализируй"],normalized:"init",form:"infinitive"},behavior:{primary:"поведение",normalized:"behavior"},install:{primary:"установить_пакет",normalized:"install",form:"infinitive"},measure:{primary:"измерить",alternatives:["измерь"],normalized:"measure",form:"infinitive"},beep:{primary:"звук",normalized:"beep"},break:{primary:"прервать",normalized:"break"},copy:{primary:"копировать",normalized:"copy"},exit:{primary:"выйти",normalized:"exit"},pick:{primary:"выбрать",normalized:"pick"},render:{primary:"отобразить",normalized:"render"},into:{primary:"в",alternatives:["во"],normalized:"into"},before:{primary:"до",alternatives:["перед"],normalized:"before"},after:{primary:"после",normalized:"after"},until:{primary:"пока_не",normalized:"until"},event:{primary:"событие",normalized:"event"},from:{primary:"из",alternatives:["от","с"],normalized:"from"},connect:{primary:"подключить",alternatives:["соединить","подключиться"],normalized:"connect"},stream:{primary:"транслировать",alternatives:["поток","стрим"],normalized:"stream"},live:{primary:"в-прямом-эфире",alternatives:["прямой-эфир","вживую"],normalized:"live"},socket:{primary:"сокет",alternatives:["гнездо","websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"при",normalized:"on"},sourceMarker:{primary:"на",alternatives:["в","при"],position:"before"},eventMarker:{primary:"при",position:"before"},temporalMarkers:["когда","если"]}}}}),Lm={};gp(Lm,{swahiliProfile:()=>jm});var Om,Cm=vp({"src/generators/profiles/swahili.ts"(){jm={code:"sw",name:"Swahili",nativeName:"Kiswahili",direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:1,verb:{position:"start",subjectDrop:1},references:{me:"mimi",it:"hiyo",you:"wewe",result:"matokeo",event:"tukio",target:"lengo",body:"mwili"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:1,specialForms:{me:"yangu",it:"yake",you:"yako"},keywords:{wangu:"me",yangu:"me",langu:"me",changu:"me",wako:"you",yako:"you",lako:"you",chako:"you",wake:"it",yake:"it",lake:"it",chake:"it"}},roleMarkers:{destination:{primary:"kwenye",alternatives:["kwa"],position:"before"},source:{primary:"kutoka",position:"before"},patient:{primary:"",position:"before"},style:{primary:"na",position:"before"}},keywords:{toggle:{primary:"badilisha",normalized:"toggle"},add:{primary:"ongeza",normalized:"add"},remove:{primary:"ondoa",alternatives:["futa","toa"],normalized:"remove"},put:{primary:"weka",alternatives:["tia"],normalized:"put"},append:{primary:"ambatanisha",normalized:"append"},prepend:{primary:"tanguliza",normalized:"prepend"},take:{primary:"chukua",normalized:"take"},make:{primary:"tengeneza",alternatives:["unda"],normalized:"make"},clone:{primary:"nakili",alternatives:["rudufu"],normalized:"clone"},swap:{primary:"badilishana",alternatives:["badalisha"],normalized:"swap"},morph:{primary:"geuza",alternatives:["badilisha umbo"],normalized:"morph"},set:{primary:"seti",normalized:"set"},get:{primary:"pata",alternatives:["pokea"],normalized:"get"},increment:{primary:"ongezeko",normalized:"increment"},decrement:{primary:"punguza",normalized:"decrement"},log:{primary:"andika",alternatives:["rekodi"],normalized:"log"},show:{primary:"onyesha",normalized:"show"},hide:{primary:"ficha",alternatives:["mficho"],normalized:"hide"},transition:{primary:"hamisha",alternatives:["animisha"],normalized:"transition"},on:{primary:"unapo",alternatives:["kwenye"],normalized:"on"},trigger:{primary:"chochea",normalized:"trigger"},send:{primary:"tuma",alternatives:["peleka"],normalized:"send"},focus:{primary:"lenga",alternatives:["angazia"],normalized:"focus"},blur:{primary:"blur",normalized:"blur"},empty:{primary:"toa-kila-kitu",alternatives:["mwaga"],normalized:"empty"},open:{primary:"fungua",normalized:"open"},close:{primary:"funga",normalized:"close"},select:{primary:"alama",normalized:"select"},clear:{primary:"safisha",normalized:"clear"},reset:{primary:"anzisha-upya",normalized:"reset"},breakpoint:{primary:"nukta-simama",normalized:"breakpoint"},go:{primary:"nenda",alternatives:["enda","elekea"],normalized:"go"},scroll:{primary:"sogeza",alternatives:["skroli"],normalized:"scroll"},push:{primary:"sukuma",alternatives:["push"],normalized:"push"},replace:{primary:"badilisha_url",alternatives:["badili_url"],normalized:"replace"},process:{primary:"shughulikia",alternatives:["changanua"],normalized:"process"},wait:{primary:"subiri",alternatives:["ngoja"],normalized:"wait"},fetch:{primary:"leta",alternatives:["pakia"],normalized:"fetch"},settle:{primary:"tulia",alternatives:["imarika"],normalized:"settle"},if:{primary:"kama",alternatives:["ikiwa"],normalized:"if"},when:{primary:"wakati",normalized:"when"},where:{primary:"wapi",normalized:"where"},else:{primary:"vinginevyo",alternatives:["sivyo"],normalized:"else"},repeat:{primary:"rudia",normalized:"repeat"},for:{primary:"kwa",normalized:"for"},while:{primary:"kadri",normalized:"while"},continue:{primary:"endelea",normalized:"continue"},halt:{primary:"simama",alternatives:["acha"],normalized:"halt"},throw:{primary:"tupa",normalized:"throw"},call:{primary:"ita",normalized:"call"},return:{primary:"rudisha",alternatives:["rejea"],normalized:"return"},then:{primary:"kisha",alternatives:["halafu","baadaye"],normalized:"then"},and:{primary:"na",alternatives:["pia","vilevile"],normalized:"and"},end:{primary:"mwisho",alternatives:["maliza","tamati"],normalized:"end"},js:{primary:"js",alternatives:["javascript"],normalized:"js"},async:{primary:"isiyo sawia",normalized:"async"},tell:{primary:"sema",alternatives:["ambia"],normalized:"tell"},default:{primary:"chaguo-msingi",normalized:"default"},init:{primary:"anzisha",alternatives:["anza"],normalized:"init"},behavior:{primary:"tabia",normalized:"behavior"},install:{primary:"sakinisha",normalized:"install"},measure:{primary:"pima",normalized:"measure"},beep:{primary:"lia",normalized:"beep"},break:{primary:"vunja",normalized:"break"},copy:{primary:"nakala",normalized:"copy"},exit:{primary:"toka",normalized:"exit"},pick:{primary:"chagua",normalized:"pick"},render:{primary:"chora",normalized:"render"},into:{primary:"ndani",normalized:"into"},before:{primary:"kabla",normalized:"before"},after:{primary:"baada",normalized:"after"},until:{primary:"hadi",normalized:"until"},event:{primary:"tukio",normalized:"event"},from:{primary:"kutoka",normalized:"from"},connect:{primary:"unganisha",alternatives:["unga","ungana"],normalized:"connect"},stream:{primary:"tiririsha",alternatives:["mtiririko","strimu"],normalized:"stream"},live:{primary:"moja-kwa-moja",alternatives:["mubashara","hai"],normalized:"live"},socket:{primary:"soketi",alternatives:["tundu","soketi-wavuti"],normalized:"socket"}},eventHandler:{keyword:{primary:"unapo",alternatives:["kwenye","kwa","wakati"]},sourceMarker:{primary:"kutoka",position:"before"},conditionalKeyword:{primary:"unapo",alternatives:["anapo","tunapo","mnapo","wanapo"]},eventMarker:{primary:"unapo",alternatives:["kwenye","kwa","wakati"],position:"before"}}}}}),Nm={};gp(Nm,{thaiProfile:()=>Om});var Pm,Rm=vp({"src/generators/profiles/thai.ts"(){Om={code:"th",name:"Thai",nativeName:"ไทย",direction:"ltr",script:"thai",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:0,defaultVerbForm:"base",verb:{position:"second",subjectDrop:1},references:{me:"ฉัน",it:"มัน",you:"คุณ",result:"ผลลัพธ์",event:"เหตุการณ์",target:"เป้าหมาย",body:"บอดี้"},possessive:{marker:"ของ",markerPosition:"between",keywords:{ของฉัน:"me",ของผม:"me",ของคุณ:"you",ของมัน:"it",ของเขา:"it",ของเธอ:"it"}},roleMarkers:{patient:{primary:"",position:"before"},destination:{primary:"ใน",alternatives:["ไปยัง"],position:"before"},source:{primary:"จาก",position:"before"},style:{primary:"ด้วย",position:"before"},event:{primary:"เมื่อ",position:"before"}},keywords:{toggle:{primary:"สลับ",alternatives:[],normalized:"toggle"},add:{primary:"เพิ่ม",alternatives:[],normalized:"add"},remove:{primary:"ลบ",alternatives:["ลบออก"],normalized:"remove"},put:{primary:"ใส่",alternatives:["วาง"],normalized:"put"},append:{primary:"เพิ่มท้าย",alternatives:[],normalized:"append"},prepend:{primary:"เพิ่มหน้า",alternatives:[],normalized:"prepend"},take:{primary:"รับ",alternatives:[],normalized:"take"},make:{primary:"สร้าง",alternatives:[],normalized:"make"},clone:{primary:"โคลน",alternatives:["สำเนา"],normalized:"clone"},swap:{primary:"สลับที่",alternatives:[],normalized:"swap"},morph:{primary:"แปลงร่าง",alternatives:[],normalized:"morph"},set:{primary:"ตั้ง",alternatives:["กำหนด"],normalized:"set"},get:{primary:"รับค่า",alternatives:[],normalized:"get"},increment:{primary:"เพิ่มค่า",alternatives:[],normalized:"increment"},decrement:{primary:"ลดค่า",alternatives:[],normalized:"decrement"},log:{primary:"บันทึก",alternatives:[],normalized:"log"},show:{primary:"แสดง",alternatives:[],normalized:"show"},hide:{primary:"ซ่อน",alternatives:[],normalized:"hide"},transition:{primary:"เปลี่ยนผ่าน",alternatives:[],normalized:"transition"},on:{primary:"เมื่อ",alternatives:["ตอน"],normalized:"on"},trigger:{primary:"ทริกเกอร์",alternatives:[],normalized:"trigger"},send:{primary:"ส่ง",alternatives:[],normalized:"send"},focus:{primary:"โฟกัส",alternatives:[],normalized:"focus"},blur:{primary:"เบลอ",alternatives:[],normalized:"blur"},empty:{primary:"ล้าง",alternatives:["ทำให้ว่าง"],normalized:"empty"},open:{primary:"เปิด",normalized:"open"},close:{primary:"ปิด",normalized:"close"},select:{primary:"ทำเครื่องหมาย",normalized:"select"},clear:{primary:"เคลียร์",normalized:"clear"},reset:{primary:"รีเซ็ต",normalized:"reset"},breakpoint:{primary:"จุดพัก",normalized:"breakpoint"},click:{primary:"คลิก",normalized:"click"},hover:{primary:"โฮเวอร์",alternatives:["วางเมาส์"],normalized:"hover"},submit:{primary:"ยื่น",alternatives:["ส่งข้อมูล"],normalized:"submit"},input:{primary:"ป้อน",alternatives:["กรอก"],normalized:"input"},change:{primary:"เปลี่ยน",alternatives:["เปลี่ยนแปลง"],normalized:"change"},go:{primary:"ไป",alternatives:["ไปที่"],normalized:"go"},scroll:{primary:"เลื่อน",normalized:"scroll"},push:{primary:"ดัน",alternatives:["ผลัก"],normalized:"push"},replace:{primary:"แทนที่",alternatives:["เปลี่ยน-url"],normalized:"replace"},process:{primary:"ประมวลผล",alternatives:["จัดการ"],normalized:"process"},wait:{primary:"รอ",alternatives:[],normalized:"wait"},fetch:{primary:"ดึงข้อมูล",alternatives:[],normalized:"fetch"},settle:{primary:"คงที่",alternatives:[],normalized:"settle"},if:{primary:"ถ้า",alternatives:["หาก"],normalized:"if"},when:{primary:"ขณะที่",normalized:"when"},where:{primary:"ที่ไหน",normalized:"where"},else:{primary:"ไม่งั้น",alternatives:["ไม่เช่นนั้น"],normalized:"else"},repeat:{primary:"ทำซ้ำ",alternatives:[],normalized:"repeat"},for:{primary:"สำหรับ",alternatives:[],normalized:"for"},while:{primary:"ในขณะที่",alternatives:[],normalized:"while"},continue:{primary:"ต่อไป",alternatives:[],normalized:"continue"},halt:{primary:"หยุด",alternatives:[],normalized:"halt"},throw:{primary:"โยน",alternatives:[],normalized:"throw"},call:{primary:"เรียก",alternatives:[],normalized:"call"},return:{primary:"คืนค่า",alternatives:["กลับ"],normalized:"return"},then:{primary:"แล้ว",alternatives:[],normalized:"then"},and:{primary:"และ",alternatives:[],normalized:"and"},end:{primary:"จบ",alternatives:[],normalized:"end"},js:{primary:"เจเอส",alternatives:["js"],normalized:"js"},async:{primary:"อะซิงค์",alternatives:[],normalized:"async"},tell:{primary:"บอก",alternatives:[],normalized:"tell"},default:{primary:"ค่าเริ่มต้น",alternatives:[],normalized:"default"},init:{primary:"เริ่มต้น",alternatives:[],normalized:"init"},behavior:{primary:"พฤติกรรม",alternatives:[],normalized:"behavior"},install:{primary:"ติดตั้ง",alternatives:[],normalized:"install"},measure:{primary:"วัด",alternatives:[],normalized:"measure"},beep:{primary:"บี๊บ",alternatives:[],normalized:"beep"},break:{primary:"ขัดจังหวะ",alternatives:[],normalized:"break"},copy:{primary:"คัดลอก",alternatives:[],normalized:"copy"},exit:{primary:"ออก",alternatives:[],normalized:"exit"},pick:{primary:"เลือก",alternatives:[],normalized:"pick"},render:{primary:"แสดงผล",alternatives:[],normalized:"render"},into:{primary:"ใน",alternatives:[],normalized:"into"},before:{primary:"ก่อน",alternatives:[],normalized:"before"},after:{primary:"หลัง",alternatives:[],normalized:"after"},until:{primary:"จนถึง",alternatives:[],normalized:"until"},event:{primary:"เหตุการณ์",alternatives:[],normalized:"event"},from:{primary:"จาก",normalized:"from"},connect:{primary:"เชื่อมต่อ",alternatives:["เชื่อม"],normalized:"connect"},stream:{primary:"สตรีม",alternatives:["สตรีมมิ่ง","กระแส"],normalized:"stream"},live:{primary:"ไลฟ์",alternatives:["สด","ถ่ายทอดสด"],normalized:"live"},socket:{primary:"ซ็อกเก็ต",alternatives:["websocket","เว็บซ็อกเก็ต"],normalized:"socket"}},tokenization:{boundaryStrategy:"character"},eventHandler:{keyword:{primary:"เมื่อ",alternatives:["ตอน"],normalized:"on"},sourceMarker:{primary:"จาก",position:"before"},eventMarker:{primary:"เมื่อ",alternatives:["ตอน"],position:"before"},temporalMarkers:["เมื่อ","ตอน"]}}}}),$m={};gp($m,{tagalogProfile:()=>Pm});var Im,Mm=vp({"src/generators/profiles/tl.ts"(){Pm={code:"tl",name:"Tagalog",nativeName:"Tagalog",direction:"ltr",script:"latin",wordOrder:"VSO",markingStrategy:"preposition",usesSpaces:1,defaultVerbForm:"base",verb:{position:"start",subjectDrop:1},references:{me:"ako",it:"ito",you:"ikaw",result:"resulta",event:"pangyayari",target:"target",body:"body"},possessive:{marker:"ng",markerPosition:"between",keywords:{ko:"me",akin:"me",aking:"me",mo:"you",iyo:"you",niya:"it",nito:"it",kaniya:"it"}},roleMarkers:{destination:{primary:"sa",position:"before"},source:{primary:"mula_sa",position:"before"},patient:{primary:"",position:"before"},style:{primary:"nang",position:"before"}},keywords:{toggle:{primary:"palitan",alternatives:["itoggle"],normalized:"toggle"},add:{primary:"idagdag",alternatives:["magdagdag"],normalized:"add"},remove:{primary:"alisin",alternatives:["tanggalin"],normalized:"remove"},put:{primary:"ilagay",alternatives:["maglagay"],normalized:"put"},append:{primary:"idagdag_sa_dulo",normalized:"append"},prepend:{primary:"idagdag_sa_simula",normalized:"prepend"},take:{primary:"kumuha",normalized:"take"},make:{primary:"gumawa",alternatives:["lumikha"],normalized:"make"},clone:{primary:"i-clone",normalized:"clone"},swap:{primary:"palitan_pwesto",alternatives:["magpalit"],normalized:"swap"},morph:{primary:"baguhin",normalized:"morph"},set:{primary:"itakda",alternatives:["magtakda"],normalized:"set"},get:{primary:"kunin",normalized:"get"},increment:{primary:"dagdagan",alternatives:["taasan"],normalized:"increment"},decrement:{primary:"bawasan",alternatives:["ibaba"],normalized:"decrement"},log:{primary:"itala",normalized:"log"},show:{primary:"ipakita",alternatives:["magpakita"],normalized:"show"},hide:{primary:"itago",alternatives:["magtago"],normalized:"hide"},transition:{primary:"lumipat",normalized:"transition"},on:{primary:"kapag",normalized:"on"},trigger:{primary:"palitawin",alternatives:["magpatugtog"],normalized:"trigger"},send:{primary:"ipadala",alternatives:["magpadala"],normalized:"send"},focus:{primary:"ituon",normalized:"focus"},blur:{primary:"alisin_tuon",normalized:"blur"},empty:{primary:"walang-laman",alternatives:["alisin-laman"],normalized:"empty"},open:{primary:"buksan",normalized:"open"},close:{primary:"isara",normalized:"close"},select:{primary:"piliin",normalized:"select"},clear:{primary:"burahin",normalized:"clear"},reset:{primary:"i-reset",normalized:"reset"},breakpoint:{primary:"breakpoint",normalized:"breakpoint"},go:{primary:"pumunta",alternatives:["punta"],normalized:"go"},scroll:{primary:"iscroll",alternatives:["mag_scroll"],normalized:"scroll"},push:{primary:"itulak",alternatives:["ipush"],normalized:"push"},replace:{primary:"palitan_url",alternatives:["ireplace"],normalized:"replace"},process:{primary:"iproseso",alternatives:["proseso"],normalized:"process"},wait:{primary:"maghintay",alternatives:["hintay"],normalized:"wait"},fetch:{primary:"kuhanin_mula",alternatives:["kunin_mula"],normalized:"fetch"},settle:{primary:"magpatahimik",normalized:"settle"},if:{primary:"kung",normalized:"if"},when:{primary:"tuwing",normalized:"when"},where:{primary:"kung_saan",normalized:"where"},else:{primary:"kung_hindi",alternatives:["kundi"],normalized:"else"},repeat:{primary:"ulitin",alternatives:["paulit-ulit"],normalized:"repeat"},for:{primary:"para_sa",normalized:"for"},while:{primary:"habang",normalized:"while"},continue:{primary:"magpatuloy",normalized:"continue"},halt:{primary:"itigil",alternatives:["huminto"],normalized:"halt"},throw:{primary:"ihagis",alternatives:["itapon"],normalized:"throw"},call:{primary:"tawagin",alternatives:["tawagan","tumawag"],normalized:"call"},return:{primary:"ibalik",alternatives:["bumalik"],normalized:"return"},then:{primary:"pagkatapos",alternatives:["saka"],normalized:"then"},and:{primary:"at",normalized:"and"},end:{primary:"wakas",alternatives:["tapos"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"async",normalized:"async"},tell:{primary:"sabihin",alternatives:["magsabi"],normalized:"tell"},default:{primary:"pamantayan",alternatives:["default","unang_halaga"],normalized:"default"},init:{primary:"simulan",alternatives:["magsimula"],normalized:"init"},behavior:{primary:"ugali",alternatives:["kilos"],normalized:"behavior"},install:{primary:"ikabit",alternatives:["mag-install"],normalized:"install"},measure:{primary:"sukatin",normalized:"measure"},beep:{primary:"tunog",normalized:"beep"},break:{primary:"putulin",normalized:"break"},copy:{primary:"kopyahin",normalized:"copy"},exit:{primary:"lumabas",normalized:"exit"},pick:{primary:"pumili",normalized:"pick"},render:{primary:"irender",normalized:"render"},into:{primary:"sa",normalized:"into"},before:{primary:"bago",normalized:"before"},after:{primary:"matapos",normalized:"after"},until:{primary:"hanggang",normalized:"until"},event:{primary:"pangyayari",normalized:"event"},from:{primary:"mula",alternatives:["galing"],normalized:"from"},connect:{primary:"ikonekta",alternatives:["kumonekta","connect"],normalized:"connect"},stream:{primary:"i-stream",alternatives:["stream","agos"],normalized:"stream"},live:{primary:"live",alternatives:["tuwiran","direkta"],normalized:"live"},socket:{primary:"socket",alternatives:["websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"kapag",normalized:"on"},sourceMarker:{primary:"mula_sa",alternatives:["galing_sa"],position:"before"},eventMarker:{primary:"kapag",position:"before"}}}}}),qm={};gp(qm,{turkishProfile:()=>Im});var _m,Dm=vp({"src/generators/profiles/turkish.ts"(){Im={code:"tr",name:"Turkish",nativeName:"Türkçe",regions:["priority"],direction:"ltr",script:"latin",wordOrder:"SOV",markingStrategy:"case-suffix",usesSpaces:1,verb:{position:"end",suffixes:["mek","mak","yor","di","miş"],subjectDrop:1},references:{me:"ben",it:"o",you:"sen",result:"sonuç",event:"olay",target:"hedef",body:"gövde"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:1,specialForms:{me:"benim",it:"onun",you:"senin"},keywords:{benim:"me",senin:"you",onun:"it"}},roleMarkers:{patient:{primary:"i",alternatives:["ı","u","ü","yi","yı","yu","yü","ni","nı","nu","nü"],position:"after"},destination:{primary:"e",alternatives:["a","ye","ya","ne","na","de","da","te","ta","ın","in","un","ün","nın","nin","nun","nün"],position:"after"},source:{primary:"den",alternatives:["dan","ten","tan"],position:"after"},style:{primary:"le",alternatives:["la","yle","yla"],position:"after"},event:{primary:"i",alternatives:["ı","u","ü"],position:"after"}},keywords:{toggle:{primary:"değiştir",alternatives:["aç/kapat"],normalized:"toggle"},add:{primary:"ekle",normalized:"add"},remove:{primary:"kaldır",alternatives:["sil"],normalized:"remove"},put:{primary:"koy",normalized:"put"},append:{primary:"iliştir",normalized:"append"},prepend:{primary:"başınaekle",normalized:"prepend"},take:{primary:"tut",normalized:"take"},make:{primary:"yap",normalized:"make"},clone:{primary:"klonla",normalized:"clone"},swap:{primary:"takas",normalized:"swap"},morph:{primary:"dönüştür",alternatives:["şekil değiştir"],normalized:"morph"},set:{primary:"ayarla",alternatives:["belirle"],normalized:"set"},get:{primary:"al",normalized:"get"},increment:{primary:"artır",normalized:"increment"},decrement:{primary:"azalt",normalized:"decrement"},log:{primary:"kaydet",normalized:"log"},show:{primary:"göster",normalized:"show"},hide:{primary:"gizle",normalized:"hide"},transition:{primary:"geçiş",normalized:"transition"},on:{primary:"üzerinde",alternatives:["zaman"],normalized:"on"},trigger:{primary:"tetikle",normalized:"trigger"},send:{primary:"gönder",normalized:"send"},focus:{primary:"odak",alternatives:["odaklanma"],normalized:"focus"},blur:{primary:"bulanık",alternatives:["bulanıklık","bulanik"],normalized:"blur"},empty:{primary:"boşalt",alternatives:["bosalt"],normalized:"empty"},open:{primary:"aç",alternatives:["ac"],normalized:"open"},close:{primary:"kapat",normalized:"close"},select:{primary:"vurgula",normalized:"select"},clear:{primary:"temizle",normalized:"clear"},reset:{primary:"sıfırla",alternatives:["sifirla"],normalized:"reset"},breakpoint:{primary:"kesme-noktası",alternatives:["kesme-noktasi"],normalized:"breakpoint"},click:{primary:"tıklama",alternatives:["tıkla","tiklama","tık","tik"],normalized:"click"},hover:{primary:"üzerine gelme",alternatives:["üzerinde gezinme"],normalized:"hover"},submit:{primary:"gönderme",normalized:"submit"},input:{primary:"giriş",alternatives:["girdi","giris"],normalized:"input"},change:{primary:"değişiklik",alternatives:["değişim","degisim"],normalized:"change"},go:{primary:"git",normalized:"go"},scroll:{primary:"kaydır",alternatives:["kaydir"],normalized:"scroll"},push:{primary:"itele",alternatives:["push"],normalized:"push"},replace:{primary:"değiştir_url",alternatives:["degistir_url"],normalized:"replace"},process:{primary:"işle",alternatives:["isle"],normalized:"process"},wait:{primary:"bekle",normalized:"wait"},fetch:{primary:"getir",normalized:"fetch"},settle:{primary:"sabitlen",normalized:"settle"},if:{primary:"eğer",normalized:"if"},when:{primary:"iken",alternatives:["durumunda","olduğunda"],normalized:"when"},where:{primary:"nerede",normalized:"where"},else:{primary:"yoksa",normalized:"else"},repeat:{primary:"tekrarla",normalized:"repeat"},for:{primary:"için",normalized:"for"},while:{primary:"süresince",normalized:"while"},continue:{primary:"devam",normalized:"continue"},halt:{primary:"durdur",normalized:"halt"},throw:{primary:"fırlat",normalized:"throw"},call:{primary:"çağır",normalized:"call"},return:{primary:"dön",normalized:"return"},then:{primary:"ardından",alternatives:["daha sonra","ardindan"],normalized:"then"},and:{primary:"ve",alternatives:["ayrıca","hem de"],normalized:"and"},or:{primary:"veya",normalized:"or"},not:{primary:"değil",alternatives:["degil"],normalized:"not"},end:{primary:"son",alternatives:["bitiş","bitti"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"asenkron",normalized:"async"},tell:{primary:"söyle",normalized:"tell"},default:{primary:"varsayılan",normalized:"default"},init:{primary:"başlat",normalized:"init"},behavior:{primary:"davranış",normalized:"behavior"},install:{primary:"yükle",alternatives:["kur","yüklemek"],normalized:"install"},measure:{primary:"ölç",normalized:"measure"},beep:{primary:"bip",normalized:"beep"},break:{primary:"dur",normalized:"break"},copy:{primary:"kopyala",normalized:"copy"},exit:{primary:"çık",normalized:"exit"},pick:{primary:"seç",normalized:"pick"},render:{primary:"render",normalized:"render"},into:{primary:"içine",normalized:"into"},before:{primary:"önce",normalized:"before"},after:{primary:"sonra",normalized:"after"},until:{primary:"kadar",normalized:"until"},event:{primary:"olay",normalized:"event"},from:{primary:"den",alternatives:["dan"],normalized:"from"},connect:{primary:"bağlan",alternatives:["bağla","bağlantı"],normalized:"connect"},stream:{primary:"yayınla",alternatives:["akıt","akış"],normalized:"stream"},live:{primary:"canlı",alternatives:["gerçek-zamanlı"],normalized:"live"},socket:{primary:"soket",alternatives:["websocket"],normalized:"socket"}},eventHandler:{eventMarker:{primary:"da",alternatives:["de","ta","te"],position:"after"},temporalMarkers:["dığında","diğinde"]}}}}),Vm={};gp(Vm,{ukrainianProfile:()=>_m});var Hm,Fm=vp({"src/generators/profiles/ukrainian.ts"(){_m={code:"uk",name:"Ukrainian",nativeName:"Українська",direction:"ltr",script:"cyrillic",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:1,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:1,suffixes:["ти","тися","ити","итися","ати","атися","іти","ітися"]},references:{me:"я",it:"це",you:"ти",result:"результат",event:"подія",target:"ціль",body:"body"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:1,specialForms:{me:"мій",it:"його",you:"твій"},keywords:{мій:"me",моя:"me",моє:"me",мої:"me",твій:"you",твоя:"you",твоє:"you",твої:"you",його:"it",її:"it"}},roleMarkers:{destination:{primary:"в",alternatives:["на","до"],position:"before"},source:{primary:"з",alternatives:["від","із"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"з",alternatives:["із"],position:"before"}},keywords:{toggle:{primary:"перемкнути",alternatives:["перемкни"],normalized:"toggle",form:"infinitive"},add:{primary:"додати",alternatives:["додай"],normalized:"add",form:"infinitive"},remove:{primary:"видалити",alternatives:["видали","прибрати","прибери"],normalized:"remove",form:"infinitive"},put:{primary:"покласти",alternatives:["поклади","помістити","помісти","вставити","встав"],normalized:"put",form:"infinitive"},append:{primary:"додати_в_кінець",alternatives:["дописати"],normalized:"append",form:"infinitive"},prepend:{primary:"додати_на_початок",normalized:"prepend",form:"infinitive"},take:{primary:"взяти",alternatives:["візьми"],normalized:"take",form:"infinitive"},make:{primary:"створити",alternatives:["створи"],normalized:"make",form:"infinitive"},clone:{primary:"клонувати",alternatives:["клонуй"],normalized:"clone",form:"infinitive"},swap:{primary:"поміняти",alternatives:["поміняй"],normalized:"swap",form:"infinitive"},morph:{primary:"трансформувати",alternatives:["трансформуй"],normalized:"morph",form:"infinitive"},set:{primary:"встановити",alternatives:["встанови","задати","задай"],normalized:"set",form:"infinitive"},get:{primary:"отримати",alternatives:["отримай"],normalized:"get",form:"infinitive"},increment:{primary:"збільшити",alternatives:["збільш"],normalized:"increment",form:"infinitive"},decrement:{primary:"зменшити",alternatives:["зменш"],normalized:"decrement",form:"infinitive"},log:{primary:"записати",alternatives:["запиши"],normalized:"log",form:"infinitive"},show:{primary:"показати",alternatives:["покажи"],normalized:"show",form:"infinitive"},hide:{primary:"сховати",alternatives:["сховай","приховати","приховай"],normalized:"hide",form:"infinitive"},transition:{primary:"анімувати",alternatives:["анімуй"],normalized:"transition",form:"infinitive"},on:{primary:"при",normalized:"on"},trigger:{primary:"ініціювати",alternatives:["запустити","запусти"],normalized:"trigger",form:"infinitive"},send:{primary:"надіслати",alternatives:["надішли"],normalized:"send",form:"infinitive"},focus:{primary:"сфокусувати",alternatives:["сфокусуй","фокус"],normalized:"focus",form:"infinitive"},blur:{primary:"розфокусувати",alternatives:["розфокусуй"],normalized:"blur",form:"infinitive"},empty:{primary:"спорожнити",normalized:"empty"},open:{primary:"відкрити",normalized:"open"},close:{primary:"закрити",normalized:"close"},select:{primary:"виділити",normalized:"select"},clear:{primary:"очистити",normalized:"clear"},reset:{primary:"скинути",normalized:"reset"},breakpoint:{primary:"точка-зупинки",normalized:"breakpoint"},click:{primary:"кліку",alternatives:["клік","натисканні"],normalized:"click"},hover:{primary:"наведенні",alternatives:["наведення"],normalized:"hover"},submit:{primary:"відправці",alternatives:["відправка"],normalized:"submit"},input:{primary:"введенні",alternatives:["введення"],normalized:"input"},change:{primary:"зміні",alternatives:["зміна"],normalized:"change"},go:{primary:"перейти",alternatives:["перейди","йти","йди"],normalized:"go",form:"infinitive"},scroll:{primary:"прокрутити",alternatives:["прокрути"],normalized:"scroll",form:"infinitive"},push:{primary:"штовхнути",alternatives:["заштовхнути"],normalized:"push",form:"infinitive"},replace:{primary:"замінити",alternatives:["заміни"],normalized:"replace",form:"infinitive"},process:{primary:"обробити",alternatives:["обробляти"],normalized:"process",form:"infinitive"},wait:{primary:"чекати",alternatives:["чекай","зачекай"],normalized:"wait",form:"infinitive"},fetch:{primary:"завантажити",alternatives:["завантаж"],normalized:"fetch",form:"infinitive"},settle:{primary:"стабілізувати",normalized:"settle",form:"infinitive"},if:{primary:"якщо",normalized:"if"},when:{primary:"коли",normalized:"when"},where:{primary:"де",normalized:"where"},else:{primary:"інакше",normalized:"else"},repeat:{primary:"повторити",alternatives:["повтори"],normalized:"repeat",form:"infinitive"},for:{primary:"для",alternatives:["кожний"],normalized:"for"},while:{primary:"поки",normalized:"while"},continue:{primary:"продовжити",alternatives:["продовжуй"],normalized:"continue",form:"infinitive"},halt:{primary:"зупинити",alternatives:["зупинись","стоп"],normalized:"halt",form:"infinitive"},throw:{primary:"кинути",alternatives:["кинь"],normalized:"throw",form:"infinitive"},call:{primary:"викликати",alternatives:["виклич"],normalized:"call",form:"infinitive"},return:{primary:"повернути",alternatives:["поверни"],normalized:"return",form:"infinitive"},then:{primary:"потім",alternatives:["далі","тоді"],normalized:"then"},and:{primary:"і",alternatives:["та"],normalized:"and"},end:{primary:"кінець",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"асинхронно",alternatives:["async"],normalized:"async"},tell:{primary:"сказати",alternatives:["скажи"],normalized:"tell",form:"infinitive"},default:{primary:"за_замовчуванням",normalized:"default"},init:{primary:"ініціалізувати",alternatives:["ініціалізуй"],normalized:"init",form:"infinitive"},behavior:{primary:"поведінка",normalized:"behavior"},install:{primary:"встановити_пакет",normalized:"install",form:"infinitive"},measure:{primary:"виміряти",alternatives:["виміряй"],normalized:"measure",form:"infinitive"},beep:{primary:"звук",normalized:"beep"},break:{primary:"перервати",normalized:"break"},copy:{primary:"копіювати",normalized:"copy"},exit:{primary:"вийти",normalized:"exit"},pick:{primary:"вибрати",normalized:"pick"},render:{primary:"відобразити",normalized:"render"},into:{primary:"в",alternatives:["у"],normalized:"into"},before:{primary:"до",alternatives:["перед"],normalized:"before"},after:{primary:"після",normalized:"after"},until:{primary:"поки_не",normalized:"until"},event:{primary:"подія",normalized:"event"},from:{primary:"з",alternatives:["від","із"],normalized:"from"},connect:{primary:"підключити",alternatives:["зʼєднати","підключитися"],normalized:"connect"},stream:{primary:"транслювати",alternatives:["потік","стрім"],normalized:"stream"},live:{primary:"наживо",alternatives:["у-прямому-ефірі","в-режимі-реального-часу"],normalized:"live"},socket:{primary:"сокет",alternatives:["гніздо","websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"при",normalized:"on"},sourceMarker:{primary:"на",alternatives:["в","при"],position:"before"},eventMarker:{primary:"при",position:"before"},temporalMarkers:["коли","якщо"]}}}}),Bm={};gp(Bm,{vietnameseProfile:()=>Hm});var Um,Gm=vp({"src/generators/profiles/vietnamese.ts"(){Hm={code:"vi",name:"Vietnamese",nativeName:"Tiếng Việt",direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:1,defaultVerbForm:"base",verb:{position:"start",subjectDrop:1},references:{me:"tôi",it:"nó",you:"bạn",result:"kết quả",event:"sự kiện",target:"mục tiêu",body:"body"},possessive:{marker:"của",markerPosition:"between",specialForms:{me:"của tôi",it:"của nó",you:"của bạn"},keywords:{"của tôi":"me","của bạn":"you","của anh":"you","của chị":"you","của nó":"it"}},roleMarkers:{destination:{primary:"vào",alternatives:["cho","đến"],position:"before"},source:{primary:"từ",alternatives:["khỏi"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"với",position:"before"}},keywords:{toggle:{primary:"chuyển đổi",alternatives:["bật tắt","chuyển"],normalized:"toggle"},add:{primary:"thêm",alternatives:["bổ sung"],normalized:"add"},remove:{primary:"xóa",alternatives:["gỡ bỏ","loại bỏ","bỏ"],normalized:"remove"},put:{primary:"đặt",alternatives:["để","đưa"],normalized:"put"},append:{primary:"nối",normalized:"append"},prepend:{primary:"thêm vào đầu",normalized:"prepend"},take:{primary:"lấy",normalized:"take"},make:{primary:"tạo",normalized:"make"},clone:{primary:"nhân bản",normalized:"clone"},swap:{primary:"hoán đổi",normalized:"swap"},morph:{primary:"biến đổi",normalized:"morph"},set:{primary:"gán",alternatives:["thiết lập"],normalized:"set"},get:{primary:"lấy giá trị",alternatives:["nhận"],normalized:"get"},increment:{primary:"tăng",alternatives:["tăng lên"],normalized:"increment"},decrement:{primary:"giảm",alternatives:["giảm đi"],normalized:"decrement"},log:{primary:"in ra",normalized:"log"},show:{primary:"hiển thị",alternatives:["hiện"],normalized:"show"},hide:{primary:"ẩn",alternatives:["che","giấu"],normalized:"hide"},transition:{primary:"chuyển tiếp",normalized:"transition"},on:{primary:"khi",alternatives:["trên"],normalized:"on"},trigger:{primary:"kích hoạt",normalized:"trigger"},send:{primary:"gửi",normalized:"send"},focus:{primary:"tập trung",normalized:"focus"},blur:{primary:"mất tập trung",normalized:"blur"},empty:{primary:"làm-rỗng",normalized:"empty"},open:{primary:"mở",normalized:"open"},close:{primary:"đóng",normalized:"close"},select:{primary:"đánh-dấu",normalized:"select"},clear:{primary:"tẩy",normalized:"clear"},reset:{primary:"đặt-lại",normalized:"reset"},breakpoint:{primary:"điểm-dừng",normalized:"breakpoint"},click:{primary:"nhấp",alternatives:["bấm"],normalized:"click"},hover:{primary:"di chuột",alternatives:["rê chuột"],normalized:"hover"},submit:{primary:"nộp",alternatives:[],normalized:"submit"},input:{primary:"nhập",alternatives:["nhập liệu"],normalized:"input"},change:{primary:"thay đổi",alternatives:["đổi"],normalized:"change"},go:{primary:"đi đến",alternatives:["đi"],normalized:"go"},scroll:{primary:"cuộn",normalized:"scroll"},push:{primary:"đẩy",alternatives:["push"],normalized:"push"},replace:{primary:"thay_thế",alternatives:["thay_the"],normalized:"replace"},process:{primary:"xử_lý",alternatives:["xu_ly"],normalized:"process"},wait:{primary:"chờ",alternatives:["đợi"],normalized:"wait"},fetch:{primary:"tải",normalized:"fetch"},settle:{primary:"ổn định",normalized:"settle"},if:{primary:"nếu",normalized:"if"},when:{primary:"lúc",normalized:"when"},where:{primary:"ở_đâu",normalized:"where"},else:{primary:"không thì",alternatives:["nếu không"],normalized:"else"},repeat:{primary:"lặp lại",normalized:"repeat"},for:{primary:"với mỗi",normalized:"for"},while:{primary:"trong khi",normalized:"while"},continue:{primary:"tiếp tục",normalized:"continue"},halt:{primary:"dừng",alternatives:["dừng lại"],normalized:"halt"},throw:{primary:"ném",normalized:"throw"},call:{primary:"gọi",normalized:"call"},return:{primary:"trả về",normalized:"return"},then:{primary:"rồi",alternatives:["sau đó","thì"],normalized:"then"},and:{primary:"và",normalized:"and"},end:{primary:"kết thúc",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"bất đồng bộ",normalized:"async"},tell:{primary:"nói với",normalized:"tell"},default:{primary:"mặc định",normalized:"default"},init:{primary:"khởi tạo",normalized:"init"},behavior:{primary:"hành vi",normalized:"behavior"},install:{primary:"cài đặt",normalized:"install"},measure:{primary:"đo lường",normalized:"measure"},beep:{primary:"beep",normalized:"beep"},break:{primary:"ngắt",normalized:"break"},copy:{primary:"sao chép",normalized:"copy"},exit:{primary:"thoát",normalized:"exit"},pick:{primary:"chọn",normalized:"pick"},render:{primary:"kết xuất",normalized:"render"},into:{primary:"vào",alternatives:["vào trong"],normalized:"into"},before:{primary:"trước",alternatives:["trước khi"],normalized:"before"},after:{primary:"sau",alternatives:["sau khi"],normalized:"after"},until:{primary:"cho đến khi",normalized:"until"},event:{primary:"sự kiện",normalized:"event"},from:{primary:"từ",alternatives:["khỏi"],normalized:"from"},connect:{primary:"kết-nối",alternatives:["kết-nối-tới"],normalized:"connect"},stream:{primary:"truyền-phát",alternatives:["phát","luồng"],normalized:"stream"},live:{primary:"trực-tiếp",alternatives:["phát-trực-tiếp"],normalized:"live"},socket:{primary:"socket",alternatives:["ổ-cắm","websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"khi",alternatives:["trên"],normalized:"on"},sourceMarker:{primary:"trên",alternatives:["tại"],position:"before"},eventMarker:{primary:"khi",alternatives:["lúc"],position:"before"},temporalMarkers:["khi","lúc"]}}}}),Wm={};gp(Wm,{chineseProfile:()=>Um});var Km,Jm,Zm,Ym,Xm,Qm,ed,td,nd=vp({"src/generators/profiles/chinese.ts"(){Um={code:"zh",name:"Chinese",nativeName:"中文",regions:["east-asian","priority"],direction:"ltr",script:"cjk",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:0,verb:{position:"second",subjectDrop:1},references:{me:"我",it:"它",you:"你",result:"结果",event:"事件",target:"目标",body:"主体"},possessive:{marker:"的",markerPosition:"between",keywords:{我的:"me",你的:"you",它的:"it",他的:"it",她的:"it"}},roleMarkers:{destination:{primary:"在",alternatives:["到","于"],position:"before"},source:{primary:"从",alternatives:["由"],position:"before"},patient:{primary:"把",position:"before"},style:{primary:"用",alternatives:["以"],position:"before"}},keywords:{toggle:{primary:"切换",normalized:"toggle"},add:{primary:"添加",alternatives:["加"],normalized:"add"},remove:{primary:"移除",alternatives:["删除","去掉"],normalized:"remove"},put:{primary:"放置",alternatives:["放","放入"],normalized:"put"},append:{primary:"追加",alternatives:["附加"],normalized:"append"},prepend:{primary:"前置",alternatives:["预置"],normalized:"prepend"},take:{primary:"拿取",normalized:"take"},make:{primary:"制作",normalized:"make"},clone:{primary:"克隆",normalized:"clone"},swap:{primary:"交换",normalized:"swap"},morph:{primary:"变形",alternatives:["转换"],normalized:"morph"},set:{primary:"设置",alternatives:["设定"],normalized:"set"},get:{primary:"获取",alternatives:["获得","取得"],normalized:"get"},increment:{primary:"增加",normalized:"increment"},decrement:{primary:"减少",normalized:"decrement"},log:{primary:"日志",normalized:"log"},show:{primary:"显示",alternatives:["展示"],normalized:"show"},hide:{primary:"隐藏",normalized:"hide"},transition:{primary:"过渡",normalized:"transition"},on:{primary:"当",alternatives:["在...时"],normalized:"on"},trigger:{primary:"触发",normalized:"trigger"},send:{primary:"发送",normalized:"send"},focus:{primary:"聚焦",normalized:"focus"},blur:{primary:"失焦",normalized:"blur"},empty:{primary:"清空",normalized:"empty"},open:{primary:"打开",normalized:"open"},close:{primary:"关闭",normalized:"close"},select:{primary:"选择",normalized:"select"},clear:{primary:"清除",normalized:"clear"},reset:{primary:"重置",normalized:"reset"},breakpoint:{primary:"断点",normalized:"breakpoint"},click:{primary:"点击",normalized:"click"},hover:{primary:"悬停",alternatives:["悬浮"],normalized:"hover"},submit:{primary:"提交",normalized:"submit"},input:{primary:"输入",normalized:"input"},change:{primary:"改变",alternatives:["变化"],normalized:"change"},go:{primary:"前往",normalized:"go"},scroll:{primary:"滚动",normalized:"scroll"},push:{primary:"推送",normalized:"push"},replace:{primary:"替换",normalized:"replace"},process:{primary:"处理",normalized:"process"},wait:{primary:"等待",normalized:"wait"},fetch:{primary:"抓取",normalized:"fetch"},settle:{primary:"稳定",normalized:"settle"},if:{primary:"如果",normalized:"if"},when:{primary:"何时",normalized:"when"},where:{primary:"哪里",normalized:"where"},else:{primary:"否则",normalized:"else"},repeat:{primary:"重复",normalized:"repeat"},for:{primary:"为",normalized:"for"},while:{primary:"持续",normalized:"while"},continue:{primary:"继续",normalized:"continue"},halt:{primary:"停止",normalized:"halt"},throw:{primary:"抛出",normalized:"throw"},call:{primary:"调用",normalized:"call"},return:{primary:"返回",normalized:"return"},then:{primary:"然后",alternatives:["接着"],normalized:"then"},and:{primary:"并且",alternatives:["和","而且"],normalized:"and"},end:{primary:"结束",alternatives:["终止","完"],normalized:"end"},js:{primary:"JS执行",alternatives:["js"],normalized:"js"},async:{primary:"异步",normalized:"async"},tell:{primary:"告诉",normalized:"tell"},default:{primary:"默认",normalized:"default"},init:{primary:"初始化",normalized:"init"},behavior:{primary:"行为",normalized:"behavior"},install:{primary:"安装",normalized:"install"},measure:{primary:"测量",normalized:"measure"},beep:{primary:"蜂鸣",normalized:"beep"},break:{primary:"中断",normalized:"break"},copy:{primary:"复制",normalized:"copy"},exit:{primary:"退出",normalized:"exit"},pick:{primary:"选取",normalized:"pick"},render:{primary:"渲染",normalized:"render"},into:{primary:"进入",normalized:"into"},before:{primary:"之前",normalized:"before"},after:{primary:"之后",normalized:"after"},until:{primary:"直到",normalized:"until"},event:{primary:"事件",normalized:"event"},from:{primary:"从",normalized:"from"},connect:{primary:"连接",alternatives:["连接器"],normalized:"connect"},stream:{primary:"流",alternatives:["流式传输"],normalized:"stream"},live:{primary:"实时",alternatives:["直播"],normalized:"live"},socket:{primary:"套接字",alternatives:["websocket"],normalized:"socket"}},tokenization:{boundaryStrategy:"character"},eventHandler:{keyword:{primary:"当",alternatives:["在...时"],normalized:"on"},sourceMarker:{primary:"从",position:"before"},eventMarker:{primary:"当",alternatives:["在"],position:"before"},temporalMarkers:["当","在...时"]}}}}),rd=vp({"src/tokenizers/token-utils.ts"(){}}),id=vp({"src/tokenizers/char-classifiers.ts"(){}}),ad=vp({"src/tokenizers/base-tokenizer.ts"(){}}),od=vp({"src/tokenizers/base.ts"(){rd(),id(),ad()}}),sd=vp({"src/tokenizers/generic-extractors.ts"(){Km=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Jm=class{constructor(e=Km){this.name="operator",this.operators=[...e].sort((e,t)=>t.length-e.length)}canExtract(e,t){return this.operators.some(n=>e.startsWith(n,t))}extract(e,t){for(const n of this.operators)if(e.startsWith(n,t))return{value:n,length:n.length};return null}},Zm=class{constructor(e="()[]{},:;"){this.punctuation=e,this.name="punctuation"}canExtract(e,t){return this.punctuation.includes(e[t])}extract(e,t){const n=e[t];return this.punctuation.includes(n)?{value:n,length:1}:null}}}}),ld=vp({"src/tokenizers/extractors/css-selector.ts"(){Ym=class{constructor(){this.name="css-selector"}canExtract(e,t){const n=e[t];return"#"===n||"."===n||"["===n||"<"===n}extract(e,t){const n=function(e,t){const n=e[t];if("#"===n){const n=e.slice(t).match(/^#[a-zA-Z_][\w-]*/);return n?n[0]:null}if("."===n){const n=e.slice(t).match(/^\.[a-zA-Z_][\w-]*/);return n?n[0]:null}if("["===n){let n=0,r=t;for(;e.length>r;){if("["===e[r]&&n++,"]"===e[r]&&(n--,0===n))return e.slice(t,r+1);r++}return null}if("<"===n){const n=e.slice(t).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return n?n[0]:null}return null}(e,t);return n?{value:n,length:n.length,metadata:{type:"css-selector"}}:null}}}}),cd=vp({"src/tokenizers/extractors/event-modifier.ts"(){Xm=class{constructor(){this.name="event-modifier"}canExtract(e,t){if("."!==e[t])return 0;const n=e.slice(t);return/^\.(once|prevent|stop|debounce|throttle|queue)/.test(n)}extract(e,t){const n=e.slice(t).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!n)return null;const r=n[0],i=r.slice(1).split("(")[0],a=n[1];return{value:r,length:r.length,metadata:{modifierName:i,value:a?"queue"===i?a:parseInt(a,10):void 0}}}}}}),ud=vp({"src/tokenizers/extractors/url.ts"(){Qm=class{constructor(){this.name="url"}canExtract(e,t){const n=e.slice(t);return n.startsWith("http://")||n.startsWith("https://")||n.startsWith("//")||n.startsWith("./")||n.startsWith("../")||n.startsWith("/")}extract(e,t){const n=function(e,t){const n=e.slice(t);if(n.startsWith("http://")||n.startsWith("https://")){const e=n.match(/^https?:\/\/[^\s]*/);return e?e[0]:null}if(n.startsWith("//")){const e=n.match(/^\/\/[^\s]*/);return e?e[0]:null}if(n.startsWith("./")||n.startsWith("../")){const e=n.match(/^\.\.?\/[^\s]*/);return e?e[0]:null}if(n.startsWith("/")){const e=n.match(/^\/[^\s]*/);return e?e[0]:null}return null}(e,t);return n?{value:n,length:n.length,metadata:{type:"url"}}:null}}}}),pd=vp({"src/tokenizers/extractors/variable-ref.ts"(){ed=class{constructor(){this.name="variable-ref"}canExtract(e,t){return":"===e[t]&&e.length>t+1&&/[a-zA-Z_]/.test(e[t+1])}extract(e,t){if(!this.canExtract(e,t))return null;let n=1;for(;e.length>t+n&&/[a-zA-Z0-9_]/.test(e[t+n]);)n++;return{value:e.substring(t,t+n),length:n,metadata:{type:"variable-reference"}}}}}});function md(e){return function(e){const t=e.charCodeAt(0);return t>=12352&&12447>=t}(e)||function(e){const t=e.charCodeAt(0);return t>=12448&&12543>=t}(e)||function(e){const t=e.charCodeAt(0);return t>=19968&&40879>=t||t>=13312&&19903>=t}(e)}var dd,fd,yd,hd,vd,gd=vp({"src/tokenizers/extractors/japanese-keyword.ts"(){td=class{constructor(){this.name="japanese-keyword"}setContext(e){this.context=e}canExtract(e,t){return md(e[t])}extract(e,t){if(!this.context)throw Error("JapaneseKeywordExtractor: context not set");const n=t;this.context.isKeywordStart(e,t);let r="",i=t;for(;e.length>i&&md(e[i]);)r+=e[i],i++;let a=r,o=r.length;for(let e=r.length;e>0;e--){const t=r.substring(0,e);if(this.context.lookupKeyword(t)){a=t,o=e;break}}if(r=a,i=t+o,!r)return null;const s=this.context.lookupKeyword(r),l=s&&s.normalized!==s.native?s.normalized:void 0;let c;if(!s&&this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(c=t.normalized)}}return{value:r,length:i-n,metadata:{normalized:l||c}}}}}}),bd=vp({"src/tokenizers/extractors/japanese-particle.ts"(){dd=new Map([["を",{role:"patient",confidence:.95}],["に",{role:"destination",confidence:.85}],["が",{role:"subject",confidence:.9}],["の",{role:"possessive",confidence:.9}],["と",{role:"conjunction",confidence:.8}],["で",{role:"instrument",confidence:.85}],["へ",{role:"direction",confidence:.85}],["や",{role:"listing",confidence:.8}],["か",{role:"question",confidence:.85}],["も",{role:"also",confidence:.85}],["は",{role:"topic",confidence:.9}]]),fd=new Map([["から",{role:"source",confidence:.95}],["まで",{role:"until",confidence:.95}],["より",{role:"comparison",confidence:.9}],["として",{role:"as",confidence:.9}],["について",{role:"about",confidence:.9}],["によって",{role:"by-means",confidence:.9}],["にて",{role:"at-location",confidence:.85}]]),yd=class{constructor(){this.name="japanese-particle"}setContext(e){this.u=e}canExtract(e,t){if(dd.has(e[t]))return 1;for(const[n]of fd)if(e.startsWith(n,t))return 1;return 0}extract(e,t){for(const[n,r]of fd)if(e.startsWith(n,t))return{value:n,length:n.length,metadata:{role:r.role,confidence:r.confidence,variant:n}};const n=e[t],r=dd.get(n);return r?{value:n,length:1,metadata:{role:r.role,confidence:r.confidence,variant:n}}:null}}}});function wd(e){return function(e){const t=e.charCodeAt(0);return t>=44032&&55203>=t}(e)||function(e){const t=e.charCodeAt(0);return t>=4352&&4607>=t||t>=12592&&12687>=t}(e)}var kd,zd,xd,Ed,Sd=vp({"src/tokenizers/extractors/korean-keyword.ts"(){hd=["할때","하면","하니까","할 때"],vd=class{constructor(){this.name="korean-keyword"}setContext(e){this.context=e}canExtract(e,t){return wd(e[t])}extract(e,t){if(!this.context)throw Error("KoreanKeywordExtractor: context not set");const n=t;for(let t=Math.min(6,e.length-n);t>=2;t--){const r=e.slice(n,n+t);let i=1;for(let e=0;r.length>e;e++)if(!wd(r[e])){i=0;break}if(!i)continue;const a=this.context.lookupKeyword(r);if(a)return{value:r,length:t,metadata:{normalized:a.normalized!==a.native?a.normalized:void 0}};if(this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const n=this.context.lookupKeyword(e.stem);if(n)return{value:r,length:t,metadata:{normalized:n.normalized,stem:e.stem,stemConfidence:e.confidence}}}}}let r="",i=t;for(;e.length>i&&wd(e[i])&&(0>=r.length||!this.context.isKeywordStart(e,i));)r+=e[i],i++;if(!r)return null;for(const e of hd)if(r.endsWith(e)&&r.length>e.length){const t=r.slice(0,-e.length),n=this.context.lookupKeyword(t);if(n)return{value:t,length:t.length,metadata:{normalized:n.normalized,hasSuffix:1,suffix:e,stem:t}}}const a=this.context.lookupKeyword(r),o=a&&a.normalized!==a.native?a.normalized:void 0;let s,l,c;if(r.includes("토글")&&(console.log(`[KO DEBUG] word="${r}"`),console.log("[KO DEBUG] keywordEntry="+(a?"FOUND":"NOT FOUND")),console.log("[KO DEBUG] normalizer="+(this.context.normalizer?"EXISTS":"MISSING"))),!a&&this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(s=t.normalized,l=e.stem,c=e.confidence,r.includes("토글")&&console.log(`[KO DEBUG] word="${r}", stem="${e.stem}", normalized="${s}"`))}}return{value:r,length:i-n,metadata:{normalized:o||s,stem:l,stemConfidence:c}}}}}}),Td=vp({"src/tokenizers/extractors/korean-particle.ts"(){kd=new Map([["이",{role:"agent",confidence:.85,variant:"consonant",description:"subject marker (after consonant)"}],["가",{role:"agent",confidence:.85,variant:"vowel",description:"subject marker (after vowel)"}],["을",{role:"patient",confidence:.95,variant:"consonant",description:"object marker (after consonant)"}],["를",{role:"patient",confidence:.95,variant:"vowel",description:"object marker (after vowel)"}],["은",{role:"agent",confidence:.75,variant:"consonant",description:"topic marker (after consonant)"}],["는",{role:"agent",confidence:.75,variant:"vowel",description:"topic marker (after vowel)"}],["에",{role:"destination",confidence:.85,description:"at/to marker"}],["로",{role:"destination",confidence:.85,variant:"vowel",description:"to/by means (after vowel or ㄹ)"}],["와",{role:"style",confidence:.7,variant:"vowel",description:"and/with (after vowel)"}],["과",{role:"style",confidence:.7,variant:"consonant",description:"and/with (after consonant)"}],["의",{role:"patient",confidence:.6,description:"possessive marker"}],["도",{role:"patient",confidence:.65,description:"also/too marker"}],["만",{role:"patient",confidence:.65,description:"only marker"}]]),zd=new Map([["에서",{role:"source",confidence:.8,description:"at/from marker (action location)"}],["으로",{role:"destination",confidence:.85,variant:"consonant",description:"to/by means (after consonant)"}],["부터",{role:"source",confidence:.9,description:"from/since marker"}],["까지",{role:"destination",confidence:.75,description:"until/to marker"}],["처럼",{role:"manner",confidence:.8,description:"like/as marker"}],["보다",{role:"source",confidence:.75,description:"than marker"}]]),xd=class{constructor(){this.name="korean-particle"}setContext(e){this.u=e}canExtract(e,t){if(kd.has(e[t]))return 1;for(const[n]of zd)if(e.startsWith(n,t))return 1;return 0}extract(e,t){for(const[n,r]of zd)if(e.startsWith(n,t))return{value:n,length:n.length,metadata:{particleRole:r.role,particleConfidence:r.confidence,particleVariant:r.variant}};const n=e[t],r=kd.get(n);return r?{value:n,length:1,metadata:{particleRole:r.role,particleConfidence:r.confidence,particleVariant:r.variant}}:null}}}});function jd(e){const t=e.charCodeAt(0);return t>=19968&&40959>=t||t>=13312&&19903>=t||t>=63744&&64255>=t||t>=131072&&173791>=t||t>=173824&&177983>=t||t>=177984&&178207>=t||t>=178208&&183983>=t||t>=183984&&191471>=t||t>=194560&&195103>=t}var Ad,Ld,Od,Cd,Nd,Pd,Rd,$d,Id,Md,qd,_d,Dd,Vd,Hd,Fd,Bd,Ud,Gd,Wd,Kd=vp({"src/tokenizers/extractors/chinese-keyword.ts"(){Ed=class{constructor(){this.name="chinese-keyword"}setContext(e){this.context=e}canExtract(e,t){return jd(e[t])}extract(e,t){if(!this.context)throw Error("ChineseKeywordExtractor: context not set");const n=t;let r=null;if(this.context.isKeywordStart(e,t))for(let n=10;n>=1;n--){const i=e.slice(t,t+n);if([...i].every(e=>jd(e))){const e=this.context.lookupKeyword(i);if(e){r={word:i,entry:e};break}}}if(r)return{value:r.word,length:r.word.length,metadata:{normalized:r.entry.normalized}};let i="",a=t;for(;e.length>a&&jd(e[a])&&(i+=e[a],a++,a>=e.length||!this.context.isKeywordStart(e,a)););return i?{value:i,length:a-n,metadata:{}}:null}}}}),Jd=vp({"src/tokenizers/extractors/chinese-particle.ts"(){Ad=new Map([["把",{role:"patient",confidence:.95,description:"ba-construction object marker"}],["在",{role:"location",confidence:.85,description:"at/in/on location marker"}],["从",{role:"source",confidence:.9,description:"from marker"}],["到",{role:"destination",confidence:.9,description:"to/until marker"}],["向",{role:"destination",confidence:.85,description:"towards marker"}],["给",{role:"destination",confidence:.85,description:"to/for recipient marker"}],["对",{role:"destination",confidence:.8,description:"to/towards marker"}],["用",{role:"instrument",confidence:.85,description:"with/using marker"}],["被",{role:"agent",confidence:.8,description:"by (passive) marker"}],["让",{role:"agent",confidence:.75,description:"let/make causative marker"}],["的",{role:"possessive",confidence:.9,description:"possessive/attributive marker"}],["地",{role:"manner",confidence:.85,description:"adverbial marker"}],["得",{role:"manner",confidence:.8,description:"complement marker"}],["了",{role:"aspect",confidence:.7,description:"completion aspect marker"}],["着",{role:"aspect",confidence:.7,description:"progressive aspect marker"}],["过",{role:"aspect",confidence:.7,description:"experiential aspect marker"}],["吗",{role:"mood",confidence:.75,description:"question particle"}],["呢",{role:"mood",confidence:.7,description:"question/emphasis particle"}],["吧",{role:"mood",confidence:.7,description:"suggestion particle"}]]),Ld=new Map([["然后",{role:"sequence",confidence:.9,description:"then/afterwards"}],["接着",{role:"sequence",confidence:.85,description:"next/following"}],["并且",{role:"conjunction",confidence:.85,description:"and/moreover"}],["或者",{role:"conjunction",confidence:.85,description:"or"}],["如果",{role:"condition",confidence:.9,description:"if"}],["那么",{role:"consequence",confidence:.85,description:"then"}],["否则",{role:"alternative",confidence:.85,description:"otherwise"}]]),Od=class{constructor(){this.name="chinese-particle"}setContext(e){this.u=e}canExtract(e,t){if(Ad.has(e[t]))return 1;for(const[n]of Ld)if(e.startsWith(n,t))return 1;return 0}extract(e,t){for(const[n,r]of Ld)if(e.startsWith(n,t))return{value:n,length:n.length,metadata:{particleRole:r.role,particleConfidence:r.confidence,particleDescription:r.description}};const n=e[t],r=Ad.get(n);return r?{value:n,length:1,metadata:{particleRole:r.role,particleConfidence:r.confidence,particleDescription:r.description}}:null}}}}),Zd=vp({"src/tokenizers/extractors/vietnamese-keyword.ts"(){var e;({isLetter:Cd,isIdentifierChar:Nd}=(e=/[a-zA-ZàáảãạăằắẳẵặâầấẩẫậèéẻẽẹêềếểễệìíỉĩịòóỏõọôồốổỗộơờớởỡợùúủũụưừứửữựỳýỷỹỵđÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÈÉẺẼẸÊỀẾỂỄỆÌÍỈĨỊÒÓỎÕỌÔỒỐỔỖỘƠỜỚỞỠỢÙÚỦŨỤƯỪỨỬỮỰỲÝỶỸỴĐ]/,{isLetter:t=>e.test(t),isIdentifierChar:t=>/[0-9]/.test(t)||e.test(t)})),Pd=new Set(["trong","ngoài","trên","dưới","vào","ra","đến","từ","với","cho","bởi","qua","trước","sau","giữa","bên","theo","về","tới","lên","xuống"]),Rd=class{constructor(){this.name="vietnamese-keyword"}setContext(e){this.context=e}canExtract(e,t){return Cd(e[t])}extract(e,t){if(!this.context)throw Error("VietnameseKeywordExtractor: context not set");const n=this.tryMultiWordPhrase(e,t);if(n)return n;let r=t,i="";for(;e.length>r&&Nd(e[r]);)i+=e[r++];if(!i)return null;const a=i.toLowerCase(),o=Pd.has(a),s=this.context.lookupKeyword(a);return{value:i,length:r-t,metadata:{normalized:s&&s.normalized!==s.native?s.normalized:void 0,isPreposition:o}}}tryMultiWordPhrase(e,t){if(!this.context)return null;const n=["chuyển đổi","bật tắt","hiển thị","gỡ bỏ","loại bỏ","bổ sung","thêm vào đầu","hoán đổi","biến đổi","thiết lập","lấy giá trị","tăng lên","giảm đi","in ra","chuyển tiếp","kích hoạt","tập trung","mất tập trung","nhấp chuột","di chuột","rê chuột","nhập liệu","thay đổi","đi đến","chờ đợi","ổn định","nếu không","không thì","lặp lại","với mỗi","trong khi","tiếp tục","dừng lại","trả về","sau đó","kết thúc","bất đồng bộ","nói với","mặc định","khởi tạo","hành vi","cài đặt","đo lường","sao chép","thoát ra","kết xuất","vào trong","trước khi","sau khi","cho đến khi","sự kiện","kết quả","mục tiêu","của tôi","của nó","của bạn","của anh","của chị","không xác định","đầu tiên","cuối cùng","tiếp theo","trước đó","gần nhất","nhấp đúp","gửi biểu mẫu","phím xuống","phím lên","chuột vào","chuột ra","tải trang","mili giây","thêm vào cuối","nhân bản","tạo ra","đặt giá trị","ghi nhật ký","chuyển tới","ngược lại"];for(const r of n)if(e.slice(t,t+r.length).toLowerCase()===r.toLowerCase()){const n=t+r.length;if(n>=e.length||!/[a-zA-Zàáảãạăằắẳẵặâầấẩẫậèéẻẽẹêềếểễệìíỉĩịòóỏõọôồốổỗộơờớởỡợùúủũụưừứửữựỳýỷỹỵđ]/.test(e[n])){const i=this.context.lookupKeyword(r);return{value:e.slice(t,n),length:r.length,metadata:{normalized:i?.normalized,isPreposition:0}}}}return null}}}}),Yd=vp({"src/tokenizers/extractors/arabic-keyword.ts"(){od(),$d=ep([[1536,1791],[1872,1919],[2208,2303],[64336,65023],[65136,65279]]),Id=new Set(["في","على","من","إلى","الى","مع","عن","قبل","بعد","بين"]),Md=class{constructor(){this.name="arabic-keyword"}setContext(e){this.context=e}canExtract(e,t){return $d(e[t])}extract(e,t){if(!this.context)throw Error("ArabicKeywordExtractor: context not set");const n=t;this.context.isKeywordStart(e,t);let r="",i=t;for(;e.length>i&&($d(e[i])||"ـ"===e[i]);)r+=e[i],i++;if(!r)return null;const a=this.context.lookupKeyword(r),o=a&&a.normalized!==a.native?a.normalized:void 0;if(Id.has(r))return{value:r,length:i-n,metadata:{prepositionValue:r,normalized:o}};let s,l,c;if(!a&&this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(s=t.normalized,l=e.stem,c=e.confidence)}}return{value:r,length:i-n,metadata:{normalized:o||s,stem:l,stemConfidence:c}}}}}}),Xd=vp({"src/tokenizers/extractors/arabic-proclitic.ts"(){od(),qd=ep([[1536,1791],[1872,1919],[2208,2303],[64336,65023],[65136,65279]]),_d=new Map([["و",{normalized:"and",type:"conjunction"}],["ف",{normalized:"then",type:"conjunction"}],["ب",{normalized:"with",type:"preposition"}],["ل",{normalized:"to",type:"preposition"}],["ك",{normalized:"like",type:"preposition"}],["ول",{normalized:"and-to",type:"conjunction"}],["وب",{normalized:"and-with",type:"conjunction"}],["وك",{normalized:"and-like",type:"conjunction"}],["فل",{normalized:"then-to",type:"conjunction"}],["فب",{normalized:"then-with",type:"conjunction"}],["فك",{normalized:"then-like",type:"conjunction"}]]),Dd=class{constructor(){this.name="arabic-proclitic"}setContext(e){this.context=e}canExtract(e,t){return _d.has(e[t])||e.length>t+1&&_d.has(e.slice(t,t+2))}extract(e,t){if(!this.context)throw Error("ArabicProcliticExtractor: context not set");let n=t;for(;e.length>n&&(qd(e[n])||"ـ"===e[n]);)n++;const r=e.slice(t,n);if(this.context.isKeyword(r))return null;if(e.length>=t+2){const r=e.slice(t,t+2),i=_d.get(r);if(i){const a=t+2;if(e.length>a&&qd(e[a])){let o=0,s=a;for(;e.length>s&&qd(e[s]);)o++,s++;if(o>=2){if(!_d.get(e[t]))return{value:r,length:2,metadata:{procliticType:i.type,normalized:i.normalized}};{const a=e.slice(t+1,n);if(!this.context.isKeyword(a))return{value:r,length:2,metadata:{procliticType:i.type,normalized:i.normalized}}}}}}}const i=e[t],a=_d.get(i);if(!a)return null;const o=t+1;if(o>=e.length||!qd(e[o]))return null;let s=0,l=o;for(;e.length>l&&qd(e[l]);)s++,l++;return 2>s?null:{value:i,length:1,metadata:{procliticType:a.type,normalized:a.normalized}}}}}}),Qd=vp({"src/tokenizers/extractors/arabic-temporal.ts"(){od(),Vd=ep([[1536,1791],[1872,1919],[2208,2303],[64336,65023],[65136,65279]]),Hd=new Map([["عندما",{normalized:"on",formality:"formal",confidence:.95,description:"when (formal MSA)"}],["حينما",{normalized:"on",formality:"formal",confidence:.93,description:"when/whenever (formal)"}],["عند",{normalized:"on",formality:"neutral",confidence:.88,description:"at/when (neutral)"}],["حين",{normalized:"on",formality:"neutral",confidence:.85,description:"when/time (neutral)"}],["لمّا",{normalized:"on",formality:"dialectal",confidence:.7,description:"when (dialectal, with shadda)"}],["لما",{normalized:"on",formality:"dialectal",confidence:.68,description:"when (dialectal, no diacritic)"}],["لدى",{normalized:"on",formality:"neutral",confidence:.82,description:"at/with (temporal)"}]]),Fd=class{constructor(){this.name="arabic-temporal"}setContext(e){this.u=e}canExtract(e,t){for(const[n]of Hd)if(e.startsWith(n,t))return 1;return 0}extract(e,t){const n=Array.from(Hd.entries()).sort(([e],[t])=>t.length-e.length);for(const[r,i]of n)if(e.startsWith(r,t)){const n=t+r.length;if(n>=e.length||/\s/.test(e[n])||!Vd(e[n]))return{value:r,length:r.length,metadata:{temporalFormality:i.formality,temporalConfidence:i.confidence,normalized:i.normalized,description:i.description}}}return null}}}}),ef=vp({"src/tokenizers/extractors/cyrillic-keyword.ts"(){Bd=class{constructor(e,t,n){this.name=e;const r=(i=t,{isLetter:e=>i.test(e),isIdentifierChar:e=>/[0-9]/.test(e)||i.test(e)});var i;this.isLetter=r.isLetter,this.isIdentifierChar=r.isIdentifierChar,this.prepositions=n}setContext(e){this.context=e}canExtract(e,t){return this.isLetter(e[t])}extract(e,t){if(!this.context)throw Error(this.name+": context not set");let n=t,r="";for(;e.length>n&&this.isIdentifierChar(e[n]);)r+=e[n++];if(!r)return null;const i=r.toLowerCase(),a=this.prepositions.has(i),o=this.context.lookupKeyword(i),s=o&&o.normalized!==o.native?o.normalized:void 0;let l;if(!o&&this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:r,length:n-t,metadata:{normalized:s||l,isPreposition:a}}}},Ud=new Set(["в","во","на","с","со","к","ко","о","об","обо","у","от","до","из","за","по","под","над","перед","передо","между","через","без","для","при","про","после","вокруг","против","вместо","кроме","среди"]),Gd=new Set(["в","у","на","з","із","зі","до","від","о","об","при","для","під","над","перед","між","через","без","по","за","про","після","навколо","проти","замість","крім","серед","к"])}});function tf(e){const t=e.charCodeAt(0);return t>=2304&&2431>=t||t>=43232&&43263>=t}var nf,rf,af,of,sf=vp({"src/tokenizers/extractors/hindi-keyword.ts"(){Wd=class{constructor(){this.name="hindi-keyword"}setContext(e){this.context=e}canExtract(e,t){return tf(e[t])}extract(e,t){if(!this.context)throw Error("HindiKeywordExtractor: context not set");const n=t;let r="",i=t;for(;e.length>i&&(tf(e[i])||" "===e[i]);){if(" "===e[i]){if(e.length>i+1&&tf(e[i+1])){const t=e.slice(i),n=[" के लिए"," के साथ"," के बाद"," से पहले"," नहीं तो"," जब तक"," के बारे में"].find(e=>t.startsWith(e));if(n){r+=n,i+=n.length;continue}}break}r+=e[i],i++}if(!r)return null;const a=this.context.lookupKeyword(r),o=a&&a.normalized!==a.native?a.normalized:void 0;let s;if(!a&&this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(s=t.normalized)}}return{value:r,length:i-n,metadata:{normalized:o||s}}}}}}),lf=vp({"src/tokenizers/extractors/hindi-particle.ts"(){nf=new Map([["को",{role:"patient",confidence:.95}],["में",{role:"destination",confidence:.9}],["पर",{role:"event",confidence:.85}],["से",{role:"source",confidence:.9}],["का",{role:"possessive",confidence:.95}],["की",{role:"possessive",confidence:.95}],["के",{role:"possessive",confidence:.95}],["तक",{role:"until",confidence:.9}],["ने",{role:"agent",confidence:.85}]]),rf=new Map([["के लिए",{role:"purpose",confidence:.95}],["के साथ",{role:"instrument",confidence:.95}],["के बाद",{role:"temporal-after",confidence:.9}],["से पहले",{role:"temporal-before",confidence:.9}],["नहीं तो",{role:"conditional",confidence:.85}],["जब तक",{role:"temporal-until",confidence:.9}],["के बारे में",{role:"about",confidence:.9}]]),af=class{constructor(){this.name="hindi-particle"}setContext(e){this.u=e}canExtract(e,t){for(const[n]of rf)if(e.startsWith(n,t))return 1;let n="",r=t;for(;e.length>r&&this.isDevanagari(e[r]);)n+=e[r],r++;return nf.has(n)}extract(e,t){for(const[n,r]of rf)if(e.startsWith(n,t))return{value:n,length:n.length,metadata:{role:r.role,confidence:r.confidence,variant:n}};let n="",r=t;for(;e.length>r&&this.isDevanagari(e[r]);)n+=e[r],r++;const i=nf.get(n);return i?{value:n,length:n.length,metadata:{role:i.role,confidence:i.confidence,variant:n}}:null}isDevanagari(e){const t=e.charCodeAt(0);return t>=2304&&2431>=t||t>=43232&&43263>=t}}}});function cf(e){const t=e.charCodeAt(0);return t>=2432&&2559>=t}var uf,pf,mf,df=vp({"src/tokenizers/extractors/bengali-keyword.ts"(){of=class{constructor(){this.name="bengali-keyword"}setContext(e){this.context=e}canExtract(e,t){return cf(e[t])}extract(e,t){if(!this.context)throw Error("BengaliKeywordExtractor: context not set");const n=t;let r="",i=t;for(;e.length>i&&cf(e[i]);)r+=e[i],i++;if(!r)return null;const a=this.context.lookupKeyword(r),o=a&&a.normalized!==a.native?a.normalized:void 0;let s;if(!a&&this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(s=t.normalized)}}return{value:r,length:i-n,metadata:{normalized:o||s}}}}}}),ff=vp({"src/tokenizers/extractors/bengali-particle.ts"(){uf=new Map([["কে",{role:"patient",confidence:.95}],["তে",{role:"destination",confidence:.9}],["এ",{role:"event",confidence:.85}],["থেকে",{role:"source",confidence:.95}],["র",{role:"possessive",confidence:.95}],["এর",{role:"possessive",confidence:.95}],["দিয়ে",{role:"instrument",confidence:.9}],["জন্য",{role:"purpose",confidence:.9}],["পর্যন্ত",{role:"until",confidence:.9}],["মধ্যে",{role:"location",confidence:.85}]]),pf=class{constructor(){this.name="bengali-particle"}setContext(e){this.u=e}canExtract(e,t){let n="",r=t;for(;e.length>r&&this.isBengali(e[r]);)n+=e[r],r++;return uf.has(n)}extract(e,t){let n="",r=t;for(;e.length>r&&this.isBengali(e[r]);)n+=e[r],r++;const i=uf.get(n);return i?{value:n,length:n.length,metadata:{role:i.role,confidence:i.confidence,variant:n}}:null}isBengali(e){const t=e.charCodeAt(0);return t>=2432&&2559>=t}}}});function yf(e){const t=e.charCodeAt(0);return t>=3584&&3711>=t}function hf(e){return/[a-zA-Z0-9_]/.test(e)}var vf,gf=vp({"src/tokenizers/extractors/thai-keyword.ts"(){mf=class{constructor(){this.name="thai-keyword"}setContext(e){this.context=e}canExtract(e,t){return yf(e[t])||hf(e[t])}extract(e,t){if(!this.context)throw Error("ThaiKeywordExtractor: context not set");const n=e[t];return yf(n)?this.extractThaiWord(e,t):hf(n)?this.extractAsciiWord(e,t):null}extractThaiWord(e,t){if(!this.context)return null;let n=null,r=t,i="";for(;e.length>r&&yf(e[r]);){i+=e[r],r++;const t=this.context.lookupKeyword(i);t&&(n={word:i,entry:t})}if(n)return{value:n.word,length:n.word.length,metadata:{normalized:n.entry.normalized!==n.entry.native?n.entry.normalized:void 0}};let a=t,o="";for(;e.length>a&&yf(e[a])&&(0>=o.length||!this.isKeywordStart(e,a));)o+=e[a],a++;return o?{value:o,length:o.length,metadata:{}}:null}extractAsciiWord(e,t){if(!this.context)return null;let n=t,r="";for(;e.length>n&&hf(e[n]);)r+=e[n++];if(!r)return null;const i=r.toLowerCase(),a=this.context.lookupKeyword(i);return{value:r,length:r.length,metadata:{normalized:a&&a.normalized!==a.native?a.normalized:void 0}}}isKeywordStart(e,t){if(!this.context)return 0;let n=t,r="";for(;e.length>n&&yf(e[n]);){if(r+=e[n],n++,this.context.lookupKeyword(r))return 1;if(r.length>10)break}return 0}}}});function bf(e){return/[a-zA-Z0-9_]/.test(e)}var wf,kf,zf=vp({"src/tokenizers/extractors/malay-keyword.ts"(){vf=class{constructor(){this.name="malay-keyword"}setContext(e){this.context=e}canExtract(e,t){return/[a-zA-Z_]/.test(e[t])}extract(e,t){if(!this.context)throw Error("MalayKeywordExtractor: context not set");let n=t,r="";for(;e.length>n&&bf(e[n]);)r+=e[n++];if(!r)return null;const i=r.toLowerCase(),a=this.context.lookupKeyword(i);return{value:r,length:r.length,metadata:{normalized:a&&a.normalized!==a.native?a.normalized:void 0}}}}}});function xf(e){return/[a-zA-Z0-9_]/.test(e)}var Ef,Sf,Tf,jf,Af,Lf,Of,Cf,Nf,Pf,Rf,$f,If,Mf,qf,_f=vp({"src/tokenizers/extractors/tagalog-keyword.ts"(){wf=new Set(["sa","ng","para","mula","hanggang","gaya","tulad","kasama","para sa"]),kf=class{constructor(){this.name="tagalog-keyword"}setContext(e){this.context=e}canExtract(e,t){return/[a-zA-Z_]/.test(e[t])}extract(e,t){if(!this.context)throw Error("TagalogKeywordExtractor: context not set");let n=t,r="";for(;e.length>n&&xf(e[n]);)r+=e[n++];if(!r)return null;const i=r.toLowerCase(),a=wf.has(i),o=this.context.lookupKeyword(i),s=o&&o.normalized!==o.native?o.normalized:void 0;let l;if(!o&&this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:r,length:r.length,metadata:{normalized:s||l,isPreposition:a}}}}}}),Df=vp({"src/tokenizers/extractors/polish-keyword.ts"(){Ef=new Set(["do","od","z","ze","w","we","na","po","pod","przed","za","nad","między","miedzy","przez","dla","bez","o","przy","u","według","wedlug","mimo","wśród","wsrod","obok","poza","wokół","wokol","przeciw","ku"]),({isLetter:Sf,isIdentifierChar:Tf}=function(){const e=/[a-zA-ZąęćńóśźżłĄĘĆŃÓŚŹŻŁ]/;return{isLetter:t=>e.test(t),isIdentifierChar:t=>/[0-9]/.test(t)||e.test(t)}}()),jf=class{constructor(){this.name="polish-keyword"}setContext(e){this.context=e}canExtract(e,t){return Sf(e[t])}extract(e,t){if(!this.context)throw Error("PolishKeywordExtractor: context not set");let n=t,r="";for(;e.length>n&&Tf(e[n]);)r+=e[n++];if(!r)return null;const i=r.toLowerCase(),a=Ef.has(i),o=this.context.lookupKeyword(i),s=o&&o.normalized!==o.native?o.normalized:void 0;let l;if(!o&&this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:r,length:n-t,metadata:{normalized:s||l,isPreposition:a}}}}}}),Vf=vp({"src/tokenizers/extractors/indonesian-keyword.ts"(){Af=new Set(["di","ke","dari","pada","dengan","tanpa","untuk","oleh","antara","sebelum","sesudah","setelah","selama","sampai","hingga","sejak","menuju","tentang","terhadap","melalui","dalam","luar"]),({isLetter:Lf,isIdentifierChar:Of}=function(){const e=/[a-zA-Z]/;return{isLetter:t=>e.test(t),isIdentifierChar:t=>/[0-9]/.test(t)||e.test(t)}}()),Cf=class{constructor(){this.name="indonesian-keyword"}setContext(e){this.context=e}canExtract(e,t){return Lf(e[t])}extract(e,t){if(!this.context)throw Error("IndonesianKeywordExtractor: context not set");let n=t,r="";for(;e.length>n&&Of(e[n]);)r+=e[n++];if(!r)return null;const i=r.toLowerCase(),a=Af.has(i),o=this.context.lookupKeyword(i),s=o&&o.normalized!==o.native?o.normalized:void 0;let l;if(!o&&this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:r,length:n-t,metadata:{normalized:s||l,isPreposition:a}}}}}}),Hf=vp({"src/tokenizers/extractors/swahili-keyword.ts"(){Nf=new Set(["kwa","na","katika","kwenye","kutoka","hadi","mpaka","kabla","baada","wakati","bila","kuhusu","karibu","mbele","nyuma","ndani","nje","juu","chini","kati"]),({isLetter:Pf,isIdentifierChar:Rf}=function(){const e=/[a-zA-Z]/;return{isLetter:t=>e.test(t),isIdentifierChar:t=>/[0-9]/.test(t)||e.test(t)}}()),$f=class{constructor(){this.name="swahili-keyword"}setContext(e){this.context=e}canExtract(e,t){return Pf(e[t])}extract(e,t){if(!this.context)throw Error("SwahiliKeywordExtractor: context not set");let n=t,r="";for(;e.length>n&&Rf(e[n]);)r+=e[n++];if(!r)return null;const i=r.toLowerCase(),a=Nf.has(i),o=this.context.lookupKeyword(i),s=o&&o.normalized!==o.native?o.normalized:void 0;let l;if(!o&&this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:r,length:n-t,metadata:{normalized:s||l,isPreposition:a}}}}}});function Ff(e){const t=e.charCodeAt(0);return t>=65&&90>=t||t>=97&&122>=t?1:"çÇğĞıİöÖşŞüÜ".includes(e)}var Bf,Uf,Gf,Wf=vp({"src/tokenizers/extractors/turkish-keyword.ts"(){If=new Set(["ile","için","kadar","gibi","önce","üzerinde","altında","içinde","dışında","arasında","karşı","göre","rağmen","doğru","boyunca"]),Mf=new Set(["de","da","te","ta","den","dan","ten","tan","e","a","ye","ya","i","ı","u","ü","in","ın","un","ün","le","la","yle","yla"]),qf=class{constructor(){this.name="turkish-keyword"}setContext(e){this.context=e}canExtract(e,t){return Ff(e[t])}extract(e,t){if(!this.context)throw Error("TurkishKeywordExtractor: context not set");const n=t;for(let t=Math.min(12,e.length-n);t>=2;t--){const r=e.slice(n,n+t);let i=1;for(let e=0;r.length>e;e++)if(!Ff(r[e])){i=0;break}if(!i)continue;const a=this.context.lookupKeyword(r);if(a)return{value:r,length:t,metadata:{normalized:a.normalized!==a.native?a.normalized:void 0}};if(this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const n=this.context.lookupKeyword(e.stem);if(n)return{value:r,length:t,metadata:{normalized:n.normalized,stem:e.stem,stemConfidence:e.confidence}}}}}let r="",i=t;for(;e.length>i&&Ff(e[i]);)r+=e[i],i++;for(let e=r.length;e>=2;e--){const t=r.substring(0,e),n=this.context.lookupKeyword(t);if(n)return{value:t,length:e,metadata:{normalized:n.normalized!==n.native?n.normalized:void 0}}}if(!r)return null;if(!r)return null;if(If.has(r.toLowerCase()))return{value:r,length:i-n,metadata:{postpositionValue:r.toLowerCase()}};if(Mf.has(r.toLowerCase()))return{value:r,length:i-n,metadata:{caseSuffixValue:r.toLowerCase()}};const a=this.context.lookupKeyword(r),o=a&&a.normalized!==a.native?a.normalized:void 0;let s,l,c;if(!a&&this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(s=t.normalized,l=e.stem,c=e.confidence)}}return{value:r,length:i-n,metadata:{normalized:o||s,stem:l,stemConfidence:c}}}}}});function Kf(e){const t=e.charCodeAt(0);return t>=65&&90>=t||t>=97&&122>=t?1:"ñ"===e||"Ñ"===e||"'"===e||"’"===e}var Jf,Zf,Yf,Xf,Qf,ey,ty,ny,ry,iy,ay=vp({"src/tokenizers/extractors/quechua-keyword.ts"(){Bf=new Set(["-ta","-man","-manta","-pi","-wan","-paq","-kama","-rayku","-hina","ta","man","manta","pi","wan","paq","kama","hina","pa"]),Uf=new Set(["kama","hina","rayku","paq"]),Gf=class{constructor(){this.name="quechua-keyword"}setContext(e){this.context=e}canExtract(e,t){return Kf(e[t])}extract(e,t){if(!this.context)throw Error("QuechuaKeywordExtractor: context not set");const n=t;for(let t=Math.min(12,e.length-n);t>=2;t--){const r=e.slice(n,n+t);let i=1;for(let e=0;r.length>e;e++)if(!Kf(r[e])){i=0;break}if(!i)continue;const a=this.context.lookupKeyword(r);if(a)return{value:r,length:t,metadata:{normalized:a.normalized!==a.native?a.normalized:void 0}};if(this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const n=this.context.lookupKeyword(e.stem);if(n)return{value:r,length:t,metadata:{normalized:n.normalized}}}}}let r="",i=t;for(;e.length>i&&Kf(e[i])&&(0>=r.length||!this.context.isKeywordStart(e,i));)r+=e[i],i++;if(!r)return null;if(Bf.has(r.toLowerCase()))return{value:r,length:i-n,metadata:{suffixValue:r.toLowerCase()}};if(Uf.has(r.toLowerCase()))return{value:r,length:i-n,metadata:{postpositionValue:r.toLowerCase()}};const a=this.context.lookupKeyword(r),o=a&&a.normalized!==a.native?a.normalized:void 0;let s;if(!a&&this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(s=t.normalized)}}return{value:r,length:i-n,metadata:{normalized:o||s}}}}}}),oy=vp({"src/tokenizers/extractors/hebrew-keyword.ts"(){od(),Jf=ep([[1424,1535],[64285,64335]]),Zf=new Set(["על","את","אל","מן","עם","בתוך","מתוך","ליד","אחרי","לפני","בין","עד","של"]),Yf=new Set(["ו"]),Xf=class{constructor(){this.name="hebrew-keyword"}setContext(e){this.context=e}canExtract(e,t){return Jf(e[t])}extract(e,t){if(!this.context)throw Error("HebrewKeywordExtractor: context not set");const n=t;this.context.isKeywordStart(e,t);let r="",i=t;for(;e.length>i&&Jf(e[i]);)r+=e[i],i++;if(!r)return null;const a=this.context.lookupKeyword(r),o=a&&a.normalized!==a.native?a.normalized:void 0;if(Zf.has(r))return{value:r,length:i-n,metadata:{prepositionValue:r,normalized:o}};if(Yf.has(r))return{value:r,length:i-n,metadata:{conjunctionValue:r,normalized:o}};let s;if(!a&&this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(s=t.normalized)}}return{value:r,length:i-n,metadata:{normalized:o||s}}}}}}),sy=vp({"src/tokenizers/extractors/hebrew-proclitic.ts"(){od(),Qf=ep([[1424,1535],[64285,64335]]),ey=new Map([["ב","on"],["ל","to"],["מ","from"],["כ","as"],["ה","the"],["ו","and"],["ש","that"]]),ty=new Set(["ב","כ"]),ny=new Set(["לחיצה","קליק","שליחה","הגשה","ריחוף","מעבר","שינוי","עדכון","קלט","הזנה","מיקוד","טשטוש","טעינה","גלילה"]),ry=class{constructor(){this.name="hebrew-proclitic"}setContext(e){this.context=e}canExtract(e,t){return ey.has(e[t])&&e.length>t+1&&Qf(e[t+1])}extract(e,t){if(!this.context)throw Error("HebrewProcliticExtractor: context not set");const n=e[t],r=ey.get(n);if(!r)return null;let i=t;for(;e.length>i&&Qf(e[i]);)i++;const a=e.slice(t,i),o=this.context?.lookupKeyword(a);if(o)return null;if(e.length>t+1&&ey.has(e[t+1])){const n=e.slice(t+1,i),r=this.context?.lookupKeyword(n),a=ny.has(n);if(!r&&!a&&3>n.length)return null}const s=e.slice(t+1,i),l=this.context?.lookupKeyword(s),c=ty.has(n),u=ny.has(s);return c&&u?{value:n,length:1,metadata:{normalized:r,procliticType:r,isEventMarker:1}}:1===s.length&&ey.has(s)?null:l||u||s.length>=2?{value:n,length:1,metadata:{normalized:r,procliticType:r,isEventMarker:c&&l}}:null}}}});function ly(e){const t=e.charCodeAt(0);return t>=48&&57>=t||t>=65&&90>=t||t>=97&&122>=t||95===t||36===t}var cy=vp({"src/tokenizers/extractors/ascii-identifier.ts"(){iy=class{constructor(){this.name="ascii-identifier"}setContext(e){this.context=e}canExtract(e,t){return function(e){const t=e.charCodeAt(0);return t>=65&&90>=t||t>=97&&122>=t||95===t||36===t}(e[t])}extract(e,t){if(!this.context)throw Error("AsciiIdentifierExtractor: context not set");const n=t;let r="",i=t;for(;e.length>i&&ly(e[i]);)r+=e[i],i++;if(!r)return null;const a=this.context.lookupKeyword(r);return{value:r,length:i-n,metadata:{normalized:a&&a.normalized!==a.native?a.normalized:void 0}}}}}}),uy=vp({"src/tokenizers/extractors/index.ts"(){ld(),cd(),ud(),pd()}});function py(){return[new Qm,new Xm,new ed,new Ym]}var my,dy=vp({"src/tokenizers/extractor-helpers.ts"(){uy()}});function fy(e){return/[a-zA-Z0-9_]/.test(e)}var yy,hy,vy,gy=vp({"src/tokenizers/extractors/english-keyword.ts"(){my=class{constructor(){this.name="english-keyword"}setContext(e){this.context=e}canExtract(e,t){return/[a-zA-Z_]/.test(e[t])}extract(e,t){if(!this.context)throw Error("EnglishKeywordExtractor: context not set");let n=t,r="";for(;e.length>n&&fy(e[n]);)r+=e[n++];if(!r)return null;if(e.length>n&&":"===e[n]){const t=n;n++;let i="";for(;e.length>n&&fy(e[n]);)i+=e[n++];i?r=r+":"+i:n=t}const i=this.context.lookupKeyword(r),a=i&&i.normalized!==i.native?i.normalized:void 0;let o=null;return this.context.isKeyword(r)||(o=this.tryClassSyntaxConversion(e,n,r)),{value:o||r,length:n-t,metadata:{normalized:a,classConversion:o?1:void 0}}}tryClassSyntaxConversion(e,t,n){let r=t;for(;e.length>r&&/\s/.test(e[r]);)r++;if("class"===e.slice(r,r+5).toLowerCase()){const t=r+5;if(t>=e.length||!fy(e[t]))return"."+n}return null}}}}),by={};gp(by,{EnglishTokenizer:()=>hy,englishTokenizer:()=>vy});var wy,ky,zy,xy=vp({"src/tokenizers/english.ts"(){od(),Fp(),sd(),dy(),gy(),yy=[{native:"true",normalized:"true"},{native:"false",normalized:"false"},{native:"null",normalized:"null"},{native:"undefined",normalized:"undefined"},{native:"first",normalized:"first"},{native:"last",normalized:"last"},{native:"next",normalized:"next"},{native:"previous",normalized:"previous"},{native:"closest",normalized:"closest"},{native:"click",normalized:"click"},{native:"dblclick",normalized:"dblclick"},{native:"mousedown",normalized:"mousedown"},{native:"mouseup",normalized:"mouseup"},{native:"mouseover",normalized:"mouseover"},{native:"mouseout",normalized:"mouseout"},{native:"mouseenter",normalized:"mouseenter"},{native:"mouseleave",normalized:"mouseleave"},{native:"mousemove",normalized:"mousemove"},{native:"keydown",normalized:"keydown"},{native:"keyup",normalized:"keyup"},{native:"keypress",normalized:"keypress"},{native:"input",normalized:"input"},{native:"change",normalized:"change"},{native:"submit",normalized:"submit"},{native:"reset",normalized:"reset"},{native:"load",normalized:"load"},{native:"unload",normalized:"unload"},{native:"scroll",normalized:"scroll"},{native:"resize",normalized:"resize"},{native:"dragstart",normalized:"dragstart"},{native:"drag",normalized:"drag"},{native:"dragend",normalized:"dragend"},{native:"dragenter",normalized:"dragenter"},{native:"dragleave",normalized:"dragleave"},{native:"dragover",normalized:"dragover"},{native:"drop",normalized:"drop"},{native:"touchstart",normalized:"touchstart"},{native:"touchmove",normalized:"touchmove"},{native:"touchend",normalized:"touchend"},{native:"touchcancel",normalized:"touchcancel"},{native:"in",normalized:"in"},{native:"to",normalized:"to"},{native:"at",normalized:"at"},{native:"by",normalized:"by"},{native:"with",normalized:"with"},{native:"without",normalized:"without"},{native:"of",normalized:"of"},{native:"as",normalized:"as"},{native:"every",normalized:"every"},{native:"upon",normalized:"upon"},{native:"unless",normalized:"unless"},{native:"forever",normalized:"forever"},{native:"times",normalized:"times"},{native:"and",normalized:"and"},{native:"or",normalized:"or"},{native:"not",normalized:"not"},{native:"is",normalized:"is"},{native:"exists",normalized:"exists"},{native:"empty",normalized:"empty"},{native:"my",normalized:"my"},{native:"your",normalized:"your"},{native:"its",normalized:"its"},{native:"the",normalized:"the"},{native:"a",normalized:"a"},{native:"an",normalized:"an"},{native:"delete",normalized:"delete"},{native:"innerHTML",normalized:"innerHTML"},{native:"outerHTML",normalized:"outerHTML"},{native:"beforebegin",normalized:"beforebegin"},{native:"afterend",normalized:"afterend"},{native:"beforeend",normalized:"beforeend"},{native:"afterbegin",normalized:"afterbegin"},{native:"flip",normalized:"toggle"},{native:"switch",normalized:"toggle"},{native:"increase",normalized:"increment"},{native:"decrease",normalized:"decrement"},{native:"display",normalized:"show"},{native:"reveal",normalized:"show"},{native:"conceal",normalized:"hide"},{native:"colour",normalized:"color"},{native:"grey",normalized:"gray"},{native:"centre",normalized:"center"},{native:"behaviour",normalized:"behavior"},{native:"initialise",normalized:"initialize"},{native:"favourite",normalized:"favorite"}],vy=new(hy=class extends rp{constructor(){super(),this.language="en",this.direction="ltr",this.initializeKeywordsFromProfile(_p,yy),this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractors([new my]),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){return this.isKeyword(e)?"keyword":e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||e.startsWith("http")?"url":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(e)?"operator":"identifier"}})}}),Ey=vp({"src/tokenizers/morphology/types.ts"(){}});function Sy(e){const t=e.charCodeAt(0);return t>=12352&&12447>=t}function Ty(e){const t=e.charCodeAt(0);return t>=12448&&12543>=t}function jy(e){const t=e.charCodeAt(0);return t>=19968&&40959>=t||t>=13312&&19903>=t}var Ay,Ly,Oy,Cy,Ny=vp({"src/tokenizers/morphology/japanese-normalizer.ts"(){Ey(),wy=[{pattern:"したら",confidence:.88,conjugationType:"conditional-tara",minStemLength:2},{pattern:"すると",confidence:.88,conjugationType:"conditional-to",minStemLength:2},{pattern:"すれば",confidence:.85,conjugationType:"conditional-ba",minStemLength:2},{pattern:"たら",confidence:.85,conjugationType:"conditional-tara",minStemLength:2},{pattern:"れば",confidence:.82,conjugationType:"conditional-ba",minStemLength:2},{pattern:"ていました",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"ています",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"てください",confidence:.85,conjugationType:"request",minStemLength:2},{pattern:"でください",confidence:.85,conjugationType:"request",minStemLength:2},{pattern:"ている",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"ておく",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"てみる",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"てある",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"てくれ",confidence:.8,conjugationType:"casual-request",minStemLength:2},{pattern:"でくれ",confidence:.8,conjugationType:"casual-request",minStemLength:2},{pattern:"ちゃった",confidence:.82,conjugationType:"contracted-past",minStemLength:2},{pattern:"じゃった",confidence:.82,conjugationType:"contracted-past",minStemLength:2},{pattern:"ちゃう",confidence:.82,conjugationType:"contracted",minStemLength:2},{pattern:"じゃう",confidence:.82,conjugationType:"contracted",minStemLength:2},{pattern:"ました",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"ません",confidence:.85,conjugationType:"negative",minStemLength:2},{pattern:"ます",confidence:.85,conjugationType:"polite",minStemLength:2},{pattern:"て",confidence:.85,conjugationType:"te-form",minStemLength:2},{pattern:"た",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"ない",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"なかった",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"られる",confidence:.8,conjugationType:"potential",minStemLength:2},{pattern:"れる",confidence:.78,conjugationType:"potential",minStemLength:2},{pattern:"られた",confidence:.8,conjugationType:"passive",minStemLength:2},{pattern:"させる",confidence:.8,conjugationType:"causative",minStemLength:2},{pattern:"せる",confidence:.78,conjugationType:"causative",minStemLength:2},{pattern:"よう",confidence:.8,conjugationType:"volitional",minStemLength:2},{pattern:"る",confidence:.75,conjugationType:"dictionary",minStemLength:3}],ky=[{pattern:"したら",confidence:.88,conjugationType:"conditional-tara"},{pattern:"すると",confidence:.88,conjugationType:"conditional-to"},{pattern:"すれば",confidence:.85,conjugationType:"conditional-ba"},{pattern:"しています",confidence:.85,conjugationType:"progressive"},{pattern:"している",confidence:.85,conjugationType:"progressive"},{pattern:"しました",confidence:.85,conjugationType:"past"},{pattern:"します",confidence:.85,conjugationType:"polite"},{pattern:"しない",confidence:.82,conjugationType:"negative"},{pattern:"して",confidence:.85,conjugationType:"te-form"},{pattern:"した",confidence:.85,conjugationType:"past"},{pattern:"する",confidence:.88,conjugationType:"dictionary"}],new(zy=class{constructor(){this.language="ja"}isNormalizable(e){return function(e){for(const t of e)if(Sy(t)||Ty(t)||jy(t))return 1;return 0}(e)?2>e.length?0:Sy(e[e.length-1]):0}normalize(e){const t=this.normalizeCompound(e);if(t)return t;const n=this.trySuruNormalization(e);if(n)return n;for(const t of wy)if(e.endsWith(t.pattern)){const n=e.slice(0,-t.pattern.length);if((t.minStemLength??2)>n.length)continue;const r={removedSuffixes:[t.pattern]};return t.conjugationType&&(r.conjugationType=t.conjugationType),ap(n,t.confidence,r)}return ip(e)}trySuruNormalization(e){for(const t of ky)if(e.endsWith(t.pattern)){const n=e.slice(0,-t.pattern.length);if(1>n.length)continue;return ap(n,t.confidence,{removedSuffixes:[t.pattern],conjugationType:t.conjugationType,originalForm:"suru-verb"})}return null}normalizeCompound(e){const t=[{pattern:"ていなかった",suffixes:["て","い","なかった"],confidence:.8,minStemLength:2},{pattern:"でいなかった",suffixes:["で","い","なかった"],confidence:.8,minStemLength:2},{pattern:"ていない",suffixes:["て","い","ない"],confidence:.82,minStemLength:2},{pattern:"でいない",suffixes:["で","い","ない"],confidence:.82,minStemLength:2},{pattern:"ていた",suffixes:["て","い","た"],confidence:.85,minStemLength:2},{pattern:"でいた",suffixes:["で","い","た"],confidence:.85,minStemLength:2}];for(const{pattern:n,suffixes:r,confidence:i,minStemLength:a}of t)if(e.endsWith(n)){const t=e.slice(0,-n.length);if(a>t.length)continue;return ap(t,i,{removedSuffixes:r,conjugationType:"compound"})}return null}})}}),Py={};gp(Py,{JapaneseTokenizer:()=>Oy,japaneseTokenizer:()=>Cy});var Ry,$y,Iy,My=vp({"src/tokenizers/japanese.ts"(){od(),Ny(),um(),sd(),dy(),gd(),bd(),cy(),Ay=new Set(["を","に","で","から","まで","へ","と","の","が","は","も","より"]),Ly=[{native:"真",normalized:"true"},{native:"偽",normalized:"false"},{native:"ヌル",normalized:"null"},{native:"未定義",normalized:"undefined"},{native:"最初",normalized:"first"},{native:"最後",normalized:"last"},{native:"次",normalized:"next"},{native:"前",normalized:"previous"},{native:"最も近い",normalized:"closest"},{native:"親",normalized:"parent"},{native:"クリック",normalized:"click"},{native:"変更",normalized:"change"},{native:"送信",normalized:"submit"},{native:"入力",normalized:"input"},{native:"ロード",normalized:"load"},{native:"スクロール",normalized:"scroll"},{native:"キーダウン",normalized:"keydown"},{native:"キーアップ",normalized:"keyup"},{native:"マウスオーバー",normalized:"mouseover"},{native:"マウスアウト",normalized:"mouseout"},{native:"私",normalized:"me"},{native:"したら",normalized:"on"},{native:"すると",normalized:"on"},{native:"時に",normalized:"on"},{native:"秒",normalized:"s"},{native:"ミリ秒",normalized:"ms"},{native:"分",normalized:"m"},{native:"時間",normalized:"h"}],Cy=new(Oy=class extends rp{constructor(){super(),this.language="ja",this.direction="ltr",this.initializeKeywordsFromProfile(om,Ly),this.normalizer=new zy,this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractor(new iy),this.registerExtractor(new yd),this.registerExtractor(new td),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){return Ay.has(e)?"particle":this.isKeyword(e)?"keyword":e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||e.startsWith("http")?"url":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||e.startsWith("「")||/^\d/.test(e)?"literal":"identifier"}})}});function qy(e){const t=e.charCodeAt(0);return t>=44032&&55203>=t}var _y,Dy,Vy,Hy,Fy=vp({"src/tokenizers/morphology/korean-normalizer.ts"(){Ey(),Ry=[{pattern:"하시니까",confidence:.85,conjugationType:"honorific-causal",minStemLength:1},{pattern:"하실때",confidence:.88,conjugationType:"honorific-temporal",minStemLength:1},{pattern:"하실 때",confidence:.88,conjugationType:"honorific-temporal",minStemLength:1},{pattern:"하시면",confidence:.88,conjugationType:"honorific-conditional",minStemLength:1},{pattern:"으시면",confidence:.85,conjugationType:"honorific-conditional",minStemLength:2},{pattern:"시면",confidence:.82,conjugationType:"honorific-conditional",minStemLength:2},{pattern:"하고나서",confidence:.85,conjugationType:"sequential-after",minStemLength:1},{pattern:"하고 나서",confidence:.85,conjugationType:"sequential-after",minStemLength:1},{pattern:"하고서",confidence:.85,conjugationType:"sequential-after",minStemLength:1},{pattern:"고나서",confidence:.82,conjugationType:"sequential-after",minStemLength:2},{pattern:"고 나서",confidence:.82,conjugationType:"sequential-after",minStemLength:2},{pattern:"고서",confidence:.82,conjugationType:"sequential-after",minStemLength:2},{pattern:"하기전에",confidence:.85,conjugationType:"sequential-before",minStemLength:1},{pattern:"하기 전에",confidence:.85,conjugationType:"sequential-before",minStemLength:1},{pattern:"기전에",confidence:.82,conjugationType:"sequential-before",minStemLength:2},{pattern:"기 전에",confidence:.82,conjugationType:"sequential-before",minStemLength:2},{pattern:"하자마자",confidence:.88,conjugationType:"immediate",minStemLength:1},{pattern:"자마자",confidence:.85,conjugationType:"immediate",minStemLength:2},{pattern:"해야해요",confidence:.85,conjugationType:"obligation",minStemLength:1},{pattern:"해야해",confidence:.85,conjugationType:"obligation",minStemLength:1},{pattern:"해야하다",confidence:.85,conjugationType:"obligation",minStemLength:1},{pattern:"어야해요",confidence:.82,conjugationType:"obligation",minStemLength:2},{pattern:"어야해",confidence:.82,conjugationType:"obligation",minStemLength:2},{pattern:"아야해요",confidence:.82,conjugationType:"obligation",minStemLength:2},{pattern:"아야해",confidence:.82,conjugationType:"obligation",minStemLength:2},{pattern:"하니까",confidence:.85,conjugationType:"causal-nikka",minStemLength:1},{pattern:"할때",confidence:.88,conjugationType:"temporal-ttae",minStemLength:1},{pattern:"할 때",confidence:.88,conjugationType:"temporal-ttae",minStemLength:1},{pattern:"을때",confidence:.85,conjugationType:"temporal-ttae",minStemLength:2},{pattern:"을 때",confidence:.85,conjugationType:"temporal-ttae",minStemLength:2},{pattern:"하면",confidence:.88,conjugationType:"conditional-myeon",minStemLength:1},{pattern:"으면",confidence:.85,conjugationType:"conditional-myeon",minStemLength:2},{pattern:"니까",confidence:.82,conjugationType:"causal-nikka",minStemLength:2},{pattern:"면",confidence:.8,conjugationType:"conditional-myeon",minStemLength:2},{pattern:"하였습니다",confidence:.85,conjugationType:"past",minStemLength:1},{pattern:"했습니다",confidence:.85,conjugationType:"past",minStemLength:1},{pattern:"합니다",confidence:.85,conjugationType:"polite",minStemLength:1},{pattern:"습니다",confidence:.82,conjugationType:"polite",minStemLength:2},{pattern:"됩니다",confidence:.82,conjugationType:"polite",minStemLength:1},{pattern:"ㅂ니다",confidence:.82,conjugationType:"polite",minStemLength:2},{pattern:"하세요",confidence:.85,conjugationType:"honorific",minStemLength:1},{pattern:"하십시오",confidence:.85,conjugationType:"honorific",minStemLength:1},{pattern:"세요",confidence:.82,conjugationType:"honorific",minStemLength:2},{pattern:"십시오",confidence:.82,conjugationType:"honorific",minStemLength:2},{pattern:"하고있어요",confidence:.82,conjugationType:"progressive",minStemLength:1},{pattern:"하고있어",confidence:.82,conjugationType:"progressive",minStemLength:1},{pattern:"했어요",confidence:.85,conjugationType:"past",minStemLength:1},{pattern:"해요",confidence:.85,conjugationType:"polite",minStemLength:1},{pattern:"어요",confidence:.82,conjugationType:"polite",minStemLength:2},{pattern:"아요",confidence:.82,conjugationType:"polite",minStemLength:2},{pattern:"했어",confidence:.85,conjugationType:"past",minStemLength:1},{pattern:"해",confidence:.8,conjugationType:"present",minStemLength:1},{pattern:"었어",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"았어",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"하고있다",confidence:.82,conjugationType:"progressive",minStemLength:1},{pattern:"고있다",confidence:.8,conjugationType:"progressive",minStemLength:2},{pattern:"고있어",confidence:.8,conjugationType:"progressive",minStemLength:2},{pattern:"하다",confidence:.88,conjugationType:"dictionary",minStemLength:1},{pattern:"하지않다",confidence:.82,conjugationType:"negative",minStemLength:1},{pattern:"안하다",confidence:.82,conjugationType:"negative",minStemLength:1},{pattern:"지않다",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"해라",confidence:.82,conjugationType:"imperative",minStemLength:1},{pattern:"하라",confidence:.82,conjugationType:"imperative",minStemLength:1},{pattern:"다",confidence:.75,conjugationType:"dictionary",minStemLength:2}],$y=[{pattern:"하시니까",confidence:.88,conjugationType:"honorific-causal"},{pattern:"하실때",confidence:.88,conjugationType:"honorific-temporal"},{pattern:"하실 때",confidence:.88,conjugationType:"honorific-temporal"},{pattern:"하시면",confidence:.88,conjugationType:"honorific-conditional"},{pattern:"하셨어요",confidence:.85,conjugationType:"honorific-past"},{pattern:"하셨어",confidence:.85,conjugationType:"honorific-past"},{pattern:"하십니다",confidence:.85,conjugationType:"honorific-polite"},{pattern:"하고나서",confidence:.88,conjugationType:"sequential-after"},{pattern:"하고 나서",confidence:.88,conjugationType:"sequential-after"},{pattern:"하고서",confidence:.88,conjugationType:"sequential-after"},{pattern:"하기전에",confidence:.88,conjugationType:"sequential-before"},{pattern:"하기 전에",confidence:.88,conjugationType:"sequential-before"},{pattern:"하자마자",confidence:.88,conjugationType:"immediate"},{pattern:"해야해요",confidence:.88,conjugationType:"obligation"},{pattern:"해야해",confidence:.88,conjugationType:"obligation"},{pattern:"해야하다",confidence:.88,conjugationType:"obligation"},{pattern:"하니까",confidence:.88,conjugationType:"causal-nikka"},{pattern:"할때",confidence:.88,conjugationType:"temporal-ttae"},{pattern:"할 때",confidence:.88,conjugationType:"temporal-ttae"},{pattern:"하면",confidence:.88,conjugationType:"conditional-myeon"},{pattern:"하였습니다",confidence:.85,conjugationType:"past"},{pattern:"했습니다",confidence:.85,conjugationType:"past"},{pattern:"합니다",confidence:.85,conjugationType:"polite"},{pattern:"하십시오",confidence:.85,conjugationType:"honorific"},{pattern:"하세요",confidence:.85,conjugationType:"honorific"},{pattern:"했어요",confidence:.85,conjugationType:"past"},{pattern:"해요",confidence:.85,conjugationType:"polite"},{pattern:"했어",confidence:.85,conjugationType:"past"},{pattern:"해",confidence:.8,conjugationType:"present"},{pattern:"하고있어요",confidence:.82,conjugationType:"progressive"},{pattern:"하고있어",confidence:.82,conjugationType:"progressive"},{pattern:"하고있다",confidence:.82,conjugationType:"progressive"},{pattern:"해서",confidence:.82,conjugationType:"connective"},{pattern:"하고",confidence:.8,conjugationType:"connective"},{pattern:"하지않아요",confidence:.82,conjugationType:"negative"},{pattern:"하지않다",confidence:.82,conjugationType:"negative"},{pattern:"안해요",confidence:.82,conjugationType:"negative"},{pattern:"안해",confidence:.82,conjugationType:"negative"},{pattern:"해라",confidence:.82,conjugationType:"imperative"},{pattern:"하라",confidence:.82,conjugationType:"imperative"},{pattern:"하다",confidence:.88,conjugationType:"dictionary"}],new(Iy=class{constructor(){this.language="ko"}isNormalizable(e){return function(e){for(const t of e)if(qy(t))return 1;return 0}(e)?2>e.length?0:1:0}normalize(e){const t=this.normalizeCompound(e);if(t)return t;const n=this.tryHadaNormalization(e);if(n)return n;for(const t of Ry)if(e.endsWith(t.pattern)){const n=e.slice(0,-t.pattern.length);if((t.minStemLength??2)>n.length)continue;const r={removedSuffixes:[t.pattern]};return t.conjugationType&&(r.conjugationType=t.conjugationType),ap(n,t.confidence,r)}return ip(e)}tryHadaNormalization(e){for(const t of $y)if(e.endsWith(t.pattern)){const n=e.slice(0,-t.pattern.length);if(1>n.length)continue;return ap(n,t.confidence,{removedSuffixes:[t.pattern],conjugationType:t.conjugationType,originalForm:"hada-verb"})}return null}normalizeCompound(e){const t=[{pattern:"하고나서였어",suffixes:["하고나서","였어"],confidence:.78,conjugationType:"sequential-after",minStemLength:2},{pattern:"하고나서였다",suffixes:["하고나서","였다"],confidence:.78,conjugationType:"sequential-after",minStemLength:2},{pattern:"하고나서",suffixes:["하고","나서"],confidence:.85,conjugationType:"sequential-after",minStemLength:2},{pattern:"해야했어",suffixes:["해야","했어"],confidence:.8,conjugationType:"obligation",minStemLength:2},{pattern:"해야했다",suffixes:["해야","했다"],confidence:.8,conjugationType:"obligation",minStemLength:2},{pattern:"해야했습니다",suffixes:["해야","했습니다"],confidence:.8,conjugationType:"obligation",minStemLength:2},{pattern:"하시면서",suffixes:["하시","면서"],confidence:.82,conjugationType:"connective",minStemLength:2},{pattern:"하시며",suffixes:["하시","며"],confidence:.82,conjugationType:"connective",minStemLength:2},{pattern:"하고있었어",suffixes:["하고","있었어"],confidence:.8,conjugationType:"progressive",minStemLength:2},{pattern:"하고있었다",suffixes:["하고","있었다"],confidence:.8,conjugationType:"progressive",minStemLength:2}];for(const{pattern:n,suffixes:r,confidence:i,conjugationType:a,minStemLength:o}of t)if(e.endsWith(n)){const t=e.slice(0,-n.length);if(o>t.length)continue;return ap(t,i,{removedSuffixes:r,conjugationType:a})}return null}})}}),By={};gp(By,{KoreanTokenizer:()=>Vy,koreanTokenizer:()=>Hy});var Uy,Gy,Wy,Ky,Jy,Zy=vp({"src/tokenizers/korean.ts"(){od(),Fy(),dm(),sd(),dy(),Sd(),Td(),cy(),_y=new Set(["이","가","을","를","은","는","에","에서","로","으로","와","과","의","도","만","부터","까지","처럼","보다"]),Dy=[{native:"참",normalized:"true"},{native:"거짓",normalized:"false"},{native:"널",normalized:"null"},{native:"미정의",normalized:"undefined"},{native:"첫번째",normalized:"first"},{native:"마지막",normalized:"last"},{native:"다음",normalized:"next"},{native:"이전",normalized:"previous"},{native:"가장가까운",normalized:"closest"},{native:"부모",normalized:"parent"},{native:"클릭",normalized:"click"},{native:"더블클릭",normalized:"dblclick"},{native:"변경",normalized:"change"},{native:"제출",normalized:"submit"},{native:"입력",normalized:"input"},{native:"로드",normalized:"load"},{native:"스크롤",normalized:"scroll"},{native:"키다운",normalized:"keydown"},{native:"키업",normalized:"keyup"},{native:"마우스오버",normalized:"mouseover"},{native:"마우스아웃",normalized:"mouseout"},{native:"내",normalized:"my"},{native:"그것의",normalized:"its"},{native:"그다음",normalized:"then"},{native:"그런후",normalized:"then"},{native:"그러면",normalized:"then"},{native:"그리고",normalized:"and"},{native:"또는",normalized:"or"},{native:"아니",normalized:"not"},{native:"이다",normalized:"is"},{native:"초",normalized:"s"},{native:"밀리초",normalized:"ms"},{native:"분",normalized:"m"},{native:"시간",normalized:"h"}],Hy=new(Vy=class extends rp{constructor(){super(),this.language="ko",this.direction="ltr",this.initializeKeywordsFromProfile(cm,Dy),this.normalizer=new Iy,this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractor(new iy),this.registerExtractor(new xd),this.registerExtractor(new vd),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){return _y.has(e)?"particle":this.isKeyword(e)?"keyword":e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||e.startsWith("http")?"url":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}})}});function Yy(e){const t=e.charCodeAt(0);return t>=1536&&1791>=t||t>=1872&&1919>=t||t>=2208&&2303>=t||t>=64336&&65023>=t||t>=65136&&65279>=t}var Xy,Qy,eh,th,nh,rh=vp({"src/tokenizers/morphology/arabic-normalizer.ts"(){Ey(),Uy=[{pattern:"وال",confidencePenalty:.15,prefixType:"conjunction"},{pattern:"فال",confidencePenalty:.15,prefixType:"conjunction"},{pattern:"بال",confidencePenalty:.15,prefixType:"preposition"},{pattern:"كال",confidencePenalty:.15,prefixType:"preposition"},{pattern:"لل",confidencePenalty:.12,prefixType:"preposition"}],Gy=[{pattern:"ال",confidencePenalty:.08,prefixType:"article",minRemaining:2},{pattern:"و",confidencePenalty:.08,prefixType:"conjunction",minRemaining:3},{pattern:"ف",confidencePenalty:.08,prefixType:"conjunction",minRemaining:3},{pattern:"ب",confidencePenalty:.1,prefixType:"preposition",minRemaining:3},{pattern:"ل",confidencePenalty:.1,prefixType:"preposition",minRemaining:3},{pattern:"ك",confidencePenalty:.1,prefixType:"preposition",minRemaining:3}],Wy=[{pattern:"ي",confidencePenalty:.12,prefixType:"verb-marker",minRemaining:3},{pattern:"ت",confidencePenalty:.12,prefixType:"verb-marker",minRemaining:3},{pattern:"ن",confidencePenalty:.12,prefixType:"verb-marker",minRemaining:3},{pattern:"أ",confidencePenalty:.12,prefixType:"verb-marker",minRemaining:3},{pattern:"ا",confidencePenalty:.12,prefixType:"verb-marker",minRemaining:3}],Ky=[{pattern:"ون",confidencePenalty:.1,type:"masculine-plural"},{pattern:"ين",confidencePenalty:.1,type:"masculine-plural-accusative"},{pattern:"ات",confidencePenalty:.1,type:"feminine-plural"},{pattern:"ان",confidencePenalty:.1,type:"dual-nominative"},{pattern:"ين",confidencePenalty:.1,type:"dual-accusative"},{pattern:"ها",confidencePenalty:.1,type:"pronoun-her"},{pattern:"هم",confidencePenalty:.1,type:"pronoun-them"},{pattern:"هن",confidencePenalty:.1,type:"pronoun-them-f"},{pattern:"نا",confidencePenalty:.1,type:"pronoun-us"},{pattern:"كم",confidencePenalty:.1,type:"pronoun-you-pl"},{pattern:"ك",confidencePenalty:.08,type:"pronoun-you"},{pattern:"ه",confidencePenalty:.08,type:"pronoun-him"},{pattern:"ي",confidencePenalty:.08,type:"pronoun-me"},{pattern:"ة",confidencePenalty:.08,type:"feminine"}],new(Jy=class{constructor(){this.language="ar"}isNormalizable(e){return function(e){for(const t of e)if(Yy(t))return 1;return 0}(e)?2>e.length?0:1:0}normalize(e){let t=function(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}(e),n=1;const r=[],i=[];for(const e of Uy)if(t.startsWith(e.pattern)){const i=t.slice(e.pattern.length);if(i.length>=2){t=i,n-=e.confidencePenalty,r.push(e.pattern);break}}if(0===r.length)for(const e of Gy)if(t.startsWith(e.pattern)){const i=t.slice(e.pattern.length);if(i.length>=(e.minRemaining??2)){t=i,n-=e.confidencePenalty,r.push(e.pattern);break}}if(!(t.endsWith("ات")||t.endsWith("ة")||t.endsWith("ون")||t.endsWith("ين")||t.endsWith("ها")||t.endsWith("هم")||t.endsWith("هن")||t.endsWith("نا")||t.endsWith("كم")||0!==r.length&&"و"!==r[0]&&"ف"!==r[0]))for(const e of Wy)if(t.startsWith(e.pattern)){const i=t.slice(e.pattern.length);if(i.length>=(e.minRemaining??3)){t=i,n-=e.confidencePenalty,r.push(e.pattern);break}}for(const e of Ky)if(t.endsWith(e.pattern)){const r=t.slice(0,-e.pattern.length);2>r.length||(t=r,n-=e.confidencePenalty,i.push(e.pattern))}return n=Math.max(.5,n),0===r.length&&0===i.length?ip(e):ap(t,n,{removedPrefixes:r,removedSuffixes:i})}})}}),ih={};gp(ih,{ArabicTokenizer:()=>th,arabicTokenizer:()=>nh});var ah,oh,sh,lh,ch,uh=vp({"src/tokenizers/arabic.ts"(){od(),rh(),Rp(),sd(),dy(),Yd(),cy(),Xd(),Qd(),Xy=new Set(["ول","وب","وك","فل","فب","فك"]),Qy=new Set(["في","على","من","إلى","الى","مع","عن","قبل","بعد","بين","ب","ل","ك"]),eh=[{native:"صحيح",normalized:"true"},{native:"خطأ",normalized:"false"},{native:"null",normalized:"null"},{native:"فارغ",normalized:"null"},{native:"غير معرف",normalized:"undefined"},{native:"الأول",normalized:"first"},{native:"أول",normalized:"first"},{native:"الأخير",normalized:"last"},{native:"آخر",normalized:"last"},{native:"التالي",normalized:"next"},{native:"السابق",normalized:"previous"},{native:"الأقرب",normalized:"closest"},{native:"الأب",normalized:"parent"},{native:"النقر",normalized:"click"},{native:"نقر",normalized:"click"},{native:"الإدخال",normalized:"input"},{native:"إدخال",normalized:"input"},{native:"التغيير",normalized:"change"},{native:"تغيير",normalized:"change"},{native:"الإرسال",normalized:"submit"},{native:"إرسال",normalized:"submit"},{native:"التركيز",normalized:"focus"},{native:"فقدان التركيز",normalized:"blur"},{native:"ضغط",normalized:"keydown"},{native:"رفع",normalized:"keyup"},{native:"تمرير الفأرة",normalized:"mouseover"},{native:"مغادرة الفأرة",normalized:"mouseout"},{native:"تحميل",normalized:"load"},{native:"تمرير",normalized:"scroll"},{native:"هي",normalized:"it"},{native:"ثانية",normalized:"s"},{native:"ثواني",normalized:"s"},{native:"ملي ثانية",normalized:"ms"},{native:"دقيقة",normalized:"m"},{native:"دقائق",normalized:"m"},{native:"ساعة",normalized:"h"},{native:"ساعات",normalized:"h"},{native:"عندما",normalized:"on"},{native:"حينما",normalized:"on"},{native:"عند",normalized:"on"},{native:"حين",normalized:"on"},{native:"لمّا",normalized:"on"},{native:"لما",normalized:"on"},{native:"لدى",normalized:"on"}],nh=new(th=class extends rp{constructor(){super(),this.language="ar",this.direction="rtl",this.initializeKeywordsFromProfile(Op,eh),this.normalizer=new Jy,this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractor(new iy),this.registerExtractor(new Fd),this.registerExtractor(new Dd),this.registerExtractor(new Md),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}tokenizeWithExtractors(e){const t=[];let n=0;for(;e.length>n;){for(;e.length>n&&Mu(e[n]);)n++;if(n>=e.length)break;let r=0;for(const i of this.extractors)if(i.canExtract(e,n)){const a=i.extract(e,n);if(a){const e=a.metadata?.normalized,i=a.metadata?.stem,o=a.metadata?.stemConfidence,s={};if(a.metadata)for(const[e,t]of Object.entries(a.metadata))"normalized"!==e&&"stem"!==e&&"stemConfidence"!==e&&(s[e]=t);let l;l="conjunction"===s.procliticType?"conjunction":"preposition"===s.procliticType?"particle":this.classifyToken(a.value);const c={};e&&(c.normalized=e),i&&(c.stem=i),void 0!==o&&(c.stemConfidence=o),Object.keys(s).length>0&&(c.metadata=s),t.push(Iu(a.value,l,$u(n,n+a.length),Object.keys(c).length>0?c:void 0)),n+=a.length,r=1;break}}if(!r){const r=e[n],i=this.classifyUnknownChar(r);t.push(Iu(r,i,$u(n,n+1))),n++}}return new Ru(t,this.language)}classifyToken(e){return Xy.has(e)?"conjunction":Qy.has(e)?"particle":this.isKeyword(e)?"keyword":e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||e.startsWith("http")?"url":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}})}});function ph(e){return/[áéíóúüñÁÉÍÓÚÜÑ]/.test(e)}var mh,dh,fh,yh,hh,vh,gh,bh,wh=vp({"src/tokenizers/morphology/spanish-normalizer.ts"(){Ey(),ah=[{ending:"ando",stem:"ar",confidence:.88,type:"gerund"},{ending:"ado",stem:"ar",confidence:.88,type:"participle"},{ending:"ada",stem:"ar",confidence:.88,type:"participle"},{ending:"ados",stem:"ar",confidence:.88,type:"participle"},{ending:"adas",stem:"ar",confidence:.88,type:"participle"},{ending:"o",stem:"ar",confidence:.75,type:"present"},{ending:"as",stem:"ar",confidence:.82,type:"present"},{ending:"a",stem:"ar",confidence:.75,type:"present"},{ending:"amos",stem:"ar",confidence:.85,type:"present"},{ending:"áis",stem:"ar",confidence:.85,type:"present"},{ending:"ais",stem:"ar",confidence:.82,type:"present"},{ending:"an",stem:"ar",confidence:.8,type:"present"},{ending:"é",stem:"ar",confidence:.85,type:"past"},{ending:"aste",stem:"ar",confidence:.88,type:"past"},{ending:"ó",stem:"ar",confidence:.82,type:"past"},{ending:"amos",stem:"ar",confidence:.85,type:"past"},{ending:"asteis",stem:"ar",confidence:.88,type:"past"},{ending:"aron",stem:"ar",confidence:.88,type:"past"},{ending:"aba",stem:"ar",confidence:.88,type:"past"},{ending:"abas",stem:"ar",confidence:.88,type:"past"},{ending:"ábamos",stem:"ar",confidence:.88,type:"past"},{ending:"abamos",stem:"ar",confidence:.85,type:"past"},{ending:"abais",stem:"ar",confidence:.88,type:"past"},{ending:"aban",stem:"ar",confidence:.88,type:"past"},{ending:"e",stem:"ar",confidence:.72,type:"subjunctive"},{ending:"es",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"emos",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"éis",stem:"ar",confidence:.85,type:"subjunctive"},{ending:"eis",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"en",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"a",stem:"ar",confidence:.75,type:"imperative"},{ending:"ad",stem:"ar",confidence:.85,type:"imperative"},{ending:"ar",stem:"ar",confidence:.92,type:"dictionary"}],oh=[{ending:"iendo",stem:"er",confidence:.88,type:"gerund"},{ending:"ido",stem:"er",confidence:.85,type:"participle"},{ending:"ida",stem:"er",confidence:.85,type:"participle"},{ending:"idos",stem:"er",confidence:.85,type:"participle"},{ending:"idas",stem:"er",confidence:.85,type:"participle"},{ending:"o",stem:"er",confidence:.72,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"e",stem:"er",confidence:.72,type:"present"},{ending:"emos",stem:"er",confidence:.85,type:"present"},{ending:"éis",stem:"er",confidence:.85,type:"present"},{ending:"eis",stem:"er",confidence:.82,type:"present"},{ending:"en",stem:"er",confidence:.78,type:"present"},{ending:"í",stem:"er",confidence:.85,type:"past"},{ending:"iste",stem:"er",confidence:.88,type:"past"},{ending:"ió",stem:"er",confidence:.85,type:"past"},{ending:"io",stem:"er",confidence:.82,type:"past"},{ending:"imos",stem:"er",confidence:.85,type:"past"},{ending:"isteis",stem:"er",confidence:.88,type:"past"},{ending:"ieron",stem:"er",confidence:.88,type:"past"},{ending:"ía",stem:"er",confidence:.88,type:"past"},{ending:"ia",stem:"er",confidence:.85,type:"past"},{ending:"ías",stem:"er",confidence:.88,type:"past"},{ending:"ias",stem:"er",confidence:.85,type:"past"},{ending:"íamos",stem:"er",confidence:.88,type:"past"},{ending:"iamos",stem:"er",confidence:.85,type:"past"},{ending:"íais",stem:"er",confidence:.88,type:"past"},{ending:"iais",stem:"er",confidence:.85,type:"past"},{ending:"ían",stem:"er",confidence:.88,type:"past"},{ending:"ian",stem:"er",confidence:.85,type:"past"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],sh=[{ending:"iendo",stem:"ir",confidence:.88,type:"gerund"},{ending:"ido",stem:"ir",confidence:.85,type:"participle"},{ending:"ida",stem:"ir",confidence:.85,type:"participle"},{ending:"idos",stem:"ir",confidence:.85,type:"participle"},{ending:"idas",stem:"ir",confidence:.85,type:"participle"},{ending:"o",stem:"ir",confidence:.72,type:"present"},{ending:"es",stem:"ir",confidence:.78,type:"present"},{ending:"e",stem:"ir",confidence:.72,type:"present"},{ending:"imos",stem:"ir",confidence:.85,type:"present"},{ending:"ís",stem:"ir",confidence:.85,type:"present"},{ending:"is",stem:"ir",confidence:.82,type:"present"},{ending:"en",stem:"ir",confidence:.78,type:"present"},{ending:"í",stem:"ir",confidence:.85,type:"past"},{ending:"iste",stem:"ir",confidence:.88,type:"past"},{ending:"ió",stem:"ir",confidence:.85,type:"past"},{ending:"io",stem:"ir",confidence:.82,type:"past"},{ending:"imos",stem:"ir",confidence:.85,type:"past"},{ending:"isteis",stem:"ir",confidence:.88,type:"past"},{ending:"ieron",stem:"ir",confidence:.88,type:"past"},{ending:"ía",stem:"ir",confidence:.88,type:"past"},{ending:"ia",stem:"ir",confidence:.85,type:"past"},{ending:"ías",stem:"ir",confidence:.88,type:"past"},{ending:"ias",stem:"ir",confidence:.85,type:"past"},{ending:"íamos",stem:"ir",confidence:.88,type:"past"},{ending:"iamos",stem:"ir",confidence:.85,type:"past"},{ending:"íais",stem:"ir",confidence:.88,type:"past"},{ending:"iais",stem:"ir",confidence:.85,type:"past"},{ending:"ían",stem:"ir",confidence:.88,type:"past"},{ending:"ian",stem:"ir",confidence:.85,type:"past"},{ending:"ir",stem:"ir",confidence:.92,type:"dictionary"}],lh=[...ah,...oh,...sh].sort((e,t)=>t.ending.length-e.ending.length),new(ch=class extends op{constructor(){super({language:"es",minWordLength:3,minStemLength:2,endings:lh,reflexiveSuffixes:["se","me","te","nos","os"],infinitiveEndings:["ar","er","ir"]})}isNormalizable(e){if(3>e.length)return 0;const t=e.toLowerCase();if(t.endsWith("ar")||t.endsWith("er")||t.endsWith("ir"))return 1;if(t.endsWith("ando")||t.endsWith("iendo"))return 1;if(t.endsWith("ado")||t.endsWith("ido"))return 1;if(t.endsWith("arse")||t.endsWith("erse")||t.endsWith("irse"))return 1;for(const t of e)if(ph(t))return 1;return 0}})}}),kh=vp({"src/tokenizers/extractors/spanish-keyword.ts"(){var e;od(),({isLetter:mh,isIdentifierChar:dh}=(e=/[a-zA-ZáéíóúüñÁÉÍÓÚÜÑ]/,{isLetter:t=>e.test(t),isIdentifierChar:t=>/[0-9]/.test(t)||e.test(t)})),fh=new Set(["en","a","de","desde","hasta","con","sin","por","para","sobre","entre","antes","después","despues","dentro","fuera","al","del"]),yh=class{constructor(){this.name="spanish-keyword"}setContext(e){this.context=e}canExtract(e,t){return mh(e[t])}extract(e,t){if(!this.context)throw Error("SpanishKeywordExtractor: context not set");return this.tryMultiWordPhrase(e,t)||this.extractSpanishWord(e,t)}tryMultiWordPhrase(e,t){if(!this.context)return null;const n=["de lo contrario","de lo normal","por defecto","de nuevo","de otra manera"];for(const r of n)if(e.slice(t,t+r.length).toLowerCase()===r.toLowerCase()){const n=t+r.length;if(n>=e.length||Mu(e[n])||!mh(e[n])){const i=this.context.lookupKeyword(r);return{value:e.slice(t,n),length:r.length,metadata:{normalized:i?.normalized,multiWord:1}}}}return null}extractSpanishWord(e,t){if(!this.context)return null;let n=t,r="";for(;e.length>n&&dh(e[n]);)r+=e[n++];if(!r)return null;const i=r.toLowerCase(),a=fh.has(i),o=this.context.lookupKeyword(r),s=o&&o.normalized!==o.native?o.normalized:void 0;let l;if(!o&&this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:r,length:n-t,metadata:{normalized:s||l,isPreposition:a}}}}}}),zh={};gp(zh,{SpanishTokenizer:()=>gh,spanishTokenizer:()=>bh});var xh,Eh,Sh=vp({"src/tokenizers/spanish.ts"(){od(),wh(),Gp(),sd(),dy(),kh(),hh=new Set(["en","a","de","desde","hasta","con","sin","por","para","sobre","entre","antes","después","despues","dentro","fuera","al","del"]),vh=[{native:"verdadero",normalized:"true"},{native:"falso",normalized:"false"},{native:"nulo",normalized:"null"},{native:"indefinido",normalized:"undefined"},{native:"segundo",normalized:"s"},{native:"segundos",normalized:"s"},{native:"milisegundo",normalized:"ms"},{native:"milisegundos",normalized:"ms"},{native:"minuto",normalized:"m"},{native:"minutos",normalized:"m"},{native:"hora",normalized:"h"},{native:"horas",normalized:"h"},{native:"mí",normalized:"me"},{native:"destino",normalized:"target"}],bh=new(gh=class extends rp{constructor(){super(),this.language="es",this.direction="ltr",this.initializeKeywordsFromProfile(Hp,vh),this.setNormalizer(new ch),this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractors([new yh]),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){const t=e.toLowerCase();return hh.has(t)?"particle":this.isKeyword(t)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(e)?"operator":"identifier"}})}});function Th(e){const t=e.charCodeAt(0);return t>=65&&90>=t||t>=97&&122>=t?1:"çÇğĞıİöÖşŞüÜ".includes(e)}function jh(e){return"aıouAIOU".includes(e)}function Ah(e){return"eiöüEİÖÜ".includes(e)}function Lh(e){return jh(e)||Ah(e)}function Oh(e,t){const n=function(e){for(let t=e.length-1;t>=0;t--)if(Lh(e[t]))return e[t];return null}(e);if(!n)return 1;const r=t.split("").find(e=>Lh(e));return r?jh(n)?jh(r):Ah(r):1}var Ch,Nh,Ph,Rh,$h,Ih=vp({"src/tokenizers/morphology/turkish-normalizer.ts"(){Ey(),xh=[{pattern:"iyorsunuz",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"ıyorsunuz",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"üyorsunuz",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"uyorsunuz",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"iyorsun",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"ıyorsun",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"üyorsun",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"uyorsun",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"iyoruz",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"ıyoruz",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"üyoruz",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"uyoruz",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"iyorum",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"ıyorum",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"üyorum",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"uyorum",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"iyorlar",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"ıyorlar",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"üyorlar",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"uyorlar",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"eceksiniz",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"acaksınız",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"eceksin",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"acaksın",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"eceğiz",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"acağız",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"eceğim",confidence:.85,conjugationType:"future",minStemLength:2},{pattern:"acağım",confidence:.85,conjugationType:"future",minStemLength:2},{pattern:"ecekler",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"acaklar",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"mişsiniz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"mışsınız",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"müşsünüz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"muşsunuz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"mişsin",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"mışsın",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"müşsün",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"muşsun",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"mişiz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"mışız",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"müşüz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"muşuz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"mişim",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"mışım",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"müşüm",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"muşum",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"mişler",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"mışlar",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"müşler",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"muşlar",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"diniz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dınız",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dünüz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dunuz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tiniz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tınız",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tünüz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tunuz",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"diler",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dılar",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"düler",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dular",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tiler",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tılar",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tüler",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tular",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"din",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dın",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dün",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dun",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tin",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tın",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tün",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tun",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dik",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dık",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dük",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"duk",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tik",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tık",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tük",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"tuk",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"dim",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"dım",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"düm",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"dum",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"tim",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"tım",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"tüm",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"tum",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"iyor",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"ıyor",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"üyor",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"uyor",confidence:.85,conjugationType:"progressive",minStemLength:2},{pattern:"ecek",confidence:.85,conjugationType:"future",minStemLength:2},{pattern:"acak",confidence:.85,conjugationType:"future",minStemLength:2},{pattern:"miş",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"mış",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"müş",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"muş",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"di",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"dı",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"dü",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"du",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"ti",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"tı",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"tü",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"tu",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"mek",confidence:.88,conjugationType:"dictionary",minStemLength:2},{pattern:"mak",confidence:.88,conjugationType:"dictionary",minStemLength:2},{pattern:"eyelim",confidence:.82,conjugationType:"optative",minStemLength:2},{pattern:"ayalım",confidence:.82,conjugationType:"optative",minStemLength:2},{pattern:"eyim",confidence:.82,conjugationType:"optative",minStemLength:2},{pattern:"ayım",confidence:.82,conjugationType:"optative",minStemLength:2},{pattern:"elim",confidence:.82,conjugationType:"optative",minStemLength:2},{pattern:"alım",confidence:.82,conjugationType:"optative",minStemLength:2},{pattern:"melisiniz",confidence:.82,conjugationType:"necessitative",minStemLength:2},{pattern:"malısınız",confidence:.82,conjugationType:"necessitative",minStemLength:2},{pattern:"melisin",confidence:.82,conjugationType:"necessitative",minStemLength:2},{pattern:"malısın",confidence:.82,conjugationType:"necessitative",minStemLength:2},{pattern:"meliyiz",confidence:.82,conjugationType:"necessitative",minStemLength:2},{pattern:"malıyız",confidence:.82,conjugationType:"necessitative",minStemLength:2},{pattern:"meliyim",confidence:.85,conjugationType:"necessitative",minStemLength:2},{pattern:"malıyım",confidence:.85,conjugationType:"necessitative",minStemLength:2},{pattern:"meliler",confidence:.82,conjugationType:"necessitative",minStemLength:2},{pattern:"malılar",confidence:.82,conjugationType:"necessitative",minStemLength:2},{pattern:"meli",confidence:.85,conjugationType:"necessitative",minStemLength:2},{pattern:"malı",confidence:.85,conjugationType:"necessitative",minStemLength:2},{pattern:"ebiliyor",confidence:.82,conjugationType:"potential",minStemLength:2},{pattern:"abiliyor",confidence:.82,conjugationType:"potential",minStemLength:2},{pattern:"ebilir",confidence:.85,conjugationType:"potential",minStemLength:2},{pattern:"abilir",confidence:.85,conjugationType:"potential",minStemLength:2},{pattern:"ebildi",confidence:.82,conjugationType:"potential",minStemLength:2},{pattern:"abildi",confidence:.82,conjugationType:"potential",minStemLength:2},{pattern:"ebilmek",confidence:.85,conjugationType:"potential",minStemLength:2},{pattern:"abilmek",confidence:.85,conjugationType:"potential",minStemLength:2},{pattern:"iniz",confidence:.82,conjugationType:"imperative",minStemLength:2},{pattern:"ınız",confidence:.82,conjugationType:"imperative",minStemLength:2},{pattern:"ünüz",confidence:.82,conjugationType:"imperative",minStemLength:2},{pattern:"unuz",confidence:.82,conjugationType:"imperative",minStemLength:2},{pattern:"in",confidence:.8,conjugationType:"imperative",minStemLength:2},{pattern:"ın",confidence:.8,conjugationType:"imperative",minStemLength:2},{pattern:"ün",confidence:.8,conjugationType:"imperative",minStemLength:2},{pattern:"un",confidence:.8,conjugationType:"imperative",minStemLength:2},{pattern:"ildi",confidence:.82,conjugationType:"passive",minStemLength:2},{pattern:"ıldı",confidence:.82,conjugationType:"passive",minStemLength:2},{pattern:"üldü",confidence:.82,conjugationType:"passive",minStemLength:2},{pattern:"uldu",confidence:.82,conjugationType:"passive",minStemLength:2},{pattern:"ilir",confidence:.82,conjugationType:"passive",minStemLength:2},{pattern:"ılır",confidence:.82,conjugationType:"passive",minStemLength:2},{pattern:"ülür",confidence:.82,conjugationType:"passive",minStemLength:2},{pattern:"ulur",confidence:.82,conjugationType:"passive",minStemLength:2},{pattern:"tirmek",confidence:.82,conjugationType:"causative",minStemLength:2},{pattern:"tırmak",confidence:.82,conjugationType:"causative",minStemLength:2},{pattern:"türmek",confidence:.82,conjugationType:"causative",minStemLength:2},{pattern:"turmak",confidence:.82,conjugationType:"causative",minStemLength:2},{pattern:"dirmek",confidence:.82,conjugationType:"causative",minStemLength:2},{pattern:"dırmak",confidence:.82,conjugationType:"causative",minStemLength:2},{pattern:"dürmek",confidence:.82,conjugationType:"causative",minStemLength:2},{pattern:"durmak",confidence:.82,conjugationType:"causative",minStemLength:2},{pattern:"miyorsunuz",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"mıyorsunuz",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"müyorsunuz",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"muyorsunuz",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"miyorsun",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"mıyorsun",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"müyorsun",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"muyorsun",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"miyoruz",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"mıyoruz",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"müyoruz",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"muyoruz",confidence:.8,conjugationType:"negative",minStemLength:2},{pattern:"miyorum",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"mıyorum",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"müyorum",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"muyorum",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"miyor",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"mıyor",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"müyor",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"muyor",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"medi",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"madı",confidence:.82,conjugationType:"negative",minStemLength:2},{pattern:"me",confidence:.75,conjugationType:"negative",minStemLength:3},{pattern:"ma",confidence:.75,conjugationType:"negative",minStemLength:3}],new(Eh=class{constructor(){this.language="tr"}isNormalizable(e){return function(e){for(const t of e)if(Th(t))return 1;return 0}(e)?3>e.length?0:1:0}normalize(e){const t=e.toLowerCase();for(const e of xh)if(t.endsWith(e.pattern)){const n=t.slice(0,-e.pattern.length);if((e.minStemLength??2)>n.length)continue;if(!Oh(n,e.pattern)){const t=.9*e.confidence,r={removedSuffixes:[e.pattern]};return e.conjugationType&&(r.conjugationType=e.conjugationType),ap(n,t,r)}const r={removedSuffixes:[e.pattern]};return e.conjugationType&&(r.conjugationType=e.conjugationType),ap(n,e.confidence,r)}return ip(e)}})}}),Mh={};gp(Mh,{TurkishTokenizer:()=>Rh,turkishTokenizer:()=>$h});var qh,_h,Dh,Vh,Hh=vp({"src/tokenizers/turkish.ts"(){od(),Ih(),Dm(),sd(),dy(),Wf(),Ch=new Set(["ile","için","kadar","gibi","önce","üzerinde","altında","içinde","dışında","arasında","karşı","göre","rağmen","doğru","boyunca"]),Nh=new Set(["de","da","te","ta","den","dan","ten","tan","e","a","ye","ya","i","ı","u","ü","in","ın","un","ün","le","la","yle","yla"]),Ph=[{native:"doğru",normalized:"true"},{native:"dogru",normalized:"true"},{native:"yanlış",normalized:"false"},{native:"yanlis",normalized:"false"},{native:"null",normalized:"null"},{native:"boş",normalized:"null"},{native:"bos",normalized:"null"},{native:"tanımsız",normalized:"undefined"},{native:"tanimsiz",normalized:"undefined"},{native:"ilk",normalized:"first"},{native:"son",normalized:"last"},{native:"sonraki",normalized:"next"},{native:"önceki",normalized:"previous"},{native:"onceki",normalized:"previous"},{native:"en_yakın",normalized:"closest"},{native:"en_yakin",normalized:"closest"},{native:"ebeveyn",normalized:"parent"},{native:"fare üzerinde",normalized:"mouseover"},{native:"fare uzerinde",normalized:"mouseover"},{native:"fare dışında",normalized:"mouseout"},{native:"fare disinda",normalized:"mouseout"},{native:"kaydır",normalized:"scroll"},{native:"kaydir",normalized:"scroll"},{native:"tuş_bas",normalized:"keydown"},{native:"tus_bas",normalized:"keydown"},{native:"tuş_bırak",normalized:"keyup"},{native:"tus_birak",normalized:"keyup"},{native:"saniye",normalized:"s"},{native:"milisaniye",normalized:"ms"},{native:"dakika",normalized:"m"},{native:"saat",normalized:"h"},{native:"sonra",normalized:"then"}],$h=new(Rh=class extends rp{constructor(){super(),this.language="tr",this.direction="ltr",this.initializeKeywordsFromProfile(Im,Ph),this.setNormalizer(new Eh),this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractor(new qf),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){const t=e.toLowerCase();return Ch.has(t)||Nh.has(t)?"particle":this.isKeyword(t)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(e)?"operator":"identifier"}})}}),Fh={};gp(Fh,{ChineseTokenizer:()=>Dh,chineseTokenizer:()=>Vh});var Bh,Uh,Gh,Wh,Kh,Jh,Zh=vp({"src/tokenizers/chinese.ts"(){od(),nd(),sd(),dy(),Kd(),Jd(),cy(),qh=new Set(["把","在","从","到","向","给","对","用","被","让","的","地","得","了","着","过","吗","呢","吧"]),_h=[{native:"真",normalized:"true"},{native:"假",normalized:"false"},{native:"空",normalized:"null"},{native:"未定义",normalized:"undefined"},{native:"第一个",normalized:"first"},{native:"首个",normalized:"first"},{native:"最后一个",normalized:"last"},{native:"末个",normalized:"last"},{native:"下一个",normalized:"next"},{native:"上一个",normalized:"previous"},{native:"最近的",normalized:"closest"},{native:"父级",normalized:"parent"},{native:"点击",normalized:"click"},{native:"双击",normalized:"dblclick"},{native:"输入",normalized:"input"},{native:"变更",normalized:"change"},{native:"改变",normalized:"change"},{native:"提交",normalized:"submit"},{native:"按键",normalized:"keydown"},{native:"释放键",normalized:"keyup"},{native:"鼠标移入",normalized:"mouseover"},{native:"鼠标移出",normalized:"mouseout"},{native:"获得焦点",normalized:"focus"},{native:"失去焦点",normalized:"blur"},{native:"加载",normalized:"load"},{native:"滚动",normalized:"scroll"},{native:"我的",normalized:"my"},{native:"它的",normalized:"its"},{native:"秒",normalized:"s"},{native:"毫秒",normalized:"ms"},{native:"分钟",normalized:"m"},{native:"小时",normalized:"h"},{native:"和",normalized:"and"},{native:"或者",normalized:"or"},{native:"或",normalized:"or"},{native:"不",normalized:"not"},{native:"非",normalized:"not"},{native:"是",normalized:"is"},{native:"若",normalized:"if"},{native:"不然",normalized:"else"},{native:"循环",normalized:"repeat"},{native:"遍历",normalized:"for"},{native:"每个",normalized:"for"},{native:"为每",normalized:"for"},{native:"中止",normalized:"halt"},{native:"抛",normalized:"throw"},{native:"呼叫",normalized:"call"},{native:"回",normalized:"return"},{native:"脚本",normalized:"js"},{native:"通知",normalized:"tell"},{native:"缺省",normalized:"default"},{native:"初始",normalized:"init"},{native:"动作",normalized:"behavior"},{native:"激发",normalized:"trigger"},{native:"对焦",normalized:"focus"},{native:"模糊",normalized:"blur"},{native:"跳转",normalized:"go"},{native:"导航",normalized:"go"},{native:"抓取",normalized:"fetch"},{native:"获取数据",normalized:"fetch"},{native:"安定",normalized:"settle"},{native:"拿取",normalized:"take"},{native:"取",normalized:"take"},{native:"创建",normalized:"make"},{native:"克隆",normalized:"clone"},{native:"记录",normalized:"log"},{native:"打印",normalized:"log"},{native:"动画",normalized:"transition"},{native:"到里面",normalized:"into"},{native:"里",normalized:"into"},{native:"前",normalized:"before"},{native:"后",normalized:"after"},{native:"那么",normalized:"then"},{native:"完",normalized:"end"}],Vh=new(Dh=class extends rp{constructor(){super(),this.language="zh",this.direction="ltr",this.initializeKeywordsFromProfile(Um,_h),this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractor(new iy),this.registerExtractor(new Od),this.registerExtractor(new Ed),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){return qh.has(e)?"particle":this.isKeyword(e)?"keyword":e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||e.startsWith("http")?"url":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||e.startsWith("“")||e.startsWith("‘")||/^\d/.test(e)?"literal":"identifier"}})}});function Yh(e){return/[áàâãéêíóôõúüçÁÀÂÃÉÊÍÓÔÕÚÜÇ]/.test(e)}var Xh,Qh,ev,tv,nv,rv,iv,av,ov=vp({"src/tokenizers/morphology/portuguese-normalizer.ts"(){Ey(),Bh=["-se","-me","-te","-nos","-vos"],Uh=[{ending:"ando",stem:"ar",confidence:.88,type:"gerund"},{ending:"ado",stem:"ar",confidence:.88,type:"participle"},{ending:"ada",stem:"ar",confidence:.88,type:"participle"},{ending:"ados",stem:"ar",confidence:.88,type:"participle"},{ending:"adas",stem:"ar",confidence:.88,type:"participle"},{ending:"o",stem:"ar",confidence:.75,type:"present"},{ending:"as",stem:"ar",confidence:.82,type:"present"},{ending:"a",stem:"ar",confidence:.75,type:"present"},{ending:"amos",stem:"ar",confidence:.85,type:"present"},{ending:"ais",stem:"ar",confidence:.85,type:"present"},{ending:"am",stem:"ar",confidence:.8,type:"present"},{ending:"ei",stem:"ar",confidence:.88,type:"past"},{ending:"aste",stem:"ar",confidence:.88,type:"past"},{ending:"ou",stem:"ar",confidence:.88,type:"past"},{ending:"ámos",stem:"ar",confidence:.88,type:"past"},{ending:"amos",stem:"ar",confidence:.85,type:"past"},{ending:"astes",stem:"ar",confidence:.88,type:"past"},{ending:"aram",stem:"ar",confidence:.88,type:"past"},{ending:"ava",stem:"ar",confidence:.88,type:"past"},{ending:"avas",stem:"ar",confidence:.88,type:"past"},{ending:"ávamos",stem:"ar",confidence:.88,type:"past"},{ending:"avamos",stem:"ar",confidence:.85,type:"past"},{ending:"áveis",stem:"ar",confidence:.88,type:"past"},{ending:"aveis",stem:"ar",confidence:.85,type:"past"},{ending:"avam",stem:"ar",confidence:.88,type:"past"},{ending:"e",stem:"ar",confidence:.72,type:"subjunctive"},{ending:"es",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"emos",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"eis",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"em",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"a",stem:"ar",confidence:.75,type:"imperative"},{ending:"ai",stem:"ar",confidence:.85,type:"imperative"},{ending:"ar",stem:"ar",confidence:.92,type:"dictionary"}],Gh=[{ending:"endo",stem:"er",confidence:.88,type:"gerund"},{ending:"ido",stem:"er",confidence:.85,type:"participle"},{ending:"ida",stem:"er",confidence:.85,type:"participle"},{ending:"idos",stem:"er",confidence:.85,type:"participle"},{ending:"idas",stem:"er",confidence:.85,type:"participle"},{ending:"o",stem:"er",confidence:.72,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"e",stem:"er",confidence:.72,type:"present"},{ending:"emos",stem:"er",confidence:.85,type:"present"},{ending:"eis",stem:"er",confidence:.82,type:"present"},{ending:"em",stem:"er",confidence:.78,type:"present"},{ending:"i",stem:"er",confidence:.85,type:"past"},{ending:"este",stem:"er",confidence:.88,type:"past"},{ending:"eu",stem:"er",confidence:.88,type:"past"},{ending:"emos",stem:"er",confidence:.85,type:"past"},{ending:"estes",stem:"er",confidence:.88,type:"past"},{ending:"eram",stem:"er",confidence:.88,type:"past"},{ending:"ia",stem:"er",confidence:.85,type:"past"},{ending:"ias",stem:"er",confidence:.85,type:"past"},{ending:"íamos",stem:"er",confidence:.88,type:"past"},{ending:"iamos",stem:"er",confidence:.85,type:"past"},{ending:"íeis",stem:"er",confidence:.88,type:"past"},{ending:"ieis",stem:"er",confidence:.85,type:"past"},{ending:"iam",stem:"er",confidence:.85,type:"past"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],Wh=[{ending:"indo",stem:"ir",confidence:.88,type:"gerund"},{ending:"ido",stem:"ir",confidence:.85,type:"participle"},{ending:"ida",stem:"ir",confidence:.85,type:"participle"},{ending:"idos",stem:"ir",confidence:.85,type:"participle"},{ending:"idas",stem:"ir",confidence:.85,type:"participle"},{ending:"o",stem:"ir",confidence:.72,type:"present"},{ending:"es",stem:"ir",confidence:.78,type:"present"},{ending:"e",stem:"ir",confidence:.72,type:"present"},{ending:"imos",stem:"ir",confidence:.85,type:"present"},{ending:"is",stem:"ir",confidence:.82,type:"present"},{ending:"em",stem:"ir",confidence:.78,type:"present"},{ending:"i",stem:"ir",confidence:.85,type:"past"},{ending:"iste",stem:"ir",confidence:.88,type:"past"},{ending:"iu",stem:"ir",confidence:.88,type:"past"},{ending:"imos",stem:"ir",confidence:.85,type:"past"},{ending:"istes",stem:"ir",confidence:.88,type:"past"},{ending:"iram",stem:"ir",confidence:.88,type:"past"},{ending:"ia",stem:"ir",confidence:.85,type:"past"},{ending:"ias",stem:"ir",confidence:.85,type:"past"},{ending:"íamos",stem:"ir",confidence:.88,type:"past"},{ending:"iamos",stem:"ir",confidence:.85,type:"past"},{ending:"íeis",stem:"ir",confidence:.88,type:"past"},{ending:"ieis",stem:"ir",confidence:.85,type:"past"},{ending:"iam",stem:"ir",confidence:.85,type:"past"},{ending:"ir",stem:"ir",confidence:.92,type:"dictionary"}],Kh=[...Uh,...Gh,...Wh].sort((e,t)=>t.ending.length-e.ending.length),new(Jh=class{constructor(){this.language="pt"}isNormalizable(e){return 3>e.length?0:function(e){const t=e.toLowerCase();if(t.endsWith("ar")||t.endsWith("er")||t.endsWith("ir"))return 1;if(t.endsWith("ando")||t.endsWith("endo")||t.endsWith("indo"))return 1;if(t.endsWith("ado")||t.endsWith("ido"))return 1;if(t.endsWith("ar-se")||t.endsWith("er-se")||t.endsWith("ir-se"))return 1;for(const t of e)if(Yh(t))return 1;return 0}(e)}normalize(e){const t=e.toLowerCase();if((t.endsWith("ar")||t.endsWith("er")||t.endsWith("ir"))&&!Bh.some(e=>t.endsWith(e)))return ip(e);const n=this.tryReflexiveNormalization(t);return n||(this.tryConjugationNormalization(t)||ip(e))}tryReflexiveNormalization(e){for(const t of Bh)if(e.endsWith(t)){const n=e.slice(0,-t.length);if(n.endsWith("ar")||n.endsWith("er")||n.endsWith("ir"))return ap(n,.88,{removedSuffixes:[t],conjugationType:"reflexive"});const r=this.tryConjugationNormalization(n);if(r&&r.stem!==n)return ap(r.stem,.95*r.confidence,{removedSuffixes:[t,...r.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}tryConjugationNormalization(e){for(const t of Kh)if(e.endsWith(t.ending)){const n=e.slice(0,-t.ending.length);if(2>n.length)continue;return ap(n+t.stem,t.confidence,{removedSuffixes:[t.ending],conjugationType:t.type})}return null}})}}),sv=vp({"src/tokenizers/extractors/portuguese-keyword.ts"(){var e;({isLetter:Xh,isIdentifierChar:Qh}=(e=/[a-zA-ZáâãéêíóôõúçÁÂÃÉÊÍÓÔÕÚÇ]/,{isLetter:t=>e.test(t),isIdentifierChar:t=>/[0-9]/.test(t)||e.test(t)})),ev=new Set(["em","a","de","para","com","sem","por","sobre","entre","antes","depois","dentro","fora","ao","do","da","no","na"]),tv=class{constructor(){this.name="portuguese-keyword"}setContext(e){this.context=e}canExtract(e,t){return Xh(e[t])}extract(e,t){if(!this.context)throw Error("PortugueseKeywordExtractor: context not set");let n=t,r="";for(;e.length>n&&Qh(e[n]);)r+=e[n++];if(!r)return null;const i=r.toLowerCase(),a=ev.has(i),o=this.context.lookupKeyword(i),s=o&&o.normalized!==o.native?o.normalized:void 0;let l;if(!o&&this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:r,length:n-t,metadata:{normalized:s||l,isPreposition:a}}}}}}),lv={};gp(lv,{PortugueseTokenizer:()=>iv,portugueseTokenizer:()=>av});var cv,uv,pv,mv,dv,fv,yv,hv,vv,gv,bv,wv,kv,zv=vp({"src/tokenizers/portuguese.ts"(){od(),zm(),ov(),sd(),dy(),sv(),nv=new Set(["em","a","de","desde","até","ate","com","sem","por","para","sobre","entre","antes","depois","dentro","fora","ao","do","no","na"]),rv=[{native:"verdadeiro",normalized:"true"},{native:"falso",normalized:"false"},{native:"nulo",normalized:"null"},{native:"indefinido",normalized:"undefined"},{native:"primeiro",normalized:"first"},{native:"primeira",normalized:"first"},{native:"último",normalized:"last"},{native:"ultima",normalized:"last"},{native:"próximo",normalized:"next"},{native:"proximo",normalized:"next"},{native:"anterior",normalized:"previous"},{native:"mais próximo",normalized:"closest"},{native:"mais proximo",normalized:"closest"},{native:"pai",normalized:"parent"},{native:"clique",normalized:"click"},{native:"click",normalized:"click"},{native:"entrada",normalized:"input"},{native:"mudança",normalized:"change"},{native:"mudanca",normalized:"change"},{native:"envio",normalized:"submit"},{native:"tecla baixo",normalized:"keydown"},{native:"tecla cima",normalized:"keyup"},{native:"mouse sobre",normalized:"mouseover"},{native:"mouse fora",normalized:"mouseout"},{native:"foco",normalized:"focus"},{native:"desfoque",normalized:"blur"},{native:"carregar",normalized:"load"},{native:"rolagem",normalized:"scroll"},{native:"meu",normalized:"my"},{native:"minha",normalized:"my"},{native:"isso",normalized:"it"},{native:"segundo",normalized:"s"},{native:"segundos",normalized:"s"},{native:"milissegundo",normalized:"ms"},{native:"milissegundos",normalized:"ms"},{native:"minuto",normalized:"m"},{native:"minutos",normalized:"m"},{native:"hora",normalized:"h"},{native:"horas",normalized:"h"},{native:"senao",normalized:"else"},{native:"transicao",normalized:"transition"},{native:"ate",normalized:"until"},{native:"entao",normalized:"then"},{native:"lancar",normalized:"throw"},{native:"assincrono",normalized:"async"},{native:"padrao",normalized:"default"},{native:"até que",normalized:"until"},{native:"dentro de",normalized:"into"}],av=new(iv=class extends rp{constructor(){super(),this.language="pt",this.direction="ltr",this.initializeKeywordsFromProfile(gm,rv),this.setNormalizer(new Jh),this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractors([new tv]),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){const t=e.toLowerCase();return nv.has(t)?"particle":this.isKeyword(t)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}})}}),xv=vp({"src/tokenizers/morphology/french-normalizer.ts"(){Ey(),cv=["toi","vous","nous"],uv=[{ending:"ant",stem:"er",confidence:.88,type:"gerund"},{ending:"é",stem:"er",confidence:.88,type:"participle"},{ending:"ée",stem:"er",confidence:.88,type:"participle"},{ending:"és",stem:"er",confidence:.88,type:"participle"},{ending:"ées",stem:"er",confidence:.88,type:"participle"},{ending:"e",stem:"er",confidence:.75,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"ons",stem:"er",confidence:.85,type:"present"},{ending:"ez",stem:"er",confidence:.85,type:"present"},{ending:"ent",stem:"er",confidence:.82,type:"present"},{ending:"ais",stem:"er",confidence:.82,type:"past"},{ending:"ait",stem:"er",confidence:.82,type:"past"},{ending:"ions",stem:"er",confidence:.85,type:"past"},{ending:"iez",stem:"er",confidence:.85,type:"past"},{ending:"aient",stem:"er",confidence:.85,type:"past"},{ending:"ai",stem:"er",confidence:.8,type:"past"},{ending:"as",stem:"er",confidence:.78,type:"past"},{ending:"a",stem:"er",confidence:.75,type:"past"},{ending:"âmes",stem:"er",confidence:.88,type:"past"},{ending:"âtes",stem:"er",confidence:.88,type:"past"},{ending:"èrent",stem:"er",confidence:.88,type:"past"},{ending:"erai",stem:"er",confidence:.85,type:"future"},{ending:"eras",stem:"er",confidence:.85,type:"future"},{ending:"era",stem:"er",confidence:.82,type:"future"},{ending:"erons",stem:"er",confidence:.88,type:"future"},{ending:"erez",stem:"er",confidence:.88,type:"future"},{ending:"eront",stem:"er",confidence:.88,type:"future"},{ending:"erais",stem:"er",confidence:.85,type:"conditional"},{ending:"erait",stem:"er",confidence:.85,type:"conditional"},{ending:"erions",stem:"er",confidence:.88,type:"conditional"},{ending:"eriez",stem:"er",confidence:.88,type:"conditional"},{ending:"eraient",stem:"er",confidence:.88,type:"conditional"},{ending:"ions",stem:"er",confidence:.8,type:"subjunctive"},{ending:"iez",stem:"er",confidence:.8,type:"subjunctive"},{ending:"ons",stem:"er",confidence:.82,type:"imperative"},{ending:"ez",stem:"er",confidence:.82,type:"imperative"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],pv=[{ending:"issant",stem:"ir",confidence:.88,type:"gerund"},{ending:"i",stem:"ir",confidence:.8,type:"participle"},{ending:"ie",stem:"ir",confidence:.82,type:"participle"},{ending:"is",stem:"ir",confidence:.78,type:"participle"},{ending:"ies",stem:"ir",confidence:.82,type:"participle"},{ending:"is",stem:"ir",confidence:.78,type:"present"},{ending:"it",stem:"ir",confidence:.78,type:"present"},{ending:"issons",stem:"ir",confidence:.88,type:"present"},{ending:"issez",stem:"ir",confidence:.88,type:"present"},{ending:"issent",stem:"ir",confidence:.88,type:"present"},{ending:"issais",stem:"ir",confidence:.85,type:"past"},{ending:"issait",stem:"ir",confidence:.85,type:"past"},{ending:"issions",stem:"ir",confidence:.88,type:"past"},{ending:"issiez",stem:"ir",confidence:.88,type:"past"},{ending:"issaient",stem:"ir",confidence:.88,type:"past"},{ending:"irai",stem:"ir",confidence:.85,type:"future"},{ending:"iras",stem:"ir",confidence:.85,type:"future"},{ending:"ira",stem:"ir",confidence:.82,type:"future"},{ending:"irons",stem:"ir",confidence:.88,type:"future"},{ending:"irez",stem:"ir",confidence:.88,type:"future"},{ending:"iront",stem:"ir",confidence:.88,type:"future"},{ending:"ir",stem:"ir",confidence:.9,type:"dictionary"}],mv=[{ending:"ant",stem:"re",confidence:.82,type:"gerund"},{ending:"u",stem:"re",confidence:.8,type:"participle"},{ending:"ue",stem:"re",confidence:.82,type:"participle"},{ending:"us",stem:"re",confidence:.82,type:"participle"},{ending:"ues",stem:"re",confidence:.82,type:"participle"},{ending:"s",stem:"re",confidence:.72,type:"present"},{ending:"d",stem:"re",confidence:.75,type:"present"},{ending:"ons",stem:"re",confidence:.82,type:"present"},{ending:"ez",stem:"re",confidence:.82,type:"present"},{ending:"ent",stem:"re",confidence:.8,type:"present"},{ending:"re",stem:"re",confidence:.9,type:"dictionary"}],dv=[...uv,...pv,...mv].sort((e,t)=>t.ending.length-e.ending.length),new(fv=class{constructor(){this.language="fr"}isNormalizable(e){return 3>e.length?0:function(e){const t=e.toLowerCase();return t.endsWith("er")||t.endsWith("ir")||t.endsWith("re")||t.endsWith("ant")||t.endsWith("é")||t.endsWith("i")||t.endsWith("u")||/[àâäéèêëïîôùûüÿçœæ]/i.test(e)?1:0}(e)}normalize(e){const t=e.toLowerCase();if((t.endsWith("er")||t.endsWith("ir")||t.endsWith("re"))&&t.length>=4)return ip(e);const n=this.tryReflexiveNormalization(t);return n||(this.tryConjugationNormalization(t)||ip(e))}tryReflexiveNormalization(e){for(const t of cv){const n="-"+t;if(e.endsWith(n)){const t=e.slice(0,-n.length),r=this.tryConjugationNormalization(t);if(r&&r.stem!==t)return ap(r.stem,.95*r.confidence,{removedSuffixes:[n,...r.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}}return null}tryConjugationNormalization(e){for(const t of dv)if(e.endsWith(t.ending)){const n=e.slice(0,-t.ending.length);if(2>n.length)continue;return ap(n+t.stem,t.confidence,{removedSuffixes:[t.ending],conjugationType:t.type})}return null}})}}),Ev=vp({"src/tokenizers/extractors/french-keyword.ts"(){var e;({isLetter:yv,isIdentifierChar:hv}=(e=/[a-zA-ZàâæçéèêëïîôùûüÿœÀÂÆÇÉÈÊËÏÎÔÙÛÜŸŒ]/,{isLetter:t=>e.test(t),isIdentifierChar:t=>/[0-9]/.test(t)||e.test(t)})),vv=new Set(["à","a","de","du","des","dans","sur","sous","avec","sans","par","pour","entre","avant","après","apres","depuis","vers","chez","contre","au","aux"]),gv=class{constructor(){this.name="french-keyword"}setContext(e){this.context=e}canExtract(e,t){return yv(e[t])}extract(e,t){if(!this.context)throw Error("FrenchKeywordExtractor: context not set");let n=t,r="";for(;e.length>n&&hv(e[n]);)r+=e[n++];if(!r)return null;const i=r.toLowerCase(),a=vv.has(i),o=this.context.lookupKeyword(i),s=o&&o.normalized!==o.native?o.normalized:void 0;let l;if(!o&&this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:r,length:n-t,metadata:{normalized:s||l,isPreposition:a}}}}}}),Sv={};gp(Sv,{FrenchTokenizer:()=>wv,frenchTokenizer:()=>kv});var Tv,jv,Av,Lv,Ov,Cv,Nv,Pv,Rv,$v,Iv,Mv,qv=vp({"src/tokenizers/french.ts"(){od(),Jp(),xv(),sd(),dy(),Ev(),bv=[{native:"vrai",normalized:"true"},{native:"faux",normalized:"false"},{native:"nul",normalized:"null"},{native:"indéfini",normalized:"undefined"},{native:"indefini",normalized:"undefined"},{native:"premier",normalized:"first"},{native:"première",normalized:"first"},{native:"premiere",normalized:"first"},{native:"dernier",normalized:"last"},{native:"dernière",normalized:"last"},{native:"derniere",normalized:"last"},{native:"suivant",normalized:"next"},{native:"précédent",normalized:"previous"},{native:"precedent",normalized:"previous"},{native:"plus proche",normalized:"closest"},{native:"parent",normalized:"parent"},{native:"clic",normalized:"click"},{native:"click",normalized:"click"},{native:"entrée",normalized:"input"},{native:"entree",normalized:"input"},{native:"changement",normalized:"change"},{native:"soumission",normalized:"submit"},{native:"touche bas",normalized:"keydown"},{native:"touche haut",normalized:"keyup"},{native:"souris dessus",normalized:"mouseover"},{native:"souris dehors",normalized:"mouseout"},{native:"focus",normalized:"focus"},{native:"flou",normalized:"blur"},{native:"chargement",normalized:"load"},{native:"défilement",normalized:"scroll"},{native:"defilement",normalized:"scroll"},{native:"je",normalized:"me"},{native:"mon",normalized:"my"},{native:"ma",normalized:"my"},{native:"mes",normalized:"my"},{native:"ça",normalized:"it"},{native:"ca",normalized:"it"},{native:"resultat",normalized:"result"},{native:"evenement",normalized:"event"},{native:"seconde",normalized:"s"},{native:"secondes",normalized:"s"},{native:"milliseconde",normalized:"ms"},{native:"millisecondes",normalized:"ms"},{native:"minute",normalized:"m"},{native:"minutes",normalized:"m"},{native:"heure",normalized:"h"},{native:"heures",normalized:"h"},{native:"prefixer",normalized:"prepend"},{native:"creer",normalized:"make"},{native:"definir",normalized:"set"},{native:"etablir",normalized:"set"},{native:"incrementer",normalized:"increment"},{native:"decrementer",normalized:"decrement"},{native:"declencher",normalized:"trigger"},{native:"defocaliser",normalized:"blur"},{native:"recuperer",normalized:"fetch"},{native:"repeter",normalized:"repeat"},{native:"arreter",normalized:"halt"},{native:"defaut",normalized:"default"},{native:"jusqua",normalized:"until"},{native:"apres",normalized:"after"},{native:"journaliser",normalized:"log"},{native:"transmuter",normalized:"morph"},{native:"tant que",normalized:"while"}],kv=new(wv=class extends rp{constructor(){super(),this.language="fr",this.direction="ltr",this.initializeKeywordsFromProfile(Up,bv),this.normalizer=new fv,this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractors([new gv]),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){return this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(e)?"operator":e.startsWith("/")||e.startsWith("./")||e.startsWith("http")?"url":"identifier"}})}}),_v=vp({"src/tokenizers/morphology/german-normalizer.ts"(){Ey(),Tv=["an","auf","aus","ein","mit","vor","zu","ab","bei","nach","weg","um","her","hin"],jv=[{ending:"end",stem:"en",confidence:.88,type:"gerund"},{ending:"e",stem:"en",confidence:.75,type:"present"},{ending:"st",stem:"en",confidence:.8,type:"present"},{ending:"t",stem:"en",confidence:.78,type:"present"},{ending:"en",stem:"en",confidence:.85,type:"dictionary"},{ending:"test",stem:"en",confidence:.85,type:"past"},{ending:"ten",stem:"en",confidence:.82,type:"past"},{ending:"tet",stem:"en",confidence:.85,type:"past"},{ending:"te",stem:"en",confidence:.82,type:"past"},{ending:"test",stem:"en",confidence:.8,type:"subjunctive"},{ending:"ten",stem:"en",confidence:.78,type:"subjunctive"},{ending:"tet",stem:"en",confidence:.8,type:"subjunctive"},{ending:"te",stem:"en",confidence:.78,type:"subjunctive"},{ending:"e",stem:"en",confidence:.72,type:"imperative"},{ending:"t",stem:"en",confidence:.72,type:"imperative"},{ending:"en",stem:"en",confidence:.75,type:"imperative"}],Av=[{ending:"le",stem:"eln",confidence:.82,type:"present"},{ending:"elst",stem:"eln",confidence:.85,type:"present"},{ending:"elt",stem:"eln",confidence:.85,type:"present"},{ending:"eln",stem:"eln",confidence:.88,type:"dictionary"},{ending:"re",stem:"ern",confidence:.82,type:"present"},{ending:"erst",stem:"ern",confidence:.85,type:"present"},{ending:"ert",stem:"ern",confidence:.85,type:"present"},{ending:"ern",stem:"ern",confidence:.88,type:"dictionary"}],Lv=[...jv,...Av].sort((e,t)=>t.ending.length-e.ending.length),Ov=class{constructor(){this.language="de"}isNormalizable(e){return 3>e.length?0:function(e){const t=e.toLowerCase();return t.endsWith("en")||t.endsWith("eln")||t.endsWith("ern")||t.startsWith("ge")&&t.endsWith("t")||t.startsWith("ge")&&t.endsWith("en")||/[äöüß]/i.test(e)?1:0}(e)}normalize(e){const t=e.toLowerCase();if(t.endsWith("en")&&t.length>=4)return ip(e);if((t.endsWith("eln")||t.endsWith("ern"))&&t.length>=5)return ip(e);const n=this.tryParticipleNormalization(t);return n||(this.tryConjugationNormalization(t)||ip(e))}tryParticipleNormalization(e){for(const t of Tv)if(e.startsWith(t+"ge")){const n=e.slice(t.length),r=this.trySimpleParticipleNormalization(n);if(r){const e={removedPrefixes:["ge"],conjugationType:"participle"};return r.metadata?.removedSuffixes&&(e.removedSuffixes=r.metadata.removedSuffixes),ap(t+r.stem,.95*r.confidence,e)}}return this.trySimpleParticipleNormalization(e)}trySimpleParticipleNormalization(e){if(!e.startsWith("ge"))return null;const t=e.slice(2);return t.endsWith("t")&&t.length>=3?ap(t.slice(0,-1)+"en",.85,{removedPrefixes:["ge"],removedSuffixes:["t"],conjugationType:"participle"}):t.endsWith("en")&&t.length>=4?ap(t,.82,{removedPrefixes:["ge"],conjugationType:"participle"}):null}tryConjugationNormalization(e){for(const t of Lv)if(e.endsWith(t.ending)){const n=e.slice(0,-t.ending.length);if(2>n.length)continue;return ap(n+t.stem,t.confidence,{removedSuffixes:[t.ending],conjugationType:t.type})}return null}},new Ov}}),Dv=vp({"src/tokenizers/extractors/german-keyword.ts"(){var e;({isLetter:Cv,isIdentifierChar:Nv}=(e=/[a-zA-ZäöüÄÖÜß]/,{isLetter:t=>e.test(t),isIdentifierChar:t=>/[0-9]/.test(t)||e.test(t)})),Pv=new Set(["an","auf","aus","bei","durch","für","fur","gegen","in","mit","nach","ohne","seit","über","uber","um","unter","von","vor","zu","zwischen","bis","gegenüber","gegenuber","während","wahrend","wegen","trotz","statt","innerhalb","außerhalb","ausserhalb"]),Rv=class{constructor(){this.name="german-keyword"}setContext(e){this.context=e}canExtract(e,t){return Cv(e[t])}extract(e,t){if(!this.context)throw Error("GermanKeywordExtractor: context not set");return this.extractGermanWord(e,t)}extractGermanWord(e,t){if(!this.context)return null;let n=t,r="";for(;e.length>n&&Nv(e[n]);)r+=e[n++];if(!r)return null;const i=r.toLowerCase(),a=Pv.has(i),o=this.context.lookupKeyword(r),s=o&&o.normalized!==o.native?o.normalized:void 0;let l;if(!o&&this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:r,length:n-t,metadata:{normalized:s||l,isPreposition:a}}}}}}),Vv={};gp(Vv,{GermanTokenizer:()=>Iv,germanTokenizer:()=>Mv});var Hv,Fv,Bv,Uv,Gv=vp({"src/tokenizers/german.ts"(){od(),Dp(),_v(),sd(),dy(),Dv(),$v=[{native:"wahr",normalized:"true"},{native:"falsch",normalized:"false"},{native:"null",normalized:"null"},{native:"undefiniert",normalized:"undefined"},{native:"erste",normalized:"first"},{native:"erster",normalized:"first"},{native:"erstes",normalized:"first"},{native:"letzte",normalized:"last"},{native:"letzter",normalized:"last"},{native:"letztes",normalized:"last"},{native:"nächste",normalized:"next"},{native:"nachste",normalized:"next"},{native:"vorherige",normalized:"previous"},{native:"nächste",normalized:"closest"},{native:"eltern",normalized:"parent"},{native:"klick",normalized:"click"},{native:"click",normalized:"click"},{native:"eingabe",normalized:"input"},{native:"änderung",normalized:"change"},{native:"anderung",normalized:"change"},{native:"absenden",normalized:"submit"},{native:"taste unten",normalized:"keydown"},{native:"taste oben",normalized:"keyup"},{native:"maus drüber",normalized:"mouseover"},{native:"maus druber",normalized:"mouseover"},{native:"maus weg",normalized:"mouseout"},{native:"fokus",normalized:"focus"},{native:"unschärfe",normalized:"blur"},{native:"unscharfe",normalized:"blur"},{native:"scrollen",normalized:"scroll"},{native:"meine",normalized:"my"},{native:"meinen",normalized:"my"},{native:"ergebnis",normalized:"result"},{native:"ziel",normalized:"target"},{native:"sekunde",normalized:"s"},{native:"sekunden",normalized:"s"},{native:"millisekunde",normalized:"ms"},{native:"millisekunden",normalized:"ms"},{native:"minute",normalized:"m"},{native:"minuten",normalized:"m"},{native:"stunde",normalized:"h"},{native:"stunden",normalized:"h"},{native:"hinzufugen",normalized:"add"},{native:"hinzufgen",normalized:"add"},{native:"loschen",normalized:"remove"},{native:"anhangen",normalized:"append"},{native:"erhohen",normalized:"increment"},{native:"ubergang",normalized:"transition"},{native:"auslosen",normalized:"trigger"},{native:"zuruckgeben",normalized:"return"},{native:"anschliessend",normalized:"then"},{native:"erhöhe",normalized:"increment"},{native:"erhohe",normalized:"increment"},{native:"verringere",normalized:"decrement"}],Mv=new(Iv=class extends rp{constructor(){super(),this.language="de",this.direction="ltr",this.initializeKeywordsFromProfile(Ip,$v),this.normalizer=new Ov,this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractors([new Rv]),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){return this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}})}}),Wv={};gp(Wv,{IndonesianTokenizer:()=>Bv,indonesianTokenizer:()=>Uv});var Kv,Jv,Zv=vp({"src/tokenizers/indonesian.ts"(){od(),im(),sd(),dy(),Vf(),Hv=new Set(["di","ke","dari","pada","dengan","tanpa","untuk","oleh","antara","sebelum","sesudah","setelah","selama","sampai","hingga","sejak","menuju","tentang","terhadap","melalui","dalam","luar"]),Fv=[{native:"benar",normalized:"true"},{native:"salah",normalized:"false"},{native:"null",normalized:"null"},{native:"kosong",normalized:"null"},{native:"tidakdidefinisikan",normalized:"undefined"},{native:"pertama",normalized:"first"},{native:"terakhir",normalized:"last"},{native:"berikutnya",normalized:"next"},{native:"sebelumnya",normalized:"previous"},{native:"terdekat",normalized:"closest"},{native:"induk",normalized:"parent"},{native:"klik",normalized:"click"},{native:"click",normalized:"click"},{native:"ubah",normalized:"change"},{native:"kirim",normalized:"submit"},{native:"tekan",normalized:"keydown"},{native:"arahkan",normalized:"mouseover"},{native:"tinggalkan",normalized:"mouseout"},{native:"kabur",normalized:"blur"},{native:"muat",normalized:"load"},{native:"gulir",normalized:"scroll"},{native:"input",normalized:"input"},{native:"milik",normalized:"my"},{native:"detik",normalized:"s"},{native:"milidetik",normalized:"ms"},{native:"menit",normalized:"m"},{native:"jam",normalized:"h"},{native:"atau",normalized:"or"},{native:"tidak",normalized:"not"},{native:"adalah",normalized:"is"},{native:"ada",normalized:"exists"}],Uv=new(Bv=class extends rp{constructor(){super(),this.language="id",this.direction="ltr",this.initializeKeywordsFromProfile(em,Fv),this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractors([new Cf]),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){const t=e.toLowerCase();return Hv.has(t)?"particle":this.isKeyword(t)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(e)?"operator":"identifier"}})}});function Yv(e){const t=e.charCodeAt(0);return t>=65&&90>=t||t>=97&&122>=t?1:"ñ"===e||"Ñ"===e||"'"===e||"'"===e}var Xv,Qv,eg,tg,ng,rg=vp({"src/tokenizers/morphology/quechua-normalizer.ts"(){Ey(),Kv=[{pattern:"shankichik",confidence:.8,conjugationType:"progressive",minStemLength:2},{pattern:"shaniku",confidence:.8,conjugationType:"progressive",minStemLength:2},{pattern:"shanki",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"shani",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"shanchik",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"shanku",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"shan",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"rqankichik",confidence:.8,conjugationType:"past",minStemLength:2},{pattern:"rqaniku",confidence:.8,conjugationType:"past",minStemLength:2},{pattern:"rqanki",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"rqani",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"rqanchik",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"rqanku",confidence:.82,conjugationType:"past",minStemLength:2},{pattern:"rqan",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"nqankichik",confidence:.8,conjugationType:"future",minStemLength:2},{pattern:"nqaniku",confidence:.8,conjugationType:"future",minStemLength:2},{pattern:"nqanki",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"nqani",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"nqanchik",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"nqanku",confidence:.82,conjugationType:"future",minStemLength:2},{pattern:"nqa",confidence:.85,conjugationType:"future",minStemLength:2},{pattern:"chikuy",confidence:.8,conjugationType:"compound",minStemLength:2},{pattern:"chiku",confidence:.82,conjugationType:"compound",minStemLength:2},{pattern:"chiy",confidence:.85,conjugationType:"causative",minStemLength:2,replacement:"y"},{pattern:"chiq",confidence:.85,conjugationType:"causative",minStemLength:2,replacement:"y"},{pattern:"chi",confidence:.82,conjugationType:"causative",minStemLength:2},{pattern:"kuy",confidence:.82,conjugationType:"reflexive",minStemLength:2},{pattern:"rqa",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"rqan",confidence:.85,conjugationType:"past",minStemLength:2},{pattern:"sha",confidence:.82,conjugationType:"progressive",minStemLength:2},{pattern:"na",confidence:.85,conjugationType:"obligation",minStemLength:2},{pattern:"manmi",confidence:.8,conjugationType:"potential",minStemLength:2},{pattern:"man",confidence:.8,conjugationType:"potential",minStemLength:2},{pattern:"nkichik",confidence:.8,conjugationType:"present",minStemLength:2},{pattern:"niku",confidence:.8,conjugationType:"present",minStemLength:2},{pattern:"nki",confidence:.82,conjugationType:"present",minStemLength:2},{pattern:"nchik",confidence:.82,conjugationType:"present",minStemLength:2},{pattern:"nku",confidence:.82,conjugationType:"present",minStemLength:2},{pattern:"ni",confidence:.85,conjugationType:"present",minStemLength:2},{pattern:"ku",confidence:.82,conjugationType:"reflexive",minStemLength:2},{pattern:"ychik",confidence:.82,conjugationType:"imperative",minStemLength:2},{pattern:"y",confidence:.9,conjugationType:"dictionary",minStemLength:2},{pattern:"sqa",confidence:.82,conjugationType:"passive",minStemLength:2},{pattern:"ska",confidence:.82,conjugationType:"passive",minStemLength:2},{pattern:"kama",confidence:.7,conjugationType:"dictionary",minStemLength:2},{pattern:"manta",confidence:.7,conjugationType:"dictionary",minStemLength:2},{pattern:"man",confidence:.7,conjugationType:"dictionary",minStemLength:2},{pattern:"wan",confidence:.7,conjugationType:"dictionary",minStemLength:2},{pattern:"pi",confidence:.7,conjugationType:"dictionary",minStemLength:2},{pattern:"ta",confidence:.7,conjugationType:"dictionary",minStemLength:2}],Jv=new class{constructor(){this.language="qu"}isNormalizable(e){return function(e){for(const t of e)if(Yv(t))return 1;return 0}(e)?3>e.length?0:/[aiu]/.test(e.toLowerCase())?1:0:0}normalize(e){const t=e.toLowerCase();for(const e of Kv)if(t.endsWith(e.pattern)){let n=t.slice(0,-e.pattern.length);if(e.replacement&&!n.endsWith(e.replacement)&&(n+=e.replacement),(e.minStemLength??2)>n.length)continue;if(!this.isValidStem(n))continue;const r={removedSuffixes:[e.pattern]};return e.conjugationType&&(r.conjugationType=e.conjugationType),ap(n,e.confidence,r)}return ip(e)}isValidStem(e){return 2>e.length?0:/[aeiou]/.test(e)?new Set(["ta","man","pi","wan","pa","kama","hina"]).has(e)?0:1:0}}}}),ig={};gp(ig,{QuechuaTokenizer:()=>tg,quechuaTokenizer:()=>ng});var ag,og,sg,lg,cg=vp({"src/tokenizers/quechua.ts"(){od(),Sm(),rg(),sd(),dy(),ay(),Xv=class{constructor(){this.name="quechua-string-literal"}canExtract(e,t){return'"'===e[t]}extract(e,t){const n=e[t];let r=n,i=t+1;for(;e.length>i;){const t=e[i];if(t===n)return r+=t,{value:r,length:r.length};"\\"===t&&e.length>i+1?(r+=t+e[i+1],i+=2):(r+=t,i++)}return null}},Qv=new Set(["-ta","-man","-manta","-pi","-wan","-paq","-kama","-rayku","-hina","ta","man","manta","pi","wan","paq","kama","hina","pa"]),eg=[{native:"arí",normalized:"true"},{native:"ari",normalized:"true"},{native:"manan",normalized:"false"},{native:"mana",normalized:"false"},{native:"ch'usaq",normalized:"null"},{native:"chusaq",normalized:"null"},{native:"mana riqsisqa",normalized:"undefined"},{native:"ñawpaq",normalized:"first"},{native:"nawpaq",normalized:"first"},{native:"qhipa",normalized:"last"},{native:"hamuq",normalized:"next"},{native:"ñawpaq kaq",normalized:"previous"},{native:"ñawpaq_kaq",normalized:"previous"},{native:"aswan qayllaqa",normalized:"closest"},{native:"tayta",normalized:"parent"},{native:"llikllay",normalized:"click"},{native:"ñitiy",normalized:"click"},{native:"click",normalized:"click"},{native:"yaykuy",normalized:"input"},{native:"llave uray",normalized:"keydown"},{native:"llave hawa",normalized:"keyup"},{native:"mausiri yayku",normalized:"mouseover"},{native:"mausiri lluqsi",normalized:"mouseout"},{native:"qhaway",normalized:"focus"},{native:"mana qhaway",normalized:"blur"},{native:"kargay",normalized:"load"},{native:"muyuy",normalized:"scroll"},{native:"ñuqa",normalized:"me"},{native:"nuqa",normalized:"me"},{native:"ñuqap",normalized:"my"},{native:"nuqap",normalized:"my"},{native:"chay",normalized:"it"},{native:"chaymi",normalized:"it"},{native:"lluqsiy",normalized:"result"},{native:"ruway",normalized:"event"},{native:"maypi",normalized:"target"},{native:"sikundu",normalized:"s"},{native:"segundu",normalized:"s"},{native:"waranqa sikundu",normalized:"ms"},{native:"minutu",normalized:"m"},{native:"ura",normalized:"h"},{native:"hora",normalized:"h"},{native:"chaypim",normalized:"on"},{native:"kaypi",normalized:"on"},{native:"chayqa",normalized:"then"},{native:"chaymanta",normalized:"then"},{native:"chaymantataq",normalized:"then"},{native:"hinaspa",normalized:"then"},{native:"tukukuy",normalized:"end"},{native:"puchukay",normalized:"end"},{native:"kaykama",normalized:"until"},{native:"yapay",normalized:"add"},{native:"t'ikray",normalized:"toggle"},{native:"tikray",normalized:"toggle"},{native:"qhawachiy",normalized:"focus"},{native:"mana qhawachiy",normalized:"blur"},{native:"-manta",normalized:"from"}],ng=new(tg=class extends rp{constructor(){super(),this.language="qu",this.direction="ltr",this.initializeKeywordsFromProfile(km,eg),this.setNormalizer(Jv),this.registerExtractors(py()),this.registerExtractor(new Xv),this.registerExtractor(new Cc),this.registerExtractor(new Gf),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){const t=e.toLowerCase();return Qv.has(t)?"particle":this.isKeyword(t)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||/^\d/.test(e)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(e)?"operator":"identifier"}})}}),ug={};gp(ug,{SwahiliTokenizer:()=>sg,swahiliTokenizer:()=>lg});var pg,mg,dg,fg,yg,hg,vg=vp({"src/tokenizers/swahili.ts"(){od(),Cm(),sd(),dy(),Hf(),ag=new Set(["kwa","na","katika","kwenye","kutoka","hadi","mpaka","kabla","baada","wakati","bila","kuhusu","karibu","mbele","nyuma","ndani","nje","juu","chini","kati"]),og=[{native:"kweli",normalized:"true"},{native:"uongo",normalized:"false"},{native:"null",normalized:"null"},{native:"tupu",normalized:"null"},{native:"haijafafanuliwa",normalized:"undefined"},{native:"wa kwanza",normalized:"first"},{native:"wa mwisho",normalized:"last"},{native:"ifuatayo",normalized:"next"},{native:"iliyotangulia",normalized:"previous"},{native:"karibu",normalized:"closest"},{native:"mzazi",normalized:"parent"},{native:"bonyeza",normalized:"click"},{native:"click",normalized:"click"},{native:"ganti",normalized:"change"},{native:"wasilisha",normalized:"submit"},{native:"bonyeza kitufe",normalized:"keydown"},{native:"sogeza juu",normalized:"mouseover"},{native:"sogeza nje",normalized:"mouseout"},{native:"fifia",normalized:"blur"},{native:"pakia",normalized:"load"},{native:"sukuma",normalized:"scroll"},{native:"input",normalized:"input"},{native:"yangu",normalized:"my"},{native:"wangu",normalized:"my"},{native:"changu",normalized:"my"},{native:"langu",normalized:"my"},{native:"sekunde",normalized:"s"},{native:"millisekunde",normalized:"ms"},{native:"dakika",normalized:"m"},{native:"saa",normalized:"h"},{native:"au",normalized:"or"},{native:"si",normalized:"not"},{native:"ni",normalized:"is"},{native:"ipo",normalized:"exists"},{native:"tupu",normalized:"empty"}],lg=new(sg=class extends rp{constructor(){super(),this.language="sw",this.direction="ltr",this.initializeKeywordsFromProfile(jm,og),this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractors([new $f]),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){const t=e.toLowerCase();return ag.has(t)?"particle":this.isKeyword(t)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(e)?"operator":"identifier"}})}});function gg(e){return/[àèéìíîòóùúÀÈÉÌÍÎÒÓÙÚ]/.test(e)}var bg,wg,kg,zg,xg,Eg,Sg=vp({"src/tokenizers/morphology/italian-normalizer.ts"(){Ey(),pg=["si","mi","ti","ci","vi"],mg=[{ending:"ando",stem:"are",confidence:.88,type:"gerund"},{ending:"ato",stem:"are",confidence:.88,type:"participle"},{ending:"ata",stem:"are",confidence:.88,type:"participle"},{ending:"ati",stem:"are",confidence:.88,type:"participle"},{ending:"ate",stem:"are",confidence:.88,type:"participle"},{ending:"o",stem:"are",confidence:.75,type:"present"},{ending:"i",stem:"are",confidence:.72,type:"present"},{ending:"a",stem:"are",confidence:.75,type:"present"},{ending:"iamo",stem:"are",confidence:.85,type:"present"},{ending:"ate",stem:"are",confidence:.85,type:"present"},{ending:"ano",stem:"are",confidence:.85,type:"present"},{ending:"avo",stem:"are",confidence:.88,type:"past"},{ending:"avi",stem:"are",confidence:.88,type:"past"},{ending:"ava",stem:"are",confidence:.88,type:"past"},{ending:"avamo",stem:"are",confidence:.88,type:"past"},{ending:"avate",stem:"are",confidence:.88,type:"past"},{ending:"avano",stem:"are",confidence:.88,type:"past"},{ending:"ai",stem:"are",confidence:.85,type:"past"},{ending:"asti",stem:"are",confidence:.88,type:"past"},{ending:"ò",stem:"are",confidence:.85,type:"past"},{ending:"ammo",stem:"are",confidence:.88,type:"past"},{ending:"aste",stem:"are",confidence:.88,type:"past"},{ending:"arono",stem:"are",confidence:.88,type:"past"},{ending:"i",stem:"are",confidence:.72,type:"subjunctive"},{ending:"ino",stem:"are",confidence:.82,type:"subjunctive"},{ending:"a",stem:"are",confidence:.75,type:"imperative"},{ending:"are",stem:"are",confidence:.92,type:"dictionary"}],dg=[{ending:"endo",stem:"ere",confidence:.88,type:"gerund"},{ending:"uto",stem:"ere",confidence:.85,type:"participle"},{ending:"uta",stem:"ere",confidence:.85,type:"participle"},{ending:"uti",stem:"ere",confidence:.85,type:"participle"},{ending:"ute",stem:"ere",confidence:.85,type:"participle"},{ending:"o",stem:"ere",confidence:.72,type:"present"},{ending:"i",stem:"ere",confidence:.72,type:"present"},{ending:"e",stem:"ere",confidence:.72,type:"present"},{ending:"iamo",stem:"ere",confidence:.85,type:"present"},{ending:"ete",stem:"ere",confidence:.85,type:"present"},{ending:"ono",stem:"ere",confidence:.82,type:"present"},{ending:"evo",stem:"ere",confidence:.88,type:"past"},{ending:"evi",stem:"ere",confidence:.88,type:"past"},{ending:"eva",stem:"ere",confidence:.88,type:"past"},{ending:"evamo",stem:"ere",confidence:.88,type:"past"},{ending:"evate",stem:"ere",confidence:.88,type:"past"},{ending:"evano",stem:"ere",confidence:.88,type:"past"},{ending:"ei",stem:"ere",confidence:.85,type:"past"},{ending:"etti",stem:"ere",confidence:.85,type:"past"},{ending:"esti",stem:"ere",confidence:.88,type:"past"},{ending:"é",stem:"ere",confidence:.85,type:"past"},{ending:"ette",stem:"ere",confidence:.85,type:"past"},{ending:"emmo",stem:"ere",confidence:.88,type:"past"},{ending:"este",stem:"ere",confidence:.88,type:"past"},{ending:"erono",stem:"ere",confidence:.88,type:"past"},{ending:"ettero",stem:"ere",confidence:.88,type:"past"},{ending:"ere",stem:"ere",confidence:.92,type:"dictionary"}],fg=[{ending:"endo",stem:"ire",confidence:.85,type:"gerund"},{ending:"ito",stem:"ire",confidence:.85,type:"participle"},{ending:"ita",stem:"ire",confidence:.85,type:"participle"},{ending:"iti",stem:"ire",confidence:.85,type:"participle"},{ending:"ite",stem:"ire",confidence:.85,type:"participle"},{ending:"o",stem:"ire",confidence:.7,type:"present"},{ending:"i",stem:"ire",confidence:.7,type:"present"},{ending:"e",stem:"ire",confidence:.7,type:"present"},{ending:"iamo",stem:"ire",confidence:.85,type:"present"},{ending:"ite",stem:"ire",confidence:.85,type:"present"},{ending:"ono",stem:"ire",confidence:.78,type:"present"},{ending:"isco",stem:"ire",confidence:.85,type:"present"},{ending:"isci",stem:"ire",confidence:.85,type:"present"},{ending:"isce",stem:"ire",confidence:.85,type:"present"},{ending:"iscono",stem:"ire",confidence:.88,type:"present"},{ending:"ivo",stem:"ire",confidence:.88,type:"past"},{ending:"ivi",stem:"ire",confidence:.88,type:"past"},{ending:"iva",stem:"ire",confidence:.88,type:"past"},{ending:"ivamo",stem:"ire",confidence:.88,type:"past"},{ending:"ivate",stem:"ire",confidence:.88,type:"past"},{ending:"ivano",stem:"ire",confidence:.88,type:"past"},{ending:"ii",stem:"ire",confidence:.85,type:"past"},{ending:"isti",stem:"ire",confidence:.88,type:"past"},{ending:"ì",stem:"ire",confidence:.85,type:"past"},{ending:"immo",stem:"ire",confidence:.88,type:"past"},{ending:"iste",stem:"ire",confidence:.88,type:"past"},{ending:"irono",stem:"ire",confidence:.88,type:"past"},{ending:"ire",stem:"ire",confidence:.92,type:"dictionary"}],yg=[...mg,...dg,...fg].sort((e,t)=>t.ending.length-e.ending.length),new(hg=class{constructor(){this.language="it"}isNormalizable(e){return 3>e.length?0:function(e){const t=e.toLowerCase();if(t.endsWith("are")||t.endsWith("ere")||t.endsWith("ire"))return 1;if(t.endsWith("ando")||t.endsWith("endo"))return 1;if(t.endsWith("ato")||t.endsWith("uto")||t.endsWith("ito"))return 1;if(t.endsWith("arsi")||t.endsWith("ersi")||t.endsWith("irsi"))return 1;for(const t of e)if(gg(t))return 1;return 0}(e)}normalize(e){const t=e.toLowerCase();if((t.endsWith("are")||t.endsWith("ere")||t.endsWith("ire"))&&!pg.some(e=>t.endsWith(e+"are")||t.endsWith(e+"ere")||t.endsWith(e+"ire")))return ip(e);const n=this.tryReflexiveNormalization(t);return n||(this.tryConjugationNormalization(t)||ip(e))}tryReflexiveNormalization(e){for(const t of pg)if(e.endsWith(t)){const n=e.slice(0,-t.length);if(n.endsWith("ar")||n.endsWith("er")||n.endsWith("ir"))return ap(n+"e",.88,{removedSuffixes:[t],conjugationType:"reflexive"});if(n.endsWith("are")||n.endsWith("ere")||n.endsWith("ire"))return ap(n,.88,{removedSuffixes:[t],conjugationType:"reflexive"});const r=this.tryConjugationNormalization(n);if(r&&r.stem!==n)return ap(r.stem,.95*r.confidence,{removedSuffixes:[t,...r.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}tryConjugationNormalization(e){for(const t of yg)if(e.endsWith(t.ending)){const n=e.slice(0,-t.ending.length);if(2>n.length)continue;return ap(n+t.stem,t.confidence,{removedSuffixes:[t.ending],conjugationType:t.type})}return null}})}}),Tg=vp({"src/tokenizers/extractors/romance-language-keyword.ts"(){bg=class{constructor(e,t,n){this.name=e;const r=(i=t,{isLetter:e=>i.test(e),isIdentifierChar:e=>/[0-9]/.test(e)||i.test(e)});var i;this.isLetter=r.isLetter,this.isIdentifierChar=r.isIdentifierChar,this.prepositions=n}setContext(e){this.context=e}canExtract(e,t){return this.isLetter(e[t])}extract(e,t){if(!this.context)throw Error(this.name+": context not set");let n=t,r="";for(;e.length>n&&this.isIdentifierChar(e[n]);)r+=e[n++];if(!r)return null;const i=r.toLowerCase(),a=this.prepositions.has(i),o=this.context.lookupKeyword(i),s=o&&o.normalized!==o.native?o.normalized:void 0;let l;if(!o&&this.context.normalizer){const e=this.context.normalizer.normalize(r);if(e.stem!==r&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:r,length:n-t,metadata:{normalized:s||l,isPreposition:a}}}},wg=new Set(["in","a","di","da","con","su","per","tra","fra","dopo","prima","dentro","fuori","sopra","sotto","al","allo","alla","ai","agli","alle","del","dello","della","dei","degli","delle","dal","dallo","dalla","dai","dagli","dalle","nel","nello","nella","nei","negli","nelle","sul","sullo","sulla","sui","sugli","sulle"])}}),jg={};gp(jg,{ItalianTokenizer:()=>xg,italianTokenizer:()=>Eg});var Ag,Lg,Og,Cg=vp({"src/tokenizers/italian.ts"(){od(),Sg(),sm(),sd(),dy(),Tg(),kg=new Set(["in","a","di","da","con","su","per","tra","fra","dopo","prima","dentro","fuori","sopra","sotto","al","allo","alla","ai","agli","alle","del","dello","della","dei","degli","delle","dal","dallo","dalla","dai","dagli","dalle","nel","nello","nella","nei","negli","nelle","sul","sullo","sulla","sui","sugli","sulle"]),zg=[{native:"vero",normalized:"true"},{native:"falso",normalized:"false"},{native:"nullo",normalized:"null"},{native:"indefinito",normalized:"undefined"},{native:"primo",normalized:"first"},{native:"prima",normalized:"first"},{native:"ultimo",normalized:"last"},{native:"ultima",normalized:"last"},{native:"prossimo",normalized:"next"},{native:"successivo",normalized:"next"},{native:"precedente",normalized:"previous"},{native:"vicino",normalized:"closest"},{native:"padre",normalized:"parent"},{native:"clic",normalized:"click"},{native:"click",normalized:"click"},{native:"fare clic",normalized:"click"},{native:"input",normalized:"input"},{native:"cambio",normalized:"change"},{native:"invio",normalized:"submit"},{native:"tasto giù",normalized:"keydown"},{native:"tasto su",normalized:"keyup"},{native:"mouse sopra",normalized:"mouseover"},{native:"mouse fuori",normalized:"mouseout"},{native:"fuoco",normalized:"focus"},{native:"sfuocatura",normalized:"blur"},{native:"caricamento",normalized:"load"},{native:"scorrimento",normalized:"scroll"},{native:"io",normalized:"me"},{native:"me",normalized:"me"},{native:"destinazione",normalized:"target"},{native:"secondo",normalized:"s"},{native:"secondi",normalized:"s"},{native:"millisecondo",normalized:"ms"},{native:"millisecondi",normalized:"ms"},{native:"minuto",normalized:"m"},{native:"minuti",normalized:"m"},{native:"ora",normalized:"h"},{native:"ore",normalized:"h"},{native:"fino a",normalized:"until"},{native:"prima di",normalized:"before"},{native:"dopo di",normalized:"after"},{native:"dentro di",normalized:"into"},{native:"fuori di",normalized:"out"},{native:"aggiungere",normalized:"add"},{native:"aggiungi",normalized:"add"},{native:"rimuovi",normalized:"remove"},{native:"elimina",normalized:"remove"},{native:"togli",normalized:"remove"},{native:"metti",normalized:"put"},{native:"inserisci",normalized:"put"},{native:"prendi",normalized:"take"},{native:"fai",normalized:"make"},{native:"crea",normalized:"make"},{native:"clona",normalized:"clone"},{native:"copia",normalized:"clone"},{native:"imposta",normalized:"set"},{native:"ottieni",normalized:"get"},{native:"incrementa",normalized:"increment"},{native:"aumenta",normalized:"increment"},{native:"decrementa",normalized:"decrement"},{native:"diminuisci",normalized:"decrement"},{native:"registra",normalized:"log"},{native:"mostra",normalized:"show"},{native:"visualizza",normalized:"show"},{native:"nascondi",normalized:"hide"},{native:"anima",normalized:"transition"},{native:"scatena",normalized:"trigger"},{native:"attiva",normalized:"trigger"},{native:"invia",normalized:"send"},{native:"focalizza",normalized:"focus"},{native:"sfuoca",normalized:"blur"},{native:"vai",normalized:"go"},{native:"naviga",normalized:"go"},{native:"aspetta",normalized:"wait"},{native:"attendi",normalized:"wait"},{native:"recupera",normalized:"fetch"},{native:"stabilizza",normalized:"settle"},{native:"ripeti",normalized:"repeat"},{native:"continua",normalized:"continue"},{native:"ferma",normalized:"halt"},{native:"lancia",normalized:"throw"},{native:"chiama",normalized:"call"},{native:"ritorna",normalized:"return"},{native:"inizializza",normalized:"init"},{native:"installa",normalized:"install"},{native:"misura",normalized:"measure"},{native:"e",normalized:"and"},{native:"o",normalized:"or"},{native:"non",normalized:"not"},{native:"è",normalized:"is"},{native:"esiste",normalized:"exists"},{native:"vuoto",normalized:"empty"},{native:"toggle",normalized:"toggle"},{native:"di",normalized:"tell"}],Eg=new(xg=class extends rp{constructor(){super(),this.language="it",this.direction="ltr",this.initializeKeywordsFromProfile(rm,zg),this.setNormalizer(new hg),this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractors([new bg("italian-keyword",/[a-zA-ZàèéìíîòóùúÀÈÉÌÍÎÒÓÙÚ]/,wg)]),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){const t=e.toLowerCase();return kg.has(t)?"particle":this.isKeyword(t)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(e)?"operator":"identifier"}})}}),Ng={};gp(Ng,{VietnameseTokenizer:()=>Lg,vietnameseTokenizer:()=>Og});var Pg,Rg,$g,Ig,Mg,qg,_g=vp({"src/tokenizers/vietnamese.ts"(){od(),Gm(),Zd(),sd(),dy(),Ag=[{native:"đúng",normalized:"true"},{native:"sai",normalized:"false"},{native:"null",normalized:"null"},{native:"không xác định",normalized:"undefined"},{native:"đầu tiên",normalized:"first"},{native:"cuối cùng",normalized:"last"},{native:"tiếp theo",normalized:"next"},{native:"trước đó",normalized:"previous"},{native:"gần nhất",normalized:"closest"},{native:"cha",normalized:"parent"},{native:"nhấp",normalized:"click"},{native:"nhấp chuột",normalized:"click"},{native:"click",normalized:"click"},{native:"nhấp đúp",normalized:"dblclick"},{native:"nhập",normalized:"input"},{native:"thay đổi",normalized:"change"},{native:"gửi biểu mẫu",normalized:"submit"},{native:"phím xuống",normalized:"keydown"},{native:"phím lên",normalized:"keyup"},{native:"chuột vào",normalized:"mouseover"},{native:"chuột ra",normalized:"mouseout"},{native:"tải trang",normalized:"load"},{native:"cuộn",normalized:"scroll"},{native:"của tôi",normalized:"my"},{native:"của nó",normalized:"its"},{native:"giây",normalized:"s"},{native:"mili giây",normalized:"ms"},{native:"phút",normalized:"m"},{native:"giờ",normalized:"h"},{native:"thêm vào cuối",normalized:"append"},{native:"nhân bản",normalized:"clone"},{native:"tạo ra",normalized:"make"},{native:"đặt giá trị",normalized:"set"},{native:"ghi nhật ký",normalized:"log"},{native:"chuyển tới",normalized:"go"},{native:"ngược lại",normalized:"else"},{native:"lặp",normalized:"repeat"},{native:"hoặc",normalized:"or"},{native:"không",normalized:"not"},{native:"là",normalized:"is"},{native:"tồn tại",normalized:"exists"},{native:"rỗng",normalized:"empty"},{native:"javascript",normalized:"js"}],Og=new(Lg=class extends rp{constructor(){super(),this.language="vi",this.direction="ltr",this.initializeKeywordsFromProfile(Hm,Ag),this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractors([new Rd]),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){const t=e.toLowerCase();return this.isKeyword(t)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(e)?"operator":"identifier"}})}}),Dg=vp({"src/tokenizers/morphology/polish-normalizer.ts"(){Ey(),Pg=new Map([["przełącz","przełączać"],["przelacz","przelaczac"],["dodaj","dodawać"],["usuń","usuwać"],["usun","usuwac"],["umieść","umieszczać"],["umiesc","umieszczac"],["wstaw","wstawiać"],["ustaw","ustawiać"],["pobierz","pobierać"],["weź","brać"],["wez","brac"],["zwiększ","zwiększać"],["zwieksz","zwiekszac"],["zmniejsz","zmniejszać"],["pokaż","pokazywać"],["pokaz","pokazywac"],["ukryj","ukrywać"],["schowaj","schowywać"],["czekaj","czekać"],["poczekaj","poczekać"],["idź","iść"],["idz","isc"],["przejdź","przejść"],["przejdz","przejsc"],["wywołaj","wywoływać"],["wywolaj","wywolywac"],["wyślij","wysyłać"],["wyslij","wysylac"],["loguj","logować"],["wypisz","wypisywać"],["sklonuj","sklonować"],["kopiuj","kopiować"],["zamień","zamieniać"],["zamien","zamieniac"],["utwórz","tworzyć"],["utworz","tworzyc"],["stwórz","stwarzać"],["stworz","stwarzac"],["skup","skupiać"],["rozmyj","rozmywać"],["nawiguj","nawigować"],["załaduj","ładować"],["zaladuj","ladowac"],["powtórz","powtarzać"],["powtorz","powtarzac"],["kontynuuj","kontynuować"],["zatrzymaj","zatrzymywać"],["przerwij","przerywać"],["rzuć","rzucać"],["rzuc","rzucac"],["zwróć","zwracać"],["zwroc","zwracac"],["inicjuj","inicjować"],["zainstaluj","instalować"],["zmierz","mierzyć"]]),new(Rg=class{constructor(){this.language="pl"}isNormalizable(e){return 3>e.length?0:/[a-zA-ZąęćńóśźżłĄĘĆŃÓŚŹŻŁ]/.test(e)}normalize(e){const t=e.toLowerCase();if(this.isInfinitive(t))return ip(t);const n=this.tryImperativeNormalization(t);if(n)return n;const r=this.tryPastTenseNormalization(t);return r||(this.tryPresentTenseNormalization(t)||ip(t))}isInfinitive(e){return["ać","eć","ić","yć","ąć","ować","iwać","ywać"].some(t=>e.endsWith(t))}tryImperativeNormalization(e){return Pg.has(e)?ap(Pg.get(e),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):e.endsWith("aj")?ap(e.slice(0,-2)+"ać",.8,{removedSuffixes:["aj"],conjugationType:"imperative"}):e.endsWith("uj")?ap(e.slice(0,-2)+"ować",.8,{removedSuffixes:["uj"],conjugationType:"imperative"}):e.endsWith("ij")?ap(e.slice(0,-2)+"ić",.75,{removedSuffixes:["ij"],conjugationType:"imperative"}):null}tryPresentTenseNormalization(e){return e.endsWith("uję")||e.endsWith("uje")?ap(e.slice(0,-3)+"ować",.85,{removedSuffixes:["uję"],conjugationType:"present"}):e.endsWith("am")&&e.length>3?ap(e.slice(0,-2)+"ać",.8,{removedSuffixes:["am"],conjugationType:"present"}):e.endsWith("em")&&e.length>3?ap(e.slice(0,-2)+"eć",.75,{removedSuffixes:["em"],conjugationType:"present"}):e.endsWith("ę")&&e.length>2?ap(e.slice(0,-1)+"ać",.7,{removedSuffixes:["ę"],conjugationType:"present"}):null}tryPastTenseNormalization(e){if(e.endsWith("ałem")||e.endsWith("ałam"))return ap(e.slice(0,-4)+"ać",.85,{removedSuffixes:[e.slice(-4)],conjugationType:"past"});if(e.endsWith("ał")||e.endsWith("ała")){const t=e.endsWith("ała")?3:2;return ap(e.slice(0,-t)+"ać",.8,{removedSuffixes:[e.slice(-t)],conjugationType:"past"})}if(e.endsWith("iłem")||e.endsWith("iłam")||e.endsWith("ilem")||e.endsWith("ilam"))return ap(e.slice(0,-4)+"ić",.85,{removedSuffixes:[e.slice(-4)],conjugationType:"past"});if(e.endsWith("ił")||e.endsWith("iła")||e.endsWith("il")||e.endsWith("ila")){const t=e.endsWith("iła")||e.endsWith("ila")?3:2;return ap(e.slice(0,-t)+"ić",.8,{removedSuffixes:[e.slice(-t)],conjugationType:"past"})}return null}})}}),Vg={};gp(Vg,{PolishTokenizer:()=>Mg,polishTokenizer:()=>qg});var Hg,Fg,Bg=vp({"src/tokenizers/polish.ts"(){od(),bm(),Dg(),sd(),dy(),Df(),$g=new Set(["do","od","z","ze","w","we","na","po","pod","przed","za","nad","między","miedzy","przez","dla","bez","o","przy","u","według","wedlug","mimo","wśród","wsrod","obok","poza","wokół","wokol","przeciw","ku"]),Ig=[{native:"prawda",normalized:"true"},{native:"fałsz",normalized:"false"},{native:"falsz",normalized:"false"},{native:"null",normalized:"null"},{native:"nieokreślony",normalized:"undefined"},{native:"nieokreslony",normalized:"undefined"},{native:"pierwszy",normalized:"first"},{native:"pierwsza",normalized:"first"},{native:"pierwsze",normalized:"first"},{native:"ostatni",normalized:"last"},{native:"ostatnia",normalized:"last"},{native:"ostatnie",normalized:"last"},{native:"następny",normalized:"next"},{native:"nastepny",normalized:"next"},{native:"poprzedni",normalized:"previous"},{native:"najbliższy",normalized:"closest"},{native:"najblizszy",normalized:"closest"},{native:"rodzic",normalized:"parent"},{native:"kliknięcie",normalized:"click"},{native:"klikniecie",normalized:"click"},{native:"klik",normalized:"click"},{native:"click",normalized:"click"},{native:"zmiana",normalized:"change"},{native:"wysłanie",normalized:"submit"},{native:"wyslanie",normalized:"submit"},{native:"naciśnięcie",normalized:"keydown"},{native:"nacisniecie",normalized:"keydown"},{native:"klawisz",normalized:"keydown"},{native:"najechanie",normalized:"mouseover"},{native:"zjechanie",normalized:"mouseout"},{native:"rozmycie",normalized:"blur"},{native:"załadowanie",normalized:"load"},{native:"zaladowanie",normalized:"load"},{native:"przewinięcie",normalized:"scroll"},{native:"przewiniecie",normalized:"scroll"},{native:"input",normalized:"input"},{native:"mój",normalized:"my"},{native:"moj",normalized:"my"},{native:"sekunda",normalized:"s"},{native:"sekundy",normalized:"s"},{native:"sekund",normalized:"s"},{native:"milisekunda",normalized:"ms"},{native:"milisekundy",normalized:"ms"},{native:"milisekund",normalized:"ms"},{native:"minuta",normalized:"m"},{native:"minuty",normalized:"m"},{native:"minut",normalized:"m"},{native:"godzina",normalized:"h"},{native:"godziny",normalized:"h"},{native:"godzin",normalized:"h"},{native:"połóż",normalized:"put"},{native:"poloz",normalized:"put"},{native:"lub",normalized:"or"},{native:"nie",normalized:"not"},{native:"jest",normalized:"is"},{native:"istnieje",normalized:"exists"},{native:"pusty",normalized:"empty"},{native:"puste",normalized:"empty"}],qg=new(Mg=class extends rp{constructor(){super(),this.language="pl",this.direction="ltr",this.initializeKeywordsFromProfile(ym,Ig),this.setNormalizer(new Rg),this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractors([new jf]),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){const t=e.toLowerCase();return $g.has(t)?"particle":this.isKeyword(t)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(e)?"operator":"identifier"}})}});function Ug(e){return/[а-яА-ЯёЁ]/.test(e)}var Gg,Wg,Kg,Jg,Zg=vp({"src/tokenizers/morphology/russian-normalizer.ts"(){Ey(),Hg=new Map([["переключи","переключить"],["добавь","добавить"],["удали","удалить"],["убери","убрать"],["положи","положить"],["помести","поместить"],["вставь","вставить"],["возьми","взять"],["создай","создать"],["клонируй","клонировать"],["поменяй","поменять"],["трансформируй","трансформировать"],["установи","установить"],["задай","задать"],["получи","получить"],["увеличь","увеличить"],["уменьши","уменьшить"],["запиши","записать"],["покажи","показать"],["скрой","скрыть"],["спрячь","спрятать"],["анимируй","анимировать"],["вызови","вызвать"],["отправь","отправить"],["сфокусируй","сфокусировать"],["размой","размыть"],["перейди","перейти"],["иди","идти"],["жди","ждать"],["подожди","подождать"],["загрузи","загрузить"],["повтори","повторить"],["продолжи","продолжить"],["брось","бросить"],["верни","вернуть"],["скажи","сказать"],["инициализируй","инициализировать"],["измерь","измерить"]]),new(Fg=class{constructor(){this.language="ru"}isNormalizable(e){return 3>e.length?0:function(e){for(const t of e)if(Ug(t))return 1;return 0}(e)}normalize(e){const t=e.toLowerCase();if(t.endsWith("ся")||t.endsWith("сь")){const e=this.tryReflexiveNormalization(t);if(e)return e}if(t.endsWith("ть")||t.endsWith("ти")||t.endsWith("чь"))return ip(e);const n=this.tryImperativeLookup(t);if(n)return n;const r=this.tryPastTenseNormalization(t);if(r)return r;const i=this.tryPresentTenseNormalization(t);return i||(this.tryGenericImperativeNormalization(t)||ip(e))}tryReflexiveNormalization(e){e.endsWith("ся");const t=e.slice(0,-2);if(e.endsWith("ться")||e.endsWith("тись")||e.endsWith("чься"))return ip(e);const n=this.normalizeNonReflexive(t);return 1>n.confidence?ap(n.stem.endsWith("ть")?n.stem.slice(0,-2)+"ться":n.stem+"ся",.95*n.confidence,{removedSuffixes:["ся",...n.metadata?.removedSuffixes||[]],conjugationType:"reflexive"}):null}normalizeNonReflexive(e){if(e.endsWith("ть")||e.endsWith("ти")||e.endsWith("чь"))return ip(e);const t=this.tryImperativeLookup(e);if(t)return t;const n=this.tryPastTenseNormalization(e);if(n)return n;const r=this.tryPresentTenseNormalization(e);return r||(this.tryGenericImperativeNormalization(e)||ip(e))}tryImperativeLookup(e){return Hg.has(e)?ap(Hg.get(e),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(e){return e.endsWith("йте")&&e.length>5?ap(e.slice(0,-3)+"ть",.8,{removedSuffixes:["йте"],conjugationType:"imperative"}):e.endsWith("ите")&&e.length>5?ap(e.slice(0,-3)+"ить",.8,{removedSuffixes:["ите"],conjugationType:"imperative"}):e.endsWith("й")&&e.length>3?ap(e.slice(0,-1)+"ть",.75,{removedSuffixes:["й"],conjugationType:"imperative"}):e.endsWith("и")&&e.length>3?ap(e+"ть",.7,{removedSuffixes:["и→ить"],conjugationType:"imperative"}):null}tryPastTenseNormalization(e){return e.endsWith("ала")&&e.length>4?ap(e.slice(0,-3)+"ать",.85,{removedSuffixes:["ала"],conjugationType:"past"}):e.endsWith("ила")&&e.length>4?ap(e.slice(0,-3)+"ить",.85,{removedSuffixes:["ила"],conjugationType:"past"}):e.endsWith("ело")&&e.length>4?ap(e.slice(0,-3)+"еть",.82,{removedSuffixes:["ело"],conjugationType:"past"}):e.endsWith("або")&&e.length>4?ap(e.slice(0,-3)+"ать",.82,{removedSuffixes:["або"],conjugationType:"past"}):e.endsWith("али")&&e.length>4?ap(e.slice(0,-3)+"ать",.85,{removedSuffixes:["али"],conjugationType:"past"}):e.endsWith("или")&&e.length>4?ap(e.slice(0,-3)+"ить",.85,{removedSuffixes:["или"],conjugationType:"past"}):e.endsWith("ал")&&e.length>3?ap(e.slice(0,-2)+"ать",.82,{removedSuffixes:["ал"],conjugationType:"past"}):e.endsWith("ил")&&e.length>3?ap(e.slice(0,-2)+"ить",.82,{removedSuffixes:["ил"],conjugationType:"past"}):null}tryPresentTenseNormalization(e){return e.endsWith("ишь")&&e.length>4?ap(e.slice(0,-3)+"ить",.8,{removedSuffixes:["ишь"],conjugationType:"present"}):e.endsWith("ит")&&e.length>3?ap(e.slice(0,-2)+"ить",.78,{removedSuffixes:["ит"],conjugationType:"present"}):e.endsWith("им")&&e.length>3?ap(e.slice(0,-2)+"ить",.78,{removedSuffixes:["им"],conjugationType:"present"}):e.endsWith("ят")&&e.length>3?ap(e.slice(0,-2)+"ить",.78,{removedSuffixes:["ят"],conjugationType:"present"}):e.endsWith("ешь")&&e.length>4?ap(e.slice(0,-3)+"ать",.75,{removedSuffixes:["ешь"],conjugationType:"present"}):e.endsWith("ет")&&e.length>3?ap(e.slice(0,-2)+"ать",.72,{removedSuffixes:["ет"],conjugationType:"present"}):e.endsWith("ем")&&e.length>3?ap(e.slice(0,-2)+"ать",.72,{removedSuffixes:["ем"],conjugationType:"present"}):e.endsWith("ют")&&e.length>3?ap(e.slice(0,-2)+"ать",.75,{removedSuffixes:["ют"],conjugationType:"present"}):e.endsWith("ут")&&e.length>3?ap(e.slice(0,-2)+"ать",.72,{removedSuffixes:["ут"],conjugationType:"present"}):null}})}}),Yg={};gp(Yg,{RussianTokenizer:()=>Kg,russianTokenizer:()=>Jg});var Xg,Qg,eb,tb,nb,rb,ib=vp({"src/tokenizers/russian.ts"(){od(),Zg(),Am(),sd(),dy(),ef(),cy(),Gg=new Set(["в","во","на","с","со","к","ко","о","об","обо","у","от","до","из","за","по","под","над","перед","передо","между","через","без","для","при","про","после","вокруг","против","вместо","кроме","среди"]),Wg=[{native:"истина",normalized:"true"},{native:"правда",normalized:"true"},{native:"ложь",normalized:"false"},{native:"null",normalized:"null"},{native:"неопределено",normalized:"undefined"},{native:"секунда",normalized:"s"},{native:"секунды",normalized:"s"},{native:"секунд",normalized:"s"},{native:"миллисекунда",normalized:"ms"},{native:"миллисекунды",normalized:"ms"},{native:"миллисекунд",normalized:"ms"},{native:"минута",normalized:"m"},{native:"минуты",normalized:"m"},{native:"минут",normalized:"m"},{native:"час",normalized:"h"},{native:"часа",normalized:"h"},{native:"часов",normalized:"h"},{native:"первая",normalized:"first"},{native:"первое",normalized:"first"},{native:"последняя",normalized:"last"},{native:"последнее",normalized:"last"},{native:"следующая",normalized:"next"},{native:"предыдущая",normalized:"previous"},{native:"пустая",normalized:"empty"},{native:"пустое",normalized:"empty"},{native:"моя",normalized:"my"},{native:"моё",normalized:"my"},{native:"мои",normalized:"my"}],Jg=new(Kg=class extends rp{constructor(){super(),this.language="ru",this.direction="ltr",this.initializeKeywordsFromProfile(Em,Wg),this.setNormalizer(new Fg),this.registerExtractors([...py(),new Bd("russian-keyword",/[a-zA-Zа-яА-ЯёЁ]/,Ud),new Oc,new Cc,new iy,new Jm,new Zm])}classifyToken(e){const t=e.toLowerCase();return Gg.has(t)?"particle":this.isKeyword(t)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}})}}),ab=vp({"src/tokenizers/morphology/ukrainian-normalizer.ts"(){Ey(),Xg=new Map([["перемкни","перемкнути"],["додай","додати"],["видали","видалити"],["прибери","прибрати"],["поклади","покласти"],["помісти","помістити"],["встав","вставити"],["візьми","взяти"],["створи","створити"],["клонуй","клонувати"],["поміняй","поміняти"],["трансформуй","трансформувати"],["встанови","встановити"],["задай","задати"],["отримай","отримати"],["збільш","збільшити"],["зменш","зменшити"],["запиши","записати"],["покажи","показати"],["сховай","сховати"],["приховай","приховати"],["анімуй","анімувати"],["виклич","викликати"],["надішли","надіслати"],["сфокусуй","сфокусувати"],["розфокусуй","розфокусувати"],["перейди","перейти"],["йди","йти"],["чекай","чекати"],["зачекай","зачекати"],["завантаж","завантажити"],["повтори","повторити"],["продовжуй","продовжити"],["кинь","кинути"],["поверни","повернути"],["скажи","сказати"],["ініціалізуй","ініціалізувати"],["виміряй","виміряти"]]),new(Qg=class{constructor(){this.language="uk"}isNormalizable(e){return 3>e.length?0:function(e){return/[а-яА-ЯіІїЇєЄґҐьЬ']/.test(e)}(e)}normalize(e){const t=e.toLowerCase();if(t.endsWith("ся")||t.endsWith("сь")){const e=this.tryReflexiveNormalization(t);if(e)return e}if(t.endsWith("ти")||t.endsWith("чи"))return ip(e);const n=this.tryImperativeLookup(t);if(n)return n;const r=this.tryPastTenseNormalization(t);if(r)return r;const i=this.tryPresentTenseNormalization(t);return i||(this.tryGenericImperativeNormalization(t)||ip(e))}tryReflexiveNormalization(e){const t=e.slice(0,-2);if(e.endsWith("тися")||e.endsWith("чися"))return ip(e);const n=this.normalizeNonReflexive(t);return 1>n.confidence?ap(n.stem.endsWith("ти")?n.stem.slice(0,-2)+"тися":n.stem+"ся",.95*n.confidence,{removedSuffixes:["ся",...n.metadata?.removedSuffixes||[]],conjugationType:"reflexive"}):null}normalizeNonReflexive(e){if(e.endsWith("ти")||e.endsWith("чи"))return ip(e);const t=this.tryImperativeLookup(e);if(t)return t;const n=this.tryPastTenseNormalization(e);if(n)return n;const r=this.tryPresentTenseNormalization(e);return r||(this.tryGenericImperativeNormalization(e)||ip(e))}tryImperativeLookup(e){return Xg.has(e)?ap(Xg.get(e),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(e){return e.endsWith("йте")&&e.length>5?ap(e.slice(0,-3)+"ти",.8,{removedSuffixes:["йте"],conjugationType:"imperative"}):e.endsWith("іть")&&e.length>5?ap(e.slice(0,-3)+"ити",.8,{removedSuffixes:["іть"],conjugationType:"imperative"}):e.endsWith("й")&&e.length>3?ap(e.slice(0,-1)+"ти",.75,{removedSuffixes:["й"],conjugationType:"imperative"}):e.endsWith("и")&&e.length>3?ap(e+"ти",.7,{removedSuffixes:["и→ити"],conjugationType:"imperative"}):null}tryPastTenseNormalization(e){return e.endsWith("ала")&&e.length>4?ap(e.slice(0,-3)+"ати",.85,{removedSuffixes:["ала"],conjugationType:"past"}):e.endsWith("ила")&&e.length>4?ap(e.slice(0,-3)+"ити",.85,{removedSuffixes:["ила"],conjugationType:"past"}):e.endsWith("али")&&e.length>4?ap(e.slice(0,-3)+"ати",.85,{removedSuffixes:["али"],conjugationType:"past"}):e.endsWith("или")&&e.length>4?ap(e.slice(0,-3)+"ити",.85,{removedSuffixes:["или"],conjugationType:"past"}):e.endsWith("ав")&&e.length>3?ap(e.slice(0,-2)+"ати",.82,{removedSuffixes:["ав"],conjugationType:"past"}):e.endsWith("ив")&&e.length>3?ap(e.slice(0,-2)+"ити",.82,{removedSuffixes:["ив"],conjugationType:"past"}):null}tryPresentTenseNormalization(e){return e.endsWith("иш")&&e.length>3?ap(e.slice(0,-2)+"ити",.8,{removedSuffixes:["иш"],conjugationType:"present"}):e.endsWith("ить")&&e.length>4?ap(e.slice(0,-3)+"ити",.78,{removedSuffixes:["ить"],conjugationType:"present"}):e.endsWith("имо")&&e.length>4?ap(e.slice(0,-3)+"ити",.8,{removedSuffixes:["имо"],conjugationType:"present"}):e.endsWith("ять")&&e.length>4?ap(e.slice(0,-3)+"ити",.78,{removedSuffixes:["ять"],conjugationType:"present"}):e.endsWith("єш")&&e.length>3?ap(e.slice(0,-2)+"ати",.78,{removedSuffixes:["єш"],conjugationType:"present"}):e.endsWith("еш")&&e.length>3?ap(e.slice(0,-2)+"ати",.75,{removedSuffixes:["еш"],conjugationType:"present"}):e.endsWith("є")&&e.length>2?ap(e.slice(0,-1)+"ати",.72,{removedSuffixes:["є"],conjugationType:"present"}):e.endsWith("ємо")&&e.length>4?ap(e.slice(0,-3)+"ати",.8,{removedSuffixes:["ємо"],conjugationType:"present"}):e.endsWith("ють")&&e.length>4?ap(e.slice(0,-3)+"ати",.78,{removedSuffixes:["ють"],conjugationType:"present"}):e.endsWith("уть")&&e.length>4?ap(e.slice(0,-3)+"ати",.75,{removedSuffixes:["уть"],conjugationType:"present"}):null}})}}),ob={};gp(ob,{UkrainianTokenizer:()=>nb,ukrainianTokenizer:()=>rb});var sb,lb,cb,ub,pb=vp({"src/tokenizers/ukrainian.ts"(){od(),ab(),Fm(),sd(),dy(),ef(),cy(),eb=new Set(["в","у","на","з","із","зі","до","від","о","об","при","для","під","над","перед","між","через","без","по","за","про","після","навколо","проти","замість","крім","серед","к"]),tb=[{native:"істина",normalized:"true"},{native:"правда",normalized:"true"},{native:"хибність",normalized:"false"},{native:"null",normalized:"null"},{native:"невизначено",normalized:"undefined"},{native:"секунда",normalized:"s"},{native:"секунди",normalized:"s"},{native:"секунд",normalized:"s"},{native:"мілісекунда",normalized:"ms"},{native:"мілісекунди",normalized:"ms"},{native:"мілісекунд",normalized:"ms"},{native:"хвилина",normalized:"m"},{native:"хвилини",normalized:"m"},{native:"хвилин",normalized:"m"},{native:"година",normalized:"h"},{native:"години",normalized:"h"},{native:"годин",normalized:"h"},{native:"перша",normalized:"first"},{native:"перше",normalized:"first"},{native:"остання",normalized:"last"},{native:"останнє",normalized:"last"},{native:"наступна",normalized:"next"},{native:"попередня",normalized:"previous"},{native:"порожня",normalized:"empty"},{native:"порожнє",normalized:"empty"},{native:"моя",normalized:"my"},{native:"моє",normalized:"my"},{native:"мої",normalized:"my"}],rb=new(nb=class extends rp{constructor(){super(),this.language="uk",this.direction="ltr",this.initializeKeywordsFromProfile(_m,tb),this.setNormalizer(new Qg),this.registerExtractors([...py(),new Bd("ukrainian-keyword",/[a-zA-Zа-яА-ЯіІїЇєЄґҐьЬ']/,Gd),new Oc,new Cc,new iy,new Jm,new Zm])}classifyToken(e){const t=e.toLowerCase();return eb.has(t)?"particle":this.isKeyword(t)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":"identifier"}})}}),mb={};gp(mb,{HebrewTokenizer:()=>cb,hebrewTokenizer:()=>ub});var db,fb,yb=vp({"src/tokenizers/he.ts"(){od(),Xp(),sd(),dy(),oy(),sy(),cy(),sb=new Set(["על","את","אל","מן","עם","בתוך","מתוך","ליד","אחרי","לפני","בין","עד","של"]),lb=[{native:"אמת",normalized:"true"},{native:"שקר",normalized:"false"},{native:"null",normalized:"null"},{native:"ריק",normalized:"null"},{native:"לא מוגדר",normalized:"undefined"},{native:"ראשון",normalized:"first"},{native:"אחרון",normalized:"last"},{native:"הבא",normalized:"next"},{native:"הקודם",normalized:"previous"},{native:"הקרוב",normalized:"closest"},{native:"הורה",normalized:"parent"},{native:"לחיצה",normalized:"click"},{native:"קליק",normalized:"click"},{native:"קלט",normalized:"input"},{native:"שינוי",normalized:"change"},{native:"שליחה",normalized:"submit"},{native:"מיקוד",normalized:"focus"},{native:"טשטוש",normalized:"blur"},{native:"לחיצת מקש",normalized:"keydown"},{native:"שחרור מקש",normalized:"keyup"},{native:"מעבר עכבר",normalized:"mouseover"},{native:"יציאת עכבר",normalized:"mouseout"},{native:"טעינה",normalized:"load"},{native:"גלילה",normalized:"scroll"},{native:"היא",normalized:"it"},{native:"הוא",normalized:"it"},{native:"את",normalized:"you"},{native:"שנייה",normalized:"s"},{native:"שניות",normalized:"s"},{native:"מילישנייה",normalized:"ms"},{native:"דקה",normalized:"m"},{native:"דקות",normalized:"m"},{native:"שעה",normalized:"h"},{native:"שעות",normalized:"h"}],ub=new(cb=class extends rp{constructor(){super(),this.language="he",this.direction="rtl",this.initializeKeywordsFromProfile(Kp,lb),this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractor(new iy),this.registerExtractor(new ry),this.registerExtractors([new Xf]),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){return sb.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(e)?"operator":"identifier"}})}});function hb(e){return/[\u0900-\u097F\u0A8E-\u0A8F]/u.test(e)}var vb,gb,bb,wb,kb=vp({"src/tokenizers/morphology/hindi-normalizer.ts"(){Ey(),db=[{suffix:" रहा है",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:" रही है",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:" रहे हैं",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"रहा",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"रही",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"रहे",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"ूंगा",replacement:"",confidence:.85,type:"future",minStemLength:1},{suffix:"ूंगी",replacement:"",confidence:.85,type:"future",minStemLength:1},{suffix:"ेगा",replacement:"",confidence:.85,type:"future",minStemLength:1},{suffix:"ेगी",replacement:"",confidence:.85,type:"future",minStemLength:1},{suffix:"ेंगे",replacement:"",confidence:.85,type:"future",minStemLength:1},{suffix:"ता है",replacement:"",confidence:.85,type:"present",minStemLength:1},{suffix:"ती है",replacement:"",confidence:.85,type:"present",minStemLength:1},{suffix:"ते हैं",replacement:"",confidence:.85,type:"present",minStemLength:1},{suffix:"ता",replacement:"",confidence:.85,type:"present",minStemLength:1},{suffix:"ती",replacement:"",confidence:.85,type:"present",minStemLength:1},{suffix:"ते",replacement:"",confidence:.85,type:"present",minStemLength:1},{suffix:"ना",replacement:"",confidence:.9,type:"dictionary",minStemLength:1},{suffix:"ाया",replacement:"",confidence:.82,type:"past",minStemLength:1},{suffix:"ायी",replacement:"",confidence:.82,type:"past",minStemLength:1},{suffix:"ाये",replacement:"",confidence:.82,type:"past",minStemLength:1},{suffix:"या",replacement:"",confidence:.82,type:"past",minStemLength:1},{suffix:"िये",replacement:"",confidence:.85,type:"imperative",minStemLength:1},{suffix:"िए",replacement:"",confidence:.85,type:"imperative",minStemLength:1},{suffix:"ई",replacement:"",confidence:.82,type:"past",minStemLength:1},{suffix:"ए",replacement:"",confidence:.82,type:"past",minStemLength:1},{suffix:"ें",replacement:"",confidence:.85,type:"imperative",minStemLength:1},{suffix:"ो",replacement:"",confidence:.85,type:"imperative",minStemLength:1},{suffix:"ा",replacement:"",confidence:.82,type:"past",minStemLength:2},{suffix:"ी",replacement:"",confidence:.82,type:"past",minStemLength:2},{suffix:"े",replacement:"",confidence:.82,type:"past",minStemLength:2}],new(fb=class{constructor(){this.language="hi"}isNormalizable(e){return 2>e.length?0:hb(e)}normalize(e){return this.tryConjugationNormalization(e)||ip(e)}tryConjugationNormalization(e){for(const t of db)if(e.endsWith(t.suffix)){const n=Array.from(e),r=Array.from(t.suffix),i=n.slice(0,n.length-r.length),a=i.join("")+t.replacement;if((t.minStemLength??1)>i.length)continue;if(a.length>0&&!hb(a))continue;return ap(a,t.confidence,{removedSuffixes:[t.suffix],conjugationType:t.type})}return null}})}}),zb={};gp(zb,{HindiTokenizer:()=>bb,hindiTokenizer:()=>wb});var xb,Eb,Sb=vp({"src/tokenizers/hindi.ts"(){od(),kb(),tm(),sd(),dy(),sf(),lf(),cy(),vb=new Set(["को","में","पर","से","का","की","के","तक","ने"]),gb=[{native:"सच",normalized:"true"},{native:"सत्य",normalized:"true"},{native:"झूठ",normalized:"false"},{native:"असत्य",normalized:"false"},{native:"खाली",normalized:"null"},{native:"अपरिभाषित",normalized:"undefined"},{native:"पहला",normalized:"first"},{native:"अंतिम",normalized:"last"},{native:"अगला",normalized:"next"},{native:"पिछला",normalized:"previous"},{native:"निकटतम",normalized:"closest"},{native:"मूल",normalized:"parent"},{native:"क्लिक",normalized:"click"},{native:"परिवर्तन",normalized:"change"},{native:"जमा",normalized:"submit"},{native:"इनपुट",normalized:"input"},{native:"लोड",normalized:"load"},{native:"स्क्रॉल",normalized:"scroll"},{native:"को",normalized:"to"},{native:"के साथ",normalized:"with"}],wb=new(bb=class extends rp{constructor(){super(),this.language="hi",this.direction="ltr",this.initializeKeywordsFromProfile(Yp,gb),this.normalizer=new fb,this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractor(new af),this.registerExtractor(new Wd),this.registerExtractor(new iy),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){return vb.has(e)?"particle":this.isKeyword(e)?"keyword":e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||e.startsWith("http")?"url":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":(e.startsWith(":"),"identifier")}})}});function Tb(e){return/[\u0980-\u09FF]/u.test(e)}var jb,Ab,Lb,Ob,Cb=vp({"src/tokenizers/morphology/bengali-normalizer.ts"(){Ey(),xb=[{suffix:"চ্ছে আছে",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"চ্ছ আছি",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"চ্ছেন আছেন",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"েছেন",replacement:"",confidence:.85,type:"present",minStemLength:1},{suffix:"েছে",replacement:"",confidence:.85,type:"present",minStemLength:1},{suffix:"েছ",replacement:"",confidence:.85,type:"present",minStemLength:1},{suffix:"বেন",replacement:"",confidence:.85,type:"future",minStemLength:1},{suffix:"বে",replacement:"",confidence:.85,type:"future",minStemLength:1},{suffix:"বো",replacement:"",confidence:.85,type:"future",minStemLength:1},{suffix:"লেন",replacement:"",confidence:.85,type:"past",minStemLength:1},{suffix:"লো",replacement:"",confidence:.85,type:"past",minStemLength:1},{suffix:"ল",replacement:"",confidence:.85,type:"past",minStemLength:2},{suffix:"ুন",replacement:"",confidence:.85,type:"imperative",minStemLength:1},{suffix:"ো",replacement:"",confidence:.85,type:"imperative",minStemLength:1},{suffix:"চ্ছে",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"চ্ছ",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"চ্ছি",replacement:"",confidence:.82,type:"progressive",minStemLength:1},{suffix:"া",replacement:"",confidence:.9,type:"dictionary",minStemLength:1},{suffix:"ে",replacement:"",confidence:.85,type:"present",minStemLength:2},{suffix:"ি",replacement:"",confidence:.85,type:"present",minStemLength:2},{suffix:"ো",replacement:"",confidence:.85,type:"present",minStemLength:2}],Eb=new class{constructor(){this.language="bn"}isNormalizable(e){return 2>e.length?0:Tb(e)}normalize(e){return this.tryConjugationNormalization(e)||ip(e)}tryConjugationNormalization(e){for(const t of xb)if(e.endsWith(t.suffix)){const n=Array.from(e),r=Array.from(t.suffix),i=n.slice(0,n.length-r.length),a=i.join("")+t.replacement;if((t.minStemLength??1)>i.length)continue;if(a.length>0&&!Tb(a))continue;return ap(a,t.confidence,{removedSuffixes:[t.suffix],conjugationType:t.type})}return null}}}}),Nb={};gp(Nb,{BengaliTokenizer:()=>Lb,bengaliTokenizer:()=>Ob});var Pb,Rb,$b,Ib=vp({"src/tokenizers/bengali.ts"(){od(),Cb(),Mp(),sd(),dy(),df(),ff(),cy(),jb=new Set(["কে","তে","থেকে","র","এর","দিয়ে","জন্য","পর্যন্ত","এ","মধ্যে"]),Ab=[{native:"সত্য",normalized:"true"},{native:"মিথ্যা",normalized:"false"},{native:"শূন্য",normalized:"null"},{native:"অনির্ধারিত",normalized:"undefined"},{native:"প্রথম",normalized:"first"},{native:"পরবর্তী",normalized:"next"},{native:"আগের",normalized:"previous"},{native:"নিকটতম",normalized:"closest"},{native:"মূল",normalized:"parent"},{native:"ক্লিক",normalized:"click"},{native:"জমা",normalized:"submit"},{native:"ইনপুট",normalized:"input"},{native:"লোড",normalized:"load"},{native:"স্ক্রোল",normalized:"scroll"},{native:"কে",normalized:"to"},{native:"সাথে",normalized:"with"}],Ob=new(Lb=class extends rp{constructor(){super(),this.language="bn",this.direction="ltr",this.initializeKeywordsFromProfile(Pp,Ab),this.setNormalizer(Eb),this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractor(new pf),this.registerExtractor(new of),this.registerExtractor(new iy),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){return jb.has(e)?"particle":this.isKeyword(e)?"keyword":e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||e.startsWith("http")?"url":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith('"')||e.startsWith("'")||/^\d/.test(e)?"literal":(e.startsWith(":"),"identifier")}})}}),Mb={};gp(Mb,{ThaiTokenizer:()=>Rb,thaiTokenizer:()=>$b});var qb,_b,Db,Vb=vp({"src/tokenizers/thai.ts"(){od(),Rm(),sd(),dy(),gf(),Pb=[{native:"จริง",normalized:"true"},{native:"เท็จ",normalized:"false"},{native:"ว่าง",normalized:"null"},{native:"ไม่กำหนด",normalized:"undefined"},{native:"แรก",normalized:"first"},{native:"สุดท้าย",normalized:"last"},{native:"ถัดไป",normalized:"next"},{native:"ก่อนหน้า",normalized:"previous"},{native:"ใกล้สุด",normalized:"closest"},{native:"ต้นทาง",normalized:"parent"},{native:"คลิก",normalized:"click"},{native:"เปลี่ยนแปลง",normalized:"change"},{native:"ส่ง",normalized:"submit"},{native:"อินพุต",normalized:"input"},{native:"โหลด",normalized:"load"},{native:"เลื่อน",normalized:"scroll"},{native:"เวลา",normalized:"when"},{native:"ไปยัง",normalized:"to"},{native:"ด้วย",normalized:"with"},{native:"และ",normalized:"and"}],$b=new(Rb=class extends rp{constructor(){super(),this.language="th",this.direction="ltr",this.initializeKeywordsFromProfile(Om,Pb),this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractors([new mf]),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){return this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith(".")||e.startsWith("#")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith(":")?"identifier":e.startsWith('"')||e.startsWith("'")||/^-?\d/.test(e)?"literal":"identifier"}})}}),Hb={};gp(Hb,{MalayTokenizer:()=>_b,malayTokenizer:()=>Db});var Fb,Bb,Ub,Gb,Wb,Kb=vp({"src/tokenizers/ms.ts"(){od(),hm(),sd(),dy(),zf(),qb=[{native:"benar",normalized:"true"},{native:"salah",normalized:"false"},{native:"kosong",normalized:"null"},{native:"tak_tentu",normalized:"undefined"},{native:"pertama",normalized:"first"},{native:"terakhir",normalized:"last"},{native:"seterusnya",normalized:"next"},{native:"sebelumnya",normalized:"previous"},{native:"terdekat",normalized:"closest"},{native:"induk",normalized:"parent"},{native:"klik",normalized:"click"},{native:"berubah",normalized:"change"},{native:"ubah",normalized:"change"},{native:"hantar",normalized:"submit"},{native:"input",normalized:"input"},{native:"masuk",normalized:"input"},{native:"muat",normalized:"load"},{native:"tatal",normalized:"scroll"},{native:"hover",normalized:"hover"}],Db=new(_b=class extends rp{constructor(){super(),this.language="ms",this.direction="ltr",this.initializeKeywordsFromProfile(mm,qb),this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractors([new vf]),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){return this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith(".")||e.startsWith("#")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith(":")?"identifier":e.startsWith('"')||e.startsWith("'")||/^-?\d/.test(e)?"literal":"identifier"}})}});function Jb(e){const t=e.charCodeAt(0);return t>=65&&90>=t||t>=97&&122>=t?1:"ñ"===e||"Ñ"===e}var Zb,Yb,Xb,Qb=vp({"src/tokenizers/morphology/tagalog-normalizer.ts"(){Ey(),Fb=[{pattern:"magpapa",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3},{pattern:"magpa",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3},{pattern:"ipang",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3},{pattern:"ipag",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3},{pattern:"nagpa",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3}],Bb=[{pattern:"mag",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3},{pattern:"nag",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3},{pattern:"mang",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3},{pattern:"nang",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3},{pattern:"ma",confidencePenalty:.12,prefixType:"verb-marker",minRemaining:3},{pattern:"na",confidencePenalty:.12,prefixType:"verb-marker",minRemaining:3},{pattern:"i",confidencePenalty:.15,prefixType:"verb-marker",minRemaining:3},{pattern:"pa",confidencePenalty:.12,prefixType:"verb-marker",minRemaining:3}],Ub=["um","in"],Gb=[{pattern:"hin",confidencePenalty:.18,type:"patient-focus"},{pattern:"in",confidencePenalty:.18,type:"patient-focus"},{pattern:"han",confidencePenalty:.18,type:"locative-focus"},{pattern:"an",confidencePenalty:.18,type:"locative-focus"}],Wb=new class{constructor(){this.language="tl"}isNormalizable(e){return function(e){for(const t of e)if(Jb(t))return 1;return 0}(e)?2>e.length?0:1:0}normalize(e){let t=e.toLowerCase(),n=1;const r=[],i=[],a=[];for(const e of Fb)if(t.startsWith(e.pattern)){const i=t.slice(e.pattern.length);if(i.length>=(e.minRemaining??2)){t=i,n-=e.confidencePenalty,r.push(e.pattern),a.push("prefix:"+e.pattern);break}}if(0===r.length)for(const e of Bb)if(t.startsWith(e.pattern)){const i=t.slice(e.pattern.length);if(i.length>=(e.minRemaining??2)){t=i,n-=e.confidencePenalty,r.push(e.pattern),a.push("prefix:"+e.pattern);break}}const o=function(e){const t=e.toLowerCase();if(4>t.length)return{stem:t,reduplicated:0};const n=t[0],r=t[1];if(!"aeiou".includes(n)&&"aeiou".includes(r)){const e=t.slice(2);if(e.length>=2&&e[0]===n)return{stem:e,reduplicated:1}}return{stem:t,reduplicated:0}}(t);o.reduplicated&&o.stem.length>=2&&(t=o.stem,n-=.1,a.push("reduplication:CV"));const s=function(e){const t=e.toLowerCase();if(5>t.length)return null;let n=0;for(let e=0;t.length>e&&!"aeiou".includes(t[e]);e++)n=e+1;if(0===n)return null;for(const e of Ub){const r=n;if(t.slice(r,r+e.length)===e){const i=t.slice(0,n)+t.slice(r+e.length);if(i.length>=3)return{stem:i,infix:e}}}return null}(t);let l=0;if(s&&s.stem.length>=2&&(t=s.stem,n-=.18,a.push("infix:"+s.infix),l=1),!l)for(const e of Gb)if(t.endsWith(e.pattern)){const r=t.slice(0,-e.pattern.length);if(r.length>=2){t=r,n-=e.confidencePenalty,i.push(e.pattern),a.push("suffix:"+e.pattern);break}}return n=Math.max(.5,n),0===r.length&&0===i.length&&0===a.length?ip(e):ap(t,n,{removedPrefixes:r,removedSuffixes:i,appliedRules:a})}}}}),ew={};gp(ew,{TagalogTokenizer:()=>Yb,tagalogTokenizer:()=>Xb});var tw,nw=vp({"src/tokenizers/tl.ts"(){od(),Mm(),Qb(),sd(),dy(),_f(),Zb=[{native:"totoo",normalized:"true"},{native:"mali",normalized:"false"},{native:"wala",normalized:"null"},{native:"hindi_tinukoy",normalized:"undefined"},{native:"una",normalized:"first"},{native:"huli",normalized:"last"},{native:"susunod",normalized:"next"},{native:"nakaraan",normalized:"previous"},{native:"pinakamalapit",normalized:"closest"},{native:"magulang",normalized:"parent"},{native:"pindot",normalized:"click"},{native:"pagbabago",normalized:"change"},{native:"isumite",normalized:"submit"},{native:"input",normalized:"input"},{native:"karga",normalized:"load"},{native:"mag_scroll",normalized:"scroll"}],Xb=new(Yb=class extends rp{constructor(){super(),this.language="tl",this.direction="ltr",this.initializeKeywordsFromProfile(Pm,Zb),this.setNormalizer(Wb),this.registerExtractors(py()),this.registerExtractor(new Oc),this.registerExtractor(new Cc),this.registerExtractors([new kf]),this.registerExtractor(new Jm),this.registerExtractor(new Zm)}classifyToken(e){return this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(e)?"event-modifier":e.startsWith(".")||e.startsWith("#")||e.startsWith("[")||e.startsWith("*")||e.startsWith("<")?"selector":e.startsWith(":")?"identifier":e.startsWith('"')||e.startsWith("'")||/^-?\d/.test(e)?"literal":"identifier"}})}});function rw(e){switch(e){case"bn":return[{id:"event-handler-bn-sov",language:"bn",command:"on",priority:100,template:{format:"{event} তে {action}",tokens:[{type:"role",role:"event"},{type:"literal",value:"তে",alternatives:["এ"]},{type:"role",role:"action"}]},extraction:{event:{position:0},action:{position:2}}},{id:"event-handler-bn-with-source",language:"bn",command:"on",priority:95,template:{format:"{source} থেকে {event} তে {action}",tokens:[{type:"role",role:"source"},{type:"literal",value:"থেকে"},{type:"role",role:"event"},{type:"literal",value:"তে",alternatives:["এ"]},{type:"role",role:"action"}]},extraction:{source:{position:0},event:{marker:"তে",position:2},action:{position:4}}},{id:"event-handler-bn-when",language:"bn",command:"on",priority:90,template:{format:"যখন {event} {action}",tokens:[{type:"literal",value:"যখন"},{type:"role",role:"event"},{type:"role",role:"action"}]},extraction:{event:{position:1},action:{position:2}}}];case"de":return[{id:"event-de-wenn-source",language:"de",command:"on",priority:115,template:{format:"wenn {event} von {source} {body}",tokens:[{type:"literal",value:"wenn",alternatives:["falls","sobald"]},{type:"role",role:"event"},{type:"literal",value:"von",alternatives:["aus"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"von",markerAlternatives:["aus"]}}},{id:"event-de-wenn",language:"de",command:"on",priority:105,template:{format:"wenn {event} {body}",tokens:[{type:"literal",value:"wenn",alternatives:["falls","sobald"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-de-bei-source",language:"de",command:"on",priority:110,template:{format:"bei {event} von {source} {body}",tokens:[{type:"literal",value:"bei",alternatives:["beim"]},{type:"role",role:"event"},{type:"literal",value:"von",alternatives:["aus"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"von",markerAlternatives:["aus"]}}},{id:"event-de-bei",language:"de",command:"on",priority:100,template:{format:"bei {event} {body}",tokens:[{type:"literal",value:"bei",alternatives:["beim"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-de-auf",language:"de",command:"on",priority:95,template:{format:"auf {event} {body}",tokens:[{type:"literal",value:"auf"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-de-im-falle",language:"de",command:"on",priority:90,template:{format:"im Falle von {event} {body}",tokens:[{type:"literal",value:"im Falle von",alternatives:["im Fall von"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"en":return[{id:"event-en-when-source",language:"en",command:"on",priority:115,template:{format:"when {event} from {source} {body}",tokens:[{type:"literal",value:"when"},{type:"role",role:"event"},{type:"literal",value:"from"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"from"}}},{id:"event-en-when",language:"en",command:"on",priority:105,template:{format:"when {event} {body}",tokens:[{type:"literal",value:"when"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-en-source",language:"en",command:"on",priority:110,template:{format:"on {event} from {source} {body}",tokens:[{type:"literal",value:"on"},{type:"role",role:"event"},{type:"literal",value:"from"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"from"}}},{id:"event-en-standard",language:"en",command:"on",priority:100,template:{format:"on {event} {body}",tokens:[{type:"literal",value:"on"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-en-upon",language:"en",command:"on",priority:98,template:{format:"upon {event} {body}",tokens:[{type:"literal",value:"upon"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-en-if",language:"en",command:"on",priority:95,template:{format:"if {event} {body}",tokens:[{type:"literal",value:"if"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"es":return[{id:"event-es-native-al-source",language:"es",command:"on",priority:115,template:{format:"al {event} en {source} {body}",tokens:[{type:"literal",value:"al"},{type:"role",role:"event"},{type:"literal",value:"en",alternatives:["de"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"en",markerAlternatives:["de"]}}},{id:"event-es-cuando-source",language:"es",command:"on",priority:112,template:{format:"cuando {event} en {source} {body}",tokens:[{type:"literal",value:"cuando"},{type:"role",role:"event"},{type:"literal",value:"en",alternatives:["de"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"en",markerAlternatives:["de"]}}},{id:"event-es-native-al",language:"es",command:"on",priority:108,template:{format:"al {event} {body}",tokens:[{type:"literal",value:"al"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-es-standard",language:"es",command:"on",priority:100,template:{format:"en {event} {body}",tokens:[{type:"literal",value:"en",alternatives:["al","cuando"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-es-source",language:"es",command:"on",priority:110,template:{format:"en {event} desde {source} {body}",tokens:[{type:"literal",value:"en",alternatives:["al"]},{type:"role",role:"event"},{type:"literal",value:"desde",alternatives:["de"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"desde",markerAlternatives:["de"]}}},{id:"event-es-when",language:"es",command:"on",priority:95,template:{format:"cuando {event} {body}",tokens:[{type:"literal",value:"cuando"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-es-conditional-si",language:"es",command:"on",priority:85,template:{format:"si {event} {body}",tokens:[{type:"literal",value:"si"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"fr":return[{id:"event-fr-quand-source",language:"fr",command:"on",priority:115,template:{format:"quand {event} de {source} {body}",tokens:[{type:"literal",value:"quand",alternatives:["lorsque"]},{type:"role",role:"event"},{type:"literal",value:"de",alternatives:["depuis"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"de",markerAlternatives:["depuis"]}}},{id:"event-fr-quand",language:"fr",command:"on",priority:105,template:{format:"quand {event} {body}",tokens:[{type:"literal",value:"quand",alternatives:["lorsque"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-fr-sur-source",language:"fr",command:"on",priority:110,template:{format:"sur {event} de {source} {body}",tokens:[{type:"literal",value:"sur",alternatives:["lors de"]},{type:"role",role:"event"},{type:"literal",value:"de",alternatives:["depuis"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"de",markerAlternatives:["depuis"]}}},{id:"event-fr-sur",language:"fr",command:"on",priority:100,template:{format:"sur {event} {body}",tokens:[{type:"literal",value:"sur",alternatives:["lors de"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-fr-si",language:"fr",command:"on",priority:95,template:{format:"si {event} {body}",tokens:[{type:"literal",value:"si"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-fr-a",language:"fr",command:"on",priority:90,template:{format:"à {event} {body}",tokens:[{type:"literal",value:"à",alternatives:["au"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"hi":return[{id:"event-hi-standard",language:"hi",command:"on",priority:100,template:{format:"{event} पर",tokens:[{type:"role",role:"event"},{type:"literal",value:"पर",alternatives:["में","जब"]}]},extraction:{event:{position:0}}},{id:"event-hi-with-source",language:"hi",command:"on",priority:95,template:{format:"{source} से {event} पर",tokens:[{type:"role",role:"source"},{type:"literal",value:"से"},{type:"role",role:"event"},{type:"literal",value:"पर",alternatives:["में","जब"]}]},extraction:{source:{position:0},event:{marker:"से",position:2}}},{id:"event-hi-bare",language:"hi",command:"on",priority:80,template:{format:"{event}",tokens:[{type:"role",role:"event"}]},extraction:{event:{position:0}}}];case"id":return[{id:"event-id-ketika-source",language:"id",command:"on",priority:115,template:{format:"ketika {event} dari {source} {body}",tokens:[{type:"literal",value:"ketika",alternatives:["saat","waktu"]},{type:"role",role:"event"},{type:"literal",value:"dari"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"dari"}}},{id:"event-id-ketika",language:"id",command:"on",priority:105,template:{format:"ketika {event} {body}",tokens:[{type:"literal",value:"ketika",alternatives:["saat","waktu"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-id-pada-source",language:"id",command:"on",priority:110,template:{format:"pada {event} dari {source} {body}",tokens:[{type:"literal",value:"pada"},{type:"role",role:"event"},{type:"literal",value:"dari"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"dari"}}},{id:"event-id-pada",language:"id",command:"on",priority:100,template:{format:"pada {event} {body}",tokens:[{type:"literal",value:"pada"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-id-jika",language:"id",command:"on",priority:95,template:{format:"jika {event} {body}",tokens:[{type:"literal",value:"jika",alternatives:["kalau","apabila"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-id-bila",language:"id",command:"on",priority:90,template:{format:"bila {event} {body}",tokens:[{type:"literal",value:"bila"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"it":return[{id:"event-handler-it-full",language:"it",command:"on",priority:100,template:{format:"su {event} {action}",tokens:[{type:"literal",value:"su",alternatives:["quando","al","on"]},{type:"role",role:"event"},{type:"role",role:"action"}]},extraction:{event:{position:1},action:{position:2}}},{id:"event-handler-it-from",language:"it",command:"on",priority:95,template:{format:"su {event} da {source} {action}",tokens:[{type:"literal",value:"su",alternatives:["quando","al","on"]},{type:"role",role:"event"},{type:"literal",value:"da",alternatives:["di"]},{type:"role",role:"source"},{type:"role",role:"action"}]},extraction:{event:{position:1},source:{marker:"da",markerAlternatives:["di"]},action:{position:-1}}}];case"ms":return[{id:"event-ms-apabila",language:"ms",command:"on",priority:100,template:{format:"apabila {event} {body}",tokens:[{type:"literal",value:"apabila",alternatives:["bila","ketika"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-ms-apabila-source",language:"ms",command:"on",priority:110,template:{format:"apabila {event} dari {source} {body}",tokens:[{type:"literal",value:"apabila",alternatives:["bila","ketika"]},{type:"role",role:"event"},{type:"literal",value:"dari"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"dari"}}}];case"pl":return[{id:"event-handler-pl-full",language:"pl",command:"on",priority:100,template:{format:"gdy {event} na {source}",tokens:[{type:"literal",value:"gdy",alternatives:["przy","na"]},{type:"role",role:"event"},{type:"group",optional:1,tokens:[{type:"literal",value:"na",alternatives:["w","przy","z"]},{type:"role",role:"source"}]}]},extraction:{event:{position:1},source:{marker:"na",markerAlternatives:["w","przy","z"],default:{type:"reference",value:"me"}}}},{id:"event-handler-pl-simple",language:"pl",command:"on",priority:90,template:{format:"gdy {event}",tokens:[{type:"literal",value:"gdy",alternatives:["przy","na"]},{type:"role",role:"event"}]},extraction:{event:{position:1},source:{default:{type:"reference",value:"me"}}}}];case"pt":return[{id:"event-pt-ao-source",language:"pt",command:"on",priority:115,template:{format:"ao {event} em {source} {body}",tokens:[{type:"literal",value:"ao",alternatives:["à"]},{type:"role",role:"event"},{type:"literal",value:"em",alternatives:["de","no","na"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"em",markerAlternatives:["de","no","na"]}}},{id:"event-pt-quando-source",language:"pt",command:"on",priority:110,template:{format:"quando {event} de {source} {body}",tokens:[{type:"literal",value:"quando"},{type:"role",role:"event"},{type:"literal",value:"de",alternatives:["em","no","na"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"de",markerAlternatives:["em","no","na"]}}},{id:"event-pt-ao",language:"pt",command:"on",priority:105,template:{format:"ao {event} {body}",tokens:[{type:"literal",value:"ao",alternatives:["à"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-pt-quando",language:"pt",command:"on",priority:100,template:{format:"quando {event} {body}",tokens:[{type:"literal",value:"quando"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-pt-em",language:"pt",command:"on",priority:95,template:{format:"em {event} {body}",tokens:[{type:"literal",value:"em",alternatives:["no","na"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-pt-se",language:"pt",command:"on",priority:90,template:{format:"se {event} {body}",tokens:[{type:"literal",value:"se"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"qu":return[{id:"event-qu-source",language:"qu",command:"on",priority:110,template:{format:"{event} pi {source} manta {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"pi"},{type:"role",role:"source"},{type:"literal",value:"manta"}]},extraction:{event:{position:0},source:{marker:"manta"}}},{id:"event-qu-kaqtin",language:"qu",command:"on",priority:105,template:{format:"{event} kaqtin {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"kaqtin",alternatives:["qtin","ptin"]}]},extraction:{event:{position:0}}},{id:"event-qu-standard",language:"qu",command:"on",priority:100,template:{format:"{event} pi {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"pi",alternatives:["kaqpi","kaqpim"]}]},extraction:{event:{position:0}}}];case"ru":return[{id:"event-handler-ru-full",language:"ru",command:"on",priority:100,template:{format:"при {event} на {source}",tokens:[{type:"literal",value:"при",alternatives:["когда"]},{type:"role",role:"event"},{type:"group",optional:1,tokens:[{type:"literal",value:"на",alternatives:["в","от"]},{type:"role",role:"source"}]}]},extraction:{event:{position:1},source:{marker:"на",markerAlternatives:["в","от"],default:{type:"reference",value:"me"}}}},{id:"event-handler-ru-simple",language:"ru",command:"on",priority:90,template:{format:"при {event}",tokens:[{type:"literal",value:"при",alternatives:["когда"]},{type:"role",role:"event"}]},extraction:{event:{position:1},source:{default:{type:"reference",value:"me"}}}}];case"sw":return[{id:"event-sw-unapo-source",language:"sw",command:"on",priority:115,template:{format:"unapo {event} kutoka {source} {body}",tokens:[{type:"literal",value:"unapo",alternatives:["wakati wa","wakati"]},{type:"role",role:"event"},{type:"literal",value:"kutoka"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"kutoka"}}},{id:"event-sw-unapo",language:"sw",command:"on",priority:105,template:{format:"unapo {event} {body}",tokens:[{type:"literal",value:"unapo",alternatives:["wakati wa","wakati"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-sw-kwa-source",language:"sw",command:"on",priority:110,template:{format:"kwa {event} kutoka {source} {body}",tokens:[{type:"literal",value:"kwa"},{type:"role",role:"event"},{type:"literal",value:"kutoka"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"kutoka"}}},{id:"event-sw-kwa",language:"sw",command:"on",priority:100,template:{format:"kwa {event} {body}",tokens:[{type:"literal",value:"kwa"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-sw-ikiwa",language:"sw",command:"on",priority:95,template:{format:"ikiwa {event} {body}",tokens:[{type:"literal",value:"ikiwa",alternatives:["kama"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-sw-baada-ya",language:"sw",command:"on",priority:90,template:{format:"baada ya {event} {body}",tokens:[{type:"literal",value:"baada ya"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"th":return[{id:"event-handler-th-svo",language:"th",command:"on",priority:100,template:{format:"เมื่อ {event} {action}",tokens:[{type:"literal",value:"เมื่อ",alternatives:["ตอน"]},{type:"role",role:"event"},{type:"role",role:"action"}]},extraction:{event:{position:1},action:{position:2}}},{id:"event-handler-th-with-source",language:"th",command:"on",priority:95,template:{format:"เมื่อ {event} จาก {source} {action}",tokens:[{type:"literal",value:"เมื่อ",alternatives:["ตอน"]},{type:"role",role:"event"},{type:"literal",value:"จาก"},{type:"role",role:"source"},{type:"role",role:"action"}]},extraction:{event:{position:1},source:{marker:"จาก",position:3},action:{position:4}}}];case"tl":return[{id:"event-tl-kapag-source",language:"tl",command:"on",priority:115,template:{format:"kapag {event} mula_sa {source} {body}",tokens:[{type:"literal",value:"kapag",alternatives:["kung","sa"]},{type:"role",role:"event"},{type:"literal",value:"mula_sa",alternatives:["galing_sa"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"mula_sa"}}},{id:"event-tl-kapag",language:"tl",command:"on",priority:105,template:{format:"kapag {event} {body}",tokens:[{type:"literal",value:"kapag",alternatives:["kung","sa"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"uk":return[{id:"event-handler-uk-full",language:"uk",command:"on",priority:100,template:{format:"при {event} на {source}",tokens:[{type:"literal",value:"при",alternatives:["коли"]},{type:"role",role:"event"},{type:"group",optional:1,tokens:[{type:"literal",value:"на",alternatives:["в","від"]},{type:"role",role:"source"}]}]},extraction:{event:{position:1},source:{marker:"на",markerAlternatives:["в","від"],default:{type:"reference",value:"me"}}}},{id:"event-handler-uk-simple",language:"uk",command:"on",priority:90,template:{format:"при {event}",tokens:[{type:"literal",value:"при",alternatives:["коли"]},{type:"role",role:"event"}]},extraction:{event:{position:1},source:{default:{type:"reference",value:"me"}}}}];case"vi":return[{id:"event-handler-vi-full",language:"vi",command:"on",priority:100,template:{format:"khi {event} trên {source}",tokens:[{type:"literal",value:"khi",alternatives:["lúc","trên"]},{type:"role",role:"event"},{type:"group",optional:1,tokens:[{type:"literal",value:"trên",alternatives:["tại"]},{type:"role",role:"source"}]}]},extraction:{event:{position:1},source:{marker:"trên",markerAlternatives:["tại"],default:{type:"reference",value:"me"}}}},{id:"event-handler-vi-simple",language:"vi",command:"on",priority:90,template:{format:"khi {event}",tokens:[{type:"literal",value:"khi",alternatives:["lúc","trên"]},{type:"role",role:"event"}]},extraction:{event:{position:1},source:{default:{type:"reference",value:"me"}}}}];case"zh":return[{id:"event-zh-temporal-source",language:"zh",command:"on",priority:115,template:{format:"{event} 的时候 从 {source} {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"的时候",alternatives:["时候","时"]},{type:"literal",value:"从",alternatives:["在"]},{type:"role",role:"source"}]},extraction:{event:{position:0},source:{marker:"从",markerAlternatives:["在"]}}},{id:"event-zh-source",language:"zh",command:"on",priority:110,template:{format:"当 {event} 从 {source} {body}",tokens:[{type:"literal",value:"当"},{type:"role",role:"event"},{type:"literal",value:"从",alternatives:["在"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"从",markerAlternatives:["在"]}}},{id:"event-zh-immediate",language:"zh",command:"on",priority:108,template:{format:"一 {event} 就 {body}",tokens:[{type:"literal",value:"一"},{type:"role",role:"event"},{type:"literal",value:"就"}]},extraction:{event:{position:1}}},{id:"event-zh-temporal",language:"zh",command:"on",priority:105,template:{format:"{event} 的时候 {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"的时候",alternatives:["时候","时"]}]},extraction:{event:{position:0}}},{id:"event-zh-whenever",language:"zh",command:"on",priority:103,template:{format:"每当 {event} {body}",tokens:[{type:"literal",value:"每当",alternatives:["每次"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-zh-standard",language:"zh",command:"on",priority:100,template:{format:"当 {event} {body}",tokens:[{type:"literal",value:"当"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-zh-completion",language:"zh",command:"on",priority:95,template:{format:"{event} 了 {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"了"}]},extraction:{event:{position:0}}},{id:"event-zh-conditional",language:"zh",command:"on",priority:90,template:{format:"如果 {event} {body}",tokens:[{type:"literal",value:"如果",alternatives:["若","假如"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];default:return[]}}var iw,aw,ow,sw=vp({"src/patterns/event-handler.ts"(){tw={ko:{클릭:"click",입력:"input",변경:"change",제출:"submit",키다운:"keydown",키업:"keyup",마우스오버:"mouseover",마우스아웃:"mouseout",마우스다운:"mousedown",마우스업:"mouseup",포커스:"focus",블러:"blur",로드:"load",리사이즈:"resize",스크롤:"scroll"},ja:{クリック:"click",入力:"input",変更:"change",送信:"submit",キーダウン:"keydown",キーアップ:"keyup",キープレス:"keypress",マウスオーバー:"mouseover",マウスアウト:"mouseout",マウス押下:"mousedown",マウス解放:"mouseup",フォーカス:"focus",ブラー:"blur",ロード:"load",読み込み:"load",サイズ変更:"resize",スクロール:"scroll"},ar:{النقر:"click",نقر:"click",الإدخال:"input",إدخال:"input",التغيير:"change",تغيير:"change",الإرسال:"submit",إرسال:"submit","ضغط المفتاح":"keydown","رفع المفتاح":"keyup","تمرير الماوس":"mouseover",التركيز:"focus",تحميل:"load",تمرير:"scroll"},es:{clic:"click",click:"click",entrada:"input",cambio:"change",envío:"submit",enviar:"submit","tecla abajo":"keydown","tecla arriba":"keyup","ratón encima":"mouseover","ratón fuera":"mouseout",enfoque:"focus",desenfoque:"blur",carga:"load",desplazamiento:"scroll"},tr:{tıklama:"click",tıkla:"click",tık:"click",giriş:"input",girdi:"input",değişiklik:"change",değişim:"change",gönderme:"submit",gönder:"submit",tuşbasma:"keydown",tuşbırakma:"keyup",fare_bas:"mousedown",fare_bırak:"mouseup",fareiçinde:"mouseover",faredışında:"mouseout",odaklanma:"focus",odak:"focus",bulanıklık:"blur",yükleme:"load",yükle:"load",boyut_değiştir:"resize",kaydırma:"scroll"},pt:{clique:"click",clicar:"click",click:"click",entrada:"input",inserir:"input",mudança:"change",mudanca:"change",alterar:"change",envio:"submit",enviar:"submit","tecla baixo":"keydown","tecla cima":"keyup","pressionar tecla":"keydown","soltar tecla":"keyup","mouse sobre":"mouseover","mouse fora":"mouseout",foco:"focus",focar:"focus",desfoque:"blur",desfocar:"blur",carregar:"load",carregamento:"load",rolagem:"scroll",rolar:"scroll"},zh:{点击:"click",单击:"click",双击:"dblclick",输入:"input",改变:"change",变化:"change",变更:"change",提交:"submit",发送:"submit",按键:"keydown",键入:"keydown",松键:"keyup",鼠标进入:"mouseover",鼠标移入:"mouseover",鼠标离开:"mouseout",鼠标移出:"mouseout",焦点:"focus",聚焦:"focus",失焦:"blur",模糊:"blur",加载:"load",载入:"load",滚动:"scroll"},fr:{clic:"click",cliquer:"click",click:"click",saisie:"input",entrée:"input",changement:"change",changer:"change",soumettre:"submit",soumission:"submit",envoi:"submit","touche bas":"keydown","touche haut":"keyup","souris dessus":"mouseover","souris dehors":"mouseout",focus:"focus",focaliser:"focus",défocus:"blur",défocaliser:"blur",chargement:"load",charger:"load",défilement:"scroll",défiler:"scroll"},de:{klick:"click",klicken:"click",click:"click",eingabe:"input",eingeben:"input",änderung:"change",ändern:"change",absenden:"submit",einreichen:"submit","taste runter":"keydown","taste hoch":"keyup","maus über":"mouseover","maus raus":"mouseout",fokus:"focus",fokussieren:"focus",defokussieren:"blur",unschärfe:"blur",laden:"load",ladung:"load",scrollen:"scroll",blättern:"scroll"},id:{klik:"click",click:"click",masukan:"input",input:"input",ubah:"change",perubahan:"change",kirim:"submit","tekan tombol":"keydown","lepas tombol":"keyup","mouse masuk":"mouseover","mouse keluar":"mouseout",fokus:"focus",blur:"blur",muat:"load",memuat:"load",gulir:"scroll",menggulir:"scroll"},bn:{ক্লিক:"click",ইনপুট:"input",জমা:"submit",লোড:"load",স্ক্রোল:"scroll",রিসাইজ:"resize",ঝাপসা:"blur",ফোকাস:"focus",পরিবর্তন:"change"},qu:{click:"click","ñit'iy":"click",ñitiy:"click",yaykuchiy:"input",yaykuy:"input",tikray:"change","t'ikray":"change",apachiy:"submit",kachay:"submit","llave uray":"keydown","llave hawa":"keyup","q'away":"focus",qhaway:"focus",paqariy:"blur","mana q'away":"blur",cargay:"load",apakuy:"load",apamuy:"load",kunray:"scroll",muyuy:"scroll",hatun_kay:"resize"},sw:{bofya:"click",click:"click",kubofya:"click",ingiza:"input",kubadilisha:"change",mabadiliko:"change",tuma:"submit",kutuma:"submit","bonyeza chini":"keydown","bonyeza juu":"keyup","panya juu":"mouseover","panya nje":"mouseout",lenga:"focus",kulenga:"focus",blur:"blur",pakia:"load",kupakia:"load",sogeza:"scroll",kusogeza:"scroll"}}}});function lw(e,t){return e.replace(/\{(\w+)\}/g,(e,n)=>(t[n]??`{${n}}`)+"")}function cw(e,t,n={},r){const i=lw(aw[e],n),a=ow[e],o=a?lw(a,n):void 0;return{code:e,message:i,severity:t,...r&&{role:r},...o&&{suggestion:o}}}var uw,pw,mw=vp({"src/generators/schema-error-codes.ts"(){iw={AMBIGUOUS_TYPE_LITERAL_SELECTOR:"SCHEMA_AMBIGUOUS_TYPE_LITERAL_SELECTOR",TOO_MANY_EXPECTED_TYPES:"SCHEMA_TOO_MANY_EXPECTED_TYPES",MULTI_TYPE_PATIENT_EXPECTED:"SCHEMA_MULTI_TYPE_PATIENT_EXPECTED",NO_REQUIRED_ROLES:"SCHEMA_NO_REQUIRED_ROLES",NO_REQUIRED_ROLES_EXPECTED:"SCHEMA_NO_REQUIRED_ROLES_EXPECTED",TRANSITION_PATIENT_ACCEPTS_SELECTOR:"SCHEMA_TRANSITION_PATIENT_ACCEPTS_SELECTOR",TRANSITION_MISSING_GOAL:"SCHEMA_TRANSITION_MISSING_GOAL",EVENT_HANDLER_MISSING_EVENT:"SCHEMA_EVENT_HANDLER_MISSING_EVENT",EVENT_HANDLER_EVENT_NOT_REQUIRED:"SCHEMA_EVENT_HANDLER_EVENT_NOT_REQUIRED",CONDITIONAL_MISSING_CONDITION:"SCHEMA_CONDITIONAL_MISSING_CONDITION",CONDITIONAL_CONDITION_NOT_REQUIRED:"SCHEMA_CONDITIONAL_CONDITION_NOT_REQUIRED",FOR_LOOP_MISSING_SOURCE:"SCHEMA_FOR_LOOP_MISSING_SOURCE",WHILE_LOOP_MISSING_CONDITION:"SCHEMA_WHILE_LOOP_MISSING_CONDITION",VALUE_TYPE_MISMATCH:"SCHEMA_VALUE_TYPE_MISMATCH",SELECTOR_KIND_MISMATCH:"SCHEMA_SELECTOR_KIND_MISMATCH",SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE:"SCHEMA_SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE",KEYWORD_COLLISION:"PROFILE_KEYWORD_COLLISION"},aw={[iw.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[iw.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[iw.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[iw.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[iw.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[iw.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Transition command 'patient' role (CSS property name) should only accept 'literal', not 'selector'. CSS property names like 'background-color' are strings, not CSS selectors.",[iw.TRANSITION_MISSING_GOAL]:"Transition command requires a 'goal' role for the target value (to <value>). Without it, there's no way to specify what value to transition to.",[iw.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[iw.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[iw.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[iw.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[iw.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[iw.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[iw.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[iw.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[iw.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[iw.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},ow={[iw.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[iw.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[iw.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[iw.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[iw.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[iw.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[iw.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[iw.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[iw.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[iw.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[iw.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[iw.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[iw.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[iw.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."}}}),dw={};function fw(e){const t=[];for(const n of e.roles)n.expectedTypes.includes("literal")&&n.expectedTypes.includes("selector")&&("patient"===n.role&&uw.has(e.action)?t.push(cw(iw.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:n.role,command:e.action},n.role)):t.push(cw(iw.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:n.role},n.role))),n.expectedTypes.length>3&&!uw.has(e.action)&&t.push(cw(iw.TOO_MANY_EXPECTED_TYPES,"warning",{role:n.role,count:n.expectedTypes.length},n.role));for(const n of e.roles)n.selectorKinds&&n.selectorKinds.length>0&&(n.expectedTypes.includes("selector")||t.push(cw(iw.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:n.role},n.role)));switch(e.action){case"transition":!function(e,t){const n=e.roles.find(e=>"patient"===e.role),r=e.roles.find(e=>"goal"===e.role);n&&n.expectedTypes.includes("selector")&&t.push(cw(iw.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),n&&!r&&t.push(cw(iw.TRANSITION_MISSING_GOAL,"error",{}))}(e,t);break;case"on":!function(e,t){const n=e.roles.find(e=>"event"===e.role);n||t.push(cw(iw.EVENT_HANDLER_MISSING_EVENT,"warning",{})),n&&!n.required&&t.push(cw(iw.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}))}(e,t);break;case"if":case"unless":!function(e,t){const n=e.roles.find(e=>"condition"===e.role);n||t.push(cw(iw.CONDITIONAL_MISSING_CONDITION,"warning",{})),n&&!n.required&&t.push(cw(iw.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}))}(e,t);break;case"repeat":case"for":case"while":!function(e,t){"for"===e.action?e.roles.find(e=>"source"===e.role)||t.push(cw(iw.FOR_LOOP_MISSING_SOURCE,"warning",{})):"while"===e.action&&(e.roles.find(e=>"condition"===e.role)||t.push(cw(iw.WHILE_LOOP_MISSING_CONDITION,"warning",{})))}(e,t)}return 0===e.roles.filter(e=>e.required).length&&(pw.has(e.action)?t.push(cw(iw.NO_REQUIRED_ROLES_EXPECTED,"note",{command:e.action})):t.push(cw(iw.NO_REQUIRED_ROLES,"warning",{}))),function(e,t){return{action:e,items:t}}(e.action,t)}function yw(e,t={}){const n=new Map,{includeNotes:r=0}=t;for(const[t,i]of Object.entries(e)){const e=fw(i),a=e.items.some(e=>"warning"===e.severity||"error"===e.severity),o=r&&e.items.some(e=>"note"===e.severity);(a||o)&&n.set(t,e)}return n}function hw(e,t={}){const n=[],{showNotes:r=0,showCodes:i=1}=t;for(const[t,a]of e){const e=a.items.filter(e=>"error"===e.severity),o=a.items.filter(e=>"warning"===e.severity),s=a.items.filter(e=>"note"===e.severity);if(e.length>0){n.push(` ❌ ${t}:`);for(const t of e)n.push(` ERROR${i?` [${t.code}]`:""}: ${t.message}`),t.suggestion&&n.push(" 💡 Suggestion: "+t.suggestion)}if(o.length>0){n.push(` ⚠️ ${t}:`);for(const e of o)n.push(` ${i&&` [${e.code}]`?e.code+": ":""}${e.message}`),e.suggestion&&n.push(" 💡 "+e.suggestion)}if(r&&s.length>0){n.push(` ℹ️ ${t}:`);for(const e of s)n.push(` ${i&&` [${e.code}]`?e.code+": ":""}${e.message}`)}}return n.join("\n")}function vw(e){let t=0,n=0,r=0;const i={};for(const a of e.values())for(const e of a.items)"error"===e.severity?t++:"warning"===e.severity?n++:"note"===e.severity&&r++,i[e.code]=(i[e.code]||0)+1;return{totalCommands:e.size,errors:t,warnings:n,notes:r,byCode:i}}function gw(e,t){const n=[];for(const r of t){const t=e.roles.find(e=>e.role===r.role);t&&(t.expectedTypes.length>0&&!t.expectedTypes.includes(r.type)&&(t.expectedTypes.includes("expression")||n.push({level:"error",role:r.role,message:`${e.action}.${r.role} expects type [${t.expectedTypes.join(", ")}], got '${r.type}'`,code:iw.VALUE_TYPE_MISMATCH})),"selector"===r.type&&r.selectorKind&&t.selectorKinds&&t.selectorKinds.length>0&&(t.selectorKinds.includes(r.selectorKind)||n.push({level:"error",role:r.role,message:`${e.action}.${r.role} expects selector kind [${t.selectorKinds.join(", ")}], got '${r.selectorKind}'`,code:iw.SELECTOR_KIND_MISMATCH})))}return n}function bw(e){const t=[];if(!e.keywords)return{language:e.code,collisions:t};const n=new Map;for(const[t,r]of Object.entries(e.keywords)){if(!r||!r.primary)continue;const e=n.get(r.primary)||[];if(e.push({command:t,isPrimary:1}),n.set(r.primary,e),r.alternatives)for(const e of r.alternatives){const r=n.get(e)||[];r.push({command:t,isPrimary:0}),n.set(e,r)}}for(const[e,r]of n){const n=[...new Set(r.map(e=>e.command))];if(1>=n.length)continue;const i=r.filter(e=>e.isPrimary).length;let a;a=2>i?1===i?"primary-alternative":"alternative-alternative":"primary-primary",t.push({keyword:e,commands:n.sort(),type:a})}const r={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return t.sort((e,t)=>r[e.type]-r[t.type]),{language:e.code,collisions:t}}function ww(e){const t=[];for(const[,n]of Object.entries(e)){const e=bw(n);e.collisions.length>0&&t.push(e)}return t.sort((e,t)=>e.language.localeCompare(t.language))}gp(dw,{SchemaErrorCodes:()=>iw,formatValidationResults:()=>hw,getValidationStats:()=>vw,validateAllKeywordCollisions:()=>ww,validateAllSchemas:()=>yw,validateCommandSchema:()=>fw,validateKeywordCollisions:()=>bw,validateRoleValues:()=>gw});var kw,zw,xw,Ew,Sw,Tw,jw,Aw,Lw,Ow,Cw,Nw,Pw,Rw,$w,Iw,Mw,qw=vp({"src/generators/schema-validator.ts"(){mw(),uw=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),pw=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep","empty","open","close","select","clear","reset","breakpoint"])}});function _w(e){return Mw[e]}function Dw(){return Object.values(Mw).filter(e=>e.roles.length>0)}var Vw=vp({"src/generators/command-schemas.ts"(){Mw={toggle:kw={action:"toggle",description:"Toggle a class or attribute on/off",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to toggle",required:1,expectedTypes:["selector"],selectorKinds:["class","attribute"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","INVALID_CSS_PROPERTY"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"toggle command requires an argument"},{condition:"Class names are valid CSS identifiers",errorCode:"NO_VALID_CLASS_NAMES",message:"toggle command: no valid class names found"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to toggle",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",INVALID_CSS_PROPERTY:"Check CSS property name syntax (use kebab-case)"}},add:zw={action:"add",description:"Add a class or attribute to an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to add",required:1,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","PROPERTY_REQUIRES_VALUE"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"add command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to add",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",PROPERTY_REQUIRES_VALUE:"When adding a property (*prop), provide a value argument"}},remove:xw={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",targetRole:"source",roles:[{role:"patient",description:"The class or attribute to remove",required:1,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},put:Ew={action:"put",description:"Put content into a target element or variable",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to put",required:1,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:1,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"into"},markerVariants:{en:["before","after"]},methodCarrier:"method"}],errorCodes:["MISSING_ARGUMENTS","MISSING_CONTENT","MISSING_POSITION","INVALID_POSITION","NO_TARGET","NO_ELEMENTS"],preconditions:[{condition:"Command has content and position arguments",errorCode:"MISSING_ARGUMENTS",message:"put requires arguments"},{condition:"Content to put is specified",errorCode:"MISSING_CONTENT",message:"put requires content"},{condition:"Position keyword is specified (into, before, after, etc.)",errorCode:"MISSING_POSITION",message:"put requires position keyword"}],recoveryHints:{MISSING_ARGUMENTS:"Use syntax: put <content> into/before/after <target>",MISSING_CONTENT:"Add content to put (string, element, or expression)",MISSING_POSITION:"Add position keyword: into, before, after, at start of, at end of",INVALID_POSITION:"Valid positions: into, before, after, at start of, at end of",NO_TARGET:'Ensure target element exists or use "me" reference',NO_ELEMENTS:"Check that the selector matches existing elements"}},set:Sw={action:"set",description:"Set a property or variable to a value",category:"variable",primaryRole:"destination",roles:[{role:"destination",description:"The property or variable to set",required:1,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ja:"を",ko:"를",tr:"i",ar:"",sw:"",tl:"",bn:"কে",qu:"ta"}},{role:"patient",description:"The value to set",required:1,expectedTypes:["literal","expression","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"à",de:"auf",id:"ke",ja:"に",ko:"으로",tr:"e",ar:"إلى",sw:"kwenye",tl:"sa",bn:"তে",qu:"man"}}],errorCodes:["MISSING_TARGET","INVALID_TARGET","MISSING_VALUE","INVALID_SYNTAX"],preconditions:[{condition:"Command has a target variable or property",errorCode:"MISSING_TARGET",message:"set command requires a target"},{condition:"Target is a valid variable or property reference",errorCode:"INVALID_TARGET",message:"set command target must be a string or object literal"},{condition:'Value is specified with "to" keyword',errorCode:"MISSING_VALUE",message:'set command requires a value (use "to" keyword)'}],recoveryHints:{MISSING_TARGET:"Add a target: set :variable to value OR set element.property to value",INVALID_TARGET:'Use local variable (:name), element property (el.prop), or "the X of Y" syntax',MISSING_VALUE:'Add "to <value>" to specify what to set',INVALID_SYNTAX:"Use syntax: set <target> to <value>"}},show:Tw={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to show",required:1,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:0,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},hide:jw={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to hide",required:1,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:0,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},on:Aw={action:"on",description:"Handle an event",category:"event",primaryRole:"event",hasBody:1,roles:[{role:"event",description:"The event to handle",required:1,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to listen on (defaults to me)",required:0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},trigger:Lw={action:"trigger",description:"Trigger/dispatch an event",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to trigger (supports namespaced events like draggable:start)",required:1,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},wait:Ow={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"duration",roles:[{role:"duration",description:"Duration or event to wait for",required:1,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},fetch:Cw={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",roles:[{role:"source",description:"The URL to fetch from",required:1,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,renderOverride:{en:""}},{role:"responseType",description:"Response format (json, text, html, blob, etc.)",required:0,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"as"}},{role:"method",description:"HTTP method (GET, POST, etc.)",required:0,expectedTypes:["literal"],svoPosition:3,sovPosition:3},{role:"destination",description:"Where to store the result",required:0,expectedTypes:["selector","reference"],svoPosition:4,sovPosition:4}]},increment:Nw={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to increment",required:1,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:0,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},decrement:Pw={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to decrement",required:1,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:0,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},append:Rw={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to append",required:1,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:1,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},prepend:$w={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to prepend",required:1,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:1,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},log:{action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to log",required:1,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},get:{action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",roles:[{role:"source",description:"The source to get from",required:1,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",ja:"を",zh:"",ko:"를",ar:"على",tr:"i",id:"",sw:"",tl:"",bn:"কে",qu:"ta"}},{role:"destination",description:"Where to store the result (optional)",required:0,expectedTypes:["reference"],svoPosition:2,sovPosition:1}]},take:{action:"take",description:"Take content from a source element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The class or element to take",required:1,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to take from (defaults to me)",required:0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},make:{action:"make",description:"Create a new element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element type or selector to create",required:1,expectedTypes:["literal","selector"],svoPosition:1,sovPosition:1}]},halt:{action:"halt",description:"Halt/stop execution or event propagation",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"What to halt (event, default, bubbling, etc.)",required:0,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},settle:{action:"settle",description:"Wait for animations/transitions to settle",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"The element to settle (defaults to me)",required:0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},throw:{action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The error message or object to throw",required:1,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},send:{action:"send",description:"Send an event to an element",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to send",required:1,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to",ja:"に",ar:"إلى",es:"a",ko:"에게",zh:"到",tr:"-e",pt:"para",fr:"à",de:"an",id:"ke",qu:"-man",sw:"kwa"}}]},if:{action:"if",description:"Conditional execution",category:"control-flow",primaryRole:"condition",hasBody:1,roles:[{role:"condition",description:"The condition to evaluate",required:1,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},unless:{action:"unless",description:"Negated conditional execution (executes when condition is false)",category:"control-flow",primaryRole:"condition",hasBody:1,roles:[{role:"condition",description:"The condition to evaluate (body executes when false)",required:1,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},else:{action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:1,roles:[]},repeat:{action:"repeat",description:"Repeat a block of commands",category:"control-flow",primaryRole:"loopType",hasBody:1,roles:[{role:"loopType",description:"Loop variant: forever, times, for, while, until, until-event",required:1,expectedTypes:["literal"],svoPosition:0,sovPosition:0},{role:"quantity",description:"Number of times to repeat",required:0,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"event",description:"Event to wait for (terminates loop)",required:0,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"source",description:"Element to listen for event on",required:0,expectedTypes:["selector","reference"],svoPosition:3,sovPosition:3}],notes:'Can also use "repeat forever", "repeat until condition", or "repeat until event X from Y"'},for:{action:"for",description:"Iterate over a collection",category:"control-flow",primaryRole:"patient",hasBody:1,roles:[{role:"patient",description:"The iteration variable",required:1,expectedTypes:["reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The collection to iterate over",required:1,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"in"}}]},while:{action:"while",description:"Loop while condition is true",category:"control-flow",primaryRole:"condition",hasBody:1,roles:[{role:"condition",description:"The condition to check",required:1,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},continue:{action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},go:{action:"go",description:"Navigate to a URL",category:"navigation",primaryRole:"destination",roles:[{role:"destination",description:"The URL to navigate to",required:1,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"},renderOverride:{en:""}}]},scroll:{action:"scroll",description:"Scroll the viewport to a target element",category:"navigation",primaryRole:"destination",argSkipTokens:["of","the","top","bottom","middle","center","nearest","left","right","smoothly","instantly"],roles:[{role:"destination",description:"The element to scroll to",required:1,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"}}]},push:{action:"push",description:"Push a URL onto the browser history",category:"navigation",primaryRole:"patient",roles:[{role:"patient",description:"The URL to push (after the `url` keyword)",required:1,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:Iw={en:"url",es:"url",pt:"url",fr:"url",de:"url",it:"url",ja:"url",ko:"url",zh:"url",ar:"url",he:"url",hi:"url",bn:"url",tr:"url",ru:"url",uk:"url",pl:"url",id:"url",vi:"url",th:"url",ms:"url",tl:"url",sw:"url",qu:"url"}}]},replace:{action:"replace",description:"Replace the current browser history entry with a URL",category:"navigation",primaryRole:"patient",roles:[{role:"patient",description:"The URL to replace with (after the `url` keyword)",required:1,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:Iw}]},process:{action:"process",description:"Process hx-partial markup in HTML content",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The HTML content (string, element, or response) to process",required:1,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"partials in",es:"partials in",pt:"partials in",fr:"partials in",de:"partials in",it:"partials in",ja:"partials in",ko:"partials in",zh:"partials in",ar:"partials in",he:"partials in",hi:"partials in",bn:"partials in",tr:"partials in",ru:"partials in",uk:"partials in",pl:"partials in",id:"partials in",vi:"partials in",th:"partials in",ms:"partials in",tl:"partials in",sw:"partials in",qu:"partials in"}}]},transition:{action:"transition",description:"Transition an element with animation",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The property to transition (opacity, *background-color, etc.)",required:1,expectedTypes:["literal"],svoPosition:1,sovPosition:2,markerOverride:{en:"",ar:"",tl:"",sw:""}},{role:"goal",description:"The target value to transition to",required:1,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:3,markerOverride:{en:"to",ar:"إلى",tl:"sa",sw:"kwenye",bn:"তে",qu:"man",es:"a",pt:"para",fr:"à",de:"auf",ja:"に",ko:"으로",tr:"e",id:"ke"}},{role:"destination",description:"The target element (defaults to me)",required:0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:3,sovPosition:1},{role:"duration",description:"Transition duration (over 500ms, for 2 seconds)",required:0,expectedTypes:["literal"],svoPosition:4,sovPosition:4,markerOverride:{en:"over"}},{role:"style",description:"Easing function (ease-in, linear, etc.)",required:0,expectedTypes:["literal"],svoPosition:5,sovPosition:5}]},clone:{action:"clone",description:"Clone an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to clone",required:1,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"destination",description:"Where to put the clone",required:0,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"into"}}]},focus:{action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to focus (defaults to me)",required:0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},blur:{action:"blur",description:"Remove focus from an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to blur (defaults to me)",required:0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},empty:{action:"empty",description:"Remove all children from an element (sets innerHTML to empty)",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to empty (defaults to me)",required:0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},open:{action:"open",description:"Open a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to open (defaults to me)",required:0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2},{role:"style",description:"Open-mode variant (modal / non-modal) for <dialog>",required:0,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"as"}}]},close:{action:"close",description:"Close a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to close (defaults to me)",required:0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},select:{action:"select",description:"Select the contents of a text field or DOM element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element whose contents to select (defaults to me)",required:0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},clear:{action:"clear",description:"Clear a variable, local, or input element",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The variable or element to clear (defaults to me)",required:0,expectedTypes:["selector","reference","expression"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},reset:{action:"reset",description:"Reset a <form> element to its default values",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The form element to reset (defaults to me)",required:0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},breakpoint:{action:"breakpoint",description:"Drop into the debugger",category:"control-flow",primaryRole:"patient",roles:[]},call:{action:"call",description:"Call a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The function to call",required:1,expectedTypes:["expression","reference"],svoPosition:1,sovPosition:1}]},return:{action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The value to return",required:0,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},js:{action:"js",description:"Execute raw JavaScript code",category:"control-flow",primaryRole:"patient",hasBody:1,roles:[{role:"patient",description:"The JavaScript code to execute",required:0,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},async:{action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:1,roles:[]},tell:{action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",hasBody:1,roles:[{role:"destination",description:"The element to tell",required:1,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}}]},default:{action:"default",description:"Set a default value for a variable",category:"variable",primaryRole:"destination",roles:[{role:"destination",description:"The variable to set default for",required:1,expectedTypes:["reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ar:"",tl:"",sw:"",bn:"কে",qu:"ta"}},{role:"patient",description:"The default value",required:1,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",ar:"إلى",tl:"sa",sw:"kwenye",bn:"তে",qu:"man"}}]},init:{action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:1,roles:[]},behavior:{action:"behavior",description:"Define a reusable behavior",category:"control-flow",primaryRole:"patient",hasBody:1,roles:[{role:"patient",description:"The behavior name (PascalCase identifier)",required:1,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},install:{action:"install",description:"Install a behavior on an element",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The behavior name to install",required:1,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"Element to install on (defaults to me)",required:0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},measure:{action:"measure",description:"Measure element dimensions (x, y, width, height, etc.)",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"Property to measure (x, y, width, height, top, left, etc.)",required:0,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"source",description:"Element to measure (defaults to me)",required:0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},swap:{action:"swap",description:"Swap DOM content using various strategies (innerHTML, outerHTML, delete, etc.)",category:"dom-content",primaryRole:"destination",roles:[{role:"method",description:"The swap strategy (innerHTML, outerHTML, beforebegin, afterend, delete)",required:0,expectedTypes:["literal"],svoPosition:1,sovPosition:3,markerOverride:{en:""}},{role:"destination",description:"The element to swap content in/for",required:1,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"of"}},{role:"patient",description:"The content to swap in (optional for delete)",required:0,expectedTypes:["literal","expression","selector"],svoPosition:3,sovPosition:2,markerOverride:{en:"with"}}]},morph:{action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"destination",roles:[{role:"destination",description:"The element to morph",required:1,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}},{role:"patient",description:"The target content/element to morph into",required:1,expectedTypes:["literal","expression","selector"],svoPosition:2,sovPosition:2,markerOverride:{en:"to"}}]},beep:{action:"beep",description:"Debug output for expressions with type information",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The expression(s) to debug",required:0,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},break:{action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},copy:{action:"copy",description:"Copy text or element content to the clipboard",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The text or element to copy",required:1,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},exit:{action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},pick:{action:"pick",description:"Select a random element from a collection",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The items to pick from",required:1,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1},{role:"source",description:'The array to pick from (with "from" keyword)',required:0,expectedTypes:["reference","expression"],svoPosition:2,sovPosition:2}]},render:{action:"render",description:"Render a template with optional variables",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The template to render",required:1,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"style",description:"Variables to pass to the template (with keyword)",required:0,expectedTypes:["expression","reference"],svoPosition:2,sovPosition:1}]},compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:1,roles:[]}},"undefined"!=typeof process&&"production"!==process.env.NODE_ENV&&Promise.resolve().then(()=>(qw(),dw)).then(({validateAllSchemas:e,formatValidationResults:t})=>{const n=e(Mw);n.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(t(n)),console.warn("\nThese warnings help identify potential schema design issues."),console.warn("Fix them to improve type inference and avoid runtime bugs."))}).catch(e=>{console.debug("Schema validation skipped:",e)})}});function Hw(e,t){const n="SOV"===t?"sovPosition":"svoPosition";return[...e].sort((e,t)=>(e[n]??99)-(t[n]??99))}var Fw=vp({"src/parser/utils/role-positioning.ts"(){}}),Bw=vp({"src/parser/utils/marker-resolution.ts"(){}}),Uw=vp({"src/generators/event-handlers-sov.ts"(){}});function Gw(e,t,n,r,i){const a=[];"before"===r.position&&a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),a.push({type:"role",role:"event",optional:0}),a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary}),a.push({type:"role",role:"patient",optional:0});const o=t.roleMarkers.destination;return o&&a.push({type:"group",optional:1,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:1}]}),{id:`${e.action}-event-${t.code}-vso`,language:t.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`${r.primary} {event} ${n.primary} {patient} ${o?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Ww(e,t,n,r,i){const a=[];"before"===r.position&&a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),a.push({type:"role",role:"event",optional:0}),a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary});const o=[...e.roles.filter(e=>e.required)].sort((e,t)=>(e.svoPosition??999)-(t.svoPosition??999));for(const e of o){let n,r;if(e.markerOverride&&void 0!==e.markerOverride[t.code])n=e.markerOverride[t.code];else{const i=t.roleMarkers[e.role];i&&(n=i.primary,r=i.alternatives)}n&&a.push(r?{type:"literal",value:n,alternatives:r}:{type:"literal",value:n}),a.push({type:"role",role:e.role,optional:0})}const s=o.map(e=>`{${e.role}}`).join(" ");return{id:`${e.action}-event-${t.code}-vso-2role`,language:t.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`${r.primary} {event} ${n.primary} ${s}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},...Object.fromEntries(o.map(e=>[e.role,{fromRole:e.role}]))}}}var Kw,Jw=vp({"src/generators/event-handlers-vso.ts"(){}});function Zw(){return jp().map(e=>Tp(e)).filter(e=>void 0!==e)}function Yw(e,t,n=Kw){const r=`${e.action}-${t.code}-generated`,i=n.basePriority??100,a=t.keywords[e.action];if(!a)throw Error(`No keyword translation for '${e.action}' in ${t.code}`);const o=function(e,t,n){const r=[],i=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary},a=function(e,t){const n=[],r=Hw(e.roles,t.wordOrder);for(const e of r){const r=nk(e,t);e.required?n.push(...r):n.push({type:"group",optional:1,tokens:r})}return n}(e,t);switch(t.wordOrder){case"SVO":case"VSO":default:r.push(i),r.push(...a);break;case"SOV":r.push(...a),r.push(i)}return r}(e,t,a),s=rk(e,t),l=function(e,t,n){const r=[],i=Hw(e.roles,t.wordOrder).map(e=>{const n=function(e,t){const n=e.markerOverride?.[t.code],r=t.roleMarkers[e.role];if(void 0!==n)return{primary:n,position:r?.position??"before",isOverride:1};if(r&&r.primary){const e={primary:r.primary,position:r.position,isOverride:0};return r.alternatives&&(e.alternatives=r.alternatives),e}return null}(e,t);let r="";return r=n&&n.primary?"before"===n.position?`${n.primary} {${e.role}}`:`{${e.role}} ${n.primary}`:`{${e.role}}`,e.required?r:`[${r}]`});switch(t.wordOrder){case"SVO":case"VSO":default:r.push(n.primary,...i);break;case"SOV":r.push(...i,n.primary)}return r.join(" ")}(e,t,a);return{id:r,language:t.code,command:e.action,priority:i,template:{format:l,tokens:o},extraction:s}}function Xw(e,t,n=Kw){if(0===e.roles.filter(e=>!e.required).length)return null;const r=e.roles.filter(e=>e.required);return{...Yw({...e,roles:r},t,n),id:`${e.action}-${t.code}-generated-simple`,priority:(n.basePriority??100)-5,extraction:rk(e,t)}}function Qw(e,t,n=Kw){const r=[];if(r.push(Yw(e,t,n)),n.generateSimpleVariants){const i=Xw(e,t,n);i&&r.push(i)}return r}function ek(e,t=Kw){const n=[],r=Dw();for(const i of r){if(!e.keywords[i.action])continue;const r=Qw(i,e,t);if(n.push(...r),e.eventHandler?.eventMarker){const r=tk(i,e,t);n.push(...r)}}return n}function tk(e,t,n=Kw){if(!t.eventHandler||!t.eventHandler.eventMarker)return[];const r=[],i=t.eventHandler.eventMarker,a=t.keywords[e.action];if(!a)return[];const o=2===e.roles.filter(e=>e.required).length;if("SOV"===t.wordOrder)if(o)r.push(function(e,t,n,r,i){const a=[];if(a.push({type:"role",role:"event",optional:0}),"after"===r.position){const e=r.primary.split(/\s+/);if(e.length>1)for(const t of e)a.push({type:"literal",value:t});else a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary})}const o=[...e.roles.filter(e=>e.required)].sort((e,t)=>(e.sovPosition??999)-(t.sovPosition??999));for(const e of o){let n,r;if(a.push({type:"role",role:e.role,optional:0}),e.markerOverride&&void 0!==e.markerOverride[t.code])n=e.markerOverride[t.code];else{const i=t.roleMarkers[e.role];i&&(n=i.primary,r=i.alternatives)}n&&a.push(r?{type:"literal",value:n,alternatives:r}:{type:"literal",value:n})}a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary});const s=o.map(e=>`{${e.role}}`).join(" ");return{id:`${e.action}-event-${t.code}-sov-2role`,language:t.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`{event} ${r.primary} ${s} ${n.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},...Object.fromEntries(o.map(e=>[e.role,{fromRole:e.role}]))}}}(e,t,a,i,n)),r.push(function(e,t,n,r,i){const a=[],o=[...e.roles.filter(e=>e.required)].sort((e,t)=>(e.sovPosition??999)-(t.sovPosition??999)),s=o[0];let l;if(a.push({type:"role",role:s.role,optional:0}),s.markerOverride&&void 0!==s.markerOverride[t.code])l=s.markerOverride[t.code];else{const e=t.roleMarkers[s.role];e&&(l=e.primary)}if(l&&a.push({type:"literal",value:l}),a.push({type:"role",role:"event",optional:0}),"after"===r.position){const e=r.primary.split(/\s+/);if(e.length>1)for(const t of e)a.push({type:"literal",value:t});else a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary})}a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary});const c=o[1];let u,p;if(a.push({type:"role",role:c.role,optional:0}),c.markerOverride&&void 0!==c.markerOverride[t.code])u=c.markerOverride[t.code];else{const e=t.roleMarkers[c.role];e&&(u=e.primary,p=e.alternatives)}return u&&a.push(p?{type:"literal",value:u,alternatives:p}:{type:"literal",value:u}),{id:`${e.action}-event-${t.code}-sov-2role-dest-first`,language:t.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{${s.role}} {event} ${r.primary} ${n.primary} {${c.role}}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},[s.role]:{fromRole:s.role},[c.role]:{fromRole:c.role}}}}(e,t,a,i,n));else{r.push(function(e,t,n,r,i){const a=[];if(a.push({type:"role",role:"event",optional:0}),"after"===r.position){const e=r.primary.split(/\s+/);if(e.length>1)for(const t of e)a.push({type:"literal",value:t});else a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary})}const o=t.roleMarkers.destination;o&&a.push({type:"group",optional:1,tokens:[{type:"role",role:"destination",optional:1},o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary}]}),a.push({type:"role",role:"patient",optional:0});const s=t.roleMarkers.patient;return s&&a.push(s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary}),a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary}),{id:`${e.action}-event-${t.code}-sov`,language:t.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`{event} ${r.primary} {destination?} {patient} ${s?.primary||""} ${n.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}(e,t,a,i,n)),r.push(function(e,t,n,r,i){const a=[];a.push({type:"role",role:"patient",optional:0});const o=t.roleMarkers.patient;if(o&&a.push(o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary}),a.push({type:"role",role:"event",optional:0}),"after"===r.position){const e=r.primary.split(/\s+/);if(e.length>1)for(const t of e)a.push({type:"literal",value:t});else a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary})}return a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary}),{id:`${e.action}-event-${t.code}-sov-patient-first`,language:t.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`{patient} ${o?.primary||""} {event} ${r.primary} ${n.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}(e,t,a,i,n));const o=t.roleMarkers.destination;o&&o.primary!==i.primary&&r.push(function(e,t,n,r,i){const a=[];a.push({type:"role",role:"patient",optional:0});const o=t.roleMarkers.patient;o&&a.push(o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary});const s=t.roleMarkers.destination;if(s&&(a.push({type:"role",role:"destination",optional:0}),a.push(s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary})),a.push({type:"role",role:"event",optional:0}),"after"===r.position){const e=r.primary.split(/\s+/);if(e.length>1)for(const t of e)a.push({type:"literal",value:t});else a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary})}return a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary}),{id:`${e.action}-event-${t.code}-sov-patient-first-dest`,language:t.code,command:"on",priority:(i.basePriority??100)+40,template:{format:`{patient} ${o?.primary||""} {destination} ${s?.primary||""} {event} ${r.primary} ${n.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}(e,t,a,i,n));const s=i.primary.split(/\s+/),l=i.alternatives?.some(e=>!e.includes(" ")&&e.length>1);s.length>1&&l&&r.push(function(e,t,n,r,i){const a=[];a.push({type:"role",role:"event",optional:0});const o=r.alternatives?.filter(e=>!e.includes(" ")&&e.length>1)||[];o.length>0&&a.push({type:"literal",value:o[0],alternatives:o.slice(1)});const s=t.roleMarkers.destination;s&&a.push({type:"group",optional:1,tokens:[{type:"role",role:"destination",optional:1},s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary}]}),a.push({type:"role",role:"patient",optional:0});const l=t.roleMarkers.patient;return l&&a.push(l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary}),a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary}),{id:`${e.action}-event-${t.code}-sov-compact`,language:t.code,command:"on",priority:(i.basePriority??100)+52,template:{format:`{event}${o[0]||""} {patient} ${n.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}(e,t,a,i,n)),r.push(function(e,t,n,r,i){const a=[];if(a.push({type:"role",role:"event",optional:0}),"after"===r.position){const e=r.primary.split(/\s+/);if(e.length>1)for(const t of e)a.push({type:"literal",value:t});else a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary})}return a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary}),{id:`${e.action}-event-${t.code}-sov-simple`,language:t.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{event} ${r.primary} ${n.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}(e,t,a,i,n));const c=function(e,t,n,r){const i=t.eventHandler?.temporalMarkers;if(!i||0===i.length)return null;const a=[];a.push({type:"role",role:"event",optional:0}),t.possessive?.marker&&a.push({type:"group",optional:1,tokens:[{type:"literal",value:t.possessive.marker}]}),a.push({type:"literal",value:i[0],alternatives:i.slice(1)}),a.push({type:"role",role:"patient",optional:0});const o=t.roleMarkers.patient;return o?.primary&&a.push(o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary}),a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary}),{id:`${e.action}-event-${t.code}-sov-temporal`,language:t.code,command:"on",priority:(r.basePriority??100)+49,template:{format:`{event} ${i[0]} {patient} ${n.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}(e,t,a,n);c&&r.push(c)}else"VSO"===t.wordOrder?o?(r.push(Ww(e,t,a,i,n)),r.push(function(e,t,n,r,i){const a=[];a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary});const o=[...e.roles.filter(e=>e.required)].sort((e,t)=>(e.svoPosition??999)-(t.svoPosition??999));for(const e of o){let n,r;if(e.markerOverride&&void 0!==e.markerOverride[t.code])n=e.markerOverride[t.code];else{const i=t.roleMarkers[e.role];i&&(n=i.primary,r=i.alternatives)}n&&a.push(r?{type:"literal",value:n,alternatives:r}:{type:"literal",value:n}),a.push({type:"role",role:e.role,optional:0})}"before"===r.position&&a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),a.push({type:"role",role:"event",optional:0});const s=o.map(e=>`{${e.role}}`).join(" ");return{id:`${e.action}-event-${t.code}-vso-verb-first-2role`,language:t.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${n.primary} ${s} ${r.primary} {event}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},...Object.fromEntries(o.map(e=>[e.role,{fromRole:e.role}]))}}}(e,t,a,i,n))):(r.push(Gw(e,t,a,i,n)),r.push(function(e,t,n,r,i){const a=[];a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary}),a.push({type:"role",role:"patient",optional:0});const o=t.roleMarkers.destination;return o&&a.push({type:"group",optional:1,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:1}]}),"before"===r.position&&a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),a.push({type:"role",role:"event",optional:0}),{id:`${e.action}-event-${t.code}-vso-verb-first`,language:t.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`${n.primary} {patient} ${o?.primary||""} {destination?} ${r.primary} {event}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}(e,t,a,i,n)),t.eventHandler?.negationMarker&&r.push(function(e,t,n,r,i){const a=[],o=t.eventHandler?.negationMarker;"before"===r.position&&a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),o&&a.push(o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary}),a.push({type:"role",role:"event",optional:0}),a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary}),a.push({type:"role",role:"patient",optional:0});const s=t.roleMarkers.destination;return s&&a.push({type:"group",optional:1,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:1}]}),{id:`${e.action}-event-${t.code}-vso-negated`,language:t.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${r.primary} ${o?.primary||""} {event} ${n.primary} {patient} ${s?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}(e,t,a,i,n)),t.tokenization?.prefixes&&r.push(function(e,t,n,r){const i=[];i.push({type:"literal",value:"and",alternatives:["then"]}),i.push({type:"role",role:"event",optional:0}),i.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary}),i.push({type:"role",role:"patient",optional:0});const a=t.roleMarkers.destination;return a&&i.push({type:"group",optional:1,tokens:[a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary},{type:"role",role:"destination",optional:1}]}),{id:`${e.action}-event-${t.code}-vso-proclitic`,language:t.code,command:"on",priority:(r.basePriority??100)+45,template:{format:`[proclitic?] {event} ${n.primary} {patient} ${a?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}(e,t,a,n))):r.push(o?Ww(e,t,a,i,n):Gw(e,t,a,i,n));return r}function nk(e,t){const n=[],r=e.markerOverride?.[t.code],i=t.roleMarkers[e.role],a={type:"role",role:e.role,optional:!e.required,expectedTypes:e.expectedTypes};if(void 0!==r){const e=r?r.split(/\s+/).filter(Boolean):[];if("before"===(i?.position??"before")){for(const t of e)n.push({type:"literal",value:t});n.push(a)}else{n.push(a);for(const t of e)n.push({type:"literal",value:t})}}else i?"before"===i.position?(i.primary&&n.push(i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary}),n.push(a)):(n.push(a),n.push(i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary})):n.push(a);return n}function rk(e,t){const n=function(e,t){const n={};for(const r of e.roles){const e=r.markerOverride?.[t.code],i=t.roleMarkers[r.role];n[r.role]=void 0!==e?e?{marker:e}:{}:i&&i.primary?i.alternatives?{marker:i.primary,markerAlternatives:i.alternatives}:{marker:i.primary}:{}}return n}(e,t),r={};for(const t of e.roles){const e=n[t.role]||{};r[t.role]=!t.required&&t.default?{...e,default:t.default}:e}return r}var ik=vp({"src/generators/pattern-generator.ts"(){Vw(),Fw(),Bw(),Uw(),Jw(),Cp(),Kw={basePriority:100,generateSimpleVariants:1,generateAlternatives:1}}});function ak(e){switch(e){case"bn":return[{id:"toggle-bn-full",language:"bn",command:"toggle",priority:100,template:{format:"{patient} কে টগল করুন",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"টগল",alternatives:["পরিবর্তন"]},{type:"literal",value:"করুন"}]},extraction:{patient:{position:0}}},{id:"toggle-bn-simple",language:"bn",command:"toggle",priority:90,template:{format:"টগল {patient}",tokens:[{type:"literal",value:"টগল",alternatives:["পরিবর্তন"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"toggle-bn-with-dest",language:"bn",command:"toggle",priority:95,template:{format:"{destination} এ {patient} কে টগল করুন",tokens:[{type:"role",role:"destination"},{type:"literal",value:"এ",alternatives:["তে"]},{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"টগল",alternatives:["পরিবর্তন"]},{type:"literal",value:"করুন"}]},extraction:{destination:{position:0},patient:{position:2}}}];case"en":return[{id:"toggle-en-full",language:"en",command:"toggle",priority:100,template:{format:"toggle {patient} on {target}",tokens:[{type:"literal",value:"toggle"},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"on",alternatives:["from"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"on",markerAlternatives:["from"],default:{type:"reference",value:"me"}}}},{id:"toggle-en-simple",language:"en",command:"toggle",priority:90,template:{format:"toggle {patient}",tokens:[{type:"literal",value:"toggle"},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"es":return[{id:"toggle-es-full",language:"es",command:"toggle",priority:100,template:{format:"alternar {patient} en {target}",tokens:[{type:"literal",value:"alternar",alternatives:["cambiar","toggle"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"en",alternatives:["sobre","de"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"en",markerAlternatives:["sobre","de"],default:{type:"reference",value:"me"}}}},{id:"toggle-es-simple",language:"es",command:"toggle",priority:90,template:{format:"alternar {patient}",tokens:[{type:"literal",value:"alternar",alternatives:["cambiar","toggle"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"hi":return[{id:"toggle-hi-full",language:"hi",command:"toggle",priority:100,template:{format:"{patient} को {destination} पर टॉगल करें",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"role",role:"destination"},{type:"literal",value:"पर"},{type:"literal",value:"टॉगल",alternatives:["बदलें","बदल"]},{type:"group",optional:1,tokens:[{type:"literal",value:"करें",alternatives:["करो"]}]}]},extraction:{patient:{position:0},destination:{marker:"को",position:2}}},{id:"toggle-hi-simple",language:"hi",command:"toggle",priority:90,template:{format:"{patient} टॉगल करें",tokens:[{type:"role",role:"patient"},{type:"literal",value:"टॉगल",alternatives:["बदलें","बदल"]},{type:"group",optional:1,tokens:[{type:"literal",value:"करें",alternatives:["करो"]}]}]},extraction:{patient:{position:0},destination:{default:{type:"reference",value:"me"}}}},{id:"toggle-hi-bare",language:"hi",command:"toggle",priority:80,template:{format:"टॉगल {patient}",tokens:[{type:"literal",value:"टॉगल",alternatives:["बदलें","बदल"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"it":return[{id:"toggle-it-full",language:"it",command:"toggle",priority:100,template:{format:"commutare {patient} su {target}",tokens:[{type:"literal",value:"commutare",alternatives:["alternare","toggle","cambiare"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"su",alternatives:["in","di"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"su",markerAlternatives:["in","di"],default:{type:"reference",value:"me"}}}},{id:"toggle-it-simple",language:"it",command:"toggle",priority:90,template:{format:"commutare {patient}",tokens:[{type:"literal",value:"commutare",alternatives:["alternare","toggle","cambiare"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"pl":return[{id:"toggle-pl-full",language:"pl",command:"toggle",priority:100,template:{format:"przełącz {patient} na {destination}",tokens:[{type:"literal",value:"przełącz",alternatives:["przelacz","przełączaj"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"na",alternatives:["w","dla"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"na",markerAlternatives:["w","dla"],default:{type:"reference",value:"me"}}}},{id:"toggle-pl-simple",language:"pl",command:"toggle",priority:90,template:{format:"przełącz {patient}",tokens:[{type:"literal",value:"przełącz",alternatives:["przelacz","przełączaj"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"qu":return[{id:"toggle-qu-sov",language:"qu",command:"toggle",priority:100,template:{format:"{patient} ta t'ikray",tokens:[{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"t'ikray",alternatives:["tikray","kutichiy"]}]},extraction:{patient:{position:0}}},{id:"toggle-qu-simple",language:"qu",command:"toggle",priority:90,template:{format:"t'ikray {patient}",tokens:[{type:"literal",value:"t'ikray",alternatives:["tikray","kutichiy"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"toggle-qu-with-dest",language:"qu",command:"toggle",priority:95,template:{format:"{destination} pi {patient} ta t'ikray",tokens:[{type:"role",role:"destination"},{type:"literal",value:"pi"},{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"t'ikray",alternatives:["tikray","kutichiy"]}]},extraction:{destination:{position:0},patient:{position:2}}},{id:"toggle-qu-dest-man",language:"qu",command:"toggle",priority:93,template:{format:"{destination} man {patient} ta t'ikray",tokens:[{type:"role",role:"destination"},{type:"literal",value:"man"},{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"t'ikray",alternatives:["tikray","kutichiy"]}]},extraction:{destination:{position:0},patient:{position:2}}}];case"ru":return[{id:"toggle-ru-full",language:"ru",command:"toggle",priority:100,template:{format:"переключить {patient} на {destination}",tokens:[{type:"literal",value:"переключить",alternatives:["переключи"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"на",alternatives:["в","для"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"на",markerAlternatives:["в","для"],default:{type:"reference",value:"me"}}}},{id:"toggle-ru-simple",language:"ru",command:"toggle",priority:90,template:{format:"переключить {patient}",tokens:[{type:"literal",value:"переключить",alternatives:["переключи"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"th":return[{id:"toggle-th-simple",language:"th",command:"toggle",priority:100,template:{format:"สลับ {patient}",tokens:[{type:"literal",value:"สลับ"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"toggle-th-with-dest",language:"th",command:"toggle",priority:95,template:{format:"สลับ {patient} ใน {destination}",tokens:[{type:"literal",value:"สลับ"},{type:"role",role:"patient"},{type:"literal",value:"ใน"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"ใน",position:3}}}];case"uk":return[{id:"toggle-uk-full",language:"uk",command:"toggle",priority:100,template:{format:"перемкнути {patient} на {destination}",tokens:[{type:"literal",value:"перемкнути",alternatives:["перемкни"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"на",alternatives:["в","для"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"на",markerAlternatives:["в","для"],default:{type:"reference",value:"me"}}}},{id:"toggle-uk-simple",language:"uk",command:"toggle",priority:90,template:{format:"перемкнути {patient}",tokens:[{type:"literal",value:"перемкнути",alternatives:["перемкни"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"vi":return[{id:"toggle-vi-full",language:"vi",command:"toggle",priority:100,template:{format:"chuyển đổi {patient} trên {target}",tokens:[{type:"literal",value:"chuyển đổi",alternatives:["chuyển","bật tắt"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"trên",alternatives:["tại","ở"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"trên",markerAlternatives:["tại","ở"],default:{type:"reference",value:"me"}}}},{id:"toggle-vi-simple",language:"vi",command:"toggle",priority:90,template:{format:"chuyển đổi {patient}",tokens:[{type:"literal",value:"chuyển đổi",alternatives:["chuyển","bật tắt"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"zh":return[{id:"toggle-zh-full",language:"zh",command:"toggle",priority:100,template:{format:"切换 {patient} 在 {target}",tokens:[{type:"literal",value:"切换"},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"在",alternatives:["到","于"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"在",markerAlternatives:["到","于"],default:{type:"reference",value:"me"}}}},{id:"toggle-zh-simple",language:"zh",command:"toggle",priority:90,template:{format:"切换 {patient}",tokens:[{type:"literal",value:"切换"},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}},{id:"toggle-zh-ba",language:"zh",command:"toggle",priority:95,template:{format:"把 {patient} 切换",tokens:[{type:"literal",value:"把"},{type:"role",role:"patient"},{type:"literal",value:"切换"}]},extraction:{patient:{marker:"把"},destination:{default:{type:"reference",value:"me"}}}},{id:"toggle-zh-full-ba",language:"zh",command:"toggle",priority:98,template:{format:"在 {target} 把 {patient} 切换",tokens:[{type:"literal",value:"在",alternatives:["到","于"]},{type:"role",role:"destination"},{type:"literal",value:"把"},{type:"role",role:"patient"},{type:"literal",value:"切换"}]},extraction:{destination:{marker:"在",markerAlternatives:["到","于"]},patient:{marker:"把"}}}];default:return[]}}var ok=vp({"src/patterns/toggle.ts"(){}});function sk(e){switch(e){case"bn":return[{id:"put-bn-full",language:"bn",command:"put",priority:100,template:{format:"{patient} কে {destination} এ রাখুন",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"role",role:"destination"},{type:"literal",value:"এ",alternatives:["তে"]},{type:"literal",value:"রাখুন",alternatives:["রাখ"]}]},extraction:{patient:{position:0},destination:{marker:"এ",position:2}}},{id:"put-bn-simple",language:"bn",command:"put",priority:90,template:{format:"রাখুন {patient} {destination} এ",tokens:[{type:"literal",value:"রাখুন",alternatives:["রাখ"]},{type:"role",role:"patient"},{type:"role",role:"destination"},{type:"literal",value:"এ",alternatives:["তে"]}]},extraction:{patient:{position:1},destination:{position:2}}}];case"en":return[{id:"put-en-into",language:"en",command:"put",priority:100,template:{format:"put {patient} into {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"into",alternatives:["in","to"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"into",markerAlternatives:["in","to"]}}},{id:"put-en-before",language:"en",command:"put",priority:95,template:{format:"put {patient} before {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"before"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"before"},manner:{default:{type:"literal",value:"before"}}}},{id:"put-en-after",language:"en",command:"put",priority:95,template:{format:"put {patient} after {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"after"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"after"},manner:{default:{type:"literal",value:"after"}}}}];case"es":return[{id:"put-es-full",language:"es",command:"put",priority:100,template:{format:"poner {patient} en {destination}",tokens:[{type:"literal",value:"poner",alternatives:["pon","colocar","put"]},{type:"role",role:"patient"},{type:"literal",value:"en",alternatives:["dentro de","a"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"en",markerAlternatives:["dentro de","a"]}}},{id:"put-es-before",language:"es",command:"put",priority:95,template:{format:"poner {patient} antes de {destination}",tokens:[{type:"literal",value:"poner",alternatives:["pon","colocar"]},{type:"role",role:"patient"},{type:"literal",value:"antes de",alternatives:["antes"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"antes de",markerAlternatives:["antes"]},manner:{default:{type:"literal",value:"before"}}}},{id:"put-es-after",language:"es",command:"put",priority:95,template:{format:"poner {patient} después de {destination}",tokens:[{type:"literal",value:"poner",alternatives:["pon","colocar"]},{type:"role",role:"patient"},{type:"literal",value:"después de",alternatives:["despues de","después"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"después de",markerAlternatives:["despues de","después"]},manner:{default:{type:"literal",value:"after"}}}}];case"hi":return[{id:"put-hi-full",language:"hi",command:"put",priority:100,template:{format:"{patient} को {destination} में रखें",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"role",role:"destination"},{type:"literal",value:"में"},{type:"literal",value:"रखें",alternatives:["रख","डालें","डाल"]}]},extraction:{patient:{position:0},destination:{marker:"में",position:3}}},{id:"put-hi-simple",language:"hi",command:"put",priority:90,template:{format:"{patient} रखें",tokens:[{type:"role",role:"patient"},{type:"literal",value:"रखें",alternatives:["रख","डालें","डाल"]}]},extraction:{patient:{position:0},destination:{default:{type:"reference",value:"me"}}}},{id:"put-hi-bare",language:"hi",command:"put",priority:80,template:{format:"रखें {patient}",tokens:[{type:"literal",value:"रखें",alternatives:["रख","डालें","डाल"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"id":return[{id:"put-id-full",language:"id",command:"put",priority:100,template:{format:"taruh {patient} ke dalam {destination}",tokens:[{type:"literal",value:"taruh",alternatives:["letakkan","masukkan","tempatkan","put"]},{type:"role",role:"patient",expectedTypes:["literal","selector","reference","expression"]},{type:"literal",value:"ke"},{type:"literal",value:"dalam",alternatives:["di"]},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{position:4}}},{id:"put-id-simple-ke",language:"id",command:"put",priority:95,template:{format:"taruh {patient} ke {destination}",tokens:[{type:"literal",value:"taruh",alternatives:["letakkan","masukkan","tempatkan"]},{type:"role",role:"patient",expectedTypes:["literal","selector","reference","expression"]},{type:"literal",value:"ke",alternatives:["di","pada"]},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{position:3}}},{id:"put-id-di",language:"id",command:"put",priority:90,template:{format:"taruh {patient} di {destination}",tokens:[{type:"literal",value:"taruh",alternatives:["letakkan","masukkan"]},{type:"role",role:"patient",expectedTypes:["literal","selector","reference","expression"]},{type:"literal",value:"di"},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{position:3}}}];case"it":return[{id:"put-it-full",language:"it",command:"put",priority:100,template:{format:"mettere {patient} in {target}",tokens:[{type:"literal",value:"mettere",alternatives:["metti","inserire","put"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"in",alternatives:["dentro","nel"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"in",markerAlternatives:["dentro","nel"]}}},{id:"put-it-simple",language:"it",command:"put",priority:90,template:{format:"mettere {patient}",tokens:[{type:"literal",value:"mettere",alternatives:["metti","inserire","put"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"pl":return[{id:"put-pl-full",language:"pl",command:"put",priority:100,template:{format:"umieść {patient} w {destination}",tokens:[{type:"literal",value:"umieść",alternatives:["umiesc","wstaw","włóż","wloz"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"w",alternatives:["do","na"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"w",markerAlternatives:["do","na"]}}},{id:"put-pl-before",language:"pl",command:"put",priority:95,template:{format:"umieść {patient} przed {destination}",tokens:[{type:"literal",value:"umieść",alternatives:["umiesc","wstaw"]},{type:"role",role:"patient"},{type:"literal",value:"przed"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"przed"},manner:{default:{type:"literal",value:"before"}}}},{id:"put-pl-after",language:"pl",command:"put",priority:95,template:{format:"umieść {patient} po {destination}",tokens:[{type:"literal",value:"umieść",alternatives:["umiesc","wstaw"]},{type:"role",role:"patient"},{type:"literal",value:"po"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"po"},manner:{default:{type:"literal",value:"after"}}}}];case"ru":return[{id:"put-ru-full",language:"ru",command:"put",priority:100,template:{format:"положить {patient} в {destination}",tokens:[{type:"literal",value:"положить",alternatives:["положи","поместить","помести","вставить","вставь"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"в",alternatives:["во","на"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"в",markerAlternatives:["во","на"]}}},{id:"put-ru-before",language:"ru",command:"put",priority:95,template:{format:"положить {patient} перед {destination}",tokens:[{type:"literal",value:"положить",alternatives:["положи","поместить","помести"]},{type:"role",role:"patient"},{type:"literal",value:"перед",alternatives:["до"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"перед",markerAlternatives:["до"]},manner:{default:{type:"literal",value:"before"}}}},{id:"put-ru-after",language:"ru",command:"put",priority:95,template:{format:"положить {patient} после {destination}",tokens:[{type:"literal",value:"положить",alternatives:["положи","поместить","помести"]},{type:"role",role:"patient"},{type:"literal",value:"после"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"после"},manner:{default:{type:"literal",value:"after"}}}}];case"th":return[{id:"put-th-full",language:"th",command:"put",priority:100,template:{format:"ใส่ {patient} ใน {destination}",tokens:[{type:"literal",value:"ใส่",alternatives:["วาง"]},{type:"role",role:"patient"},{type:"literal",value:"ใน"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"ใน",position:3}}}];case"uk":return[{id:"put-uk-full",language:"uk",command:"put",priority:100,template:{format:"покласти {patient} в {destination}",tokens:[{type:"literal",value:"покласти",alternatives:["поклади","помістити","помісти","вставити","встав"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"в",alternatives:["у","на"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"в",markerAlternatives:["у","на"]}}},{id:"put-uk-before",language:"uk",command:"put",priority:95,template:{format:"покласти {patient} перед {destination}",tokens:[{type:"literal",value:"покласти",alternatives:["поклади","помістити","помісти"]},{type:"role",role:"patient"},{type:"literal",value:"перед",alternatives:["до"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"перед",markerAlternatives:["до"]},manner:{default:{type:"literal",value:"before"}}}},{id:"put-uk-after",language:"uk",command:"put",priority:95,template:{format:"покласти {patient} після {destination}",tokens:[{type:"literal",value:"покласти",alternatives:["поклади","помістити","помісти"]},{type:"role",role:"patient"},{type:"literal",value:"після"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"після"},manner:{default:{type:"literal",value:"after"}}}}];case"vi":return[{id:"put-vi-into",language:"vi",command:"put",priority:100,template:{format:"đặt {patient} vào {target}",tokens:[{type:"literal",value:"đặt",alternatives:["để","đưa"]},{type:"role",role:"patient"},{type:"literal",value:"vào",alternatives:["vào trong"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"vào",markerAlternatives:["vào trong"]}}},{id:"put-vi-before",language:"vi",command:"put",priority:95,template:{format:"đặt {patient} trước {target}",tokens:[{type:"literal",value:"đặt",alternatives:["để","đưa"]},{type:"role",role:"patient"},{type:"literal",value:"trước",alternatives:["trước khi"]},{type:"role",role:"manner"}]},extraction:{patient:{position:1},manner:{marker:"trước",markerAlternatives:["trước khi"]}}},{id:"put-vi-after",language:"vi",command:"put",priority:95,template:{format:"đặt {patient} sau {target}",tokens:[{type:"literal",value:"đặt",alternatives:["để","đưa"]},{type:"role",role:"patient"},{type:"literal",value:"sau",alternatives:["sau khi"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"sau",markerAlternatives:["sau khi"]}}}];case"zh":return[{id:"put-zh-full",language:"zh",command:"put",priority:100,template:{format:"放置 {patient} 到 {destination}",tokens:[{type:"literal",value:"放置",alternatives:["放","放入","置入","put"]},{type:"role",role:"patient",expectedTypes:["literal","selector","reference","expression"]},{type:"literal",value:"到",alternatives:["在","于","入"]},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{position:3}}},{id:"put-zh-ba",language:"zh",command:"put",priority:95,template:{format:"把 {patient} 放到 {destination}",tokens:[{type:"literal",value:"把"},{type:"role",role:"patient",expectedTypes:["literal","selector","reference","expression"]},{type:"literal",value:"放到",alternatives:["放在","放入"]},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{position:3}}}];default:return[]}}var lk,ck,uk,pk,mk,dk,fk,yk,hk,vk,gk,bk=vp({"src/patterns/put.ts"(){}}),wk={};function kk(){const e=[];e.push(...ak("en")),e.push(...sk("en")),e.push(...rw("en")),e.push(lk,ck,uk,pk,mk,dk,fk,yk,hk,vk,gk);const t=ek(_p);return e.push(...t),e}gp(wk,{buildEnglishPatterns:()=>kk});var zk=vp({"src/patterns/en.ts"(){Fp(),ik(),ok(),bk(),sw(),lk={id:"fetch-en-with-response-type",language:"en",command:"fetch",priority:90,template:{format:"fetch {source} as {responseType}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"literal",value:"as"},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]},extraction:{source:{position:1},responseType:{marker:"as"}}},ck={id:"fetch-en-simple",language:"en",command:"fetch",priority:80,template:{format:"fetch {source}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source"}]},extraction:{source:{position:1}}},uk={id:"swap-en-handcrafted",language:"en",command:"swap",priority:110,template:{format:"swap {method} {destination}",tokens:[{type:"literal",value:"swap"},{type:"role",role:"method"},{type:"role",role:"destination"}]},extraction:{method:{position:1},destination:{position:2}}},pk={id:"repeat-en-until-event-from",language:"en",command:"repeat",priority:120,template:{format:"repeat until event {event} from {source}",tokens:[{type:"literal",value:"repeat"},{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:"from"},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]}]},extraction:{event:{marker:"event"},source:{marker:"from"},loopType:{default:{type:"literal",value:"until-event"}}}},mk={id:"repeat-en-until-event",language:"en",command:"repeat",priority:110,template:{format:"repeat until event {event}",tokens:[{type:"literal",value:"repeat"},{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]}]},extraction:{event:{marker:"event"},loopType:{default:{type:"literal",value:"until-event"}}}},dk={id:"set-en-possessive",language:"en",command:"set",priority:100,template:{format:"set {destination} to {patient}",tokens:[{type:"literal",value:"set"},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"to"},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{marker:"to"}}},fk={id:"for-en-basic",language:"en",command:"for",priority:100,template:{format:"for {patient} in {source}",tokens:[{type:"literal",value:"for"},{type:"role",role:"patient",expectedTypes:["expression","reference"]},{type:"literal",value:"in"},{type:"role",role:"source",expectedTypes:["selector","expression","reference"]}]},extraction:{patient:{position:1},source:{marker:"in"},loopType:{default:{type:"literal",value:"for"}}}},yk={id:"if-en-basic",language:"en",command:"if",priority:100,template:{format:"if {condition}",tokens:[{type:"literal",value:"if"},{type:"role",role:"condition",expectedTypes:["expression","reference","selector"]}]},extraction:{condition:{position:1}}},hk={id:"unless-en-basic",language:"en",command:"unless",priority:100,template:{format:"unless {condition}",tokens:[{type:"literal",value:"unless"},{type:"role",role:"condition",expectedTypes:["expression","reference","selector"]}]},extraction:{condition:{position:1}}},vk={id:"temporal-en-in",language:"en",command:"wait",priority:95,template:{format:"in {duration}",tokens:[{type:"literal",value:"in"},{type:"role",role:"duration",expectedTypes:["literal","expression"]}]},extraction:{duration:{position:1}}},gk={id:"temporal-en-after",language:"en",command:"wait",priority:95,template:{format:"after {duration}",tokens:[{type:"literal",value:"after"},{type:"role",role:"duration",expectedTypes:["literal","expression"]}]},extraction:{duration:{position:1}}}}}),xk=.5,Ek=new Set(["me","my","myself","you","your","yourself","it","its","result","event","target","body","detail","window","document"]),Sk=new Set(["and","or","not","no"]),Tk=new Set(["true","false","null","undefined"]),jk=new Set(["ms","s","seconds","second","milliseconds","millisecond","minutes","minute","hours","hour"]),Ak=class{constructor(){this.tokens=[],this.current=0}parse(e){try{return this.tokens=function(e){const t=[];let n=0,r=1,i=1;function a(){return 0===t.length?1:["OPERATOR","COMPARISON","LOGICAL","LPAREN","LBRACKET","LBRACE","COMMA","COLON"].includes(t[t.length-1].type)}function o(t=0){return e[n+t]??""}function s(){const t=e[n];return n++,"\n"===t?(r++,i=1):i++,t}function l(){for(;e.length>n&&/\s/.test(e[n]);)s()}function c(t){let r="";for(;e.length>n&&t(e[n]);)r+=s();return r}function u(t){let r=t;for(s();e.length>n&&e[n]!==t;)"\\"===e[n]&&e.length>n+1?(r+=s(),r+=s()):r+=s();return e.length>n&&(r+=s()),r}function p(){let t="`";for(s();e.length>n&&"`"!==e[n];)"\\"===e[n]&&e.length>n+1?(t+=s(),t+=s()):t+=s();return e.length>n&&(t+=s()),t}function m(){let t="<";for(s();e.length>n&&(t+=s(),!t.endsWith("/>")););return t}function d(e,t,a){return{type:e,value:t,start:a,end:n,line:r,column:i-t.length}}for(;e.length>n&&(l(),e.length>n);){const r=n,i=o();if("'"!==i||"s"!==o(1)||/\w/.test(o(2))){if('"'===i||"'"===i){const e=u(i);t.push(d("STRING",e,r));continue}if("`"===i){const e=p();t.push(d("TEMPLATE_LITERAL",e,r));continue}if("<"===i&&/[a-zA-Z.#\[]/.test(o(1))){const e=m();t.push(d("QUERY_SELECTOR",e,r));continue}if("#"===i&&a()){s();const e=c(e=>/[\w-]/.test(e));t.push(d("ID_SELECTOR","#"+e,r));continue}if("."===i&&/[a-zA-Z_-]/.test(o(1))&&a()){s();const e=c(e=>/[\w-]/.test(e));t.push(d("CLASS_SELECTOR","."+e,r));continue}if("["===i&&a()){const i=o(1);if("@"===i||/[a-zA-Z]/.test(i)){let i="";for(i+=s();e.length>n&&"]"!==e[n];)i+='"'===e[n]||"'"===e[n]?u(e[n]):s();e.length>n&&(i+=s()),t.push(d("ATTRIBUTE_SELECTOR",i,r));continue}}if("["!==i)if("]"!==i){if(/\d/.test(i)){const e=c(e=>/[\d.]/.test(e)),i=n,a=c(e=>/[a-zA-Z]/.test(e));jk.has(a)?t.push(d("TIME_EXPRESSION",e+a,r)):(n=i,t.push(d("NUMBER",e,r)));continue}if("("!==i)if(")"!==i)if("{"!==i)if("}"!==i)if(","!==i)if(":"!==i)if("."!==i)if("+"!==i&&"-"!==i&&"*"!==i&&"/"!==i&&"%"!==i){if("="===i||"!"===i||"<"===i||">"===i){let e=s();"="===o()&&(e+=s()),t.push(d("COMPARISON",e,r));continue}if(/[a-zA-Z_$]/.test(i)){const e=c(e=>/[\w$]/.test(e)),n=e.toLowerCase();Ek.has(n)?t.push(d("CONTEXT_VAR",e,r)):Sk.has(n)?t.push(d("LOGICAL",e,r)):Tk.has(n)?t.push(d("BOOLEAN",e,r)):t.push(d("IDENTIFIER",e,r));continue}s()}else s(),t.push(d("OPERATOR",i,r));else s(),t.push(d("DOT",".",r));else s(),t.push(d("COLON",":",r));else s(),t.push(d("COMMA",",",r));else s(),t.push(d("RBRACE","}",r));else s(),t.push(d("LBRACE","{",r));else s(),t.push(d("RPAREN",")",r));else s(),t.push(d("LPAREN","(",r))}else s(),t.push(d("RBRACKET","]",r));else s(),t.push(d("LBRACKET","[",r))}else s(),s(),t.push(d("POSSESSIVE","'s",r))}return t.push(d("EOF","",n)),t}(e),this.current=0,this.isAtEnd()?{success:0,error:"Empty expression"}:{success:1,node:this.parseExpression(),consumed:this.current}}catch(e){return{success:0,error:e instanceof Error?e.message:"Parse error"}}}peek(){return this.tokens[this.current]??{type:"EOF",value:"",start:0,end:0}}previous(){return this.tokens[this.current-1]??{type:"EOF",value:"",start:0,end:0}}isAtEnd(){return"EOF"===this.peek().type}advance(){return this.isAtEnd()||this.current++,this.previous()}check(e){return this.peek().type===e}checkValue(e){return this.peek().value.toLowerCase()===e.toLowerCase()}match(...e){for(const t of e)if(this.check(t))return this.advance(),1;return 0}parseExpression(){return this.parseOr()}parseOr(){let e=this.parseAnd();for(;this.checkValue("or");){const t=this.advance().value,n=this.parseAnd();e=this.createBinaryExpression(t,e,n)}return e}parseAnd(){let e=this.parseEquality();for(;this.checkValue("and");){const t=this.advance().value,n=this.parseEquality();e=this.createBinaryExpression(t,e,n)}return e}parseEquality(){let e=this.parseComparison();for(;this.match("COMPARISON")||this.checkValue("is")||this.checkValue("matches")||this.checkValue("contains")||this.checkValue("in");){const t=this.previous().value,n=this.parseComparison();e=this.createBinaryExpression(t,e,n)}return e}parseComparison(){let e=this.parseAddition();for(;this.check("COMPARISON");){const t=this.advance().value,n=this.parseAddition();e=this.createBinaryExpression(t,e,n)}return e}parseAddition(){let e=this.parseMultiplication();for(;"+"===this.peek().value||"-"===this.peek().value;){const t=this.advance().value,n=this.parseMultiplication();e=this.createBinaryExpression(t,e,n)}return e}parseMultiplication(){let e=this.parseUnary();for(;"*"===this.peek().value||"/"===this.peek().value||"%"===this.peek().value;){const t=this.advance().value,n=this.parseUnary();e=this.createBinaryExpression(t,e,n)}return e}parseUnary(){if(this.checkValue("not")||this.checkValue("no")||"-"===this.peek().value){const e=this.advance().value,t=this.parseUnary();return this.createUnaryExpression(e,t)}return this.parsePostfix()}parsePostfix(){let e=this.parsePrimary();for(;;)if(this.match("DOT")){if(!this.check("IDENTIFIER")&&!this.check("CONTEXT_VAR"))break;{const t=this.advance().value;e=this.createPropertyAccess(e,t)}}else if(this.match("POSSESSIVE")){if(!this.check("IDENTIFIER")&&!this.check("CONTEXT_VAR"))break;{const t=this.advance().value;e=this.createPossessiveExpression(e,t)}}else if(this.match("LPAREN")){const t=this.parseArguments();e=this.createCallExpression(e,t)}else{if(!this.match("LBRACKET"))break;{const t=this.parseExpression();if(!this.match("RBRACKET"))throw Error("Expected ] after index");e=this.createPropertyAccess(e,t)}}return e}parsePrimary(){const e=this.peek();if(this.match("NUMBER"))return this.createLiteral(parseFloat(e.value),"number",e);if(this.match("STRING")){const t=e.value.slice(1,-1);return this.createLiteral(t,"string",e)}if(this.match("BOOLEAN"))return this.createLiteral("true"===e.value?1:"false"===e.value?0:"null"===e.value?null:void 0,{true:"boolean",false:"boolean",null:"null",undefined:"undefined"}[e.value]??"string",e);if(this.match("TEMPLATE_LITERAL"))return{type:"templateLiteral",value:e.value,start:e.start,end:e.end,line:e.line,column:e.column};if(this.match("TIME_EXPRESSION"))return this.parseTimeExpression(e);if(this.match("ID_SELECTOR"))return this.createSelector(e.value,"id",e);if(this.match("CLASS_SELECTOR"))return this.createSelector(e.value,"class",e);if(this.match("ATTRIBUTE_SELECTOR"))return this.createSelector(e.value,"attribute",e);if(this.match("QUERY_SELECTOR")){const t=e.value.slice(1,-2);return this.createSelector(t,"query",e)}if(this.match("CONTEXT_VAR"))return this.createContextReference(e.value,e);if(this.match("IDENTIFIER"))return this.createIdentifier(e.value,e);if(this.match("LPAREN")){const e=this.parseExpression();if(!this.match("RPAREN"))throw Error("Expected ) after expression");return e}if(this.match("LBRACKET"))return this.parseArrayLiteral();if(this.match("LBRACE"))return this.parseObjectLiteral();throw Error("Unexpected token: "+e.value)}parseArguments(){const e=[];if(!this.check("RPAREN"))do{e.push(this.parseExpression())}while(this.match("COMMA"));if(!this.match("RPAREN"))throw Error("Expected ) after arguments");return e}parseArrayLiteral(){const e=[],t=this.previous().start;if(!this.check("RBRACKET"))do{e.push(this.parseExpression())}while(this.match("COMMA"));if(!this.match("RBRACKET"))throw Error("Expected ] after array elements");return{type:"arrayLiteral",elements:e,start:t,end:this.previous().end}}parseObjectLiteral(){const e=[],t=this.previous().start;if(!this.check("RBRACE"))do{let t;if(this.check("STRING"))t=this.advance().value.slice(1,-1);else{if(!this.check("IDENTIFIER"))throw Error("Expected property name");t=this.advance().value}if(!this.match("COLON"))throw Error("Expected : after property name");const n=this.parseExpression();e.push({key:t,value:n})}while(this.match("COMMA"));if(!this.match("RBRACE"))throw Error("Expected } after object properties");return{type:"objectLiteral",properties:e.map(e=>({type:"objectProperty",key:e.key,value:e.value})),start:t,end:this.previous().end}}parseTimeExpression(e){const t=e.value.match(/^(\d+(?:\.\d+)?)(ms|s|seconds?|milliseconds?|minutes?|hours?)$/i);if(!t)throw Error("Invalid time expression: "+e.value);return{type:"timeExpression",value:parseFloat(t[1]),unit:t[2].toLowerCase(),raw:e.value,start:e.start,end:e.end,line:e.line,column:e.column}}createLiteral(e,t,n){return{type:"literal",value:e,dataType:t,raw:n.value,start:n.start,end:n.end,line:n.line,column:n.column}}createSelector(e,t,n){return{type:"selector",value:e,selector:e,selectorType:t,start:n.start,end:n.end,line:n.line,column:n.column}}createContextReference(e,t){return{type:"contextReference",contextType:e,name:t.value,start:t.start,end:t.end,line:t.line,column:t.column}}createIdentifier(e,t){return{type:"identifier",name:e,start:t.start,end:t.end,line:t.line,column:t.column}}createPropertyAccess(e,t){return{type:"propertyAccess",object:e,property:"string"==typeof t?t:"identifier"===t.type?t.name:"",start:e.start,end:this.previous().end}}createPossessiveExpression(e,t){return{type:"possessiveExpression",object:e,property:t,start:e.start,end:this.previous().end}}createBinaryExpression(e,t,n){return{type:"binaryExpression",operator:e,left:t,right:n,start:t.start,end:n.end}}createUnaryExpression(e,t){return{type:"unaryExpression",operator:e,operand:t,prefix:1,start:this.previous().start,end:t.end}}createCallExpression(e,t){return{type:"callExpression",callee:e,arguments:t,start:e.start,end:this.previous().end}}};function Lk(e,t){switch(e.type){case"literal":return Ok(e);case"selector":return Ck(e,t);case"reference":return Nk(e);case"property-path":return Pk(e,t);case"expression":return Rk(e);case"flag":return{type:"literal",value:e.enabled};default:throw Error("Unknown semantic value type: "+e.type)}}function Ok(e){const t={type:"literal",value:e.value};return e.dataType?{...t,dataType:e.dataType}:t}function Ck(e,t){return t&&e.value.startsWith("*")&&/^[a-zA-Z-]/.test(e.value.slice(1))&&t.push(`Converted '${e.value}' to a CSS selector, but it looks like a CSS property name. CSS properties in commands like 'transition' should be literal strings, not selectors. Consider using expectedTypes: ['literal'] instead of ['literal', 'selector'] in the command schema.`),{type:"selector",value:e.value,selector:e.value,selectorType:e.selectorKind}}function Nk(e){return{type:"contextReference",contextType:e.value,name:e.value}}function Pk(e,t){return{type:"propertyAccess",object:Lk(e.object,t),property:e.property}}function Rk(e){const t=(n=e.raw,(new Ak).parse(n));var n;return t.success&&t.node?t.node:{type:"identifier",name:e.raw}}function $k(e,t){return e.roles.get(t)}function Ik(e,t,n){const r=$k(e,t);return r?Lk(r,n):void 0}function Mk(e,t=[],n,r={}){const i={type:"command",name:e,args:t};return n&&Object.keys(n).length>0&&(i.modifiers=n),r.isBlocking&&(i.isBlocking=r.isBlocking),r.implicitTarget&&(i.implicitTarget=r.implicitTarget),r.semanticRoles&&Object.keys(r.semanticRoles).length>0&&(i.semanticRoles=r.semanticRoles),i}var qk={action:"toggle",toAST(e,t){const n=Ik(e,"patient"),r=Ik(e,"destination"),i=Ik(e,"duration"),a=n?[n]:[],o={};return r&&(o.on=r),i&&(o.for=i),Mk("toggle",a,o)}},_k={action:"add",toAST(e,t){const n=Ik(e,"patient"),r=Ik(e,"destination"),i=n?[n]:[],a={};return r&&(a.to=r),Mk("add",i,a)}},Dk={action:"remove",toAST(e,t){const n=Ik(e,"patient"),r=Ik(e,"source"),i=n?[n]:[],a={};return r&&(a.from=r),Mk("remove",i,a)}},Vk={action:"set",toAST(e,t){const n=Ik(e,"destination"),r=Ik(e,"patient"),i=[],a={};return n&&i.push(n),r&&(a.to=r),Mk("set",i,a)}},Hk={action:"show",toAST(e,t){const n=Ik(e,"destination"),r=Ik(e,"patient"),i=Ik(e,"duration"),a=[],o={},s=n??r;return s&&a.push(s),i&&(o.with=i),Mk("show",a,o)}},Fk={action:"hide",toAST(e,t){const n=Ik(e,"destination"),r=Ik(e,"patient"),i=Ik(e,"duration"),a=[],o={},s=n??r;return s&&a.push(s),i&&(o.with=i),Mk("hide",a,o)}},Bk={action:"increment",toAST(e,t){const n=Ik(e,"destination"),r=Ik(e,"patient"),i=Ik(e,"quantity"),a=[],o={},s=n??r;return s&&a.push(s),i&&(o.by=i),Mk("increment",a,o)}},Uk={action:"decrement",toAST(e,t){const n=Ik(e,"destination"),r=Ik(e,"patient"),i=Ik(e,"quantity"),a=[],o={},s=n??r;return s&&a.push(s),i&&(o.by=i),Mk("decrement",a,o)}},Gk={action:"wait",toAST(e,t){const n=Ik(e,"duration");return Mk("wait",n?[n]:[],void 0,{isBlocking:1})}},Wk={action:"log",toAST(e,t){const n=Ik(e,"patient"),r=[];return n&&r.push(n),Mk("log",r)}},Kk={action:"put",toAST(e,t){const n=Ik(e,"patient"),r=Ik(e,"destination"),i=$k(e,"method"),a=n?[n]:[],o={};return r&&(o["literal"===i?.type?i.value+"":"into"]=r),Mk("put",a,o)}},Jk={action:"fetch",toAST(e,t){const n=Ik(e,"source"),r=Ik(e,"method"),i=Ik(e,"responseType"),a=Ik(e,"patient"),o=n?[n]:[],s={};return r&&(s.with=r),i&&(s.as=i),a&&(s.body=a),Mk("fetch",o,s,{isBlocking:1})}},Zk={action:"append",toAST(e,t){const n=Ik(e,"patient"),r=Ik(e,"destination"),i=n?[n]:[],a={};return r&&(a.to=r),Mk("append",i,a)}},Yk={action:"prepend",toAST(e,t){const n=Ik(e,"patient"),r=Ik(e,"destination"),i=n?[n]:[],a={};return r&&(a.to=r),Mk("prepend",i,a)}},Xk={action:"trigger",toAST(e,t){const n=Ik(e,"event"),r=Ik(e,"destination"),i=n?[n]:[],a={};return r&&(a.on=r),Mk("trigger",i,a)}},Qk={action:"send",toAST(e,t){const n=Ik(e,"event"),r=Ik(e,"destination"),i=Ik(e,"patient"),a=n?[n]:[],o={};return r&&(o.to=r),i&&(o.detail=i),Mk("send",a,o)}},ez={action:"go",toAST(e,t){const n=Ik(e,"source"),r=Ik(e,"destination"),i=[],a={};return n&&i.push(n),r&&(a.to=r),Mk("go",i,a)}},tz={action:"transition",toAST(e,t){const n=Ik(e,"patient"),r=Ik(e,"goal"),i=Ik(e,"duration"),a=Ik(e,"destination"),o=n?[n]:[],s={};return r&&(s.to=r),i&&(s.over=i),a&&(s.on=a),Mk("transition",o,s)}},nz={action:"focus",toAST(e,t){const n=Ik(e,"destination"),r=Ik(e,"patient"),i=[],a=n??r;return a&&i.push(a),Mk("focus",i,{})}},rz={action:"blur",toAST(e,t){const n=Ik(e,"destination"),r=Ik(e,"patient"),i=[],a=n??r;return a&&i.push(a),Mk("blur",i)}},iz={action:"get",toAST(e,t){const n=Ik(e,"source"),r=Ik(e,"patient"),i=[],a=n??r;return a&&i.push(a),Mk("get",i)}},az={action:"take",toAST(e,t){const n=Ik(e,"patient"),r=Ik(e,"source"),i=n?[n]:[],a={};return r&&(a.from=r),Mk("take",i,a)}},oz={action:"call",toAST(e,t){const n=Ik(e,"patient");return Mk("call",n?[n]:[])}},sz={action:"return",toAST(e,t){const n=Ik(e,"patient");return Mk("return",n?[n]:[])}},lz={action:"halt",toAST:(e,t)=>Mk("halt",[])},cz={action:"throw",toAST(e,t){const n=Ik(e,"patient");return Mk("throw",n?[n]:[])}},uz={action:"settle",toAST(e,t){const n=Ik(e,"destination"),r=Ik(e,"patient"),i=[],a=n??r;return a&&i.push(a),Mk("settle",i,void 0,{isBlocking:1})}},pz={action:"swap",toAST(e,t){const n=Ik(e,"patient"),r=Ik(e,"source"),i=Ik(e,"destination"),a=Ik(e,"style"),o=[],s={};return n&&o.push(n),r&&o.push(r),i&&(s.on=i),a&&(s.with=a),Mk("swap",o,s)}},mz={action:"morph",toAST(e,t){const n=Ik(e,"source"),r=Ik(e,"destination"),i=Ik(e,"patient"),a=[],o={},s=n??i;return s&&a.push(s),r&&(o.on=r),Mk("morph",a,o)}},dz={action:"clone",toAST(e,t){const n=Ik(e,"source"),r=Ik(e,"destination"),i=Ik(e,"patient"),a=[],o={},s=n??i;return s&&a.push(s),r&&(o.into=r),Mk("clone",a,o)}},fz={action:"make",toAST(e,t){const n=Ik(e,"patient");return Mk("make",n?[n]:[])}},yz={action:"measure",toAST(e,t){const n=Ik(e,"patient"),r=Ik(e,"destination"),i=Ik(e,"source"),a=[],o={};n&&a.push(n);const s=r??i;return s&&(o.of=s),Mk("measure",a,o)}},hz={action:"tell",toAST(e,t){const n=Ik(e,"destination"),r=Ik(e,"patient"),i=[],a=n??r;return a&&i.push(a),Mk("tell",i)}},vz={action:"js",toAST(e,t){const n=Ik(e,"patient");return Mk("js",n?[n]:[])}},gz={action:"async",toAST:(e,t)=>Mk("async",[])},bz={action:"if",toAST(e,t){const n=Ik(e,"condition");return Mk("if",n?[n]:[])}},wz={action:"unless",toAST(e,t){const n=Ik(e,"condition");return Mk("unless",n?[n]:[])}},kz={action:"repeat",toAST(e,t){const n=Ik(e,"quantity"),r=Ik(e,"patient"),i=[],a=n??r;return a&&i.push(a),Mk("repeat",i)}},zz={action:"for",toAST(e,t){const n=Ik(e,"patient"),r=Ik(e,"source"),i=n?[n]:[],a={};return r&&(a.in=r),Mk("for",i,a)}},xz={action:"while",toAST(e,t){const n=Ik(e,"condition");return Mk("while",n?[n]:[])}},Ez={action:"continue",toAST:(e,t)=>Mk("continue",[])},Sz={action:"default",toAST(e,t){const n=Ik(e,"patient"),r=Ik(e,"source"),i=n?[n]:[],a={};return r&&(a.to=r),Mk("default",i,a)}},Tz={action:"init",toAST:(e,t)=>Mk("init",[])},jz={action:"behavior",toAST(e,t){const n=Ik(e,"patient");return Mk("behavior",n?[n]:[])}},Az={action:"install",toAST(e,t){const n=Ik(e,"patient"),r=Ik(e,"destination"),i=n?[n]:[],a={};return r&&(a.on=r),Mk("install",i,a)}},Lz=new Map([["toggle",qk],["add",_k],["remove",Dk],["set",Vk],["show",Hk],["hide",Fk],["increment",Bk],["decrement",Uk],["wait",Gk],["log",Wk],["put",Kk],["fetch",Jk],["append",Zk],["prepend",Yk],["get",iz],["take",az],["trigger",Xk],["send",Qk],["on",{action:"on",toAST(e,t){const n=Ik(e,"event"),r=Ik(e,"source"),i=n?[n]:[],a={};return r&&(a.from=r),Mk("on",i,a)}}],["go",ez],["transition",tz],["focus",nz],["blur",rz],["call",oz],["return",sz],["halt",lz],["throw",cz],["settle",uz],["swap",pz],["morph",mz],["clone",dz],["measure",yz],["make",fz],["tell",hz],["default",Sz],["js",vz],["async",gz],["if",bz],["unless",wz],["repeat",kz],["for",zz],["while",xz],["continue",Ez],["init",Tz],["behavior",jz],["install",Az]]);function Oz(e){return Lz.get(e)}var Cz=class{constructor(e={}){this.warnings=[]}build(e){switch(e.kind){case"command":return this.buildCommand(e);case"event-handler":return this.buildEventHandler(e);case"conditional":return this.buildConditional(e);case"compound":return this.buildCompound(e);case"loop":return this.buildLoop(e);default:throw Error("Unknown semantic node kind: "+e.kind)}}buildCommand(e){const t=Oz(e.action);let n;if(t){const r=t.toAST(e,this);if("ast"in r&&"warnings"in r){const e=r;this.warnings.push(...e.warnings),n=e.ast}else n=r}else n=this.buildGenericCommand(e);if(e.roles&&e.roles.size>0){const t={};for(const[n,r]of e.roles)t[n]=Lk(r);Object.keys(t).length>0&&(n.semanticRoles=t)}return n}buildGenericCommand(e){const t=[],n={},r=["patient","source","quantity"],i=["destination","duration","method","style"];for(const n of r){const r=e.roles.get(n);r&&t.push(Lk(r))}for(const t of i){const r=e.roles.get(t);r&&(n[this.roleToModifierKey(t)]=Lk(r))}const a={type:"command",name:e.action,args:t};return Object.keys(n).length>0?{...a,modifiers:n}:a}roleToModifierKey(e){return{destination:"on",duration:"for",source:"from",condition:"if",method:"via",style:"with"}[e]??e}buildEventHandler(e){const t=e.roles.get("event");let n,r;if("literal"===t?.type){const e=t.value+"";e.includes("|")||e.includes(" or ")?(r=e.split(/\s+or\s+|\|/).map(e=>e.trim()),n=r[0]):n=e}else n="reference"===t?.type?t.value:"click";const i=e.body.map(e=>this.build(e)),a=e.roles.get("source");let o,s;"selector"===a?.type?(o=a.value,s=a.value):"reference"===a?.type?s=a.value:"literal"===a?.type&&(s=a.value+"");const l=e.roles.get("condition"),c=l?Lk(l):void 0,u=e.roles.get("destination"),p=u?Lk(u):void 0,m=e.eventModifiers;let d=o;if(m?.from){const e=m.from;"selector"!==e.type||o||(d=e.value)}const f=e.parameterNames?[...e.parameterNames]:void 0;return{type:"eventHandler",event:n,commands:i,...r&&r.length>1?{events:r}:{},...d?{selector:d}:{},...s?{target:s}:{},...c?{condition:c}:{},...p?{watchTarget:p}:{},...f&&f.length>0?{args:f,params:f}:{}}}buildConditional(e){const t=e.roles.get("condition");if(!t)throw Error("Conditional node missing condition");const n=Lk(t),r=e.thenBranch.map(e=>this.build(e)),i=e.elseBranch?.map(e=>this.build(e)),a=[n,{type:"block",commands:r}];return i&&i.length>0&&a.push({type:"block",commands:i}),{type:"command",name:"if",args:a}}buildCompound(e){const t=e.statements.map(e=>this.build(e));return 1===t.length?t[0]:0===t.length?{type:"block",commands:[]}:{type:"CommandSequence",commands:t}}buildLoop(e){const t=e.body.map(e=>this.build(e)),n=[{type:"identifier",name:e.loopVariant}];switch(e.loopVariant){case"times":{const t=e.roles.get("quantity");t&&n.push(Lk(t));break}case"for":{e.loopVariable&&n.push({type:"string",value:e.loopVariable});const t=e.roles.get("source");t&&n.push(Lk(t));break}case"while":case"until":{const t=e.roles.get("condition");t&&n.push(Lk(t));break}}return n.push({type:"block",commands:t}),{type:"command",name:"repeat",args:n}}buildBlock(e){return{type:"block",commands:e.map(e=>this.build(e))}}};Cp(),Rp(),Mp(),Dp(),Fp(),Gp(),Jp(),Xp(),tm(),im(),sm(),um(),dm(),hm(),bm(),zm(),Sm(),Am(),Cm(),Rm(),Mm(),Dm(),Fm(),Gm(),nd();var Nz=Object.freeze({ar:Op,bn:Pp,de:Ip,en:_p,es:Hp,fr:Up,he:Kp,hi:Yp,id:em,it:rm,ja:om,ko:cm,ms:mm,pl:ym,pt:gm,qu:km,ru:Em,sw:jm,th:Om,tl:Pm,tr:Im,uk:_m,vi:Hm,zh:Um});function Pz(e){let t="complex";return e.startsWith("#")&&!e.includes(" ")?t="id":e.startsWith(".")&&!e.includes(" ")?t="class":e.startsWith("[")&&e.endsWith("]")?t="attribute":/^[a-z][a-z0-9]*$/i.test(e)&&(t="element"),{type:"selector",value:e,selectorKind:t}}function Rz(e,t){return void 0!==t?{type:"literal",value:e,dataType:t}:{type:"literal",value:e}}function $z(e){return Fl(e)}function Iz(e){return{type:"reference",value:e}}function Mz(e,t){return{type:"property-path",object:e,property:t}}function qz(e,t,n){const r={kind:"command",action:e,roles:new Map(Object.entries(t))};return void 0!==n?{...r,metadata:n}:r}function _z(e,t,n,r,i,a){const o=new Map;o.set("event",e);const s={kind:"event-handler",action:"on",roles:o,body:t};return void 0!==n&&(s.eventModifiers=n),void 0!==r&&(s.metadata=r),void 0!==i&&i.length>0&&(s.parameterNames=i),void 0!==a&&a.length>0&&(s.additionalEvents=a),s}function Dz(e,t="then",n){const r={kind:"compound",action:"compound",roles:new Map,statements:e,chainType:t};return void 0!==n&&(r.metadata=n),r}function Vz(e,t){return t&&0!==t.length?t.includes(e)||t.includes("expression")?1:"property-path"===e?t.some(e=>["selector","reference","expression"].includes(e)):0:1}Cp();var Hz=new Set(["بدل","غير","أضف","أزل","ضع","اجعل","عين","زد","انقص","سجل","أظهر","أخف","شغل","أرسل","ركز","شوش","توقف","انسخ","احذف","اصنع","انتظر","انتقال","أو"]),Fz={patient:["على"],destination:["إلى","الى"],source:["من"],agent:["من"],manner:["ب"],style:["ب"],goal:["إلى","الى"],method:["ب"]},Bz=new class{calculate(e){return this.calculateWithBreakdown(e).final}calculateWithBreakdown(e){const t=this.scoreRoleCoverage(e),n=this.scoreStemPenalty(e),r=this.scoreLanguageBoost(e),i=this.scoreLanguageAdjustment(e);let a=t;return a=Math.max(.5,a+n),a=Math.min(1,a+r),a=Math.max(0,Math.min(1,a+i)),{roleCoverage:t,stemPenalty:n,languageBoost:r,languageAdjustment:i,final:a}}scoreRoleCoverage(e){const{pattern:t,captured:n}=e;let r=0,i=0;const a=e=>void 0!==t.extraction?.[e]?.default;for(const e of t.template.tokens)if("role"===e.type)i+=1,n.has(e.role)&&(r+=1);else if("group"===e.type)for(const t of e.tokens)"role"===t.type&&(i+=.8,n.has(t.role)?r+=.8:a(t.role)&&(r+=.48));return i>0?r/i:1}scoreStemPenalty(e){const{stemMatchCount:t,totalKeywordMatches:n}=e;return t>0&&n>0?-t/n*.15:0}scoreLanguageBoost(e){const{pattern:t}=e;if("ar"!==t.language)return 0;const n=t.template.tokens[0];return n&&"literal"===n.type&&(Hz.has(n.value)||n.alternatives?.some(e=>Hz.has(e)))?.15:0}scoreLanguageAdjustment(e){const{pattern:t,captured:n}=e;if("ar"!==t.language)return 0;let r=0;for(const[e,t]of n.entries()){const n=Fz[e];if(!n||0===n.length)continue;const i="metadata"in t?t.metadata:void 0;i&&"string"==typeof i.prepositionValue&&(n.includes(i.prepositionValue)?r+=.1:r-=.1)}return Math.max(-.1,Math.min(.1,r))}},Uz=class e{constructor(e){this.matchCache=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??Bz}matchPattern(e,t){const n=e.mark(),r=new Map;if(this.currentProfile=Tp(t.language),this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(e,t.template.tokens,r))return e.reset(n),null;const i=this.confidenceModel.calculate({pattern:t,captured:r,stemMatchCount:this.stemMatchCount,totalKeywordMatches:this.totalKeywordMatches});return this.applyExtractionRules(t,r),{pattern:t,captured:r,consumedTokens:e.position()-n.position,confidence:i}}matchBest(e,t){this.matchCache.clear();const n=[],r=e.position();for(const i of t){const t=e.mark(),a=`${r}:${i.id}`;let o;this.matchCache.has(a)?o=this.matchCache.get(a):(o=this.matchPattern(e,i),this.matchCache.set(a,o)),o&&n.push(o),e.reset(t)}if(0===n.length)return null;n.sort((e,t)=>{const n=t.pattern.priority-e.pattern.priority;return 0!==n?n:t.confidence-e.confidence});const i=n[0];return this.matchPattern(e,i.pattern),i}matchTokenSequence(e,t,n){const r=t[0],i="literal"===r?.type&&("and"===r.value||"then"===r.value||r.alternatives?.includes("and")||r.alternatives?.includes("then"));if("ar"===this.currentProfile?.code&&!i)for(;"conjunction"===e.peek()?.kind;)e.advance();for(const r of t)if(!this.matchPatternToken(e,r,n)){if(this.isOptional(r))continue;return 0}return 1}matchPatternToken(e,t,n){switch(t.type){case"literal":return this.matchLiteralToken(e,t);case"role":return this.matchRoleToken(e,t,n);case"group":return this.matchGroupToken(e,t,n);default:return 0}}matchLiteralToken(e,t){const n=e.peek();if(!n)return 0;const r=this.getMatchType(n,t.value);if("none"!==r)return this.totalKeywordMatches++,"stem"===r&&this.stemMatchCount++,e.advance(),1;if(t.alternatives)for(const r of t.alternatives){const t=this.getMatchType(n,r);if("none"!==t)return this.totalKeywordMatches++,"stem"===t&&this.stemMatchCount++,e.advance(),1}return 0}matchRoleToken(e,t,n){this.skipNoiseWords(e);const r=e.peek();if(!r)return t.optional||0;const i=this.tryMatchPossessiveExpression(e);if(i)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(i.type)&&!t.expectedTypes.includes("expression")?t.optional||0:(n.set(t.role,i),1);const a=this.tryMatchMethodCallExpression(e);if(a)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(a.type)&&!t.expectedTypes.includes("expression")?t.optional||0:(n.set(t.role,a),1);const o=this.tryMatchPossessiveSelectorExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!Vz(o.type,t.expectedTypes)?t.optional||0:(n.set(t.role,o),1);const s=this.tryMatchPropertyAccessExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(s.type)&&!t.expectedTypes.includes("expression")?t.optional||0:(n.set(t.role,s),1);const l=this.tryMatchSelectorPropertyExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!Vz(l.type,t.expectedTypes)?t.optional||0:(n.set(t.role,l),1);const c=this.tokenToSemanticValue(r);return c?t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(c.type)?t.optional||0:(n.set(t.role,c),e.advance(),1):t.optional||0}tryMatchPossessiveExpression(e){const t=e.peek();if(!t)return null;if(!this.currentProfile)return null;const n=(t.normalized||t.value).toLowerCase(),r=(i=this.currentProfile,a=n,i.possessive?.keywords?.[a]);var i,a;if(!r)return null;const o=e.mark();e.advance();const s=e.peek();if(!s)return e.reset(o),null;if("identifier"===s.kind||"keyword"===s.kind&&!this.isStructuralKeyword(s.value)||"selector"===s.kind&&s.value.startsWith("*")||"selector"===s.kind&&s.value.startsWith("@")||"selector"===s.kind&&s.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s.value)){e.advance();let t=s.value;"selector"===s.kind&&t.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(t)&&(t=t.substring(1));let n=t;for(;"selector"===e.peek()?.kind&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)n+=e.peek().value,e.advance();const i=e.peek();return"literal"===i?.kind&&i.value.startsWith("(")&&(n+=i.value,e.advance()),Mz(Iz(r),n)}return e.reset(o),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(t){const n=t.peek();if(!n||"selector"!==n.kind)return null;const r=t.mark();t.advance();const i=t.peek();if(!i||"operator"!==i.kind||"."!==i.value)return t.reset(r),null;t.advance();const a=t.peek();if(!a||"identifier"!==a.kind)return t.reset(r),null;t.advance();const o=t.peek();if(!o||"punctuation"!==o.kind||"("!==o.value)return t.reset(r),null;t.advance();const s=[];for(;!t.isAtEnd()&&e.MAX_METHOD_ARGS>s.length;){const e=t.peek();if(!e)break;if("punctuation"===e.kind&&")"===e.value){t.advance();break}"punctuation"!==e.kind||","!==e.value?(s.push(e.value),t.advance()):t.advance()}return{type:"expression",raw:`${n.value}.${a.value}(${s.join(", ")})`}}tryMatchPropertyAccessExpression(t){const n=t.peek();if(!n)return null;if("identifier"!==n.kind&&"keyword"!==n.kind)return null;const r=t.mark();t.advance();const i=t.peek();if(!i||"operator"!==i.kind||"."!==i.value)return t.reset(r),null;t.advance();const a=t.peek();if(!a||"identifier"!==a.kind)return t.reset(r),null;t.advance();let o=`${n.value}.${a.value}`,s=1;for(;!t.isAtEnd()&&e.MAX_PROPERTY_DEPTH>s;){const e=t.peek();if(!e||"operator"!==e.kind||"."!==e.value)break;t.advance();const n=t.peek();if(!n||"identifier"!==n.kind)break;t.advance(),o+="."+n.value,s++}const l=t.peek();if(l&&"punctuation"===l.kind&&"("===l.value){t.advance();const n=[];let r=0;for(;!t.isAtEnd()&&e.MAX_METHOD_ARGS>n.length;){const e=t.peek();if(!e)break;if("punctuation"===e.kind&&")"===e.value){if(0===r){t.advance();break}r--}"punctuation"===e.kind&&"("===e.value&&r++,"punctuation"!==e.kind||","!==e.value?(n.push(e.value),t.advance()):t.advance()}return{type:"expression",raw:`${o}(${n.join(", ")})`}}return{type:"expression",raw:o}}tryMatchPossessiveSelectorExpression(e){const t=e.peek();if(!t||"selector"!==t.kind)return null;const n=e.mark();e.advance();const r=e.peek();if(!r||"punctuation"!==r.kind||"'s"!==r.value)return e.reset(n),null;e.advance();const i=e.peek();return i?"selector"!==i.kind&&"identifier"!==i.kind?(e.reset(n),null):(e.advance(),Mz(Pz(t.value),i.value)):(e.reset(n),null)}tryMatchSelectorPropertyExpression(e){const t=e.peek();if(!t||"selector"!==t.kind)return null;if(!t.value.startsWith("#"))return null;const n=e.mark();e.advance();const r=e.peek();if(!r||"selector"!==r.kind)return e.reset(n),null;if(!r.value.startsWith("."))return e.reset(n),null;e.peek(1),e.advance();const i=r.value.slice(1);return Mz(Pz(t.value),i)}matchGroupToken(e,t,n){const r=e.mark(),i=new Set(n.keys());if(!this.matchTokenSequence(e,t.tokens,n)){e.reset(r);for(const e of n.keys())i.has(e)||n.delete(e);return t.optional||0}return 1}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem!==t||void 0===e.stemConfidence||.7>e.stemConfidence?"keyword"===e.kind&&e.value.toLowerCase()===t.toLowerCase()?"case-insensitive":"none":"stem"}tokenToSemanticValue(e){switch(e.kind){case"selector":return Pz(e.value);case"literal":return this.parseLiteralValue(e.value);case"keyword":const t=(e.normalized||e.value).toLowerCase();return $z(t)?Iz(t):Rz(e.normalized||e.value);case"identifier":if(e.value.startsWith(":"))return Iz(e.value);const n=e.value.toLowerCase();return $z(n)?Iz(n):{type:"expression",raw:e.value};case"url":return Rz(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("「"))return Rz(e.slice(1,-1),"string");if("true"===e)return Rz(1,"boolean");if("false"===e)return Rz(0,"boolean");const t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){const n=parseFloat(t[1]);return t[2]?Rz(e,"duration"):Rz(n,"number")}const n=parseFloat(e);return isNaN(n)?Rz(e,"string"):Rz(n,"number")}applyExtractionRules(e,t){for(const[n,r]of Object.entries(e.extraction))t.has(n)||(void 0!==r.value?t.set(n,{type:"literal",value:r.value}):r.default&&t.set(n,r.default))}isOptional(e){return"literal"!==e.type&&1==e.optional}skipNoiseWords(t){const n=t.peek();if(!n)return;const r=n.value.toLowerCase();if(e.ENGLISH_NOISE_WORDS.has(r)){const e=t.mark();t.advance();const n=t.peek();if(n&&("selector"===n.kind||"identifier"===n.kind))return;t.reset(e)}"class"===r&&t.advance()}extractEventModifiers(e){const t={};let n=0;for(;!e.isAtEnd();){const r=e.peek();if(!r||"event-modifier"!==r.kind)break;const i=r.metadata;if(!i)break;switch(n=1,i.modifierName){case"once":t.once=1;break;case"debounce":"number"==typeof i.value&&(t.debounce=i.value);break;case"throttle":"number"==typeof i.value&&(t.throttle=i.value);break;case"queue":"first"!==i.value&&"last"!==i.value&&"all"!==i.value&&"none"!==i.value||(t.queue=i.value)}e.advance()}return n?t:void 0}};Uz.MAX_PROPERTY_DEPTH=10,Uz.MAX_METHOD_ARGS=20,Uz.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Gz=Uz,Wz=new Gz;function Kz(e,t){return function(e,t){return function(e){let t=lp.get(e);if(!t&&Sp(e)){const n=Ep(e);t=lp.get(n)}if(!t){const t=Array.from(lp.keys()).join(", ");throw Error(`Language '${e}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${e}';`)}return t}(t).tokenize(e)}(e,t)}function Jz(){return jp()}Cp(),xy(),My(),Zy(),uh(),Sh(),Hh(),Zh(),od(),Cp(),sw(),Cp();var Zz=class{render(e,t){if("compound"===e.kind)return this.renderCompound(e,t);const n=function(e,t){return Lp(e).filter(e=>e.command===t).sort((e,t)=>t.priority-e.priority)}(t,e.action);if(0===n.length)return this.renderExplicit(e);const r=this.findBestPattern(e,n);return r?this.renderWithPattern(e,r):this.renderExplicit(e)}renderCompound(e,t){const n=e.statements.map(e=>this.render(e,t)),r=this.getChainWord(e.chainType,t);return n.join(` ${r} `)}getChainWord(e,t){const n=Tp(t);if(!n?.keywords)return e;const r=n.keywords[e];return r?.primary??e}renderExplicit(e){return tc(e)}supportedLanguages(){return Jz()}findBestPattern(e,t){const n=t.map(t=>{let n=t.priority;for(const r of t.template.tokens)"role"===r.type&&(e.roles.has(r.role)?n+=10:r.optional||(n-=50));return"en"===t.language&&((t.id.includes("standard")||t.id.includes("en-source"))&&(n+=20),(t.id.includes("-when")||t.id.includes("-if")||t.id.includes("-upon"))&&(n-=15)),{pattern:t,score:n}});return n.sort((e,t)=>t.score-e.score),n.length>0?n[0].pattern:null}renderWithPattern(e,t){const n=[],r=t.language;for(const i of t.template.tokens){const t=this.renderPatternToken(i,e,r);null!==t&&n.push(t)}if("event-handler"===e.kind&&e.body&&e.body.length>0){const t=e.body.map(e=>this.render(e,r));n.push(t.join(" "))}return n.join(" ")}renderPatternToken(e,t,n){switch(e.type){case"literal":return e.value;case"role":{const r=t.roles.get(e.role);return r?this.valueToNaturalString(r,n):null}case"group":{if(!e.tokens.filter(e=>"role"===e.type&&!e.optional).every(e=>t.roles.has(e.role))&&e.optional)return null;if(e.optional&&e.tokens.find(e=>"role"===e.type&&"destination"===e.role)){const e=t.roles.get("destination");if("reference"===e?.type&&"me"===e.value)return null}const r=[];let i=0;for(const a of e.tokens){const e=this.renderPatternToken(a,t,n);null!==e&&(r.push(e),"role"===a.type&&(i=1))}return e.optional&&!i?null:r.length>0?r.join(" "):null}default:return null}}valueToNaturalString(e,t="en"){switch(e.type){case"literal":return"string"==typeof e.value&&"string"===e.dataType?`"${e.value}"`:e.value+"";case"selector":return e.value;case"reference":return this.renderReference(e,t);case"property-path":return this.renderPropertyPath(e,t);case"expression":return e.raw;case"flag":return e.name}}renderReference(e,t){const n=Tp(t);return n?.references?n.references[e.value]??e.value:e.value}renderPropertyPath(e,t){const n=Tp(t),r=e.property,i="reference"===e.object.type?e.object.value:null;if(n?.possessive?.specialForms&&i){const e=n.possessive.specialForms[i];if(e){const{markerPosition:t,usePossessiveAdjectives:i}=n.possessive;return i&&"after-object"===t?`${r} ${e}`:`${e} ${r}`}}const a=this.valueToNaturalString(e.object,t);if(n?.possessive){const{marker:e,markerPosition:t,usePossessiveAdjectives:o}=n.possessive;if(o&&i&&"after-object"===t)return`${r} ${a}`;if(e)switch(t){case"between":return n.usesSpaces?`${a}${e} ${r}`:`${a}${e}${r}`;case"after-object":return`${a}${e} ${r}`;case"before-property":return`${a} ${e} ${r}`}}return"en"!==t&&n?.possessive?`${a} ${r}`:"me"===a?"my "+r:"it"===a?"its "+r:`${a}'s ${r}`}},Yz=new Zz;function Xz(e,t){return Yz.render(e,t)}function Qz(e){return Yz.renderExplicit(e)}Vw();var ex={getSchema:_w};function tx(e){return Gl(e,{schemaLookup:ex})}var nx=class extends Error{constructor(e,t,n,r){super(e),this.name="SemanticParseError",this.language=t,this.input=n,this.diagnostics=r}};function rx(e,t,n){return{message:e,severity:t,source:"semantic-parser",...n&&{code:n}}}function ix(e,t){return 0===t.length?e:{...e,diagnostics:t}}var ax=class e{parse(e,t){const{modifiers:n,remainingInput:r}=this.extractStandaloneModifiers(e,t),i=r||e,a=[],o=Kz(i,t),s=Lp(t);if(0===s.length)throw new nx("No patterns available for language: "+t,t,i,[rx(`No patterns registered for language '${t}'`,"error","no-patterns")]);const l=[...s].sort((e,t)=>t.priority-e.priority),c=l.filter(e=>"on"===e.command),u=Wz.matchBest(o,c);if(u){a.push(rx(`event pattern matched: ${u.pattern.id} (confidence: ${u.confidence.toFixed(2)})`,"info","pattern-match"));const e=this.buildEventHandler(u,o,t);return ix(n?this.applyModifiers(e,n):e,a)}a.push(rx(`event patterns: ${c.length} tried, no match`,"info","stage-event"));const p=l.filter(e=>"on"!==e.command),m=Wz.matchBest(o,p);if(m)return a.push(rx(`command pattern matched: ${m.pattern.id} (confidence: ${m.confidence.toFixed(2)})`,"info","pattern-match")),ix(this.buildCommand(m,t),a);a.push(rx(`command patterns: ${p.length} tried, no match`,"info","stage-command"));const d=this.trySOVEventExtraction(i,t,l);if(d)return a.push(rx("SOV event extraction succeeded","info","stage-sov")),ix(n?this.applyModifiers(d,n):d,a);a.push(rx("SOV event extraction: no event keyword found","info","stage-sov"));const f=this.tryCompoundCommandParsing(o,p,t);if(f)return a.push(rx("compound command parsing succeeded","info","stage-compound")),ix(f,a);throw a.push(rx("compound parsing: no then-keywords or no command matches","info","stage-compound")),a.push(rx(`all parse stages exhausted for "${i}"`,"error","parse-failed")),new nx(`Could not parse input in ${t}: ${i}`,t,i,a)}canParse(e,t){try{return this.parse(e,t),1}catch{return 0}}supportedLanguages(){return Jz()}buildCommand(e,t){if(!e)throw Error("No match to build command from");const n={};for(const[t,r]of e.captured)n[t]=r;return qz(e.pattern.command,n,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence})}buildEventHandler(e,t,n){if(!e)throw Error("No match to build event handler from");const r=e.captured.get("event");if(!r)throw Error("Event handler pattern matched but no event captured");const i=Wz.extractEventModifiers(t),a=this.extractOrConjunctionEvents(t,n);let o,s=r;a.length>0&&"literal"===r.type&&(s={type:"literal",value:[r.value+"",...a.map(e=>("value"in e?e.value:"")+"")].join(" or ")});const l=e.captured.get("action");if(l&&"literal"===l.type){const r=l.value,i={};for(const[t,n]of e.captured)"event"!==t&&"action"!==t&&"continues"!==t&&(i[t]=n);const a=qz(r,i,{sourceLanguage:n,patternId:e.pattern.id,confidence:e.confidence}),s=e.captured.get("continues");if(s&&"literal"===s.type&&"then"===s.value){const e=Lp(n).filter(e=>"on"!==e.command).sort((e,t)=>t.priority-e.priority),r=Lp(n).filter(e=>e.id.startsWith("grammar-")&&e.id.includes("-continuation")).sort((e,t)=>t.priority-e.priority),i=this.parseBodyWithGrammarPatterns(t,e,r,n);o=i.length>0?[a,...i]:[a]}else o=[a]}else{const e=Lp(n).filter(e=>"on"!==e.command).sort((e,t)=>t.priority-e.priority);o=this.parseBodyWithClauses(t,e,n)}return _z(s,o,i,{sourceLanguage:n,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,t,n){const r=[],i=[];for(;!e.isAtEnd();){const a=e.peek();if(!a)break;const o="conjunction"===a.kind||"keyword"===a.kind&&this.isThenKeyword(a.value,n),s="keyword"===a.kind&&this.isEndKeyword(a.value,n);if(o){if(i.length>0){const e=this.parseClause(i,t,n);r.push(...e),i.length=0}e.advance()}else{if(s){if(i.length>0){const e=this.parseClause(i,t,n);r.push(...e)}e.advance();break}i.push(a),e.advance()}}if(i.length>0){const e=this.parseClause(i,t,n);r.push(...e)}return r.length>1?[Dz(r,"then",{sourceLanguage:n})]:r}parseClause(e,t,n){if(0===e.length)return[];const r=new Ru(e,n),i=[];for(;!r.isAtEnd();){const e=Wz.matchBest(r,t);e?i.push(this.buildCommand(e,n)):r.advance()}if(0===i.length){const t=this.parseSOVClauseByVerbAnchoring(e,n);if(t.length>0)return t}return i}static buildVerbLookup(e){const t=new Map;for(const[n,r]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","for","end","then","and"].includes(n)&&(t.set(r.primary.toLowerCase(),n),r.alternatives))for(const e of r.alternatives)t.set(e.toLowerCase(),n);return t}static buildMarkerToRoleLookup(e){const t=new Map;for(const[n,r]of Object.entries(e.roleMarkers))if(r&&(t.set(r.primary,n),r.alternatives))for(const e of r.alternatives)t.has(e)||t.set(e,n);return t}parseSOVClauseByVerbAnchoring(t,n){const r=Tp(n);if(!r||"SOV"!==r.wordOrder)return[];const i=e.buildVerbLookup(r),a=e.buildMarkerToRoleLookup(r),o=[];let s=0;for(;t.length>s;){let e=-1,r="";for(let n=s;t.length>n;n++){const a=t[n],o=i.get(a.value.toLowerCase()),s=a.normalized?i.get(a.normalized.toLowerCase()):void 0,l=o||s;if(l){e=n,r=l;break}}if(-1===e)break;const l=t.slice(s,e);let c=t.length;for(let r=e+1;t.length>r;r++){const a=t[r];if("conjunction"===a.kind||this.isThenKeyword(a.value,n)){c=r;break}if(r>e+1&&(i.get(a.value.toLowerCase())||(a.normalized?i.get(a.normalized.toLowerCase()):void 0))){c=r;break}}const u=t.slice(e+1,c),p=this.extractRolesFromMarkedTokens(l,u,a,r,n);if(o.push(qz(r,p,{sourceLanguage:n,confidence:.7})),s=c,t.length>s){const e=t[s];("conjunction"===e.kind||this.isThenKeyword(e.value,n))&&s++}}return o}extractRolesFromMarkedTokens(e,t,n,r,i){const a={},o=e=>{let t=[];for(const i of e){const e=n.get(i.value);if(e&&"particle"===i.kind&&t.length>0){const n=this.tokensToSemanticValue(t);if(n){const t=this.mapRoleForCommand(e,r,a);t&&(a[t]=n)}t=[]}else t.push(i)}if(t.length>0){const e=this.tokensToSemanticValue(t);e&&(a.patient?a.destination||(a.destination=e):a.patient=e)}};return o(e),o(t),a}mapRoleForCommand(e,t,n){return n[e]?"patient"!==e||n.destination?"destination"!==e||n.patient?"source"!==e||n.source?null:"source":"patient":"destination":e}tokensToSemanticValue(e){if(0===e.length)return null;const t=e.filter(e=>"whitespace"!==e.kind);if(0===t.length)return null;if(1===t.length)return this.tokenToSemanticValue(t[0]);const n=t.map(e=>e.value).join(""),r=t[0];return"selector"===r.kind||r.value.startsWith("#")||r.value.startsWith(".")||r.value.startsWith("@")||r.value.startsWith("*")?Pz(n):"literal"===r.kind||r.value.startsWith('"')||r.value.startsWith("'")?Rz(n):"reference"===r.kind?Iz(n):Rz(n)}tokenToSemanticValue(e){const t=e.value;if("selector"===e.kind||t.startsWith("#")||t.startsWith(".")||t.startsWith("@")||t.startsWith("*"))return Pz(t);if(t.startsWith('"')||t.startsWith("'"))return Rz(t);if(/^-?\d+(\.\d+)?$/.test(t))return Rz(parseFloat(t));if("true"===t||"真"===t||"참"===t||"doğru"===t)return Rz(1);if("false"===t||"偽"===t||"거짓"===t||"yanlış"===t)return Rz(0);const n=e.normalized?.toLowerCase();return"me"===n||"it"===n||"you"===n||"result"===n||"body"===n?Iz(n):"reference"===e.kind?Iz(e.normalized||"me"):Rz(t)}parseBodyWithGrammarPatterns(e,t,n,r){const i=[];for(;!e.isAtEnd();){const a=e.peek();if(a&&this.isThenKeyword(a.value,r)){e.advance();continue}if(a&&this.isEndKeyword(a.value,r)){e.advance();break}let o=0;if(n.length>0){const t=Wz.matchBest(e,n);if(t){const e=t.pattern.command,n={};for(const[e,r]of t.captured)"event"!==e&&"action"!==e&&"continues"!==e&&(n[e]=r);const a=qz(e,n,{sourceLanguage:r,patternId:t.pattern.id});i.push(a),o=1;const s=t.captured.get("continues");if(s&&"literal"===s.type&&"then"===s.value)continue}}if(!o){const n=Wz.matchBest(e,t);n&&(i.push(this.buildCommand(n,r)),o=1)}o||e.advance()}return i}tryCompoundCommandParsing(e,t,n){const r=e.tokens;if(!r.some(e=>"conjunction"===e.kind||"keyword"===e.kind&&this.isThenKeyword(e.value,n)))return null;const i=new Ru(r,n),a=this.parseBodyWithClauses(i,t,n);return 0===a.length?null:1===a.length?a[0]:Dz(a,"then",{sourceLanguage:n,confidence:.65})}trySOVEventExtraction(t,n,r){const i=e.SOV_EVENT_MARKERS[n];if(!i)return null;const a=Kz(t,n).tokens,o=tw[n],s=new Set;if(o)for(const e of Object.keys(o))s.add(e.toLowerCase());const l=e.SOV_SOURCE_MARKERS[n];let c=-1,u="",p="",m=1;for(let t=0;a.length>t;t++){const n=a[t],r=n.value.toLowerCase();let l=r,d="";const f=r.indexOf("[");f>0&&(l=r.slice(0,f),d=n.value.slice(f));const y=n.normalized?.toLowerCase(),h=y&&e.KNOWN_EVENTS.has(y),v=s.has(r)||s.has(l),g=e.KNOWN_EVENTS.has(l);if(h||v||g){let e;if(e=h?y:v?o?.[r]??o?.[l]??l:l,0>=i.size){c=t,u=e,p=d,m=1;break}{let n=1;const r=a[t+1];r&&"selector"===r.kind&&r.value.startsWith("[")&&(n=2);const o=a[t+n];if(o&&("particle"===o.kind||"keyword"===o.kind)&&i.has(o.value)){c=t,u=e,p=d||(2===n?a[t+1].value:""),m=n+1;break}}}}if(-1===c)return null;const d=new Set;for(let e=c;c+m>e;e++)d.add(e);if(l){const e=c+m;if(a.length>e){const t=a[e];"particle"!==t.kind&&"keyword"!==t.kind||!l.markers.has(t.value)||d.add(e)}for(let e=0;c>e;e++){const t=a[e],n=t.value.toLowerCase(),r=t.normalized?.toLowerCase();if(l.windowTokens.has(n)||r&&l.windowTokens.has(r)){d.add(e);break}}}const f=a.filter((e,t)=>!d.has(t));if(0===f.length)return null;const y=r.filter(e=>"on"!==e.command),h=new Ru(f,n),v=this.parseBodyWithClauses(h,y,n);if(0===v.length)return null;const g={sourceLanguage:n,confidence:.75};return p&&(g.keyFilter=p),_z({type:"literal",value:u},v,void 0,g)}isThenKeyword(e,t){const n={en:new Set(["then"]),ja:new Set(["それから","次に","そして"]),ar:new Set(["ثم","بعدها","ثمّ"]),es:new Set(["entonces","luego","después"]),ko:new Set(["그다음","그리고","그런후","그러면"]),zh:new Set(["然后","接着","之后"]),tr:new Set(["sonra","ardından","daha sonra"]),pt:new Set(["então","depois","logo"]),fr:new Set(["puis","ensuite","alors"]),de:new Set(["dann","danach","anschließend"]),id:new Set(["lalu","kemudian","setelah itu"]),tl:new Set(["pagkatapos","tapos"]),bn:new Set(["তারপর","পরে"]),qu:new Set(["chaymantataq","hinaspa","chaymanta","chayqa"]),sw:new Set(["kisha","halafu","baadaye"])};return(n[t]||n.en).has(e.toLowerCase())}isEndKeyword(e,t){const n={en:new Set(["end"]),ja:new Set(["終わり","終了","おわり"]),ar:new Set(["نهاية","انتهى","آخر"]),es:new Set(["fin","final","terminar"]),ko:new Set(["끝","종료","마침"]),zh:new Set(["结束","终止","完"]),tr:new Set(["son","bitiş","bitti"]),pt:new Set(["fim","final","término"]),fr:new Set(["fin","terminer","finir"]),de:new Set(["ende","beenden","fertig"]),id:new Set(["selesai","akhir","tamat"]),tl:new Set(["wakas","tapos"]),bn:new Set(["সমাপ্ত"]),qu:new Set(["tukukuy","tukuy","puchukay"]),sw:new Set(["mwisho","maliza","tamati"])};return(n[t]||n.en).has(e.toLowerCase())}extractStandaloneModifiers(t,n){const r=Kz(t,n).tokens;if(0===r.length)return{modifiers:null,remainingInput:null};const i=r[0].value.toLowerCase(),a=e.STANDALONE_MODIFIERS[i];if(!a)return{modifiers:null,remainingInput:null};const o={};let s=1;if("once"===a)o.once=1;else{let e=1;if(r.length>e){const t=r[e];"keyword"!==t.kind&&"particle"!==t.kind||(e++,s++)}if(r.length>e){const t=r[e];if("literal"===t.kind){const n=t.value.match(/^(\d+)(ms|s|m)?$/);if(n){let t=parseInt(n[1],10);const r=n[2]||"ms";"s"===r?t*=1e3:"m"===r&&(t*=6e4),o[a]=t,s=e+1}}}o[a]||(o[a]="debounce"===a?300:100)}const l=r.slice(s);return 0===l.length?{modifiers:null,remainingInput:null}:{modifiers:o,remainingInput:t.slice(l[0].position.start)}}applyModifiers(e,t){return{...e,eventModifiers:{...e.eventModifiers,...t}}}extractOrConjunctionEvents(t,n){const r=[];for(;;){const n=t.mark(),i=t.peek();if(!i)break;const a=(i.normalized||i.value).toLowerCase();if(!e.OR_KEYWORDS.has(a)){t.reset(n);break}t.advance();const o=t.peek();if(!o){t.reset(n);break}const s=(o.normalized||o.value).toLowerCase();t.advance(),r.push({type:"literal",value:s})}return r}};ax.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]),ax.SOV_EVENT_MARKERS={ja:new Set(["で"]),ko:new Set,tr:new Set(["de","da","te","ta"]),bn:new Set(["এ"]),qu:new Set(["pi"])},ax.SOV_SOURCE_MARKERS={ja:{markers:new Set(["から"]),windowTokens:new Set(["ウィンドウ","ドキュメント","window","document"])},ko:{markers:new Set(["에서"]),windowTokens:new Set(["창","윈도우","문서","window","document"])},tr:{markers:new Set(["den","dan","ten","tan"]),windowTokens:new Set(["pencere","belge","window","document"])},bn:{markers:new Set(["থেকে","মধ্যে"]),windowTokens:new Set(["উইন্ডো","ডকুমেন্ট","window","document"])},qu:{markers:new Set(["manta"]),windowTokens:new Set(["k_iri","ventana","window","document"])}},ax.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"},ax.OR_KEYWORDS=new Set(["or","أو","o","ou","oder","atau","atau","或","または","또는","veya","অথবা","utaq","au","або","или","hoặc","lub","או","หรือ","o"]);var ox=ax,sx=new ox;function lx(e,t){return sx.parse(e,t)}function cx(e,t){try{const n=Kz(e,t),r=Lp(t);if(0===r.length)return{confidence:0,parseSuccess:0,error:"No patterns available for language: "+t};const i=[...r].sort((e,t)=>t.priority-e.priority),a=i.filter(e=>"on"===e.command),o=Wz.matchBest(n,a);if(o)return{confidence:o.confidence,parseSuccess:1,patternId:o.pattern.id,action:o.pattern.command,tokensConsumed:o.consumedTokens};n.reset(n.mark());const s=i.filter(e=>"on"!==e.command),l=Wz.matchBest(n,s);return l?{confidence:l.confidence,parseSuccess:1,patternId:l.pattern.id,action:l.pattern.command,tokensConsumed:l.consumedTokens}:{confidence:0,parseSuccess:0,error:"Could not match any patterns for: "+e}}catch(e){return{confidence:0,parseSuccess:0,error:e instanceof Error?e.message:e+""}}}function ux(e,t){try{const n=lx(e,t);if(n)return{node:n,confidence:n.metadata?.confidence??.8,error:void 0,tokensConsumed:Kz(e,t).tokens.length}}catch{}const n=cx(e,t);return n.parseSuccess?{node:null,confidence:n.confidence,error:void 0,tokensConsumed:n.tokensConsumed}:{node:null,confidence:0,error:n.error}}function px(e,t){return Wl(e)?e:Qz(lx(e,t))}function mx(e,t){return Xz(tx(e),t)}function dx(e,t,n){return Wl(e)?mx(e,n):Xz(lx(e,t),n)}function fx(e,t){return Wl(e)?tx(e):lx(e,t)}function yx(e,t){if(e.type!==t.type)return 0;switch(e.type){case"literal":case"selector":case"reference":return e.value===t.value;case"property-path":return yx(e.object,t.object)&&e.property===t.property;case"expression":return e.raw===t.raw;case"flag":return e.name===t.name&&e.enabled===t.enabled;default:return 0}}Cp();var hx=class{constructor(e={}){this.cache=new Map,this.config={maxSize:e.maxSize??1e3,ttlMs:e.ttlMs??0,enabled:e.enabled??1},this.stats={hits:0,misses:0,evictions:0,expirations:0}}makeKey(e,t){return`${t}:${e}`}isExpired(e){return 0===this.config.ttlMs?0:Date.now()-e.createdAt>this.config.ttlMs}evictLRU(){const e=this.cache.keys().next().value;void 0!==e&&(this.cache.delete(e),this.stats.evictions++)}get(e,t){if(!this.config.enabled)return void this.stats.misses++;const n=this.makeKey(e,t),r=this.cache.get(n);if(r)return this.isExpired(r)?(this.cache.delete(n),this.stats.expirations++,void this.stats.misses++):(this.cache.delete(n),r.lastAccessed=Date.now(),this.cache.set(n,r),this.stats.hits++,r.result);this.stats.misses++}set(e,t,n){if(!this.config.enabled)return;if(null!==n&&"object"==typeof n&&"confidence"in n&&0===n.confidence)return;const r=this.makeKey(e,t),i=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(r,{result:n,createdAt:i,lastAccessed:i})}has(e,t){if(!this.config.enabled)return 0;const n=this.makeKey(e,t),r=this.cache.get(n);return r?this.isExpired(r)?(this.cache.delete(n),this.stats.expirations++,0):1:0}delete(e,t){const n=this.makeKey(e,t);return this.cache.delete(n)}clear(){this.cache.clear()}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0}}getStats(){const e=this.stats.hits+this.stats.misses;return{hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:e>0?this.stats.hits/e:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(e){if(void 0!==e.maxSize)for(this.config.maxSize=e.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();void 0!==e.ttlMs&&(this.config.ttlMs=e.ttlMs),void 0!==e.enabled&&(this.config.enabled=e.enabled)}enable(){this.config.enabled=1}disable(){this.config.enabled=0}getConfig(){return{...this.config}}},vx=new hx;uh(),Rp(),zp("ar",nh,Op),Ib(),Mp(),zp("bn",Ob,Pp),Gv(),Dp(),zp("de",Mv,Ip),xy(),Fp(),zk(),zp("en",vy,_p),xp("en",kk()),Sh(),Gp(),zp("es",bh,Hp),qv(),Jp(),zp("fr",kv,Up),yb(),Xp(),zp("he",ub,Kp),Sb(),tm(),zp("hi",wb,Yp),Zv(),im(),zp("id",Uv,em),Cg(),sm(),zp("it",Eg,rm),My(),um(),zp("ja",Cy,om),Zy(),dm(),zp("ko",Hy,cm),Kb(),hm(),zp("ms",Db,mm),Bg(),bm(),zp("pl",qg,ym),zv(),zm(),zp("pt",av,gm),cg(),Sm(),zp("qu",ng,km),ib(),Am(),zp("ru",Jg,Em),vg(),Cm(),zp("sw",lg,jm),Vb(),Rm(),zp("th",$b,Om),nw(),Mm(),zp("tl",Xb,Pm),Hh(),Dm(),zp("tr",$h,Im),pb(),Fm(),zp("uk",rb,_m),_g(),Gm(),zp("vi",Og,Hm),Zh(),nd(),zp("zh",Vh,Um),Cp();var gx={en:async()=>{const{englishTokenizer:e}=await Promise.resolve().then(()=>(xy(),by)),{englishProfile:t}=await Promise.resolve().then(()=>(Fp(),Vp)),{buildEnglishPatterns:n}=await Promise.resolve().then(()=>(zk(),wk));return{tokenizer:e,profile:t,buildPatterns:n}},es:async()=>{const{spanishTokenizer:e}=await Promise.resolve().then(()=>(Sh(),zh)),{spanishProfile:t}=await Promise.resolve().then(()=>(Gp(),Bp));return{tokenizer:e,profile:t}},ja:async()=>{const{japaneseTokenizer:e}=await Promise.resolve().then(()=>(My(),Py)),{japaneseProfile:t}=await Promise.resolve().then(()=>(um(),lm));return{tokenizer:e,profile:t}},ar:async()=>{const{arabicTokenizer:e}=await Promise.resolve().then(()=>(uh(),ih)),{arabicProfile:t}=await Promise.resolve().then(()=>(Rp(),Np));return{tokenizer:e,profile:t}},ko:async()=>{const{koreanTokenizer:e}=await Promise.resolve().then(()=>(Zy(),By)),{koreanProfile:t}=await Promise.resolve().then(()=>(dm(),pm));return{tokenizer:e,profile:t}},zh:async()=>{const{chineseTokenizer:e}=await Promise.resolve().then(()=>(Zh(),Fh)),{chineseProfile:t}=await Promise.resolve().then(()=>(nd(),Wm));return{tokenizer:e,profile:t}},tr:async()=>{const{turkishTokenizer:e}=await Promise.resolve().then(()=>(Hh(),Mh)),{turkishProfile:t}=await Promise.resolve().then(()=>(Dm(),qm));return{tokenizer:e,profile:t}},pt:async()=>{const{portugueseTokenizer:e}=await Promise.resolve().then(()=>(zv(),lv)),{portugueseProfile:t}=await Promise.resolve().then(()=>(zm(),wm));return{tokenizer:e,profile:t}},fr:async()=>{const{frenchTokenizer:e}=await Promise.resolve().then(()=>(qv(),Sv)),{frenchProfile:t}=await Promise.resolve().then(()=>(Jp(),Wp));return{tokenizer:e,profile:t}},de:async()=>{const{germanTokenizer:e}=await Promise.resolve().then(()=>(Gv(),Vv)),{germanProfile:t}=await Promise.resolve().then(()=>(Dp(),qp));return{tokenizer:e,profile:t}},id:async()=>{const{indonesianTokenizer:e}=await Promise.resolve().then(()=>(Zv(),Wv)),{indonesianProfile:t}=await Promise.resolve().then(()=>(im(),nm));return{tokenizer:e,profile:t}},qu:async()=>{const{quechuaTokenizer:e}=await Promise.resolve().then(()=>(cg(),ig)),{quechuaProfile:t}=await Promise.resolve().then(()=>(Sm(),xm));return{tokenizer:e,profile:t}},sw:async()=>{const{swahiliTokenizer:e}=await Promise.resolve().then(()=>(vg(),ug)),{swahiliProfile:t}=await Promise.resolve().then(()=>(Cm(),Lm));return{tokenizer:e,profile:t}},bn:async()=>{const{bengaliTokenizer:e}=await Promise.resolve().then(()=>(Ib(),Nb)),{bengaliProfile:t}=await Promise.resolve().then(()=>(Mp(),$p));return{tokenizer:e,profile:t}},hi:async()=>{const{hindiTokenizer:e}=await Promise.resolve().then(()=>(Sb(),zb)),{hindiProfile:t}=await Promise.resolve().then(()=>(tm(),Qp));return{tokenizer:e,profile:t}},it:async()=>{const{italianTokenizer:e}=await Promise.resolve().then(()=>(Cg(),jg)),{italianProfile:t}=await Promise.resolve().then(()=>(sm(),am));return{tokenizer:e,profile:t}},ms:async()=>{const{malayTokenizer:e}=await Promise.resolve().then(()=>(Kb(),Hb)),{malayProfile:t}=await Promise.resolve().then(()=>(hm(),fm));return{tokenizer:e,profile:t}},pl:async()=>{const{polishTokenizer:e}=await Promise.resolve().then(()=>(Bg(),Vg)),{polishProfile:t}=await Promise.resolve().then(()=>(bm(),vm));return{tokenizer:e,profile:t}},ru:async()=>{const{russianTokenizer:e}=await Promise.resolve().then(()=>(ib(),Yg)),{russianProfile:t}=await Promise.resolve().then(()=>(Am(),Tm));return{tokenizer:e,profile:t}},th:async()=>{const{thaiTokenizer:e}=await Promise.resolve().then(()=>(Vb(),Mb)),{thaiProfile:t}=await Promise.resolve().then(()=>(Rm(),Nm));return{tokenizer:e,profile:t}},tl:async()=>{const{tagalogTokenizer:e}=await Promise.resolve().then(()=>(nw(),ew)),{tagalogProfile:t}=await Promise.resolve().then(()=>(Mm(),$m));return{tokenizer:e,profile:t}},uk:async()=>{const{ukrainianTokenizer:e}=await Promise.resolve().then(()=>(pb(),ob)),{ukrainianProfile:t}=await Promise.resolve().then(()=>(Fm(),Vm));return{tokenizer:e,profile:t}},vi:async()=>{const{vietnameseTokenizer:e}=await Promise.resolve().then(()=>(_g(),Ng)),{vietnameseProfile:t}=await Promise.resolve().then(()=>(Gm(),Bm));return{tokenizer:e,profile:t}},he:async()=>{const{hebrewTokenizer:e}=await Promise.resolve().then(()=>(yb(),mb)),{hebrewProfile:t}=await Promise.resolve().then(()=>(Xp(),Zp));return{tokenizer:e,profile:t}}},bx=Object.keys(gx);async function wx(e,t={}){const{url:n,module:r,skipIfRegistered:i=1}=t;if(i&&Ap(e))return{code:e,loaded:0};try{let t;if(r)t=r;else if(n)t=await async function(e,t){try{const e=await fetch(t);if(!e.ok)throw Error(`Failed to fetch ${t}: ${e.status} ${e.statusText}`);const n=await e.text(),r=new Blob([n],{type:"application/javascript"}),i=URL.createObjectURL(r);try{const e=await import(i);if(!e.tokenizer||!e.profile)throw Error("Invalid language module: missing tokenizer or profile");return e}finally{URL.revokeObjectURL(i)}}catch(n){throw Error(`Failed to load language '${e}' from ${t}: ${n instanceof Error?n.message:n+""}`)}}(e,n);else{const n=gx[e];if(!n)throw Error(`Unknown language: ${e}. Supported: ${bx.join(", ")}`);t=await n()}return function(e,t){zp(e,t.tokenizer,t.profile),t.patterns?xp(e,t.patterns):t.buildPatterns&&xp(e,t.buildPatterns())}(e,t),{code:e,loaded:1}}catch(t){return{code:e,loaded:0,error:t instanceof Error?t.message:t+""}}}ok(),bk(),sw();var kx=[{id:"fetch-en-with-response-type",language:"en",command:"fetch",priority:90,template:{format:"fetch {source} as {responseType}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"literal",value:"as"},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]},extraction:{source:{position:1},responseType:{marker:"as"}}},{id:"fetch-en-simple",language:"en",command:"fetch",priority:80,template:{format:"fetch {source}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source"}]},extraction:{source:{position:1}}},{id:"swap-en-handcrafted",language:"en",command:"swap",priority:110,template:{format:"swap {method} {destination}",tokens:[{type:"literal",value:"swap"},{type:"role",role:"method"},{type:"role",role:"destination"}]},extraction:{method:{position:1},destination:{position:2}}},{id:"repeat-en-until-event-from",language:"en",command:"repeat",priority:120,template:{format:"repeat until event {event} from {source}",tokens:[{type:"literal",value:"repeat"},{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:"from"},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]}]},extraction:{event:{marker:"event"},source:{marker:"from"},loopType:{default:{type:"literal",value:"until-event"}}}},{id:"repeat-en-until-event",language:"en",command:"repeat",priority:110,template:{format:"repeat until event {event}",tokens:[{type:"literal",value:"repeat"},{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]}]},extraction:{event:{marker:"event"},loopType:{default:{type:"literal",value:"until-event"}}}},{id:"set-en-possessive",language:"en",command:"set",priority:100,template:{format:"set {destination} to {patient}",tokens:[{type:"literal",value:"set"},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"to"},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{marker:"to"}}},{id:"for-en-basic",language:"en",command:"for",priority:100,template:{format:"for {patient} in {source}",tokens:[{type:"literal",value:"for"},{type:"role",role:"patient",expectedTypes:["expression","reference"]},{type:"literal",value:"in"},{type:"role",role:"source",expectedTypes:["selector","expression","reference"]}]},extraction:{patient:{position:1},source:{marker:"in"},loopType:{default:{type:"literal",value:"for"}}}},{id:"if-en-basic",language:"en",command:"if",priority:100,template:{format:"if {condition}",tokens:[{type:"literal",value:"if"},{type:"role",role:"condition",expectedTypes:["expression","reference","selector"]}]},extraction:{condition:{position:1}}},{id:"unless-en-basic",language:"en",command:"unless",priority:100,template:{format:"unless {condition}",tokens:[{type:"literal",value:"unless"},{type:"role",role:"condition",expectedTypes:["expression","reference","selector"]}]},extraction:{condition:{position:1}}},{id:"temporal-en-in",language:"en",command:"wait",priority:95,template:{format:"in {duration}",tokens:[{type:"literal",value:"in"},{type:"role",role:"duration",expectedTypes:["literal","expression"]}]},extraction:{duration:{position:1}}},{id:"temporal-en-after",language:"en",command:"wait",priority:95,template:{format:"after {duration}",tokens:[{type:"literal",value:"after"},{type:"role",role:"duration",expectedTypes:["literal","expression"]}]},extraction:{duration:{position:1}}}];ik(),Cp();var zx=[ak,function(e){return[]},sk,rw,function(e){switch(e){case"bn":return[{id:"add-bn-full",language:"bn",command:"add",priority:100,template:{format:"{patient} কে যোগ করুন",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"যোগ"},{type:"literal",value:"করুন"}]},extraction:{patient:{position:0}}},{id:"add-bn-simple",language:"bn",command:"add",priority:90,template:{format:"যোগ {patient}",tokens:[{type:"literal",value:"যোগ"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"add-bn-with-dest",language:"bn",command:"add",priority:95,template:{format:"{destination} এ {patient} কে যোগ করুন",tokens:[{type:"role",role:"destination"},{type:"literal",value:"এ",alternatives:["তে"]},{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"যোগ"},{type:"literal",value:"করুন"}]},extraction:{destination:{position:0},patient:{position:2}}}];case"hi":return[{id:"add-hi-full",language:"hi",command:"add",priority:100,template:{format:"{patient} को {destination} में जोड़ें",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"role",role:"destination"},{type:"literal",value:"में"},{type:"literal",value:"जोड़ें",alternatives:["जोड़"]}]},extraction:{patient:{position:0},destination:{marker:"में",position:3}}},{id:"add-hi-simple",language:"hi",command:"add",priority:90,template:{format:"{patient} जोड़ें",tokens:[{type:"role",role:"patient"},{type:"literal",value:"जोड़ें",alternatives:["जोड़"]}]},extraction:{patient:{position:0},destination:{default:{type:"reference",value:"me"}}}},{id:"add-hi-bare",language:"hi",command:"add",priority:80,template:{format:"जोड़ें {patient}",tokens:[{type:"literal",value:"जोड़ें",alternatives:["जोड़"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"it":return[{id:"add-it-full",language:"it",command:"add",priority:100,template:{format:"aggiungere {patient} a {target}",tokens:[{type:"literal",value:"aggiungere",alternatives:["aggiungi","add"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"a",alternatives:["su","in"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"a",markerAlternatives:["su","in"],default:{type:"reference",value:"me"}}}},{id:"add-it-simple",language:"it",command:"add",priority:90,template:{format:"aggiungere {patient}",tokens:[{type:"literal",value:"aggiungere",alternatives:["aggiungi","add"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"pl":return[{id:"add-pl-full",language:"pl",command:"add",priority:100,template:{format:"dodaj {patient} do {destination}",tokens:[{type:"literal",value:"dodaj",alternatives:["dołącz","dolacz"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"do",alternatives:["na","w"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"do",markerAlternatives:["na","w"],default:{type:"reference",value:"me"}}}},{id:"add-pl-simple",language:"pl",command:"add",priority:90,template:{format:"dodaj {patient}",tokens:[{type:"literal",value:"dodaj",alternatives:["dołącz","dolacz"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"qu":return[{id:"add-qu-sov",language:"qu",command:"add",priority:100,template:{format:"{patient} ta yapay",tokens:[{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"yapay",alternatives:["yapaykuy"]}]},extraction:{patient:{position:0}}},{id:"add-qu-simple",language:"qu",command:"add",priority:90,template:{format:"yapay {patient}",tokens:[{type:"literal",value:"yapay",alternatives:["yapaykuy"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"add-qu-with-dest",language:"qu",command:"add",priority:95,template:{format:"{destination} man {patient} ta yapay",tokens:[{type:"role",role:"destination"},{type:"literal",value:"man"},{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"yapay",alternatives:["yapaykuy"]}]},extraction:{destination:{position:0},patient:{position:2}}}];case"ru":return[{id:"add-ru-full",language:"ru",command:"add",priority:100,template:{format:"добавить {patient} к {destination}",tokens:[{type:"literal",value:"добавить",alternatives:["добавь"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"к",alternatives:["на","в"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"к",markerAlternatives:["на","в"],default:{type:"reference",value:"me"}}}},{id:"add-ru-simple",language:"ru",command:"add",priority:90,template:{format:"добавить {patient}",tokens:[{type:"literal",value:"добавить",alternatives:["добавь"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"th":return[{id:"add-th-simple",language:"th",command:"add",priority:100,template:{format:"เพิ่ม {patient}",tokens:[{type:"literal",value:"เพิ่ม"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"add-th-with-dest",language:"th",command:"add",priority:95,template:{format:"เพิ่ม {patient} ใน {destination}",tokens:[{type:"literal",value:"เพิ่ม"},{type:"role",role:"patient"},{type:"literal",value:"ใน"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"ใน",position:3}}}];case"uk":return[{id:"add-uk-full",language:"uk",command:"add",priority:100,template:{format:"додати {patient} до {destination}",tokens:[{type:"literal",value:"додати",alternatives:["додай"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"до",alternatives:["на","в"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"до",markerAlternatives:["на","в"],default:{type:"reference",value:"me"}}}},{id:"add-uk-simple",language:"uk",command:"add",priority:90,template:{format:"додати {patient}",tokens:[{type:"literal",value:"додати",alternatives:["додай"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"vi":return[{id:"add-vi-full",language:"vi",command:"add",priority:100,template:{format:"thêm {patient} vào {target}",tokens:[{type:"literal",value:"thêm",alternatives:["bổ sung"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"vào",alternatives:["cho"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"vào",markerAlternatives:["cho"],default:{type:"reference",value:"me"}}}},{id:"add-vi-simple",language:"vi",command:"add",priority:90,template:{format:"thêm {patient}",tokens:[{type:"literal",value:"thêm",alternatives:["bổ sung"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"zh":return[{id:"add-zh-full",language:"zh",command:"add",priority:100,template:{format:"给 {destination} 添加 {patient}",tokens:[{type:"literal",value:"给",alternatives:["為","为"]},{type:"role",role:"destination"},{type:"literal",value:"添加",alternatives:["加","增加","加上"]},{type:"role",role:"patient"}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"add-zh-simple",language:"zh",command:"add",priority:90,template:{format:"添加 {patient}",tokens:[{type:"literal",value:"添加",alternatives:["加","增加"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}},{id:"add-zh-ba",language:"zh",command:"add",priority:95,template:{format:"把 {patient} 添加到 {destination}",tokens:[{type:"literal",value:"把"},{type:"role",role:"patient"},{type:"literal",value:"添加到",alternatives:["加到","增加到"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"添加到",markerAlternatives:["加到","增加到"]}}}];default:return[]}},function(e){switch(e){case"bn":return[{id:"remove-bn-full",language:"bn",command:"remove",priority:100,template:{format:"{patient} কে সরান",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"সরান",alternatives:["মুছুন"]}]},extraction:{patient:{position:0}}},{id:"remove-bn-simple",language:"bn",command:"remove",priority:90,template:{format:"সরান {patient}",tokens:[{type:"literal",value:"সরান",alternatives:["মুছুন"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"remove-bn-with-source",language:"bn",command:"remove",priority:95,template:{format:"{source} থেকে {patient} কে সরান",tokens:[{type:"role",role:"source"},{type:"literal",value:"থেকে"},{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"সরান",alternatives:["মুছুন"]}]},extraction:{source:{position:0},patient:{position:2}}}];case"hi":return[{id:"remove-hi-full",language:"hi",command:"remove",priority:100,template:{format:"{patient} को {source} से हटाएं",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"role",role:"source"},{type:"literal",value:"से"},{type:"literal",value:"हटाएं",alternatives:["हटा","मिटाएं"]}]},extraction:{patient:{position:0},source:{marker:"से",position:3}}},{id:"remove-hi-simple",language:"hi",command:"remove",priority:90,template:{format:"{patient} हटाएं",tokens:[{type:"role",role:"patient"},{type:"literal",value:"हटाएं",alternatives:["हटा","मिटाएं"]}]},extraction:{patient:{position:0},source:{default:{type:"reference",value:"me"}}}},{id:"remove-hi-bare",language:"hi",command:"remove",priority:80,template:{format:"हटाएं {patient}",tokens:[{type:"literal",value:"हटाएं",alternatives:["हटा","मिटाएं"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},source:{default:{type:"reference",value:"me"}}}}];case"it":return[{id:"remove-it-full",language:"it",command:"remove",priority:100,template:{format:"rimuovere {patient} da {target}",tokens:[{type:"literal",value:"rimuovere",alternatives:["rimuovi","eliminare","togliere","remove"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"da",alternatives:["di"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"da",markerAlternatives:["di"],default:{type:"reference",value:"me"}}}},{id:"remove-it-simple",language:"it",command:"remove",priority:90,template:{format:"rimuovere {patient}",tokens:[{type:"literal",value:"rimuovere",alternatives:["rimuovi","eliminare","togliere","remove"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}];case"pl":return[{id:"remove-pl-full",language:"pl",command:"remove",priority:100,template:{format:"usuń {patient} z {source}",tokens:[{type:"literal",value:"usuń",alternatives:["usun","wyczyść","wyczysc"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"z",alternatives:["od","ze"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"z",markerAlternatives:["od","ze"],default:{type:"reference",value:"me"}}}},{id:"remove-pl-simple",language:"pl",command:"remove",priority:90,template:{format:"usuń {patient}",tokens:[{type:"literal",value:"usuń",alternatives:["usun","wyczyść","wyczysc"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},source:{default:{type:"reference",value:"me"}}}}];case"qu":return[{id:"remove-qu-sov",language:"qu",command:"remove",priority:100,template:{format:"{patient} ta qichuy",tokens:[{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"qichuy",alternatives:["hurquy","anchuchiy"]}]},extraction:{patient:{position:0}}},{id:"remove-qu-simple",language:"qu",command:"remove",priority:90,template:{format:"qichuy {patient}",tokens:[{type:"literal",value:"qichuy",alternatives:["hurquy","anchuchiy"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"remove-qu-with-source",language:"qu",command:"remove",priority:95,template:{format:"{source} manta {patient} ta qichuy",tokens:[{type:"role",role:"source"},{type:"literal",value:"manta"},{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"qichuy",alternatives:["hurquy","anchuchiy"]}]},extraction:{source:{position:0},patient:{position:2}}}];case"ru":return[{id:"remove-ru-full",language:"ru",command:"remove",priority:100,template:{format:"удалить {patient} из {source}",tokens:[{type:"literal",value:"удалить",alternatives:["удали","убрать","убери"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"из",alternatives:["от","с"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"из",markerAlternatives:["от","с"],default:{type:"reference",value:"me"}}}},{id:"remove-ru-simple",language:"ru",command:"remove",priority:90,template:{format:"удалить {patient}",tokens:[{type:"literal",value:"удалить",alternatives:["удали","убрать","убери"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},source:{default:{type:"reference",value:"me"}}}}];case"th":return[{id:"remove-th-simple",language:"th",command:"remove",priority:100,template:{format:"ลบ {patient}",tokens:[{type:"literal",value:"ลบ",alternatives:["ลบออก"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"remove-th-with-source",language:"th",command:"remove",priority:95,template:{format:"ลบ {patient} จาก {source}",tokens:[{type:"literal",value:"ลบ",alternatives:["ลบออก"]},{type:"role",role:"patient"},{type:"literal",value:"จาก"},{type:"role",role:"source"}]},extraction:{patient:{position:1},source:{marker:"จาก",position:3}}}];case"uk":return[{id:"remove-uk-full",language:"uk",command:"remove",priority:100,template:{format:"видалити {patient} з {source}",tokens:[{type:"literal",value:"видалити",alternatives:["видали","прибрати","прибери"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"з",alternatives:["від","із"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"з",markerAlternatives:["від","із"],default:{type:"reference",value:"me"}}}},{id:"remove-uk-simple",language:"uk",command:"remove",priority:90,template:{format:"видалити {patient}",tokens:[{type:"literal",value:"видалити",alternatives:["видали","прибрати","прибери"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},source:{default:{type:"reference",value:"me"}}}}];case"vi":return[{id:"remove-vi-full",language:"vi",command:"remove",priority:100,template:{format:"xóa {patient} khỏi {target}",tokens:[{type:"literal",value:"xóa",alternatives:["gỡ bỏ","loại bỏ","bỏ"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"khỏi",alternatives:["từ"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"khỏi",markerAlternatives:["từ"],default:{type:"reference",value:"me"}}}},{id:"remove-vi-simple",language:"vi",command:"remove",priority:90,template:{format:"xóa {patient}",tokens:[{type:"literal",value:"xóa",alternatives:["gỡ bỏ","loại bỏ","bỏ"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},source:{default:{type:"reference",value:"me"}}}}];case"zh":return[{id:"remove-zh-full",language:"zh",command:"remove",priority:100,template:{format:"从 {destination} 删除 {patient}",tokens:[{type:"literal",value:"从",alternatives:["從"]},{type:"role",role:"destination"},{type:"literal",value:"删除",alternatives:["刪除","移除","去掉"]},{type:"role",role:"patient"}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"remove-zh-simple",language:"zh",command:"remove",priority:90,template:{format:"删除 {patient}",tokens:[{type:"literal",value:"删除",alternatives:["刪除","移除","去掉"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}},{id:"remove-zh-ba",language:"zh",command:"remove",priority:95,template:{format:"把 {patient} 从 {destination} 删除",tokens:[{type:"literal",value:"把"},{type:"role",role:"patient"},{type:"literal",value:"从",alternatives:["從"]},{type:"role",role:"destination"},{type:"literal",value:"删除",alternatives:["刪除","移除"]}]},extraction:{patient:{position:1},destination:{position:3}}}];default:return[]}},function(e){switch(e){case"bn":return[{id:"show-bn-full",language:"bn",command:"show",priority:100,template:{format:"{patient} কে দেখান",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"দেখান",alternatives:["দেখাও"]}]},extraction:{patient:{position:0}}},{id:"show-bn-simple",language:"bn",command:"show",priority:90,template:{format:"দেখান {patient}",tokens:[{type:"literal",value:"দেখান",alternatives:["দেখাও"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"de":return[{id:"show-de-full",language:"de",command:"show",priority:100,template:{format:"zeige {patient}",tokens:[{type:"literal",value:"zeige",alternatives:["zeigen","anzeigen","show"]},{type:"role",role:"patient",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1}}}];case"fr":return[{id:"show-fr-full",language:"fr",command:"show",priority:100,template:{format:"afficher {patient}",tokens:[{type:"literal",value:"afficher",alternatives:["montrer","présenter","show"]},{type:"role",role:"patient",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1}}}];case"hi":return[{id:"show-hi-full",language:"hi",command:"show",priority:100,template:{format:"{patient} को दिखाएं",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"literal",value:"दिखाएं",alternatives:["दिखा"]}]},extraction:{patient:{position:0}}},{id:"show-hi-simple",language:"hi",command:"show",priority:90,template:{format:"दिखाएं {patient}",tokens:[{type:"literal",value:"दिखाएं",alternatives:["दिखा"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"show-hi-bare",language:"hi",command:"show",priority:80,template:{format:"दिखाएं",tokens:[{type:"literal",value:"दिखाएं",alternatives:["दिखा"]}]},extraction:{patient:{default:{type:"reference",value:"me"}}}}];case"it":return[{id:"show-it-full",language:"it",command:"show",priority:100,template:{format:"mostrare {patient} con {style}",tokens:[{type:"literal",value:"mostrare",alternatives:["mostra","visualizzare","show"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"con"},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"con"}}},{id:"show-it-simple",language:"it",command:"show",priority:90,template:{format:"mostrare {patient}",tokens:[{type:"literal",value:"mostrare",alternatives:["mostra","visualizzare","show"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"pl":return[{id:"show-pl-full",language:"pl",command:"show",priority:100,template:{format:"pokaż {patient} z {style}",tokens:[{type:"literal",value:"pokaż",alternatives:["pokaz","wyświetl","wyswietl"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"z",alternatives:["ze","jako"]},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"z",markerAlternatives:["ze","jako"]}}},{id:"show-pl-simple",language:"pl",command:"show",priority:90,template:{format:"pokaż {patient}",tokens:[{type:"literal",value:"pokaż",alternatives:["pokaz","wyświetl","wyswietl"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"ru":return[{id:"show-ru-full",language:"ru",command:"show",priority:100,template:{format:"показать {patient} с {style}",tokens:[{type:"literal",value:"показать",alternatives:["покажи"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"с",alternatives:["со","как"]},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"с",markerAlternatives:["со","как"]}}},{id:"show-ru-simple",language:"ru",command:"show",priority:90,template:{format:"показать {patient}",tokens:[{type:"literal",value:"показать",alternatives:["покажи"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"th":return[{id:"show-th-simple",language:"th",command:"show",priority:100,template:{format:"แสดง {patient}",tokens:[{type:"literal",value:"แสดง"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"uk":return[{id:"show-uk-full",language:"uk",command:"show",priority:100,template:{format:"показати {patient} з {style}",tokens:[{type:"literal",value:"показати",alternatives:["покажи"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"з",alternatives:["із","як"]},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"з",markerAlternatives:["із","як"]}}},{id:"show-uk-simple",language:"uk",command:"show",priority:90,template:{format:"показати {patient}",tokens:[{type:"literal",value:"показати",alternatives:["покажи"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"vi":return[{id:"show-vi-full",language:"vi",command:"show",priority:100,template:{format:"hiển thị {patient} với {effect}",tokens:[{type:"literal",value:"hiển thị",alternatives:["hiện"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"với"},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"với"}}},{id:"show-vi-simple",language:"vi",command:"show",priority:90,template:{format:"hiển thị {patient}",tokens:[{type:"literal",value:"hiển thị",alternatives:["hiện"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"zh":return[{id:"show-zh-full",language:"zh",command:"show",priority:100,template:{format:"显示 {patient}",tokens:[{type:"literal",value:"显示",alternatives:["顯示","展示","呈现","呈現"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"show-zh-ba",language:"zh",command:"show",priority:95,template:{format:"把 {patient} 显示",tokens:[{type:"literal",value:"把"},{type:"role",role:"patient"},{type:"literal",value:"显示",alternatives:["顯示","展示"]}]},extraction:{patient:{position:1}}},{id:"show-zh-with-给",language:"zh",command:"show",priority:90,template:{format:"给 {destination} 显示 {patient}",tokens:[{type:"literal",value:"给",alternatives:["給"]},{type:"role",role:"destination"},{type:"literal",value:"显示",alternatives:["顯示"]},{type:"role",role:"patient"}]},extraction:{destination:{position:1},patient:{position:3}}}];default:return[]}},function(e){switch(e){case"bn":return[{id:"hide-bn-full",language:"bn",command:"hide",priority:100,template:{format:"{patient} কে লুকান",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"লুকান",alternatives:["লুকাও"]}]},extraction:{patient:{position:0}}},{id:"hide-bn-simple",language:"bn",command:"hide",priority:90,template:{format:"লুকান {patient}",tokens:[{type:"literal",value:"লুকান",alternatives:["লুকাও"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"de":return[{id:"hide-de-full",language:"de",command:"hide",priority:100,template:{format:"verstecke {patient}",tokens:[{type:"literal",value:"verstecke",alternatives:["verstecken","verberge","verbergen","hide"]},{type:"role",role:"patient",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1}}}];case"hi":return[{id:"hide-hi-full",language:"hi",command:"hide",priority:100,template:{format:"{patient} को छिपाएं",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"literal",value:"छिपाएं",alternatives:["छिपा"]}]},extraction:{patient:{position:0}}},{id:"hide-hi-simple",language:"hi",command:"hide",priority:90,template:{format:"छिपाएं {patient}",tokens:[{type:"literal",value:"छिपाएं",alternatives:["छिपा"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"hide-hi-bare",language:"hi",command:"hide",priority:80,template:{format:"छिपाएं",tokens:[{type:"literal",value:"छिपाएं",alternatives:["छिपा"]}]},extraction:{patient:{default:{type:"reference",value:"me"}}}}];case"it":return[{id:"hide-it-full",language:"it",command:"hide",priority:100,template:{format:"nascondere {patient} con {style}",tokens:[{type:"literal",value:"nascondere",alternatives:["nascondi","hide"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"con"},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"con"}}},{id:"hide-it-simple",language:"it",command:"hide",priority:90,template:{format:"nascondere {patient}",tokens:[{type:"literal",value:"nascondere",alternatives:["nascondi","hide"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"pl":return[{id:"hide-pl-full",language:"pl",command:"hide",priority:100,template:{format:"ukryj {patient} z {style}",tokens:[{type:"literal",value:"ukryj",alternatives:["schowaj","zasłoń","zaslon"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"z",alternatives:["ze","jako"]},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"z",markerAlternatives:["ze","jako"]}}},{id:"hide-pl-simple",language:"pl",command:"hide",priority:90,template:{format:"ukryj {patient}",tokens:[{type:"literal",value:"ukryj",alternatives:["schowaj","zasłoń","zaslon"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"ru":return[{id:"hide-ru-full",language:"ru",command:"hide",priority:100,template:{format:"скрыть {patient} с {style}",tokens:[{type:"literal",value:"скрыть",alternatives:["скрой","спрятать","спрячь"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"с",alternatives:["со","как"]},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"с",markerAlternatives:["со","как"]}}},{id:"hide-ru-simple",language:"ru",command:"hide",priority:90,template:{format:"скрыть {patient}",tokens:[{type:"literal",value:"скрыть",alternatives:["скрой","спрятать","спрячь"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"th":return[{id:"hide-th-simple",language:"th",command:"hide",priority:100,template:{format:"ซ่อน {patient}",tokens:[{type:"literal",value:"ซ่อน"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"uk":return[{id:"hide-uk-full",language:"uk",command:"hide",priority:100,template:{format:"сховати {patient} з {style}",tokens:[{type:"literal",value:"сховати",alternatives:["сховай","приховати","приховай"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"з",alternatives:["із","як"]},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"з",markerAlternatives:["із","як"]}}},{id:"hide-uk-simple",language:"uk",command:"hide",priority:90,template:{format:"сховати {patient}",tokens:[{type:"literal",value:"сховати",alternatives:["сховай","приховати","приховай"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"vi":return[{id:"hide-vi-full",language:"vi",command:"hide",priority:100,template:{format:"ẩn {patient} với {effect}",tokens:[{type:"literal",value:"ẩn",alternatives:["che","giấu"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"với"},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"với"}}},{id:"hide-vi-simple",language:"vi",command:"hide",priority:90,template:{format:"ẩn {patient}",tokens:[{type:"literal",value:"ẩn",alternatives:["che","giấu"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"zh":return[{id:"hide-zh-full",language:"zh",command:"hide",priority:100,template:{format:"隐藏 {patient}",tokens:[{type:"literal",value:"隐藏",alternatives:["隱藏","藏起","藏"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"hide-zh-ba",language:"zh",command:"hide",priority:95,template:{format:"把 {patient} 隐藏",tokens:[{type:"literal",value:"把"},{type:"role",role:"patient"},{type:"literal",value:"隐藏",alternatives:["隱藏","藏起"]}]},extraction:{patient:{position:1}}},{id:"hide-zh-from",language:"zh",command:"hide",priority:90,template:{format:"从 {destination} 隐藏 {patient}",tokens:[{type:"literal",value:"从",alternatives:["從"]},{type:"role",role:"destination"},{type:"literal",value:"隐藏",alternatives:["隱藏"]},{type:"role",role:"patient"}]},extraction:{destination:{position:1},patient:{position:3}}}];default:return[]}},function(e){switch(e){case"bn":return[{id:"set-bn-full",language:"bn",command:"set",priority:100,template:{format:"{patient} কে {goal} এ সেট করুন",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"role",role:"goal"},{type:"literal",value:"এ",alternatives:["তে"]},{type:"literal",value:"সেট",alternatives:["নির্ধারণ"]},{type:"literal",value:"করুন"}]},extraction:{patient:{position:0},goal:{marker:"এ",position:2}}},{id:"set-bn-simple",language:"bn",command:"set",priority:90,template:{format:"সেট {patient} {goal}",tokens:[{type:"literal",value:"সেট",alternatives:["নির্ধারণ"]},{type:"role",role:"patient"},{type:"role",role:"goal"}]},extraction:{patient:{position:1},goal:{position:2}}}];case"de":return[{id:"set-de-full",language:"de",command:"set",priority:100,template:{format:"setze {destination} auf {patient}",tokens:[{type:"literal",value:"setze",alternatives:["setzen","stelle","stellen","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"auf",alternatives:["zu","an"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-de-festlegen-auf",language:"de",command:"set",priority:99,template:{format:"festlegen auf {destination} {patient}",tokens:[{type:"literal",value:"festlegen",alternatives:["einstellen","setzen"]},{type:"literal",value:"auf",alternatives:["an"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-de-equals",language:"de",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:0},patient:{position:2}}}];case"es":return[{id:"set-es-full",language:"es",command:"set",priority:100,template:{format:"establecer {destination} a {patient}",tokens:[{type:"literal",value:"establecer",alternatives:["fijar","definir","poner","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"a",alternatives:["en","como"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-es-prep-first",language:"es",command:"set",priority:95,template:{format:"establecer en {destination} {patient}",tokens:[{type:"literal",value:"establecer",alternatives:["fijar","definir","poner","set"]},{type:"literal",value:"en",alternatives:["a"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-es-equals",language:"es",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:0},patient:{position:2}}}];case"fr":return[{id:"set-fr-full",language:"fr",command:"set",priority:100,template:{format:"définir {destination} à {patient}",tokens:[{type:"literal",value:"définir",alternatives:["definir","mettre","fixer","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"à",alternatives:["a","sur","comme"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-fr-sur-direct",language:"fr",command:"set",priority:98,template:{format:"définir sur {destination} {patient}",tokens:[{type:"literal",value:"définir",alternatives:["definir","mettre","fixer"]},{type:"literal",value:"sur",alternatives:["à","en"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-fr-equals",language:"fr",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:0},patient:{position:2}}}];case"hi":return[{id:"set-hi-full",language:"hi",command:"set",priority:100,template:{format:"{destination} को {patient} सेट करें",tokens:[{type:"role",role:"destination"},{type:"literal",value:"को"},{type:"role",role:"patient"},{type:"literal",value:"सेट",alternatives:["निर्धारित"]},{type:"group",optional:1,tokens:[{type:"literal",value:"करें",alternatives:["करो"]}]}]},extraction:{destination:{position:0},patient:{marker:"को",position:2}}},{id:"set-hi-simple",language:"hi",command:"set",priority:90,template:{format:"सेट {destination} {patient}",tokens:[{type:"literal",value:"सेट",alternatives:["निर्धारित"]},{type:"role",role:"destination"},{type:"role",role:"patient"}]},extraction:{destination:{position:1},patient:{position:2}}}];case"id":return[{id:"set-id-full",language:"id",command:"set",priority:100,template:{format:"atur {destination} ke {patient}",tokens:[{type:"literal",value:"atur",alternatives:["tetapkan","setel","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"ke",alternatives:["menjadi","jadi","pada"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-id-pada-direct",language:"id",command:"set",priority:98,template:{format:"atur pada {destination} {patient}",tokens:[{type:"literal",value:"atur",alternatives:["tetapkan","setel"]},{type:"literal",value:"pada",alternatives:["ke","di"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-id-equals",language:"id",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:0},patient:{position:2}}}];case"it":return[{id:"set-it-full",language:"it",command:"set",priority:100,template:{format:"impostare {patient} a {goal}",tokens:[{type:"literal",value:"impostare",alternatives:["imposta","set","definire"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"a",alternatives:["su","come"]},{type:"role",role:"goal"}]}]},extraction:{patient:{position:1},goal:{marker:"a",markerAlternatives:["su","come"]}}},{id:"set-it-simple",language:"it",command:"set",priority:90,template:{format:"impostare {patient}",tokens:[{type:"literal",value:"impostare",alternatives:["imposta","set"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"pl":return[{id:"set-pl-full",language:"pl",command:"set",priority:100,template:{format:"ustaw {patient} na {goal}",tokens:[{type:"literal",value:"ustaw",alternatives:["określ","okresl","przypisz"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"na",alternatives:["do","jako"]},{type:"role",role:"goal"}]}]},extraction:{patient:{position:1},goal:{marker:"na",markerAlternatives:["do","jako"]}}},{id:"set-pl-simple",language:"pl",command:"set",priority:90,template:{format:"ustaw {patient}",tokens:[{type:"literal",value:"ustaw",alternatives:["określ","okresl"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"pt":return[{id:"set-pt-full",language:"pt",command:"set",priority:100,template:{format:"definir {destination} para {patient}",tokens:[{type:"literal",value:"definir",alternatives:["estabelecer","colocar","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"para",alternatives:["como","a","em"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-pt-em-direct",language:"pt",command:"set",priority:98,template:{format:"definir em {destination} {patient}",tokens:[{type:"literal",value:"definir",alternatives:["estabelecer","colocar"]},{type:"literal",value:"em",alternatives:["para","a"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-pt-equals",language:"pt",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:0},patient:{position:2}}}];case"ru":return[{id:"set-ru-full",language:"ru",command:"set",priority:100,template:{format:"установить {patient} в {goal}",tokens:[{type:"literal",value:"установить",alternatives:["установи","задать","задай"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"в",alternatives:["на","как"]},{type:"role",role:"goal"}]}]},extraction:{patient:{position:1},goal:{marker:"в",markerAlternatives:["на","как"]}}},{id:"set-ru-simple",language:"ru",command:"set",priority:90,template:{format:"установить {patient}",tokens:[{type:"literal",value:"установить",alternatives:["установи","задать","задай"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"th":return[{id:"set-th-simple",language:"th",command:"set",priority:100,template:{format:"ตั้ง {patient} {goal}",tokens:[{type:"literal",value:"ตั้ง",alternatives:["กำหนด"]},{type:"role",role:"patient"},{type:"role",role:"goal"}]},extraction:{patient:{position:1},goal:{position:2}}}];case"uk":return[{id:"set-uk-full",language:"uk",command:"set",priority:100,template:{format:"встановити {patient} в {goal}",tokens:[{type:"literal",value:"встановити",alternatives:["встанови","задати","задай"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"в",alternatives:["на","як"]},{type:"role",role:"goal"}]}]},extraction:{patient:{position:1},goal:{marker:"в",markerAlternatives:["на","як"]}}},{id:"set-uk-simple",language:"uk",command:"set",priority:90,template:{format:"встановити {patient}",tokens:[{type:"literal",value:"встановити",alternatives:["встанови","задати","задай"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"vi":return[{id:"set-vi-full",language:"vi",command:"set",priority:100,template:{format:"gán {target} thành {value}",tokens:[{type:"literal",value:"gán",alternatives:["thiết lập","đặt giá trị"]},{type:"role",role:"patient"},{type:"literal",value:"thành",alternatives:["bằng","là"]},{type:"role",role:"goal"}]},extraction:{patient:{position:1},goal:{marker:"thành",markerAlternatives:["bằng","là"]}}},{id:"set-vi-simple",language:"vi",command:"set",priority:90,template:{format:"đặt {target} là {value}",tokens:[{type:"literal",value:"đặt"},{type:"role",role:"patient"},{type:"literal",value:"là"},{type:"role",role:"goal"}]},extraction:{patient:{position:1},goal:{marker:"là"}}}];case"zh":return[{id:"set-zh-full",language:"zh",command:"set",priority:100,template:{format:"设置 {destination} 为 {patient}",tokens:[{type:"literal",value:"设置",alternatives:["設置","设定","設定"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"为",alternatives:["為","到","成"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{marker:"为",markerAlternatives:["為","到","成"]}}},{id:"set-zh-ba",language:"zh",command:"set",priority:95,template:{format:"把 {destination} 设置为 {patient}",tokens:[{type:"literal",value:"把"},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"设置为",alternatives:["設置為","设定为","設定為"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{marker:"设置为",markerAlternatives:["設置為","设定为","設定為"]}}},{id:"set-zh-simple",language:"zh",command:"set",priority:90,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:0},patient:{position:2}}}];default:return[]}},function(e){switch(e){case"bn":return[{id:"get-bn-full",language:"bn",command:"get",priority:100,template:{format:"{source} থেকে পান",tokens:[{type:"role",role:"source"},{type:"literal",value:"থেকে"},{type:"literal",value:"পান",alternatives:["নিন"]}]},extraction:{source:{position:0}}},{id:"get-bn-simple",language:"bn",command:"get",priority:90,template:{format:"পান {source}",tokens:[{type:"literal",value:"পান",alternatives:["নিন"]},{type:"role",role:"source"}]},extraction:{source:{position:1}}}];case"de":return[{id:"get-de-full",language:"de",command:"get",priority:100,template:{format:"hole {source}",tokens:[{type:"literal",value:"hole",alternatives:["holen","get","bekomme","bekommen"]},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]}]},extraction:{source:{position:1}}}];case"hi":return[{id:"get-hi-full",language:"hi",command:"get",priority:100,template:{format:"{source} से प्राप्त करें",tokens:[{type:"role",role:"source"},{type:"literal",value:"से"},{type:"literal",value:"प्राप्त",alternatives:["पाएं"]},{type:"group",optional:1,tokens:[{type:"literal",value:"करें",alternatives:["करो"]}]}]},extraction:{source:{position:0}}},{id:"get-hi-simple",language:"hi",command:"get",priority:90,template:{format:"प्राप्त {source}",tokens:[{type:"literal",value:"प्राप्त",alternatives:["पाएं"]},{type:"role",role:"source"}]},extraction:{source:{position:1}}}];case"it":return[{id:"get-it-full",language:"it",command:"get",priority:100,template:{format:"ottenere {patient} da {source}",tokens:[{type:"literal",value:"ottenere",alternatives:["ottieni","get","prendere"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"da",alternatives:["di"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"da",markerAlternatives:["di"]}}},{id:"get-it-simple",language:"it",command:"get",priority:90,template:{format:"ottenere {patient}",tokens:[{type:"literal",value:"ottenere",alternatives:["ottieni","get"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"pl":return[{id:"get-pl-full",language:"pl",command:"get",priority:100,template:{format:"uzyskaj {patient} z {source}",tokens:[{type:"literal",value:"uzyskaj"},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"z",alternatives:["od","ze"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"z",markerAlternatives:["od","ze"]}}},{id:"get-pl-simple",language:"pl",command:"get",priority:90,template:{format:"uzyskaj {patient}",tokens:[{type:"literal",value:"uzyskaj"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"ru":return[{id:"get-ru-full",language:"ru",command:"get",priority:100,template:{format:"получить {patient} из {source}",tokens:[{type:"literal",value:"получить",alternatives:["получи","взять","возьми"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"из",alternatives:["от","с"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"из",markerAlternatives:["от","с"]}}},{id:"get-ru-simple",language:"ru",command:"get",priority:90,template:{format:"получить {patient}",tokens:[{type:"literal",value:"получить",alternatives:["получи","взять","возьми"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"th":return[{id:"get-th-simple",language:"th",command:"get",priority:100,template:{format:"รับค่า {source}",tokens:[{type:"literal",value:"รับค่า"},{type:"role",role:"source"}]},extraction:{source:{position:1}}}];case"uk":return[{id:"get-uk-full",language:"uk",command:"get",priority:100,template:{format:"отримати {patient} з {source}",tokens:[{type:"literal",value:"отримати",alternatives:["отримай","взяти","візьми"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"з",alternatives:["від","із"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"з",markerAlternatives:["від","із"]}}},{id:"get-uk-simple",language:"uk",command:"get",priority:90,template:{format:"отримати {patient}",tokens:[{type:"literal",value:"отримати",alternatives:["отримай","взяти","візьми"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"vi":return[{id:"get-vi-full",language:"vi",command:"get",priority:100,template:{format:"lấy giá trị của {target}",tokens:[{type:"literal",value:"lấy giá trị",alternatives:["nhận","lấy"]},{type:"group",optional:1,tokens:[{type:"literal",value:"của"}]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"get-vi-simple",language:"vi",command:"get",priority:90,template:{format:"lấy {target}",tokens:[{type:"literal",value:"lấy",alternatives:["nhận","lấy giá trị"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];default:return[]}},function(e){switch(e){case"bn":return[{id:"increment-bn-full",language:"bn",command:"increment",priority:100,template:{format:"{patient} কে বৃদ্ধি করুন",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"বৃদ্ধি",alternatives:["বাড়ান"]},{type:"literal",value:"করুন"}]},extraction:{patient:{position:0}}},{id:"increment-bn-with-quantity",language:"bn",command:"increment",priority:95,template:{format:"{patient} কে {quantity} দিয়ে বৃদ্ধি করুন",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"role",role:"quantity"},{type:"literal",value:"দিয়ে"},{type:"literal",value:"বৃদ্ধি",alternatives:["বাড়ান"]},{type:"literal",value:"করুন"}]},extraction:{patient:{position:0},quantity:{marker:"দিয়ে",position:2}}},{id:"increment-bn-simple",language:"bn",command:"increment",priority:90,template:{format:"বৃদ্ধি {patient}",tokens:[{type:"literal",value:"বৃদ্ধি",alternatives:["বাড়ান"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"de":return[{id:"increment-de-full",language:"de",command:"increment",priority:100,template:{format:"erhöhe {patient}",tokens:[{type:"literal",value:"erhöhe",alternatives:["erhoehe","erhöhen","inkrementiere","inkrementieren","increment"]},{type:"role",role:"patient",expectedTypes:["selector","reference","expression"]}]},extraction:{patient:{position:1}}}];case"hi":return[{id:"increment-hi-full",language:"hi",command:"increment",priority:100,template:{format:"{patient} को बढ़ाएं",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"literal",value:"बढ़ाएं",alternatives:["बढ़ा"]}]},extraction:{patient:{position:0}}},{id:"increment-hi-with-quantity",language:"hi",command:"increment",priority:95,template:{format:"{patient} को {quantity} से बढ़ाएं",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"role",role:"quantity"},{type:"literal",value:"से"},{type:"literal",value:"बढ़ाएं",alternatives:["बढ़ा"]}]},extraction:{patient:{position:0},quantity:{marker:"से",position:2}}},{id:"increment-hi-simple",language:"hi",command:"increment",priority:90,template:{format:"बढ़ाएं {patient}",tokens:[{type:"literal",value:"बढ़ाएं",alternatives:["बढ़ा"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"it":return[{id:"increment-it-full",language:"it",command:"increment",priority:100,template:{format:"incrementare {patient} di {quantity}",tokens:[{type:"literal",value:"incrementare",alternatives:["incrementa","aumentare","increment"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"di",alternatives:["per"]},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"di",markerAlternatives:["per"],default:{type:"literal",value:"1"}}}},{id:"increment-it-simple",language:"it",command:"increment",priority:90,template:{format:"incrementare {patient}",tokens:[{type:"literal",value:"incrementare",alternatives:["incrementa","aumentare","increment"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:"1"}}}}];case"pl":return[{id:"increment-pl-full",language:"pl",command:"increment",priority:100,template:{format:"zwiększ {patient} o {quantity}",tokens:[{type:"literal",value:"zwiększ",alternatives:["zwieksz","podnieś","podnies"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"o"},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"o",default:{type:"literal",value:1}}}},{id:"increment-pl-simple",language:"pl",command:"increment",priority:90,template:{format:"zwiększ {patient}",tokens:[{type:"literal",value:"zwiększ",alternatives:["zwieksz","podnieś","podnies"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}];case"ru":return[{id:"increment-ru-full",language:"ru",command:"increment",priority:100,template:{format:"увеличить {patient} на {quantity}",tokens:[{type:"literal",value:"увеличить",alternatives:["увеличь"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"на"},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"на",default:{type:"literal",value:1}}}},{id:"increment-ru-simple",language:"ru",command:"increment",priority:90,template:{format:"увеличить {patient}",tokens:[{type:"literal",value:"увеличить",alternatives:["увеличь"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}];case"th":return[{id:"increment-th-simple",language:"th",command:"increment",priority:100,template:{format:"เพิ่มค่า {patient}",tokens:[{type:"literal",value:"เพิ่มค่า"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"increment-th-with-quantity",language:"th",command:"increment",priority:95,template:{format:"เพิ่มค่า {patient} ด้วย {quantity}",tokens:[{type:"literal",value:"เพิ่มค่า"},{type:"role",role:"patient"},{type:"literal",value:"ด้วย"},{type:"role",role:"quantity"}]},extraction:{patient:{position:1},quantity:{marker:"ด้วย",position:3}}}];case"uk":return[{id:"increment-uk-full",language:"uk",command:"increment",priority:100,template:{format:"збільшити {patient} на {quantity}",tokens:[{type:"literal",value:"збільшити",alternatives:["збільш"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"на"},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"на",default:{type:"literal",value:1}}}},{id:"increment-uk-simple",language:"uk",command:"increment",priority:90,template:{format:"збільшити {patient}",tokens:[{type:"literal",value:"збільшити",alternatives:["збільш"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}];case"vi":return[{id:"increment-vi-full",language:"vi",command:"increment",priority:100,template:{format:"tăng {target} thêm {amount}",tokens:[{type:"literal",value:"tăng",alternatives:["tăng lên"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"thêm",alternatives:["lên"]},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"thêm",markerAlternatives:["lên"],default:{type:"literal",value:"1"}}}},{id:"increment-vi-simple",language:"vi",command:"increment",priority:90,template:{format:"tăng {target}",tokens:[{type:"literal",value:"tăng",alternatives:["tăng lên"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:"1"}}}}];case"zh":return[{id:"increment-zh-full",language:"zh",command:"increment",priority:100,template:{format:"增加 {patient}",tokens:[{type:"literal",value:"增加",alternatives:["递增","加","增","increment"]},{type:"role",role:"patient",expectedTypes:["selector","reference","expression"]}]},extraction:{patient:{position:1}}}];default:return[]}},function(e){switch(e){case"bn":return[{id:"decrement-bn-full",language:"bn",command:"decrement",priority:100,template:{format:"{patient} কে হ্রাস করুন",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"literal",value:"হ্রাস",alternatives:["কমান"]},{type:"literal",value:"করুন"}]},extraction:{patient:{position:0}}},{id:"decrement-bn-with-quantity",language:"bn",command:"decrement",priority:95,template:{format:"{patient} কে {quantity} দিয়ে হ্রাস করুন",tokens:[{type:"role",role:"patient"},{type:"literal",value:"কে"},{type:"role",role:"quantity"},{type:"literal",value:"দিয়ে"},{type:"literal",value:"হ্রাস",alternatives:["কমান"]},{type:"literal",value:"করুন"}]},extraction:{patient:{position:0},quantity:{marker:"দিয়ে",position:2}}},{id:"decrement-bn-simple",language:"bn",command:"decrement",priority:90,template:{format:"হ্রাস {patient}",tokens:[{type:"literal",value:"হ্রাস",alternatives:["কমান"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"de":return[{id:"decrement-de-full",language:"de",command:"decrement",priority:100,template:{format:"verringere {patient}",tokens:[{type:"literal",value:"verringere",alternatives:["verringern","dekrementiere","dekrementieren","reduziere","decrement"]},{type:"role",role:"patient",expectedTypes:["selector","reference","expression"]}]},extraction:{patient:{position:1}}}];case"hi":return[{id:"decrement-hi-full",language:"hi",command:"decrement",priority:100,template:{format:"{patient} को घटाएं",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"literal",value:"घटाएं",alternatives:["घटा"]}]},extraction:{patient:{position:0}}},{id:"decrement-hi-with-quantity",language:"hi",command:"decrement",priority:95,template:{format:"{patient} को {quantity} से घटाएं",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"role",role:"quantity"},{type:"literal",value:"से"},{type:"literal",value:"घटाएं",alternatives:["घटा"]}]},extraction:{patient:{position:0},quantity:{marker:"से",position:2}}},{id:"decrement-hi-simple",language:"hi",command:"decrement",priority:90,template:{format:"घटाएं {patient}",tokens:[{type:"literal",value:"घटाएं",alternatives:["घटा"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}];case"it":return[{id:"decrement-it-full",language:"it",command:"decrement",priority:100,template:{format:"decrementare {patient} di {quantity}",tokens:[{type:"literal",value:"decrementare",alternatives:["decrementa","diminuire","decrement"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"di",alternatives:["per"]},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"di",markerAlternatives:["per"],default:{type:"literal",value:"1"}}}},{id:"decrement-it-simple",language:"it",command:"decrement",priority:90,template:{format:"decrementare {patient}",tokens:[{type:"literal",value:"decrementare",alternatives:["decrementa","diminuire","decrement"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:"1"}}}}];case"pl":return[{id:"decrement-pl-full",language:"pl",command:"decrement",priority:100,template:{format:"zmniejsz {patient} o {quantity}",tokens:[{type:"literal",value:"zmniejsz",alternatives:["obniż","obniz"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"o"},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"o",default:{type:"literal",value:1}}}},{id:"decrement-pl-simple",language:"pl",command:"decrement",priority:90,template:{format:"zmniejsz {patient}",tokens:[{type:"literal",value:"zmniejsz",alternatives:["obniż","obniz"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}];case"ru":return[{id:"decrement-ru-full",language:"ru",command:"decrement",priority:100,template:{format:"уменьшить {patient} на {quantity}",tokens:[{type:"literal",value:"уменьшить",alternatives:["уменьши"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"на"},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"на",default:{type:"literal",value:1}}}},{id:"decrement-ru-simple",language:"ru",command:"decrement",priority:90,template:{format:"уменьшить {patient}",tokens:[{type:"literal",value:"уменьшить",alternatives:["уменьши"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}];case"th":return[{id:"decrement-th-simple",language:"th",command:"decrement",priority:100,template:{format:"ลดค่า {patient}",tokens:[{type:"literal",value:"ลดค่า"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"decrement-th-with-quantity",language:"th",command:"decrement",priority:95,template:{format:"ลดค่า {patient} ด้วย {quantity}",tokens:[{type:"literal",value:"ลดค่า"},{type:"role",role:"patient"},{type:"literal",value:"ด้วย"},{type:"role",role:"quantity"}]},extraction:{patient:{position:1},quantity:{marker:"ด้วย",position:3}}}];case"uk":return[{id:"decrement-uk-full",language:"uk",command:"decrement",priority:100,template:{format:"зменшити {patient} на {quantity}",tokens:[{type:"literal",value:"зменшити",alternatives:["зменш"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"на"},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"на",default:{type:"literal",value:1}}}},{id:"decrement-uk-simple",language:"uk",command:"decrement",priority:90,template:{format:"зменшити {patient}",tokens:[{type:"literal",value:"зменшити",alternatives:["зменш"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}];case"vi":return[{id:"decrement-vi-full",language:"vi",command:"decrement",priority:100,template:{format:"giảm {target} đi {amount}",tokens:[{type:"literal",value:"giảm",alternatives:["giảm đi"]},{type:"role",role:"patient"},{type:"group",optional:1,tokens:[{type:"literal",value:"đi",alternatives:["xuống"]},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"đi",markerAlternatives:["xuống"],default:{type:"literal",value:"1"}}}},{id:"decrement-vi-simple",language:"vi",command:"decrement",priority:90,template:{format:"giảm {target}",tokens:[{type:"literal",value:"giảm",alternatives:["giảm đi"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:"1"}}}}];case"zh":return[{id:"decrement-zh-full",language:"zh",command:"decrement",priority:100,template:{format:"减少 {patient}",tokens:[{type:"literal",value:"减少",alternatives:["递减","减","降低","decrement"]},{type:"role",role:"patient",expectedTypes:["selector","reference","expression"]}]},extraction:{patient:{position:1}}}];default:return[]}},function(e){return"en"===e?[{id:"append-en-full",language:"en",command:"append",priority:100,template:{format:"append {patient} to {destination}",tokens:[{type:"literal",value:"append"},{type:"role",role:"patient",expectedTypes:["literal","selector","expression"]},{type:"literal",value:"to"},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{marker:"to"}}}]:[]},function(e){return"en"===e?[{id:"prepend-en-full",language:"en",command:"prepend",priority:100,template:{format:"prepend {patient} to {destination}",tokens:[{type:"literal",value:"prepend"},{type:"role",role:"patient",expectedTypes:["literal","selector","expression"]},{type:"literal",value:"to"},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{marker:"to"}}}]:[]},function(e){return"en"===e?[{id:"trigger-en-full",language:"en",command:"trigger",priority:100,template:{format:"trigger {event} on {destination}",tokens:[{type:"literal",value:"trigger"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"group",optional:1,tokens:[{type:"literal",value:"on"},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]}]},extraction:{event:{position:1},destination:{marker:"on",default:{type:"reference",value:"me"}}}},{id:"trigger-en-simple",language:"en",command:"trigger",priority:90,template:{format:"trigger {event}",tokens:[{type:"literal",value:"trigger"},{type:"role",role:"event",expectedTypes:["literal","expression"]}]},extraction:{event:{position:1},destination:{default:{type:"reference",value:"me"}}}}]:[]},function(e){return[]}],xx=new Map;function Ex(e){const t=zx.flatMap(t=>t(e));return"en"===e&&t.push(...kx),t.push(...function(e){const t=xx.get(e);if(t)return t;const n=Tp(e);if(!n)return[];const r=ek(n);return xx.set(e,r),r}(e)),t}var Sx=["en","ja","ar","es","ko","zh","tr","pt","fr","de","id","qu","sw","it","vi","pl","ru","uk","hi","bn","th","ms","tl","he"],Tx=new Map,jx=null;function Ax(){if(null===jx){const e=[];for(const t of Sx)e.push(...Ex(t));jx=e}return jx}function Lx(e){if(Tx.has(e))return Tx.get(e);const t=Ex(e);return Tx.set(e,t),t}ok(),bk(),sw(),sw(),Cp(),pp=function(e){return Ex(e.code)},uy(),dy(),sd(),Cp(),Rp(),Mp(),nd(),Fp(),Jp(),Dp(),Xp(),tm(),im(),sm(),um(),dm(),hm(),bm(),zm(),Sm(),Am(),Gp(),Cm(),Rm(),Mm(),Dm(),Fm(),Gm(),Vw(),ik(),qw(),Vw();var Ox=new Map(Object.entries(Mw));function Cx(e){return Ox.get(e)}function Nx(e){return"literal"===e.type&&"string"==typeof e.value||"selector"===e.type||"reference"===e.type?e.value:void 0}function Px(e,t){if(null==e)return 0;for(const n of t)switch(n){case"selector":if("selector"===e.type)return 1;const t=Nx(e);if(t&&(t.startsWith(".")||t.startsWith("#")||t.startsWith("[")))return 1;break;case"literal":if("literal"===e.type)return 1;if("property-path"===e.type)return 1;break;case"reference":if("reference"===e.type)return 1;if("property-path"===e.type)return 1;const n=Nx(e);if(n&&["me","you","it","my","its","result","event","target"].includes(n.toLowerCase()))return 1;break;case"expression":if("expression"===e.type)return 1;if("property-path"===e.type)return 1}return 0}function Rx(e){const t=[],n=[],r=[];let i=0;const a=Cx(e.action);if(!a)return n.push({code:"UNKNOWN_ROLE",message:`No schema found for action '${e.action}'. Skipping validation.`,severity:"warning"}),{valid:1,errors:t,warnings:n,confidenceAdjustment:-.1,suggestions:r};const o=new Map;for(const t of e.arguments)t.role&&o.set(t.role,t);for(const e of a.roles){const a=o.get(e.role);!e.required||a?a&&!Px(a,e.expectedTypes)&&(n.push({code:"INVALID_TYPE",message:`Role '${e.role}' expected ${e.expectedTypes.join(" or ")}, got ${a.type}.`,role:e.role,expected:e.expectedTypes,actual:a,severity:"warning"}),i-=.1):e.default?n.push({code:"MISSING_REQUIRED_ROLE",message:`Role '${e.role}' not provided, using default.`,role:e.role,severity:"warning"}):(t.push({code:"MISSING_REQUIRED_ROLE",message:`Required role '${e.role}' (${e.description}) is missing.`,role:e.role,expected:e.expectedTypes,severity:"error"}),r.push(`Add ${e.description.toLowerCase()} to the command.`),i-=.2)}for(const t of e.arguments)t.role&&(a.roles.some(e=>e.role===t.role)||(n.push({code:"UNKNOWN_ROLE",message:`Role '${t.role}' is not recognized for command '${e.action}'.`,role:t.role,severity:"warning"}),i-=.05));return a.roles.filter(e=>e.required&&!e.default).every(e=>o.has(e.role))&&0===t.length&&(i+=.1),{valid:0===t.length,errors:t,warnings:n,confidenceAdjustment:Math.max(-1,Math.min(1,i)),suggestions:r}}function $x(e){switch(e){case"preposition":return"preposition";case"postposition":case"particle":case"case-suffix":return"postposition";default:return"none"}}function Ix(e,t,n){const r={form:t.primary,role:e,position:$x(n),required:t.required??0};return t.alternatives&&(r.alternatives=t.alternatives),r}var Mx={accessibility:1,performance:1,schema:1,strict:0},qx=new Set(["scroll","mousemove","touchmove","resize","input","keydown","keyup","keypress"]),_x=new Set(["scroll","mousemove","touchmove","resize"]);function Dx(e,t){const n=[];if("event-handler"===e.kind){const r=e.roles.get("event");if(r&&"literal"===r.type){const e=(r.value+"").toLowerCase();"mouseenter"!==e&&"mouseover"!==e&&"hover"!==e||n.push({code:"HOVER_ONLY_INTERACTION",severity:"warning",message:`Hover-only interaction detected (${e}). Not accessible to keyboard or touch users.`,suggestion:"Add keyboard equivalent (focus) or use a click-based interaction.",location:{input:t,role:"event"}})}}return n}function Vx(e,t){const n=[];if("event-handler"===e.kind){const r=e.roles.get("event");if(r&&"literal"===r.type){const e=(r.value+"").toLowerCase();if(qx.has(e)){const r=_x.has(e)?"warning":"info";n.push({code:"HIGH_FREQUENCY_TRIGGER",severity:r,message:`High-frequency event '${e}' may cause performance issues.`,suggestion:_x.has(e)?`Consider using 'on ${e} throttled:100ms' to limit execution frequency.`:"Consider debouncing or throttling this handler.",location:{input:t,role:"event"}})}}}return n}function Hx(e,t){const n=[];if("command"!==e.kind)return n;const r=Cx(e.action);if(!r)return n;const i=Array.isArray(r.roles)?r.roles:[],a=new Set;for(const r of i)r&&"object"==typeof r&&"role"in r&&(a.add(r.role),r.required&&!e.roles.has(r.role)&&n.push({code:"MISSING_REQUIRED_ROLE",severity:"error",message:`Command '${e.action}' requires '${r.role}' but it was not provided.`,suggestion:r.description,location:{input:t}}));return e.roles.forEach((r,i)=>{a.has(i)||n.push({code:"INVALID_ROLE_FOR_COMMAND",severity:"warning",message:`Role '${i}' is not typically used with '${e.action}' command.`,location:{input:t,role:i}})}),n}function Fx(e){return"event-handler"===e.kind?e.body??[]:[]}function Bx(e,t={}){const n=[],r=new Map;for(const t of e)if("event-handler"===t.kind){const e=t.roles.get("event"),n=t.roles.get("source"),i=`${"literal"===e?.type?e.value:"unknown"}:${"selector"===n?.type?n.value:"self"}`;r.has(i)||r.set(i,[]);const a=Fx(t);r.get(i).push({handler:t,commands:a})}return r.forEach((e,t)=>{if(e.length>1){const r=[],i=[];for(const{commands:t}of e)for(const e of t){r.push(e.action);const t=e.roles.get("patient");i.push("selector"===t?.type?t.value:"unknown")}const a=r.includes("toggle"),o=r.includes("show"),s=r.includes("hide");a&&(o||s)&&i.filter((e,t)=>("toggle"===r[t]||"show"===r[t]||"hide"===r[t])&&i.some((n,r)=>t!==r&&e===n)).length>0&&n.push({code:"CONFLICTING_ACTIONS",severity:"warning",message:`Conflicting actions on '${t}': ${[...new Set(r)].join(", ")} may interfere with each other.`,suggestion:"Consider using a single toggle or conditional logic."}),r.some(e=>["fetch","wait","send"].includes(e))&&e.length>1&&n.push({code:"POTENTIAL_RACE_CONDITION",severity:"info",message:`Multiple handlers on '${t}' include async operations. Consider sequencing.`,suggestion:'Use "then" to chain operations or add loading states.'})}}),n}function Ux(e,t="en",n={}){const r={...Mx,...n},i=[];let a=null;try{a=lx(e,t)}catch{}if(!a)return{valid:0,warnings:[{code:"UNREACHABLE_BEHAVIOR",severity:"error",message:"Could not parse input to semantic representation.",location:{input:e}}],node:null};r.accessibility&&i.push(...Dx(a,e)),r.performance&&i.push(...Vx(a,e)),r.schema&&i.push(...Hx(a,e));const o=i.some(e=>"error"===e.severity),s=i.some(e=>"warning"===e.severity);return{valid:r.strict?!o&&!s:!o,warnings:i,node:a}}var Gx=0,Wx={};function Kx(e){const t={};return"number"==typeof e.start&&(t.start=e.start),"number"==typeof e.end&&(t.end=e.end),"number"==typeof e.line&&(t.line=e.line),"number"==typeof e.column&&(t.column=e.column),t}function Jx(e){if(!e)return{type:"literal",value:null};switch(e.type){case"eventHandler":return function(e){const t=e.event??"click",n=(e.commands??e.body??[]).map(e=>Jx(e)),r=function(e){const t=e.eventModifiers;return{...e.once||t?.once?{once:1}:{},...e.debounce||t?.debounce?{debounce:e.debounce??t?.debounce}:{},...e.throttle||t?.throttle?{throttle:e.throttle??t?.throttle}:{},...e.prevent||t?.prevent?{prevent:1}:{},...e.stop||t?.stop?{stop:1}:{},...e.capture||t?.capture?{capture:1}:{},...e.passive||t?.passive?{passive:1}:{},...e.from||t?.from?{from:e.from??t?.from}:e.selector?{from:e.selector}:{}}}(e);return{type:"event",event:t,modifiers:r,body:n,...Kx(e)}}(e);case"command":return function(e){const t=e.name;if("if"===t||"unless"===t)return function(e){const t=e.args??[];let n=t[0]?Jx(t[0]):{type:"literal",value:1};const r=Zx(t[1]),i=t[2]?Zx(t[2]):void 0;return"unless"===e.name&&(n={type:"unary",operator:"not",operand:n}),{type:"if",condition:n,thenBranch:r,...i?{elseBranch:i}:{},...Kx(e)}}(e);if("repeat"===t)return function(e){const t=e.args??[];if(0===t.length)return{type:"repeat",body:[],...Kx(e)};const n=t[0],r=t[t.length-1];switch(n?.name??n?.value??"forever"){case"times":return{type:"repeat",count:t[1]?Jx(t[1]):void 0,body:Zx(r),...Kx(e)};case"for":return{type:"foreach",itemName:t[1]?.value??"item",collection:t[2]?Jx(t[2]):{type:"identifier",value:"[]"},body:Zx(r),...Kx(e)};case"while":return{type:"while",condition:t[1]?Jx(t[1]):{type:"literal",value:1},body:Zx(r),...Kx(e)};case"until":return{type:"while",condition:{type:"unary",operator:"not",operand:t[1]?Jx(t[1]):{type:"literal",value:0}},body:Zx(r),...Kx(e)};default:return{type:"repeat",body:Zx(r),...Kx(e)}}}(e);const n=(e.args??[]).map(e=>Jx(e)),r=e.target?Jx(e.target):void 0,i=e.modifiers?function(e){const t={};for(const[n,r]of Object.entries(e))t[n]=Jx(r);return t}(e.modifiers):void 0,a=e.semanticRoles,o=a?function(e){const t={};for(const[n,r]of Object.entries(e))t[n]=Jx(r);return t}(a):void 0;return{type:"command",name:t,args:n,...r?{target:r}:{},...i&&Object.keys(i).length>0?{modifiers:i}:{},...o&&Object.keys(o).length>0?{roles:o}:{},...Kx(e)}}(e);case"CommandSequence":return function(e){const t=e.commands??[];return 1===t.length?Jx(t[0]):{type:"event",event:"click",body:t.map(e=>Jx(e)),...Kx(e)}}(e);case"block":return function(e){const t=e.commands??[];return 1===t.length?Jx(t[0]):{type:"event",event:"click",body:t.map(e=>Jx(e)),...Kx(e)}}(e);case"if":return function(e){const t=e.condition?Jx(e.condition):{type:"literal",value:1},n=(e.thenBranch??[]).map(e=>Jx(e)),r=e.elseBranch?e.elseBranch.map(e=>Jx(e)):void 0;return{type:"if",condition:t,thenBranch:n,...r?{elseBranch:r}:{},...Kx(e)}}(e);case"literal":case"string":case"timeExpression":return{type:"literal",value:e.value,...Kx(e)};case"selector":case"htmlSelector":return{type:"selector",value:e.value??e.selector??"",...Kx(e)};case"contextReference":return{type:"identifier",value:e.name??e.contextType??"",...Kx(e)};case"identifier":return{type:"identifier",value:e.name??e.value??"",name:e.name??"",...Kx(e)};case"propertyAccess":return function(e){return{type:"possessive",object:e.object?Jx(e.object):{type:"identifier",value:"me"},property:e.property??"",...Kx(e)}}(e);case"possessiveExpression":return function(e){return{type:"possessive",object:e.object?Jx(e.object):{type:"identifier",value:"me"},property:"string"==typeof e.property?e.property:e.property?.name??e.property?.value??"",...Kx(e)}}(e);case"memberExpression":return function(e){return{type:"member",object:e.object?Jx(e.object):{type:"identifier",value:"me"},property:"string"==typeof e.property?e.property:e.property?Jx(e.property):{type:"literal",value:""},computed:e.computed??0,...Kx(e)}}(e);case"binaryExpression":return function(e){return{type:"binary",operator:e.operator??"",left:Jx(e.left),right:Jx(e.right),...Kx(e)}}(e);case"callExpression":return function(e){return{type:"call",callee:"string"==typeof e.callee?{type:"identifier",value:e.callee,name:e.callee}:Jx(e.callee),args:(e.arguments??e.args??[]).map(e=>Jx(e)),...Kx(e)}}(e);case"unaryExpression":return{type:"unary",operator:e.operator,operand:Jx(e.operand),...Kx(e)};case"templateLiteral":return{type:"literal",value:e.raw??"",...Kx(e)};case"variable":return{type:"variable",name:e.name??"",scope:e.scope??"local",...Kx(e)};case"positional":return{type:"positional",position:e.position,...e.target?{target:Jx(e.target)}:{},...Kx(e)};case"positionalExpression":return{type:"positional",position:e.operator,...e.argument?{target:Jx(e.argument)}:{},...Kx(e)};default:return{type:"literal",value:e.value??null,...Kx(e)}}}function Zx(e){return e?"block"===e.type?(e.commands??[]).map(e=>Jx(e)):[Jx(e)]:[]}function Yx(e,t){return ux(e,t)}var Xx=Object.freeze({__proto__:null,ASTBuilder:Cz,get CssSelectorExtractor(){return Ym},DEFAULT_CONFIDENCE_THRESHOLD:xk,get EventModifierExtractor(){return Xm},HIGH_CONFIDENCE_THRESHOLD:.8,IdentifierExtractor:Nc,KNOWN_PROFILES:Nz,LAZY_LOAD_LANGUAGES:bx,NumberExtractor:Cc,get OperatorExtractor(){return Jm},PatternMatcher:Gz,get PunctuationExtractor(){return Zm},SUPPORTED_LANGUAGES:bx,get SchemaErrorCodes(){return iw},SemanticCache:hx,SemanticParserImpl:ox,SemanticRendererImpl:Zz,StringLiteralExtractor:Oc,TokenStreamImpl:Ru,get UrlExtractor(){return Qm},VERSION:"0.1.0",get VariableRefExtractor(){return ed},get addSchema(){return zw},analyze:Ux,analyzeAll:function(e,t="en",n={}){const r=[],i=[];for(const a of e){const e=Ux(a,t,n);r.push(...e.warnings),e.node&&i.push(e.node)}r.push(...Bx(i,n));const a=r.some(e=>"error"===e.severity),o={...Mx,...n},s=r.some(e=>"warning"===e.severity);return{valid:o.strict?!a&&!s:!a,warnings:r,node:i[0]??null}},analyzeMultiple:Bx,get appendSchema(){return Rw},get arabicProfile(){return Op},get arabicTokenizer(){return nh},get bengaliProfile(){return Pp},buildAST:function(e){const t=new Cz;return{ast:t.build(e),warnings:t.warnings}},calculateTranslationConfidence:cx,canLoadLanguage:function(e){return e in gx},canParse:function(e,t){return sx.canParse(e,t)},checkAccessibility:Dx,checkPerformance:Vx,checkSchema:Hx,get chineseProfile(){return Um},get chineseTokenizer(){return Vh},get commandSchemas(){return Mw},convertExpression:Rk,convertLiteral:Ok,convertPropertyPath:Pk,convertReference:Nk,convertSelector:Ck,convertValue:Lk,createCommandNode:qz,createCompoundNode:Dz,createConditionalNode:function(e,t,n,r){const i=new Map;i.set("condition",e);const a={kind:"conditional",action:"if",roles:i,thenBranch:t};return void 0!==n&&(a.elseBranch=n),void 0!==r&&(a.metadata=r),a},createEventHandler:_z,createLiteral:Rz,createLoopNode:function(e,t,n,r,i){const a={kind:"loop",action:e,loopVariant:t,roles:new Map(Object.entries(n)),body:r};return i?.loopVariable&&(a.loopVariable=i.loopVariable),i?.indexVariable&&(a.indexVariable=i.indexVariable),i?.metadata&&(a.metadata=i.metadata),a},createPropertyPath:Mz,createReference:Iz,createSelector:Pz,createSemanticCache:function(e){return new hx(e)},createTokenizerContext:$c,get decrementSchema(){return Pw},devModeAnalyze:function(e,t,n){if(!Gx)return;if(!n)return void console.warn("[hyperfixi] Parse failed: "+e);const r=Ux(e,t,Wx);for(const e of r.warnings)console["error"===e.severity?"error":"warning"===e.severity?"warn":"info"](`${"error"===e.severity?"❌":"warning"===e.severity?"⚠️":"ℹ️"} [hyperfixi:${e.code}] ${e.message}`,e.suggestion?"\n 💡 "+e.suggestion:"",e.location?.input?"\n 📍 "+e.location.input:"")},disableDevMode:function(){Gx=0},enableDevMode:function(e={}){Gx=1,Wx=e},get englishProfile(){return _p},get englishTokenizer(){return vy},get eventNameTranslations(){return tw},get fetchSchema(){return Cw},formatValidationResults:hw,get frenchProfile(){return Up},fromExplicit:mx,fromSemanticAST:Jx,generateAllPatterns:function(e,t=Kw){const n=[],r=e??Zw();for(const e of r){const r=ek(e,t);n.push(...r)}return n},generatePattern:Yw,generatePatternVariants:Qw,generatePatternsForCommand:function(e,t,n=Kw){const r=[],i=t??Zw();for(const t of i){if(!t.keywords[e.action])continue;const i=Qw(e,t,n);r.push(...i)}return r},generatePatternsForLanguage:ek,generateSimplePattern:Xw,get germanProfile(){return Ip},getAllTranslations:function(e,t,n=["en","ja","ar","es","ko","zh","tr","pt","fr","de","id","qu","sw"]){const r={},i=fx(e,t);for(const e of n)r[e]=Xz(i,e);return r.explicit=Qz(i),r},getCommandMapper:Oz,getCommandType:function(e,t){try{return sx.parse(e,t).action}catch{return null}},getDefaultExtractors:function(){return[new Oc,new Cc,new Jm,new Zm,new Nc]},getDefinedSchemas:Dw,getDevModeConfig:function(){return{...Wx}},getEventHandlerPatternsForLanguage:rw,getGeneratorSummary:function(){const e=jp(),t=Dw().map(e=>e.action);let n=0;for(const t of e){const e=Tp(t);if(e)for(const t of Dw())e.keywords[t.action]&&(n+=2)}return{languages:e,commands:t,totalPatterns:n}},getHyperscriptExtractors:py,getLoadedLanguages:function(){return bx.filter(Ap)},getPatternById:function(e){return Ax().find(t=>t.id===e)},getPatternStats:function(){const e={},t={},n=Ax();for(const r of n)e[r.language]=(e[r.language]||0)+1,t[r.command]=(t[r.command]||0)+1;return{totalPatterns:n.length,byLanguage:e,byCommand:t}},getPatternsForLanguage:Lx,getPatternsForLanguageAndCommand:function(e,t){return Lx(e).filter(e=>e.command===t).sort((e,t)=>t.priority-e.priority)},getPutPatternsForLanguage:sk,getRegisteredLanguages:jp,getRegisteredMappers:function(){return new Map(Lz)},getSchema:_w,getSchemasByCategory:function(e){return Object.values(Mw).filter(t=>t.category===e)},getSupportedCommands:function(){const e=new Set(Ax().map(e=>e.command));return Array.from(e)},getSupportedLanguages:function(){return[...bx]},getSupportedPatternLanguages:function(){const e=new Set(Ax().map(e=>e.language));return Array.from(e)},getSupportedTokenizerLanguages:Jz,getTogglePatternsForLanguage:ak,getTokenizer:function(e){return function(e){let t=lp.get(e);return!t&&Sp(e)&&(t=lp.get(Ep(e))),t}(e)},getUnloadedLanguages:function(){return bx.filter(e=>!Ap(e))},getValidationStats:vw,getValidatorSchema:Cx,get hebrewProfile(){return Kp},get hideSchema(){return jw},get hindiProfile(){return Yp},get incrementSchema(){return Nw},get indonesianProfile(){return em},isContextAwareExtractor:Rc,isDevModeEnabled:function(){return Gx},isExplicitSyntax:Wl,isLanguageRegistered:Ap,isLanguageSupported:function(e){return Ap(e)},isUnifiedProfile:function(e){return e&&"object"==typeof e?"string"==typeof e.code&&"string"==typeof e.name&&"string"==typeof e.wordOrder&&"string"==typeof e.markingStrategy&&"string"==typeof e.morphology&&"object"==typeof e.keywords&&Array.isArray(e.canonicalOrder):0},get italianProfile(){return rm},get japaneseProfile(){return om},get japaneseTokenizer(){return Cy},get koreanProfile(){return cm},get koreanTokenizer(){return Hy},loadLanguage:wx,loadLanguages:async function(e,t={}){return Promise.all(e.map(e=>wx(e,t)))},get malayProfile(){return mm},markingStrategyToAdpositionType:$x,matchBest:function(e,t){return Wz.matchBest(e,t)},matchPattern:function(e,t){return Wz.matchPattern(e,t)},normalizeEventName:function(e,t){const n=tw[t];return n&&n[e]?n[e]:e.toLowerCase()},get onSchema(){return Aw},parse:lx,parseAny:fx,parseExplicit:tx,parseSemantic:Yx,parseWithConfidence:ux,patternMatcher:Wz,get polishProfile(){return ym},get portugueseProfile(){return gm},get prependSchema(){return $w},get putSchema(){return Ew},get quechuaProfile(){return km},registerCommandMapper:function(e){Lz.set(e.action,e)},registerSchema:function(e,t){Ox.set(e,t)},registerTokenizer:function(e){!function(e){lp.set(e.language,e)}(e)},get removeSchema(){return xw},render:Xz,renderExplicit:Qz,roundTrip:function(e,t,n){const r=fx(e,t),i=n??t,a=Wl(e)?Qz(r):Xz(r,i);if(void 0!==n)return a;const o=e.trim().toLowerCase(),s=a.trim().toLowerCase();return{original:e,semantic:r,rendered:a,matches:o===s}},get russianProfile(){return Em},schemaRegistry:Ox,semanticCache:vx,semanticParser:sx,semanticRenderer:Yz,get setSchema(){return Sw},get showSchema(){return Tw},get spanishProfile(){return Hp},get spanishTokenizer(){return bh},get swahiliProfile(){return jm},get tagalogProfile(){return Pm},get thaiProfile(){return Om},toExplicit:px,toGrammaticalMarker:Ix,toI18nProfile:function(e){const t=[];for(const[n,r]of Object.entries(e.roleMarkers))r&&t.push(Ix(n,r,e.markingStrategy));return{code:e.code,name:e.nativeName,wordOrder:e.wordOrder,adpositionType:$x(e.markingStrategy),morphology:e.morphology,direction:e.direction,markers:t,canonicalOrder:e.canonicalOrder}},get toggleSchema(){return kw},tokenize:Kz,translate:dx,get triggerSchema(){return Lw},tryGetProfile:Tp,get turkishProfile(){return Im},get turkishTokenizer(){return $h},get ukrainianProfile(){return _m},validateAllSchemas:yw,validateAndAdjustConfidence:function(e){const t=Rx(e);return{...e,confidence:Math.max(0,Math.min(1,e.confidence+t.confidenceAdjustment)),validation:t}},validateCommandSchema:fw,validateLanguageKeywords:function(e,t=Dw()){const n=[],r=[];for(const i of t)e.keywords[i.action]?r.push(i.action):n.push(i.action);return{missing:n,available:r}},validateSemanticResult:Rx,validateTranslation:function(e,t,n,r){try{const i=fx(e,n),a=fx(t,r);if(i.action!==a.action)return 0;for(const[e,t]of i.roles){const n=a.roles.get(e);if(!n)return 0;if(!yx(t,n))return 0}return 1}catch{return 0}},get vietnameseProfile(){return Hm},get waitSchema(){return Ow},withCache:function(e,t=vx){return(n,r)=>{const i=t.get(n,r);if(i)return i;const a=e(n,r);return t.set(n,r,a),a}}});let Qx=null;function eE(e){if(e&&"object"==typeof e.locals&&e.locals instanceof Map)return e;const t=e?.globals,n=t instanceof Map?t:Ln(),r={me:e?.me||null,you:e?.you||null,it:e?.it||e?.result,result:e?.result,locals:new Map,globals:n,halted:0,returned:0,broke:0,continued:0,async:0};if(!e)return r;if(e.locals&&"object"==typeof e.locals)for(const[t,n]of Object.entries(e.locals))r.locals.set(t,n);if(e.globals&&"object"==typeof e.globals&&!(e.globals instanceof Map))for(const[t,n]of Object.entries(e.globals))oe(r,t,n);const i=new Set(["me","you","it","result","locals","globals","language"]);for(const[t,n]of Object.entries(e))i.has(t)||void 0===n||r.locals.set(t,n);return r}async function tE(e,t){if(!e||""===e.trim())throw Error("Cannot evaluate empty script");try{const n=eE(t),r=t?.language||"en";return function(e){const t=e.trim().toLowerCase();if([/^set\s+.+\s+to\s+.+/,/^put\s+.+\s+(into|before|after)\s+.+/,/^add\s+.+(\s+to\s+.+)?/,/^remove\s+.+(\s+from\s+.+)?/,/^show\s+.+/,/^hide\s+.+/,/^toggle\s+.+/,/^log\s+.*/,/^wait\s+.+/,/^call\s+.+/,/^send\s+.+/,/^make\s+.+/,/^increment\s+.+/,/^decrement\s+.+/,/^fetch\s+.+/,/^throw\s+.+/,/^return\s+.+/,/^break/,/^continue/,/^halt/,/^go\s+.+/,/^if\s+.+/,/^repeat\s+.+/,/^on\s+.+/,/^render\s+.+/].some(e=>e.test(t)))return 1;const n=t.split(/\s/)[0];return n&&T.has(n)?1:0}(e)?await async function(e,t,n="en"){const r=ze(e),i=new cn(r,{semanticAnalyzer:(Qx||(Qx=at({parse:Yx,isRegistered:Ap,registered:jp})),Qx),language:n,semanticConfidenceThreshold:xk}).parse();if(!i.success||!i.node)throw Error("Parse error: "+(i.error?.message||"Unknown parse error"));const a=new Sl;return await a.execute(i.node,t)}(e,n,r):await fn(e,n)}catch(e){if(e instanceof Error)throw Error("HyperScript evaluation error: "+e.message);throw e}}async function nE(e,t){if(!e||""===e.trim())throw Error("Cannot evaluate empty expression");try{const n=eE(t);return await fn(e,n)}catch(e){if(e instanceof Error)throw Error("HyperScript evaluation error: "+e.message);throw e}}async function rE(e,t){if(function(e){const t=e.toLowerCase();return["fetch","wait","settle","async","promise"].some(e=>t.includes(e))}(e))return nE(e,t);try{return tE(e,t)}catch(n){if(n instanceof Error&&n.message.includes("Async expressions not yet supported"))return nE(e,t);throw n}}const iE={name:"HistorySwap",init:(e,t={})=>function(e){const{target:t,strategy:n="morph",useViewTransition:r=0,fetchOptions:i={},transformUrl:a,onBeforeFetch:o,onAfterSwap:s,onError:l}=e,c=async e=>{const c=(()=>{if("string"==typeof t){const e=document.querySelector(t);return Wi(e)?e:null}return Wi(t)?t:null})();if(!c)return void console.warn(`HistorySwap: target "${t}" not found`);let u=window.location.href;a&&(u=a(u));try{o&&await o(u),c.classList.add("hx-swapping");const e=await fetch(u,{method:"GET",headers:{Accept:"text/html","HX-Request":"true","HX-History-Restore-Request":"true"},...i});if(!e.ok)throw Error(`HTTP ${e.status}: ${e.statusText}`);const a=await e.text();await qo([c],a,n,{useViewTransition:r}),c.classList.remove("hx-swapping"),s&&await s(u,a),ps(window,"historyswap",{url:u,strategy:n,target:t})}catch(e){c.classList.remove("hx-swapping"),l?l(e,u):console.error("HistorySwap fetch failed:",e)}};return window.addEventListener("popstate",c),{destroy:()=>{window.removeEventListener("popstate",c)},config:e}}({target:t.target||e,strategy:t.strategy||"morph",useViewTransition:!!t.useViewTransition}),destroy(e){e.destroy()}};const aE={name:"Boosted",init:(e,t={})=>function(e){const{container:t,target:n,linkSelector:r="a[href]",formSelector:i="form",boostForms:a=0,strategy:o="morph",pushUrl:s=1,useViewTransition:l=0,fetchOptions:c={},onBeforeFetch:u,onAfterSwap:p,onError:m}=e,d=async(e,r="GET",i=null)=>{const a=(()=>{if(!n)return document.body;if("string"==typeof n){const e=document.querySelector(n);return Wi(e)?e:null}return Wi(n)?n:null})();if(a)try{if(u&&0==await u(e,r))return;a.classList.add("hx-swapping"),t.classList.add("hx-boosting");const m={method:r,headers:{Accept:"text/html","HX-Request":"true","HX-Boosted":"true"},...c};i&&"GET"!==r&&(m.body=i);const d=await fetch(e,m);if(!d.ok)throw Error(`HTTP ${d.status}: ${d.statusText}`);const f=await d.text();await qo([a],f,o,{useViewTransition:l}),a.classList.remove("hx-swapping"),t.classList.remove("hx-boosting"),s&&"GET"===r&&window.history.pushState(null,"",e),p&&await p(e,f),ps(window,"boosted",{url:e,method:r,strategy:o,target:n})}catch(n){a.classList.remove("hx-swapping"),t.classList.remove("hx-boosting"),m?m(n,e):(console.error("Boosted fetch failed:",n),window.location.href=e)}else console.warn(`Boosted: target "${n}" not found`)},f=async e=>{const t=e.target.closest(r);t&&function(e){return e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||0!==e.button?0:1}(e)&&function(e){return function(e){try{return new URL(e,window.location.origin).origin!==window.location.origin}catch{return 0}}(e.href)||e.target&&"_self"!==e.target||e.hasAttribute("download")||e.hasAttribute("data-no-boost")||e.hasAttribute("hx-boost-off")||"javascript:"===e.protocol||"mailto:"===e.protocol?0:1}(t)&&(e.preventDefault(),e.stopPropagation(),await d(t.href))},y=async e=>{if(!a)return;const t=e.target.closest(i);if(!t)return;if(t.hasAttribute("data-no-boost")||t.hasAttribute("hx-boost-off"))return;if(t.target&&"_self"!==t.target)return;e.preventDefault(),e.stopPropagation();const n=(t.method||"GET").toUpperCase(),r=new FormData(t);let o,s=null;if("GET"===n){const e=new URLSearchParams;r.forEach((t,n)=>{e.append(n,t+"")}),o=`${t.action||window.location.pathname}?${""+e}`}else o=t.action||window.location.pathname,s=r;await d(o,n,s)};return t.addEventListener("click",f),a&&t.addEventListener("submit",y),{destroy:()=>{t.removeEventListener("click",f),t.removeEventListener("submit",y)},config:e,boost:d}}({container:e,target:t.target,linkSelector:t.linkSelector||"a[href]",formSelector:t.formSelector||"form",boostForms:!!t.boostForms,strategy:t.strategy||"morph",pushUrl:0!=t.pushUrl,useViewTransition:!!t.useViewTransition}),destroy(e){e.destroy()}},oE="click";let sE,lE,cE,uE=null;function pE(e,t,n){Ye.parse("Failed to compile hyperscript on element:",e),Ye.parse(`Code: "${t}"`),n.errors?.length&&n.errors.forEach((e,t)=>{Ye.parse(`Error ${t+1}: ${e.message} (line ${e.line}, col ${e.column})`)}),Ye.parse("Compilation failed - error details:",{code:t,errors:n.errors,codeLines:t.split("\n"),element:e.tagName})}async function mE(e,t){try{return await cE().execute(e,t)}catch(e){throw Ye.runtime("Error executing hyperscript AST:",e),e}}function dE(e,t,n){try{const r=function(e){try{if(function(e){return"eventHandler"===e.type}(e)){const t=e.event||oE,n=e.commands,r={type:"CommandSequence",commands:n||[],start:e.start||0,end:e.end||0,line:e.line||1,column:e.column||1};return Ye.event("Extracted event info:",{type:e.type,eventType:t,commandCount:n?.length||0}),{eventType:t,body:r}}if(function(e){return"FeatureNode"===e.type}(e)&&"on"===e.name){const t=e.args?.[0]?.value||oE,n=e.body||e;return Ye.event("Extracted event info:",{type:e.type,eventType:t}),{eventType:t,body:n}}return"CommandSequence"===e.type||"Block"===e.type?(Ye.event("Extracted event info:",{type:e.type,eventType:oE}),{eventType:oE,body:e}):(Ye.event("Unknown AST structure for event extraction:",e.type),null)}catch(e){return Ye.event("Error extracting event info:",e),null}}(t);if(!r)return void Ye.event("Could not extract event information from AST:",t);Ye.event("Setting up event handler:",{element:e.tagName,eventType:r.eventType});const i=async t=>{1==uE?.logAll&&console.log("[hyperfixi]",r.eventType,e,t);try{n.locals.set("event",t),n.locals.set("target",t.target),await mE(r.body,n)}catch(e){Ye.event("Error executing hyperscript event handler:",e),Ye.event("Error stack:",e instanceof Error?e.stack:"No stack trace"),Ye.event("Event info body:",r.body),Ye.event("Context:",n)}};e.addEventListener(r.eventType,i);try{const t=cE?.();t?.trackListener?.(e,e,r.eventType,i)}catch{}Ye.event("Event handler attached:",r.eventType)}catch(e){Ye.event("Error setting up event handler:",e)}}function fE(e){return An(e)}function yE(e,t,n,r){const i=new CustomEvent(t,{bubbles:1,cancelable:n,detail:r});return e.dispatchEvent(i)}function hE(e,t){if(!yE(e,"hyperscript:before:init",1,{code:t}))return;const n=function(e){const t=e.getAttribute("data-lang");if(t)return t;const n=e.closest("[lang]")?.getAttribute("lang");if(n)return n.split("-")[0];if("undefined"!=typeof document){const e=document.documentElement?.lang;if(e)return e.split("-")[0]}return"en"}(e);"en"===n?(function(e,t){try{Ye.runtime("Processing hyperscript:",t);const n=sE(t);if(!n.ok)return void pE(e,t,n);if(!n.ast)return void Ye.parse("No AST generated for hyperscript:",t);Ye.runtime("Successfully compiled hyperscript:",t),Ye.runtime("Generated AST:",n.ast);const r=fE(e);if(t.trim().startsWith("on ")){Ye.event("Setting up event handler for:",t),Ye.event("Element for event handler:",e),Ye.event("AST for event handler:",n.ast);try{Ye.event("About to call setupEventHandler..."),dE(e,n.ast,r),Ye.event("setupEventHandler completed successfully")}catch(e){throw Ye.event("Error in setupEventHandler:",e),Ye.event("setupError stack:",e instanceof Error?e.stack:"No stack trace"),e}}else Ye.runtime("Executing immediate hyperscript:",t),mE(n.ast,r)}catch(t){Ye.runtime("Error processing hyperscript attribute:",t,"on element:",e)}}(e,t),vE(e),yE(e,"hyperscript:after:init",0,{code:t})):async function(e,t,n){try{Ye.runtime("Processing multilingual hyperscript:",{code:t,lang:n});const r=await lE(t,{language:n});if(!r.ok)return void pE(e,t,r);if(!r.ast)return void Ye.parse("No AST generated for hyperscript:",t);Ye.runtime("Successfully compiled multilingual hyperscript:",{code:t,lang:n,directPath:r.meta.directPath,confidence:r.meta.confidence});const i=fE(e);t.trim().startsWith("on ")||"eventHandler"===r.ast.type?(Ye.event("Setting up multilingual event handler:",{code:t,lang:n}),dE(e,r.ast,i)):(Ye.runtime("Executing immediate multilingual hyperscript:",t),mE(r.ast,i))}catch(t){Ye.runtime("Error processing multilingual hyperscript:",t,"on element:",e)}}(e,t,n).then(()=>{vE(e),yE(e,"hyperscript:after:init",0,{code:t})})}function vE(e){e.hasAttribute("data-hyperscript-powered")||e.setAttribute("data-hyperscript-powered","")}class gE{constructor(e){this.capacity=e,this.head=0,this.count=0,this.items=Array(e)}push(e){this.items[this.head]=e,this.head=(this.head+1)%this.capacity,this.capacity>this.count&&this.count++}toArray(){return this.capacity>this.count?this.items.slice(0,this.count):[...this.items.slice(this.head),...this.items.slice(0,this.head)]}get length(){return this.count}clear(){this.head=0,this.count=0}last(){if(0!==this.count)return this.items[(this.head-1+this.capacity)%this.capacity]}}class bE{constructor(){this.state={enabled:0,paused:0,stepMode:"continue",callDepth:0,pauseDepth:0,currentSnapshot:null},this.history=new gE(200),this.breakpoints=new Map,this.snapshotIndex=0,this.p=null,this.listeners=new Map,this.hooks={beforeExecute:this.beforeExecute.bind(this),afterExecute:this.afterExecute.bind(this)}}on(e,t){let n=this.listeners.get(e);return n||(n=new Set,this.listeners.set(e,n)),n.add(t),()=>n.delete(t)}emit(e,t){const n=this.listeners.get(e);if(n)for(const e of n)try{e(t)}catch{}}enable(){this.state.enabled=1,this.emit("enabled")}disable(){this.state.paused&&this.p&&(this.p(),this.p=null),this.state.enabled=0,this.state.paused=0,this.state.stepMode="continue",this.state.callDepth=0,this.emit("disabled")}get enabled(){return this.state.enabled}continue(){this.state.stepMode="continue",this.resume()}pause(){this.state.stepMode="pause"}stepOver(){this.state.stepMode="over",this.state.pauseDepth=this.state.callDepth,this.resume()}stepInto(){this.state.stepMode="into",this.resume()}stepOut(){this.state.stepMode="out",this.state.pauseDepth=this.state.callDepth,this.resume()}resume(){this.p&&(this.state.paused=0,this.emit("resumed"),this.p(),this.p=null)}setBreakpoint(e){const t=`bp_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;return this.breakpoints.set(t,{...e,id:t,hitCount:0}),t}removeBreakpoint(e){return this.breakpoints.delete(e)}getBreakpoints(){return Array.from(this.breakpoints.values())}clearBreakpoints(){this.breakpoints.clear()}getState(){return{...this.state}}getHistory(){return this.history.toArray()}clearHistory(){this.history.clear(),this.snapshotIndex=0}async beforeExecute(e){if(!this.state.enabled)return;this.state.callDepth++;const t=this.captureSnapshot(e);this.history.push(t),this.emit("snapshot",t),this.shouldPause(e)&&(this.state.paused=1,this.state.currentSnapshot=t,this.emit("paused",t),await new Promise(e=>{this.p=e}),this.state.currentSnapshot=null)}async afterExecute(e,t){if(!this.state.enabled)return;const n=this.history.last();n&&(n.variables.m=wE(t)),this.state.callDepth=Math.max(0,this.state.callDepth-1)}shouldPause(e){if(this.hitBreakpoint(e))return 1;switch(this.state.stepMode){case"pause":return this.state.stepMode="into",1;case"into":return 1;case"over":return this.state.pauseDepth>=this.state.callDepth;case"out":return this.state.pauseDepth>this.state.callDepth;case"continue":return 0}}hitBreakpoint(e){for(const t of this.breakpoints.values()){if(!t.enabled)continue;let n=0;switch(t.type){case"command":n=e.commandName===t.value;break;case"element":if(e.element)try{n=e.element.matches(t.value)}catch{}break;case"expression":n=this.evaluateCondition(t.value,e)}if(n)return t.hitCount++,1}return 0}evaluateCondition(e,t){try{const n=t.executionContext,r={commandName:t.commandName,it:n.it,result:n.result,me:n.me};if(n.locals)for(const[e,t]of n.locals)r[e]=t;const i=Object.keys(r),a=i.map(e=>r[e]);return!!Function(...i,`return (${e});`)(...a)}catch{return 0}}captureSnapshot(e){const t=e.executionContext,n={};if(n.it=wE(t.it),n.result=wE(t.result),t.me&&(n.me=kE(t.me)),t.you&&(n.you=kE(t.you)),e.event&&(n["event.type"]=e.event.type,e.event.target&&(n["event.target"]=kE(e.event.target))),t.locals)for(const[e,r]of t.locals)e.startsWith("__")||(n[":"+e]=wE(r));return{commandName:e.commandName,element:e.element,variables:n,timestamp:Date.now(),depth:this.state.callDepth,index:this.snapshotIndex++}}}function wE(e){if(null==e)return e;if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(e instanceof Element)return kE(e);if(Array.isArray(e))return`Array(${e.length})`;if(e instanceof Map)return`Map(${e.size})`;if(e instanceof Set)return`Set(${e.size})`;if("function"==typeof e)return`ƒ ${e.name||"anonymous"}()`;if("object"==typeof e){const t=Object.keys(e);return t.length>3?`{${t.slice(0,3).join(", ")}, ...${t.length-3} more}`:`{${t.join(", ")}}`}return e+""}function kE(e){let t="<"+e.tagName.toLowerCase();return e.id&&(t+="#"+e.id),e.classList.length>0&&(t+="."+Array.from(e.classList).join(".")),t+=">",t}const zE="en",xE=new class{constructor(e=500){this.cache=new Map,this.hits=0,this.misses=0,this.maxSize=e}makeKey(e,t){return`${t?.language||zE}\0${t?.traditional?"1":"0"}\0${e}`}get(e,t){const n=this.makeKey(e,t),r=this.cache.get(n);if(r)return this.hits++,this.cache.delete(n),this.cache.set(n,r),r.result;this.misses++}set(e,t,n){if(!n.ok)return;const r=this.makeKey(e,t);if(this.cache.size>=this.maxSize&&!this.cache.has(r)){const e=this.cache.keys().next().value;void 0!==e&&this.cache.delete(e)}this.cache.set(r,{result:n})}clear(){this.cache.clear(),this.hits=0,this.misses=0}getStats(){const e=this.hits+this.misses;return{size:this.cache.size,hits:this.hits,misses:this.misses,hitRate:e>0?this.hits/e:0}}}(500);let EE=null,SE=null;const TE={semantic:1,language:"en",confidenceThreshold:xk,logAll:0};async function jE(){if(!SE){const{SemanticGrammarBridge:e}=await Promise.resolve().then(function(){return DS});SE=new e,await SE.initialize()}return SE}let AE=null,LE=null;function OE(){if(!AE&&(AE=new Sl({lazyLoad:0}),(e=AE.behaviorRegistry)instanceof Map||e&&"function"==typeof e.set?e.set("HistorySwap",iE):e&&"object"==typeof e&&(e.HistorySwap=iE),function(e){e instanceof Map||e&&"function"==typeof e.set?e.set("Boosted",aE):e&&"object"==typeof e&&(e.Boosted=aE)}(AE.behaviorRegistry),"undefined"!=typeof globalThis)){const e=globalThis;e.l=e.l||{},e.l.runtime=AE,e.l.behaviors=AE.behaviorAPI}var e;return AE}async function CE(e,t){if(!e)throw Error("AST is required for execution");const n=t||An();return await OE().execute(e,n)}function NE(e,t){if("string"!=typeof e)throw new TypeError("Code must be a string");const n=xE.get(e,t);if(n)return n;const r=performance.now(),i=t?.language||zE;try{const n=t?.traditional??0,o=n?{}:TE.semantic?{semanticAnalyzer:(EE||(EE=at({parse:Yx,isRegistered:Ap,registered:jp})),EE),language:TE.language,semanticConfidenceThreshold:TE.confidenceThreshold}:{},s=!n,l=un(e,o),c=performance.now()-r;if(l.success&&l.node){const n={ok:1,ast:l.node,meta:{parser:s?"semantic":"traditional",language:i,timeMs:c}};return xE.set(e,t,n),n}return{ok:0,errors:l.error?[(a=l.error,{message:a.message,line:a.line??1,column:a.column??1})]:[],meta:{parser:s?"semantic":"traditional",language:i,timeMs:c}}}catch(a){const e=performance.now()-r;return{ok:0,errors:[{message:a instanceof Error?a.message:"Unknown compilation error",line:1,column:1}],meta:{parser:"traditional",language:i,timeMs:e}}}var a}async function PE(e,t){if("string"!=typeof e)throw new TypeError("Code must be a string");const n=t?.language||zE;if(n===zE||t?.traditional)return NE(e,t);const r=xE.get(e,t);if(r)return r;const i=performance.now();try{const r=await jE(),a=await r.parseToASTWithDetails(e,n);if(a.usedDirectPath&&a.ast){const r=performance.now()-i,o={ok:1,ast:a.ast,meta:{parser:"semantic",confidence:a.confidence,language:n,timeMs:r,directPath:1}};return xE.set(e,t,o),o}const o=NE(a.fallbackText||e,{...t,language:zE}),s={...o,meta:{...o.meta,language:n,confidence:a.confidence,directPath:0}};return xE.set(e,t,s),s}catch{return NE(e,{...t,language:"en"})}}!function(e,t,n){sE=e,lE=t,cE=n}(NE,PE,OE),uE=TE;const RE={compile:PE,compileSync:NE,execute:CE,eval:async function(e,t,n){if("string"!=typeof e||0===e.trim().length)throw Error("Code must be a non-empty string");let r;if(t)if(t instanceof Element)r=An(t);else if("object"==typeof(i=t)&&null!==i&&"locals"in i&&i.locals instanceof Map)r=t;else{const e=t;r=function(e){return"object"==typeof e&&null!==e&&"me"in e}(e)?An(e.me):An()}else r=An();var i;const a=await PE(e.trim(),n);if(!a.ok)throw Error("Compilation failed: "+(a.errors?.[0]?.message||"Unknown compilation error"));return CE(a.ast,r)},validate:async function(e,t){const n=await PE(e,t);return{valid:n.ok,errors:n.errors}},process:function(e){try{const t=e.getAttribute("_");t&&hE(e,t),e.querySelectorAll("[_]").forEach(e=>{const t=e.getAttribute("_");t&&hE(e,t)})}catch(e){Ye.runtime("Error processing hyperscript node:",e)}},cleanup:e=>{e.dispatchEvent(new CustomEvent("hyperscript:before:cleanup",{bubbles:1,cancelable:0}));const t=OE().cleanupTree(e);return e.hasAttribute?.("data-hyperscript-powered")&&e.removeAttribute("data-hyperscript-powered"),e.dispatchEvent(new CustomEvent("hyperscript:after:cleanup",{bubbles:1,cancelable:0,detail:{count:t}})),t},createContext:function(e,t){return t?function(e,t){return{me:t??e.me,it:null,you:null,result:null,locals:new Map,globals:e.globals,parent:e,flags:{halted:0,breaking:0,continuing:0,returning:0,async:0}}}(t,e):An(e)},config:TE,version:"2.0.0",createRuntime:function(e){return new Sl(e)},getDefaultRuntime:()=>OE(),registerHooks:(e,t)=>{OE().registerHooks(e,t)},unregisterHooks:e=>OE().unregisterHooks(e),getRegisteredHooks:()=>OE().getRegisteredHooks(),evalLSE:async function(e,t){if("string"!=typeof e||0===e.trim().length)throw Error("LSE code must be a non-empty string");const{parseExplicit:n,semanticNodeToRuntimeAST:r}=await Promise.resolve().then(function(){return FS}),i=await n(e),a=await r(i),o=t?An(t):An();return await OE().execute(a,o)},evalLSENode:async function(e,t){const{semanticNodeToRuntimeAST:n}=await Promise.resolve().then(function(){return FS}),r=await n(e),i=t?An(t):An();return await OE().execute(r,i)},compileLSE:async function(e){const t=performance.now();if("string"!=typeof e||0===e.trim().length)return{ok:0,errors:[{message:"LSE code must be a non-empty string",line:0,column:0}],meta:{parser:"lse",language:"explicit",timeMs:performance.now()-t}};try{const{parseExplicit:n,semanticNodeToRuntimeAST:r}=await Promise.resolve().then(function(){return FS}),i=await n(e,{collectDiagnostics:1}),a=await r(i),o=i.diagnostics?.filter(e=>"error"===e.severity),s=o&&o.length>0;return{ok:!s,ast:s?void 0:a,lse:i,...s?{errors:o.map(e=>({message:e.message,line:0,column:0}))}:{},meta:{parser:"lse",language:"explicit",timeMs:performance.now()-t}}}catch(e){return{ok:0,errors:[{message:e.message,line:0,column:0}],meta:{parser:"lse",language:"explicit",timeMs:performance.now()-t}}}},toLSE:async function(e,t){const n=t||zE,{parseSemantic:r}=await Promise.resolve().then(function(){return Xx}),{renderExplicit:i}=await Promise.resolve().then(function(){return FS}),a=r(e,n);if(!a||!a.node)throw Error(`Failed to parse "${e}" as ${n} hyperscript`);return await i(a.node)},fromLSE:async function(e,t){const{render:n}=await Promise.resolve().then(function(){return Xx}),{parseExplicit:r}=await Promise.resolve().then(function(){return FS});return n(await r(e),t)},clearCache:()=>xE.clear(),getCacheStats:()=>xE.getStats(),get debug(){return LE||(LE=new bE,OE().registerHooks("__debugger",LE.hooks)),LE}},$E=/^on\s+(\w+)/,IE=new Set(["load","mutation","intersection","appear","every"]);function ME(){return"undefined"!=typeof globalThis&&"scheduler"in globalThis&&"function"==typeof globalThis.scheduler?.yield?globalThis.scheduler.yield():new Promise(e=>setTimeout(e,0))}const qE=new class{constructor(e={}){this.processedElements=new WeakSet,this.observer=null,this.processedCount=0,this.readyEventDispatched=0,this.initialized=0,this.lazyElements=new WeakSet,this.options={attributeName:"_",autoScan:1,processOnlyNewElements:1,lazyParsing:0,chunkedProcessing:0,chunkSize:16,...e}}async init(){Ye.parse("ATTR: init() called"),"undefined"!=typeof document&&(this.initialized?Ye.parse("ATTR: Already initialized, skipping duplicate init()"):(this.initialized=1,Ye.parse("ATTR: Starting initialization..."),this.options.autoScan&&(await this.scanAndProcessAll(),this.dispatchReadyEvent()),this.setupMutationObserver()))}async scanAndProcessAll(){"undefined"!=typeof window&&window.__hyperfixi_behaviors_ready&&(Ye.parse("ATTR: Waiting for external behaviors..."),await window.__hyperfixi_behaviors_ready,Ye.parse("ATTR: External behaviors registered"));const e=document.querySelectorAll('script[type="text/hyperscript"]');Ye.parse(`ATTR: Found ${e.length} script tags`);for(const t of e)t instanceof HTMLScriptElement&&(Ye.parse("ATTR: Processing script tag:",t.textContent?.substring(0,50)),await this.processHyperscriptTag(t));const t=document.querySelectorAll(`[${this.options.attributeName}]`);if(Ye.parse(`ATTR: Found ${t.length} elements to process`),this.options.lazyParsing){Ye.parse("ATTR: Using lazy parsing mode");const e=[];t.forEach(t=>{if(t instanceof HTMLElement){const n=this.processElementLazy(t);n&&e.push(n)}}),e.length>0&&await Promise.all(e)}else if(this.options.chunkedProcessing)Ye.parse(`ATTR: Using chunked processing (chunkSize=${this.options.chunkSize})`),await this.processElementsChunked(t);else{const e=[];t.forEach(t=>{t instanceof HTMLElement&&e.push(this.processElementAsync(t))}),await Promise.all(e)}Ye.parse("ATTR: All elements processed"),"undefined"!=typeof window&&window.dispatchEvent(new CustomEvent("lokascript:initialized",{detail:{scriptsProcessed:e.length,elementsProcessed:t.length}}))}async processHyperscriptTag(e){const t=e.getAttribute("for");t?await this.processHyperscriptTagForElements(e,t):await this.processHyperscriptTagGlobal(e)}async processHyperscriptTagForElements(e,t){Ye.parse(`SCRIPT: Processing hyperscript script tag with for="${t}"`);const n=e.textContent||e.innerHTML;if(!n||!n.trim())return void Ye.parse("SCRIPT: No hyperscript code found in script tag");const r=document.querySelectorAll(t);if(0!==r.length)try{Ye.parse(`SCRIPT: Compiling for="${t}" code:`,n.substring(0,50)+"...");const e=RE.compileSync(n);if(!e.ok)return void console.warn(`[LokaScript] Script for="${t}" compilation failed:`,e.errors);for(const t of r)if(t instanceof HTMLElement){const n=An(t);await RE.execute(e.ast,n)}Ye.parse(`SCRIPT: Executed for="${t}" on ${r.length} element(s)`)}catch(e){console.error(`[LokaScript] Error processing script for="${t}":`,e)}else console.warn(`[LokaScript] Script with for="${t}" found no matching elements`)}async processHyperscriptTagGlobal(e){Ye.parse("SCRIPT: Processing hyperscript script tag");const t=e.textContent||e.innerHTML;if(t&&t.trim())try{Ye.parse("SCRIPT: Compiling script tag code:",t.substring(0,50)+"...");const e=An(null),n=RE.compileSync(t);if(Ye.parse("SCRIPT: Compilation result:",n.ok?"SUCCESS":"FAILED"),!n.ok)return void console.warn("[LokaScript] Script compilation failed:",n.errors);Ye.parse("ATTR: Script compiled, AST type:",n.ast?.type,"name:",n.ast?.name),await RE.execute(n.ast,e),Ye.parse("ATTR: Script executed successfully")}catch(e){console.error("[LokaScript] Script execution error:",e)}else Ye.parse("SCRIPT: No hyperscript code found in script tag")}processElement(e){this.processElementAsync(e)}async processElementAsync(e){if(Ye.parse("ATTR: Attempting to process element:",e),this.options.processOnlyNewElements&&this.processedElements.has(e))return void Ye.parse("ATTR: Skipping already processed element");const t=e.getAttribute(this.options.attributeName);if(Ye.parse("ATTR: Found hyperscript code:",t),t){this.processedElements.add(e),this.processedCount++;try{Ye.parse("ATTR: Processing element with code:",t);const n=An(e);Ye.parse("ATTR: Created context for element"),Ye.parse("ATTR: About to compile hyperscript code");const r=RE.compileSync(t);if(Ye.parse("ATTR: Compilation result:",r),!r.ok)return void console.warn("[LokaScript] Compilation failed for _= attribute:",r.errors,e);Ye.parse("ATTR: Compilation succeeded, processing handler type"),Ye.parse("ATTR: Executing compiled AST"),await RE.execute(r.ast,n),this.dispatchLoadEvent(e)}catch(t){console.error("[LokaScript] Error processing _= attribute:",t,e)}}else Ye.parse("ATTR: No hyperscript code found on element")}async processElementsChunked(e){const t=this.options.chunkSize,n=[];e.forEach(e=>{e instanceof HTMLElement&&n.push(e)});for(let e=0;n.length>e;e+=t){const r=n.slice(e,e+t).map(e=>this.processElementAsync(e));await Promise.all(r),n.length>e+t&&await ME()}}processElementLazy(e){const t=e.getAttribute(this.options.attributeName);if(!t)return null;const n=t.match($E);if(!n||IE.has(n[1])||this.hasMultipleHandlers(t))return this.processElementAsync(e);const r=n[1];return Ye.parse(`ATTR: Lazy-registering stub for "${r}" on element`),e.addEventListener(r,async n=>{this.lazyElements.delete(e);try{const r=RE.compileSync(t);if(!r.ok||!r.ast)return void console.warn("[LokaScript] Lazy compilation failed:",r.errors,e);const i=An(e);RE.execute(r.ast,i);const a=r.ast;if("eventHandler"===a.type&&a.commands?.length>0){a.modifiers?.prevent&&n.preventDefault(),a.modifiers?.stop&&n.stopPropagation();const t=An(e);t.locals.set("event",n),t.locals.set("target",n.target),t.event=n;for(const e of a.commands){const n=Vn(await RE.execute(e,t));void 0!==n&&Object.assign(t,{it:n,result:n})}}this.dispatchLoadEvent(e)}catch(t){console.error("[LokaScript] Error in lazy handler on first event:",t,e)}},{once:1}),this.lazyElements.add(e),this.processedElements.add(e),this.processedCount++,null}hasMultipleHandlers(e){const t=new Set(["me","it","its","my","you","yourself"]);let n=0;const r=/\bon\s+(\w+)/g;let i;for(;null!==(i=r.exec(e));)if("."!==e[i.index+i[0].length]&&!t.has(i[1])&&(n++,n>1))return 1;return 0}dispatchLoadEvent(e){try{const t=new Event("load",{bubbles:0,cancelable:0});e.dispatchEvent(t)}catch(t){Ye.parse("ATTR: Error dispatching load event on element:",e,t)}}dispatchReadyEvent(){if(!this.readyEventDispatched)try{const e=new CustomEvent("hyperscript:ready",{bubbles:1,cancelable:0,detail:{processedElements:this.processedCount,timestamp:Date.now()}});document.dispatchEvent(e),this.readyEventDispatched=1}catch(e){Ye.parse("ATTR: Error dispatching hyperscript:ready event:",e)}}setupMutationObserver(){"undefined"!=typeof MutationObserver&&(this.observer=new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{if(e.nodeType===Node.ELEMENT_NODE){const t=e;"SCRIPT"===t.tagName&&"text/hyperscript"===t.getAttribute("type")&&this.processHyperscriptTag(t).catch(e=>{console.error("[LokaScript] Error processing dynamically added script tag:",e)});const n=t.querySelectorAll?.('script[type="text/hyperscript"]');n?.forEach(e=>{e instanceof HTMLScriptElement&&this.processHyperscriptTag(e).catch(e=>{console.error("[LokaScript] Error processing dynamically added script tag:",e)})}),t.getAttribute&&t.getAttribute(this.options.attributeName)&&this.processElementAsync(t).catch(e=>{console.error("[LokaScript] Error processing dynamically added element:",e)});const r=t.querySelectorAll?.(`[${this.options.attributeName}]`);r?.forEach(e=>{e instanceof HTMLElement&&this.processElementAsync(e).catch(e=>{console.error("[LokaScript] Error processing dynamically added element:",e)})})}})})}),this.observer.observe(document.body,{childList:1,subtree:1}))}destroy(){this.observer&&(this.observer.disconnect(),this.observer=null),this.initialized=0,this.readyEventDispatched=0,this.processedCount=0,this.lazyElements=new WeakSet}reset(){this.destroy()}};class _E{constructor(e,t,n=0){this.pool=[],this.index=0,this.metrics={allocations:0,reuses:0,peakPoolSize:0},this.factory=e,this.reset=t;for(let t=0;n>t;t++)this.pool.push(e());this.metrics.allocations=n,this.metrics.peakPoolSize=n}get(){let e;return this.pool.length>this.index?(e=this.pool[this.index++],this.metrics.reuses++,this.reset&&this.reset(e)):(e=this.factory(),this.pool.push(e),this.index++,this.metrics.allocations++,this.pool.length>this.metrics.peakPoolSize&&(this.metrics.peakPoolSize=this.pool.length)),e}releaseAll(){this.index=0}getMetrics(){const e=this.metrics.allocations+this.metrics.reuses;return{...this.metrics,hitRate:e>0?this.metrics.reuses/e*100:0}}clear(){this.pool=[],this.index=0,this.metrics={allocations:0,reuses:0,peakPoolSize:0}}}const DE=new class{constructor(){this.pending=new Map,this.rafId=null,this.stylePool=new _E(()=>({}),e=>{for(const t of Object.keys(e))delete e[t]},10)}add(e,t){let n=this.pending.get(e);n||(n=this.stylePool.get(),this.pending.set(e,n)),Object.assign(n,t),this.rafId||(this.rafId=requestAnimationFrame(()=>this.flush()))}flush(){for(const[e,t]of this.pending)for(const[n,r]of Object.entries(t))if(n.startsWith("--"))e.style.setProperty(n,r);else{const t=n.replace(/-([a-z])/g,e=>e[1].toUpperCase());e.style[t]=r}this.pending.clear(),this.stylePool.releaseAll(),this.rafId=null}cancel(){this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.pending.clear(),this.stylePool.releaseAll()}getPendingCount(){return this.pending.size}getPoolMetrics(){return this.stylePool.getMetrics()}},VE={evalHyperScript:tE,evalHyperScriptAsync:nE,evalHyperScriptSmart:rE,evaluate:tE,compile:(e,t)=>{Ye.parse("BROWSER-BUNDLE: hyperfixi.compile() called",{code:e,options:t});const n=RE.compileSync(e,t);if(Ye.parse("BROWSER-BUNDLE: hyperscript.compileSync() returned",{result:n}),!n.ok)throw Error(n.errors&&n.errors.length>0?n.errors[0].message:"Compilation failed");return n},compileSync:(e,t)=>RE.compileSync(e,t),compileMultilingual:async(e,t)=>RE.compile(e,{language:t}),execute:RE.execute,run:async(e,t)=>RE.eval(e,t),createContext:RE.createContext,createRuntime:RE.createRuntime,Parser:cn,Runtime:Sl,tokenize:ze,installPlugin:function(e,t){const n={commandRegistry:e.getRegistry(),parserExtensions:ae(),runtime:e};t.install(n)},getParserExtensionRegistry:ae,processNode:async e=>{e===document?await qE.scanAndProcessAll():e instanceof HTMLElement&&await qE.processElementAsync(e)},process:e=>VE.processNode(e),attributeProcessor:qE,styleBatcher:DE,ObjectPool:_E,debug:Ye,debugControl:Xe,semantic:{parseSemantic:Yx,parse:lx,translate:dx,render:Xz,toExplicit:px,fromExplicit:mx,supportedLanguages:["ar","bn","de","en","es","fr","hi","id","it","ja","ko","ms","pl","pt","qu","ru","sw","th","tl","tr","uk","vi","zh"]},semanticDebug:{enable:function(e){Qe=1,et=e??("undefined"!=typeof window?window:null)},disable:function(){Qe=0},isEnabled:tt,getStats:function(){return{...nt}},resetStats:function(){nt={totalParses:0,semanticSuccesses:0,semanticFallbacks:0,traditionalParses:0,averageConfidence:0,confidenceHistory:[]},rt=[]},getEventHistory:function(){return[...rt]},replayEvents:function(e){for(const t of rt)e(t)}},config:TE,registerHooks:RE.registerHooks,unregisterHooks:RE.unregisterHooks,getRegisteredHooks:RE.getRegisteredHooks,getDefaultRuntime:RE.getDefaultRuntime,registry:Mn(),registerFetchResponseType:function(e,t){bs.set(e.toLowerCase(),t)},evalLSENode:RE.evalLSENode.bind(RE),version:"2.0.0-full"};if("undefined"!=typeof window){if(window.hyperfixi=VE,void 0===window.lokascript){let e=0;Object.defineProperty(window,"lokascript",{get:()=>(e||(e=1,console.warn("[DEPRECATED] window.lokascript is deprecated and will be removed in v3.0.0. Please use window.hyperfixi instead. See https://github.com/codetalcott/hyperfixi/blob/main/MIGRATION.md")),window.hyperfixi),set(e){window.hyperfixi=e},enumerable:1,configurable:1})}window.evalHyperScript=tE,window.evalHyperScriptAsync=nE,window.evalHyperScriptSmart=rE,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{qE.init()}):qE.init()}function HE(e,t){(function(){try{return"undefined"!=typeof localStorage&&null!==localStorage.getItem("hyperfixi:debug")}catch{return 0}})()&&void 0!==console&&console.warn("[@hyperfixi/reactivity] "+e,t)}var FE=new WeakMap,BE=0;function UE(e){const t=FE.get(e);if(void 0!==t)return t;const n=++BE;return FE.set(e,n),n}var GE=class{constructor(e,t,n,r){this.r=e,this.expression=t,this.handler=n,this.element=r}dependencies=new Map;lastValue=void 0;h=0;v=0;get stopped(){return this.h}async initialize(){if(!this.h)try{const e=await this.r.k(this,this.expression);this.lastValue=e,null!=e&&await this.handler(e)}catch(e){HE("effect.initialize failed",e)}}async run(){if(!this.h)if(!this.element||this.element.isConnected){if(this.v++,this.v>100)return void 0!==console&&console.error("[@hyperfixi/reactivity] Effect halted: > 100 consecutive triggers (cycle detected)."),void this.stop();try{const e=await this.r.k(this,this.expression);if(Object.is(e,this.lastValue))return;this.lastValue=e,await this.handler(e)}catch(e){HE("effect.run failed",e)}}else this.stop()}resetTriggerCount(){this.v=0}stop(){this.h||(this.h=1,this.r.S(this),this.dependencies.clear())}},WE=new class{currentEffect=null;pending=new Set;scheduled=0;globalSubs=new Map;elementState=new WeakMap;getElementState(e){let t=this.elementState.get(e);return t||(t={symbolSubs:new Map,caretVars:new Map,domHandlers:new Map,effects:new Set},this.elementState.set(e,t)),t}async k(e,t){const n=this.currentEffect;this.currentEffect=e,this.S(e),e.dependencies.clear();try{return await t()}finally{this.currentEffect=n}}trackGlobal(e){const t=this.currentEffect;if(!t)return;const n=(e=>"global:"+e)(e);if(t.dependencies.has(n))return;t.dependencies.set(n,{key:n,kind:"global",name:e,element:null});let r=this.globalSubs.get(e);r||(r=new Set,this.globalSubs.set(e,r)),r.add(t)}trackElement(e,t){const n=this.currentEffect;if(!n)return;const r=((e,t)=>`element:${UE(e)}:${t}`)(e,t);if(n.dependencies.has(r))return;n.dependencies.set(r,{key:r,kind:"element",name:t,element:e});const i=this.getElementState(e);let a=i.symbolSubs.get(t);a||(a=new Set,i.symbolSubs.set(t,a)),a.add(n),i.effects.add(n)}trackDomProperty(e,t){const n=this.currentEffect;if(!n)return;const r=((e,t)=>`dom:${UE(e)}:${t}`)(e,t);if(n.dependencies.has(r))return;n.dependencies.set(r,{key:r,kind:"dom",name:t,element:e});const i=this.getElementState(e);let a=i.domHandlers.get(t);if(!a){const n=new Set,r=()=>{for(const e of n)this.schedule(e)};e.addEventListener("input",r),e.addEventListener("change",r),a={subs:n,detach:()=>{e.removeEventListener("input",r),e.removeEventListener("change",r)}},i.domHandlers.set(t,a)}a.subs.add(n),i.effects.add(n)}notifyGlobal(e){const t=this.globalSubs.get(e);if(t)for(const e of t)this.schedule(e)}notifyElement(e,t){const n=this.elementState.get(e);if(!n)return;const r=n.symbolSubs.get(t);if(r)for(const e of r)this.schedule(e)}createEffect(e,t,n){const r=new GE(this,e,t,n);return n&&this.getElementState(n).effects.add(r),queueMicrotask(()=>{r.initialize()}),()=>r.stop()}stopElementEffects(e){const t=this.elementState.get(e);if(t){for(const e of Array.from(t.effects))e.stop();t.effects.clear()}}S(e){for(const t of e.dependencies.values())if("global"===t.kind){const n=this.globalSubs.get(t.name);n?.delete(e)}else if("element"===t.kind&&t.element){const n=this.elementState.get(t.element),r=n?.symbolSubs.get(t.name);r?.delete(e),n?.effects.delete(e)}else if("dom"===t.kind&&t.element){const n=this.elementState.get(t.element),r=n?.domHandlers.get(t.name);r?.subs.delete(e),r&&0===r.subs.size&&(r.detach(),n?.domHandlers.delete(t.name)),n?.effects.delete(e)}}isIsolationBoundary(e){return"function"==typeof e.getAttribute&&"isolated"===e.getAttribute("dom-scope")}findCaretOwner(e,t){let n=e;for(;n;){const e=this.elementState.get(n);if(e&&e.caretVars.has(t))return n;if(this.isIsolationBoundary(n))return null;n=n.parentElement}return null}readCaret(e,t){let n=e;for(;n;){this.trackElement(n,t);const e=this.elementState.get(n);if(e&&e.caretVars.has(t))return e.caretVars.get(t);if(this.isIsolationBoundary(n))return;n=n.parentElement}}writeCaret(e,t,n,r){const i=r??this.findCaretOwner(e,t)??e;this.getElementState(i).caretVars.set(t,n),this.notifyElement(i,t)}schedule(e){e.stopped||(this.pending.add(e),this.scheduled||(this.scheduled=1,queueMicrotask(()=>{this.flush()})))}async flush(){try{for(;this.pending.size>0;){const e=Array.from(this.pending);this.pending.clear();for(const t of e)t.stopped||(await t.run(),this.pending.has(t)||t.resetTriggerCount())}}finally{this.scheduled=0}}};function KE(e){return e instanceof Element?e:Array.isArray(e)&&e[0]instanceof Element?e[0]:null}function JE(e,t){const n=t,r=n.advance();if(!r||!r.value)throw Error("Expected identifier after '^'");let i=null;const a=n.peek();a&&"on"===a.value&&(n.advance(),i=n.parseExpr(86));const o=e;return{type:"caretVar",name:r.value,onTarget:i,start:o?.start??0,end:o?.end??0,line:o?.line,column:o?.column}}function ZE(e,t){const n=e,r=n.parseCommandListUntilEnd();!n.isAtEnd()&&n.check("end")&&n.match("end");const i=t;return{type:"liveFeature",body:r,start:i?.start??0,end:n.getPosition().end,line:i?.line,column:i?.column}}function YE(e,t){const n=e,r=[n.parseExpression()];for(;n.match("or");)r.push(n.parseExpression());n.consume("changes","Expected 'changes' after when expression list");const i=n.parseCommandListUntilEnd();!n.isAtEnd()&&n.check("end")&&n.match("end");const a=t;return{type:"whenFeature",watched:r,body:i,start:a?.start??0,end:n.getPosition().end,line:a?.line,column:a?.column}}function XE(e,t){const n=e,r=n.parseExpression();if(!(n.match("to")||n.match("and")||n.match("with")))throw Error("bind requires 'to', 'and', or 'with' between the two sides");const i=n.parseExpression();n.check("end")&&n.match("end");const a=t;return{type:"bindFeature",left:r,right:i,start:a?.start??0,end:n.getPosition().end,line:a?.line,column:a?.column}}function QE(e){if(!e)return 0;if("identifier"!==e.type)return 0;const t=e.scope;if("local"===t||"global"===t)return 1;const n=e.name??"";return n.startsWith("$")||n.startsWith(":")}function eS(e){const t=e.name??"",n=e.scope;let r,i;if("global"===n?(r=1,i=t):"local"===n?(r=0,i=t):t.startsWith("$")?(r=1,i=t.slice(1)):t.startsWith(":")?(r=0,i=t.slice(1)):(r=0,i=t),!i)throw Error("bind: variable reference has empty name");return{name:i,isGlobal:r}}var tS={name:"@hyperfixi/reactivity",version:"2.3.1",install(e){const{parserExtensions:t,runtime:n}=e;t.hasFeature("live")||(t.registerFeature("live",ZE),t.registerFeature("when",YE),t.registerFeature("bind",XE),t.registerPrefixOperator("^",85,JE),t.registerNodeEvaluator("liveFeature",function(e){return async function(t,n){const r=n,i=r.me??document.body,a=t,o=WE.createEffect(async()=>{for(const t of a.body)await e.execute(t,r)},()=>{},i);r.registerCleanup?.(i,o,"live-effect")}}(n)),t.registerNodeEvaluator("whenFeature",function(e){return async function(t,n){const r=n,i=r.me??document.body,a=t;for(const t of a.watched){const n=WE.createEffect(async()=>await e.execute(t,r),async t=>{const n={...r,it:t,result:t};for(const t of a.body)await e.execute(t,n)},i);r.registerCleanup?.(i,n,"when-effect")}}}(n)),t.registerNodeEvaluator("bindFeature",function(e){return async function(t,n){const r=n,i=r.me??document.body,a=t,o=QE(a.left),s=QE(a.right);let l=null,c=null;if(o&&!s)l=eS(a.left),c={exprNode:a.right};else{if(!s||o)throw Error(o&&s?"bind: cannot bind two symbols together (need a DOM side)":"bind: could not identify a symbol side");l=eS(a.right),c={exprNode:a.left}}const u=function(e){if(!e||"memberExpression"!==e.type&&"possessiveExpression"!==e.type)return null;if("memberExpression"===e.type&&1==e.computed)return null;const t=e.property,n=e.object;if(!t||!n||"identifier"!==t.type)return null;const r=t.name??"";return r?{element:n,propertyName:r}:null}(c.exprNode);if(u&&function(e){return e?"memberExpression"===e.type||"possessiveExpression"===e.type:0}(u.element))throw Error("bind: multi-level property access (e.g., `#el.a.b`) is not supported in v1 — restructure to a single property write or pass the element directly for auto-detection (e.g., `bind $x to #el`).");const p=u?u.element:c.exprNode,m=await e.execute(p,r);if(!(m instanceof Element))throw Error(`bind: right-hand side did not resolve to an element (got ${null===m?"null":void 0===m?"undefined":typeof m}${null!=m?` "${(m+"").slice(0,40)}"`:""}).${u?"":" If you meant to write to a property, use the explicit form: `<selector>'s <property>`."}`);const d=m,f=u?u.propertyName:function(e){const t=e.tagName;if("INPUT"===t){const t=e.type;return"checkbox"===t||"radio"===t?"checked":"number"===t||"range"===t?"valueAsNumber":"value"}return"TEXTAREA"===t||"SELECT"===t?"value":"true"===e.contentEditable?"textContent":"value"in e?"value":null}(d);if(!f)throw Error(`bind: could not auto-detect property for <${d.tagName.toLowerCase()}> — use explicit \`<expr>'s <property>\` form`);const y=!u||function(e){const t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t||"true"===e.contentEditable?1:0}(d);u&&!y&&function(){try{return"undefined"!=typeof localStorage&&null!==localStorage.getItem("hyperfixi:debug")}catch{return 0}}()&&void 0!==console&&console.warn(`[@hyperfixi/reactivity] bind: DOM→var skipped for <${d.tagName.toLowerCase()}>.${f} — no input/change event source.`);let h=null;y&&(h=WE.createEffect(()=>(WE.trackDomProperty(d,f),"valueAsNumber"===f?d.valueAsNumber:"checked"===f?d.checked:"textContent"===f?d.textContent??"":d[f]),e=>{var t;t=e,l.isGlobal?(r.globals?.set(l.name,t),WE.notifyGlobal(l.name)):(r.locals?.set(l.name,t),WE.notifyElement(i,l.name))},i));const v=WE.createEffect(()=>(l.isGlobal?WE.trackGlobal(l.name):WE.trackElement(i,l.name),l.isGlobal?r.globals?.get(l.name):r.locals?.get(l.name)),e=>{void 0!==e&&(e=>{if("valueAsNumber"===f){const t=Number(e);d.valueAsNumber=Number.isNaN(t)?null:t}else"checked"===f?d.checked=!!e:"textContent"===f?d.textContent=null==e?"":e+"":d[f]=e})(e)},i);h&&r.registerCleanup?.(i,h,"bind-dom-to-var"),r.registerCleanup?.(i,v,"bind-var-to-dom")}}(n)),t.registerNodeEvaluator("caretVar",function(e){return async function(t,n){const r=t,i=n;let a=i.me??null;if(r.onTarget){const t=KE(await e.execute(r.onTarget,i));t&&(a=t)}if(a)return WE.readCaret(a,r.name)}}(n)),t.registerNodeWriter("caretVar",function(e){return async function(t,n,r){const i=t,a=r,o=a.me??null;if(!o)return;let s;if(i.onTarget){const t=KE(await e.execute(i.onTarget,a));t&&(s=t)}WE.writeCaret(o,i.name,n,s)}}(n)),t.registerGlobalWriteHook((e,t,n)=>{WE.notifyGlobal(e)}),t.registerGlobalReadHook((e,t)=>{WE.trackGlobal(e)}),t.registerLocalWriteHook((e,t,n)=>{const r=n.me??null;r&&WE.notifyElement(r,e)}),t.registerLocalReadHook((e,t)=>{const n=t.me??null;n&&WE.trackElement(n,e)}))}};let nS={nameOf:(e,t,n)=>`${t}-${n}`,selectorFor:(e,t)=>`[${e}-${t}]`,eventNameOf:(e,t)=>t};function rS(){return nS}const iS={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"},aS={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 oS(e){if("this"===e)return"me";const t=e.match(/^closest\s+(.+)$/);if(t)return`closest <${t[1]}/>`;const n=e.match(/^find\s+(.+)$/);if(n)return`first <${n[1]}/> in me`;const r=e.match(/^next\s+(.+)$/);if(r)return`next <${r[1]}/>`;const i=e.match(/^previous\s+(.+)$/);return i?`previous <${i[1]}/>`:e}function sS(e,t){const n=[];if(e.hxLive&&n.push(`live\n ${e.hxLive}\nend`),!e.url)return n.join("\n");const r=[],i=e.trigger||function(e){const t=e.tagName.toLowerCase();if("form"===t)return"submit";if("input"===t||"textarea"===t||"select"===t){const t=e.getAttribute("type");return"submit"===t||"button"===t?"click":"change"}return"click"}(t),{event:a,modifiers:o}=function(e,t){const n=e.trim().split(/\s+/),r=n[0],i=n.slice(1),a=r.match(/^(\w+)\[(.+)\]$/);if(a){const e=t(a[1]);return{event:aS[e]||e,modifiers:["filter: "+a[2],...i]}}const o=t(r);return{event:aS[o]||o,modifiers:i}}(i,e=>rS().eventNameOf(t,e)),s=function(e){const t=[];for(const n of e){const e=n.match(/^delay:(\d+)(ms|s)?$/);if(e){t.push(`.debounce(${e[1]}${"s"===(e[2]||"ms")?"000":""})`);continue}const r=n.match(/^throttle:(\d+)(ms|s)?$/);r?t.push(`.throttle(${r[1]}${"s"===(r[2]||"ms")?"000":""})`):"once"!==n||t.push(".once")}return t.join("")}(o);e.confirm&&r.push(`if not js window.confirm('${e.confirm.replace(/'/g,"\\'")}') return end`);const l=t.tagName.toLowerCase();"form"!==l&&"a"!==l||r.push("halt the event");let c=`fetch '${e.url}'`;e.method&&"GET"!==e.method&&(c+=" via "+e.method),"form"===l?c+=" with values of me":e.vals&&(c+=" with "+e.vals),c+=" as html",r.push(c);const u=function(e,t){const n=iS[t]||t;return"none"===n?"":"delete"===n?"remove "+e:"before"===n?"put it before "+e:"after"===n?"put it after "+e:"start"===n?"put it at start of "+e:"end"===n?"put it at end of "+e:"morph"===n?`morph ${e} with it`:"innerHTML morph"===n?`morph innerHTML of ${e} with it`:"outerHTML"===n?`set ${e}'s outerHTML to it`:"put it into "+e}(e.target?oS(e.target):"me",e.swap||"innerHTML");u&&r.push("then "+u),e.pushUrl?r.push(`then push url '${1==e.pushUrl?e.url:e.pushUrl}'`):e.replaceUrl&&r.push(`then replace url '${1==e.replaceUrl?e.url:e.replaceUrl}'`);const p=`on ${a}${s}\n ${r.join("\n ")}`;return n.push(p),n.join("\n")}function lS(e){const t=e.attributes;for(let e=0;t.length>e;e++)if(t[e].name.startsWith("hx-"))return 1;return 0}function cS(e){return e.hasAttribute("fx-action")}function uS(e){return lS(e)||cS(e)}class pS{constructor(e,t,n,r={}){this.element=e,this.url=t,this.swapHandler=n,this.source=null,this.listeners=new Map,this.destroyed=0,this.reconnectAttempts=0,this.reconnectTimer=null,this.maxAttempts=r.maxAttempts??5,this.baseBackoffMs=r.baseBackoffMs??1e3,this.maxBackoffMs=r.maxBackoffMs??3e4,this.debug=r.debug??0,this.EventSourceCtor=r.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(e){if(this.destroyed)return;if(this.listeners.has(e))return;const t=e=>{this.swapHandler(e.type,e.data)};this.listeners.set(e,t),this.source&&this.source.addEventListener(e,t)}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(e){return this.dispatch("htmx:sseError",{url:this.url,error:e}),void this.scheduleReconnect()}this.source.onopen=()=>{this.reconnectAttempts=0,this.dispatch("htmx:sseOpen",{url:this.url})},this.source.onmessage=e=>{this.dispatch("htmx:sseMessage",{url:this.url,data:e.data})},this.source.onerror=e=>{this.dispatch("htmx:sseError",{url:this.url,event:e}),this.source&&2===this.source.readyState&&(this.closeSource(),this.scheduleReconnect())};for(const[e,t]of this.listeners)this.source.addEventListener(e,t)}}closeSource(){if(this.source){for(const[e,t]of this.listeners)try{this.source.removeEventListener(e,t)}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 e=Math.min(this.baseBackoffMs*Math.pow(2,this.reconnectAttempts),this.maxBackoffMs);this.reconnectAttempts++,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.open()},e)}dispatch(e,t){if("undefined"!=typeof CustomEvent)try{const n=new CustomEvent(e,{detail:t,bubbles:1,cancelable:0});this.element.dispatchEvent(n)}catch{}}}class mS{constructor(e,t,n,r={}){this.element=e,this.url=t,this.swapHandler=n,this.socket=null,this.destroyed=0,this.reconnectAttempts=0,this.reconnectTimer=null,this.outboundQueue=[],this.maxAttempts=r.maxAttempts??5,this.baseBackoffMs=r.baseBackoffMs??1e3,this.maxBackoffMs=r.maxBackoffMs??3e4,this.debug=r.debug??0,this.protocols=r.protocols,this.WSCtor=r.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(e){if(this.destroyed)return;const t="string"==typeof e?e:JSON.stringify(e);this.socket&&1===this.socket.readyState?this.socket.send(t):this.outboundQueue.push(t)}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(e){return this.dispatch("htmx:wsError",{url:this.url,error:e}),void this.scheduleReconnect()}this.socket.onopen=()=>{if(this.reconnectAttempts=0,this.dispatch("htmx:wsOpen",{url:this.url}),this.outboundQueue.length&&this.socket){for(const e of this.outboundQueue)try{this.socket.send(e)}catch(e){this.dispatch("htmx:wsError",{url:this.url,error:e})}this.outboundQueue=[]}},this.socket.onmessage=e=>{const t="string"==typeof e.data?e.data:e.data+"",n=function(e){if(!e||"{"!==e[0])return null;let t;try{t=JSON.parse(e)}catch{return null}return"object"!=typeof t||null===t||"string"!=typeof t.target||"string"!=typeof t.data?null:{target:t.target,swap:"string"==typeof t.swap?t.swap:void 0,data:t.data}}(t);n?this.swapHandler(n,n.data):this.dispatch("htmx:wsMessage",{url:this.url,data:t})},this.socket.onerror=e=>{this.dispatch("htmx:wsError",{url:this.url,event:e})},this.socket.onclose=e=>{this.dispatch("htmx:wsClose",{url:this.url,code:e.code,reason:e.reason}),this.socket=null,this.destroyed||e.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 e=Math.min(this.baseBackoffMs*Math.pow(2,this.reconnectAttempts),this.maxBackoffMs);this.reconnectAttempts++,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.open()},e)}dispatch(e,t){if("undefined"!=typeof CustomEvent)try{const n=new CustomEvent(e,{detail:t,bubbles:1,cancelable:0});this.element.dispatchEvent(n)}catch{}}}function dS(e){if("undefined"!=typeof HTMLFormElement&&e instanceof HTMLFormElement){const t=new FormData(e),n={};for(const[e,r]of t.entries())n[e]="string"==typeof r?r:r.name;return n}const t=e.getAttribute("name"),n=e.value;return t&&void 0!==n?{[t]:n+""}:{}}function fS(e){return e?e.split(/[-_]/)[0].toLowerCase():"en"}function yS(e){const t=e.getAttribute?.("data-hyperfixi-lang");if(t)return fS(t);const n=e.closest?.("[data-hyperfixi-lang]");if(n)return fS(n.getAttribute("data-hyperfixi-lang"));const r=e.closest?.("[lang]");return r?fS(r.getAttribute("lang")):"en"}const hS=new Map,vS=new Map,gS=new Set;let bS=0;const wS=new Set;function kS(){const e=new Set;for(const t of vS.values())for(const n of t.values())e.add(n);return[...e]}function zS(e,t){const n=fS(e),r=t?.hyperfixi??{};var i;hS.set(n,r),vS.set(n,function(e){const t=new Map;if(!e)return t;for(const[n,r]of Object.entries(e))t.set(r,n);return t}(r.attrs)),gS.delete(n),bS||(i={nameOf:(e,t,n)=>{const r=`${t}-${n}`,i=yS(e);if("en"===i)return r;const a=vS.get(i)?.get(r);return a||(hS.has(i)||gS.has(i)||(gS.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.`)),r)},selectorFor:(e,t)=>{const n=`${e}-${t}`,r=new Set([n]);for(const e of vS.values()){const t=e.get(n);t&&r.add(t)}return[...r].map(e=>`[${e}]`).join(", ")},eventNameOf:(e,t)=>{const n=yS(e);return"en"===n?t:hS.get(n)?.events?.[t]??t}},nS=i,bS=1);for(const e of wS)e()}function xS(e){for(const t of function(){const e=new Set(["hx-on:"]);for(const t of vS.values()){const n=t.get("hx-on");n&&e.add(n+":")}return[...e]}())if(e.startsWith(t))return e.slice(t.length);return null}!function(){if("undefined"==typeof window)return;const e=window;e.T||(e.T={register:zS})}();const ES=["get","post","put","patch","delete","target","swap","trigger","confirm","boost","vals","headers","push-url","replace-url","on","live"].filter(e=>"on"!==e).map(e=>"hx-"+e).concat(["sse-swap","ws-send"]),SS=["live"],TS=["fx-action","fx-method","fx-trigger","fx-target","fx-swap","fx-ignore"],jS=[...ES,...TS];function AS(e,t,n){return e.getAttribute(rS().nameOf(e,t,n))}function LS(e,t,n){return e.hasAttribute(rS().nameOf(e,t,n))}class OS{getSwapTemplate(e,t){const n=`${t.target??"me"}|${t.swap??"innerHTML"}`,r=this.swapTemplateCache.get(e);if(r&&r.sig===n)return r.build;const i=function(e){const t=e.swap??"innerHTML",n=oS(e.target??"me");switch(t){case"outerHTML":return e=>`set ${n}'s outerHTML to ${e}`;case"beforebegin":return e=>`put ${e} before ${n}`;case"afterend":return e=>`put ${e} after ${n}`;case"afterbegin":return e=>`put ${e} at start of ${n}`;case"beforeend":return e=>`put ${e} at end of ${n}`;case"none":return()=>"";case"delete":return()=>"remove "+n;default:return e=>`put ${e} into ${n}`}}(t);return this.swapTemplateCache.set(e,{sig:n,build:i}),i}dispatchLifecycleEvent(e,t,n,r={}){const i=new CustomEvent(t,{detail:n,bubbles:r.bubbles??1,cancelable:r.cancelable??1}),a=e.dispatchEvent(i);return!a&&this.options.debug&&console.log(`[${r.debugPrefix??"htmx"}-compat] ${t} cancelled`),a}constructor(e={}){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:e.processExisting??1,watchMutations:e.watchMutations??1,debug:e.debug??0,root:e.root??("undefined"!=typeof document?document.body:null),requestDropping:e.requestDropping??1,fixiEvents:e.fixiEvents??1,eventSourceCtor:e.eventSourceCtor,wsEventSourceCtor:e.wsEventSourceCtor},this.eventSourceCtor=e.eventSourceCtor,this.wsEventSourceCtor=e.wsEventSourceCtor}init(e){this.executeCallback=e,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 e of this.sseConnectionsSet)e.detach();this.sseConnectionsSet.clear();for(const e of this.wsConnectionsSet)e.detach();this.wsConnectionsSet.clear();for(const e of[...this.onHandlerElements])this.detachOnHandlers(e);this.executeCallback=null}attachSSE(e){const t=this.sseConnections.get(e);if(t)return t;const n=AS(e,"sse","connect");if(!n)return null;const r=new pS(e,n,(t,r)=>{const i={url:void 0,method:"GET",target:AS(e,"hx","target")??void 0,swap:AS(e,"hx","swap")??"innerHTML"},a=this.getSwapTemplate(e,i)(JSON.stringify(r));a&&(this.dispatchLifecycleEvent(e,"htmx:sseMessage",{url:n,event:t,data:r},{cancelable:0}),this.executeCallback&&this.executeCallback(a,e).catch(e=>{void 0!==console&&console.error("[sse-compat] swap execution failed:",e)}))},{EventSourceCtor:this.eventSourceCtor,debug:this.options.debug});this.sseConnections.set(e,r),this.sseConnectionsSet.add(r);const i=AS(e,"sse","swap");if(i)for(const e of i.split(",").map(e=>e.trim()).filter(Boolean))r.listenFor(e);return r}getSSEConnection(e){return this.sseConnections.get(e)??null}detachSSE(e){const t=this.sseConnections.get(e);t&&(t.detach(),this.sseConnections.delete(e),this.sseConnectionsSet.delete(t))}detachSSESubtree(e){if(this.detachSSE(e),"function"!=typeof e.querySelectorAll)return;const t=e.querySelectorAll(rS().selectorFor("sse","connect"));for(const e of t)this.detachSSE(e)}attachWS(e){const t=this.wsConnections.get(e);if(t)return t;const n=AS(e,"ws","connect");if(!n)return null;const r=new mS(e,n,(t,r)=>{const i={url:void 0,method:"GET",target:t.target,swap:t.swap??AS(e,"hx","swap")??"innerHTML"},a=this.getSwapTemplate(e,i)(JSON.stringify(t.data));a&&(this.dispatchLifecycleEvent(e,"htmx:wsMessage",{url:n,envelope:t,data:t.data},{cancelable:0}),this.executeCallback&&this.executeCallback(a,e).catch(e=>{void 0!==console&&console.error("[ws-compat] swap execution failed:",e)}))},{WSEventSourceCtor:this.wsEventSourceCtor,debug:this.options.debug});return this.wsConnections.set(e,r),this.wsConnectionsSet.add(r),this.wireWSSendDescendants(e,r),r}wireWSSendDescendants(e,t){if("function"!=typeof e.querySelectorAll)return;const n=rS().selectorFor("ws","send"),r=[];e.matches?.(n)&&r.push(e);for(const t of e.querySelectorAll(n))r.push(t);for(const e of r){if(this.wsSendListeners.has(e))continue;const n="FORM"===e.tagName?"submit":"click",r=r=>{"submit"===n&&r.preventDefault();const i=dS(e);t.send(i)};e.addEventListener(n,r),this.wsSendListeners.set(e,()=>e.removeEventListener(n,r))}}getWSConnection(e){return this.wsConnections.get(e)??null}detachWS(e){const t=this.wsConnections.get(e);if(t&&(t.detach(),this.wsConnections.delete(e),this.wsConnectionsSet.delete(t),"function"==typeof e.querySelectorAll)){const t=rS().selectorFor("ws","send"),n=[];e.matches?.(t)&&n.push(e);for(const r of e.querySelectorAll(t))n.push(r);for(const e of n){const t=this.wsSendListeners.get(e);t&&(t(),this.wsSendListeners.delete(e))}}}detachWSSubtree(e){if(this.detachWS(e),"function"!=typeof e.querySelectorAll)return;const t=e.querySelectorAll(rS().selectorFor("ws","connect"));for(const e of t)this.detachWS(e)}installOnHandlers(e,t){if(this.detachOnHandlers(e),!this.executeCallback)return;const n=this.executeCallback,r=new Map;for(const[i,a]of Object.entries(t)){const t=rS().eventNameOf(e,i),o=t=>{n(a,e).catch(e=>{void 0!==console&&console.error(`[htmx-compat] hx-on:${i} execution failed:`,e)})};e.addEventListener(t,o),r.set(t,()=>e.removeEventListener(t,o))}this.onHandlerListeners.set(e,r),this.onHandlerElements.add(e)}detachOnHandlers(e){const t=this.onHandlerListeners.get(e);if(t){for(const e of t.values())e();this.onHandlerListeners.delete(e),this.onHandlerElements.delete(e)}}detachOnHandlersSubtree(e){for(const t of this.findHxOnElements(e))this.detachOnHandlers(t)}scanForHtmxElements(e){const t=e??this.options.root;if(!t)return[];if(t.closest?.("[fx-ignore]"))return[];const n=function(){const e=rS(),t=[];for(const n of["get","post","put","patch","delete",...SS])t.push(e.selectorFor("hx",n));return t.push(e.selectorFor("sse","connect")),t.push(e.selectorFor("ws","connect")),t.push("[fx-action]"),t.join(", ")}(),r=new Set(t.querySelectorAll(n));t.matches?.(n)&&r.add(t);for(const e of this.findHxOnElements(t))r.add(e);return Array.from(r).filter(e=>!e.closest("[fx-ignore]"))}findHxOnElements(e){const t=[],n=e=>{const n=e.attributes;for(let r=0;n.length>r;r++)if(null!==xS(n[r].name))return void t.push(e)};if(n(e),"function"==typeof e.querySelectorAll)for(const t of e.querySelectorAll("*"))n(t);return t}collectAttributes(e){const t={};for(const n of["get","post","put","patch","delete"]){const r=AS(e,"hx",n);if(r){t.method=n.toUpperCase(),t.url=r;break}}const n=AS(e,"hx","target");n&&(t.target=n);const r=AS(e,"hx","swap");r&&(t.swap=r);const i=AS(e,"hx","trigger");i&&(t.trigger=i);const a=AS(e,"hx","confirm");a&&(t.confirm=a),"true"===AS(e,"hx","boost")&&(t.boost=1);const o=AS(e,"hx","vals");o&&(t.vals=o);const s=AS(e,"hx","headers");s&&(t.headers=s);const l=AS(e,"hx","push-url");l&&(t.pushUrl="true"===l?1:l);const c=AS(e,"hx","replace-url");c&&(t.replaceUrl="true"===c?1:c);const u={};for(const t of e.attributes){const e=xS(t.name);null!==e&&(u[e]=t.value)}Object.keys(u).length>0&&(t.onHandlers=u);const p=AS(e,"hx","live");return p&&(t.hxLive=p),t}collectFxAttributes(e){const t={},n=e.getAttribute("fx-action");n&&(t.url=n);const r=e.getAttribute("fx-method");t.method=r?.toUpperCase()||"GET";const i=e.getAttribute("fx-target");i&&(t.target=i);const a=e.getAttribute("fx-swap");t.swap=a||"outerHTML";const o=e.getAttribute("fx-trigger");return o&&(t.trigger=o),t}isFxElement(e){return e.hasAttribute("fx-action")}processElement(e){if(this.processedElements.has(e))return;LS(e,"sse","connect")&&this.attachSSE(e),LS(e,"ws","connect")&&this.attachWS(e);const t=this.isFxElement(e),n=t?this.collectFxAttributes(e):this.collectAttributes(e),r=t?"fx":"htmx";if(n.onHandlers&&this.installOnHandlers(e,n.onHandlers),!n.url&&!n.boost&&!n.hxLive)return;if(n.hxLive&&!ae().hasFeature("live")&&(void 0!==console&&console.error(`[${r}-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:`,e),delete n.hxLive,!n.url&&!n.boost))return;if(t&&this.options.fixiEvents&&!this.dispatchLifecycleEvent(e,"fx:init",{element:e,options:{}},{debugPrefix:"fx"}))return;if(!this.dispatchLifecycleEvent(e,"htmx:configuring",{config:n,element:e},{debugPrefix:r}))return;if(t&&this.options.fixiEvents){const t={cfg:{trigger:n.trigger||"click",method:n.method||"GET",action:n.url,headers:{},target:n.target,swap:n.swap||"outerHTML",body:null,drop:this.pendingRequests.has(e)?1:0,transition:1,preventTrigger:1,signal:(new AbortController).signal},element:e};if(!this.dispatchLifecycleEvent(e,"fx:config",t,{debugPrefix:"fx"}))return}const i=sS(n,e);if(this.options.debug&&console.log(`[${r}-compat] Translated:`,{element:e.tagName,config:n,hyperscript:i}),this.processedElements.add(e),this.executeCallback&&i){if(t&&this.options.requestDropping&&this.pendingRequests.has(e))return void(this.options.debug&&console.log("[fx-compat] Request dropped - pending request exists"));const a=new AbortController;if(t&&this.options.requestDropping&&this.pendingRequests.set(e,a),e.setAttribute(t?"data-fx-generated":"data-hx-generated",i),!this.dispatchLifecycleEvent(e,"htmx:beforeRequest",{element:e,url:n.url,method:n.method||"GET"},{debugPrefix:r}))return void this.pendingRequests.delete(e);if(t&&this.options.fixiEvents&&!this.dispatchLifecycleEvent(e,"fx:before",{element:e,url:n.url,method:n.method||"GET"},{debugPrefix:"fx"}))return void this.pendingRequests.delete(e);let o=1;this.executeCallback(i,e).then(()=>{t&&this.options.fixiEvents&&!this.dispatchLifecycleEvent(e,"fx:after",{cfg:{trigger:n.trigger||"click",method:n.method||"GET",action:n.url,headers:{},target:n.target,swap:n.swap||"outerHTML",body:null,drop:0,transition:1,preventTrigger:1,signal:a.signal,response:null,text:""},element:e},{debugPrefix:"fx"})||(this.dispatchLifecycleEvent(e,"htmx:afterSettle",{element:e,target:n.target},{cancelable:0}),t&&this.options.fixiEvents&&this.dispatchLifecycleEvent(e,"fx:swapped",{element:e,target:n.target},{cancelable:0,debugPrefix:"fx"}))}).catch(n=>{o=0,console.error(`[${r}-compat] Execution error:`,n);const i=n instanceof Error?n:Error(n+"");this.dispatchLifecycleEvent(e,"htmx:error",{element:e,error:i},{cancelable:0}),t&&this.options.fixiEvents&&this.dispatchLifecycleEvent(e,"fx:error",{element:e,error:i},{cancelable:0,debugPrefix:"fx"})}).finally(()=>{this.pendingRequests.delete(e),t&&this.options.fixiEvents&&this.dispatchLifecycleEvent(e,"fx:finally",{element:e,success:o},{cancelable:0,debugPrefix:"fx"}),t&&this.options.fixiEvents&&this.dispatchLifecycleEvent(e,"fx:inited",{element:e},{cancelable:0,bubbles:0,debugPrefix:"fx"})})}}processSubtree(e){const t=this.scanForHtmxElements(e);for(const e of t)this.processElement(e)}startObserver(){var e;this.observer=new MutationObserver(e=>{for(const t of e){for(const e of t.addedNodes)e instanceof Element&&this.processSubtree(e);for(const e of t.removedNodes)e instanceof Element&&(this.detachSSESubtree(e),this.detachWSSubtree(e),this.detachOnHandlersSubtree(e));if("attributes"===t.type&&t.target instanceof Element){const e=t.attributeName;null!=e&&(jS.includes(e)||null!==xS(e)||this.localizedAttrSet.has(e))&&(this.processedElements.delete(t.target),this.processElement(t.target))}}}),this.localizedAttrSet=new Set(kS()),this.unsubscribeVocab=(wS.add(e=()=>this.refreshLocalizedAttrs()),()=>{wS.delete(e)}),this.options.root&&this.observer.observe(this.options.root,{childList:1,subtree:1,attributes:1,attributeFilter:this.computeAttributeFilter()})}computeAttributeFilter(){const e=kS();return 0===e.length?jS:[...new Set([...jS,...e])]}refreshLocalizedAttrs(){this.localizedAttrSet=new Set(kS()),this.observer&&this.options.root&&(this.observer.disconnect(),this.observer.observe(this.options.root,{childList:1,subtree:1,attributes:1,attributeFilter:this.computeAttributeFilter()}))}manualProcess(e){return sS(this.isFxElement(e)?this.collectFxAttributes(e):this.collectAttributes(e),e)}hasPendingRequest(e){return this.pendingRequests.has(e)}abortPendingRequest(e){const t=this.pendingRequests.get(e);return t?(t.abort(),this.pendingRequests.delete(e),1):0}}!function(){const e=VE.getDefaultRuntime();VE.installPlugin(e,tS)}();let CS=null;async function NS(e,t){await VE.run(e,t)}function PS(e={}){const{processHyperscript:t=1,...n}=e;CS=new OS({processExisting:n.processExisting??1,watchMutations:n.watchMutations??1,debug:n.debug??0,root:n.root??document.body,requestDropping:n.requestDropping??1,fixiEvents:n.fixiEvents??1}),CS.init(NS),RS||"undefined"==typeof document||(RS=e=>{const t=e.detail,n=t?.elt??e.target;n&&"function"==typeof n.querySelector&&VE.processNode(n)},document.addEventListener("htmx:load",RS),document.addEventListener("htmx:after:process",RS)),e.debug&&console.log("[hyperfixi-hx-v4] htmx/fixi compatibility enabled")}let RS=null;function $S(){CS&&(CS.destroy(),CS=null),RS&&"undefined"!=typeof document&&(document.removeEventListener("htmx:load",RS),document.removeEventListener("htmx:after:process",RS),RS=null)}function IS(e){return new OS({processExisting:0,watchMutations:0}).manualProcess(e)}const MS={...VE,version:"2.0.0-hybrid-hx-v4",enableHtmxCompatibility:PS,disableHtmxCompatibility:$S,getHtmxProcessor:function(){return CS},translateHtmx:IS,hasHtmxAttributes:lS,hasFxAttributes:cS,hasAnyAttributes:uS,HtmxAttributeProcessor:OS,translateToHyperscript:sS,features:{htmx:1,fixi:1,hyperscript:1,reactivity:1,hxLive:1},htmxAttributes:ES,fixiAttributes:TS,fixiEvents:["fx:init","fx:inited","fx:config","fx:before","fx:after","fx:error","fx:finally","fx:swapped"]};if("undefined"!=typeof window){Object.assign(window.hyperfixi,MS);const e=()=>{PS({processExisting:1,watchMutations:1,processHyperscript:1,requestDropping:1,fixiEvents:1})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}let qS=null;async function _S(){return qS||(qS=await Promise.resolve().then(function(){return Xx})),qS}var DS=Object.freeze({__proto__:null,SemanticGrammarBridge:class{constructor(e={}){this.j=0,this.config={confidenceThreshold:e.confidenceThreshold??xk,fallbackOnLowConfidence:e.fallbackOnLowConfidence??1}}async initialize(){await _S(),this.j=1}isInitialized(){return this.j}async transform(e,t,n){if(this.isInitialized()||await this.initialize(),t===n)return{output:e,usedSemantic:0,confidence:1,sourceLang:t,targetLang:n};const r=await _S();try{const i=r.translate(e,t,n);if(i!==e)return{output:i,usedSemantic:1,confidence:.9,sourceLang:t,targetLang:n}}catch{}return{output:e,usedSemantic:0,confidence:0,sourceLang:t,targetLang:n}}async parse(e,t){return this.isInitialized()||await this.initialize(),(await _S()).parseSemantic(e,t).node??null}async render(e,t){return(await _S()).render(e,t)}async parseToAST(e,t){this.isInitialized()||await this.initialize();const n=await _S(),r=n.parseSemantic(e,t);if(r.confidence>=this.config.confidenceThreshold&&r.node)try{return n.buildAST(r.node).ast}catch(e){Ye.runtime("[SemanticGrammarBridge] AST build failed, using fallback:",e)}return null}async parseToASTWithDetails(e,t){this.isInitialized()||await this.initialize();const n=await _S(),r=n.parseSemantic(e,t);if(r.confidence>=this.config.confidenceThreshold&&r.node)try{const e=n.buildAST(r.node);return{ast:e.ast,usedDirectPath:1,confidence:r.confidence,lang:t,fallbackText:null,warnings:e.warnings}}catch{}if(r.node&&this.config.fallbackOnLowConfidence){const e=n.render(r.node,"en");return{ast:null,usedDirectPath:0,confidence:r.confidence,lang:t,fallbackText:e}}return{ast:null,usedDirectPath:0,confidence:r.confidence,lang:t,fallbackText:null}}async getAllTranslations(e,t){const n=(await _S()).getSupportedLanguages(),r={};for(const i of n)r[i]=await this.transform(e,t,i);return r}}});let VS=null;async function HS(){if(!VS)try{VS=await Promise.resolve().then(function(){return fp})}catch{throw Error("@lokascript/framework is required for LSE support. Install it: npm install @lokascript/framework")}return VS}var FS=Object.freeze({__proto__:null,fromEnvelopeJSON:async function(e){return(await HS()).fromEnvelopeJSON(e)},fromInterchangeNode:async function(e){return(await HS()).fromInterchangeNode(e)},fromProtocolJSON:async function(e){return(await HS()).fromProtocolJSON(e)},isEnvelope:async function(e){return(await HS()).isEnvelope(e)},isExplicitSyntax:async function(e){return(await HS()).isExplicitSyntax(e)},isLSEAvailable:function(){if(VS)return 1;try{return require.resolve("@lokascript/framework"),1}catch{return 0}},parseExplicit:async function(e,t){return(await HS()).parseExplicit(e,t)},renderExplicit:async function(e){return(await HS()).renderExplicit(e)},semanticNodeToRuntimeAST:async function(e){return(await HS()).semanticNodeToRuntimeAST(e)},toEnvelopeJSON:async function(e){return(await HS()).toEnvelopeJSON(e)},toProtocolJSON:async function(e){return(await HS()).toProtocolJSON(e)},validateProtocolJSON:async function(e){return(await HS()).validateProtocolJSON(e)}});e.FIXI_ATTRS=TS,e.HTMX_ATTRS=ES,e.HtmxAttributeProcessor=OS,e.default=MS,e.disableHtmxCompatibility=$S,e.enableHtmxCompatibility=PS,e.hasAnyAttributes=uS,e.hasFxAttributes=cS,e.translateHtmx=IS,Object.defineProperty(e,"A",{value:1})}({});
|