@hyperfixi/core 2.6.0 → 2.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/api/hyperscript-api.d.ts +6 -0
  2. package/dist/ast-utils/index.js +8 -8
  3. package/dist/ast-utils/index.mjs +8 -8
  4. package/dist/bundle-generator/index.js +12 -4
  5. package/dist/bundle-generator/index.mjs +12 -4
  6. package/dist/chunks/{bridge-fFLEvCQs.js → bridge-lZbOVRDD.js} +2 -2
  7. package/dist/chunks/browser-modular-DegkWQ8d.js +2 -0
  8. package/dist/chunks/{index-BRgVy8nY.js → index-i_j9Z-1e.js} +2 -2
  9. package/dist/commands/data/set.d.ts +1 -0
  10. package/dist/commands/index.js +156 -47
  11. package/dist/commands/index.mjs +156 -47
  12. package/dist/core/context.d.ts +4 -0
  13. package/dist/dom/attribute-processor.d.ts +1 -0
  14. package/dist/hyperfixi-browser-classic-i18n.js +1 -1
  15. package/dist/hyperfixi-browser-minimal.js +1 -1
  16. package/dist/hyperfixi-browser-standard.js +1 -1
  17. package/dist/hyperfixi-browser.js +1 -1
  18. package/dist/hyperfixi-classic-i18n.js +1 -1
  19. package/dist/hyperfixi-hx-v4.js +1 -1
  20. package/dist/hyperfixi-hx.js +1 -1
  21. package/dist/hyperfixi-hybrid-complete.js +1 -1
  22. package/dist/hyperfixi-hybrid-hx.js +1 -1
  23. package/dist/hyperfixi-lite-plus.js +1 -1
  24. package/dist/hyperfixi-lite.js +1 -1
  25. package/dist/hyperfixi-minimal.js +1 -1
  26. package/dist/hyperfixi-multilingual.js +1 -1
  27. package/dist/hyperfixi-standard.js +1 -1
  28. package/dist/hyperfixi.js +1 -1
  29. package/dist/hyperfixi.mjs +1 -1
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.js +694 -459
  32. package/dist/index.min.js +1 -1
  33. package/dist/index.mjs +691 -460
  34. package/dist/lokascript-browser-classic-i18n.js +1 -1
  35. package/dist/lokascript-browser-minimal.js +1 -1
  36. package/dist/lokascript-browser-standard.js +1 -1
  37. package/dist/lokascript-browser.js +1 -1
  38. package/dist/lokascript-hybrid-complete.js +1 -1
  39. package/dist/lokascript-hybrid-hx.js +1 -1
  40. package/dist/lokascript-lite-plus.js +1 -1
  41. package/dist/lokascript-lite.js +1 -1
  42. package/dist/lokascript-multilingual.js +1 -1
  43. package/dist/parser/full-parser.js +70 -35
  44. package/dist/parser/full-parser.mjs +70 -35
  45. package/dist/parser/parser-types.d.ts +1 -1
  46. package/dist/parser/parser.d.ts +2 -0
  47. package/dist/parser/regex-parser.js +23 -14
  48. package/dist/parser/regex-parser.mjs +23 -14
  49. package/dist/registry/index.js +178 -45
  50. package/dist/registry/index.mjs +178 -45
  51. package/dist/types/core-context.d.ts +1 -0
  52. package/package.json +6 -6
  53. package/dist/chunks/browser-modular-BK3IOo93.js +0 -2
  54. package/dist/compatibility/browser-bundle.d.ts +0 -164
@@ -1,2 +0,0 @@
1
- import{v as e}from"./feature-sockets-CrYvjZ4j.js";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 r(e){return{ok:!0,value:e}}function n(e){return{ok:!1,error:e}}function i(e){return!0===e.ok}const a="then",o="else",s="end",l="and",c="if",u="for",p="while",m="until",d="forever",f="times",h="each",y="index",v="in",g="to",k="from",b="with",w="of",z="by",x="between",E="on",T="event",S="def",C="behavior",A="global",L="local",j="the",P="start",O=[a,l,o,s,E],N=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"]),I=new Set(["put","trigger","send","remove","take","toggle","set","show","hide","add","halt","measure","js","tell","pick","start","swap","morph","push","replace","process"]),R=new Set(["if","unless","repeat","wait","for","while"]),M="at",W="at start of",_="at end of",q=["into","before","after",M,W,_,"at the start of","at the end of"],$=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"]),V={isCommand:e=>N.has(e.toLowerCase()),isCompoundCommand:e=>I.has(e.toLowerCase()),isControlFlowCommand:e=>R.has(e.toLowerCase()),isKeyword:e=>$.has(e.toLowerCase()),isTerminator:e=>O.includes(e),isPutOperation:e=>q.includes(e),isCSSFunction:e=>D.has(e.toLowerCase())},D=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"]),B=new Set(["me","it","you","result","my","its","your"]),H=new Set(["and","or","not","no"]),F=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","am in","am not in","am between","am not between","is really","is not really","is equal","is not equal","contain","do not contain","does not contains","do not match","does not match","ignoring case","sorted by","mapped to","split by","joined by"]),K=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"]),U=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"]),G=new Set(["then","end","to","into","on","with","from","in","by","for","while","until","unless","else","catch","finally"]),Y=new Set([")","]","}",","]);function Z(e,t){return{infix:{bp:[e,e+1],handler:t??((t,r,n)=>{const i=n.parseExpr(e+1);return{type:"binaryExpression",operator:r.value,left:t,right:i,start:t.start,end:i.end??r.end,line:t.line??r.line,column:t.column??r.column}})}}}function J(e,t){return{infix:{bp:[e+1,e],handler:(t,r,n)=>{const i=n.parseExpr(e);return{type:"binaryExpression",operator:r.value,left:t,right:i,start:t.start,end:i.end??r.end,line:t.line??r.line,column:t.column??r.column}}}}}function X(e,t){return{prefix:{bp:e,handler:t??((t,r)=>{const n=r.parseExpr(e);return{type:"unaryExpression",operator:t.value,operand:n,argument:n,prefix:!0,start:t.start,end:n.end??t.end,line:t.line,column:t.column}})}}}const Q=new Map([["or",Z(10)],["||",Z(10)],["and",Z(20)],["&&",Z(20)],["==",Z(30)],["!=",Z(30)],["<",Z(30)],[">",Z(30)],["<=",Z(30)],[">=",Z(30)],["is",Z(30)],["matches",Z(30)],["contains",Z(30)],["starts with",Z(30)],["ends with",Z(30)],["does not start with",Z(30)],["does not end with",Z(30)],["is between",Z(30,(e,t,r)=>{const n=r.parseExpr(31),i=r.peek();if(!i||"and"!==i.value.toLowerCase())throw Error("between requires 'and' between min and max operands, got: "+(i?.value??"<end>"));r.advance();const a=r.parseExpr(31);return{type:"betweenExpression",value:e,min:n,max:a,negated:!1,start:e.start,end:a.end}})],["is not between",Z(30,(e,t,r)=>{const n=r.parseExpr(31),i=r.peek();if(!i||"and"!==i.value.toLowerCase())throw Error("between requires 'and' between min and max operands, got: "+(i?.value??"<end>"));r.advance();const a=r.parseExpr(31);return{type:"betweenExpression",value:e,min:n,max:a,negated:!0,start:e.start,end:a.end}})],["am between",Z(30,(e,t,r)=>{const n=r.parseExpr(31),i=r.peek();if(!i||"and"!==i.value.toLowerCase())throw Error("between requires 'and' between min and max operands, got: "+(i?.value??"<end>"));r.advance();const a=r.parseExpr(31);return{type:"betweenExpression",value:e,min:n,max:a,negated:!1,start:e.start,end:a.end}})],["am not between",Z(30,(e,t,r)=>{const n=r.parseExpr(31),i=r.peek();if(!i||"and"!==i.value.toLowerCase())throw Error("between requires 'and' between min and max operands, got: "+(i?.value??"<end>"));r.advance();const a=r.parseExpr(31);return{type:"betweenExpression",value:e,min:n,max:a,negated:!0,start:e.start,end:a.end}})],["ignoring case",{infix:{bp:[25,26],handler:(e,t,r)=>(e.ignoringCase=!0,e)}}],["where",Z(28,(e,t,r)=>{const n=r.parseExpr(29);return{type:"collectionExpression",operator:"where",collection:e,right:n,start:e.start,end:n.end}})],["sorted by",Z(28,(e,t,r)=>{const n=r.parseExpr(29);let i="asc";const a=r.peek();if(a&&"string"==typeof a.value){const e=a.value.toLowerCase();"asc"===e||"ascending"===e?(r.advance(),i="asc"):"desc"!==e&&"descending"!==e||(r.advance(),i="desc")}return{type:"collectionExpression",operator:"sorted by",collection:e,right:n,order:i,start:e.start,end:n.end}})],["mapped to",Z(28,(e,t,r)=>{const n=r.parseExpr(29);return{type:"collectionExpression",operator:"mapped to",collection:e,right:n,start:e.start,end:n.end}})],["split by",Z(28,(e,t,r)=>{const n=r.parseExpr(29);return{type:"collectionExpression",operator:"split by",collection:e,right:n,start:e.start,end:n.end}})],["joined by",Z(28,(e,t,r)=>{const n=r.parseExpr(29);return{type:"collectionExpression",operator:"joined by",collection:e,right:n,start:e.start,end:n.end}})],["+",{...Z(40),...X(80)}],["-",{...Z(40),...X(80)}],["*",Z(50)],["/",Z(50)],["%",Z(50)],["mod",Z(50)],["^",J(60)],["**",J(60)],["as",Z(70,(e,t,r)=>{const n=()=>{const e=r.peek();!e||"a"!==e.value&&"an"!==e.value||r.advance();const t=r.parseExpr(71),n=r.peek();if(n&&":"===n.value&&t&&"identifier"===t.type){r.advance();const e=r.advance();e&&void 0!==e.value&&(t.name=`${t.name}:${e.value}`,t.end=e.end)}return t};let i=n(),a={type:"asExpression",expression:e,targetType:i,start:e.start,end:i.end??t.end,line:e.line??t.line,column:e.column??t.column};for(;r.peek()&&"|"===r.peek().value;){r.advance();const e=n();a={type:"asExpression",expression:a,targetType:e,start:a.start,end:e.end??a.end,line:a.line,column:a.column}}return a})],["not",X(80)],["!",X(80)],["no",X(27)]]);function ee(e){return(t,r,n)=>{const i=n.advance();if(!i||!i.value)throw Error(`Type check requires a type name after 'is ${e?"not ":""}a/an', got: <end>`);let a=!0;const o=n.peek();return o&&"!"===o.value&&(n.advance(),a=!1),{type:"typeCheckExpression",value:t,typeName:i.value,nullOk:a,negated:e,start:t.start,end:i.end}}}const te=function(...e){const t=new Map;for(const r of e)for(const[e,n]of r){const r=t.get(e);t.set(e,r?{prefix:n.prefix??r.prefix,infix:n.infix??r.infix}:{...n})}return t}(Q,new Map([["===",Z(30)],["!==",Z(30)],["is not",Z(30)],["am",Z(30)],["is in",Z(30)],["is not in",Z(30)],["precedes",Z(30)],["does not precede",Z(30)],["follows",Z(30)],["does not follow",Z(30)],["is a",Z(30,ee(!1))],["is an",Z(30,ee(!1))],["is not a",Z(30,ee(!0))],["is not an",Z(30,ee(!0))],["has",Z(30)],["have",Z(30)],["match",Z(30)],["include",Z(30)],["includes",Z(30)],["equals",Z(30)],["does not contain",Z(30)],["does not include",Z(30)],["am in",Z(30)],["am not in",Z(30)],["is really",Z(30)],["is not really",Z(30)],["is equal",Z(30)],["is not equal",Z(30)],["contain",Z(30)],["do not contain",Z(30)],["does not contains",Z(30)],["do not match",Z(30)],["does not match",Z(30)],["is equal to",Z(30)],["is not equal to",Z(30)],["is really equal to",Z(30)],["is not really equal to",Z(30)],["really equals",Z(30)],["is greater than",Z(30)],["is less than",Z(30)],["is greater than or equal to",Z(30)],["is less than or equal to",Z(30)],["in",Z(30)],["of",J(30)],["really",Z(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:!1,start:e.start})}}],["does not exist",{infix:{bp:[30,31],handler:(e,t)=>({type:"unaryExpression",operator:t.value,operand:e,prefix:!1,start:e.start})}}],["is empty",{infix:{bp:[30,31],handler:(e,t)=>({type:"unaryExpression",operator:t.value,operand:e,prefix:!1,start:e.start})}}],["is not empty",{infix:{bp:[30,31],handler:(e,t)=>({type:"unaryExpression",operator:t.value,operand:e,prefix:!1,start:e.start})}}],["some",X(80)]]),new Map([["=",J(5)]])),re=new Map,ne=new Map,ie=new Map,ae=new Set,oe=new Set,se=new Set,le=new Set;function ce(e){return re.get(e.toLowerCase())}function ue(e){return ie.get(e)}function pe(e,t){if(0!==oe.size)for(const r of oe)try{r(e,t)}catch(e){}}function me(e,t,r){if(0!==se.size)for(const n of se)try{n(e,t,r)}catch(e){}}function de(e,t){if(0!==le.size)for(const r of le)try{r(e,t)}catch(e){}}function fe(e,t,r){if(e.globals.set(t,r),0!==ae.size)for(const n of ae)try{n(t,r,e)}catch(e){}}const he=new class{constructor(e={}){this.types=new Map,this.coercionCache=new Map,this.config={strictMode:!1,cacheCoercions:!0,...e},this.registerBuiltinTypes()}register(e){this.types.has(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,r]of this.types)if(r.isType(e))return t;return"Unknown"}getHyperScriptType(e){const t=this.inferType(e),r=this.types.get(t);return r?.hyperscriptType??"unknown"}coerce(e,t,r){const n=this.types.get(t);if(!n){if(this.config.strictMode)throw Error("Unknown target type: "+t);return null}if(n.isType(e))return e;if(this.config.cacheCoercions){const r=`${this.inferType(e)}:${t}:${JSON.stringify(e)}`;if(this.coercionCache.has(r))return this.coercionCache.get(r)}const i=this.inferType(e),a=n.coerceFrom?.[i];if(a){const n=a(e,r);if(this.config.cacheCoercions&&null!==n){const r=`${i}:${t}:${JSON.stringify(e)}`;this.coercionCache.set(r,n)}return n}return n.defaultValue}canCoerce(e,t){const r=this.types.get(t);if(!r)return!1;if(r.isType(e))return!0;const n=this.inferType(e);return void 0!==r.coerceFrom?.[n]}getCoercionInfo(e,t){const r=this.types.get(t);return r&&(e===t||r.coerceFrom?.[e])?{possible:!0,direct:!0}:{possible:!1,direct:!1}}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:!1,description:"True or false value",examples:[!0,!1],coerceFrom:{String:e=>{const t=e.toLowerCase().trim();return"true"===t||"yes"===t||"1"===t||"false"!==t&&"no"!==t&&"0"!==t&&""!==t&&t.length>0},Number:e=>0!==e,Null:()=>!1,Undefined:()=>!1,Array:e=>!!Array.isArray(e)&&e.length>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 r=e;if(r.startsWith("#")||r.startsWith(".")||r.match(/^[\w-]+$/))try{return document.querySelector(r)}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,r)=>{t[r+""]=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=>!0,defaultValue:null,description:"Unknown/any value type"})}};function ye(e){const t=he.get("String");return t?t.isType(e):"string"==typeof e}function ve(e){const t=he.get("Number");return t?t.isType(e):"number"==typeof e}function ge(e){const t=he.get("Boolean");return t?t.isType(e):"boolean"==typeof e}function ke(e){const t=he.get("Object");return t?t.isType(e):"object"==typeof e&&null!==e}function be(e){const t=he.get("Function");return t?t.isType(e):"function"==typeof e}function we(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&1===e.nodeType&&"style"in e}function ze(e){return e instanceof Element}function xe(e){return e instanceof HTMLElement}const Ee=new Set(["disabled","readonly","required","checked","selected","hidden","open","autofocus","autoplay","controls","loop","muted","multiple","reversed","defer","async","novalidate","formnovalidate","ismap"]);function Te(e,t){return Ee.has(t.toLowerCase())?e.hasAttribute(t):e.getAttribute(t)}const Se={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!1;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=>we(e)?e.tabIndex:void 0,hidden:e=>we(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,next:e=>e.nextElementSibling,previous: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 r=e.getAttribute("name");r&&"value"in e&&t.append(r,e.value)}),t}(e)};function Ce(e,t){if(t.startsWith("*"))return function(e,t){if(!xe(e))return;if(t.startsWith("computed-"))return getComputedStyle(e).getPropertyValue(t.slice(9))||"";const r=t.replace(/-([a-z])/g,(e,t)=>t.toUpperCase());return e.style[r]}(e,t.slice(1));if(t.startsWith("computed-")){const r=t.slice(9);if(xe(e)){return getComputedStyle(e).getPropertyValue(r)}return}if(t.startsWith("@")){return Te(e,t.slice(1))}const r=Se[t.toLowerCase()];if(r)return r(e);if(function(e,t){return e.hasAttribute(t)}(e,t))return Te(e,t);const n=e[t];return be(n)?n.bind(e):n}const Ae={1:"one",2:"two",3:"three",4:"four",5:"five"};function Le(e,t,r,n){if(e.length!==t){const e=n?` (${n})`:"";return`${r} requires exactly ${i=t,Ae[i]??i+""} argument${1===t?"":"s"}${e}`}var i;return null}function je(e,t,r,n){if("string"!=typeof e[t]){return`${r} ${n||"argument "+(t+1)} must be a string`}return null}function Pe(e,t,r){return Le(e,1,t,r)??je(e,0,t,r)}function Oe(e,t){return Le(e,2,t,"left, right")}function Ne(){return null}function Ie(e,t,r,n){if(e.length>t){return`${r} expression takes at most ${1===t?"one":t+""} argument${1===t?"":"s"}${n?` (${n})`:""}`}return null}function Re(e,t,r,n,i){if(t>e.length||e.length>r){return`${n} requires ${t}-${r} arguments${i?` (${i})`:""}`}return null}class Me{trackPerformance(e,t,r,n){e.evaluationHistory&&e.evaluationHistory.push({expressionName:this.name,category:this.category,input:t,output:r.success?r.value:r.error,timestamp:n,duration:Date.now()-n,success:r.success})}trackSimple(e,t,r,n=(r?"success":"error")){e.evaluationHistory&&e.evaluationHistory.push({expressionName:this.name,category:this.category,input:"operation",output:n,timestamp:t,duration:Date.now()-t,success:r})}toBoolean(e){return!1!==e&&0!==e&&0n!==e&&""!==e&&null!=e&&(!ve(e)||!isNaN(e))}success(e,t){return{success:!0,value:e,type:t}}failure(e,t,r,n,i=[]){return{success:!1,error:{name:e,type:t,message:r,code:n,suggestions:i}}}validationSuccess(){return{isValid:!0,errors:[],suggestions:[]}}validationFailure(e,t,r=[]){return{isValid:!1,errors:[{type:e,message:t,suggestions:r}],suggestions:r}}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":ke(e)?"object":typeof e}inferEvaluationType(e){return void 0===e?"Undefined":null===e?"Null":ye(e)?"String":ve(e)?"Number":ge(e)?"Boolean":Array.isArray(e)?"Array":this.isElement(e)?"Element":"Object"}normalizeCollection(e){return Array.isArray(e)?e:e instanceof NodeList?Array.from(e):ye(e)?e.split(""):null==e?[]:ke(e)&&Symbol.iterator in e?Array.from(e):[]}toNumber(e){if(ve(e)&&Number.isFinite(e))return e;if(ye(e)){const t=Number(e);return Number.isFinite(t)?t:null}return ge(e)?e?1:0:null}}function We(e,t,r,n,i="runtime-error"){return{success:!1,error:{name:e+"ConversionError",type:i,message:r,code:t,suggestions:n}}}function _e(e,t){return{success:!0,value:e,type:t}}function qe(e,t){return`${e}: ${t instanceof Error?t.message:t+""}`}const $e={Array:(e,t)=>{try{return Array.isArray(e)?_e(e,"array"):e instanceof NodeList?_e(Array.from(e),"array"):_e(null==e?[]:[e],"array")}catch(e){return We("Array","ARRAY_CONVERSION_FAILED",qe("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?_e("","string"):ye(e)?_e(e,"string"):ke(e)?_e(JSON.stringify(e),"string"):_e(e+"","string")}catch(e){return We("String","STRING_CONVERSION_FAILED",qe("Failed to convert value to String",e),["Check if object has circular references","Ensure value is serializable"])}},Boolean:(e,t)=>{try{if(ge(e))return _e(e,"boolean");if(null==e)return _e(!1,"boolean");if(ye(e)){const t=e.toLowerCase().trim();return _e("false"!==t&&"0"!==t&&""!==t,"boolean")}return ve(e)?_e(0!==e&&!isNaN(e),"boolean"):_e(!!e,"boolean")}catch(e){return We("Boolean","BOOLEAN_CONVERSION_FAILED",qe("Failed to convert value to Boolean",e),["Use explicit true/false values","Check for unexpected data types"])}},Number:(e,t)=>{try{if(ve(e))return _e(e,"number");if(null==e)return _e(0,"number");const t=Number(e);return isNaN(t)?We("Number","INVALID_NUMBER",`Cannot convert "${e}" to a valid number`,["Check if value contains non-numeric characters","Use a valid numeric format"],"invalid-argument"):_e(t,"number")}catch(e){return We("Number","NUMBER_CONVERSION_FAILED",qe("Failed to convert value to Number",e),["Ensure value is convertible to number","Check for special characters"])}},Int:(e,t)=>{const r=$e.Number(e,t);return r.success?_e(Math.trunc(r.value),"number"):r},Float:(e,t)=>{const r=$e.Number(e,t);return r.success?_e(parseFloat(""+r.value),"number"):r},Date:(e,t)=>{try{if(e instanceof Date)return _e(e,"object");if(null==e)return _e(new Date(""),"object");if(ye(e)&&/^\d{4}-\d{2}-\d{2}$/.test(e)){const[t,r,n]=e.split("-").map(Number);return _e(new Date(t,r-1,n),"object")}const t=new Date(e);return isNaN(t.getTime())?We("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"):_e(t,"object")}catch(e){return We("Date","DATE_CONVERSION_FAILED",qe("Failed to convert value to Date",e),["Check date format","Ensure value is a valid date string or timestamp"])}},JSON:(e,t)=>{if(!ye(e))return _e(e,"object");try{return _e(JSON.parse(e),"object")}catch(e){return We("JSON","JSON_PARSE_FAILED",qe("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 _e(JSON.stringify(e),"string")}catch(e){return We("JSONString","JSON_STRINGIFY_FAILED",qe("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(ke(e))return _e(e,"object");if(ye(e))try{return _e(JSON.parse(e),"object")}catch(e){return We("Object","JSON_PARSE_FAILED",qe("Cannot parse JSON string",e),["Check JSON syntax","Ensure proper escaping of quotes","Validate JSON format"],"syntax-error")}return _e({},"object")}catch(e){return We("Object","OBJECT_CONVERSION_FAILED",qe("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 _e(Fe(e),"object");if(e instanceof HTMLElement){const t=e.querySelectorAll("input, select, textarea"),r={};return t.forEach(e=>{const t=e;if(t.name){const e=Ke(t);void 0!==e&&(r[t.name]=e)}}),_e(r,"object")}return _e({},"object")}catch(e){return We("FormValues","FORM_VALUES_EXTRACTION_FAILED",qe("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 r=e;if(e instanceof HTMLElement){const n=$e.Values(e,t);if(!n.success)return n;r=n.value}if(!ke(r))return _e("","string");const n=new URLSearchParams;for(const[e,t]of Object.entries(r))if(null!=t)if(Array.isArray(t))for(const r of t)n.append(e,r+"");else n.append(e,t+"");return _e(""+n,"string")}catch(e){return We("FormEncoded","FORM_ENCODE_FAILED",qe("Failed to URL-encode values",e),["Ensure input is a form element or plain object of scalar/array values"])}},Set:(e,t)=>{try{return _e(new Set(e),"object")}catch(e){return We("Set","SET_CONVERSION_FAILED",qe("Failed to convert to Set",e),["Ensure the value is iterable"])}},Map:(e,t)=>{try{return _e(new Map(Object.entries(e??{})),"object")}catch(e){return We("Map","MAP_CONVERSION_FAILED",qe("Failed to convert to Map",e),["Ensure the value is a plain object"])}},Keys:(e,t)=>e instanceof Map?_e(Array.from(e.keys()),"array"):_e(Object.keys(e??{}),"array"),Entries:(e,t)=>e instanceof Map?_e(Array.from(e.entries()),"array"):_e(Object.entries(e??{}),"array"),Reversed:(e,t)=>{try{return _e(Array.from(e).reverse(),"array")}catch(e){return We("Reversed","REVERSED_CONVERSION_FAILED",qe("Failed to reverse value",e),["Ensure the value is array-like"])}},Unique:(e,t)=>{try{return _e([...new Set(e)],"array")}catch(e){return We("Unique","UNIQUE_CONVERSION_FAILED",qe("Failed to dedupe value",e),["Ensure the value is iterable"])}},Flat:(e,t)=>{try{return _e(Array.from(e).flat(),"array")}catch(e){return We("Flat","FLAT_CONVERSION_FAILED",qe("Failed to flatten value",e),["Ensure the value is array-like"])}}},Ve=e.object({value:e.any(),type:e.string().min(1)});const De=e.object({value:e.any(),type:e.string().min(1)});new class extends Me{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=Ve,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:!1,examples:['"123"',"form","[1,2,3]","true","null"]},{name:"type",type:"string",description:"Target conversion type",optional:!1,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 r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:{name:"AsExpressionValidationError",type:"validation-error",message:n.errors[0]?.message||"Invalid input",code:"VALIDATION_FAILED",suggestions:n.suggestions}};const{value:i,type:a}=t;if(a.startsWith("Fixed")){const n=a.match(/^Fixed:(\d+)$/),o=n?parseInt(n[1],10):0,s=$e.Number(i,e);if(!s.success)return s;const l={success:!0,value:s.value.toFixed(o),type:"string"};return this.trackPerformance(e,t,l,r),l}let o=$e[a];if(o){const n=o(i,e);return this.trackPerformance(e,t,n,r),n}const s=a.toLowerCase(),l={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"}[s];if(l&&(o=$e[l],o)){const n=o(i,e);return this.trackPerformance(e,t,n,r),n}const c={success:!1,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,c,r),c}catch(n){const i={success:!1,error:{name:"AsExpressionError",type:"runtime-error",message:"Conversion failed: "+(n instanceof Error?n.message:n+""),code:"CONVERSION_FAILED",suggestions:["Check value and type compatibility","Ensure value is convertible to target type"]}};return this.trackPerformance(e,t,i,r),i}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?{isValid:!0,errors:[],suggestions:[]}:{isValid:!1,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 Me{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=De,this.metadata={category:"Conversion",complexity:"simple",sideEffects:[],dependencies:[],returnTypes:["Boolean"],examples:[{input:"42 is number",description:"Check if value is a number",expectedOutput:!0},{input:"null is empty",description:"Check if value is empty/null",expectedOutput:!0},{input:"element is Element",description:"Check if value is DOM element",expectedOutput:!0,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:!1,examples:["42","null","element",'"text"',"[]"]},{name:"type",type:"string",description:"Type name to check against",optional:!1,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 r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:{name:"IsExpressionValidationError",type:"validation-error",message:n.errors[0]?.message||"Invalid input",code:"VALIDATION_FAILED",suggestions:n.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=ye(i);break;case"number":s=ve(i)&&!isNaN(i);break;case"boolean":s=ge(i);break;case"object":s=ke(i);break;case"array":s=Array.isArray(i);break;case"function":s=be(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||ke(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,r),l}catch(n){const i=this.failure("IsExpressionError","type-mismatch","Type check failed: "+(n instanceof Error?n.message:n+""),"TYPE_CHECK_FAILED",["Check type name spelling","Ensure value is accessible"]);return this.trackPerformance(e,t,i,r),i}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:!1,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 Be={conversions:{dynamicResolvers:[]}},He={Array:e=>Array.isArray(e)?e:e instanceof NodeList?Array.from(e):null==e?[]:[e],String:e=>null==e?"":ye(e)?e:ke(e)?JSON.stringify(e):e+"",Boolean:e=>{if(ge(e))return e;if(null==e)return!1;if(ye(e)){const t=e.toLowerCase().trim();return"false"!==t&&"0"!==t&&""!==t}return ve(e)?0!==e&&!isNaN(e):!!e},Number:e=>{if(ve(e))return e;if(null==e)return 0;const t=Number(e);return isNaN(t)?0:t},Math:e=>{if(ve(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(!ve(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 0}},Int:e=>{const t=He.Number(e);return Math.trunc(t)},Float:e=>{const t=He.Number(e);return parseFloat(""+t)},Date:e=>{if(e instanceof Date)return e;if(null==e)return new Date(NaN);if(ye(e)&&/^\d{4}-\d{2}-\d{2}$/.test(e)){const[t,r,n]=e.split("-").map(Number);return new Date(t,r-1,n)}return new Date(e)},JSON:e=>{if(!ye(e))return e;try{return JSON.parse(e)}catch{return e}},JSONString:e=>{try{return JSON.stringify(e)}catch{return"{}"}},Object:e=>{if(ke(e))return e;if(ye(e))try{return JSON.parse(e)}catch(e){return{}}return{}},Fragment:e=>{const t=document.createDocumentFragment(),r=Array.isArray(e)||e instanceof NodeList?Array.from(e):[e];for(const e of r)if(e instanceof Node)t.append(e);else{const r=document.createElement("template");r.innerHTML=null==e?"":e+"",t.append(r.content)}return t},HTML:e=>ye(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:He.String(e)).join(""):e instanceof Element?e.outerHTML:He.String(e),Values:(e,t)=>{if(e instanceof HTMLFormElement)return Fe(e);if(e instanceof HTMLElement){const t=e.querySelectorAll("input, select, textarea"),r={};return t.forEach(e=>{e.name&&(r[e.name]=Ke(e))}),r}return{}},FormEncoded:(e,t)=>{const r=e instanceof HTMLElement?He.Values(e,t):e;if(!ke(r))return"";const n=new URLSearchParams;for(const[e,t]of Object.entries(r))if(null!=t)if(Array.isArray(t))for(const r of t)n.append(e,r+"");else n.append(e,t+"");return""+n},Set:e=>new Set(e),Map:e=>new Map(Object.entries(e??{})),Keys:e=>e instanceof Map?Array.from(e.keys()):Object.keys(e??{}),Entries:e=>e instanceof Map?Array.from(e.entries()):Object.entries(e??{}),Reversed:e=>Array.from(e).reverse(),Unique:e=>[...new Set(e)],Flat:e=>Array.from(e).flat(),"Values:Form":(e,t)=>{const r=He.Values(e,t);return He.FormEncoded(r,t)},"Values:JSON":(e,t)=>{const r=He.Values(e,t);return JSON.stringify(r)}};function Fe(e){const t={};return e.querySelectorAll("input, select, textarea").forEach(e=>{const r=e;if(r.name){const e=Ke(r);void 0!==e&&(void 0!==t[r.name]?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(e)):t[r.name]=e)}}),t}function Ke(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 Ue={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"};function Ge(e,t,r){if("string"!=typeof t)throw Error("Conversion type must be a string");if(t.startsWith("Fixed")){const{precision:r}=function(e){const t=e.match(/^Fixed(?::(\d+))?$/);return t?{precision:t[1]?parseInt(t[1],10):0}:{}}(t);return He.Number(e).toFixed(r??0)}if(null==e)return e;let n=He[t];if(n)return n(e,r);const i=Ue[t.toLowerCase()];if(i&&(n=He[i],n))return n(e,r);const a=Be.conversions[t];if("function"==typeof a)return a(e,r);for(const r of Be.conversions.dynamicResolvers){const n=r(t,e);if(void 0!==n)return n}return e}const Ye={as:{name:"as",category:"Conversion",evaluatesTo:"Any",precedence:20,associativity:"Left",operators:["as"],async evaluate(e,...t){const[r,n]=t;return Ge(r,n,e)},validate:e=>Le(e,2,"as","value, type")??je(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[r,n]=t;if(!ye(n))throw Error("Type check requires a string type");switch(n.toLowerCase()){case"null":return null===r;case"undefined":return void 0===r;case"string":return ye(r);case"number":return ve(r)&&!isNaN(r);case"boolean":return ge(r);case"object":return ke(r);case"array":return Array.isArray(r);case"function":return be(r);case"date":return r instanceof Date;case"element":return r instanceof Element;case"node":return r instanceof Node;case"nodelist":return r instanceof NodeList;case"empty":return null==r||""===r||Array.isArray(r)&&0===r.length||ke(r)&&0===Object.keys(r).length;default:return r?.constructor?.name?.toLowerCase()===n.toLowerCase()}},validate:e=>Le(e,2,"is","value, type")??je(e,1,"is","type")},async:{name:"async",category:"Conversion",evaluatesTo:"Any",precedence:25,associativity:"Right",operators:["async"],evaluate:async(e,t)=>t,validate:e=>Le(e,1,"async","expression")}},Ze=new Set(["__proto__","constructor","prototype"]);function Je(e,t){if(e instanceof Element)return Ce(e,t);if(ke(e)){if(Ze.has(t))return;return e[t]}return e[t]}function Xe(e){let t;if(Array.isArray(e))t=e;else{if(!("undefined"!=typeof NodeList&&e instanceof NodeList||"undefined"!=typeof HTMLCollection&&e instanceof HTMLCollection))return!1;t=Array.from(e)}return 0!==t.length&&t.every(e=>e instanceof Element||null!=e&&"object"==typeof e&&e.constructor!==Object&&!Array.isArray(e))}const Qe={possessive:{name:"possessive",category:"Reference",evaluatesTo:"Any",operators:["'s","s"],async evaluate(e,...t){const[r,n]=t;if(null!=r){if("string"!=typeof n)throw Error("Property name must be a string");return Xe(r)&&!(n in r)?Array.from(r,e=>Je(e,n)):Je(r,n)}},validate:e=>Le(e,2,"possessive","element, property")??je(e,1,"possessive","property name")},my:{name:"my",category:"Reference",evaluatesTo:"Any",operators:["my"],async evaluate(e,...t){const[r]=t;if(e.me){if("string"!=typeof r)throw Error("Property name must be a string");if(e.me instanceof Element)return Ce(e.me,r);if(ke(e.me)){if(Ze.has(r))return;return e.me[r]}return e.me[r]}},validate:e=>Pe(e,"my","property")},its:{name:"its",category:"Reference",evaluatesTo:"Any",operators:["its"],async evaluate(e,...t){const[r]=t;if(null==e.it)return;if("string"!=typeof r)throw Error("Property name must be a string");const n=e.it;if(n instanceof Element)return Ce(n,r);if(ke(n)){if(Ze.has(r))return;return n[r]}return n[r]},validate:e=>Pe(e,"its","property")},your:{name:"your",category:"Reference",evaluatesTo:"Any",operators:["your"],async evaluate(e,...t){const[r]=t;if(e.you){if("string"!=typeof r)throw Error("Property name must be a string");if(e.you instanceof Element)return Ce(e.you,r);if(ke(e.you)){if(Ze.has(r))return;return e.you[r]}return e.you[r]}},validate:e=>Pe(e,"your","property")},of:{name:"of",category:"Reference",evaluatesTo:"Any",operators:["of"],async evaluate(e,...t){const[r,n]=t;if(null!=n){if("string"!=typeof r)throw Error("Property name must be a string");if(n instanceof Element)return Ce(n,r);if(ke(n)){if(Ze.has(r))return;return n[r]}return n[r]}},validate:e=>Le(e,2,"of","property, object")??je(e,0,"of","property name")},attribute:{name:"attribute",category:"Reference",evaluatesTo:"String",operators:["@"],async evaluate(e,...t){const[r,n]=t;if("string"!=typeof r)throw Error("Attribute name must be a string");const i=n||e.me;return i&&i instanceof Element?i.getAttribute(r):null},validate:e=>Re(e,1,2,"attribute","attributeName, optional element")??je(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[r,n,i]=t;if("string"!=typeof r)throw Error("Attribute name must be a string");if("string"!=typeof n)throw Error("Expected value must be a string");const a=i||e.me;if(!(a&&a instanceof Element))return!1;return a.getAttribute(r)===n},validate:e=>Re(e,2,3,"attributeWithValue","attributeName, expectedValue, optional element")??je(e,0,"attributeWithValue","attribute name")??je(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[r]=t;if("string"!=typeof r)throw Error("Class name must be a string");const n=r.startsWith(".")?r.slice(1):r,i=document.getElementsByClassName(n);return Array.from(i)},validate:e=>Pe(e,"classReference","className")},idReference:{name:"idReference",category:"Reference",evaluatesTo:"Element",operators:["#"],async evaluate(e,...t){const[r]=t;if("string"!=typeof r)throw Error("ID value must be a string");const n=r.startsWith("#")?r.slice(1):r;return document.getElementById(n)},validate:e=>Pe(e,"idReference","idValue")}};function et(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 tt;!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"}(tt||(tt={}));const rt=new Set(["+","-","*","/","mod"]),nt=new Set(["ms","s","seconds","minutes","hours","days"]);function it(e){const t={input:"",position:0,line:1,column:1,tokens:[]};t.input=e;const r=e.length;for(;r>t.position&&(st(t),r>t.position);){const r=e[t.position];if("-"!==r||"-"!==at(t,1))if('"'!==r){if("'"===r||"'"===r){const e=at(t,1),r=t.tokens[t.tokens.length-1];if("s"===e&&r&&(r.kind===tt.IDENTIFIER||r.kind===tt.SELECTOR||"]"===r.value||")"===r.value||"}"===r.value)){const e=t.position;ot(t),ot(t),lt(t,tt.OPERATOR,"'s",e)}else pt(t);continue}if("`"!==r)if("<"!==r)if("#"!==r){if("."===r){if("."===at(t,1)){const e=t.position;ot(t),ot(t),lt(t,tt.OPERATOR,"..",e);continue}const e=t.tokens[t.tokens.length-1],r=new Set(["from","to","into","on","in","at","between","first","last","next","previous","closest","random","of","some","no"]),n=e&&e.kind===tt.IDENTIFIER&&N.has(e.value.toLowerCase()),i=e&&e.kind===tt.IDENTIFIER&&r.has(e.value.toLowerCase());if((!e||e.kind===tt.OPERATOR&&")"!==e.value&&"]"!==e.value||n||i||"("===e.value||"["===e.value||"{"===e.value||","===e.value||";"===e.value)&&!(e&&e.end===t.position)&&(bt(at(t))||"{"===at(t)||"-"===at(t))){dt(t);continue}}if("@"!==r)if("{"!==r)if("}"!==r){if("["===r){const e=t.tokens[t.tokens.length-1],r=e&&e.kind===tt.IDENTIFIER&&K.has(e.value)&&t.tokens.length>=2&&"on"===t.tokens[t.tokens.length-2]?.value;e&&(e.kind===tt.IDENTIFIER||")"===e.value||"]"===e.value)&&!r?(lt(t,tt.OPERATOR,"["),ot(t)):r?(lt(t,tt.SYMBOL,"["),ot(t)):(lt(t,tt.OPERATOR,"["),ot(t));continue}if("]"!==r){if("$"===r){const e=at(t,1);if(e>="a"&&"z">=e||e>="A"&&"Z">=e||"_"===e){kt(t);continue}}Et(r)?yt(t):"0">r||r>"9"?("a">r||r>"z")&&("A">r||r>"Z")&&"_"!==r?(lt(t,tt.UNKNOWN,r),ot(t)):gt(t):vt(t)}else lt(t,tt.OPERATOR,"]"),ot(t)}else lt(t,tt.OPERATOR,"}"),ot(t);else lt(t,tt.OPERATOR,"{"),ot(t);else ht(t)}else dt(t);else xt(t)?ft(t):yt(t);else mt(t)}else pt(t);else ut(t)}return t.tokens}function at(e,t=1){const r=e.position+t;return e.input.length>r?e.input[r]:""}function ot(e){const t=e.input[e.position];if(e.position++,"\n"===t)e.line++,e.column=1;else if("\r"===t){"\n"===(e.input.length>e.position?e.input[e.position]:"")&&e.position++,e.line++,e.column=1}else e.column++;return t}function st(e){const t=e.input,r=t.length;for(;r>e.position;){const r=t[e.position];if(" "!==r&&"\t"!==r&&"\r"!==r&&"\n"!==r)break;ot(e)}}function lt(e,t,r,n,i){const a=n??e.position-r.length,o=e.position;let s=e.column-r.length;if(void 0!==n){s=1;let t=-1;for(let r=0;n>r;r++)"\n"!==e.input[r]&&"\r"!==e.input[r]||(t=r);s=n-t}const l={kind:t,value:r,start:a,end:o,line:ct(e,a),column:s};e.tokens.push(l)}function ct(e,t){let r=1;for(let n=0;t>n&&e.input.length>n;n++){const t=e.input[n];"\n"===t?r++:"\r"===t&&(r++,e.input.length>n+1&&"\n"===e.input[n+1]&&n++)}return r}function ut(e){const t=e.position;let r="";for(ot(e),ot(e);e.input.length>e.position;){if("\n"===e.input[e.position])break;r+=ot(e)}lt(e,tt.COMMENT,"--"+r,t)}function pt(e){const t=e.position,r=ot(e);let n=r;for(;e.input.length>e.position;){const t=ot(e);if(n+=t,t===r)break;"\\"===t&&e.input.length>e.position&&(n+=ot(e))}lt(e,tt.STRING,n,t)}function mt(e){const t=e.position;ot(e);let r="";for(;e.input.length>e.position;){const t=e.input[e.position];if("`"===t){ot(e);break}if("\\"===t){if(ot(e),e.input.length>e.position){const t=ot(e);switch(t){case"n":r+="\n";break;case"t":r+="\t";break;case"r":r+="\r";break;case"\\":r+="\\";break;case"`":r+="`";break;default:r+=t}}}else r+=ot(e)}if(e.position>=e.input.length&&!e.input.endsWith("`"))throw Error(`Unterminated template literal at line ${e.line}, column ${e.column-r.length}`);lt(e,tt.TEMPLATE,r,t)}function dt(e){const t=e.position;let r=ot(e);if(e.position<e.input.length&&"{"===e.input[e.position]){for(r+=ot(e);e.input.length>e.position;){const t=e.input[e.position];if(r+=ot(e),"}"===t)break}lt(e,tt.SELECTOR,r,t)}else{for(;e.input.length>e.position;){const t=e.input[e.position];if("\\"===t)ot(e),e.input.length>e.position&&(r+=ot(e));else{if(!wt(t)&&"-"!==t&&"_"!==t&&":"!==t)break;r+=ot(e)}}lt(e,tt.SELECTOR,r,t)}}function ft(e){const t=e.position;if(zt(e))return void function(e,t){const r=e.input;let n="",i=0,a="";for(;r.length>e.position;){const t=r[e.position];if(a)n+=ot(e),t===a&&(a="");else if('"'!==t&&"'"!==t){if("<"===t){if("/"===r[e.position+1]){for(;r.length>e.position&&">"!==r[e.position];)n+=ot(e);if(r.length>e.position&&(n+=ot(e)),i--,0>=i)break;continue}let t=!1,a="";for(;r.length>e.position;){const i=r[e.position];if(a)n+=ot(e),i===a&&(a="");else if('"'!==i&&"'"!==i){if(">"===i){t="/"===r[e.position-1],n+=ot(e);break}n+=ot(e)}else a=i,n+=ot(e)}if(t||i++,0>=i)break;continue}n+=ot(e)}else a=t,n+=ot(e)}lt(e,tt.SELECTOR,n,t)}(e,t);let r="";for(r+=ot(e);e.input.length-1>e.position;){const t=e.input[e.position],n=e.input[e.position+1];if(r+=ot(e),"/"===t&&">"===n){r+=ot(e);break}}lt(e,tt.SELECTOR,r,t)}function ht(e){const t=e.position;let r=ot(e);for(;e.input.length>e.position;){const t=e.input[e.position];if(!wt(t)&&"_"!==t&&"-"!==t)break;r+=ot(e)}lt(e,tt.SYMBOL,r,t)}function yt(e){const t=e.position;let r="";const n=e.input[e.position];if(("'"===n||"'"===n)&&"s"===at(e,1))return r="'s",ot(e),ot(e),void lt(e,tt.OPERATOR,r,t);const i=e.input.substring(e.position,e.position+2),a=e.input.substring(e.position,e.position+3);["===","!=="].includes(a)?(r=a,ot(e),ot(e),ot(e)):["==","!=","<=",">=","&&","||","**","~=","|=","^=","$=","*=","?."].includes(i)?(r=i,ot(e),ot(e)):r=ot(e),lt(e,tt.OPERATOR,r,t)}function vt(e){const t=e.position,r=e.input,n=r.length;let i="";for(;n>e.position;){const t=r[e.position];if("0">t||t>"9")break;i+=ot(e)}if(n>e.position&&"."===r[e.position]&&(e.position+1>=n||"."!==r[e.position+1]))for(i+=ot(e);n>e.position;){const t=r[e.position];if("0">t||t>"9")break;i+=ot(e)}if(n>e.position){const t=r[e.position];if("e"===t||"E"===t){const t=n>e.position+1?r[e.position+1]:"",a=n>e.position+2?r[e.position+2]:"";if(t>="0"&&"9">=t||!("+"!==t&&"-"!==t||"0">a||a>"9"))for(i+=ot(e),"+"!==r[e.position]&&"-"!==r[e.position]||(i+=ot(e));n>e.position;){const t=r[e.position];if("0">t||t>"9")break;i+=ot(e)}}}const a=e.position;let o="";for(;n>e.position;){const t=r[e.position];if(("a">t||t>"z")&&("A">t||t>"Z"))break;o+=ot(e)}nt.has(o)?lt(e,tt.TIME,i+o,t):(e.position=a,lt(e,tt.NUMBER,i,t))}function gt(e){const t=e.position,r=e.input,n=r.length;let i="";for(;n>e.position;){const t=r[e.position];if(("a">t||t>"z")&&("A">t||t>"Z")&&("0">t||t>"9")&&"_"!==t&&"-"!==t)break;i+=ot(e)}const a=function(e,t,r){const n=t.toLowerCase(),i=e.position;if("'s"===t||"'s"===t)return!1;const a=e.tokens[e.tokens.length-1];if(a&&(a.kind===tt.IDENTIFIER||a.kind===tt.SELECTOR)){const t=e.input.length>e.position?e.input[e.position]:"";if("'"===t||"'"===t)return!1}st(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+=ot(e)}if(o){const t=o.toLowerCase(),i=`${n} ${t}`,a=function(e,t,r,n){const i=t.toLowerCase(),a=r.toLowerCase();if("at"===i){const t=e.position;if("the"===a){st(e);let r="";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;r+=ot(e)}const i=r.toLowerCase();if("start"===i||"end"===i){st(e);let t="";for(;e.input.length>e.position;){const r=e.input[e.position];if(("a">r||r>"z")&&("A">r||r>"Z")&&("0">r||r>"9")&&"_"!==r&&"-"!==r)break;t+=ot(e)}if("of"===t.toLowerCase()){return lt(e,tt.IDENTIFIER,`at the ${i} of`,n),!0}}return e.position=t,!1}if("start"===a||"end"===a){st(e);let r="";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;r+=ot(e)}if("of"===r.toLowerCase()){return lt(e,tt.IDENTIFIER,`at ${a} of`,n),!0}return e.position=t,!1}}return!1}(e,n,t,r);if(a)return!0;const s=function(e,t,r){const n=e.position;let i=`${t} ${r}`,a=e.position;const o=[t,r],s=8;for(;s>o.length&&(st(e),e.input.length>e.position);){let t="";for(;e.input.length>e.position;){const r=e.input[e.position];if(("a">r||r>"z")&&("A">r||r>"Z"))break;t+=ot(e)}if(!t)break;o.push(t.toLowerCase());const r=o.join(" ");F.has(r)&&(i=r,a=e.position)}if(F.has(i)&&i!==`${t} ${r}`)return e.position=a,i;return e.position=n,null}(e,n,t);if(s)return lt(e,tt.OPERATOR,s,r),!0;if(F.has(i))return lt(e,tt.OPERATOR,i,r),!0}if(F.has(n))return e.position=i,lt(e,tt.OPERATOR,t,r),!0;return e.position=i,!1}(e,i,t);if(a)return;const o=function(e){const t=e.toLowerCase();if("include"===t||"includes"===t)return tt.OPERATOR;if(H.has(t))return tt.OPERATOR;if(rt.has(e)||rt.has(t))return tt.OPERATOR;if(F.has(t))return tt.OPERATOR;return tt.IDENTIFIER}(i);lt(e,o,i,t)}function kt(e){const t=e.position,r=e.input,n=r.length;ot(e);let i="$";for(;n>e.position;){const t=r[e.position];if(("a">t||t>"z")&&("A">t||t>"Z")&&("0">t||t>"9")&&"_"!==t)break;i+=ot(e)}lt(e,tt.IDENTIFIER,i,t)}function bt(e){return/[a-zA-Z]/.test(e)}function wt(e){return/[a-zA-Z0-9]/.test(e)}function zt(e){const t=e.input,r=t[e.position+1];if(!r||!/[a-zA-Z]/.test(r))return!1;let n=e.position+1,i="";for(;t.length>n&&/[a-zA-Z0-9-]/.test(t[n]);)i+=t[n],n++;return i.length>0&&-1!==t.indexOf("</"+i+">",n)}function xt(e){if(zt(e))return!0;let t=e.position+1,r=!1;for(;e.input.length>t;){const n=e.input[t];if("/"===n&&e.input.length>t+1&&">"===e.input[t+1])return r;if(wt(n)||"."===n||"#"===n||"["===n||"]"===n||":"===n||"-"===n||"_"===n||" "===n||"="===n||'"'===n||"'"===n||"("===n||")"===n||"*"===n||"^"===n||"$"===n||"~"===n||"|"===n||">"===n||"+"===n||","===n||"{"===n||"}"===n)r=!0,t++;else{if(" "!==n&&"\t"!==n)return!1;t++}if(t-e.position>50)return!1}return!1}function Et(e){return"+-*/^%=!<>&|(){}[],.;:?''~$".includes(e)}!function(){if("undefined"!=typeof localStorage)try{const e=localStorage,t=e.getItem("hyperfixi:debug")||e.getItem("lokascript:debug");if("*"===t||"true"===t)return!0}catch{}!("undefined"==typeof window||!window.__HYPERFIXI_DEBUG__)||"undefined"!=typeof process&&process}();const Tt={command:(...e)=>{},event:(...e)=>{},parse:(...e)=>{},expr:(...e)=>{},expressions:(...e)=>{},style:(...e)=>{},runtime:(...e)=>{},loop:(...e)=>{},async:(...e)=>{}};let St=!1,Ct=null;if("undefined"!=typeof window&&"undefined"!=typeof URLSearchParams)try{"semantic"===new URLSearchParams(window.location.search).get("debug")&&(St=!0,Ct=window)}catch{}let At={totalParses:0,semanticSuccesses:0,semanticFallbacks:0,traditionalParses:0,averageConfidence:0,confidenceHistory:[]};class Lt{constructor(e){this.analyzer=e.analyzer,this.language=e.language,this.confidenceThreshold=e.confidenceThreshold??.5,this.debugEnabled=e.debug??!1}isAvailable(){return this.analyzer.supportsLanguage(this.language)}shouldSkipSemantic(e){const t=e.trim().split(/\s+/)[0]?.toLowerCase();if(Lt.SKIP_SEMANTIC_COMMANDS.has(t))return!0;const r=e.toLowerCase();return!!/\bjs\b/.test(r)||(!!/\btell\b/.test(r)||!!/\*[a-zA-Z]/.test(e))}trySemanticParse(e){const t=performance.now();if(this.shouldSkipSemantic(e))return{success:!1,confidence:0,errors:["Command skipped for semantic parsing - using traditional parser"]};if(!this.isAvailable())return{success:!1,confidence:0,errors:[`Semantic parsing not available for language '${this.language}'`]};try{const n=this.analyzer.analyze(e,this.language),i=performance.now()-t,a=n.confidence>=this.confidenceThreshold&&!!n.command,o=!a&&n.confidence>0;if(St){const t={};if(n.command?.roles)for(const[e,r]of n.command.roles)t[e]=r.value;const s={input:e.substring(0,100),language:this.language,confidence:n.confidence,threshold:this.confidenceThreshold,semanticSuccess:a,fallbackTriggered:o,command:n.command?.name,roles:Object.keys(t).length>0?t:void 0,errors:n.errors,timestamp:Date.now(),duration:i};!function(e){if(!St)return;if(e.roles&&Object.keys(e.roles),Ct){const t=new CustomEvent("lokascript:semantic:parse",{detail:e,bubbles:!0});Ct.dispatchEvent(t)}}(s),r=s,At.totalParses++,r.semanticSuccess?At.semanticSuccesses++:r.fallbackTriggered?At.semanticFallbacks++:At.traditionalParses++,At.confidenceHistory.push(r.confidence),At.confidenceHistory.length>100&&At.confidenceHistory.shift(),At.averageConfidence=At.confidenceHistory.reduce((e,t)=>e+t,0)/At.confidenceHistory.length}if(!a)return{success:!1,confidence:n.confidence,tokensConsumed:n.tokensConsumed,errors:n.errors};return{success:!0,node:this.buildCommandNode(n),confidence:n.confidence,tokensConsumed:n.tokensConsumed}}catch(e){return{success:!1,confidence:0,errors:[e instanceof Error?e.message:e+""]}}var r}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 r=[],n={};for(const[e,i]of t.roles){const a=this.semanticValueToExpression(i);switch(e){case"patient":case"event":r.push(a);break;case"destination":"put"===t.name?n.into=a:"add"===t.name||"append"===t.name||"prepend"===t.name?n.to=a:n.on=a;break;case"source":"fetch"===t.name?r.push(a):n.from=a;break;case"quantity":n.by=a;break;case"duration":n.over=a;break;case"responseType":n.as=a;break;case"method":n.method=a;break;case"style":n.with=a;break;case"condition":n.when=a;break;default:n[e]=a}}return{type:"command",name:t.name,args:r,modifiers:Object.keys(n).length>0?n:void 0,isBlocking:!1,start:0,end:0,line:1,column:0}}buildRepeatCommandNode(e){const t=[],r={},n=e.roles.get("loopType");n&&t.push({type:"identifier",name:n.value+"",start:0,end:0,line:1,column:0});const i=e.roles.get("patient");"for"===(n?n.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&&(r.condition=this.semanticValueToExpression(l)),{type:"command",name:"repeat",args:t,modifiers:Object.keys(r).length>0?r:void 0,isBlocking:!1,start:0,end:0,line:1,column:0}}buildSetCommandNode(e){const t=[],r=e.roles.get("destination");if(r)if("property-path"===r.type){const e=r;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(r));t.push({type:"identifier",name:"to",start:0,end:0,line:1,column:0});const n=e.roles.get("patient");return n&&t.push(this.semanticValueToExpression(n)),{type:"command",name:"set",args:t,isBlocking:!1,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=[],r=e.roles.get("condition");return r&&t.push(this.semanticValueToExpression(r)),{type:"command",name:e.name,args:t,isBlocking:!1,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:!1,start:0,end:0,line:1,column:0}}default:return this.parseExpressionString(e.raw||"")}}parseExpressionString(e){let t=0;const r=()=>{for(;e.length>t&&/\s/.test(e[t]);)t++},n=()=>{r();const n=t;for(;e.length>t&&/[a-zA-Z0-9_$]/.test(e[t]);)t++;return e.slice(n,t)},i=()=>{const n=[];if(t++,r(),")"!==e[t])for(n.push(a()),r();","===e[t];)t++,r(),n.push(a()),r();return")"===e[t]&&t++,n},a=()=>{r();const a=n();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;){r();const a=e[t];if("."===a){t++;const e=n();e&&(o={type:"memberExpression",object:o,property:{type:"identifier",name:e,start:0,end:0,line:1,column:0},computed:!1,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 jt(e){return{analyze(t,r){if(!e.isRegistered(r))return{confidence:0,errors:[`Language '${r}' is not supported for semantic parsing`]};const n=e.parse(t,r);return{confidence:n.confidence,...void 0!==n.tokensConsumed?{tokensConsumed:n.tokensConsumed}:{},...n.node?{command:{name:n.node.action,roles:n.node.roles}}:{},...n.error?{errors:[n.error]}:{}}},supportsLanguage:t=>e.isRegistered(t),supportedLanguages:()=>e.registered()}}function Pt(e){return e.kind===tt.IDENTIFIER&&N.has(e.value.toLowerCase())}function Ot(e){return e.kind===tt.IDENTIFIER&&U.has(e.value.toLowerCase())}function Nt(e){return e.kind===tt.IDENTIFIER&&K.has(e.value.toLowerCase())}function It(e){return e.kind===tt.IDENTIFIER&&B.has(e.value.toLowerCase())}function Rt(e){return F.has(e.value.toLowerCase())}function Mt(e){return e.kind===tt.IDENTIFIER}function Wt(e){return e.kind===tt.SELECTOR}function _t(e){return e.kind===tt.SELECTOR&&!e.value.startsWith("<")}function qt(e){return e.kind===tt.STRING||e.kind===tt.NUMBER||e.kind===tt.TEMPLATE}function $t(e){return e.kind===tt.IDENTIFIER}function Vt(e){return e.kind===tt.TIME}function Dt(e){return e.kind===tt.SYMBOL}function Bt(e){return e.kind===tt.COMMENT}function Ht(e){if(e.kind!==tt.IDENTIFIER)return!1;const t=e.value.toLowerCase();return!(N.has(t)||U.has(t)||K.has(t)||B.has(t))}function Ft(e){return e.kind===tt.STRING}function Kt(e){return e.kind===tt.NUMBER}function Ut(e){if(e.kind===tt.IDENTIFIER){const t=e.value;return"true"===t||"false"===t||"null"===t||"undefined"===t}return!1}function Gt(e){return e.kind===tt.TEMPLATE}function Yt(e){return e.kind===tt.SELECTOR&&e.value.startsWith("<")}function Zt(e){return e.kind===tt.SELECTOR&&e.value.startsWith("#")}function Jt(e){return e.kind===tt.SELECTOR&&e.value.startsWith(".")}function Xt(e){return e.kind===tt.SELECTOR&&(!e.value.startsWith("#")&&!e.value.startsWith("."))}function Qt(e){if(e.kind!==tt.OPERATOR)return!1;const t=e.value.toLowerCase();return!H.has(t)&&!F.has(t)}function er(e){const t=e.value.toLowerCase();return"then"===t||"and"===t||"else"===t||"end"===t||"on"===t}function tr(e,t,r){return{type:"literal",value:e,raw:t,start:r.start,end:r.end,line:r.line,column:r.column}}function rr(e,t){return{type:"identifier",name:e,start:t.start,end:t.end,line:t.line,column:t.column}}function nr(e,t,r,n){return{type:"binaryExpression",operator:e,left:t,right:r,start:n.start,end:n.end,line:n.line,column:n.column}}function ir(e,t){return{type:"block",commands:e,start:t.start,end:t.end,line:t.line,column:t.column}}function ar(e,t){return{type:"string",value:e,start:t.start,end:t.end,line:t.line,column:t.column}}function or(e,t){return{type:"objectLiteral",properties:e,start:t.start,end:t.end,line:t.line,column:t.column}}function sr(e,t){return{type:"arrayLiteral",elements:e,start:t.start,end:t.end,line:t.line,column:t.column}}function lr(e,t,r){return{type:"propertyOfExpression",property:e,target:t,start:r.start,end:r.end,line:r.line,column:r.column}}function cr(e,t,r){return{type:"command",name:"__ERROR__",args:[],diagnostics:[{message:t,severity:"error",code:"parse-error",line:e.line,column:e.column,...r&&{source:r}}],start:e.start,end:e.end,line:e.line,column:e.column}}Lt.SKIP_SEMANTIC_COMMANDS=new Set(["swap","morph","js","tell"]);const ur=[{command:"append",keywords:["to"],syntax:"append <value> [to <target>]"},{command:"make",keywords:["a","an","from","called"],syntax:"make (a|an) <type> [from <args>] [called <name>]"},{command:"send",keywords:["to"],syntax:"send <event> to <target>"},{command:"throw",keywords:[],syntax:"throw <error>"}];function pr(e,t){return!!e&&t.some(t=>e.value===t||e.value.toLowerCase()===t)}const mr=[a,l,o,s];function dr(e,t=[]){if(e.isAtEnd())return!0;for(const t of mr)if(e.check(t))return!0;for(const r of t)if(e.check(r))return!0;return!!e.checkIsCommand()}function fr(e,t=[]){if(!dr(e,t))return e.parseExpression()}function hr(e,t,r){return!!e.check(t)&&(e.advance(),r.push(e.createIdentifier(t)),!0)}function yr(e,t,r){for(const n of t)if(e.check(n))return e.advance(),r.push(e.createIdentifier(n)),n;return null}function vr(e,t){return!!e.check(t)&&(e.advance(),!0)}function gr(e){const t=e.savePosition();let r;if(e.checkIdentifierLike()){const n=e.peek().value;e.advance(),e.check(":")?(e.advance(),r=n):e.restorePosition(t)}const n=e.parseExpression();return void 0!==r?{name:r,value:n}:{value:n}}class kr{constructor(e){this.args=[],this.isBlocking=!1,this.name=e}static from(e){const t=new kr(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 kr(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 kr(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=!0){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 kr(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 br(e,t){const r=[];let n="";const i=e.peek().start||0,a=e.peek().line||1,o=e.peek().column||1;if(e.checkIdentifierLike()){for(n=e.advance().value;e.check(":")&&!e.isAtEnd();)e.advance(),n+=":",e.checkIdentifierLike()&&(n+=e.advance().value);if(e.check("(")){e.advance();const t=[];for(;!e.isAtEnd()&&!e.check(")");){const{name:r,value:n}=gr(e);if(t.push(void 0!==r?{type:"objectLiteral",properties:[{key:{type:"identifier",name:r},value:n}],start:n.start,end:n.end,line:n.line,column:n.column}:n),e.check(","))e.advance();else if(!e.check(")"))break}e.check(")")&&e.advance(),r.push({type:"functionCall",name:n,args:t,start:i,end:e.getPosition().end,line:a,column:o})}else r.push({type:"string",value:n,start:i,end:e.getPosition().end,line:a,column:o})}const s=[...r];for(;!dr(e);){if(e.check("on")||e.check("to")){const t=e.advance().value;s.push(e.createIdentifier(t));continue}s.push(e.parsePrimary())}return kr.fromIdentifier(t).withArgs(...s).endingAt(e.getPosition()).build()}function wr(e,t){const r=[];if(e.check(j)){const t=e.advance();if(r.push({type:"identifier",name:j,start:t.start,end:t.end,line:t.line,column:t.column}),e.check(T)){const t=e.advance();r.push({type:"identifier",name:T,start:t.start,end:t.end,line:t.line,column:t.column})}}return kr.fromIdentifier(t).withArgs(...r).endingAt(e.getPosition()).build()}function zr(e,t){const r=[];let n=!1;const i=e.savePosition();for(let t=0;500>t&&!e.isAtEnd();t++){const t=e.peek();if(t.value===a){n=!0;break}if(t.value===s||t.value===C||t.value===S||t.value===E)break;e.advance()}e.restorePosition(i);let l=!1;if(!n){const r=e.savePosition(),n=t.line,i=100;for(;!e.isAtEnd()&&i>e.current-r;){const t=e.peek(),r=t.value?.toLowerCase();if(r===C||r===S||r===E)break;if(r===o||r===s){t.line===n&&(l=!0);break}if((e.checkIsCommand()||e.isCommand(r))&&void 0!==t.line&&t.line!==n){l=!0;break}e.advance()}e.restorePosition(r)}const u=n||l;let p;if(u)p=e.parseExpression();else{const r=[],n=20;let i=0;for(;!e.isAtEnd()&&!e.checkIsCommand()&&!e.isCommand(e.peek().value)&&!e.check(a)&&n>i;){const t=e.savePosition();r.push(e.parseLogicalAnd()),e.savePosition()===t&&e.advance(),i++}if(0===r.length)throw Error("Expected condition after if/unless");p=1===r.length?r[0]:{type:"expression",tokens:r,start:r[0].start,end:r[r.length-1].end,line:t.line,column:t.column}}if(r.push(p),u){n&&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");r.push(ir(i,{start:t.start,end:e.getPosition().end,line:t.line,column:t.column}));let a=!1;if(e.check(o))if(e.advance(),e.check(c)){const t=e.peek();e.advance();const n=zr(e,t);r.push(ir([n],{start:t.start,end:e.getPosition().end,line:t.line,column:t.column})),a=!0}else{const n=[];for(;!e.isAtEnd()&&!e.check(s)&&(e.checkIsCommand()||e.isCommand(e.peek().value));){e.advance();const t=e.parseCommand();t&&n.push(t)}r.push(ir(n,{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 n=e.parseCommand();r.push(ir([n],{start:t.start,end:e.getPosition().end,line:t.line,column:t.column}))}}return kr.from(t).withArgs(...r).endingAt(e.getPosition()).build()}function xr(e,t){const r=[],n={};if(e.checkAnySelector()||e.checkContextVar()||e.match("<")){const t=e.parsePrimary();if(r.push(t),e.match("*")){if(e.checkIdentifierLike()){const t=e.advance();r.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();r.push(t)}}else if(e.checkIdentifierLike()){const t=e.parsePrimary();r.push(t)}if(e.match("and")&&e.match("set")&&e.checkIdentifierLike()){const t=e.advance();n.set={type:"identifier",name:t.value,start:t.start,end:t.end,line:t.line,column:t.column}}const i=kr.fromIdentifier(t).withArgs(...r).endingAt(e.getPosition());return Object.keys(n).length>0&&i.withModifiers(n),i.build()}function Er(e,t){const r=[],n=fr(e,[k]);n&&r.push(n),hr(e,k,r);const i=fr(e);return i&&r.push(i),kr.fromIdentifier(t).withArgs(...r).endingAt(e.getPosition()).build()}function Tr(e,t){const r=[];if(e.check(x)){e.advance(),r.push(e.createIdentifier("between"));const n=fr(e,[l]);if(n&&"binaryExpression"===n.type&&"and"===n.operator)n.left&&r.push(n.left),r.push(e.createIdentifier("and")),n.right&&r.push(n.right);else{n&&r.push(n),hr(e,l,r);const t=fr(e,[k,E,u]);t&&r.push(t)}if(yr(e,[k,E],r)){const t=fr(e);t&&r.push(t)}return kr.fromIdentifier(t).withArgs(...r).endingAt(e.getPosition()).build()}const n=fr(e,[k,E]);n&&r.push(n);if(yr(e,[k,E],r)){const t=fr(e);t&&r.push(t)}return e.check("modal")&&(e.advance(),r.push({type:"literal",value:"modal",raw:"modal"})),kr.fromIdentifier(t).withArgs(...r).endingAt(e.getPosition()).build()}function Sr(e,t){const r=e.parseExpression();if(!r)return e.addError("Put command requires content expression"),null;const n=e.peek();if(!n||!q.includes(n.value))return e.addError(`Expected operation keyword (${q.join(", ")}) after put expression, got: ${n?.value}`),null;let i=e.advance().value;const a=i.toLowerCase();"at start of"===a||"at the start of"===a?i=W:"at end of"===a||"at the end of"===a?i=_:i===M&&(e.check(P)||e.check(j)?(vr(e,j),e.check(P)&&(e.advance(),e.check(w)&&(e.advance(),i=W))):e.check(s)&&(e.advance(),e.check(w)&&(e.advance(),i=_)));const o=e.parseExpression();return o?kr.fromIdentifier(t).withArgs(r,e.createIdentifier(i),o).endingAt(e.getPosition()).build():(e.addError("Put command requires target expression after operation keyword"),null)}const Cr=["innerhtml","outerhtml","into","over","delete","morph","morphouter"];function Ar(e,t){const r=e.savePosition();let n=null,i=[];try{n=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(A)&&!e.check(L))return null;const t=e.advance(),r=e.advance();return{type:"identifier",name:r.value,scope:t.value,start:t.start,end:r.end}}(e)??function(e){if(!e.check(j))return null;const t=e.savePosition();e.advance();const r=e.parseExpression();if(!r)return e.restorePosition(t),null;if("binaryExpression"===r.type&&r.operator===w){const e=r.left,t=r.right;return lr(e,t,{start:e.start??0,end:t.end??0,line:e.line??1,column:e.column??1})}return e.check(g)?r:(e.restorePosition(t),null)}(e),n||(n=e.parseExpression())}catch{e.restorePosition(r),n=null}if(!n){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(g)||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")===j&&e(t[2],"value")===w){const r=t[1],n=t[3];return{expression:lr(rr(e(r,"value")||e(r,"name")||"",{start:r.start??0,end:r.end??0,line:r.line??1,column:r.column??1}),{type:"idSelector"===n.type?"idSelector":"cssSelector",value:e(n,"value")||e(n,"name")||"",start:n.start??0,end:n.end??0,line:n.line,column:n.column},{start:t[0].start??0,end:n.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);n=t.expression,i=t.tokens}if(!e.check(g)){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 n?u.push(n):i.length>0&&u.push(...i),u.push(e.createIdentifier(g)),c&&u.push(c),kr.fromIdentifier(t).withArgs(...u).endingAt(e.getPosition()).build()}function Lr(e,t){switch(t.name.toLowerCase()){case"put":return Sr(e,t);case"trigger":case"send":return br(e,t);case"remove":return Er(e,t);case"toggle":return Tr(e,t);case"set":return Ar(e,t);case"halt":return wr(e,t);case"measure":return xr(e,t);case"js":return function(e,t){const r=[];if(e.match("(")){for(;!e.check(")")&&!e.isAtEnd();)e.checkIdentifierLike()&&r.push(e.advance().value),e.match(",");e.consume(")","Expected ) after js parameters")}const n=e.peek().start,i=function(e,t){const r=e.getInputSlice(t);if(!r)return t;let n=0;for(;r.length>n;){const e=r[n];if("'"!==e&&"’"!==e&&"‘"!==e)if('"'!==e)if("`"!==e)if("/"===e&&n+1<r.length&&"/"===r[n+1])for(n+=2;r.length>n&&"\n"!==r[n];)n++;else if("/"===e&&n+1<r.length&&"*"===r[n+1]){for(n+=2;r.length>n&&("*"!==r[n]||n+1>=r.length||"/"!==r[n+1]);)n++;n+=2}else{if(("e"===e||"E"===e)&&r.length>=n+3&&"end"===r.slice(n,n+3).toLowerCase()){if((0===n||!/[a-zA-Z0-9_]/.test(r[n-1]))&&(n+3>=r.length||!/[a-zA-Z0-9_]/.test(r[n+3])))return t+n}n++}else{for(n++;r.length>n&&"`"!==r[n];)"\\"===r[n]&&n++,n++;n++}else{for(n++;r.length>n&&'"'!==r[n];)"\\"===r[n]&&n++,n++;n++}else{for(n++;r.length>n&&r[n]!==e;)"\\"===r[n]&&n++,n++;n++}}return t+r.length}(e,n);for(;!e.isAtEnd()&&!e.check(s)&&e.peek().start<i;)e.advance();e.consume(s,"Expected end after js code body");const a=e.getInputSlice(n,i),o={type:"literal",value:a.trim(),start:t.start,end:e.getPosition().end},l={type:"arrayLiteral",elements:r.map(e=>({type:"literal",value:e,start:t.start,end:t.end})),start:t.start,end:e.getPosition().end};return kr.fromIdentifier(t).withArgs(o,l).endingAt(e.getPosition()).build()}(e,t);case"tell":return function(e,t){const r=e.parseExpression();if(!r)throw Error("tell command requires a target expression");const n=[];for(;!e.isAtEnd();){if(e.checkIsCommand()){try{e.advance();const t=e.parseCommand();if(!t)break;n.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===n.length)throw Error("tell command requires at least one command after the target");return kr.fromIdentifier(t).withArgs(r,...n).endingAt(e.getPosition()).build()}(e,t);case"pick":return function(e,t){const r=kr.fromIdentifier(t);vr(e,j);const n=e.peek(),i=n.value,a=e=>({type:"literal",value:e,start:t.start,end:t.end}),o=()=>{if(!e.match("of","from"))throw Error("pick: expected 'of' or 'from' before source expression");return e.parseExpression()};if("first"===i){e.advance();const t=e.parsePrimary(),n=o();return r.withArgs(n).withModifier("variant",a("first")).withModifier("count",t).endingAt(e.getPosition()).build()}if("last"===i){e.advance();const t=e.parsePrimary(),n=o();return r.withArgs(n).withModifier("variant",a("last")).withModifier("count",t).endingAt(e.getPosition()).build()}if("random"===i){let t;e.advance(),e.check("of")||e.check("from")||(t=e.parsePrimary());const n=o(),i=r.withArgs(n).withModifier("variant",a("random"));return t&&i.withModifier("count",t),i.endingAt(e.getPosition()).build()}if("item"===i||"items"===i||"character"===i||"characters"===i){let t,n;e.advance(),e.match("at","from"),t=e.match("start")?a("start"):e.parsePrimary();let i=!1;(e.match("to")||e.match(".."))&&(e.match("end")?i=!0:n=e.parsePrimary());let s="default";e.match("inclusive")?s="inclusive":e.match("exclusive")&&(s="exclusive");const l=o(),c=r.withArgs(l).withModifier("variant",a("range")).withModifier("rangeStart",t).withModifier("rangeMode",a(s));return i?c.withModifier("rangeEnd",a("end")):n&&c.withModifier("rangeEnd",n),c.endingAt(e.getPosition()).build()}if("match"===i||"matches"===i){e.advance(),e.match("of");const t=e.parsePrimary();let n;e.matchOperator("|")&&(n=e.advance().value);const s=o(),l=r.withArgs(s).withModifier("variant",a("match"===i?"match":"matches")).withModifier("regex",t);return n&&l.withModifier("flags",a(n)),l.endingAt(e.getPosition()).build()}return jr(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 r={};if(e.match("using")){const t=e.parsePrimary();r.transitionName=t}const n=e.parseCommandListUntilEnd();return kr.fromIdentifier(t).withArgs(...n).withModifiers(r).endingAt(e.getPosition()).build()}(e,t);case"swap":case"morph":return function(e,t){const r=[];let n=null;if(!e.isAtEnd()){const t=e.peek();if(t&&t.value){const i=t.value.toLowerCase();Cr.includes(i)&&(n=i,e.advance(),r.push(e.createIdentifier(n)))}}if("delete"===n){const n=e.parseExpression();return n&&r.push(n),kr.fromIdentifier(t).withArgs(...r).endingAt(e.getPosition()).build()}!e.isAtEnd()&&e.check(w)&&(e.advance(),r.push(e.createIdentifier("of")));const i=e.parseExpression();if(i&&r.push(i),!e.isAtEnd()&&e.check(b)){e.advance(),r.push(e.createIdentifier("with"));const t=e.parseExpression();t&&r.push(t)}return kr.fromIdentifier(t).withArgs(...r).endingAt(e.getPosition()).build()}(e,t);default:return jr(e,t)}}function jr(e,t){const r=[];for(;!dr(e,["catch","finally"])&&(e.checkIdentifierLike()||e.checkSelector()||e.checkLiteral()||e.checkTimeExpression()||e.match("<"));)r.push(e.parsePrimary());return kr.fromIdentifier(t).withArgs(...r).endingAt(e.getPosition()).build()}function Pr(e){if(e.isAtEnd())return!0;const t=e.peek().value;return["as","with","{","then","end","else","otherwise",")"].includes(t)||dr(e)}function Or(e,t){const r={};let n=null;if(!e.isAtEnd()&&e.check("/")&&(n=function(e){const t=e.savePosition();let r="";for(;!e.isAtEnd()&&!Pr(e);)r+=e.advance().value;return r&&"/"!==r?{type:"literal",value:r,raw:r,start:t,end:e.savePosition()}:(e.restorePosition(t),null)}(e)),n||(n=e.parsePrimary()),!n)return e.addError("fetch requires a URL"),kr.from(t).endingAt(e.getPosition()).build();!e.isAtEnd()&&e.check("{")&&(r.with=e.parsePrimary());for(let t=0;3>t&&!e.isAtEnd();t++)if(!e.check("as")||r.as){if(!e.check("with")||r.with){if(e.check("do")&&!r.doNotThrow){const t=e.peekAt(1),n=e.peekAt(2);if("not"===t?.value&&"throw"===n?.value){const t=e.advance();e.advance();const n=e.advance();r.doNotThrow={type:"literal",value:!0,start:t.start,end:n.end,line:t.line,column:t.column};continue}}break}e.advance(),r.with=Nr(e)?Ir(e):e.parsePrimary()}else e.advance(),e.isAtEnd()||vr(e,"a")||vr(e,"an"),r.as=e.parsePrimary();const i=kr.from(t).withArgs(n).endingAt(e.getPosition());return Object.keys(r).length>0&&i.withModifiers(r),i.build()}function Nr(e){if(e.check("{"))return!1;if(!e.checkIdentifierLike())return!1;const t=e.peekAt(1);return null!==t&&":"===t.value}function Ir(e){const t=[],r=e.getPosition();do{if(!e.checkIdentifierLike())break;const r=e.advance(),n={type:"identifier",name:r.value,start:r.start,end:r.end,line:r.line,column:r.column};e.consume(":","Expected ':' after property name in fetch named arguments");const i=e.parsePrimary();i&&t.push({key:n,value:i})}while(e.match(",")&&!e.isAtEnd());const n=e.getPosition();return{type:"objectLiteral",properties:t,start:r.start,end:n.end,line:r.line,column:r.column}}const Rr=new Set(["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","pc","pt","px"]);class Mr{constructor(e,t,r){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 Lt({analyzer:t.semanticAnalyzer,language:t.language,confidenceThreshold:t.semanticConfidenceThreshold??.5})),this.originalInput=r||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:!1,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:!1,node:1===e.length?e[0]:this.createProgramNode(e),tokens:this.tokens,error:this.error,warnings:this.warnings}:{success:!0,node:1===e.length?e[0]:this.createProgramNode(e),tokens:this.tokens,warnings:this.warnings}}const e=this.peek(),t=e&&ce(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(),r=t?ce(t.value):void 0;if(r){const t=this.advance(),n=r(this.getContext(),t);n&&e.push(n);continue}break}{this.advance();const t=this.parseDefFeature();t&&e.push(t)}}return this.isAtEnd()?this.error?{success:!1,node:this.createProgramNode(e),tokens:this.tokens,error:this.error,warnings:this.warnings}:{success:!0,node:this.createProgramNode(e),tokens:this.tokens,warnings:this.warnings}:(this.addError("Unexpected token: "+this.peek().value),{success:!1,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")){const t=[e];let r=0;for(;!this.isAtEnd()&&this.check("on");){this.peek(),this.advance();const e=this.parseEventHandler();if(e&&(t.push(e),r++),this.isAtEnd()||this.peek(),this.isAtEnd(),this.check("on"),!this.isAtEnd()&&!this.check("on")){if(!this.isAtEnd())return this.peek(),this.addError("Unexpected token after event handlers: "+this.peek().value),{success:!1,node:this.createProgramNode(t),tokens:this.tokens,error:this.error};break}}return this.error?{success:!1,node:this.createProgramNode(t),tokens:this.tokens,error:this.error,warnings:this.warnings}:{success:!0,node:this.createProgramNode(t),tokens:this.tokens,warnings:this.warnings}}return this.isAtEnd()?this.error?{success:!1,node:e,tokens:this.tokens,error:this.error,warnings:this.warnings}:{success:!0,node:e,tokens:this.tokens,warnings:this.warnings}:(this.addError("Unexpected token: "+this.peek().value),{success:!1,node:e||this.createErrorNode(),tokens:this.tokens,error:this.error})}}const r=this.parseExpression();if(this.error)return{success:!1,node:r||this.createErrorNode(),tokens:this.tokens,error:this.error};if(!this.isAtEnd()){const e=this.peek();return r&&["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:!1,node:r||this.createErrorNode(),tokens:this.tokens,error:this.error,warnings:this.warnings}}return{success:!0,node:r,tokens:this.tokens,warnings:this.warnings}}catch(e){return this.addError(e instanceof Error?e.message:"Unknown parsing error"),{success:!1,node:this.createErrorNode(),tokens:this.tokens,error:this.error,warnings:this.warnings}}}parseExpression(){return this.parseExpressionPratt(0)}parseExpressionPratt(e){const t=`${this.current}:${e}`,r=this.prattCache.get(t);if(r)return this.current=r.endPos,r.node;if(this.isAtEnd())return this.addError("Unexpected end of expression"),this.createErrorNode();const n=this.peek(),i=Mr.PRATT_TABLE.get(n.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();if(60>=e){const e=this.tryParseStringPostfix(a,t);if(e){a=e;continue}}const r=Mr.PRATT_TABLE.get(t.value);if(!r?.infix){if(G.has(t.value)||Y.has(t.value))break;break}const[n]=r.infix.bp;if(e>n)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){}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()&&!Mr.POSTFIX_UNARY_OPERATORS.has(i.value))return this.addError(`Expected expression after '${i.value}' operator`),a;a=r.infix.handler(a,i,this.makePrattContext())}return this.prattCache.set(t,{node:a,endPos:this.current}),a}tryParseStringPostfix(e,t){const r=t.value;let n=null;if(Rr.has(r))n=r;else if("%"===r){this.canStartOperand(this.tokens.length>this.current+1?this.tokens[this.current+1]:null)||(n="%")}if(null==n)return null;const i=this.advance();return{type:"stringPostfix",expression:e,unit:n,start:e.start,end:i.end,line:e.line,column:e.column}}canStartOperand(e){if(!e)return!1;const t=e.value;return!G.has(t)&&!Y.has(t)&&("number"===e.kind||"string"===e.kind||"identifier"===e.kind||"symbol"===e.kind||["(","[","{","-","+","!","#",".","<","$","@"].includes(t))}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||(G.has(t.value)||Y.has(t.value))},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):V.isCommand(e)}isKeyword(e){return this.keywordResolver?this.keywordResolver.isKeyword(e):V.isKeyword(e)}createCommandFromIdentifier(e){const t=[],r=this.resolveKeyword(e.name.toLowerCase());if(this.isCompoundCommand(r))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:!1,...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 V.isCompoundCommand(e)}parseCompoundCommand(e){return Lr(this.getContext(),e)}parsePutCommand(e){return Sr(this.getContext(),e)}parseSetCommand(e){return Ar(this.getContext(),e)}parseHaltCommand(e){return wr(this.getContext(),e)}parseMeasureCommand(e){return xr(this.getContext(),e)}parseTriggerCommand(e){return br(this.getContext(),e)}parseCommandListUntilTerminator(e){const t=[],r=()=>this.check("end")||e.some(e=>this.check(e));for(e.join(",");!this.isAtEnd()&&!r();){this.peek(),this.peek();let e=!1;const n=this.checkIsCommand(),i=!n&&this.checkIdentifier()&&this.isCommand(this.peek().value);if(n||i){this.peek(),this.advance();const r=this.error;try{const n=this.parseCommand();this.error&&this.error!==r&&(this.error=r),n&&(t.push(n),e=!0)}catch(e){this.error=r}}else this.checkIdentifier()&&this.peek();if(!e){this.peek();break}for(this.peek();!(this.isAtEnd()||r()||this.checkIsCommand()||this.isCommand(this.peek().value)||this.check("then")||this.check("and")||this.check(","));)this.peek(),this.advance();if(!this.match("then","and",",")&&(!this.checkIsCommand()&&!this.isCommand(this.peek().value))){this.peek();break}}let n="end";for(const t of e)if(this.check(t)){n=t;break}return this.check("end")||e.some(e=>this.check(e))||(n=""),{commands:t,terminator:n}}parseCommandListUntilEnd(){const{commands:e}=this.parseCommandListUntilTerminator([]);if(this.peek(),!this.check("end"))throw this.peek(),this.peek(),Error('Expected "end" to close repeat block');return this.advance(),e}parseCommandListUntilEndOrElse(){const{commands:e,terminator:t}=this.parseCommandListUntilTerminator(["else"]),r="else"===t;if(!r){if(!this.check("end"))throw Error('Expected "end" to close repeat block');this.advance()}return{commands:e,hasElse:r}}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 r=[];let n="forever",i=null,a=null,o=null,s=null,l=null,c=null;if(e.check(u)){e.advance(),n=u;const t=e.peek();Mt(t)&&(l=t.value,e.advance()),e.check(v)&&(e.advance(),s=e.parseExpression())}else if(e.check(v))e.advance(),n=u,l="it",s=e.parseExpression();else if(e.check(p))e.advance(),n=p,o=e.parseExpression();else if(e.check(m))if(e.advance(),n=m,e.check(T)){e.advance(),n="until-event";const t=e.peek();if(!Mt(t)&&!Nt(t))throw Error('Expected event name after "event"');i=t.value,e.advance(),e.peek(),e.peek(),e.check(k)&&(e.advance(),e.peek(),vr(e,j),e.peek(),a=e.parsePrimary())}else o=e.parseExpression();else e.check(d)?(e.advance(),n=d):(c=e.parseExpression(),e.check(f)&&(e.advance(),n=f));let h,g=null;if(e.check(b)){const t=e.peekAt(1);t&&t.value.toLowerCase()===y&&(e.advance(),e.advance(),g=y)}else if(e.check(y)){e.advance();const t=e.peek();Mt(t)?(g=t.value,e.advance()):g=y}let w=null,z=!1;if(n===d){const t=e.parseRepeatBody();if(h=t.commands,"else"===t.terminator)e.advance(),w=e.parseCommandListUntilEnd();else if("until"===t.terminator||"while"===t.terminator){if(z=!0,n=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();h=t.commands,t.hasElse&&(e.advance(),w=e.parseCommandListUntilEnd())}r.push({type:"identifier",name:n,start:t.start,end:t.end,line:t.line,column:t.column});const x={start:t.start,end:t.end,line:t.line,column:t.column};l&&r.push(ar(l,x)),s&&r.push(s),o&&r.push(o),c&&r.push(c),i&&r.push(ar(i,x)),a&&r.push(a),g&&r.push(ar(g,x)),r.push(ir(h,{...x,end:x.end||0})),null!==w&&r.push(ir(w,{...x,end:x.end||0}));const E=kr.from(t).withArgs(...r);return z&&E.withModifier("bottomTested",{type:"literal",value:!0,...x}),E.endingAt(e.getPosition()).build()}(this.getContext(),e)}parseForCommand(e){return function(e,t){const r=[];let n=null,i=null;e.check(h)&&e.advance();const a=e.peek();if(!Mt(a))throw Error('Expected variable name after "for"');if(n=a.value,e.advance(),!e.check(v))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(b)){const t=e.peekAt(1);t&&t.value.toLowerCase()===y&&(e.advance(),e.advance(),o=y)}else if(e.check(y)){e.advance();const t=e.peek();Mt(t)?(o=t.value,e.advance()):o=y}const s=e.parseCommandListUntilEnd();r.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 r.push(ar(n,l)),r.push(i),o&&r.push(ar(o,l)),r.push(ir(s,{...l,end:l.end||0})),kr.from({...t,value:"repeat"}).withArgs(...r).endingAt(e.getPosition()).build()}(this.getContext(),e)}parseWaitCommand(e){return function(e,t){const r=[];if(e.checkTimeExpression()||e.checkLiteral()||e.checkContextVar()||e.check("(")||e.checkIdentifierLike()&&!e.check("for")&&!dr(e)){const n=e.parseExpression();return r.push(n),kr.from(t).withArgs(...r).blocking().endingAt(e.getPosition()).build()}if(e.check("for")){e.advance();const n=[];do{const t=e.peek();if(!Mt(t))throw Error('Expected event name after "for"');const r=t.value;e.advance();const i=[];if(e.check("(")){for(e.advance();!e.isAtEnd()&&!e.check(")");){const t=e.peek();if(!Mt(t))break;i.push(t.value),e.advance(),e.check(",")&&e.advance()}if(!e.check(")"))throw Error('Expected ")" after event parameters');e.advance()}if(n.push({name:r,params:i}),!e.check("or"))break;e.advance()}while(!e.isAtEnd());let i=null;e.check(k)&&(e.advance(),vr(e,j),i=e.parsePrimary());const a={start:t.start,end:e.getPosition().end,line:t.line,column:t.column};r.push(sr(n.map(e=>or([{key:rr("name",a),value:tr(e.name,`"${e.name}"`,a)},{key:rr("args",a),value:sr(e.params.map(e=>tr(e,`"${e}"`,a)),a)}],a)),a)),i&&r.push(i)}return kr.from(t).withArgs(...r).blocking().endingAt(e.getPosition()).build()}(this.getContext(),e)}parseInstallCommand(e){return function(e,t){const r=[];if(!e.checkIdentifierLike())throw Error('Expected behavior name after "install"');const n=e.advance().value,i=e.previous();if(r.push(rr(n,{start:i.start,end:i.end,line:i.line,column:i.column})),e.check("(")){e.advance();const n=[];for(;!e.isAtEnd()&&!e.check(")");)if(n.push(gr(e)),e.check(","))e.advance();else if(!e.check(")"))break;if(!e.check(")"))throw Error('Expected ")" after behavior parameters');if(e.advance(),n.length>0){const i={start:t.start,end:e.getPosition().end,line:t.line,column:t.column};r.push(or(n.map(e=>({key:e.name?rr(e.name,i):tr("_positional","_positional",i),value:e.value})),i))}}return kr.from(t).withArgs(...r).endingAt(e.getPosition()).build()}(this.getContext(),e)}parseTransitionCommand(e){return function(e,t){const r=[],n={};let i=null;const a=e.peek();if(Mt(a)||"*"===a.value){let t="";e.check("*")&&(t="*",e.advance());const r=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);r&&(t+=r,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(r.push(i),!e.check(g))throw Error('Expected "to" keyword after property in transition command');e.advance();const o=e.parsePrimary();if(n.to=o,e.check("over")){e.advance();const t=e.parsePrimary();n.over=t}if(e.check(b)){e.advance();const t=e.parsePrimary();n.with=t}return kr.from(t).withArgs(...r).withModifiers(n).endingAt(e.getPosition()).build()}(this.getContext(),e)}parseAddCommand(e){return function(e,t){const r=[];if(e.match("{"))r.push(e.parseCSSObjectLiteral());else{const t=fr(e,[g]);t&&r.push(t)}if(e.check(g)){e.advance();const t=fr(e);t&&r.push(t)}return kr.from(t).withArgs(...r).endingAt(e.getPosition()).build()}(this.getContext(),e)}parseIfCommand(e){return zr(this.getContext(),e)}parseRemoveCommand(e){return Er(this.getContext(),e)}parseToggleCommand(e){return Tr(this.getContext(),e)}parseRegularCommand(e){return jr(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),!1)}else if(this.match("?.")){const t=this.consumeIdentifierLike("Expected property name after '?.' - malformed optional access"),r=this.createMemberExpression(e,this.createIdentifier(t.value),!1);r.optional=!0,e=r}else if(this.match("[")){const t=this.parseExpression();this.consume("]","Expected ']' after array index"),e=this.createMemberExpression(e,t,!0)}else{if(!this.check("'s"))break;{let t;if(this.advance(),this.check("*")){this.advance();t="*"+this.consumeIdentifier("Expected property name after * in CSS property syntax").value}else if(Dt(this.peek())&&this.peek().value.startsWith("@"))t=this.advance().value;else if(this.check("[")&&this.tokens[this.current+1]?.value?.startsWith("@"))this.advance(),t=this.advance().value,this.consume("]","Expected ']' after attribute reference");else{t=this.consumeIdentifierLike("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()&&Mt(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),r=this.processEscapeSequences(t);return this.createLiteral(r,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=!0;break;case"false":t=!1;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,t=e.slice(1,-2).trim(),r=this.createSelector(t);return r.fromQuery=!0,r.raw=e,r}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(Ht)||this.matchPredicate(Ot)||this.matchPredicate(It)||this.matchPredicate(Pt)||this.matchPredicate(Nt))){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,r=this.createSelector("."+t);return this.createCallExpression(this.createIdentifier(e.value),[r])}this.current=t}if(this.check("#")){const t=this.current;if(this.advance(),this.checkIdentifier()){const t=this.advance().value,r=this.createSelector("#"+t);return this.createCallExpression(this.createIdentifier(e.value),[r])}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("?.");if("my"===e.value&&!t)return this.parseContextPropertyAccess("me");if("its"===e.value&&!t)return this.parseContextPropertyAccess("it");if("your"===e.value&&!t)return this.parseContextPropertyAccess("you");if("the"===e.value)return this.parseTheXofY();if("values"===e.value&&this.check("of")){this.advance();return{type:"propertyOfExpression",property:{type:"identifier",name:"values"},target:this.parsePrimary(),line:e.line,column:e.column}}return this.createIdentifier(e.value)}if(this.match("$"))return this.parseDollarExpression();if("\\"===this.peek().value)return this.parseBlockLiteral();if(Dt(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()}parseBlockLiteral(){const e=this.peek().start;this.advance();const t=[];for(;!(this.isAtEnd()||this.check("-")&&">"===this.tokens[this.current+1]?.value);){if(!this.checkIdentifier()){this.addError("Unexpected token in block literal parameters: "+this.peek().value);break}t.push(this.advance().value),this.match(",")}if(!this.check("-")||">"!==this.tokens[this.current+1]?.value)return this.addError("Expected '->' in block literal"),this.createErrorNode();this.advance(),this.advance();return{type:"blockLiteral",parameters:t,body:this.parseExpression(),start:e,end:this.previous().end,line:this.previous().line,column:this.previous().column}}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),!1)}}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.check("["))this.advance(),t=this.parseExpression(),this.consume("]","Expected ']' after computed property name in object literal");else if(this.matchString()){const e=this.previous().value,r=e.slice(1,-1);t=this.createLiteral(r,e)}else{if(!this.check("-")&&!this.checkPredicate(Ht))return this.addError("Expected property name in object literal"),this.createErrorNode();{let e="",r=!1;for(;this.check("-");)this.advance(),e+="-",r=!0;for(this.checkPredicate(Ht)&&(e+=this.advance().value);this.check("-");)this.advance(),e+="-",r=!0,this.checkPredicate(Ht)&&(e+=this.advance().value);if(""===e||"-"===e)return this.addError("Expected property name in object literal"),this.createErrorNode();t=r?this.createLiteral(e,e):this.createIdentifier(e)}}this.consume(":","Expected ':' after property name in object literal");const r=this.parseExpression();if(e.push({key:t,value:r}),!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 r;if(this.matchPredicate(Ht))r=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);r=this.createLiteral(t,e)}}if(!this.consume(":","Expected ':' after CSS property name"))return this.createErrorNode();const n=[];let i=!1,a=0,o=-1,s=-1;for(;!this.isAtEnd()&&(0!==a||!this.check(";")&&!this.check("}"));){const e=this.advance();n.push(e.value),0>o&&"number"==typeof e.start&&(o=e.start),"number"==typeof e.end&&(s=e.end),"$"===e.value&&this.check("{")&&(i=!0),"{"===e.value&&a++,"}"===e.value&&a--}const l=this.originalInput&&o>=0&&s>o?this.originalInput.slice(o,s):n.join(""),c=i?{type:"templateLiteral",value:l,start:e.start,end:this.getPosition().end,line:e.line,column:e.column}:this.createLiteral(l,l);if(t.push({key:r,value:c}),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(),r=t.value;if(!this.check("("))return this.addError('Expected "(" after constructor name'),this.createErrorNode();this.advance();const n=[];if(!this.check(")"))do{n.push(this.parseExpression())}while(this.match(","));return this.consume(")","Expected ')' after constructor arguments"),{type:"callExpression",callee:{type:"identifier",name:r,start:t.start,end:t.end,line:t.line,column:t.column},arguments:n,isConstructor:!0,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 r=[];if(this.check("(")){if(this.advance(),!this.check(")"))for(this.checkIdentifier()&&r.push(this.advance().value);this.check(",");)this.advance(),this.checkIdentifier()&&r.push(this.advance().value);this.consume(")","Expected ')' after parameter list")}const n=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:r,body:n,...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 r=t.value;if(this.check(":")){this.advance();r=`${r}:${this.advance().value}`}return r}callExprToCommandNode(e,t){return{type:"command",name:e.callee.name,args:e.arguments,isBlocking:!1,...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,r,n,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)}},...r?[{key:{type:"identifier",name:"preposition"},value:{type:"literal",value:r,raw:`"${r}"`}}]:[],{key:{type:"identifier",name:"targetExpression"},value:n}]}],isBlocking:!1,...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 r=e.callee.name,n=this.peek();if(!(Mr.PSEUDO_COMMAND_PREPOSITIONS.includes(n.value.toLowerCase())||Ht(n)&&!this.isCommand(n.value)||It(n)))return{node:this.callExprToCommandNode(e,t),isPseudo:!1,targetFailed:!1};let i,a;this.isCommand(r)&&this.addWarning({type:"command-shadow",message:`Method '${r}' shadows hyperscript command`,suggestions:[`Rename method to avoid confusion (e.g., '${r}Fn', 'my${r.charAt(0).toUpperCase()+r.slice(1)}')`,`Use 'call' command instead: call ${r}(...)`,"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}}),Mr.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:!1,targetFailed:!0}}return{node:this.createPseudoCommandNode(r,e,i,a,t),isPseudo:!0,targetFailed:!1}}parseCommandWithErrorRecovery(){this.advance();const e=this.error;try{const t=this.parseCommand();return this.error&&this.error!==e&&(this.error=e),t}catch(t){return this.error=e,null}}parseEventHandler(){const e=[];let t=!1;if(this.check("first")&&!this.checkIsCommand()&&this.tokens.length>this.current+1){const e=this.tokens[this.current+1],r=e?.value?.toLowerCase();r&&"of"!==r&&"in"!==r&&"from"!==r&&(this.advance(),t=!0)}const r=this.parseEventNameWithNamespace("Expected event name after 'on'");for(e.push(r);this.check("or");){this.advance();const t=this.parseEventNameWithNamespace("Expected event name after 'or'");e.push(t)}let n;if(e.join(", "),this.registryIntegration){const t=e[0];if(this.registryIntegration.hasEventSource(t)){const e=this.registryIntegration.getEventSource(t);n=e?.name}}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"),i.join(", ")}const a={};for(;this.check(".");){this.advance();const e=this.advance().value.toLowerCase();if("once"===e)a.once=!0;else if("prevent"===e)a.prevent=!0;else if("stop"===e)a.stop=!0;else if("debounce"===e||"throttle"===e){if(!this.check("("))throw Error(`Expected '(' after '.${e}'`);{this.advance();const t=this.advance(),r=parseInt(t.value,10);if(isNaN(r))throw Error(`Expected number for ${e} delay, got: ${t.value}`);"debounce"===e?a.debounce=r:a.throttle=r,this.consume(")",`Expected ')' after ${e} delay`)}}}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 e=this.advance(),r=(o=e.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}else if(this.matchNumber()){const e=parseInt(this.previous().value,10);a[t]=e}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=!0),Object.keys(a),this.match("[")&&(s=this.parseExpression(),this.consume("]","Expected ']' after event condition")),this.match("from")){const e=this.advance();l=e.value}if(this.match("of")){const e=this.advance();c=e.value.startsWith("@")?e.value.substring(1):e.value}this.match("in")&&(u=this.parseExpression());const p=[];for(this.isAtEnd()||this.peek(),this.isAtEnd();!this.isAtEnd()&&(this.peek(),this.peek(),!this.check("on"));)if(this.checkComment())this.peek(),this.advance();else{if(this.check("end")){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 r=this.parseCommand();p.push(r);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),this.isAtEnd()||this.peek())}}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){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 r={type:"command",name:t.left.name,args:[t.right],isBlocking:!1,...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(r)}}}}}}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&&{args:i},...s&&{condition:s},...l&&{target:l},...c&&{attributeName:c},...u&&{watchTarget:u},...n&&{customEventSource:n},...Object.keys(a).length>0&&{modifiers:a},start:m.start,end:m.end,line:m.line,column:m.column};return e.join(", "),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 r=[];if(this.match("(")){if(!this.check(")"))do{const e=this.consumeIdentifierLike("Expected parameter name");r.push(e.value)}while(this.match(","));this.consume(")","Expected ')' after behavior parameters")}const n=new Set(r),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'"),r=[];if(this.check("(")){for(this.advance();!this.isAtEnd()&&!this.check(")");){const e=this.peek();Ht(e)?(r.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(),r=n.has(t.value);this.checkIsCommand()&&!r||(e.push(t.value),a=t.value,this.advance())}}const o={type:"eventHandler",event:t,commands:this.parseCommandListUntilEnd(),...void 0!==a&&{target:a},...r.length>0&&{args:r},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")}this.consume("end","Expected 'end' to close behavior definition");return{type:"behavior",name:t,parameters:r,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,r=this.parseCommand();if(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")||(this.error=t)}for(e.push(r);!(this.isAtEnd()||this.checkIsCommand()||this.isCommand(this.peek().value)||this.check("then")||this.check("on"));)this.peek(),this.advance();if(this.check("on"))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(),r=this.getPosition(),n="Expected command, got: "+t.value;this.addError(n);const i=cr(r,n,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 ur.find(t=>t.command===e.toLowerCase())||null}(e)}isTokenKeyword(e,t){return pr(e,t)}parseMultiWordCommand(e,t){return function(e,t,r){const n=e.getMultiWordPattern(r);if(!n)return null;const i=[],a={};for(;!dr(e,["catch","finally",...n.keywords])&&!pr(e.peek(),n.keywords);){const t=e.parsePrimary();if(!t)break;if(i.push(t),!e.match(",")&&pr(e.peek(),n.keywords))break}for(;!e.isAtEnd()&&pr(e.peek(),n.keywords);){const t=e.advance().value,r=e.parseExpression();if(r&&(a[t]=r),!pr(e.peek(),n.keywords))break}const o=kr.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?t.node:null}catch(e){return 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(),r=t.value.toLowerCase();if(e.includes(r))break;if(Pt(t))break;this.advance()}}parseCommand(){const e=this.parseCommandCore();if(e&&"command"===e.type&&!e.body&&(this.check("when")||this.check("where"))){const t=this.peek().value.toLowerCase();this.advance();const r=this.parseExpression();r&&(e.modifiers={...e.modifiers??{},[t]:r})}return e}parseCommandCore(){const e=this.previous();let t=e.value;if(this.semanticAdapter&&!["install","wait","repeat","for","set","put","increment","decrement","add","append","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 Or(this.getContext(),e);const r=this.parseMultiWordCommand(e,t);if(r)return r;const n=t.toLowerCase();if("repeat"===n)return this.parseRepeatCommand(e);if("for"===n)return this.parseForCommand(e);if("if"===n||"unless"===n)return this.parseIfCommand(e);if("wait"===n)return this.parseWaitCommand(e);if("install"===n)return this.parseInstallCommand(e);if("transition"===n)return this.parseTransitionCommand(e);if("add"===n)return this.parseAddCommand(e);if(this.isCompoundCommand(n)){return this.parseCompoundCommand({type:"identifier",name:n,start:e.start||0,end:e.end||0,line:e.line,column:e.column})||function(e,t){return{type:"command",name:e,args:[],partial:!0,start:t.start,end:t.end,line:t.line,column:t.column}}(n,this.getPosition())}const i=[];if(("increment"===t||"decrement"===t)&&!this.isAtEnd())return function(e,t){const r=t.value,n="increment"===r?"+":"-";let i=!1;e.check(A)&&(i=!0,e.advance());const a=e.parseExpression();if(!a)throw Error("Expected variable or expression after "+r);let o;if(e.check(z)){e.advance();const t=e.parseExpression();if(!t)throw Error(`Expected amount after 'by' in ${r} command`);o=t}else o=tr(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=nr(n,a,o,l),u=[s,rr(g,l),c];return kr.from(t).withName("set").withArgs(...u).withOriginalCommand(r).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 r=i[i.length-1];if(!r||"identifier"!==r.type&&"keyword"!==r.type||!t.includes(r.name??r.value))break}const a=this.getPosition();return{type:"command",name:t,args:i,isBlocking:!1,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 r;this.match("else")&&(r=this.parseConditionalBranch());const n=this.getPosition();return{type:"conditionalExpression",test:e,consequent:t,alternate:r,start:n.start,end:n.end,line:n.line,column:n.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())}const r=this.createCallExpression(this.createIdentifier(e),t);if("next"===e||"previous"===e){const e=this.parseRelativePositionalModifiers();e&&(r.relativePositional=e)}return r}parseRelativePositionalModifiers(){if(!(this.check("from")||this.check("within")||this.check("in")||this.check("with")))return null;let e,t,r,n=!1,i=!1;return this.match("from")&&(e=this.parseRelativePositionalOperand()),this.match("in")?(n=!0,r=this.parseRelativePositionalOperand()):this.match("within")&&(t=this.parseRelativePositionalOperand()),this.match("with")&&(this.match("wrapping"),i=!0),{from:e,within:t,inElt:r,inSearch:n,wrapping:i}}parseRelativePositionalOperand(){return this.match("the"),this.parsePrimary()}parseTheXofY(){if(!this.checkIdentifier())return this.createIdentifier("the");const e=this.peek(),t=e.value;if(["first","last","next","previous","random","closest"].includes(t))return this.advance(),this.parseNavigationFunction(t);if(this.advance(),!this.check("of"))return this.createIdentifier(t);this.advance();return{type:"propertyOfExpression",property:{type:"identifier",name:t},target:this.parseCall(),line:e.line,column:e.column}}parseContextPropertyAccess(e){if(this.match("*")){let t="";if(!this.checkIdentifier())return this.addError("Expected property name after 'my *'"),this.createMemberExpression(this.createIdentifier(e),this.createIdentifier(""),!1);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 r="*"+t;return this.createMemberExpression(this.createIdentifier(e),this.createIdentifier(r),!1)}{if(this.check("[")&&this.tokens[this.current+1]?.value?.startsWith("@")){this.advance();const t=this.advance();return this.consume("]","Expected ']' after attribute reference"),this.createMemberExpression(this.createIdentifier(e),{type:"attributeAccess",attributeName:t.value.substring(1),start:t.start,end:t.end,line:t.line,column:t.column},!0)}if(Dt(this.peek())&&this.peek().value.startsWith("@")){const t=this.advance();return this.createMemberExpression(this.createIdentifier(e),this.createIdentifier(t.value),!1)}const t=this.consumeIdentifierLike(`Expected property name after '${{me:"my",it:"its",you:"your"}[e]}'`);return this.createMemberExpression(this.createIdentifier(e),this.createIdentifier(t.value),!1)}}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;V.isCSSFunction(t)}return this.consume(")","Expected ')' after arguments"),this.createCallExpression(e,t)}createLiteral(e,t){return tr(e,t,this.getPosition())}createIdentifier(e){return rr(e,this.getPosition())}createBinaryExpression(e,t,r){return nr(e,t,r,this.getPosition())}createUnaryExpression(e,t,r){return function(e,t,r,n){return{type:"unaryExpression",operator:e,argument:t,prefix:r,start:n.start,end:n.end,line:n.line,column:n.column}}(e,t,r,this.getPosition())}createCallExpression(e,t){return function(e,t,r){return{type:"callExpression",callee:e,arguments:t,start:r.start,end:r.end,line:r.line,column:r.column}}(e,t,this.getPosition())}createMemberExpression(e,t,r){return function(e,t,r,n){return{type:"memberExpression",object:e,property:t,computed:r,start:n.start,end:n.end,line:n.line,column:n.column}}(e,t,r,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,r){return{type:"possessiveExpression",object:e,property:t,start:r.start,end:r.end,line:r.line,column:r.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(0===e.length)return{type:"identifier",name:"__ERROR__",start:0,end:0,line:1,column:1};if(1===e.length)return 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 t}(e)}match(...e){for(const t of e)if(this.check(t))return this.advance(),!0;return!1}matchOperator(e){if(this.isAtEnd())return!1;const t=this.peek();return!(!Qt(t)||t.value!==e)&&(this.advance(),!0)}check(e){if(this.isAtEnd())return!1;const t=this.peek().value;return this.resolveKeyword(t)===e}checkPredicate(e){return!this.isAtEnd()&&e(this.peek())}matchPredicate(e){return!!this.checkPredicate(e)&&(this.advance(),!0)}checkSelector(){return this.checkPredicate(_t)}matchSelector(){return this.matchPredicate(_t)}checkAnySelector(){return this.checkPredicate(Wt)}checkLiteral(){return this.checkPredicate(qt)}checkIdentifierLike(){return this.checkPredicate(Mt)}checkIsCommand(){return this.checkPredicate(Pt)}checkCommandTerminator(){return this.checkPredicate(er)}checkReference(){return this.checkPredicate($t)}checkTimeExpression(){return this.checkPredicate(Vt)}checkEvent(){return this.checkPredicate(Nt)}checkContextVar(){return this.checkPredicate(It)}checkComment(){return this.checkPredicate(Bt)}checkIdentifier(){return this.checkPredicate(Ht)}checkKeyword(){return this.checkPredicate(Ot)}checkString(){return this.checkPredicate(Ft)}matchString(){return this.matchPredicate(Ft)}checkNumber(){return this.checkPredicate(Kt)}matchNumber(){return this.matchPredicate(Kt)}checkBoolean(){return this.checkPredicate(Ut)}matchBoolean(){return this.matchPredicate(Ut)}checkTemplateLiteral(){return this.checkPredicate(Gt)}matchTemplateLiteral(){return this.matchPredicate(Gt)}checkQueryReference(){return this.checkPredicate(Yt)}matchQueryReference(){return this.matchPredicate(Yt)}checkIdSelector(){return this.checkPredicate(Zt)}checkClassSelector(){return this.checkPredicate(Jt)}checkCssSelector(){return this.checkPredicate(Xt)}checkBasicOperator(){return this.checkPredicate(Qt)}matchBasicOperator(){return this.matchPredicate(Qt)}matchTimeExpression(){return this.matchPredicate(Vt)}matchIdentifierLike(){return this.matchPredicate(Mt)}matchComparisonOperator(){return this.matchPredicate(Rt)}consumePredicate(e,t){return this.checkPredicate(e)?this.advance():(this.addError(t),this.peek())}consumeIdentifier(e){return this.consumePredicate(Ht,e)}consumeIdentifierLike(e){return this.consumePredicate(Mt,e)}consumeEvent(e){return this.consumePredicate(Nt,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 r=t.start||0,n=t.line||1,i=t.column||1;if(e.includes("property name after '.'")){const e=this.current>0?this.previous():t;r=e.end||e.start||0,n=e.line||1,i=e.column||1}if(e.includes("parenthes")){const e=this.current>0?this.previous():t;r=e.end||e.start||0,n=e.line||1,i=e.column||1,0===r&&this.current>0&&(r=this.current)}if(e.includes("Expected expression after")){const e=this.current>0?this.previous():t;r=e.start||0,n=e.line||1,i=e.column||1,0===r&&(r=Math.max(1,this.current-1))}if(e.includes("Missing operand")){let e=t;for(let t=this.current-1;t>=0;t--){const r=this.tokens[t];if(r&&("+"===r.value||"-"===r.value)){e=r;break}}r=e.start||0,n=e.line||1,i=e.column||1}this.error={message:e,line:Math.max(1,n),column:Math.max(1,i),position:Math.max(0,r)},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;this.advance()}}parseAttributeOrArrayLiteral(){const e=this.previous().start,t=this.previous().line,r=this.previous().column;if(!this.isAtEnd()&&this.peek().value.startsWith("@")){const n=[];for(;!this.check("]")&&!this.isAtEnd();){const e=this.advance();n.push(e.value)}this.consume("]","Expected ']' after attribute literal");const i=n.join("");if(!i.includes("="))return{type:"attributeAccess",attributeName:i.replace(/^@/,""),start:e,end:this.previous().end,line:t,column:r};const a="["+i+"]";return{type:"literal",value:a,raw:a,start:e,end:this.previous().end,line:t,column:r}}const n=new Set(["=","~=","|=","^=","$=","*="]),i=this.tokens[this.current],a=this.tokens[this.current+1];if("identifier"===i?.kind&&("]"===a?.value||a&&n.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,r=this.advance().value;e+=t+'"'+(r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'")?r.slice(1,-1):r)+'"',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:r}}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 r=e.current+t;return r>=0&&e.tokens.length>r?e.tokens[r]: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:!0,configurable:!0}),t}}function Wr(e,t){const r=it(e);return new Mr(r,t,e).parse()}function _r(e,t){const r=e.registry?.get(t);if(!r)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 r}function qr(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 $r(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 Ur(e,t);const r=e;switch(e.type){case"literal":return function(e){return e.value}(r);case"identifier":return Ur(r,t);case"binaryExpression":return async function(e,t){const r=e.operator,n=e.right,i=e.left;if("="===r){const r=await $r(e.right,t);if("identifier"===i?.type&&"string"==typeof i.name){const e=i.name;return e.startsWith("$")?fe(t,e.slice(1),r):"global"===i.scope?fe(t,e,r):(t.locals||(t.locals=new Map),t.locals.set(e,r)),r}throw Error(`Assignment target must be a variable identifier (got '${i?.type??"undefined"}')`)}if("has"===r||"have"===r){const r=await $r(e.left,t);return!!(r instanceof Element&&"selector"===n.type&&"string"==typeof n.value&&n.value.startsWith("."))&&r.classList.contains(n.value.slice(1))}if("in"===r||"is in"===r){const r="callExpression"===i?.type&&"identifier"===i.callee?.type?i.callee.name:null;if(("first"===r||"last"===r)&&Array.isArray(i.arguments)){const n=i.arguments[0];if("selector"===n?.type&&"string"==typeof n.value){const i=await $r(e.right,t);if(i&&"function"==typeof i.querySelectorAll){const e=Array.from(i.querySelectorAll(n.value));return 0===e.length?null:"first"===r?e[0]:e[e.length-1]}}}if("selector"===i?.type&&i.fromQuery&&"string"==typeof i.value){const r=await $r(e.right,t),n=r&&"function"==typeof r.querySelectorAll?r:null;if(n)return Array.from(n.querySelectorAll(i.value))}}if("of"===r&&"selector"===i?.type&&"string"==typeof i.value&&/^\*[a-zA-Z][\w-]*$/.test(i.value)){const r=await $r(e.right,t);return _r(t,"styleRef").evaluate(t,i.value.slice(1),r)}if("of"===r){const r=Gr(e.left);if(r){const n=await $r(e.right,t);let i=n;for(const e of r){if(null==i)return;i=ze(i)?Ce(i,e):i[e]}return"function"==typeof i?i.bind(n):i}}const a=await $r(e.left,t);if("and"===r){if(!a)return a;const r=await $r(e.right,t);return _r(t,"and").evaluate(t,a,r)}if("or"===r){if(a)return a;const r=await $r(e.right,t);return _r(t,"or").evaluate(t,a,r)}const o=await $r(e.right,t),s=e=>"string"==typeof e?e.toLowerCase():e,l=e.ignoringCase?s(a):a,c=e.ignoringCase?s(o):o;switch(r){case"+":return"string"==typeof a||"string"==typeof o?(a??"")+""+(o??""):Array.isArray(a)?Array.isArray(o)?[...a,...o]:[...a,o]:qr(await _r(t,"addition").evaluate(t,{left:a,right:o}));case"-":return qr(await _r(t,"subtraction").evaluate(t,{left:a,right:o}));case"*":return qr(await _r(t,"multiplication").evaluate(t,{left:a,right:o}));case"/":return qr(await _r(t,"division").evaluate(t,{left:a,right:o}));case"%":case"mod":return qr(await _r(t,"modulo").evaluate(t,{left:a,right:o}));case"^":case"**":return qr(await _r(t,"power").evaluate(t,{left:a,right:o}));case">":case"is greater than":return _r(t,"greaterThan").evaluate(t,a,o);case"<":case"is less than":return _r(t,"lessThan").evaluate(t,a,o);case">=":case"is greater than or equal to":return _r(t,"greaterThanOrEqual").evaluate(t,a,o);case"<=":case"is less than or equal to":return _r(t,"lessThanOrEqual").evaluate(t,a,o);case"==":return _r(t,"equals").evaluate(t,l,c);case"is":case"am":case"equals":case"is equal":case"is equal to":{const r=Jr(e,a,o);return void 0!==r?r:_r(t,"equals").evaluate(t,l,c)}case"!=":return _r(t,"notEquals").evaluate(t,l,c);case"is not":case"is not equal":case"is not equal to":{const r=Jr(e,a,o);return void 0!==r?!r:_r(t,"notEquals").evaluate(t,l,c)}case"===":case"really equals":case"is really":case"is really equal to":return _r(t,"strictEquals").evaluate(t,l,c);case"!==":case"is not really":case"is not really equal to":return _r(t,"strictNotEquals").evaluate(t,l,c);case"as":return _r(t,"as").evaluate(t,a,Qr(o));case"contains":case"contain":case"includes":case"include":return _r(t,"contains").evaluate(t,l,c);case"does not contain":case"do not contain":case"does not contains":case"does not include":return _r(t,"doesNotContain").evaluate(t,l,c);case"starts with":return _r(t,"startsWith").evaluate(t,l,c);case"ends with":return _r(t,"endsWith").evaluate(t,l,c);case"does not start with":return!await _r(t,"startsWith").evaluate(t,l,c);case"does not end with":return!await _r(t,"endsWith").evaluate(t,l,c);case"match":case"matches":return _r(t,"matches").evaluate(t,l,Zr(e.right,c));case"does not match":case"do not match":return!await _r(t,"matches").evaluate(t,l,Zr(e.right,c));case"in":case"is in":case"am in":return Yr(a,o);case"is not in":case"am not in":return!Yr(a,o);case"of":return o&&"object"==typeof o?o[a]:void 0;case"precedes":return Xr(a,o,Node.DOCUMENT_POSITION_FOLLOWING);case"does not precede":return!Xr(a,o,Node.DOCUMENT_POSITION_FOLLOWING);case"follows":return Xr(a,o,Node.DOCUMENT_POSITION_PRECEDING);case"does not follow":return!Xr(a,o,Node.DOCUMENT_POSITION_PRECEDING);default:throw Error("Unknown binary operator: "+r)}}(r,t);case"asExpression":return async function(e,t){const r=await $r(e.expression,t),n=Qr(e.targetType);return _r(t,"as").evaluate(t,r,n)}(r,t);case"betweenExpression":return async function(e,t){const r=await $r(e.value,t),n=await $r(e.min,t),i=await $r(e.max,t),a=e=>"string"==typeof e?e.toLowerCase():e,[o,s,l]=e.ignoringCase?[a(r),a(n),a(i)]:[r,n,i],c=await _r(t,"between").evaluate(t,o,s,l);return e.negated?!c:c}(r,t);case"typeCheckExpression":return async function(e,t){const r=await $r(e.value,t),n=e.typeName+"",i=!1!==e.nullOk,a=function(e,t,r){if(null==e&&r)return!0;const n=Object.prototype.toString.call(e).slice(8,-1);if(n===t)return!0;const i=globalThis[t];return"function"==typeof i&&e instanceof i}(r,n,i);return e.negated?!a:a}(r,t);case"collectionExpression":return async function(e,t){const r=await $r(e.collection,t);if(null==r)return r;const n=async(e,r)=>$r(e,{...t,it:r});switch(e.operator){case"where":return async function(e,t,r){const n=et(e),i=[];for(const e of n)await r(t,e)&&i.push(e);return i}(r,e.right,n);case"sorted by":return async function(e,t,r,n){const i=[...et(e)],a=await Promise.all(i.map(e=>n(t,e))),o=i.map((e,t)=>t);o.sort((e,t)=>{const r=a[e],n=a[t];return r===n?0:null==r?1:null==n||n>r?-1:1});const s=o.map(e=>i[e]);return"desc"===r?s.reverse():s}(r,e.right,e.order??"asc",n);case"mapped to":return async function(e,t,r){const n=et(e);return Promise.all(n.map(e=>r(t,e)))}(r,e.right,n);case"split by":{const n=await $r(e.right,t);return a=n,null==(i=r)?[]:(i+"").split(null==a?"":a+"")}case"joined by":return function(e,t){const r=null==t?"":t+"";return et(e).map(e=>null==e?"":e+"").join(r)}(r,await $r(e.right,t));default:throw Error("Unknown collection operator: "+e.operator)}var i,a}(r,t);case"unaryExpression":return async function(e,t){const r=e.operand??e.argument;if(!r)throw Error(`Unary expression has no operand (operator: ${e.operator})`);const n=await $r(r,t);switch(e.operator){case"not":case"!":return _r(t,"not").evaluate(t,n);case"no":return _r(t,"no").evaluate(t,n);case"-":return-n;case"+":return+n;case"exists":case"some":return _r(t,"exists").evaluate(t,n);case"does not exist":return _r(t,"doesNotExist").evaluate(t,n);case"is empty":return _r(t,"isEmpty").evaluate(t,n);case"is not empty":return _r(t,"isNotEmpty").evaluate(t,n);default:throw Error("Unknown unary operator: "+e.operator)}}(r,t);case"memberExpression":return async function(e,t){const r=await $r(e.object,t);if(e.computed){const n=await $r(e.property,t);return Array.isArray(r)&&"number"==typeof n&&0>n?r[r.length+n]:r?.[n]}return nn(r,e.property.name,t)}(r,t);case"propertyAccess":return async function(e,t){let r=await $r(e.object,t);for(const n of(e.property+"").split(".")){if(null==r)return;r=await nn(r,n,t)}return r}(r,t);case"callExpression":return async function(e,t){const r=await $r(e.callee,t);if(e.isConstructor&&"function"==typeof r){return new r(...await Promise.all(e.arguments.map(e=>$r(e,t))))}if("identifier"===e.callee.type){const n=e.callee.name,i=await async function(e,t,r){if(!an.has(t))return Promise.all(e.map(e=>$r(e,r)));return Promise.all(e.map(e=>"identifier"===e.type&&e.name?e.name:"selector"===e.type&&e.value?e.value:$r(e,r)))}(e.arguments,n,t);switch(n){case"closest":return _r(t,"closest").evaluate(t,...i);case"previous":case"next":{const r=e.relativePositional;if(r){const e=r.from?on(await $r(r.from,t)):t.me,a=r.within?on(await $r(r.within,t)):void 0,o=r.inElt?await $r(r.inElt,t):void 0;return _r(t,n).evaluate(t,i[0],e,{within:a,inElt:o,inSearch:r.inSearch,wrapping:r.wrapping})}return _r(t,n).evaluate(t,...i)}case"first":return _r(t,"first").evaluate(t,...i);case"last":return _r(t,"last").evaluate(t,...i);default:if("function"==typeof r)return r(...i);throw Error("Cannot call non-function: "+n)}}if("function"==typeof r){const n=await Promise.all(e.arguments.map(e=>$r(e,t)));if("memberExpression"===e.callee.type&&e.callee.object){const i=await $r(e.callee.object,t);return r.apply(i,n)}return r(...n)}throw Error("Cannot call non-function")}(r,t);case"selector":return async function(e,t){let r=e.value;if("string"==typeof r&&!e.fromQuery&&/^\*[a-zA-Z][\w-]*$/.test(r))return _r(t,"styleRef").evaluate(t,r.slice(1));if("string"==typeof r&&e.fromQuery&&/\$[^=]/.test(r)){const{selector:n,elements:i}=await async function(e,t){const r=pn(e),n=await Promise.all(r.filter(e=>"expr"in e).map(e=>Hr(e.expr,t)));return mn(r,n)}(r,t),a=cn(e,n);i.forEach((e,t)=>e.setAttribute("data-hs-query-id",t+""));try{return await _r(t,"elementWithSelector").evaluate(t,a)}finally{i.forEach(e=>e.removeAttribute("data-hs-query-id"))}}"string"==typeof r&&!e.fromQuery&&r.includes("{")&&(r=await function(e,t){return rn(e,/\{([^}]*)\}/g,async(e,r)=>(await Hr(r.trim(),t)??"")+"")}(r,t));const n="string"==typeof r?cn(e,r):r,i=await _r(t,"elementWithSelector").evaluate(t,n);if(!e.fromQuery&&"string"==typeof r&&r.startsWith("#"))return Array.isArray(i)?i[0]??null:i;return i}(r,t);case"contextReference":return async function(e,t){switch(e.contextType){case"me":case"you":case"it":return _r(t,e.contextType).evaluate(t);case"my":case"myself":case"I":return _r(t,"me").evaluate(t);case"your":case"yourself":return _r(t,"you").evaluate(t);case"its":return _r(t,"it").evaluate(t);case"event":return t.event;case"target":return t.target??t.event?.target??_r(t,"me").evaluate(t);case"body":return"undefined"!=typeof document?document.body:void 0;case"document":return _r(t,"document").evaluate(t);case"window":return _r(t,"window").evaluate(t);default:return}}(r,t);case"possessiveExpression":return async function(e,t){const r=await $r(e.object,t),n=e.property.name;return _r(t,"possessive").evaluate(t,r,n)}(r,t);case"eventHandler":return async function(e,t){return{event:e.event,selector:e.selector,commands:e.commands,handler:async r=>{const n={...t,event:r,target:r.target,currentTarget:r.currentTarget};for(const t of e.commands)await $r(t,n)}}}(r,t);case"conditionalExpression":return async function(e,t){const r=await $r(e.test,t);if(r)return $r(e.consequent,t);if(e.alternate)return $r(e.alternate,t);return}(r,t);case"string":return r.value;case"arrayLiteral":return async function(e,t){const r=[];for(const n of e.elements)r.push(await $r(n,t));return r}(r,t);case"objectLiteral":return async function(e,t){const r={};for(const n of e.properties){const e=n.key;let i;i="identifier"===e.type?e.name:"literal"===e.type&&"string"===e.valueType?e.value:await $r(e,t)+"",r[i]=await $r(n.value,t)}return r}(r,t);case"attributeAccess":return async function(e,t){const r=e.attributeName;if(t.me&&t.me instanceof Element)return t.me.getAttribute(r);return"@"+r}(r,t);case"propertyOfExpression":return async function(e,t){const r=e.property;if("identifier"!==r?.type)throw Error('Property name must be an identifier in "the X of Y" pattern');const n=r.name,i=await $r(e.target,t);if(null==i)throw Error(`Cannot access property "${n}" of ${i}`);return _r(t,"possessive").evaluate(t,i,n)}(r,t);case"templateLiteral":return async function(e,t){let r=e.value;return r=await rn(r,/\$([a-zA-Z_$][a-zA-Z0-9_.$]*|\d+)/g,async(e,r)=>{try{if(/^\d+$/.test(r))return r;if(r.includes(".")){const e=r.split(".");let n=tn(e[0],t);for(let t=1;e.length>t&&null!=n;t++)n=n[e[t]];return(n??"")+""}return(tn(r,t)??"")+""}catch{return""}}),r=await rn(r,/\$(?:\{([^}]+)\}|\(([^)]+)\))/g,async(e,r,n)=>{const i=r||n;try{return await Hr(i,t)+""}catch{return"undefined"}}),r}(r,t);case"stringPostfix":return async function(e,t){const r=await $r(e.expression,t);return`${r}${e.unit}`}(r,t);case"blockLiteral":return en(r,t);default:{const r=ne.get(e.type);if(r)return r(e,t);throw Error("Unknown AST node type: "+e.type)}}}Mr.POSTFIX_UNARY_OPERATORS=new Set(["exists","does not exist","is empty","is not empty","ignoring case"]),Mr.PRATT_TABLE=te,Mr.PSEUDO_COMMAND_PREPOSITIONS=["from","on","with","into","at","to"];class Vr extends Error{constructor(e){super(`Expression node "${e}" is not synchronously evaluable`),this.name="NotSyncEvaluable"}}function Dr(e,t){const r=e;switch(r?.type){case"literal":case"string":return r.value;case"selector":return function(e,t){const r=e.value;if("string"!=typeof r)throw new Vr("selector");if(!e.fromQuery&&/^\*[a-zA-Z][\w-]*$/.test(r))throw new Vr("selector");if(e.fromQuery&&/\$[^=]/.test(r)){const{selector:n,elements:i}=function(e,t){const r=pn(e),n=r.filter(e=>"expr"in e).map(e=>Br(e.expr,t));return mn(r,n)}(r,t),a=cn(e,n),o=t?.me?.ownerDocument??("undefined"!=typeof document?document:null);if(!o)throw new Vr("selector");i.forEach((e,t)=>e.setAttribute("data-hs-query-id",t+""));try{return Array.from(o.querySelectorAll(a))}finally{i.forEach(e=>e.removeAttribute("data-hs-query-id"))}}const n=!e.fromQuery&&r.includes("{")?function(e,t){return e.replace(/\{([^}]*)\}/g,(e,r)=>(Br(r.trim(),t)??"")+"")}(r,t):r,i=cn(e,n),a=t?.me?.ownerDocument??("undefined"!=typeof document?document:null);if(!a)throw new Vr("selector");const o=Array.from(a.querySelectorAll(i));if(!e.fromQuery&&n.startsWith("#"))return o[0]??null;return o}(r,t);case"identifier":return function(e,t){return"me"===e||"my"===e||"I"===e?t.me:"you"===e||"your"===e||"yourself"===e?t.you:"it"===e||"its"===e?t.it??t.result:"window"===e?"undefined"!=typeof window?window:globalThis:"document"===e?"undefined"!=typeof document?document:void 0:t.locals?.has(e)?t.locals.get(e):t.globals?.has(e)?t.globals.get(e):e.startsWith("$")&&t.globals?.has(e.slice(1))?t.globals.get(e.slice(1)):void 0!==t[e]?t[e]:"undefined"!=typeof globalThis&&e in globalThis?globalThis[e]:void 0}(r.name,t);case"contextReference":return function(e,t){switch(e){case"me":return t.me;case"you":return t.you;case"it":return t.it??t.result;case"event":return t.event;case"target":return t.target??t.event?.target??t.me;default:throw new Vr("contextReference")}}(r.contextType,t);case"arrayLiteral":return r.elements.map(e=>Dr(e,t));case"objectLiteral":return function(e,t){const r={};for(const n of e.properties){const e=n.key;let i;i="identifier"===e.type?e.name:"literal"===e.type&&"string"===e.valueType?e.value:Dr(e,t)+"",r[i]=Dr(n.value,t)}return r}(r,t);case"asExpression":return Ge(Dr(r.expression,t),Qr(r.targetType),t);case"stringPostfix":return`${Dr(r.expression,t)}${r.unit}`;case"blockLiteral":return en(r,t);case"memberExpression":{const e=Dr(r.object,t);if(null==e)return;if(e instanceof Element||Array.isArray(e)||"undefined"!=typeof Node&&e instanceof Node)throw new Vr("memberExpression");const n=e[r.computed?Dr(r.property,t)+"":r.property?.name];return"function"==typeof n?n.bind(e):n}default:throw new Vr(r?.type??"unknown")}}function Br(e,t){const r=Wr(e);if(!r.success||!r.node){const e=r.error??r.errors?.[0];throw Error("Failed to parse expression: "+(e?.message??"unknown error"))}return Dr(r.node,t)}async function Hr(e,t){const r=Wr(e);if(!r.success||!r.node){const e=r.error??r.errors?.[0];throw Error("Failed to parse expression: "+(e?.message??"unknown error"))}const n=t.registry?t:{...t,registry:await Kr()};return $r(r.node,n)}let Fr=null;async function Kr(){if(!Fr){const e=await Promise.resolve().then(function(){return ha});Fr=e.createFullExpressionRegistry()}return Fr}async function Ur(e,t){const r=e.name;return"me"===r||"my"===r||"I"===r?_r(t,"me").evaluate(t):"you"===r||"your"===r||"yourself"===r?_r(t,"you").evaluate(t):"it"===r||"its"===r?_r(t,"it").evaluate(t):"window"===r?_r(t,"window").evaluate(t):"document"===r?_r(t,"document").evaluate(t):"global"===e.scope&&t.globals?.has(r)?(pe(r,t),t.globals.get(r)):t.locals&&t.locals.has(r)?(de(r,t),t.locals.get(r)):t.globals&&t.globals.has(r)?(r.startsWith("$")&&pe(r.slice(1),t),t.globals.get(r)):r.startsWith("$")&&t.globals&&t.globals.has(r.slice(1))?(pe(r.slice(1),t),t.globals.get(r.slice(1))):void 0!==t[r]?t[r]:"undefined"!=typeof globalThis&&r in globalThis?globalThis[r]:void 0}function Gr(e){const t=e;if(!t)return null;if("identifier"===t.type&&"string"==typeof t.name)return[t.name];if("memberExpression"===t.type&&!t.computed){const e=Gr(t.object);if(!e)return null;const r=t.property,n="identifier"===r?.type&&"string"==typeof r.name?r.name:"string"==typeof r?.value?r.value:null;return null==n?null:[...e,n]}return null}function Yr(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 Zr(e,t){return e&&"selector"===e.type&&"string"==typeof e.value?e.value:t}function Jr(e,t,r){if(void 0!==r)return;const n=e.right;if(!n||"identifier"!==n.type||"string"!=typeof n.name)return;if(null==t||"object"!=typeof t)return;const i=t[n.name];return"boolean"==typeof i?!0===i:void 0}function Xr(e,t,r){return e instanceof Node&&t instanceof Node&&0!==(e.compareDocumentPosition(t)&r)}function Qr(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 en(e,t){const r=e.parameters??[];return(...n)=>{const i=new Map(t.locals??new Map);r.forEach((e,t)=>i.set(e,n[t]));const a={...t,locals:i};try{return Dr(e.body,a)}catch(t){if(t instanceof Vr)return $r(e.body,a);throw t}}}function tn(e,t){return t.locals?.has(e)?(de(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 rn(e,t,r){const n=[];let i;for(;null!==(i=t.exec(e));)n.push({index:i.index,length:i[0].length,replacement:await r(i[0],...i.slice(1))});let a=e;for(let e=n.length-1;e>=0;e--){const{index:t,length:r,replacement:i}=n[e];a=a.substring(0,t)+i+a.substring(t+r)}return a}function nn(e,t,r){if("string"==typeof t&&t.startsWith("@")){const r=t.substring(1);return e&&"function"==typeof e.getAttribute?e.getAttribute(r):void 0}return e instanceof Element&&"string"==typeof t?Ce(e,t):Xe(e)&&!(t in e)?_r(r,"possessive").evaluate(r,e,t):e?.[t]}const an=new Set(["closest","previous","next"]);function on(e){return e instanceof Element?e:Array.isArray(e)&&e[0]instanceof Element?e[0]:void 0}const sn=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");const ln=/[:&()[\]/]/g;function cn(e,t){return e.fromQuery||!t.startsWith(".")||t.includes("{")?function(e){return e.replace(sn,"$1\\:")}(t):function(e){return e[0]+e.slice(1).replace(ln,"\\$&")}(t)}const un=/\$\{([^}]+)\}|\$([a-zA-Z_$][a-zA-Z0-9_.$]*)/g;function pn(e){const t=[];let r,n=0;for(un.lastIndex=0;null!==(r=un.exec(e));)r.index>n&&t.push({lit:e.slice(n,r.index)}),t.push({expr:r[1]??r[2]}),n=r.index+r[0].length;return e.length>n&&t.push({lit:e.slice(n)}),t}function mn(e,t){let r="";const n=[];let i=0;for(const a of e){if("lit"in a){r+=a.lit;continue}const e=t[i++];ze(e)?(r+=`[data-hs-query-id='${n.length}']`,n.push(e)):r+=(e??"")+""}return{selector:r,elements:n}}class dn{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!1;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 r of this.afterExecuteHooks)await r(e,t)}async runOnError(e,t){let r=t;for(const t of this.onErrorHooks){const n=await t(e,r);n instanceof Error&&(r=n)}return r}shouldIntercept(e,t){for(const r of this.interceptCommandHooks)if(r(e,t))return!0;return!1}getRegisteredNames(){return Array.from(this.hooks.keys())}clear(){this.hooks.clear(),this.beforeExecuteHooks=[],this.afterExecuteHooks=[],this.onErrorHooks=[],this.interceptCommandHooks=[]}}class fn{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??!1}registerListener(e,t,r,n,i){this.addCleanup(e,{type:"listener",target:t,eventName:r,cleanup:()=>{t.removeEventListener(r,n,i)},description:r+" listener"})}registerObserver(e,t){this.addCleanup(e,{type:"observer",cleanup:()=>{t.disconnect()},description:"MutationObserver"})}registerInterval(e,t){this.addCleanup(e,{type:"interval",cleanup:()=>{clearInterval(t)},description:"Interval"})}registerTimeout(e,t){this.addCleanup(e,{type:"timeout",cleanup:()=>{clearTimeout(t)},description:"Timeout"})}registerCustom(e,t,r){this.addCleanup(e,{type:"custom",cleanup:t,description:r||"Custom cleanup"})}registerGlobal(e,t="custom",r){this.globalCleanups.push({type:t,cleanup:e,description:r||"Global cleanup"})}addCleanup(e,t){const r=this.elementCleanups.get(e);r?r.push(t):(this.elementCleanups.set(e,[t]),this.elementCount++),this.typeCounts[t.type]++}cleanupElement(e){const t=this.elementCleanups.get(e);if(!t||0===t.length)return 0;let r=0;for(const e of t){try{e.cleanup(),r++}catch(e){}this.typeCounts[e.type]--}return this.elementCleanups.delete(e),this.elementCount--,r}cleanupElementTree(e){let t=this.cleanupElement(e);const r=e.querySelectorAll("*");for(const e of r)t+=this.cleanupElement(e);return t}cleanupGlobal(){let e=0;for(const t of this.globalCleanups)try{t.cleanup(),e++}catch(e){}return this.globalCleanups=[],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,r=0,n=0,i=0;for(const a of this.globalCleanups)switch(a.type){case"listener":e++;break;case"observer":t++;break;case"interval":r++;break;case"timeout":n++;break;case"custom":i++}return{elementsTracked:this.elementCount,listeners:this.typeCounts.listener+e,observers:this.typeCounts.observer+t,intervals:this.typeCounts.interval+r,timeouts:this.typeCounts.timeout+n,custom:this.typeCounts.custom+i,global:this.globalCleanups.length}}setDebugMode(e){this.debugMode=e}}const hn=new Map;function yn(e,t){return{me:e??null,it:null,you:null,result:null,locals:new Map,globals:hn,flags:{halted:!1,breaking:!1,continuing:!1,returning:!1,async:!1}}}function vn(){return hn}class gn{constructor(){this.sources=new Map,this.subscriptions=new Map,this.nextId=1}register(e,t){const r=e.toLowerCase();this.sources.has(r),this.sources.set(r,t)}unregister(e){const t=e.toLowerCase(),r=this.sources.get(t);if(r){for(const[e,r]of this.subscriptions.entries())r.source===t&&(r.unsubscribe(),this.subscriptions.delete(e));return r.destroy?.(),this.sources.delete(t)}return!1}get(e){return this.sources.get(e.toLowerCase())}has(e){return this.sources.has(e.toLowerCase())}subscribe(e,t,r){const n=this.get(e);if(!n)return;n.initialize?.();const i=n.subscribe(t,r);return this.subscriptions.set(i.id,i),i}unsubscribe(e){const t=this.subscriptions.get(e);return!!t&&(t.unsubscribe(),this.subscriptions.delete(e))}getSourceNames(){return Array.from(this.sources.keys())}getSubscriptions(){return Array.from(this.subscriptions.values())}findSourceForEvent(e){for(const[t,r]of this.sources.entries())if(r.supports?.(e)??r.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 kn{constructor(){this.providers=new Map,this.globalProviders=new Map}register(e,t,r){const n=e.toLowerCase();this.providers.set(n,"function"==typeof t?{name:n,provide:t,cache:r?.cache??!0,description:r?.description,dependencies:r?.dependencies}:t)}registerGlobal(e,t,r){const n=e.toLowerCase();this.globalProviders.set(n,"function"==typeof t?{name:n,provide:t,cache:r?.cache??!0,description:r?.description,dependencies:r?.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,r){const n=this.get(e);if(!n)return;const i="__provider_"+n.name;if(n.cache&&r?.has(i))return r.get(i);if(n.dependencies)for(const e of n.dependencies)await this.resolve(e,t,r);const a=await n.provide(t);return n.cache&&r&&r.set(i,a),a}resolveSync(e,t,r){const n=this.get(e);if(!n)return;const i="__provider_"+n.name;if(n.cache&&r?.has(i))return r.get(i);const a=n.provide(t);if(a instanceof Promise)throw Error(`Context provider '${e}' is async. Use resolve() instead of resolveSync().`);return n.cache&&r&&r.set(i,a),a}enhance(e){const t=this,r=new Map;return new Proxy(e,{get(e,n,i){if("string"==typeof n){if(t.get(n))try{return t.resolveSync(n,e,r)}catch{return t.resolve(n,e,r)}}return Reflect.get(e,n,i)},has:(e,r)=>!("string"!=typeof r||!t.has(r))||Reflect.has(e,r)})}async resolveAll(e){const t=new Map,r={},n=[...this.globalProviders.entries(),...this.providers.entries()];for(const[i,a]of n)try{r[i]=await this.resolve(i,e,t)}catch(e){r[i]=void 0}return r}getProviderNames(){return[...new Set([...this.globalProviders.keys(),...this.providers.keys()])]}clear(){this.providers.clear(),this.globalProviders.clear()}}const bn={evaluate:(e,t)=>$r(e,t)};class wn{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 zn{constructor(e,t,r){this.impl=e,this.hookRegistry=r??null}setHookRegistry(e){this.hookRegistry=e}createHookContext(e,t,r={}){return{commandName:this.name,element:e.me instanceof Element?e.me:null,args:t,modifiers:r,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 r=t[0],n=this.createHookContext(e,t,r&&"object"==typeof r&&"modifiers"in r&&r.modifiers||{});try{if(this.hookRegistry&&await this.hookRegistry.runBeforeExecute(n),this.hookRegistry?.shouldIntercept(this.name,n))return;const i=wn.toTyped(e);let a,o;if(this.impl.parseInput&&"function"==typeof this.impl.parseInput)if(r&&"object"==typeof r&&("args"in r||"modifiers"in r)){const t=r.modifiers,n=t?.when||t?.where;if(n){if(!await $r(n,e))return}a=await this.impl.parseInput({args:r.args||[],modifiers:t||{},commandName:r.commandName},bn,e)}else a=t;else a=t;if(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 Object.assign(e,wn.fromTyped(i,e)),this.hookRegistry&&await this.hookRegistry.runAfterExecute(n,o),o}catch(e){if(Ln(e),this.hookRegistry&&e instanceof Error){throw await this.hookRegistry.runOnError(n,e)}throw e}}validate(e){return this.impl.validate?this.impl.validate(e):{isValid:!0,errors:[],suggestions:[]}}}class xn{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)}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 r=t.toLowerCase();this.implementations.set(r,e);const n=new zn(e,void 0,this.hookRegistry);this.adapters.set(r,n),N.add(r);const i=e.metadata?.aliases;if(i&&Array.isArray(i))for(const t of i){const r=t.toLowerCase();this.implementations.set(r,e),this.adapters.set(r,n),N.add(r)}}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 r=this.getAdapter(e);return r?r.validate(t):{isValid:!1,errors:[{type:"runtime-error",message:"Unknown command: "+e,suggestions:["Available commands: "+this.getCommandNames().join(", ")]}],suggestions:["Available commands: "+this.getCommandNames().join(", ")]}}}function En(e){const t=e?.commands??new xn,r=e?.eventSources??new gn,n=e?.context??new kn,i=new Set,a={commands:t,eventSources:r,context:n,use(e){if(!i.has(e.name)){if(e.commands)for(const r of e.commands)t.register(r);if(e.eventSources)for(const t of e.eventSources)r.register(t.name,t);if(e.contextProviders)for(const{name:t,provide:r,options:i}of e.contextProviders)n.register(t,r,i);e.setup?.(a),i.add(e.name)}},reset(){i.clear()}};return a}let Tn=null;function Sn(){return Tn||(Tn=En()),Tn}class Cn{constructor(e={}){this.contextCache=new WeakMap;const t=Sn();this.options={enableContextProviders:e.enableContextProviders??!0,enableEventSources:e.enableEventSources??!0,registry:e.registry??{}},this.contextRegistry=this.options.registry.context??t.context,this.eventSourceRegistry=this.options.registry.eventSources??t.eventSources}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),this.contextRegistry.getProviderNames(),t}catch(t){return e}}getEventSource(e){if(!this.options.enableEventSources)return;const t=this.eventSourceRegistry.get(e);if(t)return t;const r=this.eventSourceRegistry.findSourceForEvent(e);if(r){return this.eventSourceRegistry.get(r)}}hasEventSource(e){return void 0!==this.getEventSource(e)}subscribeToEventSource(e,t,r){if(!this.options.enableEventSources)throw Error("Event sources are disabled in this runtime");const n=this.eventSourceRegistry.subscribe(e,t,r);if(!n)throw Error(`Failed to subscribe to event source '${e}'`);return n}getEventSourceNames(){return this.eventSourceRegistry.getSourceNames()}getContextProviderNames(){return this.contextRegistry.getProviderNames()}destroy(){this.eventSourceRegistry.destroy(),this.contextCache=new WeakMap}}function An(e){const t=Error(e.type.toUpperCase()+"_EXECUTION");return t["is"+e.type.charAt(0).toUpperCase()+e.type.slice(1)]=!0,"returnValue"in e&&(t.returnValue=e.returnValue),t}function Ln(e){return e instanceof Error&&(null!==t(e)||"HALT_EXECUTION"===e.message||"EXIT_COMMAND"===e.message||"EXIT_EXECUTION"===e.message)}function jn(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 Pn(e){return null!==e&&"object"==typeof e&&"command"in e&&"selector"in e}const On=new WeakMap;class Nn{constructor(e){if(this.autoCleanupObserver=null,this.registryIntegration=null,this.runtimeWarnings=[],this.options={commandTimeout:1e4,enableErrorReporting:!0,enableResultPattern:!0,enableAutoCleanup:!0,...e},this.registry=e.registry,this.expressionRegistry=e.expressionRegistry,this.behaviorRegistry=new Map,this.globalVariables=vn(),this.hookRegistry=new dn,e.hooks&&this.hookRegistry.register("default",e.hooks),this.registry.setHookRegistry(this.hookRegistry),this.cleanupRegistry=new fn,this.options.enableAutoCleanup&&this.setupAutoCleanup(),!1!==e.registryIntegration){this.registryIntegration=new Cn("object"==typeof e.registryIntegration?e.registryIntegration:{})}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,r)=>await this.installBehaviorOnElement(e,t,r)}}setupAutoCleanup(){"undefined"!=typeof MutationObserver&&"undefined"!=typeof document&&(this.autoCleanupObserver=new MutationObserver(e=>{const t=[];for(const r of e)for(const e of r.removedNodes)e instanceof Element&&t.push(e);t.length>0&&queueMicrotask(()=>{for(const e of t)if(!e.isConnected){this.cleanupRegistry.cleanupElementTree(e)}})}),document.body?this.autoCleanupObserver.observe(document.body,{childList:!0,subtree:!0}):document.addEventListener("DOMContentLoaded",()=>{this.autoCleanupObserver?.observe(document.body,{childList:!0,subtree:!0})},{once:!0}))}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,r,n,i){this.cleanupRegistry.registerListener(e,t,r,n,i)}cleanupTree(e){return this.cleanupRegistry.cleanupElementTree(e)}getCleanupStats(){return this.cleanupRegistry.getStats()}getCleanupRegistry(){return this.cleanupRegistry}logError(...e){}logWarn(...e){}destroy(){this.autoCleanupObserver&&(this.autoCleanupObserver.disconnect(),this.autoCleanupObserver=null),this.cleanupRegistry.cleanupAll(),this.hookRegistry.clear(),this.behaviorRegistry.clear()}hasErrorDiagnostics(e){const t=e.diagnostics;return!!t?.some(e=>"error"===e.severity)}getWarnings(){return this.runtimeWarnings}async execute(e,r){r.registry||(r.registry=this.expressionRegistry),r.locals.has("_behaviors")||r.locals.set("_behaviors",this.behaviorAPI),r.locals.has("_runtimeExecute")||r.locals.set("_runtimeExecute",(e,t)=>this.execute(e,t||r));try{if(this.hasErrorDiagnostics(e)){const t=e.diagnostics?.[0];return void this.runtimeWarnings.push(t?.message||"Skipped error node")}switch(e.type){case"command":if(this.options.enableResultPattern){const t=await this.processCommandWithResult(e,r);if(!i(t)){if("return"===t.error.type){const e=t.error.returnValue;return void 0!==e&&Object.assign(r,{it:e,result:e}),e}throw An(t.error)}return t.value}try{return await this.processCommand(e,r)}catch(e){const n=t(e);if(n?.isReturn){const e=n.returnValue;return void 0!==e&&Object.assign(r,{it:e,result:e}),e}throw e}case"eventHandler":return await this.executeEventHandler(e,r);case"event":{const t={type:"eventHandler",event:e.event,events:[e.event],commands:e.body||[],target:e.filter,modifiers:e.modifiers||{}};return await this.executeEventHandler(t,r)}case"behavior":return await this.executeBehaviorDefinition(e,r);case"Program":return await this.executeProgram(e,r);case"initBlock":case"block":return await this.executeBlock(e,r);case"sequence":case"CommandSequence":if(this.options.enableResultPattern){const t=e,n=await this.executeCommandSequenceWithResult(t.commands||[],r);if(!i(n))throw An(n.error);return n.value}return await this.executeCommandSequence(e,r);case"objectLiteral":return await this.executeObjectLiteral(e,r);default:if(this.options.enableResultPattern){const t=await this.evaluateExpressionWithResult(e,r);if(!i(t))throw An(t.error);return t.value}return await this.evaluateExpression(e,r)}}catch(e){throw e}}async processCommand(e,t){const{name:r,args:n,modifiers:i}=e,a=r.toLowerCase();if(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:n||[],modifiers:i||{},commandName:a,runtime:this})}catch(e){throw Ln(e)||this.logError(`Error executing command '${a}':`,e),e}}const o=`Unknown command: ${r}. Ensure it is registered in the Runtime options.`;throw this.logWarn(o),Error(o)}toSignal(e){const r=t(e);if(r){if(r.isHalt||"HALT_EXECUTION"===r.message)return{type:"halt"};if(r.isExit||"EXIT_COMMAND"===r.message)return{type:"exit",returnValue:r.returnValue};if(r.isBreak)return{type:"break"};if(r.isContinue)return{type:"continue"};if(r.isReturn)return{type:"return",returnValue:r.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(!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 r(await l.execute(t,{args:a||[],modifiers:o||{},commandName:s,runtime:this}))}catch(e){const t=this.toSignal(e);if(t)return n(t);throw this.logError(`Error executing command '${s}':`,e),e}}async executeCommandSequenceWithResult(e,t){let n;for(const a of e){if(this.hasErrorDiagnostics(a)){const e=a.diagnostics?.[0];this.runtimeWarnings.push(e?.message||"Skipped error node");continue}if("command"===a.type){const e=await this.processCommandWithResult(a,t);if(!i(e)){const n=e.error;switch(n.type){case"halt":case"exit":case"break":case"continue":return e;case"return":return void 0!==n.returnValue&&Object.assign(t,{it:n.returnValue,result:n.returnValue}),r(n.returnValue)}}n=e.value}else{const e=await this.evaluateExpressionWithResult(a,t);if(!i(e))return e;n=e.value}}return r(n)}async evaluateExpression(e,t){const r=t.registry?t:{...t,registry:this.expressionRegistry},n=await $r(e,r);return Pn(n)?await this.executeCommandFromPattern(n.command,n.selector,t):n}async evaluateExpressionWithResult(e,t){const a=t.registry?t:{...t,registry:this.expressionRegistry},o=await async function(e,t){try{return r(await $r(e,t))}catch(e){if(e instanceof Error){const t=e;if(t.isHalt||"HALT_EXECUTION"===t.message)return n({type:"halt"});if(t.isExit||"EXIT_COMMAND"===t.message)return n({type:"exit",returnValue:t.returnValue});if(t.isBreak)return n({type:"break"});if(t.isContinue)return n({type:"continue"});if(t.isReturn)return n({type:"return",returnValue:t.returnValue})}throw e}}(e,a);if(!i(o))return o;const s=o.value;if(Pn(s)){if(this.options.enableResultPattern){return this.processCommandWithResult({type:"command",name:s.command,args:[{type:"literal",value:s.selector}]},t)}try{return r(await this.executeCommandFromPattern(s.command,s.selector,t))}catch(e){const t=this.toSignal(e);if(t)return n(t);throw e}}return r(s)}async executeCommandFromPattern(e,t,r){return this.processCommand({type:"command",name:e,args:[{type:"literal",value:t}]},r)}async executeProgram(e,t){if(!e.statements||!Array.isArray(e.statements))return;let r;const n=[],i=[],a=[];for(const t of e.statements)"eventHandler"===t.type?n.push(t):"initBlock"===t.type?i.push(t):a.push(t);for(const e of n)try{await this.execute(e,t)}catch(e){if(Ln(e)&&(e.isHalt||e.isExit))break;throw e}for(const e of i)try{r=await this.execute(e,t)}catch(e){if(Ln(e)&&(e.isHalt||e.isExit))break;throw e}for(const e of a)try{r=await this.execute(e,t)}catch(e){if(Ln(e)&&(e.isHalt||e.isExit))break;throw e}return r}async executeBlock(e,t){if(e.commands&&Array.isArray(e.commands))for(const r of e.commands)try{await this.execute(r,t)}catch(e){if(Ln(e)&&e.isHalt)break;throw e}}async executeCommandSequence(e,t){if(!e.commands||!Array.isArray(e.commands))return;let r;for(const n of e.commands)try{r=await this.execute(n,t)}catch(e){if(Ln(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 r}async executeObjectLiteral(e,t){const r={};if(!e.properties)return r;for(const n of e.properties){let e;if("identifier"===n.key.type)e=n.key.name;else if("literal"===n.key.type)e=n.key.value+"";else{e=await this.execute(n.key,t)+""}const i=await this.execute(n.value,t);r[e]=i}return r}enhanceContext(e){return this.registryIntegration?this.registryIntegration.enhanceContext(e):e}async executeBehaviorDefinition(e,t){const{name:r,parameters:n=[],eventHandlers:i=[],initBlock:a}=e,o=e.imperativeInstaller;this.behaviorRegistry.set(r,"function"==typeof o?{name:r,parameters:n,type:"imperative",install:o}:{name:r,parameters:n,eventHandlers:i,initBlock:a})}async installBehaviorOnElement(e,t,r){let n=this.behaviorRegistry.get(e);if(!n&&(this.behaviorAPI.resolve&&this.behaviorAPI.resolve(e)&&(n=this.behaviorRegistry.get(e)),!n))throw Error(`Behavior "${e}" not found`);if("imperative"===n.type)return void("function"==typeof n.install&&n.install(t,r));const i={me:t,you:null,it:null,result:null,locals:new Map,globals:this.globalVariables,registry:this.expressionRegistry,halted:!1,returned:!1,broke:!1,continued:!1,async:!1},a=this.enhanceContext(i);if(n.parameters)for(const e of n.parameters){a.locals.set(e,e in r?r[e]:void 0)}for(const[e,t]of Object.entries(r))n.parameters?.includes(e)||a.locals.set(e,t);if(n.initBlock){const t=this.options.commandTimeout??1e4;try{await Promise.race([this.execute(n.initBlock,a),new Promise((r,n)=>setTimeout(()=>n(Error(`Behavior "${e}" init block timed out after ${t}ms`)),t))])}catch(e){if(!(e instanceof Error&&Ln(e)))throw e}}if(n.eventHandlers){const t=this.options.commandTimeout??1e4;for(const r of n.eventHandlers)await Promise.race([this.executeEventHandler(r,a),new Promise((r,n)=>setTimeout(()=>n(Error(`Behavior "${e}" handler attachment timed out after ${t}ms`)),t))])}}async executeEventHandler(e,t){const{event:r,events:n,commands:i,target:a,args:o,selector:s,attributeName:l,watchTarget:c,modifiers:u}=e,p=n&&n.length>0?n:[r];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);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 m=this.queryElements(a,t)}else m=t.me?[t.me]:[];if(0===m.length&&!d)return;if("mutation"===r&&l)return void this.setupMutationObserver(m,l,i,t);if("change"===r&&c)return void this.setupChangeObserver(c,i,t);const f=e.customEventSource;if(f&&this.registryIntegration){const e=async e=>{const n=new Map(t.locals),a={...t,locals:n,it:e,event:e},o=this.enhanceContext(a);try{await this.execute({type:"program",commands:i},o)}catch(e){this.logError(`[HyperFixi] Error executing commands for custom event '${r}':`,e)}};try{const n=this.registryIntegration.subscribeToEventSource(f,{event:r,handler:e,target:a,selector:s},t);this.cleanupRegistry.registerGlobal(()=>n.unsubscribe(),"listener",`Custom event source '${f}' subscription ${n.id}`)}catch(e){this.logError(`[HyperFixi] Failed to subscribe to custom event source '${f}':`,e)}return}const h=Nn.createEventHandler(this,i,t,s,o);let y,v=null;if(u){let e=h;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 r;y=n=>{r&&clearTimeout(r),r=setTimeout(()=>e(n),t)},v=()=>{r&&(clearTimeout(r),r=void 0)}}else if(u.throttle){const t=u.throttle;let r=0;y=n=>{const i=Date.now();t>i-r||(r=i,e(n))}}else y=e}else y=h;const g=u?.once?{once:!0}:void 0;if(d){for(const e of p)d.addEventListener(e,y,g),m.length>0?this.cleanupRegistry.registerListener(m[0],d,e,y):this.cleanupRegistry.registerGlobal(()=>d.removeEventListener(e,y),"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 r of e){const e=new CustomEvent("resize",{detail:r,bubbles:!1,cancelable:!1});if(e.synthetic=!0,y(e),g?.once){t.disconnect();break}}});t.observe(e),this.cleanupRegistry.registerCustom(e,()=>t.disconnect(),"resize-observer");continue}e.addEventListener(t,y,g),this.cleanupRegistry.registerListener(e,e,t,y)}v&&this.cleanupRegistry.registerCustom(e,v,"debounce-timeout")}}static createEventHandler(e,t,r,n,i){return async a=>{const o=On.get(a)??0;if(o>=100)return;if(On.set(a,o+1),n&&a.target instanceof Element)try{if(!a.target.matches(n)&&!a.target.closest(n))return}catch{}const s=new Map(r.locals),l={...r,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 r of i){c.locals.set(r,e[r]??t?.[r]??null)}}for(const r of t)try{const t=jn(await e.execute(r,c));void 0!==t&&Object.assign(c,{it:t,result:t})}catch(t){if(Ln(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,r,n){for(const i of e){const e=new MutationObserver(async e=>{for(const a of e)if("attributes"===a.type&&a.attributeName===t){const e={...n,me:i,it:a,locals:new Map(n.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 r)try{await this.execute(e,l)}catch(e){if(Ln(e)){if(e.isHalt||e.isExit||e.isReturn)break}else this.logError("Error executing mutation handler command:",e)}}});e.observe(i,{attributes:!0,attributeOldValue:!0,attributeFilter:[t]}),this.cleanupRegistry.registerObserver(i,e)}}async setupChangeObserver(e,t,r){const n=await this.execute(e,r);let i=[];this.isElement(n)?i=[n]:Array.isArray(n)&&(i=n.filter(e=>this.isElement(e)));for(const e of i){const n=new MutationObserver(async n=>{for(const i of n)if("childList"===i.type||"characterData"===i.type){const n={...r,me:r.me,it:i,locals:new Map(r.locals)};n.locals.set("target",e);const a=i.oldValue,o=e.textContent;null!==a&&n.locals.set("oldValue",a),n.locals.set("newValue",o);const s=this.enhanceContext(n);for(const e of t)try{await this.execute(e,s)}catch(e){if(Ln(e)){if(e.isHalt||e.isExit||e.isReturn)break}else this.logError("Error executing change handler command:",e)}}});n.observe(e,{childList:!0,characterData:!0,subtree:!0,characterDataOldValue:!0}),this.cleanupRegistry.registerObserver(e,n)}}queryElements(e,t){const r=t.me,n=(r instanceof Element?r.ownerDocument:null)??("undefined"!=typeof document?document:null);if(!n)return[];let i=e;i.startsWith("<")&&i.endsWith("/>")&&(i=i.slice(1,-2).trim());try{return Array.from(n.querySelectorAll(i))}catch{return[]}}isElement(e){if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;if(e&&"object"==typeof e){return!!e.style&&!!e.classList}return!1}}function In(...e){const t=new Map;for(const r of e)for(const[e,n]of Object.entries(r))t.set(e,n);return t}const Rn=e.object({selector:e.string().min(1),single:e.boolean().optional().default(!1)});new class extends Me{constructor(){super(...arguments),this.name="me",this.category="Reference",this.syntax="me",this.description="References the current element in the execution context",this.inputSchema=e.undefined(),this.outputType="Element",this.metadata={category:"Reference",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=e.me,i=this.isElement(n)?n:null,a=this.success(i,"element");return this.trackPerformance(e,t,a,r),a}catch(n){const i=this.failure("MeExpressionError","runtime-error",n instanceof Error?n.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,r),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 Me{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=e.undefined(),this.outputType="Element",this.metadata={category:"Reference",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=e.you,i=this.isElement(n)?n:null,a=this.success(i,"element");return this.trackPerformance(e,t,a,r),a}catch(n){const i=this.failure("YouExpressionError","runtime-error",n instanceof Error?n.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,r),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 Me{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=e.undefined(),this.outputType="Any",this.metadata={category:"Reference",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=e.it,i={success:!0,value:n,type:this.inferType(n)};return this.trackPerformance(e,t,i,r),i}catch(n){const i=this.failure("ItExpressionError","runtime-error",n instanceof Error?n.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,r),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 Me{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=Rn,this.outputType="ElementList",this.metadata={category:"Reference",complexity:"medium"}}async evaluate(e,t){const r=Date.now();try{if(!this.isValidCSSSelector(t.selector)){const n=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,n,r),n}let n;if(t.single){n=document.querySelector(t.selector)}else{const e=Array.from(document.querySelectorAll(t.selector));n=e.length>0?e:null}const i={success:!0,value:n,type:Array.isArray(n)?"element-list":"element"};return this.trackPerformance(e,t,i,r),i}catch(n){const i=this.failure("CSSSelectorError","runtime-error",n instanceof Error?n.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,r),i}}validate(e){try{const t=this.inputSchema.safeParse(e);if(!t.success)return{isValid:!1,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:r}=t.data;return this.isValidCSSSelector(r)?this.validationSuccess():this.validationFailure("syntax-error",`Invalid CSS selector syntax: "${r}"`,["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),!0}catch{return!1}}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"]}};function Mn(e,t){if(t.startsWith("computed-")){const r=t.substring(9);return getComputedStyle(e).getPropertyValue(r)||""}const r=t.replace(/-([a-z])/g,(e,t)=>t.toUpperCase());return e.style[r]}const Wn={me:{name:"me",category:"Reference",evaluatesTo:"Element",evaluate:async e=>e.me??null,validate:Ne},you:{name:"you",category:"Reference",evaluatesTo:"Element",evaluate:async e=>e.you??null,validate:Ne},it:{name:"it",category:"Reference",evaluatesTo:"Any",evaluate:async e=>e.it,validate:Ne},its:{name:"its",category:"Reference",evaluatesTo:"Any",evaluate:async e=>e.it,validate:Ne},result:{name:"result",category:"Reference",evaluatesTo:"Any",evaluate:async e=>e.result,validate:Ne},querySelector:{name:"querySelector",category:"Reference",evaluatesTo:"Element",async evaluate(e,...t){const[r]=t;if("string"!=typeof r)throw Error("querySelector requires a string selector");return document.querySelector(r)},validate:e=>Pe(e,"querySelector","selector")},querySelectorAll:{name:"querySelectorAll",category:"Reference",evaluatesTo:"Array",async evaluate(e,...t){const r=t[0];if("string"!=typeof r)throw Error("querySelectorAll requires a string selector");const n=document.querySelectorAll(r);return Array.from(n)},validate:e=>Pe(e,"querySelectorAll","selector")},getElementById:{name:"getElementById",category:"Reference",evaluatesTo:"Element",async evaluate(e,...t){const r=t[0];if("string"!=typeof r)throw Error("getElementById requires a string ID");return document.getElementById(r)},validate:e=>Pe(e,"getElementById","ID")},getElementsByClassName:{name:"getElementsByClassName",category:"Reference",evaluatesTo:"Array",async evaluate(e,...t){const r=t[0];if("string"!=typeof r)throw Error("getElementsByClassName requires a string class name");const n=document.getElementsByClassName(r);return Array.from(n)},validate:e=>Pe(e,"getElementsByClassName","className")},closest:{name:"closest",category:"Reference",evaluatesTo:"Element",async evaluate(e,...t){let r=t[0];if(r&&"object"==typeof r&&"type"in r){const e=r;"identifier"===e.type&&e.name?r=e.name:"literal"===e.type&&"string"==typeof e.value&&(r=e.value)}if("string"!=typeof r)throw Error("closest requires a string selector");return e.me?e.me.closest(r):null},validate(e){if(1!==e.length)return"closest requires exactly 1 argument (selector)";const t=e[0];if("string"==typeof t)return null;if(t&&"object"==typeof t&&"type"in t){if("identifier"===t.type||"literal"===t.type)return null}return"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:Ne},window:{name:"window",category:"Reference",evaluatesTo:"Object",evaluate:async e=>window,validate:Ne},document:{name:"document",category:"Reference",evaluatesTo:"Object",evaluate:async e=>document,validate:Ne},elementWithSelector:{name:"elementWithSelector",category:"Reference",evaluatesTo:"Array",async evaluate(e,...t){const r=t[0];if("string"!=typeof r)throw Error("Selector must be a string");const n=e?.me?.ownerDocument??("undefined"!=typeof document?document:null);if(!n)throw Error("DOM not available - cannot resolve element selector");const i=n.querySelectorAll(r);return Array.from(i)},validate:e=>Pe(e,"elementWithSelector","selector")},styleRef:{name:"styleRef",category:"Reference",evaluatesTo:"String",async evaluate(e,...t){const r=t[0],n=t[1];if("string"!=typeof r)throw Error("StyleRef requires a string property name");const i=n||e.me;if(i&&i instanceof HTMLElement)return Mn(i,r)},validate:e=>Re(e,1,2,"styleRef","property, optional element")??je(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 r=t[0],n=t[1];if("string"!=typeof r||"string"!=typeof n)throw Error("Possessive styleRef requires possessor and property strings");let i=null;if("my"===r&&e.me?i=e.me instanceof HTMLElement?e.me:null:"its"===r&&e.it&&(i=e.it instanceof HTMLElement?e.it:null),i)return Mn(i,n)},validate:e=>Le(e,2,"possessiveStyleRef","possessor, property")??je(e,0,"possessiveStyleRef","possessor")??je(e,1,"possessiveStyleRef","property")},ofStyleRef:{name:"ofStyleRef",category:"Reference",evaluatesTo:"String",async evaluate(e,...t){const r=t[0],n=t[1];if("string"!=typeof r||"string"!=typeof n)throw Error("Of styleRef requires property and reference strings");let i=null;if("me"===n&&e.me?i=e.me instanceof HTMLElement?e.me:null:"it"===n&&e.it&&(i=e.it instanceof HTMLElement?e.it:null),i)return Mn(i,r)},validate:e=>Le(e,2,"ofStyleRef","property, reference")??je(e,0,"ofStyleRef","property")??je(e,1,"ofStyleRef","reference")}};class _n{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[r,n]of this.accessOrder)t>n&&(t=n,e=r);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,r)=>e+(t-r.timestamp),0)/e.length:0,totalAccesses:e.reduce((e,t)=>e+t.accessCount,0)}}}const qn=new class{constructor(){this.domQueryCache=new _n(200,3e3),this.exprResultCache=new _n(500,2e3),this.cssMatchCache=new _n(100,5e3),this.formValueCache=new _n(50,1e3),this.hits=0,this.misses=0}querySelector(e){const t="querySelector:"+e,r=this.domQueryCache.get(t);if(void 0!==r)return this.hits++,r;this.misses++;const n=document.querySelector(e);return this.domQueryCache.set(t,n),n}querySelectorAll(e){const t="querySelectorAll:"+e,r=this.domQueryCache.get(t);if(void 0!==r)return this.hits++,r;this.misses++;const n=Array.from(document.querySelectorAll(e));return this.domQueryCache.set(t,n),n}getElementById(e){const t="getElementById:"+e,r=this.domQueryCache.get(t);if(void 0!==r)return this.hits++,r;this.misses++;const n=document.getElementById(e);return this.domQueryCache.set(t,n),n}getElementsByClassName(e){const t="getElementsByClassName:"+e,r=this.domQueryCache.get(t);if(void 0!==r)return this.hits++,r;this.misses++;const n=Array.from(document.getElementsByClassName(e));return this.domQueryCache.set(t,n),n}matches(e,t){const r=`matches:${this.getElementCacheKey(e)}:${t}`,n=this.cssMatchCache.get(r);if(void 0!==n)return this.hits++,n;this.misses++;const i=e.matches(t);return this.cssMatchCache.set(r,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),r=this.formValueCache.get("formValue:"+t);if(void 0!==r)return this.hits++,r;this.misses++}setFormValue(e,t){const r=this.getElementCacheKey(e);this.formValueCache.set("formValue:"+r,t)}invalidateElementCache(e){const t=this.getElementCacheKey(e);for(const e of[this.domQueryCache,this.cssMatchCache,this.formValueCache])for(const r of Array.from(e.cache.keys()))"string"==typeof r&&r.includes(t)&&e.delete(r)}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("."),r=this.getElementPosition(e);return`${e.tagName.toLowerCase()}${t?"."+t:""}@${r}`}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(([r,n])=>{e-n.timestamp>t.ttl&&t.delete(r)})})}};"undefined"!=typeof window&&setInterval(()=>{qn.cleanup()},1e4);const $n=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 r=performance.now()-t;return this.startTimes.delete(e),r}return 0}recordTokenization(e){this.metrics.tokenizationTime+=e}recordEvaluation(e){this.metrics.evaluationTime+=e}updateCacheMetrics(){const e=qn.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 Vn(){qn.cleanup();$n.getMetrics().memoryUsage>52428800&&$n.reset()}let Dn=null;function Bn(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 r=e.trim();if(""===r)return 0;const n=parseFloat(r);if(isNaN(n))throw Error(`${t} cannot be converted to number: "${e}"`);return n}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 r=e[0];if(Array.isArray(r))throw Error(t+" is a nested array, cannot convert to number");return Bn(r,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 r=parseFloat(e);if(!isNaN(r))return r}}const r=e.valueOf();if("number"==typeof r&&Number.isFinite(r))return r}throw Error(`${t} cannot be converted to number: ${typeof e}`)}function Hn(e){if("number"==typeof e)return Number.isFinite(e)?e:null;if("string"==typeof e){const t=e.trim();if(""===t)return 0;const r=parseFloat(t);return isNaN(r)?null:r}return"boolean"==typeof e?e?1:0:null==e?0:null}function Fn(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 Kn(e){try{return Bn(e,"_"),!0}catch{return!1}}function Un(e,t,r){if("==="===r)return e===t;if("!=="===r)return e!==t;if(null==e||null==t)return function(e,t,r){const n=null==e,i=null==t;if(n&&i)switch(r){case"==":case">=":case"<=":return!0;default:return!1}switch(r){case"==":case">":case"<":case">=":case"<=":default:return!1;case"!=":return!0}}(e,t,r);const[n,i]=function(e,t){if("number"==typeof e&&"number"==typeof t)return[e,t];if("string"==typeof e&&"string"==typeof t){const r=parseFloat(e),n=parseFloat(t);return isNaN(r)||isNaN(n)?[e,t]:[r,n]}const r=Hn(e),n=Hn(t);if(null!==r&&null!==n)return[r,n];return[e+"",t+""]}(e,t);switch(r){case">":return n>i;case"<":return i>n;case">=":return n>=i;case"<=":return i>=n;case"==":return Gn(e,t);case"!=":return!Gn(e,t);default:return!1}}function Gn(e,t){if(e===t)return!0;if(typeof e==typeof t)return("string"==typeof e||"number"==typeof e)&&e===t;if("number"==typeof e&&"string"==typeof t){const r=parseFloat(t);return!isNaN(r)&&e===r}if("string"==typeof e&&"number"==typeof t){const r=parseFloat(e);return!isNaN(r)&&r===t}return"boolean"==typeof e?Gn(e?1:0,t):"boolean"==typeof t?Gn(e,t?1:0):e+""==t+""}function Yn(e,t=[]){return{isValid:!1,errors:e,suggestions:t}}function Zn(e,t,r=[],n="error"){return{type:e,message:t,suggestions:r,severity:n}}function Jn(e,t,r,n,i,a=!0,o){return t&&"object"==typeof t&&"evaluationHistory"in t&&Array.isArray(t.evaluationHistory)&&t.evaluationHistory.push({expressionName:e.name,category:e.category,input:r,output:n,timestamp:i,duration:Date.now()-i,success:a,...void 0!==o&&{error:o}}),n}"undefined"!=typeof window&&function(e=3e4){Dn&&clearInterval(Dn),Dn=setInterval(Vn,e)}();const Xn=e.object({left:e.unknown().describe("Left operand value"),right:e.unknown().describe("Right operand value")}).strict(),Qn=e.object({operand:e.unknown().describe("Operand value to negate")}).strict();class ei extends Me{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=Xn,this.outputType="Boolean",this.metadata={category:"Logical",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:n.errors[0]};const i=this.toBoolean(t.left);if(!i)return this.trackSimple(e,r,!0,"boolean"),this.success(!1,"boolean");const a=this.toBoolean(t.right),o=i&&a;return this.trackSimple(e,r,!0,"boolean"),this.success(o,"boolean")}catch(t){return this.trackSimple(e,r,!1),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:!1,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"])}}}class ti extends Me{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=Xn,this.outputType="Boolean",this.metadata={category:"Logical",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:n.errors[0]};const i=this.toBoolean(t.left);if(i)return this.trackSimple(e,r,!0,"boolean"),this.success(!0,"boolean");const a=this.toBoolean(t.right),o=i||a;return this.trackSimple(e,r,!0,"boolean"),this.success(o,"boolean")}catch(t){return this.trackSimple(e,r,!1),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:!1,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"])}}}class ri extends Me{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=Qn,this.outputType="Boolean",this.metadata={category:"Logical",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:n.errors[0]};const i=!this.toBoolean(t.operand);return this.trackSimple(e,r,!0,"boolean"),this.success(i,"boolean")}catch(t){return this.trackSimple(e,r,!1),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:!1,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"])}}}function ni(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&1===e.nodeType}new ei,new ti,new ri;const ii=e.tuple([e.unknown(),e.unknown()]),ai=e.tuple([e.unknown(),e.string()]),oi={name:"equals",category:"Comparison",evaluatesTo:"Boolean",precedence:10,associativity:"Left",operators:["is","==","equals"],async evaluate(e,t,r){const n=Date.now();try{return Jn(this,e,[t,r],t==r,n)}catch(i){throw Jn(this,e,[t,r],!1,n,!1,i instanceof Error?i:Error(i+"")),i}},validate:e=>Oe(e,"equals"),inputSchema:ii,metadata:{category:"Logical",complexity:"simple",sideEffects:[],dependencies:[],returnTypes:["Boolean"],examples:[{input:"value is 5",description:"Check if value equals 5 using loose equality",expectedOutput:!0,context:{result:5}},{input:'"5" == 5',description:'String "5" equals number 5 with type coercion',expectedOutput:!0}],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:!1,examples:["5",'"hello"',"true","null"]},{name:"right",type:"unknown",description:"Right operand for comparison",optional:!1,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"]}},si={name:"strictEquals",category:"Comparison",evaluatesTo:"Boolean",precedence:10,associativity:"Left",operators:["==="],async evaluate(e,t,r){const n=e.evaluationHistory,i=t===r;return n&&Jn(this,e,[t,r],i,n?Date.now():0),i},validate:e=>Oe(e,"strictEquals")},li={name:"notEquals",category:"Comparison",evaluatesTo:"Boolean",precedence:10,associativity:"Left",operators:["!=","is not","does not equal"],async evaluate(e,t,r){const n=e.evaluationHistory,i=t!=r;return n&&Jn(this,e,[t,r],i,n?Date.now():0),i},validate:e=>Oe(e,"notEquals")},ci={name:"strictNotEquals",category:"Comparison",evaluatesTo:"Boolean",precedence:10,associativity:"Left",operators:["!=="],async evaluate(e,t,r){const n=e.evaluationHistory,i=t!==r;return n&&Jn(this,e,[t,r],i,n?Date.now():0),i},validate:e=>Oe(e,"strictNotEquals")},ui={name:"lessThan",category:"Comparison",evaluatesTo:"Boolean",precedence:12,associativity:"Left",operators:["<","is less than"],async evaluate(e,t,r){const n=e.evaluationHistory,i=n?Date.now():0,a=Un(t,r,"<");return n&&Jn(this,e,[t,r],a,i),a},validate:e=>Oe(e,"lessThan")},pi={name:"lessThanOrEqual",category:"Comparison",evaluatesTo:"Boolean",precedence:12,associativity:"Left",operators:["<=","is less than or equal to"],async evaluate(e,t,r){const n=e.evaluationHistory,i=n?Date.now():0,a=Un(t,r,"<=");return n&&Jn(this,e,[t,r],a,i),a},validate:e=>Oe(e,"lessThanOrEqual")},mi={name:"greaterThan",category:"Comparison",evaluatesTo:"Boolean",precedence:12,associativity:"Left",operators:[">","is greater than"],async evaluate(e,t,r){const n=e.evaluationHistory,i=n?Date.now():0,a=Un(t,r,">");return n&&Jn(this,e,[t,r],a,i),a},validate:e=>Oe(e,"greaterThan")},di={name:"greaterThanOrEqual",category:"Comparison",evaluatesTo:"Boolean",precedence:12,associativity:"Left",operators:[">=","is greater than or equal to"],async evaluate(e,t,r){const n=e.evaluationHistory,i=n?Date.now():0,a=Un(t,r,">=");return n&&Jn(this,e,[t,r],a,i),a},validate:e=>Oe(e,"greaterThanOrEqual")},fi={name:"and",category:"Logical",evaluatesTo:"Boolean",precedence:6,associativity:"Left",operators:["and","&&"],async evaluate(e,t,r){const n=Date.now();try{return Jn(this,e,[t,r],t&&r,n)}catch(i){throw Jn(this,e,[t,r],!1,n,!1,i instanceof Error?i:Error(i+"")),i}},validate:e=>Oe(e,"and"),inputSchema:ii,metadata:{category:"Logical",complexity:"simple",sideEffects:[],dependencies:[],returnTypes:["Boolean"],examples:[{input:"true and false",description:"Logical AND of boolean values",expectedOutput:!1},{input:"name and age",description:"Both name and age must be truthy",expectedOutput:!0,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:!1,examples:["true","name","5",'"hello"']},{name:"right",type:"unknown",description:"Right operand (evaluated for truthiness)",optional:!1,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"]}},hi={name:"or",category:"Logical",evaluatesTo:"Boolean",precedence:5,associativity:"Left",operators:["or","||"],async evaluate(e,t,r){const n=e.evaluationHistory,i=t||r;return n&&Jn(this,e,[t,r],i,n?Date.now():0),i},validate:e=>Oe(e,"or")},yi={name:"not",category:"Logical",evaluatesTo:"Boolean",precedence:15,associativity:"Right",operators:["not","!"],async evaluate(e,t){const r=e.evaluationHistory,n=!t;return r&&Jn(this,e,[t],n,r?Date.now():0),n},validate:e=>Le(e,1,"not","operand")},vi={name:"isEmpty",category:"Logical",evaluatesTo:"Boolean",operators:["is empty","isEmpty"],async evaluate(e,t){const r=e.evaluationHistory,n=r?Date.now():0;let i;return i=null==t||(ye(t)||Array.isArray(t)||t instanceof NodeList?0===t.length:!(t instanceof Node||t instanceof Element)&&(!!ke(t)&&0===Object.keys(t).length)),r&&Jn(this,e,[t],i,n),i},validate:e=>Le(e,1,"isEmpty","value")},gi={name:"no",category:"Logical",evaluatesTo:"Boolean",operators:["no"],async evaluate(e,t){const r=e.evaluationHistory,n=r?Date.now():0;let i;return i=null==t||(!1===t||(Array.isArray(t)||t instanceof NodeList?0===t.length:(ye(t),!1))),r&&Jn(this,e,[t],i,n),i},validate:e=>Le(e,1,"no","value")},ki={name:"isNotEmpty",category:"Logical",evaluatesTo:"Boolean",operators:["is not empty","isNotEmpty"],async evaluate(e,t){const r=e.evaluationHistory,n=r?Date.now():0,i=!await vi.evaluate(e,t);return r&&Jn(this,e,[t],i,n),i},validate:e=>Le(e,1,"isNotEmpty","value")},bi={name:"exists",category:"Logical",evaluatesTo:"Boolean",operators:["exists"],async evaluate(e,t){const r=e.evaluationHistory,n=r?Date.now():0,i=wi(t);return r&&Jn(this,e,[t],i,n),i},validate:e=>Le(e,1,"exists","value")};function wi(e){return null!=e&&(Array.isArray(e)?e.length>0:!("undefined"!=typeof NodeList&&e instanceof NodeList)||e.length>0)}const zi={name:"doesNotExist",category:"Logical",evaluatesTo:"Boolean",operators:["does not exist","doesNotExist"],async evaluate(e,t){const r=e.evaluationHistory,n=r?Date.now():0,i=!wi(t);return r&&Jn(this,e,[t],i,n),i},validate:e=>Le(e,1,"doesNotExist","value")},xi={name:"contains",category:"Logical",evaluatesTo:"Boolean",operators:["contains","includes","include"],async evaluate(e,t,r){const n=e.evaluationHistory,i=n?Date.now():0;let a;if(t&&r){if(ni(t)&&ni(r))return a=t.contains(r),n&&Jn(this,e,[t,r],a,i),a;if(ye(t)&&t.match(/^[.#][\w-]+$/)){const o=document.querySelector(t);if(o&&ni(r))return a=o.contains(r),n&&Jn(this,e,[t,r],a,i),a;if(o&&ye(r)&&r.match(/^[.#][\w-]+$/)){const s=document.querySelector(r);return a=!!s&&o.contains(s),n&&Jn(this,e,[t,r],a,i),a}}if(ye(r)&&r.match(/^[.#][\w-]+$/)&&ni(t)){const o=document.querySelector(r);return a=!!o&&t.contains(o),n&&Jn(this,e,[t,r],a,i),a}}if(ye(t)&&ye(r))a=t.includes(r);else if(Array.isArray(t)||"undefined"!=typeof NodeList&&t instanceof NodeList){const e=Array.from(t);a=e.includes(r)||r instanceof Node&&e.some(e=>e instanceof Node&&e.contains(r))}else a=!(!ke(t)||!ye(r))&&r in t;return n&&Jn(this,e,[t,r],a,i),a},validate:e=>Le(e,2,"contains","container, value")},Ei={name:"doesNotContain",category:"Logical",evaluatesTo:"Boolean",operators:["does not contain","doesNotContain","does not include","doesNotInclude"],async evaluate(e,t,r){const n=e.evaluationHistory,i=n?Date.now():0,a=!await xi.evaluate(e,t,r);return n&&Jn(this,e,[t,r],a,i),a},validate:e=>Le(e,2,"doesNotContain","container, value")},Ti={name:"startsWith",category:"Logical",evaluatesTo:"Boolean",operators:["starts with","startsWith"],async evaluate(e,t,r){const n=e.evaluationHistory,i=n?Date.now():0,a=null!=t&&null!=r&&(t+"").startsWith(r+"");return n&&Jn(this,e,[t,r],a,i),a},validate:e=>Le(e,2,"startsWith","str, prefix")},Si={name:"endsWith",category:"Logical",evaluatesTo:"Boolean",operators:["ends with","endsWith"],async evaluate(e,t,r){const n=e.evaluationHistory,i=n?Date.now():0,a=null!=t&&null!=r&&(t+"").endsWith(r+"");return n&&Jn(this,e,[t,r],a,i),a},validate:e=>Le(e,2,"endsWith","str, suffix")},Ci={name:"between",category:"Logical",evaluatesTo:"Boolean",operators:["is between","between"],async evaluate(e,t,r,n){const i=e.evaluationHistory;let a=r,o=n;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&&Jn(this,e,[t,r,n],s,i?Date.now():0),s},validate:e=>Le(e,3,"between","value, min, max")},Ai={name:"matches",category:"Logical",evaluatesTo:"Boolean",operators:["matches"],async evaluate(e,t,r){const n=Date.now();try{let i;if(t instanceof Element&&ye(r)){const e=r;if(e.startsWith(".")||e.startsWith("#")||e.startsWith(":")||e.startsWith("[")||/^[a-zA-Z][\w-]*$/.test(e))try{i=function(e,t){return qn.matches(e,t)}(t,e)}catch(e){i=!1}else i=!1}else if(ye(t)&&ye(r)){const e=t,n=r;try{i=(n.startsWith("/")&&n.endsWith("/")?RegExp(n.slice(1,-1)):RegExp(n)).test(e)}catch(t){i=e.includes(n)}}else i=!1;return Jn(this,e,[t,r],i,n)}catch(i){throw Jn(this,e,[t,r],!1,n,!1,i instanceof Error?i:Error(i+"")),i}},validate:e=>Le(e,2,"matches","element, selector"),inputSchema:ai,metadata:{category:"Logical",complexity:"medium",sideEffects:["dom-query"],dependencies:[],returnTypes:["Boolean"],examples:[{input:'element matches ".active"',description:"Check if element has active class",expectedOutput:!0},{input:'text matches "/^hello/"',description:'Check if text starts with "hello" using regex',expectedOutput:!0,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:!1,examples:["<div>",'"hello world"',"me","target"]},{name:"selector",type:"string",description:"CSS selector or regex pattern to match against",optional:!1,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"]}},Li={name:"has",category:"Logical",evaluatesTo:"Boolean",operators:["has","have"],async evaluate(e,t,r){const n=e.evaluationHistory,i=n?Date.now():0;let a=!1;if(t instanceof Element&&ye(r)){const e=r;e.startsWith(".")?a=t.classList.contains(e.slice(1)):e.startsWith("[")&&e.endsWith("]")&&(a=t.hasAttribute(e.slice(1,-1)))}return n&&Jn(this,e,[t,r],a,i),a},validate:e=>Le(e,2,"has","element, selector")},ji={name:"doesNotHave",category:"Logical",evaluatesTo:"Boolean",operators:["does not have"],async evaluate(e,t,r){const n=e.evaluationHistory,i=n?Date.now():0,a=!await Li.evaluate(e,t,r);return n&&Jn(this,e,[t,r],a,i),a},validate:e=>Le(e,2,"doesNotHave","element, selector")},Pi={equals:oi,strictEquals:si,notEquals:li,strictNotEquals:ci,lessThan:ui,lessThanOrEqual:pi,greaterThan:mi,greaterThanOrEqual:di,and:fi,or:hi,not:yi,no:gi,isEmpty:vi,isNotEmpty:ki,exists:bi,doesNotExist:zi,contains:xi,doesNotContain:Ei,startsWith:Ti,endsWith:Si,between:Ci,matches:Ai,has:Li,doesNotHave:ji},Oi=e.object({value:e.string().describe("String literal value")}).strict(),Ni=e.object({value:e.number().describe("Number literal value")}).strict(),Ii=e.object({value:e.boolean().describe("Boolean literal value")}).strict(),Ri=e.object({left:e.unknown().describe("Left operand"),right:e.unknown().describe("Right operand")}).strict();class Mi extends Me{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 r=Date.now();try{const n=this.validate(t);if(!n.isValid){const t=this.failure("ValidationError","validation-error",n.errors.map(e=>e.message).join(", "),"VALIDATION_FAILED",n.suggestions);return this.trackSimple(e,r,!1),t}let i=t.value;(i.includes("${")||i.includes("$"))&&(i=this.interpolateString(i,e));const a=this.success(i,"string");return this.trackSimple(e,r,!0,i),a}catch(t){return this.trackSimple(e,r,!1),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 r=e.replace(/\$\{([^}]+)\}/g,(e,r)=>{try{const e=this.resolveExpression(r.trim(),t);return void 0!==e?e+"":""}catch(e){return""}});return r=r.replace(/\$([a-zA-Z_$][a-zA-Z0-9_.$]*)/g,(e,r)=>{try{const e=this.resolveVariable(r,t);return void 0!==e?e+"":""}catch(e){return""}}),r}resolveExpression(e,t){if(e.includes(".")){const r=e.split(".");let n=this.resolveVariable(r[0],t);for(let e=1;r.length>e&&null!=n;e++)n=n[r[e]];return n}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)?(de(e,t),t.locals.get(e)):t.globals?.has(e)?t.globals.get(e):void 0}}class Wi extends Me{constructor(){super(...arguments),this.name="numberLiteral",this.category="Special",this.syntax="123 or 3.14",this.description="Numeric literal with validation",this.inputSchema=Ni,this.outputType="Number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);return n.isValid?Number.isFinite(t.value)?(this.trackSimple(e,r,!0,t.value),this.success(t.value,"number")):(this.trackSimple(e,r,!1),this.failure("NumberValidationError","invalid-argument","Number literal must be finite","NUMBER_NOT_FINITE")):(this.trackSimple(e,r,!1),this.failure("ValidationError","validation-error",n.errors.map(e=>e.message).join(", "),"VALIDATION_FAILED",n.suggestions))}catch(t){return this.trackSimple(e,r,!1),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"])}}}class _i extends Me{constructor(){super(...arguments),this.name="booleanLiteral",this.category="Special",this.syntax="true or false",this.description="Boolean literal values",this.inputSchema=Ii,this.outputType="Boolean",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);return n.isValid?(this.trackSimple(e,r,!0,t.value),this.success(t.value,"boolean")):(this.trackSimple(e,r,!1),this.failure("ValidationError","validation-error",n.errors.map(e=>e.message).join(", "),"VALIDATION_FAILED",n.suggestions))}catch(t){return this.trackSimple(e,r,!1),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"])}}}let qi=class extends Me{constructor(){super(...arguments),this.name="addition",this.category="Special",this.syntax="left + right",this.description="Addition of two numeric values",this.inputSchema=Ri,this.outputType="Number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return this.trackSimple(e,r,!1),this.failure("ValidationError","validation-error",n.errors.map(e=>e.message).join(", "),"VALIDATION_FAILED",n.suggestions);const i=Bn(t.left,"left operand"),a=i+Bn(t.right,"right operand");return this.trackSimple(e,r,!0,a),this.success(a,"number")}catch(t){return this.trackSimple(e,r,!1),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"])}}};class $i extends Me{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=Ri,this.outputType="String",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return this.trackSimple(e,r,!1),this.failure("ValidationError","validation-error",n.errors[0]?.message||"Invalid input","STRING_CONCATENATION_VALIDATION_FAILED",n.suggestions);const i=this.convertToString(t.left),a=i+this.convertToString(t.right);return this.trackSimple(e,r,!0,a),this.success(a,"string")}catch(t){return this.trackSimple(e,r,!1),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=Ri.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(ye(e))return e;if(ve(e))return""+e;if(ge(e))return""+e;if(e instanceof Date)return""+e;try{return e+""}catch{return"[object Object]"}}}let Vi=class extends Me{constructor(){super(...arguments),this.name="multiplication",this.category="Special",this.syntax="left * right",this.description="Multiplication of two numeric values",this.inputSchema=Ri,this.outputType="Number",this.metadata={category:"Special",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return this.trackSimple(e,r,!1),this.failure("ValidationError","validation-error",n.errors.map(e=>e.message).join(", "),"VALIDATION_FAILED",n.suggestions);const i=Bn(t.left,"left operand"),a=i*Bn(t.right,"right operand");return this.trackSimple(e,r,!0,a),this.success(a,"number")}catch(t){return this.trackSimple(e,r,!1),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"])}}};const Di={stringLiteral:new Mi,numberLiteral:new Wi,booleanLiteral:new _i,addition:new qi,stringConcatenation:new $i,multiplication:new Vi};const Bi={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"},Hi=e.object({collection:e.unknown().describe("Collection to operate on (array, NodeList, or string)")}).strict(),Fi=e.object({collection:e.unknown().describe("Collection to access"),index:e.number().describe("Index position to access")}).strict(),Ki=e.object({collection:e.unknown().describe("Collection to select random item from")}).strict();class Ui extends Me{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=Hi,this.outputType="Any",this.metadata={category:"Positional",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:n.errors[0]};const i=this.normalizeCollection(t.collection),a=i.length>0?i[0]:void 0,o={success:!0,value:a,type:Bi[this.inferEvaluationType(a)]};return this.trackPerformance(e,t,o,r),o}catch(n){const i=this.failure("FirstExpressionError","runtime-error","First operation failed: "+(n instanceof Error?n.message:n+""),"FIRST_OPERATION_FAILED");return this.trackPerformance(e,t,i,r),i}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:!1,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"])}}}class Gi extends Me{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=Hi,this.outputType="Any",this.metadata={category:"Positional",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:n.errors[0]};const i=this.normalizeCollection(t.collection),a=i.length>0?i[i.length-1]:void 0,o={success:!0,value:a,type:Bi[this.inferEvaluationType(a)]};return this.trackPerformance(e,t,o,r),o}catch(n){const i=this.failure("LastExpressionError","runtime-error","Last operation failed: "+(n instanceof Error?n.message:n+""),"LAST_OPERATION_FAILED");return this.trackPerformance(e,t,i,r),i}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:!1,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"])}}}class Yi extends Me{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=Fi,this.outputType="Any",this.metadata={category:"Positional",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:n.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:!0,value:o,type:Bi[this.inferEvaluationType(o)]};return this.trackPerformance(e,t,s,r),s}catch(n){const i=this.failure("AtExpressionError","runtime-error","At operation failed: "+(n instanceof Error?n.message:n+""),"AT_OPERATION_FAILED");return this.trackPerformance(e,t,i,r),i}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:!1,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}}class Zi extends Me{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=Ki,this.outputType="Any",this.metadata={category:"Positional",complexity:"simple"}}async evaluate(e,t){const r=Date.now();try{const n=this.validate(t);if(!n.isValid)return{success:!1,error:n.errors[0]};const i=this.normalizeCollection(t.collection);if(0===i.length){const n={success:!0,value:void 0,type:"undefined"};return this.trackPerformance(e,t,n,r),n}const a=i[this.getSecureRandomIndex(i.length)],o={success:!0,value:a,type:Bi[this.inferEvaluationType(a)]};return this.trackPerformance(e,t,o,r),o}catch(n){const i=this.failure("RandomExpressionError","runtime-error","Random operation failed: "+(n instanceof Error?n.message:n+""),"RANDOM_OPERATION_FAILED");return this.trackPerformance(e,t,i,r),i}}validate(e){try{const t=this.inputSchema.safeParse(e);return t.success?this.validationSuccess():{isValid:!1,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)}}new Ui,new Gi,new Yi,new Zi;const Ji={name:"first",category:"Reference",evaluatesTo:"Any",operators:["first"],async evaluate(e,t){const r=void 0!==t?t:e.it;if(null==r)return null;if(Array.isArray(r))return r.length>0?r[0]:null;if(r instanceof NodeList||r instanceof HTMLCollection)return r.length>0?r[0]:null;if(r instanceof Element)return r.children.length>0?r.children[0]:null;if(ye(r)){return r.length>0?r[0]:null}if(ke(r)&&"length"in r&&ve(r.length)){return r.length>0?r[0]:null}return null},validate:e=>Ie(e,1,"first","collection")},Xi={name:"last",category:"Reference",evaluatesTo:"Any",operators:["last"],async evaluate(e,t){const r=void 0!==t?t:e.it;if(null==r)return null;if(Array.isArray(r))return r.length>0?r[r.length-1]:null;if(r instanceof NodeList||r instanceof HTMLCollection)return r.length>0?r[r.length-1]:null;if(r instanceof Element){const e=r.children;return e.length>0?e[e.length-1]:null}if(ye(r)){return r.length>0?r[r.length-1]:null}if(ke(r)&&"length"in r&&ve(r.length)){return r.length>0?r[r.length-1]:null}return null},validate:e=>Ie(e,1,"last","collection")},Qi={name:"at",category:"Reference",evaluatesTo:"Any",operators:["at"],async evaluate(e,...t){const[r,n]=t;if(!ve(r))throw Error("Index must be a number");const i=r,a=void 0!==n?n: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(ye(a)){const e=0>i?a.length+i:i;return e>=0&&a.length>e?a[e]:null}if(ke(a)&&"length"in a&&ve(a.length)){const e=0>i?a.length+i:i;return e>=0&&a.length>e?a[e]:null}return null},validate:e=>Re(e,1,2,"at","index, optional collection")??function(e,t,r,n){if("number"!=typeof e[t])return`${r} ${n} must be a number`;return null}(e,0,"at","index")};function ea(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;const e=r.querySelector(t);if(e)return e;r=r.nextElementSibling}const n=e.parentElement;return n&&n!==document.documentElement?ea(n,t):null}function ta(e,t){let r=e.previousElementSibling;for(;r;){const e=Array.from(r.querySelectorAll(t)).reverse();if(e.length>0)return e[0];if(r.matches(t))return r;r=r.previousElementSibling}const n=e.parentElement;return n&&n!==document.documentElement?ta(n,t):null}const ra=2,na=4;function ia(e,t,r,n){if(r.inSearch){if(null==r.inElt)return;return function(e,t,r,n){const i=Array.from(t??[]),a=[];for(const t of i)(t.matches&&t.matches(r)||t===e)&&a.push(t);for(let t=0;a.length-1>t;t++)if(a[t]===e)return a[t+1];if(n){const e=a[0];if(e&&e.matches&&e.matches(r))return e}}(e,n?Array.from(r.inElt):Array.from(r.inElt).reverse(),t,!!r.wrapping)}const i=r.within??("undefined"!=typeof document?document.body:null);if(i)return n?function(e,t,r,n){const i=t.querySelectorAll(r);for(let t=0;i.length>t;t++){const r=i[t];if(r.compareDocumentPosition(e)===ra)return r}return n?i[0]:void 0}(e,i,t,!!r.wrapping):function(e,t,r,n){const i=t.querySelectorAll(r);for(let t=i.length-1;t>=0;t--){const r=i[t];if(r.compareDocumentPosition(e)===na)return r}return n?i[i.length-1]:void 0}(e,i,t,!!r.wrapping)}function aa(e){let t=0,r=e;for(;r&&r.parentElement;){t+=Array.from(r.parentElement.children).indexOf(r),r=r.parentElement,t+=1e3}return t}const oa={first:Ji,last:Xi,at:Qi,next:{name:"next",category:"Reference",evaluatesTo:"Element",operators:["next"],async evaluate(e,...t){const[r,n,i]=t,a=n||e.me;return a&&a instanceof Element?r?i?ia(a,r,i,!0):ea(a,r):a.nextElementSibling:null},validate(e){const t=Ie(e,3,"next","optional selector, optional fromElement, optional modifiers");return t||(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[r,n,i]=t,a=n||e.me;return a&&a instanceof Element?r?i?ia(a,r,i,!1):ta(a,r):a.previousElementSibling:null},validate(e){const t=Ie(e,3,"previous","optional selector, optional fromElement, optional modifiers");return t||(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[r,n,i]=t,a=i||e.me;if(!(a&&a instanceof Element))return null;const o=a.closest(n);return o?function(e,t,r){const n=Array.from(r.querySelectorAll(t)),i=aa(e);for(const e of n){if(aa(e)>i)return e}return null}(a,r,o):null},validate(e){const t=Re(e,2,3,"nextWithin","selector, withinSelector, optional fromElement");return t||("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[r,n,i]=t,a=i||e.me;if(!(a&&a instanceof Element))return null;const o=a.closest(n);return o?function(e,t,r){const n=Array.from(r.querySelectorAll(t)),i=aa(e);for(let e=n.length-1;e>=0;e--){const t=n[e];if(i>aa(t))return t}return null}(a,r,o):null},validate(e){const t=Re(e,2,3,"previousWithin","selector, withinSelector, optional fromElement");return t||("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")}}};class sa{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 r=this.validate(t);if(!r.isValid)return{success:!1,errors:r.errors,suggestions:r.suggestions};try{const{left:e,right:r}=t,n=Bn(e,"left operand"),i=Bn(r,"right operand");return{success:!0,value:Fn(n+i,"addition"),type:"number"}}catch(e){return{success:!1,errors:[Zn("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 Yn([Zn("missing-argument","Input is null or undefined")],["Provide an object with left and right operands"]);if("object"!=typeof e)return Yn([Zn("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"),Yn([Zn("missing-argument",`Missing ${e.join(" and ")} operand${e.length>1?"s":""}`)],["Provide { left: value, right: value }"])}return{isValid:!0,errors:[],suggestions:[]}}(e);if(!t.isValid)return t;const{left:r,right:n}=e;return Kn(r)?Kn(n)?{isValid:!0,errors:[],suggestions:[]}:{isValid:!1,errors:[Zn("type-mismatch","Right operand cannot be converted to number: "+(n+""))],suggestions:["Provide a numeric value for right operand"]}:{isValid:!1,errors:[Zn("type-mismatch","Left operand cannot be converted to number: "+(r+""))],suggestions:["Provide a numeric value for left operand"]}}}class la{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 r=this.validate(t);if(!r.isValid)return{success:!1,errors:r.errors,suggestions:r.suggestions};try{const{left:e,right:r}=t,n=Bn(e,"left operand"),i=Bn(r,"right operand");return{success:!0,value:Fn(n-i,"subtraction"),type:"number"}}catch(e){return{success:!1,errors:[Zn("runtime-error","Subtraction failed: "+(e instanceof Error?e.message:e+""))],suggestions:["Ensure both operands are numeric"]}}}validate(e){return(new sa).validate(e)}}class ca{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 r=this.validate(t);if(!r.isValid)return{success:!1,errors:r.errors,suggestions:r.suggestions};try{const{left:e,right:r}=t,n=Bn(e,"left operand"),i=Bn(r,"right operand");return{success:!0,value:Fn(n*i,"multiplication"),type:"number"}}catch(e){return{success:!1,errors:[Zn("runtime-error","Multiplication failed: "+(e instanceof Error?e.message:e+""))],suggestions:["Ensure both operands are numeric"]}}}validate(e){return(new sa).validate(e)}}class ua{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 r=this.validate(t);if(!r.isValid)return{success:!1,errors:r.errors,suggestions:r.suggestions};try{const{left:e,right:r}=t,n=Bn(e,"left operand"),i=function(e,t,r=!0){if(0===t){if(r)return 0===e?NaN:e>0?1/0:-1/0;throw Error("Division by zero")}return e/t}(n,Bn(r,"right operand"),!0);return{success:!0,value:i,type:"number"}}catch(e){return{success:!1,errors:[Zn("runtime-error","Division failed: "+(e instanceof Error?e.message:e+""))],suggestions:["Ensure both operands are numeric"]}}}validate(e){return(new sa).validate(e)}}class pa{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 r=this.validate(t);if(!r.isValid)return{success:!1,errors:r.errors,suggestions:r.suggestions};try{const{left:e,right:r}=t,n=Bn(e,"left operand"),i=function(e,t){if(0===t)throw Error("Modulo by zero");return e%t}(n,Bn(r,"right operand"));return{success:!0,value:i,type:"number"}}catch(e){return{success:!1,errors:[Zn("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 sa).validate(e)}}class ma{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 r=this.validate(t);if(!r.isValid)return{success:!1,errors:r.errors,suggestions:r.suggestions};try{const{left:e,right:r}=t,n=Bn(e,"left operand"),i=Bn(r,"right operand");return{success:!0,value:Fn(Math.pow(n,i),"power"),type:"number"}}catch(e){return{success:!1,errors:[Zn("runtime-error","Power failed: "+(e instanceof Error?e.message:e+""))],suggestions:["Ensure both operands are numeric"]}}}validate(e){return(new sa).validate(e)}}const da={addition:new sa,subtraction:new la,multiplication:new ca,division:new ua,modulo:new pa,power:new ma};function fa(){return In(Wn,Pi,Ye,oa,Qe,Di,da)}var ha=Object.freeze({__proto__:null,conversion:Ye,conversionExpressions:Ye,createCommonRegistry:function(){return In(Wn,Pi,Di,Ye,oa)},createCoreRegistry:function(){return In(Wn,Pi,Di)},createExpressionRegistry:In,createFullExpressionRegistry:fa,createFullRegistry:function(){return In(Wn,Pi,Di,Ye,oa,Qe)},logical:Pi,logicalExpressions:Pi,positional:oa,positionalExpressions:oa,properties:Qe,propertiesExpressions:Qe,references:Wn,referencesExpressions:Wn,special:Di,specialExpressions:Di});function ya(e,t,r,n,i,a){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,l=n.kind,c="getter"===l?"get":"setter"===l?"set":"value",u=!t&&e?n.static?e:e.prototype:null,p=t||(u?Object.getOwnPropertyDescriptor(u,n.name):{}),m=!1,d=r.length-1;d>=0;d--){var f={};for(var h in n)f[h]="access"===h?{}:n[h];for(var h in n.access)f.access[h]=n.access[h];f.addInitializer=function(e){if(m)throw new TypeError("Cannot add initializers after decoration has completed");a.push(o(e||null))};var y=(0,r[d])("accessor"===l?{get:p.get,set:p.set}:p[c],f);if("accessor"===l){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(s=o(y.get))&&(p.get=s),(s=o(y.set))&&(p.set=s),(s=o(y.init))&&i.unshift(s)}else(s=o(y))&&("field"===l?i.unshift(s):p[c]=s)}u&&Object.defineProperty(u,n.name,p),m=!0}function va(e,t,r){for(var n=arguments.length>2,i=0;t.length>i;i++)r=n?t[i].call(e,r):t[i].call(e);return n?r:void 0}function ga(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}"function"==typeof SuppressedError&&SuppressedError;const ka=Symbol("command:name"),ba=Symbol("command:category"),wa=Symbol("command:metadata");function za(e){return function(t,r){const n=t;n[ka]=e.name,n[ba]=e.category,Object.defineProperty(t.prototype,"name",{value:e.name,writable:!1,enumerable:!0})}}function xa(e){return function(t,r){const n=t,i=n[ba];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??!1,hasBody:e.hasBody??!1,version:"1.0.0",compatibility:e.compatibility};n[wa]=a,Object.defineProperty(t,"metadata",{value:a,writable:!1,enumerable:!0,configurable:!1}),Object.defineProperty(t.prototype,"metadata",{get:()=>a,enumerable:!0,configurable:!1})}}function Ea(e){return()=>new e}function Ta(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&1===e.nodeType&&"tagName"in e&&"string"==typeof e.tagName&&"classList"in e}function Sa(e){return null!==e&&"object"==typeof e&&"length"in e&&"number"==typeof e.length&&(Symbol.iterator in e||"function"==typeof e.item)}function Ca(e,t){return e?`[${e}] ${t}`:t}function Aa(e,t,r){if(Ta(e))return e;if(!e){const e=t.me;if(!e)throw Error(Ca(r,"No target element — provide explicit target or ensure context.me is set"));return ja(e)}if("string"==typeof e){const n=e.trim();if("me"===n){if(!t.me)throw Error(Ca(r,'Context reference "me" is not available'));return ja(t.me)}if("it"===n){if(!Ta(t.it))throw Error(Ca(r,'Context reference "it" is not an HTMLElement'));return t.it}if("you"===n){if(!t.you)throw Error(Ca(r,'Context reference "you" is not available'));return ja(t.you)}const i=t.me?.ownerDocument??("undefined"!=typeof document?document:null);if(!i)throw Error(Ca(r,"DOM not available — cannot resolve element selector"));const a=i.querySelector(n);if(!a)throw Error(Ca(r,"Element not found with selector: "+n));if(!Ta(a))throw Error(Ca(r,"Element found but is not an HTMLElement: "+n));return a}throw Error(Ca(r,"Invalid target type: "+typeof e))}function La(e,t){if(Array.isArray(e))return e.filter(Ta);if(Sa(e))return Array.from(e).filter(Ta);if(Ta(e))return[e];if(!e){const e=t.me;return e&&Ta(e)?[e]:[]}if("string"==typeof e){const r=e.trim();if("me"===r)return t.me&&Ta(t.me)?[t.me]:[];if("it"===r)return Ta(t.it)?[t.it]:[];if("you"===r)return t.you&&Ta(t.you)?[t.you]:[];const n=t.me?.ownerDocument??("undefined"!=typeof document?document:null);if(n){let e=r;e.startsWith("<")&&e.endsWith("/>")&&(e=e.slice(1,-2).trim());const t=n.querySelectorAll(e);return Array.from(t).filter(Ta)}}return[]}function ja(e){if(Ta(e))return e;throw Error("Value is not an HTMLElement")}function Pa(e,t,r){switch(e.toLowerCase()){case"my":case"me":if(!t.me)throw Error(Ca(r,'No "me" element in context'));if(!Ta(t.me))throw Error(Ca(r,"context.me is not an HTMLElement"));return t.me;case"its":case"it":if(!t.it)throw Error(Ca(r,'No "it" value in context'));if(!Ta(t.it))throw Error(Ca(r,"context.it is not an HTMLElement"));return t.it;case"your":case"you":if(!t.you)throw Error(Ca(r,'No "you" element in context'));if(!Ta(t.you))throw Error(Ca(r,"context.you is not an HTMLElement"));return t.you;default:throw Error(Ca(r,"Unknown possessive: "+e))}}const Oa=["on","from","to","in","with","at"];async function Na(e,t,r,n,i={},a){let o=e;if(i.filterPrepositions&&e&&(o=e.filter(e=>{const t=e;return"identifier"!==t?.type||"string"!=typeof t.name||!Oa.includes(t.name.toLowerCase())})),(!o||0===o.length)&&i.fallbackModifierKey&&a){const e=a[i.fallbackModifierKey];e&&(o=[e])}if(!o||0===o.length){if(!r.me)throw Error(n+" command: no target specified and context.me is null");if(!Ta(r.me))throw Error(n+" command: context.me must be an HTMLElement");return[r.me]}const s=[];for(const e of o){const i=await t.evaluate(e,r);if(""!==i&&("string"!=typeof i||""!==i.trim()))if(Ta(i))s.push(i);else if(Sa(i)){const e=Array.from(i).filter(Ta);s.push(...e)}else if(Array.isArray(i)){const e=i.filter(Ta);s.push(...e)}else{if("string"!=typeof i){if(null==i)continue;throw Error(`Invalid ${n} 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=r.me?.ownerDocument??("undefined"!=typeof document?document:null);if(!t)throw Error("DOM not available - cannot resolve element selector");const n=t.querySelectorAll(e),a=Array.from(n).filter(Ta);s.push(...a)}catch(e){throw Error(`Invalid CSS selector: "${i}" - ${e instanceof Error?e.message:e+""}`)}}}if(0===s.length){if(!r.me)throw Error(n+" command: no target specified and context.me is null");if(!Ta(r.me))throw Error(n+" command: context.me must be an HTMLElement");return[r.me]}return s}class Ia{async parseInput(e,t,r){const{targets:n}=await async function(e,t,r,n){return{targets:await Na(e.args,t,r,n)}}(e,t,r,this.mode);return{targets:n,mode:this.mode,defaultDisplay:"show"===this.mode?"block":void 0}}validate(e){if("object"!=typeof e||null===e)return!1;const t=e;return!!Array.isArray(t.targets)&&(!!t.targets.every(e=>Ta(e))&&(("show"===t.mode||"hide"===t.mode)&&("show"!==t.mode||"string"==typeof t.defaultDisplay)))}showElement(e,t="block"){const r=e.dataset.originalDisplay;void 0!==r?(e.style.display=r||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")}}const Ra=Ea((()=>{let e,t,r=[xa({description:"Hide elements by setting display to none",syntax:"hide [<target>]",examples:["hide me","hide #modal","hide .warnings","hide <button/>"],sideEffects:["dom-mutation"]}),za({name:"hide",category:"dom"})],n=[],i=Ia;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!1;const t=e;return!!Array.isArray(t.targets)&&!!t.targets.every(e=>Ta(e))}},ga(t,"HideCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:a},null,n),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),va(t,n)})(),t})());const Ma=Ea((()=>{let e,t,r=[xa({description:"Show elements by restoring display property",syntax:"show [<target>]",examples:["show me","show #modal","show .hidden","show <button/>"],sideEffects:["dom-mutation"]}),za({name:"show",category:"dom"})],n=[],i=Ia;return t=class extends i{constructor(){super(...arguments),this.mode="show"}async execute(e,t){const r=e.defaultDisplay||"block";for(const t of e.targets)this.showElement(t,r)}validate(e){if("object"!=typeof e||null===e)return!1;const t=e;return!!Array.isArray(t.targets)&&(!!t.targets.every(e=>Ta(e))&&"string"==typeof t.defaultDisplay)}},ga(t,"ShowCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:a},null,n),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),va(t,n)})(),t})());function Wa(e){const t=e.trim();return!(!t.startsWith("[@")||!t.endsWith("]"))||!!t.startsWith("@")}function _a(e){const t=e.trim();if(t.startsWith("[@")&&t.endsWith("]")){const e=t.slice(2,-1),r=e.indexOf("=");if(-1===r)return{name:e.trim()};const n=e.slice(0,r).trim();let i=e.slice(r+1).trim();return(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),{name:n,value:i}}if(t.startsWith("@"))return{name:t.substring(1).trim()};throw Error("Invalid attribute syntax: "+e)}function qa(e,t){for(const r of e)t(r);return e}function $a(e,t,r){for(const n of e)for(const e of t)r(n,e);return e}function Va(e,t,r){const n=e.hasAttribute(t);void 0!==r?n&&e.getAttribute(t)===r?e.removeAttribute(t):e.setAttribute(t,r):n?e.removeAttribute(t):e.setAttribute(t,"")}function Da(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&&Ha(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&&Ha(e));const t=(e+"").trim(),r=t.startsWith(".")?t.substring(1):t;return r.length>0&&Ha(r)?[r]:[]}function Ba(e){const t=e.trim();return/^\{[^}]+\}$/.test(t)}function Ha(e){if(!e||0===e.trim().length)return!1;const t=e.trim();if(Ba(t))return!0;return/^[a-zA-Z_-][a-zA-Z0-9_-]*$/.test(t)}function Fa(e,t){return e.map(e=>{if(Ba(e)){const r=function(e){const t=e.trim(),r=t.match(/^\{(.+)\}$/);return r?r[1].trim():t}(e),n=t.locals.get(r)??t.globals.get(r);return null!=n?n+"":""}return e}).filter(e=>e.length>0)}function Ka(e){return"string"==typeof e&&e.trim().startsWith("*")}function Ua(e){const t=function(e){const t=e.trim();if(!t.startsWith("*"))return null;const r=t.substring(1).trim();return r?{property:r}:null}(e);if(!t)return null;const r=t.property.toLowerCase();return["display","visibility","opacity"].includes(r)?r:null}function Ga(e,t,r){e.style.setProperty(t,r)}const Ya=["dialog","details","summary","select"];function Za(e){if(!e||"object"!=typeof e)return null;return"string"==typeof e.selector?e.selector:"string"==typeof e.value?e.value:"string"==typeof e.name?e.name:null}function Ja(e){if(!e||"object"!=typeof e)return!1;if("identifier"!==e.type)return!1;const t=e.name;return"string"==typeof t&&function(e){if("string"!=typeof e)return!1;const t=e.toLowerCase();return Ya.includes(t)}(t)}async function Xa(e,t,r){return function(e){if(!e||"object"!=typeof e)return!1;const t=e.type;if("selector"!==t&&"cssSelector"!==t&&"classSelector"!==t)return!1;const r=Za(e);return"string"==typeof r&&r.startsWith(".")}(e)||function(e){if(!e||"object"!=typeof e)return!1;const t=e.type;if("selector"!==t&&"cssSelector"!==t&&"cssProperty"!==t)return!1;const r=Za(e);return"string"==typeof r&&r.startsWith("*")}(e)?{value:Za(e),extractedFromNode:!0}:function(e){if(!e||"object"!=typeof e)return!1;if("attributeAccess"===e.type)return!0;if("selector"===e.type||"cssSelector"===e.type){const t=Za(e);return"string"==typeof t&&t.startsWith("@")}return!1}(e)?{value:(n=e,"attributeAccess"===n.type?"@"+n.attributeName:Za(n)),extractedFromNode:!0}:{value:await t.evaluate(e,r),extractedFromNode:!1};var n}class Qa{async resolveTargets(e,t,r,n){return Na(e,t,r,this.mode,{filterPrepositions:!0,fallbackModifierKey:this.preposition},n)}async evaluateFirst(e,t,r){return Xa(e,t,r)}parseClassNames(e){return Da(e)}isAttribute(e){return Wa(e.trim())}isCSSProperty(e){return Ka(e.trim())}validateTargets(e){return Array.isArray(e)&&function(e){return Array.isArray(e)&&e.length>0&&e.every(e=>Ta(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 eo=(()=>{let e,t,r=[xa({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"]}),za({name:"add",category:"dom"})],n=[],i=Qa;return t=class extends i{constructor(){super(...arguments),this.mode="add",this.preposition="to"}async parseInput(e,t,r){if(!e.args||0===e.args.length)throw Error("add command requires an argument");const{value:n}=await this.evaluateFirst(e.args[0],t,r);if("object"==typeof n&&null!==n&&!Array.isArray(n)){return{type:"styles",styles:n,targets:await this.resolveTargets(e.args.slice(1),t,r,e.modifiers)}}if("string"==typeof n){const i=n.trim();if(this.isAttribute(i)){const{name:n,value:a}=function(e){const t=_a(e);return{name:t.name,value:t.value??""}}(i);return{type:"attribute",name:n,value:a,targets:await this.resolveTargets(e.args.slice(1),t,r,e.modifiers)}}if(this.isCSSProperty(i)){const n=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],r);return{type:"styles",styles:{[n]:a+""},targets:await this.resolveTargets(e.args.slice(2),t,r,e.modifiers)}}}const i=this.parseClassNames(n);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,r,e.modifiers)}}async execute(e,t){switch(e.type){case"classes":{const r=Fa(e.classes,t);r.length>0&&$a(e.targets,r,(e,t)=>{e.classList.contains(t)||e.classList.add(t)});break}case"attribute":!function(e,t,r){qa(e,e=>{e.setAttribute(t,r)})}(e.targets,e.name,e.value);break;case"styles":!function(e,t){$a(e,Object.entries(t),(e,[t,r])=>{e.style.setProperty(t,r)})}(e.targets,e.styles)}}validate(e){if("object"!=typeof e||null===e)return!1;const t=e;if(!this.validateType(t.type,["classes","attribute","styles"]))return!1;if(!this.validateTargets(t.targets))return!1;if("classes"===t.type){if(!this.validateStringArray(e.classes,1))return!1}else if("attribute"===t.type){if("string"!=typeof e.name||0===e.name.length)return!1;if("string"!=typeof e.value)return!1}else if("styles"===t.type){const t=e;if("object"!=typeof t.styles||null===t.styles)return!1;if(Array.isArray(t.styles))return!1;const r=t.styles;if(0===Object.keys(r).length)return!1;if(!Object.values(r).every(e=>"string"==typeof e))return!1}return!0}},ga(t,"AddCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:a},null,n),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),va(t,n)})(),t})();const to=Ea(eo);function ro(e){return!!e.parentNode&&(e.remove(),!0)}const no=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"remove",category:"dom"})],n=[],i=Qa;return t=class extends i{constructor(){super(...arguments),this.mode="remove",this.preposition="from"}async parseInput(e,t,r){if(!e.args||0===e.args.length)throw Error("remove command requires an argument");const{value:n}=await this.evaluateFirst(e.args[0],t,r);if(Ta(n))return{type:"element",targets:[n]};if(Array.isArray(n)&&n.length>0&&Ta(n[0]))return{type:"element",targets:n.filter(e=>Ta(e))};if("string"==typeof n){const i=n.trim();if(this.isAttribute(i)){return{type:"attribute",name:_a(i).name,targets:await this.resolveTargets(e.args.slice(1),t,r,e.modifiers)}}if(this.isCSSProperty(i)){return{type:"styles",properties:[i.substring(1).trim()],targets:await this.resolveTargets(e.args.slice(1),t,r,e.modifiers)}}}const i=this.parseClassNames(n);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,r,e.modifiers)}}execute(e,t){switch(e.type){case"classes":{const r=Fa(e.classes,t);r.length>0&&$a(e.targets,r,(e,t)=>{e.classList.remove(t)});break}case"attribute":!function(e,t){qa(e,e=>{e.removeAttribute(t)})}(e.targets,e.name);break;case"styles":!function(e,t){$a(e,t,(e,t)=>{e.style.removeProperty(t)})}(e.targets,e.properties);break;case"element":for(const t of e.targets)ro(t)}}validate(e){if("object"!=typeof e||null===e)return!1;const t=e;if(!this.validateType(t.type,["classes","attribute","styles","element"]))return!1;if(!this.validateTargets(t.targets))return!1;if("classes"===t.type){if(!this.validateStringArray(e.classes,1))return!1}else if("attribute"===t.type){if("string"!=typeof e.name||0===e.name.length)return!1}else if("styles"===t.type){if(!this.validateStringArray(e.properties,1))return!1}return!0}},ga(t,"RemoveCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:a},null,n),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),va(t,n)})(),t})());function io(e){const t=e.trim().match(/^(\d+(?:\.\d+)?)\s*(s|ms|sec|seconds?|milliseconds?)?$/i);if(!t)return null;const r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();return"ms"===n||"millisecond"===n||"milliseconds"===n?{number:r,milliseconds:Math.floor(r)}:"s"===n||"sec"===n||"second"===n||"seconds"===n?{number:r,milliseconds:Math.floor(1e3*r)}:null}function ao(e,t=300){if("number"==typeof e)return Math.max(0,Math.floor(e));if("string"==typeof e){const r=io(e);return r?r.milliseconds:t}return t}function oo(e){if("number"==typeof e){if(0>e)throw Error("Duration must be >= 0");return Math.floor(e)}if("string"==typeof e){const t=io(e);if(!t)throw Error(`Invalid duration format: "${e}"`);return t.milliseconds}throw Error("Invalid duration type: "+typeof e)}function so(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 lo(e,t){let r=0;for(let n=0;e.length>n;n++){r=Math.max(r,(e[n]||0)+(t[n]||0))}return r}function co(e){if(0===e.length)return[];return"SUMMARY"===e[0].tagName?e.map(e=>e.closest("details")).filter(e=>null!==e):e}function uo(e){return"DIALOG"===e.tagName}function po(e){return"DETAILS"===e.tagName}function mo(e,t,r){return()=>{"class"===t?e.classList.toggle(r):"attribute"===t&&Va(e,r)}}function fo(e,t,r,n){const i=mo(e,t,r),a=setTimeout(i,n);return()=>{clearTimeout(a)}}function ho(e,t,r,n){const i=mo(e,t,r),a=()=>{i(),e.removeEventListener(n,a)};return e.addEventListener(n,a,{once:!0}),()=>{e.removeEventListener(n,a)}}function yo(e,t,r){if(t.startsWith("@")){const n=t.substring(1);return void(!1===r?e.removeAttribute(n):e.setAttribute(n,!0===r?"":r+""))}const n=r+"";switch(t){case"textContent":return void(e.textContent=n);case"innerHTML":return void(e.innerHTML=n);case"innerText":return void(e.innerText=n);case"id":return void(e.id=n);case"className":return void(e.className=n);case"value":return void("value"in e&&(e.value=n));case"checked":return void("checked"in e&&(e.checked=!!r))}if(t.includes(".")){const n=t.split(".");let i=e;for(let e=0;n.length-1>e;e++)if(i=i[n[e]],null==i)return;return void(i[n[n.length-1]]=r)}if(t.includes("-")||t in e.style)e.style.setProperty(t,n);else try{e[t]=r}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 vo(e){return null==e||""===e}const go=/^the\s+(.+?)\s+of\s+(.+)$/i,ko=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 bo(e){return"string"==typeof e&&go.test(e)}function wo(e,t){const r=e.match(go);if(!r)return null;try{return{element:Aa(r[2].trim(),t),property:r[1].trim()}}catch{return null}}async function zo(e,t,r){if(function(e){return!(!e||"object"!=typeof e)&&("propertyOfExpression"===e.type&&"object"==typeof e.property&&null!==e.property)}(e))return async function(e,t,r){const n=e.property?.name;if(!n)return null;let i=await t.evaluate(e.target,r);return Array.isArray(i)&&(i=i[0]),Ta(i)?{element:i,property:n}:null}(e,t,r);if(function(e){return!(!e||"object"!=typeof e)&&("propertyAccess"===e.type&&("string"==typeof e.property||"object"==typeof e.property&&null!==e.property&&"string"==typeof e.property.name))}(e))return async function(e,t,r){const n="string"==typeof e.property?e.property:e.property?.name;if(!n)return null;let i=await t.evaluate(e.object,r);return Array.isArray(i)&&(i=i[0]),Ta(i)?{element:i,property:n}:null}(e,t,r);const n=e;if("possessiveExpression"===n?.type||"memberExpression"===n?.type){const e=n.object,i=n.property;let a=await t.evaluate(e,r);if(Array.isArray(a)&&(a=a[0]),!Ta(a))return null;const o=i?.name||i?.value;return o?{element:a,property:o}:null}return null}function xo(e){const{element:t,property:r}=e;if(r.startsWith("*")){return function(e,t){return window.getComputedStyle(e).getPropertyValue(t)}(t,r.substring(1))}return Ce(t,r)}function Eo(e,t){const{element:r,property:n}=e;if(n.startsWith("*")){return void Ga(r,n.substring(1),t+"")}yo(r,n,t)}async function To(e,t,r){let n,i;if(e?.for){const i=await t.evaluate(e.for,r);n="number"==typeof i?i:"string"==typeof i?ao(i):void 0}if(e?.until){const n=await t.evaluate(e.until,r);"string"==typeof n&&(i=n)}return{duration:n,untilEvent:i}}function So(e,t){const r=t?.name,n=Ja(t);if(Ta(e)||Array.isArray(e)&&e.every(e=>Ta(e)))return{type:"element",expression:""};if(n&&r)return{type:"element",expression:r};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!1;const t=e.toLowerCase();return Ya.some(e=>t.includes(e))}(t)?{type:"element",expression:t}:{type:"class",expression:t}}return{type:"class",expression:""}}let Co=(()=>{let e,t,r=[xa({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"]}),za({name:"toggle",category:"dom"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args?.length)throw Error("toggle command requires an argument");let n=!1;if(function(e){if(!e||"asExpression"!==e.type)return!1;const t=e.targetType,r="string"==typeof t?t:t?.name;return"string"==typeof r&&"modal"===r.toLowerCase()}(e.args[0])){n=!0;const t=e.args[0].expression;e={...e,args:[t,...e.args.slice(1)]}}const i=e.args[0],a=i?.name;if("between"===a&&e.args.length>=4){const{duration:n,untilEvent:i}=await To(e.modifiers,t,r),a=async e=>{const n=e;return"selector"===n?.type?n.value:t.evaluate(e,r)},o=await a(e.args[1]),s=await a(e.args[3]),l=[];for(let t=4;e.args.length>t;t++){const r=e.args[t]?.name;"on"!==r&&"from"!==r&&l.push(e.args[t])}const c={filterPrepositions:!0,fallbackModifierKey:"on"},u=await Na(l,t,r,"toggle",c,e.modifiers);return{type:"classes-between",classA:(o+"").replace(/^\./,""),classB:(s+"").replace(/^\./,""),targets:u,duration:n,untilEvent:i}}const o=await zo(i,t,r);if(o)return{type:"property",target:o};if("selector"===i.type&&"string"==typeof i.value&&i.value.startsWith("*")){let n=i.value,a=1;if("*"===n&&e.args.length>1&&"identifier"===e.args[1].type&&(n="*"+e.args[1].name,a=2),"*"===n&&e.modifiers?.on){const i=e.modifiers.on?.name;if(i&&["display","visibility","opacity"].includes(i)){n="*"+i;const{duration:a,untilEvent:o}=await To(e.modifiers,t,r),s=Ua(n);if(s){const e=r.me;return{type:"css-property",property:s,targets:e?[e]:[],duration:a,untilEvent:o}}}}const o=Ua(n);if(o){const{duration:n,untilEvent:i}=await To(e.modifiers,t,r),s={filterPrepositions:!0,fallbackModifierKey:"on"};return{type:"css-property",property:o,targets:await Na(e.args.slice(a),t,r,"toggle",s,e.modifiers),duration:n,untilEvent:i}}}const{duration:s,untilEvent:l}=await To(e.modifiers,t,r),{value:c}=await Xa(i,t,r);if(bo(c)){const e=wo(c,r);if(e)return{type:"property",target:e}}const{type:u,expression:p}=So(c,i),m={filterPrepositions:!0,fallbackModifierKey:"on"};switch(u){case"attribute":{const{name:n,value:i}=_a(p);return{type:"attribute",name:n,value:i,targets:await Na(e.args.slice(1),t,r,"toggle",m,e.modifiers),duration:s,untilEvent:l}}case"css-property":{const n=Ua(p);if(!n)throw Error("Invalid CSS property: "+p);return{type:"css-property",property:n,targets:await Na(e.args.slice(1),t,r,"toggle",m,e.modifiers)}}case"element":{let a;if(Ta(c))a=[c];else if(Array.isArray(c)&&c.every(e=>Ta(e)))a=c;else if(p){const e=document.querySelectorAll(p);a=Array.from(e).filter(e=>Ta(e))}else a=await Na([i],t,r,"toggle",m,e.modifiers);const o=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}}(a);if("dialog"===o){const i=n?"modal":await async function(e,t,r,n){if(t?.as){const e=await r.evaluate(t.as,n);if("string"==typeof e&&"modal"===e.toLowerCase())return"modal"}if(e.length>=2){const t=await r.evaluate(e[1],n);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 r.evaluate(e[2],n);if("string"==typeof t&&"modal"===t.toLowerCase())return"modal"}}}return"non-modal"}(e.args,e.modifiers,t,r);return{type:"dialog",mode:i,targets:a}}if("details"===o)return{type:"details",targets:co(a)};if("select"===o)return{type:"select",targets:a};return{type:"classes",classes:Da(p),targets:a,duration:s,untilEvent:l}}default:{const n=Da(p||c);if(!n.length)throw Error("toggle command: no valid class names found");return{type:"classes",classes:n,targets:await Na(e.args.slice(1),t,r,"toggle",m,e.modifiers),duration:s,untilEvent:l}}}}async execute(e,t){switch(e.type){case"classes":{const r=Fa(e.classes,t);if(0===r.length)return[...e.targets];if($a(e.targets,r,(e,t)=>{e.classList.toggle(t)}),(e.duration||e.untilEvent)&&r.length)for(const t of e.targets)e.duration&&fo(t,"class",r[0],e.duration),e.untilEvent&&ho(t,"class",r[0],e.untilEvent);return[...e.targets]}case"attribute":if(function(e,t,r){qa(e,e=>{Va(e,t,r)})}(e.targets,e.name,e.value),e.duration||e.untilEvent)for(const t of e.targets)e.duration&&fo(t,"attribute",e.name,e.duration),e.untilEvent&&ho(t,"attribute",e.name,e.untilEvent);return[...e.targets];case"css-property":return qa(e.targets,t=>function(e,t){const r=window.getComputedStyle(e);switch(t){case"display":"none"===r.display?(e.style.display=e.dataset.previousDisplay||"block",delete e.dataset.previousDisplay):(e.dataset.previousDisplay=r.display,e.style.display="none");break;case"visibility":e.style.visibility="hidden"===r.visibility?"visible":"hidden";break;case"opacity":e.style.opacity=0===parseFloat(r.opacity)?"1":"0"}}(t,e.property));case"property":return function(e){const t=xo(e),r=e.property,n=r.startsWith("@")?r.substring(1):r;if("boolean"==typeof t||ko.has(n)||ko.has(n.toLowerCase())){const r=!t;return Eo(e,r),r}if("number"==typeof t){const r=0===t?1:0;return Eo(e,r),r}if("string"==typeof t){const n="__ht_"+r,i=e.element[n];return""===t&&void 0!==i?(Eo(e,i),i):(e.element[n]=t,Eo(e,""),"")}const i=!t;Eo(e,i)}(e.target),[e.target.element];case"dialog":return qa(e.targets,t=>{return n=e.mode,void((r=t).open?r.close():"modal"===n?r.showModal():r.show());var r,n});case"details":return qa(e.targets,e=>{var t;(t=e).open=!t.open});case"select":return qa(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:!0,cancelable:!0});e.dispatchEvent(t)}}(e));case"classes-between":for(const t of e.targets){const r=t.classList.contains(e.classA),n=t.classList.contains(e.classB);r?(t.classList.remove(e.classA),t.classList.add(e.classB)):n?(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&&fo(t,"class",e.classA,e.duration),e.untilEvent&&ho(t,"class",e.classA,e.untilEvent);return[...e.targets]}}},ga(t,"ToggleCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})();const Ao=Ea(Co);let Lo=(()=>{let e,t,r=[xa({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"]}),za({name:"put",category:"dom"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args?.length)throw Error("put requires arguments");const n=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 r=e.args[t],s=n(r),l="literal"===s?r.value:r.name;if(("literal"===s||"identifier"===s)&&i.includes(l)){a=t,o=l;break}}let s=null,l=null;if(-1===a){const t=i.find(t=>e.modifiers[t]);if(t)s=e.args[0],o=t,l=e.modifiers[t];else if(e.args.length<3){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,r),u=this.mapPosition(o);let p,m,d=null;if(l){const e=n(l),i=await zo(l,t,r);if(i)return{value:c,targets:[i.element],position:"replace",memberPath:i.property};if("memberExpression"===e){const e=l.object,n=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(r.me&&n?.name)return{value:c,targets:[r.me],position:"replace",memberPath:n.name}}else if("its"===i||"it"===i){const e=await t.evaluate(l,r);"string"==typeof e&&(d=e)}else d=i}if(d&&n?.name)p=n.name;else if(!d&&!p){const e=await t.evaluate(l,r);"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&&bo(e)){const t=wo(e,r);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 n=await t.evaluate(l,r),i=this.resolveEvaluatedAsElements(n);if(i)return{value:c,targets:i,position:u,memberPath:p};m=e}}else{const e=await t.evaluate(l,r),n=this.resolveEvaluatedAsElements(e);if(n)return{value:c,targets:n,position:u,memberPath:p};"string"==typeof e&&(this.looksLikeCss(e)?d=e:m=e)}}if(m)return{value:c,targets:[],position:u,memberPath:p,variableName:m};return{value:c,targets:await this.resolveTargets(d,r),position:u,memberPath:p}}async execute(e,t){const{value:r,targets:n,position:i,memberPath:a,variableName:o}=e;if(o)return t.locals&&t.locals.set(o,r),t[o]=r,void Object.assign(t,{it:r});if(a)for(const e of n)this.setProperty(e,a,r);else for(const e of n){const t=this.parseValue(r);this.insertContent(e,t,i)}return n}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||!Ta(t.me))throw Error("put: no target and context.me is null");return[t.me]}const r=Array.from(document.querySelectorAll(e)).filter(e=>Ta(e));if(!r.length)throw Error(`No elements: "${e}"`);return r}parseValue(e){return Ta(e)?e:null==e?"":e+""}insertContent(e,t,r){if("replace"!==r)if(Ta(t)){const n=t;switch(r){case"beforebegin":e.parentElement?.insertBefore(n,e);break;case"afterbegin":e.insertBefore(n,e.firstChild);break;case"beforeend":e.appendChild(n);break;case"afterend":e.parentElement?.insertBefore(n,e.nextSibling)}}else{t.includes("<")&&t.includes(">")?e.insertAdjacentHTML(r,t):e.insertAdjacentText(r,t)}else if(Ta(t))e.innerHTML="",e.appendChild(t);else{t.includes("<")&&t.includes(">")?e.innerHTML=t:e.textContent=t}}resolveEvaluatedAsElements(e){if(Ta(e))return[e];if(Array.isArray(e)){const t=e.filter(Ta);return t.length>0?t:null}if("undefined"!=typeof NodeList&&e instanceof NodeList){const t=Array.from(e).filter(Ta);return t.length>0?t:null}return null}looksLikeCss(e){if(!e)return!1;if(/^[#.\[]/.test(e))return!0;if(/[>+~\s]/.test(e)&&e.length>1)return!0;return["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())}setProperty(e,t,r){const n=t.split(".");let i=e;for(let e=0;n.length-1>e;e++){if(!i[n[e]])throw Error(`Property path "${t}" does not exist`);i=i[n[e]]}i[n[n.length-1]]=r}},ga(t,"PutCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})();const jo=Ea(Lo);function Po(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 Oo(e,t,r){return"global"===r&&t.globals&&t.globals.has(e)?t.globals.get(e):"global"!==r&&t.locals&&t.locals.has(e)?(de(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"===r&&t.locals&&t.locals.has(e)?(de(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 No(e,t,r,n){if("global"===n)return fe(r,e,t),void("undefined"!=typeof window&&(window[e]=t));if(e.startsWith("$")){return void fe(r,e.slice(1),t)}if(r.locals&&r.locals.has(e))return r.locals.set(e,t),void me(e,t,r);if(r.globals&&r.globals.has(e))return fe(r,e,t),void("undefined"!=typeof window&&e in window&&(window[e]=t));if(r.variables&&r.variables.has(e))r.variables.set(e,t);else{if("undefined"!=typeof window&&e in window)return window[e]=t,void fe(r,e,t);r.locals.set(e,t),me(e,t,r)}}function Io(e,t){return"me"===e?t.me:"it"===e?t.it:"you"===e?t.you:Oo(e,t)}function Ro(e,t,r,n){if("number"==typeof e)return e;if(Ta(e)){const r=e;if(t){if(t.startsWith("data-")||["id","class","title","alt","src","href"].includes(t)){return Po(r.getAttribute(t))}return Po(r[t])}return Po(r.value||r.textContent)}if("string"==typeof e){if("global"===r){return Po(Oo(e,n,"global"))}if(e.includes("."))return function(e,t){const r=e.split("."),n=r[1],i=Io(r[0],t);return i?Po(i[n]):0}(e,n);if("me"===e&&n.me)return Po(n.me.value||0);if("it"===e)return Po(n.it||0);if("you"===e&&n.you)return Po(n.you.value||0);return Po(Oo(e,n))}return Po(e)}function Mo(e,t,r,n,i){if(Ta(e)){const r=e;return void(t?t.startsWith("data-")||["id","class","title","alt","src","href"].includes(t)?r.setAttribute(t,n+""):r[t]=n:"value"in r&&void 0!==r.value?r.value=n+"":r.textContent=n+"")}if("string"==typeof e){if("global"===r)return void No(e,n,i,"global");if(e.includes("."))return void function(e,t,r){const n=e.split("."),i=n[1],a=Io(n[0],r);a&&(a[i]=t)}(e,n,i);if("me"===e&&i.me)return void(i.me.value=n);if("it"===e)return void Object.assign(i,{it:n});if("you"===e&&i.you)return void(i.you.value=n);No(e,n,i)}}const Wo={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function _o(e){return e.replace(/[&<>"']/g,e=>Wo[e])}let qo=(()=>{let e,t,r=[xa({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"]}),za({name:"make",category:"dom"})],n=[];return t=class{async parseInput(e,t,r){const n=e.modifiers.an??e.modifiers.a??e.args[0];if(!n)throw Error("Make command requires class name or DOM element expression");const i=n.raw;let a="string"==typeof i&&i.startsWith("<")?i:await t.evaluate(n,r);if(null==a)throw Error("Make command requires class name or DOM element expression");"string"==typeof a&&a.startsWith("<")&&(a=await async function(e,t){if(!e.includes("{"))return e;const r=/\{([^{}]+)\}/g,n=[];let i;for(;null!==(i=r.exec(e));){let e=i[0];try{const r=await Hr(i[1].trim(),t);null!=r&&(e=_o(r+""))}catch{}n.push({index:i.index,length:i[0].length,text:e})}let a=e;for(let e=n.length-1;e>=0;e--){const{index:t,length:r,text:i}=n[e];a=a.slice(0,t)+i+a.slice(t+r)}return a}(a,r));const o=void 0!==e.modifiers.an?"an":"a",s=await async function(e,t,r){if(!e)return[];if("arrayLiteral"===e.type&&Array.isArray(e.args)){const n=[];for(const i of e.args)n.push(await t.evaluate(i,r));return n}const n=await t.evaluate(e,r);return Array.isArray(n)?n:[n]}(e.modifiers.from,t,r),l=await async function(e,t,r){if(!e)return;if(("symbol"===e.type||"identifier"===e.type)&&"string"==typeof e.name)return e.name;const n=await t.evaluate(e,r);return"string"==typeof n?n:void 0}(e.modifiers.called,t,r);return{article:o,expression:a,constructorArgs:s,variableName:l}}async execute(e,t){const{expression:r,constructorArgs:n=[],variableName:i}=e,a="string"==typeof r&&r.startsWith("<"),o=a&&r.endsWith("/>")?function(e){const t=e.slice(1,-2);let r="div",n=t;const i=t.match(/^([a-zA-Z][a-zA-Z0-9]*)/);i&&(r=i[1],n=t.slice(i[0].length));const a=document.createElement(r),o=n.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}(r):a&&/<\/[a-zA-Z]/.test(r)?function(e){const t=document.createElement("template");t.innerHTML=e.trim();const r=t.content.firstElementChild;if(r&&Ta(r))return r;const n=document.createElement("div");n.innerHTML=e.trim();const i=n.firstElementChild;return i&&Ta(i)?i:n}(r):function(e,t,r){if(Ta(e))return e;const n=e+"";let i;if("undefined"!=typeof window&&(i=window[n]),i||"undefined"==typeof global||(i=global[n]),!i&&r.variables?.has(n)&&(i=r.variables.get(n)),!i||"function"!=typeof i)throw Error(`Constructor '${n}' not found or is not a function`);return 0===t.length?new i:new i(...t)}(r,n,t);return Object.assign(t,{it:o}),i&&No(i,o,t),o}},ga(t,"MakeCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})();const $o=Ea(qo);const Vo=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"empty",category:"dom"})],n=[];return t=class{async parseInput(e,t,r){return{targets:await Na(e.args,t,r,"empty",{filterPrepositions:!0,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!1;const t=e;return!!Array.isArray(t.targets)&&t.targets.every(e=>Ta(e))}},ga(t,"EmptyCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());function Do(e){return e.hasAttribute("popover")}let Bo=(()=>{let e,t,r=[xa({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"]}),za({name:"open",category:"dom"})],n=[];return t=class{async parseInput(e,t,r){const n=(e.args??[]).filter(e=>{const t=e;if("identifier"!==t?.type)return!0;const r=t.name?.toLowerCase();return"as"!==r&&"modal"!==r&&"non-modal"!==r&&"nonmodal"!==r}),i=co(await Na(n,t,r,"open",{filterPrepositions:!0,fallbackModifierKey:"on"},e.modifiers)),a=await async function(e,t,r,n){if(t?.as){const e=await r.evaluate(t.as,n);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 r.evaluate(e[t+1],n);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,r);return{targets:i,dialogMode:a}}async execute(e,t){for(const t of e.targets)if(uo(t))t.open||("modal"===e.dialogMode?t.showModal():t.show());else if(po(t))t.open=!0;else if(Do(t)){const e=t;if("function"==typeof e.showPopover)try{e.showPopover()}catch{}}}validate(e){if("object"!=typeof e||null===e)return!1;const t=e;return!!Array.isArray(t.targets)&&(!!t.targets.every(e=>Ta(e))&&("modal"===t.dialogMode||"non-modal"===t.dialogMode))}},ga(t,"OpenCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})();const Ho=Ea(Bo);function Fo(e){return e.hasAttribute("popover")}const Ko=Ea((()=>{let e,t,r=[xa({description:"Close a dialog, details element, or popover",syntax:["close","close <target>"],examples:["close","close #myDialog","close #details","close #popup"],sideEffects:["dom-mutation"]}),za({name:"close",category:"dom"})],n=[];return t=class{async parseInput(e,t,r){return{targets:co(await Na(e.args,t,r,"close",{filterPrepositions:!0,fallbackModifierKey:"on"},e.modifiers))}}async execute(e,t){for(const t of e.targets)if(uo(t))t.open&&t.close();else if(po(t))t.open=!1;else if(Fo(t)){const e=t;if("function"==typeof e.hidePopover)try{e.hidePopover()}catch{}}}validate(e){if("object"!=typeof e||null===e)return!1;const t=e;return!!Array.isArray(t.targets)&&t.targets.every(e=>Ta(e))}},ga(t,"CloseCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());function Uo(e){const t=e.tagName;return"INPUT"===t||"TEXTAREA"===t}const Go=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"select",category:"dom"})],n=[];return t=class{async parseInput(e,t,r){return{targets:await Na(e.args,t,r,"select",{filterPrepositions:!0,fallbackModifierKey:"on"},e.modifiers)}}async execute(e,t){if(0!==e.targets.length)for(const t of e.targets){if(Uo(t)){t.select();continue}const e=t.ownerDocument??("undefined"!=typeof document?document:null),r=e?.defaultView;if(!e||!r)continue;const n=r.getSelection?.();if(n)try{const r=e.createRange();r.selectNodeContents(t),n.removeAllRanges(),n.addRange(r)}catch{}}}validate(e){if("object"!=typeof e||null===e)return!1;const t=e;return!!Array.isArray(t.targets)&&t.targets.every(e=>Ta(e))}},ga(t,"SelectCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());function Yo(e){return"FORM"===e.tagName}const Zo=Ea((()=>{let e,t,r=[xa({description:"Reset a <form> element to its default values (HTMLFormElement.reset())",syntax:["reset","reset <target>"],examples:["reset","reset #myForm","reset <form/>"],sideEffects:["dom-mutation"]}),za({name:"reset",category:"dom"})],n=[];return t=class{async parseInput(e,t,r){return{targets:await Na(e.args,t,r,"reset",{filterPrepositions:!0,fallbackModifierKey:"on"},e.modifiers)}}async execute(e,t){for(const t of e.targets)Yo(t)&&t.reset()}validate(e){if("object"!=typeof e||null===e)return!1;const t=e;return!!Array.isArray(t.targets)&&t.targets.every(e=>Ta(e))}},ga(t,"ResetCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());var Jo="moveBefore"in Element.prototype,Xo=[0,1,0,0,0,0,0,0,0,1,0,1,0],Qo=0,es=1,ts=2,rs=new Set,ns=new Set,is=new Set,as=new Set,os=new Set,ss=new Set;function ls(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 cs(e){const t=document.createElement("template");return t.innerHTML=e.trim(),t.content}function us(e,t,r){if(t!==r){if(t.parentNode===e){if(t.nextSibling===r)return;if(Jo)return void e.moveBefore(t,r)}e.insertBefore(t,r)}}class ps{#e=new WeakMap;#t=new WeakMap;#r;constructor(e={}){this.#r=e}morph(e,t){fs(e)&&this.#n(e),t instanceof NodeList?(this.#i(t),this.#a(e,t)):fs(t)&&(this.#o(t),this.#s(e,t))}#a(e,t){const r=t.length;if(0===r)this.#l(e);else if(1===r)this.#s(e,t[0]);else if(r>1){const r=[...t];this.#s(e,r.shift());const n=e.nextSibling,i=e.parentNode||document;for(let e=0;r.length>e;e++){const t=r[e];(this.#r.beforeNodeAdded?.(i,t,n)??1)&&(i.insertBefore(t,n),this.#r.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.#r.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.#r.afterNodeVisited?.(e,t))}#u(e,t){(this.#r.beforeNodeVisited?.(e,t)??1)&&(this.#f(e,t),this.#r.afterNodeVisited?.(e,t))}#p(e,t){(this.#r.beforeNodeVisited?.(e,t)??1)&&(e.nodeType===t.nodeType&&null!==e.nodeValue&&null!==t.nodeValue?e.nodeValue=t.nodeValue:this.#f(e,t),this.#r.afterNodeVisited?.(e,t))}#m(e,t){e.hasAttribute("morphlex-dirty")&&e.removeAttribute("morphlex-dirty");for(const{name:r,value:n}of t.attributes){"value"===r&&ms(e)&&e.value!==n&&(this.#r.preserveChanges&&e.value!==e.defaultValue||(e.value=n)),"selected"===r&&ds(e)&&!e.selected&&(this.#r.preserveChanges&&e.selected!==e.defaultSelected||(e.selected=!0)),"checked"===r&&ms(e)&&!e.checked&&(this.#r.preserveChanges&&e.checked!==e.defaultChecked||(e.checked=!0));const t=e.getAttribute(r);t!==n&&(this.#r.beforeAttributeUpdated?.(e,r,n)??1)&&(e.setAttribute(r,n),this.#r.afterAttributeUpdated?.(e,r,t))}for(const{name:r,value:n}of e.attributes)t.hasAttribute(r)||("selected"===r&&ds(e)&&e.selected&&(this.#r.preserveChanges&&e.selected!==e.defaultSelected||(e.selected=!1)),"checked"===r&&ms(e)&&e.checked&&(this.#r.preserveChanges&&e.checked!==e.defaultChecked||(e.checked=!1)),(this.#r.beforeAttributeUpdated?.(e,r,null)??1)&&(e.removeAttribute(r),this.#r.afterAttributeUpdated?.(e,r,n)))}#d(e,t){const r=t.textContent||"",n=e.value!==e.defaultValue;e.textContent!==r&&(e.textContent=r),this.#r.preserveChanges&&n||(e.value=e.defaultValue)}visitChildNodes(e,t){if(!(this.#r.beforeChildrenVisited?.(e)??1))return;const r=e,n=[...e.childNodes],i=[...t.childNodes];rs.clear(),ns.clear(),is.clear(),as.clear(),os.clear(),ss.clear();const a=[],o=[],s=[],l=[],c=[],u=[];for(let e=0;n.length>e;e++){const t=n[e],r=t.nodeType;l[e]=r,1===r?(u[e]=t.localName,""!==t.id?is.add(e):ns.add(e)):3===r&&""===t.textContent?.trim()?ss.add(e):rs.add(e)}for(let e=0;i.length>e;e++){const t=i[e],r=t.nodeType;if(s[e]=r,1===r)c[e]=t.localName,os.add(e);else{if(3===r&&""===t.textContent?.trim())continue;as.add(e)}}for(const e of os){const t=c[e],r=i[e];for(const i of ns){if(t!==u[i])continue;if(n[i].isEqualNode(r)){a[e]=i,o[e]=Qo,ns.delete(i),os.delete(e);break}}}for(const e of os){const t=i[e],r=t.id,s=this.#e.get(t);if(""!==r||s)e:for(const t of is){const i=n[t];if(c[e]===u[t]){if(""!==r&&r===i.id){a[e]=t,o[e]=es,is.delete(t),os.delete(e);break e}if(s){const r=this.#t.get(i);if(r)for(let n=0;s.length>n;n++){if(r.has(s[n])){a[e]=t,o[e]=es,is.delete(t),os.delete(e);break e}}}}}}for(const e of os){const t=i[e],r=t.getAttribute("name"),s=t.getAttribute("href"),l=t.getAttribute("src");for(const t of ns){const i=n[t];if(c[e]===u[t]&&(r&&r===i.getAttribute("name")||s&&s===i.getAttribute("href")||l&&l===i.getAttribute("src"))){a[e]=t,o[e]=es,ns.delete(t),os.delete(e);break}}}for(const e of os){const t=i[e],r=c[e];for(const i of ns){if(r===u[i]){if("input"===r&&n[i].type!==t.type)continue;a[e]=i,o[e]=es,ns.delete(i),os.delete(e);break}}}for(const e of as){const t=i[e];for(const r of rs){if(n[r].isEqualNode(t)){a[e]=r,o[e]=Qo,rs.delete(r),as.delete(e);break}}}for(const e of as){const t=s[e];for(const r of rs)if(t===l[r]){a[e]=r,o[e]=ts,rs.delete(r),as.delete(e);break}}for(const e of rs)this.#l(n[e]);for(const e of ss)this.#l(n[e]);for(const e of ns)this.#l(n[e]);for(const e of is)this.#l(n[e]);const p=function(e){const t=e.length;if(0===t)return[];const r=[],n=[],i=Array(t);for(let a=0;t>a;a++){const t=e[a];if(void 0===t)continue;let o=0,s=r.length;for(;s>o;){const e=Math.floor((o+s)/2);t>r[e]?o=e+1:s=e}i[a]=o>0?n[o-1]:-1,o===r.length?(r.push(t),n.push(a)):(r[o]=t,n[o]=a)}const a=[];if(0===n.length)return a;let o=n[n.length-1];for(;void 0!==o&&-1!==o;)a.unshift(o),o=i[o];return a}(a),m=Array(n.length);for(let e=0;p.length>e;e++)m[a[p[e]]]=!0;let d=r.firstChild;for(let e=0;i.length>e;e++){const t=i[e],s=a[e];if(void 0!==s){const i=n[s],a=o[e];m[s]||us(r,i,d),a===Qo||(a===es?this.#c(i,t):this.#s(i,t)),d=i.nextSibling}else(this.#r.beforeNodeAdded?.(r,t,d)??1)&&(r.insertBefore(t,d),this.#r.afterNodeAdded?.(t),d=t.nextSibling)}this.#r.afterChildrenVisited?.(e)}#f(e,t){const r=e.parentNode||document,n=e;(this.#r.beforeNodeRemoved?.(e)??1)&&(this.#r.beforeNodeAdded?.(r,t,n)??1)&&(r.insertBefore(t,n),this.#r.afterNodeAdded?.(t),e.remove(),this.#r.afterNodeRemoved?.(e))}#l(e){(this.#r.beforeNodeRemoved?.(e)??1)&&(e.remove(),this.#r.afterNodeRemoved?.(e))}#i(e){for(const t of e)fs(t)&&this.#o(t)}#o(e){const t=this.#e;for(const r of e.querySelectorAll("[id]")){const n=r.id;if(""===n)continue;let i=r;for(;i;){const r=t.get(i);if(r?r.push(n):t.set(i,[n]),i===e)break;i=i.parentElement}}}#n(e){const t=this.#t;for(const r of e.querySelectorAll("[id]")){const n=r.id;if(""===n)continue;let i=r;for(;i;){const r=t.get(i);if(r?r.add(n):t.set(i,new Set([n])),i===e)break;i=i.parentElement}}}}function ms(e){return"input"===e.localName}function ds(e){return"option"===e.localName}function fs(e){return!!Xo[e.nodeType]}function hs(e){return{preserveChanges:e?.preserveChanges??!0}}const ys={morph(e,t,r){!function(e,t,r={}){"string"==typeof t&&(t=cs(t).childNodes),!r.preserveChanges&&fs(e)&&ls(e),new ps(r).morph(e,t)}(e,t,hs(r))},morphInner(e,t,r){let n;if("string"==typeof t){const r=document.createElement(e.tagName);r.innerHTML=t,n=r}else n=t;!function(e,t,r={}){if("string"==typeof t){const e=cs(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.");fs(e)&&ls(e),new ps(r).visitChildNodes(e,t)}(e,n,hs(r))}};function vs(){if("undefined"!=typeof document)return document.startViewTransition}function gs(){return"function"==typeof vs()}const ks=[];let bs=!1;async function ws(e,t){const r=vs();if(!r)return void await e();const n=async()=>{await e()};let i;if(t?.transitionName)try{i=r({update:n,types:[t.transitionName]})}catch{i=r(n)}else i=r(n);await i.finished}function zs(e,t){return new Promise((r,n)=>{ks.push({callback:e,options:t,resolve:r,reject:n}),async function(){if(!bs){bs=!0;try{for(;ks.length>0;){const e=ks.shift();try{await ws(e.callback,e.options),e.resolve()}catch(t){e.reject(t)}}}finally{bs=!1}}}().catch(n)})}const xs={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 Es(e,t,r,n){const i=null===t||Ta(t)?"":t,a=Ta(t)?t:null;switch(r){case"morph":if(null!==t)try{ys.morphInner(e,a||i,n)}catch(t){a?(e.innerHTML="",e.appendChild(a)):e.innerHTML=i}break;case"morphOuter":if(null!==t)try{ys.morph(e,a||i,n)}catch(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 "${r}"`)}}async function Ts(e,t,r,n={}){const{morphOptions:i,useViewTransition:a=!1}=n,o=()=>{for(const n of e)Es(n,t,r,i)};a&&gs()?await zs(o):o()}function Ss(e){if(null==e)return null;if(Ta(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,r=document.createElement("div");return r.appendChild(t.cloneNode(!0)),r.innerHTML}return e+""}async function Cs(e,t){const r=La(e||void 0,t);if(0===r.length){throw Error("[HyperFixi] swap: no elements found"+(e?` matching "${e}"`:""))}return r}let As=(()=>{let e,t,r=[xa({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"]}),za({name:"swap",category:"dom"})],n=[];return t=class{async parseInput(e,t,r){const n=e.args;if(!n||0===n.length)throw Error("[HyperFixi] swap: command requires arguments");const i=n.map(e=>{if(!e||"object"!=typeof e)return null;const t=e,r=t.type;return"literal"===r&&"string"==typeof t.value?t.value.toLowerCase():"identifier"===r&&"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===n.length&&1===a&&-1===o&&-1===s&&-1===l){const e=n[0],t=n[2],r="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(r&&i&&!a.has(e.name.toLowerCase())&&!a.has(t.name.toLowerCase())&&!xs[e.name.toLowerCase()])return{variant:"variable",leftName:e.name,rightName:t.name}}let c=!1;if(-1!==l){const e=i.slice(l+1);e.includes("view")&&e.includes("transition")&&(c=!0)}let u="morph",p=null,m=null;if(-1!==s)u="delete",p=n[s+1],m=null;else if(-1!==o&&-1!==a){const e=i[0];e&&xs[e]&&(u=xs[e]),p=n[o+1],m=n[a+1]}else if(-1!==a){const e=i.slice(0,a),t=e.findIndex(e=>"into"===e),r=e.findIndex(e=>"over"===e);if(-1!==t)u="innerHTML",p=n[t+1];else if(-1!==r)u="outerHTML",p=n[r+1];else{const e=i[0];e&&xs[e]?(u=xs[e],p=n[1]||n[a-1]):p=n[a-1]}m=n[a+1]}else{if(2>n.length)throw Error('[HyperFixi] swap: could not parse arguments. Expected "swap <target> with <content>"');{const e=i[0];e&&xs[e]&&(u=xs[e]),p=n[n.length-2],m=n[n.length-1]}}let d=null,f=null;if(p){const e=p.type,n=p.value;if("selector"===e&&"string"==typeof n)d=n;else if("binaryExpression"===e&&"of"===p.operator){const e=p.left,n=p.right;if(e&&"identifier"===e.type&&"string"==typeof e.name){const t=e.name.toLowerCase();xs[t]&&(u=xs[t])}n&&"selector"===n.type&&"string"==typeof n.value?d=n.value:n&&(d=await t.evaluate(n,r))}else d=await t.evaluate(p,r)}m&&(f=await t.evaluate(m,r));let h=null;if("string"==typeof d)h=d;else if(Ta(d))return{targets:[d],content:Ss(f),strategy:u,morphOptions:{preserveChanges:!0},useViewTransition:c};return{targets:await Cs(h,r),content:Ss(f),strategy:u,morphOptions:{preserveChanges:!0},useViewTransition:c}}async execute(e,t){if("variable"===e.variant){const{leftName:r,rightName:n}=e,i=e=>t.locals?.has(e)?t.locals.get(e):t.globals?.has(e)?t.globals.get(e):void 0,a=(e,r)=>{t.locals?.has(e)?t.locals.set(e,r):t.globals?.has(e)?t.globals.set(e,r):t.locals&&t.locals.set(e,r)},o=i(r);return a(r,i(n)),void a(n,o)}const{targets:r,content:n,strategy:i,morphOptions:a,useViewTransition:o}=e;if(!r||!i)throw Error("[HyperFixi] swap: DOM swap requires targets and strategy");await Ts(r,n??null,i,{morphOptions:a,useViewTransition:o})}},ga(t,"SwapCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})(),Ls=(()=>{let e,t,r=[xa({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"]}),za({name:"morph",category:"dom"})],n=[];return t=class{async parseInput(e,t,r){const n=e.args;if(!n||0===n.length)throw Error("[HyperFixi] morph: command requires arguments");const i=n.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=!1;if(-1!==s){const e=i.slice(s+1);e.includes("view")&&e.includes("transition")&&(l=!0)}let c="morph",u=null,p=null;if(-1!==o&&(-1===a?1/0:a)>o?(c="morphOuter",u=n[o+1],-1!==a&&(p=n[a+1])):-1!==a?(u=n[a-1],p=n[a+1]):2>n.length||(u=n[0],p=n[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,r);let d,f=null;if(p&&(f=await t.evaluate(p,r)),!m)throw Error("[HyperFixi] morph: could not determine target");if("string"==typeof m)d=await Cs(m,r);else{if(!Ta(m))throw Error("[HyperFixi] morph: target must be a selector or element");d=[m]}return{targets:d,content:Ss(f),strategy:c,morphOptions:{preserveChanges:!0},useViewTransition:l}}async execute(e,t){const{targets:r,content:n,strategy:i,morphOptions:a,useViewTransition:o}=e;if(!r||!i)throw Error("[HyperFixi] morph: requires targets and strategy");await Ts(r,n??null,i,{morphOptions:a,useViewTransition:o})}},ga(t,"MorphCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})();const js=Ea(As),Ps=Ea(Ls);js(),Ps();const Os={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."}},Ns={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."}},Is={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 Rs={...{enabled:!("undefined"!=typeof window&&window.__HYPERFIXI_PROD__||"undefined"!=typeof process&&"production"===process.env?.NODE_ENV),showWarnings:!0,strictness:"standard",additionalCriticalElements:[],additionalStructuralElements:[],ignoredElements:[],ignoredTargets:[],targetOverrides:[]}};function Ms(e,t){if("*"===t)return!0;if(t.includes("*")){const r=t.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return RegExp("^"+r+"$").test(e)}return e===t}function Ws(e,t=""){const r=function(e){const t={...Rs};if(Rs.targetOverrides)for(const r of Rs.targetOverrides)if(Ms(e,r.target))return{...t,...r.config};return t}(t);if(!r.enabled)return{valid:!0,issues:[],bySeverity:{critical:[],structural:[],warning:[]},totalIssues:0,shouldProceed:!0};if(r.ignoredTargets?.some(e=>Ms(t,e)))return{valid:!0,issues:[],bySeverity:{critical:[],structural:[],warning:[]},totalIssues:0,shouldProceed:!0};const n=[];if(e.match(/<!DOCTYPE[^>]*>/i)&&!r.ignoredElements?.includes("doctype")&&n.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,r){const n=[];for(const[i,a]of Object.entries(Os)){if(r.ignoredElements?.includes(i))continue;const o=RegExp(`<${i}[\\s>]`,"gi"),s=e.match(o),l=s?.length||0;l>0&&n.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"!==r.strictness)for(const[i,a]of Object.entries(Ns)){if(r.ignoredElements?.includes(i))continue;const o=RegExp(`<${i}[\\s>]`,"gi"),s=e.match(o),l=s?.length||0;l>0&&n.push({severity:"strict"===r.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 _s(n)}(e,t,r);for(const[i,a]of Object.entries(Os)){if(r.ignoredElements?.includes(i))continue;const o=RegExp(`<${i}[\\s>]`,"gi"),s=e.match(o),l=s?.length||0;l>0&&n.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"!==r.strictness)for(const[e,a]of Object.entries(Ns)){if(r.ignoredElements?.includes(e))continue;const o=i.querySelectorAll(e).length;o>0&&n.push({severity:"strict"===r.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"===r.strictness)for(const[e,a]of Object.entries(Is)){if(r.ignoredElements?.includes(e))continue;const o=i.querySelectorAll(e).length;o>0&&n.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(r.additionalCriticalElements)for(const e of r.additionalCriticalElements){if(r.ignoredElements?.includes(e))continue;const a=i.querySelectorAll(e).length;a>0&&n.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(r.additionalStructuralElements)for(const e of r.additionalStructuralElements){if(r.ignoredElements?.includes(e))continue;const a=i.querySelectorAll(e).length;a>0&&n.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(r.customValidator){const i=r.customValidator(e,t);n.push(...i)}return _s(n)}function _s(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:!0}}const qs="color: #dc2626; font-weight: bold;",$s="color: #ea580c; font-weight: bold;",Vs="color: #ca8a04; font-weight: bold;",Ds="color: inherit;",Bs={critical:"🚨",structural:"⚠️",warning:"💡"},Hs={critical:"CRITICAL",structural:"STRUCTURAL",warning:"WARNING"};function Fs(e){0!==e.totalIssues&&("undefined"!=typeof window&&void 0!==console?function(e){if(function(e){const t=[],r=[];e.bySeverity.critical.length>0&&(t.push(`%c${e.bySeverity.critical.length} critical%c`),r.push(qs,Ds));e.bySeverity.structural.length>0&&(t.length>0&&t.push(", "),t.push(`%c${e.bySeverity.structural.length} structural%c`),r.push($s,Ds));e.bySeverity.warning.length>0&&(t.length>0&&t.push(", "),t.push(`%c${e.bySeverity.warning.length} warning(s)%c`),r.push(Vs,Ds))}(e),e.bySeverity.critical.length>0)for(const t of e.bySeverity.critical)Ks(t);if(e.bySeverity.structural.length>0)for(const t of e.bySeverity.structural)Ks(t);if(e.bySeverity.warning.length>0)for(const t of e.bySeverity.warning)Ks(t)}(e):function(e){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)");for(const t of e.issues){}}(e))}function Ks(e){}function Us(e){return`${Bs[e.severity]} [${Hs[e.severity]}] <${e.element}>${e.count>1?` (${e.count}x)`:""}${e.targetSelector?` [target: ${e.targetSelector}]`:""}: ${e.message}`}function Gs(e){return e.issues.map(Us)}function Ys(e,t,r={}){return new CustomEvent(e,{detail:void 0!==t?t:{},bubbles:void 0===r.bubbles||r.bubbles,cancelable:void 0===r.cancelable||r.cancelable,composed:void 0!==r.composed&&r.composed})}function Zs(e){const t=e.trim();return/^\d+$/.test(t)?parseInt(t,10):/^\d*\.\d+$/.test(t)?parseFloat(t):"true"===t||"false"!==t&&("null"===t?null:"undefined"!==t?t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'")?t.slice(1,-1):t:void 0)}function Js(e,t,r={},n={}){const i=Ys(t,r,n);return e.dispatchEvent(i),i}function Xs(e,t,r={},n={}){return{lokascript:Js(e,"lokascript:"+t,r,n),hyperfixi:Js(e,"hyperfixi:"+t,r,n)}}const Qs={morph:"morph",morphouter:"morphOuter",innerhtml:"innerHTML",outerhtml:"outerHTML",beforebegin:"beforeBegin",afterbegin:"afterBegin",beforeend:"beforeEnd",afterend:"afterEnd",delete:"delete",none:"none"};function el(e,t){const{target:r,strategy:n,content:i}=e,a=document.querySelector(r);if(!a||!Ta(a))return{success:!1,error:`Target "${r}" not found`};try{switch(n){case"morph":ys.morphInner(a,i,t);break;case"morphOuter":ys.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:!1,error:`Unknown strategy "${n}"`}}return{success:!0}}catch(e){return{success:!1,error:e+""}}}function tl(e,t){const r=function(e){const t=[],r=document.createElement("div");r.innerHTML=e;const n=r.querySelectorAll("hx-partial");for(const e of n){const r=e.getAttribute("target");if(!r)continue;const n=e.getAttribute("strategy")?.toLowerCase()||"morph";t.push({target:r,strategy:Qs[n]||"morph",content:e.innerHTML})}return t}(e),n={...Rs},i={count:0,targets:[],errors:[],validationWarnings:[],validationDetails:{}};for(const e of r){if(n.enabled){const t=Ws(e.content,e.target);t.totalIssues>0&&(n.showWarnings&&Fs(t),i.validationWarnings.push(...Gs(t)),i.validationDetails[e.target]=t)}const r=el(e,t);r.success?(i.count++,i.targets.push(e.target)):r.error&&i.errors.push(`${e.target}: ${r.error}`)}return i}const rl=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"process",category:"dom"})],n=[];return t=class{async parseInput(e,t,r){const n=e.args;if(!n||0===n.length)throw Error("process partials command requires content argument");const i=[],a=[];for(const e of n){const n=await t.evaluate(e,r);i.push(n),"string"==typeof n&&a.push(n.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(Ta(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=!1;if(-1!==u){const e=a.slice(u+1).join(" ");e.includes("view")&&e.includes("transition")&&(p=!0)}return{html:c,useViewTransition:p,morphOptions:{preserveChanges:!0}}}async execute(e,t){const{html:r,useViewTransition:n,morphOptions:i}=e,a=()=>tl(r,i);let o;return n&&gs()?await zs(()=>{o=a()}):o=a(),t.it=o,Xs(window,"partials",o),o}},ga(t,"ProcessPartialsCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());function nl(e,t,r,n){return e?new Promise(r=>{const i=()=>{a({event:null,timedOut:!1,cancelled:!0})},a=al(()=>{e.removeEventListener(t,o),n&&n.removeEventListener("abort",i)},r),o=e=>{a({event:e,timedOut:!1,cancelled:!1})};n?.aborted?r({event:null,timedOut:!1,cancelled:!0}):(e.addEventListener(t,o),n&&n.addEventListener("abort",i))}):Promise.reject(Error("waitForEvent: no target provided"))}function il(e){return new Promise(t=>setTimeout(t,e))}function al(e,t){let r=!1;return n=>{r||(r=!0,e(),t(n))}}rl();let ol=(()=>{let e,t,r=[xa({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"]}),za({name:"wait",category:"async"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args?.length)throw Error("wait command requires an argument");if(e.modifiers.or)return this.parseRaceCondition(e,t,r);if(e.modifiers.for)return this.parseEventWait(e.modifiers.for,e.modifiers.from,t,r);const n=e.args[0];return"arrayLiteral"===n.type&&n.elements?this.parseEventArrayWait(n.elements,e.args[1],t,r):this.parseTimeWait(e.args[0],t,r)}async execute(e,t){const r=Date.now();if("time"===e.type)return await il(e.milliseconds),{type:"time",result:e.milliseconds,duration:Date.now()-r};if("event"===e.type){const n=e.target??t.me??document,i=(await nl(n,e.eventName)).event;if(Object.assign(t,{it:i}),e.destructure)for(const r of e.destructure)r in i&&t.locals.set(r,i[r]);return{type:"event",result:i,duration:Date.now()-r}}const{result:n,winningCondition:i}=await this.executeRace(e.conditions,t);if(Object.assign(t,{it:n}),n instanceof Event&&"event"===i?.type&&i.destructure)for(const e of i.destructure)e in n&&t.locals.set(e,n[e]);return{type:n instanceof Event?"event":"time",result:n,duration:Date.now()-r}}async parseTimeWait(e,t,r){return{type:"time",milliseconds:oo(await t.evaluate(e,r))}}async parseEventWait(e,t,r,n){const i=await r.evaluate(e,n);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 r.evaluate(t,n);if(!e||"object"!=typeof e||!("addEventListener"in e))throw Error("wait for from: target must be an EventTarget");l=e}else l=n.me??void 0;return{type:"event",eventName:o,target:l,destructure:s}}async parseEventArrayWait(e,t,r,n){const i=[];for(const t of e){const e=t;if("objectLiteral"===e.type&&e.properties){let t="",r=[];for(const n of e.properties){const e=n.key?.name||n.key?.value;"name"===e&&n.value?t=n.value.value||"":"args"===e&&n.value?.elements&&(r=n.value.elements.map(e=>e.value||e.name||""))}t&&i.push({name:t,params:r})}}let a;if(t){const e=await r.evaluate(t,n);e&&"object"==typeof e&&"addEventListener"in e&&(a=e)}return a||(a=n.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,r){const n=[];e.modifiers.for?n.push(await this.parseEventWait(e.modifiers.for,e.modifiers.from,t,r)):e.args[0]&&n.push(await this.parseTimeWait(e.args[0],t,r));const i=await t.evaluate(e.modifiers.or,r),a=Array.isArray(i)?i:[i];for(const e of a)try{n.push({type:"time",milliseconds:oo(e)})}catch{if("string"==typeof e){const t=e.match(/^(\w+)\(([^)]+)\)$/);n.push(t?{type:"event",eventName:t[1],target:r.me??void 0,destructure:t[2].split(",").map(e=>e.trim())}:{type:"event",eventName:e,target:r.me??void 0})}}if(2>n.length)throw Error("wait: race requires at least 2 conditions");return{type:"race",conditions:n}}async executeRace(e,t){const r=new AbortController,n=r.signal,i=e.map(e=>{if("time"===e.type)return il(e.milliseconds).then(()=>({result:e.milliseconds,winningCondition:e}));return nl(e.target??t.me??document,e.eventName,0,n).then(t=>({result:t.event,winningCondition:e}))});try{return await Promise.race(i)}finally{r.abort()}}},ga(t,"WaitCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})();const sl=Ea(ol),ll=new Map;let cl=[/^4\d{2}$/,/^5\d{2}$/];let ul=(()=>{let e,t,r=[xa({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"]}),za({name:"fetch",category:"async"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args?.length)throw Error("fetch requires a URL");const n=await this.parseURL(e.args[0],t,r),i=this.parseResponseType(e.modifiers.as);return{url:n,responseType:i,options:await this.parseRequestOptions(e.modifiers.with,t,r),throwOnError:!!!e.modifiers.doNotThrow&&"response"!==i}}async execute(e,t){const r=Date.now(),{url:n,responseType:i,options:a}=e,o=new AbortController;let s;t.me&&(s=()=>o.abort(),t.me.addEventListener("fetch:abort",s,{once:!0}));const l={...a,signal:o.signal},c=ll.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(n,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 cl.some(e=>e.test(t))}(a.status)){const e=Error(`Fetch failed for ${n}: HTTP ${a.status} ${a.statusText}`.trim());throw e.response=a,e.isFetchStatusError=!0,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()-r};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 "+n);if(e instanceof Error&&!0===e.isFetchStatusError)throw e;throw Error(`Fetch failed for ${n}: ${e instanceof Error?e.message:e+""}`)}finally{u&&clearTimeout(u),t.me&&s&&t.me.removeEventListener("fetch:abort",s)}}async parseURL(e,t,r){const n=await t.evaluate(e,r);if("string"!=typeof n||!n)throw Error("fetch: URL must be a non-empty string");return n}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(ll.has(t))return t;throw Error(`fetch: invalid response type "${t}"`)}return"text"}async parseRequestOptions(e,t,r){if(!e)return{};const n=await t.evaluate(e,r);if("object"!=typeof n||null===n)throw Error('fetch: "with" options must be an object');const i={};return"method"in n&&(i.method=(n.method+"").toUpperCase()),"headers"in n&&(i.headers=this.parseHeaders(n.headers)),"body"in n&&(i.body=this.parseBody(n.body)),"credentials"in n&&(i.credentials=n.credentials),"mode"in n&&(i.mode=n.mode),"cache"in n&&(i.cache=n.cache),i}parseHeaders(e){if(e instanceof Headers)return e;const t=new Headers;if("object"==typeof e&&null!==e)for(const[r,n]of Object.entries(e))t.set(r,n+"");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,r){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 n=ll.get(t);return n?n.handler(e,r):e.text()}}}parseHTML(e){const t=(new DOMParser).parseFromString(e,"text/html"),r=document.createDocumentFragment();return Array.from(t.body.childNodes).forEach(e=>r.appendChild(e.cloneNode(!0))),1===r.childNodes.length&&Ta(r.firstChild)?r.firstChild:r}dispatchEvent(e,t,r){e.dispatchEvent(new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!0}))}},ga(t,"FetchCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})();const pl=Ea(ul);const ml=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"set",category:"data"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args?.length)throw Error("set command requires a target");const n=e.args[0],i=n?.name||n?.value,a=n?.type;if(a){const i=ue(a);if(i){return{type:"node-write",node:n,value:await this.extractValue(e,t,r),writer:i}}}const o=await this.resolveAttributeWriteTarget(n,e,t,r);if(o){const n=await this.extractValue(e,t,r);return{type:"attribute",elements:o.elements,name:o.name,value:n}}const s=await zo(n,t,r);if(s){const n=await this.extractValue(e,t,r);if(s.property.startsWith("*")){const e=s.property.substring(1);return{type:"style",element:s.element,property:e,value:n+""}}return{type:"property",element:s.element,property:s.property,value:n}}if("memberExpression"===n?.type||"propertyAccess"===n?.type){const i=await this.tryParseMemberExpression(n,e,t,r);if(i)return i}let l;if(l="identifier"!==n?.type&&"variable"!==n?.type||"string"!=typeof i?await t.evaluate(n,r):i,function(e){if("object"!=typeof e||null===e||Array.isArray(e))return!1;if(Ta(e)||e instanceof Node)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}(l)){return{type:"object-literal",properties:l,targets:await this.resolveTargets(e.modifiers.on,t,r)}}if(bo(l)){const n=wo(l,r);if(n){const i=await this.extractValue(e,t,r);return{type:"property",element:n.element,property:n.property,value:i}}return this.parseTheXofY(l,e,t,r)}if("string"==typeof l&&Ka(l)){const n=l.substring(1).trim(),i=await this.extractValue(e,t,r);return{type:"style",element:await this.resolveElement(e.modifiers.on,t,r),property:n,value:i+""}}if("string"==typeof l&&Wa(l)){const n=l.substring(1).trim(),i=await this.extractValue(e,t,r);return{type:"attribute",elements:await this.resolveTargets(e.modifiers.on,t,r),name:n,value:i}}if("string"==typeof l){const n=l.match(/^(my|me|its?|your?)\s+(.+)$/i);if(n){const i=Pa(n[1],r),a=await this.extractValue(e,t,r);return{type:"property",element:i,property:n[2],value:a}}}if(Ta(l)){return{type:"property",element:l,property:"textContent",value:await this.extractValue(e,t,r)}}if(Array.isArray(l)&&l.length>0&&Ta(l[0])){const n=await this.extractValue(e,t,r);return{type:"property",element:l[0],property:"textContent",value:n}}if("string"!=typeof l){throw Error("set command target must be a string or object literal"+("memberExpression"===n?.type||"propertyAccess"===n?.type?` (a property chain evaluated to ${null===l?"null":typeof l} — check that all intermediate objects exist)`:""))}return{type:"variable",name:l,value:await this.extractValue(e,t,r)}}async execute(e,t){switch(e.type){case"variable":return No(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":for(const t of e.elements)t.setAttribute(e.name,e.value+"");return Object.assign(t,{it:e.value}),{target:"@"+e.name,value:e.value,targetType:"attribute"};case"property":return yo(e.element,e.property,e.value),Object.assign(t,{it:e.value}),{target:e.element,value:e.value,targetType:"property"};case"style":return Ga(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[r,n]of Object.entries(e.properties))yo(t,r,n);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 resolveAttributeWriteTarget(e,t,r,n){const i=e;if("attributeAccess"===i?.type){return{elements:await this.resolveTargets(t.modifiers.on,r,n),name:i.attributeName}}if("binaryExpression"===i?.type&&"of"===i.operator&&"attributeAccess"===i.left?.type){const e=await this.evaluateToElement(i.right,r,n);if(e)return{elements:[e],name:i.left.attributeName}}if("memberExpression"===i?.type&&"attributeAccess"===i.property?.type){const e=await this.evaluateToElement(i.object,r,n);if(e)return{elements:[e],name:i.property.attributeName}}return null}async evaluateToElement(e,t,r){const n=await t.evaluate(e,r),i=Array.isArray(n)?n[0]:n;return Ta(i)?i:null}async tryParseMemberExpression(e,t,r,n){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=Pa(e,n),o=await this.extractValue(t,r,n);return{type:"property",element:i,property:a.name,value:o}}}const o=e.object,s=e.computed;if(o){const i=o;let l;if("memberExpression"===i.type&&!i.computed&&"style"===i.property?.name&&i.object){const e=await r.evaluate(i.object,n);l=(e&&"object"==typeof e&&"style"in e?e.style:void 0)??await r.evaluate(o,n)}else l=await r.evaluate(o,n);if(null!=l&&"object"==typeof l){const i=s?await r.evaluate(e.property,n)+"":a?.name||"";if(i){return{type:"member-assignment",container:l,property:i,value:await this.extractValue(t,r,n)}}}}return null}async extractValue(e,t,r){if(e.modifiers.to)return t.evaluate(e.modifiers.to,r);const n=e.args.findIndex(e=>"identifier"===e.type&&"to"===e.name);if(n>=0&&e.args.length>n+1)return t.evaluate(e.args[n+1],r);if(e.args.length>=2)return t.evaluate(e.args[1],r);throw Error('set command requires a value (use "to" keyword)')}async resolveElement(e,t,r){if(!e)return Aa(void 0,r);return Aa(await t.evaluate(e,r),r)}async resolveTargets(e,t,r){if(!e)return La(void 0,r);return La(await t.evaluate(e,r),r)}async parseTheXofY(e,t,r,n){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=Aa(o,n),l=await this.extractValue(t,r,n);return{type:"property",element:s,property:a.trim(),value:l}}validate(e){if(!e||"object"!=typeof e)return!1;const t=e;if(!t.type||"string"!=typeof t.type)return!1;if(!["variable","attribute","property","style","object-literal"].includes(t.type))return!1;switch(t.type){case"variable":return"string"==typeof t.name&&"value"in t;case"attribute":return"string"==typeof t.name&&Array.isArray(t.elements)&&t.elements.every(Ta)&&"value"in t;case"property":return"string"==typeof t.property&&Ta(t.element)&&"value"in t;case"style":return"string"==typeof t.property&&""!==t.property&&Ta(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!1}}},ga(t,"SetCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());const dl=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"get",category:"data"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args||0===e.args.length)throw Error("get command requires an expression argument");const n=e.args[0],i=await t.evaluate(n,r);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&&"value"in e}},ga(t,"GetCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());function fl(e){return e&&"object"==typeof e&&e.type||"unknown"}let hl=(()=>{let e,t,r=[xa({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"]}),za({name:"increment",category:"data"})],n=[];return t=class{async parseInput(e,t,r){const n="decrement"===e.commandName?.toLowerCase()?"decrement":"increment",i=await async function(e,t,r,n){if(!e.args||0===e.args.length)throw Error(n+" command requires a target");const i=e.args[0];let a,o,s;const l=fl(i);if("identifier"===l)a=i.name,i.scope&&(o=i.scope);else if("literal"===l)a=i.value;else{const e=ue(l);if(e){const n=await t.evaluate(i,r),o="number"==typeof n?n:null==n?0:Number(n)||0;a=o,s={node:i,writer:e,currentValue:o}}else{const e=await t.evaluate(i,r);a=Array.isArray(e)&&e.length>0?e[0]:e}}let c=1,u=o;for(let n=1;e.args.length>n;n++){const i=e.args[n];if(i&&"literal"===i.type){const e=i.value;"global"===e?u="global":"number"==typeof e&&(c=e)}else if(i&&"literal"!==i.type){const e=await t.evaluate(i,r);"number"==typeof e&&(c=e)}}const p=e.modifiers?.by;if(p){const e=p.value;if("literal"===fl(p)&&"number"==typeof e)c=e;else if("literal"!==fl(p)){const e=await t.evaluate(p,r);"number"==typeof e&&(c=e)}}return{target:a,amount:c,...u&&{scope:u},...s&&{customWrite:s}}}(e,t,r,n);return{...i,operation:n}}async execute(e,t){const{target:r,property:n,scope:i,amount:a=1,operation:o="increment",customWrite:s}=e;if(s){const e=isFinite(a)?a:1,r="increment"===o?s.currentValue+e:s.currentValue-e;return await s.writer(s.node,r,t),Object.assign(t,{it:r}),r}const l=Ro(r,n,i,t);let c;if(isNaN(l))c=NaN;else{const e=isFinite(a)?a:1;c="increment"===o?l+e:l-e}return Mo(r,n,i,c,t),Object.assign(t,{it:c}),c}},ga(t,"NumericModifyCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})();const yl=Ea(hl),vl=Ea(hl);function gl(e){const t=e.tagName;return"INPUT"===t||"TEXTAREA"===t||"SELECT"===t}const kl=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"clear",category:"data"})],n=[];return t=class{async parseInput(e,t,r){const n=e.args?.[0],i=n?.type,a=n?.name;if(n&&("variable"===i||"identifier"===i&&"string"==typeof a))try{const e=await t.evaluate(n,r);if(!Ta(e)&&!Array.isArray(e))return{type:"variable",name:a}}catch{return{type:"variable",name:a}}return{type:"form-fields",targets:await Na(e.args,t,r,"clear",{filterPrepositions:!0,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)gl(t)&&("SELECT"===t.tagName?t.selectedIndex=-1:t.value="")}validate(e){if("object"!=typeof e||null===e)return!1;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=>Ta(e))}return!1}},ga(t,"ClearCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());const bl=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"log",category:"utility"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args||0===e.args.length)return{values:[]};return{values:await Promise.all(e.args.map(e=>t.evaluate(e,r)))}}async execute(e,t){const r="undefined"!=typeof window?window.console:console;0===e.values.length?r.log():r.log(...e.values)}validate(e){if("object"!=typeof e||null===e)return!1;return Array.isArray(e.values)}},ga(t,"LogCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());let wl=(()=>{let e,t,r=[xa({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"]}),za({name:"trigger",category:"event"})],n=[];return t=class{async parseInput(e,t,r){const n="send"===e.commandName?.toLowerCase()?"send":"trigger",i=n;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,r))}else if("identifier"===a(o)||"keyword"===a(o))s=o.name;else{const e=await t.evaluate(o,r);s="string"==typeof e?e:e+""}const u=e.modifiers?.on||e.modifiers?.to;if(u)c=await this.resolveTargets([u],t,r,i);else{const n=e.args.findIndex((e,t)=>{if(0===t)return!1;const r=e.name||e.value;return"on"===r||"to"===r});if(-1!==n&&n<e.args.length-1){const a=e.args.slice(n+1),o=a.findIndex(e=>"with"===(e.name||e.value)),s=-1===o?a:a.slice(0,o);c=await this.resolveTargets(s,t,r,i)}else{if(!r.me)throw Error(i+": no target specified and context.me is null");c=[r.me]}}return{eventName:s,detail:l,targets:c,options:await this.parseEventOptions(e.args,t,r),mode:n}}async execute(e,t){const r=Ys(e.eventName,e.detail,e.options);for(const t of e.targets)t.dispatchEvent(r);t.it=r}async resolveTargets(e,t,r,n){const i=[];for(const n of e){const e=await t.evaluate(n,r);if("window"!==e&&e!==window)if("document"!==e&&e!==document)if("me"===e&&r.me)i.push(r.me);else if("you"===e&&r.you)i.push(r.you);else if("it"===e&&r.it)i.push(r.it);else if(Ta(e))i.push(e);else if(e instanceof NodeList)i.push(...Array.from(e).filter(Ta));else if(Array.isArray(e))i.push(...e.filter(Ta));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(Ta));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(n+": no valid targets");return i}async parseEventDetail(e,t,r){if(!e?.length)return;if(1===e.length){const n=e[0];if("objectLiteral"!==n?.type)return await t.evaluate(n,r)}const n={};for(const i of e){const e=await t.evaluate(i,r);if("object"!=typeof e||null===e||Array.isArray(e)){if("string"==typeof e&&e.includes(":")){const[t,r]=e.split(":",2);n[t.trim()]=Zs(r.trim())}}else Object.assign(n,e)}return Object.keys(n).length?n:void 0}async parseEventOptions(e,t,r){const n={bubbles:!0,cancelable:!0,composed:!1},i=e.findIndex(e=>"with"===(e.name||e.value));if(-1===i)return n;for(const a of e.slice(i+1)){const e=await t.evaluate(a,r);if("string"==typeof e){const t=e.toLowerCase();"bubbles"===t?n.bubbles=!0:"nobubbles"===t?n.bubbles=!1:"cancelable"===t?n.cancelable=!0:"nocancelable"===t?n.cancelable=!1:"composed"===t&&(n.composed=!0)}}return n}},ga(t,"EventDispatchCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})();const zl=Ea(wl),xl=Ea(wl);let El=(()=>{let e,t,r=[xa({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"]}),za({name:"go",category:"navigation"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args||0===e.args.length)return{args:[]};return{args:await Promise.all(e.args.map(e=>t.evaluate(e,r)))}}async execute(e,t){const{args:r}=e;if(0===r.length)throw Error("Go command requires arguments");if("string"==typeof r[0]&&"back"===r[0].toLowerCase())return await this.goBack(),{result:"back",type:"back"};if(this.isUrlNavigation(r)){return{result:await this.navigateToUrl(r,t),type:"url"}}const n=this.findBareUrl(r);if(null!==n){return{result:await this.navigateToBareUrl(n,r),type:"url"}}return{result:await this.scrollToElement(r,t),type:"scroll"}}isUrlNavigation(e){return-1!==e.findIndex(e=>"url"===e)}isBareUrl(e){return!!e.startsWith("/")||/^[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 r=e.findIndex(e=>"url"===e),n=e[r+1];if(!n)throw Error('URL is required after "url" keyword');const i="string"==typeof n?n:n+"",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),!0}catch{return!1}}async scrollToElement(e,t){const r=this.parseScrollPosition(e),n=this.parseScrollTarget(e),i=this.parseScrollOffset(e),a=!e.includes("instantly"),o=this.resolveScrollTarget(n,t);if(!o)throw Error("Target element not found: "+n);if("undefined"!=typeof window){const e=a?"smooth":"instant",t=this.mapVerticalPosition(r.vertical),n=this.mapHorizontalPosition(r.horizontal);if(0!==i){o.scrollIntoView?.({behavior:e,block:t,inline:n});const{x:a,y:s}=this.calculateScrollPosition(o,r,i);window.scrollTo?.({left:a,top:s,behavior:e})}else o.scrollIntoView?.({behavior:e,block:t,inline:n})}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"},r=["top","middle","bottom"],n=["left","center","right"];let i=!1,a=!1;for(const o of e)"string"==typeof o&&(r.includes(o)?(t.vertical=o,i=!0):n.includes(o)&&(t.horizontal=o,a=!0));return a&&!i&&(t.vertical="nearest"),t}parseScrollTarget(e){const t=e.findIndex(e=>"of"===e);if(-1!==t&&e.length>t+1){let r=e[t+1];return"the"===r&&e.length>t+2&&(r=e[t+2]),r}for(const t of e)if("object"==typeof t&&t&&t.nodeType)return t;const r=["top","middle","bottom","left","center","right","of","the","to","smoothly","instantly"];for(const t of e)if("string"==typeof t&&!r.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 r=e[t];if("string"==typeof r){const e=r.match(/^([+-]?\d+)(px)?$/);if(e)return parseInt(e[1],10)}if(("+"===r||"-"===r)&&e.length>t+1){const n=e[t+1],i="number"==typeof n?n:parseInt((n+"").replace("px",""),10);if(!isNaN(i))return"-"===r?-i:i}}return 0}resolveScrollTarget(e,t){if("object"==typeof e&&e&&e.nodeType)return e;const r="string"==typeof e?e:e+"";if("body"===r&&"undefined"!=typeof document)return document.body;if("html"===r&&"undefined"!=typeof document)return document.documentElement;if("me"===r&&Ta(t.me))return t.me;if("it"===r&&Ta(t.it))return t.it;if("you"===r&&Ta(t.you))return t.you;const n=Oo(r,t);if(Ta(n))return n;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}calculateScrollPosition(e,t,r){if("undefined"==typeof window||!e.getBoundingClientRect)return{x:0,y:0};const n=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=n.left+i;break;case"center":l=n.left+i+n.width/2-o/2;break;case"right":l=n.right+i-o}switch(t.vertical){case"top":c=n.top+a+r;break;case"middle":c=n.top+a+n.height/2-s/2+r;break;case"bottom":c=n.bottom+a-s+r}return{x:Math.max(0,l),y:Math.max(0,c)}}},ga(t,"GoCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})();const Tl=Ea(El);const Sl=["url","with","title"];async function Cl(e,t,r,n){if(!e||0===e.length)throw Error(n+" command requires a URL argument");const i=[],a=[];for(let n=0;e.length>n;n++){const o=e[n],s=o,l=s?.type||"unknown",c=s?.name;if("identifier"===l&&c&&Sl.includes(c.toLowerCase()))i.push(c.toLowerCase()),a.push(c.toLowerCase());else{const e=await t.evaluate(o,r);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(`${n} 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,r){const n=r?" Debug: "+r:"";if(null==e)throw Error(`[HyperFixi] ${t}: URL is required.${n}`);if("string"!=typeof e)throw Error(`[HyperFixi] ${t}: URL must be a string (got ${typeof e}: ${e+""}).${n}`);if(""===e.trim())throw Error(`[HyperFixi] ${t}: URL cannot be empty.${n}`);if("undefined"===e)throw Error(`[HyperFixi] ${t}: URL evaluated to string 'undefined' - check your expression.${n}`);if("null"===e)throw Error(`[HyperFixi] ${t}: URL evaluated to string 'null' - check your expression.${n}`);return e}(u,n,c);return{url:m,title:p}}let Al=(()=>{let e,t,r=[xa({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"]}),za({name:"push",category:"navigation"})],n=[];return t=class{async parseInput(e,t,r){const n=e.commandName?.toLowerCase().includes("replace")?"replace":"push";return{...await Cl(e.args,t,r,n+" url"),mode:n}}async execute(e,t){const{url:r,title:n,state:i,mode:a}=e;"push"===a?window.history.pushState(i||null,"",r):window.history.replaceState(i||null,"",r),n&&(document.title=n);return Xs(window,"push"===a?"pushurl":"replaceurl",{url:r,title:n,state:i}),{url:r,title:n,mode:a}}},ga(t,"HistoryCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})();const Ll=Ea(Al),jl=Ea(Al);const Pl=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"scroll",category:"navigation"})],n=[];return t=class{async parseInput(e,t,r){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,r)))}}async execute(e,t){const{args:r}=e,n=this.parsePosition(r),i=!r.includes("instantly"),a=this.resolveTarget(r,t);if(!a)throw Error("scroll: target element not found");return"function"==typeof a.scrollIntoView&&a.scrollIntoView({block:n,behavior:i?"smooth":"instant"}),{element:a,position:n,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 r=new Set(["to","of","the","top","bottom","middle","center","left","right","nearest","smoothly","instantly"]);for(const n of e){if("object"==typeof n&&n&&n.nodeType)return n;if("string"!=typeof n||r.has(n))continue;if("me"===n&&Ta(t.me))return t.me;if("it"===n&&Ta(t.it))return t.it;if("you"===n&&Ta(t.you))return t.you;if("body"===n&&"undefined"!=typeof document)return document.body;if("html"===n&&"undefined"!=typeof document)return document.documentElement;const e=Oo(n,t);if(Ta(e))return e;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}},ga(t,"ScrollCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());function Ol(e,t){if("boolean"==typeof e)return e;if("function"==typeof e)return!0;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 r=Oo(e,t);return void 0!==r?!!r:!!e}return!!e}const Nl=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"if",category:"control-flow"})],n=[];return t=class{async parseInput(e,t,r){const n="unless"===e.commandName?.toLowerCase()?"unless":"if";if(!e.args||0===e.args.length)throw Error(n+" command requires a condition to evaluate");let i,a;if("unless"===n){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:n,condition:await t.evaluate(e.args[0],r),thenCommands:i,elseCommands:a}}async execute(e,t){const{mode:r,condition:n,thenCommands:i,elseCommands:a}=e,o=Ol(n,t);let s,l;return("unless"===r?!o:o)?(s="then",l=await this.executeCommandsOrBlock(i,t),"unless"===r&&Object.assign(t,{it:l})):a&&"if"===r?(s="else",l=await this.executeCommandsOrBlock(a,t)):s="none",{mode:r,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 r=t.locals.get("_runtimeExecute");if(!r)throw Error("Runtime execute function not available");let n;if(e.commands?.length)for(const i of e.commands)n=await r(i,t);return n}async executeCommands(e,t){let r;for(const n of e)r=n?.execute?await n.execute(t):"function"==typeof n?await n():n;return r}},ga(t,"ConditionalCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})()),Il=Nl,Rl=Nl;let Ml=(()=>{let e,t,r=[xa({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"]}),za({name:"repeat",category:"control-flow"})],n=[];return t=class{async parseInput(e,t,r){let n;if(e.modifiers?.index){const i=await t.evaluate(e.modifiers.index,r);"string"==typeof i&&(n=i)}let i,a=e.modifiers?.block||e.modifiers?.commands;if(!a){const t=[];for(let r=e.args.length-1;r>=0;r--){const n=e.args[r];if("block"===n?.type&&n.commands&&(t.unshift(n),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,r);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],r):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:n,commands:a,elseCommands:i}}if("times"===s||e.modifiers?.times){const o=e.args[1],s=o?await t.evaluate(o,r):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:n,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:n,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=r.me;if(e.args[2]){const n=e.args[2];if("identifier"===n?.type&&"document"===n.name)l=document;else if("identifier"===n?.type&&"window"===n.name&&"undefined"!=typeof window)l=window;else{const n=await t.evaluate(e.args[2],r);n instanceof EventTarget?l=n:"document"===n?l=document:"undefined"!=typeof window&&n===window&&(l=window)}}return{type:"until-event",eventName:s,eventTarget:l,indexVariable:n,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:n,commands:a,elseCommands:i,bottomTested:l}}if("forever"===s||e.modifiers?.forever)return{type:"forever",indexVariable:n,commands:a,elseCommands:i};throw Error("repeat command requires a loop type (for/times/while/until/forever)")}async execute(e,t){const{type:r,variable:n,collection:i,condition:a,count:o,indexVariable:s,commands:l,elseCommands:c,bottomTested:u,eventName:p,eventTarget:m}=e;let d,f;switch(r){case"for":({config:d,iterCtx:f}=function(e,t,r){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:r}}}(i,n,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,r,n){return{config:{type:"while",shouldContinue:()=>t(e,r)},iterCtx:{index:0,conditionExpr:e,indexVariable:n}}}(a,Ol,t,s));break;case"until":({config:d,iterCtx:f}=function(e,t,r,n){return{config:{type:"until",shouldContinue:()=>!t(e,r)},iterCtx:{index:0,conditionExpr:e,indexVariable:n}}}(a,Ol,t,s));break;case"until-event":({config:d,iterCtx:f}=function(e,t,r){const n={index:0,eventFired:!1,indexVariable:r};return{config:{type:"until-event",shouldContinue:e=>!e.eventFired,eventSetup:{eventName:e,target:t,onEvent:()=>{n.eventFired=!0}}},iterCtx:n}}(p,m,s));break;case"forever":({config:d,iterCtx:f}=function(e,t=1e4){return{config:{type:"forever",maxIterations:t,shouldContinue:()=>!0},iterCtx:{index:0,indexVariable:e}}}(s));break;default:throw Error("Unknown repeat type: "+r)}if(u){const e=d.shouldContinue;d.shouldContinue=async t=>0===t.index||await e(t)}try{const e=await async function(e,t,r,n,i){const a=e.maxIterations??1e4;let o,s=0,l=!1;e.eventSetup&&e.eventSetup.target.addEventListener(e.eventSetup.eventName,e.eventSetup.onEvent,{once:!0});try{for(;a>s&&await e.shouldContinue(n);){e.beforeIteration&&await e.beforeIteration(n,r),n.indexVariable&&r.locals&&r.locals.set(n.indexVariable,s);try{o=await i(t,r)}catch(t){if(t instanceof Error){if(t.message.includes("BREAK")){l=!0;break}if(t.message.includes("CONTINUE")){s++,n.index=s,"until-event"===e.type&&await new Promise(e=>setTimeout(e,0));continue}}throw t}s++,n.index=s,"until-event"===e.type&&await new Promise(e=>setTimeout(e,0))}}finally{e.eventSetup&&!n.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:r,iterations:0,completed:!0,lastResult:e}}return Object.assign(t,{it:e.lastResult}),{type:r,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:r,iterations:0,completed:!0,interrupted:e.message.includes("BREAK")};throw e}}async executeCommands(e,t){if(e&&"object"==typeof e&&"block"===e.type){const r=e,n=t.locals.get("_runtimeExecute");if(!n)throw Error("Runtime execute function not available");let i;if(r.commands)for(const e of r.commands)i=await n(e,t);return i}if(Array.isArray(e)){let r;for(const n of e)r="function"==typeof n?await n(t):n&&"function"==typeof n.execute?await n.execute(t):n;return r}return"function"==typeof e?await e(t):e}},ga(t,"RepeatCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})();const Wl=Ea(Ml);class _l{async parseInput(e,t,r){return{signalType:this.signalType}}async execute(e,t){const r=Error(this.errorMessage);throw r[this.errorFlag]=!0,"exit"===this.signalType&&(r.returnValue=void 0,r.timestamp=Date.now()),r}}const ql=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"break",category:"control-flow"})],n=[],i=_l;return t=class extends i{constructor(){super(...arguments),this.signalType="break",this.errorMessage="BREAK_LOOP",this.errorFlag="isBreak"}},ga(t,"BreakCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:a},null,n),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),va(t,n)})(),t})());const $l=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"continue",category:"control-flow"})],n=[],i=_l;return t=class extends i{constructor(){super(...arguments),this.signalType="continue",this.errorMessage="CONTINUE_LOOP",this.errorFlag="isContinue"}},ga(t,"ContinueCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:a},null,n),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),va(t,n)})(),t})());const Vl=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"halt",category:"control-flow"})],n=[];return t=class{async parseInput(e,t,r){if(e.args&&e.args.length>0){const n=e.args[0];if(n&&("the"===n.name||"the"===n.value))return{target:r.event};return{target:await t.evaluate(e.args[0],r)}}return{}}async execute(e,t){let r=e.target;if(("the"===r&&t.event||"object"==typeof r&&null!==r&&"the"===r.target&&t.event)&&(r=t.event),this.isEvent(r)){const e=r;return e.preventDefault(),e.stopPropagation(),{halted:!0,timestamp:Date.now(),eventHalted:!0}}"halted"in t&&(t.halted=!0);const n=Error("HALT_EXECUTION");throw n.isHalt=!0,n}isEvent(e){return null!==e&&"object"==typeof e&&"preventDefault"in e&&"stopPropagation"in e}},ga(t,"HaltCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());const Dl=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"return",category:"control-flow"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args||0===e.args.length)return{value:void 0};return{value:await t.evaluate(e.args[0],r)}}async execute(e,t){const{value:r}=e;"returnValue"in t&&(t.returnValue=r),Object.assign(t,{it:r});const n=Error("RETURN_VALUE");throw n.isReturn=!0,n.returnValue=r,n}},ga(t,"ReturnCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());const Bl=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"exit",category:"control-flow"})],n=[],i=_l;return t=class extends i{constructor(){super(...arguments),this.signalType="exit",this.errorMessage="EXIT_COMMAND",this.errorFlag="isExit"}},ga(t,"ExitCommand"),(()=>{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:a},null,n),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),va(t,n)})(),t})());const Hl=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"call",category:"execution"})],n=[];return t=class{parseInput(e,t,r){if(!e.args?.length)throw Error("call command requires an expression");return Promise.resolve({expression:e.args[0]})}async execute(e,t){const{expression:r}=e,n=t.locals?.get("__evaluator"),i=n?await n.evaluate(r,t):await $r(r,t);let a,o,s=!1;return"function"==typeof i?(o="function",a=i(),a instanceof Promise&&(s=!0,a=await a)):i instanceof Promise?(o="promise",s=!0,a=await i):(o="value",a=i),Object.assign(t,{it:a,result:a}),{result:a,wasAsync:s,expressionType:o}}},ga(t,"CallCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());const Fl=Ea((()=>{let e,t,r=[xa({description:"Focus an element (calls HTMLElement.focus())",syntax:["focus","focus <target>","focus on <target>"],examples:["focus","focus #search","focus on <input/>"],sideEffects:["focus"]}),za({name:"focus",category:"execution"})],n=[];return t=class{async parseInput(e,t,r){return{targets:await Na(e.args,t,r,"focus",{filterPrepositions:!0,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!1;const t=e;return!!Array.isArray(t.targets)&&t.targets.every(e=>Ta(e))}},ga(t,"FocusCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());const Kl=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"blur",category:"execution"})],n=[];return t=class{async parseInput(e,t,r){return{targets:await Na(e.args,t,r,"blur",{filterPrepositions:!0,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!1;const t=e;return!!Array.isArray(t.targets)&&t.targets.every(e=>Ta(e))}},ga(t,"BlurCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());const Ul=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"append",category:"content"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args?.length)throw Error("append requires content");const n=await t.evaluate(e.args[0],r);let i;if(e.modifiers?.to){const n=e.modifiers.to,a=n.type;i="identifier"!==a&&"variable"!==a&&"symbol"!==a||"string"!=typeof n.name?await t.evaluate(e.modifiers.to,r):n.name}else e.target&&(i=e.target);return{content:n,target:i}}async execute(e,t){const{content:r,target:n}=e,i=r+"";if(!n)return Object.assign(t,void 0===t.it?{it:i}:{it:t.it+""+i}),{result:t.it,targetType:"result"};if("string"==typeof n){if(n.startsWith("#")||n.startsWith(".")||n.includes("[")){const e=this.resolveDOMElement(n);return e.innerHTML+=i,{result:e,targetType:"element",target:e}}if("me"===n||"it"===n||"you"===n){const e=this.resolveContextRef(n,t);if(Ta(e))return e.innerHTML+=i,{result:e,targetType:"element",target:e}}const e=Oo(n,t);if(void 0!==e){if(Ta(e))return e.innerHTML+=i,{result:e,targetType:"element",target:e};if(Array.isArray(e))return e.push(r),{result:e,targetType:"array",target:n};const a=(null==e?"":e+"")+i;return No(n,a,t),{result:a,targetType:"variable",target:n}}return No(n,i,t),{result:i,targetType:"variable",target:n}}if(Array.isArray(n))return n.push(r),{result:n,targetType:"array"};if(Ta(n))return n.innerHTML+=i,{result:n,targetType:"element",target:n};{const e=n+""+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)}}},ga(t,"AppendCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());const Gl=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"transition",category:"animation"})],n=[];return t=class{async parseInput(e,t,r){if(!e.args?.length)throw Error("transition requires property and value");let n,i;const a=await t.evaluate(e.args[0],r);if(Ta(a)||"string"==typeof a&&/^[#.]|^(?:me|it|you)$/.test(a)?(i=a,n=await t.evaluate(e.args[1],r)+""):n=a+"",!n)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,r);void 0===o&&"identifier"===e.modifiers.to.type&&(o=e.modifiers.to.name);const s={property:n,value:o};return void 0!==i&&(s.target=i),e.modifiers?.over&&(s.duration=await t.evaluate(e.modifiers.over,r)),e.modifiers?.with&&(s.timingFunction=await t.evaluate(e.modifiers.with,r)+""),s}async execute(e,t){let{property:r}=e;const{target:n,value:i,duration:a,timingFunction:o}=e;r.startsWith("*")&&(r=r.substring(1)),r=r.replace(/([A-Z])/g,"-$1").toLowerCase();const s=Aa(n,t,"transition"),l=ao(a,300),c=getComputedStyle(s).getPropertyValue(r),u=s.style.transition,p=`${r} ${l}ms ${o||"ease"}`;s.style.transition=u?`${u}, ${p}`:p;let m=i+"",d=!1;if("initial"===m||"inherit"===m||"unset"===m||"revert"===m){const e=s.style.getPropertyValue(r);s.style.removeProperty(r),m=getComputedStyle(s).getPropertyValue(r),e&&s.style.setProperty(r,e),d=!0}s.style.setProperty(r,m);const f=await function(e,t,r){return new Promise(n=>{const i=r=>{r.target===e&&r.propertyName===t&&o({completed:!0,cancelled:!1})},a=r=>{r.target===e&&r.propertyName===t&&o({completed:!1,cancelled:!0})},o=al(()=>{e.removeEventListener("transitionend",i),e.removeEventListener("transitioncancel",a),clearTimeout(s)},n);e.addEventListener("transitionend",i),e.addEventListener("transitioncancel",a);const s=setTimeout(()=>{o({completed:!0,cancelled:!1})},r+50)})}(s,r,l);return s.style.transition=u,d&&s.style.removeProperty(r),Object.assign(t,{it:s}),{element:s,property:r,fromValue:c,toValue:m,duration:l,completed:f.completed}}},ga(t,"TransitionCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());const Yl=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"measure",category:"animation"})],n=[];return t=class{async parseInput(e,t,r){let n,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,r);if(Ta(o)&&(n=o,e.args.length>1)){const n=e.args[1];i="identifier"===n.type?n.name:await t.evaluate(n,r)+""}}else i=a.name}else{const o=await t.evaluate(a,r);if(Ta(o)||"string"==typeof o&&/^[#.]/.test(o)){if(n=o,e.args.length>1){const n=e.args[1];i="identifier"===n.type?n.name:await t.evaluate(n,r)+""}}else"string"==typeof o&&(i=o)}}e.modifiers?.set&&(a=await t.evaluate(e.modifiers.set,r)+"");const o={};return void 0!==n&&(o.target=n),void 0!==i&&(o.property=i),void 0!==a&&(o.variable=a),o}async execute(e,t){const r=Aa(e.target,t,"measure"),n=e.property||"width",i=this.getMeasurement(r,n);return e.variable&&t.locals&&t.locals.set(e.variable,i.value),Object.assign(t,{it:i.value}),{result:i.value,wasAsync:!1,element:r,property:n,value:i.value,unit:i.unit,stored:!!e.variable}}getMeasurement(e,t){const r=getComputedStyle(e);if(t.startsWith("*")){const e=r.getPropertyValue(t.substring(1)),n=parseFloat(e);if(!isNaN(n)){const t=e.match(/([a-zA-Z%]+)$/);return{value:n,unit:t?t[1]:""}}return{value:e,unit:""}}const n=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[n])return{value:a[n](),unit:"px"};const o=r.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"}}},ga(t,"MeasureCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());const Zl=Ea((()=>{let e,t,r=[xa({description:"Wait for CSS transitions and animations to complete",syntax:"settle [<target>] [for <timeout>]",examples:["settle","settle #animated-element","settle for 3000"],sideEffects:["timing"]}),za({name:"settle",category:"animation"})],n=[];return t=class{async parseInput(e,t,r){let n,i;if(e.args&&e.args.length>0){const i=await t.evaluate(e.args[0],r);(Ta(i)||"string"==typeof i&&(i.startsWith("#")||i.startsWith(".")||"me"===i||"it"===i||"you"===i))&&(n=i)}e.modifiers?.for&&(i=await t.evaluate(e.modifiers.for,r));const a={};return void 0!==n&&(a.target=n),void 0!==i&&(a.timeout=i),a}async execute(e,t){const{target:r,timeout:n}=e,i=Aa(r,t,"settle"),a=ao(n,5e3),o=Date.now(),s=getComputedStyle(i),l=so(s.transitionDuration),c=so(s.transitionDelay),u=so(s.animationDuration),p=so(s.animationDelay),m=lo(l,c),d=lo(u,p),f=Math.max(m,d),h=await(y=i,v=f,g=a,v>0?new Promise(e=>{const t=e=>{e.target===y&&n({completed:!0,type:"transition"})},r=e=>{e.target===y&&n({completed:!0,type:"animation"})},n=al(()=>{y.removeEventListener("transitionend",t),y.removeEventListener("animationend",r),clearTimeout(i),clearTimeout(a)},e);y.addEventListener("transitionend",t),y.addEventListener("animationend",r);const i=setTimeout(()=>{n({completed:!0,type:"timeout"})},v+50),a=setTimeout(()=>{n({completed:!1,type:"timeout"})},g)}):Promise.resolve({completed:!0,type:"timeout"}));var y,v,g;const k=Date.now()-o;return Object.assign(t,{it:i}),{element:i,settled:h.completed,timeout:a,duration:k}}},ga(t,"SettleCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());const Jl=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"start",category:"animation"})],n=[];return t=class{async parseInput(e,t,r){const n=e.args??[];let i;if(e.modifiers?.transitionName){const n=await t.evaluate(e.modifiers.transitionName,r);i="string"==typeof n?n:(n??"")+""}return{transitionName:i,body:n}}async execute(e,t){const r=t.locals.get("_runtimeExecute");let n=0;const i=async()=>{for(const i of e.body)r?await r(i,t):i&&"function"==typeof i.execute?await i.execute(t):"function"==typeof i&&await i(t),n++};if(!gs())return await i(),{usedViewTransition:!1,commandsExecuted:n};const a=e.transitionName?{transitionName:e.transitionName}:void 0;return await zs(i,a),{usedViewTransition:!0,commandsExecuted:n}}},ga(t,"StartViewTransitionCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());const Xl=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"js",category:"advanced"})],n=[];return t=class{async parseInput(e,t,r){let n,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)n=a.value;else{if(!a||void 0===a.value)throw Error("js command requires JavaScript code");n=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:n};return i&&i.length>0&&(s.parameters=i),s}async execute(e,t){const{code:r,parameters:n=[]}=e;if(!r.trim())return{result:void 0,executed:!1,codeLength:r.length,parameters:n,preserveArrayResult:!0};try{const e=this.createExecutionContext(t,n),i=Function(...Object.keys(e),r),a=await i(...Object.values(e));return void 0!==a&&Object.assign(t,{it:a}),{result:a,executed:!0,codeLength:r.length,parameters:n,preserveArrayResult:!0}}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:console,document:"undefined"!=typeof document?document:void 0,window:"undefined"!=typeof window?window:void 0,...t.reduce((t,r)=>{let n=e.locals?.get(r);return void 0===n&&(n=e.variables?.get(r)),void 0===n&&(n=e[r]),t[r]=n,t},{})}}},ga(t,"JsCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());const Ql=Ea((()=>{let e,t,r=[xa({description:"Execute commands asynchronously without blocking",syntax:["async <command> [<command> ...]"],examples:["async command1 command2","async fetchData processData","async animateIn showContent"],sideEffects:["async-execution"]}),za({name:"async",category:"advanced"})],n=[];return t=class{async parseInput(e,t,r){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:r}=e,n=Date.now();try{const e=await this.executeCommandsAsync(t,r),i=Date.now()-n;return e.length>0&&Object.assign(t,{it:e[e.length-1]}),{commandCount:r.length,results:e,executed:!0,duration:i}}catch(e){throw Error("Async command execution failed: "+(e instanceof Error?e.message:"Unknown error"))}}async executeCommandsAsync(e,t){const r=[];for(let n=0;t.length>n;n++){const i=t[n];try{const t=await this.executeCommand(i,e);r.push(t),Object.assign(e,{it:t})}catch(e){const r=this.getCommandName(i);throw Error(`Command '${r}' (${n+1}/${t.length}) failed: ${e instanceof Error?e.message:"Unknown error"}`)}}return r}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"}},ga(t,"AsyncCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());const ec=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"default",category:"data"})],n=[];return t=class{async parseInput(e,t,r){if(1>e.args.length)throw Error("default command requires a target");const n=await t.evaluate(e.args[0],r);let i;if(e.modifiers?.to)i=await t.evaluate(e.modifiers.to,r);else{if(2>e.args.length)throw Error('default command requires a value (use "to <value>")');i=await t.evaluate(e.args[1],r)}return{target:n,value:i}}async execute(e,t){const{target:r,value:n}=e;if("string"==typeof r){if(r.startsWith("@"))return this.defaultAttribute(t,r.substring(1),n);const e=r.match(/^(my|its?|your?)\s+(.+)$/);if(e){const[,r,i]=e;return this.defaultElementProperty(t,r,i,n)}return this.defaultVariable(t,r,n)}if(Ta(r))return this.defaultElementValue(t,r,n);throw Error("Invalid target type: "+typeof r)}defaultVariable(e,t,r){const n=Oo(t,e);return null!=n?{target:t,value:r,wasSet:!1,existingValue:n,targetType:"variable"}:(No(t,r,e),Object.assign(e,{it:r}),{target:t,value:r,wasSet:!0,targetType:"variable"})}defaultAttribute(e,t,r){if(!e.me)throw Error("No element context available for attribute default");const n=e.me.getAttribute(t);return null!==n?{target:"@"+t,value:r,wasSet:!1,existingValue:n,targetType:"attribute"}:(e.me.setAttribute(t,r+""),Object.assign(e,{it:r}),{target:"@"+t,value:r,wasSet:!0,targetType:"attribute"})}defaultElementProperty(e,t,r,n){const i=Pa(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 r=t.split(".");let n=e;for(const e of r){if(null==n)break;n=n[e]}return n}return t.includes("-")||t in e.style?e.style.getPropertyValue(t)||e.style[t]:e[t]}(i,r),o=`${t} ${r}`;return vo(a)?(yo(i,r,n),Object.assign(e,{it:n}),{target:o,value:n,wasSet:!0,targetType:"property"}):{target:o,value:n,wasSet:!1,existingValue:a,targetType:"property"}}defaultElementValue(e,t,r){const n=function(e){return"value"in e?e.value:e.textContent}(t);return vo(n)?(function(e,t){"value"in e?e.value=t+"":e.textContent=t+""}(t,r),Object.assign(e,{it:r}),{target:"element",value:r,wasSet:!0,targetType:"element"}):{target:"element",value:r,wasSet:!1,existingValue:n,targetType:"element"}}},ga(t,"DefaultCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());class tc{constructor(){this.name="pseudo-command"}get metadata(){return tc.metadata}async parseInput(e,t,r){if(1===e.args.length&&"objectLiteral"===e.args[0].type){const n=e.args[0].properties||[];let i,a,o="",s=[];for(const e of n){const n=e.value;switch(e.key?.name||e.key?.value){case"methodName":o=n?.value||await t.evaluate(n,r)+"";break;case"methodArgs":"arrayLiteral"===n?.type&&n.elements?s=await Promise.all(n.elements.map(e=>t.evaluate(e,r))):"literal"===n?.type&&Array.isArray(n.value)&&(s=await Promise.all(n.value.map(e=>t.evaluate(e,r))));break;case"preposition":const e=n?.value;e&&"null"!==e&&(i=e);break;case"target":case"targetExpression":a=await t.evaluate(n,r)}}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 n=await t.evaluate(e.args[0],r)+"",i=Array.isArray(e.args[1])?await Promise.all(e.args[1].map(e=>t.evaluate(e,r))):[];let a,o;const s=["from","on","with","into","at","to"];for(const n of s)if(e.modifiers?.[n]){o=n,a=await t.evaluate(e.modifiers[n],r);break}if(a||3>e.args.length||(a=await t.evaluate(e.args[2],r)),!a)throw Error("pseudo-command requires a target expression");return{methodName:n,methodArgs:i,preposition:o,targetExpression:a}}async execute(e,t){const{methodName:r,methodArgs:n,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,r);if(!a)throw Error(`Method "${r}" not found on target object`);if("function"!=typeof a)throw Error(`"${r}" is not a function (it's a ${typeof a})`);const o=await this.executeMethod(a,e,n);return t.locals.set("result",o),Object.assign(t,{it:o}),{result:o,methodName:r,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 r=e.split(".");let n="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:null;t.locals.has(r[0])?(n=t.locals.get(r[0]),r.shift()):t.variables?.has(r[0])?(n=t.variables.get(r[0]),r.shift()):t.globals.has(r[0])&&(n=t.globals.get(r[0]),r.shift());for(const e of r){if(null==n)return null;n=n[e]}return n}resolveMethod(e,t){if(!e)return null;if(t in e)return e[t];const r=t.split(".");let n=e;for(let e=0;r.length>e;e++){const t=r[e];if(null==n)return null;if(!(t in n))return null;if(n=n[t],e===r.length-1&&"function"==typeof n)return n}return null}async executeMethod(e,t,r){try{const n=e.apply(t,r);return n&&"object"==typeof n&&"then"in n?await n:n}catch(e){throw Error("Method execution failed: "+(e instanceof Error?e.message:e+""))}}}tc.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 rc=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"tell",category:"utility"})],n=[];return t=class{async parseInput(e,t,r){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],r),commands:e.args.slice(1)}}async execute(e,t){const{target:r,commands:n}=e,i=La(r,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 r={...t,me:e,you:e};for(const e of n)try{const t=await this.executeCommand(e,r,a);o.push(t),Object.assign(r,{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*n.length}}async executeCommand(e,t,r){if(e&&"object"==typeof e&&"command"===e.type&&r)return await r(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")}},ga(t,"TellCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());let nc=(()=>{let e,t,r=[xa({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"]}),za({name:"copy",category:"utility"})],n=[];return t=class{async parseInput(e,t,r){if(1>e.args.length)throw Error("copy command requires a source (text or element)");const n=await t.evaluate(e.args[0],r);let i="text";if(e.modifiers?.format){const n=await t.evaluate(e.modifiers.format,r);"html"!==n&&"text"!==n||(i=n)}return{source:n,format:i}}async execute(e,t){const{source:r,format:n="text"}=e,i=this.extractText(r,n,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:!0,text:i,format:n,method:"clipboard-api"}}catch{}try{if(this.copyUsingExecCommand(i))return this.dispatchCopyEvent(t,"copy:success",{text:i,method:"execCommand"}),{success:!0,text:i,format:n,method:"execCommand"}}catch{}return this.dispatchCopyEvent(t,"copy:error",{text:i,error:"All copy methods failed"}),{success:!1,text:i,format:n,method:"fallback"}}extractText(e,t,r){if("string"==typeof e)return e;if(Ta(e))return"html"===t?e.outerHTML:e.textContent||"";if(e===r.me&&Ta(r.me)){const e=r.me;return"html"===t?e.outerHTML:e.textContent||""}return e+""}copyUsingExecCommand(e){if("undefined"==typeof document)return!1;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 r=document.execCommand("copy");return document.body.removeChild(t),r}catch{return t.parentNode?.removeChild(t),!1}}dispatchCopyEvent(e,t,r){if(Ta(e.me)){const n=new CustomEvent(t,{detail:r,bubbles:!0,cancelable:!1});e.me.dispatchEvent(n)}}},ga(t,"CopyCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})();const ic=Ea(nc);let ac=(()=>{let e,t,r=[xa({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"]}),za({name:"pick",category:"utility"})],n=[];return t=class{async parseInput(e,t,r){const n=e.modifiers?.variant,i=n?.value;if("first"===i||"last"===i){const n=await t.evaluate(e.args[0],r),a=await t.evaluate(e.modifiers.count,r);if(!Array.isArray(n))throw Error(`pick ${i}: source must be an array, got ${typeof n}`);if("number"!=typeof a||!Number.isFinite(a))throw Error(`pick ${i}: count must be a number, got ${typeof a}`);return{variant:i,array:n,count:a}}if("random"===i){const n=await t.evaluate(e.args[0],r);if(!Array.isArray(n))throw Error("pick random: source must be an array");let i;if(e.modifiers.count){const n=await t.evaluate(e.modifiers.count,r);if("number"!=typeof n||!Number.isFinite(n))throw Error("pick random: count must be a number, got "+typeof n);i=n}return{variant:"random",array:n,count:i}}if("range"===i){const n=await t.evaluate(e.args[0],r);if(!Array.isArray(n)&&"string"!=typeof n)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,r),o="start"===a?"start":Number(a);let s;if(e.modifiers.rangeEnd){if("end"===e.modifiers.rangeEnd.value)s="end";else{const n=await t.evaluate(e.modifiers.rangeEnd,r);s=Number(n)}}const l=e.modifiers.rangeMode;return{variant:"range",array:n,rangeStart:o,rangeEnd:s,rangeMode:l?.value??"default"}}if("match"===i||"matches"===i){const n=await t.evaluate(e.args[0],r);if("string"!=typeof n)throw Error(`pick ${i}: source must be a string, got ${typeof n}`);const a=await t.evaluate(e.modifiers.regex,r),o="string"==typeof a?a:a+"",s=e.modifiers.flags,l=s?.value;return{variant:i,source:n,regex:o,flags:l}}if(e.modifiers?.from){const n=await t.evaluate(e.modifiers.from,r);if(!Array.isArray(n))throw Error("pick from requires an array");if(0===n.length)throw Error("Cannot pick from empty array");return{variant:"random",array:n}}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,r)))}}async execute(e,t){const r=e.variant??"random";if("first"===r){const r=e.array??[],n=r.slice(0,e.count??0);return Object.assign(t,{it:n}),{selectedItem:n,sourceLength:r.length,sourceType:"array",variant:"first"}}if("last"===r){const r=e.array??[],n=e.count??0,i=n>0?r.slice(-n):[];return Object.assign(t,{it:i}),{selectedItem:i,sourceLength:r.length,sourceType:"array",variant:"last"}}if("range"===r){const r=e.array??[];let n="start"===e.rangeStart?0:e.rangeStart??0,i=void 0===e.rangeEnd?n+1:"end"===e.rangeEnd?r.length:e.rangeEnd;"inclusive"===e.rangeMode?i++:"exclusive"===e.rangeMode&&n++;const a=r.slice(n,i);return Object.assign(t,{it:a}),{selectedItem:a,sourceLength:r.length,sourceType:"array",variant:"range"}}if("match"===r){const r=e.source??"",n=RegExp(e.regex??"",e.flags).exec(r);return Object.assign(t,{it:n}),{selectedItem:n,sourceLength:r.length,sourceType:"string",variant:"match"}}if("matches"===r){const r=e.source??"",n=e.flags??"g",i=RegExp(e.regex??"",n.includes("g")?n:"g"+n),a=Array.from(r.matchAll(i));return Object.assign(t,{it:a}),{selectedItem:a,sourceLength:r.length,sourceType:"string",variant:"matches"}}const n=e.items??e.array??[];if(0===n.length)throw Error("Cannot pick from empty collection");if(void 0===e.count){const r=Math.floor(Math.random()*n.length),i=n[r];return Object.assign(t,{it:i}),{selectedItem:i,selectedIndex:r,sourceLength:n.length,sourceType:e.items?"items":"array",variant:"random"}}const i=n.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:n.length,sourceType:e.items?"items":"array",variant:"random"}}},ga(t,"PickCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})();const oc=Ea(ac);const sc=Ea((()=>{let e,t,r=[xa({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"]}),za({name:"throw",category:"control-flow"})],n=[];return t=class{async parseInput(e,t,r){if(1>e.args.length)throw Error("throw command requires a message or error object");return{message:await t.evaluate(e.args[0],r)}}async execute(e,t){const{message:r}=e;let n;throw n=r instanceof Error?r:Error("string"==typeof r?r:r+""),n}},ga(t,"ThrowCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());let lc=(()=>{let e,t,r=[xa({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"]}),za({name:"beep",category:"utility"})],n=[];return t=class{async parseInput(e,t,r){if(0===e.args.length)return{expressions:[]};return{expressions:await Promise.all(e.args.map(e=>t.evaluate(e,r)))}}async execute(e,t){const r=e.expressions||[];if(0===r.length)return this.debugContext(t),{expressionCount:0,debugged:!0,outputs:[]};const n=[];for(const e of r){const t=this.debugExpression(e);n.push(t)}return{expressionCount:r.length,debugged:!0,outputs:n}}debugContext(e){}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":Ta(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(Ta(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+""}},ga(t,"BeepCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})();const cc=Ea(lc);const uc=Ea((()=>{let e,t,r=[xa({description:"Drop into the debugger (emits a debugger; statement)",syntax:["breakpoint"],examples:["breakpoint","on click breakpoint"],sideEffects:["debugging"]}),za({name:"breakpoint",category:"utility"})],n=[];return t=class{async parseInput(e,t,r){return{}}async execute(e,t){}validate(e){return"object"==typeof e&&null!==e}},ga(t,"BreakpointCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})());class pc{constructor(){this.name="install"}get metadata(){return pc.metadata}async parseInput(e,t,r){if(1>e.args.length)throw Error("install command requires a behavior name");const n=e.args[0];let i,a,o;if(i="identifier"===n?.type&&"string"==typeof n.name?n.name:await t.evaluate(n,r)+"",!/^[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 n=await t.evaluate(e.args[1],r);if(n&&"object"==typeof n&&!Array.isArray(n)){a=n;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,r)),{behaviorName:i,parameters:a,target:o}}async execute(e,t){const{behaviorName:r,parameters:n={},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(r,t))throw Error(`Behavior "${r}" is not defined. Define it using the 'behavior' keyword before installing.`);const a=[];for(const i of e){const e=await this.installBehavior(r,i,n,t);a.push(e)}return{success:!0,behaviorName:r,installedCount:a.length,instances:a}}catch(e){throw Error(`Failed to install behavior "${r}": ${e instanceof Error?e.message:e+""}`)}}resolveTarget(e,t){if(null==e){const e=t.me||t.locals.get("me");if(Ta(e))return[e];throw Error('No target specified and "me" is not available in context')}if(Ta(e))return[e];if(Array.isArray(e)){const t=e.filter(e=>Ta(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(Ta(e))return[e];throw Error('"me" is not available in context')}if("undefined"!=typeof document){const t=document.querySelectorAll(e),r=Array.from(t).filter(e=>Ta(e));if(0===r.length)throw Error(`No elements found matching selector: "${e}"`);return r}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=>Ta(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(Ta(t))return[t]}throw Error("Cannot resolve target to HTMLElement(s): "+(e+""))}behaviorExists(e,t){const r=t.locals.get("_behaviors");if(r&&"object"==typeof r){const t=r;if(t.has(e))return!0;if(t.resolve&&t.resolve(e))return!0}if("undefined"!=typeof globalThis){const t=globalThis._hyperscript;if(t?.behaviors){if(t.behaviors.has(e))return!0;if(t.behaviors.resolve&&t.behaviors.resolve(e))return!0}}return!1}async installBehavior(e,t,r,n){const i=n.locals.get("_behaviors");if(i&&"object"==typeof i){const n=i;if(n.install&&"function"==typeof n.install)return await n.install(e,t,r)}if("undefined"!=typeof globalThis){const n=globalThis._hyperscript;if(n?.behaviors?.install)return await n.behaviors.install(e,t,r)}throw Error("Behavior system not available in context")}}pc.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"]};let mc=(()=>{let e,t,r=[xa({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"]}),za({name:"take",category:"animation"})],n=[];return t=class{async parseInput(e,t,r){if(3>e.args.length)throw Error('take requires property, "from", and source');const n=await t.evaluate(e.args[0],r)+"";if("from"!==await t.evaluate(e.args[1],r))throw Error("take syntax: take <property> from <source>");const i=await t.evaluate(e.args[2],r);let a;if(e.args.length<8)e.args.length>3&&(a=await t.evaluate(e.args[3],r));else{const n=await Promise.all([3,4,5,6].map(n=>t.evaluate(e.args[n],r)));"and"===n[0]&&"put"===n[1]&&"it"===n[2]&&"on"===n[3]&&e.args[7]&&(a=await t.evaluate(e.args[7],r))}return!a&&e.modifiers?.on&&(a=await t.evaluate(e.modifiers.on,r)),{property:n,source:i,target:a}}async execute(e,t){const r=Aa(e.source,t,"take"),n=Aa(e.target?e.target:void 0,t,"take"),i=this.takeProperty(r,e.property);return this.putProperty(n,e.property,i),{targetElement:n,property:e.property,value:i}}takeProperty(e,t){const r=t.trim(),n=r.toLowerCase();if("class"===n||"classes"===n){const t=Array.from(e.classList);return e.className="",t}if(r.startsWith(".")){const t=r.substring(1);return e.classList.contains(t)?(e.classList.remove(t),t):null}if(r.startsWith("@")){const t=r.substring(1),n=e.getAttribute(t);return e.removeAttribute(t),n}if(r.startsWith("data-")){const t=e.getAttribute(r);return e.removeAttribute(r),t}if("id"===n){const t=e.id;return e.id="",t}if("title"===n){const t=e.title;return e.title="",t}if("value"===n&&"value"in e){const t=e.value;return e.value="",t}const i=r.replace(/-([a-z])/g,(e,t)=>t.toUpperCase());if(r.includes("-")||i in e.style||r in e.style){let t;return i in e.style?(t=e.style[i],e.style[i]=""):r in e.style?(t=e.style[r],e.style[r]=""):(t=e.style.getPropertyValue(r),e.style.removeProperty(r)),t}const a=e.getAttribute(t);return null!==a?(e.removeAttribute(t),a):null}putProperty(e,t,r){if(null==r)return;const n=t.trim(),i=n.toLowerCase();if("class"===i||"classes"===i)return void(Array.isArray(r)?r.forEach(t=>t&&"string"==typeof t&&e.classList.add(t)):"string"==typeof r&&(e.className=r));if(n.startsWith("."))return void(r&&e.classList.add(n.substring(1)));if(n.startsWith("@"))return void e.setAttribute(n.substring(1),r+"");if(n.startsWith("data-"))return void e.setAttribute(n,r+"");if("id"===i)return void(e.id=r+"");if("title"===i)return void(e.title=r+"");if("value"===i&&"value"in e)return void(e.value=r+"");const a=n.replace(/-([a-z])/g,(e,t)=>t.toUpperCase());n.includes("-")||a in e.style||n in e.style?a in e.style?e.style[a]=r+"":n in e.style?e.style[n]=r+"":e.style.setProperty(n,r+""):e.setAttribute(t,r+"")}},ga(t,"TakeCommand"),(()=>{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;ya(null,e={value:t},r,{kind:"class",name:t.name,metadata:i},null,n),t=e.value,i&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i}),va(t,n)})(),t})();const dc=Ea(mc);class fc{constructor(){this.name="render"}get metadata(){return fc.metadata}async parseInput(e,t,r){if(1>e.args.length)throw Error("render command requires a template");const n=await t.evaluate(e.args[0],r);let i;if(e.args.length>=3){if("with"===await t.evaluate(e.args[1],r)){const n=await t.evaluate(e.args[2],r);n&&"object"==typeof n&&(i=n)}}if(!i&&e.modifiers?.with){const n=await t.evaluate(e.modifiers.with,r);n&&"object"==typeof n&&(i=n)}return{template:n,variables:i}}async execute(e,t){const{template:r,variables:n={}}=e,i=this.extractTemplateContent(r,t),a=this.createTemplateContext(t,n),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 r=e;if(!r.includes("<")&&!r.includes("$")){const e=this.resolveVariable(r,t);if(e instanceof HTMLTemplateElement)return e.innerHTML;"string"==typeof e&&(r=e)}const n=r.match(/<template[^>]*>([\s\S]*?)<\/template>/i);return n?n[1]:r}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,r){const n=e.split("\n"),i=[];let a=0;for(;n.length>a;){const e=n[a].trim();if(e.startsWith("@repeat ")){const{nextIndex:e,rendered:o}=await this.processRepeatDirective(n,a,t);i.push(o),a=e,r.push("@repeat")}else if(e.startsWith("@if ")){const{nextIndex:e,rendered:o}=await this.processIfDirective(n,a,t,r);i.push(o),a=e,r.push("@if")}else if("@else"===e||"@end"===e)a++;else{const r=this.processVariableInterpolation(e,t);i.push(r),a++}}return i.join("\n")}async processRepeatDirective(e,t,r){const n=e[t].trim(),i=n.match(/^@repeat\s+in\s+(.+)$/);if(!i)throw Error("Invalid @repeat syntax: "+n);const a=this.evaluateExpression(i[1],r),{endIndex:o,blockContent:s}=this.extractDirectiveBlock(e,t+1),l=[];if(Array.isArray(a))for(const e of a){const t={...r,locals:new Map([...r.locals.entries(),["it",e]])},n=await this.processTemplate(s.join("\n"),t,[]);l.push(n)}return{nextIndex:o+1,rendered:l.join("\n")}}async processIfDirective(e,t,r,n){const i=e[t].trim(),a=i.match(/^@if\s+(.+)$/);if(!a)throw Error("Invalid @if syntax: "+i);const o=!!this.evaluateExpression(a[1],r),{endIndex:s,blockContent:l,elseContent:c}=this.extractIfElseBlock(e,t+1);let u="";return o?u=await this.processTemplate(l.join("\n"),r,[]):c.length>0&&(u=await this.processTemplate(c.join("\n"),r,[]),n.push("@else")),{nextIndex:s+1,rendered:u}}extractDirectiveBlock(e,t){const r=[];let n=1,i=t;for(;e.length>i&&n>0;){const t=e[i].trim();t.startsWith("@repeat ")||t.startsWith("@if ")?(n++,r.push(e[i])):"@end"===t?(n--,n>0&&r.push(e[i])):r.push(e[i]),i++}return{endIndex:i-1,blockContent:r}}extractIfElseBlock(e,t){const r=[],n=[];let i=1,a=t,o=!1;for(;e.length>a&&i>0;){const t=e[a].trim();if(t.startsWith("@if "))i++;else{if("@else"===t&&1===i){o=!0,a++;continue}if("@end"===t&&(i--,0===i))break}o?n.push(e[a]):r.push(e[a]),a++}return{endIndex:a,blockContent:r,elseContent:n}}processVariableInterpolation(e,t){return e.replace(/\$\{([^}]+)\}/g,(e,r)=>{try{const e=r.trim();if(e.startsWith("unescaped ")){const r=e.substring(10).trim();return(this.evaluateExpression(r,t)||"")+""}const n=this.evaluateExpression(e,t);return this.escapeHtml((n||"")+"")}catch(t){return e}})}evaluateExpression(e,t){if("true"===e)return!0;if("false"===e)return!1;if("null"===e)return null;if("undefined"===e)return;const r=Number(e);if(!isNaN(r)&&""!==e.trim())return r;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 r=e.split(".");let n=this.resolveVariable(r[0],t);for(let e=1;r.length>e&&null!=n;e++){if("object"!=typeof n||null===n)return;n=n[r[e]]}return n}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,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}createDOMElement(e){if("undefined"==typeof document)return null;const t=document.createElement("div");return t.innerHTML=e,1===t.children.length?t.firstElementChild:t}}fc.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 hc extends Nn{constructor(e={}){const t=e.registry||new xn;e.registry||(t.register(Ra()),t.register(Ma()),t.register(to()),t.register(no()),t.register(Ao()),t.register(jo()),t.register($o()),t.register(Vo()),t.register(Ho()),t.register(Ko()),t.register(Go()),t.register(Zo()),t.register(js()),t.register(Ps()),t.register(rl()),t.register(sl()),t.register(pl()),t.register(ml()),t.register(dl()),t.register(yl()),t.register(vl()),t.register(kl()),t.register(bl()),t.register(zl()),t.register(xl()),t.register(Tl()),t.register(Ll()),t.register(jl()),t.register(Pl()),t.register(Il()),t.register(Wl()),t.register(ql()),t.register($l()),t.register(Vl()),t.register(Dl()),t.register(Bl()),t.register(Hl()),t.register(Ul()),t.register(Fl()),t.register(Kl()),t.register(Gl()),t.register(Yl()),t.register(Zl()),t.register(Jl()),t.register(Xl()),t.register(Ql()),t.register(Rl()),t.register(ec()),t.register(new tc),t.register(rc()),t.register(ic()),t.register(oc()),t.register(sc()),t.register(cc()),t.register(uc()),t.register(new pc),t.register(dc()),t.register(new fc));const r={registry:t,expressionRegistry:e.expressionRegistry??fa()};void 0!==e.enableAsyncCommands&&(r.enableAsyncCommands=e.enableAsyncCommands),void 0!==e.commandTimeout&&(r.commandTimeout=e.commandTimeout),void 0!==e.enableErrorReporting&&(r.enableErrorReporting=e.enableErrorReporting),super(r)}getRegistry(){return this.registry}}function yc(e,t){return t?{type:"literal",value:e,dataType:t}:{type:"literal",value:e}}function vc(e,t){return t?{type:"selector",value:e,selectorKind:t}:{type:"selector",value:e}}function gc(e){return{type:"reference",value:e}}function kc(e,t){return{type:"property-path",object:e,property:t}}function bc(e){return{type:"expression",raw:e}}function wc(e,t=!0){return{type:"flag",name:e,enabled:t}}function zc(e,t,r){const n={kind:"command",action:e,roles:t instanceof Map?t:new Map(Object.entries(t))};return r?{...n,metadata:r}:n}function xc(e,t,r,n,i){return{kind:"event-handler",action:e,roles:t instanceof Map?t:new Map(Object.entries(t)),body:r,...i&&{eventModifiers:i},...n&&{metadata:n}}}function Ec(e,t,r,n,i){return{kind:"conditional",action:e,roles:t instanceof Map?t:new Map(Object.entries(t)),thenBranch:r,...n&&{elseBranch:n},...i&&{metadata:i}}}function Tc(e,t="sequential",r){const n={kind:"compound",action:"compound",roles:new Map,statements:e,chainType:t};return r?{...n,metadata:r}:n}function Sc(e,t,r,n,i,a,o){return{kind:"loop",action:e,roles:t instanceof Map?t:new Map(Object.entries(t)),loopVariant:r,body:n,...i&&{loopVariable:i},...a&&{indexVariable:a},...o&&{metadata:o}}}function Cc(e,t,r,n){return{kind:"command",action:"try",roles:new Map,body:e,...t&&t.length>0?{catchBranch:t}:{},...r&&r.length>0?{finallyBranch:r}:{},...n?{metadata:n}:{}}}function Ac(e,t,r){return{kind:"command",action:e,roles:new Map,asyncVariant:e,asyncBody:t,...r?{metadata:r}:{}}}function Lc(e,t,r,n){return{kind:"command",action:"match",roles:e instanceof Map?e:new Map(Object.entries(e)),arms:t,...r&&r.length>0?{defaultArm:r}:{},...n?{metadata:n}:{}}}function jc(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?`${jc(e.object)}.${e.property}`:""}function Pc(e,t){const r=e.roles.get(t);return r?jc(r):""}var Oc=new Set(["me","you","it","result","event","target","body"]);function Nc(e,t=Oc){return t.has(e)}var Ic=new Set(["body","then","else","condition","loop-body","variable","catch","finally"]);function Rc(e){const t=e.slice(1,-1);let r=0;for(const e of t)if("["===e)r++;else if("]"===e)r--;else if(0===r&&(" "===e||":"===e))return!0;return!1}function Mc(e,t={}){const r=e.trim(),n=!0===t.collectDiagnostics,i=[];if(!r.startsWith("[")||!r.endsWith("]"))throw Error("Explicit syntax must be wrapped in brackets: [command role:value ...]");const a=r.slice(1,-1).trim();if(!a)throw Error("Empty explicit statement");const o=function(e){const t=[];let r="",n=!1,i="",a=0;for(let o=0;e.length>o;o++){const s=e[o];n?(r+=s,s===i&&"\\"!==e[o-1]&&(n=!1)):'"'!==s&&"'"!==s?"["!==s?"]"!==s?" "!==s||0!==a?r+=s:r&&(t.push(r),r=""):(a--,r+=s):(a++,r+=s):(n=!0,i=s,r+=s)}r&&t.push(r);return 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??Oc,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("+"),r=t.slice(1);if(!r){if(n){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(r)){if(n){i.push({severity:"error",code:"UNKNOWN_FLAG",message:`Unknown flag "${r}" for command "${s}"`,source:"schema",suggestions:[...p].map(e=>"+"+e)}),l.set(r,wc(r,e));continue}throw Error(`Unknown flag "${r}" for command "${s}". Valid roles: ${[...p].join(", ")}`)}l.set(r,wc(r,e));continue}const r=t.indexOf(":");if(-1===r){if(n){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,r);if(p&&!Ic.has(a)&&!p.has(a)){if(!n)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(r+1);if(Ic.has(a)&&m.startsWith("[")&&Rc(m)){const e=Hc(t,r+1),n=t.slice(r+1,e+1);l.set(u,{type:"expression",raw:n});continue}const d=Bc(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(!n)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(n)return i.push({severity:"error",code:"MISSING_EVENT_ROLE",message:"Event handler requires event role: [on event:click ...]",source:"schema"}),m(xc("on",l,[],{sourceLanguage:"explicit"}));throw Error("Event handler requires event role: [on event:click ...]")}const e=Dc(l,"body",t);return l.delete("body"),m(xc("on",l,e,{sourceLanguage:"explicit"}))}case"if":{const e=Dc(l,"then",t),r=Dc(l,"else",t);return l.delete("then"),l.delete("else"),m(Ec(s,l,e,r.length>0?r:void 0,{sourceLanguage:"explicit"}))}case"repeat":{const e=Dc(l,"loop-body",t),r=l.get("loop-variant"),n=l.get("variable"),i=l.get("index-variable");let a;l.delete("loop-body"),l.delete("loop-variant"),l.delete("variable"),l.delete("index-variable"),a=r&&"literal"===r.type&&"string"==typeof r.value?r.value:l.has("quantity")?"times":l.has("source")?"for":l.has("condition")?"while":"forever";return m(Sc(s,l,a,e,"literal"===n?.type&&"string"==typeof n.value?n.value:"expression"===n?.type?n.raw:void 0,"literal"===i?.type&&"string"==typeof i.value?i.value:void 0,{sourceLanguage:"explicit"}))}default:return m(zc(s,l,{sourceLanguage:"explicit"}))}}function Wc(e){const t=e.trim();return t.startsWith("[")&&t.endsWith("]")}var _c=new Set(["then","and","async","sequential"]);function qc(e){const t=[];let r=null,n="",i=0,a=!1,o="";for(let s=0;e.length>s;s++){const l=e[s];if(a)n+=l,l===o&&"\\"!==e[s-1]&&(a=!1);else if('"'!==l&&"'"!==l)if("["!==l){if("]"!==l)n+=l;else if(i--,n+=l,0===i){const i=e.slice(s+1),a=i.match(/^\s*\|>\s*/);if(a){t.push(n.trim()),n="",r??(r="pipe"),s+=a[0].length;continue}const o=i.match(/^\s+(then|and|async|sequential)\s+/);if(o&&_c.has(o[1])){t.push(n.trim()),n="",r??(r=o[1]),s+=o[0].length;continue}}}else i++,n+=l;else a=!0,o=l,n+=l}return n.trim()&&t.push(n.trim()),{segments:t,chainType:r}}function $c(e,t){const r=e.trim(),{annotations:n,remainder:i}=function(e){const t=[];let r=0;for(;e.length>r;){for(;e.length>r&&(" "===e[r]||"\t"===e[r]);)r++;if(r>=e.length||"@"!==e[r])break;r++;const n=r;for(;e.length>r&&/[A-Za-z0-9\-_]/.test(e[r]);)r++;const i=e.slice(n,r);if(!i)break;let a;if(e.length>r&&"("===e[r]){r++;const t=r;if(e.length<=r||'"'!==e[r]&&"'"!==e[r]){for(;e.length>r&&")"!==e[r];)r++;a=e.slice(t,r)}else{const n=e[r];for(r++;e.length>r&&e[r]!==n;)"\\"===e[r]&&r++,r++;r++,a=e.slice(t+1,r-1)}e.length>r&&")"===e[r]&&r++}t.push(void 0!==a?{name:i,value:a}:{name:i})}return{annotations:t,remainder:e.slice(r).trim()}}(r),{segments:a,chainType:o}=qc(i);let s;if(1<a.length){s=Tc(a.map(e=>Mc(e,t)),o??"sequential")}else s=Mc(a[0]||i,t);return n.length>0?{...s,annotations:n}:s}var Vc=/^#!lse\s+(\d+\.\d+(?:\.\d+)?)\s*$/;function Dc(e,t,r){const n=e.get(t);return n&&"expression"===n.type?[Mc(n.raw,r)]:[]}function Bc(e,t){if(e.startsWith("#")||e.startsWith(".")||e.startsWith("[")||e.startsWith("@")||e.startsWith("*"))return vc(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 yc(e.slice(1,-1),"string");if("true"===e)return yc(!0,"boolean");if("false"===e)return yc(!1,"boolean");const r=e.toLowerCase();if(Nc(r,t))return gc(r);const n=e.match(/^(-?\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(n){const t=parseFloat(n[1]);return n[2]?yc(e,"duration"):yc(t,"number")}return yc(e)}function Hc(e,t){let r=0;for(let n=t;e.length>n;n++)if("["===e[n])r++;else if("]"===e[n]&&(r--,0===r))return n;return e.length-1}function Fc(e){let t;if("compound"===e.kind){const r=e;t=r.statements.map(e=>Fc(e)).join(` ${r.chainType} `)}else t=function(e){const t=[e.action];for(const[r,n]of e.roles)t.push("flag"===n.type?n.enabled?"+"+n.name:"~"+n.name:`${r}:${Kc(n)}`);if("event-handler"===e.kind){e.body&&e.body.length>0&&t.push("body:"+e.body.map(e=>Fc(e)).join(" "))}if("conditional"===e.kind){const r=e;r.thenBranch&&r.thenBranch.length>0&&t.push("then:"+r.thenBranch.map(e=>Fc(e)).join(" ")),r.elseBranch&&r.elseBranch.length>0&&t.push("else:"+r.elseBranch.map(e=>Fc(e)).join(" "))}if("loop"===e.kind){const r=e;r.loopVariant&&t.push("loop-variant:"+r.loopVariant),r.loopVariable&&t.push("variable:"+r.loopVariable),r.indexVariable&&t.push("index-variable:"+r.indexVariable),r.body&&r.body.length>0&&t.push("loop-body:"+r.body.map(e=>Fc(e)).join(" "))}if("command"===e.kind){const r=e;r.body&&r.body.length>0&&t.push("body:"+r.body.map(e=>Fc(e)).join(" ")),r.catchBranch&&r.catchBranch.length>0&&t.push("catch:"+r.catchBranch.map(e=>Fc(e)).join(" ")),r.finallyBranch&&r.finallyBranch.length>0&&t.push("finally:"+r.finallyBranch.map(e=>Fc(e)).join(" ")),r.asyncVariant&&t.push("async-variant:"+r.asyncVariant),r.asyncBody&&r.asyncBody.length>0&&t.push("async-body:"+r.asyncBody.map(e=>Fc(e)).join(" "))}return`[${t.join(" ")}]`}(e);if(e.annotations&&e.annotations.length>0){return e.annotations.map(e=>void 0!==e.value?`@${e.name}(${e.value})`:"@"+e.name).join(" ")+" "+t}return t}function Kc(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`${Kc(e.object)}'s ${e.property}`;case"expression":return e.raw;case"flag":return e.name}}function Uc(e){const t=Gc(e.roles);let r;switch(e.kind){case"command":{const n=e;r={kind:"command",action:e.action,roles:t},n.body&&n.body.length>0&&(r.body=n.body.map(Uc)),n.catchBranch&&n.catchBranch.length>0&&(r.catchBranch=n.catchBranch.map(Uc)),n.finallyBranch&&n.finallyBranch.length>0&&(r.finallyBranch=n.finallyBranch.map(Uc)),n.asyncVariant&&(r.asyncVariant=n.asyncVariant),n.asyncBody&&n.asyncBody.length>0&&(r.asyncBody=n.asyncBody.map(Uc)),n.arms&&n.arms.length>0&&(r.arms=n.arms.map(e=>({pattern:Yc(e.pattern),body:e.body.map(Uc)}))),n.defaultArm&&n.defaultArm.length>0&&(r.defaultArm=n.defaultArm.map(Uc));break}case"event-handler":{const n=e;if(function(e){if(!e.body||1!==e.body.length)return!1;const t=e.body[0];if("command"!==t.kind)return!1;const r=t;if(r.body&&r.body.length>0)return!1;if(r.catchBranch&&r.catchBranch.length>0)return!1;if(r.finallyBranch&&r.finallyBranch.length>0)return!1;if(r.asyncVariant)return!1;if(r.asyncBody&&r.asyncBody.length>0)return!1;if(r.arms&&r.arms.length>0)return!1;if(r.defaultArm&&r.defaultArm.length>0)return!1;const n=e.roles.get("event");return!(!n||"literal"!==n.type)&&("string"==typeof n.value&&(!r.roles.has("event")&&((!e.additionalEvents||0>=e.additionalEvents.length)&&((!e.parameterNames||0>=e.parameterNames.length)&&((!e.annotations||0>=e.annotations.length)&&((!e.diagnostics||0>=e.diagnostics.length)&&((!r.annotations||0>=r.annotations.length)&&(!r.diagnostics||0>=r.diagnostics.length))))))))}(n)){const e=n.body[0],t={event:n.roles.get("event").value},i=function(e){if(!e)return;const t={};e.once&&(t.once=!0);"number"==typeof e.debounce&&(t.debounce=e.debounce);"number"==typeof e.throttle&&(t.throttle=e.throttle);e.queue&&(t.queue=e.queue);return Object.keys(t).length>0?t:void 0}(n.eventModifiers);i&&(t.modifiers=i),r={action:e.action,roles:Gc(e.roles),trigger:t};break}r={kind:"event-handler",action:e.action,roles:t,body:n.body.map(Uc)};break}case"compound":{const t=e;r={kind:"compound",action:"compound",statements:t.statements.map(Uc),chainType:t.chainType};break}case"conditional":{const n=e;r={kind:"command",action:e.action,roles:t},r.thenBranch=n.thenBranch.map(Uc),n.elseBranch&&n.elseBranch.length>0&&(r.elseBranch=n.elseBranch.map(Uc));break}case"loop":{const n=e;r={kind:"command",action:e.action,roles:t},r.loopVariant=n.loopVariant,r.loopBody=n.body.map(Uc),n.loopVariable&&(r.loopVariable=n.loopVariable),n.indexVariable&&(r.indexVariable=n.indexVariable);break}}return e.annotations&&e.annotations.length>0&&(r.annotations=e.annotations.map(e=>void 0!==e.value?{name:e.name,value:e.value}:{name:e.name})),e.diagnostics&&e.diagnostics.length>0&&(r.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})),r}function Gc(e){const t={};for(const[r,n]of e)t[r]=Yc(n);return t}function Yc(e){switch(e.type){case"selector":{const t="selectorKind"in e?e.selectorKind:void 0,r={type:"selector",value:e.value};return t&&new Set(["id","class","attribute","element","complex"]).has(t)&&(r.selectorKind=t),r}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:jc(e)};case"flag":return{type:"flag",name:e.name,enabled:e.enabled}}}function Zc(e){const t=new Map(Object.entries(e.roles??{}).map(([e,t])=>[e,Xc(t)])),r=e.annotations?.map(e=>void 0!==e.value?{name:e.name,value:e.value}:{name:e.name}),n=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",yc(e.trigger.event,"string"));const i=new Map(t);i.delete("event");return Jc(xc("on",t,[zc(e.action,i)],{sourceLanguage:"json"},e.trigger.modifiers??{}),r,n)}const i=e.kind??"command";if("event-handler"===i){const i=(e.body??[]).map(Zc);return Jc(xc(e.action,t,i),r,n)}if("compound"===i){return Jc(Tc((e.statements??[]).map(Zc),e.chainType??"sequential"),r,n)}if(e.thenBranch&&e.thenBranch.length>0){const i=e.thenBranch.map(Zc),a=e.elseBranch?e.elseBranch.map(Zc):void 0;return Jc(Ec(e.action,t,i,a),r,n)}if(e.loopVariant){const i=(e.loopBody??[]).map(Zc);return Jc(Sc(e.action,t,e.loopVariant,i,e.loopVariable,e.indexVariable),r,n)}if(e.catchBranch||e.finallyBranch){return Jc(Cc((e.body??[]).map(Zc),e.catchBranch?e.catchBranch.map(Zc):void 0,e.finallyBranch?e.finallyBranch.map(Zc):void 0),r,n)}if(e.asyncVariant){const t=(e.asyncBody??[]).map(Zc);return Jc(Ac(e.asyncVariant,t),r,n)}if(e.arms&&e.arms.length>0){return Jc(Lc(t,e.arms.map(e=>({pattern:Xc(e.pattern),body:e.body.map(Zc)})),e.defaultArm?e.defaultArm.map(Zc):void 0),r,n)}return Jc(e.body&&e.body.length>0&&"command"===i?Cc(e.body.map(Zc)):zc(e.action,t),r,n)}function Jc(e,t,r){return t&&0!==t.length||r&&0!==r.length?{...e,...t&&t.length>0?{annotations:t}:{},...r&&r.length>0?{diagnostics:r}:{}}:e}function Xc(e){switch(e.type){case"selector":return vc((e.value??"")+"",e.selectorKind);case"literal":return yc(void 0!==e.value?e.value:"",e.dataType);case"reference":return gc((e.value??"")+"");case"expression":return bc(e.raw??(e.value??"")+"");case"flag":return wc(e.name??(e.value??"")+"",e.enabled??("boolean"!=typeof e.value||e.value));case"property-path":return bc((e.value??e.raw??"")+"")}}var Qc=new Set(["command","event-handler","compound"]),eu=new Set(["selector","literal","reference","expression","property-path","flag"]),tu=new Set(["then","and","async","sequential","pipe"]),ru=new Set(["all","race"]),nu=new Set(["error","warning","info"]);var iu=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!1}log(e,t,...r){if(!this.enabled)return;(new Date).toISOString()}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=!0}disable(){this.enabled=!1}};function au(e,t){return!t||0===t.length||(!!t.includes(e)||(!!t.includes("expression")||"property-path"===e&&t.some(e=>["selector","reference","expression"].includes(e))))}function ou(e,t){return e?.possessive?.keywords?.[t]}var su=class e{constructor(){this.logger=new iu("pattern-matcher"),this.stemMatchCount=0,this.totalKeywordMatches=0}safeToLowerCase(e){return"string"==typeof e?e.toLowerCase():null==e?"":(e+"").toLowerCase()}matchPattern(e,t,r){const n=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 r=0;10>r;r++){const n=e.peek(r);if(!n)break;t.push({type:n.type,value:n.value,kind:n.kind})}this.logger.debug("Input tokens (first 10):",t),this.logger.debug("Profile code:",r?.code)}this.currentProfile=r,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(n),null;const o=this.calculateConfidence(t,i);return this.applyExtractionRules(t,i),{pattern:t,captured:i,consumedTokens:e.position()-n.position,confidence:o}}matchBest(e,t,r){const n=[];for(const i of t){const t=e.mark(),a=this.matchPattern(e,i,r);a&&n.push(a),e.reset(t)}if(0===n.length)return null;n.sort((e,t)=>{const r=t.pattern.priority-e.pattern.priority;if(0!==r)return r;const n=t.confidence-e.confidence;return Math.abs(n)>.001?n:t.consumedTokens-e.consumedTokens});const i=n[0];return this.matchPattern(e,i.pattern),i}matchTokenSequence(e,t,r,n){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(n)for(const e of n)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){r.set(a.role,{type:"expression",raw:c.join(" ")}),o=null,s=null;continue}if(a.optional)continue;return!1}if("group"===a.type){const l=this.collectStopMarkers(t,i+1);if(n)for(const e of n)l.add(e);if(this.matchGroupToken(e,a,r,l)){o=null,s=null;continue}if(this.isOptional(a))continue;return!1}const c="role"===a.type&&!0===a.optional,u=c?e.mark():null;if("role"===a.type&&!c){const n=t.length>i+1?t[i+1]:null;if("literal"===n?.type){const t=e.peek();if(t&&"none"!==this.getMatchType(t,n.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),r.delete(s),o=null,s=null;const t=this.matchPatternToken(e,a,r);if(this.logger.debug(" >> Backtrack retry result:",t),t)continue}return!1}}}const p=this.matchPatternToken(e,a,r);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),r.delete(s),o=null,s=null;const t=this.matchPatternToken(e,a,r);if(this.logger.debug(" >> Backtrack retry result:",t),t)continue}return!1}}return!0}matchPatternToken(e,t,r){switch(t.type){case"literal":return this.matchLiteralToken(e,t);case"role":return this.matchRoleToken(e,t,r);case"group":return this.matchGroupToken(e,t,r);default:return!1}}matchLiteralToken(e,t){const r=e.peek();if(this.logger.debug(" >>> matchLiteralToken: expecting",t.value),this.logger.debug(" >>> matchLiteralToken: got token",r?JSON.stringify({type:r.type,value:r.value,kind:r.kind}):"null"),!r)return this.logger.debug(" >>> matchLiteralToken: FAIL - no token"),!1;const n=this.getMatchType(r,t.value);if(this.logger.debug(" >>> matchType for",r.value,"vs",t.value,":",n),"none"!==n)return this.totalKeywordMatches++,"stem"===n&&this.stemMatchCount++,e.advance(),!0;if(t.alternatives)for(const n of t.alternatives){const t=this.getMatchType(r,n);if("none"!==t)return this.totalKeywordMatches++,"stem"===t&&this.stemMatchCount++,e.advance(),!0}return!1}matchRoleToken(e,t,r){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 n=e.peek();if(this.logger.debug(" >>> After skipNoiseWords, current token:",n?JSON.stringify({value:n.value,kind:n.kind}):"null"),!n)return t.optional||!1;const i=this.tryMatchPossessiveExpression(e);if(i)return t.expectedTypes&&t.expectedTypes.length>0&&!au(i.type,t.expectedTypes)?t.optional||!1:(r.set(t.role,i),!0);const a=this.tryMatchMethodCallExpression(e);if(a)return t.expectedTypes&&t.expectedTypes.length>0&&!au(a.type,t.expectedTypes)?t.optional||!1:(r.set(t.role,a),!0);const o=this.tryMatchPossessiveSelectorExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!au(o.type,t.expectedTypes)?t.optional||!1:(r.set(t.role,o),!0);const s=this.tryMatchPropertyAccessExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!au(s.type,t.expectedTypes)?t.optional||!1:(r.set(t.role,s),!0);const l=this.tryMatchSelectorPropertyExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!au(l.type,t.expectedTypes)?t.optional||!1:(r.set(t.role,l),!0);this.logger.debug(" >>> Trying tokenToSemanticValue for token:",n?JSON.stringify({value:n.value,kind:n.kind}):"null");const c=this.tokenToSemanticValue(n);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&&!au(c.type,t.expectedTypes)?(this.logger.debug(" >>> TYPE MISMATCH - returning",t.optional||!1),t.optional||!1):(this.logger.debug(" >>> Type validation PASSED"),r.set(t.role,c),e.advance(),!0)):t.optional||!1}tryMatchPossessiveExpression(e){const t=e.peek();if(!t)return null;if(!this.currentProfile)return null;const r=this.safeToLowerCase(t.normalized||t.value),n=ou(this.currentProfile,r);if(!n)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 r=t;for(;"selector"===e.peek()?.kind&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)r+=e.peek().value,e.advance();const i=e.peek();return"literal"===i?.kind&&i.value.startsWith("(")&&(r+=i.value,e.advance()),kc(gc(n),r)}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 r=t.peek();if(!r||"selector"!==r.kind)return null;const n=t.mark();t.advance();const i=t.peek();if(!i||"operator"!==i.kind||"."!==i.value)return t.reset(n),null;t.advance();const a=t.peek();if(!a||"identifier"!==a.kind)return t.reset(n),null;t.advance();const o=t.peek();if(!o||"punctuation"!==o.kind||"("!==o.value)return t.reset(n),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:`${r.value}.${a.value}(${s.join(", ")})`}}tryMatchPropertyAccessExpression(t){const r=t.peek();if(!r)return null;if("identifier"!==r.kind&&"keyword"!==r.kind)return null;const n=t.mark();t.advance();const i=t.peek();if(!i||"operator"!==i.kind||"."!==i.value)return t.reset(n),null;t.advance();const a=t.peek();if(!a||"identifier"!==a.kind)return t.reset(n),null;t.advance();let o=`${r.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 r=t.peek();if(!r||"identifier"!==r.kind)break;t.advance(),o+="."+r.value,s++}const l=t.peek();if(l&&"punctuation"===l.kind&&"("===l.value){t.advance();const r=[];let n=0;for(;!t.isAtEnd()&&e.MAX_METHOD_ARGS>r.length;){const e=t.peek();if(!e)break;if("punctuation"===e.kind&&")"===e.value){if(0===n){t.advance();break}n--}"punctuation"===e.kind&&"("===e.value&&n++,"punctuation"!==e.kind||","!==e.value?(r.push(e.value),t.advance()):t.advance()}return{type:"expression",raw:`${o}(${r.join(", ")})`}}return{type:"expression",raw:o}}tryMatchPossessiveSelectorExpression(e){const t=e.peek();if(!t||"selector"!==t.kind)return null;const r=e.mark();e.advance();const n=e.peek();if(!n||"punctuation"!==n.kind||"'s"!==n.value)return e.reset(r),null;e.advance();const i=e.peek();return i?"selector"!==i.kind&&"identifier"!==i.kind?(e.reset(r),null):(e.advance(),kc(vc(t.value),i.value)):(e.reset(r),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 r=e.mark();e.advance();const n=e.peek();if(!n||"selector"!==n.kind)return e.reset(r),null;if(!n.value.startsWith("."))return e.reset(r),null;e.peek(1);e.advance();const i=n.value.slice(1);return kc(vc(t.value),i)}matchGroupToken(t,r,n,i){const a=t.mark(),o=new Set(n.keys());if(this.matchTokenSequence(t,r.tokens,n,i))return!0;t.reset(a);for(const e of n.keys())o.has(e)||n.delete(e);if(!r.optional)return!1;const s=this.getGroupLeadingMarker(r);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,r.tokens,n,i))return!0;t.reset(a);for(const e of n.keys())o.has(e)||n.delete(e);break}}return!0}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 r=new Set;for(let n=t;e.length>n;n++){const t=e[n];if("literal"===t.type){if(r.add(t.value.toLowerCase()),t.alternatives)for(const e of t.alternatives)r.add(e.toLowerCase());break}if("group"===t.type){for(const e of t.tokens)if("literal"===e.type){if(r.add(e.value.toLowerCase()),e.alternatives)for(const t of e.alternatives)r.add(t.toLowerCase());break}if(!t.optional)break}}return r}isStopMarker(e,t){return 0!==t.size&&(!!t.has(e.value.toLowerCase())||!(!e.normalized||!t.has(e.normalized.toLowerCase())))}tokenToSemanticValue(e){switch(e.kind){case"selector":return vc(e.value);case"literal":return this.parseLiteralValue(e.value);case"keyword":return this.safeToLowerCase(e.normalized||e.value),yc(e.normalized||e.value);case"identifier":return"string"==typeof e.value&&e.value.startsWith(":")?gc(e.value):(this.safeToLowerCase(e.value),{type:"expression",raw:e.value});case"url":return yc(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("「")){return yc(e.slice(1,-1),"string")}if("true"===e)return yc(!0,"boolean");if("false"===e)return yc(!1,"boolean");const t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){const r=parseFloat(t[1]);return t[2]?yc(e,"duration"):yc(r,"number")}const r=parseFloat(e);return isNaN(r)?yc(e,"string"):yc(r,"number")}applyExtractionRules(e,t){for(const[r,n]of Object.entries(e.extraction))t.has(r)||(void 0!==n.value?t.set(r,{type:"literal",value:n.value}):n.default&&t.set(r,n.default))}isOptional(e){return"literal"!==e.type&&!0===e.optional}calculateConfidence(e,t){let r=0,n=0;const i=t=>void 0!==e.extraction?.[t]?.default;for(const a of e.template.tokens)if("role"===a.type)n+=1,t.has(a.role)&&(r+=1);else if("group"===a.type)for(const e of a.tokens)if("role"===e.type){const a=i(e.role),o=.8;n+=o,t.has(e.role)?r+=o:a&&(r+=.6*o)}let a=n>0?r/n:1;if(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 r=new Set(["بدل","غير","أضف","أزل","ضع","اجعل","عين","زد","انقص","سجل","أظهر","أخف","شغل","أرسل","ركز","شوش","توقف","انسخ","احذف","اصنع","انتظر","انتقال","أو"]);if(r.has(t.value))return.15;if(t.alternatives)for(const e of t.alternatives)if(r.has(e))return.15;return 0}arabicPrepositionDisambiguation(e,t){if("ar"!==e.language)return 0;let r=0;const n={patient:["على"],destination:["إلى","الى"],source:["من"],agent:["من"],manner:["ب"],style:["ب"],goal:["إلى","الى"],method:["ب"]};for(const[e,i]of t.entries()){const t=n[e];if(!t||0===t.length)continue;const a="metadata"in i?i.metadata:void 0;if(a&&"string"==typeof a.prepositionValue){t.includes(a.prepositionValue)?r+=.1:r-=.1}}return Math.max(-.1,Math.min(.1,r))}skipNoiseWords(t){const r=t.peek();if(!r)return;const n=this.safeToLowerCase(r.value);if(e.ENGLISH_NOISE_WORDS.has(n)){const e=t.mark();t.advance();const r=t.peek();if(r&&"selector"===r.kind)return;t.reset(e)}"class"===n&&t.advance()}extractEventModifiers(e){const t={};let r=!1;for(;!e.isAtEnd();){const n=e.peek();if(!n||"event-modifier"!==n.kind)break;const i=n.metadata;if(!i)break;switch(r=!0,i.modifierName){case"once":t.once=!0;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 r?t:void 0}};su.MAX_MARKER_SCAN=3,su.MAX_PROPERTY_DEPTH=10,su.MAX_METHOD_ARGS=20,su.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var lu=su,cu=new lu;var uu={basePriority:100,includeOptionalVariants:!0};function pu(e,t,r=uu){const n=`${e.action}-${t.code}-generated`,i=r.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,r,n){const i=[],a={type:"literal",value:r,...n?.length&&{alternatives:n}},o=function(e,t){const r=[...e];"SVO"===t?r.sort((e,t)=>(t.svoPosition??0)-(e.svoPosition??0)):"SOV"===t&&r.sort((e,t)=>(t.sovPosition??0)-(e.sovPosition??0));return r}(e.roles,t.wordOrder);if("SVO"===t.wordOrder){i.push(a);for(const e of o)mu(i,e,t)}else if("SOV"===t.wordOrder){for(const e of o)mu(i,e,t);i.push(a)}else if("VSO"===t.wordOrder){i.push(a);for(const e of o)mu(i,e,t)}else{i.push(a);for(const e of o)mu(i,e,t)}return i}(e,t,a.primary,a.alternatives),s=function(e,t){const r={};for(const n of e.roles){const e=du(n,t),i={...void 0!==n.default&&{default:n.default},...e&&{marker:e}};r[n.role]=i}return r}(e,t),l=function(e,t,r){const n=[];"SVO"!==t.wordOrder&&"VSO"!==t.wordOrder||n.push(r);for(const r of e.roles){const e=du(r,t),i=`{${r.role}}`;if(e){const a=t.roleMarkers?.[r.role];n.push("after"===a?.position?`${i} ${e}`:`${e} ${i}`)}else n.push(i)}"SOV"===t.wordOrder&&n.push(r);return n.join(" ")}(e,t,a.primary);return{id:n,language:t.code,command:e.action,priority:i,template:{format:l,tokens:o},extraction:s}}function mu(e,t,r){const n=du(t,r),i=!t.required,a={type:"role",role:t.role,optional:i,expectedTypes:t.expectedTypes,...t.greedy&&{greedy:!0}};if(n){const o=r.roleMarkers?.[t.role],s="SOV"===r.wordOrder?"after":"before",l=t.markerPosition??o?.position??s;i?e.push("before"===l?{type:"group",optional:!0,tokens:[{type:"literal",value:n},a]}:{type:"group",optional:!0,tokens:[a,{type:"literal",value:n}]}):"before"===l?(e.push({type:"literal",value:n}),e.push(a)):(e.push(a),e.push({type:"literal",value:n}))}else e.push(a)}function du(e,t){return e.markerOverride?.[t.code]?e.markerOverride[t.code]:t.roleMarkers?.[e.role]?.primary}function fu(e,t){const r=[],n=new Set;for(const i of t){const t=e.get(i);t&&(r.push(t),n.add(i))}for(const[t,i]of e)n.has(t)||r.push(i);return r}function hu(e,t,r){const n=[];for(const i of e){const e=t.find(e=>e.role===i.role);e?"preposition"===r?(e.form&&n.push(e.form),n.push(i.translated||i.value)):"postposition"===r?(n.push(i.translated||i.value),e.form&&n.push(e.form)):n.push(i.translated||i.value):n.push(i.translated||i.value)}return n}function yu(e){if(0===e.length)return"";let t="";for(let r=0;e.length>r;r++){const n=e[r],i=e[r+1],a=n.endsWith("-"),o=n.startsWith("-");let s=n;if(a&&(s=n.slice(0,-1)),o&&(s=n.substring(1)),t+=s,i){const e=i.startsWith("-");a||e||(t+=" ")}}return t}var vu=class{constructor(e){this.dictionary=e.dictionary,this.profileProvider=e.profileProvider}transform(e,t,r){const n=this.profileProvider.getProfile(t),i=this.profileProvider.getProfile(r);if(!n)throw Error("No profile found for language: "+t);if(!i)throw Error("No profile found for language: "+r);const a=this.parseStatement(e,t,n);return yu(hu(fu(this.translateRoles(a,t,r),i.canonicalOrder),i.markers,i.adpositionType))}parseStatement(e,t,r){const n=new Map,i=e.split(/\s+/);let a=0;for(;i.length>a;){const e=i[a],o=r.markers.find(t=>t.form===e);if(o)i.length>a+1?(n.set(o.role,i[a+1]),a+=2):a++;else{const r=this.dictionary.lookup(e,t);r?n.set("action",r):(e.startsWith("#")||e.startsWith("."),n.set("patient",e)),a++}}return n}translateRoles(e,t,r){const n=new Map;for(const[t,i]of e){const e=this.dictionary.translate(i,r);n.set(t,{role:t,value:i,translated:e??i})}return n}},gu=class{constructor(e){this.translations=e}lookup(e,t){const r=this.translations[t];if(!r)return;const n=e.toLowerCase();for(const[e,t]of Object.entries(r))if(t.toLowerCase()===n)return e}translate(e,t){return this.translations[t]?.[e]}getAllTranslations(e,t){const r=this.lookup(e,t);if(!r)return{};const n={};for(const[e,t]of Object.entries(this.translations)){const i=t[r];i&&(n[e]=i)}return n}},ku=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}},bu=class{constructor(){this.name="string-literal"}canExtract(e,t){const r=e[t];return'"'===r||"'"===r||"`"===r||"“"===r||"‘"===r}extract(e,t){const r=e[t];if("“"===r){let r=1;for(;e.length>t+r;){if("”"===e[t+r])return r++,{value:e.substring(t,t+r),length:r};r++}return null}if("‘"===r){let r=1;for(;e.length>t+r;){if("’"===e[t+r])return r++,{value:e.substring(t,t+r),length:r};r++}return null}let n=1,i=!1;for(;e.length>t+n;){const a=e[t+n];if(i)i=!1,n++;else if("\\"!==a){if(a===r)return n++,{value:e.substring(t,t+n),length:n};n++}else i=!0,n++}return null}},wu=class{constructor(){this.name="number"}canExtract(e,t){return/\d/.test(e[t])}extract(e,t){let r=0,n=!1;for(;e.length>t+r;){const i=e[t+r];if(/\d/.test(i))r++;else{if("."!==i||n)break;n=!0,r++}}if(0===r)return null;const i=e.substring(t,t+r),a=t+r;if(e.length>a){const t=e.slice(a),n=[{pattern:"毫秒",suffix:"ms"},{pattern:"分钟",suffix:"m"},{pattern:"小时",suffix:"h"},{pattern:"ミリ秒",suffix:"ms"},{pattern:"時間",suffix:"h"}];for(const e of n)if(t.startsWith(e.pattern))return{value:i+e.suffix,length:r+e.pattern.length,metadata:{hasTimeUnit:!0}};if(t.startsWith("ms"))return{value:i+"ms",length:r+2,metadata:{hasTimeUnit:!0}};const o=[{pattern:"秒",suffix:"s"},{pattern:"分",suffix:"m"}];for(const e of o)if(t.startsWith(e.pattern))return{value:i+e.suffix,length:r+1,metadata:{hasTimeUnit:!0}};if(/^[smh](?![a-zA-Z])/.test(t))return{value:i+t[0],length:r+1,metadata:{hasTimeUnit:!0}}}return{value:i,length:r}}},zu=class{constructor(){this.name="identifier"}canExtract(e,t){return/[a-zA-Z_]/.test(e[t])}extract(e,t){let r=0;for(;e.length>t+r;){if(!/[a-zA-Z0-9_]/.test(e[t+r]))break;r++}return r>0?{value:e.substring(t,t+r),length:r}:null}},xu=class{constructor(){this.name="unicode-identifier"}canExtract(e,t){return e.charCodeAt(t)>=128&&/\p{L}/u.test(e[t])}extract(e,t){let r=0;for(;e.length>t+r;){if(!/[\p{L}\p{N}\p{M}]/u.test(e[t+r]))break;r++}return r>0?{value:e.substring(t,t+r),length:r}:null}};function Eu(e){return"setContext"in e&&"function"==typeof e.setContext}function Tu(e){const t={language:e.language,direction:e.direction,lookupKeyword:e.lookupKeyword.bind(e),isKeyword:e.isKeyword.bind(e),isKeywordStart:e.isKeywordStart.bind(e),...e.isKeywordStartAtBoundary?{isKeywordStartAtBoundary:e.isKeywordStartAtBoundary.bind(e)}:{}};return e.normalizer?{...t,normalizer:e.normalizer}:t}var Su=new Set(["selector","literal","reference","expression","property-path","flag"]);function Cu(e){switch(e.type){case"selector":return vc(e.value+"",(t=e.value+"").startsWith("#")?"id":t.startsWith(".")?"class":t.startsWith("[")?"attribute":"complex");case"literal":return yc(e.value,"number"==typeof e.value?"number":"boolean"==typeof e.value?"boolean":"string");case"reference":return gc(e.value+"");case"expression":case"property-path":return bc(e.value+"");case"flag":return wc(e.value+"",!0);default:return yc(e.value+"","string")}var t}function Au(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:`${Au(e.object).value}.${e.property}`};case"flag":return{type:"flag",value:e.enabled}}}function Lu(e){if(!e||"object"!=typeof e)return zc("unknown",{});switch(e.type){case"event":return function(e){const t=(e.event??"click")+"",r=Array.isArray(e.body)?e.body:[],n=r.map(Lu),i={event:yc(t)};e.target&&"object"==typeof e.target&&(i.source=Pu(e.target));const a=e.modifiers;let o;a&&(o=function(e){const t=!0===e.once||void 0,r="number"==typeof e.debounce?e.debounce:void 0,n="number"==typeof e.throttle?e.throttle:void 0,i="string"==typeof e.from?function(e){if(Oc.has(e))return gc(e);const t=Wu(e);return t?vc(e,t):yc(e)}(e.from):void 0;if(void 0===t&&void 0===r&&void 0===n&&void 0===i)return;return{...void 0!==t?{once:t}:{},...void 0!==r?{debounce:r}:{},...void 0!==n?{throttle:n}:{},...void 0!==i?{from:i}:{}}}(a),a.prevent&&(i.prevent=yc(!0)),a.stop&&(i.stop=yc(!0)),a.passive&&(i.passive=yc(!0)),a.capture&&(i.capture=yc(!0)));return xc("on",i,n,void 0,o)}(e);case"command":return function(e){const t=(e.name??"unknown")+"",r=Array.isArray(e.args)?e.args:[],n=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]=Pu(t))}else o=function(e,t,r,n){const i={};switch(e){case"set":{t[0]&&(i.destination=Pu(t[0]));const e=r?.to;e&&"object"==typeof e&&"type"in e?i.patient=Pu(e):t[1]&&(i.patient=Pu(t[1]));break}case"put":if(t[0]&&(i.patient=Pu(t[0])),r)for(const e of["into","before","after"]){const t=r[e];if(t&&"object"==typeof t&&"type"in t){i.destination=Pu(t),i.method=yc(e);break}}!i.destination&&n&&(i.destination=Pu(n));break;case"increment":case"decrement":{t[0]&&(i.destination=Pu(t[0]));const e=r?.by;e&&"object"==typeof e&&"type"in e?i.quantity=Pu(e):t[1]&&(i.quantity=Pu(t[1]));break}case"fetch":{t[0]&&(i.source=Pu(t[0]));const e=r?.as;e&&"object"==typeof e&&"type"in e?i.responseType=Pu(e):"string"==typeof e&&(i.responseType=yc(e));break}case"wait":case"settle":t[0]&&(i.duration=Pu(t[0]));break;case"toggle":case"add":case"show":case"hide":case"send":case"trigger":default:t[0]&&(i.patient=Pu(t[0])),n&&(i.destination=Pu(n));break;case"remove":t[0]&&(i.patient=Pu(t[0])),n&&(i.source=Pu(n));break;case"log":t[0]&&(i.patient=Pu(t[0]));break;case"scroll":{const e=Mu(t,Nu);e&&(i.destination=Pu(e));break}case"push":case"replace":{const e=Mu(t,Iu);e&&(i.patient=Pu(e));break}case"process":{const e=Mu(t,Ru);e&&(i.patient=Pu(e));break}}return i}(t,r,a,n);return zc(t,o)}(e);case"if":return function(e){const t=e.condition&&"object"==typeof e.condition?Pu(e.condition):bc("true"),r=Array.isArray(e.thenBranch)?e.thenBranch:[],n=r.map(Lu);let i;const a=e.elseIfBranches;a&&a.length>0?i=[ju(a,e.elseBranch)]:Array.isArray(e.elseBranch)&&e.elseBranch.length>0&&(i=e.elseBranch.map(Lu));return Ec("if",{condition:t},n,i)}(e);case"repeat":return function(e){const t=Array.isArray(e.body)?e.body:[],r=t.map(Lu),n={};let i;null!=e.count?(i="times","number"==typeof e.count?n.quantity=yc(e.count,"number"):"object"==typeof e.count&&(n.quantity=Pu(e.count))):e.whileCondition&&"object"==typeof e.whileCondition?(i="while",n.condition=Pu(e.whileCondition)):"string"==typeof e.untilEvent?(i="until",n.condition=yc(e.untilEvent)):i="forever";return Sc("repeat",n,i,r)}(e);case"foreach":return function(e){const t=Array.isArray(e.body)?e.body:[],r=t.map(Lu),n={};e.collection&&"object"==typeof e.collection&&(n.source=Pu(e.collection));const i="string"==typeof e.itemName?e.itemName:void 0,a="string"==typeof e.indexName?e.indexName:void 0;return Sc("repeat",n,"for",r,i,a)}(e);case"while":return function(e){const t=Array.isArray(e.body)?e.body:[],r=t.map(Lu),n={};e.condition&&"object"==typeof e.condition&&(n.condition=Pu(e.condition));return Sc("repeat",n,"while",r)}(e);default:return zc("get",{patient:Pu(e)})}}function ju(e,t){const[r,...n]=e,i=Pu(r.condition),a=r.body.map(Lu);let o;return n.length>0?o=[ju(n,t)]:t&&t.length>0&&(o=t.map(Lu)),Ec("if",{condition:i},a,o)}function Pu(e){switch(e.type){case"literal":return function(e){const t=e.value;if(null==t)return yc("null");return yc(t,"number"==typeof t?"number":"boolean"==typeof t?"boolean":void 0)}(e);case"selector":return vc((e.value??"")+"",Wu((e.value??"")+""));case"identifier":return function(e){const t=(e.value??"")+"";if(Oc.has(t))return gc(t);return yc(t)}(e);case"variable":return function(e){const t=(e.name??"")+"";switch((e.scope??"local")+""){case"element":return bc(":"+t);case"global":return bc("$"+t);default:return bc(t)}}(e);case"possessive":return kc(e.object&&"object"==typeof e.object?Pu(e.object):gc("me"),(e.property??"")+"");case"binary":case"unary":case"member":case"call":case"positional":return bc(Ou(e));default:return"value"in e?yc((e.value??"")+""):bc(Ou(e))}}function Ou(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??"")+"",r=(e.scope??"local")+"";return"element"===r?":"+t:"global"===r?"$"+t:t}case"binary":{const t=e.left&&"object"==typeof e.left?Ou(e.left):"",r=e.right&&"object"==typeof e.right?Ou(e.right):"";return`${t} ${e.operator??""} ${r}`}case"unary":{const t=e.operand&&"object"==typeof e.operand?Ou(e.operand):"";return`${e.operator??""} ${t}`}case"member":{const t=e.object&&"object"==typeof e.object?Ou(e.object):"";if(e.computed&&e.property&&"object"==typeof e.property)return`${t}[${Ou(e.property)}]`;return`${t}.${"string"==typeof e.property?e.property:e.property&&"object"==typeof e.property?Ou(e.property):""}`}case"possessive":return`${e.object&&"object"==typeof e.object?Ou(e.object):""}'s ${e.property??""}`;case"call":return`${e.callee&&"object"==typeof e.callee?Ou(e.callee):""}(${Array.isArray(e.args)?e.args.map(e=>Ou(e)).join(", "):""})`;case"positional":{const t=e.target&&"object"==typeof e.target?Ou(e.target):"";return t?`${e.position??""} ${t}`:(e.position??"")+""}default:return"value"in e?(e.value??"")+"":""}}var Nu=new Set(["to","of","the","top","bottom","middle","center","nearest","left","right","smoothly","instantly"]),Iu=new Set(["url"]),Ru=new Set(["partials","in"]);function Mu(e,t){for(const r of e){if("identifier"===r.type){const e="string"==typeof r.name?r.name:r.value;if("string"==typeof e&&t.has(e))continue}return r}}function Wu(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 _u(e){switch(e.kind){case"event-handler":return function(e){const t=e.roles.get("event"),r=t&&"value"in t?t.value+"":"click",n={};e.eventModifiers&&(e.eventModifiers.once&&(n.once=!0),e.eventModifiers.debounce&&(n.debounce=e.eventModifiers.debounce),e.eventModifiers.throttle&&(n.throttle=e.eventModifiers.throttle),e.eventModifiers.queue&&(n.queue=e.eventModifiers.queue));return{type:"event",event:r,modifiers:n,body:(e.body??[]).map(_u)}}(e);case"conditional":return function(e){const t=e.roles.get("condition");return{type:"command",name:"if",args:t?[qu(t)]:[],condition:t?qu(t):void 0,thenBranch:(e.thenBranch??[]).map(_u),elseBranch:(e.elseBranch??[]).map(_u)}}(e);case"loop":return function(e){const t=e.roles.get("patient")||e.roles.get("count");return{type:"command",name:"repeat",args:t?[qu(t)]:[],loopVariant:e.loopVariant??"forever",body:(e.body??[]).map(_u),loopVariable:e.loopVariable,indexVariable:e.indexVariable}}(e);case"compound":return{type:"CommandSequence",commands:(e.statements??[]).map(_u)};default:return function(e){const t={},r=[];for(const[n,i]of e.roles){const e=qu(i);t[n]=e,r.push(e)}return{type:"command",name:e.action,args:r,roles:t}}(e)}}function qu(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:qu(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 $u=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 r of this.schemas){const n=pu(r,e.patternProfile);t.push(n)}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())}},Vu=class{constructor(e,t,r){this.registry=t,this.matcher=new lu,this.transformer=r,e.codeGenerator&&(this.codeGenerator=e.codeGenerator);const n=new Map(e.schemas.map(e=>[e.action,e]));this.schemaLookup={getSchema:e=>n.get(e)}}parse(e,t){return this.parseWithConfidence(e,t).node}parseWithConfidence(e,t){if(Wc(e)){const t=Mc(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 r=this.registry.getTokenizer(t);if(!r)throw Error("No tokenizer registered for language: "+t);const n=r.tokenize(e),i=this.registry.getPatterns(t),a={code:t};for(const r of i){const i=this.matcher.matchPattern(n,r,a);if(i){return{node:{kind:"command",action:r.command,roles:i.captured,metadata:{sourceLanguage:t,sourceText:e,patternId:r.id,confidence:i.confidence}},confidence:i.confidence}}}throw Error("No pattern matched for input: "+e)}validate(e,t){try{return{valid:!0,node:this.parseWithConfidence(e,t).node}}catch(e){return{valid:!1,errors:[e instanceof Error?e.message:e+""]}}}translate(e,t,r){return Wc(e)?e:this.transformer.transform(e,t,r)}compile(e,t){if(!this.codeGenerator)return{ok:!1,errors:["No code generator configured for this DSL"]};try{const r=this.parseWithConfidence(e,t);return{ok:!0,code:this.codeGenerator.generate(r.node),node:r.node,metadata:{parser:"semantic",confidence:r.confidence}}}catch(e){return{ok:!1,errors:[e instanceof Error?e.message:e+""]}}}getSupportedLanguages(){return this.registry.getSupportedLanguages()}};function Du(e){const t=e.outputFormat??"both",r=e.examplesPerCommand??2,n=[Hu(),Fu(),Ku(e.schemas,t,r),Uu(t),Gu()];let i=n;e.maxTokens&&e.maxTokens>0&&(i=function(e,t){const r=[];let n=t;for(const t of e){if(t.approximateTokens>n){const e=t.content.slice(0,Math.max(4*n,40))+"\n\n*(truncated)*";r.push({...t,content:e,approximateTokens:ep(e)});break}r.push(t),n-=t.approximateTokens}return r}(n,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=ep(a);return{text:a,sections:i,metadata:{domain:e.domain,commandCount:e.schemas.length,roleCount:o,approximateTokens:s}}}function Bu(e,t=2){const r=function(e){const t=e.roles.filter(e=>e.required),r=e.roles.filter(e=>!e.required),n=[];t.length>0&&n.push(t);for(const e of r)n.push([...t,e]);2>r.length||n.push([...t,...r]);0===n.length&&n.push(e.roles.slice());return n}(e),n=[];for(let i=0;Math.min(t,r.length)>i;i++){const t=r[i],a=new Map;for(const e of t){const t=Ju(e);a.set(e.role,t)}const o=new Map;for(const[e,t]of a)o.set(e,Xu(t));const s=Fc(zc(e.action,o)),l={};for(const[e,t]of a)l[e]=t;n.push({explicit:s,json:{action:e.action,roles:l}})}return n}function Hu(){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:ep(e)}}function Fu(){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:ep(e)}}function Ku(e,t,r){const n=[];for(const i of e)n.push(Yu(i,t,r));const i=n.join("\n\n");return{id:"commands",title:"Available Commands",content:i,approximateTokens:ep(i)}}function Uu(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:ep(t)}}function Gu(){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:ep(e)}}function Yu(e,t,r){const n=[];n.push(`### \`${e.action}\` — ${e.description}`),n.push("");const i=e.roles.filter(e=>e.required),a=e.roles.filter(e=>!e.required);if(i.length>0){n.push("**Required roles:**");for(const e of i)n.push(`- \`${e.role}\`: ${e.description} (type: ${Zu(e)})`)}if(a.length>0){n.push("**Optional roles:**");for(const e of a)n.push(`- \`${e.role}\`: ${e.description} (type: ${Zu(e)})`)}const o=Bu(e,r);if(o.length>0){if(n.push(""),"explicit"===t||"both"===t){n.push("**Bracket syntax:**");for(const e of o)n.push(`\`\`\`\n${e.explicit}\n\`\`\``)}if("json"===t||"both"===t){n.push("**JSON format:**");for(const e of o)n.push(`\`\`\`json\n${JSON.stringify(e.json,null,2)}\n\`\`\``)}}return n.join("\n")}function Zu(e){return e.expectedTypes.join(" | ")}function Ju(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:!0};default:return{type:"literal",value:"example"}}var t}function Xu(e){switch(e.type){case"selector":return{type:"selector",value:e.value+"",selectorKind:Qu(e.value+"")};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"}}}function Qu(e){return e.startsWith("#")?"id":e.startsWith(".")?"class":e.startsWith("[")?"attribute":"complex"}function ep(e){return Math.ceil(e.length/4)}function tp(e,t){const r=t.maxPairsPerCommand??5,n=t.minQuality??.5,i=t.shuffleRoles??!0,a=t.languages??["en"],o=[];let s=0;for(const l of e){const e=rp(l);for(const c of a){let a=0;for(const u of e){if(a>=r)break;const e=np(l,u,c,t.domain,`${t.domain}-synth-${s++}`);if(n>e.quality||(o.push(e),a++),i&&u.length>=2&&r>a){const e=np(l,[...u].reverse(),c,t.domain,`${t.domain}-synth-${s++}`);n>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 rp(e){const t=e.roles.filter(e=>e.required),r=e.roles.filter(e=>!e.required),n=[];t.length>0&&n.push(t);for(const e of r)n.push([...t,e]);return 2>r.length||n.push([...t,...r]),0===n.length&&n.push(e.roles.slice()),n}function np(e,t,r,n,i){const a=new Map;for(const e of t)a.set(e.role,ip(e));const o=new Map;for(const[e,t]of a)o.set(e,ap(t));const s=Fc(zc(e.action,o)),l={};for(const[e,t]of a)l[e]=t;const c={action:e.action,roles:l},u=function(e,t,r){const n=[e.action];for(const i of e.roles){const e=t.get(i.role);if(!e)continue;const a=i.markerOverride?.[r];a&&n.push(a),n.push(e.value+"")}return n.join(" ")}(e,a,r),p=e.roles.filter(e=>e.required).length,m=t.filter(e=>e.required).length;return{id:i,natural:u,language:r,explicit:s,json:c,domain:n,action:e.action,source:"synthetic",quality:p>0?m/p:.8}}function ip(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:!0};default:return{type:"literal",value:"example"}}var t}function ap(e){switch(e.type){case"selector":return{type:"selector",value:e.value+"",selectorKind:op(e.value+"")};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"}}}function op(e){return e.startsWith("#")?"id":e.startsWith(".")?"class":e.startsWith("[")?"attribute":"complex"}function sp(e,t,r,n,i){const a=r.some(e=>"error"===e.severity),o=r.map(e=>function(e){const t=function(e){const t=(e.code||"").toLowerCase(),r=e.message.toLowerCase();if(t.includes("missing-role")||t.includes("missing_role")||r.includes("required role")||r.includes("missing role"))return"missing_role";if(t.includes("invalid-type")||t.includes("invalid_type")||t.includes("type-mismatch")||r.includes("invalid type")||r.includes("expected type"))return"invalid_type";if(t.includes("unknown-command")||t.includes("unknown_command")||r.includes("unknown command")||r.includes("not recognized")&&r.includes("command"))return"unknown_command";if(t.includes("unknown-role")||t.includes("unknown_role")||r.includes("unknown role")||r.includes("not recognized")&&r.includes("role"))return"unknown_role";if(t.includes("parse")||t.includes("syntax")||r.includes("syntax error")||r.includes("parse error")||r.includes("unexpected"))return"syntax_error";return}(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,r){const n=[],i=r&&t?t.getSchema(r):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(", ");n.push(`Required roles for '${r}': ${e}`)}else n.push("Check that all required roles are present.");break;case"unknown_command":n.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(", ");n.push(`Valid roles for '${r}': ${e}`)}else n.push("Use only roles defined in the command schema.");break;case"invalid_type":n.push("Check value types: selectors start with #.[@*, strings use quotes, numbers are plain digits.");break;case"syntax_error":n.push("Ensure bracket syntax: [command role:value ...]. No spaces around the colon.");break;default:t.suggestion&&n.push(t.suggestion)}return[...new Set(n)]}(o,n,i);let l,c;if(i&&n){const e=n.getSchema(i);e&&(l=function(e){const t=[],r=[],n={};for(const i of e.roles)i.required?t.push(i.role):r.push(i.role),n[i.role]=i.description;return{action:e.action,requiredRoles:t,optionalRoles:r,roleDescriptions:n}}(e),a&&(c=function(e){const t=new Map,r={};for(const n of e.roles){if(!n.required)continue;const e=lp(n.role,n.expectedTypes[0]||"expression");t.set(n.role,cp(e)),r[n.role]=e}const n=zc(e.action,t),i=Fc(n),a={action:e.action,roles:r};return{explicit:i,json:a}}(e)))}return{accepted:!a,input:{format:t,text:e},diagnostics:o,hints:s,...l&&{schema:l},...c&&{correctedExample:c}}}function lp(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 cp(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 up(e){const t=[],r=e.tools??["parse","compile","validate","translate"],n=e.languages.join(", ");for(const i of r)switch(i){case"parse":t.push({name:"parse_"+e.name,description:`Parse a ${e.description} input into a semantic representation (action, roles, confidence). Supports: ${n}.`,inputSchema:{type:"object",properties:{[e.inputLabel]:{type:"string",description:e.inputDescription},language:{type:"string",description:"Language code: "+n,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: ${n}.`,inputSchema:{type:"object",properties:{[e.inputLabel]:{type:"string",description:e.inputDescription},language:{type:"string",description:"Language code: "+n,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: ${n}.`,inputSchema:{type:"object",properties:{[e.inputLabel]:{type:"string",description:e.inputDescription+" to validate"},language:{type:"string",description:"Language code: "+n,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: ${n}.`,inputSchema:{type:"object",properties:{[e.inputLabel]:{type:"string",description:e.inputDescription+" to translate"},from:{type:"string",description:"Source language code: "+n},to:{type:"string",description:"Target language code: "+n}},required:[e.inputLabel,"from","to"]}})}return t}function pp(e){const t=e.match(/^(parse|compile|validate|translate)_(.+)$/);return t?{operation:t[1],domain:t[2]}:null}function mp(e,t,r=""){const n=e[t];return"string"==typeof n?n:r}function dp(e,t){return{content:[{type:"text",text:JSON.stringify(e,null,2)}],...t&&{isError:!0}}}function fp(e){return dp({error:"Missing required parameter: "+e},!0)}var hp=/^\s*(\/\/|--|#)/;function yp(e){const t=e.trim();return""===t||hp.test(t)}function vp(e){const t=[];for(const r of e){const e=r.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 gp(e){return e.map(e=>{const t=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return RegExp(`<script[^>]*type=["']?${t}["']?[^>]*>([\\s\\S]*?)<\\/script>`,"gi")})}function kp(e,t){let r=1;for(let n=0;t>n&&e.length>n;n++)"\n"===e[n]&&r++;return r}function bp(e,t){const r=e.lastIndexOf("<",t);if(-1===r)return;const n=e.slice(r,t+200).match(/\bid=["']([^"']+)["']/);return n?.[1]}function wp(e,t){const r=e.lastIndexOf("<",t);if(-1===r)return;const n=e.slice(r,t+200).match(/\blang=["']([^"']+)["']/);return n?.[1]}var zp=class{constructor(e){this.configs=e}extract(e,t){const r=[];for(const n of this.configs){const i=n.defaultLanguage??"en",a=vp(n.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=kp(e,a.index),l=bp(e,a.index),c=wp(e,a.index);r.push({domain:n.domain,code:o,language:c??i,file:t,line:s,column:1,...null!=l&&{elementId:l}})}}if(n.scriptTypes){const a=gp(n.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=kp(e,a.index);r.push({domain:n.domain,code:o,language:i,file:t,line:s,column:1})}}}}return r}async extractFromFiles(e,t){const r=[];for(const n of e)try{const e=await t(n),i=this.extract(e,n);r.push(...i)}catch{}return r}};function xp(e,t,r){return e[t]?.[r]??t}function Ep(...e){return e.filter(Boolean).join(" ")}function Tp(e,t){const r={},n={};for(const e of t)for(const[t,n]of Object.entries(e.keywords))r[t]||(r[t]={}),r[t][e.code]=n.primary;for(const t of e)for(const e of t.roles)if(e.markerOverride){const t=e.role;n[t]||(n[t]={});for(const[r,i]of Object.entries(e.markerOverride))n[t][r]=i}for(const e of t)if(e.roleMarkers)for(const[t,r]of Object.entries(e.roleMarkers))n[t]||(n[t]={}),n[t][e.code]=r.primary;return{keywords:r,markers:n}}function Sp(e){const t=new Set,r=new Set;for(const n of e)"SOV"===n.wordOrder&&t.add(n.code),"VSO"===n.wordOrder&&r.add(n.code);return{sovLanguages:t,vsoLanguages:r}}var Cp=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 Ap(e,t){return{start:e,end:t}}function Lp(e,t,r,n){if("object"==typeof e){const{value:t,kind:r,position:n,normalized:i,stem:a,stemConfidence:o,metadata:s}=e;return{value:t,kind:r,position:n,...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||!r)throw Error("createToken requires kind and position parameters");if("string"==typeof n)return{value:i,kind:t,position:r,normalized:n};if(n){const{normalized:e,stem:a,stemConfidence:o,metadata:s}=n;return{value:i,kind:t,position:r,...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:r}}function jp(e){return/\s/.test(e)}function Pp(e){return"#"===e||"."===e||"["===e||"@"===e||"*"===e||"<"===e}function Op(e){return'"'===e||"'"===e||"`"===e||"「"===e||"」"===e}function Np(e){return/\d/.test(e)}function Ip(e){return/[a-zA-Z]/.test(e)}function Rp(e){return/[a-zA-Z0-9_-]/.test(e)}function Mp(e,t){if(t>=e.length)return null;const r=e[t];if(!Pp(r))return null;let n=t,i="";if("#"===r||"."===r){for(i+=e[n++];e.length>n&&Rp(e[n]);)i+=e[n++];if(1>=i.length)return null;if(e.length>n&&"."===e[n]&&"#"===r){let t=n+1;for(;e.length>t&&Rp(e[t]);)t++;if(e.length>t&&"("===e[t])return i}}else if("["===r){let t=1,r=!1,a=null,o=!1;for(i+=e[n++];e.length>n&&t>0;){const s=e[n];i+=s,o?o=!1:"\\"===s?o=!0:r?s===a&&(r=!1,a=null):'"'===s||"'"===s||"`"===s?(r=!0,a=s):"["===s?t++:"]"===s&&t--,n++}if(0!==t)return null}else if("@"===r){for(i+=e[n++];e.length>n&&Rp(e[n]);)i+=e[n++];if(1>=i.length)return null}else if("*"===r){for(i+=e[n++];e.length>n&&Rp(e[n]);)i+=e[n++];if(1>=i.length)return null}else if("<"===r){if(i+=e[n++],n>=e.length||!Ip(e[n]))return null;for(;e.length>n&&Rp(e[n]);)i+=e[n++];for(;e.length>n;){const t=e[n];if("."===t){if(i+=e[n++],n>=e.length||!Rp(e[n]))return null;for(;e.length>n&&Rp(e[n]);)i+=e[n++]}else if("#"===t){if(i+=e[n++],n>=e.length||!Rp(e[n]))return null;for(;e.length>n&&Rp(e[n]);)i+=e[n++]}else{if("["!==t)break;{let t=1,r=!1,a=null,o=!1;for(i+=e[n++];e.length>n&&t>0;){const s=e[n];i+=s,o?o=!1:"\\"===s?o=!0:r?s===a&&(r=!1,a=null):'"'===s||"'"===s||"`"===s?(r=!0,a=s):"["===s?t++:"]"===s&&t--,n++}if(0!==t)return null}}}for(;e.length>n&&jp(e[n]);)i+=e[n++];if(e.length>n&&"/"===e[n])for(i+=e[n++];e.length>n&&jp(e[n]);)i+=e[n++];if(n>=e.length||">"!==e[n])return null;i+=e[n++]}return i||null}function Wp(e,t){if(t>=e.length||"'"!==e[t])return!1;if(t+1>=e.length)return!1;if("s"!==e[t+1].toLowerCase())return!1;if(t+2>=e.length)return!0;const r=e[t+2];return jp(r)||"*"===r||!Rp(r)}function _p(e,t){if(t>=e.length)return null;const r=e[t];if(!Op(r))return null;if("'"===r&&Wp(e,t))return null;const n={'"':'"',"'":"'","`":"`","「":"」"}[r];if(!n)return null;let i=t+1,a=r,o=!1;for(;e.length>i;){const t=e[i];if(a+=t,o)o=!1;else if("\\"===t)o=!0;else if(t===n)return a;i++}return a}function qp(e,t){if(t>=e.length)return!1;const r=e[t],n=e[t+1]||"",i=e[t+2]||"";if("/"===r&&"/"!==n&&/[a-zA-Z0-9._-]/.test(n))return!0;if("/"===r&&"/"===n&&/[a-zA-Z]/.test(i))return!0;if("."===r&&("/"===n||"."===n&&"/"===i))return!0;const a=e.slice(t,t+8).toLowerCase();return!(!a.startsWith("http://")&&!a.startsWith("https://"))}function $p(e,t){if(!qp(e,t))return null;let r=t,n="";const i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;e.length>r;){const t=e[r];if("#"===t){if(n.length>0&&/[a-zA-Z0-9/.]$/.test(n))for(n+=t,r++;e.length>r&&/[a-zA-Z0-9_-]/.test(e[r]);)n+=e[r++];break}if(!i.test(t))break;n+=t,r++}return 2>n.length?null:n}function Vp(e,t){if(t>=e.length)return null;const r=e[t];if(!Np(r)&&"-"!==r&&"+"!==r)return null;let n=t,i="";if("-"!==e[n]&&"+"!==e[n]||(i+=e[n++]),n>=e.length||!Np(e[n]))return null;for(;e.length>n&&Np(e[n]);)i+=e[n++];if(e.length>n&&"."===e[n])for(i+=e[n++];e.length>n&&Np(e[n]);)i+=e[n++];if(e.length>n){"ms"===e.slice(n,n+2)?i+="ms":"s"!==e[n]&&"m"!==e[n]&&"h"!==e[n]||(i+=e[n])}return i}var Dp=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Bp=class{constructor(e=Dp){this.operators=e,this.name="operator",this.operators=[...e].sort((e,t)=>t.length-e.length)}canExtract(e,t){return this.operators.some(r=>e.startsWith(r,t))}extract(e,t){for(const r of this.operators)if(e.startsWith(r,t))return{value:r,length:r.length};return null}},Hp="()[]{},:;",Fp=class{constructor(e=Hp){this.punctuation=e,this.name="punctuation"}canExtract(e,t){return this.punctuation.includes(e[t])}extract(e,t){const r=e[t];return this.punctuation.includes(r)?{value:r,length:1}:null}};function Kp(){return[new bu,new wu,new Bp,new Fp,new zu,new xu]}function Up(e){return t=>{const r=t.charCodeAt(0);return e.some(([e,t])=>r>=e&&t>=r)}}var Gp=new Set(Dp),Yp=new Set(["patient","destination","source","style","event","eventMarker","agent","goal","manner","into","from","to","with","at","of","as","by","in","on","over","under","between","through","without"]),Zp=["click","dblclick","input","change","submit","keydown","keyup","keypress","mousedown","mouseup","mouseover","mouseout","mouseenter","mouseleave","mousemove","pointerdown","pointerup","pointermove","focus","blur","load","resize","scroll"],Jp=class e{constructor(){this.profileKeywords=[],this.multiWordKeywords=[],this.profileKeywordMap=new Map,this.rawExtraEntries=[],this.extractors=[]}getExtraKeywordEntries(){return this.rawExtraEntries}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){Eu(e)&&e.setContext(Tu(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 r=0;for(;e.length>r;){for(;e.length>r&&jp(e[r]);)r++;if(r>=e.length)break;const n=this.tryMultiWordKeyword(e,r);if(n){t.push(n),r=n.position.end;continue}let i=!1;for(const n of this.extractors)if(n.canExtract(e,r)){const a=n.extract(e,r);if(a){const e=a.metadata?.normalized,n=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),n&&(l.stem=n),void 0!==o&&(l.stemConfidence=o),Object.keys(s).length>0&&(l.metadata=s),t.push(Lp(a.value,this.classifyToken(a.value),Ap(r,r+a.length),Object.keys(l).length>0?l:void 0)),r+=a.length,i=!0;break}}if(!i){const n=e[r],i=this.classifyUnknownChar(n);t.push(Lp(n,i,Ap(r,r+1))),r++}}return new Cp(t,this.language)}classifyUnknownChar(e){return"()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,t,r){if("."!==e[t])return!1;const n=r[r.length-1];if(n&&!(n&&t>n.position.end)&&("identifier"===n.kind||"keyword"===n.kind||"selector"===n.kind))return r.push(Lp(".","operator",Ap(t,t+1))),!0;let i=t+1;for(;e.length>i&&Rp(e[i]);)i++;return e.length>i&&"("===e[i]&&(r.push(Lp(".","operator",Ap(t,t+1))),!0)}initializeKeywordsFromProfile(e,t=[]){const r=new Map;if(this.rawExtraEntries=t,e.keywords)for(const[t,n]of Object.entries(e.keywords))if(r.set(n.primary,{native:n.primary,normalized:n.normalized||t}),n.alternatives)for(const e of n.alternatives)r.set(e,{native:e,normalized:n.normalized||t});if(e.references){for(const[t,n]of Object.entries(e.references))r.set(n,{native:n,normalized:t});for(const t of Object.keys(e.references))r.has(t)||r.set(t,{native:t,normalized:t})}if(e.roleMarkers)for(const[t,n]of Object.entries(e.roleMarkers))if(n.primary&&r.set(n.primary,{native:n.primary,normalized:t}),n.alternatives)for(const e of n.alternatives)r.set(e,{native:e,normalized:t});if(e.possessive?.keywords)for(const[t,n]of Object.entries(e.possessive.keywords))r.set(t,{native:t,normalized:n});for(const e of Zp)r.has(e)||r.set(e,{native:e,normalized:e});for(const e of t)r.set(e.native,e);this.profileKeywords=Array.from(r.values()).sort((e,t)=>t.native.length-e.native.length),this.multiWordKeywords=this.profileKeywords.filter(e=>e.native.includes(" ")&&!Yp.has(e.normalized)),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 r of this.profileKeywords)if(e.slice(t).startsWith(r.native))return Lp(r.native,"keyword",Ap(t,t+r.native.length),r.normalized);return null}tryMultiWordKeyword(e,t,r=e=>/[\p{L}\p{N}_]/u.test(e)){if(0===this.multiWordKeywords.length)return null;const n=e.slice(t);for(const i of this.multiWordKeywords){if(!n.startsWith(i.native))continue;const a=e[t+i.native.length];if(void 0===a||!r(a))return Lp(i.native,"keyword",Ap(t,t+i.native.length),i.normalized)}return null}isKeywordStart(e,t){const r=e.slice(t);return this.profileKeywords.some(e=>r.startsWith(e.native))}isKeywordStartAtBoundary(e,t,r=e=>/[\p{L}\p{N}_]/u.test(e)){const n=e.slice(t);return this.profileKeywords.some(i=>{if(!n.startsWith(i.native))return!1;const a=e[t+i.native.length];return void 0===a||!r(a)})}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,r){const n=this.tryNormalize(e);if(!n)return null;const i=this.lookupKeyword(n.stem);if(!i)return null;const a={normalized:i.normalized,stem:n.stem,stemConfidence:n.confidence};return Lp(e,"keyword",Ap(t,r),a)}trySelector(e,t){const r=Mp(e,t);return r?Lp(r,"selector",Ap(t,t+r.length)):null}tryEventModifier(e,t){if("."!==e[t])return null;const r=e.slice(t).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!r)return null;const n=r[0].replace(/(\s|\.)$/,""),i=n.slice(1).split("(")[0],a=r[1];return{...Lp(n,"event-modifier",Ap(t,t+n.length)),metadata:{modifierName:i,value:a?"queue"===i?a:parseInt(a,10):void 0}}}tryString(e,t){const r=_p(e,t);return r?Lp(r,"literal",Ap(t,t+r.length)):null}tryNumber(e,t){const r=Vp(e,t);return r?Lp(r,"literal",Ap(t,t+r.length)):null}tryMatchTimeUnit(e,t,r,n=!1){let i=t;if(n)for(;e.length>i&&jp(e[i]);)i++;const a=e.slice(i);for(const e of r){const t=a.slice(0,e.length);if(e.caseInsensitive?t.toLowerCase()===e.pattern.toLowerCase():t===e.pattern){if(e.notFollowedBy){if((a[e.length]||"")===e.notFollowedBy)continue}if(e.checkBoundary){if(Rp(a[e.length]||""))continue}return{suffix:e.suffix,endPos:i+e.length}}}return null}parseBaseNumber(e,t,r=!0){let n=t,i="";if(!r||"-"!==e[n]&&"+"!==e[n]||(i+=e[n++]),n>=e.length||!Np(e[n]))return null;for(;e.length>n&&Np(e[n]);)i+=e[n++];if(e.length>n&&"."===e[n])for(i+=e[n++];e.length>n&&Np(e[n]);)i+=e[n++];return i&&"-"!==i&&"+"!==i?{number:i,endPos:n}:null}tryNumberWithTimeUnits(t,r,n,i={}){const{allowSign:a=!0,skipWhitespace:o=!1}=i,s=this.parseBaseNumber(t,r,a);if(!s)return null;let{number:l,endPos:c}=s;const u=[...n,...e.STANDARD_TIME_UNITS],p=this.tryMatchTimeUnit(t,c,u,o);return p&&(l+=p.suffix,c=p.endPos),Lp(l,"literal",Ap(r,c))}tryUrl(e,t){const r=$p(e,t);return r?Lp(r,"url",Ap(t,t+r.length)):null}tryVariableRef(e,t){if(":"!==e[t])return null;if(t+1>=e.length)return null;if(!Rp(e[t+1]))return null;let r=t+1;for(;e.length>r&&Rp(e[r]);)r++;return Lp(e.slice(t,r),"identifier",Ap(t,r))}tryOperator(e,t){const r=e.slice(t,t+2);if(["==","!=","<=",">=","&&","||","->"].includes(r))return Lp(r,"operator",Ap(t,t+2));const n=e[t];return["<",">","!","+","-","*","/","="].includes(n)?Lp(n,"operator",Ap(t,t+1)):["(",")","{","}",",",";",":"].includes(n)?Lp(n,"punctuation",Ap(t,t+1)):null}tryMultiCharParticle(e,t,r){for(const n of r)if(e.slice(t,t+n.length)===n)return Lp(n,"particle",Ap(t,t+n.length));return null}};Jp.STANDARD_TIME_UNITS=[{pattern:"ms",suffix:"ms",length:2},{pattern:"s",suffix:"s",length:1,checkBoundary:!0},{pattern:"m",suffix:"m",length:1,checkBoundary:!0,notFollowedBy:"s"},{pattern:"h",suffix:"h",length:1,checkBoundary:!0}];var Xp=Jp;function Qp(e){return{stem:e,confidence:1}}function em(e,t,r){return r?{stem:e,confidence:t,metadata:r}:{stem:e,confidence:t}}var tm=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 Qp(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 Qp(e)}isAlreadyNormalized(e){return!!this.config.infinitiveEndings&&this.config.infinitiveEndings.some(t=>e.endsWith(t))}tryReflexiveNormalization(e){const t=this.config.reflexiveSuffixes;if(!t)return null;for(const r of t){if(!e.endsWith(r))continue;const t=e.slice(0,-r.length);if(this.isAlreadyNormalized(t))return em(t,.88,{removedSuffixes:[r],conjugationType:"reflexive"});const n=this.tryConjugationEndings(t)||this.trySuffixRules(t);if(n&&n.stem!==t)return em(n.stem,.95*n.confidence,{removedSuffixes:[r,...n.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}tryConjugationEndings(e){const t=this.config.endings;if(!t)return null;const r=this.config.minStemLength??2;for(const n of t){if(!e.endsWith(n.ending))continue;const t=e.slice(0,-n.ending.length);if(r>t.length)continue;return em(t+n.stem,n.confidence,{removedSuffixes:[n.ending],conjugationType:n.type})}return null}trySuffixRules(e){const t=this.config.suffixRules;if(!t)return null;const r=this.config.minStemLength??2;for(const n of t){if(!e.endsWith(n.pattern))continue;const t=e.slice(0,-n.pattern.length);if((n.minStemLength??r)>t.length)continue;return em(t+(n.replacement||""),n.confidence,{removedSuffixes:[n.pattern],...n.conjugationType&&{conjugationType:n.conjugationType}})}return null}tryPrefixRules(e){const t=this.config.prefixRules;if(!t)return null;for(const r of t){if(!e.startsWith(r.pattern))continue;const t=e.slice(r.pattern.length);if(t.length>=(r.minRemaining??this.config.minStemLength??2))return em(t,1-r.confidencePenalty,{removedPrefixes:[r.pattern]})}return null}};function rm(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 nm=class{constructor(e,t){this.dsl=e,this.config=t}parse(e,t){const r=this.splitStatements(e,t),n=[],i=[];let a;for(const e of r){const r=this.classifyLine(e.text,t);let o=e.text;if(this.config.continuation){const r=this.resolveContinuation(e.text,t,a?.category);null!==r&&(o=r)}if(this.config.preprocessor){const n=this.config.preprocessor(o,r,t,{...null!=a&&{previous:a},lineNumber:e.line,indent:e.indent});if(null===n)continue;o=n}try{const i={node:this.dsl.parse(o,t),source:e.text,line:e.line,...null!=r&&{category:r},indent:e.indent};n.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:n,errors:i}}splitStatements(e,t){const{mode:r,trim:n=!0,commentPrefixes:i=["--","//"]}=this.config.split;if("delimiter"===r)return this.splitByDelimiter(e,t,n,i);const a=e.split("\n"),o=[];for(let e=0;a.length>e;e++){const t=a[e],r=t.length-t.trimStart().length,s=n?t.trim():t;s&&(i.some(e=>s.startsWith(e))||o.push({text:s,line:e+1,indent:r}))}return o}splitByDelimiter(e,t,r,n){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=r?t.trim():t;o&&(n.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 r=e.toLowerCase(),n=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"===n){if(r.endsWith(i)||r.startsWith(i))return e}else if(r.startsWith(i))return e}}}resolveContinuation(e,t,r){if(!this.config.continuation||!r)return null;const n=this.config.continuation.keywords[t]??this.config.continuation.keywords.en??[],i=e.toLowerCase();for(const a of n){const n=a.toLowerCase();if(i.startsWith(n)){const n=e.slice(a.length).trim();if(!n)return null;if(this.config.continuation.resolve)return this.config.continuation.resolve(n,r,t,this.config.keywords?.categories??{});const i=this.config.keywords?.categories[r]?.[t]??this.config.keywords?.categories[r]?.en;return i?.[0]?i[0]+" "+n:null}}return null}};var im,am,om,sm,lm,cm=Object.freeze({__proto__:null,AOTOrchestrator:class{constructor(e){this.backends=new Map,this.options={confidenceThreshold:e?.confidenceThreshold??.7,continueOnError:e?.continueOnError??!0,debug:e?.debug??!1}}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 r=Array.from(this.backends.values()).map(e=>e.scanConfig),n=new zp(r),i=await n.extractFromFiles(e,t),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 r=t.dsl.compile(e.code,e.language);return r.ok&&r.code?{domain:e.domain,source:e.code,compiled:r.code,language:e.language,file:e.file,line:e.line}:{error:r.errors?.join("; ")??"Compilation failed"}}catch(e){return{error:e instanceof Error?e.message:e+""}}}generateOutput(e,t){const r=t?.format??"esm",n=t?.includeComments??!0,i=t?.groupByDomain??!0,a=[];if(n&&(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 r of e.compiled){const e=t.get(r.domain)??[];e.push(r),t.set(r.domain,e)}for(const[e,r]of t){n&&(a.push(`// === Domain: ${e} ===`),a.push(""));for(const e of r)n&&(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)n&&a.push(`// [${t.domain}] ${t.file}:${t.line}`),a.push(t.compiled),a.push("");const o=a.join("\n").trimEnd();switch(r){case"cjs":return`'use strict';\n\n${o}\n`;case"iife":return`(function() {\n${o}\n})();\n`;default:return o+"\n"}}},BaseMorphologicalNormalizer:tm,BaseTokenizer:Xp,CrossDomainDispatcher:class{constructor(e,t){this.registry=e,this.minConfidence=t?.minConfidence??.5,this.priority=t?.priority??[]}async detect(e,t="en"){const r=this.registry.getDomainNames();if(0===r.length)return null;const n=[];for(const i of r)try{const r=await this.registry.getDSLForDomain(i);if(!r)continue;const{node:a,confidence:o}=r.parseWithConfidence(e,t);this.minConfidence>o||n.push({domain:i,node:a,confidence:o,dsl:r})}catch{}return 0===n.length?null:(n.sort(this.priority.length>0?(e,t)=>{const r=this.getPriorityIndex(e.domain),n=this.getPriorityIndex(t.domain);return r!==n?r-n:t.confidence-e.confidence}:(e,t)=>t.confidence-e.confidence),n[0])}async parseComposite(e,t="en"){const r=e.split("\n"),n=[],i=[];for(let e=0;r.length>e;e++){const a=r[e];if(yp(a))continue;const o=a.trim(),s=await this.detect(o,t);s?n.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:n,errors:i}}async compile(e,t="en"){const r=await this.detect(e,t);if(!r)return null;return{...r.dsl.compile(e,t),domain:r.domain}}async compileComposite(e,t="en"){const r=e.split("\n"),n=[],i=[];for(let e=0;r.length>e;e++){const a=r[e];if(yp(a))continue;const o=a.trim(),s=await this.detect(o,t);if(s){const r=s.dsl.compile(o,t);n.push({line:e+1,input:o,domain:s.domain,ok:r.ok,code:r.code,errors:r.errors})}else i.push({line:e+1,input:o,message:"No domain matched this input"})}return{statements:n,errors:i}}async validate(e,t="en"){const r=await this.detect(e,t);if(!r)return{valid:!1,errors:["No domain matched this input"]};return{...r.dsl.validate(e,t),domain:r.domain}}getPriorityIndex(e){const t=this.priority.indexOf(e);return-1===t?this.priority.length:t}},DEFAULT_OPERATORS:Dp,DEFAULT_PUNCTUATION:Hp,DEFAULT_REFERENCES:Oc,DomainAwareScanner:zp,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 r=this.descriptors.get(e);if(!r)throw Error("Domain not registered: "+e);this.descriptors.set(e,{...r,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(...up(t));return e}canHandle(e){const t=pp(e);return!!t&&this.descriptors.has(t.domain)}async handleToolCall(e,t){const r=pp(e);if(!r)return null;const n=this.descriptors.get(r.domain);if(!n)return null;try{const e=await this.getDSL(n);switch(r.operation){case"parse":return await this.handleParse(n,e,t);case"compile":return await this.handleCompile(n,e,t);case"validate":return await this.handleValidate(n,e,t);case"translate":return await this.handleTranslate(n,e,t);default:return dp({error:"Unknown operation: "+r.operation},!0)}}catch(e){return dp({error:`${n.name} tool error: ${e instanceof Error?e.message:e+""}`},!0)}}async getDSLForDomain(e){const t=this.descriptors.get(e);return t?this.getDSL(t):null}generatePrompt(e,t){const r=this.descriptors.get(e);return r?.schemas&&0!==r.schemas.length?Du({domain:e,description:r.description,schemas:r.schemas,...t}):null}generateTrainingData(e,t){const r=this.descriptors.get(e);return r?.schemas&&0!==r.schemas.length?tp(r.schemas,{domain:e,...t}):null}buildFeedback(e,t,r,n){const i=this.descriptors.get(e);if(!i?.schemas||0===i.schemas.length)return null;const a=this.createSchemaLookup(i.schemas);let o;try{if("explicit"===r){o=Mc(t,{schemaLookup:a}).action}}catch{}return sp(t,r,n,a,o)}getSchemas(e){const t=this.descriptors.get(e);return t?.schemas?t.schemas:null}createSchemaLookup(e){const t=new Map;for(const r of e)t.set(r.action,r);return{getSchema:e=>t.get(e)}}async getDSL(e){const t=this.dslCache.get(e.name);if(t)return t;const r=await e.getDSL();return this.dslCache.set(e.name,r),r}async getRenderer(e){if(!e.getRenderer)return null;const t=this.rendererCache.get(e.name);if(t)return t;const r=await e.getRenderer();return this.rendererCache.set(e.name,r),r}async handleParse(e,t,r){const n=mp(r,e.inputLabel);if(!n)return fp(e.inputLabel);const i=mp(r,"language","en"),a=t.parse(n,i),o={};for(const[e,t]of a.roles)o[e]=t;return dp({action:a.action,roles:o,language:i,[e.inputLabel]:n})}async handleCompile(e,t,r){const n=mp(r,e.inputLabel);if(!n)return fp(e.inputLabel);const i=mp(r,"language","en"),a=t.compile(n,i);return dp({ok:a.ok,code:a.code,errors:a.errors,language:i,input:n})}async handleValidate(e,t,r){const n=mp(r,e.inputLabel);if(!n)return fp(e.inputLabel);const i=mp(r,"language","en"),a=t.validate(n,i);return dp({valid:a.valid,errors:a.errors,language:i,[e.inputLabel]:n})}async handleTranslate(e,t,r){const n=mp(r,e.inputLabel);if(!n)return fp(e.inputLabel);const i=mp(r,"from");if(!i)return fp("from");const a=mp(r,"to");if(!a)return fp("to");const o=t.parse(n,i),s=t.compile(n,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 dp({input:{[e.inputLabel]:n,language:i},...null!=l&&{rendered:{text:l,language:a}},semantic:{action:o.action,roles:u},...s.ok&&null!=s.code&&{compiled:s.code}})}},GrammarTransformer:vu,IdentifierExtractor:zu,InMemoryDictionary:gu,InMemoryProfileProvider:ku,LatinExtendedIdentifierExtractor:class{constructor(){this.name="latin-extended-identifier"}canExtract(e,t){return/\p{L}/u.test(e[t])}extract(e,t){let r=t;for(;e.length>r&&/[\p{L}\p{N}_-]/u.test(e[r]);)r++;return r===t?null:{value:e.slice(t,r),length:r-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!1}},NumberExtractor:wu,OperatorExtractor:Bp,PatternMatcher:lu,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 r of e.diagnosticCodes){const n=t.get(r)||{count:0,actions:new Set};n.count++,n.actions.add(e.action),t.set(r,n)}return Array.from(t.entries()).map(([e,{count:t,actions:r}])=>({code:e,count:t,actions:Array.from(r)})).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 r of this.events){const n=e(r),i=t.get(n)||{attempts:0,successes:0};i.attempts++,"accepted"===r.outcome&&i.successes++,t.set(n,i)}const r={};for(const[e,{attempts:n,successes:i}]of t)r[e]={attempts:n,successes:i,rate:n>0?i/n:0};return r}},PunctuationExtractor:Fp,StringLiteralExtractor:bu,TokenStreamImpl:Cp,UnicodeIdentifierExtractor:xu,WhitespaceExtractor:class{constructor(){this.name="whitespace"}canExtract(e,t){return/\s/.test(e[t])}extract(e,t){let r=0;for(;e.length>t+r&&/\s/.test(e[t+r]);)r++;return r>0?{value:e.substring(t,t+r),length:r}:null}},accumulateBlocks:function(e,t){return"flat"===t.nesting?function(e,t){const r=[],n=[];let i=null;const a=()=>{i&&(r.push({type:i.type,...null!=i.name&&{name:i.name},statements:i.stmts,children:[],line:i.line,indent:i.indent}),i=null)};for(const r of e)if(r.category&&t.blockTypes.includes(r.category)){a();const e=t.extractName?.(r.source,r.category);i={type:r.category,...null!=e&&{name:e},stmts:[r],line:r.line,indent:r.indent}}else i?i.stmts.push(r):n.push(r);return a(),{blocks:r,orphans:n}}(e,t):function(e,t){const r=[],n=[],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):r.push(e)}}};for(const r of e)if(r.category&&t.blockTypes.includes(r.category)){a(r.indent);const e=t.extractName?.(r.source,r.category);i.push({type:r.category,...null!=e&&{name:e},stmts:[r],children:[],line:r.line,indent:r.indent})}else i.length>0?i[i.length-1].stmts.push(r):n.push(r);return a(-1),{blocks:r,orphans:n}}(e,t)},buildDisambiguation:function(e,t){const r=[...t].sort((e,t)=>t.confidence-e.confidence),n=r.map((e,t)=>({action:e.action,confidence:e.confidence,explicit:Fc(e.node),description:e.description||`${e.action} (option ${String.fromCharCode(97+t)})`})),i=n.map((e,t)=>` (${String.fromCharCode(97+t)}) ${e.explicit} — ${e.description} (conf: ${e.confidence.toFixed(2)})`);return{input:e,candidates:n,question:[`Your input parsed with confidence ${r[0]?.confidence.toFixed(2)??"?"}.`,...i,"Which did you mean?"].join("\n")}},buildFeedback:sp,buildPhrase:Ep,buildTablesFromProfiles:Tp,combineClassifiers:function(...e){return t=>e.some(e=>e(t))},convertValue:Pu,createAsyncNode:Ac,createCommandNode:zc,createCompoundNode:Tc,createConditionalNode:Ec,createDiagnosticCollector:function(){const e=[];function t(t,r,n){const i={message:r,severity:t,...null!=n?.code&&{code:n.code},...null!=n?.line&&{line:n.line},...null!=n?.column&&{column:n.column},...null!=n?.source&&{source:n.source},...null!=n?.suggestions&&n.suggestions.length>0&&{suggestions:n.suggestions}};e.push(i)}return{error(e,r,n){"string"==typeof r?t("error",r,{...n,code:e}):t("error",e,r)},warning(e,r){t("warning",e,r)},info(e,r){t("info",e,r)},add(t){e.push(t)},hasErrors:()=>e.some(e=>"error"===e.severity),getDiagnostics:()=>e,toResult(){let t=0,r=0,n=0;for(const i of e)"error"===i.severity?t++:"warning"===i.severity?r++:n++;return{ok:0===t,diagnostics:e,summary:{errors:t,warnings:r,infos:n}}}}},createEventHandlerNode:xc,createExpression:bc,createFlag:wc,createLatinCharClassifiers:function(e){const t=t=>e.test(t);return{isLetter:t,isIdentifierChar:e=>t(e)||/[0-9_-]/.test(e)}},createLiteral:yc,createLoopNode:Sc,createMatchNode:Lc,createMultiStatementParser:function(e,t){return new nm(e,t)},createMultilingualDSL:function(e){const t=e.dictionary??function(e){const t={};for(const r of e.languages){const e={};for(const[t,n]of Object.entries(r.patternProfile.keywords))e[t]=n.primary;t[r.code]=e}return new gu(t)}(e),r=e.profileProvider??function(e){const t={};for(const r of e.languages)r.grammarProfile&&(t[r.code]=r.grammarProfile);return new ku(t)}(e),n=new vu({dictionary:t,profileProvider:r}),i=new $u(e);return new Vu(e,i,n)},createPosition:Ap,createPropertyPath:kc,createReference:gc,createSchemaRenderer:function(e,t){const{keywords:r,markers:n}=Tp(e,t),{sovLanguages:i}=Sp(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=xp(r,e.action,t),l=i.has(t),c=[];for(const r of o.roles){const i=Pc(e,r.role);if(!i&&!r.required)continue;const a=r.markerOverride?.[t]??n[r.role]?.[t]??void 0;c.push({...null!=a&&{marker:a},value:i||"",role:r})}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 Ep(...u)}}},createSelector:vc,createSimpleTokenizer:function(e){const{language:t,direction:r="ltr",keywords:n,keywordExtras:i,keywordProfile:a,includeOperators:o=!1,caseInsensitive:s=!0,customExtractors:l}=e,c=new Set(s?n.map(e=>e.toLowerCase()):n);return new class extends Xp{constructor(){super(),this.language=t,this.direction=r,l&&this.registerExtractors(l),this.registerExtractors(Kp()),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&&Gp.has(e)?"operator":"identifier"}}},createToken:Lp,createTokenizerContext:Tu,createTryNode:Cc,createUnicodeRangeClassifier:Up,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:Sp,extractCssSelector:Mp,extractNumber:Vp,extractRoleValue:Pc,extractStringLiteral:_p,extractUrl:$p,extractValue:jc,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(Zc)}},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:Lu,fromProtocolJSON:Zc,generateExamples:Bu,generatePattern:pu,generatePatternVariants:function(e,t,r=uu){const n=[];return n.push(pu(e,t,r)),n},generatePrompt:Du,generateProtocolReference:function(){const e=Hu(),t=Fu();return`# LokaScript Explicit Syntax (LSE) Quick Reference\n\n${e.content}\n\n${t.content}`},getAllPossessiveKeywords:function(e){return e?.possessive?.keywords??{}},getDefaultExtractors:Kp,getPossessiveReference:ou,getRoleSpec:function(e,t){return e.roles.find(e=>e.role===t)},getRoleValue:function(e,t){return e.roles.get(t)},insertMarkers:hu,isAsciiIdentifierChar:Rp,isAsciiLetter:Ip,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}=qc(e.trim());return t.length>1},isContextAwareExtractor:Eu,isDigit:Np,isDocumentSyntax:function(e){const t=e.trim();return!!t.includes("\n")||(!!Vc.test(t)||!!(t.startsWith("//")||t.startsWith("#")&&!t.startsWith("#!")))},isEnvelope:function(e){return"object"==typeof e&&null!==e&&"lseVersion"in e&&"nodes"in e&&Array.isArray(e.nodes)},isExplicitSyntax:Wc,isIdSelector:function(e){return e.startsWith("#")},isNumericValue:function(e){if(e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/))return!0;const t=parseFloat(e);return!isNaN(t)&&isFinite(t)},isPossessiveKeyword:function(e,t){return void 0!==e?.possessive?.keywords?.[t]},isPossessiveMarker:Wp,isPropertyName:function(e){return/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e)},isQuote:Op,isSelectorStart:Pp,isTypeCompatible:au,isUrlStart:qp,isValidReference:Nc,isVariableRef:function(e){return e.startsWith(":")},isWhitespace:jp,joinTokens:yu,jsonToSemanticNode:function(e){const t=new Map;if(e.roles)for(const[r,n]of Object.entries(e.roles))t.set(r,Cu(n));if(e.trigger){t.set("event",yc(e.trigger.event,"string"));const r=new Map(t);r.delete("event");return xc("on",t,[zc(e.action,r)],{sourceLanguage:"json"},e.trigger.modifiers??{})}return zc(e.action,t,{sourceLanguage:"json"})},lookupKeyword:xp,lookupMarker:function(e,t,r){return e[t]?.[r]??t},matchBest:function(e,t){return cu.matchBest(e,t)},matchPattern:function(e,t){return cu.matchPattern(e,t)},needsDisambiguation:function(e,t=.5,r=.7){return e>=t&&r>e},noChange:Qp,normalized:em,parseCompound:$c,parseDocument:function(e,t){const r=e.split("\n");let n="1.0";const i=[];let a=0;for(let e=0;r.length>e;e++){const t=r[e].trim();if(!t)continue;const i=t.match(Vc);i&&(n=i[1],a=e+1);break}for(let e=a;r.length>e;e++){const n=r[e].trim();n&&(n.startsWith("//")||n.startsWith("#")&&!n.startsWith("#!")||i.push($c(n,t)))}return{lseVersion:n,nodes:i}},parseExplicit:Mc,parseJSONL:function(e){return e.split("\n").filter(e=>e.trim().length>0).map(e=>JSON.parse(e))},patternMatcher:cu,registryToAOTBackends:async function(e){const t=[];for(const r of e.getDomainNames()){const n=e.getDescriptor(r);if(!n?.scanConfig)continue;const i=await e.getDSLForDomain(r);if(!i)continue;const a={domain:r,attributes:[...n.scanConfig.attributes],...n.scanConfig.scriptTypes?{scriptTypes:[...n.scanConfig.scriptTypes]}:{},defaultLanguage:n.scanConfig.defaultLanguage??"en"};t.push({domain:r,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 r of e.nodes)t.push(Fc(r));return t.join("\n")},renderExplicit:Fc,renderExpr:Ou,reorderRoles:fu,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,r=e.body?.[0]?.action??t.action,n={};if(e.body?.[0])for(const[t,r]of e.body[0].roles)n[t]=Au(r);const i=t.roles.get("event"),a=i?"value"in i?i.value+"":"raw"in i?i.raw:"unknown":"unknown",o={action:"on"===r?e.body?.[0]?.action??"on":r,roles:n,trigger:{event:a}};return e.eventModifiers&&Object.keys(e.eventModifiers).length>0&&(o.trigger.modifiers=e.eventModifiers),o}const r={};for(const[e,n]of t.roles)r[e]=Au(n);return{action:t.action,roles:r}},semanticNodeToRuntimeAST:_u,semanticValueToAST:qu,synthesizeFromSchemas:tp,toEnvelopeJSON:function(e){const t={lseVersion:e.lseVersion,nodes:e.nodes.map(Uc)};return e.features&&e.features.length>0&&(t.features=[...e.features]),t},toJSONL:function(e){return e.map(e=>JSON.stringify(rm(e))).join("\n")},toJSONLRow:rm,toProtocolJSON:Uc,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 r=e,n="kind"in r?r.kind+"":"command";if("kind"in r&&!Qc.has(n)&&t.push({severity:"error",code:"INVALID_KIND",message:`Invalid kind "${r.kind}". Must be one of: command, event-handler, compound`}),"action"in r?"string"==typeof r.action&&0!==r.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 r||"compound"===n){if("roles"in r&&("object"!=typeof r.roles||null===r.roles||Array.isArray(r.roles)))t.push({severity:"error",code:"INVALID_ROLES",message:"roles must be a plain object"});else if("roles"in r&&r.roles)for(const[e,n]of Object.entries(r.roles)){if("object"!=typeof n||null===n){t.push({severity:"error",code:"INVALID_ROLE_VALUE",message:`Role "${e}" value must be an object`});continue}const r=n;"type"in r&&eu.has(r.type+"")||t.push({severity:"error",code:"INVALID_VALUE_TYPE",message:`Role "${e}" has invalid type "${r.type}"`}),"flag"===r.type&&("string"==typeof r.name||"value"in r||t.push({severity:"error",code:"MISSING_FLAG_NAME",message:`Flag role "${e}" missing required field: name (or value)`}),"boolean"==typeof r.enabled||"value"in r||t.push({severity:"error",code:"MISSING_FLAG_ENABLED",message:`Flag role "${e}" missing required field: enabled (or value)`})),"expression"!==r.type||"string"==typeof r.raw||"value"in r||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 r&&r.trigger){const e=r.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"!==n||"trigger"in r||"body"in r&&Array.isArray(r.body)||t.push({severity:"error",code:"MISSING_BODY",message:"event-handler node requires a body array"}),"compound"===n&&("statements"in r&&Array.isArray(r.statements)||t.push({severity:"error",code:"MISSING_STATEMENTS",message:"compound node requires a statements array"}),"chainType"in r&&!tu.has(r.chainType+"")&&t.push({severity:"error",code:"INVALID_CHAIN_TYPE",message:`Invalid chainType "${r.chainType}"`})),"diagnostics"in r&&!Array.isArray(r.diagnostics)&&t.push({severity:"error",code:"INVALID_DIAGNOSTICS",message:"diagnostics must be an array"}),"annotations"in r)if(Array.isArray(r.annotations))for(let e=0;r.annotations.length>e;e++){const n=r.annotations[e];n&&"object"==typeof n?"string"==typeof n.name&&0!==n.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 r&&!ru.has(r.asyncVariant+"")&&t.push({severity:"error",code:"INVALID_ASYNC_VARIANT",message:`Invalid asyncVariant "${r.asyncVariant}". Must be "all" or "race"`}),"arms"in r)if(Array.isArray(r.arms))for(let e=0;r.arms.length>e;e++){const n=r.arms[e];n&&"object"==typeof n?(n.pattern&&"object"==typeof n.pattern||t.push({severity:"error",code:"MISSING_ARM_PATTERN",message:`arms[${e}] missing required field: pattern`}),Array.isArray(n.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 r&&Array.isArray(r.diagnostics))for(let e=0;r.diagnostics.length>e;e++){const n=r.diagnostics[e];n&&"object"==typeof n?(nu.has(n.level+"")||t.push({severity:"error",code:"INVALID_DIAGNOSTIC_LEVEL",message:`diagnostics[${e}].level must be "error", "warning", or "info"`}),"string"!=typeof n.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[r,n]of Object.entries(e.roles)){if(!n||"object"!=typeof n){t.push({severity:"error",code:"INVALID_ROLE_VALUE",message:`Role "${r}" must be an object with "type" and "value" fields.`,suggestion:'Use: { "type": "selector", "value": ".active" }'});continue}const e=n;Su.has(e.type)||t.push({severity:"error",code:"INVALID_VALUE_TYPE",message:`Role "${r}" 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 "${r}" 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||au(e.type,t)},withDefaultExtractors:function(e){return e.registerExtractors(Kp()),e}}),um=Object.defineProperty,pm=Object.getOwnPropertyNames,mm=(e,t)=>function(){return e&&(t=(0,e[pm(e)[0]])(e=0)),t},dm=(e,t)=>{for(var r in t)um(e,r,{get:t[r],enumerable:!0})};function fm(e,t){const r={...e};for(const n of Object.keys(t)){const i=t[n],a=e[n];void 0!==i&&(r[n]="object"!=typeof i||null===i||Array.isArray(i)||"object"!=typeof a||null===a||Array.isArray(a)?i:fm(a,i))}return r}function hm(e,t){return fm(e,t)}function ym(e){if(!e.extends)return e;const t=am.get(e.extends);if(!t)return e;return hm(ym(t),e)}function vm(e,t,r){im.set(e,t),am.set(e,r),om.delete(e)}function gm(e,t){lm.set(e,t),om.delete(e)}function km(e){return e.split("-")[0]}function bm(e){return e.includes("-")}function wm(e){let t=am.get(e);return!t&&bm(e)&&(t=am.get(km(e))),t?ym(t):void 0}function zm(){return Array.from(im.keys())}function xm(e){if(im.has(e)&&am.has(e))return!0;if(bm(e)){const t=km(e);return im.has(t)&&am.has(t)}return!1}function Em(e,t){return function(e){let t=im.get(e);if(!t&&bm(e)){const r=km(e);t=im.get(r)}if(!t){const t=Array.from(im.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)}function Tm(e){let t=om.get(e);if(!t&&bm(e)&&(t=om.get(km(e))),t)return t;let r=lm.get(e);if(!r&&bm(e)&&(r=lm.get(km(e))),r)return om.set(e,r),r;if(!sm)throw Error(`No patterns registered for language '${e}'. Either import the language module or set a pattern generator.`);const n=function(e){let t=am.get(e);if(!t&&bm(e)){const r=km(e);t=am.get(r)}if(!t){const t=Array.from(am.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 ym(t)}(e),i=sm(n);return om.set(e,i),i}var Sm,Cm=mm({"src/registry.ts"(){im=new Map,am=new Map,om=new Map,sm=null,lm=new Map}}),Am={};dm(Am,{arabicProfile:()=>Sm});var Lm,jm=mm({"src/generators/profiles/arabic.ts"(){Sm={code:"ar",name:"Arabic",nativeName:"العربية",regions:["priority"],direction:"rtl",script:"arabic",wordOrder:"VSO",markingStrategy:"preposition",usesSpaces:!0,verb:{position:"start",subjectDrop:!0},references:{me:"أنا",it:"هو",you:"أنت",result:"النتيجة",event:"الحدث",target:"الهدف",body:"جسم"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:!0,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:"إفراغ",alternatives:["فارغ"],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"},unless:{primary:"إلا",normalized:"unless"},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"},forever:{primary:"forever",normalized:"forever"},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"},bind:{primary:"اربط",alternatives:["ربط","bind"],normalized:"bind"},intercept:{primary:"اعترض",alternatives:["اعتراض","intercept"],normalized:"intercept"},worker:{primary:"عامل",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["مصدر-الأحداث"],normalized:"eventsource"}},tokenization:{prefixes:["ال","و","ف","ب","ك","ل"]},eventHandler:{eventMarker:{primary:"عند",alternatives:["في","لدى","عندما","حين","حينما","لمّا","لما"],position:"before"},temporalMarkers:["عندما","حين","لمّا"],negationMarker:{primary:"عدم",alternatives:["عدم"],position:"before"}}}}}),Pm={};dm(Pm,{bengaliProfile:()=>Lm});var Om,Nm=mm({"src/generators/profiles/bengali.ts"(){Lm={code:"bn",name:"Bengali",nativeName:"বাংলা",direction:"ltr",script:"bengali",wordOrder:"SOV",markingStrategy:"postposition",usesSpaces:!0,defaultVerbForm:"imperative",verb:{position:"end",suffixes:["ুন","ো","া","ে","ি"],subjectDrop:!0},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:"খালি-করুন",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:"পরিবর্তন",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"},forever:{primary:"চিরকাল",normalized:"forever",alternatives:["forever"]},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"},bind:{primary:"বাইন্ড",alternatives:["bind"],normalized:"bind"},intercept:{primary:"আটকাও",alternatives:["ইন্টারসেপ্ট","intercept"],normalized:"intercept"},worker:{primary:"কর্মী",alternatives:["ওয়ার্কার","worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["ইভেন্টসোর্স"],normalized:"eventsource"}},tokenization:{particles:["কে","তে","থেকে","র","এর","দিয়ে","জন্য","পর্যন্ত"],boundaryStrategy:"space"},eventHandler:{keyword:{primary:"তে",alternatives:["এ","যখন"],normalized:"on"},sourceMarker:{primary:"থেকে",position:"after"},eventMarker:{primary:"তে",alternatives:["এ"],position:"after"},temporalMarkers:["যখন","যখনই"]}}}}),Im={};dm(Im,{germanProfile:()=>Om});var Rm,Mm=mm({"src/generators/profiles/german.ts"(){Om={code:"de",name:"German",nativeName:"Deutsch",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:!1},references:{me:"ich",it:"es",you:"du",result:"Ergebnis",event:"Ereignis",target:"Ziel",body:"Körper"},possessive:{marker:"",markerPosition:"before-property",usePossessiveAdjectives:!0,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","erhalten"],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",alternatives:["leer"],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"},unless:{primary:"wennnicht",normalized:"unless"},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"},forever:{primary:"forever",normalized:"forever"},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"},is:{primary:"ist",normalized:"is"},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"},resize:{primary:"größeändern",normalized:"resize"},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"},bind:{primary:"binden",alternatives:["verknuepfen","bind"],normalized:"bind"},intercept:{primary:"abfangen",alternatives:["intercept"],normalized:"intercept"},worker:{primary:"arbeiter",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["ereignisquelle"],normalized:"eventsource"}},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"]}}}}),Wm={};dm(Wm,{englishProfile:()=>Rm});var _m,qm=mm({"src/generators/profiles/english.ts"(){Rm={code:"en",name:"English",nativeName:"English",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"base",verb:{position:"start",subjectDrop:!1},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"},bind:{primary:"bind",normalized:"bind"},eventsource:{primary:"eventsource",normalized:"eventsource"},worker:{primary:"worker",normalized:"worker"},intercept:{primary:"intercept",normalized:"intercept"}}}}}),$m={};dm($m,{spanishProfile:()=>_m});var Vm,Dm=mm({"src/generators/profiles/spanish.ts"(){_m={code:"es",name:"Spanish",nativeName:"Español",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:!0},references:{me:"yo",it:"ello",you:"tú",result:"resultado",event:"evento",target:"objetivo",body:"cuerpo"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:!0,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"},resize:{primary:"redimensionar",normalized:"resize"},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",alternatives:["cargar"],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"},mousedown:{primary:"ratónabajo",normalized:"mousedown"},mouseup:{primary:"ratónarriba",normalized:"mouseup"},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"},unless:{primary:"menos",alternatives:["a menos que","salvo"],normalized:"unless"},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"},forever:{primary:"forever",normalized:"forever"},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"},bind:{primary:"vincular",alternatives:["enlazar","bind"],normalized:"bind"},intercept:{primary:"interceptar",alternatives:["intercept"],normalized:"intercept"},worker:{primary:"trabajador",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["fuente-de-eventos"],normalized:"eventsource"}},eventHandler:{keyword:{primary:"al",alternatives:["cuando","en"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["desde"],position:"before"},eventMarker:{primary:"al",alternatives:["cuando","en"],position:"before"},temporalMarkers:["cuando","al"]}}}}),Bm={};dm(Bm,{frenchProfile:()=>Vm});var Hm,Fm=mm({"src/generators/profiles/french.ts"(){Vm={code:"fr",name:"French",nativeName:"Français",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:!1},references:{me:"moi",it:"il",you:"toi",result:"résultat",event:"événement",target:"cible",body:"corps"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:!0,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",alternatives:["vide"],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"},unless:{primary:"saufsi",normalized:"unless"},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"},forever:{primary:"forever",normalized:"forever"},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"},resize:{primary:"redimensionner",normalized:"resize"},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","changer"],normalized:"change"},load:{primary:"charger",alternatives:["chargement"],normalized:"load"},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","vif"],normalized:"live"},socket:{primary:"socket",alternatives:["websocket"],normalized:"socket"},bind:{primary:"lier",alternatives:["relier","bind"],normalized:"bind"},intercept:{primary:"intercepter",alternatives:["intercept"],normalized:"intercept"},worker:{primary:"travailleur",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["source-d-evenements"],normalized:"eventsource"}},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","sur"],position:"before"},temporalMarkers:["quand","lorsque"]}}}}),Km={};dm(Km,{hebrewProfile:()=>Hm});var Um,Gm=mm({"src/generators/profiles/he.ts"(){Hm={code:"he",name:"Hebrew",nativeName:"עברית",direction:"rtl",script:"hebrew",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,verb:{position:"second",subjectDrop:!0},references:{me:"אני",it:"זה",you:"אתה",result:"תוצאה",event:"אירוע",target:"יעד",body:"גוף"},possessive:{marker:"של",markerPosition:"before-property",usePossessiveAdjectives:!0,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:"ב",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:"נקודת-עצירה",alternatives:["breakpoint"],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"},unless:{primary:"אלא",normalized:"unless"},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"},forever:{primary:"forever",normalized:"forever"},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:["סוקט","ווב-סוקט","socket"],normalized:"socket"},bind:{primary:"קשור",alternatives:["אגד","bind"],normalized:"bind"},intercept:{primary:"יירט",alternatives:["יירוט","intercept"],normalized:"intercept"},worker:{primary:"עובד",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["מקור-אירועים"],normalized:"eventsource"}},tokenization:{prefixes:["ה","ו","ב","כ","ל","מ","ש"]},eventHandler:{keyword:{primary:"ב",normalized:"on"},sourceMarker:{primary:"מ",alternatives:["מאת"],position:"before"},conditionalKeyword:{primary:"כאשר",alternatives:["כש","אם"]},eventMarker:{primary:"ב",alternatives:["כש"],position:"before"},temporalMarkers:["כאשר","כש"]}}}}),Ym={};dm(Ym,{hindiProfile:()=>Um});var Zm,Jm=mm({"src/generators/profiles/hindi.ts"(){Um={code:"hi",name:"Hindi",nativeName:"हिन्दी",direction:"ltr",script:"devanagari",wordOrder:"SOV",markingStrategy:"postposition",usesSpaces:!0,defaultVerbForm:"imperative",verb:{position:"end",suffixes:["ें","ा","ी","े","ो"],subjectDrop:!0},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:"खाली-करें",alternatives:["खाली"],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"},forever:{primary:"हमेशा",normalized:"forever",alternatives:["forever"]},unless:{primary:"जब तक नहीं",normalized:"unless"},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"},matches:{primary:"मेल खाता",normalized:"matches"},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"},worker:{primary:"worker",alternatives:["वर्कर"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["इवेंटसोर्स"],normalized:"eventsource"},bind:{primary:"bind",alternatives:["बाइंड","बांधें"],normalized:"bind"},intercept:{primary:"intercept",alternatives:["इंटरसेप्ट"],normalized:"intercept"}},tokenization:{particles:["को","में","पर","से","का","की","के","तक","ने"],boundaryStrategy:"space"},eventHandler:{keyword:{primary:"पर",alternatives:[],normalized:"on"},sourceMarker:{primary:"से",position:"after"},eventMarker:{primary:"पर",alternatives:[],position:"after"},temporalMarkers:["जब","जब भी"]}}}}),Xm={};dm(Xm,{indonesianProfile:()=>Zm});var Qm,ed=mm({"src/generators/profiles/indonesian.ts"(){Zm={code:"id",name:"Indonesian",nativeName:"Bahasa Indonesia",regions:["priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,verb:{position:"start",subjectDrop:!0},references:{me:"saya",it:"itu",you:"anda",result:"hasil",event:"peristiwa",target:"target",body:"badan"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:!0,specialForms:{me:"saya",it:"nya",you:"anda"},keywords:{saya:"me",aku:"me",ku:"me",my:"me",anda:"you",kamu:"you",mu:"you",nya:"it",dia:"it",miliknya:"it"},connectors:["punya"]},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",alternatives:["kosong"],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"},unless:{primary:"kecuali",normalized:"unless"},when:{primary:"ketika",normalized:"when"},where:{primary:"di_mana",normalized:"where"},else:{primary:"selainnya",alternatives:["lainnya"],normalized:"else"},repeat:{primary:"ulangi",normalized:"repeat"},for:{primary:"untuk",normalized:"for"},while:{primary:"selama",normalized:"while"},forever:{primary:"forever",normalized:"forever"},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","masukan"],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"},bind:{primary:"ikat",alternatives:["kaitkan","bind"],normalized:"bind"},intercept:{primary:"cegat",alternatives:["tangkap","intercept"],normalized:"intercept"},worker:{primary:"pekerja",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["sumber peristiwa"],normalized:"eventsource"}},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","pada"],position:"before"},temporalMarkers:["ketika","saat"]}}}}),td={};dm(td,{italianProfile:()=>Qm});var rd,nd=mm({"src/generators/profiles/italian.ts"(){Qm={code:"it",name:"Italian",nativeName:"Italiano",regions:["western"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:!0},references:{me:"io",it:"esso",you:"tu",result:"risultato",event:"evento",target:"obiettivo",body:"corpo"},possessive:{marker:"di",markerPosition:"before-property",usePossessiveAdjectives:!0,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",alternatives:["vuoto"],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"},unless:{primary:"salvo",normalized:"unless"},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"},forever:{primary:"forever",normalized:"forever"},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"},resize:{primary:"ridimensiona",normalized:"resize"},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"},load:{primary:"carica",alternatives:["caricamento"],normalized:"load"},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","vivo"],normalized:"live"},socket:{primary:"socket",alternatives:["presa","websocket"],normalized:"socket"},bind:{primary:"vincolare",alternatives:["legare","bind"],normalized:"bind"},intercept:{primary:"intercettare",alternatives:["intercept"],normalized:"intercept"},worker:{primary:"lavoratore",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["sorgente-eventi"],normalized:"eventsource"}},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","su"],position:"before"},temporalMarkers:["quando","al"]}}}}),id={};dm(id,{japaneseProfile:()=>rd});var ad,od=mm({"src/generators/profiles/japanese.ts"(){rd={code:"ja",name:"Japanese",nativeName:"日本語",regions:["east-asian","priority"],direction:"ltr",script:"cjk",wordOrder:"SOV",markingStrategy:"particle",usesSpaces:!1,defaultVerbForm:"base",verb:{position:"end",suffixes:["る","て","た","ます","ない"],subjectDrop:!0},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"},unless:{primary:"ない限り",normalized:"unless"},repeat:{primary:"繰り返し",alternatives:["繰り返す","リピート"],normalized:"repeat"},for:{primary:"ために",alternatives:["各"],normalized:"for"},while:{primary:"の間",alternatives:["間"],normalized:"while"},forever:{primary:"forever",normalized:"forever"},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"},bind:{primary:"バインド",alternatives:["結びつける","bind"],normalized:"bind"},intercept:{primary:"インターセプト",alternatives:["傍受","intercept"],normalized:"intercept"},worker:{primary:"ワーカー",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["イベントソース"],normalized:"eventsource"}},tokenization:{particles:["を","に","で","から","の","が","は","も","へ","と"],boundaryStrategy:"particle"},eventHandler:{eventMarker:{primary:"で",position:"after"},temporalMarkers:["時","とき"]}}}}),sd={};dm(sd,{koreanProfile:()=>ad});var ld,cd=mm({"src/generators/profiles/korean.ts"(){ad={code:"ko",name:"Korean",nativeName:"한국어",regions:["east-asian","priority"],direction:"ltr",script:"hangul",wordOrder:"SOV",markingStrategy:"particle",usesSpaces:!0,verb:{position:"end",suffixes:["다","요","니다","세요"],subjectDrop:!0},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:"트랜지션",alternatives:["전환"],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:"패치",alternatives:["가져오기"],normalized:"fetch"},settle:{primary:"안정",normalized:"settle"},if:{primary:"만약",normalized:"if"},when:{primary:"때",normalized:"when"},where:{primary:"어디",normalized:"where"},else:{primary:"아니면",normalized:"else"},unless:{primary:"아니라면",normalized:"unless"},repeat:{primary:"반복",normalized:"repeat"},for:{primary:"각각",normalized:"for"},while:{primary:"동안",normalized:"while"},forever:{primary:"forever",normalized:"forever"},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"},matches:{primary:"일치",normalized:"matches"},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"},bind:{primary:"바인드",alternatives:["bind"],normalized:"bind"},intercept:{primary:"가로채기",alternatives:["인터셉트","intercept"],normalized:"intercept"},worker:{primary:"워커",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["이벤트소스"],normalized:"eventsource"}},tokenization:{particles:["을","를","이","가","은","는","에","에서","으로","로","와","과","도"],boundaryStrategy:"space"},eventHandler:{eventMarker:{primary:"할 때",alternatives:["할때","때","에"],position:"after"},temporalMarkers:["할 때","할때","때"]}}}}),ud={};dm(ud,{malayProfile:()=>ld});var pd,md=mm({"src/generators/profiles/ms.ts"(){ld={code:"ms",name:"Malay",nativeName:"Melayu",direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"base",verb:{position:"start",subjectDrop:!0},references:{me:"saya",it:"ia",you:"kamu",result:"hasil",event:"peristiwa",target:"sasaran",body:"badan"},possessive:{marker:"",markerPosition:"after-object",keywords:{saya:"me",saya_punya:"me",aku:"me",awak:"you",kamu:"you",anda:"you",dia:"it",ia:"it",nya:"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",alternatives:["kosong"],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","scroll"],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"},unless:{primary:"kecuali",normalized:"unless"},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"},forever:{primary:"selamanya",normalized:"forever",alternatives:["forever"]},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"},bind:{primary:"ikat",alternatives:["kaitkan","bind"],normalized:"bind"},intercept:{primary:"pintas",alternatives:["cegat","intercept"],normalized:"intercept"},worker:{primary:"pekerja",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["sumber_peristiwa"],normalized:"eventsource"}},eventHandler:{keyword:{primary:"apabila",alternatives:["ketika"],normalized:"on"},sourceMarker:{primary:"dari",position:"before"},eventMarker:{primary:"apabila",alternatives:["ketika"],position:"before"}}}}}),dd={};dm(dd,{polishProfile:()=>pd});var fd,hd=mm({"src/generators/profiles/polish.ts"(){pd={code:"pl",name:"Polish",nativeName:"Polski",direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"imperative",verb:{position:"start",subjectDrop:!0,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:!0,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","pusty"],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"},unless:{primary:"chyba",normalized:"unless"},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"},forever:{primary:"forever",normalized:"forever"},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"},resize:{primary:"zmieńrozmiar",normalized:"resize"},hover:{primary:"najechaniu",alternatives:["hover"],normalized:"hover"},submit:{primary:"wysłaniu",alternatives:["wyslaniu","submit"],normalized:"submit"},input:{primary:"wprowadzeniu",alternatives:["input","wejście"],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","żywy"],normalized:"live"},socket:{primary:"gniazdo",alternatives:["socket","websocket"],normalized:"socket"},bind:{primary:"powiąż",alternatives:["związać","bind"],normalized:"bind"},intercept:{primary:"przechwyć",alternatives:["przechwytuj","intercept"],normalized:"intercept"},worker:{primary:"pracownik",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["źródło-zdarzeń"],normalized:"eventsource"}},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","gdy"],position:"before"},temporalMarkers:["kiedy","gdy","przy"]}}}}),yd={};dm(yd,{portugueseProfile:()=>fd});var vd,gd=mm({"src/generators/profiles/portuguese.ts"(){fd={code:"pt",name:"Portuguese",nativeName:"Português",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,verb:{position:"start",subjectDrop:!0},references:{me:"eu",it:"ele",you:"você",result:"resultado",event:"evento",target:"alvo",body:"corpo"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:!0,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",alternatives:["vazio"],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"},unless:{primary:"salvo",alternatives:["a_menos"],normalized:"unless"},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"},forever:{primary:"forever",normalized:"forever"},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"},resize:{primary:"redimensionar",normalized:"resize"},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"},mousedown:{primary:"mouseBaixo",normalized:"mousedown"},mouseup:{primary:"mouseCima",normalized:"mouseup"},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"},bind:{primary:"vincular",alternatives:["ligar","bind"],normalized:"bind"},intercept:{primary:"interceptar",alternatives:["intercept"],normalized:"intercept"},worker:{primary:"trabalhador",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["fonte-de-eventos"],normalized:"eventsource"}},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","em"],position:"before"},temporalMarkers:["quando","ao"]}}}}),kd={};dm(kd,{quechuaProfile:()=>vd});var bd,wd=mm({"src/generators/profiles/quechua.ts"(){vd={code:"qu",name:"Quechua",nativeName:"Runasimi",direction:"ltr",script:"latin",wordOrder:"SOV",markingStrategy:"postposition",usesSpaces:!0,verb:{position:"end",subjectDrop:!0},references:{me:"noqa",it:"chay",you:"qam",result:"rurasqa",event:"ruwakuq",target:"punta",body:"kurku"},possessive:{marker:"-pa",markerPosition:"after-object",keywords:{"ñuqapa":"me","ñuqaypa":"me",noqaq:"me",qampa:"you",paypa:"it",chay:"it"},connectors:["paq","pa"]},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"},unless:{primary:"mana sichus",normalized:"unless"},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"},forever:{primary:"forever",normalized:"forever"},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:"ñawpaq_kaq",alternatives:["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"},bind:{primary:"bind",alternatives:["watachiy"],normalized:"bind"},intercept:{primary:"hark'ay",alternatives:["intercept"],normalized:"intercept"},worker:{primary:"llamk'aq",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["kawsay-pukyu"],normalized:"eventsource"}},eventHandler:{keyword:{primary:"pi",alternatives:["kaqtin"]},sourceMarker:{primary:"manta",position:"after"},eventMarker:{primary:"pi",alternatives:["kaqtin","kaqpi"],position:"after"}}}}}),zd={};dm(zd,{russianProfile:()=>bd});var xd,Ed=mm({"src/generators/profiles/russian.ts"(){bd={code:"ru",name:"Russian",nativeName:"Русский",direction:"ltr",script:"cyrillic",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:!0,suffixes:["ть","ться","ить","иться","ать","аться","еть","еться"]},references:{me:"я",it:"это",you:"ты",result:"результат",event:"событие",target:"цель",body:"тело"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:!0,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:"опустошить",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:"клик",alternatives:["клике","нажатии"],normalized:"click"},hover:{primary:"наведении",alternatives:["наведение"],normalized:"hover"},submit:{primary:"отправке",alternatives:["отправка"],normalized:"submit"},input:{primary:"вводе",alternatives:["ввод"],normalized:"input"},change:{primary:"изменении",alternatives:["изменение"],normalized:"change"},load:{primary:"загрузка",alternatives:["загрузке"],normalized:"load"},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"},unless:{primary:"кроме",normalized:"unless"},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"},forever:{primary:"всегда",normalized:"forever",alternatives:["forever"]},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"},matches:{primary:"соответствует",normalized:"matches"},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","socket"],normalized:"socket"},bind:{primary:"привязать",alternatives:["связать","bind"],normalized:"bind"},intercept:{primary:"перехватить",alternatives:["перехвати","intercept"],normalized:"intercept"},worker:{primary:"рабочий",alternatives:["воркер","worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["источник-событий"],normalized:"eventsource"}},eventHandler:{keyword:{primary:"при",normalized:"on"},sourceMarker:{primary:"на",alternatives:["в","при"],position:"before"},eventMarker:{primary:"при",position:"before"},temporalMarkers:["когда","если"]}}}}),Td={};dm(Td,{swahiliProfile:()=>xd});var Sd,Cd=mm({"src/generators/profiles/swahili.ts"(){xd={code:"sw",name:"Swahili",nativeName:"Kiswahili",direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,verb:{position:"start",subjectDrop:!0},references:{me:"mimi",it:"hiyo",you:"wewe",result:"matokeo",event:"tukio",target:"lengo",body:"mwili"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:!0,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","mpito"],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","tupu"],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"},unless:{primary:"isipokuwa",normalized:"unless"},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"},forever:{primary:"forever",normalized:"forever"},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"},is:{primary:"ni",normalized:"is"},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",alternatives:["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"},bind:{primary:"ambatisha",alternatives:["funganisha","bind"],normalized:"bind"},intercept:{primary:"zuia",alternatives:["nasa","intercept"],normalized:"intercept"},worker:{primary:"mfanyakazi",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["chanzo-matukio"],normalized:"eventsource"}},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"}}}}}),Ad={};dm(Ad,{thaiProfile:()=>Sd});var Ld,jd=mm({"src/generators/profiles/thai.ts"(){Sd={code:"th",name:"Thai",nativeName:"ไทย",direction:"ltr",script:"thai",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!1,defaultVerbForm:"base",verb:{position:"second",subjectDrop:!0},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"}},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"},unless:{primary:"unless",normalized:"unless"},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"},forever:{primary:"ตลอดไป",normalized:"forever",alternatives:["forever"]},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","เว็บซ็อกเก็ต","socket"],normalized:"socket"},intercept:{primary:"ดักจับ",alternatives:["intercept","สกัดกั้น"],normalized:"intercept"},worker:{primary:"เวิร์กเกอร์",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["อีเวนต์ซอร์ส"],normalized:"eventsource"},bind:{primary:"ผูก",alternatives:["bind"],normalized:"bind"}},tokenization:{boundaryStrategy:"character"},eventHandler:{keyword:{primary:"เมื่อ",alternatives:["ตอน"],normalized:"on"},sourceMarker:{primary:"จาก",position:"before"},eventMarker:{primary:"เมื่อ",alternatives:["ตอน"],position:"before"},temporalMarkers:["เมื่อ","ตอน"]}}}}),Pd={};dm(Pd,{tagalogProfile:()=>Ld});var Od,Nd=mm({"src/generators/profiles/tl.ts"(){Ld={code:"tl",name:"Tagalog",nativeName:"Tagalog",direction:"ltr",script:"latin",wordOrder:"VSO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"base",verb:{position:"start",subjectDrop:!0},references:{me:"ako",it:"ito",you:"ikaw",result:"resulta",event:"pangyayari",target:"target",body:"katawan"},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",alternatives:["bago","matapos"],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","walang_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","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"},unless:{primary:"maliban_kung",normalized:"unless"},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"},forever:{primary:"magpakailanman",normalized:"forever",alternatives:["forever"]},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",alternatives:["sabay"],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"},worker:{primary:"worker",alternatives:["manggagawa"],normalized:"worker"},eventsource:{primary:"eventsource",normalized:"eventsource"},intercept:{primary:"intercept",alternatives:["harangin","humarang"],normalized:"intercept"},bind:{primary:"itali",alternatives:["iugnay","bind"],normalized:"bind"}},eventHandler:{keyword:{primary:"kapag",normalized:"on"},sourceMarker:{primary:"mula_sa",alternatives:["galing_sa"],position:"before"},eventMarker:{primary:"kapag",position:"before"}}}}}),Id={};dm(Id,{turkishProfile:()=>Od});var Rd,Md=mm({"src/generators/profiles/turkish.ts"(){Od={code:"tr",name:"Turkish",nativeName:"Türkçe",regions:["priority"],direction:"ltr",script:"latin",wordOrder:"SOV",markingStrategy:"case-suffix",usesSpaces:!0,markersOptional:!0,verb:{position:"end",suffixes:["mek","mak","yor","di","miş"],subjectDrop:!0},references:{me:"ben",it:"o",you:"sen",result:"sonuç",event:"olay",target:"hedef",body:"gövde"},possessive:{marker:"ın",markerPosition:"after-object",usePossessiveAdjectives:!0,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","boş"],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"},load:{primary:"yükle",normalized:"load"},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"},unless:{primary:"değilse",normalized:"unless"},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"},forever:{primary:"forever",normalized:"forever"},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:"kur",alternatives:["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"},bind:{primary:"bind",normalized:"bind"},intercept:{primary:"yakala",alternatives:["araya-gir","intercept"],normalized:"intercept"},worker:{primary:"işçi",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["olay-kaynağı"],normalized:"eventsource"}},eventHandler:{eventMarker:{primary:"da",alternatives:["de","ta","te"],position:"after"},temporalMarkers:["dığında","diğinde"]}}}}),Wd={};dm(Wd,{ukrainianProfile:()=>Rd});var _d,qd=mm({"src/generators/profiles/ukrainian.ts"(){Rd={code:"uk",name:"Ukrainian",nativeName:"Українська",direction:"ltr",script:"cyrillic",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:!0,suffixes:["ти","тися","ити","итися","ати","атися","іти","ітися"]},references:{me:"я",it:"це",you:"ти",result:"результат",event:"подія",target:"ціль",body:"тіло"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:!0,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:"спорожнити",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:"кліку",alternatives:["клік","натисканні"],normalized:"click"},hover:{primary:"наведенні",alternatives:["наведення"],normalized:"hover"},submit:{primary:"відправці",alternatives:["відправка","надсилання"],normalized:"submit"},input:{primary:"введенні",alternatives:["введення"],normalized:"input"},change:{primary:"зміні",alternatives:["зміна"],normalized:"change"},load:{primary:"завантаження",normalized:"load"},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"},unless:{primary:"крім",normalized:"unless"},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"},forever:{primary:"завжди",normalized:"forever",alternatives:["forever"]},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"},matches:{primary:"відповідає",normalized:"matches"},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","socket"],normalized:"socket"},bind:{primary:"прив'язати",alternatives:["зв'язати","приєднати","bind"],normalized:"bind"},intercept:{primary:"перехопити",alternatives:["перехоплення","intercept"],normalized:"intercept"},worker:{primary:"робітник",alternatives:["воркер","worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["джерело-подій"],normalized:"eventsource"}},eventHandler:{keyword:{primary:"при",normalized:"on"},sourceMarker:{primary:"на",alternatives:["в","при"],position:"before"},eventMarker:{primary:"при",position:"before"},temporalMarkers:["коли","якщо"]}}}}),$d={};dm($d,{vietnameseProfile:()=>_d});var Vd,Dd=mm({"src/generators/profiles/vietnamese.ts"(){_d={code:"vi",name:"Vietnamese",nativeName:"Tiếng Việt",direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!0,defaultVerbForm:"base",verb:{position:"start",subjectDrop:!0},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",my:"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",alternatives:["trố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","chờ đợi"],normalized:"wait"},fetch:{primary:"tải",normalized:"fetch"},settle:{primary:"ổn định",normalized:"settle"},if:{primary:"nếu",normalized:"if"},unless:{primary:"trừ khi",alternatives:["trừ_khi"],normalized:"unless"},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"},forever:{primary:"mãi mãi",normalized:"forever",alternatives:["forever"]},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",alternatives:["thoát ra"],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","live"],normalized:"live"},socket:{primary:"socket",alternatives:["ổ-cắm","websocket"],normalized:"socket"},bind:{primary:"ràng buộc",alternatives:["liên kết","bind"],normalized:"bind"},intercept:{primary:"chặn",alternatives:["chặn bắt","intercept"],normalized:"intercept"},worker:{primary:"worker",alternatives:["công nhân"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["nguồn sự kiện"],normalized:"eventsource"}},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"]}}}}),Bd={};dm(Bd,{chineseProfile:()=>Vd});var Hd,Fd,Kd,Ud=mm({"src/generators/profiles/chinese.ts"(){Vd={code:"zh",name:"Chinese",nativeName:"中文",regions:["east-asian","priority"],direction:"ltr",script:"cjk",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:!1,verb:{position:"second",subjectDrop:!0},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:"清空",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:"提交",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"},unless:{primary:"除非",normalized:"unless"},when:{primary:"何时",normalized:"when"},where:{primary:"哪里",normalized:"where"},else:{primary:"否则",normalized:"else"},matches:{primary:"匹配",normalized:"matches"},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","socket"],normalized:"socket"},bind:{primary:"绑定",alternatives:["bind"],normalized:"bind"},intercept:{primary:"拦截",alternatives:["intercept"],normalized:"intercept"},worker:{primary:"工作线程",alternatives:["工作者","worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["事件源"],normalized:"eventsource"}},tokenization:{boundaryStrategy:"character"},eventHandler:{keyword:{primary:"当",alternatives:["在...时"],normalized:"on"},sourceMarker:{primary:"从",position:"before"},eventMarker:{primary:"当",alternatives:["在"],position:"before"},temporalMarkers:["当","在...时"]}}}});function Gd(e,t){return e.replace(/\{(\w+)\}/g,(e,r)=>(t[r]??`{${r}}`)+"")}function Yd(e,t,r={},n){const i=Gd(Fd[e],r),a=Kd[e],o=a?Gd(a,r):void 0;return{code:e,message:i,severity:t,...n&&{role:n},...o&&{suggestion:o}}}var Zd,Jd,Xd=mm({"src/generators/schema-error-codes.ts"(){Hd={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"},Fd={[Hd.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[Hd.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[Hd.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[Hd.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[Hd.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[Hd.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.",[Hd.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.",[Hd.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[Hd.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[Hd.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[Hd.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[Hd.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[Hd.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[Hd.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[Hd.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[Hd.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[Hd.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},Kd={[Hd.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[Hd.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[Hd.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[Hd.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[Hd.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[Hd.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[Hd.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[Hd.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[Hd.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[Hd.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[Hd.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[Hd.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[Hd.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[Hd.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."}}}),Qd={};function ef(e){const t=[];for(const r of e.roles)r.expectedTypes.includes("literal")&&r.expectedTypes.includes("selector")&&("patient"===r.role&&Zd.has(e.action)?t.push(Yd(Hd.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:r.role,command:e.action},r.role)):t.push(Yd(Hd.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:r.role},r.role))),r.expectedTypes.length>3&&!Zd.has(e.action)&&t.push(Yd(Hd.TOO_MANY_EXPECTED_TYPES,"warning",{role:r.role,count:r.expectedTypes.length},r.role));for(const r of e.roles)r.selectorKinds&&r.selectorKinds.length>0&&(r.expectedTypes.includes("selector")||t.push(Yd(Hd.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:r.role},r.role)));switch(e.action){case"transition":!function(e,t){const r=e.roles.find(e=>"patient"===e.role),n=e.roles.find(e=>"goal"===e.role);r&&!n&&t.push(Yd(Hd.TRANSITION_MISSING_GOAL,"error",{}))}(e,t);break;case"on":!function(e,t){const r=e.roles.find(e=>"event"===e.role);r||t.push(Yd(Hd.EVENT_HANDLER_MISSING_EVENT,"warning",{}));r&&!r.required&&t.push(Yd(Hd.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}))}(e,t);break;case"if":case"unless":!function(e,t){const r=e.roles.find(e=>"condition"===e.role);r||t.push(Yd(Hd.CONDITIONAL_MISSING_CONDITION,"warning",{}));r&&!r.required&&t.push(Yd(Hd.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}))}(e,t);break;case"repeat":case"for":case"while":!function(e,t){if("for"===e.action){e.roles.find(e=>"source"===e.role)||t.push(Yd(Hd.FOR_LOOP_MISSING_SOURCE,"warning",{}))}else if("while"===e.action){e.roles.find(e=>"condition"===e.role)||t.push(Yd(Hd.WHILE_LOOP_MISSING_CONDITION,"warning",{}))}}(e,t)}return 0===e.roles.filter(e=>e.required).length&&(Jd.has(e.action)?t.push(Yd(Hd.NO_REQUIRED_ROLES_EXPECTED,"note",{command:e.action})):t.push(Yd(Hd.NO_REQUIRED_ROLES,"warning",{}))),function(e,t){return{action:e,items:t}}(e.action,t)}function tf(e,t={}){const r=new Map,{includeNotes:n=!1}=t;for(const[t,i]of Object.entries(e)){const e=ef(i),a=e.items.some(e=>"warning"===e.severity||"error"===e.severity),o=n&&e.items.some(e=>"note"===e.severity);(a||o)&&r.set(t,e)}return r}function rf(e,t={}){const r=[],{showNotes:n=!1,showCodes:i=!0}=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){r.push(` ❌ ${t}:`);for(const t of e){r.push(` ERROR${i?` [${t.code}]`:""}: ${t.message}`),t.suggestion&&r.push(" 💡 Suggestion: "+t.suggestion)}}if(o.length>0){r.push(` ⚠️ ${t}:`);for(const e of o){r.push(` ${(i?` [${e.code}]`:"")?e.code+": ":""}${e.message}`),e.suggestion&&r.push(" 💡 "+e.suggestion)}}if(n&&s.length>0){r.push(` ℹ️ ${t}:`);for(const e of s){r.push(` ${(i?` [${e.code}]`:"")?e.code+": ":""}${e.message}`)}}}return r.join("\n")}function nf(e){let t=0,r=0,n=0;const i={};for(const a of e.values())for(const e of a.items)"error"===e.severity?t++:"warning"===e.severity?r++:"note"===e.severity&&n++,i[e.code]=(i[e.code]||0)+1;return{totalCommands:e.size,errors:t,warnings:r,notes:n,byCode:i}}function af(e,t){const r=[];for(const n of t){const t=e.roles.find(e=>e.role===n.role);t&&(t.expectedTypes.length>0&&!t.expectedTypes.includes(n.type)&&(t.expectedTypes.includes("expression")||r.push({level:"error",role:n.role,message:`${e.action}.${n.role} expects type [${t.expectedTypes.join(", ")}], got '${n.type}'`,code:Hd.VALUE_TYPE_MISMATCH})),"selector"===n.type&&n.selectorKind&&t.selectorKinds&&t.selectorKinds.length>0&&(t.selectorKinds.includes(n.selectorKind)||r.push({level:"error",role:n.role,message:`${e.action}.${n.role} expects selector kind [${t.selectorKinds.join(", ")}], got '${n.selectorKind}'`,code:Hd.SELECTOR_KIND_MISMATCH})))}return r}function of(e){const t=[];if(!e.keywords)return{language:e.code,collisions:t};const r=new Map;for(const[t,n]of Object.entries(e.keywords)){if(!n||!n.primary)continue;const e=r.get(n.primary)||[];if(e.push({command:t,isPrimary:!0}),r.set(n.primary,e),n.alternatives)for(const e of n.alternatives){const n=r.get(e)||[];n.push({command:t,isPrimary:!1}),r.set(e,n)}}for(const[e,n]of r){const r=[...new Set(n.map(e=>e.command))];if(1>=r.length)continue;const i=n.filter(e=>e.isPrimary).length;let a;a=2>i?1===i?"primary-alternative":"alternative-alternative":"primary-primary",t.push({keyword:e,commands:r.sort(),type:a})}const n={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return t.sort((e,t)=>n[e.type]-n[t.type]),{language:e.code,collisions:t}}function sf(e){const t=[];for(const[,r]of Object.entries(e)){const e=of(r);e.collisions.length>0&&t.push(e)}return t.sort((e,t)=>e.language.localeCompare(t.language))}dm(Qd,{SchemaErrorCodes:()=>Hd,formatValidationResults:()=>rf,getValidationStats:()=>nf,validateAllKeywordCollisions:()=>sf,validateAllSchemas:()=>tf,validateCommandSchema:()=>ef,validateKeywordCollisions:()=>of,validateRoleValues:()=>af});var lf,cf,uf,pf,mf,df,ff,hf,yf,vf,gf,kf,bf,wf,zf,xf,Ef,Tf=mm({"src/generators/schema-validator.ts"(){Xd(),Zd=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),Jd=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 Sf(e){const t=e.roles.find(e=>"destination"===e.role);return t?{destination:t.default?{fromRole:"destination",default:t.default}:{fromRole:"destination"}}:{}}function Cf(e){const t=e.roles.find(e=>"source"===e.role);return t?{source:t.default?{fromRole:"source",default:t.default}:{fromRole:"source"}}:{}}function Af(e,t){return jf(e,t,"source")}function Lf(e,t){return jf(e,t,"destination")}function jf(e,t,r){if(!t||!e.roles.some(e=>e.role===r))return[];const n=t.alternatives?{type:"literal",value:t.primary,alternatives:[...t.alternatives]}:{type:"literal",value:t.primary},i={type:"role",role:r,optional:!0};return[{type:"group",optional:!0,tokens:"after"===t.position?[i,n]:[n,i]}]}function Pf(e){return Ef[e]}function Of(){return Object.values(Ef).filter(e=>e.roles.length>0||!0===e.bareKeyword)}var Nf,If,Rf=mm({"src/generators/command-schemas.ts"(){Ef={toggle:lf={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:!0,expectedTypes:["selector"],selectorKinds:["class","attribute"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:!1,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerVariants:{ko:["에서"]}}],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:cf={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:!0,expectedTypes:["selector","literal"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:!1,expectedTypes:["selector","reference","expression"],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:uf={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",targetRole:"source",roles:[{role:"patient",description:"The class/attribute to remove, or the element to remove",required:!0,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:!1,expectedTypes:["selector","reference","expression"],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:pf={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:!0,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:!0,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:mf={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:!0,expectedTypes:["selector","reference","expression","property-path"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ja:"を",ko:"를",tr:"i",ar:"",sw:"",tl:"",bn:"কে",qu:"ta",hi:"को"}},{role:"patient",description:"The value to set",required:!0,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",hi:"में"},markerVariants:{tr:["e","a","ye","ya"]}},{role:"scope",description:"The element(s) the attribute/property is set on (defaults to me)",required:!1,expectedTypes:["selector","reference"],svoPosition:3,sovPosition:3,markerOverride:{en:"on",es:"on",pt:"on",fr:"on",de:"on",it:"on",id:"on",ms:"on",sw:"on",tl:"on",zh:"on",vi:"on",ru:"on",uk:"on",pl:"on",th:"on",he:"on",ar:"on",ja:"on",ko:"on",tr:"on",hi:"on",bn:"on",qu:"on"}}],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:df={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to show",required:!0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:!1,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},hide:ff={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to hide",required:!0,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:!1,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},on:hf={action:"on",description:"Handle an event",category:"event",primaryRole:"event",hasBody:!0,roles:[{role:"event",description:"The event to handle",required:!0,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to listen on (defaults to me)",required:!1,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},trigger:yf={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:!0,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:!1,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},wait:vf={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"duration",roles:[{role:"duration",description:"Duration or event to wait for",required:!0,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},fetch:gf={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",roles:[{role:"source",description:"The URL to fetch from",required:!0,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,renderOverride:{en:""}},{role:"responseType",description:"Response format (json, text, html, blob, etc.)",required:!1,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"as"}},{role:"method",description:"HTTP method (GET, POST, etc.)",required:!1,expectedTypes:["literal"],svoPosition:3,sovPosition:3},{role:"destination",description:"Where to store the result",required:!1,expectedTypes:["selector","reference"],svoPosition:4,sovPosition:4}]},increment:kf={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to increment",required:!0,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:!1,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by",es:"por",pt:"por",fr:"par",de:"um"}}]},decrement:bf={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to decrement",required:!0,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:!1,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by",es:"por",pt:"por",fr:"par",de:"um"}}]},append:wf={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to append",required:!0,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:!0,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},prepend:zf={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to prepend",required:!0,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:!0,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:!0,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:!0,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",ja:"を",zh:"",ko:"를",ar:"على",tr:"i",id:"",he:"את",sw:"",tl:"",bn:"কে",qu:"ta"}},{role:"destination",description:"Where to store the result (optional)",required:!1,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:!0,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to take from (defaults to me)",required:!1,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:!0,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:!1,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:!1,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:!0,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:!0,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:!1,expectedTypes:["selector","reference","expression"],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:!0,roles:[{role:"condition",description:"The condition to evaluate",required:!0,expectedTypes:["expression","reference","selector"],svoPosition:1,sovPosition:1}]},unless:{action:"unless",description:"Negated conditional execution (executes when condition is false)",category:"control-flow",primaryRole:"condition",hasBody:!0,roles:[{role:"condition",description:"The condition to evaluate (body executes when false)",required:!0,expectedTypes:["expression","reference","selector"],svoPosition:1,sovPosition:1}]},else:{action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:!0,roles:[]},repeat:{action:"repeat",description:"Repeat a block of commands",category:"control-flow",primaryRole:"loopType",hasBody:!0,roles:[{role:"loopType",description:"Loop variant: forever, times, for, while, until, until-event",required:!0,expectedTypes:["literal"],svoPosition:0,sovPosition:0},{role:"quantity",description:"Number of times to repeat",required:!1,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"event",description:"Event to wait for (terminates loop)",required:!1,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"source",description:"Element to listen for event on",required:!1,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:!0,roles:[{role:"patient",description:"The iteration variable",required:!0,expectedTypes:["reference","expression"],svoPosition:1,sovPosition:2},{role:"source",description:"The collection to iterate over",required:!0,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"in",es:"en",fr:"en",de:"in",it:"in",pt:"dentro",id:"dalam",ms:"dalam",pl:"w",ru:"в",uk:"у",sw:"ndani",th:"ใน",vi:"trong",ar:"في",tl:"sa_loob",he:"in",zh:"在"}}]},while:{action:"while",description:"Loop while condition is true",category:"control-flow",primaryRole:"condition",hasBody:!0,roles:[{role:"condition",description:"The condition to check",required:!0,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:!0,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"},renderOverride:{en:""},markerOptional:{en:!0},markerVariants:{he:["את"],zh:["把"]}}]},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:!0,expectedTypes:["selector","reference","expression"],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:!0,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:xf={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:!0,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:xf}]},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:!0,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",omitRoleVariants:["goal"],roles:[{role:"patient",description:"The property to transition (opacity, *background-color, etc.)",required:!0,expectedTypes:["literal","expression","selector"],svoPosition:1,sovPosition:2,markerOverride:{en:"",ar:"",tl:"",sw:""}},{role:"goal",description:"The target value to transition to",required:!0,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:3,markerOverride:{en:"to",ar:"إلى",tl:"sa",sw:"kwa",bn:"তে",qu:"man",es:"a",pt:"para",fr:"à",de:"zu",he:"על",it:"in",ja:"に",ko:"에",ms:"ke",pl:"do",ru:"в",th:"ใน",tr:"e",uk:"в",vi:"vào",zh:"到",id:"ke"}},{role:"destination",description:"The target element (defaults to me)",required:!1,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:3,sovPosition:1},{role:"duration",description:"Transition duration (over 500ms, for 2 seconds)",required:!1,expectedTypes:["literal"],svoPosition:4,sovPosition:4,markerOverride:{en:"over"}},{role:"style",description:"Easing function (ease-in, linear, etc.)",required:!1,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:!0,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"destination",description:"Where to put the clone",required:!1,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:!1,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:!1,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:!1,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:!1,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2},{role:"style",description:"Open-mode variant (modal / non-modal) for <dialog>",required:!1,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:!1,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:!1,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:!1,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:!1,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:[],bareKeyword:!0},call:{action:"call",description:"Call a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The function to call",required:!0,expectedTypes:["expression","reference"],markerOptional:{he:!0,zh:!0},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:!1,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},js:{action:"js",description:"Execute raw JavaScript code",category:"control-flow",primaryRole:"patient",hasBody:!0,roles:[{role:"patient",description:"The JavaScript code to execute",required:!1,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},async:{action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:!0,roles:[]},tell:{action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",hasBody:!0,roles:[{role:"destination",description:"The element to tell",required:!0,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"",he:"את",zh:"把"}}]},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:!0,expectedTypes:["selector","reference","expression","property-path"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ar:"",tl:"",sw:"",bn:"কে",qu:"ta",ja:"を",ko:"를",tr:"i",hi:"को",de:"",es:"",fr:"",it:"",pt:"",pl:"",ru:"",uk:"",vi:"",id:"",ms:"",th:"",zh:"把",he:"את"}},{role:"patient",description:"The default value",required:!0,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",ar:"إلى",tl:"sa",sw:"kwa",bn:"তে",qu:"man",ja:"に",ko:"에",tr:"e",hi:"में",de:"zu",es:"a",fr:"à",it:"in",pt:"para",pl:"do",ru:"в",uk:"в",vi:"vào",id:"ke",ms:"ke",th:"ใน",zh:"到",he:"על"}}]},init:{action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:!0,roles:[]},behavior:{action:"behavior",description:"Define a reusable behavior",category:"control-flow",primaryRole:"patient",hasBody:!0,roles:[{role:"patient",description:"The behavior name (PascalCase identifier)",required:!0,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:!0,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"Element to install on (defaults to me)",required:!1,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:!1,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"source",description:"Element to measure (defaults to me)",required:!1,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:!1,expectedTypes:["literal"],svoPosition:1,sovPosition:3,markerOverride:{en:""}},{role:"destination",description:"The element to swap content in/for",required:!0,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"of",es:"",fr:"",pt:"",it:"",de:"",pl:"",ru:"",uk:"",id:"",ms:"",sw:"",th:"",vi:"",he:"את",zh:"把"}},{role:"patient",description:"The content to swap in (optional for delete)",required:!1,expectedTypes:["literal","expression","selector"],svoPosition:3,sovPosition:2,markerOverride:{en:"with",es:"con",fr:"avec",pt:"com",it:"con",de:"mit",pl:"z",ru:"с",uk:"з",id:"dengan",ms:"dengan",sw:"na",th:"ด้วย",vi:"với",he:"עם",zh:"用"}}]},morph:{action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to morph",required:!0,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}},{role:"destination",description:"The target content/element to morph into",required:!0,expectedTypes:["literal","expression","selector","reference"],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:!1,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:!0,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:[],bareKeyword:!0},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:!0,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1},{role:"source",description:'The array to pick from (with "from" keyword)',required:!1,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:!0,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"style",description:"Variables to pass to the template (with keyword)",required:!1,expectedTypes:["expression","reference"],svoPosition:2,sovPosition:1}]},bind:{action:"bind",description:"Reactively bind a variable to an element or property value",category:"variable",primaryRole:"destination",roles:[{role:"destination",description:"The variable to bind",required:!0,expectedTypes:["reference","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",it:"",id:"",ms:"",vi:"",ru:"",uk:"",pl:"",th:"",zh:"",he:"",ar:"",sw:"",tl:"",ja:"を",ko:"를",tr:"i",bn:"কে",qu:"ta",hi:"को"}},{role:"source",description:"The element or property to bind to",required:!0,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"à",de:"zu",it:"in",id:"ke",ms:"ke",vi:"vào",ru:"в",uk:"в",pl:"do",ja:"に",ko:"에",tr:"e",ar:"إلى",zh:"到",he:"ל",sw:"kwa",th:"ใน",tl:"sa",bn:"তে",qu:"man",hi:"में"}}],errorCodes:["MISSING_TARGET","MISSING_VALUE","INVALID_SYNTAX"],recoveryHints:{MISSING_TARGET:"Add a variable to bind: bind $name to #input",MISSING_VALUE:'Add "to <element>" to specify the binding source',INVALID_SYNTAX:"Use syntax: bind <variable> to <element>"}},live:{action:"live",description:"Reactive block: re-run the body when its dependencies change",category:"control-flow",primaryRole:"patient",hasBody:!0,bareKeyword:!0,roles:[]},eventsource:{action:"eventsource",description:"Open a Server-Sent Events stream and handle its events",category:"async",primaryRole:"patient",hasBody:!0,bareKeyword:!0,roles:[]},socket:{action:"socket",description:"Open a WebSocket and handle its messages",category:"async",primaryRole:"patient",hasBody:!0,bareKeyword:!0,roles:[]},worker:{action:"worker",description:"Define a Web Worker with inline methods",category:"async",primaryRole:"patient",hasBody:!0,bareKeyword:!0,roles:[]},intercept:{action:"intercept",description:"Service-worker fetch interception / caching strategies",category:"async",primaryRole:"patient",hasBody:!0,bareKeyword:!0,roles:[]},compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:!0,roles:[]}},"undefined"!=typeof process&&"production"!==process.env.NODE_ENV&&Promise.resolve().then(()=>(Tf(),Qd)).then(({validateAllSchemas:e})=>{e(Ef)}).catch(e=>{})}});function Mf(e,t,r,n){const i=If.find(t=>t.lang===e);if(!i)return!1;const a=(e,t)=>(e??"").toLowerCase()===t.toLowerCase();return a(t,i.end)&&a(r,i.at)&&a(n,i.of)}function Wf(){const e=(e,t)=>({id:"put-tr-"+e,language:"tr",command:"put",priority:105,template:{format:`{patient} ${t} {destination} i koy`,tokens:[{type:"role",role:"patient"},{type:"literal",value:t},{type:"role",role:"destination"},{type:"group",optional:!0,tokens:[{type:"literal",value:"i",alternatives:["ı","u","ü","yi","yı","yu","yü"]}]},{type:"literal",value:"koy",alternatives:["koymak"]}]},extraction:{patient:{position:0},destination:{position:2},manner:{default:{type:"literal",value:e}}}});return[e("before","önce"),e("after","sonra")]}function _f(e){const t=function(e){const t=Nf.find(t=>t.lang===e);return t?["before","after"].map(e=>{const r=t[e],n=[t.verbAlts?{type:"literal",value:t.verb,alternatives:t.verbAlts}:{type:"literal",value:t.verb}];return t.patientPrefix&&n.push(t.patientPrefixOptional?{type:"group",optional:!0,tokens:[{type:"literal",value:t.patientPrefix}]}:{type:"literal",value:t.patientPrefix}),n.push({type:"role",role:"patient"},{type:"literal",value:r},{type:"role",role:"destination"}),{id:`put-${t.lang}-${e}`,language:t.lang,command:"put",priority:95,template:{format:`${t.verb} {patient} ${r} {destination}`,tokens:n},extraction:{patient:{position:t.patientPrefix&&!t.patientPrefixOptional?2:1},destination:{marker:r},manner:{default:{type:"literal",value:e}}}}}):[]}(e),r=function(e){const t=If.find(t=>t.lang===e);if(!t)return[];const r=[],n=t.verbAlts?{type:"literal",value:t.verb,alternatives:t.verbAlts}:{type:"literal",value:t.verb},i=e=>{r.push({type:"literal",value:e})};return t.sov?(r.push({type:"role",role:"patient"}),i(t.at),i(t.end),i(t.of),r.push({type:"role",role:"destination"}),t.objMarker&&r.push({type:"literal",value:t.objMarker}),r.push(n)):(r.push(n),t.patientPrefix&&r.push({type:"literal",value:t.patientPrefix}),r.push({type:"role",role:"patient"}),i(t.at),i(t.end),i(t.of),r.push({type:"role",role:"destination"})),[{id:`put-${t.lang}-at-end`,language:t.lang,command:"put",priority:110,template:{format:`put {patient} ${t.at} ${t.end} ${t.of} {destination}`,tokens:r},extraction:{manner:{default:{type:"literal",value:"at end of"}}}}]}(e);switch(e){case"bn":return[{id:"put-bn-before",language:"bn",command:"put",priority:105,template:{format:"{patient} before {destination} কে রাখুন",tokens:[{type:"role",role:"patient"},{type:"literal",value:"before"},{type:"role",role:"destination"},{type:"literal",value:"কে"},{type:"literal",value:"রাখুন",alternatives:["রাখ"]}]},extraction:{patient:{position:0},destination:{marker:"before"},manner:{default:{type:"literal",value:"before"}}}},{id:"put-bn-after",language:"bn",command:"put",priority:105,template:{format:"{patient} after {destination} কে রাখুন",tokens:[{type:"role",role:"patient"},{type:"literal",value:"after"},{type:"role",role:"destination"},{type:"literal",value:"কে"},{type:"literal",value:"রাখুন",alternatives:["রাখ"]}]},extraction:{patient:{position:0},destination:{marker:"after"},manner:{default:{type:"literal",value:"after"}}}},{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}}},...r];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"}}}},{id:"put-en-at-end",language:"en",command:"put",priority:96,template:{format:"put {patient} at end of {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"at"},{type:"literal",value:"end"},{type:"literal",value:"of"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{position:5},manner:{default:{type:"literal",value:"at end of"}}}},{id:"put-en-at-start",language:"en",command:"put",priority:96,template:{format:"put {patient} at start of {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"at"},{type:"literal",value:"start"},{type:"literal",value:"of"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{position:5},manner:{default:{type:"literal",value:"at start of"}}}}];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"}}}},...r];case"hi":return[{id:"put-hi-before",language:"hi",command:"put",priority:106,template:{format:"{patient} before {destination} को रखें",tokens:[{type:"role",role:"patient"},{type:"literal",value:"before"},{type:"role",role:"destination"},{type:"literal",value:"को"},{type:"literal",value:"रखें",alternatives:["रख","डालें","डाल"]}]},extraction:{patient:{position:0},destination:{marker:"before"},manner:{default:{type:"literal",value:"before"}}}},{id:"put-hi-after",language:"hi",command:"put",priority:106,template:{format:"{patient} after {destination} को रखें",tokens:[{type:"role",role:"patient"},{type:"literal",value:"after"},{type:"role",role:"destination"},{type:"literal",value:"को"},{type:"literal",value:"रखें",alternatives:["रख","डालें","डाल"]}]},extraction:{patient:{position:0},destination:{marker:"after"},manner:{default:{type:"literal",value:"after"}}}},{id:"put-hi-verb-medial",language:"hi",command:"put",priority:105,template:{format:"{patient} को रखें {destination} में",tokens:[{type:"role",role:"patient"},{type:"literal",value:"को"},{type:"literal",value:"रखें",alternatives:["रख","डालें","डाल"]},{type:"role",role:"destination"},{type:"literal",value:"में"}]},extraction:{patient:{position:0},destination:{marker:"में",position:3}}},{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"}}}},...r];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}}},...t,...r];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:!0,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-before",language:"it",command:"put",priority:105,template:{format:"mettere {patient} prima {target}",tokens:[{type:"literal",value:"mettere",alternatives:["metti","inserire","put"]},{type:"role",role:"patient"},{type:"literal",value:"prima"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"prima"},manner:{default:{type:"literal",value:"before"}}}},{id:"put-it-after",language:"it",command:"put",priority:105,template:{format:"mettere {patient} dopo {target}",tokens:[{type:"literal",value:"mettere",alternatives:["metti","inserire","put"]},{type:"role",role:"patient"},{type:"literal",value:"dopo"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"dopo"},manner:{default:{type:"literal",value:"after"}}}},{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}}},...r];case"ja":return[...["before","after"].map(e=>{const t="before"===e?"前に":"後に";return{id:"put-ja-"+e,language:"ja",command:"put",priority:105,template:{format:`{patient} ${t} {destination} を 置く`,tokens:[{type:"role",role:"patient"},{type:"literal",value:t,alternatives:["before"===e?"前":"後"]},{type:"role",role:"destination"},{type:"literal",value:"を"},{type:"literal",value:"置く",alternatives:["入れる"]}]},extraction:{patient:{position:0},destination:{position:2},manner:{default:{type:"literal",value:e}}}}}),...r];case"ko":return[...["before","after"].map(e=>{const t="before"===e?"전에":"후에";return{id:"put-ko-"+e,language:"ko",command:"put",priority:105,template:{format:`{patient} ${t} {destination} 를 넣다`,tokens:[{type:"role",role:"patient"},{type:"literal",value:t},{type:"role",role:"destination"},{type:"literal",value:"를",alternatives:["을"]},{type:"literal",value:"넣다",alternatives:["넣기","놓기"]}]},extraction:{patient:{position:0},destination:{position:2},manner:{default:{type:"literal",value:e}}}}}),...r];case"tr":return[...Wf(),...r];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:!0,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:105,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:105,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"}}}},...r];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:!0,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:105,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:105,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"}}}},...r];case"qu":return[...["before","after"].map(e=>{const t="before"===e?"ñawpaqpi":"qhepapi";return{id:"put-qu-"+e,language:"qu",command:"put",priority:105,template:{format:`{patient} ${t} {destination} ta churay`,tokens:[{type:"role",role:"patient"},{type:"literal",value:t,alternatives:[e]},{type:"role",role:"destination"},{type:"group",optional:!0,tokens:[{type:"literal",value:"ta"}]},{type:"literal",value:"churay",alternatives:["tiyachiy"]}]},extraction:{patient:{position:0},destination:{position:2},manner:{default:{type:"literal",value:e}}}}}),{id:"put-qu-patient-first",language:"qu",command:"put",priority:96,template:{format:"{patient} ta {destination} man churay",tokens:[{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"role",role:"destination"},{type:"literal",value:"man"},{type:"literal",value:"churay",alternatives:["tiyachiy"]}]},extraction:{patient:{position:0},destination:{position:2}}},...r];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}}},{id:"put-th-before",language:"th",command:"put",priority:105,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:"before"}}}},{id:"put-th-after",language:"th",command:"put",priority:105,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"}}}},...r];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:!0,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"}}}},...r];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:105,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:"destination"}]},extraction:{patient:{position:1},destination:{marker:"trước",markerAlternatives:["trước khi"]},manner:{default:{type:"literal",value:"before"}}}},{id:"put-vi-after",language:"vi",command:"put",priority:105,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"]},manner:{default:{type:"literal",value:"after"}}}},...r];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:"group",optional:!0,tokens:[{type:"literal",value:"到",alternatives:["在","于","入"]}]},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{marker:"到",markerAlternatives:["在","于","入"]}}},...t,...r];default:return[...t,...r]}}var qf,$f,Vf,Df=mm({"src/patterns/put.ts"(){Nf=[{lang:"de",verb:"setzen",before:"vor",after:"nach"},{lang:"fr",verb:"mettre",before:"avant",after:"après"},{lang:"he",verb:"שים",patientPrefix:"את",before:"לפני",after:"אחרי"},{lang:"id",verb:"taruh",verbAlts:["letakkan","masukkan","tempatkan"],before:"sebelum",after:"setelah"},{lang:"ms",verb:"letak",before:"sebelum",after:"selepas"},{lang:"pt",verb:"colocar",before:"antes",after:"depois"},{lang:"sw",verb:"weka",before:"kabla",after:"baada"},{lang:"zh",verb:"放置",verbAlts:["放","放入"],patientPrefix:"把",patientPrefixOptional:!0,before:"之前",after:"之后"}],If=[{lang:"es",verb:"poner",verbAlts:["pon","colocar","put"],at:"en",end:"fin",of:"de"},{lang:"fr",verb:"mettre",at:"à",end:"fin",of:"de"},{lang:"pt",verb:"colocar",at:"em",end:"fim",of:"de"},{lang:"it",verb:"mettere",at:"a",end:"fine",of:"di"},{lang:"de",verb:"setzen",at:"bei",end:"ende",of:"von"},{lang:"sw",verb:"weka",at:"katika",end:"mwisho",of:"ya"},{lang:"id",verb:"taruh",verbAlts:["letakkan","masukkan","tempatkan"],at:"di",end:"akhir",of:"dari"},{lang:"ms",verb:"letak",at:"di",end:"tamat",of:"daripada"},{lang:"vi",verb:"đặt",at:"tại",end:"kết thúc",of:"của"},{lang:"pl",verb:"umieść",at:"przy",end:"koniec",of:"z"},{lang:"ru",verb:"положить",at:"у",end:"конец",of:"из"},{lang:"uk",verb:"покласти",at:"в",end:"кінець",of:"з"},{lang:"th",verb:"ใส่",at:"ที่",end:"จบ",of:"ของ"},{lang:"tl",verb:"ilagay",at:"sa",end:"wakas",of:"ng"},{lang:"ar",verb:"ضع",at:"عند",end:"النهاية",of:"من"},{lang:"zh",verb:"放置",verbAlts:["放","放入"],patientPrefix:"把",at:"在",end:"结束",of:"的"},{lang:"he",verb:"שים",patientPrefix:"את",at:"at",end:"סוף",of:"of"},{lang:"tr",verb:"koy",sov:!0,objMarker:"i",at:"de",end:"son",of:"nin"},{lang:"ja",verb:"置く",sov:!0,objMarker:"を",at:"で",end:"終わり",of:"の"},{lang:"ko",verb:"넣다",sov:!0,objMarker:"를",at:"에",end:"끝",of:"의"},{lang:"hi",verb:"रखें",verbAlts:["रख","डालें","डाल"],sov:!0,objMarker:"को",at:"पर",end:"समाप्त",of:"का"},{lang:"bn",verb:"রাখুন",verbAlts:["রাখ"],sov:!0,objMarker:"কে",at:"এ",end:"শেষ",of:"র"},{lang:"qu",verb:"churay",sov:!0,objMarker:"ta",at:"pi",end:"tukuy",of:"pa"}]}}),Bf=mm({"src/tokenizers/token-utils.ts"(){}}),Hf=mm({"src/tokenizers/char-classifiers.ts"(){}}),Ff=mm({"src/tokenizers/base-tokenizer.ts"(){}}),Kf=mm({"src/tokenizers/base.ts"(){Bf(),Hf(),Ff()}});var Uf,Gf=mm({"src/tokenizers/generic-extractors.ts"(){qf=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],$f=class{constructor(e=qf){this.name="operator",this.operators=[...e].sort((e,t)=>t.length-e.length)}canExtract(e,t){return this.operators.some(r=>e.startsWith(r,t))}extract(e,t){for(const r of this.operators)if(e.startsWith(r,t))return{value:r,length:r.length};return null}},Vf=class{constructor(e="()[]{},:;"){this.punctuation=e,this.name="punctuation"}canExtract(e,t){return this.punctuation.includes(e[t])}extract(e,t){const r=e[t];return this.punctuation.includes(r)?{value:r,length:1}:null}}}});function Yf(e,t){const r=e[t];if("#"===r){const r=e.slice(t).match(/^#[a-zA-Z_][\w-]*/);return r?r[0]:null}if("."===r){const r=e.slice(t).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(r)return r[0];const n=e.slice(t).match(/^\.[a-zA-Z_][\w-]*/);return n?n[0]:null}if("@"===r){const r=e.slice(t).match(/^@[a-zA-Z_][\w-]*/);return r?r[0]:null}if("*"===r){const r=e.slice(t).match(/^\*(?:--)?[a-zA-Z_][\w-]*/);return r?r[0]:null}if("["===r){let r=0,n=t;for(;e.length>n;){if("["===e[n]&&r++,"]"===e[n]&&(r--,0===r))return e.slice(t,n+1);n++}return null}if("<"===r){const r=e.slice(t).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return r?r[0]:null}return null}var Zf,Jf,Xf=mm({"src/tokenizers/extractors/css-selector.ts"(){Uf=class{constructor(){this.name="css-selector"}canExtract(e,t){const r=e[t];return"#"===r||"."===r||"["===r||"<"===r||("@"===r||"*"===r)&&null!==Yf(e,t)}extract(e,t){const r=Yf(e,t);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}}}}),Qf=mm({"src/tokenizers/extractors/event-modifier.ts"(){Zf=class{constructor(){this.name="event-modifier"}canExtract(e,t){if("."!==e[t])return!1;const r=e.slice(t);return/^\.(once|prevent|stop|debounce|throttle|queue)/.test(r)}extract(e,t){const r=e.slice(t).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!r)return null;const n=r[0],i=n.slice(1).split("(")[0],a=r[1];return{value:n,length:n.length,metadata:{modifierName:i,value:a?"queue"===i?a:parseInt(a,10):void 0}}}}}});var eh,th,rh=mm({"src/tokenizers/extractors/url.ts"(){Jf=class{constructor(){this.name="url"}canExtract(e,t){const r=e.slice(t);return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")||r.startsWith("./")||r.startsWith("../")||r.startsWith("/")}extract(e,t){const r=function(e,t){const r=e.slice(t);if(r.startsWith("http://")||r.startsWith("https://")){const e=r.match(/^https?:\/\/[^\s]*/);return e?e[0]:null}if(r.startsWith("//")){const e=r.match(/^\/\/[^\s]*/);return e?e[0]:null}if(r.startsWith("./")||r.startsWith("../")){const e=r.match(/^\.\.?\/[^\s]*/);return e?e[0]:null}if(r.startsWith("/")){const e=r.match(/^\/[^\s]*/);return e?e[0]:null}return null}(e,t);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}}}}),nh=mm({"src/tokenizers/extractors/variable-ref.ts"(){eh=class{constructor(){this.name="variable-ref"}canExtract(e,t){const r=e[t];return(":"===r||"$"===r||"^"===r)&&e.length>t+1&&/[a-zA-Z_]/.test(e[t+1])}extract(e,t){if(!this.canExtract(e,t))return null;let r=1;for(;e.length>t+r&&/[a-zA-Z0-9_]/.test(e[t+r]);)r++;return{value:e.substring(t,t+r),length:r,metadata:{type:"variable-reference"}}}}}});function ih(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 ah,oh,sh,lh,ch,uh=mm({"src/tokenizers/extractors/japanese-keyword.ts"(){th=class{constructor(){this.name="japanese-keyword"}setContext(e){this.context=e}canExtract(e,t){return ih(e[t])}extract(e,t){if(!this.context)throw Error("JapaneseKeywordExtractor: context not set");const r=t;this.context.isKeywordStart(e,t);let n="",i=t;for(;e.length>i&&ih(e[i]);)n+=e[i],i++;let a=n,o=n.length;for(let e=n.length;e>0;e--){const t=n.substring(0,e);if(this.context.lookupKeyword(t)){a=t,o=e;break}}if(n=a,i=t+o,!n)return null;const s=this.context.lookupKeyword(n),l=s&&s.normalized!==s.native?s.normalized:void 0;let c;if(!s&&this.context.normalizer){const e=this.context.normalizer.normalize(n);if(e.stem!==n&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(c=t.normalized)}}return{value:n,length:i-r,metadata:{normalized:l||c}}}}}}),ph=mm({"src/tokenizers/extractors/japanese-particle.ts"(){ah=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}]]),oh=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}]]),sh=class{constructor(){this.name="japanese-particle"}setContext(e){this._context=e}longerKeywordStartsHere(e,t){if(!this._context)return!1;for(let r=4;r>=2;r--){const n=e.slice(t,t+r);if(n.length===r&&this._context.isKeyword(n))return!0}return!1}canExtract(e,t){if(ah.has(e[t])&&!this.longerKeywordStartsHere(e,t))return!0;for(const[r]of oh)if(e.startsWith(r,t))return!0;return!1}extract(e,t){for(const[r,n]of oh)if(e.startsWith(r,t))return{value:r,length:r.length,metadata:{role:n.role,confidence:n.confidence,variant:r}};const r=e[t];if(this.longerKeywordStartsHere(e,t))return null;const n=ah.get(r);return n?{value:r,length:1,metadata:{role:n.role,confidence:n.confidence,variant:r}}:null}}}});function mh(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 dh,fh,hh,yh=mm({"src/tokenizers/extractors/korean-keyword.ts"(){lh=["할때","하면","하니까","할 때"],ch=class{constructor(){this.name="korean-keyword"}setContext(e){this.context=e}canExtract(e,t){return mh(e[t])}extract(e,t){if(!this.context)throw Error("KoreanKeywordExtractor: context not set");const r=t;for(let t=Math.min(6,e.length-r);t>=2;t--){const n=e.slice(r,r+t);let i=!0;for(let e=0;n.length>e;e++)if(!mh(n[e])){i=!1;break}if(!i)continue;const a=this.context.lookupKeyword(n);if(a)return{value:n,length:t,metadata:{normalized:a.normalized!==a.native?a.normalized:void 0}};if(this.context.normalizer){const e=this.context.normalizer.normalize(n);if(e.stem!==n&&e.confidence>=.7){const r=this.context.lookupKeyword(e.stem);if(r)return{value:n,length:t,metadata:{normalized:r.normalized,stem:e.stem,stemConfidence:e.confidence}}}}}let n="",i=t;for(;e.length>i&&mh(e[i])&&(0>=n.length||!this.context.isKeywordStart(e,i));)n+=e[i],i++;if(!n)return null;for(const e of lh)if(n.endsWith(e)&&n.length>e.length){const t=n.slice(0,-e.length),r=this.context.lookupKeyword(t);if(r)return{value:t,length:t.length,metadata:{normalized:r.normalized,hasSuffix:!0,suffix:e,stem:t}}}const a=this.context.lookupKeyword(n),o=a&&a.normalized!==a.native?a.normalized:void 0;let s,l,c;if(n.includes("토글"),!a&&this.context.normalizer){const e=this.context.normalizer.normalize(n);if(e.stem!==n&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(s=t.normalized,l=e.stem,c=e.confidence,n.includes("토글"))}}return{value:n,length:i-r,metadata:{normalized:o||s,stem:l,stemConfidence:c}}}}}});function vh(e){if(!e)return!1;const t=e.codePointAt(0);return t>=44032&&55203>=t}var gh,kh=mm({"src/tokenizers/extractors/korean-particle.ts"(){dh=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"}]]),fh=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"}]]),hh=class{constructor(){this.name="korean-particle"}setContext(e){this._context=e}canExtract(e,t){if(dh.has(e[t])&&!vh(e[t+1]))return!0;for(const[r]of fh)if(e.startsWith(r,t))return!0;return!1}extract(e,t){for(const[r,n]of fh)if(e.startsWith(r,t))return{value:r,length:r.length,metadata:{particleRole:n.role,particleConfidence:n.confidence,particleVariant:n.variant}};const r=e[t],n=dh.get(r);return n&&!vh(e[t+1])?{value:r,length:1,metadata:{particleRole:n.role,particleConfidence:n.confidence,particleVariant:n.variant}}:null}}}});function bh(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 wh,zh,xh,Eh,Th,Sh,Ch,Ah=mm({"src/tokenizers/extractors/chinese-keyword.ts"(){gh=class{constructor(){this.name="chinese-keyword"}setContext(e){this.context=e}canExtract(e,t){return bh(e[t])}extract(e,t){if(!this.context)throw Error("ChineseKeywordExtractor: context not set");const r=t;let n=null;if(this.context.isKeywordStart(e,t))for(let r=10;r>=1;r--){const i=e.slice(t,t+r);if([...i].every(e=>bh(e))){const e=this.context.lookupKeyword(i);if(e){n={word:i,entry:e};break}}}if(n)return{value:n.word,length:n.word.length,metadata:{normalized:n.entry.normalized}};let i="",a=t;for(;e.length>a&&bh(e[a])&&(i+=e[a],a++,a>=e.length||!this.context.isKeywordStart(e,a)););return i?{value:i,length:a-r,metadata:{}}:null}}}}),Lh=mm({"src/tokenizers/extractors/chinese-particle.ts"(){wh=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"}]]),zh=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"}]]),xh=class{constructor(){this.name="chinese-particle"}setContext(e){this._context=e}longerKeywordAt(e,t,r){const n=this._context;if(!n)return!1;for(let i=Math.min(10,e.length-t);i>r;i--)if(n.lookupKeyword(e.slice(t,t+i)))return!0;return!1}canExtract(e,t){if(wh.has(e[t])&&!this.longerKeywordAt(e,t,1))return!0;for(const[r]of zh)if(e.startsWith(r,t)&&!this.longerKeywordAt(e,t,r.length))return!0;return!1}extract(e,t){for(const[r,n]of zh)if(e.startsWith(r,t)&&!this.longerKeywordAt(e,t,r.length))return{value:r,length:r.length,metadata:{particleRole:n.role,particleConfidence:n.confidence,particleDescription:n.description}};const r=e[t],n=wh.get(r);return n&&!this.longerKeywordAt(e,t,1)?{value:r,length:1,metadata:{particleRole:n.role,particleConfidence:n.confidence,particleDescription:n.description}}:null}}}});var jh,Ph,Oh,Nh,Ih,Rh,Mh,Wh,_h,qh,$h,Vh,Dh,Bh=mm({"src/tokenizers/extractors/vietnamese-keyword.ts"(){var e;({isLetter:Eh,isIdentifierChar:Th}=(e=/[a-zA-ZàáảãạăằắẳẵặâầấẩẫậèéẻẽẹêềếểễệìíỉĩịòóỏõọôồốổỗộơờớởỡợùúủũụưừứửữựỳýỷỹỵđÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÈÉẺẼẸÊỀẾỂỄỆÌÍỈĨỊÒÓỎÕỌÔỒỐỔỖỘƠỜỚỞỠỢÙÚỦŨỤƯỪỨỬỮỰỲÝỶỸỴĐ]/,{isLetter:t=>e.test(t),isIdentifierChar:t=>/[0-9]/.test(t)||e.test(t)})),Sh=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"]),Ch=class{constructor(){this.name="vietnamese-keyword"}setContext(e){this.context=e}canExtract(e,t){return Eh(e[t])}extract(e,t){if(!this.context)throw Error("VietnameseKeywordExtractor: context not set");const r=this.tryMultiWordPhrase(e,t);if(r)return r;let n=t,i="";for(;e.length>n&&Th(e[n]);)i+=e[n++];if(!i)return null;const a=i.toLowerCase(),o=Sh.has(a),s=this.context.lookupKeyword(a);return{value:i,length:n-t,metadata:{normalized:s&&s.normalized!==s.native?s.normalized:void 0,isPreposition:o}}}tryMultiWordPhrase(e,t){if(!this.context)return null;const r=["vào trong","sự kiện"];for(const n of r){if(e.slice(t,t+n.length).toLowerCase()===n.toLowerCase()){const r=t+n.length;if(r>=e.length||!/[a-zA-Zàáảãạăằắẳẵặâầấẩẫậèéẻẽẹêềếểễệìíỉĩịòóỏõọôồốổỗộơờớởỡợùúủũụưừứửữựỳýỷỹỵđ]/.test(e[r])){const i=this.context.lookupKeyword(n);return{value:e.slice(t,r),length:n.length,metadata:{normalized:i?.normalized,isPreposition:!1}}}}}return null}}}}),Hh=mm({"src/tokenizers/extractors/arabic-keyword.ts"(){Kf(),jh=Up([[1536,1791],[1872,1919],[2208,2303],[64336,65023],[65136,65279]]),Ph=new Set(["في","على","من","إلى","الى","مع","عن","قبل","بعد","بين"]),Oh=class{constructor(){this.name="arabic-keyword"}setContext(e){this.context=e}canExtract(e,t){return jh(e[t])}extract(e,t){if(!this.context)throw Error("ArabicKeywordExtractor: context not set");const r=t;this.context.isKeywordStart(e,t);let n="",i=t;for(;e.length>i&&(jh(e[i])||"ـ"===e[i]);)n+=e[i],i++;if(!n)return null;const a=this.context.lookupKeyword(n),o=a&&a.normalized!==a.native?a.normalized:void 0;if(Ph.has(n))return{value:n,length:i-r,metadata:{prepositionValue:n,normalized:o}};let s,l,c;if(!a&&this.context.normalizer){const e=this.context.normalizer.normalize(n);if(e.stem!==n&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(s=t.normalized,l=e.stem,c=e.confidence)}}return{value:n,length:i-r,metadata:{normalized:o||s,stem:l,stemConfidence:c}}}}}}),Fh=mm({"src/tokenizers/extractors/arabic-proclitic.ts"(){Kf(),Nh=Up([[1536,1791],[1872,1919],[2208,2303],[64336,65023],[65136,65279]]),Ih=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"}]]),Rh=new Set(["وثيقة"]),Mh=class{constructor(){this.name="arabic-proclitic"}setContext(e){this.context=e}canExtract(e,t){return Ih.has(e[t])||e.length>t+1&&Ih.has(e.slice(t,t+2))}extract(e,t){if(!this.context)throw Error("ArabicProcliticExtractor: context not set");let r=t;for(;e.length>r&&(Nh(e[r])||"ـ"===e[r]);)r++;const n=e.slice(t,r);if(this.context.isKeyword(n))return null;if(Rh.has(n))return null;if(e.length>=t+2){const n=e.slice(t,t+2),i=Ih.get(n);if(i){const a=t+2;if(e.length>a&&Nh(e[a])){let o=0,s=a;for(;e.length>s&&Nh(e[s]);)o++,s++;if(o>=2){if(!Ih.get(e[t]))return{value:n,length:2,metadata:{procliticType:i.type,normalized:i.normalized}};{const a=e.slice(t+1,r);if(!this.context.isKeyword(a))return{value:n,length:2,metadata:{procliticType:i.type,normalized:i.normalized}}}}}}}const i=e[t],a=Ih.get(i);if(!a)return null;const o=t+1;if(o>=e.length||!Nh(e[o]))return null;let s=0,l=o;for(;e.length>l&&Nh(e[l]);)s++,l++;return 2>s?null:{value:i,length:1,metadata:{procliticType:a.type,normalized:a.normalized}}}}}}),Kh=mm({"src/tokenizers/extractors/arabic-temporal.ts"(){Kf(),Wh=Up([[1536,1791],[1872,1919],[2208,2303],[64336,65023],[65136,65279]]),_h=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)"}]]),qh=class{constructor(){this.name="arabic-temporal"}setContext(e){this._context=e}canExtract(e,t){for(const[r]of _h)if(e.startsWith(r,t))return!0;return!1}extract(e,t){const r=Array.from(_h.entries()).sort(([e],[t])=>t.length-e.length);for(const[n,i]of r)if(e.startsWith(n,t)){const r=t+n.length;if(r>=e.length||/\s/.test(e[r])||!Wh(e[r]))return{value:n,length:n.length,metadata:{temporalFormality:i.formality,temporalConfidence:i.confidence,normalized:i.normalized,description:i.description}}}return null}}}});var Uh,Gh=mm({"src/tokenizers/extractors/cyrillic-keyword.ts"(){$h=class{constructor(e,t,r){this.name=e;const n=(i=t,{isLetter:e=>i.test(e),isIdentifierChar:e=>/[0-9]/.test(e)||i.test(e)});var i;this.isLetter=n.isLetter,this.isIdentifierChar=n.isIdentifierChar,this.prepositions=r}setContext(e){this.context=e}canExtract(e,t){const r=e[t];return"'"!==r&&this.isLetter(r)}extract(e,t){if(!this.context)throw Error(this.name+": context not set");let r=t,n="";for(;e.length>r&&this.isIdentifierChar(e[r]);)n+=e[r++];if(!n)return null;const i=n.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(n);if(e.stem!==n&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:n,length:r-t,metadata:{normalized:s||l,isPreposition:a}}}},Vh=new Set(["в","во","на","с","со","к","ко","о","об","обо","у","от","до","из","за","по","под","над","перед","передо","между","через","без","для","при","про","после","вокруг","против","вместо","кроме","среди"]),Dh=new Set(["в","у","на","з","із","зі","до","від","о","об","при","для","під","над","перед","між","через","без","по","за","про","після","навколо","проти","замість","крім","серед","к"])}});function Yh(e){const t=e.charCodeAt(0);return t>=2304&&2431>=t||t>=43232&&43263>=t}var Zh,Jh,Xh,Qh,ey=mm({"src/tokenizers/extractors/hindi-keyword.ts"(){Uh=class{constructor(){this.name="hindi-keyword"}setContext(e){this.context=e}canExtract(e,t){return Yh(e[t])}extract(e,t){if(!this.context)throw Error("HindiKeywordExtractor: context not set");const r=t;let n="",i=t;for(;e.length>i&&Yh(e[i]);)n+=e[i],i++;if(this.context&&"-"===e[i]&&e.length>i+1&&Yh(e[i+1])){let t=i,r=n;for(;e.length>t&&("-"===e[t]||Yh(e[t]));)r+=e[t++];this.context.lookupKeyword(r)&&(n=r,i=t)}if(!n)return null;const a=this.context.lookupKeyword(n),o=a&&a.normalized!==a.native?a.normalized:void 0;let s;if(!a&&this.context.normalizer){const e=this.context.normalizer.normalize(n);if(e.stem!==n&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(s=t.normalized)}}return{value:n,length:i-r,metadata:{normalized:o||s}}}}}}),ty=mm({"src/tokenizers/extractors/hindi-particle.ts"(){Zh=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}]]),Jh=new Map([["के साथ",{role:"instrument",confidence:.95}],["के बारे में",{role:"about",confidence:.9}]]),Xh=class{constructor(){this.name="hindi-particle"}setContext(e){this._context=e}canExtract(e,t){for(const[r]of Jh)if(e.startsWith(r,t))return!0;let r="",n=t;for(;e.length>n&&this.isDevanagari(e[n]);)r+=e[n],n++;return Zh.has(r)}extract(e,t){for(const[r,n]of Jh)if(e.startsWith(r,t))return{value:r,length:r.length,metadata:{role:n.role,confidence:n.confidence,variant:r}};let r="",n=t;for(;e.length>n&&this.isDevanagari(e[n]);)r+=e[n],n++;const i=Zh.get(r);return i?{value:r,length:r.length,metadata:{role:i.role,confidence:i.confidence,variant:r}}:null}isDevanagari(e){const t=e.charCodeAt(0);return t>=2304&&2431>=t||t>=43232&&43263>=t}}}});function ry(e){const t=e.charCodeAt(0);return t>=2432&&2559>=t}var ny,iy,ay,oy=mm({"src/tokenizers/extractors/bengali-keyword.ts"(){Qh=class{constructor(){this.name="bengali-keyword"}setContext(e){this.context=e}canExtract(e,t){return ry(e[t])}extract(e,t){if(!this.context)throw Error("BengaliKeywordExtractor: context not set");const r=t;let n="",i=t;for(;e.length>i&&ry(e[i]);)n+=e[i],i++;if(!n)return null;const a=this.context.lookupKeyword(n),o=a&&a.normalized!==a.native?a.normalized:void 0;let s;if(!a&&this.context.normalizer){const e=this.context.normalizer.normalize(n);if(e.stem!==n&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(s=t.normalized)}}return{value:n,length:i-r,metadata:{normalized:o||s}}}}}}),sy=mm({"src/tokenizers/extractors/bengali-particle.ts"(){ny=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}]]),iy=class{constructor(){this.name="bengali-particle"}setContext(e){this._context=e}canExtract(e,t){let r="",n=t;for(;e.length>n&&this.isBengali(e[n]);)r+=e[n],n++;return ny.has(r)}extract(e,t){let r="",n=t;for(;e.length>n&&this.isBengali(e[n]);)r+=e[n],n++;const i=ny.get(r);return i?{value:r,length:r.length,metadata:{role:i.role,confidence:i.confidence,variant:r}}:null}isBengali(e){const t=e.charCodeAt(0);return t>=2432&&2559>=t}}}});function ly(e){const t=e.charCodeAt(0);return t>=3584&&3711>=t}function cy(e){return/[a-zA-Z0-9_]/.test(e)}var uy,py=mm({"src/tokenizers/extractors/thai-keyword.ts"(){ay=class{constructor(){this.name="thai-keyword"}setContext(e){this.context=e}canExtract(e,t){return ly(e[t])||cy(e[t])}extract(e,t){if(!this.context)throw Error("ThaiKeywordExtractor: context not set");const r=e[t];return ly(r)?this.extractThaiWord(e,t):cy(r)?this.extractAsciiWord(e,t):null}extractThaiWord(e,t){if(!this.context)return null;let r=null,n=t,i="";for(;e.length>n&&ly(e[n]);){i+=e[n],n++;const t=this.context.lookupKeyword(i);t&&(r={word:i,entry:t})}if(r){return{value:r.word,length:r.word.length,metadata:{normalized:r.entry.normalized!==r.entry.native?r.entry.normalized:void 0}}}let a=t,o="";for(;e.length>a&&ly(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 r=t,n="";for(;e.length>r&&cy(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase(),a=this.context.lookupKeyword(i);return{value:n,length:n.length,metadata:{normalized:a&&a.normalized!==a.native?a.normalized:void 0}}}isKeywordStart(e,t){if(!this.context)return!1;let r=t,n="";for(;e.length>r&&ly(e[r]);){if(n+=e[r],r++,this.context.lookupKeyword(n))return!0;if(n.length>10)break}return!1}}}});function my(e){return/[a-zA-Z0-9_]/.test(e)}var dy,fy,hy=mm({"src/tokenizers/extractors/malay-keyword.ts"(){uy=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 r=t,n="";for(;e.length>r&&my(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase(),a=this.context.lookupKeyword(i);return{value:n,length:n.length,metadata:{normalized:a&&a.normalized!==a.native?a.normalized:void 0}}}}}});function yy(e){return/[a-zA-Z0-9_]/.test(e)}var vy,gy,ky,by,wy=mm({"src/tokenizers/extractors/tagalog-keyword.ts"(){dy=new Set(["sa","ng","para","mula","hanggang","gaya","tulad","kasama","para sa"]),fy=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 r=t,n="";for(;e.length>r&&yy(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase(),a=dy.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(n);if(e.stem!==n&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:n,length:n.length,metadata:{normalized:s||l,isPreposition:a}}}}}});var zy,xy,Ey,Ty,Sy=mm({"src/tokenizers/extractors/polish-keyword.ts"(){vy=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:gy,isIdentifierChar:ky}=function(){const e=/[a-zA-ZąęćńóśźżłĄĘĆŃÓŚŹŻŁ]/;return{isLetter:t=>e.test(t),isIdentifierChar:t=>/[0-9]/.test(t)||e.test(t)}}()),by=class{constructor(){this.name="polish-keyword"}setContext(e){this.context=e}canExtract(e,t){return gy(e[t])}extract(e,t){if(!this.context)throw Error("PolishKeywordExtractor: context not set");let r=t,n="";for(;e.length>r&&ky(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase(),a=vy.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(n);if(e.stem!==n&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:n,length:r-t,metadata:{normalized:s||l,isPreposition:a}}}}}});var Cy,Ay,Ly,jy,Py=mm({"src/tokenizers/extractors/indonesian-keyword.ts"(){zy=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:xy,isIdentifierChar:Ey}=function(){const e=/[a-zA-Z]/;return{isLetter:t=>e.test(t),isIdentifierChar:t=>/[0-9]/.test(t)||e.test(t)}}()),Ty=class{constructor(){this.name="indonesian-keyword"}setContext(e){this.context=e}canExtract(e,t){return xy(e[t])}extract(e,t){if(!this.context)throw Error("IndonesianKeywordExtractor: context not set");let r=t,n="";for(;e.length>r&&Ey(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase(),a=zy.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(n);if(e.stem!==n&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:n,length:r-t,metadata:{normalized:s||l,isPreposition:a}}}}}});var Oy,Ny,Iy,Ry=mm({"src/tokenizers/extractors/swahili-keyword.ts"(){Cy=new Set(["kwa","na","katika","kwenye","kutoka","hadi","mpaka","kabla","baada","wakati","bila","kuhusu","karibu","mbele","nyuma","ndani","nje","juu","chini","kati"]),({isLetter:Ay,isIdentifierChar:Ly}=function(){const e=/[a-zA-Z]/;return{isLetter:t=>e.test(t),isIdentifierChar:t=>/[0-9]/.test(t)||e.test(t)}}()),jy=class{constructor(){this.name="swahili-keyword"}setContext(e){this.context=e}canExtract(e,t){return Ay(e[t])}extract(e,t){if(!this.context)throw Error("SwahiliKeywordExtractor: context not set");let r=t,n="";for(;e.length>r&&Ly(e[r]);)n+=e[r++];if(this.context&&e.length>r&&"_"===e[r]){let t=r,i=n;for(;e.length>t&&("_"===e[t]||Ly(e[t]));)i+=e[t++];this.context.lookupKeyword(i.toLowerCase())&&(n=i,r=t)}if(!n)return null;const i=n.toLowerCase(),a=Cy.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(n);if(e.stem!==n&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:n,length:r-t,metadata:{normalized:s||l,isPreposition:a}}}}}});function My(e){const t=e.charCodeAt(0);if(t>=65&&90>=t||t>=97&&122>=t)return!0;return"çÇğĞıİöÖşŞüÜ".includes(e)}var Wy,_y,qy,$y,Vy=mm({"src/tokenizers/extractors/turkish-keyword.ts"(){Oy=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"]),Ny=new Set(["de","da","te","ta","den","dan","ten","tan","e","a","ye","ya","i","ı","u","ü","in","ın","un","ün","le","la","yle","yla"]),Iy=class{constructor(){this.name="turkish-keyword"}setContext(e){this.context=e}canExtract(e,t){return My(e[t])}extract(e,t){if(!this.context)throw Error("TurkishKeywordExtractor: context not set");const r=t;for(let t=Math.min(12,e.length-r);t>=2;t--){const n=e.slice(r,r+t);if(e.length>r+t&&My(e[r+t]))continue;let i=!0;for(let e=0;n.length>e;e++)if(!My(n[e])){i=!1;break}if(!i)continue;const a=this.context.lookupKeyword(n);if(a)return{value:n,length:t,metadata:{normalized:a.normalized!==a.native?a.normalized:void 0}};if(this.context.normalizer){const e=this.context.normalizer.normalize(n);if(e.stem!==n&&e.confidence>=.7){const r=this.context.lookupKeyword(e.stem);if(r)return{value:n,length:t,metadata:{normalized:r.normalized,stem:e.stem,stemConfidence:e.confidence}}}}}let n="",i=t;for(;e.length>i&&My(e[i]);)n+=e[i],i++;for(let e=n.length;e>=2&&n.length<=e;e--){const t=n.substring(0,e),r=this.context.lookupKeyword(t);if(r)return{value:t,length:e,metadata:{normalized:r.normalized!==r.native?r.normalized:void 0}}}if(!n)return null;if(!n)return null;if(Oy.has(n.toLowerCase()))return{value:n,length:i-r,metadata:{postpositionValue:n.toLowerCase()}};if(Ny.has(n.toLowerCase()))return{value:n,length:i-r,metadata:{caseSuffixValue:n.toLowerCase()}};const a=this.context.lookupKeyword(n),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(n);if(e.stem!==n&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(s=t.normalized,l=e.stem,c=e.confidence)}}return{value:n,length:i-r,metadata:{normalized:o||s,stem:l,stemConfidence:c}}}}}});function Dy(e){const t=e.charCodeAt(0);return t>=65&&90>=t||t>=97&&122>=t||("ñ"===e||"Ñ"===e||"'"===e||"’"===e)}function By(e,t){const r=e.slice(t);for(const n of qy){if(!r.startsWith(n))continue;const i=e[t+n.length];if(void 0===i||!Dy(i))return!0}return!1}var Hy,Fy,Ky,Uy,Gy=mm({"src/tokenizers/extractors/quechua-keyword.ts"(){Wy=new Set(["-ta","-man","-manta","-pi","-wan","-paq","-kama","-rayku","-hina","ta","man","manta","pi","wan","paq","kama","hina","pa"]),_y=new Set(["kama","hina","rayku","paq"]),qy=new Set([...Wy,..._y].map(e=>e.startsWith("-")?e.slice(1):e)),$y=class{constructor(){this.name="quechua-keyword"}setContext(e){this.context=e}canExtract(e,t){return!!Dy(e[t])||null!==this.isHyphenatedSuffix(e,t)}isHyphenatedSuffix(e,t){if("-"!==e[t])return null;const r=e.slice(t).match(/^-([a-zñ'’]+)/i);return r&&Wy.has("-"+r[1].toLowerCase())?r[1]:null}extract(e,t){if(!this.context)throw Error("QuechuaKeywordExtractor: context not set");const r=t,n=this.isHyphenatedSuffix(e,t);if(null!==n)return{value:n,length:n.length+1,metadata:{suffixValue:n.toLowerCase()}};for(let t=Math.min(12,e.length-r);t>=2;t--){const n=e.slice(r,r+t),i=e[r+t];if(void 0!==i&&Dy(i))continue;let a=!0;for(let e=0;n.length>e;e++)if(!Dy(n[e])){a=!1;break}if(!a)continue;const o=this.context.lookupKeyword(n);if(o)return{value:n,length:t,metadata:{normalized:o.normalized!==o.native?o.normalized:void 0}};if(this.context.normalizer){const e=this.context.normalizer.normalize(n);if(e.stem!==n&&e.confidence>=.7){const r=this.context.lookupKeyword(e.stem);if(r)return{value:n,length:t,metadata:{normalized:r.normalized}}}}}let i="",a=t;for(;e.length>a&&Dy(e[a])&&(0>=i.length||!By(e,a));)i+=e[a],a++;if(!i)return null;if(Wy.has(i.toLowerCase()))return{value:i,length:a-r,metadata:{suffixValue:i.toLowerCase()}};if(_y.has(i.toLowerCase()))return{value:i,length:a-r,metadata:{postpositionValue:i.toLowerCase()}};const 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(i);if(e.stem!==i&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:i,length:a-r,metadata:{normalized:s||l}}}}}});var Yy,Zy,Jy,Xy,Qy,ev=mm({"src/tokenizers/extractors/hebrew-keyword.ts"(){Kf(),Hy=Up([[1424,1535],[64285,64335]]),Fy=new Set(["על","את","אל","מן","עם","בתוך","מתוך","ליד","אחרי","לפני","בין","עד","של"]),Ky=new Set(["ו"]),Uy=class{constructor(){this.name="hebrew-keyword"}setContext(e){this.context=e}canExtract(e,t){return Hy(e[t])}extract(e,t){if(!this.context)throw Error("HebrewKeywordExtractor: context not set");const r=t;this.context.isKeywordStart(e,t);let n="",i=t;for(;e.length>i&&Hy(e[i]);)n+=e[i],i++;if(!n)return null;const a=this.context.lookupKeyword(n),o=a&&a.normalized!==a.native?a.normalized:void 0;if(Fy.has(n))return{value:n,length:i-r,metadata:{prepositionValue:n,normalized:o}};if(Ky.has(n))return{value:n,length:i-r,metadata:{conjunctionValue:n,normalized:o}};let s;if(!a&&this.context.normalizer){const e=this.context.normalizer.normalize(n);if(e.stem!==n&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(s=t.normalized)}}return{value:n,length:i-r,metadata:{normalized:o||s}}}}}});var tv,rv=mm({"src/tokenizers/extractors/hebrew-proclitic.ts"(){Kf(),Yy=Up([[1424,1535],[64285,64335]]),Zy=new Map([["ב","on"],["ל","to"],["מ","from"],["כ","as"],["ה","the"],["ו","and"],["ש","that"]]),Jy=new Set(["ב","כ"]),Xy=new Set(["לחיצה","קליק","שליחה","הגשה","ריחוף","מעבר","שינוי","עדכון","קלט","הזנה","מיקוד","טשטוש","טעינה","גלילה"]),Qy=class{constructor(){this.name="hebrew-proclitic"}setContext(e){this.context=e}canExtract(e,t){return Zy.has(e[t])&&e.length>t+1&&Yy(e[t+1])}extract(e,t){if(!this.context)throw Error("HebrewProcliticExtractor: context not set");const r=e[t],n=Zy.get(r);if(!n)return null;let i=t;for(;e.length>i&&Yy(e[i]);)i++;const a=e.slice(t,i),o=this.context?.lookupKeyword(a);if(o)return null;if(e.length>t+1&&Zy.has(e[t+1])){const r=e.slice(t+1,i),n=this.context?.lookupKeyword(r),a=Xy.has(r);if(!n&&!a&&r.length<3)return null}const s=e.slice(t+1,i),l=this.context?.lookupKeyword(s),c=Jy.has(r),u=Xy.has(s);if(c&&u)return{value:r,length:1,metadata:{normalized:n,procliticType:n,isEventMarker:!0}};if(1===s.length&&Zy.has(s))return null;if(!l&&!u&&2>s.length)return null;return{value:r,length:1,metadata:{normalized:n,procliticType:n,isEventMarker:c&&l}}}}}});function nv(e){const t=e.charCodeAt(0);return t>=48&&57>=t||t>=65&&90>=t||t>=97&&122>=t||95===t||36===t}var iv=mm({"src/tokenizers/extractors/ascii-identifier.ts"(){tv=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 r=t;let n="",i=t;for(;e.length>i&&nv(e[i]);)n+=e[i],i++;if(!n)return null;const a=this.context.lookupKeyword(n);return{value:n,length:i-r,metadata:{normalized:a&&a.normalized!==a.native?a.normalized:void 0}}}}}}),av=mm({"src/tokenizers/extractors/index.ts"(){Xf(),Qf(),rh(),nh()}});function ov(){return[new Jf,new Zf,new eh,new Uf]}var sv,lv=mm({"src/tokenizers/extractor-helpers.ts"(){av()}});function cv(e){return/[a-zA-Z0-9_]/.test(e)}var uv,pv,mv,dv=mm({"src/tokenizers/extractors/english-keyword.ts"(){sv=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 r=t,n="";for(;e.length>r&&cv(e[r]);)n+=e[r++];if(!n)return null;if(e.length>r&&":"===e[r]){const t=r;r++;let i="";for(;e.length>r&&cv(e[r]);)i+=e[r++];i?n=n+":"+i:r=t}const i=this.context.lookupKeyword(n),a=i&&i.normalized!==i.native?i.normalized:void 0;let o=null;return this.context.isKeyword(n)||(o=this.tryClassSyntaxConversion(e,r,n)),{value:o||n,length:r-t,metadata:{normalized:a,classConversion:!!o||void 0}}}tryClassSyntaxConversion(e,t,r){let n=t;for(;e.length>n&&/\s/.test(e[n]);)n++;if("class"===e.slice(n,n+5).toLowerCase()){const t=n+5;if(t>=e.length||!cv(e[t]))return"."+r}return null}}}}),fv={};dm(fv,{EnglishTokenizer:()=>pv,englishTokenizer:()=>mv});var hv,yv,vv,gv=mm({"src/tokenizers/english.ts"(){Kf(),qm(),Gf(),lv(),dv(),uv=[{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"}],mv=new(pv=class extends Xp{constructor(){super(),this.language="en",this.direction="ltr",this.initializeKeywordsFromProfile(Rm,uv),this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractors([new sv]),this.registerExtractor(new $f),this.registerExtractor(new Vf)}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"}})}}),kv=mm({"src/tokenizers/morphology/types.ts"(){}});function bv(e){const t=e.charCodeAt(0);return t>=12352&&12447>=t}function wv(e){const t=e.charCodeAt(0);return t>=12448&&12543>=t}function zv(e){const t=e.charCodeAt(0);return t>=19968&&40959>=t||t>=13312&&19903>=t}var xv,Ev,Tv,Sv,Cv=mm({"src/tokenizers/morphology/japanese-normalizer.ts"(){kv(),hv=[{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}],yv=[{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(vv=class{constructor(){this.language="ja"}isNormalizable(e){if(!function(e){for(const t of e)if(bv(t)||wv(t)||zv(t))return!0;return!1}(e))return!1;if(2>e.length)return!1;return bv(e[e.length-1])}normalize(e){const t=this.normalizeCompound(e);if(t)return t;const r=this.trySuruNormalization(e);if(r)return r;for(const t of hv)if(e.endsWith(t.pattern)){const r=e.slice(0,-t.pattern.length);if((t.minStemLength??2)>r.length)continue;const n={removedSuffixes:[t.pattern]};return t.conjugationType&&(n.conjugationType=t.conjugationType),em(r,t.confidence,n)}return Qp(e)}trySuruNormalization(e){for(const t of yv)if(e.endsWith(t.pattern)){const r=e.slice(0,-t.pattern.length);if(1>r.length)continue;return em(r,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:r,suffixes:n,confidence:i,minStemLength:a}of t)if(e.endsWith(r)){const t=e.slice(0,-r.length);if(a>t.length)continue;return em(t,i,{removedSuffixes:n,conjugationType:"compound"})}return null}})}}),Av={};dm(Av,{JapaneseTokenizer:()=>Tv,japaneseTokenizer:()=>Sv});var Lv,jv,Pv,Ov=mm({"src/tokenizers/japanese.ts"(){Kf(),Cv(),od(),Gf(),lv(),uh(),ph(),iv(),xv=new Set(["を","に","で","から","まで","へ","と","の","が","は","も","より"]),Ev=[{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:"load"},{native:"スクロール",normalized:"scroll"},{native:"キーダウン",normalized:"keydown"},{native:"キーアップ",normalized:"keyup"},{native:"マウスオーバー",normalized:"mouseover"},{native:"マウスアウト",normalized:"mouseout"},{native:"マウス押下",normalized:"mousedown"},{native:"マウス解放",normalized:"mouseup"},{native:"または",normalized:"or"},{native:"私",normalized:"me"},{native:"したら",normalized:"on"},{native:"すると",normalized:"on"},{native:"時に",normalized:"on"},{native:"秒",normalized:"s"},{native:"ミリ秒",normalized:"ms"},{native:"分",normalized:"m"},{native:"時間",normalized:"h"}],Sv=new(Tv=class extends Xp{constructor(){super(),this.language="ja",this.direction="ltr",this.initializeKeywordsFromProfile(rd,Ev),this.normalizer=new vv,this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractor(new tv),this.registerExtractor(new sh),this.registerExtractor(new th),this.registerExtractor(new $f),this.registerExtractor(new Vf)}classifyToken(e){return xv.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 Nv(e){const t=e.charCodeAt(0);return t>=44032&&55203>=t}var Iv,Rv,Mv,Wv,_v=mm({"src/tokenizers/morphology/korean-normalizer.ts"(){kv(),Lv=[{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}],jv=[{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(Pv=class{constructor(){this.language="ko"}isNormalizable(e){return!!function(e){for(const t of e)if(Nv(t))return!0;return!1}(e)&&2<=e.length}normalize(e){const t=this.normalizeCompound(e);if(t)return t;const r=this.tryHadaNormalization(e);if(r)return r;for(const t of Lv)if(e.endsWith(t.pattern)){const r=e.slice(0,-t.pattern.length);if((t.minStemLength??2)>r.length)continue;const n={removedSuffixes:[t.pattern]};return t.conjugationType&&(n.conjugationType=t.conjugationType),em(r,t.confidence,n)}return Qp(e)}tryHadaNormalization(e){for(const t of jv)if(e.endsWith(t.pattern)){const r=e.slice(0,-t.pattern.length);if(1>r.length)continue;return em(r,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:r,suffixes:n,confidence:i,conjugationType:a,minStemLength:o}of t)if(e.endsWith(r)){const t=e.slice(0,-r.length);if(o>t.length)continue;return em(t,i,{removedSuffixes:n,conjugationType:a})}return null}})}}),qv={};dm(qv,{KoreanTokenizer:()=>Mv,koreanTokenizer:()=>Wv});var $v,Vv,Dv,Bv,Hv,Fv=mm({"src/tokenizers/korean.ts"(){Kf(),_v(),cd(),Gf(),lv(),yh(),kh(),iv(),Iv=new Set(["이","가","을","를","은","는","에","에서","로","으로","와","과","의","도","만","부터","까지","처럼","보다"]),Rv=[{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:"mousedown"},{native:"마우스업",normalized:"mouseup"},{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"}],Wv=new(Mv=class extends Xp{constructor(){super(),this.language="ko",this.direction="ltr",this.initializeKeywordsFromProfile(ad,Rv),this.normalizer=new Pv,this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractor(new tv),this.registerExtractor(new hh),this.registerExtractor(new ch),this.registerExtractor(new $f),this.registerExtractor(new Vf)}classifyToken(e){return Iv.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 Kv(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 Uv,Gv,Yv,Zv,Jv,Xv=mm({"src/tokenizers/morphology/arabic-normalizer.ts"(){kv(),$v=[{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"}],Vv=[{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}],Dv=[{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}],Bv=[{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(Hv=class{constructor(){this.language="ar"}isNormalizable(e){return!!function(e){for(const t of e)if(Kv(t))return!0;return!1}(e)&&2<=e.length}normalize(e){let t=function(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}(e),r=1;const n=[],i=[];for(const e of $v)if(t.startsWith(e.pattern)){const i=t.slice(e.pattern.length);if(i.length>=2){t=i,r-=e.confidencePenalty,n.push(e.pattern);break}}if(0===n.length)for(const e of Vv)if(t.startsWith(e.pattern)){const i=t.slice(e.pattern.length);if(i.length>=(e.minRemaining??2)){t=i,r-=e.confidencePenalty,n.push(e.pattern);break}}if(!(t.endsWith("ات")||t.endsWith("ة")||t.endsWith("ون")||t.endsWith("ين")||t.endsWith("ها")||t.endsWith("هم")||t.endsWith("هن")||t.endsWith("نا")||t.endsWith("كم"))&&(0===n.length||"و"===n[0]||"ف"===n[0]))for(const e of Dv)if(t.startsWith(e.pattern)){const i=t.slice(e.pattern.length);if(i.length>=(e.minRemaining??3)){t=i,r-=e.confidencePenalty,n.push(e.pattern);break}}for(const e of Bv)if(t.endsWith(e.pattern)){const n=t.slice(0,-e.pattern.length);2>n.length||(t=n,r-=e.confidencePenalty,i.push(e.pattern))}return r=Math.max(.5,r),0===n.length&&0===i.length?Qp(e):em(t,r,{removedPrefixes:n,removedSuffixes:i})}})}}),Qv={};dm(Qv,{ArabicTokenizer:()=>Zv,arabicTokenizer:()=>Jv});var eg,tg,rg,ng,ig,ag=mm({"src/tokenizers/arabic.ts"(){Kf(),Xv(),jm(),Gf(),lv(),Hh(),iv(),Fh(),Kh(),Uv=new Set(["ول","وب","وك","فل","فب","فك"]),Gv=new Set(["في","على","من","إلى","الى","مع","عن","قبل","بعد","بين","ب","ل","ك"]),Yv=[{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:"mousedown"},{native:"فأرة أعلى",normalized:"mouseup"},{native:"فأرة دخول",normalized:"mouseenter"},{native:"فأرة خروج",normalized:"mouseleave"},{native:"فأرة فوق",normalized:"mouseover"},{native:"فأرة خارج",normalized:"mouseout"},{native:"فأرة تحرك",normalized:"mousemove"},{native:"مفتاح أسفل",normalized:"keydown"},{native:"مفتاح أعلى",normalized:"keyup"},{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"}],Jv=new(Zv=class extends Xp{constructor(){super(),this.language="ar",this.direction="rtl",this.initializeKeywordsFromProfile(Sm,Yv),this.normalizer=new Hv,this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractor(new tv),this.registerExtractor(new qh),this.registerExtractor(new Mh),this.registerExtractor(new Oh),this.registerExtractor(new $f),this.registerExtractor(new Vf)}tokenizeWithExtractors(e){const t=[];let r=0;for(;e.length>r;){for(;e.length>r&&jp(e[r]);)r++;if(r>=e.length)break;const n=this.tryMultiWordKeyword(e,r);if(n){t.push(n),r=n.position.end;continue}let i=!1;for(const n of this.extractors)if(n.canExtract(e,r)){const a=n.extract(e,r);if(a){const e=a.metadata?.normalized,n=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),n&&(c.stem=n),void 0!==o&&(c.stemConfidence=o),Object.keys(s).length>0&&(c.metadata=s),t.push(Lp(a.value,l,Ap(r,r+a.length),Object.keys(c).length>0?c:void 0)),r+=a.length,i=!0;break}}if(!i){const n=e[r],i=this.classifyUnknownChar(n);t.push(Lp(n,i,Ap(r,r+1))),r++}}return new Cp(t,this.language)}classifyToken(e){return Uv.has(e)?"conjunction":Gv.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 og(e){return/[áéíóúüñÁÉÍÓÚÜÑ]/.test(e)}var sg,lg,cg,ug,pg=mm({"src/tokenizers/morphology/spanish-normalizer.ts"(){kv(),eg=[{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"}],tg=[{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"}],rg=[{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"}],ng=[...eg,...tg,...rg].sort((e,t)=>t.ending.length-e.ending.length),new(ig=class extends tm{constructor(){super({language:"es",minWordLength:3,minStemLength:2,endings:ng,reflexiveSuffixes:["se","me","te","nos","os"],infinitiveEndings:["ar","er","ir"]})}isNormalizable(e){if(3>e.length)return!1;const t=e.toLowerCase();if(t.endsWith("ar")||t.endsWith("er")||t.endsWith("ir"))return!0;if(t.endsWith("ando")||t.endsWith("iendo"))return!0;if(t.endsWith("ado")||t.endsWith("ido"))return!0;if(t.endsWith("arse")||t.endsWith("erse")||t.endsWith("irse"))return!0;for(const t of e)if(og(t))return!0;return!1}})}});var mg,dg,fg,hg,yg=mm({"src/tokenizers/extractors/spanish-keyword.ts"(){var e;Kf(),({isLetter:sg,isIdentifierChar:lg}=(e=/[a-zA-ZáéíóúüñÁÉÍÓÚÜÑ]/,{isLetter:t=>e.test(t),isIdentifierChar:t=>/[0-9]/.test(t)||e.test(t)})),cg=new Set(["en","a","de","desde","hasta","con","sin","por","para","sobre","entre","antes","después","despues","dentro","fuera","al","del"]),ug=class{constructor(){this.name="spanish-keyword"}setContext(e){this.context=e}canExtract(e,t){return sg(e[t])}extract(e,t){if(!this.context)throw Error("SpanishKeywordExtractor: context not set");const r=this.tryMultiWordPhrase(e,t);return r||this.extractSpanishWord(e,t)}tryMultiWordPhrase(e,t){if(!this.context)return null;const r=["de lo contrario","de lo normal","por defecto","de nuevo","de otra manera"];for(const n of r){if(e.slice(t,t+n.length).toLowerCase()===n.toLowerCase()){const r=t+n.length;if(r>=e.length||jp(e[r])||!sg(e[r])){const i=this.context.lookupKeyword(n);return{value:e.slice(t,r),length:n.length,metadata:{normalized:i?.normalized,multiWord:!0}}}}}return null}extractSpanishWord(e,t){if(!this.context)return null;let r=t,n="";for(;e.length>r&&lg(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase(),a=cg.has(i),o=this.context.lookupKeyword(n),s=o&&o.normalized!==o.native?o.normalized:void 0;let l;if(!o&&this.context.normalizer){const e=this.context.normalizer.normalize(n);if(e.stem!==n&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:n,length:r-t,metadata:{normalized:s||l,isPreposition:a}}}}}}),vg={};dm(vg,{SpanishTokenizer:()=>fg,spanishTokenizer:()=>hg});var gg,kg,bg=mm({"src/tokenizers/spanish.ts"(){Kf(),pg(),Dm(),Gf(),lv(),yg(),mg=new Set(["en","a","de","desde","hasta","con","sin","por","para","sobre","entre","antes","después","despues","dentro","fuera","al","del"]),dg=[{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"}],hg=new(fg=class extends Xp{constructor(){super(),this.language="es",this.direction="ltr",this.initializeKeywordsFromProfile(_m,dg),this.setNormalizer(new ig),this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractors([new ug]),this.registerExtractor(new $f),this.registerExtractor(new Vf)}classifyToken(e){const t=e.toLowerCase();return mg.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":e.startsWith("/")||e.startsWith("./")||e.startsWith("http")?"url":"identifier"}})}});function wg(e){const t=e.charCodeAt(0);if(t>=65&&90>=t||t>=97&&122>=t)return!0;return"çÇğĞıİöÖşŞüÜ".includes(e)}function zg(e){return"aıouAIOU".includes(e)}function xg(e){return"eiöüEİÖÜ".includes(e)}function Eg(e){return zg(e)||xg(e)}function Tg(e,t){const r=function(e){for(let t=e.length-1;t>=0;t--)if(Eg(e[t]))return e[t];return null}(e);if(!r)return!0;const n=t.split("").find(e=>Eg(e));return!n||(zg(r)?zg(n):xg(n))}var Sg,Cg,Ag,Lg,jg,Pg=mm({"src/tokenizers/morphology/turkish-normalizer.ts"(){kv(),gg=[{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(kg=class{constructor(){this.language="tr"}isNormalizable(e){return!!function(e){for(const t of e)if(wg(t))return!0;return!1}(e)&&3<=e.length}normalize(e){const t=e.toLowerCase();for(const e of gg)if(t.endsWith(e.pattern)){const r=t.slice(0,-e.pattern.length);if((e.minStemLength??2)>r.length)continue;if(!Tg(r,e.pattern)){const t=.9*e.confidence,n={removedSuffixes:[e.pattern]};return e.conjugationType&&(n.conjugationType=e.conjugationType),em(r,t,n)}const n={removedSuffixes:[e.pattern]};return e.conjugationType&&(n.conjugationType=e.conjugationType),em(r,e.confidence,n)}return Qp(e)}})}}),Og={};dm(Og,{TurkishTokenizer:()=>Lg,turkishTokenizer:()=>jg});var Ng,Ig,Rg,Mg,Wg=mm({"src/tokenizers/turkish.ts"(){Kf(),Pg(),Md(),Gf(),lv(),Vy(),Sg=new Set(["ile","için","kadar","gibi","önce","üzerinde","altında","içinde","dışında","arasında","karşı","göre","rağmen","boyunca"]),Cg=new Set(["de","da","te","ta","den","dan","ten","tan","e","a","ye","ya","i","ı","u","ü","in","ın","un","ün","le","la","yle","yla"]),Ag=[{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:"sonuncu",normalized:"last"},{native:"sonraki",normalized:"next"},{native:"önceki",normalized:"previous"},{native:"onceki",normalized:"previous"},{native:"enyakın",normalized:"closest"},{native:"enyakin",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:"farebas",normalized:"mousedown"},{native:"farebırak",normalized:"mouseup"},{native:"farebirak",normalized:"mouseup"},{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"}],jg=new(Lg=class extends Xp{constructor(){super(),this.language="tr",this.direction="ltr",this.initializeKeywordsFromProfile(Od,Ag),this.setNormalizer(new kg),this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractor(new Iy),this.registerExtractor(new $f),this.registerExtractor(new Vf)}classifyToken(e){const t=e.toLowerCase();return Sg.has(t)||Cg.has(t)?"particle":this.isKeyword(t)?"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"}})}}),_g={};dm(_g,{ChineseTokenizer:()=>Rg,chineseTokenizer:()=>Mg});var qg,$g,Vg,Dg,Bg,Hg,Fg=mm({"src/tokenizers/chinese.ts"(){Kf(),Ud(),Gf(),lv(),Ah(),Lh(),iv(),Ng=new Set(["把","在","从","到","向","给","对","用","被","让","的","地","得","了","着","过","吗","呢","吧"]),Ig=[{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"}],Mg=new(Rg=class extends Xp{constructor(){super(),this.language="zh",this.direction="ltr",this.initializeKeywordsFromProfile(Vd,Ig),this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractor(new tv),this.registerExtractor(new xh),this.registerExtractor(new gh),this.registerExtractor(new $f),this.registerExtractor(new Vf)}classifyToken(e){return Ng.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 Kg(e){return/[áàâãéêíóôõúüçÁÀÂÃÉÊÍÓÔÕÚÜÇ]/.test(e)}var Ug,Gg,Yg,Zg,Jg=mm({"src/tokenizers/morphology/portuguese-normalizer.ts"(){kv(),qg=["-se","-me","-te","-nos","-vos"],$g=[{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"}],Vg=[{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"}],Dg=[{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"}],Bg=[...$g,...Vg,...Dg].sort((e,t)=>t.ending.length-e.ending.length),new(Hg=class{constructor(){this.language="pt"}isNormalizable(e){return e.length>=3&&function(e){const t=e.toLowerCase();if(t.endsWith("ar")||t.endsWith("er")||t.endsWith("ir"))return!0;if(t.endsWith("ando")||t.endsWith("endo")||t.endsWith("indo"))return!0;if(t.endsWith("ado")||t.endsWith("ido"))return!0;if(t.endsWith("ar-se")||t.endsWith("er-se")||t.endsWith("ir-se"))return!0;for(const t of e)if(Kg(t))return!0;return!1}(e)}normalize(e){const t=e.toLowerCase();if((t.endsWith("ar")||t.endsWith("er")||t.endsWith("ir"))&&!qg.some(e=>t.endsWith(e)))return Qp(e);const r=this.tryReflexiveNormalization(t);if(r)return r;const n=this.tryConjugationNormalization(t);return n||Qp(e)}tryReflexiveNormalization(e){for(const t of qg)if(e.endsWith(t)){const r=e.slice(0,-t.length);if(r.endsWith("ar")||r.endsWith("er")||r.endsWith("ir"))return em(r,.88,{removedSuffixes:[t],conjugationType:"reflexive"});const n=this.tryConjugationNormalization(r);if(n&&n.stem!==r)return em(n.stem,.95*n.confidence,{removedSuffixes:[t,...n.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}tryConjugationNormalization(e){for(const t of Bg)if(e.endsWith(t.ending)){const r=e.slice(0,-t.ending.length);if(2>r.length)continue;return em(r+t.stem,t.confidence,{removedSuffixes:[t.ending],conjugationType:t.type})}return null}})}});var Xg,Qg,ek,tk,rk=mm({"src/tokenizers/extractors/portuguese-keyword.ts"(){var e;({isLetter:Ug,isIdentifierChar:Gg}=(e=/[a-zA-ZáâãéêíóôõúçÁÂÃÉÊÍÓÔÕÚÇ]/,{isLetter:t=>e.test(t),isIdentifierChar:t=>/[0-9]/.test(t)||e.test(t)})),Yg=new Set(["em","a","de","para","com","sem","por","sobre","entre","antes","depois","dentro","fora","ao","do","da","no","na"]),Zg=class{constructor(){this.name="portuguese-keyword"}setContext(e){this.context=e}canExtract(e,t){return Ug(e[t])}extract(e,t){if(!this.context)throw Error("PortugueseKeywordExtractor: context not set");let r=t,n="";for(;e.length>r&&Gg(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase(),a=Yg.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(n);if(e.stem!==n&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:n,length:r-t,metadata:{normalized:s||l,isPreposition:a}}}}}}),nk={};dm(nk,{PortugueseTokenizer:()=>ek,portugueseTokenizer:()=>tk});var ik,ak,ok,sk,lk,ck,uk=mm({"src/tokenizers/portuguese.ts"(){Kf(),gd(),Jg(),Gf(),lv(),rk(),Xg=new Set(["em","a","de","desde","até","ate","com","sem","por","para","sobre","entre","antes","depois","dentro","fora","ao","do","no","na"]),Qg=[{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:"maispróximo",normalized:"closest"},{native:"maisproximo",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"}],tk=new(ek=class extends Xp{constructor(){super(),this.language="pt",this.direction="ltr",this.initializeKeywordsFromProfile(fd,Qg),this.setNormalizer(new Hg),this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractors([new Zg]),this.registerExtractor(new $f),this.registerExtractor(new Vf)}classifyToken(e){const t=e.toLowerCase();return Xg.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":e.startsWith("/")||e.startsWith("./")||e.startsWith("http")?"url":"identifier"}})}});var pk,mk,dk,fk,hk=mm({"src/tokenizers/morphology/french-normalizer.ts"(){kv(),ik=["toi","vous","nous"],ak=[{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"}],ok=[{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"}],sk=[{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"}],lk=[...ak,...ok,...sk].sort((e,t)=>t.ending.length-e.ending.length),new(ck=class{constructor(){this.language="fr"}isNormalizable(e){return e.length>=3&&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))}(e)}normalize(e){const t=e.toLowerCase();if((t.endsWith("er")||t.endsWith("ir")||t.endsWith("re"))&&t.length>=4)return Qp(e);const r=this.tryReflexiveNormalization(t);if(r)return r;const n=this.tryConjugationNormalization(t);return n||Qp(e)}tryReflexiveNormalization(e){for(const t of ik){const r="-"+t;if(e.endsWith(r)){const t=e.slice(0,-r.length),n=this.tryConjugationNormalization(t);if(n&&n.stem!==t)return em(n.stem,.95*n.confidence,{removedSuffixes:[r,...n.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}}return null}tryConjugationNormalization(e){for(const t of lk)if(e.endsWith(t.ending)){const r=e.slice(0,-t.ending.length);if(2>r.length)continue;return em(r+t.stem,t.confidence,{removedSuffixes:[t.ending],conjugationType:t.type})}return null}})}});var yk,vk,gk,kk=mm({"src/tokenizers/extractors/french-keyword.ts"(){var e;({isLetter:pk,isIdentifierChar:mk}=(e=/[a-zA-ZàâæçéèêëïîôùûüÿœÀÂÆÇÉÈÊËÏÎÔÙÛÜŸŒ]/,{isLetter:t=>e.test(t),isIdentifierChar:t=>/[0-9]/.test(t)||e.test(t)})),dk=new Set(["à","a","de","du","des","dans","sur","sous","avec","sans","par","pour","entre","avant","après","apres","depuis","vers","chez","contre","au","aux"]),fk=class{constructor(){this.name="french-keyword"}setContext(e){this.context=e}canExtract(e,t){return pk(e[t])}extract(e,t){if(!this.context)throw Error("FrenchKeywordExtractor: context not set");let r=t,n="";for(;e.length>r&&mk(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase(),a=dk.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(n);if(e.stem!==n&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:n,length:r-t,metadata:{normalized:s||l,isPreposition:a}}}}}}),bk={};dm(bk,{FrenchTokenizer:()=>vk,frenchTokenizer:()=>gk});var wk,zk,xk,Ek,Tk,Sk=mm({"src/tokenizers/french.ts"(){Kf(),Fm(),hk(),Gf(),lv(),kk(),yk=[{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:"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"}],gk=new(vk=class extends Xp{constructor(){super(),this.language="fr",this.direction="ltr",this.initializeKeywordsFromProfile(Vm,yk),this.normalizer=new ck,this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractors([new fk]),this.registerExtractor(new $f),this.registerExtractor(new Vf)}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"}})}});var Ck,Ak,Lk,jk,Pk=mm({"src/tokenizers/morphology/german-normalizer.ts"(){kv(),wk=["an","auf","aus","ein","mit","vor","zu","ab","bei","nach","weg","um","her","hin"],zk=[{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"}],xk=[{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"}],Ek=[...zk,...xk].sort((e,t)=>t.ending.length-e.ending.length),Tk=class{constructor(){this.language="de"}isNormalizable(e){return e.length>=3&&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))}(e)}normalize(e){const t=e.toLowerCase();if(t.endsWith("en")&&t.length>=4)return Qp(e);if((t.endsWith("eln")||t.endsWith("ern"))&&t.length>=5)return Qp(e);const r=this.tryParticipleNormalization(t);if(r)return r;const n=this.tryConjugationNormalization(t);return n||Qp(e)}tryParticipleNormalization(e){for(const t of wk)if(e.startsWith(t+"ge")){const r=e.slice(t.length),n=this.trySimpleParticipleNormalization(r);if(n){const e={removedPrefixes:["ge"],conjugationType:"participle"};return n.metadata?.removedSuffixes&&(e.removedSuffixes=n.metadata.removedSuffixes),em(t+n.stem,.95*n.confidence,e)}}return this.trySimpleParticipleNormalization(e)}trySimpleParticipleNormalization(e){if(!e.startsWith("ge"))return null;const t=e.slice(2);if(t.endsWith("t")&&t.length>=3){return em(t.slice(0,-1)+"en",.85,{removedPrefixes:["ge"],removedSuffixes:["t"],conjugationType:"participle"})}return t.endsWith("en")&&t.length>=4?em(t,.82,{removedPrefixes:["ge"],conjugationType:"participle"}):null}tryConjugationNormalization(e){for(const t of Ek)if(e.endsWith(t.ending)){const r=e.slice(0,-t.ending.length);if(2>r.length)continue;return em(r+t.stem,t.confidence,{removedSuffixes:[t.ending],conjugationType:t.type})}return null}},new Tk}});var Ok,Nk,Ik,Rk=mm({"src/tokenizers/extractors/german-keyword.ts"(){var e;({isLetter:Ck,isIdentifierChar:Ak}=(e=/[a-zA-ZäöüÄÖÜß]/,{isLetter:t=>e.test(t),isIdentifierChar:t=>/[0-9]/.test(t)||e.test(t)})),Lk=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"]),jk=class{constructor(){this.name="german-keyword"}setContext(e){this.context=e}canExtract(e,t){return Ck(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 r=t,n="";for(;e.length>r&&Ak(e[r]);)n+=e[r++];if(!n)return null;const i=n.toLowerCase(),a=Lk.has(i),o=this.context.lookupKeyword(n),s=o&&o.normalized!==o.native?o.normalized:void 0;let l;if(!o&&this.context.normalizer){const e=this.context.normalizer.normalize(n);if(e.stem!==n&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:n,length:r-t,metadata:{normalized:s||l,isPreposition:a}}}}}}),Mk={};dm(Mk,{GermanTokenizer:()=>Nk,germanTokenizer:()=>Ik});var Wk,_k,qk,$k,Vk=mm({"src/tokenizers/german.ts"(){Kf(),Mm(),Pk(),Gf(),lv(),Rk(),Ok=[{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:"nächstgelegene",normalized:"closest"},{native:"nachstgelegene",normalized:"closest"},{native:"vorherige",normalized:"previous"},{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"}],Ik=new(Nk=class extends Xp{constructor(){super(),this.language="de",this.direction="ltr",this.initializeKeywordsFromProfile(Om,Ok),this.normalizer=new Tk,this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractors([new jk]),this.registerExtractor(new $f),this.registerExtractor(new Vf)}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":e.startsWith("/")||e.startsWith("./")||e.startsWith("http")?"url":"identifier"}})}}),Dk={};dm(Dk,{IndonesianTokenizer:()=>qk,indonesianTokenizer:()=>$k});var Bk,Hk,Fk=mm({"src/tokenizers/indonesian.ts"(){Kf(),ed(),Gf(),lv(),Py(),Wk=new Set(["di","ke","dari","pada","dengan","tanpa","untuk","oleh","antara","sebelum","sesudah","setelah","selama","sampai","hingga","sejak","menuju","tentang","terhadap","melalui","dalam","luar"]),_k=[{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"}],$k=new(qk=class extends Xp{constructor(){super(),this.language="id",this.direction="ltr",this.initializeKeywordsFromProfile(Zm,_k),this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractors([new Ty]),this.registerExtractor(new $f),this.registerExtractor(new Vf)}classifyToken(e){const t=e.toLowerCase();return Wk.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":e.startsWith("/")||e.startsWith("./")||e.startsWith("http")?"url":"identifier"}})}});function Kk(e){const t=e.charCodeAt(0);return t>=65&&90>=t||t>=97&&122>=t||("ñ"===e||"Ñ"===e||"'"===e||"'"===e)}var Uk,Gk,Yk,Zk,Jk,Xk=mm({"src/tokenizers/morphology/quechua-normalizer.ts"(){kv(),Bk=[{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}],Hk=new class{constructor(){this.language="qu"}isNormalizable(e){if(!function(e){for(const t of e)if(Kk(t))return!0;return!1}(e))return!1;if(3>e.length)return!1;return!!/[aiu]/.test(e.toLowerCase())}normalize(e){const t=e.toLowerCase();for(const e of Bk)if(t.endsWith(e.pattern)){let r=t.slice(0,-e.pattern.length);e.replacement&&!r.endsWith(e.replacement)&&(r+=e.replacement);if((e.minStemLength??2)>r.length)continue;if(!this.isValidStem(r))continue;const n={removedSuffixes:[e.pattern]};return e.conjugationType&&(n.conjugationType=e.conjugationType),em(r,e.confidence,n)}return Qp(e)}isValidStem(e){if(2>e.length)return!1;if(!/[aeiou]/.test(e))return!1;return!new Set(["ta","man","pi","wan","pa","kama","hina"]).has(e)}}}}),Qk={};dm(Qk,{QuechuaTokenizer:()=>Zk,quechuaTokenizer:()=>Jk});var eb,tb,rb,nb,ib=mm({"src/tokenizers/quechua.ts"(){Kf(),wd(),Xk(),Gf(),lv(),Gy(),Uk=class{constructor(){this.name="quechua-string-literal"}canExtract(e,t){return'"'===e[t]||"'"===e[t]}extract(e,t){const r=e[t];let n=r,i=t+1;for(;e.length>i;){const t=e[i];if(t===r)return n+=t,{value:n,length:n.length};"\\"===t&&e.length>i+1?(n+=t+e[i+1],i+=2):(n+=t,i++)}return null}},Gk=new Set(["-ta","-man","-manta","-pi","-wan","-paq","-kama","-rayku","-hina","ta","man","manta","pi","wan","paq","kama","hina","pa"]),Yk=[{native:"cheqaq",normalized:"true"},{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:"ñawpaqpi",normalized:"before"},{native:"nawpaqpi",normalized:"before"},{native:"qhepapi",normalized:"after"},{native:"qhipapi",normalized:"after"},{native:"ñawpaq",normalized:"first"},{native:"nawpaq",normalized:"first"},{native:"qhipa",normalized:"last"},{native:"hamuq",normalized:"next"},{native:"qhipantin",normalized:"next"},{native:"ñawpaqnin",normalized:"previous"},{native:"ñawpaq kaq",normalized:"previous"},{native:"ñawpaq_kaq",normalized:"previous"},{native:"kaylla",normalized:"closest"},{native:"qaylla",normalized:"closest"},{native:"tayta",normalized:"parent"},{native:"llikllay",normalized:"click"},{native:"ñitiy",normalized:"click"},{native:"ñit'iy",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:"ratñitiy",normalized:"mousedown"},{native:"rathuqariy",normalized:"mouseup"},{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"}],Jk=new(Zk=class extends Xp{constructor(){super(),this.language="qu",this.direction="ltr",this.initializeKeywordsFromProfile(vd,Yk),this.setNormalizer(Hk),this.registerExtractors(ov()),this.registerExtractor(new Uk),this.registerExtractor(new wu),this.registerExtractor(new $y),this.registerExtractor(new $f),this.registerExtractor(new Vf)}classifyToken(e){const t=e.toLowerCase();return Gk.has(t)?"particle":this.isKeyword(t)?"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('"')||/^\d/.test(e)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(e)?"operator":"identifier"}})}}),ab={};dm(ab,{SwahiliTokenizer:()=>rb,swahiliTokenizer:()=>nb});var ob,sb,lb,cb,ub,pb,mb=mm({"src/tokenizers/swahili.ts"(){Kf(),Cd(),Gf(),lv(),Ry(),eb=new Set(["kwa","na","katika","kwenye","kutoka","hadi","mpaka","kabla","baada","wakati","bila","kuhusu","karibu","mbele","nyuma","ndani","nje","juu","chini","kati"]),tb=[{native:"kweli",normalized:"true"},{native:"uongo",normalized:"false"},{native:"null",normalized:"null"},{native:"haijafafanuliwa",normalized:"undefined"},{native:"kwanza",normalized:"first"},{native:"wamwisho",normalized:"last"},{native:"ifuatayo",normalized:"next"},{native:"ijayo",normalized:"next"},{native:"iliyotangulia",normalized:"previous"},{native:"iliyopita",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:"panya_shuka",normalized:"mousedown"},{native:"panya_juu",normalized:"mouseup"},{native:"panya_ingia",normalized:"mouseenter"},{native:"panya_toka",normalized:"mouseleave"},{native:"panya_nje",normalized:"mouseout"},{native:"panya_sogea",normalized:"mousemove"},{native:"kitufe_shuka",normalized:"keydown"},{native:"kitufe_juu",normalized:"keyup"},{native:"fifia",normalized:"blur"},{native:"pakia",normalized:"load"},{native:"sukuma",normalized:"scroll"},{native:"input",normalized:"input"},{native:"ingizo",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"}],nb=new(rb=class extends Xp{constructor(){super(),this.language="sw",this.direction="ltr",this.initializeKeywordsFromProfile(xd,tb),this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractors([new jy]),this.registerExtractor(new $f),this.registerExtractor(new Vf)}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":["==","!=","<=",">=","<",">","&&","||","!"].includes(e)?"operator":e.startsWith("/")||e.startsWith("./")||e.startsWith("http")?"url":"identifier"}})}});function db(e){return/[àèéìíîòóùúÀÈÉÌÍÎÒÓÙÚ]/.test(e)}var fb,hb,yb=mm({"src/tokenizers/morphology/italian-normalizer.ts"(){kv(),ob=["si","mi","ti","ci","vi"],sb=[{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"}],lb=[{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"}],cb=[{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"}],ub=[...sb,...lb,...cb].sort((e,t)=>t.ending.length-e.ending.length),new(pb=class{constructor(){this.language="it"}isNormalizable(e){return e.length>=3&&function(e){const t=e.toLowerCase();if(t.endsWith("are")||t.endsWith("ere")||t.endsWith("ire"))return!0;if(t.endsWith("ando")||t.endsWith("endo"))return!0;if(t.endsWith("ato")||t.endsWith("uto")||t.endsWith("ito"))return!0;if(t.endsWith("arsi")||t.endsWith("ersi")||t.endsWith("irsi"))return!0;for(const t of e)if(db(t))return!0;return!1}(e)}normalize(e){const t=e.toLowerCase();if((t.endsWith("are")||t.endsWith("ere")||t.endsWith("ire"))&&!ob.some(e=>t.endsWith(e+"are")||t.endsWith(e+"ere")||t.endsWith(e+"ire")))return Qp(e);const r=this.tryReflexiveNormalization(t);if(r)return r;const n=this.tryConjugationNormalization(t);return n||Qp(e)}tryReflexiveNormalization(e){for(const t of ob)if(e.endsWith(t)){const r=e.slice(0,-t.length);if(r.endsWith("ar")||r.endsWith("er")||r.endsWith("ir")){return em(r+"e",.88,{removedSuffixes:[t],conjugationType:"reflexive"})}if(r.endsWith("are")||r.endsWith("ere")||r.endsWith("ire"))return em(r,.88,{removedSuffixes:[t],conjugationType:"reflexive"});const n=this.tryConjugationNormalization(r);if(n&&n.stem!==r)return em(n.stem,.95*n.confidence,{removedSuffixes:[t,...n.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}tryConjugationNormalization(e){for(const t of ub)if(e.endsWith(t.ending)){const r=e.slice(0,-t.ending.length);if(2>r.length)continue;return em(r+t.stem,t.confidence,{removedSuffixes:[t.ending],conjugationType:t.type})}return null}})}});var vb,gb,kb,bb,wb=mm({"src/tokenizers/extractors/romance-language-keyword.ts"(){fb=class{constructor(e,t,r){this.name=e;const n=(i=t,{isLetter:e=>i.test(e),isIdentifierChar:e=>/[0-9]/.test(e)||i.test(e)});var i;this.isLetter=n.isLetter,this.isIdentifierChar=n.isIdentifierChar,this.prepositions=r}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 r=t,n="";for(;e.length>r&&this.isIdentifierChar(e[r]);)n+=e[r++];if(!n)return null;const i=n.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(n);if(e.stem!==n&&e.confidence>=.7){const t=this.context.lookupKeyword(e.stem);t&&(l=t.normalized)}}return{value:n,length:r-t,metadata:{normalized:s||l,isPreposition:a}}}},hb=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"])}}),zb={};dm(zb,{ItalianTokenizer:()=>kb,italianTokenizer:()=>bb});var xb,Eb,Tb,Sb=mm({"src/tokenizers/italian.ts"(){Kf(),yb(),nd(),Gf(),lv(),wb(),vb=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"]),gb=[{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"}],bb=new(kb=class extends Xp{constructor(){super(),this.language="it",this.direction="ltr",this.initializeKeywordsFromProfile(Qm,gb),this.setNormalizer(new pb),this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractors([new fb("italian-keyword",/[a-zA-ZàèéìíîòóùúÀÈÉÌÍÎÒÓÙÚ]/,hb)]),this.registerExtractor(new $f),this.registerExtractor(new Vf)}classifyToken(e){const t=e.toLowerCase();return vb.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":e.startsWith("/")||e.startsWith("./")||e.startsWith("http")?"url":"identifier"}})}}),Cb={};dm(Cb,{VietnameseTokenizer:()=>Eb,vietnameseTokenizer:()=>Tb});var Ab,Lb,jb,Pb,Ob,Nb,Ib=mm({"src/tokenizers/vietnamese.ts"(){Kf(),Dd(),Bh(),Gf(),lv(),xb=[{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:"giá trị",normalized:"value"},{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"}],Tb=new(Eb=class extends Xp{constructor(){super(),this.language="vi",this.direction="ltr",this.initializeKeywordsFromProfile(_d,xb),this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractors([new Ch]),this.registerExtractor(new $f),this.registerExtractor(new Vf)}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":e.startsWith("/")||e.startsWith("./")||e.startsWith("http")?"url":"identifier"}})}}),Rb=mm({"src/tokenizers/morphology/polish-normalizer.ts"(){kv(),Ab=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(Lb=class{constructor(){this.language="pl"}isNormalizable(e){return e.length>=3&&/[a-zA-ZąęćńóśźżłĄĘĆŃÓŚŹŻŁ]/.test(e)}normalize(e){const t=e.toLowerCase();if(this.isInfinitive(t))return Qp(t);const r=this.tryImperativeNormalization(t);if(r)return r;const n=this.tryPastTenseNormalization(t);if(n)return n;const i=this.tryPresentTenseNormalization(t);return i||Qp(t)}isInfinitive(e){return["ać","eć","ić","yć","ąć","ować","iwać","ywać"].some(t=>e.endsWith(t))}tryImperativeNormalization(e){return Ab.has(e)?em(Ab.get(e),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):e.endsWith("aj")?em(e.slice(0,-2)+"ać",.8,{removedSuffixes:["aj"],conjugationType:"imperative"}):e.endsWith("uj")?em(e.slice(0,-2)+"ować",.8,{removedSuffixes:["uj"],conjugationType:"imperative"}):e.endsWith("ij")?em(e.slice(0,-2)+"ić",.75,{removedSuffixes:["ij"],conjugationType:"imperative"}):null}tryPresentTenseNormalization(e){return e.endsWith("uję")||e.endsWith("uje")?em(e.slice(0,-3)+"ować",.85,{removedSuffixes:["uję"],conjugationType:"present"}):e.endsWith("am")&&e.length>3?em(e.slice(0,-2)+"ać",.8,{removedSuffixes:["am"],conjugationType:"present"}):e.endsWith("em")&&e.length>3?em(e.slice(0,-2)+"eć",.75,{removedSuffixes:["em"],conjugationType:"present"}):e.endsWith("ę")&&e.length>2?em(e.slice(0,-1)+"ać",.7,{removedSuffixes:["ę"],conjugationType:"present"}):null}tryPastTenseNormalization(e){if(e.endsWith("ałem")||e.endsWith("ałam"))return em(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 em(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 em(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 em(e.slice(0,-t)+"ić",.8,{removedSuffixes:[e.slice(-t)],conjugationType:"past"})}return null}})}}),Mb={};dm(Mb,{PolishTokenizer:()=>Ob,polishTokenizer:()=>Nb});var Wb,_b,qb=mm({"src/tokenizers/polish.ts"(){Kf(),hd(),Rb(),Gf(),lv(),Sy(),jb=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"]),Pb=[{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"}],Nb=new(Ob=class extends Xp{constructor(){super(),this.language="pl",this.direction="ltr",this.initializeKeywordsFromProfile(pd,Pb),this.setNormalizer(new Lb),this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractors([new by]),this.registerExtractor(new $f),this.registerExtractor(new Vf)}classifyToken(e){const t=e.toLowerCase();return jb.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":e.startsWith("/")||e.startsWith("./")||e.startsWith("http")?"url":"identifier"}})}});function $b(e){return/[а-яА-ЯёЁ]/.test(e)}var Vb,Db,Bb,Hb,Fb=mm({"src/tokenizers/morphology/russian-normalizer.ts"(){kv(),Wb=new Map([["переключи","переключить"],["добавь","добавить"],["удали","удалить"],["убери","убрать"],["положи","положить"],["помести","поместить"],["вставь","вставить"],["возьми","взять"],["создай","создать"],["клонируй","клонировать"],["поменяй","поменять"],["трансформируй","трансформировать"],["установи","установить"],["задай","задать"],["получи","получить"],["увеличь","увеличить"],["уменьши","уменьшить"],["запиши","записать"],["покажи","показать"],["скрой","скрыть"],["спрячь","спрятать"],["анимируй","анимировать"],["вызови","вызвать"],["отправь","отправить"],["сфокусируй","сфокусировать"],["размой","размыть"],["перейди","перейти"],["иди","идти"],["жди","ждать"],["подожди","подождать"],["загрузи","загрузить"],["повтори","повторить"],["продолжи","продолжить"],["брось","бросить"],["верни","вернуть"],["скажи","сказать"],["инициализируй","инициализировать"],["измерь","измерить"]]),new(_b=class{constructor(){this.language="ru"}isNormalizable(e){return e.length>=3&&function(e){for(const t of e)if($b(t))return!0;return!1}(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 Qp(e);const r=this.tryImperativeLookup(t);if(r)return r;const n=this.tryPastTenseNormalization(t);if(n)return n;const i=this.tryPresentTenseNormalization(t);if(i)return i;const a=this.tryGenericImperativeNormalization(t);return a||Qp(e)}tryReflexiveNormalization(e){e.endsWith("ся");const t=e.slice(0,-2);if(e.endsWith("ться")||e.endsWith("тись")||e.endsWith("чься"))return Qp(e);const r=this.normalizeNonReflexive(t);if(1>r.confidence){return em(r.stem.endsWith("ть")?r.stem.slice(0,-2)+"ться":r.stem+"ся",.95*r.confidence,{removedSuffixes:["ся",...r.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}normalizeNonReflexive(e){if(e.endsWith("ть")||e.endsWith("ти")||e.endsWith("чь"))return Qp(e);const t=this.tryImperativeLookup(e);if(t)return t;const r=this.tryPastTenseNormalization(e);if(r)return r;const n=this.tryPresentTenseNormalization(e);if(n)return n;const i=this.tryGenericImperativeNormalization(e);return i||Qp(e)}tryImperativeLookup(e){return Wb.has(e)?em(Wb.get(e),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(e){return e.endsWith("йте")&&e.length>5?em(e.slice(0,-3)+"ть",.8,{removedSuffixes:["йте"],conjugationType:"imperative"}):e.endsWith("ите")&&e.length>5?em(e.slice(0,-3)+"ить",.8,{removedSuffixes:["ите"],conjugationType:"imperative"}):e.endsWith("й")&&e.length>3?em(e.slice(0,-1)+"ть",.75,{removedSuffixes:["й"],conjugationType:"imperative"}):e.endsWith("и")&&e.length>3?em(e+"ть",.7,{removedSuffixes:["и→ить"],conjugationType:"imperative"}):null}tryPastTenseNormalization(e){return e.endsWith("ала")&&e.length>4?em(e.slice(0,-3)+"ать",.85,{removedSuffixes:["ала"],conjugationType:"past"}):e.endsWith("ила")&&e.length>4?em(e.slice(0,-3)+"ить",.85,{removedSuffixes:["ила"],conjugationType:"past"}):e.endsWith("ело")&&e.length>4?em(e.slice(0,-3)+"еть",.82,{removedSuffixes:["ело"],conjugationType:"past"}):e.endsWith("або")&&e.length>4?em(e.slice(0,-3)+"ать",.82,{removedSuffixes:["або"],conjugationType:"past"}):e.endsWith("али")&&e.length>4?em(e.slice(0,-3)+"ать",.85,{removedSuffixes:["али"],conjugationType:"past"}):e.endsWith("или")&&e.length>4?em(e.slice(0,-3)+"ить",.85,{removedSuffixes:["или"],conjugationType:"past"}):e.endsWith("ал")&&e.length>3?em(e.slice(0,-2)+"ать",.82,{removedSuffixes:["ал"],conjugationType:"past"}):e.endsWith("ил")&&e.length>3?em(e.slice(0,-2)+"ить",.82,{removedSuffixes:["ил"],conjugationType:"past"}):null}tryPresentTenseNormalization(e){return e.endsWith("ишь")&&e.length>4?em(e.slice(0,-3)+"ить",.8,{removedSuffixes:["ишь"],conjugationType:"present"}):e.endsWith("ит")&&e.length>3?em(e.slice(0,-2)+"ить",.78,{removedSuffixes:["ит"],conjugationType:"present"}):e.endsWith("им")&&e.length>3?em(e.slice(0,-2)+"ить",.78,{removedSuffixes:["им"],conjugationType:"present"}):e.endsWith("ят")&&e.length>3?em(e.slice(0,-2)+"ить",.78,{removedSuffixes:["ят"],conjugationType:"present"}):e.endsWith("ешь")&&e.length>4?em(e.slice(0,-3)+"ать",.75,{removedSuffixes:["ешь"],conjugationType:"present"}):e.endsWith("ет")&&e.length>3?em(e.slice(0,-2)+"ать",.72,{removedSuffixes:["ет"],conjugationType:"present"}):e.endsWith("ем")&&e.length>3?em(e.slice(0,-2)+"ать",.72,{removedSuffixes:["ем"],conjugationType:"present"}):e.endsWith("ют")&&e.length>3?em(e.slice(0,-2)+"ать",.75,{removedSuffixes:["ют"],conjugationType:"present"}):e.endsWith("ут")&&e.length>3?em(e.slice(0,-2)+"ать",.72,{removedSuffixes:["ут"],conjugationType:"present"}):null}})}}),Kb={};dm(Kb,{RussianTokenizer:()=>Bb,russianTokenizer:()=>Hb});var Ub,Gb,Yb=mm({"src/tokenizers/russian.ts"(){Kf(),Fb(),Ed(),Gf(),lv(),Gh(),iv(),Vb=new Set(["в","во","на","с","со","к","ко","о","об","обо","у","от","до","из","за","по","под","над","перед","передо","между","через","без","для","при","про","после","вокруг","против","вместо","кроме","среди"]),Db=[{native:"мышьвниз",normalized:"mousedown"},{native:"мышьвверх",normalized:"mouseup"},{native:"изменениеразмера",normalized:"resize"},{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:"last"},{native:"следующий",normalized:"next"},{native:"предыдущий",normalized:"previous"},{native:"ближайший",normalized:"closest"},{native:"родитель",normalized:"parent"},{native:"случайный",normalized:"random"},{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"}],Hb=new(Bb=class extends Xp{constructor(){super(),this.language="ru",this.direction="ltr",this.initializeKeywordsFromProfile(bd,Db),this.setNormalizer(new _b),this.registerExtractors([...ov(),new $h("russian-keyword",/[a-zA-Zа-яА-ЯёЁ]/,Vh),new bu,new wu,new tv,new $f,new Vf])}classifyToken(e){const t=e.toLowerCase();return Vb.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":e.startsWith("/")||e.startsWith("./")||e.startsWith("http")?"url":"identifier"}})}});var Zb,Jb,Xb,Qb,ew=mm({"src/tokenizers/morphology/ukrainian-normalizer.ts"(){kv(),Ub=new Map([["перемкни","перемкнути"],["додай","додати"],["видали","видалити"],["прибери","прибрати"],["поклади","покласти"],["помісти","помістити"],["встав","вставити"],["візьми","взяти"],["створи","створити"],["клонуй","клонувати"],["поміняй","поміняти"],["трансформуй","трансформувати"],["встанови","встановити"],["задай","задати"],["отримай","отримати"],["збільш","збільшити"],["зменш","зменшити"],["запиши","записати"],["покажи","показати"],["сховай","сховати"],["приховай","приховати"],["анімуй","анімувати"],["виклич","викликати"],["надішли","надіслати"],["сфокусуй","сфокусувати"],["розфокусуй","розфокусувати"],["перейди","перейти"],["йди","йти"],["чекай","чекати"],["зачекай","зачекати"],["завантаж","завантажити"],["повтори","повторити"],["продовжуй","продовжити"],["кинь","кинути"],["поверни","повернути"],["скажи","сказати"],["ініціалізуй","ініціалізувати"],["виміряй","виміряти"]]),new(Gb=class{constructor(){this.language="uk"}isNormalizable(e){return e.length>=3&&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 Qp(e);const r=this.tryImperativeLookup(t);if(r)return r;const n=this.tryPastTenseNormalization(t);if(n)return n;const i=this.tryPresentTenseNormalization(t);if(i)return i;const a=this.tryGenericImperativeNormalization(t);return a||Qp(e)}tryReflexiveNormalization(e){const t=e.slice(0,-2);if(e.endsWith("тися")||e.endsWith("чися"))return Qp(e);const r=this.normalizeNonReflexive(t);if(1>r.confidence){return em(r.stem.endsWith("ти")?r.stem.slice(0,-2)+"тися":r.stem+"ся",.95*r.confidence,{removedSuffixes:["ся",...r.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}normalizeNonReflexive(e){if(e.endsWith("ти")||e.endsWith("чи"))return Qp(e);const t=this.tryImperativeLookup(e);if(t)return t;const r=this.tryPastTenseNormalization(e);if(r)return r;const n=this.tryPresentTenseNormalization(e);if(n)return n;const i=this.tryGenericImperativeNormalization(e);return i||Qp(e)}tryImperativeLookup(e){return Ub.has(e)?em(Ub.get(e),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(e){return e.endsWith("йте")&&e.length>5?em(e.slice(0,-3)+"ти",.8,{removedSuffixes:["йте"],conjugationType:"imperative"}):e.endsWith("іть")&&e.length>5?em(e.slice(0,-3)+"ити",.8,{removedSuffixes:["іть"],conjugationType:"imperative"}):e.endsWith("й")&&e.length>3?em(e.slice(0,-1)+"ти",.75,{removedSuffixes:["й"],conjugationType:"imperative"}):e.endsWith("и")&&e.length>3?em(e+"ти",.7,{removedSuffixes:["и→ити"],conjugationType:"imperative"}):null}tryPastTenseNormalization(e){return e.endsWith("ала")&&e.length>4?em(e.slice(0,-3)+"ати",.85,{removedSuffixes:["ала"],conjugationType:"past"}):e.endsWith("ила")&&e.length>4?em(e.slice(0,-3)+"ити",.85,{removedSuffixes:["ила"],conjugationType:"past"}):e.endsWith("али")&&e.length>4?em(e.slice(0,-3)+"ати",.85,{removedSuffixes:["али"],conjugationType:"past"}):e.endsWith("или")&&e.length>4?em(e.slice(0,-3)+"ити",.85,{removedSuffixes:["или"],conjugationType:"past"}):e.endsWith("ав")&&e.length>3?em(e.slice(0,-2)+"ати",.82,{removedSuffixes:["ав"],conjugationType:"past"}):e.endsWith("ив")&&e.length>3?em(e.slice(0,-2)+"ити",.82,{removedSuffixes:["ив"],conjugationType:"past"}):null}tryPresentTenseNormalization(e){return e.endsWith("иш")&&e.length>3?em(e.slice(0,-2)+"ити",.8,{removedSuffixes:["иш"],conjugationType:"present"}):e.endsWith("ить")&&e.length>4?em(e.slice(0,-3)+"ити",.78,{removedSuffixes:["ить"],conjugationType:"present"}):e.endsWith("имо")&&e.length>4?em(e.slice(0,-3)+"ити",.8,{removedSuffixes:["имо"],conjugationType:"present"}):e.endsWith("ять")&&e.length>4?em(e.slice(0,-3)+"ити",.78,{removedSuffixes:["ять"],conjugationType:"present"}):e.endsWith("єш")&&e.length>3?em(e.slice(0,-2)+"ати",.78,{removedSuffixes:["єш"],conjugationType:"present"}):e.endsWith("еш")&&e.length>3?em(e.slice(0,-2)+"ати",.75,{removedSuffixes:["еш"],conjugationType:"present"}):e.endsWith("є")&&e.length>2?em(e.slice(0,-1)+"ати",.72,{removedSuffixes:["є"],conjugationType:"present"}):e.endsWith("ємо")&&e.length>4?em(e.slice(0,-3)+"ати",.8,{removedSuffixes:["ємо"],conjugationType:"present"}):e.endsWith("ють")&&e.length>4?em(e.slice(0,-3)+"ати",.78,{removedSuffixes:["ють"],conjugationType:"present"}):e.endsWith("уть")&&e.length>4?em(e.slice(0,-3)+"ати",.75,{removedSuffixes:["уть"],conjugationType:"present"}):null}})}}),tw={};dm(tw,{UkrainianTokenizer:()=>Xb,ukrainianTokenizer:()=>Qb});var rw,nw,iw,aw,ow=mm({"src/tokenizers/ukrainian.ts"(){Kf(),ew(),qd(),Gf(),lv(),Gh(),iv(),Zb=new Set(["в","у","на","з","із","зі","до","від","о","об","при","для","під","над","перед","між","через","без","по","за","про","після","навколо","проти","замість","крім","серед","к"]),Jb=[{native:"мишавниз",normalized:"mousedown"},{native:"мишавгору",normalized:"mouseup"},{native:"змінарозміру",normalized:"resize"},{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:"last"},{native:"наступний",normalized:"next"},{native:"попередній",normalized:"previous"},{native:"найближчий",normalized:"closest"},{native:"батьківський",normalized:"parent"},{native:"випадковий",normalized:"random"},{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"}],Qb=new(Xb=class extends Xp{constructor(){super(),this.language="uk",this.direction="ltr",this.initializeKeywordsFromProfile(Rd,Jb),this.setNormalizer(new Gb),this.registerExtractors([...ov(),new $h("ukrainian-keyword",/[a-zA-Zа-яА-ЯіІїЇєЄґҐьЬ']/,Dh),new bu,new wu,new tv,new $f,new Vf])}classifyToken(e){const t=e.toLowerCase();return Zb.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":e.startsWith("/")||e.startsWith("./")||e.startsWith("http")?"url":"identifier"}})}}),sw={};dm(sw,{HebrewTokenizer:()=>iw,hebrewTokenizer:()=>aw});var lw,cw,uw=mm({"src/tokenizers/he.ts"(){Kf(),Gm(),Gf(),lv(),ev(),rv(),iv(),rw=new Set(["על","את","אל","מן","עם","בתוך","מתוך","ליד","אחרי","לפני","בין","עד","של"]),nw=[{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:"load",normalized:"load"},{native:"resize",normalized:"resize"},{native:"scroll",normalized:"scroll"},{native:"keydown",normalized:"keydown"},{native:"keyup",normalized:"keyup"},{native:"mousedown",normalized:"mousedown"},{native:"mouseup",normalized:"mouseup"},{native:"טעינה",normalized:"load"},{native:"גלילה",normalized:"scroll"},{native:"היא",normalized:"it"},{native:"הוא",normalized:"it"},{native:"שנייה",normalized:"s"},{native:"שניות",normalized:"s"},{native:"מילישנייה",normalized:"ms"},{native:"דקה",normalized:"m"},{native:"דקות",normalized:"m"},{native:"שעה",normalized:"h"},{native:"שעות",normalized:"h"}],aw=new(iw=class extends Xp{constructor(){super(),this.language="he",this.direction="rtl",this.initializeKeywordsFromProfile(Hm,nw),this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractor(new tv),this.registerExtractor(new Qy),this.registerExtractors([new Uy]),this.registerExtractor(new $f),this.registerExtractor(new Vf)}classifyToken(e){return rw.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":e.startsWith("/")||e.startsWith("./")||e.startsWith("http")?"url":"identifier"}})}});function pw(e){return/[\u0900-\u097F\u0A8E-\u0A8F]/u.test(e)}var mw,dw,fw,hw,yw=mm({"src/tokenizers/morphology/hindi-normalizer.ts"(){kv(),lw=[{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(cw=class{constructor(){this.language="hi"}isNormalizable(e){return e.length>=2&&pw(e)}normalize(e){const t=this.tryConjugationNormalization(e);return t||Qp(e)}tryConjugationNormalization(e){for(const t of lw)if(e.endsWith(t.suffix)){const r=Array.from(e),n=Array.from(t.suffix),i=r.slice(0,r.length-n.length),a=i.join("")+t.replacement;if((t.minStemLength??1)>i.length)continue;if(a.length>0&&!pw(a))continue;return em(a,t.confidence,{removedSuffixes:[t.suffix],conjugationType:t.type})}return null}})}}),vw={};dm(vw,{HindiTokenizer:()=>fw,hindiTokenizer:()=>hw});var gw,kw,bw=mm({"src/tokenizers/hindi.ts"(){Kf(),yw(),Jm(),Gf(),lv(),ey(),ty(),iv(),mw=new Set(["को","में","पर","से","का","की","के","तक","ने"]),dw=[{native:"माउसनीचे",normalized:"mousedown"},{native:"माउसऊपर",normalized:"mouseup"},{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"}],hw=new(fw=class extends Xp{constructor(){super(),this.language="hi",this.direction="ltr",this.initializeKeywordsFromProfile(Um,dw),this.normalizer=new cw,this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractor(new Xh),this.registerExtractor(new Uh),this.registerExtractor(new tv),this.registerExtractor(new $f),this.registerExtractor(new Vf)}classifyToken(e){return mw.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 ww(e){return/[\u0980-\u09FF]/u.test(e)}var zw,xw,Ew,Tw,Sw=mm({"src/tokenizers/morphology/bengali-normalizer.ts"(){kv(),gw=[{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}],kw=new class{constructor(){this.language="bn"}isNormalizable(e){return e.length>=2&&ww(e)}normalize(e){const t=this.tryConjugationNormalization(e);return t||Qp(e)}tryConjugationNormalization(e){for(const t of gw)if(e.endsWith(t.suffix)){const r=Array.from(e),n=Array.from(t.suffix),i=r.slice(0,r.length-n.length),a=i.join("")+t.replacement;if((t.minStemLength??1)>i.length)continue;if(a.length>0&&!ww(a))continue;return em(a,t.confidence,{removedSuffixes:[t.suffix],conjugationType:t.type})}return null}}}}),Cw={};dm(Cw,{BengaliTokenizer:()=>Ew,bengaliTokenizer:()=>Tw});var Aw,Lw,jw,Pw=mm({"src/tokenizers/bengali.ts"(){Kf(),Sw(),Nm(),Gf(),lv(),oy(),sy(),iv(),zw=new Set(["কে","তে","থেকে","র","এর","দিয়ে","জন্য","পর্যন্ত","এ","মধ্যে"]),xw=[{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"}],Tw=new(Ew=class extends Xp{constructor(){super(),this.language="bn",this.direction="ltr",this.initializeKeywordsFromProfile(Lm,xw),this.setNormalizer(kw),this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractor(new iy),this.registerExtractor(new Qh),this.registerExtractor(new tv),this.registerExtractor(new $f),this.registerExtractor(new Vf)}classifyToken(e){return zw.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")}})}}),Ow={};dm(Ow,{ThaiTokenizer:()=>Lw,thaiTokenizer:()=>jw});var Nw,Iw,Rw,Mw=mm({"src/tokenizers/thai.ts"(){Kf(),jd(),Gf(),lv(),py(),Aw=[{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"}],jw=new(Lw=class extends Xp{constructor(){super(),this.language="th",this.direction="ltr",this.initializeKeywordsFromProfile(Sd,Aw),this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractors([new ay]),this.registerExtractor(new $f),this.registerExtractor(new Vf)}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":e.startsWith("/")||e.startsWith("./")||e.startsWith("http")?"url":"identifier"}})}}),Ww={};dm(Ww,{MalayTokenizer:()=>Iw,malayTokenizer:()=>Rw});var _w,qw,$w,Vw,Dw,Bw=mm({"src/tokenizers/ms.ts"(){Kf(),md(),Gf(),lv(),hy(),Nw=[{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"}],Rw=new(Iw=class extends Xp{constructor(){super(),this.language="ms",this.direction="ltr",this.initializeKeywordsFromProfile(ld,Nw),this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractors([new uy]),this.registerExtractor(new $f),this.registerExtractor(new Vf)}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":e.startsWith("/")||e.startsWith("./")||e.startsWith("http")?"url":"identifier"}})}});function Hw(e){const t=e.charCodeAt(0);return t>=65&&90>=t||t>=97&&122>=t||("ñ"===e||"Ñ"===e)}var Fw,Kw,Uw,Gw=mm({"src/tokenizers/morphology/tagalog-normalizer.ts"(){kv(),_w=[{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}],qw=[{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}],$w=["um","in"],Vw=[{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"}],Dw=new class{constructor(){this.language="tl"}isNormalizable(e){return!!function(e){for(const t of e)if(Hw(t))return!0;return!1}(e)&&2<=e.length}normalize(e){let t=e.toLowerCase(),r=1;const n=[],i=[],a=[];for(const e of _w)if(t.startsWith(e.pattern)){const i=t.slice(e.pattern.length);if(i.length>=(e.minRemaining??2)){t=i,r-=e.confidencePenalty,n.push(e.pattern),a.push("prefix:"+e.pattern);break}}if(0===n.length)for(const e of qw)if(t.startsWith(e.pattern)){const i=t.slice(e.pattern.length);if(i.length>=(e.minRemaining??2)){t=i,r-=e.confidencePenalty,n.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:!1};const r=t[0],n=t[1];if(!"aeiou".includes(r)&&"aeiou".includes(n)){const e=t.slice(2);if(e.length>=2&&e[0]===r)return{stem:e,reduplicated:!0}}return{stem:t,reduplicated:!1}}(t);o.reduplicated&&o.stem.length>=2&&(t=o.stem,r-=.1,a.push("reduplication:CV"));const s=function(e){const t=e.toLowerCase();if(5>t.length)return null;let r=0;for(let e=0;t.length>e&&!"aeiou".includes(t[e]);e++)r=e+1;if(0===r)return null;for(const e of $w){const n=r;if(t.slice(n,n+e.length)===e){const i=t.slice(0,r)+t.slice(n+e.length);if(i.length>=3)return{stem:i,infix:e}}}return null}(t);let l=!1;if(s&&s.stem.length>=2&&(t=s.stem,r-=.18,a.push("infix:"+s.infix),l=!0),!l)for(const e of Vw)if(t.endsWith(e.pattern)){const n=t.slice(0,-e.pattern.length);if(n.length>=2){t=n,r-=e.confidencePenalty,i.push(e.pattern),a.push("suffix:"+e.pattern);break}}return r=Math.max(.5,r),0===n.length&&0===i.length&&0===a.length?Qp(e):em(t,r,{removedPrefixes:n,removedSuffixes:i,appliedRules:a})}}}}),Yw={};dm(Yw,{TagalogTokenizer:()=>Kw,tagalogTokenizer:()=>Uw});var Zw,Jw,Xw,Qw=mm({"src/tokenizers/tl.ts"(){Kf(),Nd(),Gw(),Gf(),lv(),wy(),Fw=[{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"}],Uw=new(Kw=class extends Xp{constructor(){super(),this.language="tl",this.direction="ltr",this.initializeKeywordsFromProfile(Ld,Fw),this.setNormalizer(Dw),this.registerExtractors(ov()),this.registerExtractor(new bu),this.registerExtractor(new wu),this.registerExtractors([new fy]),this.registerExtractor(new $f),this.registerExtractor(new Vf)}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":e.startsWith("/")||e.startsWith("./")||e.startsWith("http")?"url":"identifier"}})}});function ez(e,t){return Xw[t]?.has(e)?e:Jw[t]?.[e]??e}function tz(e){const t=e.verbAlts?{type:"literal",value:e.verb,alternatives:e.verbAlts}:{type:"literal",value:e.verb},r=e.eventMarkerAlts?{type:"literal",value:e.eventMarker,alternatives:e.eventMarkerAlts}:{type:"literal",value:e.eventMarker};return["before","after"].map(n=>{const i={type:"literal",value:"before"===n?e.before:e.after},a={type:"role",role:"patient"},o={type:"role",role:"destination"},s={type:"role",role:"event"};return{id:`put-event-${e.lang}-vso-${n}`,language:e.lang,command:"on",priority:160,template:{format:`${e.lang} put ${n}`,tokens:"verb-first"===e.order?[t,a,i,o,r,s]:[r,s,t,a,i,o]},extraction:"verb-first"===e.order?{action:{value:"put"},patient:{position:1},destination:{position:3},event:{position:5},manner:{default:{type:"literal",value:n}}}:{action:{value:"put"},event:{position:1},patient:{position:3},destination:{position:5},manner:{default:{type:"literal",value:n}}}}})}function rz(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:["kiedy","przy","na"]},{type:"role",role:"event"},{type:"group",optional:!0,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:["kiedy","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-maykama",language:"qu",command:"on",priority:115,template:{format:"maykama {event} {body}",tokens:[{type:"literal",value:"maykama"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{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:!0,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[...tz({lang:"tl",verb:"ilagay",verbAlts:["maglagay"],eventMarker:"kapag",eventMarkerAlts:["sa"],before:"bago",after:"matapos",order:"verb-first"}),{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:["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:["sa"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"uk":return[...tz({lang:"uk",verb:"покласти",verbAlts:["поклади","помістити","помісти","вставити","встав"],eventMarker:"при",eventMarkerAlts:["коли"],before:"до",after:"після",order:"event-first"}),{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:!0,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:!0,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-circumfix",language:"zh",command:"on",priority:106,template:{format:"当 {event} 时 {body}",tokens:[{type:"literal",value:"当"},{type:"role",role:"event"},{type:"literal",value:"时",alternatives:["的时候","时候"]}]},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}}}];case"ja":return[{id:"event-ja-when",language:"ja",command:"on",priority:95,template:{format:"とき {event} {body}",tokens:[{type:"literal",value:"とき",alternatives:["時","ときに"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"tr":return[{id:"event-tr-when",language:"tr",command:"on",priority:95,template:{format:"iken {event} {body}",tokens:[{type:"literal",value:"iken",alternatives:["durumunda","olduğunda"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"ar":return[...tz({lang:"ar",verb:"ضع",verbAlts:["اجعل"],eventMarker:"عند",eventMarkerAlts:["في","لدى","عندما","حين","حينما","لمّا","لما"],before:"قبل",after:"بعد",order:"verb-first"}),{id:"event-ar-when",language:"ar",command:"on",priority:95,template:{format:"عندما {event} {body}",tokens:[{type:"literal",value:"عندما",alternatives:["حين","لمّا"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];case"he":return[{id:"event-he-when",language:"he",command:"on",priority:95,template:{format:"כאשר {event} {body}",tokens:[{type:"literal",value:"כאשר",alternatives:["כש"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}];default:return[]}}var nz=mm({"src/patterns/event-handler.ts"(){Jw=Object.fromEntries(Object.entries(Zw={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","boyutlandırma":"resize","boyutlandır":"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"}}).map(([e,t])=>{const r={};for(const[e,n]of Object.entries(t))n in r||(r[n]=e);return[e,r]})),Xw={ar:new Set(["mouseover"]),bn:new Set(["resize"]),de:new Set(["keydown","keyup","load","mouseout","mouseover"]),fr:new Set(["blur"]),id:new Set(["input","keyup","mouseout","mouseover"]),ja:new Set(["keypress","mousedown","mouseup","resize"]),qu:new Set(["change","focus","load","resize","submit"]),sw:new Set(["change","click","input","keydown","keyup","mouseout","mouseover","submit"]),tr:new Set(["keydown","keyup","load","mousedown","mouseout","mouseover","mouseup","resize","scroll"]),zh:new Set(["focus","keyup","mouseout","mouseover"])}}});function iz(e,t){const r="SOV"===t?"sovPosition":"svoPosition";return[...e].sort((e,t)=>(e[r]??99)-(t[r]??99))}var az=mm({"src/parser/utils/role-positioning.ts"(){}});var oz=mm({"src/parser/utils/marker-resolution.ts"(){}});function sz(e,t){let r,n;if(e.markerOverride&&void 0!==e.markerOverride[t.code])r=e.markerOverride[t.code];else{const i=t.roleMarkers[e.role];i&&(r=i.primary,n=i.alternatives?[...i.alternatives]:void 0)}const i=e.markerVariants?.[t.code];if(i&&i.length>0){const e=n?[...n]:[];for(const t of i)t===r||e.includes(t)||e.push(t);n=e}return{marker:r,alternatives:n}}function lz(e,t,r){r.roles.find(e=>"scope"===e.role&&!e.required)&&(e.push({type:"group",optional:!0,tokens:[{type:"literal",value:"on"},{type:"role",role:"scope",optional:!0,expectedTypes:["selector","reference"]}]}),t.scope={fromRole:"scope"})}var cz=mm({"src/generators/event-handlers-sov.ts"(){Rf()}});function uz(e,t,r,n,i){const a=[];if("before"===n.position){a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary})}a.push({type:"role",role:"event",optional:!1});a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),a.push({type:"role",role:"patient",optional:!1});const o=t.roleMarkers.destination;return o&&a.push({type:"group",optional:!0,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:!0}]}),a.push(...Af(e,t.roleMarkers.source)),{id:`${e.action}-event-${t.code}-vso`,language:t.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`${n.primary} {event} ${r.primary} {patient} ${o?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Sf(e),...Cf(e)}}}function pz(e,t,r,n,i){const a=[];if("before"===n.position){a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary})}a.push({type:"role",role:"event",optional:!1});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.svoPosition??999)-(t.svoPosition??999));for(const e of o){let r,n;if(e.markerOverride&&void 0!==e.markerOverride[t.code])r=e.markerOverride[t.code];else{const i=t.roleMarkers[e.role];i&&(r=i.primary,n=i.alternatives)}if(r){a.push(n?{type:"literal",value:r,alternatives:n}:{type:"literal",value:r})}a.push({type:"role",role:e.role,optional:!1})}const s=o.map(e=>`{${e.role}}`).join(" "),l={action:{value:e.action},event:{fromRole:"event"},...Object.fromEntries(o.map(e=>[e.role,{fromRole:e.role}]))};return lz(a,l,e),{id:`${e.action}-event-${t.code}-vso-2role`,language:t.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`${n.primary} {event} ${r.primary} ${s}`,tokens:a},extraction:l}}var mz,dz=mm({"src/generators/event-handlers-vso.ts"(){Rf(),cz()}});function fz(){return zm().map(e=>wm(e)).filter(e=>void 0!==e)}function hz(e,t,r=mz){const n=`${e.action}-${t.code}-generated`,i=r.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,r){const n=[],i=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary},a=function(e,t){const r=[],n=iz(e.roles,t.wordOrder);for(const e of n){const n=bz(e,t);e.required?r.push(...n):r.push({type:"group",optional:!0,tokens:n})}return r}(e,t);switch(t.wordOrder){case"SVO":case"VSO":default:n.push(i),n.push(...a);break;case"SOV":n.push(...a),n.push(i)}return function(e){const t=[];for(const r of e){const e=t[t.length-1];if(e&&"literal"===e.type&&"literal"===r.type&&e.value===r.value){const n=[...e.alternatives??[],...r.alternatives??[]];n.length&&(t[t.length-1]={...e,alternatives:[...new Set(n)]});continue}t.push(r)}return t}(n)}(e,t,a),s=wz(e,t),l=function(e,t,r){const n=[],i=iz(e.roles,t.wordOrder),a=i.map(e=>{const r=function(e,t){const r=e.markerOverride?.[t.code],n=t.roleMarkers[e.role];if(void 0!==r)return{primary:r,position:n?.position??"before",isOverride:!0};if(n&&n.primary){const e={primary:n.primary,position:n.position,isOverride:!1};return n.alternatives&&(e.alternatives=n.alternatives),e}return null}(e,t);let n="";return n=r&&r.primary?"before"===r.position?`${r.primary} {${e.role}}`:`{${e.role}} ${r.primary}`:`{${e.role}}`,e.required?n:`[${n}]`});switch(t.wordOrder){case"SVO":case"VSO":default:n.push(r.primary,...a);break;case"SOV":n.push(...a,r.primary)}return n.join(" ")}(e,t,a);return{id:n,language:t.code,command:e.action,priority:i,template:{format:l,tokens:o},extraction:s}}function yz(e,t,r=mz){if(0===e.roles.filter(e=>!e.required).length)return null;const n=e.roles.filter(e=>e.required);return{...hz({...e,roles:n},t,r),id:`${e.action}-${t.code}-generated-simple`,priority:(r.basePriority??100)-5,extraction:wz(e,t)}}function vz(e,t,r=mz){const n=[];if(n.push(hz(e,t,r)),r.generateSimpleVariants){const i=yz(e,t,r);i&&n.push(i)}for(const i of e.omitRoleVariants??[]){const a=hz({...e,roles:e.roles.filter(e=>e.role!==i)},t,r);n.push({...a,id:`${e.action}-${t.code}-generated-no-${i}`,priority:(r.basePriority??100)-8})}if(!1!==r.generateVerbFirstVariants){const i=function(e,t,r=mz){if("SOV"!==t.wordOrder)return null;const n=e.roles.filter(e=>e.required);if(1!==n.length)return null;const i=t.keywords[e.action];if(!i)return null;const a=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary},o=n.map(e=>({type:"role",role:e.role,optional:!1,expectedTypes:e.expectedTypes}));return{id:`${e.action}-${t.code}-generated-verb-first`,language:t.code,command:e.action,priority:(r.basePriority??100)-20,template:{format:`${i.primary} <${n[0].role}>`,tokens:[a,...o]},extraction:wz(e,t)}}(e,t,r);i&&n.push(i)}return n}function gz(e,t=mz){const r=[],n=Of();for(const i of n){if(!e.keywords[i.action])continue;const n=vz(i,e,t);if(r.push(...n),e.eventHandler?.eventMarker){const n=kz(i,e,t);r.push(...n)}}return r}function kz(e,t,r=mz){if(!t.eventHandler||!t.eventHandler.eventMarker)return[];const n=[],i=t.eventHandler.eventMarker,a=t.keywords[e.action];if(!a)return[];if(0===e.roles.length)return[];const o=2===e.roles.filter(e=>e.required).length;if("SOV"===t.wordOrder)if(o)n.push(function(e,t,r,n,i){const a=[];if(a.push({type:"role",role:"event",optional:!1}),"after"===n.position){const e=n.primary.split(/\s+/);if(e.length>1)for(const t of e)a.push({type:"literal",value:t});else 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.sovPosition??999)-(t.sovPosition??999));for(const e of o){a.push({type:"role",role:e.role,optional:!1});const{marker:r,alternatives:n}=sz(e,t);r&&a.push(n?{type:"literal",value:r,alternatives:n}:{type:"literal",value:r})}a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary});const s=o.map(e=>`{${e.role}}`).join(" "),l={action:{value:e.action},event:{fromRole:"event"},...Object.fromEntries(o.map(e=>[e.role,{fromRole:e.role}]))};return lz(a,l,e),{id:`${e.action}-event-${t.code}-sov-2role`,language:t.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`{event} ${n.primary} ${s} ${r.primary}`,tokens:a},extraction:l}}(e,t,a,i,r)),n.push(function(e,t,r,n,i){const a=[],o=[...e.roles.filter(e=>e.required)].sort((e,t)=>(e.sovPosition??999)-(t.sovPosition??999)),s=o[0];a.push({type:"role",role:s.role,optional:!1});const{marker:l,alternatives:c}=sz(s,t);l&&a.push(c?{type:"literal",value:l,alternatives:c}:{type:"literal",value:l});if(a.push({type:"role",role:"event",optional:!1}),"after"===n.position){const e=n.primary.split(/\s+/);if(e.length>1)for(const t of e)a.push({type:"literal",value:t});else a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary})}a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary});const u=o[1];a.push({type:"role",role:u.role,optional:!1});const{marker:p,alternatives:m}=sz(u,t);p&&a.push(m?{type:"literal",value:p,alternatives:m}:{type:"literal",value:p});const d={action:{value:e.action},event:{fromRole:"event"},[s.role]:{fromRole:s.role},[u.role]:{fromRole:u.role}};return lz(a,d,e),{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} ${n.primary} ${r.primary} {${u.role}}`,tokens:a},extraction:d}}(e,t,a,i,r)),n.push(function(e,t,r,n,i){const a=[],o=[...e.roles.filter(e=>e.required)].sort((e,t)=>(e.sovPosition??999)-(t.sovPosition??999));for(const e of o){a.push({type:"role",role:e.role,optional:!1});const{marker:r,alternatives:n}=sz(e,t);r&&a.push(n?{type:"literal",value:r,alternatives:n}:{type:"literal",value:r})}if(a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),a.push({type:"role",role:"event",optional:!1}),"after"===n.position){const e=n.primary.split(/\s+/);if(e.length>1)for(const t of e)a.push({type:"literal",value:t});else 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(" "),l={action:{value:e.action},event:{fromRole:"event"},...Object.fromEntries(o.map(e=>[e.role,{fromRole:e.role}]))};return lz(a,l,e),{id:`${e.action}-event-${t.code}-sov-2role-event-last`,language:t.code,command:"on",priority:(i.basePriority??100)+40,template:{format:`${s} ${r.primary} {event} ${n.primary}`,tokens:a},extraction:l}}(e,t,a,i,r));else{n.push(function(e,t,r,n,i){const a=[];if(a.push({type:"role",role:"event",optional:!1}),"after"===n.position){const e=n.primary.split(/\s+/);if(e.length>1)for(const t of e)a.push({type:"literal",value:t});else a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary})}const o=t.roleMarkers.destination;o&&a.push({type:"group",optional:!0,tokens:[{type:"role",role:"destination",optional:!0},o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary}]}),a.push({type:"role",role:"patient",optional:!1});const s=t.roleMarkers.patient;s&&a.push(s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary});return a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),a.push(...Af(e,t.roleMarkers.source)),a.push(...Lf(e,t.roleMarkers.destination)),{id:`${e.action}-event-${t.code}-sov`,language:t.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`{event} ${n.primary} {destination?} {patient} ${s?.primary||""} ${r.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Sf(e),...Cf(e)}}}(e,t,a,i,r)),n.push(function(e,t,r,n,i){const a=[];a.push({type:"role",role:"patient",optional:!1});const o=t.roleMarkers.patient;o&&a.push(o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary});if(a.push({type:"role",role:"event",optional:!1}),"after"===n.position){const e=n.primary.split(/\s+/);if(e.length>1)for(const t of e)a.push({type:"literal",value:t});else a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary})}return a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),a.push(...Af(e,t.roleMarkers.source)),a.push(...Lf(e,t.roleMarkers.destination)),{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} ${n.primary} ${r.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Sf(e),...Cf(e)}}}(e,t,a,i,r));const o=t.roleMarkers.destination;o&&o.primary!==i.primary&&n.push(function(e,t,r,n,i){const a=[];a.push({type:"role",role:"patient",optional:!1});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:!1}),a.push(s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary})),a.push({type:"role",role:"event",optional:!1}),"after"===n.position){const e=n.primary.split(/\s+/);if(e.length>1)for(const t of e)a.push({type:"literal",value:t});else a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary})}return a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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} ${n.primary} ${r.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}(e,t,a,i,r));const s=i.primary.split(/\s+/),l=i.alternatives?.some(e=>!e.includes(" ")&&e.length>1);s.length>1&&l&&n.push(function(e,t,r,n,i){const a=[];a.push({type:"role",role:"event",optional:!1});const o=n.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:!0,tokens:[{type:"role",role:"destination",optional:!0},s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary}]}),a.push({type:"role",role:"patient",optional:!1});const l=t.roleMarkers.patient;l&&a.push(l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary});return a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),a.push(...Af(e,t.roleMarkers.source)),a.push(...Lf(e,t.roleMarkers.destination)),{id:`${e.action}-event-${t.code}-sov-compact`,language:t.code,command:"on",priority:(i.basePriority??100)+52,template:{format:`{event}${o[0]||""} {patient} ${r.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Sf(e),...Cf(e)}}}(e,t,a,i,r)),n.push(function(e,t,r,n,i){const a=[];if(a.push({type:"role",role:"event",optional:!1}),"after"===n.position){const e=n.primary.split(/\s+/);if(e.length>1)for(const t of e)a.push({type:"literal",value:t});else a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary})}return a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),{id:`${e.action}-event-${t.code}-sov-simple`,language:t.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{event} ${n.primary} ${r.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}(e,t,a,i,r));const c=function(e,t,r,n){const i=t.eventHandler?.temporalMarkers;if(!i||0===i.length)return null;const a=[];a.push({type:"role",role:"event",optional:!1}),t.possessive?.marker&&a.push({type:"group",optional:!0,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:!1});const o=t.roleMarkers.patient;o?.primary&&a.push(o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary});return a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),{id:`${e.action}-event-${t.code}-sov-temporal`,language:t.code,command:"on",priority:(n.basePriority??100)+49,template:{format:`{event} ${i[0]} {patient} ${r.primary}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}(e,t,a,r);c&&n.push(c)}else"VSO"===t.wordOrder?o?(n.push(pz(e,t,a,i,r)),n.push(function(e,t,r,n,i){const a=[];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.svoPosition??999)-(t.svoPosition??999));for(const e of o){let r,n;if(e.markerOverride&&void 0!==e.markerOverride[t.code])r=e.markerOverride[t.code];else{const i=t.roleMarkers[e.role];i&&(r=i.primary,n=i.alternatives)}r&&a.push(n?{type:"literal",value:r,alternatives:n}:{type:"literal",value:r}),a.push({type:"role",role:e.role,optional:!1})}"before"===n.position&&a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary});a.push({type:"role",role:"event",optional:!1});const s=o.map(e=>`{${e.role}}`).join(" "),l={action:{value:e.action},event:{fromRole:"event"},...Object.fromEntries(o.map(e=>[e.role,{fromRole:e.role}]))};return lz(a,l,e),{id:`${e.action}-event-${t.code}-vso-verb-first-2role`,language:t.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${r.primary} ${s} ${n.primary} {event}`,tokens:a},extraction:l}}(e,t,a,i,r))):(n.push(uz(e,t,a,i,r)),n.push(function(e,t,r,n,i){const a=[];a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),a.push({type:"role",role:"patient",optional:!1});const o=t.roleMarkers.destination;o&&a.push({type:"group",optional:!0,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:!0}]}),a.push(...Af(e,t.roleMarkers.source)),"before"===n.position&&a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary});return a.push({type:"role",role:"event",optional:!1}),{id:`${e.action}-event-${t.code}-vso-verb-first`,language:t.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`${r.primary} {patient} ${o?.primary||""} {destination?} ${n.primary} {event}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Sf(e),...Cf(e)}}}(e,t,a,i,r)),t.eventHandler?.negationMarker&&n.push(function(e,t,r,n,i){const a=[],o=t.eventHandler?.negationMarker;"before"===n.position&&a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.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:!1}),a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),a.push({type:"role",role:"patient",optional:!1});const s=t.roleMarkers.destination;return s&&a.push({type:"group",optional:!0,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:!0}]}),a.push(...Af(e,t.roleMarkers.source)),{id:`${e.action}-event-${t.code}-vso-negated`,language:t.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${n.primary} ${o?.primary||""} {event} ${r.primary} {patient} ${s?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Sf(e),...Cf(e)}}}(e,t,a,i,r)),t.tokenization?.prefixes&&n.push(function(e,t,r,n){const i=[];i.push({type:"literal",value:"and",alternatives:["then"]}),i.push({type:"role",role:"event",optional:!1}),i.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),i.push({type:"role",role:"patient",optional:!1});const a=t.roleMarkers.destination;return a&&i.push({type:"group",optional:!0,tokens:[a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary},{type:"role",role:"destination",optional:!0}]}),i.push(...Af(e,t.roleMarkers.source)),{id:`${e.action}-event-${t.code}-vso-proclitic`,language:t.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`[proclitic?] {event} ${r.primary} {patient} ${a?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:e.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Sf(e),...Cf(e)}}}(e,t,a,r))):n.push(o?pz(e,t,a,i,r):uz(e,t,a,i,r));return n}function bz(e,t){const r=[],n=e.markerOverride?.[t.code],i=t.roleMarkers[e.role],a={type:"role",role:e.role,optional:!e.required,expectedTypes:e.expectedTypes};if(void 0!==n){const o=n?n.split(/\s+/).filter(Boolean):[],s=i?.position??"before",l=!0===e.markerOptional?.[t.code],c=e=>{const t={type:"literal",value:e};r.push(l?{type:"group",optional:!0,tokens:[t]}:t)};if("before"===s){for(const e of o)c(e);r.push(a)}else{r.push(a);for(const e of o)c(e)}}else if(i){const n=e.markerVariants?.[t.code]??[],o=()=>{const e=[...new Set([...i.alternatives??[],...n])].filter(e=>e!==i.primary);return e.length?{type:"literal",value:i.primary,alternatives:e}:{type:"literal",value:i.primary}},s=n=>{r.push(t.markersOptional||e.markerOptional?.[t.code]?{type:"group",optional:!0,tokens:[n]}:n)};"before"===i.position?(i.primary&&s(o()),r.push(a)):(r.push(a),s(o()))}else r.push(a);return r}function wz(e,t){const r=function(e,t){const r={};for(const n of e.roles){const e=n.markerOverride?.[t.code],i=t.roleMarkers[n.role];if(void 0!==e)r[n.role]=e?{marker:e}:{};else if(i&&i.primary){const e=[...new Set([...i.alternatives??[],...n.markerVariants?.[t.code]??[]])].filter(e=>e!==i.primary);r[n.role]=e.length?{marker:i.primary,markerAlternatives:e}:{marker:i.primary}}else r[n.role]={}}return r}(e,t),n={};for(const t of e.roles){const e=r[t.role]||{};n[t.role]=!t.required&&t.default?{...e,default:t.default}:e}return n}var zz=mm({"src/generators/pattern-generator.ts"(){Rf(),az(),oz(),cz(),dz(),Cm(),mz={basePriority:100,generateSimpleVariants:!0,generateAlternatives:!0}}});function xz(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:!0,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:!0,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:!0,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:!0,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:!0,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:!0,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:!0,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:!0,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:!0,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:!0,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 Ez,Tz,Sz,Cz,Az,Lz,jz,Pz,Oz,Nz,Iz=mm({"src/patterns/toggle.ts"(){}});function Rz(e,t,r,n){const i=[];return i.push({type:"literal",value:t}),n&&i.push({type:"literal",value:n}),i.push({type:"role",role:"quantity",expectedTypes:["literal","expression"]}),i.push({type:"literal",value:r}),{id:`repeat-${e}-times`,language:e,command:"repeat",priority:110,template:{format:`${t}${n?" "+n:""} {quantity} ${r}`,tokens:i},extraction:{loopType:{default:{type:"literal",value:"times"}}}}}function Mz(e,t,r){return{id:`repeat-${e}-times`,language:e,command:"repeat",priority:110,template:{format:`{quantity} ${t} ${r} repeat`,tokens:[{type:"role",role:"quantity",expectedTypes:["literal","expression"]},{type:"literal",value:t},{type:"literal",value:r},{type:"literal",value:"repeat"}]},extraction:{loopType:{default:{type:"literal",value:"times"}}}}}function Wz(e,t){const r=[{type:"literal",value:"repeat"}];t.forWords&&t.forWords.length>0&&r.push({type:"group",optional:!0,tokens:t.forWords.map(e=>({type:"literal",value:e}))}),r.push({type:"role",role:"patient",expectedTypes:["expression","reference"]});for(const e of t.inWords)r.push({type:"literal",value:e});return r.push({type:"role",role:"source",expectedTypes:["selector","expression","reference"]}),{id:`repeat-${e}-for-in`,language:e,command:"repeat",priority:110,template:{format:`repeat [${(t.forWords??[]).join(" ")}] {patient} ${t.inWords.join(" ")} {source}`,tokens:r},extraction:{loopType:{default:{type:"literal",value:"for"}}}}}function _z(e,t){const r=[{type:"literal",value:"repeat"}];for(const e of t.pre??[])r.push({type:"literal",value:e});return r.push({type:"literal",value:t.whileWord}),r.push({type:"role",role:"condition",expectedTypes:["property-path","expression"]}),{id:`repeat-${e}-while-head`,language:e,command:"repeat",priority:110,template:{format:`repeat ${(t.pre??[]).join(" ")} ${t.whileWord} {condition}`,tokens:r},extraction:{loopType:{default:{type:"literal",value:"while"}}}}}function qz(e,t){const r=[{type:"literal",value:"repeat"}];for(const e of t.pre??[])r.push({type:"literal",value:e});return r.push({type:"literal",value:t.untilWord}),t.preEvent&&r.push({type:"literal",value:t.preEvent}),r.push({type:"literal",value:t.eventWord}),r.push({type:"role",role:"event",expectedTypes:["literal","expression"]}),r.push({type:"group",optional:!0,tokens:[{type:"literal",value:t.fromWord},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]}]}),{id:`repeat-${e}-until-head`,language:e,command:"repeat",priority:110,template:{format:`repeat ${t.untilWord} ${t.eventWord} {event} [${t.fromWord} {source}]`,tokens:r},extraction:{loopType:{default:{type:"literal",value:"until-event"}}}}}function $z(e,t){return{id:`repeat-${e}-until-head`,language:e,command:"repeat",priority:110,template:{format:`${t.untilWord} ${t.eventWord} {event} ${t.objMarker} repeat [{source} ${t.fromWord}]`,tokens:[{type:"literal",value:t.untilWord},{type:"literal",value:t.eventWord},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:t.objMarker},{type:"literal",value:"repeat"},{type:"group",optional:!0,tokens:[{type:"role",role:"source",expectedTypes:["selector","reference","expression"]},{type:"literal",value:t.fromWord}]}]},extraction:{loopType:{default:{type:"literal",value:"until-event"}}}}}function Vz(e){return Oz.get(e)??[]}var Dz=mm({"src/patterns/repeat.ts"(){Ez=[["es","repetir","times"],["de","wiederholen","times"],["fr","répéter","times"],["it","ripetere","times"],["pt","repetir","times"],["ru","повторить","times"],["uk","повторити","times"],["pl","powtórz","times"],["ar","كرر","times"],["he","חזור","times","את"],["id","ulangi","times"],["ms","ulang","times"],["sw","rudia","times"],["th","ทำซ้ำ","ครั้ง"],["vi","lặp lại","lần"],["tl","ulitin","beses"],["zh","重复","times","把"]],Tz=[["ja","times","を"],["ko","times","를"],["tr","times","i"],["hi","times","को"],["bn","বার","কে"],["qu","times","ta"]],Sz=[["en",{forWords:["for"],inWords:["in"]}],["es",{forWords:["para"],inWords:["en"]}],["pt",{forWords:["para"],inWords:["dentro"]}],["fr",{forWords:["pour"],inWords:["en"]}],["it",{forWords:["per"],inWords:["in"]}],["de",{forWords:["für"],inWords:["in"]}],["ru",{forWords:["для"],inWords:["в"]}],["uk",{forWords:["для"],inWords:["у"]}],["pl",{forWords:["dla"],inWords:["w"]}],["ar",{forWords:["لكل"],inWords:["في"]}],["he",{forWords:["עבור","את"],inWords:["in"]}],["hi",{inWords:["में"]}],["bn",{inWords:["এ"]}],["ja",{inWords:["の","中"]}],["ko",{inWords:["안","에"]}],["zh",{forWords:["为","把"],inWords:["在"]}],["tr",{inWords:["içinde"]}],["id",{forWords:["untuk"],inWords:["dalam"]}],["ms",{forWords:["untuk"],inWords:["dalam"]}],["sw",{forWords:["kwa"],inWords:["ndani"]}],["th",{forWords:["สำหรับ"],inWords:["ใน"]}],["vi",{forWords:["với mỗi"],inWords:["trong"]}],["tl",{forWords:["para_sa"],inWords:["sa_loob"]}],["qu",{inWords:["uku","pi"]}]],Cz=[["en",{whileWord:"while"}],["es",{whileWord:"mientras"}],["pt",{whileWord:"enquanto"}],["fr",{whileWord:"tantque"}],["it",{whileWord:"mentre"}],["de",{whileWord:"während"}],["ru",{whileWord:"пока"}],["uk",{whileWord:"поки"}],["pl",{whileWord:"dopóki"}],["ar",{whileWord:"بينما"}],["he",{pre:["את"],whileWord:"כל עוד"}],["zh",{pre:["把"],whileWord:"当"}],["id",{whileWord:"selama"}],["ms",{whileWord:"selagi"}],["sw",{whileWord:"wakati"}],["th",{whileWord:"ในขณะที่"}],["vi",{whileWord:"trong khi"}],["tl",{whileWord:"habang"}]],Az=[["es",{untilWord:"hasta",eventWord:"evento",fromWord:"de"}],["pt",{untilWord:"até",eventWord:"evento",fromWord:"de"}],["fr",{untilWord:"jusquà",eventWord:"événement",fromWord:"de"}],["it",{untilWord:"fino",eventWord:"evento",fromWord:"da"}],["de",{untilWord:"bis",eventWord:"ereignis",fromWord:"von"}],["ru",{untilWord:"до",eventWord:"событие",fromWord:"из"}],["uk",{untilWord:"до",eventWord:"подія",fromWord:"з"}],["pl",{untilWord:"aż",eventWord:"zdarzenie",fromWord:"z"}],["ar",{untilWord:"حتى",eventWord:"حدث",fromWord:"من"}],["he",{untilWord:"עד",preEvent:"את",eventWord:"אירוע",fromWord:"מ"}],["id",{untilWord:"sampai",eventWord:"peristiwa",fromWord:"dari"}],["ms",{untilWord:"sehingga",eventWord:"peristiwa",fromWord:"dari"}],["sw",{untilWord:"hadi",eventWord:"tukio",fromWord:"kutoka"}],["th",{untilWord:"จนถึง",eventWord:"เหตุการณ์",fromWord:"จาก"}],["vi",{untilWord:"cho đến khi",eventWord:"sự kiện",fromWord:"từ"}],["tl",{untilWord:"hanggang",eventWord:"pangyayari",fromWord:"mula_sa"}],["zh",{pre:["把"],untilWord:"直到",eventWord:"事件",fromWord:"从"}]],Lz={id:"repeat-qu-midclause-until-head",language:"qu",command:"repeat",priority:109,template:{format:"until event {event} ta {source} manta repeat",tokens:[{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:"ta"},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]},{type:"literal",value:"manta"},{type:"literal",value:"repeat"}]},extraction:{loopType:{default:{type:"literal",value:"until-event"}}}},jz=[["hi",{untilWord:"तक",eventWord:"घटना",objMarker:"को",fromWord:"से"}],["bn",{untilWord:"পর্যন্ত",eventWord:"ঘটনা",objMarker:"কে",fromWord:"থেকে"}],["ja",{untilWord:"まで",eventWord:"イベント",objMarker:"を",fromWord:"から"}],["ko",{untilWord:"까지",eventWord:"이벤트",objMarker:"를",fromWord:"에서"}],["tr",{untilWord:"kadar",eventWord:"olay",objMarker:"i",fromWord:"den"}]],Pz={id:"repeat-qu-until-head",language:"qu",command:"repeat",priority:110,template:{format:"hayk _ a until event {event} ta {source} manta repeat",tokens:[{type:"literal",value:"hayk"},{type:"literal",value:"_"},{type:"literal",value:"a"},{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:"ta"},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]},{type:"literal",value:"manta"},{type:"literal",value:"repeat"}]},extraction:{loopType:{default:{type:"literal",value:"until-event"}}}},Oz=new Map,Nz=(e,t)=>{const r=Oz.get(e);r?r.push(t):Oz.set(e,[t])};for(const[e,t,r,n]of Ez)Nz(e,Rz(e,t,r,n));for(const[e,t,r]of Tz)Nz(e,Mz(e,t,r));for(const[e,t]of Sz)Nz(e,Wz(e,t));for(const[e,t]of Cz)Nz(e,_z(e,t));for(const[e,t]of Az)Nz(e,qz(e,t));for(const[e,t]of jz)Nz(e,$z(e,t));Nz("qu",Pz),Nz("qu",Lz)}});function Bz(e){switch(e){case"en":return[{id:"wait-en-for-event",language:"en",command:"wait",priority:110,template:{format:"wait for {event}",tokens:[{type:"literal",value:"wait"},{type:"literal",value:"for"},{type:"role",role:"event",expectedTypes:["literal","expression"]}]},extraction:{event:{position:2}}}];case"zh":return[{id:"wait-zh-ba",language:"zh",command:"wait",priority:105,template:{format:"等待 把 {duration}",tokens:[{type:"literal",value:"等待",alternatives:["等","稍候"]},{type:"literal",value:"把"},{type:"role",role:"duration",expectedTypes:["literal","expression"]}]},extraction:{duration:{position:2}}}];case"he":return[{id:"wait-he-et",language:"he",command:"wait",priority:105,template:{format:"חכה את {duration}",tokens:[{type:"literal",value:"חכה",alternatives:["המתן"]},{type:"literal",value:"את"},{type:"role",role:"duration",expectedTypes:["literal","expression"]}]},extraction:{duration:{position:2}}}];case"ar":return[{id:"wait-ar-from-first",language:"ar",command:"wait",priority:105,template:{format:"انتظر من {source} {duration}",tokens:[{type:"literal",value:"انتظر",alternatives:["انتظري"]},{type:"literal",value:"من"},{type:"role",role:"source",expectedTypes:["expression","reference"]},{type:"role",role:"duration",expectedTypes:["expression","literal"]}]},extraction:{source:{position:2},duration:{position:3}}}];case"tl":return[{id:"wait-tl-from-first",language:"tl",command:"wait",priority:105,template:{format:"maghintay mula_sa {source} {duration}",tokens:[{type:"literal",value:"maghintay",alternatives:["hintay"]},{type:"literal",value:"mula_sa",alternatives:["galing_sa"]},{type:"role",role:"source",expectedTypes:["expression","reference"]},{type:"role",role:"duration",expectedTypes:["expression","literal"]}]},extraction:{source:{position:2},duration:{position:3}}}];default:return[]}}var Hz,Fz,Kz,Uz,Gz,Yz,Zz,Jz,Xz,Qz,ex,tx,rx,nx,ix=mm({"src/patterns/wait.ts"(){}}),ax={};function ox(){const e=[];e.push(...xz("en")),e.push(..._f("en")),e.push(...rz("en")),e.push(...Vz("en")),e.push(...Bz("en")),e.push(Hz,Fz,Uz,Kz,Gz,Yz,Zz,Jz,Xz,Qz,ex,tx,rx,nx);const t=gz(Rm);return e.push(...t),e}dm(ax,{buildEnglishPatterns:()=>ox});var sx=mm({"src/patterns/en.ts"(){qm(),zz(),Iz(),Df(),nz(),Dz(),ix(),Hz={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"}}},Fz={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}}},Kz={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}}},Uz={id:"swap-en-element",language:"en",command:"swap",priority:120,template:{format:"swap {destination} with {patient}",tokens:[{type:"literal",value:"swap"},{type:"role",role:"destination"},{type:"literal",value:"with"},{type:"role",role:"patient"}]},extraction:{}},Gz={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"}}}},Yz={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"}}}},Zz={id:"repeat-en-times",language:"en",command:"repeat",priority:110,template:{format:"repeat {quantity} times",tokens:[{type:"literal",value:"repeat"},{type:"role",role:"quantity",expectedTypes:["literal","expression"]},{type:"literal",value:"times"}]},extraction:{loopType:{default:{type:"literal",value:"times"}}}},Jz={id:"repeat-en-forever",language:"en",command:"repeat",priority:110,template:{format:"repeat forever",tokens:[{type:"literal",value:"repeat"},{type:"literal",value:"forever"}]},extraction:{loopType:{default:{type:"literal",value:"forever"}}}},Xz={id:"set-en-possessive",language:"en",command:"set",priority:100,template:{format:"set {destination} to {patient} [on {scope}]",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"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"on"},{type:"role",role:"scope",optional:!0,expectedTypes:["selector","reference"]}]}]},extraction:{destination:{position:1},patient:{marker:"to"},scope:{marker:"on"}}},Qz={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"}}},ex={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}}},tx={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}}},rx={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}}},nx={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}}}}}),lx=.5,cx=new Set(["me","my","myself","you","your","yourself","it","its","result","event","target","body","detail","window","document"]),ux=new Set(["and","or","not","no"]),px=new Set(["true","false","null","undefined"]),mx=new Set(["is","matches","match","contains","in"]),dx=new Set(["next","previous","closest","first","last"]),fx=new Set(["ms","s","seconds","second","milliseconds","millisecond","minutes","minute","hours","hour"]);var hx=new Set(["my","its","your"]),yx=new Set(["is","matches","match","contains","in","exists","does"]),vx=new Set(["next","previous","closest","first","last"]),gx=class{constructor(){this.tokens=[],this.current=0}parse(e){try{if(this.tokens=function(e){const t=[];let r=0,n=1,i=1;function a(){if(0===t.length)return!0;const e=t[t.length-1];return!("IDENTIFIER"!==e.type||!mx.has(e.value.toLowerCase()))||!("IDENTIFIER"!==e.type||!dx.has(e.value.toLowerCase()))||["OPERATOR","COMPARISON","LOGICAL","LPAREN","LBRACKET","LBRACE","COMMA","COLON"].includes(e.type)}function o(t=0){return e[r+t]??""}function s(){const t=e[r];return r++,"\n"===t?(n++,i=1):i++,t}function l(){for(;e.length>r&&/\s/.test(e[r]);)s()}function c(t){let n="";for(;e.length>r&&t(e[r]);)n+=s();return n}function u(t){let n=t;for(s();e.length>r&&e[r]!==t;)"\\"===e[r]&&e.length>r+1?(n+=s(),n+=s()):n+=s();return e.length>r&&(n+=s()),n}function p(){let t="`";for(s();e.length>r&&"`"!==e[r];)"\\"===e[r]&&e.length>r+1?(t+=s(),t+=s()):t+=s();return e.length>r&&(t+=s()),t}function m(){let t="<";for(s();e.length>r&&(t+=s(),!t.endsWith("/>")););return t}function d(e,t,a){return{type:e,value:t,start:a,end:r,line:n,column:i-t.length}}for(;e.length>r&&(l(),e.length>r);){const n=r,i=o();if("'"!==i||"s"!==o(1)||/\w/.test(o(2))){if('"'===i||"'"===i){const e=u(i);t.push(d("STRING",e,n));continue}if("`"===i){const e=p();t.push(d("TEMPLATE_LITERAL",e,n));continue}if("<"===i&&/[a-zA-Z.#\[]/.test(o(1))){const e=m();t.push(d("QUERY_SELECTOR",e,n));continue}if("#"===i&&a()){s();const e=c(e=>/[\w-]/.test(e));t.push(d("ID_SELECTOR","#"+e,n));continue}if("."===i&&/[a-zA-Z_-]/.test(o(1))&&a()){s();const e=c(e=>/[\w-]/.test(e));t.push(d("CLASS_SELECTOR","."+e,n));continue}if("@"===i&&/[a-zA-Z_]/.test(o(1))){s();const e=c(e=>/[\w-]/.test(e));t.push(d("ATTRIBUTE_REF","@"+e,n));continue}if("["===i&&a()){const i=o(1);if("@"===i||/[a-zA-Z]/.test(i)){let i="";for(i+=s();e.length>r&&"]"!==e[r];)i+='"'===e[r]||"'"===e[r]?u(e[r]):s();e.length>r&&(i+=s()),t.push(d("ATTRIBUTE_SELECTOR",i,n));continue}}if("["!==i)if("]"!==i){if(/\d/.test(i)){const e=c(e=>/[\d.]/.test(e)),i=r,a=c(e=>/[a-zA-Z]/.test(e));fx.has(a)?t.push(d("TIME_EXPRESSION",e+a,n)):(r=i,t.push(d("NUMBER",e,n)));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,n));continue}if(/[a-zA-Z_$]/.test(i)){const e=c(e=>/[\w$]/.test(e)),r=e.toLowerCase();cx.has(r)?t.push(d("CONTEXT_VAR",e,n)):ux.has(r)?t.push(d("LOGICAL",e,n)):px.has(r)?t.push(d("BOOLEAN",e,n)):t.push(d("IDENTIFIER",e,n));continue}s()}else s(),t.push(d("OPERATOR",i,n));else s(),t.push(d("DOT",".",n));else s(),t.push(d("COLON",":",n));else s(),t.push(d("COMMA",",",n));else s(),t.push(d("RBRACE","}",n));else s(),t.push(d("LBRACE","{",n));else s(),t.push(d("RPAREN",")",n));else s(),t.push(d("LPAREN","(",n))}else s(),t.push(d("RBRACKET","]",n));else s(),t.push(d("LBRACKET","[",n))}else s(),s(),t.push(d("POSSESSIVE","'s",n))}return t.push(d("EOF","",r)),t}(e),this.current=0,this.isAtEnd())return{success:!1,error:"Empty expression"};return{success:!0,node:this.parseExpression(),consumed:this.current}}catch(e){return{success:!1,error:e instanceof Error?e.message:"Parse error"}}}peek(){return this.tokens[this.current]??{type:"EOF",value:"",start:0,end:0}}peekAt(e){return this.tokens[this.current+e]??{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(),!0;return!1}parseExpression(){return this.parseOr()}parseOr(){let e=this.parseAnd();for(;this.checkValue("or");){const t=this.advance().value,r=this.parseAnd();e=this.createBinaryExpression(t,e,r)}return e}parseAnd(){let e=this.parseEquality();for(;this.checkValue("and");){const t=this.advance().value,r=this.parseEquality();e=this.createBinaryExpression(t,e,r)}return e}parseEquality(){let e=this.parseComparison();for(;;){let t;if(this.match("COMPARISON"))t=this.previous().value;else{if(!(this.checkValue("is")||this.checkValue("matches")||this.checkValue("match")||this.checkValue("contains")||this.checkValue("in")))break;{const e=this.advance().value;t="match"===e.toLowerCase()?"matches":e}}if("is"===t.toLowerCase()){if(this.checkValue("empty")){this.advance(),e=this.createPostfixUnary("is empty",e);continue}if(this.checkValue("not")&&"empty"===this.peekAt(1).value.toLowerCase()){this.advance(),this.advance(),e=this.createPostfixUnary("is not empty",e);continue}}const r=this.parseComparison();e=this.createBinaryExpression(t,e,r)}return e}parseComparison(){let e=this.parseAddition();for(;this.check("COMPARISON");){const t=this.advance().value,r=this.parseAddition();e=this.createBinaryExpression(t,e,r)}return e}parseAddition(){let e=this.parseMultiplication();for(;"+"===this.peek().value||"-"===this.peek().value;){const t=this.advance().value,r=this.parseMultiplication();e=this.createBinaryExpression(t,e,r)}return e}parseMultiplication(){let e=this.parseUnary();for(;"*"===this.peek().value||"/"===this.peek().value||"%"===this.peek().value;){const t=this.advance().value,r=this.parseUnary();e=this.createBinaryExpression(t,e,r)}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")){const t=this.parseExpression();if(!this.match("RBRACKET"))throw Error("Expected ] after index");e=this.createPropertyAccess(e,t)}else if("contextReference"===e.type&&hx.has(e.contextType??"")&&this.check("IDENTIFIER")&&!yx.has(this.peek().value.toLowerCase())){const t=this.advance().value;e=this.createPropertyAccess(e,t)}else{if(!this.checkValue("exists")||"LPAREN"===this.peekAt(1).type)break;this.advance(),e=this.createPostfixUnary("exists",e)}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||"false"!==e.value&&("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("ATTRIBUTE_REF"))return{type:"attributeAccess",attributeName:e.value.slice(1),start:e.start,end:e.end};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")){if(vx.has(e.value.toLowerCase())&&(this.check("CLASS_SELECTOR")||this.check("ID_SELECTOR")||this.check("QUERY_SELECTOR"))){const t=this.advance(),r="QUERY_SELECTOR"===t.type?t.value.slice(1,-2):t.value,n="CLASS_SELECTOR"===t.type?"class":"ID_SELECTOR"===t.type?"id":"query";return{type:"callExpression",callee:this.createIdentifier(e.value,e),arguments:[this.createSelector(r,n,t)],start:e.start,end:t.end}}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 r=this.parseExpression();e.push({key:t,value:r})}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,r){return{type:"literal",value:e,dataType:t,raw:r.value,start:r.start,end:r.end,line:r.line,column:r.column}}createSelector(e,t,r){return{type:"selector",value:e,selector:e,selectorType:t,start:r.start,end:r.end,line:r.line,column:r.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,r){return{type:"binaryExpression",operator:e,left:t,right:r,start:t.start,end:r.end}}createUnaryExpression(e,t){return{type:"unaryExpression",operator:e,operand:t,prefix:!0,start:this.previous().start,end:t.end}}createPostfixUnary(e,t){return{type:"unaryExpression",operator:e,operand:t,prefix:!1,start:t.start,end:this.previous().end}}createCallExpression(e,t){return{type:"callExpression",callee:e,arguments:t,start:e.start,end:this.previous().end}}};function kx(e,t){switch(e.type){case"literal":return bx(e);case"selector":return wx(e,t);case"reference":return zx(e);case"property-path":return xx(e,t);case"expression":return Ex(e);case"flag":return{type:"literal",value:e.enabled};default:throw Error("Unknown semantic value type: "+e.type)}}function bx(e){const t={type:"literal",value:e.value};return e.dataType?{...t,dataType:e.dataType}:t}function wx(e,t){return e.value.startsWith("@")&&/^[a-zA-Z_]/.test(e.value.slice(1))?{type:"attributeAccess",attributeName:e.value.slice(1)}:(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.`),e.value.startsWith("<")?{type:"selector",value:e.value,selector:e.value,selectorType:e.selectorKind,raw:e.value}:{type:"selector",value:e.value,selector:e.value,selectorType:e.selectorKind})}function zx(e){return{type:"contextReference",contextType:e.value,name:e.value}}function xx(e,t){return{type:"propertyAccess",object:kx(e.object,t),property:e.property}}function Ex(e){const t=(r=e.raw,(new gx).parse(r));var r;if(!t.success||!t.node){return{type:"identifier",name:e.raw}}return t.node}function Tx(e,t){return e.roles.get(t)}function Sx(e,t,r){const n=Tx(e,t);return n?kx(n,r):void 0}function Cx(e,t=[],r,n={}){const i={type:"command",name:e,args:t};return r&&Object.keys(r).length>0&&(i.modifiers=r),n.isBlocking&&(i.isBlocking=n.isBlocking),n.implicitTarget&&(i.implicitTarget=n.implicitTarget),n.semanticRoles&&Object.keys(n.semanticRoles).length>0&&(i.semanticRoles=n.semanticRoles),i}var Ax={action:"toggle",toAST(e,t){const r=Sx(e,"patient"),n=Sx(e,"destination"),i=Sx(e,"duration"),a=r?[r]:[],o={};return n&&(o.on=n),i&&(o.for=i),Cx("toggle",a,o)}},Lx={action:"add",toAST(e,t){const r=Sx(e,"patient"),n=Sx(e,"destination"),i=r?[r]:[],a={};return n&&(a.to=n),Cx("add",i,a)}},jx={action:"remove",toAST(e,t){const r=Sx(e,"patient"),n=Sx(e,"source"),i=r?[r]:[],a={};return n&&(a.from=n),Cx("remove",i,a)}},Px={action:"set",toAST(e,t){const r=Sx(e,"destination"),n=Sx(e,"patient"),i=Sx(e,"scope"),a=[],o={};return r&&a.push(r),n&&(o.to=n),i&&(o.on=i),Cx("set",a,o)}},Ox={action:"show",toAST(e,t){const r=Sx(e,"destination"),n=Sx(e,"patient"),i=Sx(e,"duration"),a=[],o={},s=r??n;return s&&a.push(s),i&&(o.with=i),Cx("show",a,o)}},Nx={action:"hide",toAST(e,t){const r=Sx(e,"destination"),n=Sx(e,"patient"),i=Sx(e,"duration"),a=[],o={},s=r??n;return s&&a.push(s),i&&(o.with=i),Cx("hide",a,o)}},Ix={action:"increment",toAST(e,t){const r=Sx(e,"destination"),n=Sx(e,"patient"),i=Sx(e,"quantity"),a=[],o={},s=r??n;return s&&a.push(s),i&&(o.by=i),Cx("increment",a,o)}},Rx={action:"decrement",toAST(e,t){const r=Sx(e,"destination"),n=Sx(e,"patient"),i=Sx(e,"quantity"),a=[],o={},s=r??n;return s&&a.push(s),i&&(o.by=i),Cx("decrement",a,o)}},Mx={action:"wait",toAST(e,t){const r=Sx(e,"event");if(r){const t={for:r},n=Sx(e,"source");return n&&(t.from=n),Cx("wait",[],t,{isBlocking:!0})}const n=Sx(e,"duration");return Cx("wait",n?[n]:[],void 0,{isBlocking:!0})}},Wx={action:"log",toAST(e,t){const r=Sx(e,"patient"),n=[];return r&&n.push(r),Cx("log",n)}},_x={action:"put",toAST(e,t){const r=Sx(e,"patient"),n=Sx(e,"destination"),i=Tx(e,"manner")??Tx(e,"method"),a=r?[r]:[],o={};if(n){o["literal"===i?.type?i.value+"":"into"]=n}return Cx("put",a,o)}},qx={action:"fetch",toAST(e,t){const r=Sx(e,"source"),n=Sx(e,"method"),i=Sx(e,"responseType"),a=Sx(e,"patient"),o=r?[r]:[],s={};return n&&(s.with=n),i&&(s.as=i),a&&(s.body=a),Cx("fetch",o,s,{isBlocking:!0})}},$x={action:"append",toAST(e,t){const r=Sx(e,"patient"),n=Sx(e,"destination"),i=r?[r]:[],a={};return n&&(a.to=n),Cx("append",i,a)}},Vx={action:"prepend",toAST(e,t){const r=Sx(e,"patient"),n=Sx(e,"destination"),i=r?[r]:[],a={};return n&&(a.to=n),Cx("prepend",i,a)}},Dx={action:"trigger",toAST(e,t){const r=Sx(e,"event"),n=Sx(e,"destination"),i=r?[r]:[],a={};return n&&(a.on=n),Cx("trigger",i,a)}},Bx={action:"send",toAST(e,t){const r=Sx(e,"event"),n=Sx(e,"destination"),i=Sx(e,"patient"),a=r?[r]:[],o={};return n&&(o.to=n),i&&(o.detail=i),Cx("send",a,o)}},Hx={action:"go",toAST(e,t){const r=Sx(e,"source"),n=Sx(e,"destination"),i=[],a={};return r&&i.push(r),n&&(a.to=n),Cx("go",i,a)}},Fx={action:"transition",toAST(e,t){const r=Sx(e,"patient"),n=Sx(e,"goal"),i=Sx(e,"duration"),a=Sx(e,"destination"),o=r?[r]:[],s={};return n&&(s.to=n),i&&(s.over=i),a&&(s.on=a),Cx("transition",o,s)}},Kx={action:"focus",toAST(e,t){const r=Sx(e,"destination"),n=Sx(e,"patient"),i=[],a=r??n;return a&&i.push(a),Cx("focus",i,{})}},Ux={action:"blur",toAST(e,t){const r=Sx(e,"destination"),n=Sx(e,"patient"),i=[],a=r??n;return a&&i.push(a),Cx("blur",i)}},Gx={action:"get",toAST(e,t){const r=Sx(e,"source"),n=Sx(e,"patient"),i=[],a=r??n;return a&&i.push(a),Cx("get",i)}},Yx={action:"take",toAST(e,t){const r=Sx(e,"patient"),n=Sx(e,"source"),i=r?[r]:[],a={};return n&&(a.from=n),Cx("take",i,a)}},Zx={action:"call",toAST(e,t){const r=Sx(e,"patient");return Cx("call",r?[r]:[])}},Jx={action:"return",toAST(e,t){const r=Sx(e,"patient");return Cx("return",r?[r]:[])}},Xx={action:"halt",toAST(e,t){const r=e.roles.get("patient");return Cx("halt",r?[kx(r)]:[])}},Qx={action:"throw",toAST(e,t){const r=Sx(e,"patient");return Cx("throw",r?[r]:[])}},eE={action:"settle",toAST(e,t){const r=Sx(e,"destination"),n=Sx(e,"patient"),i=[],a=r??n;return a&&i.push(a),Cx("settle",i,void 0,{isBlocking:!0})}},tE={action:"swap",toAST(e,t){const r=Sx(e,"patient"),n=Sx(e,"source"),i=Sx(e,"destination"),a=Sx(e,"style"),o=[],s={};return r&&o.push(r),n&&o.push(n),i&&(s.on=i),a&&(s.with=a),Cx("swap",o,s)}},rE={action:"morph",toAST(e,t){const r=Sx(e,"source"),n=Sx(e,"destination"),i=Sx(e,"patient"),a=[],o={},s=r??n;return s&&a.push(s),i&&(o.on=i),Cx("morph",a,o)}},nE={action:"clone",toAST(e,t){const r=Sx(e,"source"),n=Sx(e,"destination"),i=Sx(e,"patient"),a=[],o={},s=r??i;return s&&a.push(s),n&&(o.into=n),Cx("clone",a,o)}},iE={action:"make",toAST(e,t){const r=Sx(e,"patient");return Cx("make",r?[r]:[])}},aE={action:"measure",toAST(e,t){const r=Sx(e,"patient"),n=Sx(e,"destination"),i=Sx(e,"source"),a=[],o={};r&&a.push(r);const s=n??i;return s&&(o.of=s),Cx("measure",a,o)}},oE={action:"tell",toAST(e,t){const r=Sx(e,"destination"),n=Sx(e,"patient"),i=[],a=r??n;return a&&i.push(a),Cx("tell",i)}},sE={action:"js",toAST(e,t){const r=Sx(e,"patient");return Cx("js",r?[r]:[])}},lE={action:"async",toAST:(e,t)=>Cx("async",[])},cE={action:"if",toAST(e,t){const r=Sx(e,"condition");return Cx("if",r?[r]:[])}},uE={action:"unless",toAST(e,t){const r=Sx(e,"condition");return Cx("unless",r?[r]:[])}},pE={action:"repeat",toAST(e,t){const r=Sx(e,"quantity"),n=Sx(e,"patient"),i=[],a=r??n;return a&&i.push(a),Cx("repeat",i)}},mE={action:"for",toAST(e,t){const r=Sx(e,"patient"),n=Sx(e,"source"),i=r?[r]:[],a={};return n&&(a.in=n),Cx("for",i,a)}},dE={action:"while",toAST(e,t){const r=Sx(e,"condition");return Cx("while",r?[r]:[])}},fE={action:"continue",toAST:(e,t)=>Cx("continue",[])},hE={action:"default",toAST(e,t){const r=Sx(e,"patient"),n=Sx(e,"source"),i=r?[r]:[],a={};return n&&(a.to=n),Cx("default",i,a)}},yE={action:"init",toAST:(e,t)=>Cx("init",[])},vE={action:"behavior",toAST(e,t){const r=Sx(e,"patient");return Cx("behavior",r?[r]:[])}},gE={action:"install",toAST(e,t){const r=Sx(e,"patient"),n=Sx(e,"destination"),i=r?[r]:[],a={};return n&&(a.on=n),Cx("install",i,a)}},kE=new Map([["toggle",Ax],["add",Lx],["remove",jx],["set",Px],["show",Ox],["hide",Nx],["increment",Ix],["decrement",Rx],["wait",Mx],["log",Wx],["put",_x],["fetch",qx],["append",$x],["prepend",Vx],["get",Gx],["take",Yx],["trigger",Dx],["send",Bx],["on",{action:"on",toAST(e,t){const r=Sx(e,"event"),n=Sx(e,"source"),i=r?[r]:[],a={};return n&&(a.from=n),Cx("on",i,a)}}],["go",Hx],["transition",Fx],["focus",Kx],["blur",Ux],["call",Zx],["return",Jx],["halt",Xx],["throw",Qx],["settle",eE],["swap",tE],["morph",rE],["clone",nE],["measure",aE],["make",iE],["tell",oE],["default",hE],["js",sE],["async",lE],["if",cE],["unless",uE],["repeat",pE],["for",mE],["while",dE],["continue",fE],["init",yE],["behavior",vE],["install",gE]]);function bE(e){return kE.get(e)}var wE=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);case"behavior":return this.buildBehavior(e);case"def":return this.buildDef(e);default:throw Error("Unknown semantic node kind: "+e.kind)}}buildBehavior(e){const t=e.eventHandlers.map(e=>this.buildEventHandler(e)),r={type:"behavior",name:e.name,parameters:[...e.parameters],eventHandlers:t};return e.initBlock&&e.initBlock.length>0&&(r.initBlock={type:"initBlock",commands:e.initBlock.map(e=>this.build(e))}),r}buildDef(e){return{type:"def",name:e.name,params:[...e.parameters],body:e.body.map(e=>this.build(e))}}buildCommand(e){const t=bE(e.action);let r;if(t){const n=t.toAST(e,this);if("ast"in n&&"warnings"in n){const e=n;this.warnings.push(...e.warnings),r=e.ast}else r=n}else r=this.buildGenericCommand(e);if(e.roles&&e.roles.size>0){const t={};for(const[r,n]of e.roles)t[r]=kx(n);Object.keys(t).length>0&&(r.semanticRoles=t)}return r}buildGenericCommand(e){const t=[],r={},n=["patient","source","quantity"],i=["destination","duration","method","style"];for(const r of n){const n=e.roles.get(r);n&&t.push(kx(n))}for(const t of i){const n=e.roles.get(t);if(n){r[this.roleToModifierKey(t)]=kx(n)}}const a={type:"command",name:e.action,args:t};return Object.keys(r).length>0?{...a,modifiers:r}: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 r,n="click";const i="literal"===t?.type?t.value+"":"expression"===t?.type?t.raw:"reference"===t?.type?t.value:void 0;void 0!==i&&(i.includes("|")||i.includes(" or ")?(r=i.split(/\s+or\s+|\|/).map(e=>e.trim()),n=r[0]):n=i);const a=e.body.map(e=>this.build(e)),o=e.roles.get("source");let s,l;"selector"===o?.type?(s=o.value,l=o.value):"reference"===o?.type?l=o.value:"literal"===o?.type&&(l=o.value+"");const c=e.roles.get("condition"),u=c?kx(c):void 0,p=e.roles.get("destination"),m=p?kx(p):void 0,d=e.eventModifiers;let f=s;if(d?.from){const e=d.from;"selector"!==e.type||s||(f=e.value)}const h=e.parameterNames?[...e.parameterNames]:void 0;return{type:"eventHandler",event:n,commands:a,...r&&r.length>1?{events:r}:{},...f?{selector:f}:{},...l?{target:l}:{},...u?{condition:u}:{},...m?{watchTarget:m}:{},...h&&h.length>0?{args:h,params:h}:{}}}buildConditional(e){const t=e.roles.get("condition");if(!t)throw Error("Conditional node missing condition");const r=kx(t),n=e.thenBranch.map(e=>this.build(e)),i=e.elseBranch?.map(e=>this.build(e)),a=[r,{type:"block",commands:n}];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));if(1===t.length)return t[0];if(0===t.length)return{type:"block",commands:[]};if(t.every(e=>"eventHandler"===e.type))return{type:"Program",statements:t};return{type:"CommandSequence",commands:t}}buildLoop(e){const t=e.body.map(e=>this.build(e)),r=[{type:"identifier",name:e.loopVariant}];switch(e.loopVariant){case"times":{const t=e.roles.get("quantity");t&&r.push(kx(t));break}case"for":{e.loopVariable&&r.push({type:"string",value:e.loopVariable});const t=e.roles.get("source");t&&r.push(kx(t));break}case"while":case"until":{const t=e.roles.get("condition");t&&r.push(kx(t));break}}return r.push({type:"block",commands:t}),{type:"command",name:"repeat",args:r}}buildBlock(e){return{type:"block",commands:e.map(e=>this.build(e))}}};Cm(),jm(),Nm(),Mm(),qm(),Dm(),Fm(),Gm(),Jm(),ed(),nd(),od(),cd(),md(),hd(),gd(),wd(),Ed(),Cd(),jd(),Nd(),Md(),qd(),Dd(),Ud();var zE=Object.freeze({ar:Sm,bn:Lm,de:Om,en:Rm,es:_m,fr:Vm,he:Hm,hi:Um,id:Zm,it:Qm,ja:rd,ko:ad,ms:ld,pl:pd,pt:fd,qu:vd,ru:bd,sw:xd,th:Sd,tl:Ld,tr:Od,uk:Rd,vi:_d,zh:Vd});function xE(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 EE(e,t){return void 0!==t?{type:"literal",value:e,dataType:t}:{type:"literal",value:e}}function TE(e){return Nc(e)}function SE(e){return{type:"reference",value:e}}function CE(e,t){return{type:"property-path",object:e,property:t}}function AE(e,t,r){const n={kind:"command",action:e,roles:new Map(Object.entries(t))};return void 0!==r?{...n,metadata:r}:n}function LE(e,t,r,n,i,a){const o=new Map;o.set("event",e);const s={kind:"event-handler",action:"on",roles:o,body:t};return void 0!==r&&(s.eventModifiers=r),void 0!==n&&(s.metadata=n),void 0!==i&&i.length>0&&(s.parameterNames=i),void 0!==a&&a.length>0&&(s.additionalEvents=a),s}function jE(e,t="then",r){const n={kind:"compound",action:"compound",roles:new Map,statements:e,chainType:t};return void 0!==r&&(n.metadata=r),n}function PE(e,t,r,n){const i=new Map;i.set("condition",e);const a={kind:"conditional",action:"if",roles:i,thenBranch:t};return void 0!==r&&(a.elseBranch=r),void 0!==n&&(a.metadata=n),a}function OE(e,t){return!t||0===t.length||(!!t.includes(e)||(!!t.includes("expression")||("property-path"===e||"expression"===e)&&t.some(e=>["selector","reference","expression"].includes(e))))}function NE(e,t){const r=e.possessive?.keywords?.[t];if(r)return r;const n=e.possessive?.specialForms;if(n)for(const[e,r]of Object.entries(n))if(r===t)return e}Rf(),Cm(),Df();var IE=new Set(["بدل","غير","أضف","أزل","ضع","اجعل","عين","زد","انقص","سجل","أظهر","أخف","شغل","أرسل","ركز","شوش","توقف","انسخ","احذف","اصنع","انتظر","انتقال","أو"]),RE={patient:["على"],destination:["إلى","الى"],source:["من"],agent:["من"],manner:["ب"],style:["ب"],goal:["إلى","الى"],method:["ب"]},ME=new class{calculate(e){return this.calculateWithBreakdown(e).final}calculateWithBreakdown(e){const t=this.scoreRoleCoverage(e),r=this.scoreStemPenalty(e),n=this.scoreLanguageBoost(e),i=this.scoreLanguageAdjustment(e);let a=t;return a=Math.max(.5,a+r),a=Math.min(1,a+n),a=Math.max(0,Math.min(1,a+i)),{roleCoverage:t,stemPenalty:r,languageBoost:n,languageAdjustment:i,final:a}}scoreRoleCoverage(e){const{pattern:t,captured:r}=e;let n=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,r.has(e.role)&&(n+=1);else if("group"===e.type)for(const t of e.tokens)"role"===t.type&&(i+=.8,r.has(t.role)?n+=.8:a(t.role)&&(n+=.48));return i>0?n/i:1}scoreStemPenalty(e){const{stemMatchCount:t,totalKeywordMatches:r}=e;return t>0&&r>0?-t/r*.15:0}scoreLanguageBoost(e){const{pattern:t}=e;if("ar"!==t.language)return 0;const r=t.template.tokens[0];return r&&"literal"===r.type&&(IE.has(r.value)||r.alternatives?.some(e=>IE.has(e)))?.15:0}scoreLanguageAdjustment(e){const{pattern:t,captured:r}=e;if("ar"!==t.language)return 0;let n=0;for(const[e,t]of r.entries()){const r=RE[e];if(!r||0===r.length)continue;const i="metadata"in t?t.metadata:void 0;i&&"string"==typeof i.prepositionValue&&(r.includes(i.prepositionValue)?n+=.1:n-=.1)}return Math.max(-.1,Math.min(.1,n))}},WE=new Set(Object.values(Ef).filter(e=>!0===e.bareKeyword).map(e=>e.action)),_E=class e{constructor(e){this.matchCache=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??ME}matchPattern(e,t){const r=e.mark(),n=new Map;this.currentProfile=wm(t.language),this.currentPatternCommand=t.command,this.stemMatchCount=0,this.totalKeywordMatches=0;if(!this.matchTokenSequence(e,t.template.tokens,n))return e.reset(r),null;const i=this.confidenceModel.calculate({pattern:t,captured:n,stemMatchCount:this.stemMatchCount,totalKeywordMatches:this.totalKeywordMatches});return this.applyExtractionRules(t,n),{pattern:t,captured:n,consumedTokens:e.position()-r.position,confidence:i}}matchBest(e,t){this.matchCache.clear();const r=[],n=e.position();for(const i of t){const t=e.mark(),a=`${n}:${i.id}`;let o;this.matchCache.has(a)?o=this.matchCache.get(a):(o=this.matchPattern(e,i),this.matchCache.set(a,o)),o&&r.push(o),e.reset(t)}if(0===r.length)return null;r.sort((e,t)=>{const r=t.pattern.priority-e.pattern.priority;return 0!==r?r:t.confidence-e.confidence});const i=r[0];return this.matchPattern(e,i.pattern),i}matchTokenSequence(e,t,r,n){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=0;for(let i=0;t.length>i;i++){const a=t[i];o>0&&"literal"===a.type&&this.tryConsumeEventSourceClause(e,r,a);const s=this.matchPatternToken(e,a,r,t[i+1]??n);if(o="role"===a.type&&"event"===a.role?2:Math.max(0,o-1),!s){if(this.isOptional(a))continue;return!1}}return!0}tryConsumeEventSourceClause(e,t,r){if(t.has("source"))return;const n=e.peek(),i=e.peek(1);if(!n||!i)return;if(this.patternTokenWouldMatch(r,n))return;const a=this.currentProfile?.roleMarkers?.source,o=e=>{if("particle"!==e.kind&&"keyword"!==e.kind)return!1;if("source"===(e.normalized??"").toLowerCase())return!0;if(!a)return!1;const t=e.value.toLowerCase();return a.primary?.toLowerCase()===t||!!a.alternatives?.some(e=>e.toLowerCase()===t)},s=a?.position;if("after"!==s&&o(n)&&"selector"===i.kind){e.advance();const r=this.tokenToSemanticValue(e.advance());return void(r&&t.set("source",r))}if("after"===s&&"selector"===n.kind&&o(i)){const r=this.tokenToSemanticValue(n);e.advance(),e.advance(),r&&t.set("source",r)}}matchPatternToken(e,t,r,n){switch(t.type){case"literal":return this.matchLiteralToken(e,t);case"role":return this.matchRoleToken(e,t,r,n);case"group":return this.matchGroupToken(e,t,r,n);default:return!1}}matchLiteralToken(e,t){const r=e.peek();if(!r)return!1;const n=this.getMatchType(r,t.value);if("none"!==n)return this.totalKeywordMatches++,"stem"===n&&this.stemMatchCount++,e.advance(),!0;if(t.alternatives)for(const n of t.alternatives){const t=this.getMatchType(r,n);if("none"!==t)return this.totalKeywordMatches++,"stem"===t&&this.stemMatchCount++,e.advance(),!0}for(const r of[t.value,...t.alternatives??[]])for(const t of["-","_"])if(r.includes(t)&&this.tryMatchShatteredCompound(e,r,t))return this.totalKeywordMatches++,!0;return!1}tryFoldHyphenActionKeyword(e){const t=this.currentProfile;if(!t)return null;const r=e.mark(),n=[];for(;;){const t=e.peek();if(!t||"identifier"!==t.kind&&"keyword"!==t.kind)break;n.push(t.value),e.advance();const r=e.peek();if(!r||"-"!==r.value)break;e.advance(),n.push("-")}if(3>n.length||"-"===n[n.length-1])return e.reset(r),null;const i=n.join("").toLowerCase();for(const[e,r]of Object.entries(t.keywords))if(r.primary.toLowerCase()===i||r.alternatives?.some(e=>e.toLowerCase()===i))return EE(e);return e.reset(r),null}tryMatchShatteredCompound(e,t,r){const n=t.split(r);if(2>n.length||n.some(e=>0===e.length))return!1;const i=e.mark();for(let t=0;n.length>t;t++){if(t>0){const t=e.peek();if(!t||t.value!==r)return e.reset(i),!1;e.advance()}const a=e.peek();if(!a||"identifier"!==a.kind&&"keyword"!==a.kind&&"particle"!==a.kind||a.value.toLowerCase()!==n[t].toLowerCase())return e.reset(i),!1;e.advance()}return!0}matchRoleToken(t,r,n,i){this.skipNoiseWords(t);const a=t.peek();if(!a)return r.optional||!1;if("action"===r.role&&this.currentProfile&&"-"===t.peek(1)?.value){const e=this.tryFoldHyphenActionKeyword(t);if(e)return n.set(r.role,e),!0}if("event"===r.role&&"on"===this.currentPatternCommand){if(!e.tokenLooksLikeEvent(a))return r.optional||!1;const t=(a.normalized??a.value).toLowerCase();if(e.POSITIONAL_OR_SCOPE_KEYWORDS.has(t))return r.optional||!1;if(this.currentProfile&&void 0!==(NE(this.currentProfile,a.value)??NE(this.currentProfile,t)))return r.optional||!1;if(a.value.includes("?."))return r.optional||!1}if("event"===r.role){const t=(a.normalized??a.value).toLowerCase();if(e.STRUCTURAL_NEVER_EVENT.has(t))return r.optional||!1}if("duration"===r.role){const t=(a.normalized??a.value).toLowerCase();if(e.POSITIONAL_OR_SCOPE_KEYWORDS.has(t))return r.optional||!1}if(r.optional&&void 0===i&&"event"!==r.role&&"action"!==r.role&&"keyword"===a.kind){if((a.normalized??a.value).toLowerCase()in Ef)return!0}const o=this.tryMatchPositionalExpression(t);if(o)return r.expectedTypes&&r.expectedTypes.length>0&&!OE(o.type,r.expectedTypes)?r.optional||!1:(n.set(r.role,o),!0);const s=this.tryMatchCaretScopeExpression(t);if(s)return r.expectedTypes&&r.expectedTypes.length>0&&!OE(s.type,r.expectedTypes)?r.optional||!1:(n.set(r.role,s),!0);if("event"!==r.role&&(!r.expectedTypes||r.expectedTypes.includes("expression"))){const e=this.tryMatchOperatorRunExpression(t);if(e)return n.set(r.role,e),!0}if(r.expectedTypes?.includes("property-path")){const e=this.tryMatchOfPossessiveExpression(t);if(e)return n.set(r.role,e),!0;const i=this.tryMatchPostNominalPossessiveExpression(t);if(i)return n.set(r.role,i),!0}const l=this.tryMatchPossessiveExpression(t);if(l)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(l.type)&&!r.expectedTypes.includes("expression")?r.optional||!1:(n.set(r.role,l),!0);const c=this.tryMatchMethodCallExpression(t);if(c)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(c.type)&&!r.expectedTypes.includes("expression")?r.optional||!1:(n.set(r.role,c),!0);const u="event"===r.role&&"on"===this.currentPatternCommand||e.DECLARATION_COMMANDS.has(this.currentPatternCommand??"")?null:this.tryMatchBareCallExpression(t);if(u)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(u.type)&&!r.expectedTypes.includes("expression")?r.optional||!1:(n.set(r.role,u),!0);const p=this.tryMatchPossessiveSelectorExpression(t);if(p)return r.expectedTypes&&r.expectedTypes.length>0&&!OE(p.type,r.expectedTypes)?r.optional||!1:(n.set(r.role,p),!0);const m=this.tryMatchPropertyAccessExpression(t,"condition"!==r.role);if(m)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(m.type)&&!r.expectedTypes.includes("expression")?r.optional||!1:(n.set(r.role,m),!0);const d=this.tryMatchSelectorPropertyExpression(t);if(d)return r.expectedTypes&&r.expectedTypes.length>0&&!OE(d.type,r.expectedTypes)?r.optional||!1:(n.set(r.role,d),!0);if("identifier"===a.kind&&"{"===a.value&&(!r.expectedTypes?.length||r.expectedTypes.includes("literal"))){const e=this.tryMatchBraceRunLiteral(t);if(e)return n.set(r.role,e),!0}const f=this.tokenToSemanticValue(a);if(!f)return r.optional||!1;if(r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(f.type)){const e="selector"===f.type&&(f.value+"").startsWith("@"),t=r.expectedTypes.some(e=>"expression"===e||"reference"===e);if(!e||!t)return r.optional||!1}if(n.set(r.role,f),t.advance(),"event"===r.role){const e=t.peek();e&&"selector"===e.kind&&e.value.startsWith("[")&&"value"in f&&(n.set(r.role,EE(`${f.value+""}${e.value}`)),t.advance());const a=t.peek();if(a&&("particle"===a.kind||"keyword"===a.kind)&&"source"===(a.normalized??"").toLowerCase()&&!this.patternTokenWouldMatch(i,a)){const e=t.peek(1);if(e&&("selector"===e.kind||"identifier"===e.kind)){t.advance();const e=this.tokenToSemanticValue(t.advance());e&&!n.has("source")&&n.set("source",e)}}}return!0}patternTokenWouldMatch(e,t){return!!e&&("literal"===e.type?"none"!==this.getMatchType(t,e.value)||!!e.alternatives?.some(e=>"none"!==this.getMatchType(t,e)):"group"===e.type&&this.patternTokenWouldMatch(e.tokens?.[0],t))}tryMatchPositionalExpression(t){const r=t.peek();if(!r)return null;const n=(r.normalized??r.value).toLowerCase();if(!e.POSITIONAL_KEYWORDS.has(n)&&!e.POSITIONAL_KEYWORDS.has(r.value.toLowerCase()))return null;const i=t.mark(),a=[r.normalized??r.value];t.advance();const o=t.peek();if(!o||"selector"!==o.kind)return t.reset(i),null;a.push(o.value),t.advance();let s=0;for(;8>s++;){const e=t.peek();if(!e||"selector"!==e.kind||!e.value.startsWith("."))break;a.push(e.value),t.advance()}const l=t.peek(),c=t.peek(1);return!l||!c||"selector"!==c.kind||"keyword"!==l.kind&&"particle"!==l.kind&&"identifier"!==l.kind||e.POSITIONAL_KEYWORDS.has((l.normalized??l.value).toLowerCase())||e.COMMAND_ACTION_KEYWORDS.has((l.normalized??l.value).toLowerCase())||(a.push(l.normalized??l.value,c.value),t.advance(),t.advance()),{type:"expression",raw:a.join(" ")}}tryMatchCaretScopeExpression(e){const t=e.peek();if(!t||"identifier"!==t.kind||!t.value.startsWith("^"))return null;const r=e.peek(1),n=e.peek(2),i=(r?.normalized??"").toLowerCase(),a=!!r&&("on"===r.value.toLowerCase()||"destination"===i||"on"===i);return r&&n&&"selector"===n.kind&&a?(e.advance(),e.advance(),e.advance(),{type:"expression",raw:`${t.value} on ${n.value}`}):null}isOfPossessiveMarker(t){const r=t.value.toLowerCase(),n=(t.normalized??"").toLowerCase();if("of"===r||"ng"===r||"of"===n||"source"===n)return!0;const i=this.currentProfile?.code?e.OF_POSSESSIVE_MARKERS[this.currentProfile.code]:void 0;return!!i&&i.has(r)}tryMatchOperatorRunExpression(t){const r=t.mark(),n=t.position();if(!this.tryConsumeRunOperand(t))return t.reset(r),null;let i=1;for(;;){const r=t.peek();if(!r||!e.RUN_OPERATORS.has(r.value))break;const n=t.mark();if(t.advance(),!this.tryConsumeRunOperand(t)){t.reset(n);break}i++}if(2>i)return t.reset(r),null;const a=t.tokens.slice(n,t.position()).map(e=>e.value).join(" ");return{type:"expression",raw:a,value:a}}tryConsumeRunOperand(t){const r=t.peek();if(!r)return!1;if("("===r.value){const e=t.mark();let r=0;for(;!t.isAtEnd();){const e=t.advance();if("("===e.value)r++;else if(")"===e.value&&(r--,0===r))return!0}return t.reset(e),!1}return!!this.tryMatchPossessiveExpression(t)||!("literal"!==r.kind&&"identifier"!==r.kind&&"selector"!==r.kind&&"keyword"!==r.kind||e.RUN_OPERATORS.has(r.value)||")"===r.value)&&(t.advance(),!0)}tryMatchOfPossessiveExpression(e){const t=e.peek();if(!t||"selector"!==t.kind)return null;const r=e.mark();e.advance();const n=e.peek();if(!n||!this.isOfPossessiveMarker(n))return e.reset(r),null;e.advance();const i=e.peek();return i&&"selector"===i.kind?(e.advance(),CE(xE(i.value),t.value)):(e.reset(r),null)}tryMatchPossessiveExpression(t){const r=t.peek();if(!r)return null;if(!this.currentProfile)return null;const n=[r.value,r.normalized].filter(Boolean);let i;for(const e of n)if(i=NE(this.currentProfile,e)??NE(this.currentProfile,e.toLowerCase()),i)break;if(!i)return null;const a=t.mark();t.advance();const o=this.currentProfile.possessive?.connectors;if(o&&o.length>0){const e=t.peek();if(e){const r=e.value.toLowerCase(),n=(e.normalized??"").toLowerCase();o.some(e=>e.toLowerCase()===r||e.toLowerCase()===n)&&t.advance()}}const s=t.peek();if(!s)return t.reset(a),null;if(function(e,t){const r=If.find(t=>t.lang===e);if(!r)return!1;const n=t.toLowerCase();return n===r.at.toLowerCase()||n===r.of.toLowerCase()||n===r.end.toLowerCase()}(this.currentProfile.code,s.value))return t.reset(a),null;if("identifier"===s.kind||"keyword"===s.kind&&!this.isStructuralKeyword(s.value)&&(!s.normalized||!this.isStructuralKeyword(s.normalized))&&(!s.normalized||!this.isRoleMarkerConcept(s.normalized))||"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)){t.advance();let r=s.value;"selector"===s.kind&&r.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(r)&&(r=r.substring(1));let n=r;for(;"selector"===t.peek()?.kind&&t.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(t.peek().value);)n+=t.peek().value,t.advance();const a=t.peek();if(a&&a.value.startsWith("(")){let r="",i=0,a=0;for(;!t.isAtEnd()&&a++<e.MAX_METHOD_ARGS+2;){const e=t.peek();if(!e)break;r+=e.value,t.advance();for(const t of e.value)"("===t?i++:")"===t&&i--;if(0>=i)break}n+=r}return CE(SE(i),n)}return t.reset(a),null}tryMatchPostNominalPossessiveExpression(e){if(!this.currentProfile)return null;if("after-object"!==this.currentProfile.possessive?.markerPosition)return null;const t=e.peek();if(!t)return null;const r="selector"===t.kind&&t.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(t.value);if(!("identifier"===t.kind&&!this.isStructuralKeyword(t.value)&&!(t.normalized&&this.isStructuralKeyword(t.normalized))&&!(t.normalized&&this.isRoleMarkerConcept(t.normalized))||"selector"===t.kind&&(t.value.startsWith("*")||t.value.startsWith("@"))||r)||(e=>{for(const t of[e.value,e.normalized].filter(Boolean))if(NE(this.currentProfile,t)??NE(this.currentProfile,t.toLowerCase()))return!0;return!1})(t))return null;const n=e.mark();let i=t.value;r&&(i=i.substring(1)),e.advance();let a=i;for(;"selector"===e.peek()?.kind&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)a+=e.peek().value,e.advance();const o=e.peek();if(!o)return e.reset(n),null;let s;for(const e of[o.value,o.normalized].filter(Boolean))if(s=NE(this.currentProfile,e)??NE(this.currentProfile,e.toLowerCase()),s)break;return s?(e.advance(),CE(SE(s),a)):(e.reset(n),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())}isRoleMarkerConcept(e){return new Set(["destination","source","patient","object","event","eventmarker","manner","instrument"]).has(e.toLowerCase())}static tokenLooksLikeEvent(e){if("selector"===e.kind||"url"===e.kind)return!1;if("literal"===e.kind)return!1;const t=e.value;if(/[/#@*]/.test(t))return!1;if(t.startsWith('"')||t.startsWith("'")||t.startsWith("`"))return!1;const r=e.normalized?.toLowerCase();return!r||!WE.has(r)}tryMatchBraceRunLiteral(t){const r=t.peek();if(!r||"identifier"!==r.kind||"{"!==r.value)return null;const n=t.mark();t.advance();const i=["{"];let a=1,o=0;for(;!t.isAtEnd()&&o++<e.MAX_BRACE_RUN_TOKENS;){const e=t.advance();if(!e)break;if("{"===e.value)a++;else if("}"===e.value&&(a--,0===a))return i.push("}"),EE(i.join(" "));i.push(e.value)}return t.reset(n),null}tryMatchBareCallExpression(t){const r=t.peek();if(!r||"identifier"!==r.kind)return null;if(!/^[A-Za-z_][\w$]*$/.test(r.value))return null;const n=t.peek(1);if(!n||"("!==n.value)return null;const i=t.mark();t.advance(),t.advance();const a=[];let o=!1,s=0;for(;!t.isAtEnd()&&s++<e.MAX_METHOD_ARGS+2;){const e=t.peek();if(!e)break;if(")"===e.value){t.advance(),o=!0;break}","!==e.value?(a.push(e.value),t.advance()):t.advance()}return o?{type:"expression",raw:`${r.value}(${a.join(", ")})`}:(t.reset(i),null)}tryMatchMethodCallExpression(t){const r=t.peek();if(!r||"selector"!==r.kind)return null;const n=t.mark();t.advance();const i=t.peek();if(!i||"operator"!==i.kind||"."!==i.value)return t.reset(n),null;t.advance();const a=t.peek();if(!a||"identifier"!==a.kind)return t.reset(n),null;t.advance();const o=t.peek();if(!o||"punctuation"!==o.kind||"("!==o.value)return t.reset(n),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:`${r.value}.${a.value}(${s.join(", ")})`}}tryMatchPropertyAccessExpression(t,r=!0){const n=t.peek();if(!n)return null;if("identifier"!==n.kind&&"keyword"!==n.kind)return null;const i=t.mark();t.advance();const a=n.value.toLowerCase(),o=t.peek();if(("identifier"===n.kind||e.PROPERTY_ACCESS_BASES.has(a))&&o&&"selector"===o.kind&&/^\.[a-zA-Z_]/.test(o.value)){let i=n.value;const o=[];let s=0;for(;e.MAX_PROPERTY_DEPTH>s;){const e=t.peek();if(!e||"selector"!==e.kind||!/^\.[a-zA-Z_]/.test(e.value))break;i+="."+e.value.slice(1),o.push(e.value.slice(1)),t.advance(),s++}const l=t.peek(),c=!!l&&l.value.startsWith("(");if(r&&!c&&o.length>0&&TE(a))return CE(SE(a),o.join("."));if(c){const e=t.mark(),r=[];let n=0,a=!1;for(;!t.isAtEnd();){const e=t.peek();if(!e)break;if("("===e.value)n++;else if(")"===e.value){if(r.push(e.value),t.advance(),n--,0===n&&(a=!0),a)break;continue}r.push(e.value),t.advance()}a?i+=r.join(""):t.reset(e)}return{type:"expression",raw:i}}const s=t.peek();if(!s||"operator"!==s.kind||"."!==s.value)return t.reset(i),null;t.advance();const l=t.peek();if(!l||"identifier"!==l.kind)return t.reset(i),null;t.advance();let c=`${n.value}.${l.value}`,u=1;for(;!t.isAtEnd()&&e.MAX_PROPERTY_DEPTH>u;){const e=t.peek();if(!e||"operator"!==e.kind||"."!==e.value)break;t.advance();const r=t.peek();if(!r||"identifier"!==r.kind)break;t.advance(),c+="."+r.value,u++}const p=t.peek();if(p&&"punctuation"===p.kind&&"("===p.value){t.advance();const r=[];let n=0;for(;!t.isAtEnd()&&e.MAX_METHOD_ARGS>r.length;){const e=t.peek();if(!e)break;if("punctuation"===e.kind&&")"===e.value){if(0===n){t.advance();break}n--}"punctuation"===e.kind&&"("===e.value&&n++,"punctuation"!==e.kind||","!==e.value?(r.push(e.value),t.advance()):t.advance()}return{type:"expression",raw:`${c}(${r.join(", ")})`}}const m=n.value.toLowerCase();if(r&&TE(m)){const e=c.split(".").slice(1).join(".");return CE(SE(m),e)}return{type:"expression",raw:c}}tryMatchPossessiveSelectorExpression(e){const t=e.peek();if(!t||"selector"!==t.kind)return null;const r=e.mark();e.advance();const n=e.peek(),i=this.currentProfile?.possessive?.marker?.replace(/^-/,""),a=!!n&&"punctuation"===n.kind&&"'s"===n.value,o=!!n&&"'"===n.value&&"s"===(e.peek(1)?.value??"").toLowerCase(),s=(()=>{if(!this.currentPatternCommand)return!1;if("source"!==(n?.normalized??"").toLowerCase())return!1;const e=Ef[this.currentPatternCommand];return!!e&&e.roles.some(e=>"source"===e.role)})();if(!a&&!!(!n||!i||"'s"===i||n.value!==i||"particle"!==n.kind&&"punctuation"!==n.kind||s)&&!o)return e.reset(r),null;e.advance(),o&&e.advance();const l=e.peek();if(!l)return e.reset(r),null;return"identifier"===l.kind||(a||o)&&("selector"===l.kind||"keyword"===l.kind)?(e.advance(),CE(xE(t.value),l.value)):(e.reset(r),null)}tryMatchSelectorPropertyExpression(e){const t=e.peek();if(!t||"selector"!==t.kind)return null;if(!t.value.startsWith("#"))return null;const r=e.mark();e.advance();const n=e.peek();if(!n||"selector"!==n.kind)return e.reset(r),null;if(!n.value.startsWith("."))return e.reset(r),null;e.peek(1);e.advance();const i=n.value.slice(1);return CE(xE(t.value),i)}matchGroupToken(e,t,r,n){const i=e.mark(),a=new Set(r.keys());if(!this.matchTokenSequence(e,t.tokens,r,n)){e.reset(i);for(const e of r.keys())a.has(e)||r.delete(e);return t.optional||!1}return!0}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 xE(e.value);case"literal":return this.parseLiteralValue(e.value);case"keyword":const t=(e.normalized||e.value).toLowerCase();return TE(t)?SE(t):EE(e.normalized||e.value);case"identifier":if(e.value.startsWith("@"))return xE(e.value);if(e.value.startsWith(":")||e.value.startsWith("$"))return SE(e.value);const r=e.value.toLowerCase();return TE(r)?SE(r):{type:"expression",raw:e.value};case"url":return EE(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("「")){return EE(e.slice(1,-1),"string")}if("true"===e)return EE(!0,"boolean");if("false"===e)return EE(!1,"boolean");const t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){const r=parseFloat(t[1]);return t[2]?EE(e,"duration"):EE(r,"number")}const r=parseFloat(e);return isNaN(r)?EE(e,"string"):EE(r,"number")}applyExtractionRules(e,t){for(const[r,n]of Object.entries(e.extraction))t.has(r)||(void 0!==n.value?t.set(r,{type:"literal",value:n.value}):n.default&&t.set(r,n.default))}isOptional(e){return"literal"!==e.type&&!0===e.optional}skipNoiseWords(t){const r=t.peek();if(!r)return;const n=r.value.toLowerCase();if(e.ENGLISH_NOISE_WORDS.has(n)){const r=t.mark();t.advance();const n=t.peek();if(n&&("selector"===n.kind||"identifier"===n.kind))return;const i=t.peek(1);if(n&&"keyword"===n.kind&&i&&"selector"===i.kind&&/^\.[a-zA-Z_]/.test(i.value))return;const a=n?(n.normalized??n.value).toLowerCase():"";if(n&&e.POSITIONAL_OR_SCOPE_KEYWORDS.has(a))return;const o=t.peek(1),s=o?(o.normalized??o.value).toLowerCase():"",l="SOV"!==this.currentProfile?.wordOrder&&e.COMMAND_ACTION_KEYWORDS.has(s),c=!o||"particle"===o.kind||e.CLAUSE_BOUNDARY_KEYWORDS.has(s)||l;if(n&&"keyword"===n.kind&&"en"!==this.currentProfile?.code&&TE(a)&&c)return;if(n&&"keyword"===n.kind&&"en"===this.currentProfile?.code&&TE(a))return;t.reset(r)}"class"===n&&t.advance()}extractEventModifiers(e){const t={};let r=!1;for(;!e.isAtEnd();){const n=e.peek();if(!n||"event-modifier"!==n.kind)break;const i=n.metadata;if(!i)break;switch(r=!0,i.modifierName){case"once":t.once=!0;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 r?t:void 0}};_E.POSITIONAL_KEYWORDS=new Set(["first","last","next","previous","random","closest"]),_E.POSITIONAL_OR_SCOPE_KEYWORDS=new Set(["first","last","next","previous","random","closest","parent"]),_E.STRUCTURAL_NEVER_EVENT=new Set(["if","unless","else","end","then"]),_E.PROPERTY_ACCESS_BASES=new Set(["it","me","you","my","its","your","event","result","target","detail","body","window","document","self","this"]),_E.COMMAND_ACTION_KEYWORDS=new Set(Object.keys(Ef).map(e=>e.toLowerCase())),_E.CLAUSE_BOUNDARY_KEYWORDS=new Set(["then","and","or","end","else"]),_E.OF_POSSESSIVE_MARKERS={ms:new Set(["daripada"]),sw:new Set(["ya"]),vi:new Set(["của"]),zh:new Set(["的"]),it:new Set(["di"]),pl:new Set(["z"]),uk:new Set(["з"]),th:new Set(["ของ"]),ja:new Set(["の"]),ko:new Set(["의"]),bn:new Set(["র"]),hi:new Set(["का"]),qu:new Set(["pa"]),tr:new Set(["nin"])},_E.RUN_OPERATORS=new Set(["+","-","*","/"]),_E.MAX_BRACE_RUN_TOKENS=64,_E.MAX_PROPERTY_DEPTH=10,_E.MAX_METHOD_ARGS=20,_E.DECLARATION_COMMANDS=new Set(["behavior","def","install"]),_E.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var qE=_E,$E=new qE;function VE(e,t){return Em(e,t)}function DE(){return zm()}Cm(),gv(),Ov(),Fv(),ag(),bg(),Wg(),Fg(),Kf(),Cm(),Rf(),Cm();var BE=["if","unless","repeat","for","while"];function HE(e,t){const r=new Set([t]),n=wm(e),i=n?.keywords?.[t];if(i){i.primary&&r.add(i.primary.toLowerCase());for(const e of i.alternatives??[])r.add(e.toLowerCase())}return r}function FE(e,t){return!!t.has(e.value.toLowerCase())||!!e.normalized&&t.has(e.normalized.toLowerCase())}var KE=new Set(BE);function UE(e,t){const r=e.normalized?.toLowerCase();return r?KE.has(r):t.some(t=>FE(e,t))}var GE=new Set(["me","it","you","the","body","window","document","its","event","result","target","self","this","them","parent","next","previous","closest","first","last"]),YE=new Set(["destination","source","style","patient","on","from","to"]);function ZE(e){if(!e)return!1;if("selector"===e.kind)return!1;const t=(e.normalized??e.value).toLowerCase(),r=e.value.toLowerCase();return!GE.has(t)&&!GE.has(r)&&!YE.has(t)}var JE=new Set(["ja","ko"]);function XE(e){const t=new Set;e?.primary&&t.add(e.primary.toLowerCase());for(const r of e?.alternatives??[])t.add(r.toLowerCase());return t}function QE(e,t){const r=[];let n=t.position.end;const i=e.slice(t.position.end).match(/^\s*\(([^)]*)\)/);if(i){n=t.position.end+i[0].length;for(const e of i[1].split(/[,،、]/)){const t=e.trim();t&&r.push(t)}}return{parameters:r,headerEnd:n}}function eT(e,t,r){let n=t+1;if(n>=e.length)return-1;const i=XE(wm(r)?.roleMarkers?.patient);return i.size>0&&FE(e[n],i)&&n++,e.length>n?n:-1}function tT(e,t,r){if(!wm(t))return null;const n=HE(t,"behavior"),i=HE(t,"def"),a=e.toLowerCase(),o=[...n].some(e=>a.includes(e)),s=/\bdef\b/.test(a)||[...i].some(e=>"def"!==e&&a.includes(e));if(!o&&!s)return null;const l=VE(e,t).tokens;if(2>l.length)return null;if(FE(l[0],n))return iT(e,t,l,r,0);const c=l.findIndex((e,t)=>t>0&&FE(e,n));return c>0&&/^[A-Z][A-Za-z0-9_]*$/.test(l[0].value)?iT(e,t,l,r,c):FE(l[0],i)?function(e,t,r,n){const i=eT(r,0,t);if(0>i)return null;const a=r[i],o=a.value;if(!/^[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*$/.test(o))return null;const{parameters:s,headerEnd:l}=QE(e,a);let c=r.findIndex(e=>e.position.start>=l);c>i||(c=i+1);const u=HE(t,"end"),p=BE.map(e=>HE(t,e)),m=e=>UE(e,p),d=e=>FE(e,u);let f=0,h=-1;for(let e=c;r.length>e;e++)if(d(r[e])){if(0===f){h=e;break}f--}else m(r[e])&&f++;const y=r[c]?.position.start??l,v=0>h?e.length:r[h].position.start,g=e.slice(y,v).trim();if(!g)return null;let k;try{k=nT(n.body(g,t))}catch{return null}if(0===k.length)return null;let b=rT(k.map(e=>e.metadata?.confidence??.75));0>h&&(b*=.8);return function(e,t,r,n){const i={kind:"def",action:"def",roles:new Map,name:e,parameters:t,body:r};return void 0!==n&&(i.metadata=n),i}(o,s,k,{sourceLanguage:t,confidence:b,sourceText:e})}(e,t,l,r):null}function rT(e){return e.length>0?e.reduce((e,t)=>e+t,0)/e.length:0}function nT(e){const t=[];for(const r of e){const e=r.statements;"compound"===r.kind&&Array.isArray(e)?t.push(...e):t.push(r)}return t}function iT(e,t,r,n,i){const a=i>0,o=a?0:eT(r,i,t);if(0>o)return null;const s=r[o],l=s.value;if(!/^[A-Z][A-Za-z0-9_]*$/.test(l))return null;const{parameters:c,headerEnd:u}=QE(e,s);let p=a?i+1:r.findIndex(e=>e.position.start>=u);p>o||(p=o+1);const m=HE(t,"init"),d=HE(t,"end"),f=BE.map(e=>HE(t,e)),h=e=>UE(e,f),y=e=>FE(e,d),v=[],g=[],k=[];let b=!1,w=0,z=p;for(let i=p;r.length>i;i++){const a=r[i];if(y(a)){if(w>0){w--;continue}if(i===z){b=!0;break}if(FE(r[z],m)){const i=e.slice(r[z].position.end,a.position.start).trim();if(i)try{const e=nT(n.body(i,t));g.push(...e),k.push(rT(e.map(e=>e.metadata?.confidence??.75)))}catch{k.push(0)}}else{const i=e.slice(r[z].position.start,a.position.start).trim();try{const e=n.statement(i,t);if(e&&"event-handler"===e.kind){const t=e;v.push(t);k.push(!t.body||0===t.body.length?.2:t.metadata?.confidence??.75)}else k.push(0)}catch{k.push(0)}}z=i+1}else h(a)&&w++}if(0===v.length&&0===g.length)return null;const x=(b?1:.8)*rT(k);return function(e,t,r,n,i){const a={kind:"behavior",action:"behavior",roles:new Map,name:e,parameters:t,eventHandlers:r};return void 0!==n&&n.length>0&&(a.initBlock=n),void 0!==i&&(a.metadata=i),a}(l,c,v,g.length>0?g:void 0,{sourceLanguage:t,confidence:x,sourceText:e})}nz(),Df(),Cm(),nz();var aT=class{render(e,t){if("compound"===e.kind)return this.renderCompound(e,t);if("behavior"===e.kind)return this.renderBehavior(e,t);if("def"===e.kind)return this.renderDef(e,t);const r=function(e,t){return Tm(e).filter(e=>e.command===t).sort((e,t)=>t.priority-e.priority)}(t,e.action);if(0===r.length)return this.renderExplicit(e);const n=this.findBestPattern(e,r);return n?this.renderWithPattern(e,n):this.renderExplicit(e)}renderCompound(e,t){if(e.statements.length>1&&e.statements.every(e=>"event-handler"===e.kind)){const r=this.keyword(t,"end"),n=[];for(const i of e.statements)n.push(this.render(i,t),r);return n.join("\n")}const r=e.statements.map(e=>this.render(e,t)),n=this.getChainWord(e.chainType,t);return r.join(` ${n} `)}keyword(e,t){return wm(e)?.keywords?.[t]?.primary??t}renderBlockHeader(e,t,r){return r.length>0?`${e} ${t}(${r.join(", ")})`:`${e} ${t}`}renderBehavior(e,t){const r=this.keyword(t,"end"),n=[this.renderBlockHeader(this.keyword(t,"behavior"),e.name,e.parameters)];for(const i of e.eventHandlers)n.push(" "+this.render(i,t)," "+r);if(e.initBlock&&e.initBlock.length>0){n.push(" "+this.keyword(t,"init"));for(const r of e.initBlock)n.push(" "+this.render(r,t));n.push(" "+r)}return n.push(r),n.join("\n")}renderDef(e,t){const r=[this.renderBlockHeader(this.keyword(t,"def"),e.name,e.parameters)];for(const n of e.body)r.push(" "+this.render(n,t));return r.push(this.keyword(t,"end")),r.join("\n")}getChainWord(e,t){const r=wm(t);if(!r?.keywords)return e;const n=r.keywords[e];return n?.primary??e}renderExplicit(e){return Fc(e)}supportedLanguages(){return DE()}findBestPattern(e,t){let r=t;if("event-handler"===e.kind){const e=t.filter(e=>!/-event-/i.test(e.id));e.length>0&&(r=e)}const n=r.map(t=>{let r=t.priority;for(const n of t.template.tokens)"role"===n.type&&(e.roles.has(n.role)?r+=10:n.optional||(r-=50));return/-at-end|-at-start|-before$|-after$/i.test(t.id)&&(r-=30),"en"===t.language&&((t.id.includes("standard")||t.id.includes("en-source"))&&(r+=20),(t.id.includes("-when")||t.id.includes("-if")||t.id.includes("-upon"))&&(r-=15)),{pattern:t,score:r}});return n.sort((e,t)=>t.score-e.score),n.length>0?n[0].pattern:null}renderWithPattern(e,t){const r=[],n=t.language;for(const i of t.template.tokens){const t=this.renderPatternToken(i,e,n);null!==t&&r.push(t)}if("event-handler"===e.kind){if(e.body&&e.body.length>0){const t=e.body.map(e=>this.render(e,n));r.push(t.join(" "))}}return r.join(" ")}renderPatternToken(e,t,r){switch(e.type){case"literal":return e.value;case"role":{const n=t.roles.get(e.role);return n?"event"===e.role&&"event-handler"===t.kind?this.renderEventName(n,r):this.valueToNaturalString(n,r):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){if(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}}if(e.optional){if(e.tokens.find(e=>"role"===e.type&&"quantity"===e.role)){const e=t.roles.get("quantity");if("literal"===e?.type&&1===Number(e.value))return null}}const n=[];let i=!1;for(const a of e.tokens){const e=this.renderPatternToken(a,t,r);null!==e&&(n.push(e),"role"===a.type&&(i=!0))}return e.optional&&!i?null:n.length>0?n.join(" "):null}default:return null}}renderEventName(e,t){if("literal"!==e.type||"string"!=typeof e.value)return this.valueToNaturalString(e,t);const r=e.value,n=e=>e.includes(":")?e:ez(e,t);return r.includes(" or ")?r.split(" or ").map(e=>n(e.trim())).join(" or "):n(r)}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 r=wm(t);return r?.references?r.references[e.value]??e.value:e.value}renderPropertyPath(e,t){const r=wm(t),n=e.property,i="reference"===e.object.type?e.object.value:null;if(r?.possessive?.specialForms&&i){const e=r.possessive.specialForms[i];if(e){const{markerPosition:t,usePossessiveAdjectives:i}=r.possessive;return i&&"after-object"===t?`${n} ${e}`:`${e} ${n}`}}const a=this.valueToNaturalString(e.object,t);if(r?.possessive){const{marker:e,markerPosition:t,usePossessiveAdjectives:o}=r.possessive;if(o&&i&&"after-object"===t)return`${n} ${a}`;if(e)switch(t){case"between":return r.usesSpaces?`${a}${e} ${n}`:`${a}${e}${n}`;case"after-object":return`${a}${e} ${n}`;case"before-property":return`${a} ${e} ${n}`}}return"en"!==t&&r?.possessive?`${a} ${n}`:"me"===a?"my "+n:"it"===a?"its "+n:`${a}'s ${n}`}},oT=new aT;function sT(e,t){return oT.render(e,t)}function lT(e){return oT.renderExplicit(e)}Rf();var cT={getSchema:Pf};function uT(e){return Mc(e,{schemaLookup:cT})}var pT=new Set(["if","unless","while","repeat","for"]),mT=new Set(["then","end","else","if","unless","while","for","repeat","and"]),dT=new Set(["first","last","next","previous","random","closest"]),fT=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu","transitionend","transitionstart","transitionrun","transitioncancel","animationend","animationstart","animationiteration","animationcancel","pointerdown","pointerup","pointermove","pointerenter","pointerleave","pointercancel","pointerover","pointerout","touchstart","touchend","touchmove","touchcancel","mousemove","mouseenter","mouseleave","wheel","dragstart","dragend","dragover","dragenter","dragleave","drop","drag","loadend","loadstart","error","abort","close","open","message","popstate","hashchange","storage","online","offline","visibilitychange"]),hT=class extends Error{constructor(e,t,r,n){super(e),this.name="SemanticParseError",this.language=t,this.input=r,this.diagnostics=n}};function yT(e,t,r){return{message:e,severity:t,source:"semantic-parser",...r&&{code:r}}}function vT(e,t){return 0===t.length?e:{...e,diagnostics:t}}function gT(e){if(e.length>=2){const t=e[0];if(('"'===t||"'"===t)&&e.endsWith(t))return e.slice(1,-1)}return e}var kT=["body","statements","thenBranch","elseBranch","eventHandlers","initBlock"];function bT(e,t){if(!e||"object"!=typeof e)return e;if(e.action&&e.roles instanceof Map){const r=Pf(e.action),n=r?.primaryRole;if(r&&n&&"patient"!==n&&!r.roles.some(e=>"patient"===e.role)&&e.roles.has("patient")&&!e.roles.has(n)){const t=e.roles,r=t.get("patient");void 0!==r&&(t.delete("patient"),t.set(n,r))}if("tell"===e.action){const t=e.roles,r=t.get("patient"),n=t.get("destination");!r||"selector"!==r.type&&"reference"!==r.type||n&&"literal"!==n.type||(t.delete("patient"),t.set("destination",r))}if("transition"===e.action){const t=e.roles,r=t.get("destination");r&&"literal"===r.type&&!t.has("goal")&&(t.delete("destination"),t.set("goal",r));const n=t.get("patient");n&&"literal"===n.type&&"string"==typeof n.value&&/^[A-Za-z_][A-Za-z0-9_-]*$/.test(n.value)&&t.set("patient",{type:"expression",raw:n.value})}if("morph"===e.action){const t=e.roles,r=t.get("patient");r&&"literal"===r.type&&"string"==typeof r.value&&/<[a-zA-Z][^>]*\/?>/.test(r.value)&&t.set("patient",{type:"expression",raw:r.value})}if("wait"===e.action){const t=e.roles;if(!t.has("event")){const e=t.get("duration"),r="expression"===e?.type?e.raw:"literal"===e?.type?e.value:void 0;"string"==typeof r&&fT.has(r.toLowerCase())&&(t.delete("duration"),t.set("event",{type:"literal",value:r,dataType:"string"}))}}if("command"===e.kind&&"on"!==e.action){const t=e.roles,r=t.get("event");if(r&&"expression"===r.type){const e=r.raw;"string"==typeof e&&/^[A-Za-z_][A-Za-z0-9_-]*(:[A-Za-z0-9_-]+)?$/.test(e)&&t.set("event",{type:"literal",value:e,dataType:"string"})}}if(t?.size){const r=e.roles;for(const e of["destination","source"]){const n=r.get(e);n&&"literal"===n.type&&"string"==typeof n.value&&t.has(n.value)&&r.set(e,{type:"expression",raw:n.value})}}}const r=e;for(const e of kT){const n=r[e];if(Array.isArray(n))for(const e of n)bT(e,t)}return e}var wT=class e{constructor(){this.parseDepth=0,this.boundIdentifiers=new Set}parse(e,t){0===this.parseDepth&&this.boundIdentifiers.clear(),this.parseDepth++;try{return bT(this.parseInternal(e,t),this.boundIdentifiers)}finally{this.parseDepth--}}registerBoundIdentifiers(e){const t="repeat"===e.action||"for"===e.action?"patient":"set"===e.action?"destination":null;if(!t)return;const r=e.roles.get(t);"expression"===r?.type&&"string"==typeof r.raw&&/^[A-Za-z_]\w*$/.test(r.raw)&&this.boundIdentifiers.add(r.raw)}parseInternal(t,r){const n=tT(t,r,{statement:(e,t)=>this.parse(e,t),body:(e,t)=>this.parseStatements(e,t)});if(n)return n;const i=function(e,t,r){const n=wm(t);if(!n)return null;const i="SOV"!==n.wordOrder,a=JE.has(t)?XE(n.roleMarkers?.event):new Set,o=JE.has(t)?XE(n.keywords?.on):new Set,s=a.size>0&&o.size>0,l=HE(t,"end"),c=HE(t,"on"),u=e.toLowerCase(),p=[...l].some(e=>u.includes(e)),m=(i||s)&&(()=>{let e=0;for(const t of c)if(t)for(let r=u.indexOf(t);r>=0;r=u.indexOf(t,r+t.length))if(++e>=2)return!0;return!1})();if(!p&&!m)return null;const d=VE(e,t).tokens;if(2>d.length)return null;const f=BE.map(e=>HE(t,e)),h=e=>UE(e,f),y=e=>FE(e,l),v=[];let g=0,k=0;for(let t=0;d.length>t;t++){const r=d[t];if(y(r)){if(g>0){g--;continue}const n=e.slice(d[k].position.start,r.position.start).trim();n&&v.push(n),k=t+1}else if(h(r))g++;else if(i&&0===g&&t>k&&FE(r,c)&&ZE(d[t+1])){const n=e.slice(d[k].position.start,r.position.start).trim();n&&v.push(n),k=t}else if(s&&0===g&&t-1>k&&FE(r,a)&&void 0!==d[t+1]&&FE(d[t+1],o)){const r=e.slice(d[k].position.start,d[t-1].position.start).trim();r&&v.push(r),k=t-1}}if(d.length>k){const t=e.slice(d[k].position.start).trim();t&&v.push(t)}if(2>v.length)return null;const b=[],w=[];for(const e of v){let n;try{n=r.statement(e,t)}catch{return null}if(!n||"event-handler"!==n.kind)return null;const i=n;b.push(i),w.push(i.body&&0!==i.body.length?i.metadata?.confidence??.75:.2)}return jE(b,"then",{sourceLanguage:t,confidence:rT(w),sourceText:e})}(t,r,{statement:(e,t)=>this.parse(e,t),body:(e,t)=>this.parseStatements(e,t)});if(i)return i;const{modifiers:a,remainingInput:o}=this.extractStandaloneModifiers(t,r),s=o||t,l=this.stripAsyncModifier(s,r).remainingInput??s,c=this.stripDoNotThrowModifier(l,r).remainingInput??l,u=[],p=VE(c,r),m=Tm(r);if(0===m.length)throw new hT("No patterns available for language: "+r,r,c,[yT(`No patterns registered for language '${r}'`,"error","no-patterns")]);const d=[...m].sort((e,t)=>t.priority-e.priority);{const e=p.tokens;if("VSO"===wm(r)?.wordOrder&&e.length>=4&&"source"===e[0]?.normalized){const t=e.findIndex(e=>"on"===e.normalized);if(t>=2&&e.length>t+1){const n=c.slice(e[0].position.start,e[t].position.start).trim(),i=e[t+1].position.end,o=c.slice(e[t].position.start,i)+" "+n+c.slice(i);if(o!==c)try{const e=this.parse(o,r);if(e&&"event-handler"===e.kind){return vT(a?this.applyModifiers(e,a):e,u)}}catch{}}}}{const t=p.tokens;for(let n=1;t.length-1>n;n++){const i=t[n],o=i.value,s=(i.normalized??i.value).toLowerCase();if(!("or"===s||e.OR_KEYWORDS.has(o)||e.OR_KEYWORDS.has(s)))continue;const l=t[n+1],p=(l.normalized??l.value).toLowerCase();if(!e.KNOWN_EVENTS.has(p))break;let m=n+1;const d=t[n+2];d&&"selector"===d.kind&&d.value.startsWith("[")&&(m=n+2);const f=t[m].position.end,h=(c.slice(0,t[n].position.start).trimEnd()+" "+c.slice(f).trimStart()).trim();if(h&&h!==c)try{const e=this.parse(h,r);if(e&&"event-handler"===e.kind){e.additionalEvents=[{type:"literal",value:p}];return vT(a?this.applyModifiers(e,a):e,u)}}catch{}break}}const f=d.filter(e=>"on"===e.command),h=p.mark(),y=$E.matchBest(p,f);if(y){u.push(yT(`event pattern matched: ${y.pattern.id} (confidence: ${y.confidence.toFixed(2)})`,"info","pattern-match"));let t=!1;if(/^event-[a-z]+-bare$/.test(y.pattern.id)){const n=y.captured.get("event"),i=(""+(n?.raw??n?.value??"")).toLowerCase(),o=Zw[r],s=e.KNOWN_EVENTS.has(i)||!!o&&Object.keys(o).some(e=>e.toLowerCase()===i);if(i&&!s){const e=this.trySOVEventExtraction(c,r,d);if(e){u.push(yT(`bare-event mis-anchor on "${i}" rejected; SOV extraction preferred`,"info","stage-bare-event-guard"));return vT(a?this.applyModifiers(e,a):e,u)}if("reference"===n?.type||"expression"===n?.type){p.reset(h);const e=d.filter(e=>"on"!==e.command),r=$E.matchBest(p,e);p.reset(h),r&&"on"!==r.pattern.command?(t=!0,u.push(yT(`bare-event mis-anchor on reference "${i}" rejected; command ${r.pattern.command} preferred`,"info","stage-bare-event-guard"))):$E.matchBest(p,f)}}}if(!t){const e=this.buildEventHandler(y,p,r);return vT(a?this.applyModifiers(e,a):e,u)}}u.push(yT(`event patterns: ${f.length} tried, no match`,"info","stage-event"));const v=this.tryTrailingEventExtraction(c,r,d);if(v){u.push(yT("trailing event extraction succeeded","info","stage-trailing-event"));return vT(a?this.applyModifiers(v,a):v,u)}const g=d.filter(e=>"on"!==e.command),k=$E.matchBest(p,g);if(k){if(pT.has(k.pattern.command)){const e=this.trySOVEventExtraction(c,r,d);if(e){u.push(yT(`SOV event extraction preferred over bare ${k.pattern.command} command`,"info","stage-sov-loop"));return vT(a?this.applyModifiers(e,a):e,u)}const t=this.tryMidStreamEventExtraction(c,r,d);if(t){u.push(yT(`mid-stream event extraction preferred over bare ${k.pattern.command} command`,"info","stage-midstream-loop"));return vT(a?this.applyModifiers(t,a):t,u)}}else if(e.KNOWN_EVENTS.has(k.pattern.command)&&this.hasSOVEventMarkerHead(c,r)){const e=this.trySOVEventExtraction(c,r,d);if(e){u.push(yT("SOV event extraction preferred over command-homonym event "+k.pattern.command,"info","stage-sov-homonym"));return vT(a?this.applyModifiers(e,a):e,u)}}else if("VSO"===wm(r)?.wordOrder){const e=this.tryMidStreamEventExtraction(c,r,d);if(e){u.push(yT(`mid-stream event extraction preferred over bare ${k.pattern.command} command`,"info","stage-midstream-cmd"));return vT(a?this.applyModifiers(e,a):e,u)}}if(p.tokens.length>k.consumedTokens&&"SOV"===wm(r)?.wordOrder){const e=this.trySOVEventExtraction(c,r,d);if(e){u.push(yT(`SOV event extraction preferred over partial ${k.pattern.command} command (trailing remainder)`,"info","stage-sov-trailing"));return vT(a?this.applyModifiers(e,a):e,u)}}return u.push(yT(`command pattern matched: ${k.pattern.id} (confidence: ${k.confidence.toFixed(2)})`,"info","pattern-match")),vT(this.buildCommand(k,r),u)}if(u.push(yT(`command patterns: ${g.length} tried, no match`,"info","stage-command")),!c.includes("\n")&&"VSO"===wm(r)?.wordOrder){const e=this.tryMidStreamEventExtraction(c,r,d);if(e){u.push(yT("mid-stream event extraction succeeded with no leading command match","info","stage-midstream-nocmd"));return vT(a?this.applyModifiers(e,a):e,u)}}const b=this.trySOVEventExtraction(c,r,d);if(b){u.push(yT("SOV event extraction succeeded","info","stage-sov"));return vT(a?this.applyModifiers(b,a):b,u)}u.push(yT("SOV event extraction: no event keyword found","info","stage-sov"));const w=this.tryCompoundCommandParsing(p,g,r);if(w)return u.push(yT("compound command parsing succeeded","info","stage-compound")),vT(w,u);throw u.push(yT("compound parsing: no then-keywords or no command matches","info","stage-compound")),u.push(yT(`all parse stages exhausted for "${c}"`,"error","parse-failed")),new hT(`Could not parse input in ${r}: ${c}`,r,c,u)}parseStatements(e,t){const r=VE(e,t),n=Tm(t).filter(e=>"on"!==e.command).sort((e,t)=>t.priority-e.priority);return this.parseBodyWithClauses(r,n,t)}canParse(e,t){try{return this.parse(e,t),!0}catch{return!1}}supportedLanguages(){return DE()}buildCommand(e,t){if(!e)throw Error("No match to build command from");const r={};for(const[t,n]of e.captured)r[t]=n;const n=AE(e.pattern.command,r,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence});return this.registerBoundIdentifiers(n),n}buildEventHandler(t,r,n){if(!t)throw Error("No match to build event handler from");const i=t.captured.get("event");if(!i)throw Error("Event handler pattern matched but no event captured");const a=$E.extractEventModifiers(r),o=this.extractOrConjunctionEvents(r,n);let s,l=i;if(o.length>0&&"literal"===i.type){l={type:"literal",value:[i.value+"",...o.map(e=>("value"in e?e.value:"")+"")].join(" or ")}}const c=t.captured.get("action");if(c&&"literal"===c.type&&"if"===c.value){const e=r.tokens;let i=-1;for(let t=r.position()-1;t>=0;t--){const r=e[t],a=(r.normalized??r.value).toLowerCase();if(this.isIfKeyword(a,n)){i=t;break}}if(i>=0){const o=Tm(n).filter(e=>"on"!==e.command).sort((e,t)=>t.priority-e.priority),s=new Cp(e.slice(i),n),c=this.parseBodyWithClauses(s,o,n);if(c.some(e=>"conditional"===e.kind)||1===c.length&&"compound"===c[0]?.kind&&c[0].statements.some(e=>"conditional"===e.kind)){for(;!r.isAtEnd();)r.advance();return LE(l,c,a,{sourceLanguage:n,patternId:t.pattern.id,confidence:t.confidence})}}}if(c&&"literal"===c.type){const a=c.value,o={};for(const[e,r]of t.captured)"event"!==e&&"action"!==e&&"continues"!==e&&(o[e]=r);if("repeat"===a){const e=r.peek(),t=e=>(e.normalized??e.value).toLowerCase();if(e&&"keyword"===e.kind&&"forever"===t(e))o.loopType={type:"literal",value:"forever"},delete o.patient,r.advance();else if(e&&"keyword"===e.kind&&"event"===t(e)){r.advance();const e=r.peek();if(e)for(o.event={type:"literal",value:t(e)},o.loopType={type:"literal",value:"until-event"},delete o.patient;!r.isAtEnd();){const e=r.peek();if(!e||"conjunction"===e.kind||"keyword"===e.kind&&(this.isThenKeyword(e.value,n)||this.isEndKeyword(e.value,n)))break;r.advance()}}const i=o.patient;i&&"reference"===i.type&&"me"===i.value&&delete o.patient}let l=AE(a,o,{sourceLanguage:n,patternId:t.pattern.id,confidence:t.confidence});if(this.registerBoundIdentifiers(l),!pT.has(a)||"repeat"===a){const e=t.pattern.id.includes("verb-first"),s=r.tokens,c=r.position(),u=e=>"conjunction"===e.kind||"keyword"===e.kind&&(this.isThenKeyword(e.value,n)||this.isEndKeyword(e.value,n));let p=-1;for(let e=c-1;e>=0;e--){const t=s[e];if(u(t))break;if((t.normalized??t.value).toLowerCase()===a){p=e;break}}if(p>=0){let t=c;for(;s.length>t&&!u(s[t]);)t++;const m=s.slice(p,t);let d=m;if(e){const e=((i.value??"")+"").toLowerCase(),t=m.findIndex(t=>(t.normalized??t.value).toLowerCase()===e);if(0>t)d=null;else{const e=m[t-1],r=e&&"keyword"===e.kind&&"on"===e.normalized?.toLowerCase()?t-1:t;d=[...m.slice(0,r),...m.slice(t+1)]}}if(d&&d.length>1){const e=Tm(n).filter(e=>"on"!==e.command).sort((e,t)=>t.priority-e.priority),i=this.parseClause(d,e,n),s=i[0],c=e=>null!==e&&"object"==typeof e&&"string"==typeof e.type?e.type:typeof e,u=Pf(a),p=u?.primaryRole,m=e=>"patient"===e&&p&&"patient"!==p&&!u?.roles.some(e=>"patient"===e.role)?p:e,f=(e,t)=>{if(!pT.has(a)||!u)return!1;const r=u.roles.find(t=>t.role===m(e));return!r||r.expectedTypes.length>0&&!r.expectedTypes.includes(c(t))},h=!!s&&"command"===s.kind&&Object.entries(o).every(([e,t])=>{if(f(e,t))return!0;const r=s.roles.get(m(e));return void 0!==r&&c(r)===c(t)}),y=s?.metadata?.patternId??"",v=!pT.has(a)||/^repeat-.*-(times|for-in|while-head|until-head)$/.test(y);if(1===i.length&&s&&"command"===s.kind&&s.action===a&&h&&v&&s.roles.size>Object.keys(o).length)for(l=s;r.position()<t;)r.advance()}}}if(!pT.has(a)){const t=l,i=Pf(a)?.roles.some(e=>"quantity"===e.role&&!e.required);if(i&&!t.roles.has("quantity")){const e=r.peek();e&&/^-?\d+(\.\d+)?$/.test(e.value)&&(l=AE(a,{...Object.fromEntries(t.roles),quantity:{type:"literal",value:parseFloat(e.value),dataType:"number"}},t.metadata),r.advance())}const o=l,s=Pf(a)?.roles.some(e=>"duration"===e.role&&!e.required);if(s&&!o.roles.has("duration")){const e=r.peek();e&&/^\d+(\.\d+)?(ms|s)$/i.test(e.value)&&(l=AE(a,{...Object.fromEntries(o.roles),duration:{type:"literal",value:e.value,dataType:"string"}},o.metadata),r.advance(),this.consumeForPostposition(r,n))}const c=l,u=Pf(a),p=u?.roles.find(e=>"responseType"===e.role&&!e.required);if(p&&!c.roles.has("responseType")){const t=t=>"string"==typeof t&&e.RESPONSE_TYPE_WORDS.has(t.toLowerCase()),n=(e,t)=>{const r=Object.fromEntries(c.roles);t&&delete r.destination,r.responseType={type:"expression",raw:e},l=AE(a,r,c.metadata)},i=c.roles.get("destination"),o=u?.roles.find(e=>"destination"===e.role),s=i?.raw??i?.value;if(i&&o&&!o.expectedTypes.includes(i.type)&&t(s))n(s,!0);else{const e=r.peek();e&&t(e.value)&&(n(e.value,!1),r.advance())}}if("wait"===a){const e=l;if(!e.roles.has("event")){const t=r.peek();if(t&&fT.has(t.value.toLowerCase())){const i=Object.fromEntries(e.roles),o=i.duration;o&&"literal"!==o.type&&"expression"!==o.type&&delete i.duration;const s=i.patient;s&&"reference"===s.type&&"me"===s.value&&delete i.patient,i.event={type:"literal",value:t.value,dataType:"string"},l=AE(a,i,e.metadata),r.advance(),this.consumeForPostposition(r,n)}}}}const u=t.captured.get("continues"),p="literal"===u?.type&&"then"===u.value,m=r.peek(),d=!!m&&this.isThenKeyword(m.value,n),f=pT.has(a)&&!!m&&!this.isEndKeyword(m.value,n),h=!!m&&!this.isEndKeyword(m.value,n);if(p||d||f||h){const e=Tm(n).filter(e=>"on"!==e.command).sort((e,t)=>t.priority-e.priority),t=Tm(n).filter(e=>e.id.startsWith("grammar-")&&e.id.includes("-continuation")).sort((e,t)=>t.priority-e.priority),i=this.parseBodyWithGrammarPatterns(r,e,t,n);s=i.length>0?[l,...i]:[l]}else s=[l]}else{const e=Tm(n).filter(e=>"on"!==e.command).sort((e,t)=>t.priority-e.priority);s=this.parseBodyWithClauses(r,e,n)}return LE(l,s,a,{sourceLanguage:n,patternId:t.pattern.id,confidence:t.confidence})}parseBodyWithClauses(e,t,r){const n=[],i=[];let a=0;const o=[];for(;!e.isAtEnd();){const s=e.peek();if(!s)break;if(0===i.length){const i=this.consumeJsBlock(e,r);if(i){n.push(i);continue}const a=this.tryParseConditionalBlock(e,t,r);if(a){n.push(a);continue}}const l="conjunction"===s.kind||"keyword"===s.kind&&this.isThenKeyword(s.value,r),c=i[i.length-1],u=e.peek(1),p="at"===c?.value.toLowerCase()&&"of"===u?.value.toLowerCase()||Mf(r,s.value,c?.value,u?.value),m="keyword"===s.kind&&this.isEndKeyword(s.value,r)&&!p;if(m&&0<a)a--,o.pop(),i.push(s),e.advance();else if(l&&o.includes("if"))i.push(s),e.advance();else if(l){if(i.length>0){const e=this.parseClause(i,t,r);n.push(...e),i.length=0,a=e.filter(e=>{const t=e;return!("for"!==t.action&&"repeat"!==t.action&&"while"!==t.action||Array.isArray(t.body)&&0!==t.body.length)}).length,o.length=0;for(let e=0;a>e;e++)o.push("other")}e.advance()}else{if(m){e.advance();const a=[];for(;!e.isAtEnd();){const t=e.peek();if(!t)break;if("conjunction"===t.kind||"keyword"===t.kind&&(this.isThenKeyword(t.value,r)||this.isEndKeyword(t.value,r)))break;a.push(t),e.advance()}if(a.length>0){const e=i.length>0?this.parseClause(i,t,r):[];0===e.length&&i.length>0?n.push(...this.parseClause([...i,...a],t,r)):(n.push(...e),n.push(...this.parseClause(a,t,r)))}else if(i.length>0){const e=this.parseClause(i,t,r);n.push(...e)}i.length=0;break}if("keyword"===s.kind){const e=(s.normalized??s.value).toLowerCase();(this.isIfKeyword(e,r)||this.isUnlessKeyword(e,r)||"while"===e||"for"===e||"repeat"===e)&&(a++,o.push(this.isIfKeyword(e,r)?"if":"other"))}i.push(s),e.advance()}}if(i.length>0){const e=this.parseClause(i,t,r);n.push(...e)}this.foldFrontedWhileIntoRepeat(n,r);for(let e=n.length-1;e>=0;e--){const t=n[e];"command"!==t.kind||"for"!==t.action||t.roles instanceof Map&&0!==t.roles.size||Array.isArray(t.body)&&0!==t.body.length||n.splice(e,1)}return n.length>1?[jE(n,"then",{sourceLanguage:r})]:n}foldFrontedWhileIntoRepeat(e,t){for(let r=0;e.length>r+1;r++){const n=e[r],i=e[r+1];if("command"!==n.kind||"while"!==n.action)continue;if("command"!==i.kind||"repeat"!==i.action)continue;const a=n.roles.get("condition");if(!a)continue;if(i.roles.has("condition"))continue;if(Array.isArray(n.body)||Array.isArray(i.body))continue;const o=new Map(i.roles);o.set("condition",a),o.set("loopType",{type:"literal",value:"while",dataType:"string"}),e.splice(r,2,{...i,roles:o,metadata:{...i.metadata,sourceLanguage:t,patternId:`repeat-${t}-fronted-while-fold`,confidence:Math.max(i.metadata?.confidence??0,n.metadata?.confidence??0)}})}}parseClause(t,r,n){if(0===t.length)return[];let i=null,a=t;const o=t[t.length-1];if(o&&t.length>=2){const e=(o.normalized??o.value).toLowerCase();this.isUnlessKeyword(e,n)&&(i="unless",a=t.slice(0,-1))}let s=null;if(i&&a.length>=3){const t=wm(n),r=t?e.buildVerbLookup(t):null;if(r)for(let t=1;a.length-1>t;t++){const n=a[t],i=r.get(n.value.toLowerCase())??(n.normalized?r.get(n.normalized.toLowerCase()):void 0);if(i&&!e.CONDITION_OPERATORS.has(i)){s=a.slice(0,t),a=a.slice(t);break}}}const l=new Cp(a,n),c=[];let u=0;const p=[];let m=s;const d=()=>{if(0===p.length)return;const e=p.slice();if(p.length=0,i&&0===c.length&&null===m)return void(m=e);const t=e[0];if(t&&("identifier"===t.kind||"selector"===t.kind||"literal"===t.kind||"reference"===t.kind))for(const t of this.parseSOVClauseByVerbAnchoring(e,n)){const e=t.action,r=t.roles;e&&Pf(e)&&r instanceof Map&&r.size>0&&c.push(t)}};for(;!l.isAtEnd();){const e=l.peek(),t=!!e&&"repeat"===e.normalized?.toLowerCase(),i=l.mark(),a=$E.matchBest(l,r);if(t&&a&&"repeat"!==a.pattern.command)l.reset(i),d(),c.push(AE("repeat",{},{sourceLanguage:n,confidence:.6})),u++,l.advance();else{if(a&&"if"===a.pattern.command){const e=l.mark(),t=p.length;for(l.reset(i);!l.isAtEnd();){const e=l.peek();if(!e||this.isIfKeyword((e.normalized??e.value).toLowerCase(),n))break;p.push(e),l.advance()}const a=this.tryParseConditionalBlock(l,r,n);if(a){d(),c.push(a),u++;continue}p.length=t,l.reset(e)}if(a){d();const e=this.buildCommand(a,n);c.push(e),u++,this.tryAttachTrailingRole(l,e,n)}else{const e=l.peek();e&&"repeat"===e.normalized?.toLowerCase()?(d(),c.push(AE("repeat",{},{sourceLanguage:n,confidence:.6})),u++):e&&p.push(e),l.advance()}}}d();let f=c;if(0===u){const e=this.parseSOVClauseByVerbAnchoring(a,n);e.length>0&&(f=e)}if(i&&f.length>0&&m&&m.length>0){return[AE(i,{condition:{type:"expression",raw:this.joinTokenText(m)}},{sourceLanguage:n,patternId:`${i}-${n}-trailing-guard`,confidence:.85}),...f]}return f}tryAttachTrailingRole(e,t,r){const n=Pf(t.action);if(!n)return;const i=wm(r);if(!i)return;const a=t.roles,o=(e,t)=>{if(!e)return!1;if("selector"===e.kind)return!0;const r=(e.normalized??e.value).toLowerCase();return!mT.has(r)&&("body"===r||"it"===r||"you"===r||"result"===r||"document"===r||"window"===r||(!!this.boundIdentifiers.has(e.value)||!t&&("identifier"===e.kind||"reference"===e.kind)))},s=[{role:"source",strict:!1},{role:"destination",strict:!0}];for(const{role:t,strict:r}of s){if(!n.roles.some(e=>e.role===t))continue;const s=i.roleMarkers?.[t];if(!s)continue;const l=a.get(t);if(l&&("reference"!==l.type||"me"!==l.value))continue;const c=e=>{if(!e||"particle"!==e.kind&&"keyword"!==e.kind)return!1;const n=e.value.toLowerCase();return s.primary?.toLowerCase()===n||!r&&((e.normalized??"").toLowerCase()===t||!!s.alternatives?.some(e=>e.toLowerCase()===n))},u=e.peek(),p=e.peek(1);if(!u||!p)return;if(r&&"after"===s.position){const r=e.peek(2),n=(u.normalized??u.value).toLowerCase();if(dT.has(n)&&"selector"===p.kind&&c(r))return a.set(t,{type:"expression",raw:`${n} ${p.value}`}),e.advance(),e.advance(),void e.advance()}if("after"===s.position){if(o(u,r)&&c(p)){const r=this.tokenToSemanticValue(u);return e.advance(),e.advance(),void(r&&a.set(t,r))}}else if(c(u)&&o(p,r)){e.advance();const r=this.tokenToSemanticValue(e.advance());return void(r&&a.set(t,r))}}}static buildVerbLookup(e){const t=new Map;for(const[r,n]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","end","then","and"].includes(r)&&(t.set(n.primary.toLowerCase(),r),n.alternatives))for(const e of n.alternatives)t.set(e.toLowerCase(),r);return t}static buildMarkerToRoleLookup(e){const t=new Map;for(const[r,n]of Object.entries(e.roleMarkers)){if(!n)continue;if(!("event"!==r)&&t.has(n.primary)||t.set(n.primary,r),n.alternatives)for(const e of n.alternatives)t.has(e)||t.set(e,r)}return t}parseSOVClauseByVerbAnchoring(t,r){const n=wm(r);if(!n||"SOV"!==n.wordOrder)return[];const i=e.buildVerbLookup(n),a=e.buildMarkerToRoleLookup(n),o=[];let s=0;for(;t.length>s;){let e=-1,n="";for(let r=s;t.length>r;r++){const o=t[r];if(a.has(o.value))continue;const s=i.get(o.value.toLowerCase()),l=o.normalized?i.get(o.normalized.toLowerCase()):void 0,c=s||l;if(c){e=r,n=c;break}}if(-1===e)break;const l=t.slice(s,e);let c=t.length;for(let n=e+1;t.length>n;n++){const o=t[n];if("conjunction"===o.kind||this.isThenKeyword(o.value,r)){c=n;break}if(n>e+1&&!a.has(o.value)){if(i.get(o.value.toLowerCase())||(o.normalized?i.get(o.normalized.toLowerCase()):void 0)){c=n;break}}}const u=t.slice(e+1,c),p=this.extractRolesFromMarkedTokens(l,u,a,n,r);if(o.push(AE(n,p,{sourceLanguage:r,confidence:.7})),s=c,t.length>s){const e=t[s];("conjunction"===e.kind||this.isThenKeyword(e.value,r))&&s++}}return o}extractRolesFromMarkedTokens(e,t,r,n,i){const a={},o=e=>{let t=[];for(const i of e){const e=r.get(i.value);if(e&&"particle"===i.kind&&t.length>0){const r=this.tokensToSemanticValue(t);if(r){const t=this.mapRoleForCommand(e,n,a);t&&(a[t]=r)}t=[]}else t.push(i)}if(t.length>0){if(1===t.length&&/^\d+(\.\d+)?(ms|s)$/i.test(t[0].value)&&!a.duration&&Pf(n)?.roles.some(e=>"duration"===e.role))a.duration={type:"literal",value:t[0].value,dataType:"string"};else{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,r){return r[e]?"patient"!==e||r.destination?"destination"!==e||r.patient?"source"!==e||r.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 r=t.map(e=>e.value).join(""),n=t[0];return"selector"===n.kind||n.value.startsWith("#")||n.value.startsWith(".")||n.value.startsWith("@")||n.value.startsWith("*")?xE(r):"literal"===n.kind||n.value.startsWith('"')||n.value.startsWith("'")?EE(gT(r),"string"):"reference"===n.kind?SE(r):EE(r)}tokenToSemanticValue(e){const t=e.value;if("selector"===e.kind||t.startsWith("#")||t.startsWith(".")||t.startsWith("@")||t.startsWith("*"))return xE(t);if(t.startsWith('"')||t.startsWith("'"))return EE(gT(t),"string");if(/^-?\d+(\.\d+)?$/.test(t))return EE(parseFloat(t));if("true"===t||"真"===t||"참"===t||"doğru"===t)return EE(!0);if("false"===t||"偽"===t||"거짓"===t||"yanlış"===t)return EE(!1);const r=e.normalized?.toLowerCase();return"me"===r||"it"===r||"you"===r||"result"===r||"body"===r?SE(r):"reference"===e.kind?SE(e.normalized||"me"):EE(t)}parseBodyWithGrammarPatterns(e,t,r,n){const i=[];let a=[],o=!1;const s=()=>{!o&&a.length>0&&i.push(...this.parseSOVClauseByVerbAnchoring(a,n)),a=[],o=!1};let l=0;const c=()=>{let e=0;for(const t of i){const r=t;"for"!==r.action&&"repeat"!==r.action&&"while"!==r.action||Array.isArray(r.body)&&0!==r.body.length||e++}return e-l};for(;!e.isAtEnd();){const u=e.peek();if(u&&this.isThenKeyword(u.value,n)){s(),e.advance();continue}if(u&&this.isEndKeyword(u.value,n)){const t=e.peek(-1),r=e.peek(1);if(!Mf(n,u.value,t?.value,r?.value)){if(s(),c()>0){l++,e.advance();continue}e.advance();break}}if(u&&!o&&this.isIfKeyword((u.normalized??u.value).toLowerCase(),n)){s();const r=this.tryParseConditionalBlock(e,t,n);if(r){i.push(r),o=!0;continue}}let p=!1;if(r.length>0){const t=$E.matchBest(e,r);if(t){const e=t.pattern.command,r={};for(const[e,n]of t.captured)"event"!==e&&"action"!==e&&"continues"!==e&&(r[e]=n);const a=AE(e,r,{sourceLanguage:n,patternId:t.pattern.id});i.push(a),p=!0,o=!0;const s=t.captured.get("continues");if(s&&"literal"===s.type&&"then"===s.value)continue}}if(!p){const r=e.mark(),a=$E.matchBest(e,t);if(a){if("if"===a.pattern.command){const a=e.mark();for(e.reset(r);!e.isAtEnd();){const t=e.peek();if(!t||this.isIfKeyword((t.normalized??t.value).toLowerCase(),n))break;e.advance()}const l=this.tryParseConditionalBlock(e,t,n);if(l){s(),i.push(l),o=!0;continue}e.reset(a)}const l=this.buildCommand(a,n);i.push(l),this.tryAttachTrailingRole(e,l,n),p=!0,o=!0}}p||(u&&a.push(u),e.advance())}s();for(let e=i.length-1;e>=0;e--){const t=i[e];"command"!==t.kind||"for"!==t.action||t.roles instanceof Map&&0!==t.roles.size||Array.isArray(t.body)&&0!==t.body.length||i.splice(e,1)}return i}tryCompoundCommandParsing(e,t,r){const n=e.tokens,i=n.some(e=>"conjunction"===e.kind||"keyword"===e.kind&&this.isThenKeyword(e.value,r)),a=n.some(e=>this.isElseKeyword(e.value,r));if(!i&&!a)return null;const o=new Cp(n,r),s=this.parseBodyWithClauses(o,t,r);return 0===s.length?null:1===s.length?s[0]:jE(s,"then",{sourceLanguage:r,confidence:.65})}matchEventMarkerPhrase(t,r,n){const i=e.SOV_EVENT_MARKER_PHRASES[n];if(!i)return 0;for(const e of i)if(e.every((e,n)=>t[r+n]?.value===e))return e.length;return 0}hasSOVEventMarkerHead(t,r){const n=e.SOV_EVENT_MARKERS[r];if(void 0===n)return!1;const{tokens:i}=VE(t,r),a=Zw[r],o=new Set;if(a)for(const e of Object.keys(a))o.add(e.toLowerCase());for(let t=0;i.length>t;t++){const a=i[t],s=a.value.toLowerCase(),l=a.normalized?.toLowerCase();if(!(!!l&&(e.KNOWN_EVENTS.has(l)||fT.has(l))||e.KNOWN_EVENTS.has(s)||fT.has(s)||o.has(s)))continue;const c=this.matchEventParamPhrase(i,t+1).len,u=i[t+1+c];if(u&&("particle"===u.kind||"keyword"===u.kind)&&n.has(u.value))return!0;if(this.matchEventMarkerPhrase(i,t+1+c,r)>0)return!0}return!1}matchEventParamPhrase(e,t){if("("!==e[t]?.value)return{len:0,names:[]};const r=[];for(let n=t+1;e.length>n;n++){const i=e[n].value;if(")"===i)return{len:n-t+1,names:r};if(","!==i){if("identifier"!==e[n].kind)break;r.push(i)}}return{len:0,names:[]}}isStrippableSourceRef(e,t){if(!e)return!1;const r=e.normalized?.toLowerCase();if("keyword"===e.kind&&("me"===r||"i"===r||"it"===r))return!0;const n=e.value.toLowerCase();return t.has(n)||!!r&&t.has(r)}tryTrailingEventExtraction(t,r,n){const i=VE(t,r).tokens;if(3>i.length)return null;const a=Zw[r],o=new Set;if(a)for(const e of Object.keys(a))o.add(e.toLowerCase());const s=i.length-2,l=i[s];if(!("keyword"===l.kind&&"on"===l.normalized?.toLowerCase()))return null;const c=i[i.length-1],u=c.value.toLowerCase(),p=c.normalized?.toLowerCase();if(!(!!p&&e.KNOWN_EVENTS.has(p)||e.KNOWN_EVENTS.has(u)||o.has(u)))return null;const m=p&&e.KNOWN_EVENTS.has(p)?p:a?.[u]??u,d=i.slice(0,s);if(0===d.length)return null;const f=n.filter(e=>"on"!==e.command),h=new Cp(d,r),y=this.parseBodyWithClauses(h,f,r);return 0===y.length?null:LE({type:"literal",value:m},y,void 0,{sourceLanguage:r,confidence:.75})}tryMidStreamEventExtraction(t,r,n){const i=VE(t,r).tokens;if(3>i.length)return null;const a=Zw[r],o=new Set;if(a)for(const e of Object.keys(a))o.add(e.toLowerCase());for(let t=0;i.length-1>t;t++){const s=i[t];if(!("keyword"===s.kind&&"on"===s.normalized?.toLowerCase()))continue;const l=i[t+1],c=l.value.toLowerCase(),u=l.normalized?.toLowerCase();if(!(!!u&&e.KNOWN_EVENTS.has(u)||e.KNOWN_EVENTS.has(c)||o.has(c)))continue;const p=u&&e.KNOWN_EVENTS.has(u)?u:a?.[c]??c,m=i.filter((e,r)=>r!==t&&r!==t+1);if(0===m.length)return null;const d=n.filter(e=>"on"!==e.command),f=new Cp(m,r),h=this.parseBodyWithClauses(f,d,r);return 0===h.length?null:LE({type:"literal",value:p},h,void 0,{sourceLanguage:r,confidence:.75})}return null}trySOVEventExtraction(t,r,n){const i=e.SOV_EVENT_MARKERS[r];if(!i)return null;const a=VE(t,r).tokens,o=Zw[r],s=new Set;if(o)for(const e of Object.keys(o))s.add(e.toLowerCase());const l=e.SOV_SOURCE_MARKERS[r];let c=-1,u="",p="",m=1,d=[];for(let t=0;a.length>t;t++){const n=a[t],l=n.value.toLowerCase();let f=l,h="";const y=l.indexOf("[");y>0&&(f=l.slice(0,y),h=n.value.slice(y));const v=n.normalized?.toLowerCase(),g=v&&(e.KNOWN_EVENTS.has(v)||fT.has(v)),k=s.has(l)||s.has(f),b=e.KNOWN_EVENTS.has(f)||fT.has(f);if(g||k||b){const e=a[t-1];if(e&&"event"===(e.normalized??e.value).toLowerCase())continue;let n;n=g?v:k?o?.[l]??o?.[f]??f:f;const s=this.matchEventParamPhrase(a,t+1);if(0>=i.size){c=t,u=n,p=h,m=1+s.len+this.matchEventMarkerPhrase(a,t+1+s.len,r),d=s.names;break}{let e=1+s.len;const r=a[t+e];r&&"selector"===r.kind&&r.value.startsWith("[")&&(e+=1);const o=a[t+e];if(o&&("particle"===o.kind||"keyword"===o.kind)&&i.has(o.value)){c=t,u=n,p=h||(e===s.len+2?a[t+e-1].value:""),m=e+1,d=s.names;break}}}}if(-1===c){const e=new Set(n.filter(e=>"on"!==e.command).map(e=>e.command));for(let t=0;a.length>t;t++){const n=a[t];if("identifier"===n.kind)if(i.size>0){let e=1;const r=a[t+1];r&&"selector"===r.kind&&r.value.startsWith("[")&&(e=2);const o=a[t+e];if(o&&("particle"===o.kind||"keyword"===o.kind)&&i.has(o.value)){c=t,u=n.value,p=2===e?a[t+1].value:"",m=e+1;break}}else{const i=this.matchEventMarkerPhrase(a,t+1,r);if(i>0){c=t,u=n.value,p="",m=1+i;break}const o=a[t+1];if(o&&"keyword"===o.kind&&null!=o.normalized&&e.has(o.normalized)){c=t,u=n.value,p="",m=1;break}}}}if(-1===c)return null;const f=new Set;for(let e=c;c+m>e;e++)f.add(e);if(l){const e=c+m;if(a.length>e){const t=a[e];if("particle"!==t.kind&&"keyword"!==t.kind||!l.markers.has(t.value)){if(this.isStrippableSourceRef(t,l.windowTokens)){const t=a[e+1];t&&("particle"===t.kind||"keyword"===t.kind)&&l.markers.has(t.value)&&(f.add(e),f.add(e+1))}}else f.add(e)}if(c>=2){const e=a[c-1];("particle"===e.kind||"keyword"===e.kind)&&l.markers.has(e.value)&&this.isStrippableSourceRef(a[c-2],l.windowTokens)&&(f.add(c-2),f.add(c-1))}for(let e=0;c>e;e++){const t=a[e],r=t.value.toLowerCase(),n=t.normalized?.toLowerCase();if(l.windowTokens.has(r)||n&&l.windowTokens.has(n)){f.add(e);break}}}const h=a.filter((e,t)=>!f.has(t));if(0===h.length)return null;const y=n.filter(e=>"on"!==e.command),v=new Cp(h,r),g=this.parseBodyWithClauses(v,y,r);if(0===g.length)return null;const k={sourceLanguage:r,confidence:.75};return p&&(k.keyFilter=p),LE({type:"literal",value:u},g,void 0,k,d)}profileKeywordMatches(e,t,r){const n=wm(e)?.keywords?.[t];return!!n&&(n.primary?.toLowerCase()===r||!!n.alternatives?.some(e=>e.toLowerCase()===r))}consumeForPostposition(e,t){const r=e.peek();if(!r)return;const n=(r.normalized??"").toLowerCase(),i=wm(t)?.keywords?.for;("for"===n||r.value===i?.primary||(i?.alternatives??[]).includes(r.value))&&e.advance()}isThenKeyword(e,t){const r=e.toLowerCase(),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(["ardından","daha sonra","ardindan"]),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"])}[t];return n?n.has(r):"then"===r||this.profileKeywordMatches(t,"then",r)}isElseKeyword(e,t){const r=e.toLowerCase();return"else"===r||this.profileKeywordMatches(t,"else",r)}isEndKeyword(e,t){const r=e.toLowerCase(),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","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"])}[t];return n?"end"===r||n.has(r):"end"===r||this.profileKeywordMatches(t,"end",r)}isJsKeyword(e){const t=(e.normalized??e.value).toLowerCase();return"js"===t||this.profileKeywordMatches("en","js",t)}consumeJsBlock(e,t){const r=e.peek();if(!r||!this.isJsKeyword(r))return null;const n=e.mark(),i=[];e.advance();let a=!1;for(;!e.isAtEnd();){const r=e.peek();if(!r)break;if(e.advance(),this.isEndKeyword(r.value,t)){a=!0;break}i.push(r)}if(!a)return e.reset(n),null;return AE("js",{patient:{type:"expression",raw:i.map(e=>e.value).join(" ").trim()||"()"}},{sourceLanguage:t,patternId:"js-opaque-"+t,confidence:1})}isIfKeyword(e,t){const r=e.toLowerCase();return"if"===r||this.profileKeywordMatches(t,"if",r)}isUnlessKeyword(e,t){const r=e.toLowerCase();return"unless"===r||this.profileKeywordMatches(t,"unless",r)}isBlockEndToken(e,t,r){return!!this.isEndKeyword(e.value,r)||"keyword"===e.kind&&"end"===(e.normalized??"").toLowerCase()&&!(t&&"selector"===t.kind)}tryParseConditionalBlock(t,r,n){const i=t.peek();if(!i)return null;const a=(i.normalized??i.value).toLowerCase();if(!this.isIfKeyword(a,n))return null;const o=t.mark();t.advance();const s=[];let l=0;for(;!t.isAtEnd();){const e=t.peek();if(!e)break;const r=(e.normalized??e.value).toLowerCase();if(this.isIfKeyword(r,n)||this.isUnlessKeyword(r,n))l++,s.push(e),t.advance();else if(this.isBlockEndToken(e,t.peek(1)??void 0,n)){if(0===l){t.advance();break}l--,s.push(e),t.advance()}else s.push(e),t.advance()}if(0===s.length)return t.reset(o),null;const c=wm(n),u="SOV"===c?.wordOrder?e.buildVerbLookup(c):null;let p=0,m=0;const d=[];for(;s.length>p;p++){const t=s[p],i=(t.normalized??t.value).toLowerCase();if(this.isIfKeyword(i,n)||this.isUnlessKeyword(i,n)?m++:this.isBlockEndToken(t,s[p+1],n)&&m--,0===m&&this.isThenKeyword(t.value,n)){p++;break}if(0===m&&d.length>0){const i=(s[p-1].normalized??s[p-1].value).toLowerCase(),a=s[p-1].value.toLowerCase(),o=(t.normalized??t.value).toLowerCase(),l=e.CONDITION_COPULAS.has(i)||e.CONDITION_COPULAS_SURFACE.has(a)&&e.CONDITION_PREDICATES.has(o),c=null!==u&&u.has(t.value.toLowerCase())&&!e.CONDITION_PREDICATES.has(o);if(!e.CONDITION_OPERATORS.has(o)&&(!l||c)&&(this.tokensBeginCommand(s.slice(p),r,n)||this.sovCommandStartsAt(s.slice(p),u)))break}d.push(t)}if(0===d.length)return t.reset(o),null;const f=[],h=[];let y=!1,v=0;for(;s.length>p;p++){const e=s[p],t=(e.normalized??e.value).toLowerCase();this.isIfKeyword(t,n)||this.isUnlessKeyword(t,n)?v++:this.isBlockEndToken(e,s[p+1],n)&&v--,0!==v||y||!this.isElseKeyword(e.value,n)?(y?h:f).push(e):y=!0}const g={type:"expression",raw:this.joinTokenText(d)},k=this.parseBranch(f,r,n),b=h.length>0?this.parseBranch(h,r,n):void 0;return 0!==k.length||b&&0!==b.length?PE(g,k,b,{sourceLanguage:n,patternId:`conditional-${n}-folded`,confidence:1}):(t.reset(o),null)}joinTokenText(e){return e.map(e=>"keyword"===e.kind?e.normalized??e.value:e.value).join(" ").trim()}tokensBeginCommand(e,t,r){if(0===e.length)return!1;const n=new Cp(e,r);return null!==$E.matchBest(n,t)}sovCommandStartsAt(e,t){if(!t)return!1;const r=e=>t.has(e.value.toLowerCase())||!!e.normalized&&t.has(e.normalized.toLowerCase()),n=e=>"identifier"===e.kind||"selector"===e.kind||"literal"===e.kind||"reference"===e.kind;let i=0,a=0;for(;e.length>i+1;){const t=e[i+1];if(!n(e[i])||"particle"!==t.kind)break;a+=1,i+=2;const o=e[i];if(a>=1&&o&&r(o))return!0}return!1}parseBranch(e,t,r){if(0===e.length)return[];const n=new Cp(e,r),i=this.parseBodyWithClauses(n,t,r);return 1===i.length&&"compound"===i[0]?.kind?i[0].statements:i}extractStandaloneModifiers(t,r){const n=VE(t,r).tokens;if(0===n.length)return{modifiers:null,remainingInput:null};const i=n[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=!0;else{let e=1;if(n.length>e){const t=n[e];"keyword"!==t.kind&&"particle"!==t.kind||(e++,s++)}if(n.length>e){const t=n[e];if("literal"===t.kind){const r=t.value.match(/^(\d+)(ms|s|m)?$/);if(r){let t=parseInt(r[1],10);const n=r[2]||"ms";"s"===n?t*=1e3:"m"===n&&(t*=6e4),o[a]=t,s=e+1}}}o[a]||(o[a]="debounce"===a?300:100)}const l=n.slice(s);if(0===l.length)return{modifiers:null,remainingInput:null};return{modifiers:o,remainingInput:t.slice(l[0].position.start)}}stripAsyncModifier(e,t){const r=wm(t)?.keywords?.async,n=new Set(["async"]);r?.primary&&n.add(r.primary.toLowerCase()),r?.alternatives?.forEach(e=>n.add(e.toLowerCase()));const i=VE(e,t).tokens,a=i.findIndex(e=>n.has(e.value.toLowerCase()));if(-1===a)return{remainingInput:null};const o=i[a],s=(e.slice(0,o.position.start)+e.slice(o.position.end)).replace(/\s{2,}/g," ").trim();return 0===s.length?{remainingInput:null}:{remainingInput:s}}stripDoNotThrowModifier(e,t){const r=VE(e,t).tokens;for(let t=0;r.length-1>t;t++){if("do"!==r[t].value.toLowerCase())continue;let n=-1;for(let e=t+1;t+5>=e&&r.length>e;e++){const t=r[e];if("throw"===t.normalized?.toLowerCase()){n=e;break}const i=t.kind;if("selector"===i||"literal"===i||"reference"===i||"conjunction"===i)break}if(-1===n)continue;const i=r[n].position.end,a=(e.slice(0,r[t].position.start)+e.slice(i)).replace(/\s{2,}/g," ").trim();return 0===a.length?{remainingInput:null}:{remainingInput:a}}return{remainingInput:null}}applyModifiers(e,t){return{...e,eventModifiers:{...e.eventModifiers,...t}}}extractOrConjunctionEvents(t,r){const n=[];for(;;){const r=t.mark(),i=t.peek();if(!i)break;const a=(i.normalized||i.value).toLowerCase();if(!e.OR_KEYWORDS.has(a)){t.reset(r);break}t.advance();const o=t.peek();if(!o){t.reset(r);break}const s=(o.normalized||o.value).toLowerCase();t.advance(),n.push({type:"literal",value:s})}return n}};wT.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]),wT.RESPONSE_TYPE_WORDS=new Set(["json","text","html","xml","blob","arraybuffer","formdata","response"]),wT.SOV_EVENT_MARKERS={ja:new Set(["で"]),ko:new Set,tr:new Set(["de","da","te","ta"]),bn:new Set(["এ"]),qu:new Set(["pi"]),hi:new Set(["पर"])},wT.SOV_EVENT_MARKER_PHRASES={ko:[["할","때"],["할때"]]},wT.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"])},hi:{markers:new Set(["से"]),windowTokens:new Set(["विंडो","दस्तावेज़","window","document"])}},wT.CONDITION_COPULAS=new Set(["is","am","are","be","was","were","not","no"]),wT.CONDITION_COPULAS_SURFACE=new Set(["est","есть","є","é","ay","هو","adalah","เป็น","হয়","है","dir","kanqa"]),wT.CONDITION_PREDICATES=new Set(["empty","null","undefined"]),wT.CONDITION_OPERATORS=new Set(["matches","match","contains","exists","has","have","equals","includes"]),wT.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"},wT.OR_KEYWORDS=new Set(["or","أو","o","ou","oder","atau","atau","或","または","또는","veya","অথবা","utaq","au","або","или","hoặc","lub","או","หรือ","o","या","অথবা"]);var zT=wT,xT=new zT;function ET(e,t){return xT.parse(e,t)}function TT(e,t){try{const r=VE(e,t),n=Tm(t);if(0===n.length)return{confidence:0,parseSuccess:!1,error:"No patterns available for language: "+t};const i=[...n].sort((e,t)=>t.priority-e.priority),a=i.filter(e=>"on"===e.command),o=$E.matchBest(r,a);if(o)return{confidence:o.confidence,parseSuccess:!0,patternId:o.pattern.id,action:o.pattern.command,tokensConsumed:o.consumedTokens};r.reset(r.mark());const s=i.filter(e=>"on"!==e.command),l=$E.matchBest(r,s);return l?{confidence:l.confidence,parseSuccess:!0,patternId:l.pattern.id,action:l.pattern.command,tokensConsumed:l.consumedTokens}:{confidence:0,parseSuccess:!1,error:"Could not match any patterns for: "+e}}catch(e){return{confidence:0,parseSuccess:!1,error:e instanceof Error?e.message:e+""}}}function ST(e,t){try{const r=ET(e,t);if(r)return{node:r,confidence:r.metadata?.confidence??.8,error:void 0,tokensConsumed:VE(e,t).tokens.length}}catch{}const r=TT(e,t);return r.parseSuccess?{node:null,confidence:r.confidence,error:void 0,tokensConsumed:r.tokensConsumed}:{node:null,confidence:0,error:r.error}}function CT(e,t){return sT(uT(e),t)}function AT(e,t){return Wc(e)?uT(e):ET(e,t)}function LT(e,t){if(e.type!==t.type)return!1;switch(e.type){case"literal":case"selector":case"reference":return e.value===t.value;case"property-path":return LT(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!1}}Cm();var jT=class{constructor(e={}){this.cache=new Map,this.config={maxSize:e.maxSize??1e3,ttlMs:e.ttlMs??0,enabled:e.enabled??!0},this.stats={hits:0,misses:0,evictions:0,expirations:0}}makeKey(e,t){return`${t}:${e}`}isExpired(e){return 0!==this.config.ttlMs&&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 r=this.makeKey(e,t),n=this.cache.get(r);if(n)return this.isExpired(n)?(this.cache.delete(r),this.stats.expirations++,void this.stats.misses++):(this.cache.delete(r),n.lastAccessed=Date.now(),this.cache.set(r,n),this.stats.hits++,n.result);this.stats.misses++}set(e,t,r){if(!this.config.enabled)return;if(null!==r&&"object"==typeof r&&"confidence"in r&&0===r.confidence)return;const n=this.makeKey(e,t),i=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(n,{result:r,createdAt:i,lastAccessed:i})}has(e,t){if(!this.config.enabled)return!1;const r=this.makeKey(e,t),n=this.cache.get(r);return!!n&&(!this.isExpired(n)||(this.cache.delete(r),this.stats.expirations++,!1))}delete(e,t){const r=this.makeKey(e,t);return this.cache.delete(r)}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=!0}disable(){this.config.enabled=!1}getConfig(){return{...this.config}}},PT=new jT;ag(),jm(),vm("ar",Jv,Sm),Pw(),Nm(),vm("bn",Tw,Lm),Vk(),Mm(),vm("de",Ik,Om),gv(),qm(),sx(),vm("en",mv,Rm),gm("en",ox()),bg(),Dm(),vm("es",hg,_m),Sk(),Fm(),vm("fr",gk,Vm),uw(),Gm(),vm("he",aw,Hm),bw(),Jm(),vm("hi",hw,Um),Fk(),ed(),vm("id",$k,Zm),Sb(),nd(),vm("it",bb,Qm),Ov(),od(),vm("ja",Sv,rd),Fv(),cd(),vm("ko",Wv,ad),Bw(),md(),vm("ms",Rw,ld),qb(),hd(),vm("pl",Nb,pd),uk(),gd(),vm("pt",tk,fd),ib(),wd(),vm("qu",Jk,vd),Yb(),Ed(),vm("ru",Hb,bd),mb(),Cd(),vm("sw",nb,xd),Mw(),jd(),vm("th",jw,Sd),Qw(),Nd(),vm("tl",Uw,Ld),Wg(),Md(),vm("tr",jg,Od),ow(),qd(),vm("uk",Qb,Rd),Ib(),Dd(),vm("vi",Tb,_d),Fg(),Ud(),vm("zh",Mg,Vd),Cm();var OT={en:async()=>{const{englishTokenizer:e}=await Promise.resolve().then(()=>(gv(),fv)),{englishProfile:t}=await Promise.resolve().then(()=>(qm(),Wm)),{buildEnglishPatterns:r}=await Promise.resolve().then(()=>(sx(),ax));return{tokenizer:e,profile:t,buildPatterns:r}},es:async()=>{const{spanishTokenizer:e}=await Promise.resolve().then(()=>(bg(),vg)),{spanishProfile:t}=await Promise.resolve().then(()=>(Dm(),$m));return{tokenizer:e,profile:t}},ja:async()=>{const{japaneseTokenizer:e}=await Promise.resolve().then(()=>(Ov(),Av)),{japaneseProfile:t}=await Promise.resolve().then(()=>(od(),id));return{tokenizer:e,profile:t}},ar:async()=>{const{arabicTokenizer:e}=await Promise.resolve().then(()=>(ag(),Qv)),{arabicProfile:t}=await Promise.resolve().then(()=>(jm(),Am));return{tokenizer:e,profile:t}},ko:async()=>{const{koreanTokenizer:e}=await Promise.resolve().then(()=>(Fv(),qv)),{koreanProfile:t}=await Promise.resolve().then(()=>(cd(),sd));return{tokenizer:e,profile:t}},zh:async()=>{const{chineseTokenizer:e}=await Promise.resolve().then(()=>(Fg(),_g)),{chineseProfile:t}=await Promise.resolve().then(()=>(Ud(),Bd));return{tokenizer:e,profile:t}},tr:async()=>{const{turkishTokenizer:e}=await Promise.resolve().then(()=>(Wg(),Og)),{turkishProfile:t}=await Promise.resolve().then(()=>(Md(),Id));return{tokenizer:e,profile:t}},pt:async()=>{const{portugueseTokenizer:e}=await Promise.resolve().then(()=>(uk(),nk)),{portugueseProfile:t}=await Promise.resolve().then(()=>(gd(),yd));return{tokenizer:e,profile:t}},fr:async()=>{const{frenchTokenizer:e}=await Promise.resolve().then(()=>(Sk(),bk)),{frenchProfile:t}=await Promise.resolve().then(()=>(Fm(),Bm));return{tokenizer:e,profile:t}},de:async()=>{const{germanTokenizer:e}=await Promise.resolve().then(()=>(Vk(),Mk)),{germanProfile:t}=await Promise.resolve().then(()=>(Mm(),Im));return{tokenizer:e,profile:t}},id:async()=>{const{indonesianTokenizer:e}=await Promise.resolve().then(()=>(Fk(),Dk)),{indonesianProfile:t}=await Promise.resolve().then(()=>(ed(),Xm));return{tokenizer:e,profile:t}},qu:async()=>{const{quechuaTokenizer:e}=await Promise.resolve().then(()=>(ib(),Qk)),{quechuaProfile:t}=await Promise.resolve().then(()=>(wd(),kd));return{tokenizer:e,profile:t}},sw:async()=>{const{swahiliTokenizer:e}=await Promise.resolve().then(()=>(mb(),ab)),{swahiliProfile:t}=await Promise.resolve().then(()=>(Cd(),Td));return{tokenizer:e,profile:t}},bn:async()=>{const{bengaliTokenizer:e}=await Promise.resolve().then(()=>(Pw(),Cw)),{bengaliProfile:t}=await Promise.resolve().then(()=>(Nm(),Pm));return{tokenizer:e,profile:t}},hi:async()=>{const{hindiTokenizer:e}=await Promise.resolve().then(()=>(bw(),vw)),{hindiProfile:t}=await Promise.resolve().then(()=>(Jm(),Ym));return{tokenizer:e,profile:t}},it:async()=>{const{italianTokenizer:e}=await Promise.resolve().then(()=>(Sb(),zb)),{italianProfile:t}=await Promise.resolve().then(()=>(nd(),td));return{tokenizer:e,profile:t}},ms:async()=>{const{malayTokenizer:e}=await Promise.resolve().then(()=>(Bw(),Ww)),{malayProfile:t}=await Promise.resolve().then(()=>(md(),ud));return{tokenizer:e,profile:t}},pl:async()=>{const{polishTokenizer:e}=await Promise.resolve().then(()=>(qb(),Mb)),{polishProfile:t}=await Promise.resolve().then(()=>(hd(),dd));return{tokenizer:e,profile:t}},ru:async()=>{const{russianTokenizer:e}=await Promise.resolve().then(()=>(Yb(),Kb)),{russianProfile:t}=await Promise.resolve().then(()=>(Ed(),zd));return{tokenizer:e,profile:t}},th:async()=>{const{thaiTokenizer:e}=await Promise.resolve().then(()=>(Mw(),Ow)),{thaiProfile:t}=await Promise.resolve().then(()=>(jd(),Ad));return{tokenizer:e,profile:t}},tl:async()=>{const{tagalogTokenizer:e}=await Promise.resolve().then(()=>(Qw(),Yw)),{tagalogProfile:t}=await Promise.resolve().then(()=>(Nd(),Pd));return{tokenizer:e,profile:t}},uk:async()=>{const{ukrainianTokenizer:e}=await Promise.resolve().then(()=>(ow(),tw)),{ukrainianProfile:t}=await Promise.resolve().then(()=>(qd(),Wd));return{tokenizer:e,profile:t}},vi:async()=>{const{vietnameseTokenizer:e}=await Promise.resolve().then(()=>(Ib(),Cb)),{vietnameseProfile:t}=await Promise.resolve().then(()=>(Dd(),$d));return{tokenizer:e,profile:t}},he:async()=>{const{hebrewTokenizer:e}=await Promise.resolve().then(()=>(uw(),sw)),{hebrewProfile:t}=await Promise.resolve().then(()=>(Gm(),Km));return{tokenizer:e,profile:t}}},NT=Object.keys(OT);async function IT(e,t={}){const{url:r,module:n,skipIfRegistered:i=!0}=t;if(i&&xm(e))return{code:e,loaded:!1};try{let t;if(n)t=n;else if(r)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 r=await e.text(),n=new Blob([r],{type:"application/javascript"}),i=URL.createObjectURL(n);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(r){throw Error(`Failed to load language '${e}' from ${t}: ${r instanceof Error?r.message:r+""}`)}}(e,r);else{const r=OT[e];if(!r)throw Error(`Unknown language: ${e}. Supported: ${NT.join(", ")}`);t=await r()}return function(e,t){vm(e,t.tokenizer,t.profile),t.patterns?gm(e,t.patterns):t.buildPatterns&&gm(e,t.buildPatterns())}(e,t),{code:e,loaded:!0}}catch(t){return{code:e,loaded:!1,error:t instanceof Error?t.message:t+""}}}function RT(e){return e.map(e=>e.extraction?.scope?e:{...e,template:{...e.template,tokens:[...e.template.tokens,{type:"group",optional:!0,tokens:[{type:"literal",value:"on"},{type:"role",role:"scope",optional:!0,expectedTypes:["selector","reference"]}]}]},extraction:{...e.extraction,scope:{marker:"on"}}})}function MT(e,t,r,n,i,a,o,s){return{id:e,language:t,command:"fetch",priority:105,template:{format:`${r} ${n} {source} ${i} {responseType}`,tokens:[{type:"literal",value:r,...a?{alternatives:a}:{}},{type:"group",optional:!0,tokens:[{type:"literal",value:n,...o?{alternatives:o}:{}}]},{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"group",optional:!0,tokens:[{type:"literal",value:i,...s?{alternatives:s}:{}},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]}]},extraction:{source:{marker:n,...o?{markerAlternatives:o}:{}},responseType:{marker:i,...s?{markerAlternatives:s}:{}}}}}function WT(e,t,r,n,i,a){return{id:e,language:t,command:"fetch",priority:105,template:{format:`{source} ${n} ${r}`,tokens:[{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"group",optional:!0,tokens:[{type:"literal",value:n,...a?{alternatives:a}:{}}]},{type:"literal",value:r,...i?{alternatives:i}:{}}]},extraction:{source:{marker:n,...a?{markerAlternatives:a}:{}}}}}Iz(),Df(),nz(),ix(),Dz();var _T=[...[{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-element",language:"en",command:"swap",priority:120,template:{format:"swap {destination} with {patient}",tokens:[{type:"literal",value:"swap"},{type:"role",role:"destination"},{type:"literal",value:"with"},{type:"role",role:"patient"}]},extraction:{}},{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"}}},{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}}}]];zz(),Cm();var qT=[xz,function(e){return[]},_f,rz,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:!0,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"},{type:"role",role:"patient"},{type:"group",optional:!0,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"},{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-patient-first",language:"qu",command:"add",priority:96,template:{format:"{patient} ta {destination} man yapay",tokens:[{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"role",role:"destination"},{type:"literal",value:"man"},{type:"literal",value:"yapay",alternatives:["yapaykuy"]}]},extraction:{patient:{position:0},destination:{position:2}}},{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:!0,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":default:return[];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:!0,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:!0,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:["加到","增加到"]}}}]}},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 {source}",tokens:[{type:"literal",value:"rimuovere",alternatives:["rimuovi","eliminare","togliere","remove"]},{type:"role",role:"patient"},{type:"group",optional:!0,tokens:[{type:"literal",value:"da",alternatives:["di"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{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},source:{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:!0,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-patient-first",language:"qu",command:"remove",priority:96,template:{format:"{patient} ta {source} manta qichuy",tokens:[{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"role",role:"source"},{type:"literal",value:"manta"},{type:"literal",value:"qichuy",alternatives:["hurquy","anchuchiy"]}]},extraction:{patient:{position:0},source:{position:2}}},{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:!0,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:!0,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:!0,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:!0,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:!0,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:!0,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:!0,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:!0,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:!0,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:!0,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:!0,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:!0,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:!0,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 RT([{id:"set-bn-full",language:"bn",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:"literal",value:"সেট",alternatives:["নির্ধারণ"]},{type:"literal",value:"করুন"}]},extraction:{destination:{position:0},patient:{marker:"এ",position:2}}},{id:"set-bn-simple",language:"bn",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"de":return RT([{id:"set-de-full",language:"de",command:"set",priority:100,template:{format:"setze {destination} auf {patient}",tokens:[{type:"literal",value:"setze",alternatives:["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"]},{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 RT([{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 RT([{id:"set-fr-full",language:"fr",command:"set",priority:100,template:{format:"définir {destination} à {patient}",tokens:[{type:"literal",value:"définir",alternatives:["definir","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"he":return RT([{id:"set-he-full",language:"he",command:"set",priority:100,template:{format:"קבע את {destination} על {patient}",tokens:[{type:"literal",value:"קבע",alternatives:["הגדר"]},{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","selector"]}]},extraction:{destination:{marker:"את"},patient:{marker:"על",markerAlternatives:["ב","אל","ל","כ"]}}}]);case"hi":return RT([{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:!0,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 RT([{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"ms":return RT([{id:"set-ms-full",language:"ms",command:"set",priority:100,template:{format:"tetapkan {destination} ke {patient}",tokens:[{type:"literal",value:"tetapkan",alternatives:["setkan","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"ke",alternatives:["kepada","menjadi","jadi"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{position:3}}}]);case"it":return RT([{id:"set-it-full",language:"it",command:"set",priority:100,template:{format:"impostare {destination} a {patient}",tokens:[{type:"literal",value:"impostare",alternatives:["imposta","set","definire"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"a",alternatives:["su","come","in"]},{type:"role",role:"patient"}]}]},extraction:{destination:{position:1},patient:{marker:"a",markerAlternatives:["su","come","in"]}}},{id:"set-it-simple",language:"it",command:"set",priority:90,template:{format:"impostare {destination}",tokens:[{type:"literal",value:"impostare",alternatives:["imposta","set"]},{type:"role",role:"destination"}]},extraction:{destination:{position:1}}}]);case"pl":return RT([{id:"set-pl-full",language:"pl",command:"set",priority:100,template:{format:"ustaw {destination} na {patient}",tokens:[{type:"literal",value:"ustaw",alternatives:["określ","okresl","przypisz"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"na",alternatives:["do","jako"]},{type:"role",role:"patient"}]}]},extraction:{destination:{position:1},patient:{marker:"na",markerAlternatives:["do","jako"]}}},{id:"set-pl-simple",language:"pl",command:"set",priority:90,template:{format:"ustaw {destination}",tokens:[{type:"literal",value:"ustaw",alternatives:["określ","okresl"]},{type:"role",role:"destination"}]},extraction:{destination:{position:1}}}]);case"pt":return RT([{id:"set-pt-full",language:"pt",command:"set",priority:100,template:{format:"definir {destination} para {patient}",tokens:[{type:"literal",value:"definir",alternatives:["estabelecer","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"]},{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 RT([{id:"set-ru-full",language:"ru",command:"set",priority:100,template:{format:"установить {destination} в {patient}",tokens:[{type:"literal",value:"установить",alternatives:["установи","задать","задай"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"в",alternatives:["на","как"]},{type:"role",role:"patient"}]}]},extraction:{destination:{position:1},patient:{marker:"в",markerAlternatives:["на","как"]}}},{id:"set-ru-simple",language:"ru",command:"set",priority:90,template:{format:"установить {destination}",tokens:[{type:"literal",value:"установить",alternatives:["установи","задать","задай"]},{type:"role",role:"destination"}]},extraction:{destination:{position:1}}}]);case"sw":return RT([{id:"set-sw-kwa",language:"sw",command:"set",priority:100,template:{format:"seti {destination} kwa {patient}",tokens:[{type:"literal",value:"seti",alternatives:["weka thamani"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"kwa",alternatives:["kwenye"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference","selector"]}]},extraction:{destination:{position:1},patient:{marker:"kwa",markerAlternatives:["kwenye"]}}}]);case"th":return RT([{id:"set-th-simple",language:"th",command:"set",priority:100,template:{format:"ตั้ง {destination} ใน {patient}",tokens:[{type:"literal",value:"ตั้ง",alternatives:["กำหนด","ตั้งค่า"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"ใน",alternatives:["เป็น"]},{type:"role",role:"patient"}]}]},extraction:{destination:{position:1},patient:{marker:"ใน",markerAlternatives:["เป็น"]}}}]);case"uk":return RT([{id:"set-uk-full",language:"uk",command:"set",priority:100,template:{format:"встановити {destination} в {patient}",tokens:[{type:"literal",value:"встановити",alternatives:["встанови","задати","задай"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"в",alternatives:["на","як"]},{type:"role",role:"patient"}]}]},extraction:{destination:{position:1},patient:{marker:"в",markerAlternatives:["на","як"]}}},{id:"set-uk-simple",language:"uk",command:"set",priority:90,template:{format:"встановити {destination}",tokens:[{type:"literal",value:"встановити",alternatives:["встанови","задати","задай"]},{type:"role",role:"destination"}]},extraction:{destination:{position:1}}}]);case"vi":return RT([{id:"set-vi-vao",language:"vi",command:"set",priority:101,template:{format:"gán {destination} vào {patient}",tokens:[{type:"literal",value:"gán",alternatives:["thiết lập","đặt giá trị"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"vào",alternatives:["cho","đến"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference","selector"]}]},extraction:{destination:{position:1},patient:{marker:"vào",markerAlternatives:["cho","đến"]}}},{id:"set-vi-full",language:"vi",command:"set",priority:100,template:{format:"gán {destination} thành {patient}",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 {destination} là {patient}",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 RT([{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:"group",optional:!0,tokens:[{type:"literal",value:"到",alternatives:["为","為","成"]}]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{marker:"到",markerAlternatives:["为","為","成"]}}},{id:"set-zh-vba",language:"zh",command:"set",priority:96,template:{format:"设置 把 {destination} 到 {patient}",tokens:[{type:"literal",value:"设置",alternatives:["設置","设定","設定"]},{type:"literal",value:"把"},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"到",alternatives:["为","為","成"]}]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:2},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"zh":return[{id:"get-zh-ba",language:"zh",command:"get",priority:105,template:{format:"获取 把 {source}",tokens:[{type:"literal",value:"获取",alternatives:["获得","取得"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"把",alternatives:["从","由"]}]},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]}]},extraction:{source:{marker:"把",markerAlternatives:["从","由"]}}}];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:!0,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:!0,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:!0,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:!0,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:!0,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:!0,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 function(){const e=["erhoehe","erhöhen","inkrementiere","inkrementieren","increment"];return[{id:"increment-de-with-quantity",language:"de",command:"increment",priority:105,template:{format:"erhöhe {patient} um {quantity}",tokens:[{type:"literal",value:"erhöhe",alternatives:e},{type:"role",role:"patient",expectedTypes:["selector","reference","expression"]},{type:"literal",value:"um"},{type:"role",role:"quantity"}]},extraction:{patient:{position:1},quantity:{marker:"um",position:3}}},{id:"increment-de-full",language:"de",command:"increment",priority:100,template:{format:"erhöhe {patient}",tokens:[{type:"literal",value:"erhöhe",alternatives:e},{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:!0,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:!0,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:!0,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:!0,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"qu":return[{id:"increment-qu-sov",language:"qu",command:"increment",priority:100,template:{format:"{patient} ta yapachiy",tokens:[{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"yapachiy"}]},extraction:{patient:{position:0},quantity:{default:{type:"literal",value:1}}}},{id:"increment-qu-simple",language:"qu",command:"increment",priority:90,template:{format:"yapachiy {patient}",tokens:[{type:"literal",value:"yapachiy"},{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:!0,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:!0,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:!0,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:!0,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:!0,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:!0,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[]}},Bz,function(e){switch(e){case"zh":return[{id:"fetch-zh-ba",language:"zh",command:"fetch",priority:105,template:{format:"抓取 把 {source} 的 {responseType}",tokens:[{type:"literal",value:"抓取",alternatives:["取"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"把",alternatives:["从","由"]}]},{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"的",alternatives:["作为","当作"]},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]}]},extraction:{source:{marker:"把",markerAlternatives:["从","由"]},responseType:{marker:"的",markerAlternatives:["作为","当作"]}}}];case"ms":return[{id:"fetch-ms",language:"ms",command:"fetch",priority:105,template:{format:"ambil_dari dari {source} sebagai {responseType}",tokens:[{type:"literal",value:"ambil_dari",alternatives:["muat","ambil"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"dari"}]},{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"sebagai",alternatives:["sbg"]},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]}]},extraction:{source:{marker:"dari"},responseType:{marker:"sebagai",markerAlternatives:["sbg"]}}}];case"fr":return[{id:"fetch-fr",language:"fr",command:"fetch",priority:105,template:{format:"chercher de {source} comme {responseType}",tokens:[{type:"literal",value:"chercher",alternatives:["récupérer"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"de"}]},{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"comme"},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]}]},extraction:{source:{marker:"de"},responseType:{marker:"comme"}}}];case"pt":return[{id:"fetch-pt",language:"pt",command:"fetch",priority:105,template:{format:"buscar de {source} como {responseType}",tokens:[{type:"literal",value:"buscar"},{type:"group",optional:!0,tokens:[{type:"literal",value:"de"}]},{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"como"},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]}]},extraction:{source:{marker:"de"},responseType:{marker:"como"}}}];case"es":return[MT("fetch-es","es","buscar","de","como")];case"pl":return[MT("fetch-pl","pl","pobierz","z","jako")];case"id":return[MT("fetch-id","id","muat","dari","sebagai",["ambil"])];case"sw":return[MT("fetch-sw","sw","leta","kutoka","kuwa",void 0,void 0,["kama"])];case"he":return[MT("fetch-he","he","הבא","מ","כ",["טען"],["את"])];case"de":return[MT("fetch-de","de","abrufen","von","als",["laden"])];case"ru":return[MT("fetch-ru","ru","загрузить","из","как",["загрузи"])];case"uk":return[MT("fetch-uk","uk","завантажити","з","як",["завантаж"])];case"it":return[MT("fetch-it","it","recuperare","da","come")];case"vi":return[MT("fetch-vi","vi","tải","từ","như")];case"th":return[MT("fetch-th","th","ดึงข้อมูล","จาก","เป็น")];case"ar":return[MT("fetch-ar","ar","احضر","من","كـ",["جلب"])];case"tl":return[MT("fetch-tl","tl","kuhanin_mula","mula_sa","bilang",["kunin_mula"])];case"ja":return[WT("fetch-ja-sov","ja","フェッチ","を",["取得"])];case"ko":return[WT("fetch-ko-sov","ko","패치","을",["가져오기"],["를"])];case"tr":return[WT("fetch-tr-sov","tr","getir","i",void 0,["ı","u","ü","yi","yı","yu","yü"])];case"hi":return[WT("fetch-hi-sov","hi","लाएं","को")];case"qu":return[WT("fetch-qu-sov","qu","apamuy","ta",["taripakaramuy"])];case"bn":return[WT("fetch-bn-sov","bn","আনুন","কে")];default:return[]}},Vz,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){switch(e){case"en":return[{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:!0,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"}}}}];case"zh":return[{id:"trigger-zh-ba",language:"zh",command:"trigger",priority:105,template:{format:"触发 把 {event}",tokens:[{type:"literal",value:"触发",alternatives:["觸發"]},{type:"literal",value:"把"},{type:"role",role:"event",expectedTypes:["literal","expression"]}]},extraction:{event:{position:2},destination:{default:{type:"reference",value:"me"}}}}];case"he":return[{id:"trigger-he-et",language:"he",command:"trigger",priority:105,template:{format:"הפעל את {event} על {destination}",tokens:[{type:"literal",value:"הפעל",alternatives:["שגר"]},{type:"literal",value:"את"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"על",alternatives:["ל","אל"]},{type:"role",role:"destination",expectedTypes:["selector","reference","expression"]}]}]},extraction:{event:{position:2},destination:{marker:"על",markerAlternatives:["ל","אל"],default:{type:"reference",value:"me"}}}}];default:return[]}},function(e){switch(e){case"zh":return[{id:"send-zh-ba",language:"zh",command:"send",priority:105,template:{format:"发送 把 {event} 到 {destination}",tokens:[{type:"literal",value:"发送",alternatives:["發送","传送","傳送"]},{type:"literal",value:"把"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"到",alternatives:["给","給","向"]},{type:"role",role:"destination",expectedTypes:["selector","reference","expression"]}]}]},extraction:{event:{position:2},destination:{marker:"到",markerAlternatives:["给","給","向"],default:{type:"reference",value:"me"}}}}];case"he":return[{id:"send-he-et",language:"he",command:"send",priority:105,template:{format:"שלח את {event} על {destination}",tokens:[{type:"literal",value:"שלח"},{type:"literal",value:"את"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"group",optional:!0,tokens:[{type:"literal",value:"על",alternatives:["ל","אל"]},{type:"role",role:"destination",expectedTypes:["selector","reference","expression"]}]}]},extraction:{event:{position:2},destination:{marker:"על",markerAlternatives:["ל","אל"],default:{type:"reference",value:"me"}}}}];default:return[]}},function(e){return[]}],$T=new Map;function VT(e){const t=qT.flatMap(t=>t(e));return"en"===e&&t.push(..._T),t.push(...function(e){const t=$T.get(e);if(t)return t;const r=wm(e);if(!r)return[];const n=gz(r);return $T.set(e,n),n}(e)),t}var DT=["en","ja","ar","es","ko","zh","tr","pt","fr","de","id","qu","sw","it","vi","pl","ru","uk","hi","bn","th","ms","tl","he"];var BT=new Map,HT=null;function FT(){if(null===HT){const e=[];for(const t of DT)e.push(...VT(t));HT=e}return HT}function KT(e){if(BT.has(e))return BT.get(e);const t=VT(e);return BT.set(e,t),t}Iz(),Df(),nz(),nz(),Cm(),sm=function(e){return VT(e.code)},av(),lv(),Gf(),Cm(),jm(),Nm(),Ud(),qm(),Fm(),Mm(),Gm(),Jm(),ed(),nd(),od(),cd(),md(),hd(),gd(),wd(),Ed(),Dm(),Cd(),jd(),Nd(),Md(),qd(),Dd(),Rf(),zz(),Tf(),Rf();var UT=new Map(Object.entries(Ef));function GT(e){return UT.get(e)}function YT(e){return"literal"===e.type&&"string"==typeof e.value||"selector"===e.type||"reference"===e.type?e.value:void 0}function ZT(e,t){if(null==e)return!1;for(const r of t)switch(r){case"selector":if("selector"===e.type)return!0;const t=YT(e);if(t&&(t.startsWith(".")||t.startsWith("#")||t.startsWith("[")))return!0;break;case"literal":if("literal"===e.type)return!0;if("property-path"===e.type)return!0;break;case"reference":if("reference"===e.type)return!0;if("property-path"===e.type)return!0;const r=YT(e);if(r&&["me","you","it","my","its","result","event","target"].includes(r.toLowerCase()))return!0;break;case"expression":if("expression"===e.type)return!0;if("property-path"===e.type)return!0}return!1}function JT(e){const t=[],r=[],n=[];let i=0;const a=GT(e.action);if(!a)return r.push({code:"UNKNOWN_ROLE",message:`No schema found for action '${e.action}'. Skipping validation.`,severity:"warning"}),{valid:!0,errors:t,warnings:r,confidenceAdjustment:-.1,suggestions:n};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&&!ZT(a,e.expectedTypes)&&(r.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?r.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"}),n.push(`Add ${e.description.toLowerCase()} to the command.`),i-=.2)}for(const t of e.arguments)if(t.role){a.roles.some(e=>e.role===t.role)||(r.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:r,confidenceAdjustment:Math.max(-1,Math.min(1,i)),suggestions:n}}function XT(e){switch(e){case"preposition":return"preposition";case"postposition":case"particle":case"case-suffix":return"postposition";default:return"none"}}function QT(e,t,r){const n={form:t.primary,role:e,position:XT(r),required:t.required??!1};return t.alternatives&&(n.alternatives=t.alternatives),n}var eS={accessibility:!0,performance:!0,schema:!0,strict:!1},tS=new Set(["scroll","mousemove","touchmove","resize","input","keydown","keyup","keypress"]),rS=new Set(["scroll","mousemove","touchmove","resize"]);function nS(e,t){const r=[];if("event-handler"===e.kind){const n=e.roles.get("event");if(n&&"literal"===n.type){const e=(n.value+"").toLowerCase();"mouseenter"!==e&&"mouseover"!==e&&"hover"!==e||r.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 r}function iS(e,t){const r=[];if("event-handler"===e.kind){const n=e.roles.get("event");if(n&&"literal"===n.type){const e=(n.value+"").toLowerCase();if(tS.has(e)){const n=rS.has(e)?"warning":"info";r.push({code:"HIGH_FREQUENCY_TRIGGER",severity:n,message:`High-frequency event '${e}' may cause performance issues.`,suggestion:rS.has(e)?`Consider using 'on ${e} throttled:100ms' to limit execution frequency.`:"Consider debouncing or throttling this handler.",location:{input:t,role:"event"}})}}}return r}function aS(e,t){const r=[];if("command"!==e.kind)return r;const n=GT(e.action);if(!n)return r;const i=Array.isArray(n.roles)?n.roles:[],a=new Set;for(const n of i)n&&"object"==typeof n&&"role"in n&&(a.add(n.role),n.required&&!e.roles.has(n.role)&&r.push({code:"MISSING_REQUIRED_ROLE",severity:"error",message:`Command '${e.action}' requires '${n.role}' but it was not provided.`,suggestion:n.description,location:{input:t}}));return e.roles.forEach((n,i)=>{a.has(i)||r.push({code:"INVALID_ROLE_FOR_COMMAND",severity:"warning",message:`Role '${i}' is not typically used with '${e.action}' command.`,location:{input:t,role:i}})}),r}function oS(e){if("event-handler"===e.kind){return e.body??[]}return[]}function sS(e,t={}){const r=[],n=new Map;for(const t of e)if("event-handler"===t.kind){const e=t.roles.get("event"),r=t.roles.get("source"),i=`${"literal"===e?.type?e.value:"unknown"}:${"selector"===r?.type?r.value:"self"}`;n.has(i)||n.set(i,[]);const a=oS(t);n.get(i).push({handler:t,commands:a})}return n.forEach((e,t)=>{if(e.length>1){const n=[],i=[];for(const{commands:t}of e)for(const e of t){n.push(e.action);const t=e.roles.get("patient");i.push("selector"===t?.type?t.value:"unknown")}const a=n.includes("toggle"),o=n.includes("show"),s=n.includes("hide");if(a&&(o||s)){i.filter((e,t)=>("toggle"===n[t]||"show"===n[t]||"hide"===n[t])&&i.some((r,n)=>t!==n&&e===r)).length>0&&r.push({code:"CONFLICTING_ACTIONS",severity:"warning",message:`Conflicting actions on '${t}': ${[...new Set(n)].join(", ")} may interfere with each other.`,suggestion:"Consider using a single toggle or conditional logic."})}n.some(e=>["fetch","wait","send"].includes(e))&&e.length>1&&r.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.'})}}),r}function lS(e,t="en",r={}){const n={...eS,...r},i=[];let a=null;try{a=ET(e,t)}catch{}if(!a)return{valid:!1,warnings:[{code:"UNREACHABLE_BEHAVIOR",severity:"error",message:"Could not parse input to semantic representation.",location:{input:e}}],node:null};n.accessibility&&i.push(...nS(a,e)),n.performance&&i.push(...iS(a,e)),n.schema&&i.push(...aS(a,e));const o=i.some(e=>"error"===e.severity),s=i.some(e=>"warning"===e.severity);return{valid:n.strict?!o&&!s:!o,warnings:i,node:a}}var cS=!1,uS={};function pS(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 mS(e){if(!e)return{type:"literal",value:null};switch(e.type){case"eventHandler":return function(e){const t=e.event??"click",r=e.commands??e.body??[],n=r.map(e=>mS(e)),i=function(e){const t=e.eventModifiers;return{...e.once||t?.once?{once:!0}:{},...e.debounce||t?.debounce?{debounce:e.debounce??t?.debounce}:{},...e.throttle||t?.throttle?{throttle:e.throttle??t?.throttle}:{},...e.prevent||t?.prevent?{prevent:!0}:{},...e.stop||t?.stop?{stop:!0}:{},...e.capture||t?.capture?{capture:!0}:{},...e.passive||t?.passive?{passive:!0}:{},...e.from||t?.from?{from:e.from??t?.from}:e.selector?{from:e.selector}:{}}}(e);return{type:"event",event:t,modifiers:i,body:n,...pS(e)}}(e);case"command":return function(e){const t=e.name;if("if"===t||"unless"===t)return function(e){const t=e.args??[];let r=t[0]?mS(t[0]):{type:"literal",value:!0};const n=dS(t[1]),i=t[2]?dS(t[2]):void 0;"unless"===e.name&&(r={type:"unary",operator:"not",operand:r});return{type:"if",condition:r,thenBranch:n,...i?{elseBranch:i}:{},...pS(e)}}(e);if("repeat"===t)return function(e){const t=e.args??[];if(0===t.length)return{type:"repeat",body:[],...pS(e)};const r=t[0],n=t[t.length-1];switch(r?.name??r?.value??"forever"){case"times":return{type:"repeat",count:t[1]?mS(t[1]):void 0,body:dS(n),...pS(e)};case"for":return{type:"foreach",itemName:t[1]?.value??"item",collection:t[2]?mS(t[2]):{type:"identifier",value:"[]"},body:dS(n),...pS(e)};case"while":return{type:"while",condition:t[1]?mS(t[1]):{type:"literal",value:!0},body:dS(n),...pS(e)};case"until":return{type:"while",condition:{type:"unary",operator:"not",operand:t[1]?mS(t[1]):{type:"literal",value:!1}},body:dS(n),...pS(e)};default:return{type:"repeat",body:dS(n),...pS(e)}}}(e);const r=(e.args??[]).map(e=>mS(e)),n=e.target?mS(e.target):void 0,i=e.modifiers?function(e){const t={};for(const[r,n]of Object.entries(e))t[r]=mS(n);return t}(e.modifiers):void 0,a=e.semanticRoles,o=a?function(e){const t={};for(const[r,n]of Object.entries(e))t[r]=mS(n);return t}(a):void 0;return{type:"command",name:t,args:r,...n?{target:n}:{},...i&&Object.keys(i).length>0?{modifiers:i}:{},...o&&Object.keys(o).length>0?{roles:o}:{},...pS(e)}}(e);case"CommandSequence":return function(e){const t=e.commands??[];return 1===t.length?mS(t[0]):{type:"event",event:"click",body:t.map(e=>mS(e)),...pS(e)}}(e);case"block":return function(e){const t=e.commands??[];return 1===t.length?mS(t[0]):{type:"event",event:"click",body:t.map(e=>mS(e)),...pS(e)}}(e);case"if":return function(e){const t=e.condition?mS(e.condition):{type:"literal",value:!0},r=(e.thenBranch??[]).map(e=>mS(e)),n=e.elseBranch?e.elseBranch.map(e=>mS(e)):void 0;return{type:"if",condition:t,thenBranch:r,...n?{elseBranch:n}:{},...pS(e)}}(e);case"literal":case"string":case"timeExpression":return{type:"literal",value:e.value,...pS(e)};case"selector":case"htmlSelector":return{type:"selector",value:e.value??e.selector??"",...pS(e)};case"contextReference":return{type:"identifier",value:e.name??e.contextType??"",...pS(e)};case"identifier":return{type:"identifier",value:e.name??e.value??"",name:e.name??"",...pS(e)};case"propertyAccess":return function(e){const t=e.object?mS(e.object):{type:"identifier",value:"me"};return{type:"possessive",object:t,property:e.property??"",...pS(e)}}(e);case"possessiveExpression":return function(e){const t=e.object?mS(e.object):{type:"identifier",value:"me"},r="string"==typeof e.property?e.property:e.property?.name??e.property?.value??"";return{type:"possessive",object:t,property:r,...pS(e)}}(e);case"memberExpression":return function(e){const t=e.object?mS(e.object):{type:"identifier",value:"me"},r="string"==typeof e.property?e.property:e.property?mS(e.property):{type:"literal",value:""};return{type:"member",object:t,property:r,computed:e.computed??!1,...pS(e)}}(e);case"binaryExpression":return function(e){return{type:"binary",operator:e.operator??"",left:mS(e.left),right:mS(e.right),...pS(e)}}(e);case"callExpression":return function(e){const t="string"==typeof e.callee?{type:"identifier",value:e.callee,name:e.callee}:mS(e.callee),r=(e.arguments??e.args??[]).map(e=>mS(e));return{type:"call",callee:t,args:r,...pS(e)}}(e);case"unaryExpression":return{type:"unary",operator:e.operator,operand:mS(e.operand),...pS(e)};case"templateLiteral":return{type:"literal",value:e.raw??"",...pS(e)};case"variable":return{type:"variable",name:e.name??"",scope:e.scope??"local",...pS(e)};case"positional":return{type:"positional",position:e.position,...e.target?{target:mS(e.target)}:{},...pS(e)};case"positionalExpression":return{type:"positional",position:e.operator,...e.argument?{target:mS(e.argument)}:{},...pS(e)};default:return{type:"literal",value:e.value??null,...pS(e)}}}function dS(e){return e?"block"===e.type?(e.commands??[]).map(e=>mS(e)):[mS(e)]:[]}function fS(e,t){return ST(e,t)}var hS=Object.freeze({__proto__:null,ASTBuilder:wE,get CssSelectorExtractor(){return Uf},DEFAULT_CONFIDENCE_THRESHOLD:lx,get EventModifierExtractor(){return Zf},HIGH_CONFIDENCE_THRESHOLD:.8,IdentifierExtractor:zu,KNOWN_PROFILES:zE,LAZY_LOAD_LANGUAGES:NT,NumberExtractor:wu,get OperatorExtractor(){return $f},PatternMatcher:qE,get PunctuationExtractor(){return Vf},SUPPORTED_LANGUAGES:NT,get SchemaErrorCodes(){return Hd},SemanticCache:jT,SemanticParserImpl:zT,SemanticRendererImpl:aT,StringLiteralExtractor:bu,TokenStreamImpl:Cp,get UrlExtractor(){return Jf},VERSION:"0.1.0",get VariableRefExtractor(){return eh},get addSchema(){return cf},analyze:lS,analyzeAll:function(e,t="en",r={}){const n=[],i=[];for(const a of e){const e=lS(a,t,r);n.push(...e.warnings),e.node&&i.push(e.node)}n.push(...sS(i,r));const a=n.some(e=>"error"===e.severity),o={...eS,...r},s=n.some(e=>"warning"===e.severity);return{valid:o.strict?!a&&!s:!a,warnings:n,node:i[0]??null}},analyzeMultiple:sS,get appendSchema(){return wf},get arabicProfile(){return Sm},get arabicTokenizer(){return Jv},get bengaliProfile(){return Lm},buildAST:function(e){const t=new wE;return{ast:t.build(e),warnings:t.warnings}},calculateTranslationConfidence:TT,canLoadLanguage:function(e){return e in OT},canParse:function(e,t){return xT.canParse(e,t)},checkAccessibility:nS,checkPerformance:iS,checkSchema:aS,get chineseProfile(){return Vd},get chineseTokenizer(){return Mg},get commandSchemas(){return Ef},convertExpression:Ex,convertLiteral:bx,convertPropertyPath:xx,convertReference:zx,convertSelector:wx,convertValue:kx,createCommandNode:AE,createCompoundNode:jE,createConditionalNode:PE,createEventHandler:LE,createLiteral:EE,createLoopNode:function(e,t,r,n,i){const a={kind:"loop",action:e,loopVariant:t,roles:new Map(Object.entries(r)),body:n};return i?.loopVariable&&(a.loopVariable=i.loopVariable),i?.indexVariable&&(a.indexVariable=i.indexVariable),i?.metadata&&(a.metadata=i.metadata),a},createPropertyPath:CE,createReference:SE,createSelector:xE,createSemanticCache:function(e){return new jT(e)},createTokenizerContext:Tu,get decrementSchema(){return bf},devModeAnalyze:function(e,t,r){if(!cS)return;if(!r)return;const n=lS(e,t,uS);for(const e of n.warnings){}},disableDevMode:function(){cS=!1},enableDevMode:function(e={}){cS=!0,uS=e},get englishProfile(){return Rm},get englishTokenizer(){return mv},get eventNameTranslations(){return Zw},get fetchSchema(){return gf},fillSchemaDefaults:function e(t){if(!t||"object"!=typeof t)return t;if(t.action&&t.roles instanceof Map){const e=Pf(t.action);if(e){const r=t.roles;for(const t of e.roles)void 0===t.default||r.has(t.role)||r.set(t.role,{...t.default})}}const r=t;for(const t of kT){const n=r[t];if(Array.isArray(n))for(const t of n)e(t)}return t},formatValidationResults:rf,get frenchProfile(){return Vm},fromExplicit:CT,fromSemanticAST:mS,generateAllPatterns:function(e,t=mz){const r=[],n=e??fz();for(const e of n){const n=gz(e,t);r.push(...n)}return r},generatePattern:hz,generatePatternVariants:vz,generatePatternsForCommand:function(e,t,r=mz){const n=[],i=t??fz();for(const t of i){if(!t.keywords[e.action])continue;const i=vz(e,t,r);n.push(...i)}return n},generatePatternsForLanguage:gz,generateSimplePattern:yz,get germanProfile(){return Om},getAllTranslations:function(e,t,r=["en","ja","ar","es","ko","zh","tr","pt","fr","de","id","qu","sw"]){const n={},i=AT(e,t);for(const e of r)n[e]=sT(i,e);return n.explicit=lT(i),n},getCommandMapper:bE,getCommandType:function(e,t){try{return xT.parse(e,t).action}catch{return null}},getDefaultExtractors:function(){return[new bu,new wu,new $f,new Vf,new zu]},getDefinedSchemas:Of,getDevModeConfig:function(){return{...uS}},getEventHandlerPatternsForLanguage:rz,getGeneratorSummary:function(){const e=zm(),t=Of().map(e=>e.action);let r=0;for(const t of e){const e=wm(t);if(e)for(const t of Of())e.keywords[t.action]&&(r+=2)}return{languages:e,commands:t,totalPatterns:r}},getHyperscriptExtractors:ov,getLoadedLanguages:function(){return NT.filter(xm)},getPatternById:function(e){return FT().find(t=>t.id===e)},getPatternStats:function(){const e={},t={},r=FT();for(const n of r)e[n.language]=(e[n.language]||0)+1,t[n.command]=(t[n.command]||0)+1;return{totalPatterns:r.length,byLanguage:e,byCommand:t}},getPatternsForLanguage:KT,getPatternsForLanguageAndCommand:function(e,t){return KT(e).filter(e=>e.command===t).sort((e,t)=>t.priority-e.priority)},getPutPatternsForLanguage:_f,getRegisteredLanguages:zm,getRegisteredMappers:function(){return new Map(kE)},getSchema:Pf,getSchemasByCategory:function(e){return Object.values(Ef).filter(t=>t.category===e)},getSupportedCommands:function(){const e=new Set(FT().map(e=>e.command));return Array.from(e)},getSupportedLanguages:function(){return[...NT]},getSupportedPatternLanguages:function(){const e=new Set(FT().map(e=>e.language));return Array.from(e)},getSupportedTokenizerLanguages:DE,getTogglePatternsForLanguage:xz,getTokenizer:function(e){return function(e){let t=im.get(e);return!t&&bm(e)&&(t=im.get(km(e))),t}(e)},getUnloadedLanguages:function(){return NT.filter(e=>!xm(e))},getValidationStats:nf,getValidatorSchema:GT,get hebrewProfile(){return Hm},get hideSchema(){return ff},get hindiProfile(){return Um},get incrementSchema(){return kf},get indonesianProfile(){return Zm},isContextAwareExtractor:Eu,isDevModeEnabled:function(){return cS},isExplicitSyntax:Wc,isLanguageRegistered:xm,isLanguageSupported:function(e){return xm(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))},get italianProfile(){return Qm},get japaneseProfile(){return rd},get japaneseTokenizer(){return Sv},get koreanProfile(){return ad},get koreanTokenizer(){return Wv},loadLanguage:IT,loadLanguages:async function(e,t={}){return Promise.all(e.map(e=>IT(e,t)))},localizeEventName:ez,get malayProfile(){return ld},markingStrategyToAdpositionType:XT,matchBest:function(e,t){return $E.matchBest(e,t)},matchPattern:function(e,t){return $E.matchPattern(e,t)},normalizeEventName:function(e,t){const r=Zw[t];return r&&r[e]?r[e]:e.toLowerCase()},get onSchema(){return hf},parse:ET,parseAny:AT,parseExplicit:uT,parseSemantic:fS,parseWithConfidence:ST,patternMatcher:$E,get polishProfile(){return pd},get portugueseProfile(){return fd},get prependSchema(){return zf},get putSchema(){return pf},get quechuaProfile(){return vd},registerCommandMapper:function(e){kE.set(e.action,e)},registerSchema:function(e,t){UT.set(e,t)},registerTokenizer:function(e){!function(e){im.set(e.language,e)}(e)},get removeSchema(){return uf},render:sT,renderExplicit:lT,roundTrip:function(e,t,r){const n=AT(e,t),i=r??t,a=Wc(e)?lT(n):sT(n,i);if(void 0!==r)return a;const o=e.trim().toLowerCase(),s=a.trim().toLowerCase();return{original:e,semantic:n,rendered:a,matches:o===s}},get russianProfile(){return bd},schemaRegistry:UT,semanticCache:PT,semanticParser:xT,semanticRenderer:oT,get setSchema(){return mf},get showSchema(){return df},get spanishProfile(){return _m},get spanishTokenizer(){return hg},get swahiliProfile(){return xd},get tagalogProfile(){return Ld},get thaiProfile(){return Sd},toExplicit:function(e,t){return Wc(e)?e:lT(ET(e,t))},toGrammaticalMarker:QT,toI18nProfile:function(e){const t=[];for(const[r,n]of Object.entries(e.roleMarkers))n&&t.push(QT(r,n,e.markingStrategy));return{code:e.code,name:e.nativeName,wordOrder:e.wordOrder,adpositionType:XT(e.markingStrategy),morphology:e.morphology,direction:e.direction,markers:t,canonicalOrder:e.canonicalOrder}},get toggleSchema(){return lf},tokenize:VE,translate:function(e,t,r){return Wc(e)?CT(e,r):sT(ET(e,t),r)},get triggerSchema(){return yf},tryGetProfile:wm,get turkishProfile(){return Od},get turkishTokenizer(){return jg},get ukrainianProfile(){return Rd},validateAllSchemas:tf,validateAndAdjustConfidence:function(e){const t=JT(e);return{...e,confidence:Math.max(0,Math.min(1,e.confidence+t.confidenceAdjustment)),validation:t}},validateCommandSchema:ef,validateLanguageKeywords:function(e,t=Of()){const r=[],n=[];for(const i of t)e.keywords[i.action]?n.push(i.action):r.push(i.action);return{missing:r,available:n}},validateSemanticResult:JT,validateTranslation:function(e,t,r,n){try{const i=AT(e,r),a=AT(t,n);if(i.action!==a.action)return!1;for(const[e,t]of i.roles){const r=a.roles.get(e);if(!r)return!1;if(!LT(t,r))return!1}return!0}catch{return!1}},get vietnameseProfile(){return _d},get waitSchema(){return vf},withCache:function(e,t=PT){return(r,n)=>{const i=t.get(r,n);if(i)return i;const a=e(r,n);return t.set(r,n,a),a}}});let yS=null;function vS(){return yS||(yS=jt({parse:fS,isRegistered:xm,registered:zm})),yS}function gS(e){if(e&&"object"==typeof e.locals&&e.locals instanceof Map)return e;const t=e?.globals,r=t instanceof Map?t:vn(),n={me:e?.me||null,you:e?.you||null,it:e?.it||e?.result,result:e?.result,locals:new Map,globals:r,halted:!1,returned:!1,broke:!1,continued:!1,async:!1};if(!e)return n;if(e.locals&&"object"==typeof e.locals)for(const[t,r]of Object.entries(e.locals))n.locals.set(t,r);if(e.globals&&"object"==typeof e.globals&&!(e.globals instanceof Map))for(const[t,r]of Object.entries(e.globals))fe(n,t,r);const i=new Set(["me","you","it","result","locals","globals","language"]);for(const[t,r]of Object.entries(e))i.has(t)||void 0===r||n.locals.set(t,r);return n}async function kS(e,t){if(!e||""===e.trim())throw Error("Cannot evaluate empty script");try{const r=gS(t),n=t?.language||"en";if(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!0;const r=t.split(/\s/)[0];if(r&&N.has(r))return!0;return!1}(e))return await async function(e,t,r="en"){const n=it(e),i=new Mr(n,{semanticAnalyzer:vS(),language:r,semanticConfidenceThreshold:lx}),a=i.parse();if(!a.success||!a.node)throw Error("Parse error: "+(a.error?.message||"Unknown parse error"));const o=new hc,s=await o.execute(a.node,t);return s}(e,r,n);return await Hr(e,r)}catch(e){if(e instanceof Error)throw Error("HyperScript evaluation error: "+e.message);throw e}}async function bS(e,t){if(!e||""===e.trim())throw Error("Cannot evaluate empty expression");try{const r=gS(t);return await Hr(e,r)}catch(e){if(e instanceof Error)throw Error("HyperScript evaluation error: "+e.message);throw e}}async function wS(e,t){if(function(e){const t=e.toLowerCase();return["fetch","wait","settle","async","promise"].some(e=>t.includes(e))}(e))return bS(e,t);try{return kS(e,t)}catch(r){if(r instanceof Error&&r.message.includes("Async expressions not yet supported"))return bS(e,t);throw r}}function zS(e){const{target:t,strategy:r="morph",useViewTransition:n=!1,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 Ta(e)?e:null}return Ta(t)?t:null})();if(!c)return;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 Ts([c],a,r,{useViewTransition:n}),c.classList.remove("hx-swapping"),s&&await s(u,a),Xs(window,"historyswap",{url:u,strategy:r,target:t})}catch(e){c.classList.remove("hx-swapping"),l&&l(e,u)}};return window.addEventListener("popstate",c),{destroy:()=>{window.removeEventListener("popstate",c)},config:e}}const xS={name:"HistorySwap",init:(e,t={})=>zS({target:t.target||e,strategy:t.strategy||"morph",useViewTransition:!!t.useViewTransition}),destroy(e){e.destroy()}};function ES(e){return!function(e){try{return new URL(e,window.location.origin).origin!==window.location.origin}catch{return!1}}(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))))}function TS(e){const{container:t,target:r,linkSelector:n="a[href]",formSelector:i="form",boostForms:a=!1,strategy:o="morph",pushUrl:s=!0,useViewTransition:l=!1,fetchOptions:c={},onBeforeFetch:u,onAfterSwap:p,onError:m}=e,d=async(e,n="GET",i=null)=>{const a=(()=>{if(!r)return document.body;if("string"==typeof r){const e=document.querySelector(r);return Ta(e)?e:null}return Ta(r)?r:null})();if(a)try{if(u){if(!1===await u(e,n))return}a.classList.add("hx-swapping"),t.classList.add("hx-boosting");const m={method:n,headers:{Accept:"text/html","HX-Request":"true","HX-Boosted":"true"},...c};i&&"GET"!==n&&(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 Ts([a],f,o,{useViewTransition:l}),a.classList.remove("hx-swapping"),t.classList.remove("hx-boosting"),s&&"GET"===n&&window.history.pushState(null,"",e),p&&await p(e,f),Xs(window,"boosted",{url:e,method:n,strategy:o,target:r})}catch(r){a.classList.remove("hx-swapping"),t.classList.remove("hx-boosting"),m?m(r,e):window.location.href=e}},f=async e=>{const t=e.target.closest(n);t&&function(e){return!(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)&&0===e.button}(e)&&ES(t)&&(e.preventDefault(),e.stopPropagation(),await d(t.href))},h=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 r=(t.method||"GET").toUpperCase(),n=new FormData(t);let o,s=null;if("GET"===r){const e=new URLSearchParams;n.forEach((t,r)=>{e.append(r,t+"")}),o=`${t.action||window.location.pathname}?${""+e}`}else o=t.action||window.location.pathname,s=n;await d(o,r,s)};return t.addEventListener("click",f),a&&t.addEventListener("submit",h),{destroy:()=>{t.removeEventListener("click",f),t.removeEventListener("submit",h)},config:e,boost:d}}const SS={name:"Boosted",init:(e,t={})=>TS({container:e,target:t.target,linkSelector:t.linkSelector||"a[href]",formSelector:t.formSelector||"form",boostForms:!!t.boostForms,strategy:t.strategy||"morph",pushUrl:!1!==t.pushUrl,useViewTransition:!!t.useViewTransition}),destroy(e){e.destroy()}};const CS="click";let AS,LS,jS,PS=null;function OS(e,t,r){r.errors?.length&&r.errors.forEach((e,t)=>{}),t.split("\n")}async function NS(e,t){try{return await jS().execute(e,t)}catch(e){throw e}}function IS(e,t,r){try{const n=function(e){try{if(function(e){return"eventHandler"===e.type}(e)){return{eventType:e.event||CS,body:{type:"CommandSequence",commands:e.commands||[],start:e.start||0,end:e.end||0,line:e.line||1,column:e.column||1}}}if(function(e){return"FeatureNode"===e.type}(e)&&"on"===e.name){return{eventType:e.args?.[0]?.value||CS,body:e.body||e}}return"CommandSequence"===e.type||"Block"===e.type?{eventType:CS,body:e}:null}catch(e){return null}}(t);if(!n)return;const i=async e=>{try{r.locals.set("event",e),r.locals.set("target",e.target),await NS(n.body,r)}catch(e){}};e.addEventListener(n.eventType,i);try{const t=jS?.();t?.trackListener?.(e,e,n.eventType,i)}catch{}}catch(e){}}function RS(e){return yn(e)}function MS(e,t,r,n){const i=new CustomEvent(t,{bubbles:!0,cancelable:r,detail:n});return e.dispatchEvent(i)}function WS(e,t){if(!MS(e,"hyperscript:before:init",!0,{code:t}))return;const r=function(e){const t=e.getAttribute("data-lang");if(t)return t;const r=e.closest("[lang]")?.getAttribute("lang");if(r)return r.split("-")[0];if("undefined"!=typeof document){const e=document.documentElement?.lang;if(e)return e.split("-")[0]}return"en"}(e);"en"===r?(!function(e,t){try{const r=AS(t);if(!r.ok)return void OS(0,t,r);if(!r.ast)return;const n=RS(e);if(t.trim().startsWith("on "))try{IS(e,r.ast,n)}catch(e){throw e}else NS(r.ast,n)}catch(e){}}(e,t),_S(e),MS(e,"hyperscript:after:init",!1,{code:t})):async function(e,t,r){try{const n=await LS(t,{language:r});if(!n.ok)return void OS(0,t,n);if(!n.ast)return;const i=RS(e);t.trim().startsWith("on ")||"eventHandler"===n.ast.type?IS(e,n.ast,i):NS(n.ast,i)}catch(e){}}(e,t,r).then(()=>{_S(e),MS(e,"hyperscript:after:init",!1,{code:t})})}function _S(e){e.hasAttribute("data-hyperscript-powered")||e.setAttribute("data-hyperscript-powered","")}class qS{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;return this.items[(this.head-1+this.capacity)%this.capacity]}}class $S{constructor(){this.state={enabled:!1,paused:!1,stepMode:"continue",callDepth:0,pauseDepth:0,currentSnapshot:null},this.history=new qS(200),this.breakpoints=new Map,this.snapshotIndex=0,this._resumeResolver=null,this.listeners=new Map,this.hooks={beforeExecute:this.beforeExecute.bind(this),afterExecute:this.afterExecute.bind(this)}}on(e,t){let r=this.listeners.get(e);return r||(r=new Set,this.listeners.set(e,r)),r.add(t),()=>r.delete(t)}emit(e,t){const r=this.listeners.get(e);if(r)for(const e of r)try{e(t)}catch{}}enable(){this.state.enabled=!0,this.emit("enabled")}disable(){this.state.paused&&this._resumeResolver&&(this._resumeResolver(),this._resumeResolver=null),this.state.enabled=!1,this.state.paused=!1,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._resumeResolver&&(this.state.paused=!1,this.emit("resumed"),this._resumeResolver(),this._resumeResolver=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=!0,this.state.currentSnapshot=t,this.emit("paused",t),await new Promise(e=>{this._resumeResolver=e}),this.state.currentSnapshot=null)}async afterExecute(e,t){if(!this.state.enabled)return;const r=this.history.last();r&&(r.variables.__result=VS(t)),this.state.callDepth=Math.max(0,this.state.callDepth-1)}shouldPause(e){if(this.hitBreakpoint(e))return!0;switch(this.state.stepMode){case"pause":return this.state.stepMode="into",!0;case"into":return!0;case"over":return this.state.pauseDepth>=this.state.callDepth;case"out":return this.state.pauseDepth>this.state.callDepth;case"continue":return!1}}hitBreakpoint(e){for(const t of this.breakpoints.values()){if(!t.enabled)continue;let r=!1;switch(t.type){case"command":r=e.commandName===t.value;break;case"element":if(e.element)try{r=e.element.matches(t.value)}catch{}break;case"expression":r=this.evaluateCondition(t.value,e)}if(r)return t.hitCount++,!0}return!1}evaluateCondition(e,t){try{const r=t.executionContext,n={commandName:t.commandName,it:r.it,result:r.result,me:r.me};if(r.locals)for(const[e,t]of r.locals)n[e]=t;const i=Object.keys(n),a=i.map(e=>n[e]);return!!Function(...i,`return (${e});`)(...a)}catch{return!1}}captureSnapshot(e){const t=e.executionContext,r={};if(r.it=VS(t.it),r.result=VS(t.result),t.me&&(r.me=DS(t.me)),t.you&&(r.you=DS(t.you)),e.event&&(r["event.type"]=e.event.type,e.event.target&&(r["event.target"]=DS(e.event.target))),t.locals)for(const[e,n]of t.locals)e.startsWith("__")||(r[":"+e]=VS(n));return{commandName:e.commandName,element:e.element,variables:r,timestamp:Date.now(),depth:this.state.callDepth,index:this.snapshotIndex++}}}function VS(e){if(null==e)return e;if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return e;if(e instanceof Element)return DS(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 DS(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 BS="en";const HS=new class{constructor(e=500){this.cache=new Map,this.hits=0,this.misses=0,this.maxSize=e}makeKey(e,t){return`${t?.language||BS}\0${t?.traditional?"1":"0"}\0${e}`}get(e,t){const r=this.makeKey(e,t),n=this.cache.get(r);if(n)return this.hits++,this.cache.delete(r),this.cache.set(r,n),n.result;this.misses++}set(e,t,r){if(!r.ok)return;const n=this.makeKey(e,t);if(this.cache.size>=this.maxSize&&!this.cache.has(n)){const e=this.cache.keys().next().value;void 0!==e&&this.cache.delete(e)}this.cache.set(n,{result:r})}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 FS=null,KS=null;const US={semantic:!0,language:"en",confidenceThreshold:lx,logAll:!1,conversions:Be.conversions};let GS=null,YS=null;function ZS(){if(!GS&&(GS=new hc({lazyLoad:!1}),(e=GS.behaviorRegistry)instanceof Map||e&&"function"==typeof e.set?e.set("HistorySwap",xS):e&&"object"==typeof e&&(e.HistorySwap=xS),function(e){e instanceof Map||e&&"function"==typeof e.set?e.set("Boosted",SS):e&&"object"==typeof e&&(e.Boosted=SS)}(GS.behaviorRegistry),"undefined"!=typeof globalThis)){const e=globalThis;e._hyperscript=e._hyperscript||{},e._hyperscript.runtime=GS,e._hyperscript.behaviors=GS.behaviorAPI}var e;return GS}async function JS(e,t){if(!e)throw Error("AST is required for execution");const r=t||yn();return await ZS().execute(e,r)}function XS(e,t){if("string"!=typeof e)throw new TypeError("Code must be a string");const r=HS.get(e,t);if(r)return r;const n=performance.now(),i=t?.language||BS;try{const r=t?.traditional??!1,o=r?{}:US.semantic?{semanticAnalyzer:(FS||(FS=jt({parse:fS,isRegistered:xm,registered:zm})),FS),language:US.language,semanticConfidenceThreshold:US.confidenceThreshold}:{},s=!r,l=Wr(e,o),c=performance.now()-n;if(l.success&&l.node){const r={ok:!0,ast:l.node,meta:{parser:s?"semantic":"traditional",language:i,timeMs:c}};return HS.set(e,t,r),r}return{ok:!1,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()-n;return{ok:!1,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 QS(e,t){if("string"!=typeof e)throw new TypeError("Code must be a string");const r=t?.language||BS;if(r===BS||t?.traditional)return XS(e,t);const n=HS.get(e,t);if(n)return n;const i=performance.now();try{const n=await async function(){if(!KS){const{SemanticGrammarBridge:e}=await import("./bridge-fFLEvCQs.js");KS=new e,await KS.initialize()}return KS}(),a=await n.parseToASTWithDetails(e,r);if(a.usedDirectPath&&a.ast){const n=performance.now()-i,o={ok:!0,ast:a.ast,meta:{parser:"semantic",confidence:a.confidence,language:r,timeMs:n,directPath:!0}};return HS.set(e,t,o),o}const o=XS(a.fallbackText||e,{...t,language:BS}),s={...o,meta:{...o.meta,language:r,confidence:a.confidence,directPath:!1}};return HS.set(e,t,s),s}catch{return XS(e,{...t,language:"en"})}}!function(e,t,r){AS=e,LS=t,jS=r}(XS,QS,ZS),PS=US;const eC={compile:QS,compileSync:XS,execute:JS,eval:async function(e,t,r){if("string"!=typeof e||0===e.trim().length)throw Error("Code must be a non-empty string");let n;if(t)if(t instanceof Element)n=yn(t);else if("object"==typeof(i=t)&&null!==i&&"locals"in i&&i.locals instanceof Map)n=t;else{const e=t;n=function(e){return"object"==typeof e&&null!==e&&"me"in e}(e)?yn(e.me):yn()}else n=yn();var i;const a=await QS(e.trim(),r);if(!a.ok){throw Error("Compilation failed: "+(a.errors?.[0]?.message||"Unknown compilation error"))}return JS(a.ast,n)},validate:async function(e,t){const r=await QS(e,t);return{valid:r.ok,errors:r.errors}},process:function(e){try{const t=e.getAttribute("_");t&&WS(e,t);e.querySelectorAll("[_]").forEach(e=>{const t=e.getAttribute("_");t&&WS(e,t)})}catch(e){}},cleanup:e=>{e.dispatchEvent(new CustomEvent("hyperscript:before:cleanup",{bubbles:!0,cancelable:!1}));const t=ZS().cleanupTree(e);return e.hasAttribute?.("data-hyperscript-powered")&&e.removeAttribute("data-hyperscript-powered"),e.dispatchEvent(new CustomEvent("hyperscript:after:cleanup",{bubbles:!0,cancelable:!1,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:!1,breaking:!1,continuing:!1,returning:!1,async:!1}}}(t,e):yn(e)},config:US,version:"2.0.0",createRuntime:function(e){return new hc(e)},getDefaultRuntime:()=>ZS(),registerHooks:(e,t)=>{ZS().registerHooks(e,t)},unregisterHooks:e=>ZS().unregisterHooks(e),getRegisteredHooks:()=>ZS().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:r,semanticNodeToRuntimeAST:n}=await import("./index-BRgVy8nY.js"),i=await r(e),a=await n(i),o=t?yn(t):yn();return await ZS().execute(a,o)},evalLSENode:async function(e,t){const{semanticNodeToRuntimeAST:r}=await import("./index-BRgVy8nY.js"),n=await r(e),i=t?yn(t):yn();return await ZS().execute(n,i)},compileLSE:async function(e){const t=performance.now();if("string"!=typeof e||0===e.trim().length)return{ok:!1,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:r,semanticNodeToRuntimeAST:n}=await import("./index-BRgVy8nY.js"),i=await r(e,{collectDiagnostics:!0}),a=await n(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:!1,errors:[{message:e.message,line:0,column:0}],meta:{parser:"lse",language:"explicit",timeMs:performance.now()-t}}}},toLSE:async function(e,t){const r=t||BS,{parseSemantic:n}=await Promise.resolve().then(function(){return hS}),{renderExplicit:i}=await import("./index-BRgVy8nY.js"),a=n(e,r);if(!a||!a.node)throw Error(`Failed to parse "${e}" as ${r} hyperscript`);return await i(a.node)},fromLSE:async function(e,t){const{render:r}=await Promise.resolve().then(function(){return hS}),{parseExplicit:n}=await import("./index-BRgVy8nY.js");return r(await n(e),t)},clearCache:()=>HS.clear(),getCacheStats:()=>HS.getStats(),get debug(){return YS||(YS=new $S,ZS().registerHooks("__debugger",YS.hooks)),YS}},tC=/^on\s+(\w+)/,rC=new Set(["load","mutation","intersection","appear","every"]);function nC(){return"undefined"!=typeof globalThis&&"scheduler"in globalThis&&"function"==typeof globalThis.scheduler?.yield?globalThis.scheduler.yield():new Promise(e=>setTimeout(e,0))}const iC=new class{constructor(e={}){this.processedElements=new WeakSet,this.observer=null,this.processedCount=0,this.readyEventDispatched=!1,this.initialized=!1,this.lazyElements=new WeakSet,this.options={attributeName:"_",autoScan:!0,processOnlyNewElements:!0,lazyParsing:!1,chunkedProcessing:!1,chunkSize:16,...e}}async init(){"undefined"!=typeof document&&(this.initialized||(this.initialized=!0,this.options.autoScan&&(await this.scanAndProcessAll(),this.dispatchReadyEvent()),this.setupMutationObserver()))}async scanAndProcessAll(){"undefined"!=typeof window&&window.__hyperfixi_behaviors_ready&&await window.__hyperfixi_behaviors_ready;const e=document.querySelectorAll('script[type="text/hyperscript"]');for(const t of e)t instanceof HTMLScriptElement&&(t.textContent?.substring(0,50),await this.processHyperscriptTag(t));const t=document.querySelectorAll(`[${this.options.attributeName}]`);if(this.options.lazyParsing){const e=[];t.forEach(t=>{if(t instanceof HTMLElement){const r=this.processElementLazy(t);r&&e.push(r)}}),e.length>0&&await Promise.all(e)}else if(this.options.chunkedProcessing)await this.processElementsChunked(t);else{const e=[];t.forEach(t=>{t instanceof HTMLElement&&e.push(this.processElementAsync(t))}),await Promise.all(e)}"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){const r=e.textContent||e.innerHTML;if(!r||!r.trim())return;const n=document.querySelectorAll(t);if(0!==n.length)try{r.substring(0,50);const e=eC.compileSync(r);if(!e.ok)return;for(const t of n)if(t instanceof HTMLElement){const r=yn(t);await eC.execute(e.ast,r)}}catch(e){}}async processHyperscriptTagGlobal(e){const t=e.textContent||e.innerHTML;if(t&&t.trim())try{t.substring(0,50);const e=yn(null),r=eC.compileSync(t);if(!r.ok)return;await eC.execute(r.ast,e)}catch(e){}}processElement(e){this.processElementAsync(e)}async processElementAsync(e){if(this.options.processOnlyNewElements&&this.processedElements.has(e))return;const t=e.getAttribute(this.options.attributeName);if(t){this.processedElements.add(e),this.processedCount++;try{const r=yn(e),n=eC.compileSync(t);if(!n.ok)return;await eC.execute(n.ast,r),this.dispatchLoadEvent(e)}catch(e){}}}async processElementsChunked(e){const t=this.options.chunkSize,r=[];e.forEach(e=>{e instanceof HTMLElement&&r.push(e)});for(let e=0;r.length>e;e+=t){const n=r.slice(e,e+t).map(e=>this.processElementAsync(e));await Promise.all(n),r.length>e+t&&await nC()}}processElementLazy(e){const t=e.getAttribute(this.options.attributeName);if(!t)return null;const r=t.match(tC);if(!r||rC.has(r[1])||this.hasMultipleHandlers(t))return this.processElementAsync(e);const n=r[1];return e.addEventListener(n,async r=>{this.lazyElements.delete(e);try{const n=eC.compileSync(t);if(!n.ok||!n.ast)return;const i=yn(e);eC.execute(n.ast,i);const a=n.ast;if("eventHandler"===a.type&&a.commands?.length>0){a.modifiers?.prevent&&r.preventDefault(),a.modifiers?.stop&&r.stopPropagation();const t=yn(e);t.locals.set("event",r),t.locals.set("target",r.target),t.event=r;for(const e of a.commands){const r=jn(await eC.execute(e,t));void 0!==r&&Object.assign(t,{it:r,result:r})}}this.dispatchLoadEvent(e)}catch(e){}},{once:!0}),this.lazyElements.add(e),this.processedElements.add(e),this.processedCount++,null}hasMultipleHandlers(e){const t=new Set(["me","it","its","my","you","yourself"]);let r=0;const n=/\bon\s+(\w+)/g;let i;for(;null!==(i=n.exec(e));){if("."!==e[i.index+i[0].length]&&(!t.has(i[1])&&(r++,r>1)))return!0}return!1}dispatchLoadEvent(e){try{const t=new Event("load",{bubbles:!1,cancelable:!1});e.dispatchEvent(t)}catch(e){}}dispatchReadyEvent(){if(!this.readyEventDispatched)try{const e=new CustomEvent("hyperscript:ready",{bubbles:!0,cancelable:!1,detail:{processedElements:this.processedCount,timestamp:Date.now()}});document.dispatchEvent(e),this.readyEventDispatched=!0}catch(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=>{});const r=t.querySelectorAll?.('script[type="text/hyperscript"]');r?.forEach(e=>{e instanceof HTMLScriptElement&&this.processHyperscriptTag(e).catch(e=>{})}),t.getAttribute&&t.getAttribute(this.options.attributeName)&&this.processElementAsync(t).catch(e=>{});const n=t.querySelectorAll?.(`[${this.options.attributeName}]`);n?.forEach(e=>{e instanceof HTMLElement&&this.processElementAsync(e).catch(e=>{})})}})})}),this.observer.observe(document.body,{childList:!0,subtree:!0}))}destroy(){this.observer&&(this.observer.disconnect(),this.observer=null),this.initialized=!1,this.readyEventDispatched=!1,this.processedCount=0,this.lazyElements=new WeakSet}reset(){this.destroy()}};class aC{constructor(e,t,r=0){this.pool=[],this.index=0,this.metrics={allocations:0,reuses:0,peakPoolSize:0},this.factory=e,this.reset=t;for(let t=0;r>t;t++)this.pool.push(e());this.metrics.allocations=r,this.metrics.peakPoolSize=r}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 oC=new class{constructor(){this.pending=new Map,this.rafId=null,this.stylePool=new aC(()=>({}),e=>{for(const t of Object.keys(e))delete e[t]},10)}add(e,t){let r=this.pending.get(e);r||(r=this.stylePool.get(),this.pending.set(e,r)),Object.assign(r,t),this.rafId||(this.rafId=requestAnimationFrame(()=>this.flush()))}flush(){for(const[e,t]of this.pending)for(const[r,n]of Object.entries(t))if(r.startsWith("--"))e.style.setProperty(r,n);else{const t=r.replace(/-([a-z])/g,e=>e[1].toUpperCase());e.style[t]=n}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()}},sC={sockets:/\b(socket|connect\s+to\s+ws[s]?:)/i,eventsource:/\b(eventsource|connect\s+to\s+sse:)/i,workers:/\b(worker|start\s+worker)/i},lC=new Set,cC=new Map;function uC(e){const t=new Set,r=Array.isArray(e)?e:[e];for(const e of r)for(const[r,n]of Object.entries(sC))n.test(e)&&t.add(r);return t}async function pC(e){if(lC.has(e))return;const t=cC.get(e);if(t)return t;const r=(async()=>{try{switch(e){case"sockets":await import("./feature-sockets-CrYvjZ4j.js").then(function(e){return e.s});break;case"eventsource":await import("./feature-eventsource-BpZvPy_K.js");break;case"workers":await import("./feature-webworker-BSYguEIW.js");break;default:return}lC.add(e)}catch(e){throw e}finally{cC.delete(e)}})();return cC.set(e,r),r}async function mC(e){const t=[...uC(e)].filter(e=>!lC.has(e));0!==t.length&&await Promise.all(t.map(e=>pC(e)))}async function dC(){const e=function(){if("undefined"==typeof document)return[];const e=[];return document.querySelectorAll("[_]").forEach(t=>{const r=t.getAttribute("_");r&&e.push(r)}),document.querySelectorAll('script[type="text/hyperscript"]').forEach(t=>{t.textContent&&e.push(t.textContent)}),e}();await mC(e)}function fC(e){return lC.has(e)}function hC(){return[...lC]}async function yC(e){await Promise.all(e.map(e=>pC(e)))}const vC={evalHyperScript:kS,evalHyperScriptAsync:bS,evalHyperScriptSmart:wS,evaluate:kS,compile:e=>{const t=eC.compileSync(e);if(!t.ok){throw Error(t.errors&&t.errors.length>0?t.errors[0].message:"Compilation failed")}return t},execute:eC.execute,run:async(e,t)=>eC.eval(e,t),createContext:eC.createContext,createRuntime:eC.createRuntime,Parser:Mr,Runtime:hc,tokenize:it,processNode:async e=>{const t=[];if(e===document)document.querySelectorAll("[_]").forEach(e=>{const r=e.getAttribute("_");r&&t.push(r)}),document.querySelectorAll('script[type="text/hyperscript"]').forEach(e=>{e.textContent&&t.push(e.textContent)});else if(e instanceof HTMLElement){const r=e.getAttribute("_");r&&t.push(r)}await mC(t),e===document?iC.scanAndProcessAll():e instanceof HTMLElement&&iC.processElement(e)},process:e=>vC.processNode(e),attributeProcessor:iC,styleBatcher:oC,ObjectPool:aC,debug:Tt,features:{preloadDocument:dC,loadRequired:mC,detect:uC,isLoaded:fC,getLoaded:hC,preload:yC},version:"1.0.0-modular"};"undefined"!=typeof window&&(window.hyperfixi=vC,window.evalHyperScript=kS,window.evalHyperScriptAsync=bS,window.evalHyperScriptSmart=wS,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",async()=>{await dC(),await iC.init()}):dC().then(()=>{iC.init()}));export{lx as D,aC as O,Mr as P,hc as R,iC as a,uC as b,bS as c,Tt as d,kS as e,wS as f,hC as g,vC as h,eC as i,fC as j,yC as k,mC as l,cm as m,hS as n,dC as p,oC as s,it as t};
2
- //# sourceMappingURL=browser-modular-BK3IOo93.js.map