@hyperscript-tools/multilingual 2.3.1 → 2.4.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/LICENSE +20 -0
- package/README.md +118 -0
- package/dist/hyperscript-i18n-ar.global.js +4 -0
- package/dist/hyperscript-i18n-bn.global.js +4 -0
- package/dist/hyperscript-i18n-de.global.js +4 -0
- package/dist/hyperscript-i18n-east-asian.global.js +4 -0
- package/dist/hyperscript-i18n-en.global.js +6 -0
- package/dist/hyperscript-i18n-es.global.js +4 -0
- package/dist/hyperscript-i18n-fr.global.js +4 -0
- package/dist/hyperscript-i18n-he.global.js +4 -0
- package/dist/hyperscript-i18n-hi.global.js +4 -0
- package/dist/hyperscript-i18n-id.global.js +4 -0
- package/dist/hyperscript-i18n-it.global.js +4 -0
- package/dist/hyperscript-i18n-ja.global.js +4 -0
- package/dist/hyperscript-i18n-ko.global.js +4 -0
- package/dist/hyperscript-i18n-lite.global.js +1 -0
- package/dist/hyperscript-i18n-ms.global.js +4 -0
- package/dist/hyperscript-i18n-pl.global.js +4 -0
- package/dist/hyperscript-i18n-pt.global.js +4 -0
- package/dist/hyperscript-i18n-qu.global.js +4 -0
- package/dist/hyperscript-i18n-ru.global.js +4 -0
- package/dist/hyperscript-i18n-slavic.global.js +4 -0
- package/dist/hyperscript-i18n-south-asian.global.js +4 -0
- package/dist/hyperscript-i18n-southeast-asian.global.js +4 -0
- package/dist/hyperscript-i18n-sw.global.js +4 -0
- package/dist/hyperscript-i18n-th.global.js +4 -0
- package/dist/hyperscript-i18n-tl.global.js +4 -0
- package/dist/hyperscript-i18n-tr.global.js +4 -0
- package/dist/hyperscript-i18n-uk.global.js +4 -0
- package/dist/hyperscript-i18n-vi.global.js +4 -0
- package/dist/hyperscript-i18n-western.global.js +4 -0
- package/dist/hyperscript-i18n-zh.global.js +4 -0
- package/dist/hyperscript-i18n.global.js +63 -0
- package/package.json +101 -4
- package/scripts/copy-bundles.mjs +25 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
var HyperscriptI18n=(function(exports){'use strict';function B(a,e){return e?{type:"literal",value:a,dataType:e}:{type:"literal",value:a}}function se(a,e){return e?{type:"selector",value:a,selectorKind:e}:{type:"selector",value:a}}function Q(a){return {type:"reference",value:a}}function le(a,e){return {type:"property-path",object:a,property:e}}var _e=new Set(["me","you","it","result","event","target","body"]);function ge(a,e=_e){return e.has(a)}var Vr=class{constructor(a){this.namespace=a,this.enabled=this.checkEnabled();}checkEnabled(){if(typeof process<"u"&&process.env){let a=process.env.DEBUG||"";return a==="*"||a.includes("framework:*")||a.includes(`framework:${this.namespace}`)}return false}log(a,e,...r){if(!this.enabled)return;let t=`[framework:${this.namespace}]`,i=new Date().toISOString();switch(a){case "debug":console.debug(`${i} ${t} DEBUG:`,e,...r);break;case "info":console.info(`${i} ${t} INFO:`,e,...r);break;case "warn":console.warn(`${i} ${t} WARN:`,e,...r);break;case "error":console.error(`${i} ${t} ERROR:`,e,...r);break}}debug(a,...e){this.log("debug",a,...e);}info(a,...e){this.log("info",a,...e);}warn(a,...e){this.log("warn",a,...e);}error(a,...e){this.log("error",a,...e);}isEnabled(){return this.enabled}enable(){this.enabled=true;}disable(){this.enabled=false;}};function jr(a){return new Vr(a)}function V(a,e){return !e||e.length===0||e.includes(a)||e.includes("expression")?true:a==="property-path"?e.some(r=>["selector","reference","expression"].includes(r)):false}function Wr(a,e){return a?.possessive?.keywords?.[e]}var J=class j{constructor(){this.logger=jr("pattern-matcher"),this.stemMatchCount=0,this.totalKeywordMatches=0;}safeToLowerCase(e){return typeof e=="string"?e.toLowerCase():e==null?"":String(e).toLowerCase()}matchPattern(e,r,t){let i=e.mark(),n=new Map;if(this.logger.debug("========================================"),this.logger.debug("matchPattern ENTRY"),this.logger.debug("Pattern ID:",r.id),this.logger.debug("Pattern command:",r.command),this.logger.debug("Pattern language:",r.language),this.logger.debug("Pattern template:",JSON.stringify(r.template,null,2)),this.logger.isEnabled()){let s=[];for(let p=0;p<10;p++){let l=e.peek(p);if(l)s.push({type:l.type,value:l.value,kind:l.kind});else break}this.logger.debug("Input tokens (first 10):",s),this.logger.debug("Profile code:",t?.code);}this.currentProfile=t,this.stemMatchCount=0,this.totalKeywordMatches=0,this.logger.debug("--- Calling matchTokenSequence ---"),this.logger.debug("Pattern tokens to match:",JSON.stringify(r.template.tokens,null,2));let o=this.matchTokenSequence(e,r.template.tokens,n);if(this.logger.debug("matchTokenSequence returned:",o),this.logger.debug("Captured roles:",Array.from(n.entries()).map(([s,p])=>[s,JSON.stringify(p)])),!o)return this.logger.debug(">>> MATCH FAILED - resetting token position"),e.reset(i),null;let u=this.calculateConfidence(r,n);return this.applyExtractionRules(r,n),{pattern:r,captured:n,consumedTokens:e.position()-i.position,confidence:u}}matchBest(e,r,t){let i=[];for(let o of r){let u=e.mark(),s=this.matchPattern(e,o,t);s&&i.push(s),e.reset(u);}if(i.length===0)return null;i.sort((o,u)=>{let s=u.pattern.priority-o.pattern.priority;if(s!==0)return s;let p=u.confidence-o.confidence;return Math.abs(p)>.001?p:u.consumedTokens-o.consumedTokens});let n=i[0];return this.matchPattern(e,n.pattern),n}matchTokenSequence(e,r,t,i){let n=r[0],o=n?.type==="literal"&&(n.value==="and"||n.value==="then"||n.alternatives?.includes("and")||n.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!o)for(;e.peek()?.kind==="conjunction";)e.advance();let u=null,s=null;for(let p=0;p<r.length;p++){let l=r[p];this.logger.debug(" >> Matching pattern token:",JSON.stringify(l,null,2));let c=e.peek();if(this.logger.debug(" >> Current input token:",c?JSON.stringify({type:c.type,value:c.value,kind:c.kind}):"EOF"),l.type==="role"&&l.greedy){let g=this.collectStopMarkers(r,p+1);if(i)for(let z of i)g.add(z);let E=[];for(;!e.isAtEnd();){let z=e.peek();if(!z||this.isStopMarker(z,g))break;E.push(z.value),e.advance();}if(E.length>0){t.set(l.role,{type:"expression",raw:E.join(" ")}),u=null,s=null;continue}else {if(l.optional)continue;return false}}if(l.type==="group"){let g=this.collectStopMarkers(r,p+1);if(i)for(let z of i)g.add(z);if(this.matchGroupToken(e,l,t,g)){u=null,s=null;continue}if(this.isOptional(l))continue;return false}let m=l.type==="role"&&l.optional===true,d=m?e.mark():null;if(l.type==="role"&&!m){let g=p+1<r.length?r[p+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(l))continue;if(u&&s){this.logger.debug(" >> BACKTRACKING: undoing optional role",s),e.reset(u),t.delete(s),u=null,s=null;let z=this.matchPatternToken(e,l,t);if(this.logger.debug(" >> Backtrack retry result:",z),z)continue}return false}}}let h=this.matchPatternToken(e,l,t);if(this.logger.debug(" >> Match result:",h),h){m?(u=d,s=l.role):(u=null,s=null);continue}if(this.logger.debug(" >> Token match FAILED"),!this.isOptional(l)){if(u&&s){this.logger.debug(" >> BACKTRACKING: undoing optional role",s),e.reset(u),t.delete(s),u=null,s=null;let g=this.matchPatternToken(e,l,t);if(this.logger.debug(" >> Backtrack retry result:",g),g)continue}return false}}return true}matchPatternToken(e,r,t){switch(r.type){case "literal":return this.matchLiteralToken(e,r);case "role":return this.matchRoleToken(e,r,t);case "group":return this.matchGroupToken(e,r,t);default:return false}}matchLiteralToken(e,r){let t=e.peek();if(this.logger.debug(" >>> matchLiteralToken: expecting",r.value),this.logger.debug(" >>> matchLiteralToken: got token",t?JSON.stringify({type:t.type,value:t.value,kind:t.kind}):"null"),!t)return this.logger.debug(" >>> matchLiteralToken: FAIL - no token"),false;let i=this.getMatchType(t,r.value);if(this.logger.debug(" >>> matchType for",t.value,"vs",r.value,":",i),i!=="none")return this.totalKeywordMatches++,i==="stem"&&this.stemMatchCount++,e.advance(),true;if(r.alternatives)for(let n of r.alternatives){let o=this.getMatchType(t,n);if(o!=="none")return this.totalKeywordMatches++,o==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,r,t){this.logger.debug(" >>> matchRoleToken ENTRY: capturing role",r.role),this.logger.debug(" >>> matchRoleToken: expected types",r.expectedTypes),this.logger.debug(" >>> matchRoleToken: optional?",r.optional),this.skipNoiseWords(e);let i=e.peek();if(this.logger.debug(" >>> After skipNoiseWords, current token:",i?JSON.stringify({value:i.value,kind:i.kind}):"null"),!i)return r.optional||false;let n=this.tryMatchPossessiveExpression(e);if(n)return r.expectedTypes&&r.expectedTypes.length>0&&!V(n.type,r.expectedTypes)?r.optional||false:(t.set(r.role,n),true);let o=this.tryMatchMethodCallExpression(e);if(o)return r.expectedTypes&&r.expectedTypes.length>0&&!V(o.type,r.expectedTypes)?r.optional||false:(t.set(r.role,o),true);let u=this.tryMatchPossessiveSelectorExpression(e);if(u)return r.expectedTypes&&r.expectedTypes.length>0&&!V(u.type,r.expectedTypes)?r.optional||false:(t.set(r.role,u),true);let s=this.tryMatchPropertyAccessExpression(e);if(s)return r.expectedTypes&&r.expectedTypes.length>0&&!V(s.type,r.expectedTypes)?r.optional||false:(t.set(r.role,s),true);let p=this.tryMatchSelectorPropertyExpression(e);if(p)return r.expectedTypes&&r.expectedTypes.length>0&&!V(p.type,r.expectedTypes)?r.optional||false:(t.set(r.role,p),true);this.logger.debug(" >>> Trying tokenToSemanticValue for token:",i?JSON.stringify({value:i.value,kind:i.kind}):"null");let l=this.tokenToSemanticValue(i);return this.logger.debug(" >>> tokenToSemanticValue returned:",l?JSON.stringify(l):"null"),l?(this.logger.debug(" >>> Validating type:",l.type,"against expected:",r.expectedTypes),r.expectedTypes&&r.expectedTypes.length>0&&!V(l.type,r.expectedTypes)?(this.logger.debug(" >>> TYPE MISMATCH - returning",r.optional||false),r.optional||false):(this.logger.debug(" >>> Type validation PASSED"),t.set(r.role,l),e.advance(),true)):r.optional||false}tryMatchPossessiveExpression(e){let r=e.peek();if(!r||!this.currentProfile)return null;let t=r.normalized||r.value,i=this.safeToLowerCase(t),n=Wr(this.currentProfile,i);if(!n)return null;let o=e.mark();e.advance();let u=e.peek();if(!u)return e.reset(o),null;if(u.kind==="identifier"||u.kind==="keyword"&&!this.isStructuralKeyword(u.value)||u.kind==="selector"&&u.value.startsWith("*")||u.kind==="selector"&&u.value.startsWith("@")||u.kind==="selector"&&u.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(u.value)){e.advance();let s=u.value;u.kind==="selector"&&s.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s)&&(s=s.substring(1));let p=s;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)p+=e.peek().value,e.advance();let l=e.peek();return l?.kind==="literal"&&l.value.startsWith("(")&&(p+=l.value,e.advance()),le(Q(n),p)}return e.reset(o),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(e){let r=e.peek();if(!r||r.kind!=="selector")return null;let t=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(t),null;e.advance();let n=e.peek();if(!n||n.kind!=="identifier")return e.reset(t),null;e.advance();let o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="(")return e.reset(t),null;e.advance();let u=[];for(;!e.isAtEnd()&&u.length<j.MAX_METHOD_ARGS;){let p=e.peek();if(!p)break;if(p.kind==="punctuation"&&p.value===")"){e.advance();break}if(p.kind==="punctuation"&&p.value===","){e.advance();continue}u.push(p.value),e.advance();}return {type:"expression",raw:`${r.value}.${n.value}(${u.join(", ")})`}}tryMatchPropertyAccessExpression(e){let r=e.peek();if(!r||r.kind!=="identifier"&&r.kind!=="keyword")return null;let t=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(t),null;e.advance();let n=e.peek();if(!n||n.kind!=="identifier")return e.reset(t),null;e.advance();let o=`${r.value}.${n.value}`,u=1;for(;!e.isAtEnd()&&u<j.MAX_PROPERTY_DEPTH;){let p=e.peek();if(!p||p.kind!=="operator"||p.value!==".")break;e.advance();let l=e.peek();if(!l||l.kind!=="identifier")break;e.advance(),o+=`.${l.value}`,u++;}let s=e.peek();if(s&&s.kind==="punctuation"&&s.value==="("){e.advance();let p=[],l=0;for(;!e.isAtEnd()&&p.length<j.MAX_METHOD_ARGS;){let m=e.peek();if(!m)break;if(m.kind==="punctuation"&&m.value===")"){if(l===0){e.advance();break}l--;}if(m.kind==="punctuation"&&m.value==="("&&l++,m.kind==="punctuation"&&m.value===","){e.advance();continue}p.push(m.value),e.advance();}return {type:"expression",raw:`${o}(${p.join(", ")})`}}return {type:"expression",raw:o}}tryMatchPossessiveSelectorExpression(e){let r=e.peek();if(!r||r.kind!=="selector")return null;let t=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="punctuation"||i.value!=="'s")return e.reset(t),null;e.advance();let n=e.peek();return !n||n.kind!=="selector"&&n.kind!=="identifier"?(e.reset(t),null):(e.advance(),le(se(r.value),n.value))}tryMatchSelectorPropertyExpression(e){let r=e.peek();if(!r||r.kind!=="selector"||typeof r.value!="string"||!r.value.startsWith("#"))return null;let t=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="selector"||!i.value.startsWith("."))return e.reset(t),null;let n=e.peek(1);n&&n.kind,e.advance();let o=i.value.slice(1);return le(se(r.value),o)}matchGroupToken(e,r,t,i){let n=e.mark(),o=new Set(t.keys());if(this.matchTokenSequence(e,r.tokens,t,i))return true;e.reset(n);for(let p of t.keys())o.has(p)||t.delete(p);if(!r.optional)return false;let s=this.getGroupLeadingMarker(r);if(s)for(let p=1;p<=j.MAX_MARKER_SCAN;p++){let l=e.peek(p);if(!l)break;if((l.normalized||l.value).toLowerCase()===s){this.logger.debug(" >> MARKER SCAN: found",s,"at offset",p,"- skipping intervening tokens");for(let d=0;d<p;d++)e.advance();if(this.matchTokenSequence(e,r.tokens,t,i))return true;e.reset(n);for(let d of t.keys())o.has(d)||t.delete(d);break}}return true}getGroupLeadingMarker(e){let r=e.tokens[0];return r?.type==="literal"?r.value.toLowerCase():null}getMatchType(e,r){return e.value===r?"exact":e.normalized===r?"normalized":e.stem===r&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&this.safeToLowerCase(e.value)===r.toLowerCase()?"case-insensitive":"none"}collectStopMarkers(e,r){let t=new Set;for(let i=r;i<e.length;i++){let n=e[i];if(n.type==="literal"){if(t.add(n.value.toLowerCase()),n.alternatives)for(let o of n.alternatives)t.add(o.toLowerCase());break}if(n.type==="group"){for(let o of n.tokens)if(o.type==="literal"){if(t.add(o.value.toLowerCase()),o.alternatives)for(let u of o.alternatives)t.add(u.toLowerCase());break}if(!n.optional)break}}return t}isStopMarker(e,r){return r.size===0?false:!!(r.has(e.value.toLowerCase())||e.normalized&&r.has(e.normalized.toLowerCase()))}tokenToSemanticValue(e){switch(e.kind){case "selector":return se(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let r=e.normalized||e.value;this.safeToLowerCase(r);return B(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return Q(e.value);this.safeToLowerCase(e.value);return {type:"expression",raw:e.value};case "url":return B(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 B(i,"string")}if(e==="true")return B(true,"boolean");if(e==="false")return B(false,"boolean");let r=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(r){let i=parseFloat(r[1]);return r[2]?B(e,"duration"):B(i,"number")}let t=parseFloat(e);return isNaN(t)?B(e,"string"):B(t,"number")}applyExtractionRules(e,r){for(let[t,i]of Object.entries(e.extraction))r.has(t)||(i.value!==void 0?r.set(t,{type:"literal",value:i.value}):i.default&&r.set(t,i.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,r){let t=0,i=0,n=p=>e.extraction?.[p]?.default!==void 0;for(let p of e.template.tokens)if(p.type==="role")i+=1,r.has(p.role)&&(t+=1);else if(p.type==="group"){for(let l of p.tokens)if(l.type==="role"){let c=n(l.role),m=.8;i+=m,r.has(l.role)?t+=m:c&&(t+=m*.6);}}let o=i>0?t/i:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){let p=this.stemMatchCount/this.totalKeywordMatches*.15;o=Math.max(.5,o-p);}let u=this.calculateVSOConfidenceBoost(e);o=Math.min(1,o+u);let s=this.arabicPrepositionDisambiguation(e,r);return o=Math.max(0,Math.min(1,o+s)),o}calculateVSOConfidenceBoost(e){if(e.language!=="ar")return 0;let r=e.template.tokens[0];if(!r||r.type!=="literal")return 0;let t=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(t.has(r.value))return .15;if(r.alternatives){for(let i of r.alternatives)if(t.has(i))return .15}return 0}arabicPrepositionDisambiguation(e,r){if(e.language!=="ar")return 0;let t=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,o]of r.entries()){let u=i[n];if(!u||u.length===0)continue;let s="metadata"in o?o.metadata:void 0;if(s&&typeof s.prepositionValue=="string"){let p=s.prepositionValue;u.includes(p)?t+=.1:t-=.1;}}return Math.max(-0.1,Math.min(.1,t))}skipNoiseWords(e){let r=e.peek();if(!r)return;let t=this.safeToLowerCase(r.value);if(j.ENGLISH_NOISE_WORDS.has(t)){let i=e.mark();e.advance();let n=e.peek();if(n&&n.kind==="selector")return;e.reset(i);}t==="class"&&e.advance();}extractEventModifiers(e){let r={},t=false;for(;!e.isAtEnd();){let i=e.peek();if(!i||i.kind!=="event-modifier")break;let n=i.metadata;if(!n)break;switch(t=true,n.modifierName){case "once":r.once=true;break;case "debounce":typeof n.value=="number"&&(r.debounce=n.value);break;case "throttle":typeof n.value=="number"&&(r.throttle=n.value);break;case "queue":(n.value==="first"||n.value==="last"||n.value==="all"||n.value==="none")&&(r.queue=n.value);break}e.advance();}return t?r:void 0}};J.MAX_MARKER_SCAN=3;J.MAX_PROPERTY_DEPTH=10;J.MAX_METHOD_ARGS=20;J.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Hr=J;new Hr;var Ie=class{constructor(){this.name="string-literal";}canExtract(a,e){let r=a[e];return r==='"'||r==="'"||r==="`"||r==="\u201C"||r==="\u2018"}extract(a,e){let r=a[e];if(r==="\u201C"){let n=1;for(;e+n<a.length;){if(a[e+n]==="\u201D")return n++,{value:a.substring(e,e+n),length:n};n++;}return null}if(r==="\u2018"){let n=1;for(;e+n<a.length;){if(a[e+n]==="\u2019")return n++,{value:a.substring(e,e+n),length:n};n++;}return null}let t=1,i=false;for(;e+t<a.length;){let n=a[e+t];if(i){i=false,t++;continue}if(n==="\\"){i=true,t++;continue}if(n===r)return t++,{value:a.substring(e,e+t),length:t};t++;}return null}},Me=class{constructor(){this.name="number";}canExtract(a,e){return /\d/.test(a[e])}extract(a,e){let r=0,t=false;for(;e+r<a.length;){let o=a[e+r];if(/\d/.test(o))r++;else if(o==="."&&!t)t=true,r++;else break}if(r===0)return null;let i=a.substring(e,e+r),n=e+r;if(n<a.length){let o=a.slice(n),u=[{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 p of u)if(o.startsWith(p.pattern))return {value:i+p.suffix,length:r+p.pattern.length,metadata:{hasTimeUnit:true}};if(o.startsWith("ms"))return {value:i+"ms",length:r+2,metadata:{hasTimeUnit:true}};let s=[{pattern:"\u79D2",suffix:"s"},{pattern:"\u5206",suffix:"m"}];for(let p of s)if(o.startsWith(p.pattern))return {value:i+p.suffix,length:r+1,metadata:{hasTimeUnit:true}};if(/^[smh](?![a-zA-Z])/.test(o))return {value:i+o[0],length:r+1,metadata:{hasTimeUnit:true}}}return {value:i,length:r}}};function Ur(a){return "setContext"in a&&typeof a.setContext=="function"}function Gr(a){let e={language:a.language,direction:a.direction,lookupKeyword:a.lookupKeyword.bind(a),isKeyword:a.isKeyword.bind(a),isKeywordStart:a.isKeywordStart.bind(a)};return a.normalizer?{...e,normalizer:a.normalizer}:e}var Z=class{constructor(a,e){this.pos=0,this.tokens=a,this.language=e;}peek(a=0){let e=this.pos+a;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(a){this.pos=a.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(a){let e=[];for(;!this.isAtEnd()&&a(this.peek());)e.push(this.advance());return e}skipWhile(a){for(;!this.isAtEnd()&&a(this.peek());)this.advance();}};function b(a,e){return {start:a,end:e}}function C(a,e,r,t){if(typeof a=="object"){let{value:n,kind:o,position:u,normalized:s,stem:p,stemConfidence:l,metadata:c}=a;return {value:n,kind:o,position:u,...s!==void 0&&{normalized:s},...p!==void 0&&{stem:p},...l!==void 0&&{stemConfidence:l},...c!==void 0&&{metadata:c}}}let i=a;if(!e||!r)throw new Error("createToken requires kind and position parameters");if(typeof t=="string")return {value:i,kind:e,position:r,normalized:t};if(t){let{normalized:n,stem:o,stemConfidence:u,metadata:s}=t;return {value:i,kind:e,position:r,...n!==void 0&&{normalized:n},...o!==void 0&&{stem:o},...u!==void 0&&{stemConfidence:u},...s!==void 0&&{metadata:s}}}return {value:i,kind:e,position:r}}function X(a){return /\s/.test(a)}function Kr(a){return a==="#"||a==="."||a==="["||a==="@"||a==="*"||a==="<"}function Yr(a){return a==='"'||a==="'"||a==="`"||a==="\u300C"||a==="\u300D"}function I(a){return /\d/.test(a)}function Qr(a){return /[a-zA-Z]/.test(a)}function x(a){return /[a-zA-Z0-9_-]/.test(a)}function Xr(a,e){if(e>=a.length)return null;let r=a[e];if(!Kr(r))return null;let t=e,i="";if(r==="#"||r==="."){for(i+=a[t++];t<a.length&&x(a[t]);)i+=a[t++];if(i.length<=1)return null;if(t<a.length&&a[t]==="."&&r==="#"){let o=t+1;for(;o<a.length&&x(a[o]);)o++;if(o<a.length&&a[o]==="(")return i}}else if(r==="["){let n=1,o=false,u=null,s=false;for(i+=a[t++];t<a.length&&n>0;){let p=a[t];i+=p,s?s=false:p==="\\"?s=true:o?p===u&&(o=false,u=null):p==='"'||p==="'"||p==="`"?(o=true,u=p):p==="["?n++:p==="]"&&n--,t++;}if(n!==0)return null}else if(r==="@"){for(i+=a[t++];t<a.length&&x(a[t]);)i+=a[t++];if(i.length<=1)return null}else if(r==="*"){for(i+=a[t++];t<a.length&&x(a[t]);)i+=a[t++];if(i.length<=1)return null}else if(r==="<"){if(i+=a[t++],t>=a.length||!Qr(a[t]))return null;for(;t<a.length&&x(a[t]);)i+=a[t++];for(;t<a.length;){let n=a[t];if(n==="."){if(i+=a[t++],t>=a.length||!x(a[t]))return null;for(;t<a.length&&x(a[t]);)i+=a[t++];}else if(n==="#"){if(i+=a[t++],t>=a.length||!x(a[t]))return null;for(;t<a.length&&x(a[t]);)i+=a[t++];}else if(n==="["){let o=1,u=false,s=null,p=false;for(i+=a[t++];t<a.length&&o>0;){let l=a[t];i+=l,p?p=false:l==="\\"?p=true:u?l===s&&(u=false,s=null):l==='"'||l==="'"||l==="`"?(u=true,s=l):l==="["?o++:l==="]"&&o--,t++;}if(o!==0)return null}else break}for(;t<a.length&&X(a[t]);)i+=a[t++];if(t<a.length&&a[t]==="/")for(i+=a[t++];t<a.length&&X(a[t]);)i+=a[t++];if(t>=a.length||a[t]!==">")return null;i+=a[t++];}return i||null}function Jr(a,e){if(e>=a.length||a[e]!=="'"||e+1>=a.length||a[e+1].toLowerCase()!=="s")return false;if(e+2>=a.length)return true;let t=a[e+2];return X(t)||t==="*"||!x(t)}function Zr(a,e){if(e>=a.length)return null;let r=a[e];if(!Yr(r)||r==="'"&&Jr(a,e))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[r];if(!i)return null;let n=e+1,o=r,u=false;for(;n<a.length;){let s=a[n];if(o+=s,u)u=false;else if(s==="\\")u=true;else if(s===i)return o;n++;}return o}function et(a,e){if(e>=a.length)return false;let r=a[e],t=a[e+1]||"",i=a[e+2]||"";if(r==="/"&&t!=="/"&&/[a-zA-Z0-9._-]/.test(t)||r==="/"&&t==="/"&&/[a-zA-Z]/.test(i)||r==="."&&(t==="/"||t==="."&&i==="/"))return true;let n=a.slice(e,e+8).toLowerCase();return !!(n.startsWith("http://")||n.startsWith("https://"))}function rt(a,e){if(!et(a,e))return null;let r=e,t="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;r<a.length;){let n=a[r];if(n==="#"){if(t.length>0&&/[a-zA-Z0-9/.]$/.test(t))for(t+=n,r++;r<a.length&&/[a-zA-Z0-9_-]/.test(a[r]);)t+=a[r++];break}if(i.test(n))t+=n,r++;else break}return t.length<2?null:t}function tt(a,e){if(e>=a.length)return null;let r=a[e];if(!I(r)&&r!=="-"&&r!=="+")return null;let t=e,i="";if((a[t]==="-"||a[t]==="+")&&(i+=a[t++]),t>=a.length||!I(a[t]))return null;for(;t<a.length&&I(a[t]);)i+=a[t++];if(t<a.length&&a[t]===".")for(i+=a[t++];t<a.length&&I(a[t]);)i+=a[t++];return t<a.length&&(a.slice(t,t+2)==="ms"?i+="ms":(a[t]==="s"||a[t]==="m"||a[t]==="h")&&(i+=a[t])),i}var at=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(at);var Le=class qe{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){Ur(e)&&e.setContext(Gr(this)),this.extractors.push(e);}registerExtractors(e){for(let r of e)this.registerExtractor(r);}clearExtractors(){this.extractors=[];}isUsingExtractors(){return this.extractors.length>0}tokenizeWithExtractors(e){let r=[],t=0;for(;t<e.length;){for(;t<e.length&&X(e[t]);)t++;if(t>=e.length)break;let i=false;for(let n of this.extractors)if(n.canExtract(e,t)){let o=n.extract(e,t);if(o){let u=o.metadata?.normalized,s=o.metadata?.stem,p=o.metadata?.stemConfidence,l={};if(o.metadata)for(let[m,d]of Object.entries(o.metadata))m!=="normalized"&&m!=="stem"&&m!=="stemConfidence"&&(l[m]=d);let c={};u&&(c.normalized=u),s&&(c.stem=s),p!==void 0&&(c.stemConfidence=p),Object.keys(l).length>0&&(c.metadata=l),r.push(C(o.value,this.classifyToken(o.value),b(t,t+o.length),Object.keys(c).length>0?c:void 0)),t+=o.length,i=true;break}}if(!i){let n=e[t],o=this.classifyUnknownChar(n);r.push(C(n,o,b(t,t+1))),t++;}}return new Z(r,this.language)}classifyUnknownChar(e){return "()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,r,t){if(e[r]!==".")return false;let i=t[t.length-1],n=i&&i.position.end<r;if(i&&!n&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return t.push(C(".","operator",b(r,r+1))),true;let s=r+1;for(;s<e.length&&x(e[s]);)s++;return s<e.length&&e[s]==="("?(t.push(C(".","operator",b(r,r+1))),true):false}initializeKeywordsFromProfile(e,r=[]){let t=new Map;if(e.keywords){for(let[i,n]of Object.entries(e.keywords))if(t.set(n.primary,{native:n.primary,normalized:n.normalized||i}),n.alternatives)for(let o of n.alternatives)t.set(o,{native:o,normalized:n.normalized||i});}if(e.references){for(let[i,n]of Object.entries(e.references))t.set(n,{native:n,normalized:i});for(let i of Object.keys(e.references))t.has(i)||t.set(i,{native:i,normalized:i});}if(e.roleMarkers){for(let[i,n]of Object.entries(e.roleMarkers))if(n.primary&&t.set(n.primary,{native:n.primary,normalized:i}),n.alternatives)for(let o of n.alternatives)t.set(o,{native:o,normalized:i});}if(e.possessive?.keywords)for(let[i,n]of Object.entries(e.possessive.keywords))t.set(i,{native:i,normalized:n});for(let i of r)t.set(i.native,i);this.profileKeywords=Array.from(t.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,r){for(let t of this.profileKeywords)if(e.slice(r).startsWith(t.native))return C(t.native,"keyword",b(r,r+t.native.length),t.normalized);return null}isKeywordStart(e,r){let t=e.slice(r);return this.profileKeywords.some(i=>t.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 r=this.normalizer.normalize(e);return r.stem!==e&&r.confidence>=.7?r:null}tryMorphKeywordMatch(e,r,t){let i=this.tryNormalize(e);if(!i)return null;let n=this.lookupKeyword(i.stem);if(!n)return null;let o={normalized:n.normalized,stem:i.stem,stemConfidence:i.confidence};return C(e,"keyword",b(r,t),o)}trySelector(e,r){let t=Xr(e,r);return t?C(t,"selector",b(r,r+t.length)):null}tryEventModifier(e,r){if(e[r]!==".")return null;let t=e.slice(r).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!t)return null;let i=t[0].replace(/(\s|\.)$/,""),n=i.slice(1).split("(")[0],o=t[1];return {...C(i,"event-modifier",b(r,r+i.length)),metadata:{modifierName:n,value:o?n==="queue"?o:parseInt(o,10):void 0}}}tryString(e,r){let t=Zr(e,r);return t?C(t,"literal",b(r,r+t.length)):null}tryNumber(e,r){let t=tt(e,r);return t?C(t,"literal",b(r,r+t.length)):null}tryMatchTimeUnit(e,r,t,i=false){let n=r;if(i)for(;n<e.length&&X(e[n]);)n++;let o=e.slice(n);for(let u of t){let s=o.slice(0,u.length);if(u.caseInsensitive?s.toLowerCase()===u.pattern.toLowerCase():s===u.pattern){if(u.notFollowedBy&&(o[u.length]||"")===u.notFollowedBy)continue;if(u.checkBoundary){let l=o[u.length]||"";if(x(l))continue}return {suffix:u.suffix,endPos:n+u.length}}}return null}parseBaseNumber(e,r,t=true){let i=r,n="";if(t&&(e[i]==="-"||e[i]==="+")&&(n+=e[i++]),i>=e.length||!I(e[i]))return null;for(;i<e.length&&I(e[i]);)n+=e[i++];if(i<e.length&&e[i]===".")for(n+=e[i++];i<e.length&&I(e[i]);)n+=e[i++];return !n||n==="-"||n==="+"?null:{number:n,endPos:i}}tryNumberWithTimeUnits(e,r,t,i={}){let{allowSign:n=true,skipWhitespace:o=false}=i,u=this.parseBaseNumber(e,r,n);if(!u)return null;let{number:s,endPos:p}=u,l=[...t,...qe.STANDARD_TIME_UNITS],c=this.tryMatchTimeUnit(e,p,l,o);return c&&(s+=c.suffix,p=c.endPos),C(s,"literal",b(r,p))}tryUrl(e,r){let t=rt(e,r);return t?C(t,"url",b(r,r+t.length)):null}tryVariableRef(e,r){if(e[r]!==":"||r+1>=e.length||!x(e[r+1]))return null;let t=r+1;for(;t<e.length&&x(e[t]);)t++;let i=e.slice(r,t);return C(i,"identifier",b(r,t))}tryOperator(e,r){let t=e.slice(r,r+2);if(["==","!=","<=",">=","&&","||","->"].includes(t))return C(t,"operator",b(r,r+2));let i=e[r];return ["<",">","!","+","-","*","/","="].includes(i)?C(i,"operator",b(r,r+1)):["(",")","{","}",",",";",":"].includes(i)?C(i,"punctuation",b(r,r+1)):null}tryMultiCharParticle(e,r,t){for(let i of t)if(e.slice(r,r+i.length)===i)return C(i,"particle",b(r,r+i.length));return null}};Le.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 $e=Le;var it=Object.defineProperty,nt=Object.getOwnPropertyNames,Ze=(a,e)=>function(){return a&&(e=(0, a[nt(a)[0]])(a=0)),e},ot=(a,e)=>{for(var r in e)it(a,r,{get:e[r],enumerable:true});};function Ve(a,e){return a.replace(/\{(\w+)\}/g,(r,t)=>String(e[t]??`{${t}}`))}function T(a,e,r={},t){let i=er[a],n=Ve(i,r),o=rr[a],u=o?Ve(o,r):void 0;return {code:a,message:n,severity:e,...t&&{role:t},...u&&{suggestion:u}}}var f,er,rr,ut=Ze({"src/generators/schema-error-codes.ts"(){f={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"},er={[f.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[f.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[f.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[f.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[f.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[f.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.",[f.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.",[f.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[f.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[f.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[f.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[f.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[f.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[f.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[f.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[f.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[f.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},rr={[f.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[f.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[f.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[f.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[f.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[f.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[f.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[f.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[f.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[f.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[f.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[f.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[f.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[f.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),tr={};ot(tr,{SchemaErrorCodes:()=>f,formatValidationResults:()=>yt,getValidationStats:()=>ft,validateAllKeywordCollisions:()=>ht,validateAllSchemas:()=>dt,validateCommandSchema:()=>ar,validateKeywordCollisions:()=>ir,validateRoleValues:()=>vt});function st(a,e){return {action:a,items:e}}function ar(a){let e=[];for(let t of a.roles)t.expectedTypes.includes("literal")&&t.expectedTypes.includes("selector")&&(t.role==="patient"&&ze.has(a.action)?e.push(T(f.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:t.role,command:a.action},t.role)):e.push(T(f.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:t.role},t.role))),t.expectedTypes.length>3&&!ze.has(a.action)&&e.push(T(f.TOO_MANY_EXPECTED_TYPES,"warning",{role:t.role,count:t.expectedTypes.length},t.role));for(let t of a.roles)t.selectorKinds&&t.selectorKinds.length>0&&(t.expectedTypes.includes("selector")||e.push(T(f.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:t.role},t.role)));switch(a.action){case "transition":lt(a,e);break;case "on":pt(a,e);break;case "if":case "unless":ct(a,e);break;case "repeat":case "for":case "while":mt(a,e);break}return a.roles.filter(t=>t.required).length===0&&(nr.has(a.action)?e.push(T(f.NO_REQUIRED_ROLES_EXPECTED,"note",{command:a.action})):e.push(T(f.NO_REQUIRED_ROLES,"warning",{}))),st(a.action,e)}function lt(a,e){let r=a.roles.find(i=>i.role==="patient"),t=a.roles.find(i=>i.role==="goal");r&&r.expectedTypes.includes("selector")&&e.push(T(f.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),r&&!t&&e.push(T(f.TRANSITION_MISSING_GOAL,"error",{}));}function pt(a,e){let r=a.roles.find(t=>t.role==="event");r||e.push(T(f.EVENT_HANDLER_MISSING_EVENT,"warning",{})),r&&!r.required&&e.push(T(f.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function ct(a,e){let r=a.roles.find(t=>t.role==="condition");r||e.push(T(f.CONDITIONAL_MISSING_CONDITION,"warning",{})),r&&!r.required&&e.push(T(f.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function mt(a,e){a.action==="for"?a.roles.find(t=>t.role==="source")||e.push(T(f.FOR_LOOP_MISSING_SOURCE,"warning",{})):a.action==="while"&&(a.roles.find(t=>t.role==="condition")||e.push(T(f.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function dt(a,e={}){let r=new Map,{includeNotes:t=false}=e;for(let[i,n]of Object.entries(a)){let o=ar(n),u=o.items.some(p=>p.severity==="warning"||p.severity==="error"),s=t&&o.items.some(p=>p.severity==="note");(u||s)&&r.set(i,o);}return r}function yt(a,e={}){let r=[],{showNotes:t=false,showCodes:i=true}=e;for(let[n,o]of a){let u=o.items.filter(l=>l.severity==="error"),s=o.items.filter(l=>l.severity==="warning"),p=o.items.filter(l=>l.severity==="note");if(u.length>0){r.push(` \u274C ${n}:`);for(let l of u){let c=i?` [${l.code}]`:"";r.push(` ERROR${c}: ${l.message}`),l.suggestion&&r.push(` \u{1F4A1} Suggestion: ${l.suggestion}`);}}if(s.length>0){r.push(` \u26A0\uFE0F ${n}:`);for(let l of s){let c=i?` [${l.code}]`:"";r.push(` ${c?`${l.code}: `:""}${l.message}`),l.suggestion&&r.push(` \u{1F4A1} ${l.suggestion}`);}}if(t&&p.length>0){r.push(` \u2139\uFE0F ${n}:`);for(let l of p){let c=i?` [${l.code}]`:"";r.push(` ${c?`${l.code}: `:""}${l.message}`);}}}return r.join(`
|
|
2
|
+
`)}function ft(a){let e=0,r=0,t=0,i={};for(let n of a.values())for(let o of n.items)o.severity==="error"?e++:o.severity==="warning"?r++:o.severity==="note"&&t++,i[o.code]=(i[o.code]||0)+1;return {totalCommands:a.size,errors:e,warnings:r,notes:t,byCode:i}}function vt(a,e){let r=[];for(let t of e){let i=a.roles.find(n=>n.role===t.role);i&&(i.expectedTypes.length>0&&!i.expectedTypes.includes(t.type)&&(i.expectedTypes.includes("expression")||r.push({level:"error",role:t.role,message:`${a.action}.${t.role} expects type [${i.expectedTypes.join(", ")}], got '${t.type}'`,code:f.VALUE_TYPE_MISMATCH})),t.type==="selector"&&t.selectorKind&&i.selectorKinds&&i.selectorKinds.length>0&&(i.selectorKinds.includes(t.selectorKind)||r.push({level:"error",role:t.role,message:`${a.action}.${t.role} expects selector kind [${i.selectorKinds.join(", ")}], got '${t.selectorKind}'`,code:f.SELECTOR_KIND_MISMATCH})));}return r}function ir(a){let e=[];if(!a.keywords)return {language:a.code,collisions:e};let r=new Map;for(let[i,n]of Object.entries(a.keywords)){if(!n||!n.primary)continue;let o=r.get(n.primary)||[];if(o.push({command:i,isPrimary:true}),r.set(n.primary,o),n.alternatives)for(let u of n.alternatives){let s=r.get(u)||[];s.push({command:i,isPrimary:false}),r.set(u,s);}}for(let[i,n]of r){let o=[...new Set(n.map(p=>p.command))];if(o.length<=1)continue;let u=n.filter(p=>p.isPrimary).length,s;u>=2?s="primary-primary":u===1?s="primary-alternative":s="alternative-alternative",e.push({keyword:i,commands:o.sort(),type:s});}let t={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((i,n)=>t[i.type]-t[n.type]),{language:a.code,collisions:e}}function ht(a){let e=[];for(let[,r]of Object.entries(a)){let t=ir(r);t.collisions.length>0&&e.push(t);}return e.sort((r,t)=>r.language.localeCompare(t.language))}var ze,nr,gt=Ze({"src/generators/schema-validator.ts"(){ut(),ze=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),nr=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep","empty","open","close","select","clear","reset","breakpoint"]);}});var L=new Map,R=new Map,W=new Map,be=null;function or(a,e){let r={...a};for(let t of Object.keys(e)){let i=e[t],n=a[t];i!==void 0&&(typeof i=="object"&&i!==null&&!Array.isArray(i)&&typeof n=="object"&&n!==null&&!Array.isArray(n)?r[t]=or(n,i):r[t]=i);}return r}function Et(a,e){return or(a,e)}function Ae(a){if(!a.extends)return a;let e=R.get(a.extends);if(!e)return console.warn(`[Registry] Profile '${a.code}' extends '${a.extends}' but base is not registered. Make sure to import the base language before the variant.`),a;let r=Ae(e);return Et(r,a)}function ur(a,e,r){L.set(a,e),R.set(a,r),W.delete(a);}function sr(a){be=a;}var Ce=new Map;function lr(a,e){Ce.set(a,e),W.delete(a);}function U(a){return a.split("-")[0]}function G(a){return a.includes("-")}function kt(a){let e=L.get(a);if(!e&&G(a)){let r=U(a);e=L.get(r);}if(!e){let r=Array.from(L.keys()).join(", ");throw new Error(`Language '${a}' is not registered. Registered languages: ${r||"none"}. Import the language module first: import '@lokascript/semantic/languages/${a}';`)}return e}function zt(a){let e=R.get(a);if(!e&&G(a)){let r=U(a);e=R.get(r);}if(!e){let r=Array.from(R.keys()).join(", ");throw new Error(`Language profile '${a}' is not registered. Registered languages: ${r||"none"}. Import the language module first: import '@lokascript/semantic/languages/${a}';`)}return Ae(e)}function q(a){let e=R.get(a);return !e&&G(a)&&(e=R.get(U(a))),e?Ae(e):void 0}function bt(){return Array.from(L.keys())}function pr(a){if(L.has(a)&&R.has(a))return true;if(G(a)){let e=U(a);return L.has(e)&&R.has(e)}return false}function Ct(a,e){return kt(e).tokenize(a)}function H(a){let e=W.get(a);if(!e&&G(a)&&(e=W.get(U(a))),e)return e;let r=Ce.get(a);if(!r&&G(a)&&(r=Ce.get(U(a))),r)return W.set(a,r),r;if(!be)throw new Error(`No patterns registered for language '${a}'. Either import the language module or set a pattern generator.`);let t=zt(a),i=be(t);return W.set(a,i),i}function re(a){let e="complex";return a.startsWith("#")&&!a.includes(" ")?e="id":a.startsWith(".")&&!a.includes(" ")?e="class":a.startsWith("[")&&a.endsWith("]")?e="attribute":/^[a-z][a-z0-9]*$/i.test(a)&&(e="element"),{type:"selector",value:a,selectorKind:e}}function A(a,e){let r={type:"literal",value:a};return e!==void 0?{type:"literal",value:a,dataType:e}:r}function je(a){return ge(a)}function M(a){return {type:"reference",value:a}}function Ee(a,e){return {type:"property-path",object:a,property:e}}function pe(a,e,r){let t={kind:"command",action:a,roles:new Map(Object.entries(e))};return r!==void 0?{...t,metadata:r}:t}function We(a,e,r,t,i,n){let o=new Map;o.set("event",a);let u={kind:"event-handler",action:"on",roles:o,body:e};return r!==void 0&&(u.eventModifiers=r),t!==void 0&&(u.metadata=t),u}function He(a,e="then",r){let t={kind:"compound",action:"compound",roles:new Map,statements:a,chainType:e};return r!==void 0&&(t.metadata=r),t}function Ue(a,e){return !e||e.length===0||e.includes(a)||e.includes("expression")?true:a==="property-path"?e.some(r=>["selector","reference","expression"].includes(r)):false}function Yt(a,e){return a.possessive?.keywords?.[e]}var ke=.8,Qt=.6,Xt=.15,Jt=.5,Ge=.15,Ke=.1,Ye=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"]),Zt={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"]},ea=class{calculate(a){return this.calculateWithBreakdown(a).final}calculateWithBreakdown(a){let e=this.scoreRoleCoverage(a),r=this.scoreStemPenalty(a),t=this.scoreLanguageBoost(a),i=this.scoreLanguageAdjustment(a),n=e;return n=Math.max(Jt,n+r),n=Math.min(1,n+t),n=Math.max(0,Math.min(1,n+i)),{roleCoverage:e,stemPenalty:r,languageBoost:t,languageAdjustment:i,final:n}}scoreRoleCoverage(a){let{pattern:e,captured:r}=a,t=0,i=0,n=o=>e.extraction?.[o]?.default!==void 0;for(let o of e.template.tokens)if(o.type==="role")i+=1,r.has(o.role)&&(t+=1);else if(o.type==="group")for(let u of o.tokens)u.type==="role"&&(i+=ke,r.has(u.role)?t+=ke:n(u.role)&&(t+=ke*Qt));return i>0?t/i:1}scoreStemPenalty(a){let{stemMatchCount:e,totalKeywordMatches:r}=a;return e<=0||r<=0?0:-(e/r)*Xt}scoreLanguageBoost(a){let{pattern:e}=a;if(e.language!=="ar")return 0;let r=e.template.tokens[0];return !r||r.type!=="literal"?0:Ye.has(r.value)||r.alternatives?.some(t=>Ye.has(t))?Ge:0}scoreLanguageAdjustment(a){let{pattern:e,captured:r}=a;if(e.language!=="ar")return 0;let t=0;for(let[i,n]of r.entries()){let o=Zt[i];if(!o||o.length===0)continue;let u="metadata"in n?n.metadata:void 0;u&&typeof u.prepositionValue=="string"&&(o.includes(u.prepositionValue)?t+=.1:t-=.1);}return Math.max(-Ke,Math.min(Ke,t))}},ra=new ea,me=class ee{constructor(e){this.matchCache=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??ra;}matchPattern(e,r){let t=e.mark(),i=new Map;if(this.currentProfile=q(r.language),this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(e,r.template.tokens,i))return e.reset(t),null;let o=this.confidenceModel.calculate({pattern:r,captured:i,stemMatchCount:this.stemMatchCount,totalKeywordMatches:this.totalKeywordMatches});return this.applyExtractionRules(r,i),{pattern:r,captured:i,consumedTokens:e.position()-t.position,confidence:o}}matchBest(e,r){this.matchCache.clear();let t=[],i=e.position();for(let o of r){let u=e.mark(),s=`${i}:${o.id}`,p;this.matchCache.has(s)?p=this.matchCache.get(s):(p=this.matchPattern(e,o),this.matchCache.set(s,p)),p&&t.push(p),e.reset(u);}if(t.length===0)return null;t.sort((o,u)=>{let s=u.pattern.priority-o.pattern.priority;return s!==0?s:u.confidence-o.confidence});let n=t[0];return this.matchPattern(e,n.pattern),n}matchTokenSequence(e,r,t){let i=r[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 o of r)if(!this.matchPatternToken(e,o,t)){if(this.isOptional(o))continue;return false}return true}matchPatternToken(e,r,t){switch(r.type){case "literal":return this.matchLiteralToken(e,r);case "role":return this.matchRoleToken(e,r,t);case "group":return this.matchGroupToken(e,r,t);default:return false}}matchLiteralToken(e,r){let t=e.peek();if(!t)return false;let i=this.getMatchType(t,r.value);if(i!=="none")return this.totalKeywordMatches++,i==="stem"&&this.stemMatchCount++,e.advance(),true;if(r.alternatives)for(let n of r.alternatives){let o=this.getMatchType(t,n);if(o!=="none")return this.totalKeywordMatches++,o==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,r,t){this.skipNoiseWords(e);let i=e.peek();if(!i)return r.optional||false;let n=this.tryMatchPossessiveExpression(e);if(n)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(n.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(t.set(r.role,n),true);let o=this.tryMatchMethodCallExpression(e);if(o)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(o.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(t.set(r.role,o),true);let u=this.tryMatchPossessiveSelectorExpression(e);if(u)return r.expectedTypes&&r.expectedTypes.length>0&&!Ue(u.type,r.expectedTypes)?r.optional||false:(t.set(r.role,u),true);let s=this.tryMatchPropertyAccessExpression(e);if(s)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(s.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(t.set(r.role,s),true);let p=this.tryMatchSelectorPropertyExpression(e);if(p)return r.expectedTypes&&r.expectedTypes.length>0&&!Ue(p.type,r.expectedTypes)?r.optional||false:(t.set(r.role,p),true);let l=this.tokenToSemanticValue(i);return !l||r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(l.type)?r.optional||false:(t.set(r.role,l),e.advance(),true)}tryMatchPossessiveExpression(e){let r=e.peek();if(!r||!this.currentProfile)return null;let t=(r.normalized||r.value).toLowerCase(),i=Yt(this.currentProfile,t);if(!i)return null;let n=e.mark();e.advance();let o=e.peek();if(!o)return e.reset(n),null;if(o.kind==="identifier"||o.kind==="keyword"&&!this.isStructuralKeyword(o.value)||o.kind==="selector"&&o.value.startsWith("*")||o.kind==="selector"&&o.value.startsWith("@")||o.kind==="selector"&&o.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(o.value)){e.advance();let u=o.value;o.kind==="selector"&&u.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(u)&&(u=u.substring(1));let s=u;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)s+=e.peek().value,e.advance();let p=e.peek();return p?.kind==="literal"&&p.value.startsWith("(")&&(s+=p.value,e.advance()),Ee(M(i),s)}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 r=e.peek();if(!r||r.kind!=="selector")return null;let t=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(t),null;e.advance();let n=e.peek();if(!n||n.kind!=="identifier")return e.reset(t),null;e.advance();let o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="(")return e.reset(t),null;e.advance();let u=[];for(;!e.isAtEnd()&&u.length<ee.MAX_METHOD_ARGS;){let p=e.peek();if(!p)break;if(p.kind==="punctuation"&&p.value===")"){e.advance();break}if(p.kind==="punctuation"&&p.value===","){e.advance();continue}u.push(p.value),e.advance();}return {type:"expression",raw:`${r.value}.${n.value}(${u.join(", ")})`}}tryMatchPropertyAccessExpression(e){let r=e.peek();if(!r||r.kind!=="identifier"&&r.kind!=="keyword")return null;let t=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(t),null;e.advance();let n=e.peek();if(!n||n.kind!=="identifier")return e.reset(t),null;e.advance();let o=`${r.value}.${n.value}`,u=1;for(;!e.isAtEnd()&&u<ee.MAX_PROPERTY_DEPTH;){let p=e.peek();if(!p||p.kind!=="operator"||p.value!==".")break;e.advance();let l=e.peek();if(!l||l.kind!=="identifier")break;e.advance(),o+=`.${l.value}`,u++;}let s=e.peek();if(s&&s.kind==="punctuation"&&s.value==="("){e.advance();let p=[],l=0;for(;!e.isAtEnd()&&p.length<ee.MAX_METHOD_ARGS;){let m=e.peek();if(!m)break;if(m.kind==="punctuation"&&m.value===")"){if(l===0){e.advance();break}l--;}if(m.kind==="punctuation"&&m.value==="("&&l++,m.kind==="punctuation"&&m.value===","){e.advance();continue}p.push(m.value),e.advance();}return {type:"expression",raw:`${o}(${p.join(", ")})`}}return {type:"expression",raw:o}}tryMatchPossessiveSelectorExpression(e){let r=e.peek();if(!r||r.kind!=="selector")return null;let t=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="punctuation"||i.value!=="'s")return e.reset(t),null;e.advance();let n=e.peek();return !n||n.kind!=="selector"&&n.kind!=="identifier"?(e.reset(t),null):(e.advance(),Ee(re(r.value),n.value))}tryMatchSelectorPropertyExpression(e){let r=e.peek();if(!r||r.kind!=="selector"||!r.value.startsWith("#"))return null;let t=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="selector"||!i.value.startsWith("."))return e.reset(t),null;let n=e.peek(1);n&&n.kind,e.advance();let o=i.value.slice(1);return Ee(re(r.value),o)}matchGroupToken(e,r,t){let i=e.mark(),n=new Set(t.keys());if(!this.matchTokenSequence(e,r.tokens,t)){e.reset(i);for(let u of t.keys())n.has(u)||t.delete(u);return r.optional||false}return true}getMatchType(e,r){return e.value===r?"exact":e.normalized===r?"normalized":e.stem===r&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&e.value.toLowerCase()===r.toLowerCase()?"case-insensitive":"none"}tokenToSemanticValue(e){switch(e.kind){case "selector":return re(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let r=(e.normalized||e.value).toLowerCase();return je(r)?M(r):A(e.normalized||e.value);case "identifier":if(e.value.startsWith(":"))return M(e.value);let t=e.value.toLowerCase();return je(t)?M(t):{type:"expression",raw:e.value};case "url":return A(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 A(i,"string")}if(e==="true")return A(true,"boolean");if(e==="false")return A(false,"boolean");let r=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(r){let i=parseFloat(r[1]);return r[2]?A(e,"duration"):A(i,"number")}let t=parseFloat(e);return isNaN(t)?A(e,"string"):A(t,"number")}applyExtractionRules(e,r){for(let[t,i]of Object.entries(e.extraction))r.has(t)||(i.value!==void 0?r.set(t,{type:"literal",value:i.value}):i.default&&r.set(t,i.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}skipNoiseWords(e){let r=e.peek();if(!r)return;let t=r.value.toLowerCase();if(ee.ENGLISH_NOISE_WORDS.has(t)){let i=e.mark();e.advance();let n=e.peek();if(n&&(n.kind==="selector"||n.kind==="identifier"))return;e.reset(i);}t==="class"&&e.advance();}extractEventModifiers(e){let r={},t=false;for(;!e.isAtEnd();){let i=e.peek();if(!i||i.kind!=="event-modifier")break;let n=i.metadata;if(!n)break;switch(t=true,n.modifierName){case "once":r.once=true;break;case "debounce":typeof n.value=="number"&&(r.debounce=n.value);break;case "throttle":typeof n.value=="number"&&(r.throttle=n.value);break;case "queue":(n.value==="first"||n.value==="last"||n.value==="all"||n.value==="none")&&(r.queue=n.value);break}e.advance();}return t?r:void 0}};me.MAX_PROPERTY_DEPTH=10;me.MAX_METHOD_ARGS=20;me.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var ta=me,N=new ta;function te(a,e){return Ct(a,e)}function cr(){return bt()}var aa={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 na={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)"}},oa={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"}},ua={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",targetRole:"source",roles:[{role:"patient",description:"The class or attribute to remove",required: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"}},sa={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"},markerVariants:{en:["before","after"]},methodCarrier:"method"}],errorCodes:["MISSING_ARGUMENTS","MISSING_CONTENT","MISSING_POSITION","INVALID_POSITION","NO_TARGET","NO_ELEMENTS"],preconditions:[{condition:"Command has content and position arguments",errorCode:"MISSING_ARGUMENTS",message:"put requires arguments"},{condition:"Content to put is specified",errorCode:"MISSING_CONTENT",message:"put requires content"},{condition:"Position keyword is specified (into, before, after, etc.)",errorCode:"MISSING_POSITION",message:"put requires position keyword"}],recoveryHints:{MISSING_ARGUMENTS:"Use syntax: put <content> into/before/after <target>",MISSING_CONTENT:"Add content to put (string, element, or expression)",MISSING_POSITION:"Add position keyword: into, before, after, at start of, at end of",INVALID_POSITION:"Valid positions: into, before, after, at start of, at end of",NO_TARGET:'Ensure target element exists or use "me" reference',NO_ELEMENTS:"Check that the selector matches existing elements"}},la={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>"}},pa={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}]},ca={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}]},ma={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}]},da={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}]},ya={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"duration",roles:[{role:"duration",description:"Duration or event to wait for",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},fa={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,markerOverride:{en:"as"}},{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}]},va={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"}}]},ha={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"}}]},ga={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"}}]},Ea={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"}}]},ka={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}]},za={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}]},ba={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}]},Ca={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}]},Aa={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}]},wa={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}]},xa={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}]},Ta={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"}}]},Da={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}]},Sa={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}]},Ba={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Pa={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"'},Fa={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"}}]},Ra={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}]},_a={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},Oa={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:""}}]},Na={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}]},Ia={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"}}]},Ma={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}]},La={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}]},qa={action:"empty",description:"Remove all children from an element (sets innerHTML to empty)",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to empty (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},$a={action:"open",description:"Open a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to open (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2},{role:"style",description:"Open-mode variant (modal / non-modal) for <dialog>",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"as"}}]},Va={action:"close",description:"Close a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to close (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},ja={action:"select",description:"Select the contents of a text field or DOM element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element whose contents to select (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Wa={action:"clear",description:"Clear a variable, local, or input element",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The variable or element to clear (defaults to me)",required:false,expectedTypes:["selector","reference","expression"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Ha={action:"reset",description:"Reset a <form> element to its default values",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The form element to reset (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Ua={action:"breakpoint",description:"Drop into the debugger",category:"control-flow",primaryRole:"patient",roles:[]},Ga={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}]},Ka={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}]},Ya={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}]},Qa={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},Xa={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:""}}]},Ja={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"}}]},Za={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},ei={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}]},ri={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}]},ti={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"}}]},ai={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"}}]},ii={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"}}]},ni={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}]},oi={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},ui={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:[]},li={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}]},pi={action:"scroll",description:"Scroll the viewport to a target element",category:"navigation",primaryRole:"destination",argSkipTokens:["of","the","top","bottom","middle","center","nearest","left","right","smoothly","instantly"],roles:[{role:"destination",description:"The element to scroll to",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"}}]},mr={en:"url",es:"url",pt:"url",fr:"url",de:"url",it:"url",ja:"url",ko:"url",zh:"url",ar:"url",he:"url",hi:"url",bn:"url",tr:"url",ru:"url",uk:"url",pl:"url",id:"url",vi:"url",th:"url",ms:"url",tl:"url",sw:"url",qu:"url"},ci={en:"partials in",es:"partials in",pt:"partials in",fr:"partials in",de:"partials in",it:"partials in",ja:"partials in",ko:"partials in",zh:"partials in",ar:"partials in",he:"partials in",hi:"partials in",bn:"partials in",tr:"partials in",ru:"partials in",uk:"partials in",pl:"partials in",id:"partials in",vi:"partials in",th:"partials in",ms:"partials in",tl:"partials in",sw:"partials in",qu:"partials in"},mi={action:"push",description:"Push a URL onto the browser history",category:"navigation",primaryRole:"patient",roles:[{role:"patient",description:"The URL to push (after the `url` keyword)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:mr}]},di={action:"replace",description:"Replace the current browser history entry with a URL",category:"navigation",primaryRole:"patient",roles:[{role:"patient",description:"The URL to replace with (after the `url` keyword)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:mr}]},yi={action:"process",description:"Process hx-partial markup in HTML content",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The HTML content (string, element, or response) to process",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:ci}]},fi={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}]},dr={toggle:na,add:oa,remove:ua,put:sa,set:la,show:pa,hide:ca,on:ma,trigger:da,wait:ya,fetch:fa,increment:va,decrement:ha,append:ga,prepend:Ea,log:ka,get:za,take:ba,make:Ca,halt:Aa,settle:wa,throw:xa,send:Ta,if:Da,unless:Sa,else:Ba,repeat:Pa,for:Fa,while:Ra,continue:_a,go:Oa,scroll:pi,push:mi,replace:di,process:yi,transition:Na,clone:Ia,focus:Ma,blur:La,empty:qa,open:$a,close:Va,select:ja,clear:Wa,reset:Ha,breakpoint:Ua,call:Ga,return:Ka,js:Ya,async:Qa,tell:Xa,default:Ja,init:Za,behavior:ei,install:ri,measure:ti,swap:ai,morph:ii,beep:ni,break:oi,copy:ui,exit:si,pick:li,render:fi,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function vi(){return Object.values(dr).filter(a=>a.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(gt(),tr)).then(({validateAllSchemas:a,formatValidationResults:e})=>{let r=a(dr);r.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(r)),console.warn(`
|
|
3
|
+
These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(a=>{console.debug("Schema validation skipped:",a);});var Qe=class extends Error{constructor(a,e,r,t){super(a),this.name="SemanticParseError",this.language=e,this.input=r,this.diagnostics=t;}};function P(a,e,r){return {message:a,severity:e,source:"semantic-parser",...r&&{code:r}}}function ce(a,e){return e.length===0?a:{...a,diagnostics:e}}var K=class F{parse(e,r){let{modifiers:t,remainingInput:i}=this.extractStandaloneModifiers(e,r),n=i||e,o=[],u=te(n,r),s=H(r);if(s.length===0)throw new Qe(`No patterns available for language: ${r}`,r,n,[P(`No patterns registered for language '${r}'`,"error","no-patterns")]);let p=[...s].sort((g,E)=>E.priority-g.priority),l=p.filter(g=>g.command==="on"),c=N.matchBest(u,l);if(c){o.push(P(`event pattern matched: ${c.pattern.id} (confidence: ${c.confidence.toFixed(2)})`,"info","pattern-match"));let g=this.buildEventHandler(c,u,r),E=t?this.applyModifiers(g,t):g;return ce(E,o)}o.push(P(`event patterns: ${l.length} tried, no match`,"info","stage-event"));let m=p.filter(g=>g.command!=="on"),d=N.matchBest(u,m);if(d)return o.push(P(`command pattern matched: ${d.pattern.id} (confidence: ${d.confidence.toFixed(2)})`,"info","pattern-match")),ce(this.buildCommand(d,r),o);o.push(P(`command patterns: ${m.length} tried, no match`,"info","stage-command"));let y=this.trySOVEventExtraction(n,r,p);if(y){o.push(P("SOV event extraction succeeded","info","stage-sov"));let g=t?this.applyModifiers(y,t):y;return ce(g,o)}o.push(P("SOV event extraction: no event keyword found","info","stage-sov"));let h=this.tryCompoundCommandParsing(u,m,r);if(h)return o.push(P("compound command parsing succeeded","info","stage-compound")),ce(h,o);throw o.push(P("compound parsing: no then-keywords or no command matches","info","stage-compound")),o.push(P(`all parse stages exhausted for "${n}"`,"error","parse-failed")),new Qe(`Could not parse input in ${r}: ${n}`,r,n,o)}canParse(e,r){try{return this.parse(e,r),!0}catch{return false}}supportedLanguages(){return cr()}buildCommand(e,r){if(!e)throw new Error("No match to build command from");let t={};for(let[i,n]of e.captured)t[i]=n;return pe(e.pattern.command,t,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence})}buildEventHandler(e,r,t){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=N.extractEventModifiers(r),o=this.extractOrConjunctionEvents(r,t),u=i;o.length>0&&i.type==="literal"&&(u={type:"literal",value:[String(i.value),...o.map(c=>String("value"in c?c.value:""))].join(" or ")});let s,p=e.captured.get("action");if(p&&p.type==="literal"){let l=p.value,c={};for(let[y,h]of e.captured)y!=="event"&&y!=="action"&&y!=="continues"&&(c[y]=h);let m=pe(l,c,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence}),d=e.captured.get("continues");if(d&&d.type==="literal"&&d.value==="then"){let y=H(t).filter(E=>E.command!=="on").sort((E,z)=>z.priority-E.priority),h=H(t).filter(E=>E.id.startsWith("grammar-")&&E.id.includes("-continuation")).sort((E,z)=>z.priority-E.priority),g=this.parseBodyWithGrammarPatterns(r,y,h,t);g.length>0?s=[m,...g]:s=[m];}else s=[m];}else {let l=H(t).filter(c=>c.command!=="on").sort((c,m)=>m.priority-c.priority);s=this.parseBodyWithClauses(r,l,t);}return We(u,s,n,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,r,t){let i=[],n=[];for(;!e.isAtEnd();){let o=e.peek();if(!o)break;let u=o.kind==="conjunction"||o.kind==="keyword"&&this.isThenKeyword(o.value,t),s=o.kind==="keyword"&&this.isEndKeyword(o.value,t);if(u){if(n.length>0){let p=this.parseClause(n,r,t);i.push(...p),n.length=0;}e.advance();continue}if(s){if(n.length>0){let p=this.parseClause(n,r,t);i.push(...p);}e.advance();break}n.push(o),e.advance();}if(n.length>0){let o=this.parseClause(n,r,t);i.push(...o);}return i.length>1?[He(i,"then",{sourceLanguage:t})]:i}parseClause(e,r,t){if(e.length===0)return [];let i=new Z(e,t),n=[];for(;!i.isAtEnd();){let o=N.matchBest(i,r);o?n.push(this.buildCommand(o,t)):i.advance();}if(n.length===0){let o=this.parseSOVClauseByVerbAnchoring(e,t);if(o.length>0)return o}return n}static buildVerbLookup(e){let r=new Map;for(let[t,i]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","for","end","then","and"].includes(t)&&(r.set(i.primary.toLowerCase(),t),i.alternatives))for(let n of i.alternatives)r.set(n.toLowerCase(),t);return r}static buildMarkerToRoleLookup(e){let r=new Map;for(let[t,i]of Object.entries(e.roleMarkers))if(i&&(r.set(i.primary,t),i.alternatives))for(let n of i.alternatives)r.has(n)||r.set(n,t);return r}parseSOVClauseByVerbAnchoring(e,r){let t=q(r);if(!t||t.wordOrder!=="SOV")return [];let i=F.buildVerbLookup(t),n=F.buildMarkerToRoleLookup(t),o=[],u=0;for(;u<e.length;){let s=-1,p="";for(let y=u;y<e.length;y++){let h=e[y],g=i.get(h.value.toLowerCase()),E=h.normalized?i.get(h.normalized.toLowerCase()):void 0,z=g||E;if(z){s=y,p=z;break}}if(s===-1)break;let l=e.slice(u,s),c=e.length;for(let y=s+1;y<e.length;y++){let h=e[y];if(h.kind==="conjunction"||this.isThenKeyword(h.value,r)){c=y;break}if(y>s+1&&(i.get(h.value.toLowerCase())||(h.normalized?i.get(h.normalized.toLowerCase()):void 0))){c=y;break}}let m=e.slice(s+1,c),d=this.extractRolesFromMarkedTokens(l,m,n,p,r);if(o.push(pe(p,d,{sourceLanguage:r,confidence:.7})),u=c,u<e.length){let y=e[u];(y.kind==="conjunction"||this.isThenKeyword(y.value,r))&&u++;}}return o}extractRolesFromMarkedTokens(e,r,t,i,n){let o={},u=s=>{let p=[];for(let l of s){let c=t.get(l.value);if(c&&l.kind==="particle"&&p.length>0){let m=this.tokensToSemanticValue(p);if(m){let d=this.mapRoleForCommand(c,i,o);d&&(o[d]=m);}p=[];}else p.push(l);}if(p.length>0){let l=this.tokensToSemanticValue(p);l&&(o.patient?o.destination||(o.destination=l):o.patient=l);}};return u(e),u(r),o}mapRoleForCommand(e,r,t){return t[e]?e==="patient"&&!t.destination?"destination":e==="destination"&&!t.patient?"patient":e==="source"&&!t.source?"source":null:e}tokensToSemanticValue(e){if(e.length===0)return null;let r=e.filter(n=>n.kind!=="whitespace");if(r.length===0)return null;if(r.length===1)return this.tokenToSemanticValue(r[0]);let t=r.map(n=>n.value).join(""),i=r[0];return i.kind==="selector"||i.value.startsWith("#")||i.value.startsWith(".")||i.value.startsWith("@")||i.value.startsWith("*")?re(t):i.kind==="literal"||i.value.startsWith('"')||i.value.startsWith("'")?A(t):i.kind==="reference"?M(t):A(t)}tokenToSemanticValue(e){let r=e.value;if(e.kind==="selector"||r.startsWith("#")||r.startsWith(".")||r.startsWith("@")||r.startsWith("*"))return re(r);if(r.startsWith('"')||r.startsWith("'"))return A(r);if(/^-?\d+(\.\d+)?$/.test(r))return A(parseFloat(r));if(r==="true"||r==="\u771F"||r==="\uCC38"||r==="do\u011Fru")return A(true);if(r==="false"||r==="\u507D"||r==="\uAC70\uC9D3"||r==="yanl\u0131\u015F")return A(false);let t=e.normalized?.toLowerCase();return t==="me"||t==="it"||t==="you"||t==="result"||t==="body"?M(t):e.kind==="reference"?M(e.normalized||"me"):A(r)}parseBodyWithGrammarPatterns(e,r,t,i){let n=[];for(;!e.isAtEnd();){let o=e.peek();if(o&&this.isThenKeyword(o.value,i)){e.advance();continue}if(o&&this.isEndKeyword(o.value,i)){e.advance();break}let u=false;if(t.length>0){let s=N.matchBest(e,t);if(s){let p=s.pattern.command,l={};for(let[d,y]of s.captured)d!=="event"&&d!=="action"&&d!=="continues"&&(l[d]=y);let c=pe(p,l,{sourceLanguage:i,patternId:s.pattern.id});n.push(c),u=true;let m=s.captured.get("continues");if(m&&m.type==="literal"&&m.value==="then")continue}}if(!u){let s=N.matchBest(e,r);s&&(n.push(this.buildCommand(s,i)),u=true);}u||e.advance();}return n}tryCompoundCommandParsing(e,r,t){let i=e.tokens;if(!i.some(s=>s.kind==="conjunction"||s.kind==="keyword"&&this.isThenKeyword(s.value,t)))return null;let o=new Z(i,t),u=this.parseBodyWithClauses(o,r,t);return u.length===0?null:u.length===1?u[0]:He(u,"then",{sourceLanguage:t,confidence:.65})}trySOVEventExtraction(e,r,t){let i=F.SOV_EVENT_MARKERS[r];if(!i)return null;let o=te(e,r).tokens,u=aa[r],s=new Set;if(u)for(let k of Object.keys(u))s.add(k.toLowerCase());let p=F.SOV_SOURCE_MARKERS[r],l=-1,c="",m="",d=1;for(let k=0;k<o.length;k++){let w=o[k],_=w.value.toLowerCase(),O=_,$="",fe=_.indexOf("[");fe>0&&(O=_.slice(0,fe),$=w.value.slice(fe));let ve=w.normalized?.toLowerCase(),Fe=ve&&F.KNOWN_EVENTS.has(ve),Re=s.has(_)||s.has(O),qr=F.KNOWN_EVENTS.has(O);if(Fe||Re||qr){let Y;if(Fe?Y=ve:Re?Y=u?.[_]??u?.[O]??O:Y=O,i.size>0){let oe=1,he=o[k+1];he&&he.kind==="selector"&&he.value.startsWith("[")&&(oe=2);let ue=o[k+oe];if(ue&&(ue.kind==="particle"||ue.kind==="keyword")&&i.has(ue.value)){l=k,c=Y,m=$||(oe===2?o[k+1].value:""),d=oe+1;break}}else {l=k,c=Y,m=$,d=1;break}}}if(l===-1)return null;let y=new Set;for(let k=l;k<l+d;k++)y.add(k);if(p){let k=l+d;if(k<o.length){let w=o[k];(w.kind==="particle"||w.kind==="keyword")&&p.markers.has(w.value)&&y.add(k);}for(let w=0;w<l;w++){let _=o[w],O=_.value.toLowerCase(),$=_.normalized?.toLowerCase();if(p.windowTokens.has(O)||$&&p.windowTokens.has($)){y.add(w);break}}}let h=o.filter((k,w)=>!y.has(w));if(h.length===0)return null;let g=t.filter(k=>k.command!=="on"),E=new Z(h,r),z=this.parseBodyWithClauses(E,g,r);if(z.length===0)return null;let Pe={sourceLanguage:r,confidence:.75};return m&&(Pe.keyFilter=m),We({type:"literal",value:c},z,void 0,Pe)}isThenKeyword(e,r){let t={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 (t[r]||t.en).has(e.toLowerCase())}isEndKeyword(e,r){let t={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 (t[r]||t.en).has(e.toLowerCase())}extractStandaloneModifiers(e,r){let i=te(e,r).tokens;if(i.length===0)return {modifiers:null,remainingInput:null};let o=i[0].value.toLowerCase(),u=F.STANDALONE_MODIFIERS[o];if(!u)return {modifiers:null,remainingInput:null};let s={},p=1;if(u==="once")s.once=true;else {let d=1;if(d<i.length){let y=i[d];(y.kind==="keyword"||y.kind==="particle")&&(d++,p++);}if(d<i.length){let y=i[d];if(y.kind==="literal"){let h=y.value.match(/^(\d+)(ms|s|m)?$/);if(h){let g=parseInt(h[1],10),E=h[2]||"ms";E==="s"?g*=1e3:E==="m"&&(g*=6e4),s[u]=g,p=d+1;}}}s[u]||(s[u]=u==="debounce"?300:100);}let l=i.slice(p);if(l.length===0)return {modifiers:null,remainingInput:null};let c=l[0].position.start,m=e.slice(c);return {modifiers:s,remainingInput:m}}applyModifiers(e,r){return {...e,eventModifiers:{...e.eventModifiers,...r}}}extractOrConjunctionEvents(e,r){let t=[];for(;;){let i=e.mark(),n=e.peek();if(!n)break;let o=(n.normalized||n.value).toLowerCase();if(!F.OR_KEYWORDS.has(o)){e.reset(i);break}e.advance();let u=e.peek();if(!u){e.reset(i);break}let s=(u.normalized||u.value).toLowerCase();e.advance(),t.push({type:"literal",value:s});}return t}};K.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);K.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"])};K.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"])}};K.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};K.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 hi=K,gi=new hi;function Ei(a,e){return gi.parse(a,e)}function ki(a,e){try{let r=te(a,e),t=H(e);if(t.length===0)return {confidence:0,parseSuccess:!1,error:`No patterns available for language: ${e}`};let i=[...t].sort((p,l)=>l.priority-p.priority),n=i.filter(p=>p.command==="on"),o=N.matchBest(r,n);if(o)return {confidence:o.confidence,parseSuccess:!0,patternId:o.pattern.id,action:o.pattern.command,tokensConsumed:o.consumedTokens};r.reset(r.mark());let u=i.filter(p=>p.command!=="on"),s=N.matchBest(r,u);return s?{confidence:s.confidence,parseSuccess:!0,patternId:s.pattern.id,action:s.pattern.command,tokensConsumed:s.consumedTokens}:{confidence:0,parseSuccess:!1,error:`Could not match any patterns for: ${a}`}}catch(r){return {confidence:0,parseSuccess:false,error:r instanceof Error?r.message:String(r)}}}function yr(a,e){try{let t=Ei(a,e);if(t)return {node:t,confidence:t.metadata?.confidence??.8,error:void 0,tokensConsumed:te(a,e).tokens.length}}catch{}let r=ki(a,e);return r.parseSuccess?{node:null,confidence:r.confidence,error:void 0,tokensConsumed:r.tokensConsumed}:{node:null,confidence:0,error:r.error}}function fr(a,e){let r=e==="SOV"?"sovPosition":"svoPosition";return [...a].sort((t,i)=>{let n=t[r]??99,o=i[r]??99;return n-o})}function zi(a,e){let r=a.markerOverride?.[e.code],t=e.roleMarkers[a.role];if(r!==void 0)return {primary:r,position:t?.position??"before",isOverride:true};if(t&&t.primary){let i={primary:t.primary,position:t.position,isOverride:false};return t.alternatives&&(i.alternatives=t.alternatives),i}return null}function bi(a,e,r,t,i){let n=[];if(n.push({type:"role",role:"event",optional:false}),t.position==="after"){let p=t.primary.split(/\s+/);if(p.length>1)for(let l of p)n.push({type:"literal",value:l});else {let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(l);}}let o=e.roleMarkers.destination;o&&n.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary}]}),n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.patient;if(u){let p=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};n.push(p);}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(s),{id:`${a.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`{event} ${t.primary} {destination?} {patient} ${u?.primary||""} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Ci(a,e,r,t,i){let n=[];n.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o){let s=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(s);}if(n.push({type:"role",role:"event",optional:false}),t.position==="after"){let s=t.primary.split(/\s+/);if(s.length>1)for(let p of s)n.push({type:"literal",value:p});else {let p=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(p);}}let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(u),{id:`${a.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`{patient} ${o?.primary||""} {event} ${t.primary} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Ai(a,e,r,t,i){let n=[];n.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o){let p=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(p);}let u=e.roleMarkers.destination;if(u&&(n.push({type:"role",role:"destination",optional:false}),n.push(u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary})),n.push({type:"role",role:"event",optional:false}),t.position==="after"){let p=t.primary.split(/\s+/);if(p.length>1)for(let l of p)n.push({type:"literal",value:l});else {let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(l);}}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(s),{id:`${a.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(i.basePriority??100)+40,template:{format:`{patient} ${o?.primary||""} {destination} ${u?.primary||""} {event} ${t.primary} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function wi(a,e,r,t,i){let n=[];n.push({type:"role",role:"event",optional:false});let o=t.alternatives?.filter(l=>!l.includes(" ")&&l.length>1)||[];o.length>0&&n.push({type:"literal",value:o[0],alternatives:o.slice(1)});let u=e.roleMarkers.destination;u&&n.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary}]}),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);}let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(p),{id:`${a.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(i.basePriority??100)+52,template:{format:`{event}${o[0]||""} {patient} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function xi(a,e,r,t,i){let n=[];if(n.push({type:"role",role:"event",optional:false}),t.position==="after"){let u=t.primary.split(/\s+/);if(u.length>1)for(let s of u)n.push({type:"literal",value:s});else {let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(s);}}let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(o),{id:`${a.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{event} ${t.primary} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function Ti(a,e,r,t){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 o=e.roleMarkers.patient;if(o?.primary){let s=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(s);}let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(u),{id:`${a.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(t.basePriority??100)+49,template:{format:`{event} ${i[0]} {patient} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function Di(a,e,r,t,i){let n=[];if(n.push({type:"role",role:"event",optional:false}),t.position==="after"){let l=t.primary.split(/\s+/);if(l.length>1)for(let c of l)n.push({type:"literal",value:c});else {let c=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(c);}}let u=[...a.roles.filter(l=>l.required)].sort((l,c)=>{let m=l.sovPosition??999,d=c.sovPosition??999;return m-d});for(let l of u){n.push({type:"role",role:l.role,optional:false});let c,m;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)c=l.markerOverride[e.code];else {let d=e.roleMarkers[l.role];d&&(c=d.primary,m=d.alternatives);}if(c){let d=m?{type:"literal",value:c,alternatives:m}:{type:"literal",value:c};n.push(d);}}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(s);let p=u.map(l=>`{${l.role}}`).join(" ");return {id:`${a.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`{event} ${t.primary} ${p} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},...Object.fromEntries(u.map(l=>[l.role,{fromRole:l.role}]))}}}function Si(a,e,r,t,i){let n=[],u=[...a.roles.filter(y=>y.required)].sort((y,h)=>{let g=y.sovPosition??999,E=h.sovPosition??999;return g-E}),s=u[0];n.push({type:"role",role:s.role,optional:false});let p;if(s.markerOverride&&s.markerOverride[e.code]!==void 0)p=s.markerOverride[e.code];else {let y=e.roleMarkers[s.role];y&&(p=y.primary);}if(p&&n.push({type:"literal",value:p}),n.push({type:"role",role:"event",optional:false}),t.position==="after"){let y=t.primary.split(/\s+/);if(y.length>1)for(let h of y)n.push({type:"literal",value:h});else {let h=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(h);}}let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(l);let c=u[1];n.push({type:"role",role:c.role,optional:false});let m,d;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)m=c.markerOverride[e.code];else {let y=e.roleMarkers[c.role];y&&(m=y.primary,d=y.alternatives);}if(m){let y=d?{type:"literal",value:m,alternatives:d}:{type:"literal",value:m};n.push(y);}return {id:`${a.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{${s.role}} {event} ${t.primary} ${r.primary} {${c.role}}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},[s.role]:{fromRole:s.role},[c.role]:{fromRole:c.role}}}}function Xe(a,e,r,t,i){let n=[];if(t.position==="before"){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:"event",optional:false});let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o),n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.destination;return u&&n.push({type:"group",optional:true,tokens:[u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary},{type:"role",role:"destination",optional:true}]}),{id:`${a.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`${t.primary} {event} ${r.primary} {patient} ${u?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Bi(a,e,r,t,i){let n=[],o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o),n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.destination;if(u&&n.push({type:"group",optional:true,tokens:[u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary},{type:"role",role:"destination",optional:true}]}),t.position==="before"){let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(s);}return n.push({type:"role",role:"event",optional:false}),{id:`${a.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`${r.primary} {patient} ${u?.primary||""} {destination?} ${t.primary} {event}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Pi(a,e,r,t,i){let n=[],o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o);let s=[...a.roles.filter(l=>l.required)].sort((l,c)=>{let m=l.svoPosition??999,d=c.svoPosition??999;return m-d});for(let l of s){let c,m;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)c=l.markerOverride[e.code];else {let d=e.roleMarkers[l.role];d&&(c=d.primary,m=d.alternatives);}if(c){let d=m?{type:"literal",value:c,alternatives:m}:{type:"literal",value:c};n.push(d);}n.push({type:"role",role:l.role,optional:false});}if(t.position==="before"){let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(l);}n.push({type:"role",role:"event",optional:false});let p=s.map(l=>`{${l.role}}`).join(" ");return {id:`${a.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${r.primary} ${p} ${t.primary} {event}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},...Object.fromEntries(s.map(l=>[l.role,{fromRole:l.role}]))}}}function Je(a,e,r,t,i){let n=[];if(t.position==="before"){let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(l);}n.push({type:"role",role:"event",optional:false});let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o);let s=[...a.roles.filter(l=>l.required)].sort((l,c)=>{let m=l.svoPosition??999,d=c.svoPosition??999;return m-d});for(let l of s){let c,m;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)c=l.markerOverride[e.code];else {let d=e.roleMarkers[l.role];d&&(c=d.primary,m=d.alternatives);}if(c){let d=m?{type:"literal",value:c,alternatives:m}:{type:"literal",value:c};n.push(d);}n.push({type:"role",role:l.role,optional:false});}let p=s.map(l=>`{${l.role}}`).join(" ");return {id:`${a.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`${t.primary} {event} ${r.primary} ${p}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},...Object.fromEntries(s.map(l=>[l.role,{fromRole:l.role}]))}}}function Fi(a,e,r,t,i){let n=[],o=e.eventHandler?.negationMarker;if(t.position==="before"){let p=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(p);}if(o){let p=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(p);}n.push({type:"role",role:"event",optional:false});let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(u),n.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&n.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:`${a.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${t.primary} ${o?.primary||""} {event} ${r.primary} {patient} ${s?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Ri(a,e,r,t){let i=[];i.push({type:"literal",value:"and",alternatives:["then"]}),i.push({type:"role",role:"event",optional:false});let n=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(n),i.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.destination;return o&&i.push({type:"group",optional:true,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:true}]}),{id:`${a.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(t.basePriority??100)+45,template:{format:`[proclitic?] {event} ${r.primary} {patient} ${o?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var ae={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function vr(a,e,r=ae){let t=`${a.action}-${e.code}-generated`,i=r.basePriority??100,n=e.keywords[a.action];if(!n)throw new Error(`No keyword translation for '${a.action}' in ${e.code}`);let o=Ii(a,e,n),u=gr(a,e),s=$i(a,e,n);return {id:t,language:e.code,command:a.action,priority:i,template:{format:s,tokens:o},extraction:u}}function _i(a,e,r=ae){if(a.roles.filter(u=>!u.required).length===0)return null;let i=a.roles.filter(u=>u.required),n={...a,roles:i};return {...vr(n,e,r),id:`${a.action}-${e.code}-generated-simple`,priority:(r.basePriority??100)-5,extraction:gr(a,e)}}function Oi(a,e,r=ae){let t=[];if(t.push(vr(a,e,r)),r.generateSimpleVariants){let i=_i(a,e,r);i&&t.push(i);}return t}function hr(a,e=ae){let r=[],t=vi();for(let i of t){if(!a.keywords[i.action])continue;let n=Oi(i,a,e);if(r.push(...n),a.eventHandler?.eventMarker){let o=Ni(i,a,e);r.push(...o);}}return r}function Ni(a,e,r=ae){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let t=[],i=e.eventHandler.eventMarker,n=e.keywords[a.action];if(!n)return [];let u=a.roles.filter(s=>s.required).length===2;if(e.wordOrder==="SOV")if(u)t.push(Di(a,e,n,i,r)),t.push(Si(a,e,n,i,r));else {t.push(bi(a,e,n,i,r)),t.push(Ci(a,e,n,i,r));let s=e.roleMarkers.destination;s&&s.primary!==i.primary&&t.push(Ai(a,e,n,i,r));let p=i.primary.split(/\s+/),l=i.alternatives?.some(m=>!m.includes(" ")&&m.length>1);p.length>1&&l&&t.push(wi(a,e,n,i,r)),t.push(xi(a,e,n,i,r));let c=Ti(a,e,n,r);c&&t.push(c);}else e.wordOrder==="VSO"?u?(t.push(Je(a,e,n,i,r)),t.push(Pi(a,e,n,i,r))):(t.push(Xe(a,e,n,i,r)),t.push(Bi(a,e,n,i,r)),e.eventHandler?.negationMarker&&t.push(Fi(a,e,n,i,r)),e.tokenization?.prefixes&&t.push(Ri(a,e,n,r))):u?t.push(Je(a,e,n,i,r)):t.push(Xe(a,e,n,i,r));return t}function Ii(a,e,r){let t=[],i=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary},n=Mi(a,e);switch(e.wordOrder){case "SVO":t.push(i),t.push(...n);break;case "SOV":t.push(...n),t.push(i);break;case "VSO":t.push(i),t.push(...n);break;default:t.push(i),t.push(...n);}return t}function Mi(a,e){let r=[],t=fr(a.roles,e.wordOrder);for(let i of t){let n=Li(i,e);i.required?r.push(...n):r.push({type:"group",optional:true,tokens:n});}return r}function Li(a,e){let r=[],t=a.markerOverride?.[e.code],i=e.roleMarkers[a.role],n={type:"role",role:a.role,optional:!a.required,expectedTypes:a.expectedTypes};if(t!==void 0){let o=t?t.split(/\s+/).filter(Boolean):[];if((i?.position??"before")==="before"){for(let s of o)r.push({type:"literal",value:s});r.push(n);}else {r.push(n);for(let s of o)r.push({type:"literal",value:s});}}else if(i)if(i.position==="before"){if(i.primary){let o=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};r.push(o);}r.push(n);}else {r.push(n);let o=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};r.push(o);}else r.push(n);return r}function qi(a,e){let r={};for(let t of a.roles){let i=t.markerOverride?.[e.code],n=e.roleMarkers[t.role];i!==void 0?r[t.role]=i?{marker:i}:{}:n&&n.primary?r[t.role]=n.alternatives?{marker:n.primary,markerAlternatives:n.alternatives}:{marker:n.primary}:r[t.role]={};}return r}function gr(a,e){let r=qi(a,e),t={};for(let i of a.roles){let n=r[i.role]||{};!i.required&&i.default?t[i.role]={...n,default:i.default}:t[i.role]=n;}return t}function $i(a,e,r){let t=[],n=fr(a.roles,e.wordOrder).map(o=>{let u=zi(o,e),s="";return u&&u.primary?u.position==="before"?s=`${u.primary} {${o.role}}`:s=`{${o.role}} ${u.primary}`:s=`{${o.role}}`,o.required?s:`[${s}]`});switch(e.wordOrder){case "SVO":case "VSO":t.push(r.primary,...n);break;case "SOV":t.push(...n,r.primary);break;default:t.push(r.primary,...n);}return t.join(" ")}var Vi=class{constructor(a={}){this.cache=new Map,this.config={maxSize:a.maxSize??1e3,ttlMs:a.ttlMs??0,enabled:a.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(a,e){return `${e}:${a}`}isExpired(a){return this.config.ttlMs===0?false:Date.now()-a.createdAt>this.config.ttlMs}evictLRU(){let a=this.cache.keys().next().value;a!==void 0&&(this.cache.delete(a),this.stats.evictions++);}get(a,e){if(!this.config.enabled){this.stats.misses++;return}let r=this.makeKey(a,e),t=this.cache.get(r);if(!t){this.stats.misses++;return}if(this.isExpired(t)){this.cache.delete(r),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(r),t.lastAccessed=Date.now(),this.cache.set(r,t),this.stats.hits++,t.result}set(a,e,r){if(!this.config.enabled||r!==null&&typeof r=="object"&&"confidence"in r&&r.confidence===0)return;let t=this.makeKey(a,e),i=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(t,{result:r,createdAt:i,lastAccessed:i});}has(a,e){if(!this.config.enabled)return false;let r=this.makeKey(a,e),t=this.cache.get(r);return t?this.isExpired(t)?(this.cache.delete(r),this.stats.expirations++,false):true:false}delete(a,e){let r=this.makeKey(a,e);return this.cache.delete(r)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let a=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:a>0?this.stats.hits/a:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(a){if(a.maxSize!==void 0)for(this.config.maxSize=a.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();a.ttlMs!==void 0&&(this.config.ttlMs=a.ttlMs),a.enabled!==void 0&&(this.config.enabled=a.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}};new Vi;var ji=Object.defineProperty,Wi=Object.getOwnPropertyNames,br=(a,e)=>function(){return a&&(e=(0, a[Wi(a)[0]])(a=0)),e},Hi=(a,e)=>{for(var r in e)ji(a,r,{get:e[r],enumerable:true});};function Er(a,e){return a.replace(/\{(\w+)\}/g,(r,t)=>String(e[t]??`{${t}}`))}function D(a,e,r={},t){let i=Cr[a],n=Er(i,r),o=Ar[a],u=o?Er(o,r):void 0;return {code:a,message:n,severity:e,...t&&{role:t},...u&&{suggestion:u}}}var v,Cr,Ar,Ui=br({"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"},Cr={[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."},Ar={[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."};}}),wr={};Hi(wr,{SchemaErrorCodes:()=>v,formatValidationResults:()=>Zi,getValidationStats:()=>en,validateAllKeywordCollisions:()=>tn,validateAllSchemas:()=>Ji,validateCommandSchema:()=>xr,validateKeywordCollisions:()=>Tr,validateRoleValues:()=>rn});function Gi(a,e){return {action:a,items:e}}function xr(a){let e=[];for(let t of a.roles)t.expectedTypes.includes("literal")&&t.expectedTypes.includes("selector")&&(t.role==="patient"&&xe.has(a.action)?e.push(D(v.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:t.role,command:a.action},t.role)):e.push(D(v.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:t.role},t.role))),t.expectedTypes.length>3&&!xe.has(a.action)&&e.push(D(v.TOO_MANY_EXPECTED_TYPES,"warning",{role:t.role,count:t.expectedTypes.length},t.role));for(let t of a.roles)t.selectorKinds&&t.selectorKinds.length>0&&(t.expectedTypes.includes("selector")||e.push(D(v.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:t.role},t.role)));switch(a.action){case "transition":Ki(a,e);break;case "on":Yi(a,e);break;case "if":case "unless":Qi(a,e);break;case "repeat":case "for":case "while":Xi(a,e);break}return a.roles.filter(t=>t.required).length===0&&(Dr.has(a.action)?e.push(D(v.NO_REQUIRED_ROLES_EXPECTED,"note",{command:a.action})):e.push(D(v.NO_REQUIRED_ROLES,"warning",{}))),Gi(a.action,e)}function Ki(a,e){let r=a.roles.find(i=>i.role==="patient"),t=a.roles.find(i=>i.role==="goal");r&&r.expectedTypes.includes("selector")&&e.push(D(v.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),r&&!t&&e.push(D(v.TRANSITION_MISSING_GOAL,"error",{}));}function Yi(a,e){let r=a.roles.find(t=>t.role==="event");r||e.push(D(v.EVENT_HANDLER_MISSING_EVENT,"warning",{})),r&&!r.required&&e.push(D(v.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function Qi(a,e){let r=a.roles.find(t=>t.role==="condition");r||e.push(D(v.CONDITIONAL_MISSING_CONDITION,"warning",{})),r&&!r.required&&e.push(D(v.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function Xi(a,e){a.action==="for"?a.roles.find(t=>t.role==="source")||e.push(D(v.FOR_LOOP_MISSING_SOURCE,"warning",{})):a.action==="while"&&(a.roles.find(t=>t.role==="condition")||e.push(D(v.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function Ji(a,e={}){let r=new Map,{includeNotes:t=false}=e;for(let[i,n]of Object.entries(a)){let o=xr(n),u=o.items.some(p=>p.severity==="warning"||p.severity==="error"),s=t&&o.items.some(p=>p.severity==="note");(u||s)&&r.set(i,o);}return r}function Zi(a,e={}){let r=[],{showNotes:t=false,showCodes:i=true}=e;for(let[n,o]of a){let u=o.items.filter(l=>l.severity==="error"),s=o.items.filter(l=>l.severity==="warning"),p=o.items.filter(l=>l.severity==="note");if(u.length>0){r.push(` \u274C ${n}:`);for(let l of u){let c=i?` [${l.code}]`:"";r.push(` ERROR${c}: ${l.message}`),l.suggestion&&r.push(` \u{1F4A1} Suggestion: ${l.suggestion}`);}}if(s.length>0){r.push(` \u26A0\uFE0F ${n}:`);for(let l of s){let c=i?` [${l.code}]`:"";r.push(` ${c?`${l.code}: `:""}${l.message}`),l.suggestion&&r.push(` \u{1F4A1} ${l.suggestion}`);}}if(t&&p.length>0){r.push(` \u2139\uFE0F ${n}:`);for(let l of p){let c=i?` [${l.code}]`:"";r.push(` ${c?`${l.code}: `:""}${l.message}`);}}}return r.join(`
|
|
4
|
+
`)}function en(a){let e=0,r=0,t=0,i={};for(let n of a.values())for(let o of n.items)o.severity==="error"?e++:o.severity==="warning"?r++:o.severity==="note"&&t++,i[o.code]=(i[o.code]||0)+1;return {totalCommands:a.size,errors:e,warnings:r,notes:t,byCode:i}}function rn(a,e){let r=[];for(let t of e){let i=a.roles.find(n=>n.role===t.role);i&&(i.expectedTypes.length>0&&!i.expectedTypes.includes(t.type)&&(i.expectedTypes.includes("expression")||r.push({level:"error",role:t.role,message:`${a.action}.${t.role} expects type [${i.expectedTypes.join(", ")}], got '${t.type}'`,code:v.VALUE_TYPE_MISMATCH})),t.type==="selector"&&t.selectorKind&&i.selectorKinds&&i.selectorKinds.length>0&&(i.selectorKinds.includes(t.selectorKind)||r.push({level:"error",role:t.role,message:`${a.action}.${t.role} expects selector kind [${i.selectorKinds.join(", ")}], got '${t.selectorKind}'`,code:v.SELECTOR_KIND_MISMATCH})));}return r}function Tr(a){let e=[];if(!a.keywords)return {language:a.code,collisions:e};let r=new Map;for(let[i,n]of Object.entries(a.keywords)){if(!n||!n.primary)continue;let o=r.get(n.primary)||[];if(o.push({command:i,isPrimary:true}),r.set(n.primary,o),n.alternatives)for(let u of n.alternatives){let s=r.get(u)||[];s.push({command:i,isPrimary:false}),r.set(u,s);}}for(let[i,n]of r){let o=[...new Set(n.map(p=>p.command))];if(o.length<=1)continue;let u=n.filter(p=>p.isPrimary).length,s;u>=2?s="primary-primary":u===1?s="primary-alternative":s="alternative-alternative",e.push({keyword:i,commands:o.sort(),type:s});}let t={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((i,n)=>t[i.type]-t[n.type]),{language:a.code,collisions:e}}function tn(a){let e=[];for(let[,r]of Object.entries(a)){let t=Tr(r);t.collisions.length>0&&e.push(t);}return e.sort((r,t)=>r.language.localeCompare(t.language))}var xe,Dr,an=br({"src/generators/schema-validator.ts"(){Ui(),xe=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),Dr=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep","empty","open","close","select","clear","reset","breakpoint"]);}}),Te={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"},empty:{primary:"empty",normalized:"empty"},open:{primary:"open",normalized:"open"},close:{primary:"close",normalized:"close"},select:{primary:"select",normalized:"select"},clear:{primary:"clear",normalized:"clear"},reset:{primary:"reset",normalized:"reset"},breakpoint:{primary:"breakpoint",normalized:"breakpoint"},go:{primary:"go"},scroll:{primary:"scroll",normalized:"scroll"},push:{primary:"push",normalized:"push"},replace:{primary:"replace",normalized:"replace"},process:{primary:"process",normalized:"process"},wait:{primary:"wait"},fetch:{primary:"fetch"},settle:{primary:"settle"},if:{primary:"if"},when:{primary:"when",normalized:"when"},where:{primary:"where",normalized:"where"},else:{primary:"else"},repeat:{primary:"repeat"},for:{primary:"for"},while:{primary:"while"},continue:{primary:"continue"},halt:{primary:"halt"},throw:{primary:"throw"},call:{primary:"call"},return:{primary:"return"},then:{primary:"then"},and:{primary:"and"},end:{primary:"end"},js:{primary:"js"},async:{primary:"async"},tell:{primary:"tell"},default:{primary:"default"},init:{primary:"init"},behavior:{primary:"behavior"},install:{primary:"install"},measure:{primary:"measure"},beep:{primary:"beep"},break:{primary:"break"},copy:{primary:"copy"},exit:{primary:"exit"},pick:{primary:"pick"},render:{primary:"render"},into:{primary:"into"},before:{primary:"before"},after:{primary:"after"},until:{primary:"until"},event:{primary:"event"},from:{primary:"from"},connect:{primary:"connect",normalized:"connect"},stream:{primary:"stream",normalized:"stream"},live:{primary:"live",normalized:"live"},socket:{primary:"socket",alternatives:["websocket"],normalized:"socket"}}},nn=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],on=class{constructor(a=nn){this.name="operator",this.operators=[...a].sort((e,r)=>r.length-e.length);}canExtract(a,e){return this.operators.some(r=>a.startsWith(r,e))}extract(a,e){for(let r of this.operators)if(a.startsWith(r,e))return {value:r,length:r.length};return null}},un="()[]{},:;",sn=class{constructor(a=un){this.punctuation=a,this.name="punctuation";}canExtract(a,e){return this.punctuation.includes(a[e])}extract(a,e){let r=a[e];return this.punctuation.includes(r)?{value:r,length:1}:null}};function ln(a,e){let r=a[e];if(r==="#"){let t=a.slice(e).match(/^#[a-zA-Z_][\w-]*/);return t?t[0]:null}if(r==="."){let t=a.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return t?t[0]:null}if(r==="["){let t=0,i=e;for(;i<a.length;){if(a[i]==="["&&t++,a[i]==="]"&&(t--,t===0))return a.slice(e,i+1);i++;}return null}if(r==="<"){let t=a.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return t?t[0]:null}return null}var pn=class{constructor(){this.name="css-selector";}canExtract(a,e){let r=a[e];return r==="#"||r==="."||r==="["||r==="<"}extract(a,e){let r=ln(a,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},cn=class{constructor(){this.name="event-modifier";}canExtract(a,e){if(a[e]!==".")return false;let r=a.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(r)}extract(a,e){let r=a.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!r)return null;let t=r[0],i=t.slice(1).split("(")[0],n=r[1];return {value:t,length:t.length,metadata:{modifierName:i,value:n?i==="queue"?n:parseInt(n,10):void 0}}}};function mn(a,e){let r=a.slice(e);if(r.startsWith("http://")||r.startsWith("https://")){let t=r.match(/^https?:\/\/[^\s]*/);return t?t[0]:null}if(r.startsWith("//")){let t=r.match(/^\/\/[^\s]*/);return t?t[0]:null}if(r.startsWith("./")||r.startsWith("../")){let t=r.match(/^\.\.?\/[^\s]*/);return t?t[0]:null}if(r.startsWith("/")){let t=r.match(/^\/[^\s]*/);return t?t[0]:null}return null}var dn=class{constructor(){this.name="url";}canExtract(a,e){let r=a.slice(e);return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")||r.startsWith("./")||r.startsWith("../")||r.startsWith("/")}extract(a,e){let r=mn(a,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},yn=class{constructor(){this.name="variable-ref";}canExtract(a,e){return a[e]===":"&&e+1<a.length&&/[a-zA-Z_]/.test(a[e+1])}extract(a,e){if(!this.canExtract(a,e))return null;let r=1;for(;e+r<a.length&&/[a-zA-Z0-9_]/.test(a[e+r]);)r++;return {value:a.substring(e,e+r),length:r,metadata:{type:"variable-reference"}}}};function fn(){return [new dn,new cn,new yn,new pn]}function we(a){return /[a-zA-Z0-9_]/.test(a)}var vn=class{constructor(){this.name="english-keyword";}setContext(a){this.context=a;}canExtract(a,e){return /[a-zA-Z_]/.test(a[e])}extract(a,e){if(!this.context)throw new Error("EnglishKeywordExtractor: context not set");let r=e,t="";for(;r<a.length&&we(a[r]);)t+=a[r++];if(!t)return null;if(r<a.length&&a[r]===":"){let u=r;r++;let s="";for(;r<a.length&&we(a[r]);)s+=a[r++];s?t=t+":"+s:r=u;}let i=this.context.lookupKeyword(t),n=i&&i.normalized!==i.native?i.normalized:void 0,o=null;return this.context.isKeyword(t)||(o=this.tryClassSyntaxConversion(a,r,t)),{value:o||t,length:r-e,metadata:{normalized:n,classConversion:o?true:void 0}}}tryClassSyntaxConversion(a,e,r){let t=e;for(;t<a.length&&/\s/.test(a[t]);)t++;if(a.slice(t,t+5).toLowerCase()==="class"){let i=t+5;if(i>=a.length||!we(a[i]))return "."+r}return null}};function hn(){return [new vn]}var gn=[{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"}],En=class extends $e{constructor(){super(),this.language="en",this.direction="ltr",this.initializeKeywordsFromProfile(Te,gn),this.registerExtractors(fn()),this.registerExtractor(new Ie),this.registerExtractor(new Me),this.registerExtractors(hn()),this.registerExtractor(new on),this.registerExtractor(new sn);}classifyToken(a){return this.isKeyword(a)?"keyword":a.startsWith("/")||a.startsWith("./")||a.startsWith("../")||a.startsWith("http")?"url":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(a)?"event-modifier":a.startsWith("#")||a.startsWith(".")||a.startsWith("[")||a.startsWith("*")||a.startsWith("<")?"selector":a.startsWith('"')||a.startsWith("'")||/^\d/.test(a)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(a)?"operator":"identifier"}},kn=new En,zn={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)"}},bn={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"}},Cn={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",targetRole:"source",roles:[{role:"patient",description:"The class or attribute to remove",required: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"}},An={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"},markerVariants:{en:["before","after"]},methodCarrier:"method"}],errorCodes:["MISSING_ARGUMENTS","MISSING_CONTENT","MISSING_POSITION","INVALID_POSITION","NO_TARGET","NO_ELEMENTS"],preconditions:[{condition:"Command has content and position arguments",errorCode:"MISSING_ARGUMENTS",message:"put requires arguments"},{condition:"Content to put is specified",errorCode:"MISSING_CONTENT",message:"put requires content"},{condition:"Position keyword is specified (into, before, after, etc.)",errorCode:"MISSING_POSITION",message:"put requires position keyword"}],recoveryHints:{MISSING_ARGUMENTS:"Use syntax: put <content> into/before/after <target>",MISSING_CONTENT:"Add content to put (string, element, or expression)",MISSING_POSITION:"Add position keyword: into, before, after, at start of, at end of",INVALID_POSITION:"Valid positions: into, before, after, at start of, at end of",NO_TARGET:'Ensure target element exists or use "me" reference',NO_ELEMENTS:"Check that the selector matches existing elements"}},wn={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>"}},xn={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}]},Tn={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}]},Dn={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}]},Sn={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}]},Bn={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"duration",roles:[{role:"duration",description:"Duration or event to wait for",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},Pn={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,markerOverride:{en:"as"}},{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}]},Fn={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"}}]},Rn={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"}}]},_n={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"}}]},On={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}]},In={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}]},Mn={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}]},Ln={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}]},qn={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}]},$n={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}]},Vn={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}]},jn={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"}}]},Wn={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}]},Hn={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}]},Un={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Gn={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"'},Kn={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}]},Qn={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},Xn={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:""}}]},Jn={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}]},Zn={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"}}]},eo={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}]},ro={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}]},to={action:"empty",description:"Remove all children from an element (sets innerHTML to empty)",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to empty (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},ao={action:"open",description:"Open a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to open (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2},{role:"style",description:"Open-mode variant (modal / non-modal) for <dialog>",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"as"}}]},io={action:"close",description:"Close a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to close (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},no={action:"select",description:"Select the contents of a text field or DOM element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element whose contents to select (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},oo={action:"clear",description:"Clear a variable, local, or input element",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The variable or element to clear (defaults to me)",required:false,expectedTypes:["selector","reference","expression"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},uo={action:"reset",description:"Reset a <form> element to its default values",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The form element to reset (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},so={action:"breakpoint",description:"Drop into the debugger",category:"control-flow",primaryRole:"patient",roles:[]},lo={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}]},po={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}]},co={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}]},mo={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},yo={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:""}}]},fo={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"}}]},vo={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},ho={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}]},go={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}]},Eo={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"}}]},ko={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"}}]},zo={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"}}]},bo={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}]},Co={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Ao={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}]},wo={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},xo={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}]},To={action:"scroll",description:"Scroll the viewport to a target element",category:"navigation",primaryRole:"destination",argSkipTokens:["of","the","top","bottom","middle","center","nearest","left","right","smoothly","instantly"],roles:[{role:"destination",description:"The element to scroll to",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"}}]},Sr={en:"url",es:"url",pt:"url",fr:"url",de:"url",it:"url",ja:"url",ko:"url",zh:"url",ar:"url",he:"url",hi:"url",bn:"url",tr:"url",ru:"url",uk:"url",pl:"url",id:"url",vi:"url",th:"url",ms:"url",tl:"url",sw:"url",qu:"url"},Do={en:"partials in",es:"partials in",pt:"partials in",fr:"partials in",de:"partials in",it:"partials in",ja:"partials in",ko:"partials in",zh:"partials in",ar:"partials in",he:"partials in",hi:"partials in",bn:"partials in",tr:"partials in",ru:"partials in",uk:"partials in",pl:"partials in",id:"partials in",vi:"partials in",th:"partials in",ms:"partials in",tl:"partials in",sw:"partials in",qu:"partials in"},So={action:"push",description:"Push a URL onto the browser history",category:"navigation",primaryRole:"patient",roles:[{role:"patient",description:"The URL to push (after the `url` keyword)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:Sr}]},Bo={action:"replace",description:"Replace the current browser history entry with a URL",category:"navigation",primaryRole:"patient",roles:[{role:"patient",description:"The URL to replace with (after the `url` keyword)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:Sr}]},Po={action:"process",description:"Process hx-partial markup in HTML content",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The HTML content (string, element, or response) to process",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:Do}]},Fo={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}]},Br={toggle:zn,add:bn,remove:Cn,put:An,set:wn,show:xn,hide:Tn,on:Dn,trigger:Sn,wait:Bn,fetch:Pn,increment:Fn,decrement:Rn,append:_n,prepend:On,log:Nn,get:In,take:Mn,make:Ln,halt:qn,settle:$n,throw:Vn,send:jn,if:Wn,unless:Hn,else:Un,repeat:Gn,for:Kn,while:Yn,continue:Qn,go:Xn,scroll:To,push:So,replace:Bo,process:Po,transition:Jn,clone:Zn,focus:eo,blur:ro,empty:to,open:ao,close:io,select:no,clear:oo,reset:uo,breakpoint:so,call:lo,return:po,js:co,async:mo,tell:yo,default:fo,init:vo,behavior:ho,install:go,measure:Eo,swap:ko,morph:zo,beep:bo,break:Co,copy:Ao,exit:wo,pick:xo,render:Fo,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function Ro(){return Object.values(Br).filter(a=>a.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(an(),wr)).then(({validateAllSchemas:a,formatValidationResults:e})=>{let r=a(Br);r.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(r)),console.warn(`
|
|
5
|
+
These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(a=>{console.debug("Schema validation skipped:",a);});function Pr(a,e){let r=e==="SOV"?"sovPosition":"svoPosition";return [...a].sort((t,i)=>{let n=t[r]??99,o=i[r]??99;return n-o})}function _o(a,e){let r=a.markerOverride?.[e.code],t=e.roleMarkers[a.role];if(r!==void 0)return {primary:r,position:t?.position??"before",isOverride:true};if(t&&t.primary){let i={primary:t.primary,position:t.position,isOverride:false};return t.alternatives&&(i.alternatives=t.alternatives),i}return null}function Oo(a,e,r,t,i){let n=[];if(n.push({type:"role",role:"event",optional:false}),t.position==="after"){let p=t.primary.split(/\s+/);if(p.length>1)for(let l of p)n.push({type:"literal",value:l});else {let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(l);}}let o=e.roleMarkers.destination;o&&n.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary}]}),n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.patient;if(u){let p=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};n.push(p);}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(s),{id:`${a.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`{event} ${t.primary} {destination?} {patient} ${u?.primary||""} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function No(a,e,r,t,i){let n=[];n.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o){let s=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(s);}if(n.push({type:"role",role:"event",optional:false}),t.position==="after"){let s=t.primary.split(/\s+/);if(s.length>1)for(let p of s)n.push({type:"literal",value:p});else {let p=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(p);}}let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(u),{id:`${a.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`{patient} ${o?.primary||""} {event} ${t.primary} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Io(a,e,r,t,i){let n=[];n.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o){let p=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(p);}let u=e.roleMarkers.destination;if(u&&(n.push({type:"role",role:"destination",optional:false}),n.push(u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary})),n.push({type:"role",role:"event",optional:false}),t.position==="after"){let p=t.primary.split(/\s+/);if(p.length>1)for(let l of p)n.push({type:"literal",value:l});else {let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(l);}}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(s),{id:`${a.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(i.basePriority??100)+40,template:{format:`{patient} ${o?.primary||""} {destination} ${u?.primary||""} {event} ${t.primary} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function Mo(a,e,r,t,i){let n=[];n.push({type:"role",role:"event",optional:false});let o=t.alternatives?.filter(l=>!l.includes(" ")&&l.length>1)||[];o.length>0&&n.push({type:"literal",value:o[0],alternatives:o.slice(1)});let u=e.roleMarkers.destination;u&&n.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary}]}),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);}let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(p),{id:`${a.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(i.basePriority??100)+52,template:{format:`{event}${o[0]||""} {patient} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Lo(a,e,r,t,i){let n=[];if(n.push({type:"role",role:"event",optional:false}),t.position==="after"){let u=t.primary.split(/\s+/);if(u.length>1)for(let s of u)n.push({type:"literal",value:s});else {let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(s);}}let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(o),{id:`${a.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{event} ${t.primary} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function qo(a,e,r,t){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 o=e.roleMarkers.patient;if(o?.primary){let s=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(s);}let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(u),{id:`${a.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(t.basePriority??100)+49,template:{format:`{event} ${i[0]} {patient} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function $o(a,e,r,t,i){let n=[];if(n.push({type:"role",role:"event",optional:false}),t.position==="after"){let l=t.primary.split(/\s+/);if(l.length>1)for(let c of l)n.push({type:"literal",value:c});else {let c=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(c);}}let u=[...a.roles.filter(l=>l.required)].sort((l,c)=>{let m=l.sovPosition??999,d=c.sovPosition??999;return m-d});for(let l of u){n.push({type:"role",role:l.role,optional:false});let c,m;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)c=l.markerOverride[e.code];else {let d=e.roleMarkers[l.role];d&&(c=d.primary,m=d.alternatives);}if(c){let d=m?{type:"literal",value:c,alternatives:m}:{type:"literal",value:c};n.push(d);}}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(s);let p=u.map(l=>`{${l.role}}`).join(" ");return {id:`${a.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`{event} ${t.primary} ${p} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},...Object.fromEntries(u.map(l=>[l.role,{fromRole:l.role}]))}}}function Vo(a,e,r,t,i){let n=[],u=[...a.roles.filter(y=>y.required)].sort((y,h)=>{let g=y.sovPosition??999,E=h.sovPosition??999;return g-E}),s=u[0];n.push({type:"role",role:s.role,optional:false});let p;if(s.markerOverride&&s.markerOverride[e.code]!==void 0)p=s.markerOverride[e.code];else {let y=e.roleMarkers[s.role];y&&(p=y.primary);}if(p&&n.push({type:"literal",value:p}),n.push({type:"role",role:"event",optional:false}),t.position==="after"){let y=t.primary.split(/\s+/);if(y.length>1)for(let h of y)n.push({type:"literal",value:h});else {let h=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(h);}}let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(l);let c=u[1];n.push({type:"role",role:c.role,optional:false});let m,d;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)m=c.markerOverride[e.code];else {let y=e.roleMarkers[c.role];y&&(m=y.primary,d=y.alternatives);}if(m){let y=d?{type:"literal",value:m,alternatives:d}:{type:"literal",value:m};n.push(y);}return {id:`${a.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{${s.role}} {event} ${t.primary} ${r.primary} {${c.role}}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},[s.role]:{fromRole:s.role},[c.role]:{fromRole:c.role}}}}function kr(a,e,r,t,i){let n=[];if(t.position==="before"){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:"event",optional:false});let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o),n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.destination;return u&&n.push({type:"group",optional:true,tokens:[u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary},{type:"role",role:"destination",optional:true}]}),{id:`${a.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`${t.primary} {event} ${r.primary} {patient} ${u?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function jo(a,e,r,t,i){let n=[],o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o),n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.destination;if(u&&n.push({type:"group",optional:true,tokens:[u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary},{type:"role",role:"destination",optional:true}]}),t.position==="before"){let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(s);}return n.push({type:"role",role:"event",optional:false}),{id:`${a.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`${r.primary} {patient} ${u?.primary||""} {destination?} ${t.primary} {event}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Wo(a,e,r,t,i){let n=[],o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o);let s=[...a.roles.filter(l=>l.required)].sort((l,c)=>{let m=l.svoPosition??999,d=c.svoPosition??999;return m-d});for(let l of s){let c,m;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)c=l.markerOverride[e.code];else {let d=e.roleMarkers[l.role];d&&(c=d.primary,m=d.alternatives);}if(c){let d=m?{type:"literal",value:c,alternatives:m}:{type:"literal",value:c};n.push(d);}n.push({type:"role",role:l.role,optional:false});}if(t.position==="before"){let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(l);}n.push({type:"role",role:"event",optional:false});let p=s.map(l=>`{${l.role}}`).join(" ");return {id:`${a.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${r.primary} ${p} ${t.primary} {event}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},...Object.fromEntries(s.map(l=>[l.role,{fromRole:l.role}]))}}}function zr(a,e,r,t,i){let n=[];if(t.position==="before"){let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(l);}n.push({type:"role",role:"event",optional:false});let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o);let s=[...a.roles.filter(l=>l.required)].sort((l,c)=>{let m=l.svoPosition??999,d=c.svoPosition??999;return m-d});for(let l of s){let c,m;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)c=l.markerOverride[e.code];else {let d=e.roleMarkers[l.role];d&&(c=d.primary,m=d.alternatives);}if(c){let d=m?{type:"literal",value:c,alternatives:m}:{type:"literal",value:c};n.push(d);}n.push({type:"role",role:l.role,optional:false});}let p=s.map(l=>`{${l.role}}`).join(" ");return {id:`${a.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`${t.primary} {event} ${r.primary} ${p}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},...Object.fromEntries(s.map(l=>[l.role,{fromRole:l.role}]))}}}function Ho(a,e,r,t,i){let n=[],o=e.eventHandler?.negationMarker;if(t.position==="before"){let p=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(p);}if(o){let p=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(p);}n.push({type:"role",role:"event",optional:false});let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(u),n.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&n.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:`${a.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${t.primary} ${o?.primary||""} {event} ${r.primary} {patient} ${s?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Uo(a,e,r,t){let i=[];i.push({type:"literal",value:"and",alternatives:["then"]}),i.push({type:"role",role:"event",optional:false});let n=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(n),i.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.destination;return o&&i.push({type:"group",optional:true,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:true}]}),{id:`${a.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(t.basePriority??100)+45,template:{format:`[proclitic?] {event} ${r.primary} {patient} ${o?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var ie={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function Fr(a,e,r=ie){let t=`${a.action}-${e.code}-generated`,i=r.basePriority??100,n=e.keywords[a.action];if(!n)throw new Error(`No keyword translation for '${a.action}' in ${e.code}`);let o=Xo(a,e,n),u=Rr(a,e),s=ru(a,e,n);return {id:t,language:e.code,command:a.action,priority:i,template:{format:s,tokens:o},extraction:u}}function Go(a,e,r=ie){if(a.roles.filter(u=>!u.required).length===0)return null;let i=a.roles.filter(u=>u.required),n={...a,roles:i};return {...Fr(n,e,r),id:`${a.action}-${e.code}-generated-simple`,priority:(r.basePriority??100)-5,extraction:Rr(a,e)}}function Ko(a,e,r=ie){let t=[];if(t.push(Fr(a,e,r)),r.generateSimpleVariants){let i=Go(a,e,r);i&&t.push(i);}return t}function Yo(a,e=ie){let r=[],t=Ro();for(let i of t){if(!a.keywords[i.action])continue;let n=Ko(i,a,e);if(r.push(...n),a.eventHandler?.eventMarker){let o=Qo(i,a,e);r.push(...o);}}return r}function Qo(a,e,r=ie){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let t=[],i=e.eventHandler.eventMarker,n=e.keywords[a.action];if(!n)return [];let u=a.roles.filter(s=>s.required).length===2;if(e.wordOrder==="SOV")if(u)t.push($o(a,e,n,i,r)),t.push(Vo(a,e,n,i,r));else {t.push(Oo(a,e,n,i,r)),t.push(No(a,e,n,i,r));let s=e.roleMarkers.destination;s&&s.primary!==i.primary&&t.push(Io(a,e,n,i,r));let p=i.primary.split(/\s+/),l=i.alternatives?.some(m=>!m.includes(" ")&&m.length>1);p.length>1&&l&&t.push(Mo(a,e,n,i,r)),t.push(Lo(a,e,n,i,r));let c=qo(a,e,n,r);c&&t.push(c);}else e.wordOrder==="VSO"?u?(t.push(zr(a,e,n,i,r)),t.push(Wo(a,e,n,i,r))):(t.push(kr(a,e,n,i,r)),t.push(jo(a,e,n,i,r)),e.eventHandler?.negationMarker&&t.push(Ho(a,e,n,i,r)),e.tokenization?.prefixes&&t.push(Uo(a,e,n,r))):u?t.push(zr(a,e,n,i,r)):t.push(kr(a,e,n,i,r));return t}function Xo(a,e,r){let t=[],i=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary},n=Jo(a,e);switch(e.wordOrder){case "SVO":t.push(i),t.push(...n);break;case "SOV":t.push(...n),t.push(i);break;case "VSO":t.push(i),t.push(...n);break;default:t.push(i),t.push(...n);}return t}function Jo(a,e){let r=[],t=Pr(a.roles,e.wordOrder);for(let i of t){let n=Zo(i,e);i.required?r.push(...n):r.push({type:"group",optional:true,tokens:n});}return r}function Zo(a,e){let r=[],t=a.markerOverride?.[e.code],i=e.roleMarkers[a.role],n={type:"role",role:a.role,optional:!a.required,expectedTypes:a.expectedTypes};if(t!==void 0){let o=t?t.split(/\s+/).filter(Boolean):[];if((i?.position??"before")==="before"){for(let s of o)r.push({type:"literal",value:s});r.push(n);}else {r.push(n);for(let s of o)r.push({type:"literal",value:s});}}else if(i)if(i.position==="before"){if(i.primary){let o=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};r.push(o);}r.push(n);}else {r.push(n);let o=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};r.push(o);}else r.push(n);return r}function eu(a,e){let r={};for(let t of a.roles){let i=t.markerOverride?.[e.code],n=e.roleMarkers[t.role];i!==void 0?r[t.role]=i?{marker:i}:{}:n&&n.primary?r[t.role]=n.alternatives?{marker:n.primary,markerAlternatives:n.alternatives}:{marker:n.primary}:r[t.role]={};}return r}function Rr(a,e){let r=eu(a,e),t={};for(let i of a.roles){let n=r[i.role]||{};!i.required&&i.default?t[i.role]={...n,default:i.default}:t[i.role]=n;}return t}function ru(a,e,r){let t=[],n=Pr(a.roles,e.wordOrder).map(o=>{let u=_o(o,e),s="";return u&&u.primary?u.position==="before"?s=`${u.primary} {${o.role}}`:s=`{${o.role}} ${u.primary}`:s=`{${o.role}}`,o.required?s:`[${s}]`});switch(e.wordOrder){case "SVO":case "VSO":t.push(r.primary,...n);break;case "SOV":t.push(...n,r.primary);break;default:t.push(r.primary,...n);}return t.join(" ")}function tu(){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 au(){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 iu(){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 nu(){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 ou(){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 uu(){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 su(){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 lu(){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 pu(){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 cu(){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 mu(){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 du(){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 yu(a){switch(a){case "bn":return tu();case "en":return au();case "es":return iu();case "hi":return nu();case "it":return ou();case "pl":return uu();case "qu":return su();case "ru":return lu();case "th":return pu();case "uk":return cu();case "vi":return mu();case "zh":return du();default:return []}}function fu(){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 vu(){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 hu(){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 gu(){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 Eu(){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 ku(){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 zu(){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 bu(){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 Cu(){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 Au(){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 wu(){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 xu(){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 Tu(a){switch(a){case "bn":return fu();case "en":return vu();case "es":return hu();case "hi":return gu();case "id":return Eu();case "it":return ku();case "pl":return zu();case "ru":return bu();case "th":return Cu();case "uk":return Au();case "vi":return wu();case "zh":return xu();default:return []}}function Du(){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 Su(){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 Bu(){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 Pu(){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 Fu(){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 Ru(){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 _u(){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 Ou(){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 Nu(){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 Iu(){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 Mu(){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 Lu(){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 qu(){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 $u(){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 Vu(){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 ju(){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 Wu(){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 Hu(){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 Uu(){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 Gu(a){switch(a){case "bn":return Du();case "de":return Su();case "en":return Bu();case "es":return Pu();case "fr":return Fu();case "hi":return Ru();case "id":return _u();case "it":return Ou();case "ms":return Nu();case "pl":return Iu();case "pt":return Mu();case "qu":return Lu();case "ru":return qu();case "sw":return $u();case "th":return Vu();case "tl":return ju();case "uk":return Wu();case "vi":return Hu();case "zh":return Uu();default:return []}}var Ku={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"}}},Yu={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}}},Qu={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}}},Xu={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"}}}},Ju={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"}}}},Zu={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"}}},es={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"}}}},rs={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}}},ts={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}}},as={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}}},is={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 ns(){let a=[];a.push(...yu("en")),a.push(...Tu("en")),a.push(...Gu("en")),a.push(Ku,Yu,Qu,Xu,Ju,Zu,es,rs,ts,as,is);let e=Yo(Te);return a.push(...e),a}ur("en",kn,Te);lr("en",ns());function de(a){let e=a.getAttribute("data-lang");if(e)return De(e);let r=a.getAttribute("data-hyperscript-lang")??a.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(r)return De(r);let t=typeof document<"u"?document.documentElement?.lang:null;return t&&t!=="en"?De(t):null}function De(a){return a.split("-")[0].toLowerCase()}var _r={add:[["patient",""],["destination","to"]],append:[["patient",""],["destination","to"]],async:[],beep:[["patient",""]],behavior:[["patient",""]],blur:[["patient",""]],break:[],breakpoint:[],call:[["patient",""]],clear:[["patient",""]],clone:[["patient",""],["destination","into"]],close:[["patient",""]],compound:[],continue:[],copy:[["patient",""]],decrement:[["patient",""],["quantity","by"]],default:[["destination",""],["patient","to"]],else:[],empty:[["patient",""]],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"]],open:[["style","as"],["patient",""]],pick:[["patient",""],["source","from"]],prepend:[["patient",""],["destination","to"]],process:[["patient","partials in"]],push:[["patient","url"]],put:[["patient",""],["destination","into"]],remove:[["patient",""],["source","from"]],render:[["patient",""],["style","with"]],repeat:[["quantity",""],["condition","until"]],replace:[["patient","url"]],reset:[["patient",""]],return:[["patient",""]],scroll:[["destination","to"]],select:[["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:[["duration",""]],while:[["condition",""]]};function ye(a){switch(a.kind){case "event-handler":return os(a);case "compound":return us(a);default:return ss(a)}}function os(a){let e=["on"],r=a.roles.get("event");r&&e.push(ne(r));let t=a.roles.get("source");if(t&&e.push("from",ne(t)),a.body&&a.body.length>0){let i=a.body.map(ye);e.push(i.join(" then "));}return e.join(" ")}function us(a){let e=a.chainType==="async"?"async":a.chainType;return a.statements.map(ye).join(` ${e} `)}function ss(a){let e=_r[a.action];if(e){let t=[a.action];for(let[i,n]of e){let o=a.roles.get(i);o&&(i==="destination"&&o.type==="reference"&&o.value==="me"||(n&&t.push(n),t.push(ne(o))));}return t.join(" ")}let r=[a.action];for(let[,t]of a.roles)r.push(ne(t));return r.join(" ")}function ne(a){switch(a.type){case "literal":return typeof a.value=="string"&&a.dataType==="string"?`"${a.value}"`:String(a.value);case "selector":return a.value;case "reference":return a.value;case "property-path":return ls(a);case "expression":return a.raw;case "flag":return a.enabled?`+${a.name}`:`~${a.name}`}}function ls(a){let e=ne(a.object),r=a.property;if(a.object.type==="reference")switch(a.object.value){case "me":return `my ${r}`;case "it":return `its ${r}`;case "you":return `your ${r}`}return `${e}'s ${r}`}var Nr=.5,ps={confidenceThreshold:Nr,strategy:"semantic",fallbackToOriginal:true};function cs(a,e){return typeof a=="number"?a:a[e]??a["*"]??Nr}function Se(a,e,r={}){let t={...ps,...r},i=Or(a,e,t);if(i!==null)return i;let n=ds(a);if(n){let o=Or(n.commands,e,t);if(o!==null)return n.prefix+o}return a}function Or(a,e,r){if(r.strategy==="semantic"||r.strategy==="auto"){let t=cs(r.confidenceThreshold,e),i=Ir(a,e,t);if(i!==null)return i}if((r.strategy==="auto"||r.strategy==="i18n")&&r.i18nToEnglish){let t=ys(a,e,r.i18nToEnglish);if(t!==null)return t}return null}var ms=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function ds(a){let e=a.match(ms);if(!e)return null;let r=e[1],t=a.slice(r.length);return t?{prefix:r,commands:t}:null}function Ir(a,e,r){try{let t=vs(a,e);if(t.length>1)return hs(t,e,r);if(!pr(e))return null;let i=yr(a,e);return i.confidence<r||!i.node?null:ye(i.node)}catch{return null}}function ys(a,e,r){try{let t=r(a,e);return t!==a?t:null}catch{return null}}function fs(a){let e=["then"],r=q(a);if(r?.keywords?.then){let t=r.keywords.then;if(t.primary&&t.primary!=="then"&&e.push(t.primary),t.alternatives)for(let i of t.alternatives)e.includes(i)||e.push(i);}return e}function vs(a,e){let t=fs(e).map(u=>u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),i=new RegExp(`\\s+(?:${t.join("|")})\\s+`,"i"),n=a.split(`
|
|
6
|
+
`).map(u=>u.trim()).filter(u=>u.length>0),o=[];for(let u of n){let s=u.split(i);o.push(...s);}return o}function hs(a,e,r){let t=[];for(let i of a){let n=Ir(i.trim(),e,r);if(n===null)return null;t.push(n);}return t.join(" then ")}function Be(a={}){return function(r){let{internals:t}=r,i=t.runtime,n=i.getScript.bind(i);i.getScript=function(o){let u=n(o);if(!u)return null;let s=gs(o,a);if(!s||s==="en")return u;let p=Se(u,s,a);return a.debug&&p!==u&&console.log(`[hyperscript-i18n] ${s}: "${u}" \u2192 "${p}"`),p};}}function gs(a,e){if(e.languageAttribute){let t=a.getAttribute(e.languageAttribute);if(t)return t.split("-")[0].toLowerCase()}let r=de(a);return r||(e.defaultLanguage??null)}function Mr(a,e,r={}){return e==="en"?a:Se(a,e,r)}sr(a=>hr(a));function Lr(){typeof _hyperscript<"u"&&_hyperscript.use&&(_hyperscript.use(Be()),Es());}function Es(){if(typeof document>"u")return;let e=_hyperscript?.internals?.runtime;if(!e?.processNode||!e?.getInternalData)return;let r=e.getScriptSelector?.()??"[_], [script], [data-script]";document.querySelectorAll(r).forEach(t=>{let i=e.getInternalData(t);i.initialized&&(i.initialized=false);}),e.processNode(document.body);}var Ml=["en"];Lr();exports.plugin=Be;exports.preprocess=Mr;exports.resolveLanguage=de;exports.supportedLanguages=Ml;return exports;})({});
|