@lokascript/hyperscript-adapter 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -3
- package/dist/hyperscript-i18n-ar.global.js +4 -4
- package/dist/hyperscript-i18n-bn.global.js +4 -4
- package/dist/hyperscript-i18n-de.global.js +4 -4
- package/dist/hyperscript-i18n-east-asian.global.js +4 -4
- package/dist/hyperscript-i18n-en.global.js +6 -6
- package/dist/hyperscript-i18n-es.global.js +4 -4
- package/dist/hyperscript-i18n-fr.global.js +4 -4
- package/dist/hyperscript-i18n-he.global.js +4 -4
- package/dist/hyperscript-i18n-hi.global.js +4 -4
- package/dist/hyperscript-i18n-id.global.js +4 -4
- package/dist/hyperscript-i18n-it.global.js +4 -4
- package/dist/hyperscript-i18n-ja.global.js +4 -4
- package/dist/hyperscript-i18n-ko.global.js +4 -4
- package/dist/hyperscript-i18n-ms.global.js +4 -4
- package/dist/hyperscript-i18n-pl.global.js +4 -4
- package/dist/hyperscript-i18n-pt.global.js +4 -4
- package/dist/hyperscript-i18n-qu.global.js +4 -4
- package/dist/hyperscript-i18n-ru.global.js +4 -4
- package/dist/hyperscript-i18n-slavic.global.js +4 -4
- package/dist/hyperscript-i18n-south-asian.global.js +4 -4
- package/dist/hyperscript-i18n-southeast-asian.global.js +4 -4
- package/dist/hyperscript-i18n-sw.global.js +4 -4
- package/dist/hyperscript-i18n-th.global.js +4 -4
- package/dist/hyperscript-i18n-tl.global.js +4 -4
- package/dist/hyperscript-i18n-tr.global.js +4 -4
- package/dist/hyperscript-i18n-uk.global.js +4 -4
- package/dist/hyperscript-i18n-vi.global.js +4 -4
- package/dist/hyperscript-i18n-western.global.js +4 -4
- package/dist/hyperscript-i18n-zh.global.js +4 -4
- package/dist/hyperscript-i18n.global.js +73 -7
- package/dist/hyperscript-i18n.global.js.map +1 -1
- package/package.json +1 -1
- package/src/hyperscript-renderer.ts +3 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var HyperscriptI18n=(function(exports){'use strict';var bt=Object.defineProperty,kt=Object.getOwnPropertyNames,we=(o,e)=>function(){return o&&(e=(0, o[kt(o)[0]])(o=0)),e},Pt=(o,e)=>{for(var t in e)bt(o,t,{get:e[t],enumerable:true});};function ke(o,e){return o.replace(/\{(\w+)\}/g,(t,r)=>String(e[r]??`{${r}}`))}function w(o,e,t={},r){let i=Ae[o],n=ke(i,t),s=Ce[o],a=s?ke(s,t):void 0;return {code:o,message:n,severity:e,...r&&{role:r},...a&&{suggestion:a}}}var h,Ae,Ce,Rt=we({"src/generators/schema-error-codes.ts"(){h={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"},Ae={[h.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[h.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[h.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[h.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[h.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[h.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.",[h.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.",[h.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[h.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[h.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[h.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[h.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[h.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition."},Ce={[h.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[h.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[h.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[h.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[h.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[h.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[h.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[h.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[h.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[h.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition."};}}),_e={};Pt(_e,{SchemaErrorCodes:()=>h,formatValidationResults:()=>Nt,getValidationStats:()=>It,validateAllSchemas:()=>Ot,validateCommandSchema:()=>xe});function wt(o,e){return {action:o,items:e,get notes(){return e.filter(t=>t.severity==="note").map(t=>t.message)},get warnings(){return e.filter(t=>t.severity==="warning").map(t=>t.message)},get errors(){return e.filter(t=>t.severity==="error").map(t=>t.message)}}}function xe(o){let e=[];for(let r of o.roles)r.expectedTypes.includes("literal")&&r.expectedTypes.includes("selector")&&(r.role==="patient"&&se.has(o.action)?e.push(w(h.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:r.role,command:o.action},r.role)):e.push(w(h.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:r.role},r.role))),r.expectedTypes.length>3&&!se.has(o.action)&&e.push(w(h.TOO_MANY_EXPECTED_TYPES,"warning",{role:r.role,count:r.expectedTypes.length},r.role));switch(o.action){case "transition":At(o,e);break;case "on":Ct(o,e);break;case "if":case "unless":_t(o,e);break;case "repeat":case "for":case "while":xt(o,e);break}return o.roles.filter(r=>r.required).length===0&&(Oe.has(o.action)?e.push(w(h.NO_REQUIRED_ROLES_EXPECTED,"note",{command:o.action})):e.push(w(h.NO_REQUIRED_ROLES,"warning",{}))),wt(o.action,e)}function At(o,e){let t=o.roles.find(i=>i.role==="patient"),r=o.roles.find(i=>i.role==="goal");t&&t.expectedTypes.includes("selector")&&e.push(w(h.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),t&&!r&&e.push(w(h.TRANSITION_MISSING_GOAL,"error",{}));}function Ct(o,e){let t=o.roles.find(r=>r.role==="event");t||e.push(w(h.EVENT_HANDLER_MISSING_EVENT,"warning",{})),t&&!t.required&&e.push(w(h.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function _t(o,e){let t=o.roles.find(r=>r.role==="condition");t||e.push(w(h.CONDITIONAL_MISSING_CONDITION,"warning",{})),t&&!t.required&&e.push(w(h.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function xt(o,e){o.action==="for"?o.roles.find(r=>r.role==="source")||e.push(w(h.FOR_LOOP_MISSING_SOURCE,"warning",{})):o.action==="while"&&(o.roles.find(r=>r.role==="condition")||e.push(w(h.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function Ot(o,e={}){let t=new Map,{includeNotes:r=false}=e;for(let[i,n]of Object.entries(o)){let s=xe(n),a=s.items.some(u=>u.severity==="warning"||u.severity==="error"),l=r&&s.items.some(u=>u.severity==="note");(a||l)&&t.set(i,s);}return t}function Nt(o,e={}){let t=[],{showNotes:r=false,showCodes:i=true}=e;for(let[n,s]of o){let a=s.items.filter(c=>c.severity==="error"),l=s.items.filter(c=>c.severity==="warning"),u=s.items.filter(c=>c.severity==="note");if(a.length>0){t.push(` \u274C ${n}:`);for(let c of a){let p=i?` [${c.code}]`:"";t.push(` ERROR${p}: ${c.message}`),c.suggestion&&t.push(` \u{1F4A1} Suggestion: ${c.suggestion}`);}}if(l.length>0){t.push(` \u26A0\uFE0F ${n}:`);for(let c of l){let p=i?` [${c.code}]`:"";t.push(` ${p?`${c.code}: `:""}${c.message}`),c.suggestion&&t.push(` \u{1F4A1} ${c.suggestion}`);}}if(r&&u.length>0){t.push(` \u2139\uFE0F ${n}:`);for(let c of u){let p=i?` [${c.code}]`:"";t.push(` ${p?`${c.code}: `:""}${c.message}`);}}}return t.join(`
|
|
2
|
-
`)}function It(o){let e=0,t=0,r=0,i={};for(let n of o.values())for(let s of n.items)s.severity==="error"?e++:s.severity==="warning"?t++:s.severity==="note"&&r++,i[s.code]=(i[s.code]||0)+1;return {totalCommands:o.size,errors:e,warnings:t,notes:r,byCode:i}}var se,Oe,Mt=we({"src/generators/schema-validator.ts"(){Rt(),se=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),Oe=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep"]);}}),Lt=new Map,qt=new Map,Ne=new Map;function Dt(o,e,t){Lt.set(o,e),qt.set(o,t),Ne.delete(o);}var $t=new Map;function Vt(o,e){$t.set(o,e),Ne.delete(o);}var Bt=class{constructor(o,e){this.pos=0,this.tokens=o,this.language=e;}peek(o=0){let e=this.pos+o;return e<0||e>=this.tokens.length?null:this.tokens[e]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(o){this.pos=o.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(o){let e=[];for(;!this.isAtEnd()&&o(this.peek());)e.push(this.advance());return e}skipWhile(o){for(;!this.isAtEnd()&&o(this.peek());)this.advance();}};function T(o,e){return {start:o,end:e}}function E(o,e,t,r){if(typeof r=="string")return {value:o,kind:e,position:t,normalized:r};if(r){let{normalized:i,stem:n,stemConfidence:s}=r;return {value:o,kind:e,position:t,...i!==void 0&&{normalized:i},...n!==void 0&&{stem:n},...s!==void 0&&{stemConfidence:s}}}return {value:o,kind:e,position:t}}function U(o){return /\s/.test(o)}function Ie(o){return o==="#"||o==="."||o==="["||o==="@"||o==="*"||o==="<"}function Me(o){return o==='"'||o==="'"||o==="`"||o==="\u300C"||o==="\u300D"}function _(o){return /\d/.test(o)}function zt(o){return /[a-zA-Z]/.test(o)}function b(o){return /[a-zA-Z0-9_-]/.test(o)}function Gt(o,e){if(e>=o.length)return null;let t=o[e];if(!Ie(t))return null;let r=e,i="";if(t==="#"||t==="."){for(i+=o[r++];r<o.length&&b(o[r]);)i+=o[r++];if(i.length<=1)return null;if(r<o.length&&o[r]==="."&&t==="#"){let s=r+1;for(;s<o.length&&b(o[s]);)s++;if(s<o.length&&o[s]==="(")return i}}else if(t==="["){let n=1,s=false,a=null,l=false;for(i+=o[r++];r<o.length&&n>0;){let u=o[r];i+=u,l?l=false:u==="\\"?l=true:s?u===a&&(s=false,a=null):u==='"'||u==="'"||u==="`"?(s=true,a=u):u==="["?n++:u==="]"&&n--,r++;}if(n!==0)return null}else if(t==="@"){for(i+=o[r++];r<o.length&&b(o[r]);)i+=o[r++];if(i.length<=1)return null}else if(t==="*"){for(i+=o[r++];r<o.length&&b(o[r]);)i+=o[r++];if(i.length<=1)return null}else if(t==="<"){if(i+=o[r++],r>=o.length||!zt(o[r]))return null;for(;r<o.length&&b(o[r]);)i+=o[r++];for(;r<o.length;){let n=o[r];if(n==="."){if(i+=o[r++],r>=o.length||!b(o[r]))return null;for(;r<o.length&&b(o[r]);)i+=o[r++];}else if(n==="#"){if(i+=o[r++],r>=o.length||!b(o[r]))return null;for(;r<o.length&&b(o[r]);)i+=o[r++];}else if(n==="["){let s=1,a=false,l=null,u=false;for(i+=o[r++];r<o.length&&s>0;){let c=o[r];i+=c,u?u=false:c==="\\"?u=true:a?c===l&&(a=false,l=null):c==='"'||c==="'"||c==="`"?(a=true,l=c):c==="["?s++:c==="]"&&s--,r++;}if(s!==0)return null}else break}for(;r<o.length&&U(o[r]);)i+=o[r++];if(r<o.length&&o[r]==="/")for(i+=o[r++];r<o.length&&U(o[r]);)i+=o[r++];if(r>=o.length||o[r]!==">")return null;i+=o[r++];}return i||null}function Le(o,e){if(e>=o.length||o[e]!=="'"||e+1>=o.length||o[e+1].toLowerCase()!=="s")return false;if(e+2>=o.length)return true;let r=o[e+2];return U(r)||r==="*"||!b(r)}function Ft(o,e){if(e>=o.length)return null;let t=o[e];if(!Me(t)||t==="'"&&Le(o,e))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[t];if(!i)return null;let n=e+1,s=t,a=false;for(;n<o.length;){let l=o[n];if(s+=l,a)a=false;else if(l==="\\")a=true;else if(l===i)return s;n++;}return s}function qe(o,e){if(e>=o.length)return false;let t=o[e],r=o[e+1]||"",i=o[e+2]||"";if(t==="/"&&r!=="/"&&/[a-zA-Z0-9._-]/.test(r)||t==="/"&&r==="/"&&/[a-zA-Z]/.test(i)||t==="."&&(r==="/"||r==="."&&i==="/"))return true;let n=o.slice(e,e+8).toLowerCase();return !!(n.startsWith("http://")||n.startsWith("https://"))}function Ut(o,e){if(!qe(o,e))return null;let t=e,r="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;t<o.length;){let n=o[t];if(n==="#"){if(r.length>0&&/[a-zA-Z0-9/.]$/.test(r))for(r+=n,t++;t<o.length&&/[a-zA-Z0-9_-]/.test(o[t]);)r+=o[t++];break}if(i.test(n))r+=n,t++;else break}return r.length<2?null:r}function Ht(o,e){if(e>=o.length)return null;let t=o[e];if(!_(t)&&t!=="-"&&t!=="+")return null;let r=e,i="";if((o[r]==="-"||o[r]==="+")&&(i+=o[r++]),r>=o.length||!_(o[r]))return null;for(;r<o.length&&_(o[r]);)i+=o[r++];if(r<o.length&&o[r]===".")for(i+=o[r++];r<o.length&&_(o[r]);)i+=o[r++];return r<o.length&&(o.slice(r,r+2)==="ms"?i+="ms":(o[r]==="s"||o[r]==="m"||o[r]==="h")&&(i+=o[r])),i}var De=class $e{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map;}tryPropertyAccess(e,t,r){if(e[t]!==".")return false;let i=r[r.length-1],n=i&&i.position.end<t;if(i&&!n&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return r.push(E(".","operator",T(t,t+1))),true;let l=t+1;for(;l<e.length&&b(e[l]);)l++;return l<e.length&&e[l]==="("?(r.push(E(".","operator",T(t,t+1))),true):false}initializeKeywordsFromProfile(e,t=[]){let r=new Map;if(e.keywords){for(let[i,n]of Object.entries(e.keywords))if(r.set(n.primary,{native:n.primary,normalized:n.normalized||i}),n.alternatives)for(let s of n.alternatives)r.set(s,{native:s,normalized:n.normalized||i});}if(e.references){for(let[i,n]of Object.entries(e.references))r.set(n,{native:n,normalized:i});for(let i of Object.keys(e.references))r.has(i)||r.set(i,{native:i,normalized:i});}if(e.roleMarkers){for(let[i,n]of Object.entries(e.roleMarkers))if(n.primary&&r.set(n.primary,{native:n.primary,normalized:i}),n.alternatives)for(let s of n.alternatives)r.set(s,{native:s,normalized:i});}for(let i of t)r.set(i.native,i);this.profileKeywords=Array.from(r.values()).sort((i,n)=>n.native.length-i.native.length),this.profileKeywordMap=new Map;for(let i of this.profileKeywords){this.profileKeywordMap.set(i.native.toLowerCase(),i);let n=this.removeDiacritics(i.native);n!==i.native&&!this.profileKeywordMap.has(n.toLowerCase())&&this.profileKeywordMap.set(n.toLowerCase(),i);}}removeDiacritics(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(e,t){for(let r of this.profileKeywords)if(e.slice(t).startsWith(r.native))return E(r.native,"keyword",T(t,t+r.native.length),r.normalized);return null}isKeywordStart(e,t){let r=e.slice(t);return this.profileKeywords.some(i=>r.startsWith(i.native))}lookupKeyword(e){return this.profileKeywordMap.get(e.toLowerCase())}isKeyword(e){return this.profileKeywordMap.has(e.toLowerCase())}setNormalizer(e){this.normalizer=e;}tryNormalize(e){if(!this.normalizer)return null;let t=this.normalizer.normalize(e);return t.stem!==e&&t.confidence>=.7?t:null}tryMorphKeywordMatch(e,t,r){let i=this.tryNormalize(e);if(!i)return null;let n=this.lookupKeyword(i.stem);if(!n)return null;let s={normalized:n.normalized,stem:i.stem,stemConfidence:i.confidence};return E(e,"keyword",T(t,r),s)}trySelector(e,t){let r=Gt(e,t);return r?E(r,"selector",T(t,t+r.length)):null}tryEventModifier(e,t){if(e[t]!==".")return null;let r=e.slice(t).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!r)return null;let i=r[0].replace(/(\s|\.)$/,""),n=i.slice(1).split("(")[0],s=r[1];return {...E(i,"event-modifier",T(t,t+i.length)),metadata:{modifierName:n,value:s?n==="queue"?s:parseInt(s,10):void 0}}}tryString(e,t){let r=Ft(e,t);return r?E(r,"literal",T(t,t+r.length)):null}tryNumber(e,t){let r=Ht(e,t);return r?E(r,"literal",T(t,t+r.length)):null}tryMatchTimeUnit(e,t,r,i=false){let n=t;if(i)for(;n<e.length&&U(e[n]);)n++;let s=e.slice(n);for(let a of r){let l=s.slice(0,a.length);if(a.caseInsensitive?l.toLowerCase()===a.pattern.toLowerCase():l===a.pattern){if(a.notFollowedBy&&(s[a.length]||"")===a.notFollowedBy)continue;if(a.checkBoundary){let c=s[a.length]||"";if(b(c))continue}return {suffix:a.suffix,endPos:n+a.length}}}return null}parseBaseNumber(e,t,r=true){let i=t,n="";if(r&&(e[i]==="-"||e[i]==="+")&&(n+=e[i++]),i>=e.length||!_(e[i]))return null;for(;i<e.length&&_(e[i]);)n+=e[i++];if(i<e.length&&e[i]===".")for(n+=e[i++];i<e.length&&_(e[i]);)n+=e[i++];return !n||n==="-"||n==="+"?null:{number:n,endPos:i}}tryNumberWithTimeUnits(e,t,r,i={}){let{allowSign:n=true,skipWhitespace:s=false}=i,a=this.parseBaseNumber(e,t,n);if(!a)return null;let{number:l,endPos:u}=a,c=[...r,...$e.STANDARD_TIME_UNITS],p=this.tryMatchTimeUnit(e,u,c,s);return p&&(l+=p.suffix,u=p.endPos),E(l,"literal",T(t,u))}tryUrl(e,t){let r=Ut(e,t);return r?E(r,"url",T(t,t+r.length)):null}tryVariableRef(e,t){if(e[t]!==":"||t+1>=e.length||!b(e[t+1]))return null;let r=t+1;for(;r<e.length&&b(e[r]);)r++;let i=e.slice(t,r);return E(i,"identifier",T(t,r))}tryOperator(e,t){let r=e.slice(t,t+2);if(["==","!=","<=",">=","&&","||","->"].includes(r))return E(r,"operator",T(t,t+2));let i=e[t];return ["<",">","!","+","-","*","/","="].includes(i)?E(i,"operator",T(t,t+1)):["(",")","{","}",",",";",":"].includes(i)?E(i,"punctuation",T(t,t+1)):null}tryMultiCharParticle(e,t,r){for(let i of r)if(e.slice(t,t+i.length)===i)return E(i,"particle",T(t,t+i.length));return null}};De.STANDARD_TIME_UNITS=[{pattern:"ms",suffix:"ms",length:2},{pattern:"s",suffix:"s",length:1,checkBoundary:true},{pattern:"m",suffix:"m",length:1,checkBoundary:true,notFollowedBy:"s"},{pattern:"h",suffix:"h",length:1,checkBoundary:true}];var Wt=De,ae={code:"en",name:"English",nativeName:"English",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"base",verb:{position:"start",subjectDrop:false},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"},go:{primary:"go"},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"}}},jt=[{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"}],Kt=class extends Wt{constructor(){super(),this.language="en",this.direction="ltr",this.initializeKeywordsFromProfile(ae,jt);}tokenize(o){let e=[],t=0;for(;t<o.length;){if(U(o[t])){t++;continue}if(Ie(o[t])){let n=this.tryEventModifier(o,t);if(n){e.push(n),t=n.position.end;continue}if(o[t]==="."){let a=e[e.length-1],l=a&&a.position.end<t;if(a&&!l&&(a.kind==="identifier"||a.kind==="keyword"||a.kind==="selector")){e.push(E(".","operator",T(t,t+1))),t++;continue}let p=t+1;for(;p<o.length&&b(o[p]);)p++;if(p<o.length&&o[p]==="("){e.push(E(".","operator",T(t,t+1))),t++;continue}}let s=this.trySelector(o,t);if(s){e.push(s),t=s.position.end;continue}}if(Me(o[t])){if(o[t]==="'"&&Le(o,t)){e.push(E("'s","punctuation",T(t,t+2))),t+=2;continue}let n=this.tryString(o,t);if(n){e.push(n),t=n.position.end;continue}}if(qe(o,t)){let n=this.tryUrl(o,t);if(n){e.push(n),t=n.position.end;continue}}if(_(o[t])||o[t]==="-"&&t+1<o.length&&_(o[t+1])){let n=this.tryNumber(o,t);if(n){e.push(n),t=n.position.end;continue}}let r=this.tryVariableRef(o,t);if(r){e.push(r),t=r.position.end;continue}if(b(o[t])){let n=this.extractWord(o,t);if(n){e.push(n),t=n.position.end;continue}}let i=this.tryOperator(o,t);if(i){e.push(i),t=i.position.end;continue}t++;}return new Bt(e,"en")}classifyToken(o){return this.isKeyword(o)?"keyword":o.startsWith("#")||o.startsWith(".")||o.startsWith("[")||o.startsWith("*")||o.startsWith("<")?"selector":o.startsWith('"')||o.startsWith("'")||/^\d/.test(o)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(o)?"operator":o.startsWith("/")||o.startsWith("./")||o.startsWith("http")?"url":"identifier"}extractWord(o,e){let t=e,r="";for(;t<o.length&&b(o[t]);)r+=o[t++];if(!r)return null;if(t<o.length&&o[t]===":"){let a=t;t++;let l="";for(;t<o.length&&b(o[t]);)l+=o[t++];l?r=r+":"+l:t=a;}let i=this.classifyToken(r),n=this.lookupKeyword(r),s=n&&n.normalized!==n.native?n.normalized:void 0;if(i==="identifier"){let a=this.tryConvertToClassSelector(o,t,r);if(a)return a.token}return E(r,i,T(e,t),s)}tryConvertToClassSelector(o,e,t){let r=e;for(;r<o.length&&/\s/.test(o[r]);)r++;if(o.slice(r,r+5).toLowerCase()==="class"){let i=r+5;if(i>=o.length||!b(o[i])){let n="."+t;return {token:E(n,"selector",T(e-t.length,e)),endPos:e}}}return null}},Yt=new Kt,Qt={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:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","INVALID_CSS_PROPERTY"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"toggle command requires an argument"},{condition:"Class names are valid CSS identifiers",errorCode:"NO_VALID_CLASS_NAMES",message:"toggle command: no valid class names found"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to toggle",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",INVALID_CSS_PROPERTY:"Check CSS property name syntax (use kebab-case)"}},Xt={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:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","PROPERTY_REQUIRES_VALUE"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"add command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to add",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",PROPERTY_REQUIRES_VALUE:"When adding a property (*prop), provide a value argument"}},Zt={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to remove",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},Jt={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:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"into"}}],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"}},er={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:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ja:"\u3092",ko:"\uB97C",tr:"i",ar:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The value to set",required:true,expectedTypes:["literal","expression","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"\xE0",de:"auf",id:"ke",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",ar:"\u0625\u0644\u0649",sw:"kwenye",tl:"sa",bn:"\u09A4\u09C7",qu:"man"}}],errorCodes:["MISSING_TARGET","INVALID_TARGET","MISSING_VALUE","INVALID_SYNTAX"],preconditions:[{condition:"Command has a target variable or property",errorCode:"MISSING_TARGET",message:"set command requires a target"},{condition:"Target is a valid variable or property reference",errorCode:"INVALID_TARGET",message:"set command target must be a string or object literal"},{condition:'Value is specified with "to" keyword',errorCode:"MISSING_VALUE",message:'set command requires a value (use "to" keyword)'}],recoveryHints:{MISSING_TARGET:"Add a target: set :variable to value OR set element.property to value",INVALID_TARGET:'Use local variable (:name), element property (el.prop), or "the X of Y" syntax',MISSING_VALUE:'Add "to <value>" to specify what to set',INVALID_SYNTAX:"Use syntax: set <target> to <value>"}},tr={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to show",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},rr={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to hide",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},or={action:"on",description:"Handle an event",category:"event",primaryRole:"event",hasBody:true,roles:[{role:"event",description:"The event to handle",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to listen on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},nr={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:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},ir={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"Duration or event to wait for",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},sr={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",roles:[{role:"source",description:"The URL to fetch from",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,renderOverride:{en:""}},{role:"responseType",description:"Response format (json, text, html, blob, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"method",description:"HTTP method (GET, POST, etc.)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3},{role:"destination",description:"Where to store the result",required:false,expectedTypes:["selector","reference"],svoPosition:4,sovPosition:4}]},ar={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to increment",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},lr={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to decrement",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},cr={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to append",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},ur={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to prepend",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},pr={action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to log",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},dr={action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",roles:[{role:"source",description:"The source to get from",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",ja:"\u3092",zh:"",ko:"\uB97C",ar:"\u0639\u0644\u0649",tr:"i",id:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"destination",description:"Where to store the result (optional)",required:false,expectedTypes:["reference"],svoPosition:2,sovPosition:1}]},mr={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:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to take from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},fr={action:"make",description:"Create a new element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element type or selector to create",required:true,expectedTypes:["literal","selector"],svoPosition:1,sovPosition:1}]},vr={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:false,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},hr={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:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},yr={action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The error message or object to throw",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},gr={action:"send",description:"Send an event to an element",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to send",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to",ja:"\u306B",ar:"\u0625\u0644\u0649",es:"a",ko:"\uC5D0\uAC8C",zh:"\u5230",tr:"-e",pt:"para",fr:"\xE0",de:"an",id:"ke",qu:"-man",sw:"kwa"}}]},Tr={action:"if",description:"Conditional execution",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Er={action:"unless",description:"Negated conditional execution (executes when condition is false)",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate (body executes when false)",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Sr={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},br={action:"repeat",description:"Repeat a block of commands",category:"control-flow",primaryRole:"loopType",hasBody:true,roles:[{role:"loopType",description:"Loop variant: forever, times, for, while, until, until-event",required:true,expectedTypes:["literal"],svoPosition:0,sovPosition:0},{role:"quantity",description:"Number of times to repeat",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"event",description:"Event to wait for (terminates loop)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"source",description:"Element to listen for event on",required:false,expectedTypes:["selector","reference"],svoPosition:3,sovPosition:3}],notes:'Can also use "repeat forever", "repeat until condition", or "repeat until event X from Y"'},kr={action:"for",description:"Iterate over a collection",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The iteration variable",required:true,expectedTypes:["reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The collection to iterate over",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"in"}}]},Pr={action:"while",description:"Loop while condition is true",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to check",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Rr={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},wr={action:"go",description:"Navigate to a URL",category:"navigation",primaryRole:"destination",roles:[{role:"destination",description:"The URL to navigate to",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"},renderOverride:{en:""}}]},Ar={action:"transition",description:"Transition an element with animation",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The property to transition (opacity, *background-color, etc.)",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2,markerOverride:{en:"",ar:"",tl:"",sw:""}},{role:"goal",description:"The target value to transition to",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:3,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man",es:"a",pt:"para",fr:"\xE0",de:"auf",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",id:"ke"}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:3,sovPosition:1},{role:"duration",description:"Transition duration (over 500ms, for 2 seconds)",required:false,expectedTypes:["literal"],svoPosition:4,sovPosition:4,markerOverride:{en:"over"}},{role:"style",description:"Easing function (ease-in, linear, etc.)",required:false,expectedTypes:["literal"],svoPosition:5,sovPosition:5}]},Cr={action:"clone",description:"Clone an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to clone",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"destination",description:"Where to put the clone",required:false,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"into"}}]},_r={action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to focus (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},xr={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:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Or={action:"call",description:"Call a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The function to call",required:true,expectedTypes:["expression","reference"],svoPosition:1,sovPosition:1}]},Nr={action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The value to return",required:false,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},Ir={action:"js",description:"Execute raw JavaScript code",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The JavaScript code to execute",required:false,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Mr={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},Lr={action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",hasBody:true,roles:[{role:"destination",description:"The element to tell",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}}]},qr={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:true,expectedTypes:["reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ar:"",tl:"",sw:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The default value",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man"}}]},Dr={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},$r={action:"behavior",description:"Define a reusable behavior",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The behavior name (PascalCase identifier)",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},Vr={action:"install",description:"Install a behavior on an element",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The behavior name to install",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"Element to install on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Br={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:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"source",description:"Element to measure (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},zr={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:false,expectedTypes:["literal"],svoPosition:1,sovPosition:3,markerOverride:{en:""}},{role:"destination",description:"The element to swap content in/for",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"of"}},{role:"patient",description:"The content to swap in (optional for delete)",required:false,expectedTypes:["literal","expression","selector"],svoPosition:3,sovPosition:2,markerOverride:{en:"with"}}]},Gr={action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"destination",roles:[{role:"destination",description:"The element to morph",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}},{role:"patient",description:"The target content/element to morph into",required:true,expectedTypes:["literal","expression","selector"],svoPosition:2,sovPosition:2,markerOverride:{en:"to"}}]},Fr={action:"beep",description:"Debug output for expressions with type information",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The expression(s) to debug",required:false,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},Ur={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Hr={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:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},Wr={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},jr={action:"pick",description:"Select a random element from a collection",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The items to pick from",required:true,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1},{role:"source",description:'The array to pick from (with "from" keyword)',required:false,expectedTypes:["reference","expression"],svoPosition:2,sovPosition:2}]},Kr={action:"render",description:"Render a template with optional variables",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The template to render",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"style",description:"Variables to pass to the template (with keyword)",required:false,expectedTypes:["expression","reference"],svoPosition:2,sovPosition:1}]},Ve={toggle:Qt,add:Xt,remove:Zt,put:Jt,set:er,show:tr,hide:rr,on:or,trigger:nr,wait:ir,fetch:sr,increment:ar,decrement:lr,append:cr,prepend:ur,log:pr,get:dr,take:mr,make:fr,halt:vr,settle:hr,throw:yr,send:gr,if:Tr,unless:Er,else:Sr,repeat:br,for:kr,while:Pr,continue:Rr,go:wr,transition:Ar,clone:Cr,focus:_r,blur:xr,call:Or,return:Nr,js:Ir,async:Mr,tell:Lr,default:qr,init:Dr,behavior:$r,install:Vr,measure:Br,swap:zr,morph:Gr,beep:Fr,break:Ur,copy:Hr,exit:Wr,pick:jr,render:Kr,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function Yr(){return Object.values(Ve).filter(o=>o.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(Mt(),_e)).then(({validateAllSchemas:o,formatValidationResults:e})=>{let t=o(Ve);t.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(t)),console.warn(`
|
|
3
|
-
These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(o=>{console.debug("Schema validation skipped:",o);});function Be(o,e){let t=e==="SOV"?"sovPosition":"svoPosition";return [...o].sort((r,i)=>{let n=r[t]??99,s=i[t]??99;return n-s})}function Qr(o,e){let t=o.markerOverride?.[e.code],r=e.roleMarkers[o.role];if(t!==void 0)return {primary:t,position:r?.position??"before",isOverride:true};if(r&&r.primary){let i={primary:r.primary,position:r.position,isOverride:false};return r.alternatives&&(i.alternatives=r.alternatives),i}return null}function Xr(o,e,t,r,i){let n=[];if(n.push({type:"role",role:"event",optional:false}),r.position==="after"){let u=r.primary.split(/\s+/);if(u.length>1)for(let c of u)n.push({type:"literal",value:c});else {let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(c);}}let s=e.roleMarkers.destination;s&&n.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary}]}),n.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.patient;if(a){let u=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};n.push(u);}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return n.push(l),{id:`${o.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`{event} ${r.primary} {destination?} {patient} ${a?.primary||""} ${t.primary}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Zr(o,e,t,r,i){let n=[];n.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let l=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};n.push(l);}if(n.push({type:"role",role:"event",optional:false}),r.position==="after"){let l=r.primary.split(/\s+/);if(l.length>1)for(let u of l)n.push({type:"literal",value:u});else {let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(u);}}let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return n.push(a),{id:`${o.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`{patient} ${s?.primary||""} {event} ${r.primary} ${t.primary}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Jr(o,e,t,r,i){let n=[];n.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let u=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};n.push(u);}let a=e.roleMarkers.destination;if(a&&(n.push({type:"role",role:"destination",optional:false}),n.push(a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary})),n.push({type:"role",role:"event",optional:false}),r.position==="after"){let u=r.primary.split(/\s+/);if(u.length>1)for(let c of u)n.push({type:"literal",value:c});else {let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(c);}}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return n.push(l),{id:`${o.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(i.basePriority??100)+40,template:{format:`{patient} ${s?.primary||""} {destination} ${a?.primary||""} {event} ${r.primary} ${t.primary}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function eo(o,e,t,r,i){let n=[];n.push({type:"role",role:"event",optional:false});let s=r.alternatives?.filter(c=>!c.includes(" ")&&c.length>1)||[];s.length>0&&n.push({type:"literal",value:s[0],alternatives:s.slice(1)});let a=e.roleMarkers.destination;a&&n.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary}]}),n.push({type:"role",role:"patient",optional:false});let l=e.roleMarkers.patient;if(l){let c=l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary};n.push(c);}let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return n.push(u),{id:`${o.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(i.basePriority??100)+52,template:{format:`{event}${s[0]||""} {patient} ${t.primary}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function to(o,e,t,r,i){let n=[];if(n.push({type:"role",role:"event",optional:false}),r.position==="after"){let a=r.primary.split(/\s+/);if(a.length>1)for(let l of a)n.push({type:"literal",value:l});else {let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(l);}}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return n.push(s),{id:`${o.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{event} ${r.primary} ${t.primary}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function ro(o,e,t,r){let i=e.eventHandler?.temporalMarkers;if(!i||i.length===0)return null;let n=[];n.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&n.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),n.push({type:"literal",value:i[0],alternatives:i.slice(1)}),n.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s?.primary){let l=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};n.push(l);}let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return n.push(a),{id:`${o.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(r.basePriority??100)+49,template:{format:`{event} ${i[0]} {patient} ${t.primary}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function oo(o,e,t,r,i){let n=[];if(n.push({type:"role",role:"event",optional:false}),r.position==="after"){let c=r.primary.split(/\s+/);if(c.length>1)for(let p of c)n.push({type:"literal",value:p});else {let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(p);}}let a=[...o.roles.filter(c=>c.required)].sort((c,p)=>{let d=c.sovPosition??999,m=p.sovPosition??999;return d-m});for(let c of a){n.push({type:"role",role:c.role,optional:false});let p,d;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)p=c.markerOverride[e.code];else {let m=e.roleMarkers[c.role];m&&(p=m.primary,d=m.alternatives);}if(p){let m=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};n.push(m);}}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(l);let u=a.map(c=>`{${c.role}}`).join(" ");return {id:`${o.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`{event} ${r.primary} ${u} ${t.primary}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},...Object.fromEntries(a.map(c=>[c.role,{fromRole:c.role}]))}}}function no(o,e,t,r,i){let n=[],a=[...o.roles.filter(f=>f.required)].sort((f,v)=>{let k=f.sovPosition??999,S=v.sovPosition??999;return k-S}),l=a[0];n.push({type:"role",role:l.role,optional:false});let u;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)u=l.markerOverride[e.code];else {let f=e.roleMarkers[l.role];f&&(u=f.primary);}if(u&&n.push({type:"literal",value:u}),n.push({type:"role",role:"event",optional:false}),r.position==="after"){let f=r.primary.split(/\s+/);if(f.length>1)for(let v of f)n.push({type:"literal",value:v});else {let v=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(v);}}let c=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(c);let p=a[1];n.push({type:"role",role:p.role,optional:false});let d,m;if(p.markerOverride&&p.markerOverride[e.code]!==void 0)d=p.markerOverride[e.code];else {let f=e.roleMarkers[p.role];f&&(d=f.primary,m=f.alternatives);}if(d){let f=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};n.push(f);}return {id:`${o.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{${l.role}} {event} ${r.primary} ${t.primary} {${p.role}}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},[l.role]:{fromRole:l.role},[p.role]:{fromRole:p.role}}}}function Pe(o,e,t,r,i){let n=[];if(r.position==="before"){let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(l);}n.push({type:"role",role:"event",optional:false});let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(s),n.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.destination;return a&&n.push({type:"group",optional:true,tokens:[a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary},{type:"role",role:"destination",optional:true}]}),{id:`${o.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`${r.primary} {event} ${t.primary} {patient} ${a?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function io(o,e,t,r,i){let n=[],s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(s),n.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.destination;if(a&&n.push({type:"group",optional:true,tokens:[a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary},{type:"role",role:"destination",optional:true}]}),r.position==="before"){let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(l);}return n.push({type:"role",role:"event",optional:false}),{id:`${o.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`${t.primary} {patient} ${a?.primary||""} {destination?} ${r.primary} {event}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function so(o,e,t,r,i){let n=[],s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(s);let l=[...o.roles.filter(c=>c.required)].sort((c,p)=>{let d=c.svoPosition??999,m=p.svoPosition??999;return d-m});for(let c of l){let p,d;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)p=c.markerOverride[e.code];else {let m=e.roleMarkers[c.role];m&&(p=m.primary,d=m.alternatives);}if(p){let m=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};n.push(m);}n.push({type:"role",role:c.role,optional:false});}if(r.position==="before"){let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(c);}n.push({type:"role",role:"event",optional:false});let u=l.map(c=>`{${c.role}}`).join(" ");return {id:`${o.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${t.primary} ${u} ${r.primary} {event}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},...Object.fromEntries(l.map(c=>[c.role,{fromRole:c.role}]))}}}function Re(o,e,t,r,i){let n=[];if(r.position==="before"){let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(c);}n.push({type:"role",role:"event",optional:false});let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(s);let l=[...o.roles.filter(c=>c.required)].sort((c,p)=>{let d=c.svoPosition??999,m=p.svoPosition??999;return d-m});for(let c of l){let p,d;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)p=c.markerOverride[e.code];else {let m=e.roleMarkers[c.role];m&&(p=m.primary,d=m.alternatives);}if(p){let m=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};n.push(m);}n.push({type:"role",role:c.role,optional:false});}let u=l.map(c=>`{${c.role}}`).join(" ");return {id:`${o.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`${r.primary} {event} ${t.primary} ${u}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},...Object.fromEntries(l.map(c=>[c.role,{fromRole:c.role}]))}}}function ao(o,e,t,r,i){let n=[],s=e.eventHandler?.negationMarker;if(r.position==="before"){let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(u);}if(s){let u=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};n.push(u);}n.push({type:"role",role:"event",optional:false});let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(a),n.push({type:"role",role:"patient",optional:false});let l=e.roleMarkers.destination;return l&&n.push({type:"group",optional:true,tokens:[l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary},{type:"role",role:"destination",optional:true}]}),{id:`${o.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${r.primary} ${s?.primary||""} {event} ${t.primary} {patient} ${l?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function lo(o,e,t,r){let i=[];i.push({type:"literal",value:"and",alternatives:["then"]}),i.push({type:"role",role:"event",optional:false});let n=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(n),i.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&i.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),{id:`${o.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(r.basePriority??100)+45,template:{format:`[proclitic?] {event} ${t.primary} {patient} ${s?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var H={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function ze(o,e,t=H){let r=`${o.action}-${e.code}-generated`,i=t.basePriority??100,n=e.keywords[o.action];if(!n)throw new Error(`No keyword translation for '${o.action}' in ${e.code}`);let s=fo(o,e,n),a=Ge(o,e),l=go(o,e,n);return {id:r,language:e.code,command:o.action,priority:i,template:{format:l,tokens:s},extraction:a}}function co(o,e,t=H){if(o.roles.filter(a=>!a.required).length===0)return null;let i=o.roles.filter(a=>a.required),n={...o,roles:i};return {...ze(n,e,t),id:`${o.action}-${e.code}-simple`,priority:(t.basePriority??100)-5,extraction:Ge(o,e)}}function uo(o,e,t=H){let r=[];if(r.push(ze(o,e,t)),t.generateSimpleVariants){let i=co(o,e,t);i&&r.push(i);}return r}function po(o,e=H){let t=[],r=Yr();for(let i of r){if(!o.keywords[i.action])continue;let n=uo(i,o,e);if(t.push(...n),o.eventHandler?.eventMarker){let s=mo(i,o,e);t.push(...s);}}return t}function mo(o,e,t=H){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let r=[],i=e.eventHandler.eventMarker,n=e.keywords[o.action];if(!n)return [];let a=o.roles.filter(l=>l.required).length===2;if(e.wordOrder==="SOV")if(a)r.push(oo(o,e,n,i,t)),r.push(no(o,e,n,i,t));else {r.push(Xr(o,e,n,i,t)),r.push(Zr(o,e,n,i,t));let l=e.roleMarkers.destination;l&&l.primary!==i.primary&&r.push(Jr(o,e,n,i,t));let u=i.primary.split(/\s+/),c=i.alternatives?.some(d=>!d.includes(" ")&&d.length>1);u.length>1&&c&&r.push(eo(o,e,n,i,t)),r.push(to(o,e,n,i,t));let p=ro(o,e,n,t);p&&r.push(p);}else e.wordOrder==="VSO"?a?(r.push(Re(o,e,n,i,t)),r.push(so(o,e,n,i,t))):(r.push(Pe(o,e,n,i,t)),r.push(io(o,e,n,i,t)),e.eventHandler?.negationMarker&&r.push(ao(o,e,n,i,t)),e.tokenization?.prefixes&&r.push(lo(o,e,n,t))):a?r.push(Re(o,e,n,i,t)):r.push(Pe(o,e,n,i,t));return r}function fo(o,e,t){let r=[],i=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary},n=vo(o,e);switch(e.wordOrder){case "SVO":r.push(i),r.push(...n);break;case "SOV":r.push(...n),r.push(i);break;case "VSO":r.push(i),r.push(...n);break;default:r.push(i),r.push(...n);}return r}function vo(o,e){let t=[],r=Be(o.roles,e.wordOrder);for(let i of r){let n=ho(i,e);i.required?t.push(...n):t.push({type:"group",optional:true,tokens:n});}return t}function ho(o,e){let t=[],r=o.markerOverride?.[e.code],i=e.roleMarkers[o.role],n={type:"role",role:o.role,optional:!o.required,expectedTypes:o.expectedTypes};if(r!==void 0)(i?.position??"before")==="before"?(r&&t.push({type:"literal",value:r}),t.push(n)):(t.push(n),r&&t.push({type:"literal",value:r}));else if(i)if(i.position==="before"){if(i.primary){let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};t.push(s);}t.push(n);}else {t.push(n);let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};t.push(s);}else t.push(n);return t}function yo(o,e){let t={};for(let r of o.roles){let i=r.markerOverride?.[e.code],n=e.roleMarkers[r.role];i!==void 0?t[r.role]=i?{marker:i}:{}:n&&n.primary?t[r.role]=n.alternatives?{marker:n.primary,markerAlternatives:n.alternatives}:{marker:n.primary}:t[r.role]={};}return t}function Ge(o,e){let t=yo(o,e),r={};for(let i of o.roles){let n=t[i.role]||{};!i.required&&i.default?r[i.role]={...n,default:i.default}:r[i.role]=n;}return r}function go(o,e,t){let r=[],n=Be(o.roles,e.wordOrder).map(s=>{let a=Qr(s,e),l="";return a&&a.primary?a.position==="before"?l=`${a.primary} {${s.role}}`:l=`{${s.role}} ${a.primary}`:l=`{${s.role}}`,s.required?l:`[${l}]`});switch(e.wordOrder){case "SVO":case "VSO":r.push(t.primary,...n);break;case "SOV":r.push(...n,t.primary);break;default:r.push(t.primary,...n);}return r.join(" ")}function To(){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:true,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"}}}}]}function Eo(){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"}}}}]}function So(){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}}}]}var bo={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"}}},ko={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}}},Po={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}}},Ro={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"}}}},wo={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"}}}},Ao={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"}}},Co={id:"for-en-basic",language:"en",command:"for",priority:100,template:{format:"for {patient} in {source}",tokens:[{type:"literal",value:"for"},{type:"role",role:"patient",expectedTypes:["expression","reference"]},{type:"literal",value:"in"},{type:"role",role:"source",expectedTypes:["selector","expression","reference"]}]},extraction:{patient:{position:1},source:{marker:"in"},loopType:{default:{type:"literal",value:"for"}}}},_o={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}}},xo={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}}},Oo={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}}},No={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}}};function Io(){let o=[];o.push(...To()),o.push(...Eo()),o.push(...So()),o.push(bo,ko,Po,Ro,wo,Ao,Co,_o,xo,Oo,No);let e=po(ae);return o.push(...e),o}Dt("en",Yt,ae);Vt("en",Io());var Mo=Object.defineProperty,Lo=Object.getOwnPropertyNames,Xe=(o,e)=>function(){return o&&(e=(0, o[Lo(o)[0]])(o=0)),e},qo=(o,e)=>{for(var t in e)Mo(o,t,{get:e[t],enumerable:true});};function Fe(o,e){return o.replace(/\{(\w+)\}/g,(t,r)=>String(e[r]??`{${r}}`))}function A(o,e,t={},r){let i=Ze[o],n=Fe(i,t),s=Je[o],a=s?Fe(s,t):void 0;return {code:o,message:n,severity:e,...r&&{role:r},...a&&{suggestion:a}}}var y,Ze,Je,Do=Xe({"src/generators/schema-error-codes.ts"(){y={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"},Ze={[y.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[y.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[y.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[y.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[y.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[y.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.",[y.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.",[y.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[y.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[y.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[y.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[y.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[y.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition."},Je={[y.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[y.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[y.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[y.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[y.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[y.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[y.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[y.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[y.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[y.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition."};}}),et={};qo(et,{SchemaErrorCodes:()=>y,formatValidationResults:()=>Uo,getValidationStats:()=>Ho,validateAllSchemas:()=>Fo,validateCommandSchema:()=>tt});function $o(o,e){return {action:o,items:e,get notes(){return e.filter(t=>t.severity==="note").map(t=>t.message)},get warnings(){return e.filter(t=>t.severity==="warning").map(t=>t.message)},get errors(){return e.filter(t=>t.severity==="error").map(t=>t.message)}}}function tt(o){let e=[];for(let r of o.roles)r.expectedTypes.includes("literal")&&r.expectedTypes.includes("selector")&&(r.role==="patient"&&pe.has(o.action)?e.push(A(y.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:r.role,command:o.action},r.role)):e.push(A(y.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:r.role},r.role))),r.expectedTypes.length>3&&!pe.has(o.action)&&e.push(A(y.TOO_MANY_EXPECTED_TYPES,"warning",{role:r.role,count:r.expectedTypes.length},r.role));switch(o.action){case "transition":Vo(o,e);break;case "on":Bo(o,e);break;case "if":case "unless":zo(o,e);break;case "repeat":case "for":case "while":Go(o,e);break}return o.roles.filter(r=>r.required).length===0&&(rt.has(o.action)?e.push(A(y.NO_REQUIRED_ROLES_EXPECTED,"note",{command:o.action})):e.push(A(y.NO_REQUIRED_ROLES,"warning",{}))),$o(o.action,e)}function Vo(o,e){let t=o.roles.find(i=>i.role==="patient"),r=o.roles.find(i=>i.role==="goal");t&&t.expectedTypes.includes("selector")&&e.push(A(y.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),t&&!r&&e.push(A(y.TRANSITION_MISSING_GOAL,"error",{}));}function Bo(o,e){let t=o.roles.find(r=>r.role==="event");t||e.push(A(y.EVENT_HANDLER_MISSING_EVENT,"warning",{})),t&&!t.required&&e.push(A(y.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function zo(o,e){let t=o.roles.find(r=>r.role==="condition");t||e.push(A(y.CONDITIONAL_MISSING_CONDITION,"warning",{})),t&&!t.required&&e.push(A(y.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function Go(o,e){o.action==="for"?o.roles.find(r=>r.role==="source")||e.push(A(y.FOR_LOOP_MISSING_SOURCE,"warning",{})):o.action==="while"&&(o.roles.find(r=>r.role==="condition")||e.push(A(y.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function Fo(o,e={}){let t=new Map,{includeNotes:r=false}=e;for(let[i,n]of Object.entries(o)){let s=tt(n),a=s.items.some(u=>u.severity==="warning"||u.severity==="error"),l=r&&s.items.some(u=>u.severity==="note");(a||l)&&t.set(i,s);}return t}function Uo(o,e={}){let t=[],{showNotes:r=false,showCodes:i=true}=e;for(let[n,s]of o){let a=s.items.filter(c=>c.severity==="error"),l=s.items.filter(c=>c.severity==="warning"),u=s.items.filter(c=>c.severity==="note");if(a.length>0){t.push(` \u274C ${n}:`);for(let c of a){let p=i?` [${c.code}]`:"";t.push(` ERROR${p}: ${c.message}`),c.suggestion&&t.push(` \u{1F4A1} Suggestion: ${c.suggestion}`);}}if(l.length>0){t.push(` \u26A0\uFE0F ${n}:`);for(let c of l){let p=i?` [${c.code}]`:"";t.push(` ${p?`${c.code}: `:""}${c.message}`),c.suggestion&&t.push(` \u{1F4A1} ${c.suggestion}`);}}if(r&&u.length>0){t.push(` \u2139\uFE0F ${n}:`);for(let c of u){let p=i?` [${c.code}]`:"";t.push(` ${p?`${c.code}: `:""}${c.message}`);}}}return t.join(`
|
|
4
|
-
`)}function Ho(o){let e=0,t=0,r=0,i={};for(let n of o.values())for(let s of n.items)s.severity==="error"?e++:s.severity==="warning"?t++:s.severity==="note"&&r++,i[s.code]=(i[s.code]||0)+1;return {totalCommands:o.size,errors:e,warnings:t,notes:r,byCode:i}}var pe,rt,Wo=Xe({"src/generators/schema-validator.ts"(){Do(),pe=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),rt=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep"]);}});function j(o){let e="complex";return o.startsWith("#")&&!o.includes(" ")?e="id":o.startsWith(".")&&!o.includes(" ")?e="class":o.startsWith("[")&&o.endsWith("]")?e="attribute":/^[a-z][a-z0-9]*$/i.test(o)&&(e="element"),{type:"selector",value:o,selectorKind:e}}function P(o,e){let t={type:"literal",value:o};return e!==void 0?{type:"literal",value:o,dataType:e}:t}var jo=new Set(["me","you","it","result","event","target","body"]);function Ue(o){return jo.has(o)}function I(o){return {type:"reference",value:o}}function le(o,e){return {type:"property-path",object:o,property:e}}function J(o,e,t){let r={kind:"command",action:o,roles:new Map(Object.entries(e))};return t!==void 0?{...r,metadata:t}:r}function He(o,e,t,r,i,n){let s=new Map;s.set("event",o);let a={kind:"event-handler",action:"on",roles:s,body:e};return t!==void 0&&(a.eventModifiers=t),r!==void 0&&(a.metadata=r),a}function We(o,e="then",t){let r={kind:"compound",action:"compound",roles:new Map,statements:o,chainType:e};return t!==void 0&&(r.metadata=t),r}function je(o,e){return !e||e.length===0||e.includes(o)||e.includes("expression")?true:o==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):false}function Ko(o,e){return o.possessive?.keywords?.[e]}var $=new Map,V=new Map,ee=new Map,de=null;function ot(o,e){let t={...o};for(let r of Object.keys(e)){let i=e[r],n=o[r];i!==void 0&&(typeof i=="object"&&i!==null&&!Array.isArray(i)&&typeof n=="object"&&n!==null&&!Array.isArray(n)?t[r]=ot(n,i):t[r]=i);}return t}function Yo(o,e){return ot(o,e)}function fe(o){if(!o.extends)return o;let e=V.get(o.extends);if(!e)return console.warn(`[Registry] Profile '${o.code}' extends '${o.extends}' but base is not registered. Make sure to import the base language before the variant.`),o;let t=fe(e);return Yo(t,o)}function nt(o){de=o;}var Ke=new Map;function B(o){return o.split("-")[0]}function z(o){return o.includes("-")}function Qo(o){let e=$.get(o);if(!e&&z(o)){let t=B(o);e=$.get(t);}if(!e){let t=Array.from($.keys()).join(", ");throw new Error(`Language '${o}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${o}';`)}return e}function Xo(o){let e=V.get(o);if(!e&&z(o)){let t=B(o);e=V.get(t);}if(!e){let t=Array.from(V.keys()).join(", ");throw new Error(`Language profile '${o}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${o}';`)}return fe(e)}function Zo(o){let e=$.get(o);return !e&&z(o)&&(e=$.get(B(o))),e}function M(o){let e=V.get(o);return !e&&z(o)&&(e=V.get(B(o))),e?fe(e):void 0}function it(){return Array.from($.keys())}function Jo(o,e){return Qo(e).tokenize(o)}function D(o){let e=ee.get(o);if(!e&&z(o)&&(e=ee.get(B(o))),e)return e;let t=Ke.get(o);if(!t&&z(o)&&(t=Ke.get(B(o))),t)return ee.set(o,t),t;if(!de)throw new Error(`No patterns registered for language '${o}'. Either import the language module or set a pattern generator.`);let r=Xo(o),i=de(r);return ee.set(o,i),i}var te=class W{constructor(){this.stemMatchCount=0,this.totalKeywordMatches=0;}matchPattern(e,t){let r=e.mark(),i=new Map;if(this.currentProfile=M(t.language),this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(e,t.template.tokens,i))return e.reset(r),null;let s=this.calculateConfidence(t,i);return this.applyExtractionRules(t,i),{pattern:t,captured:i,consumedTokens:e.position()-r.position,confidence:s}}matchBest(e,t){let r=[];for(let n of t){let s=e.mark(),a=this.matchPattern(e,n);a&&r.push(a),e.reset(s);}if(r.length===0)return null;r.sort((n,s)=>{let a=s.pattern.priority-n.pattern.priority;return a!==0?a:s.confidence-n.confidence});let i=r[0];return this.matchPattern(e,i.pattern),i}matchTokenSequence(e,t,r){let i=t[0],n=i?.type==="literal"&&(i.value==="and"||i.value==="then"||i.alternatives?.includes("and")||i.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!n)for(;e.peek()?.kind==="conjunction";)e.advance();for(let s of t)if(!this.matchPatternToken(e,s,r)){if(this.isOptional(s))continue;return false}return true}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 false}}matchLiteralToken(e,t){let r=e.peek();if(!r)return false;let i=this.getMatchType(r,t.value);if(i!=="none")return this.totalKeywordMatches++,i==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let n of t.alternatives){let s=this.getMatchType(r,n);if(s!=="none")return this.totalKeywordMatches++,s==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,t,r){this.skipNoiseWords(e);let i=e.peek();if(!i)return t.optional||false;let n=this.tryMatchPossessiveExpression(e);if(n)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(n.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(r.set(t.role,n),true);let s=this.tryMatchMethodCallExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(s.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(r.set(t.role,s),true);let a=this.tryMatchPossessiveSelectorExpression(e);if(a)return t.expectedTypes&&t.expectedTypes.length>0&&!je(a.type,t.expectedTypes)?t.optional||false:(r.set(t.role,a),true);let l=this.tryMatchPropertyAccessExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(l.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(r.set(t.role,l),true);let u=this.tryMatchSelectorPropertyExpression(e);if(u)return t.expectedTypes&&t.expectedTypes.length>0&&!je(u.type,t.expectedTypes)?t.optional||false:(r.set(t.role,u),true);let c=this.tokenToSemanticValue(i);return !c||t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(c.type)?t.optional||false:(r.set(t.role,c),e.advance(),true)}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let r=(t.normalized||t.value).toLowerCase(),i=Ko(this.currentProfile,r);if(!i)return null;let n=e.mark();e.advance();let s=e.peek();if(!s)return e.reset(n),null;if(s.kind==="identifier"||s.kind==="keyword"&&!this.isStructuralKeyword(s.value)||s.kind==="selector"&&s.value.startsWith("*")||s.kind==="selector"&&s.value.startsWith("@")||s.kind==="selector"&&s.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s.value)){e.advance();let a=s.value;s.kind==="selector"&&a.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(a)&&(a=a.substring(1));let l=a;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)l+=e.peek().value,e.advance();let u=e.peek();return u?.kind==="literal"&&u.value.startsWith("(")&&(l+=u.value,e.advance()),le(I(i),l)}return 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())}tryMatchMethodCallExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let r=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(r),null;e.advance();let n=e.peek();if(!n||n.kind!=="identifier")return e.reset(r),null;e.advance();let s=e.peek();if(!s||s.kind!=="punctuation"||s.value!=="(")return e.reset(r),null;e.advance();let a=[];for(;!e.isAtEnd()&&a.length<W.MAX_METHOD_ARGS;){let u=e.peek();if(!u)break;if(u.kind==="punctuation"&&u.value===")"){e.advance();break}if(u.kind==="punctuation"&&u.value===","){e.advance();continue}a.push(u.value),e.advance();}return {type:"expression",raw:`${t.value}.${n.value}(${a.join(", ")})`}}tryMatchPropertyAccessExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"&&t.kind!=="keyword")return null;let r=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(r),null;e.advance();let n=e.peek();if(!n||n.kind!=="identifier")return e.reset(r),null;e.advance();let s=`${t.value}.${n.value}`,a=1;for(;!e.isAtEnd()&&a<W.MAX_PROPERTY_DEPTH;){let u=e.peek();if(!u||u.kind!=="operator"||u.value!==".")break;e.advance();let c=e.peek();if(!c||c.kind!=="identifier")break;e.advance(),s+=`.${c.value}`,a++;}let l=e.peek();if(l&&l.kind==="punctuation"&&l.value==="("){e.advance();let u=[],c=0;for(;!e.isAtEnd()&&u.length<W.MAX_METHOD_ARGS;){let d=e.peek();if(!d)break;if(d.kind==="punctuation"&&d.value===")"){if(c===0){e.advance();break}c--;}if(d.kind==="punctuation"&&d.value==="("&&c++,d.kind==="punctuation"&&d.value===","){e.advance();continue}u.push(d.value),e.advance();}return {type:"expression",raw:`${s}(${u.join(", ")})`}}return {type:"expression",raw:s}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let r=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="punctuation"||i.value!=="'s")return e.reset(r),null;e.advance();let n=e.peek();return !n||n.kind!=="selector"&&n.kind!=="identifier"?(e.reset(r),null):(e.advance(),le(j(t.value),n.value))}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||!t.value.startsWith("#"))return null;let r=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="selector"||!i.value.startsWith("."))return e.reset(r),null;let n=e.peek(1);n&&n.kind,e.advance();let s=i.value.slice(1);return le(j(t.value),s)}matchGroupToken(e,t,r){let i=e.mark(),n=new Set(r.keys());if(!this.matchTokenSequence(e,t.tokens,r)){e.reset(i);for(let a of r.keys())n.has(a)||r.delete(a);return t.optional||false}return true}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem===t&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&e.value.toLowerCase()===t.toLowerCase()?"case-insensitive":"none"}tokenToSemanticValue(e){switch(e.kind){case "selector":return j(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=(e.normalized||e.value).toLowerCase();return Ue(t)?I(t):P(e.normalized||e.value);case "identifier":if(e.value.startsWith(":"))return I(e.value);let r=e.value.toLowerCase();return Ue(r)?I(r):{type:"expression",raw:e.value};case "url":return P(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let i=e.slice(1,-1);return P(i,"string")}if(e==="true")return P(true,"boolean");if(e==="false")return P(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let i=parseFloat(t[1]);return t[2]?P(e,"duration"):P(i,"number")}let r=parseFloat(e);return isNaN(r)?P(e,"string"):P(r,"number")}applyExtractionRules(e,t){for(let[r,i]of Object.entries(e.extraction))t.has(r)||(i.value!==void 0?t.set(r,{type:"literal",value:i.value}):i.default&&t.set(r,i.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,t){let r=0,i=0,n=u=>e.extraction?.[u]?.default!==void 0;for(let u of e.template.tokens)if(u.type==="role")i+=1,t.has(u.role)&&(r+=1);else if(u.type==="group"){for(let c of u.tokens)if(c.type==="role"){let p=n(c.role),d=.8;i+=d,t.has(c.role)?r+=d:p&&(r+=d*.6);}}let s=i>0?r/i:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){let u=this.stemMatchCount/this.totalKeywordMatches*.15;s=Math.max(.5,s-u);}let a=this.calculateVSOConfidenceBoost(e);s=Math.min(1,s+a);let l=this.arabicPrepositionDisambiguation(e,t);return s=Math.max(0,Math.min(1,s+l)),s}calculateVSOConfidenceBoost(e){if(e.language!=="ar")return 0;let t=e.template.tokens[0];if(!t||t.type!=="literal")return 0;let r=new Set(["\u0628\u062F\u0644","\u063A\u064A\u0631","\u0623\u0636\u0641","\u0623\u0632\u0644","\u0636\u0639","\u0627\u062C\u0639\u0644","\u0639\u064A\u0646","\u0632\u062F","\u0627\u0646\u0642\u0635","\u0633\u062C\u0644","\u0623\u0638\u0647\u0631","\u0623\u062E\u0641","\u0634\u063A\u0644","\u0623\u0631\u0633\u0644","\u0631\u0643\u0632","\u0634\u0648\u0634","\u062A\u0648\u0642\u0641","\u0627\u0646\u0633\u062E","\u0627\u062D\u0630\u0641","\u0627\u0635\u0646\u0639","\u0627\u0646\u062A\u0638\u0631","\u0627\u0646\u062A\u0642\u0627\u0644","\u0623\u0648"]);if(r.has(t.value))return .15;if(t.alternatives){for(let i of t.alternatives)if(r.has(i))return .15}return 0}arabicPrepositionDisambiguation(e,t){if(e.language!=="ar")return 0;let r=0,i={patient:["\u0639\u0644\u0649"],destination:["\u0625\u0644\u0649","\u0627\u0644\u0649"],source:["\u0645\u0646"],agent:["\u0645\u0646"],manner:["\u0628"],style:["\u0628"],goal:["\u0625\u0644\u0649","\u0627\u0644\u0649"],method:["\u0628"]};for(let[n,s]of t.entries()){let a=i[n];if(!a||a.length===0)continue;let l="metadata"in s?s.metadata:void 0;if(l&&typeof l.prepositionValue=="string"){let u=l.prepositionValue;a.includes(u)?r+=.1:r-=.1;}}return Math.max(-0.1,Math.min(.1,r))}skipNoiseWords(e){let t=e.peek();if(!t)return;let r=t.value.toLowerCase();if(W.ENGLISH_NOISE_WORDS.has(r)){let i=e.mark();e.advance();let n=e.peek();if(n&&n.kind==="selector")return;e.reset(i);}r==="class"&&e.advance();}extractEventModifiers(e){let t={},r=false;for(;!e.isAtEnd();){let i=e.peek();if(!i||i.kind!=="event-modifier")break;let n=i.metadata;if(!n)break;switch(r=true,n.modifierName){case "once":t.once=true;break;case "debounce":typeof n.value=="number"&&(t.debounce=n.value);break;case "throttle":typeof n.value=="number"&&(t.throttle=n.value);break;case "queue":(n.value==="first"||n.value==="last"||n.value==="all"||n.value==="none")&&(t.queue=n.value);break}e.advance();}return r?t:void 0}};te.MAX_PROPERTY_DEPTH=10;te.MAX_METHOD_ARGS=20;te.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var st=te,q=new st,ce=class{constructor(o,e){this.pos=0,this.tokens=o,this.language=e;}peek(o=0){let e=this.pos+o;return e<0||e>=this.tokens.length?null:this.tokens[e]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(o){this.pos=o.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(o){let e=[];for(;!this.isAtEnd()&&o(this.peek());)e.push(this.advance());return e}skipWhile(o){for(;!this.isAtEnd()&&o(this.peek());)this.advance();}};function tn(o){return Zo(o)}function ue(o,e){return Jo(o,e)}function at(){return it()}var rn={ko:{\uD074\uB9AD:"click",\uC785\uB825:"input",\uBCC0\uACBD:"change",\uC81C\uCD9C:"submit",\uD0A4\uB2E4\uC6B4:"keydown",\uD0A4\uC5C5:"keyup",\uB9C8\uC6B0\uC2A4\uC624\uBC84:"mouseover",\uB9C8\uC6B0\uC2A4\uC544\uC6C3:"mouseout",\uB9C8\uC6B0\uC2A4\uB2E4\uC6B4:"mousedown",\uB9C8\uC6B0\uC2A4\uC5C5:"mouseup",\uD3EC\uCEE4\uC2A4:"focus",\uBE14\uB7EC:"blur",\uB85C\uB4DC:"load",\uB9AC\uC0AC\uC774\uC988:"resize",\uC2A4\uD06C\uB864:"scroll"},ja:{\u30AF\u30EA\u30C3\u30AF:"click",\u5165\u529B:"input",\u5909\u66F4:"change",\u9001\u4FE1:"submit",\u30AD\u30FC\u30C0\u30A6\u30F3:"keydown",\u30AD\u30FC\u30A2\u30C3\u30D7:"keyup",\u30AD\u30FC\u30D7\u30EC\u30B9:"keypress",\u30DE\u30A6\u30B9\u30AA\u30FC\u30D0\u30FC:"mouseover",\u30DE\u30A6\u30B9\u30A2\u30A6\u30C8:"mouseout",\u30DE\u30A6\u30B9\u62BC\u4E0B:"mousedown",\u30DE\u30A6\u30B9\u89E3\u653E:"mouseup",\u30D5\u30A9\u30FC\u30AB\u30B9:"focus",\u30D6\u30E9\u30FC:"blur",\u30ED\u30FC\u30C9:"load",\u8AAD\u307F\u8FBC\u307F:"load",\u30B5\u30A4\u30BA\u5909\u66F4:"resize",\u30B9\u30AF\u30ED\u30FC\u30EB:"scroll"},ar:{\u0627\u0644\u0646\u0642\u0631:"click",\u0646\u0642\u0631:"click",\u0627\u0644\u0625\u062F\u062E\u0627\u0644:"input",\u0625\u062F\u062E\u0627\u0644:"input",\u0627\u0644\u062A\u063A\u064A\u064A\u0631:"change",\u062A\u063A\u064A\u064A\u0631:"change",\u0627\u0644\u0625\u0631\u0633\u0627\u0644:"submit",\u0625\u0631\u0633\u0627\u0644:"submit","\u0636\u063A\u0637 \u0627\u0644\u0645\u0641\u062A\u0627\u062D":"keydown","\u0631\u0641\u0639 \u0627\u0644\u0645\u0641\u062A\u0627\u062D":"keyup","\u062A\u0645\u0631\u064A\u0631 \u0627\u0644\u0645\u0627\u0648\u0633":"mouseover",\u0627\u0644\u062A\u0631\u0643\u064A\u0632:"focus",\u062A\u062D\u0645\u064A\u0644:"load",\u062A\u0645\u0631\u064A\u0631:"scroll"},es:{clic:"click",click:"click",entrada:"input",cambio:"change",env\u00EDo:"submit",enviar:"submit","tecla abajo":"keydown","tecla arriba":"keyup","rat\xF3n encima":"mouseover","rat\xF3n fuera":"mouseout",enfoque:"focus",desenfoque:"blur",carga:"load",desplazamiento:"scroll"},tr:{t\u0131klama:"click",t\u0131kla:"click",t\u0131k:"click",giri\u015F:"input",girdi:"input",de\u011Fi\u015Fiklik:"change",de\u011Fi\u015Fim:"change",g\u00F6nderme:"submit",g\u00F6nder:"submit",tu\u015Fbasma:"keydown",tu\u015Fb\u0131rakma:"keyup",fare_bas:"mousedown",fare_b\u0131rak:"mouseup",farei\u00E7inde:"mouseover",fared\u0131\u015F\u0131nda:"mouseout",odaklanma:"focus",odak:"focus",bulan\u0131kl\u0131k:"blur",y\u00FCkleme:"load",y\u00FCkle:"load",boyut_de\u011Fi\u015Ftir:"resize",kayd\u0131rma:"scroll"},pt:{clique:"click",clicar:"click",click:"click",entrada:"input",inserir:"input",mudan\u00E7a:"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:{\u70B9\u51FB:"click",\u5355\u51FB:"click",\u53CC\u51FB:"dblclick",\u8F93\u5165:"input",\u6539\u53D8:"change",\u53D8\u5316:"change",\u53D8\u66F4:"change",\u63D0\u4EA4:"submit",\u53D1\u9001:"submit",\u6309\u952E:"keydown",\u952E\u5165:"keydown",\u677E\u952E:"keyup",\u9F20\u6807\u8FDB\u5165:"mouseover",\u9F20\u6807\u79FB\u5165:"mouseover",\u9F20\u6807\u79BB\u5F00:"mouseout",\u9F20\u6807\u79FB\u51FA:"mouseout",\u7126\u70B9:"focus",\u805A\u7126:"focus",\u5931\u7126:"blur",\u6A21\u7CCA:"blur",\u52A0\u8F7D:"load",\u8F7D\u5165:"load",\u6EDA\u52A8:"scroll"},fr:{clic:"click",cliquer:"click",click:"click",saisie:"input",entr\u00E9e:"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\u00E9focus:"blur",d\u00E9focaliser:"blur",chargement:"load",charger:"load",d\u00E9filement:"scroll",d\u00E9filer:"scroll"},de:{klick:"click",klicken:"click",click:"click",eingabe:"input",eingeben:"input",\u00E4nderung:"change",\u00E4ndern:"change",absenden:"submit",einreichen:"submit","taste runter":"keydown","taste hoch":"keyup","maus \xFCber":"mouseover","maus raus":"mouseout",fokus:"focus",fokussieren:"focus",defokussieren:"blur",unsch\u00E4rfe:"blur",laden:"load",ladung:"load",scrollen:"scroll",bl\u00E4ttern:"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:{\u0995\u09CD\u09B2\u09BF\u0995:"click",\u0987\u09A8\u09AA\u09C1\u099F:"input",\u099C\u09AE\u09BE:"submit",\u09B2\u09CB\u09A1:"load",\u09B8\u09CD\u0995\u09CD\u09B0\u09CB\u09B2:"scroll",\u09B0\u09BF\u09B8\u09BE\u0987\u099C:"resize",\u099D\u09BE\u09AA\u09B8\u09BE:"blur",\u09AB\u09CB\u0995\u09BE\u09B8:"focus",\u09AA\u09B0\u09BF\u09AC\u09B0\u09CD\u09A4\u09A8:"change"},qu:{click:"click","\xF1it'iy":"click",\u00F1itiy:"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"}};var G=class x{parse(e,t){let{modifiers:r,remainingInput:i}=this.extractStandaloneModifiers(e,t),n=i||e,s=ue(n,t),a=D(t);if(a.length===0)throw new Error(`No patterns available for language: ${t}`);let l=[...a].sort((v,k)=>k.priority-v.priority),u=l.filter(v=>v.command==="on"),c=q.matchBest(s,u);if(c){let v=this.buildEventHandler(c,s,t);return r?this.applyModifiers(v,r):v}let p=l.filter(v=>v.command!=="on"),d=q.matchBest(s,p);if(d)return this.buildCommand(d,t);let m=this.trySOVEventExtraction(n,t,l);if(m)return r?this.applyModifiers(m,r):m;let f=this.tryCompoundCommandParsing(s,p,t);if(f)return f;throw new Error(`Could not parse input in ${t}: ${n}`)}canParse(e,t){try{return this.parse(e,t),!0}catch{return false}}supportedLanguages(){return at()}buildCommand(e,t){if(!e)throw new Error("No match to build command from");let r={};for(let[i,n]of e.captured)r[i]=n;return J(e.pattern.command,r,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence})}buildEventHandler(e,t,r){if(!e)throw new Error("No match to build event handler from");let i=e.captured.get("event");if(!i)throw new Error("Event handler pattern matched but no event captured");let n=q.extractEventModifiers(t),s=this.extractOrConjunctionEvents(t,r),a=i;s.length>0&&i.type==="literal"&&(a={type:"literal",value:[String(i.value),...s.map(p=>String("value"in p?p.value:""))].join(" or ")});let l,u=e.captured.get("action");if(u&&u.type==="literal"){let c=u.value,p={};for(let[f,v]of e.captured)f!=="event"&&f!=="action"&&f!=="continues"&&(p[f]=v);let d=J(c,p,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence}),m=e.captured.get("continues");if(m&&m.type==="literal"&&m.value==="then"){let f=D(r).filter(S=>S.command!=="on").sort((S,C)=>C.priority-S.priority),v=D(r).filter(S=>S.id.startsWith("grammar-")&&S.id.includes("-continuation")).sort((S,C)=>C.priority-S.priority),k=this.parseBodyWithGrammarPatterns(t,f,v,r);k.length>0?l=[d,...k]:l=[d];}else l=[d];}else {let c=D(r).filter(p=>p.command!=="on").sort((p,d)=>d.priority-p.priority);l=this.parseBodyWithClauses(t,c,r);}return He(a,l,n,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,t,r){let i=[],n=[];for(;!e.isAtEnd();){let s=e.peek();if(!s)break;let a=s.kind==="conjunction"||s.kind==="keyword"&&this.isThenKeyword(s.value,r),l=s.kind==="keyword"&&this.isEndKeyword(s.value,r);if(a){if(n.length>0){let u=this.parseClause(n,t,r);i.push(...u),n.length=0;}e.advance();continue}if(l){if(n.length>0){let u=this.parseClause(n,t,r);i.push(...u);}e.advance();break}n.push(s),e.advance();}if(n.length>0){let s=this.parseClause(n,t,r);i.push(...s);}return i.length>1?[We(i,"then",{sourceLanguage:r})]:i}parseClause(e,t,r){if(e.length===0)return [];let i=new ce(e,r),n=[];for(;!i.isAtEnd();){let s=q.matchBest(i,t);s?n.push(this.buildCommand(s,r)):i.advance();}if(n.length===0){let s=this.parseSOVClauseByVerbAnchoring(e,r);if(s.length>0)return s}return n}static buildVerbLookup(e){let t=new Map;for(let[r,i]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","for","end","then","and"].includes(r)&&(t.set(i.primary.toLowerCase(),r),i.alternatives))for(let n of i.alternatives)t.set(n.toLowerCase(),r);return t}static buildMarkerToRoleLookup(e){let t=new Map;for(let[r,i]of Object.entries(e.roleMarkers))if(i&&(t.set(i.primary,r),i.alternatives))for(let n of i.alternatives)t.has(n)||t.set(n,r);return t}parseSOVClauseByVerbAnchoring(e,t){let r=M(t);if(!r||r.wordOrder!=="SOV")return [];let i=x.buildVerbLookup(r),n=x.buildMarkerToRoleLookup(r),s=[],a=0;for(;a<e.length;){let l=-1,u="";for(let f=a;f<e.length;f++){let v=e[f],k=i.get(v.value.toLowerCase()),S=v.normalized?i.get(v.normalized.toLowerCase()):void 0,C=k||S;if(C){l=f,u=C;break}}if(l===-1)break;let c=e.slice(a,l),p=e.length;for(let f=l+1;f<e.length;f++){let v=e[f];if(v.kind==="conjunction"||this.isThenKeyword(v.value,t)){p=f;break}if(f>l+1&&(i.get(v.value.toLowerCase())||(v.normalized?i.get(v.normalized.toLowerCase()):void 0))){p=f;break}}let d=e.slice(l+1,p),m=this.extractRolesFromMarkedTokens(c,d,n,u,t);if(s.push(J(u,m,{sourceLanguage:t,confidence:.7})),a=p,a<e.length){let f=e[a];(f.kind==="conjunction"||this.isThenKeyword(f.value,t))&&a++;}}return s}extractRolesFromMarkedTokens(e,t,r,i,n){let s={},a=l=>{let u=[];for(let c of l){let p=r.get(c.value);if(p&&c.kind==="particle"&&u.length>0){let d=this.tokensToSemanticValue(u);if(d){let m=this.mapRoleForCommand(p,i,s);m&&(s[m]=d);}u=[];}else u.push(c);}if(u.length>0){let c=this.tokensToSemanticValue(u);c&&(s.patient?s.destination||(s.destination=c):s.patient=c);}};return a(e),a(t),s}mapRoleForCommand(e,t,r){return r[e]?e==="patient"&&!r.destination?"destination":e==="destination"&&!r.patient?"patient":e==="source"&&!r.source?"source":null:e}tokensToSemanticValue(e){if(e.length===0)return null;let t=e.filter(n=>n.kind!=="whitespace");if(t.length===0)return null;if(t.length===1)return this.tokenToSemanticValue(t[0]);let r=t.map(n=>n.value).join(""),i=t[0];return i.kind==="selector"||i.value.startsWith("#")||i.value.startsWith(".")||i.value.startsWith("@")||i.value.startsWith("*")?j(r):i.kind==="literal"||i.value.startsWith('"')||i.value.startsWith("'")?P(r):i.kind==="reference"?I(r):P(r)}tokenToSemanticValue(e){let t=e.value;if(e.kind==="selector"||t.startsWith("#")||t.startsWith(".")||t.startsWith("@")||t.startsWith("*"))return j(t);if(t.startsWith('"')||t.startsWith("'"))return P(t);if(/^-?\d+(\.\d+)?$/.test(t))return P(parseFloat(t));if(t==="true"||t==="\u771F"||t==="\uCC38"||t==="do\u011Fru")return P(true);if(t==="false"||t==="\u507D"||t==="\uAC70\uC9D3"||t==="yanl\u0131\u015F")return P(false);let r=e.normalized?.toLowerCase();return r==="me"||r==="it"||r==="you"||r==="result"||r==="body"?I(r):e.kind==="reference"?I(e.normalized||"me"):P(t)}parseBodyWithGrammarPatterns(e,t,r,i){let n=[];for(;!e.isAtEnd();){let s=e.peek();if(s&&this.isThenKeyword(s.value,i)){e.advance();continue}if(s&&this.isEndKeyword(s.value,i)){e.advance();break}let a=false;if(r.length>0){let l=q.matchBest(e,r);if(l){let u=l.pattern.command,c={};for(let[m,f]of l.captured)m!=="event"&&m!=="action"&&m!=="continues"&&(c[m]=f);let p=J(u,c,{sourceLanguage:i,patternId:l.pattern.id});n.push(p),a=true;let d=l.captured.get("continues");if(d&&d.type==="literal"&&d.value==="then")continue}}if(!a){let l=q.matchBest(e,t);l&&(n.push(this.buildCommand(l,i)),a=true);}a||e.advance();}return n}tryCompoundCommandParsing(e,t,r){let i=e.tokens;if(!i.some(l=>l.kind==="conjunction"||l.kind==="keyword"&&this.isThenKeyword(l.value,r)))return null;let s=new ce(i,r),a=this.parseBodyWithClauses(s,t,r);return a.length===0?null:a.length===1?a[0]:We(a,"then",{sourceLanguage:r,confidence:.65})}trySOVEventExtraction(e,t,r){let i=x.SOV_EVENT_MARKERS[t];if(!i)return null;let s=ue(e,t).tokens,a=rn[t],l=new Set;if(a)for(let g of Object.keys(a))l.add(g.toLowerCase());let u=x.SOV_SOURCE_MARKERS[t],c=-1,p="",d="",m=1;for(let g=0;g<s.length;g++){let R=s[g],O=R.value.toLowerCase(),N=O,L="",oe=O.indexOf("[");oe>0&&(N=O.slice(0,oe),L=R.value.slice(oe));let ne=R.normalized?.toLowerCase(),Se=ne&&x.KNOWN_EVENTS.has(ne),be=l.has(O)||l.has(N),St=x.KNOWN_EVENTS.has(N);if(Se||be||St){let F;if(Se?F=ne:be?F=a?.[O]??a?.[N]??N:F=N,i.size>0){let X=1,ie=s[g+1];ie&&ie.kind==="selector"&&ie.value.startsWith("[")&&(X=2);let Z=s[g+X];if(Z&&(Z.kind==="particle"||Z.kind==="keyword")&&i.has(Z.value)){c=g,p=F,d=L||(X===2?s[g+1].value:""),m=X+1;break}}else {c=g,p=F,d=L,m=1;break}}}if(c===-1)return null;let f=new Set;for(let g=c;g<c+m;g++)f.add(g);if(u){let g=c+m;if(g<s.length){let R=s[g];(R.kind==="particle"||R.kind==="keyword")&&u.markers.has(R.value)&&f.add(g);}for(let R=0;R<c;R++){let O=s[R],N=O.value.toLowerCase(),L=O.normalized?.toLowerCase();if(u.windowTokens.has(N)||L&&u.windowTokens.has(L)){f.add(R);break}}}let v=s.filter((g,R)=>!f.has(R));if(v.length===0)return null;let k=r.filter(g=>g.command!=="on"),S=new ce(v,t),C=this.parseBodyWithClauses(S,k,t);if(C.length===0)return null;let Ee={sourceLanguage:t,confidence:.75};return d&&(Ee.keyFilter=d),He({type:"literal",value:p},C,void 0,Ee)}isThenKeyword(e,t){let r={en:new Set(["then"]),ja:new Set(["\u305D\u308C\u304B\u3089","\u6B21\u306B","\u305D\u3057\u3066"]),ar:new Set(["\u062B\u0645","\u0628\u0639\u062F\u0647\u0627","\u062B\u0645\u0651"]),es:new Set(["entonces","luego","despu\xE9s"]),ko:new Set(["\uADF8\uB2E4\uC74C","\uADF8\uB9AC\uACE0","\uADF8\uB7F0\uD6C4","\uADF8\uB7EC\uBA74"]),zh:new Set(["\u7136\u540E","\u63A5\u7740","\u4E4B\u540E"]),tr:new Set(["sonra","ard\u0131ndan","daha sonra"]),pt:new Set(["ent\xE3o","depois","logo"]),fr:new Set(["puis","ensuite","alors"]),de:new Set(["dann","danach","anschlie\xDFend"]),id:new Set(["lalu","kemudian","setelah itu"]),tl:new Set(["pagkatapos","tapos"]),bn:new Set(["\u09A4\u09BE\u09B0\u09AA\u09B0","\u09AA\u09B0\u09C7"]),qu:new Set(["chaymantataq","hinaspa","chaymanta","chayqa"]),sw:new Set(["kisha","halafu","baadaye"])};return (r[t]||r.en).has(e.toLowerCase())}isEndKeyword(e,t){let r={en:new Set(["end"]),ja:new Set(["\u7D42\u308F\u308A","\u7D42\u4E86","\u304A\u308F\u308A"]),ar:new Set(["\u0646\u0647\u0627\u064A\u0629","\u0627\u0646\u062A\u0647\u0649","\u0622\u062E\u0631"]),es:new Set(["fin","final","terminar"]),ko:new Set(["\uB05D","\uC885\uB8CC","\uB9C8\uCE68"]),zh:new Set(["\u7ED3\u675F","\u7EC8\u6B62","\u5B8C"]),tr:new Set(["son","biti\u015F","bitti"]),pt:new Set(["fim","final","t\xE9rmino"]),fr:new Set(["fin","terminer","finir"]),de:new Set(["ende","beenden","fertig"]),id:new Set(["selesai","akhir","tamat"]),tl:new Set(["wakas","tapos"]),bn:new Set(["\u09B8\u09AE\u09BE\u09AA\u09CD\u09A4"]),qu:new Set(["tukukuy","tukuy","puchukay"]),sw:new Set(["mwisho","maliza","tamati"])};return (r[t]||r.en).has(e.toLowerCase())}extractStandaloneModifiers(e,t){let i=ue(e,t).tokens;if(i.length===0)return {modifiers:null,remainingInput:null};let s=i[0].value.toLowerCase(),a=x.STANDALONE_MODIFIERS[s];if(!a)return {modifiers:null,remainingInput:null};let l={},u=1;if(a==="once")l.once=true;else {let m=1;if(m<i.length){let f=i[m];(f.kind==="keyword"||f.kind==="particle")&&(m++,u++);}if(m<i.length){let f=i[m];if(f.kind==="literal"){let v=f.value.match(/^(\d+)(ms|s|m)?$/);if(v){let k=parseInt(v[1],10),S=v[2]||"ms";S==="s"?k*=1e3:S==="m"&&(k*=6e4),l[a]=k,u=m+1;}}}l[a]||(l[a]=a==="debounce"?300:100);}let c=i.slice(u);if(c.length===0)return {modifiers:null,remainingInput:null};let p=c[0].position.start,d=e.slice(p);return {modifiers:l,remainingInput:d}}applyModifiers(e,t){return {...e,eventModifiers:{...e.eventModifiers,...t}}}extractOrConjunctionEvents(e,t){let r=[];for(;;){let i=e.mark(),n=e.peek();if(!n)break;let s=(n.normalized||n.value).toLowerCase();if(!x.OR_KEYWORDS.has(s)){e.reset(i);break}e.advance();let a=e.peek();if(!a){e.reset(i);break}let l=(a.normalized||a.value).toLowerCase();e.advance(),r.push({type:"literal",value:l});}return r}};G.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);G.SOV_EVENT_MARKERS={ja:new Set(["\u3067"]),ko:new Set,tr:new Set(["de","da","te","ta"]),bn:new Set(["\u098F"]),qu:new Set(["pi"])};G.SOV_SOURCE_MARKERS={ja:{markers:new Set(["\u304B\u3089"]),windowTokens:new Set(["\u30A6\u30A3\u30F3\u30C9\u30A6","\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8","window","document"])},ko:{markers:new Set(["\uC5D0\uC11C"]),windowTokens:new Set(["\uCC3D","\uC708\uB3C4\uC6B0","\uBB38\uC11C","window","document"])},tr:{markers:new Set(["den","dan","ten","tan"]),windowTokens:new Set(["pencere","belge","window","document"])},bn:{markers:new Set(["\u09A5\u09C7\u0995\u09C7","\u09AE\u09A7\u09CD\u09AF\u09C7"]),windowTokens:new Set(["\u0989\u0987\u09A8\u09CD\u09A1\u09CB","\u09A1\u0995\u09C1\u09AE\u09C7\u09A8\u09CD\u099F","window","document"])},qu:{markers:new Set(["manta"]),windowTokens:new Set(["k_iri","ventana","window","document"])}};G.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};G.OR_KEYWORDS=new Set(["or","\u0623\u0648","o","ou","oder","atau","atau","\u6216","\u307E\u305F\u306F","\uB610\uB294","veya","\u0985\u09A5\u09AC\u09BE","utaq","au","\u0430\u0431\u043E","\u0438\u043B\u0438","ho\u1EB7c","lub","\u05D0\u05D5","\u0E2B\u0E23\u0E37\u0E2D","o"]);var nn=G,sn=new nn;function ve(o,e){return sn.parse(o,e)}var me=class{constructor(o={}){this.cache=new Map,this.config={maxSize:o.maxSize??1e3,ttlMs:o.ttlMs??0,enabled:o.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(o,e){return `${e}:${o}`}isExpired(o){return this.config.ttlMs===0?false:Date.now()-o.createdAt>this.config.ttlMs}evictLRU(){let o=this.cache.keys().next().value;o!==void 0&&(this.cache.delete(o),this.stats.evictions++);}get(o,e){if(!this.config.enabled){this.stats.misses++;return}let t=this.makeKey(o,e),r=this.cache.get(t);if(!r){this.stats.misses++;return}if(this.isExpired(r)){this.cache.delete(t),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(t),r.lastAccessed=Date.now(),this.cache.set(t,r),this.stats.hits++,r.result}set(o,e,t){if(!this.config.enabled||t.confidence===0)return;let r=this.makeKey(o,e),i=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(r,{result:t,createdAt:i,lastAccessed:i});}has(o,e){if(!this.config.enabled)return false;let t=this.makeKey(o,e),r=this.cache.get(t);return r?this.isExpired(r)?(this.cache.delete(t),this.stats.expirations++,false):true:false}delete(o,e){let t=this.makeKey(o,e);return this.cache.delete(t)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let o=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:o>0?this.stats.hits/o:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(o){if(o.maxSize!==void 0)for(this.config.maxSize=o.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();o.ttlMs!==void 0&&(this.config.ttlMs=o.ttlMs),o.enabled!==void 0&&(this.config.enabled=o.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}},an=new me;var ln=class{constructor(o={}){this.patternMatcher=new st,this.languages=new Set(it()),o.cache===false?this.cache=new me({enabled:false}):this.cache=o.cache?new me(o.cache):an;}analyze(o,e){if(!this.supportsLanguage(e))return {confidence:0,errors:[`Language '${e}' is not supported for semantic parsing`]};let t=this.cache.get(o,e);if(t)return t;let r=this.analyzeUncached(o,e);return this.cache.set(o,e,r),r}analyzeUncached(o,e){try{try{let s=ve(o,e),a={confidence:s.metadata?.confidence??.8,node:s};return s.kind==="command"?{...a,command:{name:s.action,roles:s.roles}}:a}catch{}let t=tn(e);if(!t)return {confidence:0,errors:[`No tokenizer available for language '${e}'`]};let r=t.tokenize(o),i=D(e);if(i.length===0)return {confidence:0,errors:[`No patterns available for language '${e}'`]};let n=this.patternMatcher.matchBest(r,i);if(n){let s=this.buildSemanticNode(n);return {confidence:n.confidence,command:{name:n.pattern.command,roles:n.captured},node:s,tokensConsumed:n.consumedTokens}}return {confidence:0,errors:["No pattern matched the input"]}}catch(t){return {confidence:0,errors:[t instanceof Error?t.message:String(t)]}}}supportsLanguage(o){return this.languages.has(o)}supportedLanguages(){return Array.from(this.languages)}getCacheStats(){return this.cache.getStats()}clearCache(){this.cache.clear();}configureCache(o){this.cache.configure(o);}buildSemanticNode(o){return {kind:"command",action:o.pattern.command,roles:o.captured,metadata:{patternId:o.pattern.id}}}};function lt(o){return new ln(o)}var cn=.5;function ct(o,e=cn){return o.confidence>=e&&o.command!==void 0}var un={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:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","INVALID_CSS_PROPERTY"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"toggle command requires an argument"},{condition:"Class names are valid CSS identifiers",errorCode:"NO_VALID_CLASS_NAMES",message:"toggle command: no valid class names found"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to toggle",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",INVALID_CSS_PROPERTY:"Check CSS property name syntax (use kebab-case)"}},pn={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:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","PROPERTY_REQUIRES_VALUE"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"add command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to add",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",PROPERTY_REQUIRES_VALUE:"When adding a property (*prop), provide a value argument"}},dn={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to remove",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},mn={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:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"into"}}],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"}},fn={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:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ja:"\u3092",ko:"\uB97C",tr:"i",ar:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The value to set",required:true,expectedTypes:["literal","expression","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"\xE0",de:"auf",id:"ke",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",ar:"\u0625\u0644\u0649",sw:"kwenye",tl:"sa",bn:"\u09A4\u09C7",qu:"man"}}],errorCodes:["MISSING_TARGET","INVALID_TARGET","MISSING_VALUE","INVALID_SYNTAX"],preconditions:[{condition:"Command has a target variable or property",errorCode:"MISSING_TARGET",message:"set command requires a target"},{condition:"Target is a valid variable or property reference",errorCode:"INVALID_TARGET",message:"set command target must be a string or object literal"},{condition:'Value is specified with "to" keyword',errorCode:"MISSING_VALUE",message:'set command requires a value (use "to" keyword)'}],recoveryHints:{MISSING_TARGET:"Add a target: set :variable to value OR set element.property to value",INVALID_TARGET:'Use local variable (:name), element property (el.prop), or "the X of Y" syntax',MISSING_VALUE:'Add "to <value>" to specify what to set',INVALID_SYNTAX:"Use syntax: set <target> to <value>"}},vn={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to show",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},hn={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to hide",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},yn={action:"on",description:"Handle an event",category:"event",primaryRole:"event",hasBody:true,roles:[{role:"event",description:"The event to handle",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to listen on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},gn={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:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Tn={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"Duration or event to wait for",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},En={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",roles:[{role:"source",description:"The URL to fetch from",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,renderOverride:{en:""}},{role:"responseType",description:"Response format (json, text, html, blob, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"method",description:"HTTP method (GET, POST, etc.)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3},{role:"destination",description:"Where to store the result",required:false,expectedTypes:["selector","reference"],svoPosition:4,sovPosition:4}]},Sn={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to increment",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},bn={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to decrement",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},kn={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to append",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},Pn={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to prepend",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},Rn={action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to log",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},wn={action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",roles:[{role:"source",description:"The source to get from",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",ja:"\u3092",zh:"",ko:"\uB97C",ar:"\u0639\u0644\u0649",tr:"i",id:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"destination",description:"Where to store the result (optional)",required:false,expectedTypes:["reference"],svoPosition:2,sovPosition:1}]},An={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:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to take from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Cn={action:"make",description:"Create a new element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element type or selector to create",required:true,expectedTypes:["literal","selector"],svoPosition:1,sovPosition:1}]},_n={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:false,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},xn={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:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},On={action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The error message or object to throw",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},Nn={action:"send",description:"Send an event to an element",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to send",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to",ja:"\u306B",ar:"\u0625\u0644\u0649",es:"a",ko:"\uC5D0\uAC8C",zh:"\u5230",tr:"-e",pt:"para",fr:"\xE0",de:"an",id:"ke",qu:"-man",sw:"kwa"}}]},In={action:"if",description:"Conditional execution",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Mn={action:"unless",description:"Negated conditional execution (executes when condition is false)",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate (body executes when false)",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Ln={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},qn={action:"repeat",description:"Repeat a block of commands",category:"control-flow",primaryRole:"loopType",hasBody:true,roles:[{role:"loopType",description:"Loop variant: forever, times, for, while, until, until-event",required:true,expectedTypes:["literal"],svoPosition:0,sovPosition:0},{role:"quantity",description:"Number of times to repeat",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"event",description:"Event to wait for (terminates loop)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"source",description:"Element to listen for event on",required:false,expectedTypes:["selector","reference"],svoPosition:3,sovPosition:3}],notes:'Can also use "repeat forever", "repeat until condition", or "repeat until event X from Y"'},Dn={action:"for",description:"Iterate over a collection",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The iteration variable",required:true,expectedTypes:["reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The collection to iterate over",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"in"}}]},$n={action:"while",description:"Loop while condition is true",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to check",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Vn={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},Bn={action:"go",description:"Navigate to a URL",category:"navigation",primaryRole:"destination",roles:[{role:"destination",description:"The URL to navigate to",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"},renderOverride:{en:""}}]},zn={action:"transition",description:"Transition an element with animation",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The property to transition (opacity, *background-color, etc.)",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2,markerOverride:{en:"",ar:"",tl:"",sw:""}},{role:"goal",description:"The target value to transition to",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:3,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man",es:"a",pt:"para",fr:"\xE0",de:"auf",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",id:"ke"}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:3,sovPosition:1},{role:"duration",description:"Transition duration (over 500ms, for 2 seconds)",required:false,expectedTypes:["literal"],svoPosition:4,sovPosition:4,markerOverride:{en:"over"}},{role:"style",description:"Easing function (ease-in, linear, etc.)",required:false,expectedTypes:["literal"],svoPosition:5,sovPosition:5}]},Gn={action:"clone",description:"Clone an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to clone",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"destination",description:"Where to put the clone",required:false,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"into"}}]},Fn={action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to focus (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Un={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:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Hn={action:"call",description:"Call a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The function to call",required:true,expectedTypes:["expression","reference"],svoPosition:1,sovPosition:1}]},Wn={action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The value to return",required:false,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},jn={action:"js",description:"Execute raw JavaScript code",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The JavaScript code to execute",required:false,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Kn={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},Yn={action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",hasBody:true,roles:[{role:"destination",description:"The element to tell",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}}]},Qn={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:true,expectedTypes:["reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ar:"",tl:"",sw:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The default value",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man"}}]},Xn={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Zn={action:"behavior",description:"Define a reusable behavior",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The behavior name (PascalCase identifier)",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},Jn={action:"install",description:"Install a behavior on an element",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The behavior name to install",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"Element to install on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},ei={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:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"source",description:"Element to measure (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},ti={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:false,expectedTypes:["literal"],svoPosition:1,sovPosition:3,markerOverride:{en:""}},{role:"destination",description:"The element to swap content in/for",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"of"}},{role:"patient",description:"The content to swap in (optional for delete)",required:false,expectedTypes:["literal","expression","selector"],svoPosition:3,sovPosition:2,markerOverride:{en:"with"}}]},ri={action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"destination",roles:[{role:"destination",description:"The element to morph",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}},{role:"patient",description:"The target content/element to morph into",required:true,expectedTypes:["literal","expression","selector"],svoPosition:2,sovPosition:2,markerOverride:{en:"to"}}]},oi={action:"beep",description:"Debug output for expressions with type information",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The expression(s) to debug",required:false,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},ni={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},ii={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:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},si={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},ai={action:"pick",description:"Select a random element from a collection",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The items to pick from",required:true,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1},{role:"source",description:'The array to pick from (with "from" keyword)',required:false,expectedTypes:["reference","expression"],svoPosition:2,sovPosition:2}]},li={action:"render",description:"Render a template with optional variables",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The template to render",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"style",description:"Variables to pass to the template (with keyword)",required:false,expectedTypes:["expression","reference"],svoPosition:2,sovPosition:1}]},ut={toggle:un,add:pn,remove:dn,put:mn,set:fn,show:vn,hide:hn,on:yn,trigger:gn,wait:Tn,fetch:En,increment:Sn,decrement:bn,append:kn,prepend:Pn,log:Rn,get:wn,take:An,make:Cn,halt:_n,settle:xn,throw:On,send:Nn,if:In,unless:Mn,else:Ln,repeat:qn,for:Dn,while:$n,continue:Vn,go:Bn,transition:zn,clone:Gn,focus:Fn,blur:Un,call:Hn,return:Wn,js:jn,async:Kn,tell:Yn,default:Qn,init:Xn,behavior:Zn,install:Jn,measure:ei,swap:ti,morph:ri,beep:oi,break:ni,copy:ii,exit:si,pick:ai,render:li,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function ci(){return Object.values(ut).filter(o=>o.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(Wo(),et)).then(({validateAllSchemas:o,formatValidationResults:e})=>{let t=o(ut);t.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(t)),console.warn(`
|
|
5
|
-
These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(o=>{console.debug("Schema validation skipped:",o);});function pt(o,e){let t=e==="SOV"?"sovPosition":"svoPosition";return [...o].sort((r,i)=>{let n=r[t]??99,s=i[t]??99;return n-s})}function ui(o,e){let t=o.markerOverride?.[e.code],r=e.roleMarkers[o.role];if(t!==void 0)return {primary:t,position:r?.position??"before",isOverride:true};if(r&&r.primary){let i={primary:r.primary,position:r.position,isOverride:false};return r.alternatives&&(i.alternatives=r.alternatives),i}return null}function pi(o,e,t,r,i){let n=[];if(n.push({type:"role",role:"event",optional:false}),r.position==="after"){let u=r.primary.split(/\s+/);if(u.length>1)for(let c of u)n.push({type:"literal",value:c});else {let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(c);}}let s=e.roleMarkers.destination;s&&n.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary}]}),n.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.patient;if(a){let u=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};n.push(u);}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return n.push(l),{id:`${o.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`{event} ${r.primary} {destination?} {patient} ${a?.primary||""} ${t.primary}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function di(o,e,t,r,i){let n=[];n.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let l=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};n.push(l);}if(n.push({type:"role",role:"event",optional:false}),r.position==="after"){let l=r.primary.split(/\s+/);if(l.length>1)for(let u of l)n.push({type:"literal",value:u});else {let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(u);}}let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return n.push(a),{id:`${o.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`{patient} ${s?.primary||""} {event} ${r.primary} ${t.primary}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function mi(o,e,t,r,i){let n=[];n.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let u=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};n.push(u);}let a=e.roleMarkers.destination;if(a&&(n.push({type:"role",role:"destination",optional:false}),n.push(a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary})),n.push({type:"role",role:"event",optional:false}),r.position==="after"){let u=r.primary.split(/\s+/);if(u.length>1)for(let c of u)n.push({type:"literal",value:c});else {let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(c);}}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return n.push(l),{id:`${o.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(i.basePriority??100)+40,template:{format:`{patient} ${s?.primary||""} {destination} ${a?.primary||""} {event} ${r.primary} ${t.primary}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function fi(o,e,t,r,i){let n=[];n.push({type:"role",role:"event",optional:false});let s=r.alternatives?.filter(c=>!c.includes(" ")&&c.length>1)||[];s.length>0&&n.push({type:"literal",value:s[0],alternatives:s.slice(1)});let a=e.roleMarkers.destination;a&&n.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary}]}),n.push({type:"role",role:"patient",optional:false});let l=e.roleMarkers.patient;if(l){let c=l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary};n.push(c);}let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return n.push(u),{id:`${o.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(i.basePriority??100)+52,template:{format:`{event}${s[0]||""} {patient} ${t.primary}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function vi(o,e,t,r,i){let n=[];if(n.push({type:"role",role:"event",optional:false}),r.position==="after"){let a=r.primary.split(/\s+/);if(a.length>1)for(let l of a)n.push({type:"literal",value:l});else {let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(l);}}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return n.push(s),{id:`${o.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{event} ${r.primary} ${t.primary}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function hi(o,e,t,r){let i=e.eventHandler?.temporalMarkers;if(!i||i.length===0)return null;let n=[];n.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&n.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),n.push({type:"literal",value:i[0],alternatives:i.slice(1)}),n.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s?.primary){let l=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};n.push(l);}let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return n.push(a),{id:`${o.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(r.basePriority??100)+49,template:{format:`{event} ${i[0]} {patient} ${t.primary}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function yi(o,e,t,r,i){let n=[];if(n.push({type:"role",role:"event",optional:false}),r.position==="after"){let c=r.primary.split(/\s+/);if(c.length>1)for(let p of c)n.push({type:"literal",value:p});else {let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(p);}}let a=[...o.roles.filter(c=>c.required)].sort((c,p)=>{let d=c.sovPosition??999,m=p.sovPosition??999;return d-m});for(let c of a){n.push({type:"role",role:c.role,optional:false});let p,d;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)p=c.markerOverride[e.code];else {let m=e.roleMarkers[c.role];m&&(p=m.primary,d=m.alternatives);}if(p){let m=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};n.push(m);}}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(l);let u=a.map(c=>`{${c.role}}`).join(" ");return {id:`${o.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`{event} ${r.primary} ${u} ${t.primary}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},...Object.fromEntries(a.map(c=>[c.role,{fromRole:c.role}]))}}}function gi(o,e,t,r,i){let n=[],a=[...o.roles.filter(f=>f.required)].sort((f,v)=>{let k=f.sovPosition??999,S=v.sovPosition??999;return k-S}),l=a[0];n.push({type:"role",role:l.role,optional:false});let u;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)u=l.markerOverride[e.code];else {let f=e.roleMarkers[l.role];f&&(u=f.primary);}if(u&&n.push({type:"literal",value:u}),n.push({type:"role",role:"event",optional:false}),r.position==="after"){let f=r.primary.split(/\s+/);if(f.length>1)for(let v of f)n.push({type:"literal",value:v});else {let v=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(v);}}let c=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(c);let p=a[1];n.push({type:"role",role:p.role,optional:false});let d,m;if(p.markerOverride&&p.markerOverride[e.code]!==void 0)d=p.markerOverride[e.code];else {let f=e.roleMarkers[p.role];f&&(d=f.primary,m=f.alternatives);}if(d){let f=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};n.push(f);}return {id:`${o.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{${l.role}} {event} ${r.primary} ${t.primary} {${p.role}}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},[l.role]:{fromRole:l.role},[p.role]:{fromRole:p.role}}}}function Ye(o,e,t,r,i){let n=[];if(r.position==="before"){let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(l);}n.push({type:"role",role:"event",optional:false});let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(s),n.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.destination;return a&&n.push({type:"group",optional:true,tokens:[a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary},{type:"role",role:"destination",optional:true}]}),{id:`${o.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`${r.primary} {event} ${t.primary} {patient} ${a?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Ti(o,e,t,r,i){let n=[],s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(s),n.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.destination;if(a&&n.push({type:"group",optional:true,tokens:[a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary},{type:"role",role:"destination",optional:true}]}),r.position==="before"){let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(l);}return n.push({type:"role",role:"event",optional:false}),{id:`${o.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`${t.primary} {patient} ${a?.primary||""} {destination?} ${r.primary} {event}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Ei(o,e,t,r,i){let n=[],s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(s);let l=[...o.roles.filter(c=>c.required)].sort((c,p)=>{let d=c.svoPosition??999,m=p.svoPosition??999;return d-m});for(let c of l){let p,d;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)p=c.markerOverride[e.code];else {let m=e.roleMarkers[c.role];m&&(p=m.primary,d=m.alternatives);}if(p){let m=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};n.push(m);}n.push({type:"role",role:c.role,optional:false});}if(r.position==="before"){let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(c);}n.push({type:"role",role:"event",optional:false});let u=l.map(c=>`{${c.role}}`).join(" ");return {id:`${o.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${t.primary} ${u} ${r.primary} {event}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},...Object.fromEntries(l.map(c=>[c.role,{fromRole:c.role}]))}}}function Qe(o,e,t,r,i){let n=[];if(r.position==="before"){let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(c);}n.push({type:"role",role:"event",optional:false});let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(s);let l=[...o.roles.filter(c=>c.required)].sort((c,p)=>{let d=c.svoPosition??999,m=p.svoPosition??999;return d-m});for(let c of l){let p,d;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)p=c.markerOverride[e.code];else {let m=e.roleMarkers[c.role];m&&(p=m.primary,d=m.alternatives);}if(p){let m=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};n.push(m);}n.push({type:"role",role:c.role,optional:false});}let u=l.map(c=>`{${c.role}}`).join(" ");return {id:`${o.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`${r.primary} {event} ${t.primary} ${u}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},...Object.fromEntries(l.map(c=>[c.role,{fromRole:c.role}]))}}}function Si(o,e,t,r,i){let n=[],s=e.eventHandler?.negationMarker;if(r.position==="before"){let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(u);}if(s){let u=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};n.push(u);}n.push({type:"role",role:"event",optional:false});let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(a),n.push({type:"role",role:"patient",optional:false});let l=e.roleMarkers.destination;return l&&n.push({type:"group",optional:true,tokens:[l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary},{type:"role",role:"destination",optional:true}]}),{id:`${o.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${r.primary} ${s?.primary||""} {event} ${t.primary} {patient} ${l?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function bi(o,e,t,r){let i=[];i.push({type:"literal",value:"and",alternatives:["then"]}),i.push({type:"role",role:"event",optional:false});let n=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(n),i.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&i.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),{id:`${o.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(r.basePriority??100)+45,template:{format:`[proclitic?] {event} ${t.primary} {patient} ${s?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:o.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var K={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function dt(o,e,t=K){let r=`${o.action}-${e.code}-generated`,i=t.basePriority??100,n=e.keywords[o.action];if(!n)throw new Error(`No keyword translation for '${o.action}' in ${e.code}`);let s=wi(o,e,n),a=ft(o,e),l=xi(o,e,n);return {id:r,language:e.code,command:o.action,priority:i,template:{format:l,tokens:s},extraction:a}}function ki(o,e,t=K){if(o.roles.filter(a=>!a.required).length===0)return null;let i=o.roles.filter(a=>a.required),n={...o,roles:i};return {...dt(n,e,t),id:`${o.action}-${e.code}-simple`,priority:(t.basePriority??100)-5,extraction:ft(o,e)}}function Pi(o,e,t=K){let r=[];if(r.push(dt(o,e,t)),t.generateSimpleVariants){let i=ki(o,e,t);i&&r.push(i);}return r}function mt(o,e=K){let t=[],r=ci();for(let i of r){if(!o.keywords[i.action])continue;let n=Pi(i,o,e);if(t.push(...n),o.eventHandler?.eventMarker){let s=Ri(i,o,e);t.push(...s);}}return t}function Ri(o,e,t=K){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let r=[],i=e.eventHandler.eventMarker,n=e.keywords[o.action];if(!n)return [];let a=o.roles.filter(l=>l.required).length===2;if(e.wordOrder==="SOV")if(a)r.push(yi(o,e,n,i,t)),r.push(gi(o,e,n,i,t));else {r.push(pi(o,e,n,i,t)),r.push(di(o,e,n,i,t));let l=e.roleMarkers.destination;l&&l.primary!==i.primary&&r.push(mi(o,e,n,i,t));let u=i.primary.split(/\s+/),c=i.alternatives?.some(d=>!d.includes(" ")&&d.length>1);u.length>1&&c&&r.push(fi(o,e,n,i,t)),r.push(vi(o,e,n,i,t));let p=hi(o,e,n,t);p&&r.push(p);}else e.wordOrder==="VSO"?a?(r.push(Qe(o,e,n,i,t)),r.push(Ei(o,e,n,i,t))):(r.push(Ye(o,e,n,i,t)),r.push(Ti(o,e,n,i,t)),e.eventHandler?.negationMarker&&r.push(Si(o,e,n,i,t)),e.tokenization?.prefixes&&r.push(bi(o,e,n,t))):a?r.push(Qe(o,e,n,i,t)):r.push(Ye(o,e,n,i,t));return r}function wi(o,e,t){let r=[],i=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary},n=Ai(o,e);switch(e.wordOrder){case "SVO":r.push(i),r.push(...n);break;case "SOV":r.push(...n),r.push(i);break;case "VSO":r.push(i),r.push(...n);break;default:r.push(i),r.push(...n);}return r}function Ai(o,e){let t=[],r=pt(o.roles,e.wordOrder);for(let i of r){let n=Ci(i,e);i.required?t.push(...n):t.push({type:"group",optional:true,tokens:n});}return t}function Ci(o,e){let t=[],r=o.markerOverride?.[e.code],i=e.roleMarkers[o.role],n={type:"role",role:o.role,optional:!o.required,expectedTypes:o.expectedTypes};if(r!==void 0)(i?.position??"before")==="before"?(r&&t.push({type:"literal",value:r}),t.push(n)):(t.push(n),r&&t.push({type:"literal",value:r}));else if(i)if(i.position==="before"){if(i.primary){let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};t.push(s);}t.push(n);}else {t.push(n);let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};t.push(s);}else t.push(n);return t}function _i(o,e){let t={};for(let r of o.roles){let i=r.markerOverride?.[e.code],n=e.roleMarkers[r.role];i!==void 0?t[r.role]=i?{marker:i}:{}:n&&n.primary?t[r.role]=n.alternatives?{marker:n.primary,markerAlternatives:n.alternatives}:{marker:n.primary}:t[r.role]={};}return t}function ft(o,e){let t=_i(o,e),r={};for(let i of o.roles){let n=t[i.role]||{};!i.required&&i.default?r[i.role]={...n,default:i.default}:r[i.role]=n;}return r}function xi(o,e,t){let r=[],n=pt(o.roles,e.wordOrder).map(s=>{let a=ui(s,e),l="";return a&&a.primary?a.position==="before"?l=`${a.primary} {${s.role}}`:l=`{${s.role}} ${a.primary}`:l=`{${s.role}}`,s.required?l:`[${l}]`});switch(e.wordOrder){case "SVO":case "VSO":r.push(t.primary,...n);break;case "SOV":r.push(...n,t.primary);break;default:r.push(t.primary,...n);}return r.join(" ")}function re(o){let e=o.getAttribute("data-lang");if(e)return he(e);let t=o.getAttribute("data-hyperscript-lang")??o.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(t)return he(t);let r=typeof document<"u"?document.documentElement?.lang:null;return r&&r!=="en"?he(r):null}function he(o){return o.split("-")[0].toLowerCase()}var vt={add:[["patient",""],["destination","to"]],append:[["patient",""],["destination","to"]],async:[],beep:[["patient",""]],behavior:[["patient",""]],blur:[["patient",""]],break:[],call:[["patient",""]],clone:[["patient",""],["destination","into"]],compound:[],continue:[],copy:[["patient",""]],decrement:[["patient",""],["quantity","by"]],default:[["destination",""],["patient","to"]],else:[],exit:[],fetch:[["source",""],["responseType","as"],["method","via"],["destination","on"]],focus:[["patient",""]],for:[["patient",""],["source","in"]],get:[["source",""],["destination","on"]],go:[["destination",""]],halt:[["patient",""]],hide:[["patient",""],["style","with"]],if:[["condition",""]],increment:[["patient",""],["quantity","by"]],init:[],install:[["patient",""],["destination","on"]],js:[["patient",""]],log:[["patient",""]],make:[["patient",""]],measure:[["patient",""],["source","of"]],morph:[["destination",""],["patient","to"]],on:[["event",""],["source","from"]],pick:[["patient",""],["source","from"]],prepend:[["patient",""],["destination","to"]],put:[["patient",""],["destination","into"]],remove:[["patient",""],["source","from"]],render:[["patient",""],["style","with"]],repeat:[["quantity",""],["condition","until"]],return:[["patient",""]],send:[["event",""],["destination","to"]],set:[["destination",""],["patient","to"]],settle:[["patient",""]],show:[["patient",""],["style","with"]],swap:[["method",""],["destination","of"],["patient","with"]],take:[["patient",""],["source","from"]],tell:[["destination",""]],throw:[["patient",""]],toggle:[["patient",""],["destination","on"]],transition:[["patient",""],["goal","to"],["destination","on"],["duration","over"],["style","with"]],trigger:[["event",""],["destination","on"]],unless:[["condition",""]],wait:[["patient",""]],while:[["condition",""]]};function Q(o){switch(o.kind){case "event-handler":return Oi(o);case "compound":return Ni(o);default:return Ii(o)}}function Oi(o){let e=["on"],t=o.roles.get("event");t&&e.push(Y(t));let r=o.roles.get("source");if(r&&e.push("from",Y(r)),o.body&&o.body.length>0){let i=o.body.map(Q);e.push(i.join(" then "));}return e.join(" ")}function Ni(o){let e=o.chainType==="async"?"async":o.chainType;return o.statements.map(Q).join(` ${e} `)}function Ii(o){let e=vt[o.action];if(e){let r=[o.action];for(let[i,n]of e){let s=o.roles.get(i);s&&(i==="destination"&&s.type==="reference"&&s.value==="me"||(n&&r.push(n),r.push(Y(s))));}return r.join(" ")}let t=[o.action];for(let[,r]of o.roles)t.push(Y(r));return t.join(" ")}function Y(o){switch(o.type){case "literal":return typeof o.value=="string"&&o.dataType==="string"?`"${o.value}"`:String(o.value);case "selector":return o.value;case "reference":return o.value;case "property-path":return Mi(o);case "expression":return o.raw}}function Mi(o){let e=Y(o.object),t=o.property;if(o.object.type==="reference")switch(o.object.value){case "me":return `my ${t}`;case "it":return `its ${t}`;case "you":return `your ${t}`}return `${e}'s ${t}`}var yt=.5,Li={confidenceThreshold:yt,strategy:"semantic",fallbackToOriginal:true};function qi(o,e){return typeof o=="number"?o:o[e]??o["*"]??yt}var ye=null;function Di(){return ye||(ye=lt()),ye}function ge(o,e,t={}){let r={...Li,...t},i=ht(o,e,r);if(i!==null)return i;let n=Vi(o);if(n){let s=ht(n.commands,e,r);if(s!==null)return n.prefix+s}return o}function ht(o,e,t){if(t.strategy==="semantic"||t.strategy==="auto"){let r=qi(t.confidenceThreshold,e),i=gt(o,e,r);if(i!==null)return i}if((t.strategy==="auto"||t.strategy==="i18n")&&t.i18nToEnglish){let r=Bi(o,e,t.i18nToEnglish);if(r!==null)return r}return null}var $i=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function Vi(o){let e=o.match($i);if(!e)return null;let t=e[1],r=o.slice(t.length);return r?{prefix:t,commands:r}:null}function gt(o,e,t){try{let r=Gi(o,e);if(r.length>1)return Fi(r,e,t);let i=Di();if(!i.supportsLanguage(e))return null;let n=i.analyze(o,e);if(!ct(n,t))return null;if(n.node)return Q(n.node);let s=ve(o,e);return Q(s)}catch{return null}}function Bi(o,e,t){try{let r=t(o,e);return r!==o?r:null}catch{return null}}function zi(o){let e=["then"],t=M(o);if(t?.keywords?.then){let r=t.keywords.then;if(r.primary&&r.primary!=="then"&&e.push(r.primary),r.alternatives)for(let i of r.alternatives)e.includes(i)||e.push(i);}return e}function Gi(o,e){let r=zi(e).map(a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),i=new RegExp(`\\s+(?:${r.join("|")})\\s+`,"i"),n=o.split(`
|
|
6
|
-
`).map(
|
|
1
|
+
var HyperscriptI18n=(function(exports){'use strict';function _(n,e){return e?{type:"literal",value:n,dataType:e}:{type:"literal",value:n}}function ve(n,e){return e?{type:"selector",value:n,selectorKind:e}:{type:"selector",value:n}}function ae(n){return {type:"reference",value:n}}function he(n,e){return {type:"property-path",object:n,property:e}}var zt=class{constructor(n){this.namespace=n,this.enabled=this.checkEnabled();}checkEnabled(){if(typeof process<"u"&&process.env){let n=process.env.DEBUG||"";return n==="*"||n.includes("framework:*")||n.includes(`framework:${this.namespace}`)}return false}log(n,e,...t){if(!this.enabled)return;let r=`[framework:${this.namespace}]`,o=new Date().toISOString();switch(n){case "debug":console.debug(`${o} ${r} DEBUG:`,e,...t);break;case "info":console.info(`${o} ${r} INFO:`,e,...t);break;case "warn":console.warn(`${o} ${r} WARN:`,e,...t);break;case "error":console.error(`${o} ${r} ERROR:`,e,...t);break}}debug(n,...e){this.log("debug",n,...e);}info(n,...e){this.log("info",n,...e);}warn(n,...e){this.log("warn",n,...e);}error(n,...e){this.log("error",n,...e);}isEnabled(){return this.enabled}enable(){this.enabled=true;}disable(){this.enabled=false;}};function Wt(n){return new zt(n)}function q(n,e){return !e||e.length===0||e.includes(n)||e.includes("expression")?true:n==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):false}function jt(n,e){return n?.possessive?.keywords?.[e]}var Q=class V{constructor(){this.logger=Wt("pattern-matcher"),this.stemMatchCount=0,this.totalKeywordMatches=0;}safeToLowerCase(e){return typeof e=="string"?e.toLowerCase():e==null?"":String(e).toLowerCase()}matchPattern(e,t,r){let o=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()){let l=[];for(let c=0;c<10;c++){let u=e.peek(c);if(u)l.push({type:u.type,value:u.value,kind:u.kind});else break}this.logger.debug("Input tokens (first 10):",l),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));let 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(([l,c])=>[l,JSON.stringify(c)])),!a)return this.logger.debug(">>> MATCH FAILED - resetting token position"),e.reset(o),null;let s=this.calculateConfidence(t,i);return this.applyExtractionRules(t,i),{pattern:t,captured:i,consumedTokens:e.position()-o.position,confidence:s}}matchBest(e,t,r){let o=[];for(let a of t){let s=e.mark(),l=this.matchPattern(e,a,r);l&&o.push(l),e.reset(s);}if(o.length===0)return null;o.sort((a,s)=>{let l=s.pattern.priority-a.pattern.priority;if(l!==0)return l;let c=s.confidence-a.confidence;return Math.abs(c)>.001?c:s.consumedTokens-a.consumedTokens});let i=o[0];return this.matchPattern(e,i.pattern),i}matchTokenSequence(e,t,r,o){let i=t[0],a=i?.type==="literal"&&(i.value==="and"||i.value==="then"||i.alternatives?.includes("and")||i.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!a)for(;e.peek()?.kind==="conjunction";)e.advance();let s=null,l=null;for(let c=0;c<t.length;c++){let u=t[c];this.logger.debug(" >> Matching pattern token:",JSON.stringify(u,null,2));let p=e.peek();if(this.logger.debug(" >> Current input token:",p?JSON.stringify({type:p.type,value:p.value,kind:p.kind}):"EOF"),u.type==="role"&&u.greedy){let g=this.collectStopMarkers(t,c+1);if(o)for(let T of o)g.add(T);let E=[];for(;!e.isAtEnd();){let T=e.peek();if(!T||this.isStopMarker(T,g))break;E.push(T.value),e.advance();}if(E.length>0){r.set(u.role,{type:"expression",raw:E.join(" ")}),s=null,l=null;continue}else {if(u.optional)continue;return false}}if(u.type==="group"){let g=this.collectStopMarkers(t,c+1);if(o)for(let T of o)g.add(T);if(this.matchGroupToken(e,u,r,g)){s=null,l=null;continue}if(this.isOptional(u))continue;return false}let d=u.type==="role"&&u.optional===true,m=d?e.mark():null;if(u.type==="role"&&!d){let g=c+1<t.length?t[c+1]:null;if(g?.type==="literal"){let E=e.peek();if(E&&this.getMatchType(E,g.value)!=="none"){if(this.logger.debug(" >> MARKER-STEAL GUARD: current token matches next literal, skipping role"),this.logger.debug(" >> Token match FAILED"),this.isOptional(u))continue;if(s&&l){this.logger.debug(" >> BACKTRACKING: undoing optional role",l),e.reset(s),r.delete(l),s=null,l=null;let T=this.matchPatternToken(e,u,r);if(this.logger.debug(" >> Backtrack retry result:",T),T)continue}return false}}}let y=this.matchPatternToken(e,u,r);if(this.logger.debug(" >> Match result:",y),y){d?(s=m,l=u.role):(s=null,l=null);continue}if(this.logger.debug(" >> Token match FAILED"),!this.isOptional(u)){if(s&&l){this.logger.debug(" >> BACKTRACKING: undoing optional role",l),e.reset(s),r.delete(l),s=null,l=null;let g=this.matchPatternToken(e,u,r);if(this.logger.debug(" >> Backtrack retry result:",g),g)continue}return false}}return true}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 false}}matchLiteralToken(e,t){let 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"),false;let o=this.getMatchType(r,t.value);if(this.logger.debug(" >>> matchType for",r.value,"vs",t.value,":",o),o!=="none")return this.totalKeywordMatches++,o==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let i of t.alternatives){let a=this.getMatchType(r,i);if(a!=="none")return this.totalKeywordMatches++,a==="stem"&&this.stemMatchCount++,e.advance(),true}return false}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);let o=e.peek();if(this.logger.debug(" >>> After skipNoiseWords, current token:",o?JSON.stringify({value:o.value,kind:o.kind}):"null"),!o)return t.optional||false;let i=this.tryMatchPossessiveExpression(e);if(i)return t.expectedTypes&&t.expectedTypes.length>0&&!q(i.type,t.expectedTypes)?t.optional||false:(r.set(t.role,i),true);let a=this.tryMatchMethodCallExpression(e);if(a)return t.expectedTypes&&t.expectedTypes.length>0&&!q(a.type,t.expectedTypes)?t.optional||false:(r.set(t.role,a),true);let s=this.tryMatchPossessiveSelectorExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!q(s.type,t.expectedTypes)?t.optional||false:(r.set(t.role,s),true);let l=this.tryMatchPropertyAccessExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!q(l.type,t.expectedTypes)?t.optional||false:(r.set(t.role,l),true);let c=this.tryMatchSelectorPropertyExpression(e);if(c)return t.expectedTypes&&t.expectedTypes.length>0&&!q(c.type,t.expectedTypes)?t.optional||false:(r.set(t.role,c),true);this.logger.debug(" >>> Trying tokenToSemanticValue for token:",o?JSON.stringify({value:o.value,kind:o.kind}):"null");let u=this.tokenToSemanticValue(o);return this.logger.debug(" >>> tokenToSemanticValue returned:",u?JSON.stringify(u):"null"),u?(this.logger.debug(" >>> Validating type:",u.type,"against expected:",t.expectedTypes),t.expectedTypes&&t.expectedTypes.length>0&&!q(u.type,t.expectedTypes)?(this.logger.debug(" >>> TYPE MISMATCH - returning",t.optional||false),t.optional||false):(this.logger.debug(" >>> Type validation PASSED"),r.set(t.role,u),e.advance(),true)):t.optional||false}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let r=t.normalized||t.value,o=this.safeToLowerCase(r),i=jt(this.currentProfile,o);if(!i)return null;let a=e.mark();e.advance();let s=e.peek();if(!s)return e.reset(a),null;if(s.kind==="identifier"||s.kind==="keyword"&&!this.isStructuralKeyword(s.value)||s.kind==="selector"&&s.value.startsWith("*")||s.kind==="selector"&&s.value.startsWith("@")||s.kind==="selector"&&s.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s.value)){e.advance();let l=s.value;s.kind==="selector"&&l.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(l)&&(l=l.substring(1));let c=l;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)c+=e.peek().value,e.advance();let u=e.peek();return u?.kind==="literal"&&u.value.startsWith("(")&&(c+=u.value,e.advance()),he(ae(i),c)}return e.reset(a),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(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let r=e.mark();e.advance();let o=e.peek();if(!o||o.kind!=="operator"||o.value!==".")return e.reset(r),null;e.advance();let i=e.peek();if(!i||i.kind!=="identifier")return e.reset(r),null;e.advance();let a=e.peek();if(!a||a.kind!=="punctuation"||a.value!=="(")return e.reset(r),null;e.advance();let s=[];for(;!e.isAtEnd()&&s.length<V.MAX_METHOD_ARGS;){let c=e.peek();if(!c)break;if(c.kind==="punctuation"&&c.value===")"){e.advance();break}if(c.kind==="punctuation"&&c.value===","){e.advance();continue}s.push(c.value),e.advance();}return {type:"expression",raw:`${t.value}.${i.value}(${s.join(", ")})`}}tryMatchPropertyAccessExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"&&t.kind!=="keyword")return null;let r=e.mark();e.advance();let o=e.peek();if(!o||o.kind!=="operator"||o.value!==".")return e.reset(r),null;e.advance();let i=e.peek();if(!i||i.kind!=="identifier")return e.reset(r),null;e.advance();let a=`${t.value}.${i.value}`,s=1;for(;!e.isAtEnd()&&s<V.MAX_PROPERTY_DEPTH;){let c=e.peek();if(!c||c.kind!=="operator"||c.value!==".")break;e.advance();let u=e.peek();if(!u||u.kind!=="identifier")break;e.advance(),a+=`.${u.value}`,s++;}let l=e.peek();if(l&&l.kind==="punctuation"&&l.value==="("){e.advance();let c=[],u=0;for(;!e.isAtEnd()&&c.length<V.MAX_METHOD_ARGS;){let d=e.peek();if(!d)break;if(d.kind==="punctuation"&&d.value===")"){if(u===0){e.advance();break}u--;}if(d.kind==="punctuation"&&d.value==="("&&u++,d.kind==="punctuation"&&d.value===","){e.advance();continue}c.push(d.value),e.advance();}return {type:"expression",raw:`${a}(${c.join(", ")})`}}return {type:"expression",raw:a}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let r=e.mark();e.advance();let o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="'s")return e.reset(r),null;e.advance();let i=e.peek();return !i||i.kind!=="selector"&&i.kind!=="identifier"?(e.reset(r),null):(e.advance(),he(ve(t.value),i.value))}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||typeof t.value!="string"||!t.value.startsWith("#"))return null;let r=e.mark();e.advance();let o=e.peek();if(!o||o.kind!=="selector"||!o.value.startsWith("."))return e.reset(r),null;let i=e.peek(1);i&&i.kind,e.advance();let a=o.value.slice(1);return he(ve(t.value),a)}matchGroupToken(e,t,r,o){let i=e.mark(),a=new Set(r.keys());if(this.matchTokenSequence(e,t.tokens,r,o))return true;e.reset(i);for(let c of r.keys())a.has(c)||r.delete(c);if(!t.optional)return false;let l=this.getGroupLeadingMarker(t);if(l)for(let c=1;c<=V.MAX_MARKER_SCAN;c++){let u=e.peek(c);if(!u)break;if((u.normalized||u.value).toLowerCase()===l){this.logger.debug(" >> MARKER SCAN: found",l,"at offset",c,"- skipping intervening tokens");for(let m=0;m<c;m++)e.advance();if(this.matchTokenSequence(e,t.tokens,r,o))return true;e.reset(i);for(let m of r.keys())a.has(m)||r.delete(m);break}}return true}getGroupLeadingMarker(e){let t=e.tokens[0];return t?.type==="literal"?t.value.toLowerCase():null}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem===t&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&this.safeToLowerCase(e.value)===t.toLowerCase()?"case-insensitive":"none"}collectStopMarkers(e,t){let r=new Set;for(let o=t;o<e.length;o++){let i=e[o];if(i.type==="literal"){if(r.add(i.value.toLowerCase()),i.alternatives)for(let a of i.alternatives)r.add(a.toLowerCase());break}if(i.type==="group"){for(let a of i.tokens)if(a.type==="literal"){if(r.add(a.value.toLowerCase()),a.alternatives)for(let s of a.alternatives)r.add(s.toLowerCase());break}if(!i.optional)break}}return r}isStopMarker(e,t){return t.size===0?false:!!(t.has(e.value.toLowerCase())||e.normalized&&t.has(e.normalized.toLowerCase()))}tokenToSemanticValue(e){switch(e.kind){case "selector":return ve(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=e.normalized||e.value;this.safeToLowerCase(t);return _(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return ae(e.value);this.safeToLowerCase(e.value);return {type:"expression",raw:e.value};case "url":return _(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let o=e.slice(1,-1);return _(o,"string")}if(e==="true")return _(true,"boolean");if(e==="false")return _(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let o=parseFloat(t[1]);return t[2]?_(e,"duration"):_(o,"number")}let r=parseFloat(e);return isNaN(r)?_(e,"string"):_(r,"number")}applyExtractionRules(e,t){for(let[r,o]of Object.entries(e.extraction))t.has(r)||(o.value!==void 0?t.set(r,{type:"literal",value:o.value}):o.default&&t.set(r,o.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,t){let r=0,o=0,i=c=>e.extraction?.[c]?.default!==void 0;for(let c of e.template.tokens)if(c.type==="role")o+=1,t.has(c.role)&&(r+=1);else if(c.type==="group"){for(let u of c.tokens)if(u.type==="role"){let p=i(u.role),d=.8;o+=d,t.has(u.role)?r+=d:p&&(r+=d*.6);}}let a=o>0?r/o:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){let c=this.stemMatchCount/this.totalKeywordMatches*.15;a=Math.max(.5,a-c);}let s=this.calculateVSOConfidenceBoost(e);a=Math.min(1,a+s);let l=this.arabicPrepositionDisambiguation(e,t);return a=Math.max(0,Math.min(1,a+l)),a}calculateVSOConfidenceBoost(e){if(e.language!=="ar")return 0;let t=e.template.tokens[0];if(!t||t.type!=="literal")return 0;let r=new Set(["\u0628\u062F\u0644","\u063A\u064A\u0631","\u0623\u0636\u0641","\u0623\u0632\u0644","\u0636\u0639","\u0627\u062C\u0639\u0644","\u0639\u064A\u0646","\u0632\u062F","\u0627\u0646\u0642\u0635","\u0633\u062C\u0644","\u0623\u0638\u0647\u0631","\u0623\u062E\u0641","\u0634\u063A\u0644","\u0623\u0631\u0633\u0644","\u0631\u0643\u0632","\u0634\u0648\u0634","\u062A\u0648\u0642\u0641","\u0627\u0646\u0633\u062E","\u0627\u062D\u0630\u0641","\u0627\u0635\u0646\u0639","\u0627\u0646\u062A\u0638\u0631","\u0627\u0646\u062A\u0642\u0627\u0644","\u0623\u0648"]);if(r.has(t.value))return .15;if(t.alternatives){for(let o of t.alternatives)if(r.has(o))return .15}return 0}arabicPrepositionDisambiguation(e,t){if(e.language!=="ar")return 0;let r=0,o={patient:["\u0639\u0644\u0649"],destination:["\u0625\u0644\u0649","\u0627\u0644\u0649"],source:["\u0645\u0646"],agent:["\u0645\u0646"],manner:["\u0628"],style:["\u0628"],goal:["\u0625\u0644\u0649","\u0627\u0644\u0649"],method:["\u0628"]};for(let[i,a]of t.entries()){let s=o[i];if(!s||s.length===0)continue;let l="metadata"in a?a.metadata:void 0;if(l&&typeof l.prepositionValue=="string"){let c=l.prepositionValue;s.includes(c)?r+=.1:r-=.1;}}return Math.max(-0.1,Math.min(.1,r))}skipNoiseWords(e){let t=e.peek();if(!t)return;let r=this.safeToLowerCase(t.value);if(V.ENGLISH_NOISE_WORDS.has(r)){let o=e.mark();e.advance();let i=e.peek();if(i&&i.kind==="selector")return;e.reset(o);}r==="class"&&e.advance();}extractEventModifiers(e){let t={},r=false;for(;!e.isAtEnd();){let o=e.peek();if(!o||o.kind!=="event-modifier")break;let i=o.metadata;if(!i)break;switch(r=true,i.modifierName){case "once":t.once=true;break;case "debounce":typeof i.value=="number"&&(t.debounce=i.value);break;case "throttle":typeof i.value=="number"&&(t.throttle=i.value);break;case "queue":(i.value==="first"||i.value==="last"||i.value==="all"||i.value==="none")&&(t.queue=i.value);break}e.advance();}return r?t:void 0}};Q.MAX_MARKER_SCAN=3;Q.MAX_PROPERTY_DEPTH=10;Q.MAX_METHOD_ARGS=20;Q.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Ut=Q;new Ut;var De=class{constructor(){this.name="string-literal";}canExtract(n,e){let t=n[e];return t==='"'||t==="'"||t==="`"||t==="\u201C"||t==="\u2018"}extract(n,e){let t=n[e];if(t==="\u201C"){let i=1;for(;e+i<n.length;){if(n[e+i]==="\u201D")return i++,{value:n.substring(e,e+i),length:i};i++;}return null}if(t==="\u2018"){let i=1;for(;e+i<n.length;){if(n[e+i]==="\u2019")return i++,{value:n.substring(e,e+i),length:i};i++;}return null}let r=1,o=false;for(;e+r<n.length;){let i=n[e+r];if(o){o=false,r++;continue}if(i==="\\"){o=true,r++;continue}if(i===t)return r++,{value:n.substring(e,e+r),length:r};r++;}return null}},$e=class{constructor(){this.name="number";}canExtract(n,e){return /\d/.test(n[e])}extract(n,e){let t=0,r=false;for(;e+t<n.length;){let a=n[e+t];if(/\d/.test(a))t++;else if(a==="."&&!r)r=true,t++;else break}if(t===0)return null;let o=n.substring(e,e+t),i=e+t;if(i<n.length){let a=n.slice(i),s=[{pattern:"\u6BEB\u79D2",suffix:"ms"},{pattern:"\u5206\u949F",suffix:"m"},{pattern:"\u5C0F\u65F6",suffix:"h"},{pattern:"\u30DF\u30EA\u79D2",suffix:"ms"},{pattern:"\u6642\u9593",suffix:"h"}];for(let c of s)if(a.startsWith(c.pattern))return {value:o+c.suffix,length:t+c.pattern.length,metadata:{hasTimeUnit:true}};if(a.startsWith("ms"))return {value:o+"ms",length:t+2,metadata:{hasTimeUnit:true}};let l=[{pattern:"\u79D2",suffix:"s"},{pattern:"\u5206",suffix:"m"}];for(let c of l)if(a.startsWith(c.pattern))return {value:o+c.suffix,length:t+1,metadata:{hasTimeUnit:true}};if(/^[smh](?![a-zA-Z])/.test(a))return {value:o+a[0],length:t+1,metadata:{hasTimeUnit:true}}}return {value:o,length:t}}};function Ht(n){return "setContext"in n&&typeof n.setContext=="function"}function Gt(n){let e={language:n.language,direction:n.direction,lookupKeyword:n.lookupKeyword.bind(n),isKeyword:n.isKeyword.bind(n),isKeywordStart:n.isKeywordStart.bind(n)};return n.normalizer?{...e,normalizer:n.normalizer}:e}var Kt=new Set(["me","you","it","result","event","target","body"]);function Be(n,e=Kt){return e.has(n)}var X=class{constructor(n,e){this.pos=0,this.tokens=n,this.language=e;}peek(n=0){let e=this.pos+n;return e<0||e>=this.tokens.length?null:this.tokens[e]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(n){this.pos=n.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(n){let e=[];for(;!this.isAtEnd()&&n(this.peek());)e.push(this.advance());return e}skipWhile(n){for(;!this.isAtEnd()&&n(this.peek());)this.advance();}};function b(n,e){return {start:n,end:e}}function S(n,e,t,r){if(typeof n=="object"){let{value:i,kind:a,position:s,normalized:l,stem:c,stemConfidence:u,metadata:p}=n;return {value:i,kind:a,position:s,...l!==void 0&&{normalized:l},...c!==void 0&&{stem:c},...u!==void 0&&{stemConfidence:u},...p!==void 0&&{metadata:p}}}let o=n;if(!e||!t)throw new Error("createToken requires kind and position parameters");if(typeof r=="string")return {value:o,kind:e,position:t,normalized:r};if(r){let{normalized:i,stem:a,stemConfidence:s,metadata:l}=r;return {value:o,kind:e,position:t,...i!==void 0&&{normalized:i},...a!==void 0&&{stem:a},...s!==void 0&&{stemConfidence:s},...l!==void 0&&{metadata:l}}}return {value:o,kind:e,position:t}}function Y(n){return /\s/.test(n)}function Qt(n){return n==="#"||n==="."||n==="["||n==="@"||n==="*"||n==="<"}function Xt(n){return n==='"'||n==="'"||n==="`"||n==="\u300C"||n==="\u300D"}function L(n){return /\d/.test(n)}function Jt(n){return /[a-zA-Z]/.test(n)}function A(n){return /[a-zA-Z0-9_-]/.test(n)}function Zt(n,e){if(e>=n.length)return null;let t=n[e];if(!Qt(t))return null;let r=e,o="";if(t==="#"||t==="."){for(o+=n[r++];r<n.length&&A(n[r]);)o+=n[r++];if(o.length<=1)return null;if(r<n.length&&n[r]==="."&&t==="#"){let a=r+1;for(;a<n.length&&A(n[a]);)a++;if(a<n.length&&n[a]==="(")return o}}else if(t==="["){let i=1,a=false,s=null,l=false;for(o+=n[r++];r<n.length&&i>0;){let c=n[r];o+=c,l?l=false:c==="\\"?l=true:a?c===s&&(a=false,s=null):c==='"'||c==="'"||c==="`"?(a=true,s=c):c==="["?i++:c==="]"&&i--,r++;}if(i!==0)return null}else if(t==="@"){for(o+=n[r++];r<n.length&&A(n[r]);)o+=n[r++];if(o.length<=1)return null}else if(t==="*"){for(o+=n[r++];r<n.length&&A(n[r]);)o+=n[r++];if(o.length<=1)return null}else if(t==="<"){if(o+=n[r++],r>=n.length||!Jt(n[r]))return null;for(;r<n.length&&A(n[r]);)o+=n[r++];for(;r<n.length;){let i=n[r];if(i==="."){if(o+=n[r++],r>=n.length||!A(n[r]))return null;for(;r<n.length&&A(n[r]);)o+=n[r++];}else if(i==="#"){if(o+=n[r++],r>=n.length||!A(n[r]))return null;for(;r<n.length&&A(n[r]);)o+=n[r++];}else if(i==="["){let a=1,s=false,l=null,c=false;for(o+=n[r++];r<n.length&&a>0;){let u=n[r];o+=u,c?c=false:u==="\\"?c=true:s?u===l&&(s=false,l=null):u==='"'||u==="'"||u==="`"?(s=true,l=u):u==="["?a++:u==="]"&&a--,r++;}if(a!==0)return null}else break}for(;r<n.length&&Y(n[r]);)o+=n[r++];if(r<n.length&&n[r]==="/")for(o+=n[r++];r<n.length&&Y(n[r]);)o+=n[r++];if(r>=n.length||n[r]!==">")return null;o+=n[r++];}return o||null}function er(n,e){if(e>=n.length||n[e]!=="'"||e+1>=n.length||n[e+1].toLowerCase()!=="s")return false;if(e+2>=n.length)return true;let r=n[e+2];return Y(r)||r==="*"||!A(r)}function tr(n,e){if(e>=n.length)return null;let t=n[e];if(!Xt(t)||t==="'"&&er(n,e))return null;let o={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[t];if(!o)return null;let i=e+1,a=t,s=false;for(;i<n.length;){let l=n[i];if(a+=l,s)s=false;else if(l==="\\")s=true;else if(l===o)return a;i++;}return a}function rr(n,e){if(e>=n.length)return false;let t=n[e],r=n[e+1]||"",o=n[e+2]||"";if(t==="/"&&r!=="/"&&/[a-zA-Z0-9._-]/.test(r)||t==="/"&&r==="/"&&/[a-zA-Z]/.test(o)||t==="."&&(r==="/"||r==="."&&o==="/"))return true;let i=n.slice(e,e+8).toLowerCase();return !!(i.startsWith("http://")||i.startsWith("https://"))}function nr(n,e){if(!rr(n,e))return null;let t=e,r="",o=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;t<n.length;){let i=n[t];if(i==="#"){if(r.length>0&&/[a-zA-Z0-9/.]$/.test(r))for(r+=i,t++;t<n.length&&/[a-zA-Z0-9_-]/.test(n[t]);)r+=n[t++];break}if(o.test(i))r+=i,t++;else break}return r.length<2?null:r}function or(n,e){if(e>=n.length)return null;let t=n[e];if(!L(t)&&t!=="-"&&t!=="+")return null;let r=e,o="";if((n[r]==="-"||n[r]==="+")&&(o+=n[r++]),r>=n.length||!L(n[r]))return null;for(;r<n.length&&L(n[r]);)o+=n[r++];if(r<n.length&&n[r]===".")for(o+=n[r++];r<n.length&&L(n[r]);)o+=n[r++];return r<n.length&&(n.slice(r,r+2)==="ms"?o+="ms":(n[r]==="s"||n[r]==="m"||n[r]==="h")&&(o+=n[r])),o}var ir=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(ir);var Ve=class Fe{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map,this.extractors=[];}tokenize(e){if(this.isUsingExtractors())return this.tokenizeWithExtractors(e);throw new Error(`${this.constructor.name}: tokenize() not implemented and no extractors registered. Either register extractors or override tokenize() method.`)}registerExtractor(e){Ht(e)&&e.setContext(Gt(this)),this.extractors.push(e);}registerExtractors(e){for(let t of e)this.registerExtractor(t);}clearExtractors(){this.extractors=[];}isUsingExtractors(){return this.extractors.length>0}tokenizeWithExtractors(e){let t=[],r=0;for(;r<e.length;){for(;r<e.length&&Y(e[r]);)r++;if(r>=e.length)break;let o=false;for(let i of this.extractors)if(i.canExtract(e,r)){let a=i.extract(e,r);if(a){let s=a.metadata?.normalized,l=a.metadata?.stem,c=a.metadata?.stemConfidence,u={};if(a.metadata)for(let[d,m]of Object.entries(a.metadata))d!=="normalized"&&d!=="stem"&&d!=="stemConfidence"&&(u[d]=m);let p={};s&&(p.normalized=s),l&&(p.stem=l),c!==void 0&&(p.stemConfidence=c),Object.keys(u).length>0&&(p.metadata=u),t.push(S(a.value,this.classifyToken(a.value),b(r,r+a.length),Object.keys(p).length>0?p:void 0)),r+=a.length,o=true;break}}if(!o){let i=e[r],a=this.classifyUnknownChar(i);t.push(S(i,a,b(r,r+1))),r++;}}return new X(t,this.language)}classifyUnknownChar(e){return "()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,t,r){if(e[t]!==".")return false;let o=r[r.length-1],i=o&&o.position.end<t;if(o&&!i&&(o.kind==="identifier"||o.kind==="keyword"||o.kind==="selector"))return r.push(S(".","operator",b(t,t+1))),true;let l=t+1;for(;l<e.length&&A(e[l]);)l++;return l<e.length&&e[l]==="("?(r.push(S(".","operator",b(t,t+1))),true):false}initializeKeywordsFromProfile(e,t=[]){let r=new Map;if(e.keywords){for(let[o,i]of Object.entries(e.keywords))if(r.set(i.primary,{native:i.primary,normalized:i.normalized||o}),i.alternatives)for(let a of i.alternatives)r.set(a,{native:a,normalized:i.normalized||o});}if(e.references){for(let[o,i]of Object.entries(e.references))r.set(i,{native:i,normalized:o});for(let o of Object.keys(e.references))r.has(o)||r.set(o,{native:o,normalized:o});}if(e.roleMarkers){for(let[o,i]of Object.entries(e.roleMarkers))if(i.primary&&r.set(i.primary,{native:i.primary,normalized:o}),i.alternatives)for(let a of i.alternatives)r.set(a,{native:a,normalized:o});}if(e.possessive?.keywords)for(let[o,i]of Object.entries(e.possessive.keywords))r.set(o,{native:o,normalized:i});for(let o of t)r.set(o.native,o);this.profileKeywords=Array.from(r.values()).sort((o,i)=>i.native.length-o.native.length),this.profileKeywordMap=new Map;for(let o of this.profileKeywords){this.profileKeywordMap.set(o.native.toLowerCase(),o);let i=this.removeDiacritics(o.native);i!==o.native&&!this.profileKeywordMap.has(i.toLowerCase())&&this.profileKeywordMap.set(i.toLowerCase(),o);}}removeDiacritics(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(e,t){for(let r of this.profileKeywords)if(e.slice(t).startsWith(r.native))return S(r.native,"keyword",b(t,t+r.native.length),r.normalized);return null}isKeywordStart(e,t){let r=e.slice(t);return this.profileKeywords.some(o=>r.startsWith(o.native))}lookupKeyword(e){return this.profileKeywordMap.get(e.toLowerCase())}isKeyword(e){return this.profileKeywordMap.has(e.toLowerCase())}setNormalizer(e){this.normalizer=e;}tryNormalize(e){if(!this.normalizer)return null;let t=this.normalizer.normalize(e);return t.stem!==e&&t.confidence>=.7?t:null}tryMorphKeywordMatch(e,t,r){let o=this.tryNormalize(e);if(!o)return null;let i=this.lookupKeyword(o.stem);if(!i)return null;let a={normalized:i.normalized,stem:o.stem,stemConfidence:o.confidence};return S(e,"keyword",b(t,r),a)}trySelector(e,t){let r=Zt(e,t);return r?S(r,"selector",b(t,t+r.length)):null}tryEventModifier(e,t){if(e[t]!==".")return null;let r=e.slice(t).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!r)return null;let o=r[0].replace(/(\s|\.)$/,""),i=o.slice(1).split("(")[0],a=r[1];return {...S(o,"event-modifier",b(t,t+o.length)),metadata:{modifierName:i,value:a?i==="queue"?a:parseInt(a,10):void 0}}}tryString(e,t){let r=tr(e,t);return r?S(r,"literal",b(t,t+r.length)):null}tryNumber(e,t){let r=or(e,t);return r?S(r,"literal",b(t,t+r.length)):null}tryMatchTimeUnit(e,t,r,o=false){let i=t;if(o)for(;i<e.length&&Y(e[i]);)i++;let a=e.slice(i);for(let s of r){let l=a.slice(0,s.length);if(s.caseInsensitive?l.toLowerCase()===s.pattern.toLowerCase():l===s.pattern){if(s.notFollowedBy&&(a[s.length]||"")===s.notFollowedBy)continue;if(s.checkBoundary){let u=a[s.length]||"";if(A(u))continue}return {suffix:s.suffix,endPos:i+s.length}}}return null}parseBaseNumber(e,t,r=true){let o=t,i="";if(r&&(e[o]==="-"||e[o]==="+")&&(i+=e[o++]),o>=e.length||!L(e[o]))return null;for(;o<e.length&&L(e[o]);)i+=e[o++];if(o<e.length&&e[o]===".")for(i+=e[o++];o<e.length&&L(e[o]);)i+=e[o++];return !i||i==="-"||i==="+"?null:{number:i,endPos:o}}tryNumberWithTimeUnits(e,t,r,o={}){let{allowSign:i=true,skipWhitespace:a=false}=o,s=this.parseBaseNumber(e,t,i);if(!s)return null;let{number:l,endPos:c}=s,u=[...r,...Fe.STANDARD_TIME_UNITS],p=this.tryMatchTimeUnit(e,c,u,a);return p&&(l+=p.suffix,c=p.endPos),S(l,"literal",b(t,c))}tryUrl(e,t){let r=nr(e,t);return r?S(r,"url",b(t,t+r.length)):null}tryVariableRef(e,t){if(e[t]!==":"||t+1>=e.length||!A(e[t+1]))return null;let r=t+1;for(;r<e.length&&A(e[r]);)r++;let o=e.slice(t,r);return S(o,"identifier",b(t,r))}tryOperator(e,t){let r=e.slice(t,t+2);if(["==","!=","<=",">=","&&","||","->"].includes(r))return S(r,"operator",b(t,t+2));let o=e[t];return ["<",">","!","+","-","*","/","="].includes(o)?S(o,"operator",b(t,t+1)):["(",")","{","}",",",";",":"].includes(o)?S(o,"punctuation",b(t,t+1)):null}tryMultiCharParticle(e,t,r){for(let o of r)if(e.slice(t,t+o.length)===o)return S(o,"particle",b(t,t+o.length));return null}};Ve.STANDARD_TIME_UNITS=[{pattern:"ms",suffix:"ms",length:2},{pattern:"s",suffix:"s",length:1,checkBoundary:true},{pattern:"m",suffix:"m",length:1,checkBoundary:true,notFollowedBy:"s"},{pattern:"h",suffix:"h",length:1,checkBoundary:true}];var ze=Ve;var ar=Object.defineProperty,sr=Object.getOwnPropertyNames,He=(n,e)=>function(){return n&&(e=(0, n[sr(n)[0]])(n=0)),e},lr=(n,e)=>{for(var t in e)ar(n,t,{get:e[t],enumerable:true});};function We(n,e){return n.replace(/\{(\w+)\}/g,(t,r)=>String(e[r]??`{${r}}`))}function C(n,e,t={},r){let o=Ge[n],i=We(o,t),a=Ke[n],s=a?We(a,t):void 0;return {code:n,message:i,severity:e,...r&&{role:r},...s&&{suggestion:s}}}var v,Ge,Ke,ur=He({"src/generators/schema-error-codes.ts"(){v={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"},Ge={[v.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[v.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[v.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[v.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[v.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[v.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.",[v.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.",[v.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[v.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[v.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[v.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[v.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[v.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[v.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[v.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[v.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[v.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},Ke={[v.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[v.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[v.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[v.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[v.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[v.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[v.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[v.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[v.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[v.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[v.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[v.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[v.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[v.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),Ye={};lr(Ye,{SchemaErrorCodes:()=>v,formatValidationResults:()=>hr,getValidationStats:()=>yr,validateAllKeywordCollisions:()=>Er,validateAllSchemas:()=>vr,validateCommandSchema:()=>Qe,validateKeywordCollisions:()=>Xe,validateRoleValues:()=>gr});function cr(n,e){return {action:n,items:e,get notes(){return e.filter(t=>t.severity==="note").map(t=>t.message)},get warnings(){return e.filter(t=>t.severity==="warning").map(t=>t.message)},get errors(){return e.filter(t=>t.severity==="error").map(t=>t.message)}}}function Qe(n){let e=[];for(let r of n.roles)r.expectedTypes.includes("literal")&&r.expectedTypes.includes("selector")&&(r.role==="patient"&&ge.has(n.action)?e.push(C(v.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:r.role,command:n.action},r.role)):e.push(C(v.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:r.role},r.role))),r.expectedTypes.length>3&&!ge.has(n.action)&&e.push(C(v.TOO_MANY_EXPECTED_TYPES,"warning",{role:r.role,count:r.expectedTypes.length},r.role));for(let r of n.roles)r.selectorKinds&&r.selectorKinds.length>0&&(r.expectedTypes.includes("selector")||e.push(C(v.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:r.role},r.role)));switch(n.action){case "transition":pr(n,e);break;case "on":dr(n,e);break;case "if":case "unless":mr(n,e);break;case "repeat":case "for":case "while":fr(n,e);break}return n.roles.filter(r=>r.required).length===0&&(Je.has(n.action)?e.push(C(v.NO_REQUIRED_ROLES_EXPECTED,"note",{command:n.action})):e.push(C(v.NO_REQUIRED_ROLES,"warning",{}))),cr(n.action,e)}function pr(n,e){let t=n.roles.find(o=>o.role==="patient"),r=n.roles.find(o=>o.role==="goal");t&&t.expectedTypes.includes("selector")&&e.push(C(v.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),t&&!r&&e.push(C(v.TRANSITION_MISSING_GOAL,"error",{}));}function dr(n,e){let t=n.roles.find(r=>r.role==="event");t||e.push(C(v.EVENT_HANDLER_MISSING_EVENT,"warning",{})),t&&!t.required&&e.push(C(v.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function mr(n,e){let t=n.roles.find(r=>r.role==="condition");t||e.push(C(v.CONDITIONAL_MISSING_CONDITION,"warning",{})),t&&!t.required&&e.push(C(v.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function fr(n,e){n.action==="for"?n.roles.find(r=>r.role==="source")||e.push(C(v.FOR_LOOP_MISSING_SOURCE,"warning",{})):n.action==="while"&&(n.roles.find(r=>r.role==="condition")||e.push(C(v.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function vr(n,e={}){let t=new Map,{includeNotes:r=false}=e;for(let[o,i]of Object.entries(n)){let a=Qe(i),s=a.items.some(c=>c.severity==="warning"||c.severity==="error"),l=r&&a.items.some(c=>c.severity==="note");(s||l)&&t.set(o,a);}return t}function hr(n,e={}){let t=[],{showNotes:r=false,showCodes:o=true}=e;for(let[i,a]of n){let s=a.items.filter(u=>u.severity==="error"),l=a.items.filter(u=>u.severity==="warning"),c=a.items.filter(u=>u.severity==="note");if(s.length>0){t.push(` \u274C ${i}:`);for(let u of s){let p=o?` [${u.code}]`:"";t.push(` ERROR${p}: ${u.message}`),u.suggestion&&t.push(` \u{1F4A1} Suggestion: ${u.suggestion}`);}}if(l.length>0){t.push(` \u26A0\uFE0F ${i}:`);for(let u of l){let p=o?` [${u.code}]`:"";t.push(` ${p?`${u.code}: `:""}${u.message}`),u.suggestion&&t.push(` \u{1F4A1} ${u.suggestion}`);}}if(r&&c.length>0){t.push(` \u2139\uFE0F ${i}:`);for(let u of c){let p=o?` [${u.code}]`:"";t.push(` ${p?`${u.code}: `:""}${u.message}`);}}}return t.join(`
|
|
2
|
+
`)}function yr(n){let e=0,t=0,r=0,o={};for(let i of n.values())for(let a of i.items)a.severity==="error"?e++:a.severity==="warning"?t++:a.severity==="note"&&r++,o[a.code]=(o[a.code]||0)+1;return {totalCommands:n.size,errors:e,warnings:t,notes:r,byCode:o}}function gr(n,e){let t=[];for(let r of e){let o=n.roles.find(i=>i.role===r.role);o&&(o.expectedTypes.length>0&&!o.expectedTypes.includes(r.type)&&(o.expectedTypes.includes("expression")||t.push({level:"error",role:r.role,message:`${n.action}.${r.role} expects type [${o.expectedTypes.join(", ")}], got '${r.type}'`,code:v.VALUE_TYPE_MISMATCH})),r.type==="selector"&&r.selectorKind&&o.selectorKinds&&o.selectorKinds.length>0&&(o.selectorKinds.includes(r.selectorKind)||t.push({level:"error",role:r.role,message:`${n.action}.${r.role} expects selector kind [${o.selectorKinds.join(", ")}], got '${r.selectorKind}'`,code:v.SELECTOR_KIND_MISMATCH})));}return t}function Xe(n){let e=[];if(!n.keywords)return {language:n.code,collisions:e};let t=new Map;for(let[o,i]of Object.entries(n.keywords)){if(!i||!i.primary)continue;let a=t.get(i.primary)||[];if(a.push({command:o,isPrimary:true}),t.set(i.primary,a),i.alternatives)for(let s of i.alternatives){let l=t.get(s)||[];l.push({command:o,isPrimary:false}),t.set(s,l);}}for(let[o,i]of t){let a=[...new Set(i.map(c=>c.command))];if(a.length<=1)continue;let s=i.filter(c=>c.isPrimary).length,l;s>=2?l="primary-primary":s===1?l="primary-alternative":l="alternative-alternative",e.push({keyword:o,commands:a.sort(),type:l});}let r={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((o,i)=>r[o.type]-r[i.type]),{language:n.code,collisions:e}}function Er(n){let e=[];for(let[,t]of Object.entries(n)){let r=Xe(t);r.collisions.length>0&&e.push(r);}return e.sort((t,r)=>t.language.localeCompare(r.language))}var ge,Je,kr=He({"src/generators/schema-validator.ts"(){ur(),ge=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),Je=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep"]);}}),Tr=new Map,br=new Map,Ze=new Map;function Sr(n,e,t){Tr.set(n,e),br.set(n,t),Ze.delete(n);}var xr=new Map;function wr(n,e){xr.set(n,e),Ze.delete(n);}var Ee={code:"en",name:"English",nativeName:"English",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"base",verb:{position:"start",subjectDrop:false},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"},go:{primary:"go"},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"}}},Ar=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Cr=class{constructor(n=Ar){this.name="operator",this.operators=[...n].sort((e,t)=>t.length-e.length);}canExtract(n,e){return this.operators.some(t=>n.startsWith(t,e))}extract(n,e){for(let t of this.operators)if(n.startsWith(t,e))return {value:t,length:t.length};return null}},Pr="()[]{},:;",Rr=class{constructor(n=Pr){this.punctuation=n,this.name="punctuation";}canExtract(n,e){return this.punctuation.includes(n[e])}extract(n,e){let t=n[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function Or(n,e){let t=n[e];if(t==="#"){let r=n.slice(e).match(/^#[a-zA-Z_][\w-]*/);return r?r[0]:null}if(t==="."){let r=n.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return r?r[0]:null}if(t==="["){let r=0,o=e;for(;o<n.length;){if(n[o]==="["&&r++,n[o]==="]"&&(r--,r===0))return n.slice(e,o+1);o++;}return null}if(t==="<"){let r=n.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return r?r[0]:null}return null}var _r=class{constructor(){this.name="css-selector";}canExtract(n,e){let t=n[e];return t==="#"||t==="."||t==="["||t==="<"}extract(n,e){let t=Or(n,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},Nr=class{constructor(){this.name="event-modifier";}canExtract(n,e){if(n[e]!==".")return false;let t=n.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(n,e){let t=n.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let r=t[0],o=r.slice(1).split("(")[0],i=t[1];return {value:r,length:r.length,metadata:{modifierName:o,value:i?o==="queue"?i:parseInt(i,10):void 0}}}};function Ir(n,e){let t=n.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let r=t.match(/^https?:\/\/[^\s]*/);return r?r[0]:null}if(t.startsWith("//")){let r=t.match(/^\/\/[^\s]*/);return r?r[0]:null}if(t.startsWith("./")||t.startsWith("../")){let r=t.match(/^\.\.?\/[^\s]*/);return r?r[0]:null}if(t.startsWith("/")){let r=t.match(/^\/[^\s]*/);return r?r[0]:null}return null}var Mr=class{constructor(){this.name="url";}canExtract(n,e){let t=n.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(n,e){let t=Ir(n,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},Lr=class{constructor(){this.name="variable-ref";}canExtract(n,e){return n[e]===":"&&e+1<n.length&&/[a-zA-Z_]/.test(n[e+1])}extract(n,e){if(!this.canExtract(n,e))return null;let t=1;for(;e+t<n.length&&/[a-zA-Z0-9_]/.test(n[e+t]);)t++;return {value:n.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function Dr(){return [new Mr,new Nr,new Lr,new _r]}function ye(n){return /[a-zA-Z0-9_]/.test(n)}var $r=class{constructor(){this.name="english-keyword";}setContext(n){this.context=n;}canExtract(n,e){return /[a-zA-Z_]/.test(n[e])}extract(n,e){if(!this.context)throw new Error("EnglishKeywordExtractor: context not set");let t=e,r="";for(;t<n.length&&ye(n[t]);)r+=n[t++];if(!r)return null;if(t<n.length&&n[t]===":"){let s=t;t++;let l="";for(;t<n.length&&ye(n[t]);)l+=n[t++];l?r=r+":"+l:t=s;}let o=this.context.lookupKeyword(r),i=o&&o.normalized!==o.native?o.normalized:void 0,a=null;return this.context.isKeyword(r)||(a=this.tryClassSyntaxConversion(n,t,r)),{value:a||r,length:t-e,metadata:{normalized:i,classConversion:a?true:void 0}}}tryClassSyntaxConversion(n,e,t){let r=e;for(;r<n.length&&/\s/.test(n[r]);)r++;if(n.slice(r,r+5).toLowerCase()==="class"){let o=r+5;if(o>=n.length||!ye(n[o]))return "."+t}return null}};function Br(){return [new $r]}var qr=[{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"}],Vr=class extends ze{constructor(){super(),this.language="en",this.direction="ltr",this.initializeKeywordsFromProfile(Ee,qr),this.registerExtractors(Dr()),this.registerExtractor(new De),this.registerExtractor(new $e),this.registerExtractors(Br()),this.registerExtractor(new Cr),this.registerExtractor(new Rr);}classifyToken(n){return this.isKeyword(n)?"keyword":n.startsWith("/")||n.startsWith("./")||n.startsWith("../")||n.startsWith("http")?"url":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(n)?"event-modifier":n.startsWith("#")||n.startsWith(".")||n.startsWith("[")||n.startsWith("*")||n.startsWith("<")?"selector":n.startsWith('"')||n.startsWith("'")||/^\d/.test(n)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(n)?"operator":"identifier"}},Fr=new Vr,zr={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:true,expectedTypes:["selector"],selectorKinds:["class","attribute"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","INVALID_CSS_PROPERTY"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"toggle command requires an argument"},{condition:"Class names are valid CSS identifiers",errorCode:"NO_VALID_CLASS_NAMES",message:"toggle command: no valid class names found"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to toggle",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",INVALID_CSS_PROPERTY:"Check CSS property name syntax (use kebab-case)"}},Wr={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:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","PROPERTY_REQUIRES_VALUE"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"add command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to add",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",PROPERTY_REQUIRES_VALUE:"When adding a property (*prop), provide a value argument"}},jr={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to remove",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},Ur={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:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"into"}}],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"}},Hr={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:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ja:"\u3092",ko:"\uB97C",tr:"i",ar:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The value to set",required:true,expectedTypes:["literal","expression","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"\xE0",de:"auf",id:"ke",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",ar:"\u0625\u0644\u0649",sw:"kwenye",tl:"sa",bn:"\u09A4\u09C7",qu:"man"}}],errorCodes:["MISSING_TARGET","INVALID_TARGET","MISSING_VALUE","INVALID_SYNTAX"],preconditions:[{condition:"Command has a target variable or property",errorCode:"MISSING_TARGET",message:"set command requires a target"},{condition:"Target is a valid variable or property reference",errorCode:"INVALID_TARGET",message:"set command target must be a string or object literal"},{condition:'Value is specified with "to" keyword',errorCode:"MISSING_VALUE",message:'set command requires a value (use "to" keyword)'}],recoveryHints:{MISSING_TARGET:"Add a target: set :variable to value OR set element.property to value",INVALID_TARGET:'Use local variable (:name), element property (el.prop), or "the X of Y" syntax',MISSING_VALUE:'Add "to <value>" to specify what to set',INVALID_SYNTAX:"Use syntax: set <target> to <value>"}},Gr={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to show",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},Kr={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to hide",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},Yr={action:"on",description:"Handle an event",category:"event",primaryRole:"event",hasBody:true,roles:[{role:"event",description:"The event to handle",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to listen on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Qr={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:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Xr={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"Duration or event to wait for",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},Jr={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",roles:[{role:"source",description:"The URL to fetch from",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,renderOverride:{en:""}},{role:"responseType",description:"Response format (json, text, html, blob, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"method",description:"HTTP method (GET, POST, etc.)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3},{role:"destination",description:"Where to store the result",required:false,expectedTypes:["selector","reference"],svoPosition:4,sovPosition:4}]},Zr={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to increment",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},en={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to decrement",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},tn={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to append",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},rn={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to prepend",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},nn={action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to log",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},on={action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",roles:[{role:"source",description:"The source to get from",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",ja:"\u3092",zh:"",ko:"\uB97C",ar:"\u0639\u0644\u0649",tr:"i",id:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"destination",description:"Where to store the result (optional)",required:false,expectedTypes:["reference"],svoPosition:2,sovPosition:1}]},an={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:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to take from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},sn={action:"make",description:"Create a new element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element type or selector to create",required:true,expectedTypes:["literal","selector"],svoPosition:1,sovPosition:1}]},ln={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:false,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},un={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:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},cn={action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The error message or object to throw",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},pn={action:"send",description:"Send an event to an element",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to send",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to",ja:"\u306B",ar:"\u0625\u0644\u0649",es:"a",ko:"\uC5D0\uAC8C",zh:"\u5230",tr:"-e",pt:"para",fr:"\xE0",de:"an",id:"ke",qu:"-man",sw:"kwa"}}]},dn={action:"if",description:"Conditional execution",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},mn={action:"unless",description:"Negated conditional execution (executes when condition is false)",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate (body executes when false)",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},fn={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},vn={action:"repeat",description:"Repeat a block of commands",category:"control-flow",primaryRole:"loopType",hasBody:true,roles:[{role:"loopType",description:"Loop variant: forever, times, for, while, until, until-event",required:true,expectedTypes:["literal"],svoPosition:0,sovPosition:0},{role:"quantity",description:"Number of times to repeat",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"event",description:"Event to wait for (terminates loop)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"source",description:"Element to listen for event on",required:false,expectedTypes:["selector","reference"],svoPosition:3,sovPosition:3}],notes:'Can also use "repeat forever", "repeat until condition", or "repeat until event X from Y"'},hn={action:"for",description:"Iterate over a collection",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The iteration variable",required:true,expectedTypes:["reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The collection to iterate over",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"in"}}]},yn={action:"while",description:"Loop while condition is true",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to check",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},gn={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},En={action:"go",description:"Navigate to a URL",category:"navigation",primaryRole:"destination",roles:[{role:"destination",description:"The URL to navigate to",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"},renderOverride:{en:""}}]},kn={action:"transition",description:"Transition an element with animation",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The property to transition (opacity, *background-color, etc.)",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2,markerOverride:{en:"",ar:"",tl:"",sw:""}},{role:"goal",description:"The target value to transition to",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:3,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man",es:"a",pt:"para",fr:"\xE0",de:"auf",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",id:"ke"}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:3,sovPosition:1},{role:"duration",description:"Transition duration (over 500ms, for 2 seconds)",required:false,expectedTypes:["literal"],svoPosition:4,sovPosition:4,markerOverride:{en:"over"}},{role:"style",description:"Easing function (ease-in, linear, etc.)",required:false,expectedTypes:["literal"],svoPosition:5,sovPosition:5}]},Tn={action:"clone",description:"Clone an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to clone",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"destination",description:"Where to put the clone",required:false,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"into"}}]},bn={action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to focus (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Sn={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:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},xn={action:"call",description:"Call a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The function to call",required:true,expectedTypes:["expression","reference"],svoPosition:1,sovPosition:1}]},wn={action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The value to return",required:false,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},An={action:"js",description:"Execute raw JavaScript code",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The JavaScript code to execute",required:false,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Cn={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},Pn={action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",hasBody:true,roles:[{role:"destination",description:"The element to tell",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}}]},Rn={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:true,expectedTypes:["reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ar:"",tl:"",sw:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The default value",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man"}}]},On={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},_n={action:"behavior",description:"Define a reusable behavior",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The behavior name (PascalCase identifier)",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},Nn={action:"install",description:"Install a behavior on an element",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The behavior name to install",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"Element to install on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},In={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:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"source",description:"Element to measure (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},Mn={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:false,expectedTypes:["literal"],svoPosition:1,sovPosition:3,markerOverride:{en:""}},{role:"destination",description:"The element to swap content in/for",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"of"}},{role:"patient",description:"The content to swap in (optional for delete)",required:false,expectedTypes:["literal","expression","selector"],svoPosition:3,sovPosition:2,markerOverride:{en:"with"}}]},Ln={action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"destination",roles:[{role:"destination",description:"The element to morph",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}},{role:"patient",description:"The target content/element to morph into",required:true,expectedTypes:["literal","expression","selector"],svoPosition:2,sovPosition:2,markerOverride:{en:"to"}}]},Dn={action:"beep",description:"Debug output for expressions with type information",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The expression(s) to debug",required:false,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},$n={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Bn={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:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},qn={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},Vn={action:"pick",description:"Select a random element from a collection",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The items to pick from",required:true,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1},{role:"source",description:'The array to pick from (with "from" keyword)',required:false,expectedTypes:["reference","expression"],svoPosition:2,sovPosition:2}]},Fn={action:"render",description:"Render a template with optional variables",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The template to render",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"style",description:"Variables to pass to the template (with keyword)",required:false,expectedTypes:["expression","reference"],svoPosition:2,sovPosition:1}]},et={toggle:zr,add:Wr,remove:jr,put:Ur,set:Hr,show:Gr,hide:Kr,on:Yr,trigger:Qr,wait:Xr,fetch:Jr,increment:Zr,decrement:en,append:tn,prepend:rn,log:nn,get:on,take:an,make:sn,halt:ln,settle:un,throw:cn,send:pn,if:dn,unless:mn,else:fn,repeat:vn,for:hn,while:yn,continue:gn,go:En,transition:kn,clone:Tn,focus:bn,blur:Sn,call:xn,return:wn,js:An,async:Cn,tell:Pn,default:Rn,init:On,behavior:_n,install:Nn,measure:In,swap:Mn,morph:Ln,beep:Dn,break:$n,copy:Bn,exit:qn,pick:Vn,render:Fn,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function zn(){return Object.values(et).filter(n=>n.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(kr(),Ye)).then(({validateAllSchemas:n,formatValidationResults:e})=>{let t=n(et);t.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(t)),console.warn(`
|
|
3
|
+
These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(n=>{console.debug("Schema validation skipped:",n);});function tt(n,e){let t=e==="SOV"?"sovPosition":"svoPosition";return [...n].sort((r,o)=>{let i=r[t]??99,a=o[t]??99;return i-a})}function Wn(n,e){let t=n.markerOverride?.[e.code],r=e.roleMarkers[n.role];if(t!==void 0)return {primary:t,position:r?.position??"before",isOverride:true};if(r&&r.primary){let o={primary:r.primary,position:r.position,isOverride:false};return r.alternatives&&(o.alternatives=r.alternatives),o}return null}function jn(n,e,t,r,o){let i=[];if(i.push({type:"role",role:"event",optional:false}),r.position==="after"){let c=r.primary.split(/\s+/);if(c.length>1)for(let u of c)i.push({type:"literal",value:u});else {let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(u);}}let a=e.roleMarkers.destination;a&&i.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary}]}),i.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let c=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};i.push(c);}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(l),{id:`${n.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(o.basePriority??100)+50,template:{format:`{event} ${r.primary} {destination?} {patient} ${s?.primary||""} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Un(n,e,t,r,o){let i=[];i.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.patient;if(a){let l=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};i.push(l);}if(i.push({type:"role",role:"event",optional:false}),r.position==="after"){let l=r.primary.split(/\s+/);if(l.length>1)for(let c of l)i.push({type:"literal",value:c});else {let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(c);}}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(s),{id:`${n.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(o.basePriority??100)+45,template:{format:`{patient} ${a?.primary||""} {event} ${r.primary} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Hn(n,e,t,r,o){let i=[];i.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.patient;if(a){let c=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};i.push(c);}let s=e.roleMarkers.destination;if(s&&(i.push({type:"role",role:"destination",optional:false}),i.push(s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary})),i.push({type:"role",role:"event",optional:false}),r.position==="after"){let c=r.primary.split(/\s+/);if(c.length>1)for(let u of c)i.push({type:"literal",value:u});else {let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(u);}}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(l),{id:`${n.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(o.basePriority??100)+40,template:{format:`{patient} ${a?.primary||""} {destination} ${s?.primary||""} {event} ${r.primary} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function Gn(n,e,t,r,o){let i=[];i.push({type:"role",role:"event",optional:false});let a=r.alternatives?.filter(u=>!u.includes(" ")&&u.length>1)||[];a.length>0&&i.push({type:"literal",value:a[0],alternatives:a.slice(1)});let s=e.roleMarkers.destination;s&&i.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary}]}),i.push({type:"role",role:"patient",optional:false});let l=e.roleMarkers.patient;if(l){let u=l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary};i.push(u);}let c=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(c),{id:`${n.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(o.basePriority??100)+52,template:{format:`{event}${a[0]||""} {patient} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Kn(n,e,t,r,o){let i=[];if(i.push({type:"role",role:"event",optional:false}),r.position==="after"){let s=r.primary.split(/\s+/);if(s.length>1)for(let l of s)i.push({type:"literal",value:l});else {let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(l);}}let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(a),{id:`${n.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(o.basePriority??100)+48,template:{format:`{event} ${r.primary} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function Yn(n,e,t,r){let o=e.eventHandler?.temporalMarkers;if(!o||o.length===0)return null;let i=[];i.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&i.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),i.push({type:"literal",value:o[0],alternatives:o.slice(1)}),i.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.patient;if(a?.primary){let l=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};i.push(l);}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(s),{id:`${n.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(r.basePriority??100)+49,template:{format:`{event} ${o[0]} {patient} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function Qn(n,e,t,r,o){let i=[];if(i.push({type:"role",role:"event",optional:false}),r.position==="after"){let u=r.primary.split(/\s+/);if(u.length>1)for(let p of u)i.push({type:"literal",value:p});else {let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(p);}}let s=[...n.roles.filter(u=>u.required)].sort((u,p)=>{let d=u.sovPosition??999,m=p.sovPosition??999;return d-m});for(let u of s){i.push({type:"role",role:u.role,optional:false});let p,d;if(u.markerOverride&&u.markerOverride[e.code]!==void 0)p=u.markerOverride[e.code];else {let m=e.roleMarkers[u.role];m&&(p=m.primary,d=m.alternatives);}if(p){let m=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};i.push(m);}}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(l);let c=s.map(u=>`{${u.role}}`).join(" ");return {id:`${n.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(o.basePriority??100)+55,template:{format:`{event} ${r.primary} ${c} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},...Object.fromEntries(s.map(u=>[u.role,{fromRole:u.role}]))}}}function Xn(n,e,t,r,o){let i=[],s=[...n.roles.filter(f=>f.required)].sort((f,y)=>{let g=f.sovPosition??999,E=y.sovPosition??999;return g-E}),l=s[0];i.push({type:"role",role:l.role,optional:false});let c;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)c=l.markerOverride[e.code];else {let f=e.roleMarkers[l.role];f&&(c=f.primary);}if(c&&i.push({type:"literal",value:c}),i.push({type:"role",role:"event",optional:false}),r.position==="after"){let f=r.primary.split(/\s+/);if(f.length>1)for(let y of f)i.push({type:"literal",value:y});else {let y=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(y);}}let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(u);let p=s[1];i.push({type:"role",role:p.role,optional:false});let d,m;if(p.markerOverride&&p.markerOverride[e.code]!==void 0)d=p.markerOverride[e.code];else {let f=e.roleMarkers[p.role];f&&(d=f.primary,m=f.alternatives);}if(d){let f=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};i.push(f);}return {id:`${n.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(o.basePriority??100)+48,template:{format:`{${l.role}} {event} ${r.primary} ${t.primary} {${p.role}}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},[l.role]:{fromRole:l.role},[p.role]:{fromRole:p.role}}}}function je(n,e,t,r,o){let i=[];if(r.position==="before"){let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(l);}i.push({type:"role",role:"event",optional:false});let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(a),i.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&i.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),{id:`${n.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(o.basePriority??100)+50,template:{format:`${r.primary} {event} ${t.primary} {patient} ${s?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Jn(n,e,t,r,o){let i=[],a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(a),i.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;if(s&&i.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),r.position==="before"){let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(l);}return i.push({type:"role",role:"event",optional:false}),{id:`${n.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(o.basePriority??100)+45,template:{format:`${t.primary} {patient} ${s?.primary||""} {destination?} ${r.primary} {event}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Zn(n,e,t,r,o){let i=[],a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(a);let l=[...n.roles.filter(u=>u.required)].sort((u,p)=>{let d=u.svoPosition??999,m=p.svoPosition??999;return d-m});for(let u of l){let p,d;if(u.markerOverride&&u.markerOverride[e.code]!==void 0)p=u.markerOverride[e.code];else {let m=e.roleMarkers[u.role];m&&(p=m.primary,d=m.alternatives);}if(p){let m=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};i.push(m);}i.push({type:"role",role:u.role,optional:false});}if(r.position==="before"){let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(u);}i.push({type:"role",role:"event",optional:false});let c=l.map(u=>`{${u.role}}`).join(" ");return {id:`${n.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(o.basePriority??100)+48,template:{format:`${t.primary} ${c} ${r.primary} {event}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},...Object.fromEntries(l.map(u=>[u.role,{fromRole:u.role}]))}}}function Ue(n,e,t,r,o){let i=[];if(r.position==="before"){let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(u);}i.push({type:"role",role:"event",optional:false});let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(a);let l=[...n.roles.filter(u=>u.required)].sort((u,p)=>{let d=u.svoPosition??999,m=p.svoPosition??999;return d-m});for(let u of l){let p,d;if(u.markerOverride&&u.markerOverride[e.code]!==void 0)p=u.markerOverride[e.code];else {let m=e.roleMarkers[u.role];m&&(p=m.primary,d=m.alternatives);}if(p){let m=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};i.push(m);}i.push({type:"role",role:u.role,optional:false});}let c=l.map(u=>`{${u.role}}`).join(" ");return {id:`${n.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(o.basePriority??100)+55,template:{format:`${r.primary} {event} ${t.primary} ${c}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},...Object.fromEntries(l.map(u=>[u.role,{fromRole:u.role}]))}}}function eo(n,e,t,r,o){let i=[],a=e.eventHandler?.negationMarker;if(r.position==="before"){let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(c);}if(a){let c=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};i.push(c);}i.push({type:"role",role:"event",optional:false});let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(s),i.push({type:"role",role:"patient",optional:false});let l=e.roleMarkers.destination;return l&&i.push({type:"group",optional:true,tokens:[l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary},{type:"role",role:"destination",optional:true}]}),{id:`${n.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(o.basePriority??100)+48,template:{format:`${r.primary} ${a?.primary||""} {event} ${t.primary} {patient} ${l?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function to(n,e,t,r){let o=[];o.push({type:"literal",value:"and",alternatives:["then"]}),o.push({type:"role",role:"event",optional:false});let i=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};o.push(i),o.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.destination;return a&&o.push({type:"group",optional:true,tokens:[a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary},{type:"role",role:"destination",optional:true}]}),{id:`${n.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(r.basePriority??100)+45,template:{format:`[proclitic?] {event} ${t.primary} {patient} ${a?.primary||""} {destination?}`,tokens:o},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var J={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function rt(n,e,t=J){let r=`${n.action}-${e.code}-generated`,o=t.basePriority??100,i=e.keywords[n.action];if(!i)throw new Error(`No keyword translation for '${n.action}' in ${e.code}`);let a=ao(n,e,i),s=nt(n,e),l=co(n,e,i);return {id:r,language:e.code,command:n.action,priority:o,template:{format:l,tokens:a},extraction:s}}function ro(n,e,t=J){if(n.roles.filter(s=>!s.required).length===0)return null;let o=n.roles.filter(s=>s.required),i={...n,roles:o};return {...rt(i,e,t),id:`${n.action}-${e.code}-generated-simple`,priority:(t.basePriority??100)-5,extraction:nt(n,e)}}function no(n,e,t=J){let r=[];if(r.push(rt(n,e,t)),t.generateSimpleVariants){let o=ro(n,e,t);o&&r.push(o);}return r}function oo(n,e=J){let t=[],r=zn();for(let o of r){if(!n.keywords[o.action])continue;let i=no(o,n,e);if(t.push(...i),n.eventHandler?.eventMarker){let a=io(o,n,e);t.push(...a);}}return t}function io(n,e,t=J){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let r=[],o=e.eventHandler.eventMarker,i=e.keywords[n.action];if(!i)return [];let s=n.roles.filter(l=>l.required).length===2;if(e.wordOrder==="SOV")if(s)r.push(Qn(n,e,i,o,t)),r.push(Xn(n,e,i,o,t));else {r.push(jn(n,e,i,o,t)),r.push(Un(n,e,i,o,t));let l=e.roleMarkers.destination;l&&l.primary!==o.primary&&r.push(Hn(n,e,i,o,t));let c=o.primary.split(/\s+/),u=o.alternatives?.some(d=>!d.includes(" ")&&d.length>1);c.length>1&&u&&r.push(Gn(n,e,i,o,t)),r.push(Kn(n,e,i,o,t));let p=Yn(n,e,i,t);p&&r.push(p);}else e.wordOrder==="VSO"?s?(r.push(Ue(n,e,i,o,t)),r.push(Zn(n,e,i,o,t))):(r.push(je(n,e,i,o,t)),r.push(Jn(n,e,i,o,t)),e.eventHandler?.negationMarker&&r.push(eo(n,e,i,o,t)),e.tokenization?.prefixes&&r.push(to(n,e,i,t))):s?r.push(Ue(n,e,i,o,t)):r.push(je(n,e,i,o,t));return r}function ao(n,e,t){let r=[],o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary},i=so(n,e);switch(e.wordOrder){case "SVO":r.push(o),r.push(...i);break;case "SOV":r.push(...i),r.push(o);break;case "VSO":r.push(o),r.push(...i);break;default:r.push(o),r.push(...i);}return r}function so(n,e){let t=[],r=tt(n.roles,e.wordOrder);for(let o of r){let i=lo(o,e);o.required?t.push(...i):t.push({type:"group",optional:true,tokens:i});}return t}function lo(n,e){let t=[],r=n.markerOverride?.[e.code],o=e.roleMarkers[n.role],i={type:"role",role:n.role,optional:!n.required,expectedTypes:n.expectedTypes};if(r!==void 0)(o?.position??"before")==="before"?(r&&t.push({type:"literal",value:r}),t.push(i)):(t.push(i),r&&t.push({type:"literal",value:r}));else if(o)if(o.position==="before"){if(o.primary){let a=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};t.push(a);}t.push(i);}else {t.push(i);let a=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};t.push(a);}else t.push(i);return t}function uo(n,e){let t={};for(let r of n.roles){let o=r.markerOverride?.[e.code],i=e.roleMarkers[r.role];o!==void 0?t[r.role]=o?{marker:o}:{}:i&&i.primary?t[r.role]=i.alternatives?{marker:i.primary,markerAlternatives:i.alternatives}:{marker:i.primary}:t[r.role]={};}return t}function nt(n,e){let t=uo(n,e),r={};for(let o of n.roles){let i=t[o.role]||{};!o.required&&o.default?r[o.role]={...i,default:o.default}:r[o.role]=i;}return r}function co(n,e,t){let r=[],i=tt(n.roles,e.wordOrder).map(a=>{let s=Wn(a,e),l="";return s&&s.primary?s.position==="before"?l=`${s.primary} {${a.role}}`:l=`{${a.role}} ${s.primary}`:l=`{${a.role}}`,a.required?l:`[${l}]`});switch(e.wordOrder){case "SVO":case "VSO":r.push(t.primary,...i);break;case "SOV":r.push(...i,t.primary);break;default:r.push(t.primary,...i);}return r.join(" ")}function po(){return [{id:"toggle-bn-full",language:"bn",command:"toggle",priority:100,template:{format:"{patient} \u0995\u09C7 \u099F\u0997\u09B2 \u0995\u09B0\u09C1\u09A8",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0995\u09C7"},{type:"literal",value:"\u099F\u0997\u09B2",alternatives:["\u09AA\u09B0\u09BF\u09AC\u09B0\u09CD\u09A4\u09A8"]},{type:"literal",value:"\u0995\u09B0\u09C1\u09A8"}]},extraction:{patient:{position:0}}},{id:"toggle-bn-simple",language:"bn",command:"toggle",priority:90,template:{format:"\u099F\u0997\u09B2 {patient}",tokens:[{type:"literal",value:"\u099F\u0997\u09B2",alternatives:["\u09AA\u09B0\u09BF\u09AC\u09B0\u09CD\u09A4\u09A8"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"toggle-bn-with-dest",language:"bn",command:"toggle",priority:95,template:{format:"{destination} \u098F {patient} \u0995\u09C7 \u099F\u0997\u09B2 \u0995\u09B0\u09C1\u09A8",tokens:[{type:"role",role:"destination"},{type:"literal",value:"\u098F",alternatives:["\u09A4\u09C7"]},{type:"role",role:"patient"},{type:"literal",value:"\u0995\u09C7"},{type:"literal",value:"\u099F\u0997\u09B2",alternatives:["\u09AA\u09B0\u09BF\u09AC\u09B0\u09CD\u09A4\u09A8"]},{type:"literal",value:"\u0995\u09B0\u09C1\u09A8"}]},extraction:{destination:{position:0},patient:{position:2}}}]}function mo(){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:true,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"}}}}]}function fo(){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:true,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"}}}}]}function vo(){return [{id:"toggle-hi-full",language:"hi",command:"toggle",priority:100,template:{format:"{patient} \u0915\u094B {destination} \u092A\u0930 \u091F\u0949\u0917\u0932 \u0915\u0930\u0947\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0915\u094B"},{type:"role",role:"destination"},{type:"literal",value:"\u092A\u0930"},{type:"literal",value:"\u091F\u0949\u0917\u0932",alternatives:["\u092C\u0926\u0932\u0947\u0902","\u092C\u0926\u0932"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0915\u0930\u0947\u0902",alternatives:["\u0915\u0930\u094B"]}]}]},extraction:{patient:{position:0},destination:{marker:"\u0915\u094B",position:2}}},{id:"toggle-hi-simple",language:"hi",command:"toggle",priority:90,template:{format:"{patient} \u091F\u0949\u0917\u0932 \u0915\u0930\u0947\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u091F\u0949\u0917\u0932",alternatives:["\u092C\u0926\u0932\u0947\u0902","\u092C\u0926\u0932"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0915\u0930\u0947\u0902",alternatives:["\u0915\u0930\u094B"]}]}]},extraction:{patient:{position:0},destination:{default:{type:"reference",value:"me"}}}},{id:"toggle-hi-bare",language:"hi",command:"toggle",priority:80,template:{format:"\u091F\u0949\u0917\u0932 {patient}",tokens:[{type:"literal",value:"\u091F\u0949\u0917\u0932",alternatives:["\u092C\u0926\u0932\u0947\u0902","\u092C\u0926\u0932"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function ho(){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:true,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"}}}}]}function yo(){return [{id:"toggle-pl-full",language:"pl",command:"toggle",priority:100,template:{format:"prze\u0142\u0105cz {patient} na {destination}",tokens:[{type:"literal",value:"prze\u0142\u0105cz",alternatives:["przelacz","prze\u0142\u0105czaj"]},{type:"role",role:"patient"},{type:"group",optional:true,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\u0142\u0105cz {patient}",tokens:[{type:"literal",value:"prze\u0142\u0105cz",alternatives:["przelacz","prze\u0142\u0105czaj"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function go(){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}}}]}function Eo(){return [{id:"toggle-ru-full",language:"ru",command:"toggle",priority:100,template:{format:"\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C {patient} \u043D\u0430 {destination}",tokens:[{type:"literal",value:"\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C",alternatives:["\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u043D\u0430",alternatives:["\u0432","\u0434\u043B\u044F"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"\u043D\u0430",markerAlternatives:["\u0432","\u0434\u043B\u044F"],default:{type:"reference",value:"me"}}}},{id:"toggle-ru-simple",language:"ru",command:"toggle",priority:90,template:{format:"\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C {patient}",tokens:[{type:"literal",value:"\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C",alternatives:["\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function ko(){return [{id:"toggle-th-simple",language:"th",command:"toggle",priority:100,template:{format:"\u0E2A\u0E25\u0E31\u0E1A {patient}",tokens:[{type:"literal",value:"\u0E2A\u0E25\u0E31\u0E1A"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"toggle-th-with-dest",language:"th",command:"toggle",priority:95,template:{format:"\u0E2A\u0E25\u0E31\u0E1A {patient} \u0E43\u0E19 {destination}",tokens:[{type:"literal",value:"\u0E2A\u0E25\u0E31\u0E1A"},{type:"role",role:"patient"},{type:"literal",value:"\u0E43\u0E19"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"\u0E43\u0E19",position:3}}}]}function To(){return [{id:"toggle-uk-full",language:"uk",command:"toggle",priority:100,template:{format:"\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0443\u0442\u0438 {patient} \u043D\u0430 {destination}",tokens:[{type:"literal",value:"\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0443\u0442\u0438",alternatives:["\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0438"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u043D\u0430",alternatives:["\u0432","\u0434\u043B\u044F"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"\u043D\u0430",markerAlternatives:["\u0432","\u0434\u043B\u044F"],default:{type:"reference",value:"me"}}}},{id:"toggle-uk-simple",language:"uk",command:"toggle",priority:90,template:{format:"\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0443\u0442\u0438 {patient}",tokens:[{type:"literal",value:"\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0443\u0442\u0438",alternatives:["\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0438"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function bo(){return [{id:"toggle-vi-full",language:"vi",command:"toggle",priority:100,template:{format:"chuy\u1EC3n \u0111\u1ED5i {patient} tr\xEAn {target}",tokens:[{type:"literal",value:"chuy\u1EC3n \u0111\u1ED5i",alternatives:["chuy\u1EC3n","b\u1EADt t\u1EAFt"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"tr\xEAn",alternatives:["t\u1EA1i","\u1EDF"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"tr\xEAn",markerAlternatives:["t\u1EA1i","\u1EDF"],default:{type:"reference",value:"me"}}}},{id:"toggle-vi-simple",language:"vi",command:"toggle",priority:90,template:{format:"chuy\u1EC3n \u0111\u1ED5i {patient}",tokens:[{type:"literal",value:"chuy\u1EC3n \u0111\u1ED5i",alternatives:["chuy\u1EC3n","b\u1EADt t\u1EAFt"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function So(){return [{id:"toggle-zh-full",language:"zh",command:"toggle",priority:100,template:{format:"\u5207\u6362 {patient} \u5728 {target}",tokens:[{type:"literal",value:"\u5207\u6362"},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u5728",alternatives:["\u5230","\u4E8E"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"\u5728",markerAlternatives:["\u5230","\u4E8E"],default:{type:"reference",value:"me"}}}},{id:"toggle-zh-simple",language:"zh",command:"toggle",priority:90,template:{format:"\u5207\u6362 {patient}",tokens:[{type:"literal",value:"\u5207\u6362"},{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:"\u628A {patient} \u5207\u6362",tokens:[{type:"literal",value:"\u628A"},{type:"role",role:"patient"},{type:"literal",value:"\u5207\u6362"}]},extraction:{patient:{marker:"\u628A"},destination:{default:{type:"reference",value:"me"}}}},{id:"toggle-zh-full-ba",language:"zh",command:"toggle",priority:98,template:{format:"\u5728 {target} \u628A {patient} \u5207\u6362",tokens:[{type:"literal",value:"\u5728",alternatives:["\u5230","\u4E8E"]},{type:"role",role:"destination"},{type:"literal",value:"\u628A"},{type:"role",role:"patient"},{type:"literal",value:"\u5207\u6362"}]},extraction:{destination:{marker:"\u5728",markerAlternatives:["\u5230","\u4E8E"]},patient:{marker:"\u628A"}}}]}function xo(n){switch(n){case "bn":return po();case "en":return mo();case "es":return fo();case "hi":return vo();case "it":return ho();case "pl":return yo();case "qu":return go();case "ru":return Eo();case "th":return ko();case "uk":return To();case "vi":return bo();case "zh":return So();default:return []}}function wo(){return [{id:"put-bn-full",language:"bn",command:"put",priority:100,template:{format:"{patient} \u0995\u09C7 {destination} \u098F \u09B0\u09BE\u0996\u09C1\u09A8",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0995\u09C7"},{type:"role",role:"destination"},{type:"literal",value:"\u098F",alternatives:["\u09A4\u09C7"]},{type:"literal",value:"\u09B0\u09BE\u0996\u09C1\u09A8",alternatives:["\u09B0\u09BE\u0996"]}]},extraction:{patient:{position:0},destination:{marker:"\u098F",position:2}}},{id:"put-bn-simple",language:"bn",command:"put",priority:90,template:{format:"\u09B0\u09BE\u0996\u09C1\u09A8 {patient} {destination} \u098F",tokens:[{type:"literal",value:"\u09B0\u09BE\u0996\u09C1\u09A8",alternatives:["\u09B0\u09BE\u0996"]},{type:"role",role:"patient"},{type:"role",role:"destination"},{type:"literal",value:"\u098F",alternatives:["\u09A4\u09C7"]}]},extraction:{patient:{position:1},destination:{position:2}}}]}function Ao(){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"}}}}]}function Co(){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\xE9s de {destination}",tokens:[{type:"literal",value:"poner",alternatives:["pon","colocar"]},{type:"role",role:"patient"},{type:"literal",value:"despu\xE9s de",alternatives:["despues de","despu\xE9s"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"despu\xE9s de",markerAlternatives:["despues de","despu\xE9s"]},manner:{default:{type:"literal",value:"after"}}}}]}function Po(){return [{id:"put-hi-full",language:"hi",command:"put",priority:100,template:{format:"{patient} \u0915\u094B {destination} \u092E\u0947\u0902 \u0930\u0916\u0947\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0915\u094B"},{type:"role",role:"destination"},{type:"literal",value:"\u092E\u0947\u0902"},{type:"literal",value:"\u0930\u0916\u0947\u0902",alternatives:["\u0930\u0916","\u0921\u093E\u0932\u0947\u0902","\u0921\u093E\u0932"]}]},extraction:{patient:{position:0},destination:{marker:"\u092E\u0947\u0902",position:3}}},{id:"put-hi-simple",language:"hi",command:"put",priority:90,template:{format:"{patient} \u0930\u0916\u0947\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0930\u0916\u0947\u0902",alternatives:["\u0930\u0916","\u0921\u093E\u0932\u0947\u0902","\u0921\u093E\u0932"]}]},extraction:{patient:{position:0},destination:{default:{type:"reference",value:"me"}}}},{id:"put-hi-bare",language:"hi",command:"put",priority:80,template:{format:"\u0930\u0916\u0947\u0902 {patient}",tokens:[{type:"literal",value:"\u0930\u0916\u0947\u0902",alternatives:["\u0930\u0916","\u0921\u093E\u0932\u0947\u0902","\u0921\u093E\u0932"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function Ro(){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}}}]}function Oo(){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:true,tokens:[{type:"literal",value:"in",alternatives:["dentro","nel"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"in",markerAlternatives:["dentro","nel"]}}},{id:"put-it-simple",language:"it",command:"put",priority:90,template:{format:"mettere {patient}",tokens:[{type:"literal",value:"mettere",alternatives:["metti","inserire","put"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function _o(){return [{id:"put-pl-full",language:"pl",command:"put",priority:100,template:{format:"umie\u015B\u0107 {patient} w {destination}",tokens:[{type:"literal",value:"umie\u015B\u0107",alternatives:["umiesc","wstaw","w\u0142\xF3\u017C","wloz"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"w",alternatives:["do","na"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"w",markerAlternatives:["do","na"]}}},{id:"put-pl-before",language:"pl",command:"put",priority:95,template:{format:"umie\u015B\u0107 {patient} przed {destination}",tokens:[{type:"literal",value:"umie\u015B\u0107",alternatives:["umiesc","wstaw"]},{type:"role",role:"patient"},{type:"literal",value:"przed"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"przed"},manner:{default:{type:"literal",value:"before"}}}},{id:"put-pl-after",language:"pl",command:"put",priority:95,template:{format:"umie\u015B\u0107 {patient} po {destination}",tokens:[{type:"literal",value:"umie\u015B\u0107",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"}}}}]}function No(){return [{id:"put-ru-full",language:"ru",command:"put",priority:100,template:{format:"\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C {patient} \u0432 {destination}",tokens:[{type:"literal",value:"\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C",alternatives:["\u043F\u043E\u043B\u043E\u0436\u0438","\u043F\u043E\u043C\u0435\u0441\u0442\u0438\u0442\u044C","\u043F\u043E\u043C\u0435\u0441\u0442\u0438","\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044C","\u0432\u0441\u0442\u0430\u0432\u044C"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0432",alternatives:["\u0432\u043E","\u043D\u0430"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"\u0432",markerAlternatives:["\u0432\u043E","\u043D\u0430"]}}},{id:"put-ru-before",language:"ru",command:"put",priority:95,template:{format:"\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C {patient} \u043F\u0435\u0440\u0435\u0434 {destination}",tokens:[{type:"literal",value:"\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C",alternatives:["\u043F\u043E\u043B\u043E\u0436\u0438","\u043F\u043E\u043C\u0435\u0441\u0442\u0438\u0442\u044C","\u043F\u043E\u043C\u0435\u0441\u0442\u0438"]},{type:"role",role:"patient"},{type:"literal",value:"\u043F\u0435\u0440\u0435\u0434",alternatives:["\u0434\u043E"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"\u043F\u0435\u0440\u0435\u0434",markerAlternatives:["\u0434\u043E"]},manner:{default:{type:"literal",value:"before"}}}},{id:"put-ru-after",language:"ru",command:"put",priority:95,template:{format:"\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C {patient} \u043F\u043E\u0441\u043B\u0435 {destination}",tokens:[{type:"literal",value:"\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C",alternatives:["\u043F\u043E\u043B\u043E\u0436\u0438","\u043F\u043E\u043C\u0435\u0441\u0442\u0438\u0442\u044C","\u043F\u043E\u043C\u0435\u0441\u0442\u0438"]},{type:"role",role:"patient"},{type:"literal",value:"\u043F\u043E\u0441\u043B\u0435"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"\u043F\u043E\u0441\u043B\u0435"},manner:{default:{type:"literal",value:"after"}}}}]}function Io(){return [{id:"put-th-full",language:"th",command:"put",priority:100,template:{format:"\u0E43\u0E2A\u0E48 {patient} \u0E43\u0E19 {destination}",tokens:[{type:"literal",value:"\u0E43\u0E2A\u0E48",alternatives:["\u0E27\u0E32\u0E07"]},{type:"role",role:"patient"},{type:"literal",value:"\u0E43\u0E19"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"\u0E43\u0E19",position:3}}}]}function Mo(){return [{id:"put-uk-full",language:"uk",command:"put",priority:100,template:{format:"\u043F\u043E\u043A\u043B\u0430\u0441\u0442\u0438 {patient} \u0432 {destination}",tokens:[{type:"literal",value:"\u043F\u043E\u043A\u043B\u0430\u0441\u0442\u0438",alternatives:["\u043F\u043E\u043A\u043B\u0430\u0434\u0438","\u043F\u043E\u043C\u0456\u0441\u0442\u0438\u0442\u0438","\u043F\u043E\u043C\u0456\u0441\u0442\u0438","\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u0438","\u0432\u0441\u0442\u0430\u0432"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0432",alternatives:["\u0443","\u043D\u0430"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"\u0432",markerAlternatives:["\u0443","\u043D\u0430"]}}},{id:"put-uk-before",language:"uk",command:"put",priority:95,template:{format:"\u043F\u043E\u043A\u043B\u0430\u0441\u0442\u0438 {patient} \u043F\u0435\u0440\u0435\u0434 {destination}",tokens:[{type:"literal",value:"\u043F\u043E\u043A\u043B\u0430\u0441\u0442\u0438",alternatives:["\u043F\u043E\u043A\u043B\u0430\u0434\u0438","\u043F\u043E\u043C\u0456\u0441\u0442\u0438\u0442\u0438","\u043F\u043E\u043C\u0456\u0441\u0442\u0438"]},{type:"role",role:"patient"},{type:"literal",value:"\u043F\u0435\u0440\u0435\u0434",alternatives:["\u0434\u043E"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"\u043F\u0435\u0440\u0435\u0434",markerAlternatives:["\u0434\u043E"]},manner:{default:{type:"literal",value:"before"}}}},{id:"put-uk-after",language:"uk",command:"put",priority:95,template:{format:"\u043F\u043E\u043A\u043B\u0430\u0441\u0442\u0438 {patient} \u043F\u0456\u0441\u043B\u044F {destination}",tokens:[{type:"literal",value:"\u043F\u043E\u043A\u043B\u0430\u0441\u0442\u0438",alternatives:["\u043F\u043E\u043A\u043B\u0430\u0434\u0438","\u043F\u043E\u043C\u0456\u0441\u0442\u0438\u0442\u0438","\u043F\u043E\u043C\u0456\u0441\u0442\u0438"]},{type:"role",role:"patient"},{type:"literal",value:"\u043F\u0456\u0441\u043B\u044F"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"\u043F\u0456\u0441\u043B\u044F"},manner:{default:{type:"literal",value:"after"}}}}]}function Lo(){return [{id:"put-vi-into",language:"vi",command:"put",priority:100,template:{format:"\u0111\u1EB7t {patient} v\xE0o {target}",tokens:[{type:"literal",value:"\u0111\u1EB7t",alternatives:["\u0111\u1EC3","\u0111\u01B0a"]},{type:"role",role:"patient"},{type:"literal",value:"v\xE0o",alternatives:["v\xE0o trong"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"v\xE0o",markerAlternatives:["v\xE0o trong"]}}},{id:"put-vi-before",language:"vi",command:"put",priority:95,template:{format:"\u0111\u1EB7t {patient} tr\u01B0\u1EDBc {target}",tokens:[{type:"literal",value:"\u0111\u1EB7t",alternatives:["\u0111\u1EC3","\u0111\u01B0a"]},{type:"role",role:"patient"},{type:"literal",value:"tr\u01B0\u1EDBc",alternatives:["tr\u01B0\u1EDBc khi"]},{type:"role",role:"manner"}]},extraction:{patient:{position:1},manner:{marker:"tr\u01B0\u1EDBc",markerAlternatives:["tr\u01B0\u1EDBc khi"]}}},{id:"put-vi-after",language:"vi",command:"put",priority:95,template:{format:"\u0111\u1EB7t {patient} sau {target}",tokens:[{type:"literal",value:"\u0111\u1EB7t",alternatives:["\u0111\u1EC3","\u0111\u01B0a"]},{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"]}}}]}function Do(){return [{id:"put-zh-full",language:"zh",command:"put",priority:100,template:{format:"\u653E\u7F6E {patient} \u5230 {destination}",tokens:[{type:"literal",value:"\u653E\u7F6E",alternatives:["\u653E","\u653E\u5165","\u7F6E\u5165","put"]},{type:"role",role:"patient",expectedTypes:["literal","selector","reference","expression"]},{type:"literal",value:"\u5230",alternatives:["\u5728","\u4E8E","\u5165"]},{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:"\u628A {patient} \u653E\u5230 {destination}",tokens:[{type:"literal",value:"\u628A"},{type:"role",role:"patient",expectedTypes:["literal","selector","reference","expression"]},{type:"literal",value:"\u653E\u5230",alternatives:["\u653E\u5728","\u653E\u5165"]},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{position:3}}}]}function $o(n){switch(n){case "bn":return wo();case "en":return Ao();case "es":return Co();case "hi":return Po();case "id":return Ro();case "it":return Oo();case "pl":return _o();case "ru":return No();case "th":return Io();case "uk":return Mo();case "vi":return Lo();case "zh":return Do();default:return []}}function Bo(){return [{id:"event-handler-bn-sov",language:"bn",command:"on",priority:100,template:{format:"{event} \u09A4\u09C7 {action}",tokens:[{type:"role",role:"event"},{type:"literal",value:"\u09A4\u09C7",alternatives:["\u098F"]},{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} \u09A5\u09C7\u0995\u09C7 {event} \u09A4\u09C7 {action}",tokens:[{type:"role",role:"source"},{type:"literal",value:"\u09A5\u09C7\u0995\u09C7"},{type:"role",role:"event"},{type:"literal",value:"\u09A4\u09C7",alternatives:["\u098F"]},{type:"role",role:"action"}]},extraction:{source:{position:0},event:{marker:"\u09A4\u09C7",position:2},action:{position:4}}},{id:"event-handler-bn-when",language:"bn",command:"on",priority:90,template:{format:"\u09AF\u0996\u09A8 {event} {action}",tokens:[{type:"literal",value:"\u09AF\u0996\u09A8"},{type:"role",role:"event"},{type:"role",role:"action"}]},extraction:{event:{position:1},action:{position:2}}}]}function qo(){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}}}]}function Vo(){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}}}]}function Fo(){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}}}]}function zo(){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:"\xE0 {event} {body}",tokens:[{type:"literal",value:"\xE0",alternatives:["au"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function Wo(){return [{id:"event-hi-standard",language:"hi",command:"on",priority:100,template:{format:"{event} \u092A\u0930",tokens:[{type:"role",role:"event"},{type:"literal",value:"\u092A\u0930",alternatives:["\u092E\u0947\u0902","\u091C\u092C"]}]},extraction:{event:{position:0}}},{id:"event-hi-with-source",language:"hi",command:"on",priority:95,template:{format:"{source} \u0938\u0947 {event} \u092A\u0930",tokens:[{type:"role",role:"source"},{type:"literal",value:"\u0938\u0947"},{type:"role",role:"event"},{type:"literal",value:"\u092A\u0930",alternatives:["\u092E\u0947\u0902","\u091C\u092C"]}]},extraction:{source:{position:0},event:{marker:"\u0938\u0947",position:2}}},{id:"event-hi-bare",language:"hi",command:"on",priority:80,template:{format:"{event}",tokens:[{type:"role",role:"event"}]},extraction:{event:{position:0}}}]}function jo(){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}}}]}function Uo(){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}}}]}function Ho(){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"}}}]}function Go(){return [{id:"event-handler-pl-full",language:"pl",command:"on",priority:100,template:{format:"gdy {event} na {source}",tokens:[{type:"literal",value:"gdy",alternatives:["przy","na"]},{type:"role",role:"event"},{type:"group",optional:true,tokens:[{type:"literal",value:"na",alternatives:["w","przy","z"]},{type:"role",role:"source"}]}]},extraction:{event:{position:1},source:{marker:"na",markerAlternatives:["w","przy","z"],default:{type:"reference",value:"me"}}}},{id:"event-handler-pl-simple",language:"pl",command:"on",priority:90,template:{format:"gdy {event}",tokens:[{type:"literal",value:"gdy",alternatives:["przy","na"]},{type:"role",role:"event"}]},extraction:{event:{position:1},source:{default:{type:"reference",value:"me"}}}}]}function Ko(){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:["\xE0"]},{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:["\xE0"]},{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}}}]}function Yo(){return [{id:"event-qu-source",language:"qu",command:"on",priority:110,template:{format:"{event} pi {source} manta {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"pi"},{type:"role",role:"source"},{type:"literal",value:"manta"}]},extraction:{event:{position:0},source:{marker:"manta"}}},{id:"event-qu-kaqtin",language:"qu",command:"on",priority:105,template:{format:"{event} kaqtin {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"kaqtin",alternatives:["qtin","ptin"]}]},extraction:{event:{position:0}}},{id:"event-qu-standard",language:"qu",command:"on",priority:100,template:{format:"{event} pi {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"pi",alternatives:["kaqpi","kaqpim"]}]},extraction:{event:{position:0}}}]}function Qo(){return [{id:"event-handler-ru-full",language:"ru",command:"on",priority:100,template:{format:"\u043F\u0440\u0438 {event} \u043D\u0430 {source}",tokens:[{type:"literal",value:"\u043F\u0440\u0438",alternatives:["\u043A\u043E\u0433\u0434\u0430"]},{type:"role",role:"event"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u043D\u0430",alternatives:["\u0432","\u043E\u0442"]},{type:"role",role:"source"}]}]},extraction:{event:{position:1},source:{marker:"\u043D\u0430",markerAlternatives:["\u0432","\u043E\u0442"],default:{type:"reference",value:"me"}}}},{id:"event-handler-ru-simple",language:"ru",command:"on",priority:90,template:{format:"\u043F\u0440\u0438 {event}",tokens:[{type:"literal",value:"\u043F\u0440\u0438",alternatives:["\u043A\u043E\u0433\u0434\u0430"]},{type:"role",role:"event"}]},extraction:{event:{position:1},source:{default:{type:"reference",value:"me"}}}}]}function Xo(){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}}}]}function Jo(){return [{id:"event-handler-th-svo",language:"th",command:"on",priority:100,template:{format:"\u0E40\u0E21\u0E37\u0E48\u0E2D {event} {action}",tokens:[{type:"literal",value:"\u0E40\u0E21\u0E37\u0E48\u0E2D",alternatives:["\u0E15\u0E2D\u0E19"]},{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:"\u0E40\u0E21\u0E37\u0E48\u0E2D {event} \u0E08\u0E32\u0E01 {source} {action}",tokens:[{type:"literal",value:"\u0E40\u0E21\u0E37\u0E48\u0E2D",alternatives:["\u0E15\u0E2D\u0E19"]},{type:"role",role:"event"},{type:"literal",value:"\u0E08\u0E32\u0E01"},{type:"role",role:"source"},{type:"role",role:"action"}]},extraction:{event:{position:1},source:{marker:"\u0E08\u0E32\u0E01",position:3},action:{position:4}}}]}function Zo(){return [{id:"event-tl-kapag-source",language:"tl",command:"on",priority:115,template:{format:"kapag {event} mula_sa {source} {body}",tokens:[{type:"literal",value:"kapag",alternatives:["kung","sa"]},{type:"role",role:"event"},{type:"literal",value:"mula_sa",alternatives:["galing_sa"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"mula_sa"}}},{id:"event-tl-kapag",language:"tl",command:"on",priority:105,template:{format:"kapag {event} {body}",tokens:[{type:"literal",value:"kapag",alternatives:["kung","sa"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function ei(){return [{id:"event-handler-uk-full",language:"uk",command:"on",priority:100,template:{format:"\u043F\u0440\u0438 {event} \u043D\u0430 {source}",tokens:[{type:"literal",value:"\u043F\u0440\u0438",alternatives:["\u043A\u043E\u043B\u0438"]},{type:"role",role:"event"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u043D\u0430",alternatives:["\u0432","\u0432\u0456\u0434"]},{type:"role",role:"source"}]}]},extraction:{event:{position:1},source:{marker:"\u043D\u0430",markerAlternatives:["\u0432","\u0432\u0456\u0434"],default:{type:"reference",value:"me"}}}},{id:"event-handler-uk-simple",language:"uk",command:"on",priority:90,template:{format:"\u043F\u0440\u0438 {event}",tokens:[{type:"literal",value:"\u043F\u0440\u0438",alternatives:["\u043A\u043E\u043B\u0438"]},{type:"role",role:"event"}]},extraction:{event:{position:1},source:{default:{type:"reference",value:"me"}}}}]}function ti(){return [{id:"event-handler-vi-full",language:"vi",command:"on",priority:100,template:{format:"khi {event} tr\xEAn {source}",tokens:[{type:"literal",value:"khi",alternatives:["l\xFAc","tr\xEAn"]},{type:"role",role:"event"},{type:"group",optional:true,tokens:[{type:"literal",value:"tr\xEAn",alternatives:["t\u1EA1i"]},{type:"role",role:"source"}]}]},extraction:{event:{position:1},source:{marker:"tr\xEAn",markerAlternatives:["t\u1EA1i"],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\xFAc","tr\xEAn"]},{type:"role",role:"event"}]},extraction:{event:{position:1},source:{default:{type:"reference",value:"me"}}}}]}function ri(){return [{id:"event-zh-temporal-source",language:"zh",command:"on",priority:115,template:{format:"{event} \u7684\u65F6\u5019 \u4ECE {source} {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"\u7684\u65F6\u5019",alternatives:["\u65F6\u5019","\u65F6"]},{type:"literal",value:"\u4ECE",alternatives:["\u5728"]},{type:"role",role:"source"}]},extraction:{event:{position:0},source:{marker:"\u4ECE",markerAlternatives:["\u5728"]}}},{id:"event-zh-source",language:"zh",command:"on",priority:110,template:{format:"\u5F53 {event} \u4ECE {source} {body}",tokens:[{type:"literal",value:"\u5F53"},{type:"role",role:"event"},{type:"literal",value:"\u4ECE",alternatives:["\u5728"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"\u4ECE",markerAlternatives:["\u5728"]}}},{id:"event-zh-immediate",language:"zh",command:"on",priority:108,template:{format:"\u4E00 {event} \u5C31 {body}",tokens:[{type:"literal",value:"\u4E00"},{type:"role",role:"event"},{type:"literal",value:"\u5C31"}]},extraction:{event:{position:1}}},{id:"event-zh-temporal",language:"zh",command:"on",priority:105,template:{format:"{event} \u7684\u65F6\u5019 {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"\u7684\u65F6\u5019",alternatives:["\u65F6\u5019","\u65F6"]}]},extraction:{event:{position:0}}},{id:"event-zh-whenever",language:"zh",command:"on",priority:103,template:{format:"\u6BCF\u5F53 {event} {body}",tokens:[{type:"literal",value:"\u6BCF\u5F53",alternatives:["\u6BCF\u6B21"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-zh-standard",language:"zh",command:"on",priority:100,template:{format:"\u5F53 {event} {body}",tokens:[{type:"literal",value:"\u5F53"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-zh-completion",language:"zh",command:"on",priority:95,template:{format:"{event} \u4E86 {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"\u4E86"}]},extraction:{event:{position:0}}},{id:"event-zh-conditional",language:"zh",command:"on",priority:90,template:{format:"\u5982\u679C {event} {body}",tokens:[{type:"literal",value:"\u5982\u679C",alternatives:["\u82E5","\u5047\u5982"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function ni(n){switch(n){case "bn":return Bo();case "de":return qo();case "en":return Vo();case "es":return Fo();case "fr":return zo();case "hi":return Wo();case "id":return jo();case "it":return Uo();case "ms":return Ho();case "pl":return Go();case "pt":return Ko();case "qu":return Yo();case "ru":return Qo();case "sw":return Xo();case "th":return Jo();case "tl":return Zo();case "uk":return ei();case "vi":return ti();case "zh":return ri();default:return []}}var oi={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"}}},ii={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}}},ai={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}}},si={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"}}}},li={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"}}}},ui={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"}}},ci={id:"for-en-basic",language:"en",command:"for",priority:100,template:{format:"for {patient} in {source}",tokens:[{type:"literal",value:"for"},{type:"role",role:"patient",expectedTypes:["expression","reference"]},{type:"literal",value:"in"},{type:"role",role:"source",expectedTypes:["selector","expression","reference"]}]},extraction:{patient:{position:1},source:{marker:"in"},loopType:{default:{type:"literal",value:"for"}}}},pi={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}}},di={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}}},mi={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}}},fi={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}}};function vi(){let n=[];n.push(...xo("en")),n.push(...$o("en")),n.push(...ni("en")),n.push(oi,ii,ai,si,li,ui,ci,pi,di,mi,fi);let e=oo(Ee);return n.push(...e),n}Sr("en",Fr,Ee);wr("en",vi());var hi=Object.defineProperty,yi=Object.getOwnPropertyNames,ht=(n,e)=>function(){return n&&(e=(0, n[yi(n)[0]])(n=0)),e},gi=(n,e)=>{for(var t in e)hi(n,t,{get:e[t],enumerable:true});};function ot(n,e){return n.replace(/\{(\w+)\}/g,(t,r)=>String(e[r]??`{${r}}`))}function P(n,e,t={},r){let o=yt[n],i=ot(o,t),a=gt[n],s=a?ot(a,t):void 0;return {code:n,message:i,severity:e,...r&&{role:r},...s&&{suggestion:s}}}var h,yt,gt,Ei=ht({"src/generators/schema-error-codes.ts"(){h={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"},yt={[h.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[h.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[h.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[h.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[h.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[h.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.",[h.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.",[h.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[h.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[h.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[h.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[h.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[h.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[h.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[h.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[h.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},gt={[h.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[h.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[h.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[h.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[h.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[h.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[h.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[h.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[h.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[h.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[h.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[h.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[h.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),Et={};gi(Et,{SchemaErrorCodes:()=>h,formatValidationResults:()=>Ai,getValidationStats:()=>Ci,validateAllKeywordCollisions:()=>Ri,validateAllSchemas:()=>wi,validateCommandSchema:()=>kt,validateKeywordCollisions:()=>Tt,validateRoleValues:()=>Pi});function ki(n,e){return {action:n,items:e,get notes(){return e.filter(t=>t.severity==="note").map(t=>t.message)},get warnings(){return e.filter(t=>t.severity==="warning").map(t=>t.message)},get errors(){return e.filter(t=>t.severity==="error").map(t=>t.message)}}}function kt(n){let e=[];for(let r of n.roles)r.expectedTypes.includes("literal")&&r.expectedTypes.includes("selector")&&(r.role==="patient"&&Se.has(n.action)?e.push(P(h.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:r.role,command:n.action},r.role)):e.push(P(h.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:r.role},r.role))),r.expectedTypes.length>3&&!Se.has(n.action)&&e.push(P(h.TOO_MANY_EXPECTED_TYPES,"warning",{role:r.role,count:r.expectedTypes.length},r.role));for(let r of n.roles)r.selectorKinds&&r.selectorKinds.length>0&&(r.expectedTypes.includes("selector")||e.push(P(h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:r.role},r.role)));switch(n.action){case "transition":Ti(n,e);break;case "on":bi(n,e);break;case "if":case "unless":Si(n,e);break;case "repeat":case "for":case "while":xi(n,e);break}return n.roles.filter(r=>r.required).length===0&&(bt.has(n.action)?e.push(P(h.NO_REQUIRED_ROLES_EXPECTED,"note",{command:n.action})):e.push(P(h.NO_REQUIRED_ROLES,"warning",{}))),ki(n.action,e)}function Ti(n,e){let t=n.roles.find(o=>o.role==="patient"),r=n.roles.find(o=>o.role==="goal");t&&t.expectedTypes.includes("selector")&&e.push(P(h.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),t&&!r&&e.push(P(h.TRANSITION_MISSING_GOAL,"error",{}));}function bi(n,e){let t=n.roles.find(r=>r.role==="event");t||e.push(P(h.EVENT_HANDLER_MISSING_EVENT,"warning",{})),t&&!t.required&&e.push(P(h.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function Si(n,e){let t=n.roles.find(r=>r.role==="condition");t||e.push(P(h.CONDITIONAL_MISSING_CONDITION,"warning",{})),t&&!t.required&&e.push(P(h.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function xi(n,e){n.action==="for"?n.roles.find(r=>r.role==="source")||e.push(P(h.FOR_LOOP_MISSING_SOURCE,"warning",{})):n.action==="while"&&(n.roles.find(r=>r.role==="condition")||e.push(P(h.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function wi(n,e={}){let t=new Map,{includeNotes:r=false}=e;for(let[o,i]of Object.entries(n)){let a=kt(i),s=a.items.some(c=>c.severity==="warning"||c.severity==="error"),l=r&&a.items.some(c=>c.severity==="note");(s||l)&&t.set(o,a);}return t}function Ai(n,e={}){let t=[],{showNotes:r=false,showCodes:o=true}=e;for(let[i,a]of n){let s=a.items.filter(u=>u.severity==="error"),l=a.items.filter(u=>u.severity==="warning"),c=a.items.filter(u=>u.severity==="note");if(s.length>0){t.push(` \u274C ${i}:`);for(let u of s){let p=o?` [${u.code}]`:"";t.push(` ERROR${p}: ${u.message}`),u.suggestion&&t.push(` \u{1F4A1} Suggestion: ${u.suggestion}`);}}if(l.length>0){t.push(` \u26A0\uFE0F ${i}:`);for(let u of l){let p=o?` [${u.code}]`:"";t.push(` ${p?`${u.code}: `:""}${u.message}`),u.suggestion&&t.push(` \u{1F4A1} ${u.suggestion}`);}}if(r&&c.length>0){t.push(` \u2139\uFE0F ${i}:`);for(let u of c){let p=o?` [${u.code}]`:"";t.push(` ${p?`${u.code}: `:""}${u.message}`);}}}return t.join(`
|
|
4
|
+
`)}function Ci(n){let e=0,t=0,r=0,o={};for(let i of n.values())for(let a of i.items)a.severity==="error"?e++:a.severity==="warning"?t++:a.severity==="note"&&r++,o[a.code]=(o[a.code]||0)+1;return {totalCommands:n.size,errors:e,warnings:t,notes:r,byCode:o}}function Pi(n,e){let t=[];for(let r of e){let o=n.roles.find(i=>i.role===r.role);o&&(o.expectedTypes.length>0&&!o.expectedTypes.includes(r.type)&&(o.expectedTypes.includes("expression")||t.push({level:"error",role:r.role,message:`${n.action}.${r.role} expects type [${o.expectedTypes.join(", ")}], got '${r.type}'`,code:h.VALUE_TYPE_MISMATCH})),r.type==="selector"&&r.selectorKind&&o.selectorKinds&&o.selectorKinds.length>0&&(o.selectorKinds.includes(r.selectorKind)||t.push({level:"error",role:r.role,message:`${n.action}.${r.role} expects selector kind [${o.selectorKinds.join(", ")}], got '${r.selectorKind}'`,code:h.SELECTOR_KIND_MISMATCH})));}return t}function Tt(n){let e=[];if(!n.keywords)return {language:n.code,collisions:e};let t=new Map;for(let[o,i]of Object.entries(n.keywords)){if(!i||!i.primary)continue;let a=t.get(i.primary)||[];if(a.push({command:o,isPrimary:true}),t.set(i.primary,a),i.alternatives)for(let s of i.alternatives){let l=t.get(s)||[];l.push({command:o,isPrimary:false}),t.set(s,l);}}for(let[o,i]of t){let a=[...new Set(i.map(c=>c.command))];if(a.length<=1)continue;let s=i.filter(c=>c.isPrimary).length,l;s>=2?l="primary-primary":s===1?l="primary-alternative":l="alternative-alternative",e.push({keyword:o,commands:a.sort(),type:l});}let r={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((o,i)=>r[o.type]-r[i.type]),{language:n.code,collisions:e}}function Ri(n){let e=[];for(let[,t]of Object.entries(n)){let r=Tt(t);r.collisions.length>0&&e.push(r);}return e.sort((t,r)=>t.language.localeCompare(r.language))}var Se,bt,Oi=ht({"src/generators/schema-validator.ts"(){Ei(),Se=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),bt=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep"]);}});function ee(n){let e="complex";return n.startsWith("#")&&!n.includes(" ")?e="id":n.startsWith(".")&&!n.includes(" ")?e="class":n.startsWith("[")&&n.endsWith("]")?e="attribute":/^[a-z][a-z0-9]*$/i.test(n)&&(e="element"),{type:"selector",value:n,selectorKind:e}}function x(n,e){let t={type:"literal",value:n};return e!==void 0?{type:"literal",value:n,dataType:e}:t}function it(n){return Be(n)}function D(n){return {type:"reference",value:n}}function ke(n,e){return {type:"property-path",object:n,property:e}}function se(n,e,t){let r={kind:"command",action:n,roles:new Map(Object.entries(e))};return t!==void 0?{...r,metadata:t}:r}function at(n,e,t,r,o,i){let a=new Map;a.set("event",n);let s={kind:"event-handler",action:"on",roles:a,body:e};return t!==void 0&&(s.eventModifiers=t),r!==void 0&&(s.metadata=r),s}function st(n,e="then",t){let r={kind:"compound",action:"compound",roles:new Map,statements:n,chainType:e};return t!==void 0&&(r.metadata=t),r}function lt(n,e){return !e||e.length===0||e.includes(n)||e.includes("expression")?true:n==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):false}function _i(n,e){return n.possessive?.keywords?.[e]}var W=new Map,j=new Map,le=new Map,xe=null;function St(n,e){let t={...n};for(let r of Object.keys(e)){let o=e[r],i=n[r];o!==void 0&&(typeof o=="object"&&o!==null&&!Array.isArray(o)&&typeof i=="object"&&i!==null&&!Array.isArray(i)?t[r]=St(i,o):t[r]=o);}return t}function Ni(n,e){return St(n,e)}function Ae(n){if(!n.extends)return n;let e=j.get(n.extends);if(!e)return console.warn(`[Registry] Profile '${n.code}' extends '${n.extends}' but base is not registered. Make sure to import the base language before the variant.`),n;let t=Ae(e);return Ni(t,n)}function xt(n){xe=n;}var ut=new Map;function U(n){return n.split("-")[0]}function H(n){return n.includes("-")}function Ii(n){let e=W.get(n);if(!e&&H(n)){let t=U(n);e=W.get(t);}if(!e){let t=Array.from(W.keys()).join(", ");throw new Error(`Language '${n}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${n}';`)}return e}function Mi(n){let e=j.get(n);if(!e&&H(n)){let t=U(n);e=j.get(t);}if(!e){let t=Array.from(j.keys()).join(", ");throw new Error(`Language profile '${n}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${n}';`)}return Ae(e)}function Li(n){let e=W.get(n);return !e&&H(n)&&(e=W.get(U(n))),e}function $(n){let e=j.get(n);return !e&&H(n)&&(e=j.get(U(n))),e?Ae(e):void 0}function wt(){return Array.from(W.keys())}function Di(n,e){return Ii(e).tokenize(n)}function z(n){let e=le.get(n);if(!e&&H(n)&&(e=le.get(U(n))),e)return e;let t=ut.get(n);if(!t&&H(n)&&(t=ut.get(U(n))),t)return le.set(n,t),t;if(!xe)throw new Error(`No patterns registered for language '${n}'. Either import the language module or set a pattern generator.`);let r=Mi(n),o=xe(r);return le.set(n,o),o}var Te=.8,Bi=.6,qi=.15,Vi=.5,ct=.15,pt=.1,dt=new Set(["\u0628\u062F\u0644","\u063A\u064A\u0631","\u0623\u0636\u0641","\u0623\u0632\u0644","\u0636\u0639","\u0627\u062C\u0639\u0644","\u0639\u064A\u0646","\u0632\u062F","\u0627\u0646\u0642\u0635","\u0633\u062C\u0644","\u0623\u0638\u0647\u0631","\u0623\u062E\u0641","\u0634\u063A\u0644","\u0623\u0631\u0633\u0644","\u0631\u0643\u0632","\u0634\u0648\u0634","\u062A\u0648\u0642\u0641","\u0627\u0646\u0633\u062E","\u0627\u062D\u0630\u0641","\u0627\u0635\u0646\u0639","\u0627\u0646\u062A\u0638\u0631","\u0627\u0646\u062A\u0642\u0627\u0644","\u0623\u0648"]),Fi={patient:["\u0639\u0644\u0649"],destination:["\u0625\u0644\u0649","\u0627\u0644\u0649"],source:["\u0645\u0646"],agent:["\u0645\u0646"],manner:["\u0628"],style:["\u0628"],goal:["\u0625\u0644\u0649","\u0627\u0644\u0649"],method:["\u0628"]},zi=class{calculate(n){return this.calculateWithBreakdown(n).final}calculateWithBreakdown(n){let e=this.scoreRoleCoverage(n),t=this.scoreStemPenalty(n),r=this.scoreLanguageBoost(n),o=this.scoreLanguageAdjustment(n),i=e;return i=Math.max(Vi,i+t),i=Math.min(1,i+r),i=Math.max(0,Math.min(1,i+o)),{roleCoverage:e,stemPenalty:t,languageBoost:r,languageAdjustment:o,final:i}}scoreRoleCoverage(n){let{pattern:e,captured:t}=n,r=0,o=0,i=a=>e.extraction?.[a]?.default!==void 0;for(let a of e.template.tokens)if(a.type==="role")o+=1,t.has(a.role)&&(r+=1);else if(a.type==="group")for(let s of a.tokens)s.type==="role"&&(o+=Te,t.has(s.role)?r+=Te:i(s.role)&&(r+=Te*Bi));return o>0?r/o:1}scoreStemPenalty(n){let{stemMatchCount:e,totalKeywordMatches:t}=n;return e<=0||t<=0?0:-(e/t)*qi}scoreLanguageBoost(n){let{pattern:e}=n;if(e.language!=="ar")return 0;let t=e.template.tokens[0];return !t||t.type!=="literal"?0:dt.has(t.value)||t.alternatives?.some(r=>dt.has(r))?ct:0}scoreLanguageAdjustment(n){let{pattern:e,captured:t}=n;if(e.language!=="ar")return 0;let r=0;for(let[o,i]of t.entries()){let a=Fi[o];if(!a||a.length===0)continue;let s="metadata"in i?i.metadata:void 0;s&&typeof s.prepositionValue=="string"&&(a.includes(s.prepositionValue)?r+=.1:r-=.1);}return Math.max(-pt,Math.min(pt,r))}},Wi=new zi,ce=class Z{constructor(e){this.matchCache=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??Wi;}matchPattern(e,t){let r=e.mark(),o=new Map;if(this.currentProfile=$(t.language),this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(e,t.template.tokens,o))return e.reset(r),null;let a=this.confidenceModel.calculate({pattern:t,captured:o,stemMatchCount:this.stemMatchCount,totalKeywordMatches:this.totalKeywordMatches});return this.applyExtractionRules(t,o),{pattern:t,captured:o,consumedTokens:e.position()-r.position,confidence:a}}matchBest(e,t){this.matchCache.clear();let r=[],o=e.position();for(let a of t){let s=e.mark(),l=`${o}:${a.id}`,c;this.matchCache.has(l)?c=this.matchCache.get(l):(c=this.matchPattern(e,a),this.matchCache.set(l,c)),c&&r.push(c),e.reset(s);}if(r.length===0)return null;r.sort((a,s)=>{let l=s.pattern.priority-a.pattern.priority;return l!==0?l:s.confidence-a.confidence});let i=r[0];return this.matchPattern(e,i.pattern),i}matchTokenSequence(e,t,r){let o=t[0],i=o?.type==="literal"&&(o.value==="and"||o.value==="then"||o.alternatives?.includes("and")||o.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!i)for(;e.peek()?.kind==="conjunction";)e.advance();for(let a of t)if(!this.matchPatternToken(e,a,r)){if(this.isOptional(a))continue;return false}return true}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 false}}matchLiteralToken(e,t){let r=e.peek();if(!r)return false;let o=this.getMatchType(r,t.value);if(o!=="none")return this.totalKeywordMatches++,o==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let i of t.alternatives){let a=this.getMatchType(r,i);if(a!=="none")return this.totalKeywordMatches++,a==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,t,r){this.skipNoiseWords(e);let o=e.peek();if(!o)return t.optional||false;let i=this.tryMatchPossessiveExpression(e);if(i)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(i.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(r.set(t.role,i),true);let a=this.tryMatchMethodCallExpression(e);if(a)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(a.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(r.set(t.role,a),true);let s=this.tryMatchPossessiveSelectorExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!lt(s.type,t.expectedTypes)?t.optional||false:(r.set(t.role,s),true);let l=this.tryMatchPropertyAccessExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(l.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(r.set(t.role,l),true);let c=this.tryMatchSelectorPropertyExpression(e);if(c)return t.expectedTypes&&t.expectedTypes.length>0&&!lt(c.type,t.expectedTypes)?t.optional||false:(r.set(t.role,c),true);let u=this.tokenToSemanticValue(o);return !u||t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(u.type)?t.optional||false:(r.set(t.role,u),e.advance(),true)}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let r=(t.normalized||t.value).toLowerCase(),o=_i(this.currentProfile,r);if(!o)return null;let i=e.mark();e.advance();let a=e.peek();if(!a)return e.reset(i),null;if(a.kind==="identifier"||a.kind==="keyword"&&!this.isStructuralKeyword(a.value)||a.kind==="selector"&&a.value.startsWith("*")||a.kind==="selector"&&a.value.startsWith("@")||a.kind==="selector"&&a.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(a.value)){e.advance();let s=a.value;a.kind==="selector"&&s.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s)&&(s=s.substring(1));let l=s;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)l+=e.peek().value,e.advance();let c=e.peek();return c?.kind==="literal"&&c.value.startsWith("(")&&(l+=c.value,e.advance()),ke(D(o),l)}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(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let r=e.mark();e.advance();let o=e.peek();if(!o||o.kind!=="operator"||o.value!==".")return e.reset(r),null;e.advance();let i=e.peek();if(!i||i.kind!=="identifier")return e.reset(r),null;e.advance();let a=e.peek();if(!a||a.kind!=="punctuation"||a.value!=="(")return e.reset(r),null;e.advance();let s=[];for(;!e.isAtEnd()&&s.length<Z.MAX_METHOD_ARGS;){let c=e.peek();if(!c)break;if(c.kind==="punctuation"&&c.value===")"){e.advance();break}if(c.kind==="punctuation"&&c.value===","){e.advance();continue}s.push(c.value),e.advance();}return {type:"expression",raw:`${t.value}.${i.value}(${s.join(", ")})`}}tryMatchPropertyAccessExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"&&t.kind!=="keyword")return null;let r=e.mark();e.advance();let o=e.peek();if(!o||o.kind!=="operator"||o.value!==".")return e.reset(r),null;e.advance();let i=e.peek();if(!i||i.kind!=="identifier")return e.reset(r),null;e.advance();let a=`${t.value}.${i.value}`,s=1;for(;!e.isAtEnd()&&s<Z.MAX_PROPERTY_DEPTH;){let c=e.peek();if(!c||c.kind!=="operator"||c.value!==".")break;e.advance();let u=e.peek();if(!u||u.kind!=="identifier")break;e.advance(),a+=`.${u.value}`,s++;}let l=e.peek();if(l&&l.kind==="punctuation"&&l.value==="("){e.advance();let c=[],u=0;for(;!e.isAtEnd()&&c.length<Z.MAX_METHOD_ARGS;){let d=e.peek();if(!d)break;if(d.kind==="punctuation"&&d.value===")"){if(u===0){e.advance();break}u--;}if(d.kind==="punctuation"&&d.value==="("&&u++,d.kind==="punctuation"&&d.value===","){e.advance();continue}c.push(d.value),e.advance();}return {type:"expression",raw:`${a}(${c.join(", ")})`}}return {type:"expression",raw:a}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let r=e.mark();e.advance();let o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="'s")return e.reset(r),null;e.advance();let i=e.peek();return !i||i.kind!=="selector"&&i.kind!=="identifier"?(e.reset(r),null):(e.advance(),ke(ee(t.value),i.value))}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||!t.value.startsWith("#"))return null;let r=e.mark();e.advance();let o=e.peek();if(!o||o.kind!=="selector"||!o.value.startsWith("."))return e.reset(r),null;let i=e.peek(1);i&&i.kind,e.advance();let a=o.value.slice(1);return ke(ee(t.value),a)}matchGroupToken(e,t,r){let o=e.mark(),i=new Set(r.keys());if(!this.matchTokenSequence(e,t.tokens,r)){e.reset(o);for(let s of r.keys())i.has(s)||r.delete(s);return t.optional||false}return true}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem===t&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&e.value.toLowerCase()===t.toLowerCase()?"case-insensitive":"none"}tokenToSemanticValue(e){switch(e.kind){case "selector":return ee(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=(e.normalized||e.value).toLowerCase();return it(t)?D(t):x(e.normalized||e.value);case "identifier":if(e.value.startsWith(":"))return D(e.value);let r=e.value.toLowerCase();return it(r)?D(r):{type:"expression",raw:e.value};case "url":return x(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let o=e.slice(1,-1);return x(o,"string")}if(e==="true")return x(true,"boolean");if(e==="false")return x(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let o=parseFloat(t[1]);return t[2]?x(e,"duration"):x(o,"number")}let r=parseFloat(e);return isNaN(r)?x(e,"string"):x(r,"number")}applyExtractionRules(e,t){for(let[r,o]of Object.entries(e.extraction))t.has(r)||(o.value!==void 0?t.set(r,{type:"literal",value:o.value}):o.default&&t.set(r,o.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}skipNoiseWords(e){let t=e.peek();if(!t)return;let r=t.value.toLowerCase();if(Z.ENGLISH_NOISE_WORDS.has(r)){let o=e.mark();e.advance();let i=e.peek();if(i&&(i.kind==="selector"||i.kind==="identifier"))return;e.reset(o);}r==="class"&&e.advance();}extractEventModifiers(e){let t={},r=false;for(;!e.isAtEnd();){let o=e.peek();if(!o||o.kind!=="event-modifier")break;let i=o.metadata;if(!i)break;switch(r=true,i.modifierName){case "once":t.once=true;break;case "debounce":typeof i.value=="number"&&(t.debounce=i.value);break;case "throttle":typeof i.value=="number"&&(t.throttle=i.value);break;case "queue":(i.value==="first"||i.value==="last"||i.value==="all"||i.value==="none")&&(t.queue=i.value);break}e.advance();}return r?t:void 0}};ce.MAX_PROPERTY_DEPTH=10;ce.MAX_METHOD_ARGS=20;ce.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var At=ce,F=new At;function ji(n){return Li(n)}function be(n,e){return Di(n,e)}function Ct(){return wt()}var Ui={ko:{\uD074\uB9AD:"click",\uC785\uB825:"input",\uBCC0\uACBD:"change",\uC81C\uCD9C:"submit",\uD0A4\uB2E4\uC6B4:"keydown",\uD0A4\uC5C5:"keyup",\uB9C8\uC6B0\uC2A4\uC624\uBC84:"mouseover",\uB9C8\uC6B0\uC2A4\uC544\uC6C3:"mouseout",\uB9C8\uC6B0\uC2A4\uB2E4\uC6B4:"mousedown",\uB9C8\uC6B0\uC2A4\uC5C5:"mouseup",\uD3EC\uCEE4\uC2A4:"focus",\uBE14\uB7EC:"blur",\uB85C\uB4DC:"load",\uB9AC\uC0AC\uC774\uC988:"resize",\uC2A4\uD06C\uB864:"scroll"},ja:{\u30AF\u30EA\u30C3\u30AF:"click",\u5165\u529B:"input",\u5909\u66F4:"change",\u9001\u4FE1:"submit",\u30AD\u30FC\u30C0\u30A6\u30F3:"keydown",\u30AD\u30FC\u30A2\u30C3\u30D7:"keyup",\u30AD\u30FC\u30D7\u30EC\u30B9:"keypress",\u30DE\u30A6\u30B9\u30AA\u30FC\u30D0\u30FC:"mouseover",\u30DE\u30A6\u30B9\u30A2\u30A6\u30C8:"mouseout",\u30DE\u30A6\u30B9\u62BC\u4E0B:"mousedown",\u30DE\u30A6\u30B9\u89E3\u653E:"mouseup",\u30D5\u30A9\u30FC\u30AB\u30B9:"focus",\u30D6\u30E9\u30FC:"blur",\u30ED\u30FC\u30C9:"load",\u8AAD\u307F\u8FBC\u307F:"load",\u30B5\u30A4\u30BA\u5909\u66F4:"resize",\u30B9\u30AF\u30ED\u30FC\u30EB:"scroll"},ar:{\u0627\u0644\u0646\u0642\u0631:"click",\u0646\u0642\u0631:"click",\u0627\u0644\u0625\u062F\u062E\u0627\u0644:"input",\u0625\u062F\u062E\u0627\u0644:"input",\u0627\u0644\u062A\u063A\u064A\u064A\u0631:"change",\u062A\u063A\u064A\u064A\u0631:"change",\u0627\u0644\u0625\u0631\u0633\u0627\u0644:"submit",\u0625\u0631\u0633\u0627\u0644:"submit","\u0636\u063A\u0637 \u0627\u0644\u0645\u0641\u062A\u0627\u062D":"keydown","\u0631\u0641\u0639 \u0627\u0644\u0645\u0641\u062A\u0627\u062D":"keyup","\u062A\u0645\u0631\u064A\u0631 \u0627\u0644\u0645\u0627\u0648\u0633":"mouseover",\u0627\u0644\u062A\u0631\u0643\u064A\u0632:"focus",\u062A\u062D\u0645\u064A\u0644:"load",\u062A\u0645\u0631\u064A\u0631:"scroll"},es:{clic:"click",click:"click",entrada:"input",cambio:"change",env\u00EDo:"submit",enviar:"submit","tecla abajo":"keydown","tecla arriba":"keyup","rat\xF3n encima":"mouseover","rat\xF3n fuera":"mouseout",enfoque:"focus",desenfoque:"blur",carga:"load",desplazamiento:"scroll"},tr:{t\u0131klama:"click",t\u0131kla:"click",t\u0131k:"click",giri\u015F:"input",girdi:"input",de\u011Fi\u015Fiklik:"change",de\u011Fi\u015Fim:"change",g\u00F6nderme:"submit",g\u00F6nder:"submit",tu\u015Fbasma:"keydown",tu\u015Fb\u0131rakma:"keyup",fare_bas:"mousedown",fare_b\u0131rak:"mouseup",farei\u00E7inde:"mouseover",fared\u0131\u015F\u0131nda:"mouseout",odaklanma:"focus",odak:"focus",bulan\u0131kl\u0131k:"blur",y\u00FCkleme:"load",y\u00FCkle:"load",boyut_de\u011Fi\u015Ftir:"resize",kayd\u0131rma:"scroll"},pt:{clique:"click",clicar:"click",click:"click",entrada:"input",inserir:"input",mudan\u00E7a:"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:{\u70B9\u51FB:"click",\u5355\u51FB:"click",\u53CC\u51FB:"dblclick",\u8F93\u5165:"input",\u6539\u53D8:"change",\u53D8\u5316:"change",\u53D8\u66F4:"change",\u63D0\u4EA4:"submit",\u53D1\u9001:"submit",\u6309\u952E:"keydown",\u952E\u5165:"keydown",\u677E\u952E:"keyup",\u9F20\u6807\u8FDB\u5165:"mouseover",\u9F20\u6807\u79FB\u5165:"mouseover",\u9F20\u6807\u79BB\u5F00:"mouseout",\u9F20\u6807\u79FB\u51FA:"mouseout",\u7126\u70B9:"focus",\u805A\u7126:"focus",\u5931\u7126:"blur",\u6A21\u7CCA:"blur",\u52A0\u8F7D:"load",\u8F7D\u5165:"load",\u6EDA\u52A8:"scroll"},fr:{clic:"click",cliquer:"click",click:"click",saisie:"input",entr\u00E9e:"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\u00E9focus:"blur",d\u00E9focaliser:"blur",chargement:"load",charger:"load",d\u00E9filement:"scroll",d\u00E9filer:"scroll"},de:{klick:"click",klicken:"click",click:"click",eingabe:"input",eingeben:"input",\u00E4nderung:"change",\u00E4ndern:"change",absenden:"submit",einreichen:"submit","taste runter":"keydown","taste hoch":"keyup","maus \xFCber":"mouseover","maus raus":"mouseout",fokus:"focus",fokussieren:"focus",defokussieren:"blur",unsch\u00E4rfe:"blur",laden:"load",ladung:"load",scrollen:"scroll",bl\u00E4ttern:"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:{\u0995\u09CD\u09B2\u09BF\u0995:"click",\u0987\u09A8\u09AA\u09C1\u099F:"input",\u099C\u09AE\u09BE:"submit",\u09B2\u09CB\u09A1:"load",\u09B8\u09CD\u0995\u09CD\u09B0\u09CB\u09B2:"scroll",\u09B0\u09BF\u09B8\u09BE\u0987\u099C:"resize",\u099D\u09BE\u09AA\u09B8\u09BE:"blur",\u09AB\u09CB\u0995\u09BE\u09B8:"focus",\u09AA\u09B0\u09BF\u09AC\u09B0\u09CD\u09A4\u09A8:"change"},qu:{click:"click","\xF1it'iy":"click",\u00F1itiy:"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"}};var Gi={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:true,expectedTypes:["selector"],selectorKinds:["class","attribute"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","INVALID_CSS_PROPERTY"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"toggle command requires an argument"},{condition:"Class names are valid CSS identifiers",errorCode:"NO_VALID_CLASS_NAMES",message:"toggle command: no valid class names found"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to toggle",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",INVALID_CSS_PROPERTY:"Check CSS property name syntax (use kebab-case)"}},Ki={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:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","PROPERTY_REQUIRES_VALUE"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"add command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to add",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",PROPERTY_REQUIRES_VALUE:"When adding a property (*prop), provide a value argument"}},Yi={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to remove",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},Qi={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:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"into"}}],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"}},Xi={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:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ja:"\u3092",ko:"\uB97C",tr:"i",ar:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The value to set",required:true,expectedTypes:["literal","expression","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"\xE0",de:"auf",id:"ke",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",ar:"\u0625\u0644\u0649",sw:"kwenye",tl:"sa",bn:"\u09A4\u09C7",qu:"man"}}],errorCodes:["MISSING_TARGET","INVALID_TARGET","MISSING_VALUE","INVALID_SYNTAX"],preconditions:[{condition:"Command has a target variable or property",errorCode:"MISSING_TARGET",message:"set command requires a target"},{condition:"Target is a valid variable or property reference",errorCode:"INVALID_TARGET",message:"set command target must be a string or object literal"},{condition:'Value is specified with "to" keyword',errorCode:"MISSING_VALUE",message:'set command requires a value (use "to" keyword)'}],recoveryHints:{MISSING_TARGET:"Add a target: set :variable to value OR set element.property to value",INVALID_TARGET:'Use local variable (:name), element property (el.prop), or "the X of Y" syntax',MISSING_VALUE:'Add "to <value>" to specify what to set',INVALID_SYNTAX:"Use syntax: set <target> to <value>"}},Ji={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to show",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},Zi={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to hide",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},ea={action:"on",description:"Handle an event",category:"event",primaryRole:"event",hasBody:true,roles:[{role:"event",description:"The event to handle",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to listen on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},ta={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:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},ra={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"Duration or event to wait for",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},na={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",roles:[{role:"source",description:"The URL to fetch from",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,renderOverride:{en:""}},{role:"responseType",description:"Response format (json, text, html, blob, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"method",description:"HTTP method (GET, POST, etc.)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3},{role:"destination",description:"Where to store the result",required:false,expectedTypes:["selector","reference"],svoPosition:4,sovPosition:4}]},oa={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to increment",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},ia={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to decrement",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},aa={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to append",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},sa={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to prepend",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},la={action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to log",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},ua={action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",roles:[{role:"source",description:"The source to get from",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",ja:"\u3092",zh:"",ko:"\uB97C",ar:"\u0639\u0644\u0649",tr:"i",id:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"destination",description:"Where to store the result (optional)",required:false,expectedTypes:["reference"],svoPosition:2,sovPosition:1}]},ca={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:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to take from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},pa={action:"make",description:"Create a new element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element type or selector to create",required:true,expectedTypes:["literal","selector"],svoPosition:1,sovPosition:1}]},da={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:false,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},ma={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:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},fa={action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The error message or object to throw",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},va={action:"send",description:"Send an event to an element",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to send",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to",ja:"\u306B",ar:"\u0625\u0644\u0649",es:"a",ko:"\uC5D0\uAC8C",zh:"\u5230",tr:"-e",pt:"para",fr:"\xE0",de:"an",id:"ke",qu:"-man",sw:"kwa"}}]},ha={action:"if",description:"Conditional execution",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},ya={action:"unless",description:"Negated conditional execution (executes when condition is false)",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate (body executes when false)",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},ga={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Ea={action:"repeat",description:"Repeat a block of commands",category:"control-flow",primaryRole:"loopType",hasBody:true,roles:[{role:"loopType",description:"Loop variant: forever, times, for, while, until, until-event",required:true,expectedTypes:["literal"],svoPosition:0,sovPosition:0},{role:"quantity",description:"Number of times to repeat",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"event",description:"Event to wait for (terminates loop)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"source",description:"Element to listen for event on",required:false,expectedTypes:["selector","reference"],svoPosition:3,sovPosition:3}],notes:'Can also use "repeat forever", "repeat until condition", or "repeat until event X from Y"'},ka={action:"for",description:"Iterate over a collection",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The iteration variable",required:true,expectedTypes:["reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The collection to iterate over",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"in"}}]},Ta={action:"while",description:"Loop while condition is true",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to check",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},ba={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},Sa={action:"go",description:"Navigate to a URL",category:"navigation",primaryRole:"destination",roles:[{role:"destination",description:"The URL to navigate to",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"},renderOverride:{en:""}}]},xa={action:"transition",description:"Transition an element with animation",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The property to transition (opacity, *background-color, etc.)",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2,markerOverride:{en:"",ar:"",tl:"",sw:""}},{role:"goal",description:"The target value to transition to",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:3,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man",es:"a",pt:"para",fr:"\xE0",de:"auf",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",id:"ke"}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:3,sovPosition:1},{role:"duration",description:"Transition duration (over 500ms, for 2 seconds)",required:false,expectedTypes:["literal"],svoPosition:4,sovPosition:4,markerOverride:{en:"over"}},{role:"style",description:"Easing function (ease-in, linear, etc.)",required:false,expectedTypes:["literal"],svoPosition:5,sovPosition:5}]},wa={action:"clone",description:"Clone an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to clone",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"destination",description:"Where to put the clone",required:false,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"into"}}]},Aa={action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to focus (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Ca={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:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Pa={action:"call",description:"Call a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The function to call",required:true,expectedTypes:["expression","reference"],svoPosition:1,sovPosition:1}]},Ra={action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The value to return",required:false,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},Oa={action:"js",description:"Execute raw JavaScript code",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The JavaScript code to execute",required:false,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},_a={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},Na={action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",hasBody:true,roles:[{role:"destination",description:"The element to tell",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}}]},Ia={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:true,expectedTypes:["reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ar:"",tl:"",sw:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The default value",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man"}}]},Ma={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},La={action:"behavior",description:"Define a reusable behavior",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The behavior name (PascalCase identifier)",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},Da={action:"install",description:"Install a behavior on an element",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The behavior name to install",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"Element to install on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},$a={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:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"source",description:"Element to measure (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},Ba={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:false,expectedTypes:["literal"],svoPosition:1,sovPosition:3,markerOverride:{en:""}},{role:"destination",description:"The element to swap content in/for",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"of"}},{role:"patient",description:"The content to swap in (optional for delete)",required:false,expectedTypes:["literal","expression","selector"],svoPosition:3,sovPosition:2,markerOverride:{en:"with"}}]},qa={action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"destination",roles:[{role:"destination",description:"The element to morph",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}},{role:"patient",description:"The target content/element to morph into",required:true,expectedTypes:["literal","expression","selector"],svoPosition:2,sovPosition:2,markerOverride:{en:"to"}}]},Va={action:"beep",description:"Debug output for expressions with type information",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The expression(s) to debug",required:false,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},Fa={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},za={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:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},Wa={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},ja={action:"pick",description:"Select a random element from a collection",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The items to pick from",required:true,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1},{role:"source",description:'The array to pick from (with "from" keyword)',required:false,expectedTypes:["reference","expression"],svoPosition:2,sovPosition:2}]},Ua={action:"render",description:"Render a template with optional variables",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The template to render",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"style",description:"Variables to pass to the template (with keyword)",required:false,expectedTypes:["expression","reference"],svoPosition:2,sovPosition:1}]},Pt={toggle:Gi,add:Ki,remove:Yi,put:Qi,set:Xi,show:Ji,hide:Zi,on:ea,trigger:ta,wait:ra,fetch:na,increment:oa,decrement:ia,append:aa,prepend:sa,log:la,get:ua,take:ca,make:pa,halt:da,settle:ma,throw:fa,send:va,if:ha,unless:ya,else:ga,repeat:Ea,for:ka,while:Ta,continue:ba,go:Sa,transition:xa,clone:wa,focus:Aa,blur:Ca,call:Pa,return:Ra,js:Oa,async:_a,tell:Na,default:Ia,init:Ma,behavior:La,install:Da,measure:$a,swap:Ba,morph:qa,beep:Va,break:Fa,copy:za,exit:Wa,pick:ja,render:Ua,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function Ha(){return Object.values(Pt).filter(n=>n.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(Oi(),Et)).then(({validateAllSchemas:n,formatValidationResults:e})=>{let t=n(Pt);t.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(t)),console.warn(`
|
|
5
|
+
These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(n=>{console.debug("Schema validation skipped:",n);});var mt=class extends Error{constructor(n,e,t,r){super(n),this.name="SemanticParseError",this.language=e,this.input=t,this.diagnostics=r;}};function O(n,e,t){return {message:n,severity:e,source:"semantic-parser",...t&&{code:t}}}function ue(n,e){return e.length===0?n:{...n,diagnostics:e}}var G=class N{parse(e,t){let{modifiers:r,remainingInput:o}=this.extractStandaloneModifiers(e,t),i=o||e,a=[],s=be(i,t),l=z(t);if(l.length===0)throw new mt(`No patterns available for language: ${t}`,t,i,[O(`No patterns registered for language '${t}'`,"error","no-patterns")]);let c=[...l].sort((g,E)=>E.priority-g.priority),u=c.filter(g=>g.command==="on"),p=F.matchBest(s,u);if(p){a.push(O(`event pattern matched: ${p.pattern.id} (confidence: ${p.confidence.toFixed(2)})`,"info","pattern-match"));let g=this.buildEventHandler(p,s,t),E=r?this.applyModifiers(g,r):g;return ue(E,a)}a.push(O(`event patterns: ${u.length} tried, no match`,"info","stage-event"));let d=c.filter(g=>g.command!=="on"),m=F.matchBest(s,d);if(m)return a.push(O(`command pattern matched: ${m.pattern.id} (confidence: ${m.confidence.toFixed(2)})`,"info","pattern-match")),ue(this.buildCommand(m,t),a);a.push(O(`command patterns: ${d.length} tried, no match`,"info","stage-command"));let f=this.trySOVEventExtraction(i,t,c);if(f){a.push(O("SOV event extraction succeeded","info","stage-sov"));let g=r?this.applyModifiers(f,r):f;return ue(g,a)}a.push(O("SOV event extraction: no event keyword found","info","stage-sov"));let y=this.tryCompoundCommandParsing(s,d,t);if(y)return a.push(O("compound command parsing succeeded","info","stage-compound")),ue(y,a);throw a.push(O("compound parsing: no then-keywords or no command matches","info","stage-compound")),a.push(O(`all parse stages exhausted for "${i}"`,"error","parse-failed")),new mt(`Could not parse input in ${t}: ${i}`,t,i,a)}canParse(e,t){try{return this.parse(e,t),!0}catch{return false}}supportedLanguages(){return Ct()}buildCommand(e,t){if(!e)throw new Error("No match to build command from");let r={};for(let[o,i]of e.captured)r[o]=i;return se(e.pattern.command,r,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence})}buildEventHandler(e,t,r){if(!e)throw new Error("No match to build event handler from");let o=e.captured.get("event");if(!o)throw new Error("Event handler pattern matched but no event captured");let i=F.extractEventModifiers(t),a=this.extractOrConjunctionEvents(t,r),s=o;a.length>0&&o.type==="literal"&&(s={type:"literal",value:[String(o.value),...a.map(p=>String("value"in p?p.value:""))].join(" or ")});let l,c=e.captured.get("action");if(c&&c.type==="literal"){let u=c.value,p={};for(let[f,y]of e.captured)f!=="event"&&f!=="action"&&f!=="continues"&&(p[f]=y);let d=se(u,p,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence}),m=e.captured.get("continues");if(m&&m.type==="literal"&&m.value==="then"){let f=z(r).filter(E=>E.command!=="on").sort((E,T)=>T.priority-E.priority),y=z(r).filter(E=>E.id.startsWith("grammar-")&&E.id.includes("-continuation")).sort((E,T)=>T.priority-E.priority),g=this.parseBodyWithGrammarPatterns(t,f,y,r);g.length>0?l=[d,...g]:l=[d];}else l=[d];}else {let u=z(r).filter(p=>p.command!=="on").sort((p,d)=>d.priority-p.priority);l=this.parseBodyWithClauses(t,u,r);}return at(s,l,i,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,t,r){let o=[],i=[];for(;!e.isAtEnd();){let a=e.peek();if(!a)break;let s=a.kind==="conjunction"||a.kind==="keyword"&&this.isThenKeyword(a.value,r),l=a.kind==="keyword"&&this.isEndKeyword(a.value,r);if(s){if(i.length>0){let c=this.parseClause(i,t,r);o.push(...c),i.length=0;}e.advance();continue}if(l){if(i.length>0){let c=this.parseClause(i,t,r);o.push(...c);}e.advance();break}i.push(a),e.advance();}if(i.length>0){let a=this.parseClause(i,t,r);o.push(...a);}return o.length>1?[st(o,"then",{sourceLanguage:r})]:o}parseClause(e,t,r){if(e.length===0)return [];let o=new X(e,r),i=[];for(;!o.isAtEnd();){let a=F.matchBest(o,t);a?i.push(this.buildCommand(a,r)):o.advance();}if(i.length===0){let a=this.parseSOVClauseByVerbAnchoring(e,r);if(a.length>0)return a}return i}static buildVerbLookup(e){let t=new Map;for(let[r,o]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","for","end","then","and"].includes(r)&&(t.set(o.primary.toLowerCase(),r),o.alternatives))for(let i of o.alternatives)t.set(i.toLowerCase(),r);return t}static buildMarkerToRoleLookup(e){let t=new Map;for(let[r,o]of Object.entries(e.roleMarkers))if(o&&(t.set(o.primary,r),o.alternatives))for(let i of o.alternatives)t.has(i)||t.set(i,r);return t}parseSOVClauseByVerbAnchoring(e,t){let r=$(t);if(!r||r.wordOrder!=="SOV")return [];let o=N.buildVerbLookup(r),i=N.buildMarkerToRoleLookup(r),a=[],s=0;for(;s<e.length;){let l=-1,c="";for(let f=s;f<e.length;f++){let y=e[f],g=o.get(y.value.toLowerCase()),E=y.normalized?o.get(y.normalized.toLowerCase()):void 0,T=g||E;if(T){l=f,c=T;break}}if(l===-1)break;let u=e.slice(s,l),p=e.length;for(let f=l+1;f<e.length;f++){let y=e[f];if(y.kind==="conjunction"||this.isThenKeyword(y.value,t)){p=f;break}if(f>l+1&&(o.get(y.value.toLowerCase())||(y.normalized?o.get(y.normalized.toLowerCase()):void 0))){p=f;break}}let d=e.slice(l+1,p),m=this.extractRolesFromMarkedTokens(u,d,i,c,t);if(a.push(se(c,m,{sourceLanguage:t,confidence:.7})),s=p,s<e.length){let f=e[s];(f.kind==="conjunction"||this.isThenKeyword(f.value,t))&&s++;}}return a}extractRolesFromMarkedTokens(e,t,r,o,i){let a={},s=l=>{let c=[];for(let u of l){let p=r.get(u.value);if(p&&u.kind==="particle"&&c.length>0){let d=this.tokensToSemanticValue(c);if(d){let m=this.mapRoleForCommand(p,o,a);m&&(a[m]=d);}c=[];}else c.push(u);}if(c.length>0){let u=this.tokensToSemanticValue(c);u&&(a.patient?a.destination||(a.destination=u):a.patient=u);}};return s(e),s(t),a}mapRoleForCommand(e,t,r){return r[e]?e==="patient"&&!r.destination?"destination":e==="destination"&&!r.patient?"patient":e==="source"&&!r.source?"source":null:e}tokensToSemanticValue(e){if(e.length===0)return null;let t=e.filter(i=>i.kind!=="whitespace");if(t.length===0)return null;if(t.length===1)return this.tokenToSemanticValue(t[0]);let r=t.map(i=>i.value).join(""),o=t[0];return o.kind==="selector"||o.value.startsWith("#")||o.value.startsWith(".")||o.value.startsWith("@")||o.value.startsWith("*")?ee(r):o.kind==="literal"||o.value.startsWith('"')||o.value.startsWith("'")?x(r):o.kind==="reference"?D(r):x(r)}tokenToSemanticValue(e){let t=e.value;if(e.kind==="selector"||t.startsWith("#")||t.startsWith(".")||t.startsWith("@")||t.startsWith("*"))return ee(t);if(t.startsWith('"')||t.startsWith("'"))return x(t);if(/^-?\d+(\.\d+)?$/.test(t))return x(parseFloat(t));if(t==="true"||t==="\u771F"||t==="\uCC38"||t==="do\u011Fru")return x(true);if(t==="false"||t==="\u507D"||t==="\uAC70\uC9D3"||t==="yanl\u0131\u015F")return x(false);let r=e.normalized?.toLowerCase();return r==="me"||r==="it"||r==="you"||r==="result"||r==="body"?D(r):e.kind==="reference"?D(e.normalized||"me"):x(t)}parseBodyWithGrammarPatterns(e,t,r,o){let i=[];for(;!e.isAtEnd();){let a=e.peek();if(a&&this.isThenKeyword(a.value,o)){e.advance();continue}if(a&&this.isEndKeyword(a.value,o)){e.advance();break}let s=false;if(r.length>0){let l=F.matchBest(e,r);if(l){let c=l.pattern.command,u={};for(let[m,f]of l.captured)m!=="event"&&m!=="action"&&m!=="continues"&&(u[m]=f);let p=se(c,u,{sourceLanguage:o,patternId:l.pattern.id});i.push(p),s=true;let d=l.captured.get("continues");if(d&&d.type==="literal"&&d.value==="then")continue}}if(!s){let l=F.matchBest(e,t);l&&(i.push(this.buildCommand(l,o)),s=true);}s||e.advance();}return i}tryCompoundCommandParsing(e,t,r){let o=e.tokens;if(!o.some(l=>l.kind==="conjunction"||l.kind==="keyword"&&this.isThenKeyword(l.value,r)))return null;let a=new X(o,r),s=this.parseBodyWithClauses(a,t,r);return s.length===0?null:s.length===1?s[0]:st(s,"then",{sourceLanguage:r,confidence:.65})}trySOVEventExtraction(e,t,r){let o=N.SOV_EVENT_MARKERS[t];if(!o)return null;let a=be(e,t).tokens,s=Ui[t],l=new Set;if(s)for(let k of Object.keys(s))l.add(k.toLowerCase());let c=N.SOV_SOURCE_MARKERS[t],u=-1,p="",d="",m=1;for(let k=0;k<a.length;k++){let w=a[k],I=w.value.toLowerCase(),M=I,B="",de=I.indexOf("[");de>0&&(M=I.slice(0,de),B=w.value.slice(de));let me=w.normalized?.toLowerCase(),Ie=me&&N.KNOWN_EVENTS.has(me),Me=l.has(I)||l.has(M),Ft=N.KNOWN_EVENTS.has(M);if(Ie||Me||Ft){let K;if(Ie?K=me:Me?K=s?.[I]??s?.[M]??M:K=M,o.size>0){let oe=1,fe=a[k+1];fe&&fe.kind==="selector"&&fe.value.startsWith("[")&&(oe=2);let ie=a[k+oe];if(ie&&(ie.kind==="particle"||ie.kind==="keyword")&&o.has(ie.value)){u=k,p=K,d=B||(oe===2?a[k+1].value:""),m=oe+1;break}}else {u=k,p=K,d=B,m=1;break}}}if(u===-1)return null;let f=new Set;for(let k=u;k<u+m;k++)f.add(k);if(c){let k=u+m;if(k<a.length){let w=a[k];(w.kind==="particle"||w.kind==="keyword")&&c.markers.has(w.value)&&f.add(k);}for(let w=0;w<u;w++){let I=a[w],M=I.value.toLowerCase(),B=I.normalized?.toLowerCase();if(c.windowTokens.has(M)||B&&c.windowTokens.has(B)){f.add(w);break}}}let y=a.filter((k,w)=>!f.has(w));if(y.length===0)return null;let g=r.filter(k=>k.command!=="on"),E=new X(y,t),T=this.parseBodyWithClauses(E,g,t);if(T.length===0)return null;let Ne={sourceLanguage:t,confidence:.75};return d&&(Ne.keyFilter=d),at({type:"literal",value:p},T,void 0,Ne)}isThenKeyword(e,t){let r={en:new Set(["then"]),ja:new Set(["\u305D\u308C\u304B\u3089","\u6B21\u306B","\u305D\u3057\u3066"]),ar:new Set(["\u062B\u0645","\u0628\u0639\u062F\u0647\u0627","\u062B\u0645\u0651"]),es:new Set(["entonces","luego","despu\xE9s"]),ko:new Set(["\uADF8\uB2E4\uC74C","\uADF8\uB9AC\uACE0","\uADF8\uB7F0\uD6C4","\uADF8\uB7EC\uBA74"]),zh:new Set(["\u7136\u540E","\u63A5\u7740","\u4E4B\u540E"]),tr:new Set(["sonra","ard\u0131ndan","daha sonra"]),pt:new Set(["ent\xE3o","depois","logo"]),fr:new Set(["puis","ensuite","alors"]),de:new Set(["dann","danach","anschlie\xDFend"]),id:new Set(["lalu","kemudian","setelah itu"]),tl:new Set(["pagkatapos","tapos"]),bn:new Set(["\u09A4\u09BE\u09B0\u09AA\u09B0","\u09AA\u09B0\u09C7"]),qu:new Set(["chaymantataq","hinaspa","chaymanta","chayqa"]),sw:new Set(["kisha","halafu","baadaye"])};return (r[t]||r.en).has(e.toLowerCase())}isEndKeyword(e,t){let r={en:new Set(["end"]),ja:new Set(["\u7D42\u308F\u308A","\u7D42\u4E86","\u304A\u308F\u308A"]),ar:new Set(["\u0646\u0647\u0627\u064A\u0629","\u0627\u0646\u062A\u0647\u0649","\u0622\u062E\u0631"]),es:new Set(["fin","final","terminar"]),ko:new Set(["\uB05D","\uC885\uB8CC","\uB9C8\uCE68"]),zh:new Set(["\u7ED3\u675F","\u7EC8\u6B62","\u5B8C"]),tr:new Set(["son","biti\u015F","bitti"]),pt:new Set(["fim","final","t\xE9rmino"]),fr:new Set(["fin","terminer","finir"]),de:new Set(["ende","beenden","fertig"]),id:new Set(["selesai","akhir","tamat"]),tl:new Set(["wakas","tapos"]),bn:new Set(["\u09B8\u09AE\u09BE\u09AA\u09CD\u09A4"]),qu:new Set(["tukukuy","tukuy","puchukay"]),sw:new Set(["mwisho","maliza","tamati"])};return (r[t]||r.en).has(e.toLowerCase())}extractStandaloneModifiers(e,t){let o=be(e,t).tokens;if(o.length===0)return {modifiers:null,remainingInput:null};let a=o[0].value.toLowerCase(),s=N.STANDALONE_MODIFIERS[a];if(!s)return {modifiers:null,remainingInput:null};let l={},c=1;if(s==="once")l.once=true;else {let m=1;if(m<o.length){let f=o[m];(f.kind==="keyword"||f.kind==="particle")&&(m++,c++);}if(m<o.length){let f=o[m];if(f.kind==="literal"){let y=f.value.match(/^(\d+)(ms|s|m)?$/);if(y){let g=parseInt(y[1],10),E=y[2]||"ms";E==="s"?g*=1e3:E==="m"&&(g*=6e4),l[s]=g,c=m+1;}}}l[s]||(l[s]=s==="debounce"?300:100);}let u=o.slice(c);if(u.length===0)return {modifiers:null,remainingInput:null};let p=u[0].position.start,d=e.slice(p);return {modifiers:l,remainingInput:d}}applyModifiers(e,t){return {...e,eventModifiers:{...e.eventModifiers,...t}}}extractOrConjunctionEvents(e,t){let r=[];for(;;){let o=e.mark(),i=e.peek();if(!i)break;let a=(i.normalized||i.value).toLowerCase();if(!N.OR_KEYWORDS.has(a)){e.reset(o);break}e.advance();let s=e.peek();if(!s){e.reset(o);break}let l=(s.normalized||s.value).toLowerCase();e.advance(),r.push({type:"literal",value:l});}return r}};G.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);G.SOV_EVENT_MARKERS={ja:new Set(["\u3067"]),ko:new Set,tr:new Set(["de","da","te","ta"]),bn:new Set(["\u098F"]),qu:new Set(["pi"])};G.SOV_SOURCE_MARKERS={ja:{markers:new Set(["\u304B\u3089"]),windowTokens:new Set(["\u30A6\u30A3\u30F3\u30C9\u30A6","\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8","window","document"])},ko:{markers:new Set(["\uC5D0\uC11C"]),windowTokens:new Set(["\uCC3D","\uC708\uB3C4\uC6B0","\uBB38\uC11C","window","document"])},tr:{markers:new Set(["den","dan","ten","tan"]),windowTokens:new Set(["pencere","belge","window","document"])},bn:{markers:new Set(["\u09A5\u09C7\u0995\u09C7","\u09AE\u09A7\u09CD\u09AF\u09C7"]),windowTokens:new Set(["\u0989\u0987\u09A8\u09CD\u09A1\u09CB","\u09A1\u0995\u09C1\u09AE\u09C7\u09A8\u09CD\u099F","window","document"])},qu:{markers:new Set(["manta"]),windowTokens:new Set(["k_iri","ventana","window","document"])}};G.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};G.OR_KEYWORDS=new Set(["or","\u0623\u0648","o","ou","oder","atau","atau","\u6216","\u307E\u305F\u306F","\uB610\uB294","veya","\u0985\u09A5\u09AC\u09BE","utaq","au","\u0430\u0431\u043E","\u0438\u043B\u0438","ho\u1EB7c","lub","\u05D0\u05D5","\u0E2B\u0E23\u0E37\u0E2D","o"]);var Ga=G,Ka=new Ga;function Ce(n,e){return Ka.parse(n,e)}var we=class{constructor(n={}){this.cache=new Map,this.config={maxSize:n.maxSize??1e3,ttlMs:n.ttlMs??0,enabled:n.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(n,e){return `${e}:${n}`}isExpired(n){return this.config.ttlMs===0?false:Date.now()-n.createdAt>this.config.ttlMs}evictLRU(){let n=this.cache.keys().next().value;n!==void 0&&(this.cache.delete(n),this.stats.evictions++);}get(n,e){if(!this.config.enabled){this.stats.misses++;return}let t=this.makeKey(n,e),r=this.cache.get(t);if(!r){this.stats.misses++;return}if(this.isExpired(r)){this.cache.delete(t),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(t),r.lastAccessed=Date.now(),this.cache.set(t,r),this.stats.hits++,r.result}set(n,e,t){if(!this.config.enabled||t.confidence===0)return;let r=this.makeKey(n,e),o=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(r,{result:t,createdAt:o,lastAccessed:o});}has(n,e){if(!this.config.enabled)return false;let t=this.makeKey(n,e),r=this.cache.get(t);return r?this.isExpired(r)?(this.cache.delete(t),this.stats.expirations++,false):true:false}delete(n,e){let t=this.makeKey(n,e);return this.cache.delete(t)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let n=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:n>0?this.stats.hits/n:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(n){if(n.maxSize!==void 0)for(this.config.maxSize=n.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();n.ttlMs!==void 0&&(this.config.ttlMs=n.ttlMs),n.enabled!==void 0&&(this.config.enabled=n.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}},Ya=new we;var Qa=class{constructor(n={}){this.patternMatcher=new At,this.languages=new Set(wt()),n.cache===false?this.cache=new we({enabled:false}):this.cache=n.cache?new we(n.cache):Ya;}analyze(n,e){if(!this.supportsLanguage(e))return {confidence:0,errors:[`Language '${e}' is not supported for semantic parsing`]};let t=this.cache.get(n,e);if(t)return t;let r=this.analyzeUncached(n,e);return this.cache.set(n,e,r),r}analyzeUncached(n,e){try{try{let a=Ce(n,e),s={confidence:a.metadata?.confidence??.8,node:a};return a.kind==="command"?{...s,command:{name:a.action,roles:a.roles}}:s}catch{}let t=ji(e);if(!t)return {confidence:0,errors:[`No tokenizer available for language '${e}'`]};let r=t.tokenize(n),o=z(e);if(o.length===0)return {confidence:0,errors:[`No patterns available for language '${e}'`]};let i=this.patternMatcher.matchBest(r,o);if(i){let a=this.buildSemanticNode(i);return {confidence:i.confidence,command:{name:i.pattern.command,roles:i.captured},node:a,tokensConsumed:i.consumedTokens}}return {confidence:0,errors:["No pattern matched the input"]}}catch(t){return {confidence:0,errors:[t instanceof Error?t.message:String(t)]}}}supportsLanguage(n){return this.languages.has(n)}supportedLanguages(){return Array.from(this.languages)}getCacheStats(){return this.cache.getStats()}clearCache(){this.cache.clear();}configureCache(n){this.cache.configure(n);}buildSemanticNode(n){return {kind:"command",action:n.pattern.command,roles:n.captured,metadata:{patternId:n.pattern.id}}}};function Rt(n){return new Qa(n)}var Xa=.5;function Ot(n,e=Xa){return n.confidence>=e&&n.command!==void 0}function _t(n,e){let t=e==="SOV"?"sovPosition":"svoPosition";return [...n].sort((r,o)=>{let i=r[t]??99,a=o[t]??99;return i-a})}function Ja(n,e){let t=n.markerOverride?.[e.code],r=e.roleMarkers[n.role];if(t!==void 0)return {primary:t,position:r?.position??"before",isOverride:true};if(r&&r.primary){let o={primary:r.primary,position:r.position,isOverride:false};return r.alternatives&&(o.alternatives=r.alternatives),o}return null}function Za(n,e,t,r,o){let i=[];if(i.push({type:"role",role:"event",optional:false}),r.position==="after"){let c=r.primary.split(/\s+/);if(c.length>1)for(let u of c)i.push({type:"literal",value:u});else {let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(u);}}let a=e.roleMarkers.destination;a&&i.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary}]}),i.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let c=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};i.push(c);}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(l),{id:`${n.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(o.basePriority??100)+50,template:{format:`{event} ${r.primary} {destination?} {patient} ${s?.primary||""} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function es(n,e,t,r,o){let i=[];i.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.patient;if(a){let l=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};i.push(l);}if(i.push({type:"role",role:"event",optional:false}),r.position==="after"){let l=r.primary.split(/\s+/);if(l.length>1)for(let c of l)i.push({type:"literal",value:c});else {let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(c);}}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(s),{id:`${n.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(o.basePriority??100)+45,template:{format:`{patient} ${a?.primary||""} {event} ${r.primary} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ts(n,e,t,r,o){let i=[];i.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.patient;if(a){let c=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};i.push(c);}let s=e.roleMarkers.destination;if(s&&(i.push({type:"role",role:"destination",optional:false}),i.push(s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary})),i.push({type:"role",role:"event",optional:false}),r.position==="after"){let c=r.primary.split(/\s+/);if(c.length>1)for(let u of c)i.push({type:"literal",value:u});else {let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(u);}}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(l),{id:`${n.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(o.basePriority??100)+40,template:{format:`{patient} ${a?.primary||""} {destination} ${s?.primary||""} {event} ${r.primary} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function rs(n,e,t,r,o){let i=[];i.push({type:"role",role:"event",optional:false});let a=r.alternatives?.filter(u=>!u.includes(" ")&&u.length>1)||[];a.length>0&&i.push({type:"literal",value:a[0],alternatives:a.slice(1)});let s=e.roleMarkers.destination;s&&i.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary}]}),i.push({type:"role",role:"patient",optional:false});let l=e.roleMarkers.patient;if(l){let u=l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary};i.push(u);}let c=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(c),{id:`${n.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(o.basePriority??100)+52,template:{format:`{event}${a[0]||""} {patient} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ns(n,e,t,r,o){let i=[];if(i.push({type:"role",role:"event",optional:false}),r.position==="after"){let s=r.primary.split(/\s+/);if(s.length>1)for(let l of s)i.push({type:"literal",value:l});else {let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(l);}}let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(a),{id:`${n.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(o.basePriority??100)+48,template:{format:`{event} ${r.primary} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function os(n,e,t,r){let o=e.eventHandler?.temporalMarkers;if(!o||o.length===0)return null;let i=[];i.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&i.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),i.push({type:"literal",value:o[0],alternatives:o.slice(1)}),i.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.patient;if(a?.primary){let l=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};i.push(l);}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(s),{id:`${n.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(r.basePriority??100)+49,template:{format:`{event} ${o[0]} {patient} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function is(n,e,t,r,o){let i=[];if(i.push({type:"role",role:"event",optional:false}),r.position==="after"){let u=r.primary.split(/\s+/);if(u.length>1)for(let p of u)i.push({type:"literal",value:p});else {let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(p);}}let s=[...n.roles.filter(u=>u.required)].sort((u,p)=>{let d=u.sovPosition??999,m=p.sovPosition??999;return d-m});for(let u of s){i.push({type:"role",role:u.role,optional:false});let p,d;if(u.markerOverride&&u.markerOverride[e.code]!==void 0)p=u.markerOverride[e.code];else {let m=e.roleMarkers[u.role];m&&(p=m.primary,d=m.alternatives);}if(p){let m=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};i.push(m);}}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(l);let c=s.map(u=>`{${u.role}}`).join(" ");return {id:`${n.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(o.basePriority??100)+55,template:{format:`{event} ${r.primary} ${c} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},...Object.fromEntries(s.map(u=>[u.role,{fromRole:u.role}]))}}}function as(n,e,t,r,o){let i=[],s=[...n.roles.filter(f=>f.required)].sort((f,y)=>{let g=f.sovPosition??999,E=y.sovPosition??999;return g-E}),l=s[0];i.push({type:"role",role:l.role,optional:false});let c;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)c=l.markerOverride[e.code];else {let f=e.roleMarkers[l.role];f&&(c=f.primary);}if(c&&i.push({type:"literal",value:c}),i.push({type:"role",role:"event",optional:false}),r.position==="after"){let f=r.primary.split(/\s+/);if(f.length>1)for(let y of f)i.push({type:"literal",value:y});else {let y=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(y);}}let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(u);let p=s[1];i.push({type:"role",role:p.role,optional:false});let d,m;if(p.markerOverride&&p.markerOverride[e.code]!==void 0)d=p.markerOverride[e.code];else {let f=e.roleMarkers[p.role];f&&(d=f.primary,m=f.alternatives);}if(d){let f=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};i.push(f);}return {id:`${n.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(o.basePriority??100)+48,template:{format:`{${l.role}} {event} ${r.primary} ${t.primary} {${p.role}}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},[l.role]:{fromRole:l.role},[p.role]:{fromRole:p.role}}}}function ft(n,e,t,r,o){let i=[];if(r.position==="before"){let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(l);}i.push({type:"role",role:"event",optional:false});let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(a),i.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&i.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),{id:`${n.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(o.basePriority??100)+50,template:{format:`${r.primary} {event} ${t.primary} {patient} ${s?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ss(n,e,t,r,o){let i=[],a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(a),i.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;if(s&&i.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),r.position==="before"){let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(l);}return i.push({type:"role",role:"event",optional:false}),{id:`${n.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(o.basePriority??100)+45,template:{format:`${t.primary} {patient} ${s?.primary||""} {destination?} ${r.primary} {event}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ls(n,e,t,r,o){let i=[],a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(a);let l=[...n.roles.filter(u=>u.required)].sort((u,p)=>{let d=u.svoPosition??999,m=p.svoPosition??999;return d-m});for(let u of l){let p,d;if(u.markerOverride&&u.markerOverride[e.code]!==void 0)p=u.markerOverride[e.code];else {let m=e.roleMarkers[u.role];m&&(p=m.primary,d=m.alternatives);}if(p){let m=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};i.push(m);}i.push({type:"role",role:u.role,optional:false});}if(r.position==="before"){let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(u);}i.push({type:"role",role:"event",optional:false});let c=l.map(u=>`{${u.role}}`).join(" ");return {id:`${n.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(o.basePriority??100)+48,template:{format:`${t.primary} ${c} ${r.primary} {event}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},...Object.fromEntries(l.map(u=>[u.role,{fromRole:u.role}]))}}}function vt(n,e,t,r,o){let i=[];if(r.position==="before"){let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(u);}i.push({type:"role",role:"event",optional:false});let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(a);let l=[...n.roles.filter(u=>u.required)].sort((u,p)=>{let d=u.svoPosition??999,m=p.svoPosition??999;return d-m});for(let u of l){let p,d;if(u.markerOverride&&u.markerOverride[e.code]!==void 0)p=u.markerOverride[e.code];else {let m=e.roleMarkers[u.role];m&&(p=m.primary,d=m.alternatives);}if(p){let m=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};i.push(m);}i.push({type:"role",role:u.role,optional:false});}let c=l.map(u=>`{${u.role}}`).join(" ");return {id:`${n.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(o.basePriority??100)+55,template:{format:`${r.primary} {event} ${t.primary} ${c}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},...Object.fromEntries(l.map(u=>[u.role,{fromRole:u.role}]))}}}function us(n,e,t,r,o){let i=[],a=e.eventHandler?.negationMarker;if(r.position==="before"){let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(c);}if(a){let c=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};i.push(c);}i.push({type:"role",role:"event",optional:false});let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(s),i.push({type:"role",role:"patient",optional:false});let l=e.roleMarkers.destination;return l&&i.push({type:"group",optional:true,tokens:[l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary},{type:"role",role:"destination",optional:true}]}),{id:`${n.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(o.basePriority??100)+48,template:{format:`${r.primary} ${a?.primary||""} {event} ${t.primary} {patient} ${l?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function cs(n,e,t,r){let o=[];o.push({type:"literal",value:"and",alternatives:["then"]}),o.push({type:"role",role:"event",optional:false});let i=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};o.push(i),o.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.destination;return a&&o.push({type:"group",optional:true,tokens:[a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary},{type:"role",role:"destination",optional:true}]}),{id:`${n.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(r.basePriority??100)+45,template:{format:`[proclitic?] {event} ${t.primary} {patient} ${a?.primary||""} {destination?}`,tokens:o},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var te={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function Nt(n,e,t=te){let r=`${n.action}-${e.code}-generated`,o=t.basePriority??100,i=e.keywords[n.action];if(!i)throw new Error(`No keyword translation for '${n.action}' in ${e.code}`);let a=fs(n,e,i),s=Mt(n,e),l=gs(n,e,i);return {id:r,language:e.code,command:n.action,priority:o,template:{format:l,tokens:a},extraction:s}}function ps(n,e,t=te){if(n.roles.filter(s=>!s.required).length===0)return null;let o=n.roles.filter(s=>s.required),i={...n,roles:o};return {...Nt(i,e,t),id:`${n.action}-${e.code}-generated-simple`,priority:(t.basePriority??100)-5,extraction:Mt(n,e)}}function ds(n,e,t=te){let r=[];if(r.push(Nt(n,e,t)),t.generateSimpleVariants){let o=ps(n,e,t);o&&r.push(o);}return r}function It(n,e=te){let t=[],r=Ha();for(let o of r){if(!n.keywords[o.action])continue;let i=ds(o,n,e);if(t.push(...i),n.eventHandler?.eventMarker){let a=ms(o,n,e);t.push(...a);}}return t}function ms(n,e,t=te){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let r=[],o=e.eventHandler.eventMarker,i=e.keywords[n.action];if(!i)return [];let s=n.roles.filter(l=>l.required).length===2;if(e.wordOrder==="SOV")if(s)r.push(is(n,e,i,o,t)),r.push(as(n,e,i,o,t));else {r.push(Za(n,e,i,o,t)),r.push(es(n,e,i,o,t));let l=e.roleMarkers.destination;l&&l.primary!==o.primary&&r.push(ts(n,e,i,o,t));let c=o.primary.split(/\s+/),u=o.alternatives?.some(d=>!d.includes(" ")&&d.length>1);c.length>1&&u&&r.push(rs(n,e,i,o,t)),r.push(ns(n,e,i,o,t));let p=os(n,e,i,t);p&&r.push(p);}else e.wordOrder==="VSO"?s?(r.push(vt(n,e,i,o,t)),r.push(ls(n,e,i,o,t))):(r.push(ft(n,e,i,o,t)),r.push(ss(n,e,i,o,t)),e.eventHandler?.negationMarker&&r.push(us(n,e,i,o,t)),e.tokenization?.prefixes&&r.push(cs(n,e,i,t))):s?r.push(vt(n,e,i,o,t)):r.push(ft(n,e,i,o,t));return r}function fs(n,e,t){let r=[],o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary},i=vs(n,e);switch(e.wordOrder){case "SVO":r.push(o),r.push(...i);break;case "SOV":r.push(...i),r.push(o);break;case "VSO":r.push(o),r.push(...i);break;default:r.push(o),r.push(...i);}return r}function vs(n,e){let t=[],r=_t(n.roles,e.wordOrder);for(let o of r){let i=hs(o,e);o.required?t.push(...i):t.push({type:"group",optional:true,tokens:i});}return t}function hs(n,e){let t=[],r=n.markerOverride?.[e.code],o=e.roleMarkers[n.role],i={type:"role",role:n.role,optional:!n.required,expectedTypes:n.expectedTypes};if(r!==void 0)(o?.position??"before")==="before"?(r&&t.push({type:"literal",value:r}),t.push(i)):(t.push(i),r&&t.push({type:"literal",value:r}));else if(o)if(o.position==="before"){if(o.primary){let a=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};t.push(a);}t.push(i);}else {t.push(i);let a=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};t.push(a);}else t.push(i);return t}function ys(n,e){let t={};for(let r of n.roles){let o=r.markerOverride?.[e.code],i=e.roleMarkers[r.role];o!==void 0?t[r.role]=o?{marker:o}:{}:i&&i.primary?t[r.role]=i.alternatives?{marker:i.primary,markerAlternatives:i.alternatives}:{marker:i.primary}:t[r.role]={};}return t}function Mt(n,e){let t=ys(n,e),r={};for(let o of n.roles){let i=t[o.role]||{};!o.required&&o.default?r[o.role]={...i,default:o.default}:r[o.role]=i;}return r}function gs(n,e,t){let r=[],i=_t(n.roles,e.wordOrder).map(a=>{let s=Ja(a,e),l="";return s&&s.primary?s.position==="before"?l=`${s.primary} {${a.role}}`:l=`{${a.role}} ${s.primary}`:l=`{${a.role}}`,a.required?l:`[${l}]`});switch(e.wordOrder){case "SVO":case "VSO":r.push(t.primary,...i);break;case "SOV":r.push(...i,t.primary);break;default:r.push(t.primary,...i);}return r.join(" ")}function pe(n){let e=n.getAttribute("data-lang");if(e)return Pe(e);let t=n.getAttribute("data-hyperscript-lang")??n.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(t)return Pe(t);let r=typeof document<"u"?document.documentElement?.lang:null;return r&&r!=="en"?Pe(r):null}function Pe(n){return n.split("-")[0].toLowerCase()}var Lt={add:[["patient",""],["destination","to"]],append:[["patient",""],["destination","to"]],async:[],beep:[["patient",""]],behavior:[["patient",""]],blur:[["patient",""]],break:[],call:[["patient",""]],clone:[["patient",""],["destination","into"]],compound:[],continue:[],copy:[["patient",""]],decrement:[["patient",""],["quantity","by"]],default:[["destination",""],["patient","to"]],else:[],exit:[],fetch:[["source",""],["responseType","as"],["method","via"],["destination","on"]],focus:[["patient",""]],for:[["patient",""],["source","in"]],get:[["source",""],["destination","on"]],go:[["destination",""]],halt:[["patient",""]],hide:[["patient",""],["style","with"]],if:[["condition",""]],increment:[["patient",""],["quantity","by"]],init:[],install:[["patient",""],["destination","on"]],js:[["patient",""]],log:[["patient",""]],make:[["patient",""]],measure:[["patient",""],["source","of"]],morph:[["destination",""],["patient","to"]],on:[["event",""],["source","from"]],pick:[["patient",""],["source","from"]],prepend:[["patient",""],["destination","to"]],put:[["patient",""],["destination","into"]],remove:[["patient",""],["source","from"]],render:[["patient",""],["style","with"]],repeat:[["quantity",""],["condition","until"]],return:[["patient",""]],send:[["event",""],["destination","to"]],set:[["destination",""],["patient","to"]],settle:[["patient",""]],show:[["patient",""],["style","with"]],swap:[["method",""],["destination","of"],["patient","with"]],take:[["patient",""],["source","from"]],tell:[["destination",""]],throw:[["patient",""]],toggle:[["patient",""],["destination","on"]],transition:[["patient",""],["goal","to"],["destination","on"],["duration","over"],["style","with"]],trigger:[["event",""],["destination","on"]],unless:[["condition",""]],wait:[["patient",""]],while:[["condition",""]]};function ne(n){switch(n.kind){case "event-handler":return Es(n);case "compound":return ks(n);default:return Ts(n)}}function Es(n){let e=["on"],t=n.roles.get("event");t&&e.push(re(t));let r=n.roles.get("source");if(r&&e.push("from",re(r)),n.body&&n.body.length>0){let o=n.body.map(ne);e.push(o.join(" then "));}return e.join(" ")}function ks(n){let e=n.chainType==="async"?"async":n.chainType;return n.statements.map(ne).join(` ${e} `)}function Ts(n){let e=Lt[n.action];if(e){let r=[n.action];for(let[o,i]of e){let a=n.roles.get(o);a&&(o==="destination"&&a.type==="reference"&&a.value==="me"||(i&&r.push(i),r.push(re(a))));}return r.join(" ")}let t=[n.action];for(let[,r]of n.roles)t.push(re(r));return t.join(" ")}function re(n){switch(n.type){case "literal":return typeof n.value=="string"&&n.dataType==="string"?`"${n.value}"`:String(n.value);case "selector":return n.value;case "reference":return n.value;case "property-path":return bs(n);case "expression":return n.raw;case "flag":return n.enabled?`+${n.name}`:`~${n.name}`}}function bs(n){let e=re(n.object),t=n.property;if(n.object.type==="reference")switch(n.object.value){case "me":return `my ${t}`;case "it":return `its ${t}`;case "you":return `your ${t}`}return `${e}'s ${t}`}var $t=.5,Ss={confidenceThreshold:$t,strategy:"semantic",fallbackToOriginal:true};function xs(n,e){return typeof n=="number"?n:n[e]??n["*"]??$t}var Re=null;function ws(){return Re||(Re=Rt()),Re}function Oe(n,e,t={}){let r={...Ss,...t},o=Dt(n,e,r);if(o!==null)return o;let i=Cs(n);if(i){let a=Dt(i.commands,e,r);if(a!==null)return i.prefix+a}return n}function Dt(n,e,t){if(t.strategy==="semantic"||t.strategy==="auto"){let r=xs(t.confidenceThreshold,e),o=Bt(n,e,r);if(o!==null)return o}if((t.strategy==="auto"||t.strategy==="i18n")&&t.i18nToEnglish){let r=Ps(n,e,t.i18nToEnglish);if(r!==null)return r}return null}var As=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function Cs(n){let e=n.match(As);if(!e)return null;let t=e[1],r=n.slice(t.length);return r?{prefix:t,commands:r}:null}function Bt(n,e,t){try{let r=Os(n,e);if(r.length>1)return _s(r,e,t);let o=ws();if(!o.supportsLanguage(e))return null;let i=o.analyze(n,e);if(!Ot(i,t))return null;if(i.node)return ne(i.node);let a=Ce(n,e);return ne(a)}catch{return null}}function Ps(n,e,t){try{let r=t(n,e);return r!==n?r:null}catch{return null}}function Rs(n){let e=["then"],t=$(n);if(t?.keywords?.then){let r=t.keywords.then;if(r.primary&&r.primary!=="then"&&e.push(r.primary),r.alternatives)for(let o of r.alternatives)e.includes(o)||e.push(o);}return e}function Os(n,e){let r=Rs(e).map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),o=new RegExp(`\\s+(?:${r.join("|")})\\s+`,"i"),i=n.split(`
|
|
6
|
+
`).map(s=>s.trim()).filter(s=>s.length>0),a=[];for(let s of i){let l=s.split(o);a.push(...l);}return a}function _s(n,e,t){let r=[];for(let o of n){let i=Bt(o.trim(),e,t);if(i===null)return null;r.push(i);}return r.join(" then ")}function _e(n={}){return function(t){let{internals:r}=t,o=r.runtime,i=o.getScript.bind(o);o.getScript=function(a){let s=i(a);if(!s)return null;let l=Ns(a,n);if(!l||l==="en")return s;let c=Oe(s,l,n);return n.debug&&c!==s&&console.log(`[hyperscript-i18n] ${l}: "${s}" \u2192 "${c}"`),c};}}function Ns(n,e){if(e.languageAttribute){let r=n.getAttribute(e.languageAttribute);if(r)return r.split("-")[0].toLowerCase()}let t=pe(n);return t||(e.defaultLanguage??null)}function qt(n,e,t={}){return e==="en"?n:Oe(n,e,t)}xt(n=>It(n));function Vt(){typeof _hyperscript<"u"&&_hyperscript.use&&(_hyperscript.use(_e()),Is());}function Is(){if(typeof document>"u")return;let e=_hyperscript?.internals?.runtime;if(!e?.processNode||!e?.getInternalData)return;let t=e.getScriptSelector?.()??"[_], [script], [data-script]";document.querySelectorAll(t).forEach(r=>{let o=e.getInternalData(r);o.initialized&&(o.initialized=false);}),e.processNode(document.body);}var Nl=["en"];Vt();exports.plugin=_e;exports.preprocess=qt;exports.resolveLanguage=pe;exports.supportedLanguages=Nl;return exports;})({});
|