@lokascript/hyperscript-adapter 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/dist/hyperscript-i18n-ar.global.js +4 -4
- package/dist/hyperscript-i18n-bn.global.js +4 -4
- package/dist/hyperscript-i18n-de.global.js +4 -4
- package/dist/hyperscript-i18n-east-asian.global.js +4 -4
- package/dist/hyperscript-i18n-en.global.js +6 -6
- package/dist/hyperscript-i18n-es.global.js +4 -4
- package/dist/hyperscript-i18n-fr.global.js +4 -4
- package/dist/hyperscript-i18n-he.global.js +4 -4
- package/dist/hyperscript-i18n-hi.global.js +4 -4
- package/dist/hyperscript-i18n-id.global.js +4 -4
- package/dist/hyperscript-i18n-it.global.js +4 -4
- package/dist/hyperscript-i18n-ja.global.js +4 -4
- package/dist/hyperscript-i18n-ko.global.js +4 -4
- package/dist/hyperscript-i18n-ms.global.js +4 -4
- package/dist/hyperscript-i18n-pl.global.js +4 -4
- package/dist/hyperscript-i18n-pt.global.js +4 -4
- package/dist/hyperscript-i18n-qu.global.js +4 -4
- package/dist/hyperscript-i18n-ru.global.js +4 -4
- package/dist/hyperscript-i18n-slavic.global.js +4 -4
- package/dist/hyperscript-i18n-south-asian.global.js +4 -4
- package/dist/hyperscript-i18n-southeast-asian.global.js +4 -4
- package/dist/hyperscript-i18n-sw.global.js +4 -4
- package/dist/hyperscript-i18n-th.global.js +4 -4
- package/dist/hyperscript-i18n-tl.global.js +4 -4
- package/dist/hyperscript-i18n-tr.global.js +4 -4
- package/dist/hyperscript-i18n-uk.global.js +4 -4
- package/dist/hyperscript-i18n-vi.global.js +4 -4
- package/dist/hyperscript-i18n-western.global.js +4 -4
- package/dist/hyperscript-i18n-zh.global.js +4 -4
- package/dist/hyperscript-i18n.global.js +24 -35
- package/dist/hyperscript-i18n.global.js.map +1 -1
- package/dist/index.cjs +8 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +10 -16
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/generated/syntax-table.ts +12 -1
- package/src/preprocessor.ts +12 -22
- package/src/slim-preprocessor.ts +6 -24
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var HyperscriptI18n=(function(exports){'use strict';function P(t,e){return e?{type:"literal",value:t,dataType:e}:{type:"literal",value:t}}function ye(t,e){return e?{type:"selector",value:t,selectorKind:e}:{type:"selector",value:t}}function ae(t){return {type:"reference",value:t}}function ge(t,e){return {type:"property-path",object:t,property:e}}var Ot=class{constructor(t){this.namespace=t,this.enabled=this.checkEnabled();}checkEnabled(){if(typeof process<"u"&&process.env){let t=process.env.DEBUG||"";return t==="*"||t.includes("framework:*")||t.includes(`framework:${this.namespace}`)}return false}log(t,e,...r){if(!this.enabled)return;let n=`[framework:${this.namespace}]`,i=new Date().toISOString();switch(t){case "debug":console.debug(`${i} ${n} DEBUG:`,e,...r);break;case "info":console.info(`${i} ${n} INFO:`,e,...r);break;case "warn":console.warn(`${i} ${n} WARN:`,e,...r);break;case "error":console.error(`${i} ${n} ERROR:`,e,...r);break}}debug(t,...e){this.log("debug",t,...e);}info(t,...e){this.log("info",t,...e);}warn(t,...e){this.log("warn",t,...e);}error(t,...e){this.log("error",t,...e);}isEnabled(){return this.enabled}enable(){this.enabled=true;}disable(){this.enabled=false;}};function It(t){return new Ot(t)}function B(t,e){return !e||e.length===0||e.includes(t)||e.includes("expression")?true:t==="property-path"?e.some(r=>["selector","reference","expression"].includes(r)):false}function _t(t,e){return t?.possessive?.keywords?.[e]}var Q=class ${constructor(){this.logger=It("pattern-matcher"),this.stemMatchCount=0,this.totalKeywordMatches=0;}safeToLowerCase(e){return typeof e=="string"?e.toLowerCase():e==null?"":String(e).toLowerCase()}matchPattern(e,r,n){let i=e.mark(),o=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 a=[];for(let l=0;l<10;l++){let c=e.peek(l);if(c)a.push({type:c.type,value:c.value,kind:c.kind});else break}this.logger.debug("Input tokens (first 10):",a),this.logger.debug("Profile code:",n?.code);}this.currentProfile=n,this.stemMatchCount=0,this.totalKeywordMatches=0,this.logger.debug("--- Calling matchTokenSequence ---"),this.logger.debug("Pattern tokens to match:",JSON.stringify(r.template.tokens,null,2));let s=this.matchTokenSequence(e,r.template.tokens,o);if(this.logger.debug("matchTokenSequence returned:",s),this.logger.debug("Captured roles:",Array.from(o.entries()).map(([a,l])=>[a,JSON.stringify(l)])),!s)return this.logger.debug(">>> MATCH FAILED - resetting token position"),e.reset(i),null;let u=this.calculateConfidence(r,o);return this.applyExtractionRules(r,o),{pattern:r,captured:o,consumedTokens:e.position()-i.position,confidence:u}}matchBest(e,r,n){let i=[];for(let s of r){let u=e.mark(),a=this.matchPattern(e,s,n);a&&i.push(a),e.reset(u);}if(i.length===0)return null;i.sort((s,u)=>{let a=u.pattern.priority-s.pattern.priority;if(a!==0)return a;let l=u.confidence-s.confidence;return Math.abs(l)>.001?l:u.consumedTokens-s.consumedTokens});let o=i[0];return this.matchPattern(e,o.pattern),o}matchTokenSequence(e,r,n,i){let o=r[0],s=o?.type==="literal"&&(o.value==="and"||o.value==="then"||o.alternatives?.includes("and")||o.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!s)for(;e.peek()?.kind==="conjunction";)e.advance();let u=null,a=null;for(let l=0;l<r.length;l++){let c=r[l];this.logger.debug(" >> Matching pattern token:",JSON.stringify(c,null,2));let p=e.peek();if(this.logger.debug(" >> Current input token:",p?JSON.stringify({type:p.type,value:p.value,kind:p.kind}):"EOF"),c.type==="role"&&c.greedy){let y=this.collectStopMarkers(r,l+1);if(i)for(let w of i)y.add(w);let E=[];for(;!e.isAtEnd();){let w=e.peek();if(!w||this.isStopMarker(w,y))break;E.push(w.value),e.advance();}if(E.length>0){n.set(c.role,{type:"expression",raw:E.join(" ")}),u=null,a=null;continue}else {if(c.optional)continue;return false}}if(c.type==="group"){let y=this.collectStopMarkers(r,l+1);if(i)for(let w of i)y.add(w);if(this.matchGroupToken(e,c,n,y)){u=null,a=null;continue}if(this.isOptional(c))continue;return false}let d=c.type==="role"&&c.optional===true,f=d?e.mark():null;if(c.type==="role"&&!d){let y=l+1<r.length?r[l+1]:null;if(y?.type==="literal"){let E=e.peek();if(E&&this.getMatchType(E,y.value)!=="none"){if(this.logger.debug(" >> MARKER-STEAL GUARD: current token matches next literal, skipping role"),this.logger.debug(" >> Token match FAILED"),this.isOptional(c))continue;if(u&&a){this.logger.debug(" >> BACKTRACKING: undoing optional role",a),e.reset(u),n.delete(a),u=null,a=null;let w=this.matchPatternToken(e,c,n);if(this.logger.debug(" >> Backtrack retry result:",w),w)continue}return false}}}let g=this.matchPatternToken(e,c,n);if(this.logger.debug(" >> Match result:",g),g){d?(u=f,a=c.role):(u=null,a=null);continue}if(this.logger.debug(" >> Token match FAILED"),!this.isOptional(c)){if(u&&a){this.logger.debug(" >> BACKTRACKING: undoing optional role",a),e.reset(u),n.delete(a),u=null,a=null;let y=this.matchPatternToken(e,c,n);if(this.logger.debug(" >> Backtrack retry result:",y),y)continue}return false}}return true}matchPatternToken(e,r,n){switch(r.type){case "literal":return this.matchLiteralToken(e,r);case "role":return this.matchRoleToken(e,r,n);case "group":return this.matchGroupToken(e,r,n);default:return false}}matchLiteralToken(e,r){let n=e.peek();if(this.logger.debug(" >>> matchLiteralToken: expecting",r.value),this.logger.debug(" >>> matchLiteralToken: got token",n?JSON.stringify({type:n.type,value:n.value,kind:n.kind}):"null"),!n)return this.logger.debug(" >>> matchLiteralToken: FAIL - no token"),false;let i=this.getMatchType(n,r.value);if(this.logger.debug(" >>> matchType for",n.value,"vs",r.value,":",i),i!=="none")return this.totalKeywordMatches++,i==="stem"&&this.stemMatchCount++,e.advance(),true;if(r.alternatives)for(let o of r.alternatives){let s=this.getMatchType(n,o);if(s!=="none")return this.totalKeywordMatches++,s==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,r,n){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 o=this.tryMatchPossessiveExpression(e);if(o)return r.expectedTypes&&r.expectedTypes.length>0&&!B(o.type,r.expectedTypes)?r.optional||false:(n.set(r.role,o),true);let s=this.tryMatchMethodCallExpression(e);if(s)return r.expectedTypes&&r.expectedTypes.length>0&&!B(s.type,r.expectedTypes)?r.optional||false:(n.set(r.role,s),true);let u=this.tryMatchPossessiveSelectorExpression(e);if(u)return r.expectedTypes&&r.expectedTypes.length>0&&!B(u.type,r.expectedTypes)?r.optional||false:(n.set(r.role,u),true);let a=this.tryMatchPropertyAccessExpression(e);if(a)return r.expectedTypes&&r.expectedTypes.length>0&&!B(a.type,r.expectedTypes)?r.optional||false:(n.set(r.role,a),true);let l=this.tryMatchSelectorPropertyExpression(e);if(l)return r.expectedTypes&&r.expectedTypes.length>0&&!B(l.type,r.expectedTypes)?r.optional||false:(n.set(r.role,l),true);this.logger.debug(" >>> Trying tokenToSemanticValue for token:",i?JSON.stringify({value:i.value,kind:i.kind}):"null");let c=this.tokenToSemanticValue(i);return this.logger.debug(" >>> tokenToSemanticValue returned:",c?JSON.stringify(c):"null"),c?(this.logger.debug(" >>> Validating type:",c.type,"against expected:",r.expectedTypes),r.expectedTypes&&r.expectedTypes.length>0&&!B(c.type,r.expectedTypes)?(this.logger.debug(" >>> TYPE MISMATCH - returning",r.optional||false),r.optional||false):(this.logger.debug(" >>> Type validation PASSED"),n.set(r.role,c),e.advance(),true)):r.optional||false}tryMatchPossessiveExpression(e){let r=e.peek();if(!r||!this.currentProfile)return null;let n=r.normalized||r.value,i=this.safeToLowerCase(n),o=_t(this.currentProfile,i);if(!o)return null;let s=e.mark();e.advance();let u=e.peek();if(!u)return e.reset(s),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 a=u.value;u.kind==="selector"&&a.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(a)&&(a=a.substring(1));let l=a;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)l+=e.peek().value,e.advance();let c=e.peek();return c?.kind==="literal"&&c.value.startsWith("(")&&(l+=c.value,e.advance()),ge(ae(o),l)}return e.reset(s),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 n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let o=e.peek();if(!o||o.kind!=="identifier")return e.reset(n),null;e.advance();let s=e.peek();if(!s||s.kind!=="punctuation"||s.value!=="(")return e.reset(n),null;e.advance();let u=[];for(;!e.isAtEnd()&&u.length<$.MAX_METHOD_ARGS;){let l=e.peek();if(!l)break;if(l.kind==="punctuation"&&l.value===")"){e.advance();break}if(l.kind==="punctuation"&&l.value===","){e.advance();continue}u.push(l.value),e.advance();}return {type:"expression",raw:`${r.value}.${o.value}(${u.join(", ")})`}}tryMatchPropertyAccessExpression(e){let r=e.peek();if(!r||r.kind!=="identifier"&&r.kind!=="keyword")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let o=e.peek();if(!o||o.kind!=="identifier")return e.reset(n),null;e.advance();let s=`${r.value}.${o.value}`,u=1;for(;!e.isAtEnd()&&u<$.MAX_PROPERTY_DEPTH;){let l=e.peek();if(!l||l.kind!=="operator"||l.value!==".")break;e.advance();let c=e.peek();if(!c||c.kind!=="identifier")break;e.advance(),s+=`.${c.value}`,u++;}let a=e.peek();if(a&&a.kind==="punctuation"&&a.value==="("){e.advance();let l=[],c=0;for(;!e.isAtEnd()&&l.length<$.MAX_METHOD_ARGS;){let d=e.peek();if(!d)break;if(d.kind==="punctuation"&&d.value===")"){if(c===0){e.advance();break}c--;}if(d.kind==="punctuation"&&d.value==="("&&c++,d.kind==="punctuation"&&d.value===","){e.advance();continue}l.push(d.value),e.advance();}return {type:"expression",raw:`${s}(${l.join(", ")})`}}return {type:"expression",raw:s}}tryMatchPossessiveSelectorExpression(e){let r=e.peek();if(!r||r.kind!=="selector")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="punctuation"||i.value!=="'s")return e.reset(n),null;e.advance();let o=e.peek();return !o||o.kind!=="selector"&&o.kind!=="identifier"?(e.reset(n),null):(e.advance(),ge(ye(r.value),o.value))}tryMatchSelectorPropertyExpression(e){let r=e.peek();if(!r||r.kind!=="selector"||typeof r.value!="string"||!r.value.startsWith("#"))return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="selector"||!i.value.startsWith("."))return e.reset(n),null;let o=e.peek(1);o&&o.kind,e.advance();let s=i.value.slice(1);return ge(ye(r.value),s)}matchGroupToken(e,r,n,i){let o=e.mark(),s=new Set(n.keys());if(this.matchTokenSequence(e,r.tokens,n,i))return true;e.reset(o);for(let l of n.keys())s.has(l)||n.delete(l);if(!r.optional)return false;let a=this.getGroupLeadingMarker(r);if(a)for(let l=1;l<=$.MAX_MARKER_SCAN;l++){let c=e.peek(l);if(!c)break;if((c.normalized||c.value).toLowerCase()===a){this.logger.debug(" >> MARKER SCAN: found",a,"at offset",l,"- skipping intervening tokens");for(let f=0;f<l;f++)e.advance();if(this.matchTokenSequence(e,r.tokens,n,i))return true;e.reset(o);for(let f of n.keys())s.has(f)||n.delete(f);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 n=new Set;for(let i=r;i<e.length;i++){let o=e[i];if(o.type==="literal"){if(n.add(o.value.toLowerCase()),o.alternatives)for(let s of o.alternatives)n.add(s.toLowerCase());break}if(o.type==="group"){for(let s of o.tokens)if(s.type==="literal"){if(n.add(s.value.toLowerCase()),s.alternatives)for(let u of s.alternatives)n.add(u.toLowerCase());break}if(!o.optional)break}}return n}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 ye(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let r=e.normalized||e.value;this.safeToLowerCase(r);return P(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return ae(e.value);this.safeToLowerCase(e.value);return {type:"expression",raw:e.value};case "url":return P(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let i=e.slice(1,-1);return P(i,"string")}if(e==="true")return P(true,"boolean");if(e==="false")return P(false,"boolean");let r=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(r){let i=parseFloat(r[1]);return r[2]?P(e,"duration"):P(i,"number")}let n=parseFloat(e);return isNaN(n)?P(e,"string"):P(n,"number")}applyExtractionRules(e,r){for(let[n,i]of Object.entries(e.extraction))r.has(n)||(i.value!==void 0?r.set(n,{type:"literal",value:i.value}):i.default&&r.set(n,i.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,r){let n=0,i=0,o=l=>e.extraction?.[l]?.default!==void 0;for(let l of e.template.tokens)if(l.type==="role")i+=1,r.has(l.role)&&(n+=1);else if(l.type==="group"){for(let c of l.tokens)if(c.type==="role"){let p=o(c.role),d=.8;i+=d,r.has(c.role)?n+=d:p&&(n+=d*.6);}}let s=i>0?n/i:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){let l=this.stemMatchCount/this.totalKeywordMatches*.15;s=Math.max(.5,s-l);}let u=this.calculateVSOConfidenceBoost(e);s=Math.min(1,s+u);let a=this.arabicPrepositionDisambiguation(e,r);return s=Math.max(0,Math.min(1,s+a)),s}calculateVSOConfidenceBoost(e){if(e.language!=="ar")return 0;let r=e.template.tokens[0];if(!r||r.type!=="literal")return 0;let n=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(n.has(r.value))return .15;if(r.alternatives){for(let i of r.alternatives)if(n.has(i))return .15}return 0}arabicPrepositionDisambiguation(e,r){if(e.language!=="ar")return 0;let n=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[o,s]of r.entries()){let u=i[o];if(!u||u.length===0)continue;let a="metadata"in s?s.metadata:void 0;if(a&&typeof a.prepositionValue=="string"){let l=a.prepositionValue;u.includes(l)?n+=.1:n-=.1;}}return Math.max(-0.1,Math.min(.1,n))}skipNoiseWords(e){let r=e.peek();if(!r)return;let n=this.safeToLowerCase(r.value);if($.ENGLISH_NOISE_WORDS.has(n)){let i=e.mark();e.advance();let o=e.peek();if(o&&o.kind==="selector")return;e.reset(i);}n==="class"&&e.advance();}extractEventModifiers(e){let r={},n=false;for(;!e.isAtEnd();){let i=e.peek();if(!i||i.kind!=="event-modifier")break;let o=i.metadata;if(!o)break;switch(n=true,o.modifierName){case "once":r.once=true;break;case "debounce":typeof o.value=="number"&&(r.debounce=o.value);break;case "throttle":typeof o.value=="number"&&(r.throttle=o.value);break;case "queue":(o.value==="first"||o.value==="last"||o.value==="all"||o.value==="none")&&(r.queue=o.value);break}e.advance();}return n?r:void 0}};Q.MAX_MARKER_SCAN=3;Q.MAX_PROPERTY_DEPTH=10;Q.MAX_METHOD_ARGS=20;Q.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Mt=Q;new Mt;var j=class{constructor(){this.name="string-literal";}canExtract(t,e){let r=t[e];return r==='"'||r==="'"||r==="`"||r==="\u201C"||r==="\u2018"}extract(t,e){let r=t[e];if(r==="\u201C"){let o=1;for(;e+o<t.length;){if(t[e+o]==="\u201D")return o++,{value:t.substring(e,e+o),length:o};o++;}return null}if(r==="\u2018"){let o=1;for(;e+o<t.length;){if(t[e+o]==="\u2019")return o++,{value:t.substring(e,e+o),length:o};o++;}return null}let n=1,i=false;for(;e+n<t.length;){let o=t[e+n];if(i){i=false,n++;continue}if(o==="\\"){i=true,n++;continue}if(o===r)return n++,{value:t.substring(e,e+n),length:n};n++;}return null}},V=class{constructor(){this.name="number";}canExtract(t,e){return /\d/.test(t[e])}extract(t,e){let r=0,n=false;for(;e+r<t.length;){let s=t[e+r];if(/\d/.test(s))r++;else if(s==="."&&!n)n=true,r++;else break}if(r===0)return null;let i=t.substring(e,e+r),o=e+r;if(o<t.length){let s=t.slice(o),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 l of u)if(s.startsWith(l.pattern))return {value:i+l.suffix,length:r+l.pattern.length,metadata:{hasTimeUnit:true}};if(s.startsWith("ms"))return {value:i+"ms",length:r+2,metadata:{hasTimeUnit:true}};let a=[{pattern:"\u79D2",suffix:"s"},{pattern:"\u5206",suffix:"m"}];for(let l of a)if(s.startsWith(l.pattern))return {value:i+l.suffix,length:r+1,metadata:{hasTimeUnit:true}};if(/^[smh](?![a-zA-Z])/.test(s))return {value:i+s[0],length:r+1,metadata:{hasTimeUnit:true}}}return {value:i,length:r}}};function Lt(t){return "setContext"in t&&typeof t.setContext=="function"}function Dt(t){let e={language:t.language,direction:t.direction,lookupKeyword:t.lookupKeyword.bind(t),isKeyword:t.isKeyword.bind(t),isKeywordStart:t.isKeywordStart.bind(t)};return t.normalizer?{...e,normalizer:t.normalizer}:e}var Ft=new Set(["me","you","it","result","event","target","body"]);function Me(t,e=Ft){return e.has(t)}var ee=class{constructor(t,e){this.pos=0,this.tokens=t,this.language=e;}peek(t=0){let e=this.pos+t;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(t){this.pos=t.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(t){let e=[];for(;!this.isAtEnd()&&t(this.peek());)e.push(this.advance());return e}skipWhile(t){for(;!this.isAtEnd()&&t(this.peek());)this.advance();}};function S(t,e){return {start:t,end:e}}function C(t,e,r,n){if(typeof t=="object"){let{value:o,kind:s,position:u,normalized:a,stem:l,stemConfidence:c,metadata:p}=t;return {value:o,kind:s,position:u,...a!==void 0&&{normalized:a},...l!==void 0&&{stem:l},...c!==void 0&&{stemConfidence:c},...p!==void 0&&{metadata:p}}}let i=t;if(!e||!r)throw new Error("createToken requires kind and position parameters");if(typeof n=="string")return {value:i,kind:e,position:r,normalized:n};if(n){let{normalized:o,stem:s,stemConfidence:u,metadata:a}=n;return {value:i,kind:e,position:r,...o!==void 0&&{normalized:o},...s!==void 0&&{stem:s},...u!==void 0&&{stemConfidence:u},...a!==void 0&&{metadata:a}}}return {value:i,kind:e,position:r}}function J(t){return /\s/.test(t)}function $t(t){return t==="#"||t==="."||t==="["||t==="@"||t==="*"||t==="<"}function jt(t){return t==='"'||t==="'"||t==="`"||t==="\u300C"||t==="\u300D"}function M(t){return /\d/.test(t)}function Vt(t){return /[a-zA-Z]/.test(t)}function A(t){return /[a-zA-Z0-9_-]/.test(t)}function Wt(t,e){if(e>=t.length)return null;let r=t[e];if(!$t(r))return null;let n=e,i="";if(r==="#"||r==="."){for(i+=t[n++];n<t.length&&A(t[n]);)i+=t[n++];if(i.length<=1)return null;if(n<t.length&&t[n]==="."&&r==="#"){let s=n+1;for(;s<t.length&&A(t[s]);)s++;if(s<t.length&&t[s]==="(")return i}}else if(r==="["){let o=1,s=false,u=null,a=false;for(i+=t[n++];n<t.length&&o>0;){let l=t[n];i+=l,a?a=false:l==="\\"?a=true:s?l===u&&(s=false,u=null):l==='"'||l==="'"||l==="`"?(s=true,u=l):l==="["?o++:l==="]"&&o--,n++;}if(o!==0)return null}else if(r==="@"){for(i+=t[n++];n<t.length&&A(t[n]);)i+=t[n++];if(i.length<=1)return null}else if(r==="*"){for(i+=t[n++];n<t.length&&A(t[n]);)i+=t[n++];if(i.length<=1)return null}else if(r==="<"){if(i+=t[n++],n>=t.length||!Vt(t[n]))return null;for(;n<t.length&&A(t[n]);)i+=t[n++];for(;n<t.length;){let o=t[n];if(o==="."){if(i+=t[n++],n>=t.length||!A(t[n]))return null;for(;n<t.length&&A(t[n]);)i+=t[n++];}else if(o==="#"){if(i+=t[n++],n>=t.length||!A(t[n]))return null;for(;n<t.length&&A(t[n]);)i+=t[n++];}else if(o==="["){let s=1,u=false,a=null,l=false;for(i+=t[n++];n<t.length&&s>0;){let c=t[n];i+=c,l?l=false:c==="\\"?l=true:u?c===a&&(u=false,a=null):c==='"'||c==="'"||c==="`"?(u=true,a=c):c==="["?s++:c==="]"&&s--,n++;}if(s!==0)return null}else break}for(;n<t.length&&J(t[n]);)i+=t[n++];if(n<t.length&&t[n]==="/")for(i+=t[n++];n<t.length&&J(t[n]);)i+=t[n++];if(n>=t.length||t[n]!==">")return null;i+=t[n++];}return i||null}function qt(t,e){if(e>=t.length||t[e]!=="'"||e+1>=t.length||t[e+1].toLowerCase()!=="s")return false;if(e+2>=t.length)return true;let n=t[e+2];return J(n)||n==="*"||!A(n)}function Ut(t,e){if(e>=t.length)return null;let r=t[e];if(!jt(r)||r==="'"&&qt(t,e))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[r];if(!i)return null;let o=e+1,s=r,u=false;for(;o<t.length;){let a=t[o];if(s+=a,u)u=false;else if(a==="\\")u=true;else if(a===i)return s;o++;}return s}function Kt(t,e){if(e>=t.length)return false;let r=t[e],n=t[e+1]||"",i=t[e+2]||"";if(r==="/"&&n!=="/"&&/[a-zA-Z0-9._-]/.test(n)||r==="/"&&n==="/"&&/[a-zA-Z]/.test(i)||r==="."&&(n==="/"||n==="."&&i==="/"))return true;let o=t.slice(e,e+8).toLowerCase();return !!(o.startsWith("http://")||o.startsWith("https://"))}function Gt(t,e){if(!Kt(t,e))return null;let r=e,n="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;r<t.length;){let o=t[r];if(o==="#"){if(n.length>0&&/[a-zA-Z0-9/.]$/.test(n))for(n+=o,r++;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)n+=t[r++];break}if(i.test(o))n+=o,r++;else break}return n.length<2?null:n}function Ht(t,e){if(e>=t.length)return null;let r=t[e];if(!M(r)&&r!=="-"&&r!=="+")return null;let n=e,i="";if((t[n]==="-"||t[n]==="+")&&(i+=t[n++]),n>=t.length||!M(t[n]))return null;for(;n<t.length&&M(t[n]);)i+=t[n++];if(n<t.length&&t[n]===".")for(i+=t[n++];n<t.length&&M(t[n]);)i+=t[n++];return n<t.length&&(t.slice(n,n+2)==="ms"?i+="ms":(t[n]==="s"||t[n]==="m"||t[n]==="h")&&(i+=t[n])),i}var Yt=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(Yt);var De=class Fe{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map,this.extractors=[];}tokenize(e){if(this.isUsingExtractors())return this.tokenizeWithExtractors(e);throw new Error(`${this.constructor.name}: tokenize() not implemented and no extractors registered. Either register extractors or override tokenize() method.`)}registerExtractor(e){Lt(e)&&e.setContext(Dt(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=[],n=0;for(;n<e.length;){for(;n<e.length&&J(e[n]);)n++;if(n>=e.length)break;let i=false;for(let o of this.extractors)if(o.canExtract(e,n)){let s=o.extract(e,n);if(s){let u=s.metadata?.normalized,a=s.metadata?.stem,l=s.metadata?.stemConfidence,c={};if(s.metadata)for(let[d,f]of Object.entries(s.metadata))d!=="normalized"&&d!=="stem"&&d!=="stemConfidence"&&(c[d]=f);let p={};u&&(p.normalized=u),a&&(p.stem=a),l!==void 0&&(p.stemConfidence=l),Object.keys(c).length>0&&(p.metadata=c),r.push(C(s.value,this.classifyToken(s.value),S(n,n+s.length),Object.keys(p).length>0?p:void 0)),n+=s.length,i=true;break}}if(!i){let o=e[n],s=this.classifyUnknownChar(o);r.push(C(o,s,S(n,n+1))),n++;}}return new ee(r,this.language)}classifyUnknownChar(e){return "()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,r,n){if(e[r]!==".")return false;let i=n[n.length-1],o=i&&i.position.end<r;if(i&&!o&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return n.push(C(".","operator",S(r,r+1))),true;let a=r+1;for(;a<e.length&&A(e[a]);)a++;return a<e.length&&e[a]==="("?(n.push(C(".","operator",S(r,r+1))),true):false}initializeKeywordsFromProfile(e,r=[]){let n=new Map;if(e.keywords){for(let[i,o]of Object.entries(e.keywords))if(n.set(o.primary,{native:o.primary,normalized:o.normalized||i}),o.alternatives)for(let s of o.alternatives)n.set(s,{native:s,normalized:o.normalized||i});}if(e.references){for(let[i,o]of Object.entries(e.references))n.set(o,{native:o,normalized:i});for(let i of Object.keys(e.references))n.has(i)||n.set(i,{native:i,normalized:i});}if(e.roleMarkers){for(let[i,o]of Object.entries(e.roleMarkers))if(o.primary&&n.set(o.primary,{native:o.primary,normalized:i}),o.alternatives)for(let s of o.alternatives)n.set(s,{native:s,normalized:i});}if(e.possessive?.keywords)for(let[i,o]of Object.entries(e.possessive.keywords))n.set(i,{native:i,normalized:o});for(let i of r)n.set(i.native,i);this.profileKeywords=Array.from(n.values()).sort((i,o)=>o.native.length-i.native.length),this.profileKeywordMap=new Map;for(let i of this.profileKeywords){this.profileKeywordMap.set(i.native.toLowerCase(),i);let o=this.removeDiacritics(i.native);o!==i.native&&!this.profileKeywordMap.has(o.toLowerCase())&&this.profileKeywordMap.set(o.toLowerCase(),i);}}removeDiacritics(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(e,r){for(let n of this.profileKeywords)if(e.slice(r).startsWith(n.native))return C(n.native,"keyword",S(r,r+n.native.length),n.normalized);return null}isKeywordStart(e,r){let n=e.slice(r);return this.profileKeywords.some(i=>n.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,n){let i=this.tryNormalize(e);if(!i)return null;let o=this.lookupKeyword(i.stem);if(!o)return null;let s={normalized:o.normalized,stem:i.stem,stemConfidence:i.confidence};return C(e,"keyword",S(r,n),s)}trySelector(e,r){let n=Wt(e,r);return n?C(n,"selector",S(r,r+n.length)):null}tryEventModifier(e,r){if(e[r]!==".")return null;let n=e.slice(r).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!n)return null;let i=n[0].replace(/(\s|\.)$/,""),o=i.slice(1).split("(")[0],s=n[1];return {...C(i,"event-modifier",S(r,r+i.length)),metadata:{modifierName:o,value:s?o==="queue"?s:parseInt(s,10):void 0}}}tryString(e,r){let n=Ut(e,r);return n?C(n,"literal",S(r,r+n.length)):null}tryNumber(e,r){let n=Ht(e,r);return n?C(n,"literal",S(r,r+n.length)):null}tryMatchTimeUnit(e,r,n,i=false){let o=r;if(i)for(;o<e.length&&J(e[o]);)o++;let s=e.slice(o);for(let u of n){let a=s.slice(0,u.length);if(u.caseInsensitive?a.toLowerCase()===u.pattern.toLowerCase():a===u.pattern){if(u.notFollowedBy&&(s[u.length]||"")===u.notFollowedBy)continue;if(u.checkBoundary){let c=s[u.length]||"";if(A(c))continue}return {suffix:u.suffix,endPos:o+u.length}}}return null}parseBaseNumber(e,r,n=true){let i=r,o="";if(n&&(e[i]==="-"||e[i]==="+")&&(o+=e[i++]),i>=e.length||!M(e[i]))return null;for(;i<e.length&&M(e[i]);)o+=e[i++];if(i<e.length&&e[i]===".")for(o+=e[i++];i<e.length&&M(e[i]);)o+=e[i++];return !o||o==="-"||o==="+"?null:{number:o,endPos:i}}tryNumberWithTimeUnits(e,r,n,i={}){let{allowSign:o=true,skipWhitespace:s=false}=i,u=this.parseBaseNumber(e,r,o);if(!u)return null;let{number:a,endPos:l}=u,c=[...n,...Fe.STANDARD_TIME_UNITS],p=this.tryMatchTimeUnit(e,l,c,s);return p&&(a+=p.suffix,l=p.endPos),C(a,"literal",S(r,l))}tryUrl(e,r){let n=Gt(e,r);return n?C(n,"url",S(r,r+n.length)):null}tryVariableRef(e,r){if(e[r]!==":"||r+1>=e.length||!A(e[r+1]))return null;let n=r+1;for(;n<e.length&&A(e[n]);)n++;let i=e.slice(r,n);return C(i,"identifier",S(r,n))}tryOperator(e,r){let n=e.slice(r,r+2);if(["==","!=","<=",">=","&&","||","->"].includes(n))return C(n,"operator",S(r,r+2));let i=e[r];return ["<",">","!","+","-","*","/","="].includes(i)?C(i,"operator",S(r,r+1)):["(",")","{","}",",",";",":"].includes(i)?C(i,"punctuation",S(r,r+1)):null}tryMultiCharParticle(e,r,n){for(let i of n)if(e.slice(r,r+i.length)===i)return C(i,"particle",S(r,r+i.length));return null}};De.STANDARD_TIME_UNITS=[{pattern:"ms",suffix:"ms",length:2},{pattern:"s",suffix:"s",length:1,checkBoundary:true},{pattern:"m",suffix:"m",length:1,checkBoundary:true,notFollowedBy:"s"},{pattern:"h",suffix:"h",length:1,checkBoundary:true}];var W=De;function T(t){return {stem:t,confidence:1}}function m(t,e,r){return r?{stem:t,confidence:e,metadata:r}:{stem:t,confidence:e}}var Xt=new Map,Zt=new Map,Jt=new Map;function Qt(t,e,r){Xt.set(t,e),Zt.set(t,r),Jt.delete(t);}function er(t){return /[а-яА-ЯёЁ]/.test(t)}function tr(t){for(let e of t)if(er(e))return true;return false}var Be=new Map([["\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438","\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C"],["\u0434\u043E\u0431\u0430\u0432\u044C","\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C"],["\u0443\u0434\u0430\u043B\u0438","\u0443\u0434\u0430\u043B\u0438\u0442\u044C"],["\u0443\u0431\u0435\u0440\u0438","\u0443\u0431\u0440\u0430\u0442\u044C"],["\u043F\u043E\u043B\u043E\u0436\u0438","\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C"],["\u043F\u043E\u043C\u0435\u0441\u0442\u0438","\u043F\u043E\u043C\u0435\u0441\u0442\u0438\u0442\u044C"],["\u0432\u0441\u0442\u0430\u0432\u044C","\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044C"],["\u0432\u043E\u0437\u044C\u043C\u0438","\u0432\u0437\u044F\u0442\u044C"],["\u0441\u043E\u0437\u0434\u0430\u0439","\u0441\u043E\u0437\u0434\u0430\u0442\u044C"],["\u043A\u043B\u043E\u043D\u0438\u0440\u0443\u0439","\u043A\u043B\u043E\u043D\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u043F\u043E\u043C\u0435\u043D\u044F\u0439","\u043F\u043E\u043C\u0435\u043D\u044F\u0442\u044C"],["\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0438\u0440\u0443\u0439","\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438","\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C"],["\u0437\u0430\u0434\u0430\u0439","\u0437\u0430\u0434\u0430\u0442\u044C"],["\u043F\u043E\u043B\u0443\u0447\u0438","\u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C"],["\u0443\u0432\u0435\u043B\u0438\u0447\u044C","\u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C"],["\u0443\u043C\u0435\u043D\u044C\u0448\u0438","\u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C"],["\u0437\u0430\u043F\u0438\u0448\u0438","\u0437\u0430\u043F\u0438\u0441\u0430\u0442\u044C"],["\u043F\u043E\u043A\u0430\u0436\u0438","\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u044C"],["\u0441\u043A\u0440\u043E\u0439","\u0441\u043A\u0440\u044B\u0442\u044C"],["\u0441\u043F\u0440\u044F\u0447\u044C","\u0441\u043F\u0440\u044F\u0442\u0430\u0442\u044C"],["\u0430\u043D\u0438\u043C\u0438\u0440\u0443\u0439","\u0430\u043D\u0438\u043C\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u0432\u044B\u0437\u043E\u0432\u0438","\u0432\u044B\u0437\u0432\u0430\u0442\u044C"],["\u043E\u0442\u043F\u0440\u0430\u0432\u044C","\u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C"],["\u0441\u0444\u043E\u043A\u0443\u0441\u0438\u0440\u0443\u0439","\u0441\u0444\u043E\u043A\u0443\u0441\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u0440\u0430\u0437\u043C\u043E\u0439","\u0440\u0430\u0437\u043C\u044B\u0442\u044C"],["\u043F\u0435\u0440\u0435\u0439\u0434\u0438","\u043F\u0435\u0440\u0435\u0439\u0442\u0438"],["\u0438\u0434\u0438","\u0438\u0434\u0442\u0438"],["\u0436\u0434\u0438","\u0436\u0434\u0430\u0442\u044C"],["\u043F\u043E\u0434\u043E\u0436\u0434\u0438","\u043F\u043E\u0434\u043E\u0436\u0434\u0430\u0442\u044C"],["\u0437\u0430\u0433\u0440\u0443\u0437\u0438","\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C"],["\u043F\u043E\u0432\u0442\u043E\u0440\u0438","\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C"],["\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438","\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C"],["\u0431\u0440\u043E\u0441\u044C","\u0431\u0440\u043E\u0441\u0438\u0442\u044C"],["\u0432\u0435\u0440\u043D\u0438","\u0432\u0435\u0440\u043D\u0443\u0442\u044C"],["\u0441\u043A\u0430\u0436\u0438","\u0441\u043A\u0430\u0437\u0430\u0442\u044C"],["\u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u0443\u0439","\u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u0438\u0437\u043C\u0435\u0440\u044C","\u0438\u0437\u043C\u0435\u0440\u0438\u0442\u044C"]]),$e=class{constructor(){this.language="ru";}isNormalizable(t){return t.length<3?false:tr(t)}normalize(t){let e=t.toLowerCase();if(e.endsWith("\u0441\u044F")||e.endsWith("\u0441\u044C")){let s=this.tryReflexiveNormalization(e);if(s)return s}if(e.endsWith("\u0442\u044C")||e.endsWith("\u0442\u0438")||e.endsWith("\u0447\u044C"))return T(t);let r=this.tryImperativeLookup(e);if(r)return r;let n=this.tryPastTenseNormalization(e);if(n)return n;let i=this.tryPresentTenseNormalization(e);if(i)return i;let o=this.tryGenericImperativeNormalization(e);return o||T(t)}tryReflexiveNormalization(t){(t.endsWith("\u0441\u044F"),2);let r=t.slice(0,-2);if(t.endsWith("\u0442\u044C\u0441\u044F")||t.endsWith("\u0442\u0438\u0441\u044C")||t.endsWith("\u0447\u044C\u0441\u044F"))return T(t);let n=this.normalizeNonReflexive(r);if(n.confidence<1){let i=n.stem.endsWith("\u0442\u044C")?n.stem.slice(0,-2)+"\u0442\u044C\u0441\u044F":n.stem+"\u0441\u044F";return m(i,n.confidence*.95,{removedSuffixes:["\u0441\u044F",...n.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}normalizeNonReflexive(t){if(t.endsWith("\u0442\u044C")||t.endsWith("\u0442\u0438")||t.endsWith("\u0447\u044C"))return T(t);let e=this.tryImperativeLookup(t);if(e)return e;let r=this.tryPastTenseNormalization(t);if(r)return r;let n=this.tryPresentTenseNormalization(t);if(n)return n;let i=this.tryGenericImperativeNormalization(t);return i||T(t)}tryImperativeLookup(t){return Be.has(t)?m(Be.get(t),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(t){return t.endsWith("\u0439\u0442\u0435")&&t.length>5?m(t.slice(0,-3)+"\u0442\u044C",.8,{removedSuffixes:["\u0439\u0442\u0435"],conjugationType:"imperative"}):t.endsWith("\u0438\u0442\u0435")&&t.length>5?m(t.slice(0,-3)+"\u0438\u0442\u044C",.8,{removedSuffixes:["\u0438\u0442\u0435"],conjugationType:"imperative"}):t.endsWith("\u0439")&&t.length>3?m(t.slice(0,-1)+"\u0442\u044C",.75,{removedSuffixes:["\u0439"],conjugationType:"imperative"}):t.endsWith("\u0438")&&t.length>3?m(t+"\u0442\u044C",.7,{removedSuffixes:["\u0438\u2192\u0438\u0442\u044C"],conjugationType:"imperative"}):null}tryPastTenseNormalization(t){return t.endsWith("\u0430\u043B\u0430")&&t.length>4?m(t.slice(0,-3)+"\u0430\u0442\u044C",.85,{removedSuffixes:["\u0430\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0430")&&t.length>4?m(t.slice(0,-3)+"\u0438\u0442\u044C",.85,{removedSuffixes:["\u0438\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0435\u043B\u043E")&&t.length>4?m(t.slice(0,-3)+"\u0435\u0442\u044C",.82,{removedSuffixes:["\u0435\u043B\u043E"],conjugationType:"past"}):t.endsWith("\u0430\u0431\u043E")&&t.length>4?m(t.slice(0,-3)+"\u0430\u0442\u044C",.82,{removedSuffixes:["\u0430\u0431\u043E"],conjugationType:"past"}):t.endsWith("\u0430\u043B\u0438")&&t.length>4?m(t.slice(0,-3)+"\u0430\u0442\u044C",.85,{removedSuffixes:["\u0430\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0438")&&t.length>4?m(t.slice(0,-3)+"\u0438\u0442\u044C",.85,{removedSuffixes:["\u0438\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0430\u043B")&&t.length>3?m(t.slice(0,-2)+"\u0430\u0442\u044C",.82,{removedSuffixes:["\u0430\u043B"],conjugationType:"past"}):t.endsWith("\u0438\u043B")&&t.length>3?m(t.slice(0,-2)+"\u0438\u0442\u044C",.82,{removedSuffixes:["\u0438\u043B"],conjugationType:"past"}):null}tryPresentTenseNormalization(t){return t.endsWith("\u0438\u0448\u044C")&&t.length>4?m(t.slice(0,-3)+"\u0438\u0442\u044C",.8,{removedSuffixes:["\u0438\u0448\u044C"],conjugationType:"present"}):t.endsWith("\u0438\u0442")&&t.length>3?m(t.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u0438\u0442"],conjugationType:"present"}):t.endsWith("\u0438\u043C")&&t.length>3?m(t.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u0438\u043C"],conjugationType:"present"}):t.endsWith("\u044F\u0442")&&t.length>3?m(t.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u044F\u0442"],conjugationType:"present"}):t.endsWith("\u0435\u0448\u044C")&&t.length>4?m(t.slice(0,-3)+"\u0430\u0442\u044C",.75,{removedSuffixes:["\u0435\u0448\u044C"],conjugationType:"present"}):t.endsWith("\u0435\u0442")&&t.length>3?m(t.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0435\u0442"],conjugationType:"present"}):t.endsWith("\u0435\u043C")&&t.length>3?m(t.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0435\u043C"],conjugationType:"present"}):t.endsWith("\u044E\u0442")&&t.length>3?m(t.slice(0,-2)+"\u0430\u0442\u044C",.75,{removedSuffixes:["\u044E\u0442"],conjugationType:"present"}):t.endsWith("\u0443\u0442")&&t.length>3?m(t.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0443\u0442"],conjugationType:"present"}):null}},je={code:"ru",name:"Russian",nativeName:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",direction:"ltr",script:"cyrillic",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:true,suffixes:["\u0442\u044C","\u0442\u044C\u0441\u044F","\u0438\u0442\u044C","\u0438\u0442\u044C\u0441\u044F","\u0430\u0442\u044C","\u0430\u0442\u044C\u0441\u044F","\u0435\u0442\u044C","\u0435\u0442\u044C\u0441\u044F"]},references:{me:"\u044F",it:"\u044D\u0442\u043E",you:"\u0442\u044B",result:"\u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442",event:"\u0441\u043E\u0431\u044B\u0442\u0438\u0435",target:"\u0446\u0435\u043B\u044C",body:"body"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:true,specialForms:{me:"\u043C\u043E\u0439",it:"\u0435\u0433\u043E",you:"\u0442\u0432\u043E\u0439"},keywords:{\u043C\u043E\u0439:"me",\u043C\u043E\u044F:"me",\u043C\u043E\u0451:"me",\u043C\u043E\u0438:"me",\u0442\u0432\u043E\u0439:"you",\u0442\u0432\u043E\u044F:"you",\u0442\u0432\u043E\u0451:"you",\u0442\u0432\u043E\u0438:"you",\u0435\u0433\u043E:"it",\u0435\u0451:"it"}},roleMarkers:{destination:{primary:"\u0432",alternatives:["\u043D\u0430","\u043A"],position:"before"},source:{primary:"\u0438\u0437",alternatives:["\u043E\u0442","\u0441"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"\u0441",alternatives:["\u0441\u043E"],position:"before"}},keywords:{toggle:{primary:"\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C",alternatives:["\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438"],normalized:"toggle",form:"infinitive"},add:{primary:"\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C",alternatives:["\u0434\u043E\u0431\u0430\u0432\u044C"],normalized:"add",form:"infinitive"},remove:{primary:"\u0443\u0434\u0430\u043B\u0438\u0442\u044C",alternatives:["\u0443\u0434\u0430\u043B\u0438","\u0443\u0431\u0440\u0430\u0442\u044C","\u0443\u0431\u0435\u0440\u0438"],normalized:"remove",form:"infinitive"},put:{primary:"\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"],normalized:"put",form:"infinitive"},append:{primary:"\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C_\u0432_\u043A\u043E\u043D\u0435\u0446",alternatives:["\u0434\u043E\u043F\u0438\u0441\u0430\u0442\u044C"],normalized:"append",form:"infinitive"},prepend:{primary:"\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C_\u0432_\u043D\u0430\u0447\u0430\u043B\u043E",normalized:"prepend",form:"infinitive"},take:{primary:"\u0432\u0437\u044F\u0442\u044C",alternatives:["\u0432\u043E\u0437\u044C\u043C\u0438"],normalized:"take",form:"infinitive"},make:{primary:"\u0441\u043E\u0437\u0434\u0430\u0442\u044C",alternatives:["\u0441\u043E\u0437\u0434\u0430\u0439"],normalized:"make",form:"infinitive"},clone:{primary:"\u043A\u043B\u043E\u043D\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u043A\u043B\u043E\u043D\u0438\u0440\u0443\u0439"],normalized:"clone",form:"infinitive"},swap:{primary:"\u043F\u043E\u043C\u0435\u043D\u044F\u0442\u044C",alternatives:["\u043F\u043E\u043C\u0435\u043D\u044F\u0439"],normalized:"swap",form:"infinitive"},morph:{primary:"\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0438\u0440\u0443\u0439"],normalized:"morph",form:"infinitive"},set:{primary:"\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C",alternatives:["\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438","\u0437\u0430\u0434\u0430\u0442\u044C","\u0437\u0430\u0434\u0430\u0439"],normalized:"set",form:"infinitive"},get:{primary:"\u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C",alternatives:["\u043F\u043E\u043B\u0443\u0447\u0438"],normalized:"get",form:"infinitive"},increment:{primary:"\u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C",alternatives:["\u0443\u0432\u0435\u043B\u0438\u0447\u044C"],normalized:"increment",form:"infinitive"},decrement:{primary:"\u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C",alternatives:["\u0443\u043C\u0435\u043D\u044C\u0448\u0438"],normalized:"decrement",form:"infinitive"},log:{primary:"\u0437\u0430\u043F\u0438\u0441\u0430\u0442\u044C",alternatives:["\u0437\u0430\u043F\u0438\u0448\u0438"],normalized:"log",form:"infinitive"},show:{primary:"\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u044C",alternatives:["\u043F\u043E\u043A\u0430\u0436\u0438"],normalized:"show",form:"infinitive"},hide:{primary:"\u0441\u043A\u0440\u044B\u0442\u044C",alternatives:["\u0441\u043A\u0440\u043E\u0439","\u0441\u043F\u0440\u044F\u0442\u0430\u0442\u044C","\u0441\u043F\u0440\u044F\u0447\u044C"],normalized:"hide",form:"infinitive"},transition:{primary:"\u0430\u043D\u0438\u043C\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0430\u043D\u0438\u043C\u0438\u0440\u0443\u0439"],normalized:"transition",form:"infinitive"},on:{primary:"\u043F\u0440\u0438",normalized:"on"},trigger:{primary:"\u0438\u043D\u0438\u0446\u0438\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C","\u0437\u0430\u043F\u0443\u0441\u0442\u0438"],normalized:"trigger",form:"infinitive"},send:{primary:"\u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",alternatives:["\u043E\u0442\u043F\u0440\u0430\u0432\u044C"],normalized:"send",form:"infinitive"},focus:{primary:"\u0441\u0444\u043E\u043A\u0443\u0441\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0441\u0444\u043E\u043A\u0443\u0441\u0438\u0440\u0443\u0439","\u0444\u043E\u043A\u0443\u0441"],normalized:"focus",form:"infinitive"},blur:{primary:"\u0440\u0430\u0437\u043C\u044B\u0442\u044C",alternatives:["\u0440\u0430\u0437\u043C\u043E\u0439"],normalized:"blur",form:"infinitive"},click:{primary:"\u043A\u043B\u0438\u043A",alternatives:["\u043A\u043B\u0438\u043A\u0435","\u043D\u0430\u0436\u0430\u0442\u0438\u0438"],normalized:"click"},hover:{primary:"\u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0438",alternatives:["\u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0435"],normalized:"hover"},submit:{primary:"\u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0435",alternatives:["\u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0430"],normalized:"submit"},input:{primary:"\u0432\u0432\u043E\u0434\u0435",alternatives:["\u0432\u0432\u043E\u0434"],normalized:"input"},change:{primary:"\u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0438",alternatives:["\u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0435"],normalized:"change"},go:{primary:"\u043F\u0435\u0440\u0435\u0439\u0442\u0438",alternatives:["\u043F\u0435\u0440\u0435\u0439\u0434\u0438","\u0438\u0434\u0442\u0438","\u0438\u0434\u0438"],normalized:"go",form:"infinitive"},wait:{primary:"\u0436\u0434\u0430\u0442\u044C",alternatives:["\u0436\u0434\u0438","\u043F\u043E\u0434\u043E\u0436\u0434\u0438"],normalized:"wait",form:"infinitive"},fetch:{primary:"\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C",alternatives:["\u0437\u0430\u0433\u0440\u0443\u0437\u0438"],normalized:"fetch",form:"infinitive"},settle:{primary:"\u0441\u0442\u0430\u0431\u0438\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u0442\u044C",normalized:"settle",form:"infinitive"},if:{primary:"\u0435\u0441\u043B\u0438",normalized:"if"},when:{primary:"\u043A\u043E\u0433\u0434\u0430",normalized:"when"},where:{primary:"\u0433\u0434\u0435",normalized:"where"},else:{primary:"\u0438\u043D\u0430\u0447\u0435",normalized:"else"},repeat:{primary:"\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C",alternatives:["\u043F\u043E\u0432\u0442\u043E\u0440\u0438"],normalized:"repeat",form:"infinitive"},for:{primary:"\u0434\u043B\u044F",alternatives:["\u043A\u0430\u0436\u0434\u044B\u0439"],normalized:"for"},while:{primary:"\u043F\u043E\u043A\u0430",normalized:"while"},continue:{primary:"\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C",alternatives:["\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438"],normalized:"continue",form:"infinitive"},halt:{primary:"\u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C",alternatives:["\u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0441\u044C","\u0441\u0442\u043E\u043F"],normalized:"halt",form:"infinitive"},throw:{primary:"\u0431\u0440\u043E\u0441\u0438\u0442\u044C",alternatives:["\u0431\u0440\u043E\u0441\u044C"],normalized:"throw",form:"infinitive"},call:{primary:"\u0432\u044B\u0437\u0432\u0430\u0442\u044C",alternatives:["\u0432\u044B\u0437\u043E\u0432\u0438"],normalized:"call",form:"infinitive"},return:{primary:"\u0432\u0435\u0440\u043D\u0443\u0442\u044C",alternatives:["\u0432\u0435\u0440\u043D\u0438"],normalized:"return",form:"infinitive"},then:{primary:"\u0437\u0430\u0442\u0435\u043C",alternatives:["\u043F\u043E\u0442\u043E\u043C","\u0442\u043E\u0433\u0434\u0430"],normalized:"then"},and:{primary:"\u0438",normalized:"and"},end:{primary:"\u043A\u043E\u043D\u0435\u0446",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"\u0430\u0441\u0438\u043D\u0445\u0440\u043E\u043D\u043D\u043E",alternatives:["async"],normalized:"async"},tell:{primary:"\u0441\u043A\u0430\u0437\u0430\u0442\u044C",alternatives:["\u0441\u043A\u0430\u0436\u0438"],normalized:"tell",form:"infinitive"},default:{primary:"\u043F\u043E_\u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E",normalized:"default"},init:{primary:"\u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u0443\u0439"],normalized:"init",form:"infinitive"},behavior:{primary:"\u043F\u043E\u0432\u0435\u0434\u0435\u043D\u0438\u0435",normalized:"behavior"},install:{primary:"\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C_\u043F\u0430\u043A\u0435\u0442",normalized:"install",form:"infinitive"},measure:{primary:"\u0438\u0437\u043C\u0435\u0440\u0438\u0442\u044C",alternatives:["\u0438\u0437\u043C\u0435\u0440\u044C"],normalized:"measure",form:"infinitive"},beep:{primary:"\u0437\u0432\u0443\u043A",normalized:"beep"},break:{primary:"\u043F\u0440\u0435\u0440\u0432\u0430\u0442\u044C",normalized:"break"},copy:{primary:"\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C",normalized:"copy"},exit:{primary:"\u0432\u044B\u0439\u0442\u0438",normalized:"exit"},pick:{primary:"\u0432\u044B\u0431\u0440\u0430\u0442\u044C",normalized:"pick"},render:{primary:"\u043E\u0442\u043E\u0431\u0440\u0430\u0437\u0438\u0442\u044C",normalized:"render"},into:{primary:"\u0432",alternatives:["\u0432\u043E"],normalized:"into"},before:{primary:"\u0434\u043E",alternatives:["\u043F\u0435\u0440\u0435\u0434"],normalized:"before"},after:{primary:"\u043F\u043E\u0441\u043B\u0435",normalized:"after"},until:{primary:"\u043F\u043E\u043A\u0430_\u043D\u0435",normalized:"until"},event:{primary:"\u0441\u043E\u0431\u044B\u0442\u0438\u0435",normalized:"event"},from:{primary:"\u0438\u0437",alternatives:["\u043E\u0442","\u0441"],normalized:"from"}},eventHandler:{keyword:{primary:"\u043F\u0440\u0438",normalized:"on"},sourceMarker:{primary:"\u043D\u0430",alternatives:["\u0432","\u043F\u0440\u0438"],position:"before"},eventMarker:{primary:"\u043F\u0440\u0438",position:"before"},temporalMarkers:["\u043A\u043E\u0433\u0434\u0430","\u0435\u0441\u043B\u0438"]}},rr=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],nr=class{constructor(t=rr){this.name="operator",this.operators=[...t].sort((e,r)=>r.length-e.length);}canExtract(t,e){return this.operators.some(r=>t.startsWith(r,e))}extract(t,e){for(let r of this.operators)if(t.startsWith(r,e))return {value:r,length:r.length};return null}},ir="()[]{},:;",or=class{constructor(t=ir){this.punctuation=t,this.name="punctuation";}canExtract(t,e){return this.punctuation.includes(t[e])}extract(t,e){let r=t[e];return this.punctuation.includes(r)?{value:r,length:1}:null}};function sr(t,e){let r=t[e];if(r==="#"){let n=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);return n?n[0]:null}if(r==="."){let n=t.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return n?n[0]:null}if(r==="["){let n=0,i=e;for(;i<t.length;){if(t[i]==="["&&n++,t[i]==="]"&&(n--,n===0))return t.slice(e,i+1);i++;}return null}if(r==="<"){let n=t.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return n?n[0]:null}return null}var ur=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"}extract(t,e){let r=sr(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},ar=class{constructor(){this.name="event-modifier";}canExtract(t,e){if(t[e]!==".")return false;let r=t.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(r)}extract(t,e){let r=t.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!r)return null;let n=r[0],i=n.slice(1).split("(")[0],o=r[1];return {value:n,length:n.length,metadata:{modifierName:i,value:o?i==="queue"?o:parseInt(o,10):void 0}}}};function lr(t,e){let r=t.slice(e);if(r.startsWith("http://")||r.startsWith("https://")){let n=r.match(/^https?:\/\/[^\s]*/);return n?n[0]:null}if(r.startsWith("//")){let n=r.match(/^\/\/[^\s]*/);return n?n[0]:null}if(r.startsWith("./")||r.startsWith("../")){let n=r.match(/^\.\.?\/[^\s]*/);return n?n[0]:null}if(r.startsWith("/")){let n=r.match(/^\/[^\s]*/);return n?n[0]:null}return null}var cr=class{constructor(){this.name="url";}canExtract(t,e){let r=t.slice(e);return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")||r.startsWith("./")||r.startsWith("../")||r.startsWith("/")}extract(t,e){let r=lr(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},pr=class{constructor(){this.name="variable-ref";}canExtract(t,e){return t[e]===":"&&e+1<t.length&&/[a-zA-Z_]/.test(t[e+1])}extract(t,e){if(!this.canExtract(t,e))return null;let r=1;for(;e+r<t.length&&/[a-zA-Z0-9_]/.test(t[e+r]);)r++;return {value:t.substring(e,e+r),length:r,metadata:{type:"variable-reference"}}}};function dr(t){return {isLetter:n=>t.test(n),isIdentifierChar:n=>/[0-9]/.test(n)||t.test(n)}}var fr=class{constructor(t,e,r){this.name=t;let n=dr(e);this.isLetter=n.isLetter,this.isIdentifierChar=n.isIdentifierChar,this.prepositions=r;}setContext(t){this.context=t;}canExtract(t,e){return this.isLetter(t[e])}extract(t,e){if(!this.context)throw new Error(`${this.name}: context not set`);let r=e,n="";for(;r<t.length&&this.isIdentifierChar(t[r]);)n+=t[r++];if(!n)return null;let i=n.toLowerCase(),o=this.prepositions.has(i),s=this.context.lookupKeyword(i),u=s&&s.normalized!==s.native?s.normalized:void 0,a;if(!s&&this.context.normalizer){let l=this.context.normalizer.normalize(n);if(l.stem!==n&&l.confidence>=.7){let c=this.context.lookupKeyword(l.stem);c&&(a=c.normalized);}}return {value:n,length:r-e,metadata:{normalized:u||a,isPreposition:o}}}},mr=new Set(["\u0432","\u0432\u043E","\u043D\u0430","\u0441","\u0441\u043E","\u043A","\u043A\u043E","\u043E","\u043E\u0431","\u043E\u0431\u043E","\u0443","\u043E\u0442","\u0434\u043E","\u0438\u0437","\u0437\u0430","\u043F\u043E","\u043F\u043E\u0434","\u043D\u0430\u0434","\u043F\u0435\u0440\u0435\u0434","\u043F\u0435\u0440\u0435\u0434\u043E","\u043C\u0435\u0436\u0434\u0443","\u0447\u0435\u0440\u0435\u0437","\u0431\u0435\u0437","\u0434\u043B\u044F","\u043F\u0440\u0438","\u043F\u0440\u043E","\u043F\u043E\u0441\u043B\u0435","\u0432\u043E\u043A\u0440\u0443\u0433","\u043F\u0440\u043E\u0442\u0438\u0432","\u0432\u043C\u0435\u0441\u0442\u043E","\u043A\u0440\u043E\u043C\u0435","\u0441\u0440\u0435\u0434\u0438"]);function hr(){return [new fr("russian-keyword",/[a-zA-Zа-яА-ЯёЁ]/,mr)]}function vr(t){let e=t.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function yr(t){let e=t.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}var gr=class{constructor(){this.name="ascii-identifier";}setContext(t){this.context=t;}canExtract(t,e){return vr(t[e])}extract(t,e){if(!this.context)throw new Error("AsciiIdentifierExtractor: context not set");let r=e,n="",i=e;for(;i<t.length&&yr(t[i]);)n+=t[i],i++;if(!n)return null;let o=this.context.lookupKeyword(n),s=o&&o.normalized!==o.native?o.normalized:void 0;return {value:n,length:i-r,metadata:{normalized:s}}}};function Er(){return [new cr,new ar,new pr,new ur]}var br=new Set(["\u0432","\u0432\u043E","\u043D\u0430","\u0441","\u0441\u043E","\u043A","\u043A\u043E","\u043E","\u043E\u0431","\u043E\u0431\u043E","\u0443","\u043E\u0442","\u0434\u043E","\u0438\u0437","\u0437\u0430","\u043F\u043E","\u043F\u043E\u0434","\u043D\u0430\u0434","\u043F\u0435\u0440\u0435\u0434","\u043F\u0435\u0440\u0435\u0434\u043E","\u043C\u0435\u0436\u0434\u0443","\u0447\u0435\u0440\u0435\u0437","\u0431\u0435\u0437","\u0434\u043B\u044F","\u043F\u0440\u0438","\u043F\u0440\u043E","\u043F\u043E\u0441\u043B\u0435","\u0432\u043E\u043A\u0440\u0443\u0433","\u043F\u0440\u043E\u0442\u0438\u0432","\u0432\u043C\u0435\u0441\u0442\u043E","\u043A\u0440\u043E\u043C\u0435","\u0441\u0440\u0435\u0434\u0438"]),wr=[{native:"\u0438\u0441\u0442\u0438\u043D\u0430",normalized:"true"},{native:"\u043F\u0440\u0430\u0432\u0434\u0430",normalized:"true"},{native:"\u043B\u043E\u0436\u044C",normalized:"false"},{native:"null",normalized:"null"},{native:"\u043D\u0435\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u043E",normalized:"undefined"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434\u0430",normalized:"s"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434\u044B",normalized:"s"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434",normalized:"s"},{native:"\u043C\u0438\u043B\u043B\u0438\u0441\u0435\u043A\u0443\u043D\u0434\u0430",normalized:"ms"},{native:"\u043C\u0438\u043B\u043B\u0438\u0441\u0435\u043A\u0443\u043D\u0434\u044B",normalized:"ms"},{native:"\u043C\u0438\u043B\u043B\u0438\u0441\u0435\u043A\u0443\u043D\u0434",normalized:"ms"},{native:"\u043C\u0438\u043D\u0443\u0442\u0430",normalized:"m"},{native:"\u043C\u0438\u043D\u0443\u0442\u044B",normalized:"m"},{native:"\u043C\u0438\u043D\u0443\u0442",normalized:"m"},{native:"\u0447\u0430\u0441",normalized:"h"},{native:"\u0447\u0430\u0441\u0430",normalized:"h"},{native:"\u0447\u0430\u0441\u043E\u0432",normalized:"h"},{native:"\u043F\u0435\u0440\u0432\u0430\u044F",normalized:"first"},{native:"\u043F\u0435\u0440\u0432\u043E\u0435",normalized:"first"},{native:"\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u044F\u044F",normalized:"last"},{native:"\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u0435",normalized:"last"},{native:"\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0430\u044F",normalized:"next"},{native:"\u043F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0430\u044F",normalized:"previous"},{native:"\u043F\u0443\u0441\u0442\u0430\u044F",normalized:"empty"},{native:"\u043F\u0443\u0441\u0442\u043E\u0435",normalized:"empty"},{native:"\u043C\u043E\u044F",normalized:"my"},{native:"\u043C\u043E\u0451",normalized:"my"},{native:"\u043C\u043E\u0438",normalized:"my"}],Sr=class extends W{constructor(){super(),this.language="ru",this.direction="ltr",this.initializeKeywordsFromProfile(je,wr),this.setNormalizer(new $e),this.registerExtractors([...Er(),...hr(),new j,new V,new gr,new nr,new or]);}classifyToken(t){let e=t.toLowerCase();return br.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(t)?"event-modifier":t.startsWith("#")||t.startsWith(".")||t.startsWith("[")||t.startsWith("*")||t.startsWith("<")?"selector":t.startsWith('"')||t.startsWith("'")||/^\d/.test(t)?"literal":"identifier"}},Cr=new Sr;Qt("ru",Cr,je);var kr=new Map,Tr=new Map,xr=new Map;function Ar(t,e,r){kr.set(t,e),Tr.set(t,r),xr.delete(t);}var We={code:"pl",name:"Polish",nativeName:"Polski",direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"imperative",verb:{position:"start",subjectDrop:true,suffixes:["a\u0107","e\u0107","i\u0107","y\u0107","\u0105\u0107","owa\u0107"]},references:{me:"ja",it:"to",you:"ty",result:"wynik",event:"zdarzenie",target:"cel",body:"body"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:true,specialForms:{me:"m\xF3j",it:"jego",you:"tw\xF3j"},keywords:{m\u00F3j:"me",moja:"me",moje:"me",tw\u00F3j:"you",twoja:"you",twoje:"you",jego:"it",jej:"it"}},roleMarkers:{destination:{primary:"do",alternatives:["w","na"],position:"before"},source:{primary:"z",alternatives:["od","ze"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"z",alternatives:["ze"],position:"before"}},keywords:{toggle:{primary:"prze\u0142\u0105cz",alternatives:["przelacz"],normalized:"toggle",form:"imperative"},add:{primary:"dodaj",normalized:"add",form:"imperative"},remove:{primary:"usu\u0144",alternatives:["usun","wyczy\u015B\u0107","wyczysc"],normalized:"remove",form:"imperative"},put:{primary:"umie\u015B\u0107",alternatives:["umiesc","wstaw"],normalized:"put",form:"imperative"},append:{primary:"do\u0142\u0105cz",alternatives:["dolacz"],normalized:"append",form:"imperative"},prepend:{primary:"poprzed\u017A",alternatives:["poprzedz"],normalized:"prepend",form:"imperative"},take:{primary:"we\u017A",alternatives:["wez"],normalized:"take",form:"imperative"},make:{primary:"utw\xF3rz",alternatives:["utworz","stw\xF3rz","stworz"],normalized:"make",form:"imperative"},clone:{primary:"sklonuj",normalized:"clone",form:"imperative"},swap:{primary:"zamie\u0144",alternatives:["zamien"],normalized:"swap",form:"imperative"},morph:{primary:"przekszta\u0142\u0107",alternatives:["przeksztalc"],normalized:"morph",form:"imperative"},set:{primary:"ustaw",alternatives:["okre\u015Bl","okresl"],normalized:"set",form:"imperative"},get:{primary:"uzyskaj",normalized:"get",form:"imperative"},increment:{primary:"zwi\u0119ksz",alternatives:["zwieksz"],normalized:"increment",form:"imperative"},decrement:{primary:"zmniejsz",normalized:"decrement",form:"imperative"},log:{primary:"loguj",alternatives:["wypisz"],normalized:"log",form:"imperative"},show:{primary:"poka\u017C",alternatives:["pokaz","wy\u015Bwietl","wyswietl"],normalized:"show",form:"imperative"},hide:{primary:"ukryj",alternatives:["schowaj"],normalized:"hide",form:"imperative"},transition:{primary:"animuj",alternatives:["przej\u015Bcie","przejscie"],normalized:"transition",form:"imperative"},on:{primary:"gdy",alternatives:["przy","na"],normalized:"on"},trigger:{primary:"wyzw\xF3l",alternatives:["wyzwol"],normalized:"trigger",form:"imperative"},send:{primary:"wy\u015Blij",alternatives:["wyslij"],normalized:"send",form:"imperative"},focus:{primary:"skup",alternatives:["skupienie"],normalized:"focus",form:"imperative"},blur:{primary:"rozmyj",alternatives:["odskup"],normalized:"blur",form:"imperative"},go:{primary:"id\u017A",alternatives:["idz","przejd\u017A","przejdz","nawiguj"],normalized:"go",form:"imperative"},wait:{primary:"czekaj",alternatives:["poczekaj"],normalized:"wait",form:"imperative"},fetch:{primary:"pobierz",alternatives:["za\u0142aduj","zaladuj"],normalized:"fetch",form:"imperative"},settle:{primary:"ustabilizuj",normalized:"settle",form:"imperative"},if:{primary:"je\u015Bli",alternatives:["jesli","je\u017Celi","jezeli"],normalized:"if"},when:{primary:"kiedy",normalized:"when"},where:{primary:"gdzie",normalized:"where"},else:{primary:"inaczej",alternatives:["wpp"],normalized:"else"},repeat:{primary:"powt\xF3rz",alternatives:["powtorz"],normalized:"repeat",form:"imperative"},for:{primary:"dla",alternatives:["ka\u017Cdy","kazdy"],normalized:"for"},while:{primary:"dop\xF3ki",alternatives:["dopoki","podczas"],normalized:"while"},continue:{primary:"kontynuuj",alternatives:["dalej"],normalized:"continue",form:"imperative"},halt:{primary:"zatrzymaj",alternatives:["stop"],normalized:"halt",form:"imperative"},throw:{primary:"rzu\u0107",alternatives:["rzuc"],normalized:"throw",form:"imperative"},call:{primary:"wywo\u0142aj",alternatives:["wywolaj"],normalized:"call",form:"imperative"},return:{primary:"zwr\xF3\u0107",alternatives:["zwroc"],normalized:"return",form:"imperative"},then:{primary:"wtedy",alternatives:["potem","nast\u0119pnie","nastepnie"],normalized:"then"},and:{primary:"i",alternatives:["oraz"],normalized:"and"},end:{primary:"koniec",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"async",alternatives:["asynchronicznie"],normalized:"async"},tell:{primary:"powiedz",normalized:"tell",form:"imperative"},default:{primary:"domy\u015Blnie",alternatives:["domyslnie"],normalized:"default"},init:{primary:"inicjuj",normalized:"init",form:"imperative"},behavior:{primary:"zachowanie",normalized:"behavior"},install:{primary:"zainstaluj",normalized:"install",form:"imperative"},measure:{primary:"zmierz",normalized:"measure",form:"imperative"},beep:{primary:"sygna\u0142",normalized:"beep"},break:{primary:"przerwij",normalized:"break"},copy:{primary:"kopiuj",normalized:"copy"},exit:{primary:"wyjd\u017A",normalized:"exit"},pick:{primary:"wybierz",normalized:"pick"},render:{primary:"renderuj",normalized:"render"},into:{primary:"do",alternatives:["w"],normalized:"into"},before:{primary:"przed",normalized:"before"},after:{primary:"po",normalized:"after"},click:{primary:"klikni\u0119ciu",alternatives:["klikniecie","klik"],normalized:"click"},hover:{primary:"najechaniu",alternatives:["hover"],normalized:"hover"},submit:{primary:"wys\u0142aniu",alternatives:["wyslaniu","submit"],normalized:"submit"},input:{primary:"wprowadzeniu",alternatives:["input"],normalized:"input"},change:{primary:"zmianie",alternatives:["zmiana"],normalized:"change"},until:{primary:"a\u017C",alternatives:["az"],normalized:"until"},event:{primary:"zdarzenie",normalized:"event"},from:{primary:"z",alternatives:["od","ze"],normalized:"from"}},eventHandler:{keyword:{primary:"gdy",alternatives:["przy","na"],normalized:"on"},sourceMarker:{primary:"na",alternatives:["w","przy"],position:"before"},conditionalKeyword:{primary:"kiedy",alternatives:["gdy","je\u015Bli"]},eventMarker:{primary:"przy",alternatives:["na"],position:"before"},temporalMarkers:["kiedy","gdy","przy"]}},Ve=new Map([["prze\u0142\u0105cz","prze\u0142\u0105cza\u0107"],["przelacz","przelaczac"],["dodaj","dodawa\u0107"],["usu\u0144","usuwa\u0107"],["usun","usuwac"],["umie\u015B\u0107","umieszcza\u0107"],["umiesc","umieszczac"],["wstaw","wstawia\u0107"],["ustaw","ustawia\u0107"],["pobierz","pobiera\u0107"],["we\u017A","bra\u0107"],["wez","brac"],["zwi\u0119ksz","zwi\u0119ksza\u0107"],["zwieksz","zwiekszac"],["zmniejsz","zmniejsza\u0107"],["poka\u017C","pokazywa\u0107"],["pokaz","pokazywac"],["ukryj","ukrywa\u0107"],["schowaj","schowywa\u0107"],["czekaj","czeka\u0107"],["poczekaj","poczeka\u0107"],["id\u017A","i\u015B\u0107"],["idz","isc"],["przejd\u017A","przej\u015B\u0107"],["przejdz","przejsc"],["wywo\u0142aj","wywo\u0142ywa\u0107"],["wywolaj","wywolywac"],["wy\u015Blij","wysy\u0142a\u0107"],["wyslij","wysylac"],["loguj","logowa\u0107"],["wypisz","wypisywa\u0107"],["sklonuj","sklonowa\u0107"],["kopiuj","kopiowa\u0107"],["zamie\u0144","zamienia\u0107"],["zamien","zamieniac"],["utw\xF3rz","tworzy\u0107"],["utworz","tworzyc"],["stw\xF3rz","stwarza\u0107"],["stworz","stwarzac"],["skup","skupia\u0107"],["rozmyj","rozmywa\u0107"],["nawiguj","nawigowa\u0107"],["za\u0142aduj","\u0142adowa\u0107"],["zaladuj","ladowac"],["powt\xF3rz","powtarza\u0107"],["powtorz","powtarzac"],["kontynuuj","kontynuowa\u0107"],["zatrzymaj","zatrzymywa\u0107"],["przerwij","przerywa\u0107"],["rzu\u0107","rzuca\u0107"],["rzuc","rzucac"],["zwr\xF3\u0107","zwraca\u0107"],["zwroc","zwracac"],["inicjuj","inicjowa\u0107"],["zainstaluj","instalowa\u0107"],["zmierz","mierzy\u0107"]]),qe=class{constructor(){this.language="pl";}isNormalizable(t){return t.length<3?false:/[a-zA-ZąęćńóśźżłĄĘĆŃÓŚŹŻŁ]/.test(t)}normalize(t){let e=t.toLowerCase();if(this.isInfinitive(e))return T(e);let r=this.tryImperativeNormalization(e);if(r)return r;let n=this.tryPastTenseNormalization(e);if(n)return n;let i=this.tryPresentTenseNormalization(e);return i||T(e)}isInfinitive(t){return ["a\u0107","e\u0107","i\u0107","y\u0107","\u0105\u0107","owa\u0107","iwa\u0107","ywa\u0107"].some(r=>t.endsWith(r))}tryImperativeNormalization(t){return Ve.has(t)?m(Ve.get(t),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):t.endsWith("aj")?m(t.slice(0,-2)+"a\u0107",.8,{removedSuffixes:["aj"],conjugationType:"imperative"}):t.endsWith("uj")?m(t.slice(0,-2)+"owa\u0107",.8,{removedSuffixes:["uj"],conjugationType:"imperative"}):t.endsWith("ij")?m(t.slice(0,-2)+"i\u0107",.75,{removedSuffixes:["ij"],conjugationType:"imperative"}):null}tryPresentTenseNormalization(t){return t.endsWith("uj\u0119")||t.endsWith("uje")?m(t.slice(0,-3)+"owa\u0107",.85,{removedSuffixes:["uj\u0119"],conjugationType:"present"}):t.endsWith("am")&&t.length>3?m(t.slice(0,-2)+"a\u0107",.8,{removedSuffixes:["am"],conjugationType:"present"}):t.endsWith("em")&&t.length>3?m(t.slice(0,-2)+"e\u0107",.75,{removedSuffixes:["em"],conjugationType:"present"}):t.endsWith("\u0119")&&t.length>2?m(t.slice(0,-1)+"a\u0107",.7,{removedSuffixes:["\u0119"],conjugationType:"present"}):null}tryPastTenseNormalization(t){if(t.endsWith("a\u0142em")||t.endsWith("a\u0142am"))return m(t.slice(0,-4)+"a\u0107",.85,{removedSuffixes:[t.slice(-4)],conjugationType:"past"});if(t.endsWith("a\u0142")||t.endsWith("a\u0142a")){let e=t.endsWith("a\u0142a")?3:2;return m(t.slice(0,-e)+"a\u0107",.8,{removedSuffixes:[t.slice(-e)],conjugationType:"past"})}if(t.endsWith("i\u0142em")||t.endsWith("i\u0142am")||t.endsWith("ilem")||t.endsWith("ilam"))return m(t.slice(0,-4)+"i\u0107",.85,{removedSuffixes:[t.slice(-4)],conjugationType:"past"});if(t.endsWith("i\u0142")||t.endsWith("i\u0142a")||t.endsWith("il")||t.endsWith("ila")){let e=t.endsWith("i\u0142a")||t.endsWith("ila")?3:2;return m(t.slice(0,-e)+"i\u0107",.8,{removedSuffixes:[t.slice(-e)],conjugationType:"past"})}return null}},zr=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Rr=class{constructor(t=zr){this.name="operator",this.operators=[...t].sort((e,r)=>r.length-e.length);}canExtract(t,e){return this.operators.some(r=>t.startsWith(r,e))}extract(t,e){for(let r of this.operators)if(t.startsWith(r,e))return {value:r,length:r.length};return null}},Nr="()[]{},:;",Pr=class{constructor(t=Nr){this.punctuation=t,this.name="punctuation";}canExtract(t,e){return this.punctuation.includes(t[e])}extract(t,e){let r=t[e];return this.punctuation.includes(r)?{value:r,length:1}:null}};function Or(t,e){let r=t[e];if(r==="#"){let n=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);return n?n[0]:null}if(r==="."){let n=t.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return n?n[0]:null}if(r==="["){let n=0,i=e;for(;i<t.length;){if(t[i]==="["&&n++,t[i]==="]"&&(n--,n===0))return t.slice(e,i+1);i++;}return null}if(r==="<"){let n=t.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return n?n[0]:null}return null}var Ir=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"}extract(t,e){let r=Or(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},_r=class{constructor(){this.name="event-modifier";}canExtract(t,e){if(t[e]!==".")return false;let r=t.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(r)}extract(t,e){let r=t.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!r)return null;let n=r[0],i=n.slice(1).split("(")[0],o=r[1];return {value:n,length:n.length,metadata:{modifierName:i,value:o?i==="queue"?o:parseInt(o,10):void 0}}}};function Mr(t,e){let r=t.slice(e);if(r.startsWith("http://")||r.startsWith("https://")){let n=r.match(/^https?:\/\/[^\s]*/);return n?n[0]:null}if(r.startsWith("//")){let n=r.match(/^\/\/[^\s]*/);return n?n[0]:null}if(r.startsWith("./")||r.startsWith("../")){let n=r.match(/^\.\.?\/[^\s]*/);return n?n[0]:null}if(r.startsWith("/")){let n=r.match(/^\/[^\s]*/);return n?n[0]:null}return null}var Lr=class{constructor(){this.name="url";}canExtract(t,e){let r=t.slice(e);return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")||r.startsWith("./")||r.startsWith("../")||r.startsWith("/")}extract(t,e){let r=Mr(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},Dr=class{constructor(){this.name="variable-ref";}canExtract(t,e){return t[e]===":"&&e+1<t.length&&/[a-zA-Z_]/.test(t[e+1])}extract(t,e){if(!this.canExtract(t,e))return null;let r=1;for(;e+r<t.length&&/[a-zA-Z0-9_]/.test(t[e+r]);)r++;return {value:t.substring(e,e+r),length:r,metadata:{type:"variable-reference"}}}},Fr=new Set(["do","od","z","ze","w","we","na","po","pod","przed","za","nad","mi\u0119dzy","miedzy","przez","dla","bez","o","przy","u","wed\u0142ug","wedlug","mimo","w\u015Br\xF3d","wsrod","obok","poza","wok\xF3\u0142","wokol","przeciw","ku"]);function Br(){let t=/[a-zA-ZąęćńóśźżłĄĘĆŃÓŚŹŻŁ]/;return {isLetter:n=>t.test(n),isIdentifierChar:n=>/[0-9]/.test(n)||t.test(n)}}var{isLetter:$r,isIdentifierChar:jr}=Br(),Vr=class{constructor(){this.name="polish-keyword";}setContext(t){this.context=t;}canExtract(t,e){return $r(t[e])}extract(t,e){if(!this.context)throw new Error("PolishKeywordExtractor: context not set");let r=e,n="";for(;r<t.length&&jr(t[r]);)n+=t[r++];if(!n)return null;let i=n.toLowerCase(),o=Fr.has(i),s=this.context.lookupKeyword(i),u=s&&s.normalized!==s.native?s.normalized:void 0,a;if(!s&&this.context.normalizer){let l=this.context.normalizer.normalize(n);if(l.stem!==n&&l.confidence>=.7){let c=this.context.lookupKeyword(l.stem);c&&(a=c.normalized);}}return {value:n,length:r-e,metadata:{normalized:u||a,isPreposition:o}}}};function Wr(){return [new Vr]}function qr(){return [new Lr,new _r,new Dr,new Ir]}var Ur=new Set(["do","od","z","ze","w","we","na","po","pod","przed","za","nad","mi\u0119dzy","miedzy","przez","dla","bez","o","przy","u","wed\u0142ug","wedlug","mimo","w\u015Br\xF3d","wsrod","obok","poza","wok\xF3\u0142","wokol","przeciw","ku"]),Kr=[{native:"prawda",normalized:"true"},{native:"fa\u0142sz",normalized:"false"},{native:"falsz",normalized:"false"},{native:"null",normalized:"null"},{native:"nieokre\u015Blony",normalized:"undefined"},{native:"nieokreslony",normalized:"undefined"},{native:"pierwszy",normalized:"first"},{native:"pierwsza",normalized:"first"},{native:"pierwsze",normalized:"first"},{native:"ostatni",normalized:"last"},{native:"ostatnia",normalized:"last"},{native:"ostatnie",normalized:"last"},{native:"nast\u0119pny",normalized:"next"},{native:"nastepny",normalized:"next"},{native:"poprzedni",normalized:"previous"},{native:"najbli\u017Cszy",normalized:"closest"},{native:"najblizszy",normalized:"closest"},{native:"rodzic",normalized:"parent"},{native:"klikni\u0119cie",normalized:"click"},{native:"klikniecie",normalized:"click"},{native:"klik",normalized:"click"},{native:"click",normalized:"click"},{native:"zmiana",normalized:"change"},{native:"wys\u0142anie",normalized:"submit"},{native:"wyslanie",normalized:"submit"},{native:"naci\u015Bni\u0119cie",normalized:"keydown"},{native:"nacisniecie",normalized:"keydown"},{native:"klawisz",normalized:"keydown"},{native:"najechanie",normalized:"mouseover"},{native:"zjechanie",normalized:"mouseout"},{native:"rozmycie",normalized:"blur"},{native:"za\u0142adowanie",normalized:"load"},{native:"zaladowanie",normalized:"load"},{native:"przewini\u0119cie",normalized:"scroll"},{native:"przewiniecie",normalized:"scroll"},{native:"input",normalized:"input"},{native:"m\xF3j",normalized:"my"},{native:"moj",normalized:"my"},{native:"sekunda",normalized:"s"},{native:"sekundy",normalized:"s"},{native:"sekund",normalized:"s"},{native:"milisekunda",normalized:"ms"},{native:"milisekundy",normalized:"ms"},{native:"milisekund",normalized:"ms"},{native:"minuta",normalized:"m"},{native:"minuty",normalized:"m"},{native:"minut",normalized:"m"},{native:"godzina",normalized:"h"},{native:"godziny",normalized:"h"},{native:"godzin",normalized:"h"},{native:"po\u0142\xF3\u017C",normalized:"put"},{native:"poloz",normalized:"put"},{native:"lub",normalized:"or"},{native:"nie",normalized:"not"},{native:"jest",normalized:"is"},{native:"istnieje",normalized:"exists"},{native:"pusty",normalized:"empty"},{native:"puste",normalized:"empty"}],Gr=class extends W{constructor(){super(),this.language="pl",this.direction="ltr",this.initializeKeywordsFromProfile(We,Kr),this.setNormalizer(new qe),this.registerExtractors(qr()),this.registerExtractor(new j),this.registerExtractor(new V),this.registerExtractors(Wr()),this.registerExtractor(new Rr),this.registerExtractor(new Pr);}classifyToken(t){let e=t.toLowerCase();return Ur.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(t)?"event-modifier":t.startsWith("#")||t.startsWith(".")||t.startsWith("[")||t.startsWith("*")||t.startsWith("<")?"selector":t.startsWith('"')||t.startsWith("'")||/^\d/.test(t)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(t)?"operator":"identifier"}},Hr=new Gr;Ar("pl",Hr,We);var Yr=new Map,Xr=new Map,Zr=new Map;function Jr(t,e,r){Yr.set(t,e),Xr.set(t,r),Zr.delete(t);}function Qr(t){return /[а-яА-ЯіІїЇєЄґҐьЬ']/.test(t)}var Ue=new Map([["\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0438","\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0443\u0442\u0438"],["\u0434\u043E\u0434\u0430\u0439","\u0434\u043E\u0434\u0430\u0442\u0438"],["\u0432\u0438\u0434\u0430\u043B\u0438","\u0432\u0438\u0434\u0430\u043B\u0438\u0442\u0438"],["\u043F\u0440\u0438\u0431\u0435\u0440\u0438","\u043F\u0440\u0438\u0431\u0440\u0430\u0442\u0438"],["\u043F\u043E\u043A\u043B\u0430\u0434\u0438","\u043F\u043E\u043A\u043B\u0430\u0441\u0442\u0438"],["\u043F\u043E\u043C\u0456\u0441\u0442\u0438","\u043F\u043E\u043C\u0456\u0441\u0442\u0438\u0442\u0438"],["\u0432\u0441\u0442\u0430\u0432","\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u0438"],["\u0432\u0456\u0437\u044C\u043C\u0438","\u0432\u0437\u044F\u0442\u0438"],["\u0441\u0442\u0432\u043E\u0440\u0438","\u0441\u0442\u0432\u043E\u0440\u0438\u0442\u0438"],["\u043A\u043B\u043E\u043D\u0443\u0439","\u043A\u043B\u043E\u043D\u0443\u0432\u0430\u0442\u0438"],["\u043F\u043E\u043C\u0456\u043D\u044F\u0439","\u043F\u043E\u043C\u0456\u043D\u044F\u0442\u0438"],["\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0443\u0439","\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0443\u0432\u0430\u0442\u0438"],["\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438","\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0438"],["\u0437\u0430\u0434\u0430\u0439","\u0437\u0430\u0434\u0430\u0442\u0438"],["\u043E\u0442\u0440\u0438\u043C\u0430\u0439","\u043E\u0442\u0440\u0438\u043C\u0430\u0442\u0438"],["\u0437\u0431\u0456\u043B\u044C\u0448","\u0437\u0431\u0456\u043B\u044C\u0448\u0438\u0442\u0438"],["\u0437\u043C\u0435\u043D\u0448","\u0437\u043C\u0435\u043D\u0448\u0438\u0442\u0438"],["\u0437\u0430\u043F\u0438\u0448\u0438","\u0437\u0430\u043F\u0438\u0441\u0430\u0442\u0438"],["\u043F\u043E\u043A\u0430\u0436\u0438","\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u0438"],["\u0441\u0445\u043E\u0432\u0430\u0439","\u0441\u0445\u043E\u0432\u0430\u0442\u0438"],["\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u0439","\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u0442\u0438"],["\u0430\u043D\u0456\u043C\u0443\u0439","\u0430\u043D\u0456\u043C\u0443\u0432\u0430\u0442\u0438"],["\u0432\u0438\u043A\u043B\u0438\u0447","\u0432\u0438\u043A\u043B\u0438\u043A\u0430\u0442\u0438"],["\u043D\u0430\u0434\u0456\u0448\u043B\u0438","\u043D\u0430\u0434\u0456\u0441\u043B\u0430\u0442\u0438"],["\u0441\u0444\u043E\u043A\u0443\u0441\u0443\u0439","\u0441\u0444\u043E\u043A\u0443\u0441\u0443\u0432\u0430\u0442\u0438"],["\u0440\u043E\u0437\u0444\u043E\u043A\u0443\u0441\u0443\u0439","\u0440\u043E\u0437\u0444\u043E\u043A\u0443\u0441\u0443\u0432\u0430\u0442\u0438"],["\u043F\u0435\u0440\u0435\u0439\u0434\u0438","\u043F\u0435\u0440\u0435\u0439\u0442\u0438"],["\u0439\u0434\u0438","\u0439\u0442\u0438"],["\u0447\u0435\u043A\u0430\u0439","\u0447\u0435\u043A\u0430\u0442\u0438"],["\u0437\u0430\u0447\u0435\u043A\u0430\u0439","\u0437\u0430\u0447\u0435\u043A\u0430\u0442\u0438"],["\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436","\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438"],["\u043F\u043E\u0432\u0442\u043E\u0440\u0438","\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0438"],["\u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0443\u0439","\u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0438\u0442\u0438"],["\u043A\u0438\u043D\u044C","\u043A\u0438\u043D\u0443\u0442\u0438"],["\u043F\u043E\u0432\u0435\u0440\u043D\u0438","\u043F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u0438"],["\u0441\u043A\u0430\u0436\u0438","\u0441\u043A\u0430\u0437\u0430\u0442\u0438"],["\u0456\u043D\u0456\u0446\u0456\u0430\u043B\u0456\u0437\u0443\u0439","\u0456\u043D\u0456\u0446\u0456\u0430\u043B\u0456\u0437\u0443\u0432\u0430\u0442\u0438"],["\u0432\u0438\u043C\u0456\u0440\u044F\u0439","\u0432\u0438\u043C\u0456\u0440\u044F\u0442\u0438"]]),Ke=class{constructor(){this.language="uk";}isNormalizable(t){return t.length<3?false:Qr(t)}normalize(t){let e=t.toLowerCase();if(e.endsWith("\u0441\u044F")||e.endsWith("\u0441\u044C")){let s=this.tryReflexiveNormalization(e);if(s)return s}if(e.endsWith("\u0442\u0438")||e.endsWith("\u0447\u0438"))return T(t);let r=this.tryImperativeLookup(e);if(r)return r;let n=this.tryPastTenseNormalization(e);if(n)return n;let i=this.tryPresentTenseNormalization(e);if(i)return i;let o=this.tryGenericImperativeNormalization(e);return o||T(t)}tryReflexiveNormalization(t){let e=t.slice(0,-2);if(t.endsWith("\u0442\u0438\u0441\u044F")||t.endsWith("\u0447\u0438\u0441\u044F"))return T(t);let r=this.normalizeNonReflexive(e);if(r.confidence<1){let n=r.stem.endsWith("\u0442\u0438")?r.stem.slice(0,-2)+"\u0442\u0438\u0441\u044F":r.stem+"\u0441\u044F";return m(n,r.confidence*.95,{removedSuffixes:["\u0441\u044F",...r.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}normalizeNonReflexive(t){if(t.endsWith("\u0442\u0438")||t.endsWith("\u0447\u0438"))return T(t);let e=this.tryImperativeLookup(t);if(e)return e;let r=this.tryPastTenseNormalization(t);if(r)return r;let n=this.tryPresentTenseNormalization(t);if(n)return n;let i=this.tryGenericImperativeNormalization(t);return i||T(t)}tryImperativeLookup(t){return Ue.has(t)?m(Ue.get(t),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(t){return t.endsWith("\u0439\u0442\u0435")&&t.length>5?m(t.slice(0,-3)+"\u0442\u0438",.8,{removedSuffixes:["\u0439\u0442\u0435"],conjugationType:"imperative"}):t.endsWith("\u0456\u0442\u044C")&&t.length>5?m(t.slice(0,-3)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0456\u0442\u044C"],conjugationType:"imperative"}):t.endsWith("\u0439")&&t.length>3?m(t.slice(0,-1)+"\u0442\u0438",.75,{removedSuffixes:["\u0439"],conjugationType:"imperative"}):t.endsWith("\u0438")&&t.length>3?m(t+"\u0442\u0438",.7,{removedSuffixes:["\u0438\u2192\u0438\u0442\u0438"],conjugationType:"imperative"}):null}tryPastTenseNormalization(t){return t.endsWith("\u0430\u043B\u0430")&&t.length>4?m(t.slice(0,-3)+"\u0430\u0442\u0438",.85,{removedSuffixes:["\u0430\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0430")&&t.length>4?m(t.slice(0,-3)+"\u0438\u0442\u0438",.85,{removedSuffixes:["\u0438\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0430\u043B\u0438")&&t.length>4?m(t.slice(0,-3)+"\u0430\u0442\u0438",.85,{removedSuffixes:["\u0430\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0438")&&t.length>4?m(t.slice(0,-3)+"\u0438\u0442\u0438",.85,{removedSuffixes:["\u0438\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0430\u0432")&&t.length>3?m(t.slice(0,-2)+"\u0430\u0442\u0438",.82,{removedSuffixes:["\u0430\u0432"],conjugationType:"past"}):t.endsWith("\u0438\u0432")&&t.length>3?m(t.slice(0,-2)+"\u0438\u0442\u0438",.82,{removedSuffixes:["\u0438\u0432"],conjugationType:"past"}):null}tryPresentTenseNormalization(t){return t.endsWith("\u0438\u0448")&&t.length>3?m(t.slice(0,-2)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0438\u0448"],conjugationType:"present"}):t.endsWith("\u0438\u0442\u044C")&&t.length>4?m(t.slice(0,-3)+"\u0438\u0442\u0438",.78,{removedSuffixes:["\u0438\u0442\u044C"],conjugationType:"present"}):t.endsWith("\u0438\u043C\u043E")&&t.length>4?m(t.slice(0,-3)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0438\u043C\u043E"],conjugationType:"present"}):t.endsWith("\u044F\u0442\u044C")&&t.length>4?m(t.slice(0,-3)+"\u0438\u0442\u0438",.78,{removedSuffixes:["\u044F\u0442\u044C"],conjugationType:"present"}):t.endsWith("\u0454\u0448")&&t.length>3?m(t.slice(0,-2)+"\u0430\u0442\u0438",.78,{removedSuffixes:["\u0454\u0448"],conjugationType:"present"}):t.endsWith("\u0435\u0448")&&t.length>3?m(t.slice(0,-2)+"\u0430\u0442\u0438",.75,{removedSuffixes:["\u0435\u0448"],conjugationType:"present"}):t.endsWith("\u0454")&&t.length>2?m(t.slice(0,-1)+"\u0430\u0442\u0438",.72,{removedSuffixes:["\u0454"],conjugationType:"present"}):t.endsWith("\u0454\u043C\u043E")&&t.length>4?m(t.slice(0,-3)+"\u0430\u0442\u0438",.8,{removedSuffixes:["\u0454\u043C\u043E"],conjugationType:"present"}):t.endsWith("\u044E\u0442\u044C")&&t.length>4?m(t.slice(0,-3)+"\u0430\u0442\u0438",.78,{removedSuffixes:["\u044E\u0442\u044C"],conjugationType:"present"}):t.endsWith("\u0443\u0442\u044C")&&t.length>4?m(t.slice(0,-3)+"\u0430\u0442\u0438",.75,{removedSuffixes:["\u0443\u0442\u044C"],conjugationType:"present"}):null}},Ge={code:"uk",name:"Ukrainian",nativeName:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430",direction:"ltr",script:"cyrillic",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:true,suffixes:["\u0442\u0438","\u0442\u0438\u0441\u044F","\u0438\u0442\u0438","\u0438\u0442\u0438\u0441\u044F","\u0430\u0442\u0438","\u0430\u0442\u0438\u0441\u044F","\u0456\u0442\u0438","\u0456\u0442\u0438\u0441\u044F"]},references:{me:"\u044F",it:"\u0446\u0435",you:"\u0442\u0438",result:"\u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442",event:"\u043F\u043E\u0434\u0456\u044F",target:"\u0446\u0456\u043B\u044C",body:"body"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:true,specialForms:{me:"\u043C\u0456\u0439",it:"\u0439\u043E\u0433\u043E",you:"\u0442\u0432\u0456\u0439"},keywords:{\u043C\u0456\u0439:"me",\u043C\u043E\u044F:"me",\u043C\u043E\u0454:"me",\u043C\u043E\u0457:"me",\u0442\u0432\u0456\u0439:"you",\u0442\u0432\u043E\u044F:"you",\u0442\u0432\u043E\u0454:"you",\u0442\u0432\u043E\u0457:"you",\u0439\u043E\u0433\u043E:"it",\u0457\u0457:"it"}},roleMarkers:{destination:{primary:"\u0432",alternatives:["\u043D\u0430","\u0434\u043E"],position:"before"},source:{primary:"\u0437",alternatives:["\u0432\u0456\u0434","\u0456\u0437"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"\u0437",alternatives:["\u0456\u0437"],position:"before"}},keywords:{toggle:{primary:"\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0443\u0442\u0438",alternatives:["\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0438"],normalized:"toggle",form:"infinitive"},add:{primary:"\u0434\u043E\u0434\u0430\u0442\u0438",alternatives:["\u0434\u043E\u0434\u0430\u0439"],normalized:"add",form:"infinitive"},remove:{primary:"\u0432\u0438\u0434\u0430\u043B\u0438\u0442\u0438",alternatives:["\u0432\u0438\u0434\u0430\u043B\u0438","\u043F\u0440\u0438\u0431\u0440\u0430\u0442\u0438","\u043F\u0440\u0438\u0431\u0435\u0440\u0438"],normalized:"remove",form:"infinitive"},put:{primary:"\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"],normalized:"put",form:"infinitive"},append:{primary:"\u0434\u043E\u0434\u0430\u0442\u0438_\u0432_\u043A\u0456\u043D\u0435\u0446\u044C",alternatives:["\u0434\u043E\u043F\u0438\u0441\u0430\u0442\u0438"],normalized:"append",form:"infinitive"},prepend:{primary:"\u0434\u043E\u0434\u0430\u0442\u0438_\u043D\u0430_\u043F\u043E\u0447\u0430\u0442\u043E\u043A",normalized:"prepend",form:"infinitive"},take:{primary:"\u0432\u0437\u044F\u0442\u0438",alternatives:["\u0432\u0456\u0437\u044C\u043C\u0438"],normalized:"take",form:"infinitive"},make:{primary:"\u0441\u0442\u0432\u043E\u0440\u0438\u0442\u0438",alternatives:["\u0441\u0442\u0432\u043E\u0440\u0438"],normalized:"make",form:"infinitive"},clone:{primary:"\u043A\u043B\u043E\u043D\u0443\u0432\u0430\u0442\u0438",alternatives:["\u043A\u043B\u043E\u043D\u0443\u0439"],normalized:"clone",form:"infinitive"},swap:{primary:"\u043F\u043E\u043C\u0456\u043D\u044F\u0442\u0438",alternatives:["\u043F\u043E\u043C\u0456\u043D\u044F\u0439"],normalized:"swap",form:"infinitive"},morph:{primary:"\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0443\u0439"],normalized:"morph",form:"infinitive"},set:{primary:"\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0438",alternatives:["\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438","\u0437\u0430\u0434\u0430\u0442\u0438","\u0437\u0430\u0434\u0430\u0439"],normalized:"set",form:"infinitive"},get:{primary:"\u043E\u0442\u0440\u0438\u043C\u0430\u0442\u0438",alternatives:["\u043E\u0442\u0440\u0438\u043C\u0430\u0439"],normalized:"get",form:"infinitive"},increment:{primary:"\u0437\u0431\u0456\u043B\u044C\u0448\u0438\u0442\u0438",alternatives:["\u0437\u0431\u0456\u043B\u044C\u0448"],normalized:"increment",form:"infinitive"},decrement:{primary:"\u0437\u043C\u0435\u043D\u0448\u0438\u0442\u0438",alternatives:["\u0437\u043C\u0435\u043D\u0448"],normalized:"decrement",form:"infinitive"},log:{primary:"\u0437\u0430\u043F\u0438\u0441\u0430\u0442\u0438",alternatives:["\u0437\u0430\u043F\u0438\u0448\u0438"],normalized:"log",form:"infinitive"},show:{primary:"\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u0438",alternatives:["\u043F\u043E\u043A\u0430\u0436\u0438"],normalized:"show",form:"infinitive"},hide:{primary:"\u0441\u0445\u043E\u0432\u0430\u0442\u0438",alternatives:["\u0441\u0445\u043E\u0432\u0430\u0439","\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u0442\u0438","\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u0439"],normalized:"hide",form:"infinitive"},transition:{primary:"\u0430\u043D\u0456\u043C\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0430\u043D\u0456\u043C\u0443\u0439"],normalized:"transition",form:"infinitive"},on:{primary:"\u043F\u0440\u0438",normalized:"on"},trigger:{primary:"\u0456\u043D\u0456\u0446\u0456\u044E\u0432\u0430\u0442\u0438",alternatives:["\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u0438","\u0437\u0430\u043F\u0443\u0441\u0442\u0438"],normalized:"trigger",form:"infinitive"},send:{primary:"\u043D\u0430\u0434\u0456\u0441\u043B\u0430\u0442\u0438",alternatives:["\u043D\u0430\u0434\u0456\u0448\u043B\u0438"],normalized:"send",form:"infinitive"},focus:{primary:"\u0441\u0444\u043E\u043A\u0443\u0441\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0441\u0444\u043E\u043A\u0443\u0441\u0443\u0439","\u0444\u043E\u043A\u0443\u0441"],normalized:"focus",form:"infinitive"},blur:{primary:"\u0440\u043E\u0437\u0444\u043E\u043A\u0443\u0441\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0440\u043E\u0437\u0444\u043E\u043A\u0443\u0441\u0443\u0439"],normalized:"blur",form:"infinitive"},click:{primary:"\u043A\u043B\u0456\u043A\u0443",alternatives:["\u043A\u043B\u0456\u043A","\u043D\u0430\u0442\u0438\u0441\u043A\u0430\u043D\u043D\u0456"],normalized:"click"},hover:{primary:"\u043D\u0430\u0432\u0435\u0434\u0435\u043D\u043D\u0456",alternatives:["\u043D\u0430\u0432\u0435\u0434\u0435\u043D\u043D\u044F"],normalized:"hover"},submit:{primary:"\u0432\u0456\u0434\u043F\u0440\u0430\u0432\u0446\u0456",alternatives:["\u0432\u0456\u0434\u043F\u0440\u0430\u0432\u043A\u0430"],normalized:"submit"},input:{primary:"\u0432\u0432\u0435\u0434\u0435\u043D\u043D\u0456",alternatives:["\u0432\u0432\u0435\u0434\u0435\u043D\u043D\u044F"],normalized:"input"},change:{primary:"\u0437\u043C\u0456\u043D\u0456",alternatives:["\u0437\u043C\u0456\u043D\u0430"],normalized:"change"},go:{primary:"\u043F\u0435\u0440\u0435\u0439\u0442\u0438",alternatives:["\u043F\u0435\u0440\u0435\u0439\u0434\u0438","\u0439\u0442\u0438","\u0439\u0434\u0438"],normalized:"go",form:"infinitive"},wait:{primary:"\u0447\u0435\u043A\u0430\u0442\u0438",alternatives:["\u0447\u0435\u043A\u0430\u0439","\u0437\u0430\u0447\u0435\u043A\u0430\u0439"],normalized:"wait",form:"infinitive"},fetch:{primary:"\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438",alternatives:["\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436"],normalized:"fetch",form:"infinitive"},settle:{primary:"\u0441\u0442\u0430\u0431\u0456\u043B\u0456\u0437\u0443\u0432\u0430\u0442\u0438",normalized:"settle",form:"infinitive"},if:{primary:"\u044F\u043A\u0449\u043E",normalized:"if"},when:{primary:"\u043A\u043E\u043B\u0438",normalized:"when"},where:{primary:"\u0434\u0435",normalized:"where"},else:{primary:"\u0456\u043D\u0430\u043A\u0448\u0435",normalized:"else"},repeat:{primary:"\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0438",alternatives:["\u043F\u043E\u0432\u0442\u043E\u0440\u0438"],normalized:"repeat",form:"infinitive"},for:{primary:"\u0434\u043B\u044F",alternatives:["\u043A\u043E\u0436\u043D\u0438\u0439"],normalized:"for"},while:{primary:"\u043F\u043E\u043A\u0438",normalized:"while"},continue:{primary:"\u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0438\u0442\u0438",alternatives:["\u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0443\u0439"],normalized:"continue",form:"infinitive"},halt:{primary:"\u0437\u0443\u043F\u0438\u043D\u0438\u0442\u0438",alternatives:["\u0437\u0443\u043F\u0438\u043D\u0438\u0441\u044C","\u0441\u0442\u043E\u043F"],normalized:"halt",form:"infinitive"},throw:{primary:"\u043A\u0438\u043D\u0443\u0442\u0438",alternatives:["\u043A\u0438\u043D\u044C"],normalized:"throw",form:"infinitive"},call:{primary:"\u0432\u0438\u043A\u043B\u0438\u043A\u0430\u0442\u0438",alternatives:["\u0432\u0438\u043A\u043B\u0438\u0447"],normalized:"call",form:"infinitive"},return:{primary:"\u043F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u0438",alternatives:["\u043F\u043E\u0432\u0435\u0440\u043D\u0438"],normalized:"return",form:"infinitive"},then:{primary:"\u043F\u043E\u0442\u0456\u043C",alternatives:["\u0434\u0430\u043B\u0456","\u0442\u043E\u0434\u0456"],normalized:"then"},and:{primary:"\u0456",alternatives:["\u0442\u0430"],normalized:"and"},end:{primary:"\u043A\u0456\u043D\u0435\u0446\u044C",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"\u0430\u0441\u0438\u043D\u0445\u0440\u043E\u043D\u043D\u043E",alternatives:["async"],normalized:"async"},tell:{primary:"\u0441\u043A\u0430\u0437\u0430\u0442\u0438",alternatives:["\u0441\u043A\u0430\u0436\u0438"],normalized:"tell",form:"infinitive"},default:{primary:"\u0437\u0430_\u0437\u0430\u043C\u043E\u0432\u0447\u0443\u0432\u0430\u043D\u043D\u044F\u043C",normalized:"default"},init:{primary:"\u0456\u043D\u0456\u0446\u0456\u0430\u043B\u0456\u0437\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0456\u043D\u0456\u0446\u0456\u0430\u043B\u0456\u0437\u0443\u0439"],normalized:"init",form:"infinitive"},behavior:{primary:"\u043F\u043E\u0432\u0435\u0434\u0456\u043D\u043A\u0430",normalized:"behavior"},install:{primary:"\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0438_\u043F\u0430\u043A\u0435\u0442",normalized:"install",form:"infinitive"},measure:{primary:"\u0432\u0438\u043C\u0456\u0440\u044F\u0442\u0438",alternatives:["\u0432\u0438\u043C\u0456\u0440\u044F\u0439"],normalized:"measure",form:"infinitive"},beep:{primary:"\u0437\u0432\u0443\u043A",normalized:"beep"},break:{primary:"\u043F\u0435\u0440\u0435\u0440\u0432\u0430\u0442\u0438",normalized:"break"},copy:{primary:"\u043A\u043E\u043F\u0456\u044E\u0432\u0430\u0442\u0438",normalized:"copy"},exit:{primary:"\u0432\u0438\u0439\u0442\u0438",normalized:"exit"},pick:{primary:"\u0432\u0438\u0431\u0440\u0430\u0442\u0438",normalized:"pick"},render:{primary:"\u0432\u0456\u0434\u043E\u0431\u0440\u0430\u0437\u0438\u0442\u0438",normalized:"render"},into:{primary:"\u0432",alternatives:["\u0443"],normalized:"into"},before:{primary:"\u0434\u043E",alternatives:["\u043F\u0435\u0440\u0435\u0434"],normalized:"before"},after:{primary:"\u043F\u0456\u0441\u043B\u044F",normalized:"after"},until:{primary:"\u043F\u043E\u043A\u0438_\u043D\u0435",normalized:"until"},event:{primary:"\u043F\u043E\u0434\u0456\u044F",normalized:"event"},from:{primary:"\u0437",alternatives:["\u0432\u0456\u0434","\u0456\u0437"],normalized:"from"}},eventHandler:{keyword:{primary:"\u043F\u0440\u0438",normalized:"on"},sourceMarker:{primary:"\u043D\u0430",alternatives:["\u0432","\u043F\u0440\u0438"],position:"before"},eventMarker:{primary:"\u043F\u0440\u0438",position:"before"},temporalMarkers:["\u043A\u043E\u043B\u0438","\u044F\u043A\u0449\u043E"]}},en=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],tn=class{constructor(t=en){this.name="operator",this.operators=[...t].sort((e,r)=>r.length-e.length);}canExtract(t,e){return this.operators.some(r=>t.startsWith(r,e))}extract(t,e){for(let r of this.operators)if(t.startsWith(r,e))return {value:r,length:r.length};return null}},rn="()[]{},:;",nn=class{constructor(t=rn){this.punctuation=t,this.name="punctuation";}canExtract(t,e){return this.punctuation.includes(t[e])}extract(t,e){let r=t[e];return this.punctuation.includes(r)?{value:r,length:1}:null}};function on(t,e){let r=t[e];if(r==="#"){let n=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);return n?n[0]:null}if(r==="."){let n=t.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return n?n[0]:null}if(r==="["){let n=0,i=e;for(;i<t.length;){if(t[i]==="["&&n++,t[i]==="]"&&(n--,n===0))return t.slice(e,i+1);i++;}return null}if(r==="<"){let n=t.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return n?n[0]:null}return null}var sn=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"}extract(t,e){let r=on(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},un=class{constructor(){this.name="event-modifier";}canExtract(t,e){if(t[e]!==".")return false;let r=t.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(r)}extract(t,e){let r=t.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!r)return null;let n=r[0],i=n.slice(1).split("(")[0],o=r[1];return {value:n,length:n.length,metadata:{modifierName:i,value:o?i==="queue"?o:parseInt(o,10):void 0}}}};function an(t,e){let r=t.slice(e);if(r.startsWith("http://")||r.startsWith("https://")){let n=r.match(/^https?:\/\/[^\s]*/);return n?n[0]:null}if(r.startsWith("//")){let n=r.match(/^\/\/[^\s]*/);return n?n[0]:null}if(r.startsWith("./")||r.startsWith("../")){let n=r.match(/^\.\.?\/[^\s]*/);return n?n[0]:null}if(r.startsWith("/")){let n=r.match(/^\/[^\s]*/);return n?n[0]:null}return null}var ln=class{constructor(){this.name="url";}canExtract(t,e){let r=t.slice(e);return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")||r.startsWith("./")||r.startsWith("../")||r.startsWith("/")}extract(t,e){let r=an(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},cn=class{constructor(){this.name="variable-ref";}canExtract(t,e){return t[e]===":"&&e+1<t.length&&/[a-zA-Z_]/.test(t[e+1])}extract(t,e){if(!this.canExtract(t,e))return null;let r=1;for(;e+r<t.length&&/[a-zA-Z0-9_]/.test(t[e+r]);)r++;return {value:t.substring(e,e+r),length:r,metadata:{type:"variable-reference"}}}};function pn(t){return {isLetter:n=>t.test(n),isIdentifierChar:n=>/[0-9]/.test(n)||t.test(n)}}var dn=class{constructor(t,e,r){this.name=t;let n=pn(e);this.isLetter=n.isLetter,this.isIdentifierChar=n.isIdentifierChar,this.prepositions=r;}setContext(t){this.context=t;}canExtract(t,e){return this.isLetter(t[e])}extract(t,e){if(!this.context)throw new Error(`${this.name}: context not set`);let r=e,n="";for(;r<t.length&&this.isIdentifierChar(t[r]);)n+=t[r++];if(!n)return null;let i=n.toLowerCase(),o=this.prepositions.has(i),s=this.context.lookupKeyword(i),u=s&&s.normalized!==s.native?s.normalized:void 0,a;if(!s&&this.context.normalizer){let l=this.context.normalizer.normalize(n);if(l.stem!==n&&l.confidence>=.7){let c=this.context.lookupKeyword(l.stem);c&&(a=c.normalized);}}return {value:n,length:r-e,metadata:{normalized:u||a,isPreposition:o}}}},fn=new Set(["\u0432","\u0443","\u043D\u0430","\u0437","\u0456\u0437","\u0437\u0456","\u0434\u043E","\u0432\u0456\u0434","\u043E","\u043E\u0431","\u043F\u0440\u0438","\u0434\u043B\u044F","\u043F\u0456\u0434","\u043D\u0430\u0434","\u043F\u0435\u0440\u0435\u0434","\u043C\u0456\u0436","\u0447\u0435\u0440\u0435\u0437","\u0431\u0435\u0437","\u043F\u043E","\u0437\u0430","\u043F\u0440\u043E","\u043F\u0456\u0441\u043B\u044F","\u043D\u0430\u0432\u043A\u043E\u043B\u043E","\u043F\u0440\u043E\u0442\u0438","\u0437\u0430\u043C\u0456\u0441\u0442\u044C","\u043A\u0440\u0456\u043C","\u0441\u0435\u0440\u0435\u0434","\u043A"]);function mn(){return [new dn("ukrainian-keyword",/[a-zA-Zа-яА-ЯіІїЇєЄґҐьЬ']/,fn)]}function hn(t){let e=t.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function vn(t){let e=t.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}var yn=class{constructor(){this.name="ascii-identifier";}setContext(t){this.context=t;}canExtract(t,e){return hn(t[e])}extract(t,e){if(!this.context)throw new Error("AsciiIdentifierExtractor: context not set");let r=e,n="",i=e;for(;i<t.length&&vn(t[i]);)n+=t[i],i++;if(!n)return null;let o=this.context.lookupKeyword(n),s=o&&o.normalized!==o.native?o.normalized:void 0;return {value:n,length:i-r,metadata:{normalized:s}}}};function gn(){return [new ln,new un,new cn,new sn]}var En=new Set(["\u0432","\u0443","\u043D\u0430","\u0437","\u0456\u0437","\u0437\u0456","\u0434\u043E","\u0432\u0456\u0434","\u043E","\u043E\u0431","\u043F\u0440\u0438","\u0434\u043B\u044F","\u043F\u0456\u0434","\u043D\u0430\u0434","\u043F\u0435\u0440\u0435\u0434","\u043C\u0456\u0436","\u0447\u0435\u0440\u0435\u0437","\u0431\u0435\u0437","\u043F\u043E","\u0437\u0430","\u043F\u0440\u043E","\u043F\u0456\u0441\u043B\u044F","\u043D\u0430\u0432\u043A\u043E\u043B\u043E","\u043F\u0440\u043E\u0442\u0438","\u0437\u0430\u043C\u0456\u0441\u0442\u044C","\u043A\u0440\u0456\u043C","\u0441\u0435\u0440\u0435\u0434","\u043A"]),bn=[{native:"\u0456\u0441\u0442\u0438\u043D\u0430",normalized:"true"},{native:"\u043F\u0440\u0430\u0432\u0434\u0430",normalized:"true"},{native:"\u0445\u0438\u0431\u043D\u0456\u0441\u0442\u044C",normalized:"false"},{native:"null",normalized:"null"},{native:"\u043D\u0435\u0432\u0438\u0437\u043D\u0430\u0447\u0435\u043D\u043E",normalized:"undefined"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434\u0430",normalized:"s"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434\u0438",normalized:"s"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434",normalized:"s"},{native:"\u043C\u0456\u043B\u0456\u0441\u0435\u043A\u0443\u043D\u0434\u0430",normalized:"ms"},{native:"\u043C\u0456\u043B\u0456\u0441\u0435\u043A\u0443\u043D\u0434\u0438",normalized:"ms"},{native:"\u043C\u0456\u043B\u0456\u0441\u0435\u043A\u0443\u043D\u0434",normalized:"ms"},{native:"\u0445\u0432\u0438\u043B\u0438\u043D\u0430",normalized:"m"},{native:"\u0445\u0432\u0438\u043B\u0438\u043D\u0438",normalized:"m"},{native:"\u0445\u0432\u0438\u043B\u0438\u043D",normalized:"m"},{native:"\u0433\u043E\u0434\u0438\u043D\u0430",normalized:"h"},{native:"\u0433\u043E\u0434\u0438\u043D\u0438",normalized:"h"},{native:"\u0433\u043E\u0434\u0438\u043D",normalized:"h"},{native:"\u043F\u0435\u0440\u0448\u0430",normalized:"first"},{native:"\u043F\u0435\u0440\u0448\u0435",normalized:"first"},{native:"\u043E\u0441\u0442\u0430\u043D\u043D\u044F",normalized:"last"},{native:"\u043E\u0441\u0442\u0430\u043D\u043D\u0454",normalized:"last"},{native:"\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u0430",normalized:"next"},{native:"\u043F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u044F",normalized:"previous"},{native:"\u043F\u043E\u0440\u043E\u0436\u043D\u044F",normalized:"empty"},{native:"\u043F\u043E\u0440\u043E\u0436\u043D\u0454",normalized:"empty"},{native:"\u043C\u043E\u044F",normalized:"my"},{native:"\u043C\u043E\u0454",normalized:"my"},{native:"\u043C\u043E\u0457",normalized:"my"}],wn=class extends W{constructor(){super(),this.language="uk",this.direction="ltr",this.initializeKeywordsFromProfile(Ge,bn),this.setNormalizer(new Ke),this.registerExtractors([...gn(),...mn(),new j,new V,new yn,new tn,new nn]);}classifyToken(t){let e=t.toLowerCase();return En.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(t)?"event-modifier":t.startsWith("#")||t.startsWith(".")||t.startsWith("[")||t.startsWith("*")||t.startsWith("<")?"selector":t.startsWith('"')||t.startsWith("'")||/^\d/.test(t)?"literal":"identifier"}},Sn=new wn;Jr("uk",Sn,Ge);var Cn=Object.defineProperty,kn=Object.getOwnPropertyNames,st=(t,e)=>function(){return t&&(e=(0, t[kn(t)[0]])(t=0)),e},Tn=(t,e)=>{for(var r in e)Cn(t,r,{get:e[r],enumerable:true});};function He(t,e){return t.replace(/\{(\w+)\}/g,(r,n)=>String(e[n]??`{${n}}`))}function z(t,e,r={},n){let i=ut[t],o=He(i,r),s=at[t],u=s?He(s,r):void 0;return {code:t,message:o,severity:e,...n&&{role:n},...u&&{suggestion:u}}}var v,ut,at,xn=st({"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"},ut={[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."},at={[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."};}}),lt={};Tn(lt,{SchemaErrorCodes:()=>v,formatValidationResults:()=>In,getValidationStats:()=>_n,validateAllKeywordCollisions:()=>Ln,validateAllSchemas:()=>On,validateCommandSchema:()=>ct,validateKeywordCollisions:()=>pt,validateRoleValues:()=>Mn});function An(t,e){return {action:t,items:e,get notes(){return e.filter(r=>r.severity==="note").map(r=>r.message)},get warnings(){return e.filter(r=>r.severity==="warning").map(r=>r.message)},get errors(){return e.filter(r=>r.severity==="error").map(r=>r.message)}}}function ct(t){let e=[];for(let n of t.roles)n.expectedTypes.includes("literal")&&n.expectedTypes.includes("selector")&&(n.role==="patient"&&Se.has(t.action)?e.push(z(v.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:n.role,command:t.action},n.role)):e.push(z(v.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:n.role},n.role))),n.expectedTypes.length>3&&!Se.has(t.action)&&e.push(z(v.TOO_MANY_EXPECTED_TYPES,"warning",{role:n.role,count:n.expectedTypes.length},n.role));for(let n of t.roles)n.selectorKinds&&n.selectorKinds.length>0&&(n.expectedTypes.includes("selector")||e.push(z(v.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:n.role},n.role)));switch(t.action){case "transition":zn(t,e);break;case "on":Rn(t,e);break;case "if":case "unless":Nn(t,e);break;case "repeat":case "for":case "while":Pn(t,e);break}return t.roles.filter(n=>n.required).length===0&&(dt.has(t.action)?e.push(z(v.NO_REQUIRED_ROLES_EXPECTED,"note",{command:t.action})):e.push(z(v.NO_REQUIRED_ROLES,"warning",{}))),An(t.action,e)}function zn(t,e){let r=t.roles.find(i=>i.role==="patient"),n=t.roles.find(i=>i.role==="goal");r&&r.expectedTypes.includes("selector")&&e.push(z(v.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),r&&!n&&e.push(z(v.TRANSITION_MISSING_GOAL,"error",{}));}function Rn(t,e){let r=t.roles.find(n=>n.role==="event");r||e.push(z(v.EVENT_HANDLER_MISSING_EVENT,"warning",{})),r&&!r.required&&e.push(z(v.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function Nn(t,e){let r=t.roles.find(n=>n.role==="condition");r||e.push(z(v.CONDITIONAL_MISSING_CONDITION,"warning",{})),r&&!r.required&&e.push(z(v.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function Pn(t,e){t.action==="for"?t.roles.find(n=>n.role==="source")||e.push(z(v.FOR_LOOP_MISSING_SOURCE,"warning",{})):t.action==="while"&&(t.roles.find(n=>n.role==="condition")||e.push(z(v.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function On(t,e={}){let r=new Map,{includeNotes:n=false}=e;for(let[i,o]of Object.entries(t)){let s=ct(o),u=s.items.some(l=>l.severity==="warning"||l.severity==="error"),a=n&&s.items.some(l=>l.severity==="note");(u||a)&&r.set(i,s);}return r}function In(t,e={}){let r=[],{showNotes:n=false,showCodes:i=true}=e;for(let[o,s]of t){let u=s.items.filter(c=>c.severity==="error"),a=s.items.filter(c=>c.severity==="warning"),l=s.items.filter(c=>c.severity==="note");if(u.length>0){r.push(` \u274C ${o}:`);for(let c of u){let p=i?` [${c.code}]`:"";r.push(` ERROR${p}: ${c.message}`),c.suggestion&&r.push(` \u{1F4A1} Suggestion: ${c.suggestion}`);}}if(a.length>0){r.push(` \u26A0\uFE0F ${o}:`);for(let c of a){let p=i?` [${c.code}]`:"";r.push(` ${p?`${c.code}: `:""}${c.message}`),c.suggestion&&r.push(` \u{1F4A1} ${c.suggestion}`);}}if(n&&l.length>0){r.push(` \u2139\uFE0F ${o}:`);for(let c of l){let p=i?` [${c.code}]`:"";r.push(` ${p?`${c.code}: `:""}${c.message}`);}}}return r.join(`
|
|
2
|
-
`)}function _n(t){let e=0,r=0,n=0,i={};for(let o of t.values())for(let s of o.items)s.severity==="error"?e++:s.severity==="warning"?r++:s.severity==="note"&&n++,i[s.code]=(i[s.code]||0)+1;return {totalCommands:t.size,errors:e,warnings:r,notes:n,byCode:i}}function Mn(t,e){let r=[];for(let n of e){let i=t.roles.find(o=>o.role===n.role);i&&(i.expectedTypes.length>0&&!i.expectedTypes.includes(n.type)&&(i.expectedTypes.includes("expression")||r.push({level:"error",role:n.role,message:`${t.action}.${n.role} expects type [${i.expectedTypes.join(", ")}], got '${n.type}'`,code:v.VALUE_TYPE_MISMATCH})),n.type==="selector"&&n.selectorKind&&i.selectorKinds&&i.selectorKinds.length>0&&(i.selectorKinds.includes(n.selectorKind)||r.push({level:"error",role:n.role,message:`${t.action}.${n.role} expects selector kind [${i.selectorKinds.join(", ")}], got '${n.selectorKind}'`,code:v.SELECTOR_KIND_MISMATCH})));}return r}function pt(t){let e=[];if(!t.keywords)return {language:t.code,collisions:e};let r=new Map;for(let[i,o]of Object.entries(t.keywords)){if(!o||!o.primary)continue;let s=r.get(o.primary)||[];if(s.push({command:i,isPrimary:true}),r.set(o.primary,s),o.alternatives)for(let u of o.alternatives){let a=r.get(u)||[];a.push({command:i,isPrimary:false}),r.set(u,a);}}for(let[i,o]of r){let s=[...new Set(o.map(l=>l.command))];if(s.length<=1)continue;let u=o.filter(l=>l.isPrimary).length,a;u>=2?a="primary-primary":u===1?a="primary-alternative":a="alternative-alternative",e.push({keyword:i,commands:s.sort(),type:a});}let n={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((i,o)=>n[i.type]-n[o.type]),{language:t.code,collisions:e}}function Ln(t){let e=[];for(let[,r]of Object.entries(t)){let n=pt(r);n.collisions.length>0&&e.push(n);}return e.sort((r,n)=>r.language.localeCompare(n.language))}var Se,dt,Dn=st({"src/generators/schema-validator.ts"(){xn(),Se=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),dt=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep"]);}});function re(t){let e="complex";return t.startsWith("#")&&!t.includes(" ")?e="id":t.startsWith(".")&&!t.includes(" ")?e="class":t.startsWith("[")&&t.endsWith("]")?e="attribute":/^[a-z][a-z0-9]*$/i.test(t)&&(e="element"),{type:"selector",value:t,selectorKind:e}}function k(t,e){let r={type:"literal",value:t};return e!==void 0?{type:"literal",value:t,dataType:e}:r}function Ye(t){return Me(t)}function L(t){return {type:"reference",value:t}}function Ee(t,e){return {type:"property-path",object:t,property:e}}function le(t,e,r){let n={kind:"command",action:t,roles:new Map(Object.entries(e))};return r!==void 0?{...n,metadata:r}:n}function Xe(t,e,r,n,i,o){let s=new Map;s.set("event",t);let u={kind:"event-handler",action:"on",roles:s,body:e};return r!==void 0&&(u.eventModifiers=r),n!==void 0&&(u.metadata=n),u}function Ze(t,e="then",r){let n={kind:"compound",action:"compound",roles:new Map,statements:t,chainType:e};return r!==void 0&&(n.metadata=r),n}function Je(t,e){return !e||e.length===0||e.includes(t)||e.includes("expression")?true:t==="property-path"?e.some(r=>["selector","reference","expression"].includes(r)):false}function Fn(t,e){return t.possessive?.keywords?.[e]}var K=new Map,G=new Map,ce=new Map,Ce=null;function ft(t,e){let r={...t};for(let n of Object.keys(e)){let i=e[n],o=t[n];i!==void 0&&(typeof i=="object"&&i!==null&&!Array.isArray(i)&&typeof o=="object"&&o!==null&&!Array.isArray(o)?r[n]=ft(o,i):r[n]=i);}return r}function Bn(t,e){return ft(t,e)}function Te(t){if(!t.extends)return t;let e=G.get(t.extends);if(!e)return console.warn(`[Registry] Profile '${t.code}' extends '${t.extends}' but base is not registered. Make sure to import the base language before the variant.`),t;let r=Te(e);return Bn(r,t)}function mt(t){Ce=t;}var Qe=new Map;function H(t){return t.split("-")[0]}function Y(t){return t.includes("-")}function $n(t){let e=K.get(t);if(!e&&Y(t)){let r=H(t);e=K.get(r);}if(!e){let r=Array.from(K.keys()).join(", ");throw new Error(`Language '${t}' is not registered. Registered languages: ${r||"none"}. Import the language module first: import '@lokascript/semantic/languages/${t}';`)}return e}function jn(t){let e=G.get(t);if(!e&&Y(t)){let r=H(t);e=G.get(r);}if(!e){let r=Array.from(G.keys()).join(", ");throw new Error(`Language profile '${t}' is not registered. Registered languages: ${r||"none"}. Import the language module first: import '@lokascript/semantic/languages/${t}';`)}return Te(e)}function Vn(t){let e=K.get(t);return !e&&Y(t)&&(e=K.get(H(t))),e}function D(t){let e=G.get(t);return !e&&Y(t)&&(e=G.get(H(t))),e?Te(e):void 0}function ht(){return Array.from(K.keys())}function Wn(t,e){return $n(e).tokenize(t)}function U(t){let e=ce.get(t);if(!e&&Y(t)&&(e=ce.get(H(t))),e)return e;let r=Qe.get(t);if(!r&&Y(t)&&(r=Qe.get(H(t))),r)return ce.set(t,r),r;if(!Ce)throw new Error(`No patterns registered for language '${t}'. Either import the language module or set a pattern generator.`);let n=jn(t),i=Ce(n);return ce.set(t,i),i}var be=.8,Un=.6,Kn=.15,Gn=.5,et=.15,tt=.1,rt=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"]),Hn={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"]},Yn=class{calculate(t){return this.calculateWithBreakdown(t).final}calculateWithBreakdown(t){let e=this.scoreRoleCoverage(t),r=this.scoreStemPenalty(t),n=this.scoreLanguageBoost(t),i=this.scoreLanguageAdjustment(t),o=e;return o=Math.max(Gn,o+r),o=Math.min(1,o+n),o=Math.max(0,Math.min(1,o+i)),{roleCoverage:e,stemPenalty:r,languageBoost:n,languageAdjustment:i,final:o}}scoreRoleCoverage(t){let{pattern:e,captured:r}=t,n=0,i=0,o=s=>e.extraction?.[s]?.default!==void 0;for(let s of e.template.tokens)if(s.type==="role")i+=1,r.has(s.role)&&(n+=1);else if(s.type==="group")for(let u of s.tokens)u.type==="role"&&(i+=be,r.has(u.role)?n+=be:o(u.role)&&(n+=be*Un));return i>0?n/i:1}scoreStemPenalty(t){let{stemMatchCount:e,totalKeywordMatches:r}=t;return e<=0||r<=0?0:-(e/r)*Kn}scoreLanguageBoost(t){let{pattern:e}=t;if(e.language!=="ar")return 0;let r=e.template.tokens[0];return !r||r.type!=="literal"?0:rt.has(r.value)||r.alternatives?.some(n=>rt.has(n))?et:0}scoreLanguageAdjustment(t){let{pattern:e,captured:r}=t;if(e.language!=="ar")return 0;let n=0;for(let[i,o]of r.entries()){let s=Hn[i];if(!s||s.length===0)continue;let u="metadata"in o?o.metadata:void 0;u&&typeof u.prepositionValue=="string"&&(s.includes(u.prepositionValue)?n+=.1:n-=.1);}return Math.max(-tt,Math.min(tt,n))}},Xn=new Yn,de=class te{constructor(e){this.matchCache=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??Xn;}matchPattern(e,r){let n=e.mark(),i=new Map;if(this.currentProfile=D(r.language),this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(e,r.template.tokens,i))return e.reset(n),null;let s=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()-n.position,confidence:s}}matchBest(e,r){this.matchCache.clear();let n=[],i=e.position();for(let s of r){let u=e.mark(),a=`${i}:${s.id}`,l;this.matchCache.has(a)?l=this.matchCache.get(a):(l=this.matchPattern(e,s),this.matchCache.set(a,l)),l&&n.push(l),e.reset(u);}if(n.length===0)return null;n.sort((s,u)=>{let a=u.pattern.priority-s.pattern.priority;return a!==0?a:u.confidence-s.confidence});let o=n[0];return this.matchPattern(e,o.pattern),o}matchTokenSequence(e,r,n){let i=r[0],o=i?.type==="literal"&&(i.value==="and"||i.value==="then"||i.alternatives?.includes("and")||i.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!o)for(;e.peek()?.kind==="conjunction";)e.advance();for(let s of r)if(!this.matchPatternToken(e,s,n)){if(this.isOptional(s))continue;return false}return true}matchPatternToken(e,r,n){switch(r.type){case "literal":return this.matchLiteralToken(e,r);case "role":return this.matchRoleToken(e,r,n);case "group":return this.matchGroupToken(e,r,n);default:return false}}matchLiteralToken(e,r){let n=e.peek();if(!n)return false;let i=this.getMatchType(n,r.value);if(i!=="none")return this.totalKeywordMatches++,i==="stem"&&this.stemMatchCount++,e.advance(),true;if(r.alternatives)for(let o of r.alternatives){let s=this.getMatchType(n,o);if(s!=="none")return this.totalKeywordMatches++,s==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,r,n){this.skipNoiseWords(e);let i=e.peek();if(!i)return r.optional||false;let o=this.tryMatchPossessiveExpression(e);if(o)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(o.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(n.set(r.role,o),true);let s=this.tryMatchMethodCallExpression(e);if(s)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(s.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(n.set(r.role,s),true);let u=this.tryMatchPossessiveSelectorExpression(e);if(u)return r.expectedTypes&&r.expectedTypes.length>0&&!Je(u.type,r.expectedTypes)?r.optional||false:(n.set(r.role,u),true);let a=this.tryMatchPropertyAccessExpression(e);if(a)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(a.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(n.set(r.role,a),true);let l=this.tryMatchSelectorPropertyExpression(e);if(l)return r.expectedTypes&&r.expectedTypes.length>0&&!Je(l.type,r.expectedTypes)?r.optional||false:(n.set(r.role,l),true);let c=this.tokenToSemanticValue(i);return !c||r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(c.type)?r.optional||false:(n.set(r.role,c),e.advance(),true)}tryMatchPossessiveExpression(e){let r=e.peek();if(!r||!this.currentProfile)return null;let n=(r.normalized||r.value).toLowerCase(),i=Fn(this.currentProfile,n);if(!i)return null;let o=e.mark();e.advance();let s=e.peek();if(!s)return e.reset(o),null;if(s.kind==="identifier"||s.kind==="keyword"&&!this.isStructuralKeyword(s.value)||s.kind==="selector"&&s.value.startsWith("*")||s.kind==="selector"&&s.value.startsWith("@")||s.kind==="selector"&&s.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s.value)){e.advance();let u=s.value;s.kind==="selector"&&u.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(u)&&(u=u.substring(1));let a=u;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)a+=e.peek().value,e.advance();let l=e.peek();return l?.kind==="literal"&&l.value.startsWith("(")&&(a+=l.value,e.advance()),Ee(L(i),a)}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 n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let o=e.peek();if(!o||o.kind!=="identifier")return e.reset(n),null;e.advance();let s=e.peek();if(!s||s.kind!=="punctuation"||s.value!=="(")return e.reset(n),null;e.advance();let u=[];for(;!e.isAtEnd()&&u.length<te.MAX_METHOD_ARGS;){let l=e.peek();if(!l)break;if(l.kind==="punctuation"&&l.value===")"){e.advance();break}if(l.kind==="punctuation"&&l.value===","){e.advance();continue}u.push(l.value),e.advance();}return {type:"expression",raw:`${r.value}.${o.value}(${u.join(", ")})`}}tryMatchPropertyAccessExpression(e){let r=e.peek();if(!r||r.kind!=="identifier"&&r.kind!=="keyword")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let o=e.peek();if(!o||o.kind!=="identifier")return e.reset(n),null;e.advance();let s=`${r.value}.${o.value}`,u=1;for(;!e.isAtEnd()&&u<te.MAX_PROPERTY_DEPTH;){let l=e.peek();if(!l||l.kind!=="operator"||l.value!==".")break;e.advance();let c=e.peek();if(!c||c.kind!=="identifier")break;e.advance(),s+=`.${c.value}`,u++;}let a=e.peek();if(a&&a.kind==="punctuation"&&a.value==="("){e.advance();let l=[],c=0;for(;!e.isAtEnd()&&l.length<te.MAX_METHOD_ARGS;){let d=e.peek();if(!d)break;if(d.kind==="punctuation"&&d.value===")"){if(c===0){e.advance();break}c--;}if(d.kind==="punctuation"&&d.value==="("&&c++,d.kind==="punctuation"&&d.value===","){e.advance();continue}l.push(d.value),e.advance();}return {type:"expression",raw:`${s}(${l.join(", ")})`}}return {type:"expression",raw:s}}tryMatchPossessiveSelectorExpression(e){let r=e.peek();if(!r||r.kind!=="selector")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="punctuation"||i.value!=="'s")return e.reset(n),null;e.advance();let o=e.peek();return !o||o.kind!=="selector"&&o.kind!=="identifier"?(e.reset(n),null):(e.advance(),Ee(re(r.value),o.value))}tryMatchSelectorPropertyExpression(e){let r=e.peek();if(!r||r.kind!=="selector"||!r.value.startsWith("#"))return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="selector"||!i.value.startsWith("."))return e.reset(n),null;let o=e.peek(1);o&&o.kind,e.advance();let s=i.value.slice(1);return Ee(re(r.value),s)}matchGroupToken(e,r,n){let i=e.mark(),o=new Set(n.keys());if(!this.matchTokenSequence(e,r.tokens,n)){e.reset(i);for(let u of n.keys())o.has(u)||n.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 Ye(r)?L(r):k(e.normalized||e.value);case "identifier":if(e.value.startsWith(":"))return L(e.value);let n=e.value.toLowerCase();return Ye(n)?L(n):{type:"expression",raw:e.value};case "url":return k(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 k(i,"string")}if(e==="true")return k(true,"boolean");if(e==="false")return k(false,"boolean");let r=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(r){let i=parseFloat(r[1]);return r[2]?k(e,"duration"):k(i,"number")}let n=parseFloat(e);return isNaN(n)?k(e,"string"):k(n,"number")}applyExtractionRules(e,r){for(let[n,i]of Object.entries(e.extraction))r.has(n)||(i.value!==void 0?r.set(n,{type:"literal",value:i.value}):i.default&&r.set(n,i.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}skipNoiseWords(e){let r=e.peek();if(!r)return;let n=r.value.toLowerCase();if(te.ENGLISH_NOISE_WORDS.has(n)){let i=e.mark();e.advance();let o=e.peek();if(o&&(o.kind==="selector"||o.kind==="identifier"))return;e.reset(i);}n==="class"&&e.advance();}extractEventModifiers(e){let r={},n=false;for(;!e.isAtEnd();){let i=e.peek();if(!i||i.kind!=="event-modifier")break;let o=i.metadata;if(!o)break;switch(n=true,o.modifierName){case "once":r.once=true;break;case "debounce":typeof o.value=="number"&&(r.debounce=o.value);break;case "throttle":typeof o.value=="number"&&(r.throttle=o.value);break;case "queue":(o.value==="first"||o.value==="last"||o.value==="all"||o.value==="none")&&(r.queue=o.value);break}e.advance();}return n?r:void 0}};de.MAX_PROPERTY_DEPTH=10;de.MAX_METHOD_ARGS=20;de.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var vt=de,q=new vt;function Zn(t){return Vn(t)}function we(t,e){return Wn(t,e)}function yt(){return ht()}var Jn={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 ei={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)"}},ti={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"}},ri={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to remove",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},ni={action:"put",description:"Put content into a target element or variable",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to put",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"into"}}],errorCodes:["MISSING_ARGUMENTS","MISSING_CONTENT","MISSING_POSITION","INVALID_POSITION","NO_TARGET","NO_ELEMENTS"],preconditions:[{condition:"Command has content and position arguments",errorCode:"MISSING_ARGUMENTS",message:"put requires arguments"},{condition:"Content to put is specified",errorCode:"MISSING_CONTENT",message:"put requires content"},{condition:"Position keyword is specified (into, before, after, etc.)",errorCode:"MISSING_POSITION",message:"put requires position keyword"}],recoveryHints:{MISSING_ARGUMENTS:"Use syntax: put <content> into/before/after <target>",MISSING_CONTENT:"Add content to put (string, element, or expression)",MISSING_POSITION:"Add position keyword: into, before, after, at start of, at end of",INVALID_POSITION:"Valid positions: into, before, after, at start of, at end of",NO_TARGET:'Ensure target element exists or use "me" reference',NO_ELEMENTS:"Check that the selector matches existing elements"}},ii={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>"}},oi={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}]},si={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}]},ui={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}]},ai={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}]},li={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"Duration or event to wait for",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},ci={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",roles:[{role:"source",description:"The URL to fetch from",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,renderOverride:{en:""}},{role:"responseType",description:"Response format (json, text, html, blob, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"method",description:"HTTP method (GET, POST, etc.)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3},{role:"destination",description:"Where to store the result",required:false,expectedTypes:["selector","reference"],svoPosition:4,sovPosition:4}]},pi={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"}}]},di={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"}}]},fi={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"}}]},mi={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"}}]},hi={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}]},vi={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}]},yi={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}]},gi={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}]},Ei={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}]},bi={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}]},wi={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}]},Si={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"}}]},Ci={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}]},ki={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}]},Ti={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},xi={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"'},Ai={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"}}]},zi={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}]},Ri={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},Ni={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:""}}]},Pi={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}]},Oi={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"}}]},Ii={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}]},_i={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}]},Mi={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}]},Li={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}]},Di={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}]},Fi={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},Bi={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:""}}]},$i={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"}}]},ji={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Vi={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}]},Wi={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}]},qi={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"}}]},Ui={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"}}]},Ki={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"}}]},Gi={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}]},Hi={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Yi={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}]},Xi={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},Zi={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}]},Ji={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}]},gt={toggle:ei,add:ti,remove:ri,put:ni,set:ii,show:oi,hide:si,on:ui,trigger:ai,wait:li,fetch:ci,increment:pi,decrement:di,append:fi,prepend:mi,log:hi,get:vi,take:yi,make:gi,halt:Ei,settle:bi,throw:wi,send:Si,if:Ci,unless:ki,else:Ti,repeat:xi,for:Ai,while:zi,continue:Ri,go:Ni,transition:Pi,clone:Oi,focus:Ii,blur:_i,call:Mi,return:Li,js:Di,async:Fi,tell:Bi,default:$i,init:ji,behavior:Vi,install:Wi,measure:qi,swap:Ui,morph:Ki,beep:Gi,break:Hi,copy:Yi,exit:Xi,pick:Zi,render:Ji,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function Qi(){return Object.values(gt).filter(t=>t.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(Dn(),lt)).then(({validateAllSchemas:t,formatValidationResults:e})=>{let r=t(gt);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(t=>{console.debug("Schema validation skipped:",t);});var nt=class extends Error{constructor(t,e,r,n){super(t),this.name="SemanticParseError",this.language=e,this.input=r,this.diagnostics=n;}};function N(t,e,r){return {message:t,severity:e,source:"semantic-parser",...r&&{code:r}}}function pe(t,e){return e.length===0?t:{...t,diagnostics:e}}var X=class O{parse(e,r){let{modifiers:n,remainingInput:i}=this.extractStandaloneModifiers(e,r),o=i||e,s=[],u=we(o,r),a=U(r);if(a.length===0)throw new nt(`No patterns available for language: ${r}`,r,o,[N(`No patterns registered for language '${r}'`,"error","no-patterns")]);let l=[...a].sort((y,E)=>E.priority-y.priority),c=l.filter(y=>y.command==="on"),p=q.matchBest(u,c);if(p){s.push(N(`event pattern matched: ${p.pattern.id} (confidence: ${p.confidence.toFixed(2)})`,"info","pattern-match"));let y=this.buildEventHandler(p,u,r),E=n?this.applyModifiers(y,n):y;return pe(E,s)}s.push(N(`event patterns: ${c.length} tried, no match`,"info","stage-event"));let d=l.filter(y=>y.command!=="on"),f=q.matchBest(u,d);if(f)return s.push(N(`command pattern matched: ${f.pattern.id} (confidence: ${f.confidence.toFixed(2)})`,"info","pattern-match")),pe(this.buildCommand(f,r),s);s.push(N(`command patterns: ${d.length} tried, no match`,"info","stage-command"));let h=this.trySOVEventExtraction(o,r,l);if(h){s.push(N("SOV event extraction succeeded","info","stage-sov"));let y=n?this.applyModifiers(h,n):h;return pe(y,s)}s.push(N("SOV event extraction: no event keyword found","info","stage-sov"));let g=this.tryCompoundCommandParsing(u,d,r);if(g)return s.push(N("compound command parsing succeeded","info","stage-compound")),pe(g,s);throw s.push(N("compound parsing: no then-keywords or no command matches","info","stage-compound")),s.push(N(`all parse stages exhausted for "${o}"`,"error","parse-failed")),new nt(`Could not parse input in ${r}: ${o}`,r,o,s)}canParse(e,r){try{return this.parse(e,r),!0}catch{return false}}supportedLanguages(){return yt()}buildCommand(e,r){if(!e)throw new Error("No match to build command from");let n={};for(let[i,o]of e.captured)n[i]=o;return le(e.pattern.command,n,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence})}buildEventHandler(e,r,n){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 o=q.extractEventModifiers(r),s=this.extractOrConjunctionEvents(r,n),u=i;s.length>0&&i.type==="literal"&&(u={type:"literal",value:[String(i.value),...s.map(p=>String("value"in p?p.value:""))].join(" or ")});let a,l=e.captured.get("action");if(l&&l.type==="literal"){let c=l.value,p={};for(let[h,g]of e.captured)h!=="event"&&h!=="action"&&h!=="continues"&&(p[h]=g);let d=le(c,p,{sourceLanguage:n,patternId:e.pattern.id,confidence:e.confidence}),f=e.captured.get("continues");if(f&&f.type==="literal"&&f.value==="then"){let h=U(n).filter(E=>E.command!=="on").sort((E,w)=>w.priority-E.priority),g=U(n).filter(E=>E.id.startsWith("grammar-")&&E.id.includes("-continuation")).sort((E,w)=>w.priority-E.priority),y=this.parseBodyWithGrammarPatterns(r,h,g,n);y.length>0?a=[d,...y]:a=[d];}else a=[d];}else {let c=U(n).filter(p=>p.command!=="on").sort((p,d)=>d.priority-p.priority);a=this.parseBodyWithClauses(r,c,n);}return Xe(u,a,o,{sourceLanguage:n,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,r,n){let i=[],o=[];for(;!e.isAtEnd();){let s=e.peek();if(!s)break;let u=s.kind==="conjunction"||s.kind==="keyword"&&this.isThenKeyword(s.value,n),a=s.kind==="keyword"&&this.isEndKeyword(s.value,n);if(u){if(o.length>0){let l=this.parseClause(o,r,n);i.push(...l),o.length=0;}e.advance();continue}if(a){if(o.length>0){let l=this.parseClause(o,r,n);i.push(...l);}e.advance();break}o.push(s),e.advance();}if(o.length>0){let s=this.parseClause(o,r,n);i.push(...s);}return i.length>1?[Ze(i,"then",{sourceLanguage:n})]:i}parseClause(e,r,n){if(e.length===0)return [];let i=new ee(e,n),o=[];for(;!i.isAtEnd();){let s=q.matchBest(i,r);s?o.push(this.buildCommand(s,n)):i.advance();}if(o.length===0){let s=this.parseSOVClauseByVerbAnchoring(e,n);if(s.length>0)return s}return o}static buildVerbLookup(e){let r=new Map;for(let[n,i]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","for","end","then","and"].includes(n)&&(r.set(i.primary.toLowerCase(),n),i.alternatives))for(let o of i.alternatives)r.set(o.toLowerCase(),n);return r}static buildMarkerToRoleLookup(e){let r=new Map;for(let[n,i]of Object.entries(e.roleMarkers))if(i&&(r.set(i.primary,n),i.alternatives))for(let o of i.alternatives)r.has(o)||r.set(o,n);return r}parseSOVClauseByVerbAnchoring(e,r){let n=D(r);if(!n||n.wordOrder!=="SOV")return [];let i=O.buildVerbLookup(n),o=O.buildMarkerToRoleLookup(n),s=[],u=0;for(;u<e.length;){let a=-1,l="";for(let h=u;h<e.length;h++){let g=e[h],y=i.get(g.value.toLowerCase()),E=g.normalized?i.get(g.normalized.toLowerCase()):void 0,w=y||E;if(w){a=h,l=w;break}}if(a===-1)break;let c=e.slice(u,a),p=e.length;for(let h=a+1;h<e.length;h++){let g=e[h];if(g.kind==="conjunction"||this.isThenKeyword(g.value,r)){p=h;break}if(h>a+1&&(i.get(g.value.toLowerCase())||(g.normalized?i.get(g.normalized.toLowerCase()):void 0))){p=h;break}}let d=e.slice(a+1,p),f=this.extractRolesFromMarkedTokens(c,d,o,l,r);if(s.push(le(l,f,{sourceLanguage:r,confidence:.7})),u=p,u<e.length){let h=e[u];(h.kind==="conjunction"||this.isThenKeyword(h.value,r))&&u++;}}return s}extractRolesFromMarkedTokens(e,r,n,i,o){let s={},u=a=>{let l=[];for(let c of a){let p=n.get(c.value);if(p&&c.kind==="particle"&&l.length>0){let d=this.tokensToSemanticValue(l);if(d){let f=this.mapRoleForCommand(p,i,s);f&&(s[f]=d);}l=[];}else l.push(c);}if(l.length>0){let c=this.tokensToSemanticValue(l);c&&(s.patient?s.destination||(s.destination=c):s.patient=c);}};return u(e),u(r),s}mapRoleForCommand(e,r,n){return n[e]?e==="patient"&&!n.destination?"destination":e==="destination"&&!n.patient?"patient":e==="source"&&!n.source?"source":null:e}tokensToSemanticValue(e){if(e.length===0)return null;let r=e.filter(o=>o.kind!=="whitespace");if(r.length===0)return null;if(r.length===1)return this.tokenToSemanticValue(r[0]);let n=r.map(o=>o.value).join(""),i=r[0];return i.kind==="selector"||i.value.startsWith("#")||i.value.startsWith(".")||i.value.startsWith("@")||i.value.startsWith("*")?re(n):i.kind==="literal"||i.value.startsWith('"')||i.value.startsWith("'")?k(n):i.kind==="reference"?L(n):k(n)}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 k(r);if(/^-?\d+(\.\d+)?$/.test(r))return k(parseFloat(r));if(r==="true"||r==="\u771F"||r==="\uCC38"||r==="do\u011Fru")return k(true);if(r==="false"||r==="\u507D"||r==="\uAC70\uC9D3"||r==="yanl\u0131\u015F")return k(false);let n=e.normalized?.toLowerCase();return n==="me"||n==="it"||n==="you"||n==="result"||n==="body"?L(n):e.kind==="reference"?L(e.normalized||"me"):k(r)}parseBodyWithGrammarPatterns(e,r,n,i){let o=[];for(;!e.isAtEnd();){let s=e.peek();if(s&&this.isThenKeyword(s.value,i)){e.advance();continue}if(s&&this.isEndKeyword(s.value,i)){e.advance();break}let u=false;if(n.length>0){let a=q.matchBest(e,n);if(a){let l=a.pattern.command,c={};for(let[f,h]of a.captured)f!=="event"&&f!=="action"&&f!=="continues"&&(c[f]=h);let p=le(l,c,{sourceLanguage:i,patternId:a.pattern.id});o.push(p),u=true;let d=a.captured.get("continues");if(d&&d.type==="literal"&&d.value==="then")continue}}if(!u){let a=q.matchBest(e,r);a&&(o.push(this.buildCommand(a,i)),u=true);}u||e.advance();}return o}tryCompoundCommandParsing(e,r,n){let i=e.tokens;if(!i.some(a=>a.kind==="conjunction"||a.kind==="keyword"&&this.isThenKeyword(a.value,n)))return null;let s=new ee(i,n),u=this.parseBodyWithClauses(s,r,n);return u.length===0?null:u.length===1?u[0]:Ze(u,"then",{sourceLanguage:n,confidence:.65})}trySOVEventExtraction(e,r,n){let i=O.SOV_EVENT_MARKERS[r];if(!i)return null;let s=we(e,r).tokens,u=Jn[r],a=new Set;if(u)for(let b of Object.keys(u))a.add(b.toLowerCase());let l=O.SOV_SOURCE_MARKERS[r],c=-1,p="",d="",f=1;for(let b=0;b<s.length;b++){let x=s[b],I=x.value.toLowerCase(),_=I,F="",me=I.indexOf("[");me>0&&(_=I.slice(0,me),F=x.value.slice(me));let he=x.normalized?.toLowerCase(),Oe=he&&O.KNOWN_EVENTS.has(he),Ie=a.has(I)||a.has(_),Pt=O.KNOWN_EVENTS.has(_);if(Oe||Ie||Pt){let Z;if(Oe?Z=he:Ie?Z=u?.[I]??u?.[_]??_:Z=_,i.size>0){let se=1,ve=s[b+1];ve&&ve.kind==="selector"&&ve.value.startsWith("[")&&(se=2);let ue=s[b+se];if(ue&&(ue.kind==="particle"||ue.kind==="keyword")&&i.has(ue.value)){c=b,p=Z,d=F||(se===2?s[b+1].value:""),f=se+1;break}}else {c=b,p=Z,d=F,f=1;break}}}if(c===-1)return null;let h=new Set;for(let b=c;b<c+f;b++)h.add(b);if(l){let b=c+f;if(b<s.length){let x=s[b];(x.kind==="particle"||x.kind==="keyword")&&l.markers.has(x.value)&&h.add(b);}for(let x=0;x<c;x++){let I=s[x],_=I.value.toLowerCase(),F=I.normalized?.toLowerCase();if(l.windowTokens.has(_)||F&&l.windowTokens.has(F)){h.add(x);break}}}let g=s.filter((b,x)=>!h.has(x));if(g.length===0)return null;let y=n.filter(b=>b.command!=="on"),E=new ee(g,r),w=this.parseBodyWithClauses(E,y,r);if(w.length===0)return null;let Pe={sourceLanguage:r,confidence:.75};return d&&(Pe.keyFilter=d),Xe({type:"literal",value:p},w,void 0,Pe)}isThenKeyword(e,r){let n={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 (n[r]||n.en).has(e.toLowerCase())}isEndKeyword(e,r){let n={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 (n[r]||n.en).has(e.toLowerCase())}extractStandaloneModifiers(e,r){let i=we(e,r).tokens;if(i.length===0)return {modifiers:null,remainingInput:null};let s=i[0].value.toLowerCase(),u=O.STANDALONE_MODIFIERS[s];if(!u)return {modifiers:null,remainingInput:null};let a={},l=1;if(u==="once")a.once=true;else {let f=1;if(f<i.length){let h=i[f];(h.kind==="keyword"||h.kind==="particle")&&(f++,l++);}if(f<i.length){let h=i[f];if(h.kind==="literal"){let g=h.value.match(/^(\d+)(ms|s|m)?$/);if(g){let y=parseInt(g[1],10),E=g[2]||"ms";E==="s"?y*=1e3:E==="m"&&(y*=6e4),a[u]=y,l=f+1;}}}a[u]||(a[u]=u==="debounce"?300:100);}let c=i.slice(l);if(c.length===0)return {modifiers:null,remainingInput:null};let p=c[0].position.start,d=e.slice(p);return {modifiers:a,remainingInput:d}}applyModifiers(e,r){return {...e,eventModifiers:{...e.eventModifiers,...r}}}extractOrConjunctionEvents(e,r){let n=[];for(;;){let i=e.mark(),o=e.peek();if(!o)break;let s=(o.normalized||o.value).toLowerCase();if(!O.OR_KEYWORDS.has(s)){e.reset(i);break}e.advance();let u=e.peek();if(!u){e.reset(i);break}let a=(u.normalized||u.value).toLowerCase();e.advance(),n.push({type:"literal",value:a});}return n}};X.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);X.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"])};X.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"])}};X.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};X.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 eo=X,to=new eo;function xe(t,e){return to.parse(t,e)}var ke=class{constructor(t={}){this.cache=new Map,this.config={maxSize:t.maxSize??1e3,ttlMs:t.ttlMs??0,enabled:t.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(t,e){return `${e}:${t}`}isExpired(t){return this.config.ttlMs===0?false:Date.now()-t.createdAt>this.config.ttlMs}evictLRU(){let t=this.cache.keys().next().value;t!==void 0&&(this.cache.delete(t),this.stats.evictions++);}get(t,e){if(!this.config.enabled){this.stats.misses++;return}let r=this.makeKey(t,e),n=this.cache.get(r);if(!n){this.stats.misses++;return}if(this.isExpired(n)){this.cache.delete(r),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(r),n.lastAccessed=Date.now(),this.cache.set(r,n),this.stats.hits++,n.result}set(t,e,r){if(!this.config.enabled||r.confidence===0)return;let n=this.makeKey(t,e),i=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(n,{result:r,createdAt:i,lastAccessed:i});}has(t,e){if(!this.config.enabled)return false;let r=this.makeKey(t,e),n=this.cache.get(r);return n?this.isExpired(n)?(this.cache.delete(r),this.stats.expirations++,false):true:false}delete(t,e){let r=this.makeKey(t,e);return this.cache.delete(r)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let t=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:t>0?this.stats.hits/t:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(t){if(t.maxSize!==void 0)for(this.config.maxSize=t.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();t.ttlMs!==void 0&&(this.config.ttlMs=t.ttlMs),t.enabled!==void 0&&(this.config.enabled=t.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}},ro=new ke;var no=class{constructor(t={}){this.patternMatcher=new vt,this.languages=new Set(ht()),t.cache===false?this.cache=new ke({enabled:false}):this.cache=t.cache?new ke(t.cache):ro;}analyze(t,e){if(!this.supportsLanguage(e))return {confidence:0,errors:[`Language '${e}' is not supported for semantic parsing`]};let r=this.cache.get(t,e);if(r)return r;let n=this.analyzeUncached(t,e);return this.cache.set(t,e,n),n}analyzeUncached(t,e){try{try{let s=xe(t,e),u={confidence:s.metadata?.confidence??.8,node:s};return s.kind==="command"?{...u,command:{name:s.action,roles:s.roles}}:u}catch{}let r=Zn(e);if(!r)return {confidence:0,errors:[`No tokenizer available for language '${e}'`]};let n=r.tokenize(t),i=U(e);if(i.length===0)return {confidence:0,errors:[`No patterns available for language '${e}'`]};let o=this.patternMatcher.matchBest(n,i);if(o){let s=this.buildSemanticNode(o);return {confidence:o.confidence,command:{name:o.pattern.command,roles:o.captured},node:s,tokensConsumed:o.consumedTokens}}return {confidence:0,errors:["No pattern matched the input"]}}catch(r){return {confidence:0,errors:[r instanceof Error?r.message:String(r)]}}}supportsLanguage(t){return this.languages.has(t)}supportedLanguages(){return Array.from(this.languages)}getCacheStats(){return this.cache.getStats()}clearCache(){this.cache.clear();}configureCache(t){this.cache.configure(t);}buildSemanticNode(t){return {kind:"command",action:t.pattern.command,roles:t.captured,metadata:{patternId:t.pattern.id}}}};function Et(t){return new no(t)}var io=.5;function bt(t,e=io){return t.confidence>=e&&t.command!==void 0}function wt(t,e){let r=e==="SOV"?"sovPosition":"svoPosition";return [...t].sort((n,i)=>{let o=n[r]??99,s=i[r]??99;return o-s})}function oo(t,e){let r=t.markerOverride?.[e.code],n=e.roleMarkers[t.role];if(r!==void 0)return {primary:r,position:n?.position??"before",isOverride:true};if(n&&n.primary){let i={primary:n.primary,position:n.position,isOverride:false};return n.alternatives&&(i.alternatives=n.alternatives),i}return null}function so(t,e,r,n,i){let o=[];if(o.push({type:"role",role:"event",optional:false}),n.position==="after"){let l=n.primary.split(/\s+/);if(l.length>1)for(let c of l)o.push({type:"literal",value:c});else {let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(c);}}let s=e.roleMarkers.destination;s&&o.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary}]}),o.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.patient;if(u){let l=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};o.push(l);}let a=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return o.push(a),{id:`${t.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`{event} ${n.primary} {destination?} {patient} ${u?.primary||""} ${r.primary}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function uo(t,e,r,n,i){let o=[];o.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let a=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};o.push(a);}if(o.push({type:"role",role:"event",optional:false}),n.position==="after"){let a=n.primary.split(/\s+/);if(a.length>1)for(let l of a)o.push({type:"literal",value:l});else {let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(l);}}let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return o.push(u),{id:`${t.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`{patient} ${s?.primary||""} {event} ${n.primary} ${r.primary}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ao(t,e,r,n,i){let o=[];o.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};o.push(l);}let u=e.roleMarkers.destination;if(u&&(o.push({type:"role",role:"destination",optional:false}),o.push(u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary})),o.push({type:"role",role:"event",optional:false}),n.position==="after"){let l=n.primary.split(/\s+/);if(l.length>1)for(let c of l)o.push({type:"literal",value:c});else {let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(c);}}let a=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return o.push(a),{id:`${t.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(i.basePriority??100)+40,template:{format:`{patient} ${s?.primary||""} {destination} ${u?.primary||""} {event} ${n.primary} ${r.primary}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function lo(t,e,r,n,i){let o=[];o.push({type:"role",role:"event",optional:false});let s=n.alternatives?.filter(c=>!c.includes(" ")&&c.length>1)||[];s.length>0&&o.push({type:"literal",value:s[0],alternatives:s.slice(1)});let u=e.roleMarkers.destination;u&&o.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}]}),o.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.patient;if(a){let c=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};o.push(c);}let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return o.push(l),{id:`${t.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(i.basePriority??100)+52,template:{format:`{event}${s[0]||""} {patient} ${r.primary}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function co(t,e,r,n,i){let o=[];if(o.push({type:"role",role:"event",optional:false}),n.position==="after"){let u=n.primary.split(/\s+/);if(u.length>1)for(let a of u)o.push({type:"literal",value:a});else {let a=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(a);}}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return o.push(s),{id:`${t.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{event} ${n.primary} ${r.primary}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function po(t,e,r,n){let i=e.eventHandler?.temporalMarkers;if(!i||i.length===0)return null;let o=[];o.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&o.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),o.push({type:"literal",value:i[0],alternatives:i.slice(1)}),o.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s?.primary){let a=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};o.push(a);}let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return o.push(u),{id:`${t.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(n.basePriority??100)+49,template:{format:`{event} ${i[0]} {patient} ${r.primary}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function fo(t,e,r,n,i){let o=[];if(o.push({type:"role",role:"event",optional:false}),n.position==="after"){let c=n.primary.split(/\s+/);if(c.length>1)for(let p of c)o.push({type:"literal",value:p});else {let p=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(p);}}let u=[...t.roles.filter(c=>c.required)].sort((c,p)=>{let d=c.sovPosition??999,f=p.sovPosition??999;return d-f});for(let c of u){o.push({type:"role",role:c.role,optional:false});let p,d;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)p=c.markerOverride[e.code];else {let f=e.roleMarkers[c.role];f&&(p=f.primary,d=f.alternatives);}if(p){let f=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};o.push(f);}}let a=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};o.push(a);let l=u.map(c=>`{${c.role}}`).join(" ");return {id:`${t.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`{event} ${n.primary} ${l} ${r.primary}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},...Object.fromEntries(u.map(c=>[c.role,{fromRole:c.role}]))}}}function mo(t,e,r,n,i){let o=[],u=[...t.roles.filter(h=>h.required)].sort((h,g)=>{let y=h.sovPosition??999,E=g.sovPosition??999;return y-E}),a=u[0];o.push({type:"role",role:a.role,optional:false});let l;if(a.markerOverride&&a.markerOverride[e.code]!==void 0)l=a.markerOverride[e.code];else {let h=e.roleMarkers[a.role];h&&(l=h.primary);}if(l&&o.push({type:"literal",value:l}),o.push({type:"role",role:"event",optional:false}),n.position==="after"){let h=n.primary.split(/\s+/);if(h.length>1)for(let g of h)o.push({type:"literal",value:g});else {let g=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(g);}}let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};o.push(c);let p=u[1];o.push({type:"role",role:p.role,optional:false});let d,f;if(p.markerOverride&&p.markerOverride[e.code]!==void 0)d=p.markerOverride[e.code];else {let h=e.roleMarkers[p.role];h&&(d=h.primary,f=h.alternatives);}if(d){let h=f?{type:"literal",value:d,alternatives:f}:{type:"literal",value:d};o.push(h);}return {id:`${t.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{${a.role}} {event} ${n.primary} ${r.primary} {${p.role}}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},[a.role]:{fromRole:a.role},[p.role]:{fromRole:p.role}}}}function it(t,e,r,n,i){let o=[];if(n.position==="before"){let a=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(a);}o.push({type:"role",role:"event",optional:false});let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};o.push(s),o.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.destination;return u&&o.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:`${t.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`${n.primary} {event} ${r.primary} {patient} ${u?.primary||""} {destination?}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ho(t,e,r,n,i){let o=[],s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};o.push(s),o.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.destination;if(u&&o.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}]}),n.position==="before"){let a=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(a);}return o.push({type:"role",role:"event",optional:false}),{id:`${t.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?} ${n.primary} {event}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function vo(t,e,r,n,i){let o=[],s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};o.push(s);let a=[...t.roles.filter(c=>c.required)].sort((c,p)=>{let d=c.svoPosition??999,f=p.svoPosition??999;return d-f});for(let c of a){let p,d;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)p=c.markerOverride[e.code];else {let f=e.roleMarkers[c.role];f&&(p=f.primary,d=f.alternatives);}if(p){let f=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};o.push(f);}o.push({type:"role",role:c.role,optional:false});}if(n.position==="before"){let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(c);}o.push({type:"role",role:"event",optional:false});let l=a.map(c=>`{${c.role}}`).join(" ");return {id:`${t.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${r.primary} ${l} ${n.primary} {event}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},...Object.fromEntries(a.map(c=>[c.role,{fromRole:c.role}]))}}}function ot(t,e,r,n,i){let o=[];if(n.position==="before"){let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(c);}o.push({type:"role",role:"event",optional:false});let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};o.push(s);let a=[...t.roles.filter(c=>c.required)].sort((c,p)=>{let d=c.svoPosition??999,f=p.svoPosition??999;return d-f});for(let c of a){let p,d;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)p=c.markerOverride[e.code];else {let f=e.roleMarkers[c.role];f&&(p=f.primary,d=f.alternatives);}if(p){let f=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};o.push(f);}o.push({type:"role",role:c.role,optional:false});}let l=a.map(c=>`{${c.role}}`).join(" ");return {id:`${t.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`${n.primary} {event} ${r.primary} ${l}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},...Object.fromEntries(a.map(c=>[c.role,{fromRole:c.role}]))}}}function yo(t,e,r,n,i){let o=[],s=e.eventHandler?.negationMarker;if(n.position==="before"){let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(l);}if(s){let l=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};o.push(l);}o.push({type:"role",role:"event",optional:false});let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};o.push(u),o.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.destination;return a&&o.push({type:"group",optional:true,tokens:[a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary},{type:"role",role:"destination",optional:true}]}),{id:`${t.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${n.primary} ${s?.primary||""} {event} ${r.primary} {patient} ${a?.primary||""} {destination?}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function go(t,e,r,n){let i=[];i.push({type:"literal",value:"and",alternatives:["then"]}),i.push({type:"role",role:"event",optional:false});let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(o),i.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&i.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),{id:`${t.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`[proclitic?] {event} ${r.primary} {patient} ${s?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var ne={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function St(t,e,r=ne){let n=`${t.action}-${e.code}-generated`,i=r.basePriority??100,o=e.keywords[t.action];if(!o)throw new Error(`No keyword translation for '${t.action}' in ${e.code}`);let s=So(t,e,o),u=kt(t,e),a=xo(t,e,o);return {id:n,language:e.code,command:t.action,priority:i,template:{format:a,tokens:s},extraction:u}}function Eo(t,e,r=ne){if(t.roles.filter(u=>!u.required).length===0)return null;let i=t.roles.filter(u=>u.required),o={...t,roles:i};return {...St(o,e,r),id:`${t.action}-${e.code}-generated-simple`,priority:(r.basePriority??100)-5,extraction:kt(t,e)}}function bo(t,e,r=ne){let n=[];if(n.push(St(t,e,r)),r.generateSimpleVariants){let i=Eo(t,e,r);i&&n.push(i);}return n}function Ct(t,e=ne){let r=[],n=Qi();for(let i of n){if(!t.keywords[i.action])continue;let o=bo(i,t,e);if(r.push(...o),t.eventHandler?.eventMarker){let s=wo(i,t,e);r.push(...s);}}return r}function wo(t,e,r=ne){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let n=[],i=e.eventHandler.eventMarker,o=e.keywords[t.action];if(!o)return [];let u=t.roles.filter(a=>a.required).length===2;if(e.wordOrder==="SOV")if(u)n.push(fo(t,e,o,i,r)),n.push(mo(t,e,o,i,r));else {n.push(so(t,e,o,i,r)),n.push(uo(t,e,o,i,r));let a=e.roleMarkers.destination;a&&a.primary!==i.primary&&n.push(ao(t,e,o,i,r));let l=i.primary.split(/\s+/),c=i.alternatives?.some(d=>!d.includes(" ")&&d.length>1);l.length>1&&c&&n.push(lo(t,e,o,i,r)),n.push(co(t,e,o,i,r));let p=po(t,e,o,r);p&&n.push(p);}else e.wordOrder==="VSO"?u?(n.push(ot(t,e,o,i,r)),n.push(vo(t,e,o,i,r))):(n.push(it(t,e,o,i,r)),n.push(ho(t,e,o,i,r)),e.eventHandler?.negationMarker&&n.push(yo(t,e,o,i,r)),e.tokenization?.prefixes&&n.push(go(t,e,o,r))):u?n.push(ot(t,e,o,i,r)):n.push(it(t,e,o,i,r));return n}function So(t,e,r){let n=[],i=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary},o=Co(t,e);switch(e.wordOrder){case "SVO":n.push(i),n.push(...o);break;case "SOV":n.push(...o),n.push(i);break;case "VSO":n.push(i),n.push(...o);break;default:n.push(i),n.push(...o);}return n}function Co(t,e){let r=[],n=wt(t.roles,e.wordOrder);for(let i of n){let o=ko(i,e);i.required?r.push(...o):r.push({type:"group",optional:true,tokens:o});}return r}function ko(t,e){let r=[],n=t.markerOverride?.[e.code],i=e.roleMarkers[t.role],o={type:"role",role:t.role,optional:!t.required,expectedTypes:t.expectedTypes};if(n!==void 0)(i?.position??"before")==="before"?(n&&r.push({type:"literal",value:n}),r.push(o)):(r.push(o),n&&r.push({type:"literal",value:n}));else if(i)if(i.position==="before"){if(i.primary){let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};r.push(s);}r.push(o);}else {r.push(o);let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};r.push(s);}else r.push(o);return r}function To(t,e){let r={};for(let n of t.roles){let i=n.markerOverride?.[e.code],o=e.roleMarkers[n.role];i!==void 0?r[n.role]=i?{marker:i}:{}:o&&o.primary?r[n.role]=o.alternatives?{marker:o.primary,markerAlternatives:o.alternatives}:{marker:o.primary}:r[n.role]={};}return r}function kt(t,e){let r=To(t,e),n={};for(let i of t.roles){let o=r[i.role]||{};!i.required&&i.default?n[i.role]={...o,default:i.default}:n[i.role]=o;}return n}function xo(t,e,r){let n=[],o=wt(t.roles,e.wordOrder).map(s=>{let u=oo(s,e),a="";return u&&u.primary?u.position==="before"?a=`${u.primary} {${s.role}}`:a=`{${s.role}} ${u.primary}`:a=`{${s.role}}`,s.required?a:`[${a}]`});switch(e.wordOrder){case "SVO":case "VSO":n.push(r.primary,...o);break;case "SOV":n.push(...o,r.primary);break;default:n.push(r.primary,...o);}return n.join(" ")}function fe(t){let e=t.getAttribute("data-lang");if(e)return Ae(e);let r=t.getAttribute("data-hyperscript-lang")??t.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(r)return Ae(r);let n=typeof document<"u"?document.documentElement?.lang:null;return n&&n!=="en"?Ae(n):null}function Ae(t){return t.split("-")[0].toLowerCase()}var Tt={add:[["patient",""],["destination","to"]],append:[["patient",""],["destination","to"]],async:[],beep:[["patient",""]],behavior:[["patient",""]],blur:[["patient",""]],break:[],call:[["patient",""]],clone:[["patient",""],["destination","into"]],compound:[],continue:[],copy:[["patient",""]],decrement:[["patient",""],["quantity","by"]],default:[["destination",""],["patient","to"]],else:[],exit:[],fetch:[["source",""],["responseType","as"],["method","via"],["destination","on"]],focus:[["patient",""]],for:[["patient",""],["source","in"]],get:[["source",""],["destination","on"]],go:[["destination",""]],halt:[["patient",""]],hide:[["patient",""],["style","with"]],if:[["condition",""]],increment:[["patient",""],["quantity","by"]],init:[],install:[["patient",""],["destination","on"]],js:[["patient",""]],log:[["patient",""]],make:[["patient",""]],measure:[["patient",""],["source","of"]],morph:[["destination",""],["patient","to"]],on:[["event",""],["source","from"]],pick:[["patient",""],["source","from"]],prepend:[["patient",""],["destination","to"]],put:[["patient",""],["destination","into"]],remove:[["patient",""],["source","from"]],render:[["patient",""],["style","with"]],repeat:[["quantity",""],["condition","until"]],return:[["patient",""]],send:[["event",""],["destination","to"]],set:[["destination",""],["patient","to"]],settle:[["patient",""]],show:[["patient",""],["style","with"]],swap:[["method",""],["destination","of"],["patient","with"]],take:[["patient",""],["source","from"]],tell:[["destination",""]],throw:[["patient",""]],toggle:[["patient",""],["destination","on"]],transition:[["patient",""],["goal","to"],["destination","on"],["duration","over"],["style","with"]],trigger:[["event",""],["destination","on"]],unless:[["condition",""]],wait:[["patient",""]],while:[["condition",""]]};function oe(t){switch(t.kind){case "event-handler":return Ao(t);case "compound":return zo(t);default:return Ro(t)}}function Ao(t){let e=["on"],r=t.roles.get("event");r&&e.push(ie(r));let n=t.roles.get("source");if(n&&e.push("from",ie(n)),t.body&&t.body.length>0){let i=t.body.map(oe);e.push(i.join(" then "));}return e.join(" ")}function zo(t){let e=t.chainType==="async"?"async":t.chainType;return t.statements.map(oe).join(` ${e} `)}function Ro(t){let e=Tt[t.action];if(e){let n=[t.action];for(let[i,o]of e){let s=t.roles.get(i);s&&(i==="destination"&&s.type==="reference"&&s.value==="me"||(o&&n.push(o),n.push(ie(s))));}return n.join(" ")}let r=[t.action];for(let[,n]of t.roles)r.push(ie(n));return r.join(" ")}function ie(t){switch(t.type){case "literal":return typeof t.value=="string"&&t.dataType==="string"?`"${t.value}"`:String(t.value);case "selector":return t.value;case "reference":return t.value;case "property-path":return No(t);case "expression":return t.raw;case "flag":return t.enabled?`+${t.name}`:`~${t.name}`}}function No(t){let e=ie(t.object),r=t.property;if(t.object.type==="reference")switch(t.object.value){case "me":return `my ${r}`;case "it":return `its ${r}`;case "you":return `your ${r}`}return `${e}'s ${r}`}var At=.5,Po={confidenceThreshold:At,strategy:"semantic",fallbackToOriginal:true};function Oo(t,e){return typeof t=="number"?t:t[e]??t["*"]??At}var ze=null;function Io(){return ze||(ze=Et()),ze}function Re(t,e,r={}){let n={...Po,...r},i=xt(t,e,n);if(i!==null)return i;let o=Mo(t);if(o){let s=xt(o.commands,e,n);if(s!==null)return o.prefix+s}return t}function xt(t,e,r){if(r.strategy==="semantic"||r.strategy==="auto"){let n=Oo(r.confidenceThreshold,e),i=zt(t,e,n);if(i!==null)return i}if((r.strategy==="auto"||r.strategy==="i18n")&&r.i18nToEnglish){let n=Lo(t,e,r.i18nToEnglish);if(n!==null)return n}return null}var _o=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function Mo(t){let e=t.match(_o);if(!e)return null;let r=e[1],n=t.slice(r.length);return n?{prefix:r,commands:n}:null}function zt(t,e,r){try{let n=Fo(t,e);if(n.length>1)return Bo(n,e,r);let i=Io();if(!i.supportsLanguage(e))return null;let o=i.analyze(t,e);if(!bt(o,r))return null;if(o.node)return oe(o.node);let s=xe(t,e);return oe(s)}catch{return null}}function Lo(t,e,r){try{let n=r(t,e);return n!==t?n:null}catch{return null}}function Do(t){let e=["then"],r=D(t);if(r?.keywords?.then){let n=r.keywords.then;if(n.primary&&n.primary!=="then"&&e.push(n.primary),n.alternatives)for(let i of n.alternatives)e.includes(i)||e.push(i);}return e}function Fo(t,e){let n=Do(e).map(u=>u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),i=new RegExp(`\\s+(?:${n.join("|")})\\s+`,"i"),o=t.split(`
|
|
4
|
-
`).map(
|
|
1
|
+
var HyperscriptI18n=(function(exports){'use strict';function S(r,e){return e?{type:"literal",value:r,dataType:e}:{type:"literal",value:r}}function ce(r,e){return e?{type:"selector",value:r,selectorKind:e}:{type:"selector",value:r}}function Q(r){return {type:"reference",value:r}}function pe(r,e){return {type:"property-path",object:r,property:e}}var Re=new Set(["me","you","it","result","event","target","body"]);function ke(r,e=Re){return e.has(r)}var Tr=class{constructor(r){this.namespace=r,this.enabled=this.checkEnabled();}checkEnabled(){if(typeof process<"u"&&process.env){let r=process.env.DEBUG||"";return r==="*"||r.includes("framework:*")||r.includes(`framework:${this.namespace}`)}return false}log(r,e,...t){if(!this.enabled)return;let i=`[framework:${this.namespace}]`,a=new Date().toISOString();switch(r){case "debug":console.debug(`${a} ${i} DEBUG:`,e,...t);break;case "info":console.info(`${a} ${i} INFO:`,e,...t);break;case "warn":console.warn(`${a} ${i} WARN:`,e,...t);break;case "error":console.error(`${a} ${i} ERROR:`,e,...t);break}}debug(r,...e){this.log("debug",r,...e);}info(r,...e){this.log("info",r,...e);}warn(r,...e){this.log("warn",r,...e);}error(r,...e){this.log("error",r,...e);}isEnabled(){return this.enabled}enable(){this.enabled=true;}disable(){this.enabled=false;}};function Pr(r){return new Tr(r)}function V(r,e){return !e||e.length===0||e.includes(r)||e.includes("expression")?true:r==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):false}function Rr(r,e){return r?.possessive?.keywords?.[e]}var re=class q{constructor(){this.logger=Pr("pattern-matcher"),this.stemMatchCount=0,this.totalKeywordMatches=0;}safeToLowerCase(e){return typeof e=="string"?e.toLowerCase():e==null?"":String(e).toLowerCase()}matchPattern(e,t,i){let a=e.mark(),u=new Map;if(this.logger.debug("========================================"),this.logger.debug("matchPattern ENTRY"),this.logger.debug("Pattern ID:",t.id),this.logger.debug("Pattern command:",t.command),this.logger.debug("Pattern language:",t.language),this.logger.debug("Pattern template:",JSON.stringify(t.template,null,2)),this.logger.isEnabled()){let s=[];for(let l=0;l<10;l++){let m=e.peek(l);if(m)s.push({type:m.type,value:m.value,kind:m.kind});else break}this.logger.debug("Input tokens (first 10):",s),this.logger.debug("Profile code:",i?.code);}this.currentProfile=i,this.stemMatchCount=0,this.totalKeywordMatches=0,this.logger.debug("--- Calling matchTokenSequence ---"),this.logger.debug("Pattern tokens to match:",JSON.stringify(t.template.tokens,null,2));let n=this.matchTokenSequence(e,t.template.tokens,u);if(this.logger.debug("matchTokenSequence returned:",n),this.logger.debug("Captured roles:",Array.from(u.entries()).map(([s,l])=>[s,JSON.stringify(l)])),!n)return this.logger.debug(">>> MATCH FAILED - resetting token position"),e.reset(a),null;let o=this.calculateConfidence(t,u);return this.applyExtractionRules(t,u),{pattern:t,captured:u,consumedTokens:e.position()-a.position,confidence:o}}matchBest(e,t,i){let a=[];for(let n of t){let o=e.mark(),s=this.matchPattern(e,n,i);s&&a.push(s),e.reset(o);}if(a.length===0)return null;a.sort((n,o)=>{let s=o.pattern.priority-n.pattern.priority;if(s!==0)return s;let l=o.confidence-n.confidence;return Math.abs(l)>.001?l:o.consumedTokens-n.consumedTokens});let u=a[0];return this.matchPattern(e,u.pattern),u}matchTokenSequence(e,t,i,a){let u=t[0],n=u?.type==="literal"&&(u.value==="and"||u.value==="then"||u.alternatives?.includes("and")||u.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!n)for(;e.peek()?.kind==="conjunction";)e.advance();let o=null,s=null;for(let l=0;l<t.length;l++){let m=t[l];this.logger.debug(" >> Matching pattern token:",JSON.stringify(m,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"),m.type==="role"&&m.greedy){let v=this.collectStopMarkers(t,l+1);if(a)for(let k of a)v.add(k);let g=[];for(;!e.isAtEnd();){let k=e.peek();if(!k||this.isStopMarker(k,v))break;g.push(k.value),e.advance();}if(g.length>0){i.set(m.role,{type:"expression",raw:g.join(" ")}),o=null,s=null;continue}else {if(m.optional)continue;return false}}if(m.type==="group"){let v=this.collectStopMarkers(t,l+1);if(a)for(let k of a)v.add(k);if(this.matchGroupToken(e,m,i,v)){o=null,s=null;continue}if(this.isOptional(m))continue;return false}let p=m.type==="role"&&m.optional===true,d=p?e.mark():null;if(m.type==="role"&&!p){let v=l+1<t.length?t[l+1]:null;if(v?.type==="literal"){let g=e.peek();if(g&&this.getMatchType(g,v.value)!=="none"){if(this.logger.debug(" >> MARKER-STEAL GUARD: current token matches next literal, skipping role"),this.logger.debug(" >> Token match FAILED"),this.isOptional(m))continue;if(o&&s){this.logger.debug(" >> BACKTRACKING: undoing optional role",s),e.reset(o),i.delete(s),o=null,s=null;let k=this.matchPatternToken(e,m,i);if(this.logger.debug(" >> Backtrack retry result:",k),k)continue}return false}}}let E=this.matchPatternToken(e,m,i);if(this.logger.debug(" >> Match result:",E),E){p?(o=d,s=m.role):(o=null,s=null);continue}if(this.logger.debug(" >> Token match FAILED"),!this.isOptional(m)){if(o&&s){this.logger.debug(" >> BACKTRACKING: undoing optional role",s),e.reset(o),i.delete(s),o=null,s=null;let v=this.matchPatternToken(e,m,i);if(this.logger.debug(" >> Backtrack retry result:",v),v)continue}return false}}return true}matchPatternToken(e,t,i){switch(t.type){case "literal":return this.matchLiteralToken(e,t);case "role":return this.matchRoleToken(e,t,i);case "group":return this.matchGroupToken(e,t,i);default:return false}}matchLiteralToken(e,t){let i=e.peek();if(this.logger.debug(" >>> matchLiteralToken: expecting",t.value),this.logger.debug(" >>> matchLiteralToken: got token",i?JSON.stringify({type:i.type,value:i.value,kind:i.kind}):"null"),!i)return this.logger.debug(" >>> matchLiteralToken: FAIL - no token"),false;let a=this.getMatchType(i,t.value);if(this.logger.debug(" >>> matchType for",i.value,"vs",t.value,":",a),a!=="none")return this.totalKeywordMatches++,a==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let u of t.alternatives){let n=this.getMatchType(i,u);if(n!=="none")return this.totalKeywordMatches++,n==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,t,i){this.logger.debug(" >>> matchRoleToken ENTRY: capturing role",t.role),this.logger.debug(" >>> matchRoleToken: expected types",t.expectedTypes),this.logger.debug(" >>> matchRoleToken: optional?",t.optional),this.skipNoiseWords(e);let a=e.peek();if(this.logger.debug(" >>> After skipNoiseWords, current token:",a?JSON.stringify({value:a.value,kind:a.kind}):"null"),!a)return t.optional||false;let u=this.tryMatchPossessiveExpression(e);if(u)return t.expectedTypes&&t.expectedTypes.length>0&&!V(u.type,t.expectedTypes)?t.optional||false:(i.set(t.role,u),true);let n=this.tryMatchMethodCallExpression(e);if(n)return t.expectedTypes&&t.expectedTypes.length>0&&!V(n.type,t.expectedTypes)?t.optional||false:(i.set(t.role,n),true);let o=this.tryMatchPossessiveSelectorExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!V(o.type,t.expectedTypes)?t.optional||false:(i.set(t.role,o),true);let s=this.tryMatchPropertyAccessExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!V(s.type,t.expectedTypes)?t.optional||false:(i.set(t.role,s),true);let l=this.tryMatchSelectorPropertyExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!V(l.type,t.expectedTypes)?t.optional||false:(i.set(t.role,l),true);this.logger.debug(" >>> Trying tokenToSemanticValue for token:",a?JSON.stringify({value:a.value,kind:a.kind}):"null");let m=this.tokenToSemanticValue(a);return this.logger.debug(" >>> tokenToSemanticValue returned:",m?JSON.stringify(m):"null"),m?(this.logger.debug(" >>> Validating type:",m.type,"against expected:",t.expectedTypes),t.expectedTypes&&t.expectedTypes.length>0&&!V(m.type,t.expectedTypes)?(this.logger.debug(" >>> TYPE MISMATCH - returning",t.optional||false),t.optional||false):(this.logger.debug(" >>> Type validation PASSED"),i.set(t.role,m),e.advance(),true)):t.optional||false}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let i=t.normalized||t.value,a=this.safeToLowerCase(i),u=Rr(this.currentProfile,a);if(!u)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 s=o.value;o.kind==="selector"&&s.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s)&&(s=s.substring(1));let l=s;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)l+=e.peek().value,e.advance();let m=e.peek();return m?.kind==="literal"&&m.value.startsWith("(")&&(l+=m.value,e.advance()),pe(Q(u),l)}return e.reset(n),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="operator"||a.value!==".")return e.reset(i),null;e.advance();let u=e.peek();if(!u||u.kind!=="identifier")return e.reset(i),null;e.advance();let n=e.peek();if(!n||n.kind!=="punctuation"||n.value!=="(")return e.reset(i),null;e.advance();let o=[];for(;!e.isAtEnd()&&o.length<q.MAX_METHOD_ARGS;){let l=e.peek();if(!l)break;if(l.kind==="punctuation"&&l.value===")"){e.advance();break}if(l.kind==="punctuation"&&l.value===","){e.advance();continue}o.push(l.value),e.advance();}return {type:"expression",raw:`${t.value}.${u.value}(${o.join(", ")})`}}tryMatchPropertyAccessExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"&&t.kind!=="keyword")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="operator"||a.value!==".")return e.reset(i),null;e.advance();let u=e.peek();if(!u||u.kind!=="identifier")return e.reset(i),null;e.advance();let n=`${t.value}.${u.value}`,o=1;for(;!e.isAtEnd()&&o<q.MAX_PROPERTY_DEPTH;){let l=e.peek();if(!l||l.kind!=="operator"||l.value!==".")break;e.advance();let m=e.peek();if(!m||m.kind!=="identifier")break;e.advance(),n+=`.${m.value}`,o++;}let s=e.peek();if(s&&s.kind==="punctuation"&&s.value==="("){e.advance();let l=[],m=0;for(;!e.isAtEnd()&&l.length<q.MAX_METHOD_ARGS;){let p=e.peek();if(!p)break;if(p.kind==="punctuation"&&p.value===")"){if(m===0){e.advance();break}m--;}if(p.kind==="punctuation"&&p.value==="("&&m++,p.kind==="punctuation"&&p.value===","){e.advance();continue}l.push(p.value),e.advance();}return {type:"expression",raw:`${n}(${l.join(", ")})`}}return {type:"expression",raw:n}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="punctuation"||a.value!=="'s")return e.reset(i),null;e.advance();let u=e.peek();return !u||u.kind!=="selector"&&u.kind!=="identifier"?(e.reset(i),null):(e.advance(),pe(ce(t.value),u.value))}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||typeof t.value!="string"||!t.value.startsWith("#"))return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="selector"||!a.value.startsWith("."))return e.reset(i),null;let u=e.peek(1);u&&u.kind,e.advance();let n=a.value.slice(1);return pe(ce(t.value),n)}matchGroupToken(e,t,i,a){let u=e.mark(),n=new Set(i.keys());if(this.matchTokenSequence(e,t.tokens,i,a))return true;e.reset(u);for(let l of i.keys())n.has(l)||i.delete(l);if(!t.optional)return false;let s=this.getGroupLeadingMarker(t);if(s)for(let l=1;l<=q.MAX_MARKER_SCAN;l++){let m=e.peek(l);if(!m)break;if((m.normalized||m.value).toLowerCase()===s){this.logger.debug(" >> MARKER SCAN: found",s,"at offset",l,"- skipping intervening tokens");for(let d=0;d<l;d++)e.advance();if(this.matchTokenSequence(e,t.tokens,i,a))return true;e.reset(u);for(let d of i.keys())n.has(d)||i.delete(d);break}}return true}getGroupLeadingMarker(e){let t=e.tokens[0];return t?.type==="literal"?t.value.toLowerCase():null}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem===t&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&this.safeToLowerCase(e.value)===t.toLowerCase()?"case-insensitive":"none"}collectStopMarkers(e,t){let i=new Set;for(let a=t;a<e.length;a++){let u=e[a];if(u.type==="literal"){if(i.add(u.value.toLowerCase()),u.alternatives)for(let n of u.alternatives)i.add(n.toLowerCase());break}if(u.type==="group"){for(let n of u.tokens)if(n.type==="literal"){if(i.add(n.value.toLowerCase()),n.alternatives)for(let o of n.alternatives)i.add(o.toLowerCase());break}if(!u.optional)break}}return i}isStopMarker(e,t){return t.size===0?false:!!(t.has(e.value.toLowerCase())||e.normalized&&t.has(e.normalized.toLowerCase()))}tokenToSemanticValue(e){switch(e.kind){case "selector":return ce(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=e.normalized||e.value;this.safeToLowerCase(t);return S(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 S(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let a=e.slice(1,-1);return S(a,"string")}if(e==="true")return S(true,"boolean");if(e==="false")return S(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let a=parseFloat(t[1]);return t[2]?S(e,"duration"):S(a,"number")}let i=parseFloat(e);return isNaN(i)?S(e,"string"):S(i,"number")}applyExtractionRules(e,t){for(let[i,a]of Object.entries(e.extraction))t.has(i)||(a.value!==void 0?t.set(i,{type:"literal",value:a.value}):a.default&&t.set(i,a.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,t){let i=0,a=0,u=l=>e.extraction?.[l]?.default!==void 0;for(let l of e.template.tokens)if(l.type==="role")a+=1,t.has(l.role)&&(i+=1);else if(l.type==="group"){for(let m of l.tokens)if(m.type==="role"){let c=u(m.role),p=.8;a+=p,t.has(m.role)?i+=p:c&&(i+=p*.6);}}let n=a>0?i/a:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){let l=this.stemMatchCount/this.totalKeywordMatches*.15;n=Math.max(.5,n-l);}let o=this.calculateVSOConfidenceBoost(e);n=Math.min(1,n+o);let s=this.arabicPrepositionDisambiguation(e,t);return n=Math.max(0,Math.min(1,n+s)),n}calculateVSOConfidenceBoost(e){if(e.language!=="ar")return 0;let t=e.template.tokens[0];if(!t||t.type!=="literal")return 0;let i=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(i.has(t.value))return .15;if(t.alternatives){for(let a of t.alternatives)if(i.has(a))return .15}return 0}arabicPrepositionDisambiguation(e,t){if(e.language!=="ar")return 0;let i=0,a={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[u,n]of t.entries()){let o=a[u];if(!o||o.length===0)continue;let s="metadata"in n?n.metadata:void 0;if(s&&typeof s.prepositionValue=="string"){let l=s.prepositionValue;o.includes(l)?i+=.1:i-=.1;}}return Math.max(-0.1,Math.min(.1,i))}skipNoiseWords(e){let t=e.peek();if(!t)return;let i=this.safeToLowerCase(t.value);if(q.ENGLISH_NOISE_WORDS.has(i)){let a=e.mark();e.advance();let u=e.peek();if(u&&u.kind==="selector")return;e.reset(a);}i==="class"&&e.advance();}extractEventModifiers(e){let t={},i=false;for(;!e.isAtEnd();){let a=e.peek();if(!a||a.kind!=="event-modifier")break;let u=a.metadata;if(!u)break;switch(i=true,u.modifierName){case "once":t.once=true;break;case "debounce":typeof u.value=="number"&&(t.debounce=u.value);break;case "throttle":typeof u.value=="number"&&(t.throttle=u.value);break;case "queue":(u.value==="first"||u.value==="last"||u.value==="all"||u.value==="none")&&(t.queue=u.value);break}e.advance();}return i?t:void 0}};re.MAX_MARKER_SCAN=3;re.MAX_PROPERTY_DEPTH=10;re.MAX_METHOD_ARGS=20;re.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Nr=re;new Nr;var W=class{constructor(){this.name="string-literal";}canExtract(r,e){let t=r[e];return t==='"'||t==="'"||t==="`"||t==="\u201C"||t==="\u2018"}extract(r,e){let t=r[e];if(t==="\u201C"){let u=1;for(;e+u<r.length;){if(r[e+u]==="\u201D")return u++,{value:r.substring(e,e+u),length:u};u++;}return null}if(t==="\u2018"){let u=1;for(;e+u<r.length;){if(r[e+u]==="\u2019")return u++,{value:r.substring(e,e+u),length:u};u++;}return null}let i=1,a=false;for(;e+i<r.length;){let u=r[e+i];if(a){a=false,i++;continue}if(u==="\\"){a=true,i++;continue}if(u===t)return i++,{value:r.substring(e,e+i),length:i};i++;}return null}},U=class{constructor(){this.name="number";}canExtract(r,e){return /\d/.test(r[e])}extract(r,e){let t=0,i=false;for(;e+t<r.length;){let n=r[e+t];if(/\d/.test(n))t++;else if(n==="."&&!i)i=true,t++;else break}if(t===0)return null;let a=r.substring(e,e+t),u=e+t;if(u<r.length){let n=r.slice(u),o=[{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 l of o)if(n.startsWith(l.pattern))return {value:a+l.suffix,length:t+l.pattern.length,metadata:{hasTimeUnit:true}};if(n.startsWith("ms"))return {value:a+"ms",length:t+2,metadata:{hasTimeUnit:true}};let s=[{pattern:"\u79D2",suffix:"s"},{pattern:"\u5206",suffix:"m"}];for(let l of s)if(n.startsWith(l.pattern))return {value:a+l.suffix,length:t+1,metadata:{hasTimeUnit:true}};if(/^[smh](?![a-zA-Z])/.test(n))return {value:a+n[0],length:t+1,metadata:{hasTimeUnit:true}}}return {value:a,length:t}}};function _r(r){return "setContext"in r&&typeof r.setContext=="function"}function Or(r){let e={language:r.language,direction:r.direction,lookupKeyword:r.lookupKeyword.bind(r),isKeyword:r.isKeyword.bind(r),isKeywordStart:r.isKeywordStart.bind(r)};return r.normalizer?{...e,normalizer:r.normalizer}:e}var te=class{constructor(r,e){this.pos=0,this.tokens=r,this.language=e;}peek(r=0){let e=this.pos+r;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(r){this.pos=r.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(r){let e=[];for(;!this.isAtEnd()&&r(this.peek());)e.push(this.advance());return e}skipWhile(r){for(;!this.isAtEnd()&&r(this.peek());)this.advance();}};function C(r,e){return {start:r,end:e}}function b(r,e,t,i){if(typeof r=="object"){let{value:u,kind:n,position:o,normalized:s,stem:l,stemConfidence:m,metadata:c}=r;return {value:u,kind:n,position:o,...s!==void 0&&{normalized:s},...l!==void 0&&{stem:l},...m!==void 0&&{stemConfidence:m},...c!==void 0&&{metadata:c}}}let a=r;if(!e||!t)throw new Error("createToken requires kind and position parameters");if(typeof i=="string")return {value:a,kind:e,position:t,normalized:i};if(i){let{normalized:u,stem:n,stemConfidence:o,metadata:s}=i;return {value:a,kind:e,position:t,...u!==void 0&&{normalized:u},...n!==void 0&&{stem:n},...o!==void 0&&{stemConfidence:o},...s!==void 0&&{metadata:s}}}return {value:a,kind:e,position:t}}function ee(r){return /\s/.test(r)}function Mr(r){return r==="#"||r==="."||r==="["||r==="@"||r==="*"||r==="<"}function Ir(r){return r==='"'||r==="'"||r==="`"||r==="\u300C"||r==="\u300D"}function M(r){return /\d/.test(r)}function jr(r){return /[a-zA-Z]/.test(r)}function x(r){return /[a-zA-Z0-9_-]/.test(r)}function Lr(r,e){if(e>=r.length)return null;let t=r[e];if(!Mr(t))return null;let i=e,a="";if(t==="#"||t==="."){for(a+=r[i++];i<r.length&&x(r[i]);)a+=r[i++];if(a.length<=1)return null;if(i<r.length&&r[i]==="."&&t==="#"){let n=i+1;for(;n<r.length&&x(r[n]);)n++;if(n<r.length&&r[n]==="(")return a}}else if(t==="["){let u=1,n=false,o=null,s=false;for(a+=r[i++];i<r.length&&u>0;){let l=r[i];a+=l,s?s=false:l==="\\"?s=true:n?l===o&&(n=false,o=null):l==='"'||l==="'"||l==="`"?(n=true,o=l):l==="["?u++:l==="]"&&u--,i++;}if(u!==0)return null}else if(t==="@"){for(a+=r[i++];i<r.length&&x(r[i]);)a+=r[i++];if(a.length<=1)return null}else if(t==="*"){for(a+=r[i++];i<r.length&&x(r[i]);)a+=r[i++];if(a.length<=1)return null}else if(t==="<"){if(a+=r[i++],i>=r.length||!jr(r[i]))return null;for(;i<r.length&&x(r[i]);)a+=r[i++];for(;i<r.length;){let u=r[i];if(u==="."){if(a+=r[i++],i>=r.length||!x(r[i]))return null;for(;i<r.length&&x(r[i]);)a+=r[i++];}else if(u==="#"){if(a+=r[i++],i>=r.length||!x(r[i]))return null;for(;i<r.length&&x(r[i]);)a+=r[i++];}else if(u==="["){let n=1,o=false,s=null,l=false;for(a+=r[i++];i<r.length&&n>0;){let m=r[i];a+=m,l?l=false:m==="\\"?l=true:o?m===s&&(o=false,s=null):m==='"'||m==="'"||m==="`"?(o=true,s=m):m==="["?n++:m==="]"&&n--,i++;}if(n!==0)return null}else break}for(;i<r.length&&ee(r[i]);)a+=r[i++];if(i<r.length&&r[i]==="/")for(a+=r[i++];i<r.length&&ee(r[i]);)a+=r[i++];if(i>=r.length||r[i]!==">")return null;a+=r[i++];}return a||null}function $r(r,e){if(e>=r.length||r[e]!=="'"||e+1>=r.length||r[e+1].toLowerCase()!=="s")return false;if(e+2>=r.length)return true;let i=r[e+2];return ee(i)||i==="*"||!x(i)}function Vr(r,e){if(e>=r.length)return null;let t=r[e];if(!Ir(t)||t==="'"&&$r(r,e))return null;let a={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[t];if(!a)return null;let u=e+1,n=t,o=false;for(;u<r.length;){let s=r[u];if(n+=s,o)o=false;else if(s==="\\")o=true;else if(s===a)return n;u++;}return n}function qr(r,e){if(e>=r.length)return false;let t=r[e],i=r[e+1]||"",a=r[e+2]||"";if(t==="/"&&i!=="/"&&/[a-zA-Z0-9._-]/.test(i)||t==="/"&&i==="/"&&/[a-zA-Z]/.test(a)||t==="."&&(i==="/"||i==="."&&a==="/"))return true;let u=r.slice(e,e+8).toLowerCase();return !!(u.startsWith("http://")||u.startsWith("https://"))}function Wr(r,e){if(!qr(r,e))return null;let t=e,i="",a=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;t<r.length;){let u=r[t];if(u==="#"){if(i.length>0&&/[a-zA-Z0-9/.]$/.test(i))for(i+=u,t++;t<r.length&&/[a-zA-Z0-9_-]/.test(r[t]);)i+=r[t++];break}if(a.test(u))i+=u,t++;else break}return i.length<2?null:i}function Ur(r,e){if(e>=r.length)return null;let t=r[e];if(!M(t)&&t!=="-"&&t!=="+")return null;let i=e,a="";if((r[i]==="-"||r[i]==="+")&&(a+=r[i++]),i>=r.length||!M(r[i]))return null;for(;i<r.length&&M(r[i]);)a+=r[i++];if(i<r.length&&r[i]===".")for(a+=r[i++];i<r.length&&M(r[i]);)a+=r[i++];return i<r.length&&(r.slice(i,i+2)==="ms"?a+="ms":(r[i]==="s"||r[i]==="m"||r[i]==="h")&&(a+=r[i])),a}var Kr=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(Kr);var Oe=class Me{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){_r(e)&&e.setContext(Or(this)),this.extractors.push(e);}registerExtractors(e){for(let t of e)this.registerExtractor(t);}clearExtractors(){this.extractors=[];}isUsingExtractors(){return this.extractors.length>0}tokenizeWithExtractors(e){let t=[],i=0;for(;i<e.length;){for(;i<e.length&&ee(e[i]);)i++;if(i>=e.length)break;let a=false;for(let u of this.extractors)if(u.canExtract(e,i)){let n=u.extract(e,i);if(n){let o=n.metadata?.normalized,s=n.metadata?.stem,l=n.metadata?.stemConfidence,m={};if(n.metadata)for(let[p,d]of Object.entries(n.metadata))p!=="normalized"&&p!=="stem"&&p!=="stemConfidence"&&(m[p]=d);let c={};o&&(c.normalized=o),s&&(c.stem=s),l!==void 0&&(c.stemConfidence=l),Object.keys(m).length>0&&(c.metadata=m),t.push(b(n.value,this.classifyToken(n.value),C(i,i+n.length),Object.keys(c).length>0?c:void 0)),i+=n.length,a=true;break}}if(!a){let u=e[i],n=this.classifyUnknownChar(u);t.push(b(u,n,C(i,i+1))),i++;}}return new te(t,this.language)}classifyUnknownChar(e){return "()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,t,i){if(e[t]!==".")return false;let a=i[i.length-1],u=a&&a.position.end<t;if(a&&!u&&(a.kind==="identifier"||a.kind==="keyword"||a.kind==="selector"))return i.push(b(".","operator",C(t,t+1))),true;let s=t+1;for(;s<e.length&&x(e[s]);)s++;return s<e.length&&e[s]==="("?(i.push(b(".","operator",C(t,t+1))),true):false}initializeKeywordsFromProfile(e,t=[]){let i=new Map;if(e.keywords){for(let[a,u]of Object.entries(e.keywords))if(i.set(u.primary,{native:u.primary,normalized:u.normalized||a}),u.alternatives)for(let n of u.alternatives)i.set(n,{native:n,normalized:u.normalized||a});}if(e.references){for(let[a,u]of Object.entries(e.references))i.set(u,{native:u,normalized:a});for(let a of Object.keys(e.references))i.has(a)||i.set(a,{native:a,normalized:a});}if(e.roleMarkers){for(let[a,u]of Object.entries(e.roleMarkers))if(u.primary&&i.set(u.primary,{native:u.primary,normalized:a}),u.alternatives)for(let n of u.alternatives)i.set(n,{native:n,normalized:a});}if(e.possessive?.keywords)for(let[a,u]of Object.entries(e.possessive.keywords))i.set(a,{native:a,normalized:u});for(let a of t)i.set(a.native,a);this.profileKeywords=Array.from(i.values()).sort((a,u)=>u.native.length-a.native.length),this.profileKeywordMap=new Map;for(let a of this.profileKeywords){this.profileKeywordMap.set(a.native.toLowerCase(),a);let u=this.removeDiacritics(a.native);u!==a.native&&!this.profileKeywordMap.has(u.toLowerCase())&&this.profileKeywordMap.set(u.toLowerCase(),a);}}removeDiacritics(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(e,t){for(let i of this.profileKeywords)if(e.slice(t).startsWith(i.native))return b(i.native,"keyword",C(t,t+i.native.length),i.normalized);return null}isKeywordStart(e,t){let i=e.slice(t);return this.profileKeywords.some(a=>i.startsWith(a.native))}lookupKeyword(e){return this.profileKeywordMap.get(e.toLowerCase())}isKeyword(e){return this.profileKeywordMap.has(e.toLowerCase())}setNormalizer(e){this.normalizer=e;}tryNormalize(e){if(!this.normalizer)return null;let t=this.normalizer.normalize(e);return t.stem!==e&&t.confidence>=.7?t:null}tryMorphKeywordMatch(e,t,i){let a=this.tryNormalize(e);if(!a)return null;let u=this.lookupKeyword(a.stem);if(!u)return null;let n={normalized:u.normalized,stem:a.stem,stemConfidence:a.confidence};return b(e,"keyword",C(t,i),n)}trySelector(e,t){let i=Lr(e,t);return i?b(i,"selector",C(t,t+i.length)):null}tryEventModifier(e,t){if(e[t]!==".")return null;let i=e.slice(t).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!i)return null;let a=i[0].replace(/(\s|\.)$/,""),u=a.slice(1).split("(")[0],n=i[1];return {...b(a,"event-modifier",C(t,t+a.length)),metadata:{modifierName:u,value:n?u==="queue"?n:parseInt(n,10):void 0}}}tryString(e,t){let i=Vr(e,t);return i?b(i,"literal",C(t,t+i.length)):null}tryNumber(e,t){let i=Ur(e,t);return i?b(i,"literal",C(t,t+i.length)):null}tryMatchTimeUnit(e,t,i,a=false){let u=t;if(a)for(;u<e.length&&ee(e[u]);)u++;let n=e.slice(u);for(let o of i){let s=n.slice(0,o.length);if(o.caseInsensitive?s.toLowerCase()===o.pattern.toLowerCase():s===o.pattern){if(o.notFollowedBy&&(n[o.length]||"")===o.notFollowedBy)continue;if(o.checkBoundary){let m=n[o.length]||"";if(x(m))continue}return {suffix:o.suffix,endPos:u+o.length}}}return null}parseBaseNumber(e,t,i=true){let a=t,u="";if(i&&(e[a]==="-"||e[a]==="+")&&(u+=e[a++]),a>=e.length||!M(e[a]))return null;for(;a<e.length&&M(e[a]);)u+=e[a++];if(a<e.length&&e[a]===".")for(u+=e[a++];a<e.length&&M(e[a]);)u+=e[a++];return !u||u==="-"||u==="+"?null:{number:u,endPos:a}}tryNumberWithTimeUnits(e,t,i,a={}){let{allowSign:u=true,skipWhitespace:n=false}=a,o=this.parseBaseNumber(e,t,u);if(!o)return null;let{number:s,endPos:l}=o,m=[...i,...Me.STANDARD_TIME_UNITS],c=this.tryMatchTimeUnit(e,l,m,n);return c&&(s+=c.suffix,l=c.endPos),b(s,"literal",C(t,l))}tryUrl(e,t){let i=Wr(e,t);return i?b(i,"url",C(t,t+i.length)):null}tryVariableRef(e,t){if(e[t]!==":"||t+1>=e.length||!x(e[t+1]))return null;let i=t+1;for(;i<e.length&&x(e[i]);)i++;let a=e.slice(t,i);return b(a,"identifier",C(t,i))}tryOperator(e,t){let i=e.slice(t,t+2);if(["==","!=","<=",">=","&&","||","->"].includes(i))return b(i,"operator",C(t,t+2));let a=e[t];return ["<",">","!","+","-","*","/","="].includes(a)?b(a,"operator",C(t,t+1)):["(",")","{","}",",",";",":"].includes(a)?b(a,"punctuation",C(t,t+1)):null}tryMultiCharParticle(e,t,i){for(let a of i)if(e.slice(t,t+a.length)===a)return b(a,"particle",C(t,t+a.length));return null}};Oe.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 K=Oe;function w(r){return {stem:r,confidence:1}}function y(r,e,t){return t?{stem:r,confidence:e,metadata:t}:{stem:r,confidence:e}}var Gr=Object.defineProperty,Hr=Object.getOwnPropertyNames,Je=(r,e)=>function(){return r&&(e=(0, r[Hr(r)[0]])(r=0)),e},Yr=(r,e)=>{for(var t in e)Gr(r,t,{get:e[t],enumerable:true});};function Ie(r,e){return r.replace(/\{(\w+)\}/g,(t,i)=>String(e[i]??`{${i}}`))}function B(r,e,t={},i){let a=Xe[r],u=Ie(a,t),n=Ze[r],o=n?Ie(n,t):void 0;return {code:r,message:u,severity:e,...i&&{role:i},...o&&{suggestion:o}}}var h,Xe,Ze,Jr=Je({"src/generators/schema-error-codes.ts"(){h={AMBIGUOUS_TYPE_LITERAL_SELECTOR:"SCHEMA_AMBIGUOUS_TYPE_LITERAL_SELECTOR",TOO_MANY_EXPECTED_TYPES:"SCHEMA_TOO_MANY_EXPECTED_TYPES",MULTI_TYPE_PATIENT_EXPECTED:"SCHEMA_MULTI_TYPE_PATIENT_EXPECTED",NO_REQUIRED_ROLES:"SCHEMA_NO_REQUIRED_ROLES",NO_REQUIRED_ROLES_EXPECTED:"SCHEMA_NO_REQUIRED_ROLES_EXPECTED",TRANSITION_PATIENT_ACCEPTS_SELECTOR:"SCHEMA_TRANSITION_PATIENT_ACCEPTS_SELECTOR",TRANSITION_MISSING_GOAL:"SCHEMA_TRANSITION_MISSING_GOAL",EVENT_HANDLER_MISSING_EVENT:"SCHEMA_EVENT_HANDLER_MISSING_EVENT",EVENT_HANDLER_EVENT_NOT_REQUIRED:"SCHEMA_EVENT_HANDLER_EVENT_NOT_REQUIRED",CONDITIONAL_MISSING_CONDITION:"SCHEMA_CONDITIONAL_MISSING_CONDITION",CONDITIONAL_CONDITION_NOT_REQUIRED:"SCHEMA_CONDITIONAL_CONDITION_NOT_REQUIRED",FOR_LOOP_MISSING_SOURCE:"SCHEMA_FOR_LOOP_MISSING_SOURCE",WHILE_LOOP_MISSING_CONDITION:"SCHEMA_WHILE_LOOP_MISSING_CONDITION",VALUE_TYPE_MISMATCH:"SCHEMA_VALUE_TYPE_MISMATCH",SELECTOR_KIND_MISMATCH:"SCHEMA_SELECTOR_KIND_MISMATCH",SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE:"SCHEMA_SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE",KEYWORD_COLLISION:"PROFILE_KEYWORD_COLLISION"},Xe={[h.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[h.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[h.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[h.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[h.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[h.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Transition command 'patient' role (CSS property name) should only accept 'literal', not 'selector'. CSS property names like 'background-color' are strings, not CSS selectors.",[h.TRANSITION_MISSING_GOAL]:"Transition command requires a 'goal' role for the target value (to <value>). Without it, there's no way to specify what value to transition to.",[h.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[h.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[h.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[h.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[h.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[h.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[h.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[h.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[h.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},Ze={[h.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[h.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[h.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[h.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[h.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[h.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[h.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[h.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[h.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[h.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[h.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[h.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[h.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),Qe={};Yr(Qe,{SchemaErrorCodes:()=>h,formatValidationResults:()=>it,getValidationStats:()=>at,validateAllKeywordCollisions:()=>nt,validateAllSchemas:()=>tt,validateCommandSchema:()=>er,validateKeywordCollisions:()=>rr,validateRoleValues:()=>ut});function Xr(r,e){return {action:r,items:e}}function er(r){let e=[];for(let i of r.roles)i.expectedTypes.includes("literal")&&i.expectedTypes.includes("selector")&&(i.role==="patient"&&Ae.has(r.action)?e.push(B(h.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:i.role,command:r.action},i.role)):e.push(B(h.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:i.role},i.role))),i.expectedTypes.length>3&&!Ae.has(r.action)&&e.push(B(h.TOO_MANY_EXPECTED_TYPES,"warning",{role:i.role,count:i.expectedTypes.length},i.role));for(let i of r.roles)i.selectorKinds&&i.selectorKinds.length>0&&(i.expectedTypes.includes("selector")||e.push(B(h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:i.role},i.role)));switch(r.action){case "transition":Zr(r,e);break;case "on":Qr(r,e);break;case "if":case "unless":et(r,e);break;case "repeat":case "for":case "while":rt(r,e);break}return r.roles.filter(i=>i.required).length===0&&(tr.has(r.action)?e.push(B(h.NO_REQUIRED_ROLES_EXPECTED,"note",{command:r.action})):e.push(B(h.NO_REQUIRED_ROLES,"warning",{}))),Xr(r.action,e)}function Zr(r,e){let t=r.roles.find(a=>a.role==="patient"),i=r.roles.find(a=>a.role==="goal");t&&t.expectedTypes.includes("selector")&&e.push(B(h.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),t&&!i&&e.push(B(h.TRANSITION_MISSING_GOAL,"error",{}));}function Qr(r,e){let t=r.roles.find(i=>i.role==="event");t||e.push(B(h.EVENT_HANDLER_MISSING_EVENT,"warning",{})),t&&!t.required&&e.push(B(h.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function et(r,e){let t=r.roles.find(i=>i.role==="condition");t||e.push(B(h.CONDITIONAL_MISSING_CONDITION,"warning",{})),t&&!t.required&&e.push(B(h.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function rt(r,e){r.action==="for"?r.roles.find(i=>i.role==="source")||e.push(B(h.FOR_LOOP_MISSING_SOURCE,"warning",{})):r.action==="while"&&(r.roles.find(i=>i.role==="condition")||e.push(B(h.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function tt(r,e={}){let t=new Map,{includeNotes:i=false}=e;for(let[a,u]of Object.entries(r)){let n=er(u),o=n.items.some(l=>l.severity==="warning"||l.severity==="error"),s=i&&n.items.some(l=>l.severity==="note");(o||s)&&t.set(a,n);}return t}function it(r,e={}){let t=[],{showNotes:i=false,showCodes:a=true}=e;for(let[u,n]of r){let o=n.items.filter(m=>m.severity==="error"),s=n.items.filter(m=>m.severity==="warning"),l=n.items.filter(m=>m.severity==="note");if(o.length>0){t.push(` \u274C ${u}:`);for(let m of o){let c=a?` [${m.code}]`:"";t.push(` ERROR${c}: ${m.message}`),m.suggestion&&t.push(` \u{1F4A1} Suggestion: ${m.suggestion}`);}}if(s.length>0){t.push(` \u26A0\uFE0F ${u}:`);for(let m of s){let c=a?` [${m.code}]`:"";t.push(` ${c?`${m.code}: `:""}${m.message}`),m.suggestion&&t.push(` \u{1F4A1} ${m.suggestion}`);}}if(i&&l.length>0){t.push(` \u2139\uFE0F ${u}:`);for(let m of l){let c=a?` [${m.code}]`:"";t.push(` ${c?`${m.code}: `:""}${m.message}`);}}}return t.join(`
|
|
2
|
+
`)}function at(r){let e=0,t=0,i=0,a={};for(let u of r.values())for(let n of u.items)n.severity==="error"?e++:n.severity==="warning"?t++:n.severity==="note"&&i++,a[n.code]=(a[n.code]||0)+1;return {totalCommands:r.size,errors:e,warnings:t,notes:i,byCode:a}}function ut(r,e){let t=[];for(let i of e){let a=r.roles.find(u=>u.role===i.role);a&&(a.expectedTypes.length>0&&!a.expectedTypes.includes(i.type)&&(a.expectedTypes.includes("expression")||t.push({level:"error",role:i.role,message:`${r.action}.${i.role} expects type [${a.expectedTypes.join(", ")}], got '${i.type}'`,code:h.VALUE_TYPE_MISMATCH})),i.type==="selector"&&i.selectorKind&&a.selectorKinds&&a.selectorKinds.length>0&&(a.selectorKinds.includes(i.selectorKind)||t.push({level:"error",role:i.role,message:`${r.action}.${i.role} expects selector kind [${a.selectorKinds.join(", ")}], got '${i.selectorKind}'`,code:h.SELECTOR_KIND_MISMATCH})));}return t}function rr(r){let e=[];if(!r.keywords)return {language:r.code,collisions:e};let t=new Map;for(let[a,u]of Object.entries(r.keywords)){if(!u||!u.primary)continue;let n=t.get(u.primary)||[];if(n.push({command:a,isPrimary:true}),t.set(u.primary,n),u.alternatives)for(let o of u.alternatives){let s=t.get(o)||[];s.push({command:a,isPrimary:false}),t.set(o,s);}}for(let[a,u]of t){let n=[...new Set(u.map(l=>l.command))];if(n.length<=1)continue;let o=u.filter(l=>l.isPrimary).length,s;o>=2?s="primary-primary":o===1?s="primary-alternative":s="alternative-alternative",e.push({keyword:a,commands:n.sort(),type:s});}let i={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((a,u)=>i[a.type]-i[u.type]),{language:r.code,collisions:e}}function nt(r){let e=[];for(let[,t]of Object.entries(r)){let i=rr(t);i.collisions.length>0&&e.push(i);}return e.sort((t,i)=>t.language.localeCompare(i.language))}var Ae,tr,ot=Je({"src/generators/schema-validator.ts"(){Jr(),Ae=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),tr=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 j=new Map,R=new Map,ie=new Map,we=null;function ir(r,e){let t={...r};for(let i of Object.keys(e)){let a=e[i],u=r[i];a!==void 0&&(typeof a=="object"&&a!==null&&!Array.isArray(a)&&typeof u=="object"&&u!==null&&!Array.isArray(u)?t[i]=ir(u,a):t[i]=a);}return t}function st(r,e){return ir(r,e)}function De(r){if(!r.extends)return r;let e=R.get(r.extends);if(!e)return console.warn(`[Registry] Profile '${r.code}' extends '${r.extends}' but base is not registered. Make sure to import the base language before the variant.`),r;let t=De(e);return st(t,r)}function J(r,e,t){j.set(r,e),R.set(r,t),ie.delete(r);}function ar(r){we=r;}var je=new Map;function H(r){return r.split("-")[0]}function Y(r){return r.includes("-")}function lt(r){let e=j.get(r);if(!e&&Y(r)){let t=H(r);e=j.get(t);}if(!e){let t=Array.from(j.keys()).join(", ");throw new Error(`Language '${r}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${r}';`)}return e}function mt(r){let e=R.get(r);if(!e&&Y(r)){let t=H(r);e=R.get(t);}if(!e){let t=Array.from(R.keys()).join(", ");throw new Error(`Language profile '${r}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${r}';`)}return De(e)}function L(r){let e=R.get(r);return !e&&Y(r)&&(e=R.get(H(r))),e?De(e):void 0}function ct(){return Array.from(j.keys())}function ur(r){if(j.has(r)&&R.has(r))return true;if(Y(r)){let e=H(r);return j.has(e)&&R.has(e)}return false}function pt(r,e){return lt(e).tokenize(r)}function G(r){let e=ie.get(r);if(!e&&Y(r)&&(e=ie.get(H(r))),e)return e;let t=je.get(r);if(!t&&Y(r)&&(t=je.get(H(r))),t)return ie.set(r,t),t;if(!we)throw new Error(`No patterns registered for language '${r}'. Either import the language module or set a pattern generator.`);let i=mt(r),a=we(i);return ie.set(r,a),a}function ue(r){let e="complex";return r.startsWith("#")&&!r.includes(" ")?e="id":r.startsWith(".")&&!r.includes(" ")?e="class":r.startsWith("[")&&r.endsWith("]")?e="attribute":/^[a-z][a-z0-9]*$/i.test(r)&&(e="element"),{type:"selector",value:r,selectorKind:e}}function A(r,e){let t={type:"literal",value:r};return e!==void 0?{type:"literal",value:r,dataType:e}:t}function Le(r){return ke(r)}function I(r){return {type:"reference",value:r}}function Ce(r,e){return {type:"property-path",object:r,property:e}}function de(r,e,t){let i={kind:"command",action:r,roles:new Map(Object.entries(e))};return t!==void 0?{...i,metadata:t}:i}function $e(r,e,t,i,a,u){let n=new Map;n.set("event",r);let o={kind:"event-handler",action:"on",roles:n,body:e};return t!==void 0&&(o.eventModifiers=t),i!==void 0&&(o.metadata=i),o}function Ve(r,e="then",t){let i={kind:"compound",action:"compound",roles:new Map,statements:r,chainType:e};return t!==void 0&&(i.metadata=t),i}function qe(r,e){return !e||e.length===0||e.includes(r)||e.includes("expression")?true:r==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):false}function It(r,e){return r.possessive?.keywords?.[e]}var be=.8,jt=.6,Lt=.15,$t=.5,We=.15,Ue=.1,Ke=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"]),Vt={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"]},qt=class{calculate(r){return this.calculateWithBreakdown(r).final}calculateWithBreakdown(r){let e=this.scoreRoleCoverage(r),t=this.scoreStemPenalty(r),i=this.scoreLanguageBoost(r),a=this.scoreLanguageAdjustment(r),u=e;return u=Math.max($t,u+t),u=Math.min(1,u+i),u=Math.max(0,Math.min(1,u+a)),{roleCoverage:e,stemPenalty:t,languageBoost:i,languageAdjustment:a,final:u}}scoreRoleCoverage(r){let{pattern:e,captured:t}=r,i=0,a=0,u=n=>e.extraction?.[n]?.default!==void 0;for(let n of e.template.tokens)if(n.type==="role")a+=1,t.has(n.role)&&(i+=1);else if(n.type==="group")for(let o of n.tokens)o.type==="role"&&(a+=be,t.has(o.role)?i+=be:u(o.role)&&(i+=be*jt));return a>0?i/a:1}scoreStemPenalty(r){let{stemMatchCount:e,totalKeywordMatches:t}=r;return e<=0||t<=0?0:-(e/t)*Lt}scoreLanguageBoost(r){let{pattern:e}=r;if(e.language!=="ar")return 0;let t=e.template.tokens[0];return !t||t.type!=="literal"?0:Ke.has(t.value)||t.alternatives?.some(i=>Ke.has(i))?We:0}scoreLanguageAdjustment(r){let{pattern:e,captured:t}=r;if(e.language!=="ar")return 0;let i=0;for(let[a,u]of t.entries()){let n=Vt[a];if(!n||n.length===0)continue;let o="metadata"in u?u.metadata:void 0;o&&typeof o.prepositionValue=="string"&&(n.includes(o.prepositionValue)?i+=.1:i-=.1);}return Math.max(-Ue,Math.min(Ue,i))}},Wt=new qt,fe=class ae{constructor(e){this.matchCache=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??Wt;}matchPattern(e,t){let i=e.mark(),a=new Map;if(this.currentProfile=L(t.language),this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(e,t.template.tokens,a))return e.reset(i),null;let n=this.confidenceModel.calculate({pattern:t,captured:a,stemMatchCount:this.stemMatchCount,totalKeywordMatches:this.totalKeywordMatches});return this.applyExtractionRules(t,a),{pattern:t,captured:a,consumedTokens:e.position()-i.position,confidence:n}}matchBest(e,t){this.matchCache.clear();let i=[],a=e.position();for(let n of t){let o=e.mark(),s=`${a}:${n.id}`,l;this.matchCache.has(s)?l=this.matchCache.get(s):(l=this.matchPattern(e,n),this.matchCache.set(s,l)),l&&i.push(l),e.reset(o);}if(i.length===0)return null;i.sort((n,o)=>{let s=o.pattern.priority-n.pattern.priority;return s!==0?s:o.confidence-n.confidence});let u=i[0];return this.matchPattern(e,u.pattern),u}matchTokenSequence(e,t,i){let a=t[0],u=a?.type==="literal"&&(a.value==="and"||a.value==="then"||a.alternatives?.includes("and")||a.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!u)for(;e.peek()?.kind==="conjunction";)e.advance();for(let n of t)if(!this.matchPatternToken(e,n,i)){if(this.isOptional(n))continue;return false}return true}matchPatternToken(e,t,i){switch(t.type){case "literal":return this.matchLiteralToken(e,t);case "role":return this.matchRoleToken(e,t,i);case "group":return this.matchGroupToken(e,t,i);default:return false}}matchLiteralToken(e,t){let i=e.peek();if(!i)return false;let a=this.getMatchType(i,t.value);if(a!=="none")return this.totalKeywordMatches++,a==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let u of t.alternatives){let n=this.getMatchType(i,u);if(n!=="none")return this.totalKeywordMatches++,n==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,t,i){this.skipNoiseWords(e);let a=e.peek();if(!a)return t.optional||false;let u=this.tryMatchPossessiveExpression(e);if(u)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(u.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(i.set(t.role,u),true);let n=this.tryMatchMethodCallExpression(e);if(n)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(n.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(i.set(t.role,n),true);let o=this.tryMatchPossessiveSelectorExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!qe(o.type,t.expectedTypes)?t.optional||false:(i.set(t.role,o),true);let s=this.tryMatchPropertyAccessExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(s.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(i.set(t.role,s),true);let l=this.tryMatchSelectorPropertyExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!qe(l.type,t.expectedTypes)?t.optional||false:(i.set(t.role,l),true);let m=this.tokenToSemanticValue(a);return !m||t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(m.type)?t.optional||false:(i.set(t.role,m),e.advance(),true)}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let i=(t.normalized||t.value).toLowerCase(),a=It(this.currentProfile,i);if(!a)return null;let u=e.mark();e.advance();let n=e.peek();if(!n)return e.reset(u),null;if(n.kind==="identifier"||n.kind==="keyword"&&!this.isStructuralKeyword(n.value)||n.kind==="selector"&&n.value.startsWith("*")||n.kind==="selector"&&n.value.startsWith("@")||n.kind==="selector"&&n.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(n.value)){e.advance();let o=n.value;n.kind==="selector"&&o.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(o)&&(o=o.substring(1));let s=o;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)s+=e.peek().value,e.advance();let l=e.peek();return l?.kind==="literal"&&l.value.startsWith("(")&&(s+=l.value,e.advance()),Ce(I(a),s)}return e.reset(u),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="operator"||a.value!==".")return e.reset(i),null;e.advance();let u=e.peek();if(!u||u.kind!=="identifier")return e.reset(i),null;e.advance();let n=e.peek();if(!n||n.kind!=="punctuation"||n.value!=="(")return e.reset(i),null;e.advance();let o=[];for(;!e.isAtEnd()&&o.length<ae.MAX_METHOD_ARGS;){let l=e.peek();if(!l)break;if(l.kind==="punctuation"&&l.value===")"){e.advance();break}if(l.kind==="punctuation"&&l.value===","){e.advance();continue}o.push(l.value),e.advance();}return {type:"expression",raw:`${t.value}.${u.value}(${o.join(", ")})`}}tryMatchPropertyAccessExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"&&t.kind!=="keyword")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="operator"||a.value!==".")return e.reset(i),null;e.advance();let u=e.peek();if(!u||u.kind!=="identifier")return e.reset(i),null;e.advance();let n=`${t.value}.${u.value}`,o=1;for(;!e.isAtEnd()&&o<ae.MAX_PROPERTY_DEPTH;){let l=e.peek();if(!l||l.kind!=="operator"||l.value!==".")break;e.advance();let m=e.peek();if(!m||m.kind!=="identifier")break;e.advance(),n+=`.${m.value}`,o++;}let s=e.peek();if(s&&s.kind==="punctuation"&&s.value==="("){e.advance();let l=[],m=0;for(;!e.isAtEnd()&&l.length<ae.MAX_METHOD_ARGS;){let p=e.peek();if(!p)break;if(p.kind==="punctuation"&&p.value===")"){if(m===0){e.advance();break}m--;}if(p.kind==="punctuation"&&p.value==="("&&m++,p.kind==="punctuation"&&p.value===","){e.advance();continue}l.push(p.value),e.advance();}return {type:"expression",raw:`${n}(${l.join(", ")})`}}return {type:"expression",raw:n}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="punctuation"||a.value!=="'s")return e.reset(i),null;e.advance();let u=e.peek();return !u||u.kind!=="selector"&&u.kind!=="identifier"?(e.reset(i),null):(e.advance(),Ce(ue(t.value),u.value))}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||!t.value.startsWith("#"))return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="selector"||!a.value.startsWith("."))return e.reset(i),null;let u=e.peek(1);u&&u.kind,e.advance();let n=a.value.slice(1);return Ce(ue(t.value),n)}matchGroupToken(e,t,i){let a=e.mark(),u=new Set(i.keys());if(!this.matchTokenSequence(e,t.tokens,i)){e.reset(a);for(let o of i.keys())u.has(o)||i.delete(o);return t.optional||false}return true}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem===t&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&e.value.toLowerCase()===t.toLowerCase()?"case-insensitive":"none"}tokenToSemanticValue(e){switch(e.kind){case "selector":return ue(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=(e.normalized||e.value).toLowerCase();return Le(t)?I(t):A(e.normalized||e.value);case "identifier":if(e.value.startsWith(":"))return I(e.value);let i=e.value.toLowerCase();return Le(i)?I(i):{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 a=e.slice(1,-1);return A(a,"string")}if(e==="true")return A(true,"boolean");if(e==="false")return A(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let a=parseFloat(t[1]);return t[2]?A(e,"duration"):A(a,"number")}let i=parseFloat(e);return isNaN(i)?A(e,"string"):A(i,"number")}applyExtractionRules(e,t){for(let[i,a]of Object.entries(e.extraction))t.has(i)||(a.value!==void 0?t.set(i,{type:"literal",value:a.value}):a.default&&t.set(i,a.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}skipNoiseWords(e){let t=e.peek();if(!t)return;let i=t.value.toLowerCase();if(ae.ENGLISH_NOISE_WORDS.has(i)){let a=e.mark();e.advance();let u=e.peek();if(u&&(u.kind==="selector"||u.kind==="identifier"))return;e.reset(a);}i==="class"&&e.advance();}extractEventModifiers(e){let t={},i=false;for(;!e.isAtEnd();){let a=e.peek();if(!a||a.kind!=="event-modifier")break;let u=a.metadata;if(!u)break;switch(i=true,u.modifierName){case "once":t.once=true;break;case "debounce":typeof u.value=="number"&&(t.debounce=u.value);break;case "throttle":typeof u.value=="number"&&(t.throttle=u.value);break;case "queue":(u.value==="first"||u.value==="last"||u.value==="all"||u.value==="none")&&(t.queue=u.value);break}e.advance();}return i?t:void 0}};fe.MAX_PROPERTY_DEPTH=10;fe.MAX_METHOD_ARGS=20;fe.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Ut=fe,O=new Ut;function ne(r,e){return pt(r,e)}function nr(){return ct()}var Kt={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 Ht={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)"}},Yt={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"}},Jt={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"}},Xt={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"}},Zt={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>"}},Qt={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}]},ei={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}]},ri={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}]},ti={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}]},ii={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}]},ai={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}]},ui={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"}}]},ni={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"}}]},oi={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"}}]},si={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"}}]},li={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}]},mi={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}]},ci={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}]},pi={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}]},di={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}]},yi={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}]},fi={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}]},hi={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"}}]},vi={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}]},Ei={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}]},gi={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},zi={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"'},ki={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"}}]},Ci={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}]},bi={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},Ai={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:""}}]},wi={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}]},Di={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"}}]},xi={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}]},Bi={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}]},Fi={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}]},Si={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"}}]},Ti={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}]},Pi={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}]},Ri={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}]},Ni={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}]},_i={action:"breakpoint",description:"Drop into the debugger",category:"control-flow",primaryRole:"patient",roles:[]},Oi={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}]},Mi={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}]},Ii={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}]},ji={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},Li={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:""}}]},$i={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"}}]},Vi={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},qi={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}]},Wi={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}]},Ui={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"}}]},Ki={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"}}]},Gi={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"}}]},Hi={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}]},Yi={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Ji={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}]},Xi={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},Zi={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}]},Qi={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"}}]},or={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"},ea={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"},ra={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:or}]},ta={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:or}]},ia={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:ea}]},aa={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}]},sr={toggle:Ht,add:Yt,remove:Jt,put:Xt,set:Zt,show:Qt,hide:ei,on:ri,trigger:ti,wait:ii,fetch:ai,increment:ui,decrement:ni,append:oi,prepend:si,log:li,get:mi,take:ci,make:pi,halt:di,settle:yi,throw:fi,send:hi,if:vi,unless:Ei,else:gi,repeat:zi,for:ki,while:Ci,continue:bi,go:Ai,scroll:Qi,push:ra,replace:ta,process:ia,transition:wi,clone:Di,focus:xi,blur:Bi,empty:Fi,open:Si,close:Ti,select:Pi,clear:Ri,reset:Ni,breakpoint:_i,call:Oi,return:Mi,js:Ii,async:ji,tell:Li,default:$i,init:Vi,behavior:qi,install:Wi,measure:Ui,swap:Ki,morph:Gi,beep:Hi,break:Yi,copy:Ji,exit:Xi,pick:Zi,render:aa,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function ua(){return Object.values(sr).filter(r=>r.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(ot(),Qe)).then(({validateAllSchemas:r,formatValidationResults:e})=>{let t=r(sr);t.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(t)),console.warn(`
|
|
3
|
+
These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(r=>{console.debug("Schema validation skipped:",r);});var Ge=class extends Error{constructor(r,e,t,i){super(r),this.name="SemanticParseError",this.language=e,this.input=t,this.diagnostics=i;}};function T(r,e,t){return {message:r,severity:e,source:"semantic-parser",...t&&{code:t}}}function ye(r,e){return e.length===0?r:{...r,diagnostics:e}}var X=class P{parse(e,t){let{modifiers:i,remainingInput:a}=this.extractStandaloneModifiers(e,t),u=a||e,n=[],o=ne(u,t),s=G(t);if(s.length===0)throw new Ge(`No patterns available for language: ${t}`,t,u,[T(`No patterns registered for language '${t}'`,"error","no-patterns")]);let l=[...s].sort((v,g)=>g.priority-v.priority),m=l.filter(v=>v.command==="on"),c=O.matchBest(o,m);if(c){n.push(T(`event pattern matched: ${c.pattern.id} (confidence: ${c.confidence.toFixed(2)})`,"info","pattern-match"));let v=this.buildEventHandler(c,o,t),g=i?this.applyModifiers(v,i):v;return ye(g,n)}n.push(T(`event patterns: ${m.length} tried, no match`,"info","stage-event"));let p=l.filter(v=>v.command!=="on"),d=O.matchBest(o,p);if(d)return n.push(T(`command pattern matched: ${d.pattern.id} (confidence: ${d.confidence.toFixed(2)})`,"info","pattern-match")),ye(this.buildCommand(d,t),n);n.push(T(`command patterns: ${p.length} tried, no match`,"info","stage-command"));let f=this.trySOVEventExtraction(u,t,l);if(f){n.push(T("SOV event extraction succeeded","info","stage-sov"));let v=i?this.applyModifiers(f,i):f;return ye(v,n)}n.push(T("SOV event extraction: no event keyword found","info","stage-sov"));let E=this.tryCompoundCommandParsing(o,p,t);if(E)return n.push(T("compound command parsing succeeded","info","stage-compound")),ye(E,n);throw n.push(T("compound parsing: no then-keywords or no command matches","info","stage-compound")),n.push(T(`all parse stages exhausted for "${u}"`,"error","parse-failed")),new Ge(`Could not parse input in ${t}: ${u}`,t,u,n)}canParse(e,t){try{return this.parse(e,t),!0}catch{return false}}supportedLanguages(){return nr()}buildCommand(e,t){if(!e)throw new Error("No match to build command from");let i={};for(let[a,u]of e.captured)i[a]=u;return de(e.pattern.command,i,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence})}buildEventHandler(e,t,i){if(!e)throw new Error("No match to build event handler from");let a=e.captured.get("event");if(!a)throw new Error("Event handler pattern matched but no event captured");let u=O.extractEventModifiers(t),n=this.extractOrConjunctionEvents(t,i),o=a;n.length>0&&a.type==="literal"&&(o={type:"literal",value:[String(a.value),...n.map(c=>String("value"in c?c.value:""))].join(" or ")});let s,l=e.captured.get("action");if(l&&l.type==="literal"){let m=l.value,c={};for(let[f,E]of e.captured)f!=="event"&&f!=="action"&&f!=="continues"&&(c[f]=E);let p=de(m,c,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence}),d=e.captured.get("continues");if(d&&d.type==="literal"&&d.value==="then"){let f=G(i).filter(g=>g.command!=="on").sort((g,k)=>k.priority-g.priority),E=G(i).filter(g=>g.id.startsWith("grammar-")&&g.id.includes("-continuation")).sort((g,k)=>k.priority-g.priority),v=this.parseBodyWithGrammarPatterns(t,f,E,i);v.length>0?s=[p,...v]:s=[p];}else s=[p];}else {let m=G(i).filter(c=>c.command!=="on").sort((c,p)=>p.priority-c.priority);s=this.parseBodyWithClauses(t,m,i);}return $e(o,s,u,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,t,i){let a=[],u=[];for(;!e.isAtEnd();){let n=e.peek();if(!n)break;let o=n.kind==="conjunction"||n.kind==="keyword"&&this.isThenKeyword(n.value,i),s=n.kind==="keyword"&&this.isEndKeyword(n.value,i);if(o){if(u.length>0){let l=this.parseClause(u,t,i);a.push(...l),u.length=0;}e.advance();continue}if(s){if(u.length>0){let l=this.parseClause(u,t,i);a.push(...l);}e.advance();break}u.push(n),e.advance();}if(u.length>0){let n=this.parseClause(u,t,i);a.push(...n);}return a.length>1?[Ve(a,"then",{sourceLanguage:i})]:a}parseClause(e,t,i){if(e.length===0)return [];let a=new te(e,i),u=[];for(;!a.isAtEnd();){let n=O.matchBest(a,t);n?u.push(this.buildCommand(n,i)):a.advance();}if(u.length===0){let n=this.parseSOVClauseByVerbAnchoring(e,i);if(n.length>0)return n}return u}static buildVerbLookup(e){let t=new Map;for(let[i,a]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","for","end","then","and"].includes(i)&&(t.set(a.primary.toLowerCase(),i),a.alternatives))for(let u of a.alternatives)t.set(u.toLowerCase(),i);return t}static buildMarkerToRoleLookup(e){let t=new Map;for(let[i,a]of Object.entries(e.roleMarkers))if(a&&(t.set(a.primary,i),a.alternatives))for(let u of a.alternatives)t.has(u)||t.set(u,i);return t}parseSOVClauseByVerbAnchoring(e,t){let i=L(t);if(!i||i.wordOrder!=="SOV")return [];let a=P.buildVerbLookup(i),u=P.buildMarkerToRoleLookup(i),n=[],o=0;for(;o<e.length;){let s=-1,l="";for(let f=o;f<e.length;f++){let E=e[f],v=a.get(E.value.toLowerCase()),g=E.normalized?a.get(E.normalized.toLowerCase()):void 0,k=v||g;if(k){s=f,l=k;break}}if(s===-1)break;let m=e.slice(o,s),c=e.length;for(let f=s+1;f<e.length;f++){let E=e[f];if(E.kind==="conjunction"||this.isThenKeyword(E.value,t)){c=f;break}if(f>s+1&&(a.get(E.value.toLowerCase())||(E.normalized?a.get(E.normalized.toLowerCase()):void 0))){c=f;break}}let p=e.slice(s+1,c),d=this.extractRolesFromMarkedTokens(m,p,u,l,t);if(n.push(de(l,d,{sourceLanguage:t,confidence:.7})),o=c,o<e.length){let f=e[o];(f.kind==="conjunction"||this.isThenKeyword(f.value,t))&&o++;}}return n}extractRolesFromMarkedTokens(e,t,i,a,u){let n={},o=s=>{let l=[];for(let m of s){let c=i.get(m.value);if(c&&m.kind==="particle"&&l.length>0){let p=this.tokensToSemanticValue(l);if(p){let d=this.mapRoleForCommand(c,a,n);d&&(n[d]=p);}l=[];}else l.push(m);}if(l.length>0){let m=this.tokensToSemanticValue(l);m&&(n.patient?n.destination||(n.destination=m):n.patient=m);}};return o(e),o(t),n}mapRoleForCommand(e,t,i){return i[e]?e==="patient"&&!i.destination?"destination":e==="destination"&&!i.patient?"patient":e==="source"&&!i.source?"source":null:e}tokensToSemanticValue(e){if(e.length===0)return null;let t=e.filter(u=>u.kind!=="whitespace");if(t.length===0)return null;if(t.length===1)return this.tokenToSemanticValue(t[0]);let i=t.map(u=>u.value).join(""),a=t[0];return a.kind==="selector"||a.value.startsWith("#")||a.value.startsWith(".")||a.value.startsWith("@")||a.value.startsWith("*")?ue(i):a.kind==="literal"||a.value.startsWith('"')||a.value.startsWith("'")?A(i):a.kind==="reference"?I(i):A(i)}tokenToSemanticValue(e){let t=e.value;if(e.kind==="selector"||t.startsWith("#")||t.startsWith(".")||t.startsWith("@")||t.startsWith("*"))return ue(t);if(t.startsWith('"')||t.startsWith("'"))return A(t);if(/^-?\d+(\.\d+)?$/.test(t))return A(parseFloat(t));if(t==="true"||t==="\u771F"||t==="\uCC38"||t==="do\u011Fru")return A(true);if(t==="false"||t==="\u507D"||t==="\uAC70\uC9D3"||t==="yanl\u0131\u015F")return A(false);let i=e.normalized?.toLowerCase();return i==="me"||i==="it"||i==="you"||i==="result"||i==="body"?I(i):e.kind==="reference"?I(e.normalized||"me"):A(t)}parseBodyWithGrammarPatterns(e,t,i,a){let u=[];for(;!e.isAtEnd();){let n=e.peek();if(n&&this.isThenKeyword(n.value,a)){e.advance();continue}if(n&&this.isEndKeyword(n.value,a)){e.advance();break}let o=false;if(i.length>0){let s=O.matchBest(e,i);if(s){let l=s.pattern.command,m={};for(let[d,f]of s.captured)d!=="event"&&d!=="action"&&d!=="continues"&&(m[d]=f);let c=de(l,m,{sourceLanguage:a,patternId:s.pattern.id});u.push(c),o=true;let p=s.captured.get("continues");if(p&&p.type==="literal"&&p.value==="then")continue}}if(!o){let s=O.matchBest(e,t);s&&(u.push(this.buildCommand(s,a)),o=true);}o||e.advance();}return u}tryCompoundCommandParsing(e,t,i){let a=e.tokens;if(!a.some(s=>s.kind==="conjunction"||s.kind==="keyword"&&this.isThenKeyword(s.value,i)))return null;let n=new te(a,i),o=this.parseBodyWithClauses(n,t,i);return o.length===0?null:o.length===1?o[0]:Ve(o,"then",{sourceLanguage:i,confidence:.65})}trySOVEventExtraction(e,t,i){let a=P.SOV_EVENT_MARKERS[t];if(!a)return null;let n=ne(e,t).tokens,o=Kt[t],s=new Set;if(o)for(let z of Object.keys(o))s.add(z.toLowerCase());let l=P.SOV_SOURCE_MARKERS[t],m=-1,c="",p="",d=1;for(let z=0;z<n.length;z++){let D=n[z],N=D.value.toLowerCase(),_=N,$="",Ee=N.indexOf("[");Ee>0&&(_=N.slice(0,Ee),$=D.value.slice(Ee));let ge=D.normalized?.toLowerCase(),Te=ge&&P.KNOWN_EVENTS.has(ge),Pe=s.has(N)||s.has(_),Fr=P.KNOWN_EVENTS.has(_);if(Te||Pe||Fr){let Z;if(Te?Z=ge:Pe?Z=o?.[N]??o?.[_]??_:Z=_,a.size>0){let le=1,ze=n[z+1];ze&&ze.kind==="selector"&&ze.value.startsWith("[")&&(le=2);let me=n[z+le];if(me&&(me.kind==="particle"||me.kind==="keyword")&&a.has(me.value)){m=z,c=Z,p=$||(le===2?n[z+1].value:""),d=le+1;break}}else {m=z,c=Z,p=$,d=1;break}}}if(m===-1)return null;let f=new Set;for(let z=m;z<m+d;z++)f.add(z);if(l){let z=m+d;if(z<n.length){let D=n[z];(D.kind==="particle"||D.kind==="keyword")&&l.markers.has(D.value)&&f.add(z);}for(let D=0;D<m;D++){let N=n[D],_=N.value.toLowerCase(),$=N.normalized?.toLowerCase();if(l.windowTokens.has(_)||$&&l.windowTokens.has($)){f.add(D);break}}}let E=n.filter((z,D)=>!f.has(D));if(E.length===0)return null;let v=i.filter(z=>z.command!=="on"),g=new te(E,t),k=this.parseBodyWithClauses(g,v,t);if(k.length===0)return null;let Se={sourceLanguage:t,confidence:.75};return p&&(Se.keyFilter=p),$e({type:"literal",value:c},k,void 0,Se)}isThenKeyword(e,t){let i={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 (i[t]||i.en).has(e.toLowerCase())}isEndKeyword(e,t){let i={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 (i[t]||i.en).has(e.toLowerCase())}extractStandaloneModifiers(e,t){let a=ne(e,t).tokens;if(a.length===0)return {modifiers:null,remainingInput:null};let n=a[0].value.toLowerCase(),o=P.STANDALONE_MODIFIERS[n];if(!o)return {modifiers:null,remainingInput:null};let s={},l=1;if(o==="once")s.once=true;else {let d=1;if(d<a.length){let f=a[d];(f.kind==="keyword"||f.kind==="particle")&&(d++,l++);}if(d<a.length){let f=a[d];if(f.kind==="literal"){let E=f.value.match(/^(\d+)(ms|s|m)?$/);if(E){let v=parseInt(E[1],10),g=E[2]||"ms";g==="s"?v*=1e3:g==="m"&&(v*=6e4),s[o]=v,l=d+1;}}}s[o]||(s[o]=o==="debounce"?300:100);}let m=a.slice(l);if(m.length===0)return {modifiers:null,remainingInput:null};let c=m[0].position.start,p=e.slice(c);return {modifiers:s,remainingInput:p}}applyModifiers(e,t){return {...e,eventModifiers:{...e.eventModifiers,...t}}}extractOrConjunctionEvents(e,t){let i=[];for(;;){let a=e.mark(),u=e.peek();if(!u)break;let n=(u.normalized||u.value).toLowerCase();if(!P.OR_KEYWORDS.has(n)){e.reset(a);break}e.advance();let o=e.peek();if(!o){e.reset(a);break}let s=(o.normalized||o.value).toLowerCase();e.advance(),i.push({type:"literal",value:s});}return i}};X.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);X.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"])};X.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"])}};X.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};X.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 na=X,oa=new na;function sa(r,e){return oa.parse(r,e)}function la(r,e){try{let t=ne(r,e),i=G(e);if(i.length===0)return {confidence:0,parseSuccess:!1,error:`No patterns available for language: ${e}`};let a=[...i].sort((l,m)=>m.priority-l.priority),u=a.filter(l=>l.command==="on"),n=O.matchBest(t,u);if(n)return {confidence:n.confidence,parseSuccess:!0,patternId:n.pattern.id,action:n.pattern.command,tokensConsumed:n.consumedTokens};t.reset(t.mark());let o=a.filter(l=>l.command!=="on"),s=O.matchBest(t,o);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: ${r}`}}catch(t){return {confidence:0,parseSuccess:false,error:t instanceof Error?t.message:String(t)}}}function lr(r,e){try{let i=sa(r,e);if(i)return {node:i,confidence:i.metadata?.confidence??.8,error:void 0,tokensConsumed:ne(r,e).tokens.length}}catch{}let t=la(r,e);return t.parseSuccess?{node:null,confidence:t.confidence,error:void 0,tokensConsumed:t.tokensConsumed}:{node:null,confidence:0,error:t.error}}function mr(r,e){let t=e==="SOV"?"sovPosition":"svoPosition";return [...r].sort((i,a)=>{let u=i[t]??99,n=a[t]??99;return u-n})}function ma(r,e){let t=r.markerOverride?.[e.code],i=e.roleMarkers[r.role];if(t!==void 0)return {primary:t,position:i?.position??"before",isOverride:true};if(i&&i.primary){let a={primary:i.primary,position:i.position,isOverride:false};return i.alternatives&&(a.alternatives=i.alternatives),a}return null}function ca(r,e,t,i,a){let u=[];if(u.push({type:"role",role:"event",optional:false}),i.position==="after"){let l=i.primary.split(/\s+/);if(l.length>1)for(let m of l)u.push({type:"literal",value:m});else {let m=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(m);}}let n=e.roleMarkers.destination;n&&u.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary}]}),u.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o){let l=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};u.push(l);}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return u.push(s),{id:`${r.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(a.basePriority??100)+50,template:{format:`{event} ${i.primary} {destination?} {patient} ${o?.primary||""} ${t.primary}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function pa(r,e,t,i,a){let u=[];u.push({type:"role",role:"patient",optional:false});let n=e.roleMarkers.patient;if(n){let s=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};u.push(s);}if(u.push({type:"role",role:"event",optional:false}),i.position==="after"){let s=i.primary.split(/\s+/);if(s.length>1)for(let l of s)u.push({type:"literal",value:l});else {let l=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(l);}}let o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return u.push(o),{id:`${r.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(a.basePriority??100)+45,template:{format:`{patient} ${n?.primary||""} {event} ${i.primary} ${t.primary}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function da(r,e,t,i,a){let u=[];u.push({type:"role",role:"patient",optional:false});let n=e.roleMarkers.patient;if(n){let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};u.push(l);}let o=e.roleMarkers.destination;if(o&&(u.push({type:"role",role:"destination",optional:false}),u.push(o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary})),u.push({type:"role",role:"event",optional:false}),i.position==="after"){let l=i.primary.split(/\s+/);if(l.length>1)for(let m of l)u.push({type:"literal",value:m});else {let m=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(m);}}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return u.push(s),{id:`${r.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(a.basePriority??100)+40,template:{format:`{patient} ${n?.primary||""} {destination} ${o?.primary||""} {event} ${i.primary} ${t.primary}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function ya(r,e,t,i,a){let u=[];u.push({type:"role",role:"event",optional:false});let n=i.alternatives?.filter(m=>!m.includes(" ")&&m.length>1)||[];n.length>0&&u.push({type:"literal",value:n[0],alternatives:n.slice(1)});let o=e.roleMarkers.destination;o&&u.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}]}),u.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let m=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};u.push(m);}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return u.push(l),{id:`${r.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(a.basePriority??100)+52,template:{format:`{event}${n[0]||""} {patient} ${t.primary}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function fa(r,e,t,i,a){let u=[];if(u.push({type:"role",role:"event",optional:false}),i.position==="after"){let o=i.primary.split(/\s+/);if(o.length>1)for(let s of o)u.push({type:"literal",value:s});else {let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(s);}}let n=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return u.push(n),{id:`${r.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(a.basePriority??100)+48,template:{format:`{event} ${i.primary} ${t.primary}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function ha(r,e,t,i){let a=e.eventHandler?.temporalMarkers;if(!a||a.length===0)return null;let u=[];u.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&u.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),u.push({type:"literal",value:a[0],alternatives:a.slice(1)}),u.push({type:"role",role:"patient",optional:false});let n=e.roleMarkers.patient;if(n?.primary){let s=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};u.push(s);}let o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return u.push(o),{id:`${r.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(i.basePriority??100)+49,template:{format:`{event} ${a[0]} {patient} ${t.primary}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function va(r,e,t,i,a){let u=[];if(u.push({type:"role",role:"event",optional:false}),i.position==="after"){let m=i.primary.split(/\s+/);if(m.length>1)for(let c of m)u.push({type:"literal",value:c});else {let c=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(c);}}let o=[...r.roles.filter(m=>m.required)].sort((m,c)=>{let p=m.sovPosition??999,d=c.sovPosition??999;return p-d});for(let m of o){u.push({type:"role",role:m.role,optional:false});let c,p;if(m.markerOverride&&m.markerOverride[e.code]!==void 0)c=m.markerOverride[e.code];else {let d=e.roleMarkers[m.role];d&&(c=d.primary,p=d.alternatives);}if(c){let d=p?{type:"literal",value:c,alternatives:p}:{type:"literal",value:c};u.push(d);}}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};u.push(s);let l=o.map(m=>`{${m.role}}`).join(" ");return {id:`${r.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(a.basePriority??100)+55,template:{format:`{event} ${i.primary} ${l} ${t.primary}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(o.map(m=>[m.role,{fromRole:m.role}]))}}}function Ea(r,e,t,i,a){let u=[],o=[...r.roles.filter(f=>f.required)].sort((f,E)=>{let v=f.sovPosition??999,g=E.sovPosition??999;return v-g}),s=o[0];u.push({type:"role",role:s.role,optional:false});let l;if(s.markerOverride&&s.markerOverride[e.code]!==void 0)l=s.markerOverride[e.code];else {let f=e.roleMarkers[s.role];f&&(l=f.primary);}if(l&&u.push({type:"literal",value:l}),u.push({type:"role",role:"event",optional:false}),i.position==="after"){let f=i.primary.split(/\s+/);if(f.length>1)for(let E of f)u.push({type:"literal",value:E});else {let E=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(E);}}let m=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};u.push(m);let c=o[1];u.push({type:"role",role:c.role,optional:false});let p,d;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)p=c.markerOverride[e.code];else {let f=e.roleMarkers[c.role];f&&(p=f.primary,d=f.alternatives);}if(p){let f=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};u.push(f);}return {id:`${r.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(a.basePriority??100)+48,template:{format:`{${s.role}} {event} ${i.primary} ${t.primary} {${c.role}}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},[s.role]:{fromRole:s.role},[c.role]:{fromRole:c.role}}}}function He(r,e,t,i,a){let u=[];if(i.position==="before"){let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(s);}u.push({type:"role",role:"event",optional:false});let n=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};u.push(n),u.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.destination;return o&&u.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:`${r.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(a.basePriority??100)+50,template:{format:`${i.primary} {event} ${t.primary} {patient} ${o?.primary||""} {destination?}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ga(r,e,t,i,a){let u=[],n=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};u.push(n),u.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.destination;if(o&&u.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}]}),i.position==="before"){let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(s);}return u.push({type:"role",role:"event",optional:false}),{id:`${r.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(a.basePriority??100)+45,template:{format:`${t.primary} {patient} ${o?.primary||""} {destination?} ${i.primary} {event}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function za(r,e,t,i,a){let u=[],n=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};u.push(n);let s=[...r.roles.filter(m=>m.required)].sort((m,c)=>{let p=m.svoPosition??999,d=c.svoPosition??999;return p-d});for(let m of s){let c,p;if(m.markerOverride&&m.markerOverride[e.code]!==void 0)c=m.markerOverride[e.code];else {let d=e.roleMarkers[m.role];d&&(c=d.primary,p=d.alternatives);}if(c){let d=p?{type:"literal",value:c,alternatives:p}:{type:"literal",value:c};u.push(d);}u.push({type:"role",role:m.role,optional:false});}if(i.position==="before"){let m=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(m);}u.push({type:"role",role:"event",optional:false});let l=s.map(m=>`{${m.role}}`).join(" ");return {id:`${r.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(a.basePriority??100)+48,template:{format:`${t.primary} ${l} ${i.primary} {event}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(s.map(m=>[m.role,{fromRole:m.role}]))}}}function Ye(r,e,t,i,a){let u=[];if(i.position==="before"){let m=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(m);}u.push({type:"role",role:"event",optional:false});let n=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};u.push(n);let s=[...r.roles.filter(m=>m.required)].sort((m,c)=>{let p=m.svoPosition??999,d=c.svoPosition??999;return p-d});for(let m of s){let c,p;if(m.markerOverride&&m.markerOverride[e.code]!==void 0)c=m.markerOverride[e.code];else {let d=e.roleMarkers[m.role];d&&(c=d.primary,p=d.alternatives);}if(c){let d=p?{type:"literal",value:c,alternatives:p}:{type:"literal",value:c};u.push(d);}u.push({type:"role",role:m.role,optional:false});}let l=s.map(m=>`{${m.role}}`).join(" ");return {id:`${r.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(a.basePriority??100)+55,template:{format:`${i.primary} {event} ${t.primary} ${l}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(s.map(m=>[m.role,{fromRole:m.role}]))}}}function ka(r,e,t,i,a){let u=[],n=e.eventHandler?.negationMarker;if(i.position==="before"){let l=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(l);}if(n){let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};u.push(l);}u.push({type:"role",role:"event",optional:false});let o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};u.push(o),u.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&u.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:`${r.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(a.basePriority??100)+48,template:{format:`${i.primary} ${n?.primary||""} {event} ${t.primary} {patient} ${s?.primary||""} {destination?}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Ca(r,e,t,i){let a=[];a.push({type:"literal",value:"and",alternatives:["then"]}),a.push({type:"role",role:"event",optional:false});let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(u),a.push({type:"role",role:"patient",optional:false});let n=e.roleMarkers.destination;return n&&a.push({type:"group",optional:true,tokens:[n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary},{type:"role",role:"destination",optional:true}]}),{id:`${r.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`[proclitic?] {event} ${t.primary} {patient} ${n?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var oe={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function cr(r,e,t=oe){let i=`${r.action}-${e.code}-generated`,a=t.basePriority??100,u=e.keywords[r.action];if(!u)throw new Error(`No keyword translation for '${r.action}' in ${e.code}`);let n=Da(r,e,u),o=dr(r,e),s=Sa(r,e,u);return {id:i,language:e.code,command:r.action,priority:a,template:{format:s,tokens:n},extraction:o}}function ba(r,e,t=oe){if(r.roles.filter(o=>!o.required).length===0)return null;let a=r.roles.filter(o=>o.required),u={...r,roles:a};return {...cr(u,e,t),id:`${r.action}-${e.code}-generated-simple`,priority:(t.basePriority??100)-5,extraction:dr(r,e)}}function Aa(r,e,t=oe){let i=[];if(i.push(cr(r,e,t)),t.generateSimpleVariants){let a=ba(r,e,t);a&&i.push(a);}return i}function pr(r,e=oe){let t=[],i=ua();for(let a of i){if(!r.keywords[a.action])continue;let u=Aa(a,r,e);if(t.push(...u),r.eventHandler?.eventMarker){let n=wa(a,r,e);t.push(...n);}}return t}function wa(r,e,t=oe){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let i=[],a=e.eventHandler.eventMarker,u=e.keywords[r.action];if(!u)return [];let o=r.roles.filter(s=>s.required).length===2;if(e.wordOrder==="SOV")if(o)i.push(va(r,e,u,a,t)),i.push(Ea(r,e,u,a,t));else {i.push(ca(r,e,u,a,t)),i.push(pa(r,e,u,a,t));let s=e.roleMarkers.destination;s&&s.primary!==a.primary&&i.push(da(r,e,u,a,t));let l=a.primary.split(/\s+/),m=a.alternatives?.some(p=>!p.includes(" ")&&p.length>1);l.length>1&&m&&i.push(ya(r,e,u,a,t)),i.push(fa(r,e,u,a,t));let c=ha(r,e,u,t);c&&i.push(c);}else e.wordOrder==="VSO"?o?(i.push(Ye(r,e,u,a,t)),i.push(za(r,e,u,a,t))):(i.push(He(r,e,u,a,t)),i.push(ga(r,e,u,a,t)),e.eventHandler?.negationMarker&&i.push(ka(r,e,u,a,t)),e.tokenization?.prefixes&&i.push(Ca(r,e,u,t))):o?i.push(Ye(r,e,u,a,t)):i.push(He(r,e,u,a,t));return i}function Da(r,e,t){let i=[],a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary},u=xa(r,e);switch(e.wordOrder){case "SVO":i.push(a),i.push(...u);break;case "SOV":i.push(...u),i.push(a);break;case "VSO":i.push(a),i.push(...u);break;default:i.push(a),i.push(...u);}return i}function xa(r,e){let t=[],i=mr(r.roles,e.wordOrder);for(let a of i){let u=Ba(a,e);a.required?t.push(...u):t.push({type:"group",optional:true,tokens:u});}return t}function Ba(r,e){let t=[],i=r.markerOverride?.[e.code],a=e.roleMarkers[r.role],u={type:"role",role:r.role,optional:!r.required,expectedTypes:r.expectedTypes};if(i!==void 0){let n=i?i.split(/\s+/).filter(Boolean):[];if((a?.position??"before")==="before"){for(let s of n)t.push({type:"literal",value:s});t.push(u);}else {t.push(u);for(let s of n)t.push({type:"literal",value:s});}}else if(a)if(a.position==="before"){if(a.primary){let n=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};t.push(n);}t.push(u);}else {t.push(u);let n=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};t.push(n);}else t.push(u);return t}function Fa(r,e){let t={};for(let i of r.roles){let a=i.markerOverride?.[e.code],u=e.roleMarkers[i.role];a!==void 0?t[i.role]=a?{marker:a}:{}:u&&u.primary?t[i.role]=u.alternatives?{marker:u.primary,markerAlternatives:u.alternatives}:{marker:u.primary}:t[i.role]={};}return t}function dr(r,e){let t=Fa(r,e),i={};for(let a of r.roles){let u=t[a.role]||{};!a.required&&a.default?i[a.role]={...u,default:a.default}:i[a.role]=u;}return i}function Sa(r,e,t){let i=[],u=mr(r.roles,e.wordOrder).map(n=>{let o=ma(n,e),s="";return o&&o.primary?o.position==="before"?s=`${o.primary} {${n.role}}`:s=`{${n.role}} ${o.primary}`:s=`{${n.role}}`,n.required?s:`[${s}]`});switch(e.wordOrder){case "SVO":case "VSO":i.push(t.primary,...u);break;case "SOV":i.push(...u,t.primary);break;default:i.push(t.primary,...u);}return i.join(" ")}var Ta=class{constructor(r={}){this.cache=new Map,this.config={maxSize:r.maxSize??1e3,ttlMs:r.ttlMs??0,enabled:r.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(r,e){return `${e}:${r}`}isExpired(r){return this.config.ttlMs===0?false:Date.now()-r.createdAt>this.config.ttlMs}evictLRU(){let r=this.cache.keys().next().value;r!==void 0&&(this.cache.delete(r),this.stats.evictions++);}get(r,e){if(!this.config.enabled){this.stats.misses++;return}let t=this.makeKey(r,e),i=this.cache.get(t);if(!i){this.stats.misses++;return}if(this.isExpired(i)){this.cache.delete(t),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(t),i.lastAccessed=Date.now(),this.cache.set(t,i),this.stats.hits++,i.result}set(r,e,t){if(!this.config.enabled||t!==null&&typeof t=="object"&&"confidence"in t&&t.confidence===0)return;let i=this.makeKey(r,e),a=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(i,{result:t,createdAt:a,lastAccessed:a});}has(r,e){if(!this.config.enabled)return false;let t=this.makeKey(r,e),i=this.cache.get(t);return i?this.isExpired(i)?(this.cache.delete(t),this.stats.expirations++,false):true:false}delete(r,e){let t=this.makeKey(r,e);return this.cache.delete(t)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let r=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:r>0?this.stats.hits/r:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(r){if(r.maxSize!==void 0)for(this.config.maxSize=r.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();r.ttlMs!==void 0&&(this.config.ttlMs=r.ttlMs),r.enabled!==void 0&&(this.config.enabled=r.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}};new Ta;function Pa(r){return /[а-яА-ЯёЁ]/.test(r)}function Ra(r){for(let e of r)if(Pa(e))return true;return false}var yr=new Map([["\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438","\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C"],["\u0434\u043E\u0431\u0430\u0432\u044C","\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C"],["\u0443\u0434\u0430\u043B\u0438","\u0443\u0434\u0430\u043B\u0438\u0442\u044C"],["\u0443\u0431\u0435\u0440\u0438","\u0443\u0431\u0440\u0430\u0442\u044C"],["\u043F\u043E\u043B\u043E\u0436\u0438","\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C"],["\u043F\u043E\u043C\u0435\u0441\u0442\u0438","\u043F\u043E\u043C\u0435\u0441\u0442\u0438\u0442\u044C"],["\u0432\u0441\u0442\u0430\u0432\u044C","\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044C"],["\u0432\u043E\u0437\u044C\u043C\u0438","\u0432\u0437\u044F\u0442\u044C"],["\u0441\u043E\u0437\u0434\u0430\u0439","\u0441\u043E\u0437\u0434\u0430\u0442\u044C"],["\u043A\u043B\u043E\u043D\u0438\u0440\u0443\u0439","\u043A\u043B\u043E\u043D\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u043F\u043E\u043C\u0435\u043D\u044F\u0439","\u043F\u043E\u043C\u0435\u043D\u044F\u0442\u044C"],["\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0438\u0440\u0443\u0439","\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438","\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C"],["\u0437\u0430\u0434\u0430\u0439","\u0437\u0430\u0434\u0430\u0442\u044C"],["\u043F\u043E\u043B\u0443\u0447\u0438","\u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C"],["\u0443\u0432\u0435\u043B\u0438\u0447\u044C","\u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C"],["\u0443\u043C\u0435\u043D\u044C\u0448\u0438","\u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C"],["\u0437\u0430\u043F\u0438\u0448\u0438","\u0437\u0430\u043F\u0438\u0441\u0430\u0442\u044C"],["\u043F\u043E\u043A\u0430\u0436\u0438","\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u044C"],["\u0441\u043A\u0440\u043E\u0439","\u0441\u043A\u0440\u044B\u0442\u044C"],["\u0441\u043F\u0440\u044F\u0447\u044C","\u0441\u043F\u0440\u044F\u0442\u0430\u0442\u044C"],["\u0430\u043D\u0438\u043C\u0438\u0440\u0443\u0439","\u0430\u043D\u0438\u043C\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u0432\u044B\u0437\u043E\u0432\u0438","\u0432\u044B\u0437\u0432\u0430\u0442\u044C"],["\u043E\u0442\u043F\u0440\u0430\u0432\u044C","\u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C"],["\u0441\u0444\u043E\u043A\u0443\u0441\u0438\u0440\u0443\u0439","\u0441\u0444\u043E\u043A\u0443\u0441\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u0440\u0430\u0437\u043C\u043E\u0439","\u0440\u0430\u0437\u043C\u044B\u0442\u044C"],["\u043F\u0435\u0440\u0435\u0439\u0434\u0438","\u043F\u0435\u0440\u0435\u0439\u0442\u0438"],["\u0438\u0434\u0438","\u0438\u0434\u0442\u0438"],["\u0436\u0434\u0438","\u0436\u0434\u0430\u0442\u044C"],["\u043F\u043E\u0434\u043E\u0436\u0434\u0438","\u043F\u043E\u0434\u043E\u0436\u0434\u0430\u0442\u044C"],["\u0437\u0430\u0433\u0440\u0443\u0437\u0438","\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C"],["\u043F\u043E\u0432\u0442\u043E\u0440\u0438","\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C"],["\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438","\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C"],["\u0431\u0440\u043E\u0441\u044C","\u0431\u0440\u043E\u0441\u0438\u0442\u044C"],["\u0432\u0435\u0440\u043D\u0438","\u0432\u0435\u0440\u043D\u0443\u0442\u044C"],["\u0441\u043A\u0430\u0436\u0438","\u0441\u043A\u0430\u0437\u0430\u0442\u044C"],["\u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u0443\u0439","\u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u0438\u0437\u043C\u0435\u0440\u044C","\u0438\u0437\u043C\u0435\u0440\u0438\u0442\u044C"]]),fr=class{constructor(){this.language="ru";}isNormalizable(r){return r.length<3?false:Ra(r)}normalize(r){let e=r.toLowerCase();if(e.endsWith("\u0441\u044F")||e.endsWith("\u0441\u044C")){let n=this.tryReflexiveNormalization(e);if(n)return n}if(e.endsWith("\u0442\u044C")||e.endsWith("\u0442\u0438")||e.endsWith("\u0447\u044C"))return w(r);let t=this.tryImperativeLookup(e);if(t)return t;let i=this.tryPastTenseNormalization(e);if(i)return i;let a=this.tryPresentTenseNormalization(e);if(a)return a;let u=this.tryGenericImperativeNormalization(e);return u||w(r)}tryReflexiveNormalization(r){(r.endsWith("\u0441\u044F"),2);let t=r.slice(0,-2);if(r.endsWith("\u0442\u044C\u0441\u044F")||r.endsWith("\u0442\u0438\u0441\u044C")||r.endsWith("\u0447\u044C\u0441\u044F"))return w(r);let i=this.normalizeNonReflexive(t);if(i.confidence<1){let a=i.stem.endsWith("\u0442\u044C")?i.stem.slice(0,-2)+"\u0442\u044C\u0441\u044F":i.stem+"\u0441\u044F";return y(a,i.confidence*.95,{removedSuffixes:["\u0441\u044F",...i.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}normalizeNonReflexive(r){if(r.endsWith("\u0442\u044C")||r.endsWith("\u0442\u0438")||r.endsWith("\u0447\u044C"))return w(r);let e=this.tryImperativeLookup(r);if(e)return e;let t=this.tryPastTenseNormalization(r);if(t)return t;let i=this.tryPresentTenseNormalization(r);if(i)return i;let a=this.tryGenericImperativeNormalization(r);return a||w(r)}tryImperativeLookup(r){return yr.has(r)?y(yr.get(r),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(r){return r.endsWith("\u0439\u0442\u0435")&&r.length>5?y(r.slice(0,-3)+"\u0442\u044C",.8,{removedSuffixes:["\u0439\u0442\u0435"],conjugationType:"imperative"}):r.endsWith("\u0438\u0442\u0435")&&r.length>5?y(r.slice(0,-3)+"\u0438\u0442\u044C",.8,{removedSuffixes:["\u0438\u0442\u0435"],conjugationType:"imperative"}):r.endsWith("\u0439")&&r.length>3?y(r.slice(0,-1)+"\u0442\u044C",.75,{removedSuffixes:["\u0439"],conjugationType:"imperative"}):r.endsWith("\u0438")&&r.length>3?y(r+"\u0442\u044C",.7,{removedSuffixes:["\u0438\u2192\u0438\u0442\u044C"],conjugationType:"imperative"}):null}tryPastTenseNormalization(r){return r.endsWith("\u0430\u043B\u0430")&&r.length>4?y(r.slice(0,-3)+"\u0430\u0442\u044C",.85,{removedSuffixes:["\u0430\u043B\u0430"],conjugationType:"past"}):r.endsWith("\u0438\u043B\u0430")&&r.length>4?y(r.slice(0,-3)+"\u0438\u0442\u044C",.85,{removedSuffixes:["\u0438\u043B\u0430"],conjugationType:"past"}):r.endsWith("\u0435\u043B\u043E")&&r.length>4?y(r.slice(0,-3)+"\u0435\u0442\u044C",.82,{removedSuffixes:["\u0435\u043B\u043E"],conjugationType:"past"}):r.endsWith("\u0430\u0431\u043E")&&r.length>4?y(r.slice(0,-3)+"\u0430\u0442\u044C",.82,{removedSuffixes:["\u0430\u0431\u043E"],conjugationType:"past"}):r.endsWith("\u0430\u043B\u0438")&&r.length>4?y(r.slice(0,-3)+"\u0430\u0442\u044C",.85,{removedSuffixes:["\u0430\u043B\u0438"],conjugationType:"past"}):r.endsWith("\u0438\u043B\u0438")&&r.length>4?y(r.slice(0,-3)+"\u0438\u0442\u044C",.85,{removedSuffixes:["\u0438\u043B\u0438"],conjugationType:"past"}):r.endsWith("\u0430\u043B")&&r.length>3?y(r.slice(0,-2)+"\u0430\u0442\u044C",.82,{removedSuffixes:["\u0430\u043B"],conjugationType:"past"}):r.endsWith("\u0438\u043B")&&r.length>3?y(r.slice(0,-2)+"\u0438\u0442\u044C",.82,{removedSuffixes:["\u0438\u043B"],conjugationType:"past"}):null}tryPresentTenseNormalization(r){return r.endsWith("\u0438\u0448\u044C")&&r.length>4?y(r.slice(0,-3)+"\u0438\u0442\u044C",.8,{removedSuffixes:["\u0438\u0448\u044C"],conjugationType:"present"}):r.endsWith("\u0438\u0442")&&r.length>3?y(r.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u0438\u0442"],conjugationType:"present"}):r.endsWith("\u0438\u043C")&&r.length>3?y(r.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u0438\u043C"],conjugationType:"present"}):r.endsWith("\u044F\u0442")&&r.length>3?y(r.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u044F\u0442"],conjugationType:"present"}):r.endsWith("\u0435\u0448\u044C")&&r.length>4?y(r.slice(0,-3)+"\u0430\u0442\u044C",.75,{removedSuffixes:["\u0435\u0448\u044C"],conjugationType:"present"}):r.endsWith("\u0435\u0442")&&r.length>3?y(r.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0435\u0442"],conjugationType:"present"}):r.endsWith("\u0435\u043C")&&r.length>3?y(r.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0435\u043C"],conjugationType:"present"}):r.endsWith("\u044E\u0442")&&r.length>3?y(r.slice(0,-2)+"\u0430\u0442\u044C",.75,{removedSuffixes:["\u044E\u0442"],conjugationType:"present"}):r.endsWith("\u0443\u0442")&&r.length>3?y(r.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0443\u0442"],conjugationType:"present"}):null}},hr={code:"ru",name:"Russian",nativeName:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",direction:"ltr",script:"cyrillic",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:true,suffixes:["\u0442\u044C","\u0442\u044C\u0441\u044F","\u0438\u0442\u044C","\u0438\u0442\u044C\u0441\u044F","\u0430\u0442\u044C","\u0430\u0442\u044C\u0441\u044F","\u0435\u0442\u044C","\u0435\u0442\u044C\u0441\u044F"]},references:{me:"\u044F",it:"\u044D\u0442\u043E",you:"\u0442\u044B",result:"\u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442",event:"\u0441\u043E\u0431\u044B\u0442\u0438\u0435",target:"\u0446\u0435\u043B\u044C",body:"body"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:true,specialForms:{me:"\u043C\u043E\u0439",it:"\u0435\u0433\u043E",you:"\u0442\u0432\u043E\u0439"},keywords:{\u043C\u043E\u0439:"me",\u043C\u043E\u044F:"me",\u043C\u043E\u0451:"me",\u043C\u043E\u0438:"me",\u0442\u0432\u043E\u0439:"you",\u0442\u0432\u043E\u044F:"you",\u0442\u0432\u043E\u0451:"you",\u0442\u0432\u043E\u0438:"you",\u0435\u0433\u043E:"it",\u0435\u0451:"it"}},roleMarkers:{destination:{primary:"\u0432",alternatives:["\u043D\u0430","\u043A"],position:"before"},source:{primary:"\u0438\u0437",alternatives:["\u043E\u0442","\u0441"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"\u0441",alternatives:["\u0441\u043E"],position:"before"}},keywords:{toggle:{primary:"\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C",alternatives:["\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438"],normalized:"toggle",form:"infinitive"},add:{primary:"\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C",alternatives:["\u0434\u043E\u0431\u0430\u0432\u044C"],normalized:"add",form:"infinitive"},remove:{primary:"\u0443\u0434\u0430\u043B\u0438\u0442\u044C",alternatives:["\u0443\u0434\u0430\u043B\u0438","\u0443\u0431\u0440\u0430\u0442\u044C","\u0443\u0431\u0435\u0440\u0438"],normalized:"remove",form:"infinitive"},put:{primary:"\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"],normalized:"put",form:"infinitive"},append:{primary:"\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C_\u0432_\u043A\u043E\u043D\u0435\u0446",alternatives:["\u0434\u043E\u043F\u0438\u0441\u0430\u0442\u044C"],normalized:"append",form:"infinitive"},prepend:{primary:"\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C_\u0432_\u043D\u0430\u0447\u0430\u043B\u043E",normalized:"prepend",form:"infinitive"},take:{primary:"\u0432\u0437\u044F\u0442\u044C",alternatives:["\u0432\u043E\u0437\u044C\u043C\u0438"],normalized:"take",form:"infinitive"},make:{primary:"\u0441\u043E\u0437\u0434\u0430\u0442\u044C",alternatives:["\u0441\u043E\u0437\u0434\u0430\u0439"],normalized:"make",form:"infinitive"},clone:{primary:"\u043A\u043B\u043E\u043D\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u043A\u043B\u043E\u043D\u0438\u0440\u0443\u0439"],normalized:"clone",form:"infinitive"},swap:{primary:"\u043F\u043E\u043C\u0435\u043D\u044F\u0442\u044C",alternatives:["\u043F\u043E\u043C\u0435\u043D\u044F\u0439"],normalized:"swap",form:"infinitive"},morph:{primary:"\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0438\u0440\u0443\u0439"],normalized:"morph",form:"infinitive"},set:{primary:"\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C",alternatives:["\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438","\u0437\u0430\u0434\u0430\u0442\u044C","\u0437\u0430\u0434\u0430\u0439"],normalized:"set",form:"infinitive"},get:{primary:"\u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C",alternatives:["\u043F\u043E\u043B\u0443\u0447\u0438"],normalized:"get",form:"infinitive"},increment:{primary:"\u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C",alternatives:["\u0443\u0432\u0435\u043B\u0438\u0447\u044C"],normalized:"increment",form:"infinitive"},decrement:{primary:"\u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C",alternatives:["\u0443\u043C\u0435\u043D\u044C\u0448\u0438"],normalized:"decrement",form:"infinitive"},log:{primary:"\u0437\u0430\u043F\u0438\u0441\u0430\u0442\u044C",alternatives:["\u0437\u0430\u043F\u0438\u0448\u0438"],normalized:"log",form:"infinitive"},show:{primary:"\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u044C",alternatives:["\u043F\u043E\u043A\u0430\u0436\u0438"],normalized:"show",form:"infinitive"},hide:{primary:"\u0441\u043A\u0440\u044B\u0442\u044C",alternatives:["\u0441\u043A\u0440\u043E\u0439","\u0441\u043F\u0440\u044F\u0442\u0430\u0442\u044C","\u0441\u043F\u0440\u044F\u0447\u044C"],normalized:"hide",form:"infinitive"},transition:{primary:"\u0430\u043D\u0438\u043C\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0430\u043D\u0438\u043C\u0438\u0440\u0443\u0439"],normalized:"transition",form:"infinitive"},on:{primary:"\u043F\u0440\u0438",normalized:"on"},trigger:{primary:"\u0438\u043D\u0438\u0446\u0438\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C","\u0437\u0430\u043F\u0443\u0441\u0442\u0438"],normalized:"trigger",form:"infinitive"},send:{primary:"\u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",alternatives:["\u043E\u0442\u043F\u0440\u0430\u0432\u044C"],normalized:"send",form:"infinitive"},focus:{primary:"\u0441\u0444\u043E\u043A\u0443\u0441\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0441\u0444\u043E\u043A\u0443\u0441\u0438\u0440\u0443\u0439","\u0444\u043E\u043A\u0443\u0441"],normalized:"focus",form:"infinitive"},blur:{primary:"\u0440\u0430\u0437\u043C\u044B\u0442\u044C",alternatives:["\u0440\u0430\u0437\u043C\u043E\u0439"],normalized:"blur",form:"infinitive"},empty:{primary:"\u043E\u043F\u0443\u0441\u0442\u043E\u0448\u0438\u0442\u044C",normalized:"empty"},open:{primary:"\u043E\u0442\u043A\u0440\u044B\u0442\u044C",normalized:"open"},close:{primary:"\u0437\u0430\u043A\u0440\u044B\u0442\u044C",normalized:"close"},select:{primary:"\u0432\u044B\u0434\u0435\u043B\u0438\u0442\u044C",normalized:"select"},clear:{primary:"\u043E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",normalized:"clear"},reset:{primary:"\u0441\u0431\u0440\u043E\u0441\u0438\u0442\u044C",normalized:"reset"},breakpoint:{primary:"\u0442\u043E\u0447\u043A\u0430-\u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0430",normalized:"breakpoint"},click:{primary:"\u043A\u043B\u0438\u043A",alternatives:["\u043A\u043B\u0438\u043A\u0435","\u043D\u0430\u0436\u0430\u0442\u0438\u0438"],normalized:"click"},hover:{primary:"\u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0438",alternatives:["\u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0435"],normalized:"hover"},submit:{primary:"\u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0435",alternatives:["\u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0430"],normalized:"submit"},input:{primary:"\u0432\u0432\u043E\u0434\u0435",alternatives:["\u0432\u0432\u043E\u0434"],normalized:"input"},change:{primary:"\u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0438",alternatives:["\u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0435"],normalized:"change"},go:{primary:"\u043F\u0435\u0440\u0435\u0439\u0442\u0438",alternatives:["\u043F\u0435\u0440\u0435\u0439\u0434\u0438","\u0438\u0434\u0442\u0438","\u0438\u0434\u0438"],normalized:"go",form:"infinitive"},scroll:{primary:"\u043F\u0440\u043E\u043A\u0440\u0443\u0442\u0438\u0442\u044C",alternatives:["\u043F\u0440\u043E\u043A\u0440\u0443\u0442\u0438"],normalized:"scroll",form:"infinitive"},push:{primary:"\u0432\u0442\u043E\u043B\u043A\u043D\u0443\u0442\u044C",alternatives:["\u0442\u043E\u043B\u043A\u043D\u0443\u0442\u044C"],normalized:"push",form:"infinitive"},replace:{primary:"\u0437\u0430\u043C\u0435\u043D\u0438\u0442\u044C",alternatives:["\u0437\u0430\u043C\u0435\u043D\u0438"],normalized:"replace",form:"infinitive"},process:{primary:"\u043E\u0431\u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C",alternatives:["\u043E\u0431\u0440\u0430\u0431\u043E\u0442\u0430\u0439"],normalized:"process",form:"infinitive"},wait:{primary:"\u0436\u0434\u0430\u0442\u044C",alternatives:["\u0436\u0434\u0438","\u043F\u043E\u0434\u043E\u0436\u0434\u0438"],normalized:"wait",form:"infinitive"},fetch:{primary:"\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C",alternatives:["\u0437\u0430\u0433\u0440\u0443\u0437\u0438"],normalized:"fetch",form:"infinitive"},settle:{primary:"\u0441\u0442\u0430\u0431\u0438\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u0442\u044C",normalized:"settle",form:"infinitive"},if:{primary:"\u0435\u0441\u043B\u0438",normalized:"if"},when:{primary:"\u043A\u043E\u0433\u0434\u0430",normalized:"when"},where:{primary:"\u0433\u0434\u0435",normalized:"where"},else:{primary:"\u0438\u043D\u0430\u0447\u0435",normalized:"else"},repeat:{primary:"\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C",alternatives:["\u043F\u043E\u0432\u0442\u043E\u0440\u0438"],normalized:"repeat",form:"infinitive"},for:{primary:"\u0434\u043B\u044F",alternatives:["\u043A\u0430\u0436\u0434\u044B\u0439"],normalized:"for"},while:{primary:"\u043F\u043E\u043A\u0430",normalized:"while"},continue:{primary:"\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C",alternatives:["\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438"],normalized:"continue",form:"infinitive"},halt:{primary:"\u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C",alternatives:["\u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0441\u044C","\u0441\u0442\u043E\u043F"],normalized:"halt",form:"infinitive"},throw:{primary:"\u0431\u0440\u043E\u0441\u0438\u0442\u044C",alternatives:["\u0431\u0440\u043E\u0441\u044C"],normalized:"throw",form:"infinitive"},call:{primary:"\u0432\u044B\u0437\u0432\u0430\u0442\u044C",alternatives:["\u0432\u044B\u0437\u043E\u0432\u0438"],normalized:"call",form:"infinitive"},return:{primary:"\u0432\u0435\u0440\u043D\u0443\u0442\u044C",alternatives:["\u0432\u0435\u0440\u043D\u0438"],normalized:"return",form:"infinitive"},then:{primary:"\u0437\u0430\u0442\u0435\u043C",alternatives:["\u043F\u043E\u0442\u043E\u043C","\u0442\u043E\u0433\u0434\u0430"],normalized:"then"},and:{primary:"\u0438",normalized:"and"},end:{primary:"\u043A\u043E\u043D\u0435\u0446",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"\u0430\u0441\u0438\u043D\u0445\u0440\u043E\u043D\u043D\u043E",alternatives:["async"],normalized:"async"},tell:{primary:"\u0441\u043A\u0430\u0437\u0430\u0442\u044C",alternatives:["\u0441\u043A\u0430\u0436\u0438"],normalized:"tell",form:"infinitive"},default:{primary:"\u043F\u043E_\u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E",normalized:"default"},init:{primary:"\u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u0443\u0439"],normalized:"init",form:"infinitive"},behavior:{primary:"\u043F\u043E\u0432\u0435\u0434\u0435\u043D\u0438\u0435",normalized:"behavior"},install:{primary:"\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C_\u043F\u0430\u043A\u0435\u0442",normalized:"install",form:"infinitive"},measure:{primary:"\u0438\u0437\u043C\u0435\u0440\u0438\u0442\u044C",alternatives:["\u0438\u0437\u043C\u0435\u0440\u044C"],normalized:"measure",form:"infinitive"},beep:{primary:"\u0437\u0432\u0443\u043A",normalized:"beep"},break:{primary:"\u043F\u0440\u0435\u0440\u0432\u0430\u0442\u044C",normalized:"break"},copy:{primary:"\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C",normalized:"copy"},exit:{primary:"\u0432\u044B\u0439\u0442\u0438",normalized:"exit"},pick:{primary:"\u0432\u044B\u0431\u0440\u0430\u0442\u044C",normalized:"pick"},render:{primary:"\u043E\u0442\u043E\u0431\u0440\u0430\u0437\u0438\u0442\u044C",normalized:"render"},into:{primary:"\u0432",alternatives:["\u0432\u043E"],normalized:"into"},before:{primary:"\u0434\u043E",alternatives:["\u043F\u0435\u0440\u0435\u0434"],normalized:"before"},after:{primary:"\u043F\u043E\u0441\u043B\u0435",normalized:"after"},until:{primary:"\u043F\u043E\u043A\u0430_\u043D\u0435",normalized:"until"},event:{primary:"\u0441\u043E\u0431\u044B\u0442\u0438\u0435",normalized:"event"},from:{primary:"\u0438\u0437",alternatives:["\u043E\u0442","\u0441"],normalized:"from"},connect:{primary:"\u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u044C",alternatives:["\u0441\u043E\u0435\u0434\u0438\u043D\u0438\u0442\u044C","\u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u044C\u0441\u044F"],normalized:"connect"},stream:{primary:"\u0442\u0440\u0430\u043D\u0441\u043B\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u043F\u043E\u0442\u043E\u043A","\u0441\u0442\u0440\u0438\u043C"],normalized:"stream"},live:{primary:"\u0432-\u043F\u0440\u044F\u043C\u043E\u043C-\u044D\u0444\u0438\u0440\u0435",alternatives:["\u043F\u0440\u044F\u043C\u043E\u0439-\u044D\u0444\u0438\u0440","\u0432\u0436\u0438\u0432\u0443\u044E"],normalized:"live"},socket:{primary:"\u0441\u043E\u043A\u0435\u0442",alternatives:["\u0433\u043D\u0435\u0437\u0434\u043E","websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"\u043F\u0440\u0438",normalized:"on"},sourceMarker:{primary:"\u043D\u0430",alternatives:["\u0432","\u043F\u0440\u0438"],position:"before"},eventMarker:{primary:"\u043F\u0440\u0438",position:"before"},temporalMarkers:["\u043A\u043E\u0433\u0434\u0430","\u0435\u0441\u043B\u0438"]}},Na=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],_a=class{constructor(r=Na){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},Oa="()[]{},:;",Ma=class{constructor(r=Oa){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function Ia(r,e){let t=r[e];if(t==="#"){let i=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);return i?i[0]:null}if(t==="."){let i=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return i?i[0]:null}if(t==="["){let i=0,a=e;for(;a<r.length;){if(r[a]==="["&&i++,r[a]==="]"&&(i--,i===0))return r.slice(e,a+1);a++;}return null}if(t==="<"){let i=r.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return i?i[0]:null}return null}var ja=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"}extract(r,e){let t=Ia(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},La=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let i=t[0],a=i.slice(1).split("(")[0],u=t[1];return {value:i,length:i.length,metadata:{modifierName:a,value:u?a==="queue"?u:parseInt(u,10):void 0}}}};function $a(r,e){let t=r.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let i=t.match(/^https?:\/\/[^\s]*/);return i?i[0]:null}if(t.startsWith("//")){let i=t.match(/^\/\/[^\s]*/);return i?i[0]:null}if(t.startsWith("./")||t.startsWith("../")){let i=t.match(/^\.\.?\/[^\s]*/);return i?i[0]:null}if(t.startsWith("/")){let i=t.match(/^\/[^\s]*/);return i?i[0]:null}return null}var Va=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=$a(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},qa=class{constructor(){this.name="variable-ref";}canExtract(r,e){return r[e]===":"&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function Wa(r){return {isLetter:i=>r.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||r.test(i)}}var Ua=class{constructor(r,e,t){this.name=r;let i=Wa(e);this.isLetter=i.isLetter,this.isIdentifierChar=i.isIdentifierChar,this.prepositions=t;}setContext(r){this.context=r;}canExtract(r,e){return this.isLetter(r[e])}extract(r,e){if(!this.context)throw new Error(`${this.name}: context not set`);let t=e,i="";for(;t<r.length&&this.isIdentifierChar(r[t]);)i+=r[t++];if(!i)return null;let a=i.toLowerCase(),u=this.prepositions.has(a),n=this.context.lookupKeyword(a),o=n&&n.normalized!==n.native?n.normalized:void 0,s;if(!n&&this.context.normalizer){let l=this.context.normalizer.normalize(i);if(l.stem!==i&&l.confidence>=.7){let m=this.context.lookupKeyword(l.stem);m&&(s=m.normalized);}}return {value:i,length:t-e,metadata:{normalized:o||s,isPreposition:u}}}},Ka=new Set(["\u0432","\u0432\u043E","\u043D\u0430","\u0441","\u0441\u043E","\u043A","\u043A\u043E","\u043E","\u043E\u0431","\u043E\u0431\u043E","\u0443","\u043E\u0442","\u0434\u043E","\u0438\u0437","\u0437\u0430","\u043F\u043E","\u043F\u043E\u0434","\u043D\u0430\u0434","\u043F\u0435\u0440\u0435\u0434","\u043F\u0435\u0440\u0435\u0434\u043E","\u043C\u0435\u0436\u0434\u0443","\u0447\u0435\u0440\u0435\u0437","\u0431\u0435\u0437","\u0434\u043B\u044F","\u043F\u0440\u0438","\u043F\u0440\u043E","\u043F\u043E\u0441\u043B\u0435","\u0432\u043E\u043A\u0440\u0443\u0433","\u043F\u0440\u043E\u0442\u0438\u0432","\u0432\u043C\u0435\u0441\u0442\u043E","\u043A\u0440\u043E\u043C\u0435","\u0441\u0440\u0435\u0434\u0438"]);function Ga(){return [new Ua("russian-keyword",/[a-zA-Zа-яА-ЯёЁ]/,Ka)]}function Ha(r){let e=r.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function Ya(r){let e=r.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}var Ja=class{constructor(){this.name="ascii-identifier";}setContext(r){this.context=r;}canExtract(r,e){return Ha(r[e])}extract(r,e){if(!this.context)throw new Error("AsciiIdentifierExtractor: context not set");let t=e,i="",a=e;for(;a<r.length&&Ya(r[a]);)i+=r[a],a++;if(!i)return null;let u=this.context.lookupKeyword(i),n=u&&u.normalized!==u.native?u.normalized:void 0;return {value:i,length:a-t,metadata:{normalized:n}}}};function Xa(){return [new Va,new La,new qa,new ja]}var Za=new Set(["\u0432","\u0432\u043E","\u043D\u0430","\u0441","\u0441\u043E","\u043A","\u043A\u043E","\u043E","\u043E\u0431","\u043E\u0431\u043E","\u0443","\u043E\u0442","\u0434\u043E","\u0438\u0437","\u0437\u0430","\u043F\u043E","\u043F\u043E\u0434","\u043D\u0430\u0434","\u043F\u0435\u0440\u0435\u0434","\u043F\u0435\u0440\u0435\u0434\u043E","\u043C\u0435\u0436\u0434\u0443","\u0447\u0435\u0440\u0435\u0437","\u0431\u0435\u0437","\u0434\u043B\u044F","\u043F\u0440\u0438","\u043F\u0440\u043E","\u043F\u043E\u0441\u043B\u0435","\u0432\u043E\u043A\u0440\u0443\u0433","\u043F\u0440\u043E\u0442\u0438\u0432","\u0432\u043C\u0435\u0441\u0442\u043E","\u043A\u0440\u043E\u043C\u0435","\u0441\u0440\u0435\u0434\u0438"]),Qa=[{native:"\u0438\u0441\u0442\u0438\u043D\u0430",normalized:"true"},{native:"\u043F\u0440\u0430\u0432\u0434\u0430",normalized:"true"},{native:"\u043B\u043E\u0436\u044C",normalized:"false"},{native:"null",normalized:"null"},{native:"\u043D\u0435\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u043E",normalized:"undefined"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434\u0430",normalized:"s"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434\u044B",normalized:"s"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434",normalized:"s"},{native:"\u043C\u0438\u043B\u043B\u0438\u0441\u0435\u043A\u0443\u043D\u0434\u0430",normalized:"ms"},{native:"\u043C\u0438\u043B\u043B\u0438\u0441\u0435\u043A\u0443\u043D\u0434\u044B",normalized:"ms"},{native:"\u043C\u0438\u043B\u043B\u0438\u0441\u0435\u043A\u0443\u043D\u0434",normalized:"ms"},{native:"\u043C\u0438\u043D\u0443\u0442\u0430",normalized:"m"},{native:"\u043C\u0438\u043D\u0443\u0442\u044B",normalized:"m"},{native:"\u043C\u0438\u043D\u0443\u0442",normalized:"m"},{native:"\u0447\u0430\u0441",normalized:"h"},{native:"\u0447\u0430\u0441\u0430",normalized:"h"},{native:"\u0447\u0430\u0441\u043E\u0432",normalized:"h"},{native:"\u043F\u0435\u0440\u0432\u0430\u044F",normalized:"first"},{native:"\u043F\u0435\u0440\u0432\u043E\u0435",normalized:"first"},{native:"\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u044F\u044F",normalized:"last"},{native:"\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u0435",normalized:"last"},{native:"\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0430\u044F",normalized:"next"},{native:"\u043F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0430\u044F",normalized:"previous"},{native:"\u043F\u0443\u0441\u0442\u0430\u044F",normalized:"empty"},{native:"\u043F\u0443\u0441\u0442\u043E\u0435",normalized:"empty"},{native:"\u043C\u043E\u044F",normalized:"my"},{native:"\u043C\u043E\u0451",normalized:"my"},{native:"\u043C\u043E\u0438",normalized:"my"}],eu=class extends K{constructor(){super(),this.language="ru",this.direction="ltr",this.initializeKeywordsFromProfile(hr,Qa),this.setNormalizer(new fr),this.registerExtractors([...Xa(),...Ga(),new W,new U,new Ja,new _a,new Ma]);}classifyToken(r){let e=r.toLowerCase();return Za.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":"identifier"}},ru=new eu;J("ru",ru,hr);var Er={code:"pl",name:"Polish",nativeName:"Polski",direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"imperative",verb:{position:"start",subjectDrop:true,suffixes:["a\u0107","e\u0107","i\u0107","y\u0107","\u0105\u0107","owa\u0107"]},references:{me:"ja",it:"to",you:"ty",result:"wynik",event:"zdarzenie",target:"cel",body:"body"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:true,specialForms:{me:"m\xF3j",it:"jego",you:"tw\xF3j"},keywords:{m\u00F3j:"me",moja:"me",moje:"me",tw\u00F3j:"you",twoja:"you",twoje:"you",jego:"it",jej:"it"}},roleMarkers:{destination:{primary:"do",alternatives:["w","na"],position:"before"},source:{primary:"z",alternatives:["od","ze"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"z",alternatives:["ze"],position:"before"}},keywords:{toggle:{primary:"prze\u0142\u0105cz",alternatives:["przelacz"],normalized:"toggle",form:"imperative"},add:{primary:"dodaj",normalized:"add",form:"imperative"},remove:{primary:"usu\u0144",alternatives:["usun","wyczy\u015B\u0107","wyczysc"],normalized:"remove",form:"imperative"},put:{primary:"umie\u015B\u0107",alternatives:["umiesc","wstaw"],normalized:"put",form:"imperative"},append:{primary:"do\u0142\u0105cz",alternatives:["dolacz"],normalized:"append",form:"imperative"},prepend:{primary:"poprzed\u017A",alternatives:["poprzedz"],normalized:"prepend",form:"imperative"},take:{primary:"we\u017A",alternatives:["wez"],normalized:"take",form:"imperative"},make:{primary:"utw\xF3rz",alternatives:["utworz","stw\xF3rz","stworz"],normalized:"make",form:"imperative"},clone:{primary:"sklonuj",normalized:"clone",form:"imperative"},swap:{primary:"zamie\u0144",alternatives:["zamien"],normalized:"swap",form:"imperative"},morph:{primary:"przekszta\u0142\u0107",alternatives:["przeksztalc"],normalized:"morph",form:"imperative"},set:{primary:"ustaw",alternatives:["okre\u015Bl","okresl"],normalized:"set",form:"imperative"},get:{primary:"uzyskaj",normalized:"get",form:"imperative"},increment:{primary:"zwi\u0119ksz",alternatives:["zwieksz"],normalized:"increment",form:"imperative"},decrement:{primary:"zmniejsz",normalized:"decrement",form:"imperative"},log:{primary:"loguj",alternatives:["wypisz"],normalized:"log",form:"imperative"},show:{primary:"poka\u017C",alternatives:["pokaz","wy\u015Bwietl","wyswietl"],normalized:"show",form:"imperative"},hide:{primary:"ukryj",alternatives:["schowaj"],normalized:"hide",form:"imperative"},transition:{primary:"animuj",alternatives:["przej\u015Bcie","przejscie"],normalized:"transition",form:"imperative"},on:{primary:"gdy",alternatives:["przy","na"],normalized:"on"},trigger:{primary:"wyzw\xF3l",alternatives:["wyzwol"],normalized:"trigger",form:"imperative"},send:{primary:"wy\u015Blij",alternatives:["wyslij"],normalized:"send",form:"imperative"},focus:{primary:"skup",alternatives:["skupienie"],normalized:"focus",form:"imperative"},blur:{primary:"rozmyj",alternatives:["odskup"],normalized:"blur",form:"imperative"},empty:{primary:"opr\xF3\u017Cnij",alternatives:["oproznij"],normalized:"empty"},open:{primary:"otw\xF3rz",alternatives:["otworz"],normalized:"open"},close:{primary:"zamknij",normalized:"close"},select:{primary:"zaznacz",normalized:"select"},clear:{primary:"zeruj",normalized:"clear"},reset:{primary:"zresetuj",normalized:"reset"},breakpoint:{primary:"punkt-przerwania",normalized:"breakpoint"},go:{primary:"id\u017A",alternatives:["idz","przejd\u017A","przejdz","nawiguj"],normalized:"go",form:"imperative"},scroll:{primary:"przewi\u0144",alternatives:["przewin"],normalized:"scroll",form:"imperative"},push:{primary:"wepchnij",alternatives:["push"],normalized:"push",form:"imperative"},replace:{primary:"nadpisz",alternatives:["zamie\u0144_url","zamien_url"],normalized:"replace",form:"imperative"},process:{primary:"przetw\xF3rz",alternatives:["przetworz"],normalized:"process",form:"imperative"},wait:{primary:"czekaj",alternatives:["poczekaj"],normalized:"wait",form:"imperative"},fetch:{primary:"pobierz",alternatives:["za\u0142aduj","zaladuj"],normalized:"fetch",form:"imperative"},settle:{primary:"ustabilizuj",normalized:"settle",form:"imperative"},if:{primary:"je\u015Bli",alternatives:["jesli","je\u017Celi","jezeli"],normalized:"if"},when:{primary:"kiedy",normalized:"when"},where:{primary:"gdzie",normalized:"where"},else:{primary:"inaczej",alternatives:["wpp"],normalized:"else"},repeat:{primary:"powt\xF3rz",alternatives:["powtorz"],normalized:"repeat",form:"imperative"},for:{primary:"dla",alternatives:["ka\u017Cdy","kazdy"],normalized:"for"},while:{primary:"dop\xF3ki",alternatives:["dopoki","podczas"],normalized:"while"},continue:{primary:"kontynuuj",alternatives:["dalej"],normalized:"continue",form:"imperative"},halt:{primary:"zatrzymaj",alternatives:["stop"],normalized:"halt",form:"imperative"},throw:{primary:"rzu\u0107",alternatives:["rzuc"],normalized:"throw",form:"imperative"},call:{primary:"wywo\u0142aj",alternatives:["wywolaj"],normalized:"call",form:"imperative"},return:{primary:"zwr\xF3\u0107",alternatives:["zwroc"],normalized:"return",form:"imperative"},then:{primary:"wtedy",alternatives:["potem","nast\u0119pnie","nastepnie"],normalized:"then"},and:{primary:"i",alternatives:["oraz"],normalized:"and"},end:{primary:"koniec",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"async",alternatives:["asynchronicznie"],normalized:"async"},tell:{primary:"powiedz",normalized:"tell",form:"imperative"},default:{primary:"domy\u015Blnie",alternatives:["domyslnie"],normalized:"default"},init:{primary:"inicjuj",normalized:"init",form:"imperative"},behavior:{primary:"zachowanie",normalized:"behavior"},install:{primary:"zainstaluj",normalized:"install",form:"imperative"},measure:{primary:"zmierz",normalized:"measure",form:"imperative"},beep:{primary:"sygna\u0142",normalized:"beep"},break:{primary:"przerwij",normalized:"break"},copy:{primary:"kopiuj",normalized:"copy"},exit:{primary:"wyjd\u017A",normalized:"exit"},pick:{primary:"wybierz",normalized:"pick"},render:{primary:"renderuj",normalized:"render"},into:{primary:"do",alternatives:["w"],normalized:"into"},before:{primary:"przed",normalized:"before"},after:{primary:"po",normalized:"after"},click:{primary:"klikni\u0119ciu",alternatives:["klikniecie","klik"],normalized:"click"},hover:{primary:"najechaniu",alternatives:["hover"],normalized:"hover"},submit:{primary:"wys\u0142aniu",alternatives:["wyslaniu","submit"],normalized:"submit"},input:{primary:"wprowadzeniu",alternatives:["input"],normalized:"input"},change:{primary:"zmianie",alternatives:["zmiana"],normalized:"change"},until:{primary:"a\u017C",alternatives:["az"],normalized:"until"},event:{primary:"zdarzenie",normalized:"event"},from:{primary:"z",alternatives:["od","ze"],normalized:"from"},connect:{primary:"po\u0142\u0105cz",alternatives:["pod\u0142\u0105cz"],normalized:"connect"},stream:{primary:"transmituj",alternatives:["strumie\u0144","streamuj"],normalized:"stream"},live:{primary:"na-\u017Cywo",alternatives:["na-bie\u017C\u0105co","live"],normalized:"live"},socket:{primary:"gniazdo",alternatives:["socket","websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"gdy",alternatives:["przy","na"],normalized:"on"},sourceMarker:{primary:"na",alternatives:["w","przy"],position:"before"},conditionalKeyword:{primary:"kiedy",alternatives:["gdy","je\u015Bli"]},eventMarker:{primary:"przy",alternatives:["na"],position:"before"},temporalMarkers:["kiedy","gdy","przy"]}},vr=new Map([["prze\u0142\u0105cz","prze\u0142\u0105cza\u0107"],["przelacz","przelaczac"],["dodaj","dodawa\u0107"],["usu\u0144","usuwa\u0107"],["usun","usuwac"],["umie\u015B\u0107","umieszcza\u0107"],["umiesc","umieszczac"],["wstaw","wstawia\u0107"],["ustaw","ustawia\u0107"],["pobierz","pobiera\u0107"],["we\u017A","bra\u0107"],["wez","brac"],["zwi\u0119ksz","zwi\u0119ksza\u0107"],["zwieksz","zwiekszac"],["zmniejsz","zmniejsza\u0107"],["poka\u017C","pokazywa\u0107"],["pokaz","pokazywac"],["ukryj","ukrywa\u0107"],["schowaj","schowywa\u0107"],["czekaj","czeka\u0107"],["poczekaj","poczeka\u0107"],["id\u017A","i\u015B\u0107"],["idz","isc"],["przejd\u017A","przej\u015B\u0107"],["przejdz","przejsc"],["wywo\u0142aj","wywo\u0142ywa\u0107"],["wywolaj","wywolywac"],["wy\u015Blij","wysy\u0142a\u0107"],["wyslij","wysylac"],["loguj","logowa\u0107"],["wypisz","wypisywa\u0107"],["sklonuj","sklonowa\u0107"],["kopiuj","kopiowa\u0107"],["zamie\u0144","zamienia\u0107"],["zamien","zamieniac"],["utw\xF3rz","tworzy\u0107"],["utworz","tworzyc"],["stw\xF3rz","stwarza\u0107"],["stworz","stwarzac"],["skup","skupia\u0107"],["rozmyj","rozmywa\u0107"],["nawiguj","nawigowa\u0107"],["za\u0142aduj","\u0142adowa\u0107"],["zaladuj","ladowac"],["powt\xF3rz","powtarza\u0107"],["powtorz","powtarzac"],["kontynuuj","kontynuowa\u0107"],["zatrzymaj","zatrzymywa\u0107"],["przerwij","przerywa\u0107"],["rzu\u0107","rzuca\u0107"],["rzuc","rzucac"],["zwr\xF3\u0107","zwraca\u0107"],["zwroc","zwracac"],["inicjuj","inicjowa\u0107"],["zainstaluj","instalowa\u0107"],["zmierz","mierzy\u0107"]]),gr=class{constructor(){this.language="pl";}isNormalizable(r){return r.length<3?false:/[a-zA-ZąęćńóśźżłĄĘĆŃÓŚŹŻŁ]/.test(r)}normalize(r){let e=r.toLowerCase();if(this.isInfinitive(e))return w(e);let t=this.tryImperativeNormalization(e);if(t)return t;let i=this.tryPastTenseNormalization(e);if(i)return i;let a=this.tryPresentTenseNormalization(e);return a||w(e)}isInfinitive(r){return ["a\u0107","e\u0107","i\u0107","y\u0107","\u0105\u0107","owa\u0107","iwa\u0107","ywa\u0107"].some(t=>r.endsWith(t))}tryImperativeNormalization(r){return vr.has(r)?y(vr.get(r),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):r.endsWith("aj")?y(r.slice(0,-2)+"a\u0107",.8,{removedSuffixes:["aj"],conjugationType:"imperative"}):r.endsWith("uj")?y(r.slice(0,-2)+"owa\u0107",.8,{removedSuffixes:["uj"],conjugationType:"imperative"}):r.endsWith("ij")?y(r.slice(0,-2)+"i\u0107",.75,{removedSuffixes:["ij"],conjugationType:"imperative"}):null}tryPresentTenseNormalization(r){return r.endsWith("uj\u0119")||r.endsWith("uje")?y(r.slice(0,-3)+"owa\u0107",.85,{removedSuffixes:["uj\u0119"],conjugationType:"present"}):r.endsWith("am")&&r.length>3?y(r.slice(0,-2)+"a\u0107",.8,{removedSuffixes:["am"],conjugationType:"present"}):r.endsWith("em")&&r.length>3?y(r.slice(0,-2)+"e\u0107",.75,{removedSuffixes:["em"],conjugationType:"present"}):r.endsWith("\u0119")&&r.length>2?y(r.slice(0,-1)+"a\u0107",.7,{removedSuffixes:["\u0119"],conjugationType:"present"}):null}tryPastTenseNormalization(r){if(r.endsWith("a\u0142em")||r.endsWith("a\u0142am"))return y(r.slice(0,-4)+"a\u0107",.85,{removedSuffixes:[r.slice(-4)],conjugationType:"past"});if(r.endsWith("a\u0142")||r.endsWith("a\u0142a")){let e=r.endsWith("a\u0142a")?3:2;return y(r.slice(0,-e)+"a\u0107",.8,{removedSuffixes:[r.slice(-e)],conjugationType:"past"})}if(r.endsWith("i\u0142em")||r.endsWith("i\u0142am")||r.endsWith("ilem")||r.endsWith("ilam"))return y(r.slice(0,-4)+"i\u0107",.85,{removedSuffixes:[r.slice(-4)],conjugationType:"past"});if(r.endsWith("i\u0142")||r.endsWith("i\u0142a")||r.endsWith("il")||r.endsWith("ila")){let e=r.endsWith("i\u0142a")||r.endsWith("ila")?3:2;return y(r.slice(0,-e)+"i\u0107",.8,{removedSuffixes:[r.slice(-e)],conjugationType:"past"})}return null}},tu=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],iu=class{constructor(r=tu){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},au="()[]{},:;",uu=class{constructor(r=au){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function nu(r,e){let t=r[e];if(t==="#"){let i=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);return i?i[0]:null}if(t==="."){let i=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return i?i[0]:null}if(t==="["){let i=0,a=e;for(;a<r.length;){if(r[a]==="["&&i++,r[a]==="]"&&(i--,i===0))return r.slice(e,a+1);a++;}return null}if(t==="<"){let i=r.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return i?i[0]:null}return null}var ou=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"}extract(r,e){let t=nu(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},su=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let i=t[0],a=i.slice(1).split("(")[0],u=t[1];return {value:i,length:i.length,metadata:{modifierName:a,value:u?a==="queue"?u:parseInt(u,10):void 0}}}};function lu(r,e){let t=r.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let i=t.match(/^https?:\/\/[^\s]*/);return i?i[0]:null}if(t.startsWith("//")){let i=t.match(/^\/\/[^\s]*/);return i?i[0]:null}if(t.startsWith("./")||t.startsWith("../")){let i=t.match(/^\.\.?\/[^\s]*/);return i?i[0]:null}if(t.startsWith("/")){let i=t.match(/^\/[^\s]*/);return i?i[0]:null}return null}var mu=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=lu(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},cu=class{constructor(){this.name="variable-ref";}canExtract(r,e){return r[e]===":"&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}},pu=new Set(["do","od","z","ze","w","we","na","po","pod","przed","za","nad","mi\u0119dzy","miedzy","przez","dla","bez","o","przy","u","wed\u0142ug","wedlug","mimo","w\u015Br\xF3d","wsrod","obok","poza","wok\xF3\u0142","wokol","przeciw","ku"]);function du(){let r=/[a-zA-ZąęćńóśźżłĄĘĆŃÓŚŹŻŁ]/;return {isLetter:i=>r.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||r.test(i)}}var{isLetter:yu,isIdentifierChar:fu}=du(),hu=class{constructor(){this.name="polish-keyword";}setContext(r){this.context=r;}canExtract(r,e){return yu(r[e])}extract(r,e){if(!this.context)throw new Error("PolishKeywordExtractor: context not set");let t=e,i="";for(;t<r.length&&fu(r[t]);)i+=r[t++];if(!i)return null;let a=i.toLowerCase(),u=pu.has(a),n=this.context.lookupKeyword(a),o=n&&n.normalized!==n.native?n.normalized:void 0,s;if(!n&&this.context.normalizer){let l=this.context.normalizer.normalize(i);if(l.stem!==i&&l.confidence>=.7){let m=this.context.lookupKeyword(l.stem);m&&(s=m.normalized);}}return {value:i,length:t-e,metadata:{normalized:o||s,isPreposition:u}}}};function vu(){return [new hu]}function Eu(){return [new mu,new su,new cu,new ou]}var gu=new Set(["do","od","z","ze","w","we","na","po","pod","przed","za","nad","mi\u0119dzy","miedzy","przez","dla","bez","o","przy","u","wed\u0142ug","wedlug","mimo","w\u015Br\xF3d","wsrod","obok","poza","wok\xF3\u0142","wokol","przeciw","ku"]),zu=[{native:"prawda",normalized:"true"},{native:"fa\u0142sz",normalized:"false"},{native:"falsz",normalized:"false"},{native:"null",normalized:"null"},{native:"nieokre\u015Blony",normalized:"undefined"},{native:"nieokreslony",normalized:"undefined"},{native:"pierwszy",normalized:"first"},{native:"pierwsza",normalized:"first"},{native:"pierwsze",normalized:"first"},{native:"ostatni",normalized:"last"},{native:"ostatnia",normalized:"last"},{native:"ostatnie",normalized:"last"},{native:"nast\u0119pny",normalized:"next"},{native:"nastepny",normalized:"next"},{native:"poprzedni",normalized:"previous"},{native:"najbli\u017Cszy",normalized:"closest"},{native:"najblizszy",normalized:"closest"},{native:"rodzic",normalized:"parent"},{native:"klikni\u0119cie",normalized:"click"},{native:"klikniecie",normalized:"click"},{native:"klik",normalized:"click"},{native:"click",normalized:"click"},{native:"zmiana",normalized:"change"},{native:"wys\u0142anie",normalized:"submit"},{native:"wyslanie",normalized:"submit"},{native:"naci\u015Bni\u0119cie",normalized:"keydown"},{native:"nacisniecie",normalized:"keydown"},{native:"klawisz",normalized:"keydown"},{native:"najechanie",normalized:"mouseover"},{native:"zjechanie",normalized:"mouseout"},{native:"rozmycie",normalized:"blur"},{native:"za\u0142adowanie",normalized:"load"},{native:"zaladowanie",normalized:"load"},{native:"przewini\u0119cie",normalized:"scroll"},{native:"przewiniecie",normalized:"scroll"},{native:"input",normalized:"input"},{native:"m\xF3j",normalized:"my"},{native:"moj",normalized:"my"},{native:"sekunda",normalized:"s"},{native:"sekundy",normalized:"s"},{native:"sekund",normalized:"s"},{native:"milisekunda",normalized:"ms"},{native:"milisekundy",normalized:"ms"},{native:"milisekund",normalized:"ms"},{native:"minuta",normalized:"m"},{native:"minuty",normalized:"m"},{native:"minut",normalized:"m"},{native:"godzina",normalized:"h"},{native:"godziny",normalized:"h"},{native:"godzin",normalized:"h"},{native:"po\u0142\xF3\u017C",normalized:"put"},{native:"poloz",normalized:"put"},{native:"lub",normalized:"or"},{native:"nie",normalized:"not"},{native:"jest",normalized:"is"},{native:"istnieje",normalized:"exists"},{native:"pusty",normalized:"empty"},{native:"puste",normalized:"empty"}],ku=class extends K{constructor(){super(),this.language="pl",this.direction="ltr",this.initializeKeywordsFromProfile(Er,zu),this.setNormalizer(new gr),this.registerExtractors(Eu()),this.registerExtractor(new W),this.registerExtractor(new U),this.registerExtractors(vu()),this.registerExtractor(new iu),this.registerExtractor(new uu);}classifyToken(r){let e=r.toLowerCase();return gu.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(r)?"operator":"identifier"}},Cu=new ku;J("pl",Cu,Er);function bu(r){return /[а-яА-ЯіІїЇєЄґҐьЬ']/.test(r)}var zr=new Map([["\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0438","\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0443\u0442\u0438"],["\u0434\u043E\u0434\u0430\u0439","\u0434\u043E\u0434\u0430\u0442\u0438"],["\u0432\u0438\u0434\u0430\u043B\u0438","\u0432\u0438\u0434\u0430\u043B\u0438\u0442\u0438"],["\u043F\u0440\u0438\u0431\u0435\u0440\u0438","\u043F\u0440\u0438\u0431\u0440\u0430\u0442\u0438"],["\u043F\u043E\u043A\u043B\u0430\u0434\u0438","\u043F\u043E\u043A\u043B\u0430\u0441\u0442\u0438"],["\u043F\u043E\u043C\u0456\u0441\u0442\u0438","\u043F\u043E\u043C\u0456\u0441\u0442\u0438\u0442\u0438"],["\u0432\u0441\u0442\u0430\u0432","\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u0438"],["\u0432\u0456\u0437\u044C\u043C\u0438","\u0432\u0437\u044F\u0442\u0438"],["\u0441\u0442\u0432\u043E\u0440\u0438","\u0441\u0442\u0432\u043E\u0440\u0438\u0442\u0438"],["\u043A\u043B\u043E\u043D\u0443\u0439","\u043A\u043B\u043E\u043D\u0443\u0432\u0430\u0442\u0438"],["\u043F\u043E\u043C\u0456\u043D\u044F\u0439","\u043F\u043E\u043C\u0456\u043D\u044F\u0442\u0438"],["\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0443\u0439","\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0443\u0432\u0430\u0442\u0438"],["\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438","\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0438"],["\u0437\u0430\u0434\u0430\u0439","\u0437\u0430\u0434\u0430\u0442\u0438"],["\u043E\u0442\u0440\u0438\u043C\u0430\u0439","\u043E\u0442\u0440\u0438\u043C\u0430\u0442\u0438"],["\u0437\u0431\u0456\u043B\u044C\u0448","\u0437\u0431\u0456\u043B\u044C\u0448\u0438\u0442\u0438"],["\u0437\u043C\u0435\u043D\u0448","\u0437\u043C\u0435\u043D\u0448\u0438\u0442\u0438"],["\u0437\u0430\u043F\u0438\u0448\u0438","\u0437\u0430\u043F\u0438\u0441\u0430\u0442\u0438"],["\u043F\u043E\u043A\u0430\u0436\u0438","\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u0438"],["\u0441\u0445\u043E\u0432\u0430\u0439","\u0441\u0445\u043E\u0432\u0430\u0442\u0438"],["\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u0439","\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u0442\u0438"],["\u0430\u043D\u0456\u043C\u0443\u0439","\u0430\u043D\u0456\u043C\u0443\u0432\u0430\u0442\u0438"],["\u0432\u0438\u043A\u043B\u0438\u0447","\u0432\u0438\u043A\u043B\u0438\u043A\u0430\u0442\u0438"],["\u043D\u0430\u0434\u0456\u0448\u043B\u0438","\u043D\u0430\u0434\u0456\u0441\u043B\u0430\u0442\u0438"],["\u0441\u0444\u043E\u043A\u0443\u0441\u0443\u0439","\u0441\u0444\u043E\u043A\u0443\u0441\u0443\u0432\u0430\u0442\u0438"],["\u0440\u043E\u0437\u0444\u043E\u043A\u0443\u0441\u0443\u0439","\u0440\u043E\u0437\u0444\u043E\u043A\u0443\u0441\u0443\u0432\u0430\u0442\u0438"],["\u043F\u0435\u0440\u0435\u0439\u0434\u0438","\u043F\u0435\u0440\u0435\u0439\u0442\u0438"],["\u0439\u0434\u0438","\u0439\u0442\u0438"],["\u0447\u0435\u043A\u0430\u0439","\u0447\u0435\u043A\u0430\u0442\u0438"],["\u0437\u0430\u0447\u0435\u043A\u0430\u0439","\u0437\u0430\u0447\u0435\u043A\u0430\u0442\u0438"],["\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436","\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438"],["\u043F\u043E\u0432\u0442\u043E\u0440\u0438","\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0438"],["\u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0443\u0439","\u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0438\u0442\u0438"],["\u043A\u0438\u043D\u044C","\u043A\u0438\u043D\u0443\u0442\u0438"],["\u043F\u043E\u0432\u0435\u0440\u043D\u0438","\u043F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u0438"],["\u0441\u043A\u0430\u0436\u0438","\u0441\u043A\u0430\u0437\u0430\u0442\u0438"],["\u0456\u043D\u0456\u0446\u0456\u0430\u043B\u0456\u0437\u0443\u0439","\u0456\u043D\u0456\u0446\u0456\u0430\u043B\u0456\u0437\u0443\u0432\u0430\u0442\u0438"],["\u0432\u0438\u043C\u0456\u0440\u044F\u0439","\u0432\u0438\u043C\u0456\u0440\u044F\u0442\u0438"]]),kr=class{constructor(){this.language="uk";}isNormalizable(r){return r.length<3?false:bu(r)}normalize(r){let e=r.toLowerCase();if(e.endsWith("\u0441\u044F")||e.endsWith("\u0441\u044C")){let n=this.tryReflexiveNormalization(e);if(n)return n}if(e.endsWith("\u0442\u0438")||e.endsWith("\u0447\u0438"))return w(r);let t=this.tryImperativeLookup(e);if(t)return t;let i=this.tryPastTenseNormalization(e);if(i)return i;let a=this.tryPresentTenseNormalization(e);if(a)return a;let u=this.tryGenericImperativeNormalization(e);return u||w(r)}tryReflexiveNormalization(r){let e=r.slice(0,-2);if(r.endsWith("\u0442\u0438\u0441\u044F")||r.endsWith("\u0447\u0438\u0441\u044F"))return w(r);let t=this.normalizeNonReflexive(e);if(t.confidence<1){let i=t.stem.endsWith("\u0442\u0438")?t.stem.slice(0,-2)+"\u0442\u0438\u0441\u044F":t.stem+"\u0441\u044F";return y(i,t.confidence*.95,{removedSuffixes:["\u0441\u044F",...t.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}normalizeNonReflexive(r){if(r.endsWith("\u0442\u0438")||r.endsWith("\u0447\u0438"))return w(r);let e=this.tryImperativeLookup(r);if(e)return e;let t=this.tryPastTenseNormalization(r);if(t)return t;let i=this.tryPresentTenseNormalization(r);if(i)return i;let a=this.tryGenericImperativeNormalization(r);return a||w(r)}tryImperativeLookup(r){return zr.has(r)?y(zr.get(r),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(r){return r.endsWith("\u0439\u0442\u0435")&&r.length>5?y(r.slice(0,-3)+"\u0442\u0438",.8,{removedSuffixes:["\u0439\u0442\u0435"],conjugationType:"imperative"}):r.endsWith("\u0456\u0442\u044C")&&r.length>5?y(r.slice(0,-3)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0456\u0442\u044C"],conjugationType:"imperative"}):r.endsWith("\u0439")&&r.length>3?y(r.slice(0,-1)+"\u0442\u0438",.75,{removedSuffixes:["\u0439"],conjugationType:"imperative"}):r.endsWith("\u0438")&&r.length>3?y(r+"\u0442\u0438",.7,{removedSuffixes:["\u0438\u2192\u0438\u0442\u0438"],conjugationType:"imperative"}):null}tryPastTenseNormalization(r){return r.endsWith("\u0430\u043B\u0430")&&r.length>4?y(r.slice(0,-3)+"\u0430\u0442\u0438",.85,{removedSuffixes:["\u0430\u043B\u0430"],conjugationType:"past"}):r.endsWith("\u0438\u043B\u0430")&&r.length>4?y(r.slice(0,-3)+"\u0438\u0442\u0438",.85,{removedSuffixes:["\u0438\u043B\u0430"],conjugationType:"past"}):r.endsWith("\u0430\u043B\u0438")&&r.length>4?y(r.slice(0,-3)+"\u0430\u0442\u0438",.85,{removedSuffixes:["\u0430\u043B\u0438"],conjugationType:"past"}):r.endsWith("\u0438\u043B\u0438")&&r.length>4?y(r.slice(0,-3)+"\u0438\u0442\u0438",.85,{removedSuffixes:["\u0438\u043B\u0438"],conjugationType:"past"}):r.endsWith("\u0430\u0432")&&r.length>3?y(r.slice(0,-2)+"\u0430\u0442\u0438",.82,{removedSuffixes:["\u0430\u0432"],conjugationType:"past"}):r.endsWith("\u0438\u0432")&&r.length>3?y(r.slice(0,-2)+"\u0438\u0442\u0438",.82,{removedSuffixes:["\u0438\u0432"],conjugationType:"past"}):null}tryPresentTenseNormalization(r){return r.endsWith("\u0438\u0448")&&r.length>3?y(r.slice(0,-2)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0438\u0448"],conjugationType:"present"}):r.endsWith("\u0438\u0442\u044C")&&r.length>4?y(r.slice(0,-3)+"\u0438\u0442\u0438",.78,{removedSuffixes:["\u0438\u0442\u044C"],conjugationType:"present"}):r.endsWith("\u0438\u043C\u043E")&&r.length>4?y(r.slice(0,-3)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0438\u043C\u043E"],conjugationType:"present"}):r.endsWith("\u044F\u0442\u044C")&&r.length>4?y(r.slice(0,-3)+"\u0438\u0442\u0438",.78,{removedSuffixes:["\u044F\u0442\u044C"],conjugationType:"present"}):r.endsWith("\u0454\u0448")&&r.length>3?y(r.slice(0,-2)+"\u0430\u0442\u0438",.78,{removedSuffixes:["\u0454\u0448"],conjugationType:"present"}):r.endsWith("\u0435\u0448")&&r.length>3?y(r.slice(0,-2)+"\u0430\u0442\u0438",.75,{removedSuffixes:["\u0435\u0448"],conjugationType:"present"}):r.endsWith("\u0454")&&r.length>2?y(r.slice(0,-1)+"\u0430\u0442\u0438",.72,{removedSuffixes:["\u0454"],conjugationType:"present"}):r.endsWith("\u0454\u043C\u043E")&&r.length>4?y(r.slice(0,-3)+"\u0430\u0442\u0438",.8,{removedSuffixes:["\u0454\u043C\u043E"],conjugationType:"present"}):r.endsWith("\u044E\u0442\u044C")&&r.length>4?y(r.slice(0,-3)+"\u0430\u0442\u0438",.78,{removedSuffixes:["\u044E\u0442\u044C"],conjugationType:"present"}):r.endsWith("\u0443\u0442\u044C")&&r.length>4?y(r.slice(0,-3)+"\u0430\u0442\u0438",.75,{removedSuffixes:["\u0443\u0442\u044C"],conjugationType:"present"}):null}},Cr={code:"uk",name:"Ukrainian",nativeName:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430",direction:"ltr",script:"cyrillic",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:true,suffixes:["\u0442\u0438","\u0442\u0438\u0441\u044F","\u0438\u0442\u0438","\u0438\u0442\u0438\u0441\u044F","\u0430\u0442\u0438","\u0430\u0442\u0438\u0441\u044F","\u0456\u0442\u0438","\u0456\u0442\u0438\u0441\u044F"]},references:{me:"\u044F",it:"\u0446\u0435",you:"\u0442\u0438",result:"\u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442",event:"\u043F\u043E\u0434\u0456\u044F",target:"\u0446\u0456\u043B\u044C",body:"body"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:true,specialForms:{me:"\u043C\u0456\u0439",it:"\u0439\u043E\u0433\u043E",you:"\u0442\u0432\u0456\u0439"},keywords:{\u043C\u0456\u0439:"me",\u043C\u043E\u044F:"me",\u043C\u043E\u0454:"me",\u043C\u043E\u0457:"me",\u0442\u0432\u0456\u0439:"you",\u0442\u0432\u043E\u044F:"you",\u0442\u0432\u043E\u0454:"you",\u0442\u0432\u043E\u0457:"you",\u0439\u043E\u0433\u043E:"it",\u0457\u0457:"it"}},roleMarkers:{destination:{primary:"\u0432",alternatives:["\u043D\u0430","\u0434\u043E"],position:"before"},source:{primary:"\u0437",alternatives:["\u0432\u0456\u0434","\u0456\u0437"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"\u0437",alternatives:["\u0456\u0437"],position:"before"}},keywords:{toggle:{primary:"\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0443\u0442\u0438",alternatives:["\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0438"],normalized:"toggle",form:"infinitive"},add:{primary:"\u0434\u043E\u0434\u0430\u0442\u0438",alternatives:["\u0434\u043E\u0434\u0430\u0439"],normalized:"add",form:"infinitive"},remove:{primary:"\u0432\u0438\u0434\u0430\u043B\u0438\u0442\u0438",alternatives:["\u0432\u0438\u0434\u0430\u043B\u0438","\u043F\u0440\u0438\u0431\u0440\u0430\u0442\u0438","\u043F\u0440\u0438\u0431\u0435\u0440\u0438"],normalized:"remove",form:"infinitive"},put:{primary:"\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"],normalized:"put",form:"infinitive"},append:{primary:"\u0434\u043E\u0434\u0430\u0442\u0438_\u0432_\u043A\u0456\u043D\u0435\u0446\u044C",alternatives:["\u0434\u043E\u043F\u0438\u0441\u0430\u0442\u0438"],normalized:"append",form:"infinitive"},prepend:{primary:"\u0434\u043E\u0434\u0430\u0442\u0438_\u043D\u0430_\u043F\u043E\u0447\u0430\u0442\u043E\u043A",normalized:"prepend",form:"infinitive"},take:{primary:"\u0432\u0437\u044F\u0442\u0438",alternatives:["\u0432\u0456\u0437\u044C\u043C\u0438"],normalized:"take",form:"infinitive"},make:{primary:"\u0441\u0442\u0432\u043E\u0440\u0438\u0442\u0438",alternatives:["\u0441\u0442\u0432\u043E\u0440\u0438"],normalized:"make",form:"infinitive"},clone:{primary:"\u043A\u043B\u043E\u043D\u0443\u0432\u0430\u0442\u0438",alternatives:["\u043A\u043B\u043E\u043D\u0443\u0439"],normalized:"clone",form:"infinitive"},swap:{primary:"\u043F\u043E\u043C\u0456\u043D\u044F\u0442\u0438",alternatives:["\u043F\u043E\u043C\u0456\u043D\u044F\u0439"],normalized:"swap",form:"infinitive"},morph:{primary:"\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0443\u0439"],normalized:"morph",form:"infinitive"},set:{primary:"\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0438",alternatives:["\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438","\u0437\u0430\u0434\u0430\u0442\u0438","\u0437\u0430\u0434\u0430\u0439"],normalized:"set",form:"infinitive"},get:{primary:"\u043E\u0442\u0440\u0438\u043C\u0430\u0442\u0438",alternatives:["\u043E\u0442\u0440\u0438\u043C\u0430\u0439"],normalized:"get",form:"infinitive"},increment:{primary:"\u0437\u0431\u0456\u043B\u044C\u0448\u0438\u0442\u0438",alternatives:["\u0437\u0431\u0456\u043B\u044C\u0448"],normalized:"increment",form:"infinitive"},decrement:{primary:"\u0437\u043C\u0435\u043D\u0448\u0438\u0442\u0438",alternatives:["\u0437\u043C\u0435\u043D\u0448"],normalized:"decrement",form:"infinitive"},log:{primary:"\u0437\u0430\u043F\u0438\u0441\u0430\u0442\u0438",alternatives:["\u0437\u0430\u043F\u0438\u0448\u0438"],normalized:"log",form:"infinitive"},show:{primary:"\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u0438",alternatives:["\u043F\u043E\u043A\u0430\u0436\u0438"],normalized:"show",form:"infinitive"},hide:{primary:"\u0441\u0445\u043E\u0432\u0430\u0442\u0438",alternatives:["\u0441\u0445\u043E\u0432\u0430\u0439","\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u0442\u0438","\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u0439"],normalized:"hide",form:"infinitive"},transition:{primary:"\u0430\u043D\u0456\u043C\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0430\u043D\u0456\u043C\u0443\u0439"],normalized:"transition",form:"infinitive"},on:{primary:"\u043F\u0440\u0438",normalized:"on"},trigger:{primary:"\u0456\u043D\u0456\u0446\u0456\u044E\u0432\u0430\u0442\u0438",alternatives:["\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u0438","\u0437\u0430\u043F\u0443\u0441\u0442\u0438"],normalized:"trigger",form:"infinitive"},send:{primary:"\u043D\u0430\u0434\u0456\u0441\u043B\u0430\u0442\u0438",alternatives:["\u043D\u0430\u0434\u0456\u0448\u043B\u0438"],normalized:"send",form:"infinitive"},focus:{primary:"\u0441\u0444\u043E\u043A\u0443\u0441\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0441\u0444\u043E\u043A\u0443\u0441\u0443\u0439","\u0444\u043E\u043A\u0443\u0441"],normalized:"focus",form:"infinitive"},blur:{primary:"\u0440\u043E\u0437\u0444\u043E\u043A\u0443\u0441\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0440\u043E\u0437\u0444\u043E\u043A\u0443\u0441\u0443\u0439"],normalized:"blur",form:"infinitive"},empty:{primary:"\u0441\u043F\u043E\u0440\u043E\u0436\u043D\u0438\u0442\u0438",normalized:"empty"},open:{primary:"\u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438",normalized:"open"},close:{primary:"\u0437\u0430\u043A\u0440\u0438\u0442\u0438",normalized:"close"},select:{primary:"\u0432\u0438\u0434\u0456\u043B\u0438\u0442\u0438",normalized:"select"},clear:{primary:"\u043E\u0447\u0438\u0441\u0442\u0438\u0442\u0438",normalized:"clear"},reset:{primary:"\u0441\u043A\u0438\u043D\u0443\u0442\u0438",normalized:"reset"},breakpoint:{primary:"\u0442\u043E\u0447\u043A\u0430-\u0437\u0443\u043F\u0438\u043D\u043A\u0438",normalized:"breakpoint"},click:{primary:"\u043A\u043B\u0456\u043A\u0443",alternatives:["\u043A\u043B\u0456\u043A","\u043D\u0430\u0442\u0438\u0441\u043A\u0430\u043D\u043D\u0456"],normalized:"click"},hover:{primary:"\u043D\u0430\u0432\u0435\u0434\u0435\u043D\u043D\u0456",alternatives:["\u043D\u0430\u0432\u0435\u0434\u0435\u043D\u043D\u044F"],normalized:"hover"},submit:{primary:"\u0432\u0456\u0434\u043F\u0440\u0430\u0432\u0446\u0456",alternatives:["\u0432\u0456\u0434\u043F\u0440\u0430\u0432\u043A\u0430"],normalized:"submit"},input:{primary:"\u0432\u0432\u0435\u0434\u0435\u043D\u043D\u0456",alternatives:["\u0432\u0432\u0435\u0434\u0435\u043D\u043D\u044F"],normalized:"input"},change:{primary:"\u0437\u043C\u0456\u043D\u0456",alternatives:["\u0437\u043C\u0456\u043D\u0430"],normalized:"change"},go:{primary:"\u043F\u0435\u0440\u0435\u0439\u0442\u0438",alternatives:["\u043F\u0435\u0440\u0435\u0439\u0434\u0438","\u0439\u0442\u0438","\u0439\u0434\u0438"],normalized:"go",form:"infinitive"},scroll:{primary:"\u043F\u0440\u043E\u043A\u0440\u0443\u0442\u0438\u0442\u0438",alternatives:["\u043F\u0440\u043E\u043A\u0440\u0443\u0442\u0438"],normalized:"scroll",form:"infinitive"},push:{primary:"\u0448\u0442\u043E\u0432\u0445\u043D\u0443\u0442\u0438",alternatives:["\u0437\u0430\u0448\u0442\u043E\u0432\u0445\u043D\u0443\u0442\u0438"],normalized:"push",form:"infinitive"},replace:{primary:"\u0437\u0430\u043C\u0456\u043D\u0438\u0442\u0438",alternatives:["\u0437\u0430\u043C\u0456\u043D\u0438"],normalized:"replace",form:"infinitive"},process:{primary:"\u043E\u0431\u0440\u043E\u0431\u0438\u0442\u0438",alternatives:["\u043E\u0431\u0440\u043E\u0431\u043B\u044F\u0442\u0438"],normalized:"process",form:"infinitive"},wait:{primary:"\u0447\u0435\u043A\u0430\u0442\u0438",alternatives:["\u0447\u0435\u043A\u0430\u0439","\u0437\u0430\u0447\u0435\u043A\u0430\u0439"],normalized:"wait",form:"infinitive"},fetch:{primary:"\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438",alternatives:["\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436"],normalized:"fetch",form:"infinitive"},settle:{primary:"\u0441\u0442\u0430\u0431\u0456\u043B\u0456\u0437\u0443\u0432\u0430\u0442\u0438",normalized:"settle",form:"infinitive"},if:{primary:"\u044F\u043A\u0449\u043E",normalized:"if"},when:{primary:"\u043A\u043E\u043B\u0438",normalized:"when"},where:{primary:"\u0434\u0435",normalized:"where"},else:{primary:"\u0456\u043D\u0430\u043A\u0448\u0435",normalized:"else"},repeat:{primary:"\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0438",alternatives:["\u043F\u043E\u0432\u0442\u043E\u0440\u0438"],normalized:"repeat",form:"infinitive"},for:{primary:"\u0434\u043B\u044F",alternatives:["\u043A\u043E\u0436\u043D\u0438\u0439"],normalized:"for"},while:{primary:"\u043F\u043E\u043A\u0438",normalized:"while"},continue:{primary:"\u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0438\u0442\u0438",alternatives:["\u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0443\u0439"],normalized:"continue",form:"infinitive"},halt:{primary:"\u0437\u0443\u043F\u0438\u043D\u0438\u0442\u0438",alternatives:["\u0437\u0443\u043F\u0438\u043D\u0438\u0441\u044C","\u0441\u0442\u043E\u043F"],normalized:"halt",form:"infinitive"},throw:{primary:"\u043A\u0438\u043D\u0443\u0442\u0438",alternatives:["\u043A\u0438\u043D\u044C"],normalized:"throw",form:"infinitive"},call:{primary:"\u0432\u0438\u043A\u043B\u0438\u043A\u0430\u0442\u0438",alternatives:["\u0432\u0438\u043A\u043B\u0438\u0447"],normalized:"call",form:"infinitive"},return:{primary:"\u043F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u0438",alternatives:["\u043F\u043E\u0432\u0435\u0440\u043D\u0438"],normalized:"return",form:"infinitive"},then:{primary:"\u043F\u043E\u0442\u0456\u043C",alternatives:["\u0434\u0430\u043B\u0456","\u0442\u043E\u0434\u0456"],normalized:"then"},and:{primary:"\u0456",alternatives:["\u0442\u0430"],normalized:"and"},end:{primary:"\u043A\u0456\u043D\u0435\u0446\u044C",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"\u0430\u0441\u0438\u043D\u0445\u0440\u043E\u043D\u043D\u043E",alternatives:["async"],normalized:"async"},tell:{primary:"\u0441\u043A\u0430\u0437\u0430\u0442\u0438",alternatives:["\u0441\u043A\u0430\u0436\u0438"],normalized:"tell",form:"infinitive"},default:{primary:"\u0437\u0430_\u0437\u0430\u043C\u043E\u0432\u0447\u0443\u0432\u0430\u043D\u043D\u044F\u043C",normalized:"default"},init:{primary:"\u0456\u043D\u0456\u0446\u0456\u0430\u043B\u0456\u0437\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0456\u043D\u0456\u0446\u0456\u0430\u043B\u0456\u0437\u0443\u0439"],normalized:"init",form:"infinitive"},behavior:{primary:"\u043F\u043E\u0432\u0435\u0434\u0456\u043D\u043A\u0430",normalized:"behavior"},install:{primary:"\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0438_\u043F\u0430\u043A\u0435\u0442",normalized:"install",form:"infinitive"},measure:{primary:"\u0432\u0438\u043C\u0456\u0440\u044F\u0442\u0438",alternatives:["\u0432\u0438\u043C\u0456\u0440\u044F\u0439"],normalized:"measure",form:"infinitive"},beep:{primary:"\u0437\u0432\u0443\u043A",normalized:"beep"},break:{primary:"\u043F\u0435\u0440\u0435\u0440\u0432\u0430\u0442\u0438",normalized:"break"},copy:{primary:"\u043A\u043E\u043F\u0456\u044E\u0432\u0430\u0442\u0438",normalized:"copy"},exit:{primary:"\u0432\u0438\u0439\u0442\u0438",normalized:"exit"},pick:{primary:"\u0432\u0438\u0431\u0440\u0430\u0442\u0438",normalized:"pick"},render:{primary:"\u0432\u0456\u0434\u043E\u0431\u0440\u0430\u0437\u0438\u0442\u0438",normalized:"render"},into:{primary:"\u0432",alternatives:["\u0443"],normalized:"into"},before:{primary:"\u0434\u043E",alternatives:["\u043F\u0435\u0440\u0435\u0434"],normalized:"before"},after:{primary:"\u043F\u0456\u0441\u043B\u044F",normalized:"after"},until:{primary:"\u043F\u043E\u043A\u0438_\u043D\u0435",normalized:"until"},event:{primary:"\u043F\u043E\u0434\u0456\u044F",normalized:"event"},from:{primary:"\u0437",alternatives:["\u0432\u0456\u0434","\u0456\u0437"],normalized:"from"},connect:{primary:"\u043F\u0456\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u0438",alternatives:["\u0437\u02BC\u0454\u0434\u043D\u0430\u0442\u0438","\u043F\u0456\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u0438\u0441\u044F"],normalized:"connect"},stream:{primary:"\u0442\u0440\u0430\u043D\u0441\u043B\u044E\u0432\u0430\u0442\u0438",alternatives:["\u043F\u043E\u0442\u0456\u043A","\u0441\u0442\u0440\u0456\u043C"],normalized:"stream"},live:{primary:"\u043D\u0430\u0436\u0438\u0432\u043E",alternatives:["\u0443-\u043F\u0440\u044F\u043C\u043E\u043C\u0443-\u0435\u0444\u0456\u0440\u0456","\u0432-\u0440\u0435\u0436\u0438\u043C\u0456-\u0440\u0435\u0430\u043B\u044C\u043D\u043E\u0433\u043E-\u0447\u0430\u0441\u0443"],normalized:"live"},socket:{primary:"\u0441\u043E\u043A\u0435\u0442",alternatives:["\u0433\u043D\u0456\u0437\u0434\u043E","websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"\u043F\u0440\u0438",normalized:"on"},sourceMarker:{primary:"\u043D\u0430",alternatives:["\u0432","\u043F\u0440\u0438"],position:"before"},eventMarker:{primary:"\u043F\u0440\u0438",position:"before"},temporalMarkers:["\u043A\u043E\u043B\u0438","\u044F\u043A\u0449\u043E"]}},Au=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],wu=class{constructor(r=Au){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},Du="()[]{},:;",xu=class{constructor(r=Du){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function Bu(r,e){let t=r[e];if(t==="#"){let i=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);return i?i[0]:null}if(t==="."){let i=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return i?i[0]:null}if(t==="["){let i=0,a=e;for(;a<r.length;){if(r[a]==="["&&i++,r[a]==="]"&&(i--,i===0))return r.slice(e,a+1);a++;}return null}if(t==="<"){let i=r.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return i?i[0]:null}return null}var Fu=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"}extract(r,e){let t=Bu(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},Su=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let i=t[0],a=i.slice(1).split("(")[0],u=t[1];return {value:i,length:i.length,metadata:{modifierName:a,value:u?a==="queue"?u:parseInt(u,10):void 0}}}};function Tu(r,e){let t=r.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let i=t.match(/^https?:\/\/[^\s]*/);return i?i[0]:null}if(t.startsWith("//")){let i=t.match(/^\/\/[^\s]*/);return i?i[0]:null}if(t.startsWith("./")||t.startsWith("../")){let i=t.match(/^\.\.?\/[^\s]*/);return i?i[0]:null}if(t.startsWith("/")){let i=t.match(/^\/[^\s]*/);return i?i[0]:null}return null}var Pu=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=Tu(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},Ru=class{constructor(){this.name="variable-ref";}canExtract(r,e){return r[e]===":"&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function Nu(r){return {isLetter:i=>r.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||r.test(i)}}var _u=class{constructor(r,e,t){this.name=r;let i=Nu(e);this.isLetter=i.isLetter,this.isIdentifierChar=i.isIdentifierChar,this.prepositions=t;}setContext(r){this.context=r;}canExtract(r,e){return this.isLetter(r[e])}extract(r,e){if(!this.context)throw new Error(`${this.name}: context not set`);let t=e,i="";for(;t<r.length&&this.isIdentifierChar(r[t]);)i+=r[t++];if(!i)return null;let a=i.toLowerCase(),u=this.prepositions.has(a),n=this.context.lookupKeyword(a),o=n&&n.normalized!==n.native?n.normalized:void 0,s;if(!n&&this.context.normalizer){let l=this.context.normalizer.normalize(i);if(l.stem!==i&&l.confidence>=.7){let m=this.context.lookupKeyword(l.stem);m&&(s=m.normalized);}}return {value:i,length:t-e,metadata:{normalized:o||s,isPreposition:u}}}},Ou=new Set(["\u0432","\u0443","\u043D\u0430","\u0437","\u0456\u0437","\u0437\u0456","\u0434\u043E","\u0432\u0456\u0434","\u043E","\u043E\u0431","\u043F\u0440\u0438","\u0434\u043B\u044F","\u043F\u0456\u0434","\u043D\u0430\u0434","\u043F\u0435\u0440\u0435\u0434","\u043C\u0456\u0436","\u0447\u0435\u0440\u0435\u0437","\u0431\u0435\u0437","\u043F\u043E","\u0437\u0430","\u043F\u0440\u043E","\u043F\u0456\u0441\u043B\u044F","\u043D\u0430\u0432\u043A\u043E\u043B\u043E","\u043F\u0440\u043E\u0442\u0438","\u0437\u0430\u043C\u0456\u0441\u0442\u044C","\u043A\u0440\u0456\u043C","\u0441\u0435\u0440\u0435\u0434","\u043A"]);function Mu(){return [new _u("ukrainian-keyword",/[a-zA-Zа-яА-ЯіІїЇєЄґҐьЬ']/,Ou)]}function Iu(r){let e=r.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function ju(r){let e=r.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}var Lu=class{constructor(){this.name="ascii-identifier";}setContext(r){this.context=r;}canExtract(r,e){return Iu(r[e])}extract(r,e){if(!this.context)throw new Error("AsciiIdentifierExtractor: context not set");let t=e,i="",a=e;for(;a<r.length&&ju(r[a]);)i+=r[a],a++;if(!i)return null;let u=this.context.lookupKeyword(i),n=u&&u.normalized!==u.native?u.normalized:void 0;return {value:i,length:a-t,metadata:{normalized:n}}}};function $u(){return [new Pu,new Su,new Ru,new Fu]}var Vu=new Set(["\u0432","\u0443","\u043D\u0430","\u0437","\u0456\u0437","\u0437\u0456","\u0434\u043E","\u0432\u0456\u0434","\u043E","\u043E\u0431","\u043F\u0440\u0438","\u0434\u043B\u044F","\u043F\u0456\u0434","\u043D\u0430\u0434","\u043F\u0435\u0440\u0435\u0434","\u043C\u0456\u0436","\u0447\u0435\u0440\u0435\u0437","\u0431\u0435\u0437","\u043F\u043E","\u0437\u0430","\u043F\u0440\u043E","\u043F\u0456\u0441\u043B\u044F","\u043D\u0430\u0432\u043A\u043E\u043B\u043E","\u043F\u0440\u043E\u0442\u0438","\u0437\u0430\u043C\u0456\u0441\u0442\u044C","\u043A\u0440\u0456\u043C","\u0441\u0435\u0440\u0435\u0434","\u043A"]),qu=[{native:"\u0456\u0441\u0442\u0438\u043D\u0430",normalized:"true"},{native:"\u043F\u0440\u0430\u0432\u0434\u0430",normalized:"true"},{native:"\u0445\u0438\u0431\u043D\u0456\u0441\u0442\u044C",normalized:"false"},{native:"null",normalized:"null"},{native:"\u043D\u0435\u0432\u0438\u0437\u043D\u0430\u0447\u0435\u043D\u043E",normalized:"undefined"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434\u0430",normalized:"s"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434\u0438",normalized:"s"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434",normalized:"s"},{native:"\u043C\u0456\u043B\u0456\u0441\u0435\u043A\u0443\u043D\u0434\u0430",normalized:"ms"},{native:"\u043C\u0456\u043B\u0456\u0441\u0435\u043A\u0443\u043D\u0434\u0438",normalized:"ms"},{native:"\u043C\u0456\u043B\u0456\u0441\u0435\u043A\u0443\u043D\u0434",normalized:"ms"},{native:"\u0445\u0432\u0438\u043B\u0438\u043D\u0430",normalized:"m"},{native:"\u0445\u0432\u0438\u043B\u0438\u043D\u0438",normalized:"m"},{native:"\u0445\u0432\u0438\u043B\u0438\u043D",normalized:"m"},{native:"\u0433\u043E\u0434\u0438\u043D\u0430",normalized:"h"},{native:"\u0433\u043E\u0434\u0438\u043D\u0438",normalized:"h"},{native:"\u0433\u043E\u0434\u0438\u043D",normalized:"h"},{native:"\u043F\u0435\u0440\u0448\u0430",normalized:"first"},{native:"\u043F\u0435\u0440\u0448\u0435",normalized:"first"},{native:"\u043E\u0441\u0442\u0430\u043D\u043D\u044F",normalized:"last"},{native:"\u043E\u0441\u0442\u0430\u043D\u043D\u0454",normalized:"last"},{native:"\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u0430",normalized:"next"},{native:"\u043F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u044F",normalized:"previous"},{native:"\u043F\u043E\u0440\u043E\u0436\u043D\u044F",normalized:"empty"},{native:"\u043F\u043E\u0440\u043E\u0436\u043D\u0454",normalized:"empty"},{native:"\u043C\u043E\u044F",normalized:"my"},{native:"\u043C\u043E\u0454",normalized:"my"},{native:"\u043C\u043E\u0457",normalized:"my"}],Wu=class extends K{constructor(){super(),this.language="uk",this.direction="ltr",this.initializeKeywordsFromProfile(Cr,qu),this.setNormalizer(new kr),this.registerExtractors([...$u(),...Mu(),new W,new U,new Lu,new wu,new xu]);}classifyToken(r){let e=r.toLowerCase();return Vu.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":"identifier"}},Uu=new Wu;J("uk",Uu,Cr);function he(r){let e=r.getAttribute("data-lang");if(e)return xe(e);let t=r.getAttribute("data-hyperscript-lang")??r.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(t)return xe(t);let i=typeof document<"u"?document.documentElement?.lang:null;return i&&i!=="en"?xe(i):null}function xe(r){return r.split("-")[0].toLowerCase()}var br={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 ve(r){switch(r.kind){case "event-handler":return Ku(r);case "compound":return Gu(r);default:return Hu(r)}}function Ku(r){let e=["on"],t=r.roles.get("event");t&&e.push(se(t));let i=r.roles.get("source");if(i&&e.push("from",se(i)),r.body&&r.body.length>0){let a=r.body.map(ve);e.push(a.join(" then "));}return e.join(" ")}function Gu(r){let e=r.chainType==="async"?"async":r.chainType;return r.statements.map(ve).join(` ${e} `)}function Hu(r){let e=br[r.action];if(e){let i=[r.action];for(let[a,u]of e){let n=r.roles.get(a);n&&(a==="destination"&&n.type==="reference"&&n.value==="me"||(u&&i.push(u),i.push(se(n))));}return i.join(" ")}let t=[r.action];for(let[,i]of r.roles)t.push(se(i));return t.join(" ")}function se(r){switch(r.type){case "literal":return typeof r.value=="string"&&r.dataType==="string"?`"${r.value}"`:String(r.value);case "selector":return r.value;case "reference":return r.value;case "property-path":return Yu(r);case "expression":return r.raw;case "flag":return r.enabled?`+${r.name}`:`~${r.name}`}}function Yu(r){let e=se(r.object),t=r.property;if(r.object.type==="reference")switch(r.object.value){case "me":return `my ${t}`;case "it":return `its ${t}`;case "you":return `your ${t}`}return `${e}'s ${t}`}var wr=.5,Ju={confidenceThreshold:wr,strategy:"semantic",fallbackToOriginal:true};function Xu(r,e){return typeof r=="number"?r:r[e]??r["*"]??wr}function Be(r,e,t={}){let i={...Ju,...t},a=Ar(r,e,i);if(a!==null)return a;let u=Qu(r);if(u){let n=Ar(u.commands,e,i);if(n!==null)return u.prefix+n}return r}function Ar(r,e,t){if(t.strategy==="semantic"||t.strategy==="auto"){let i=Xu(t.confidenceThreshold,e),a=Dr(r,e,i);if(a!==null)return a}if((t.strategy==="auto"||t.strategy==="i18n")&&t.i18nToEnglish){let i=en(r,e,t.i18nToEnglish);if(i!==null)return i}return null}var Zu=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function Qu(r){let e=r.match(Zu);if(!e)return null;let t=e[1],i=r.slice(t.length);return i?{prefix:t,commands:i}:null}function Dr(r,e,t){try{let i=tn(r,e);if(i.length>1)return an(i,e,t);if(!ur(e))return null;let a=lr(r,e);return a.confidence<t||!a.node?null:ve(a.node)}catch{return null}}function en(r,e,t){try{let i=t(r,e);return i!==r?i:null}catch{return null}}function rn(r){let e=["then"],t=L(r);if(t?.keywords?.then){let i=t.keywords.then;if(i.primary&&i.primary!=="then"&&e.push(i.primary),i.alternatives)for(let a of i.alternatives)e.includes(a)||e.push(a);}return e}function tn(r,e){let i=rn(e).map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),a=new RegExp(`\\s+(?:${i.join("|")})\\s+`,"i"),u=r.split(`
|
|
4
|
+
`).map(o=>o.trim()).filter(o=>o.length>0),n=[];for(let o of u){let s=o.split(a);n.push(...s);}return n}function an(r,e,t){let i=[];for(let a of r){let u=Dr(a.trim(),e,t);if(u===null)return null;i.push(u);}return i.join(" then ")}function Fe(r={}){return function(t){let{internals:i}=t,a=i.runtime,u=a.getScript.bind(a);a.getScript=function(n){let o=u(n);if(!o)return null;let s=un(n,r);if(!s||s==="en")return o;let l=Be(o,s,r);return r.debug&&l!==o&&console.log(`[hyperscript-i18n] ${s}: "${o}" \u2192 "${l}"`),l};}}function un(r,e){if(e.languageAttribute){let i=r.getAttribute(e.languageAttribute);if(i)return i.split("-")[0].toLowerCase()}let t=he(r);return t||(e.defaultLanguage??null)}function xr(r,e,t={}){return e==="en"?r:Be(r,e,t)}ar(r=>pr(r));function Br(){typeof _hyperscript<"u"&&_hyperscript.use&&(_hyperscript.use(Fe()),nn());}function nn(){if(typeof document>"u")return;let e=_hyperscript?.internals?.runtime;if(!e?.processNode||!e?.getInternalData)return;let t=e.getScriptSelector?.()??"[_], [script], [data-script]";document.querySelectorAll(t).forEach(i=>{let a=e.getInternalData(i);a.initialized&&(a.initialized=false);}),e.processNode(document.body);}var ys=["ru","pl","uk"];Br();exports.plugin=Fe;exports.preprocess=xr;exports.resolveLanguage=he;exports.supportedLanguages=ys;return exports;})({});
|