@spotify/backstage-plugin-pulse-common 0.11.6 → 0.11.8
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/CHANGELOG.md +13 -0
- package/dist/config.esm.js +1 -1
- package/dist/index.cjs.js +17 -17
- package/dist/templates/convertTemplateToNode.esm.js +1 -1
- package/dist/templates/evaluation.esm.js +1 -1
- package/dist/templates/index.esm.js +1 -1
- package/dist/templates/locators.esm.js +1 -1
- package/dist/templates/logic.esm.js +1 -1
- package/dist/templates/schema/logic_parser.esm.js +19 -19
- package/dist/templates/validateResponse.esm.js +1 -1
- package/dist/templates/validateTemplate.esm.js +1 -1
- package/package.json +10 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{TemplateContextEvaluator as
|
|
1
|
+
import{TemplateContextEvaluator as c}from"./logic.esm.js";function w(i,o){const e=structuredClone(i);return{...e,sections:e.sections.map(t=>({id:t.id,name:t.name,hideProgressBar:t.hideProgressBar,pages:o.evaluateDisplayLogic(t.displayLogic)?t.pages.map(l=>({...l,questions:A(l.questions,o)})).filter(l=>l.questions.length):[]})).filter(t=>t.pages.length)}}function A(i,o){return i.filter(e=>o.evaluateDisplayLogic(e.displayLogic)).map(e=>({...e,text:o.getQuestionText(e),statements:o.getQuestionStatements(e),choices:o.getQuestionChoices(e),statementGroups:o.getQuestionStatementGroups(e),choiceGroups:o.getQuestionChoiceGroups(e),randomization:void 0}))}const v=i=>!!i?.singleAnswer||!!i?.multipleAnswers&&i?.multipleAnswers.length>0,y=(i,o)=>{let e=!1,t=o,l=new c(i,t);const g=r=>n=>{const s=r.includes(n.questionId);return s&&(e=!0),!s},p=r=>n=>{const s=!n.statementId||r.includes(n.statementId);return s||(e=!0),s},d=r=>n=>{if(n.singleAnswer){const u=!!n.singleAnswer.text||r.includes(n.singleAnswer.choiceId||n.singleAnswer.choiceValue);return u||(e=!0),{...n,singleAnswer:u?n.singleAnswer:void 0}}const s=n.multipleAnswers?.filter(u=>!!u.text||r.includes(u.choiceId||u.choiceValue));return s&&s.length<n.multipleAnswers.length&&(e=!0),{...n,multipleAnswers:s}};for(const r of i.sections){if(!l.evaluateDisplayLogic(r.displayLogic)){const n=r.pages.flatMap(s=>s.questions).map(s=>s.id);t=t.filter(g(n)),e&&(e=!1,l=new c(i,t));continue}for(const n of r.pages)for(const s of n.questions){if(!l.evaluateDisplayLogic(s.displayLogic))t=t.filter(g([s.id]));else{const u=l.getQuestionStatementsFlattened(s).map(a=>a.id),m=l.getQuestionChoicesFlattened(s).map(a=>a.id||a.value),f=p(u),h=d(m);t=t.filter(a=>a.questionId!==s.id||f(a)),t=t.map(a=>a.questionId!==s.id?a:h(a))}e&&(e=!1,l=new c(i,t))}}return t};export{w as evaluateTemplateNode,y as getRelevantQuestionResponses,v as hasAnswer};
|
|
2
2
|
//# sourceMappingURL=evaluation.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from"./schema/survey-template-schema.json.esm.js";import{validateTemplate as L}from"./validateTemplate.esm.js";import"assert";import"crypto";import"../graphql/schema-types.generated.esm.js";import"lodash";import{LOCATOR_EXPRESSION as _,parseLocator as f,validateLocator as s}from"./locators.esm.js";import"./schema/logic_parser.esm.js";const t=o,r="pulse_default_alpha";export{r as DEFAULT_TEMPLATE_ID,_ as LOCATOR_EXPRESSION,f as parseLocator,t as templateSchema,s as validateLocator,L as validateTemplate};
|
|
2
2
|
//# sourceMappingURL=index.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _="(?<questionId>[a-zA-Z][a-zA-Z0-9_]*)",d="((?<expressionWithoutIdentifier>all|all_entered_text|selected|selected_entered_text|not_selected)|(?<expressionWithIdentifier>for_matrix_choice|unselected_for_matrix_choice)(\\((?<identifier>[\\-a-zA-Z0-9_]+)\\)))",r=new RegExp(`^${_}/${d}$`);var n=(e=>(e.ALL="all",e.ALL_ENTERED_TEXT="all_entered_text",e.SELECTED="selected",e.SELECTED_ENTERED_TEXT="selected_entered_text",e.NOT_SELECTED="not_selected",e.FOR_MATRIX_CHOICE="for_matrix_choice",e.UNSELECTED_FOR_MATRIX_CHOICE="unselected_for_matrix_choice",e))(n||{});const c=e=>r.test(e),E=e=>{const t=e.match(r)?.groups;if(!t)throw new Error(`Invalid locator expression: ${e}`);const o=t.expressionWithoutIdentifier||t.expressionWithIdentifier||"all",i={questionId:t.questionId,expression:o};if(t.identifier){const s=isNaN(parseInt(t.identifier,10))?t.identifier:parseInt(t.identifier,10);i.identifier=s}return i};export{n as LOCATOR_EXPRESSION,E as parseLocator,c as validateLocator};
|
|
2
2
|
//# sourceMappingURL=locators.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import C from"assert";import*as w from"crypto";import{QuestionType as I}from"../graphql/schema-types.generated.esm.js";import{extractQuestionNodes as L,getRawQuestionId as E}from"./convertTemplateToNode.esm.js";import{LOCATOR_EXPRESSION as p,validateLocator as q,parseLocator as g}from"./locators.esm.js";import Q from"./schema/logic_parser.esm.js";const _=/\$\{q\:(?<locator>[\-a-zA-Z0-9_\/\(\)]+)\}/g,v=n=>n.choiceId??n.choiceValue??n.text;class A{questions=new Map;responsesByQuestion=new Map;responsesByQuestionStatement=new Map;surveyResponseId;forExport;evaluationCache=new Map;constructor(t,s=[],e="",i=!1){this.questions=new Map((t?L(t):[]).filter(a=>a.id).map(a=>[E(a.id),a])),s.filter(a=>a.singleAnswer||a.multipleAnswers).forEach(a=>{const c=E(a.questionId);this.responsesByQuestion.set(c,[...this.responsesByQuestion.get(c)||[],a]),a.statementId&&this.responsesByQuestionStatement.set(`${c}.${a.statementId}`,a)}),this.surveyResponseId=e,this.forExport=i}getQuestionAnswers(t,s){let e;if(s){const i=this.responsesByQuestionStatement.get(`${t}.${s}`);e=i===void 0?[]:[i]}else e=this.responsesByQuestion.get(t)||[];return e.flatMap(i=>{const{multipleAnswers:a,singleAnswer:c}=i;return a||[c]})}#t(t,s,e){return this.getQuestionAnswers(t,s).filter(i=>typeof e>"u"||e===null||v(i)===e)}#e(t,s){if(t.textInput&&["forced","optional"].includes(t.textInput)){const e=this.textEntry({questionId:s.questionId,choice:t.id||t.value});return e.trim()?{...t,display:e}:t.textInput==="forced"?null:t}return t}evaluateDisplayLogic(t){if(t&&!this.forExport)try{const s=this.evaluationCache.get(t);if(s!==void 0)return s;const e=T(t,this);return this.evaluationCache.set(t,e),e}catch(s){return console.error(s),!1}return!0}evaluateDynamicExpression(t,s){const e=this.questions.get(t.questionId);if(!e)return[];const i=this.getQuestionChoicesFlattened(e),a=i.filter(o=>this.isSelected({questionId:t.questionId,choice:o.id||o.value})),c=this.getQuestionStatementsFlattened(e),d=o=>s==="choices"?o:{...o,id:o.id||o.value||o.display},h=o=>({id:o.id,display:o.display,value:o.value});let u=[];switch(t.expression){case p.ALL:u=i.map(d);break;case p.ALL_ENTERED_TEXT:u=i.map(o=>this.#e(o,t)).filter(o=>!!o).map(o=>d(o));break;case p.SELECTED:u=a;break;case p.SELECTED_ENTERED_TEXT:u=a.map(o=>this.#e(o,t)).filter(o=>!!o).map(o=>d(o));break;case p.NOT_SELECTED:u=i.filter(o=>!this.isSelected({questionId:t.questionId,choice:o.id||o.value})).map(d);break;case p.FOR_MATRIX_CHOICE:u=c.filter(o=>this.isSelected({questionId:t.questionId,statementId:o.id,choice:t.identifier}));break;case p.UNSELECTED_FOR_MATRIX_CHOICE:u=c.filter(o=>!this.isSelected({questionId:t.questionId,statementId:o.id,choice:t.identifier}));break;default:u=[]}return this.forExport&&(u=t.expression===p.FOR_MATRIX_CHOICE||t.expression===p.UNSELECTED_FOR_MATRIX_CHOICE?c:i.map(d)),u.map(h)}isSelected(t){return!!this.#t(t.questionId,t.statementId,t.choice).length}countSelected(t){return this.getQuestionAnswers(t).length}selectedValue(t){const s=this.getQuestionAnswers(typeof t=="string"?t:t.questionId,typeof t=="string"?void 0:t.statementId);return s.length?v(s[0]):null}countChoiceSelections(t,s){return this.#t(t,null,s).length}textEntry(t){return this.#t(t.questionId,t.statementId,t.choice).map(s=>s.text).filter(s=>s).join(", ")}getQuestionText(t){if(this.forExport)return t.text;let s=t.text;return s=s.replaceAll(_,(e,i)=>{if(i&&q(i)){const a=g(i);return this.evaluateDynamicExpression(a,"choices").map(c=>c.display).join(", ")}return e}),s}getQuestionChoices(t){const s=(t.choices??[]).filter(e=>this.evaluateDisplayLogic(e.displayLogic));if(t.dynamicChoices){const e=g(t.dynamicChoices),i=this.evaluateDynamicExpression(e,"choices");s.push(...i)}return t.type===I.MatrixSingle||t.type===I.MatrixMulti?s:this.applyRandomization(s,t.id,e=>`${e.id??e.value}`,t.randomization)}getQuestionChoiceGroups(t){const s=(t.choiceGroups?.filter(e=>this.evaluateDisplayLogic(e.displayLogic))||[]).map(e=>({...e,choices:this.applyRandomization(e.choices.filter(i=>this.evaluateDisplayLogic(i.displayLogic)),t.id,i=>`${i.id??i.value}`,e.randomization)})).filter(e=>!!e.choices.length);return this.applyRandomization(s,t.id,e=>e.id,t.randomization)}getQuestionStatements(t){const s=(t.statements??[]).filter(e=>this.evaluateDisplayLogic(e.displayLogic));if(t.dynamicStatements){const e=g(t.dynamicStatements),i=this.evaluateDynamicExpression(e,"statements");s.push(...i)}return this.applyRandomization(s,t.id,e=>e.id,t.randomization)}getQuestionStatementGroups(t){const s=(t.statementGroups?.filter(e=>this.evaluateDisplayLogic(e.displayLogic))||[]).map(e=>({...e,statements:this.applyRandomization(e.statements.filter(i=>this.evaluateDisplayLogic(i.displayLogic)),t.id,i=>i.id,e.randomization)})).filter(e=>!!e.statements.length);return this.applyRandomization(s,t.id,e=>e.id,t.randomization)}getQuestionChoicesFlattened(t){return[...this.getQuestionChoices(t),...this.getQuestionChoiceGroups(t).flatMap(s=>s.choices)]}getQuestionStatementsFlattened(t){return[...this.getQuestionStatements(t),...this.getQuestionStatementGroups(t).flatMap(s=>s.statements)]}applyRandomization(t,s,e,i){if(!i||this.forExport)return t;const a=new Map(t.map(r=>[e(r),r])),c=[...a.keys()],d=new Set(c),h=(i.order??["$"]).filter(r=>r==="$"||d.has(r)),u=c.filter(r=>!h.includes(r)).map(r=>({weight:this.keyHash(s,r),key:r}));u.sort((r,f)=>r.weight.localeCompare(f.weight));const o=i.total??c.length,R=Math.min(o-(h.length-1),u.length),y=[];return h.forEach(r=>{r==="$"?y.push(...u.slice(0,R).map(f=>f.key)):y.push(r)}),y.map(r=>a.get(r))}keyHash(t,s){const e=`${t}.${this.surveyResponseId}.${s}`;return w.createHash("sha256").update(e).digest("hex")}}function x(n){if(n.length===1)return n[0];const t=n[1].value;return t==="or"?n[0]||n[2]:t==="and"?n[0]&&n[2]:!1}function m(n,t,s){switch(t){case"==":return n===s;case"!=":return n!==s;case"<=":return n<=s;case">=":return n>=s;case"<":return n<s;case">":return n>s;default:return!1}}function S(n,t,s,e){const i=e?n.toLowerCase():n,a=e?s.toLowerCase():s;switch(t){case"contains":return i.includes(a);case"not_contains":return!i.includes(a);case"regex_matches":try{return new RegExp(s).test(i)}catch{return!1}default:return m(i,t,a)}}function D(n,t){return n.length>0&&n[0].hasOwnProperty("type")&&n[0].type==="NEGATION"?!t(n.slice(1)):t(n)}function O(n){if(!["INT","IDENTIFIER"].includes(n.type))throw new SyntaxError(`Invalid token type: ${n.type}; expected IDENTIFIER or INT`);return l(n)}function l(n){switch(n.type){case"IDENTIFIER":return n.value;case"INT":return parseInt(n.value,10);case"STRING":{const t=n.value.match(/(?:'(?<single>[^\']*)')|(?:"(?<double>[^\"]*)")/),s=t?.groups?.double||t?.groups?.single;return C(s),s}case"OPERATOR":return n.value;case"TRUE":return!0;case"FALSE":return!1;default:throw new SyntaxError(`Invalid token type: ${n.type}`)}}function T(n,t){const s={bool_const:e=>e[0].value==="true",condition:e=>e[0],bool_expr:x,top_level_expr:x,start:e=>e[0],question_id:e=>e[0].value,choice_ref:e=>O(e[0]),matrix_statement_id:e=>({questionId:e[0],statementId:e[1].value}),question_choice_selected:e=>D(e,i=>t.isSelected({questionId:typeof i[0]=="string"?i[0]:i[0].questionId,statementId:typeof i[0]=="string"?void 0:i[0].statementId,choice:i[1]})),question_choice_selected_value_comparison:e=>{const i=t.selectedValue(e[0]);return i!==null&&m(i,l(e[1]),l(e[2]))},question_choice_text_comparison:e=>S(t.textEntry({questionId:e[0],choice:e[1]}),l(e[2]),l(e[3]),!1),question_choice_text_comparison_case_insensitive:e=>S(t.textEntry({questionId:e[0],choice:e[1]}),l(e[2]),l(e[3]),!0),selected_count_comparison:e=>m(t.countSelected(e[0]),l(e[1]),l(e[2])),choice_selection_count_comparison:e=>m(t.countChoiceSelections(e[0],e[1]),l(e[2]),l(e[3]))};return Q.get_parser({transformer:s}).parse(n)}export{_ as QUESTION_TEXT_LOCATOR_PATTERN,A as TemplateContextEvaluator,T as evaluateExpression};
|
|
2
2
|
//# sourceMappingURL=logic.esm.js.map
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
`,1)),n=t.slice(_,
|
|
3
|
-
`,1)[0],(
|
|
4
|
-
`+" "*
|
|
5
|
-
`).decode("ascii","backslashreplace")):(
|
|
6
|
-
`,1)),n=t.slice(_,
|
|
7
|
-
`,1)[0],
|
|
8
|
-
`+" "*
|
|
9
|
-
`)}match_examples(t,r,n=!1){
|
|
1
|
+
function Me(i={}){return i.transformer&&i.transformer.constructor.name==="object"&&(i.transformer=L.fromObj(i.transformer)),Fe._load_from_dict({data:Jt,memo:Vt,...i})}const me={};class fe{}const j={},de={escape(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},compile(i,t){return new RegExp(i,t)},error:SyntaxError};function We(i,t,r,n){const s=i.compile(t,n).exec(r);if(s!=null)return s[0]}class ye{constructor(t,r,n,s,_=!1){this.terminals=t,this.g_regex_flags=r,this.re_=n,this.use_bytes=s,this.match_whole=_,this.allowed_types=new Set(this.terminals.map(l=>l.name)),this._regexps=this._build_mres(t)}_build_mres(t){let r=this.match_whole?"$":"",n=Ye(t,_=>_.pattern.flags.join("")),s=[];for(let[_,l]of n){const a=l.map(p=>`(?<${p.name}>${p.pattern.to_regexp()+r})`).join("|");s.push(new RegExp(a,this.g_regex_flags+_+"y"))}return s}match(t,r){for(const n of this._regexps){n.lastIndex=r;let s=n.exec(t);if(s){let _=null;for(let[l,a]of Object.entries(s.groups))if(a){_=l;break}return[s[0],_]}}}}const ge=typeof require<"u"&&require("util");class xe{}const D={};function f(i){return Object.entries(i)}function J(i){return Object.keys(i)}function Ge(i,t){t===void 0&&(t=Object.keys(i)[0]);let r=i[t];return delete i[t],r}function we(i,t,r=null){return i[t]||r}function be(i,t){if(i.constructor.name==="Map")for(const[r,n]of f(t))i.set(r,n);else for(const[r,n]of f(t))i[r]=n}function Ze(i){return function(){return new i(...arguments)}}function u(i){let t=0,r=[...arguments].slice(1);return i.replace(/%([sr])/g,function(){const n=arguments[1],s=r[t++];return n==="r"?ge?ge.inspect(s,!1,null,!0):JSON.stringify(s,null,0):s})}function Je(i,t){let r=new Set(i);for(const n of t)r.add(n);return r}function ke(i,t){return[...i].filter(r=>!t.has(r))}function Te(i){return{...i}}function Ne(i){return!!i}function V(i){return Object.create(i.prototype)}function w(i){if(typeof i=="object"){let t=Object.create(Object.getPrototypeOf(i));return Object.assign(t,i)}return i}function C(i){return new Set(i)}function K(i){return i&&i.constructor.name==="Object"}function Ve(i){return i&&i.constructor.name==="Array"}function Ke(i){return typeof i=="function"}function*I(i,t=0){let r=t;for(const n of i)yield[r++,n]}function He(i){for(const t of i)if(t)return!0;return!1}function Re(i,t){return t.filter(i||Ne)}function B(i){let t=[...arguments].slice(1);return function(){return i(...t,...arguments)}}class H extends Error{}function d(i){return i[i.length-1]}function E(i){return function(){let t=new i(...arguments);return t.__call__.bind(t)}}function b(i,t){return Array.from({length:t},()=>i).flat()}function ve(i){return/^[A-Z_$]*$/.test(i)}function X(i,t,r){const n=i.split(t);return r?n.splice(-r-1):n}function Y(i,t){let r=new RegExp(t,"g");return(i.match(r)||[]).length}function Xe(i,t){for(let r of i)if(!t.has(r))return!1;return!0}function*Ye(i,t){let r=[],n=null;for(const s of i){const _=t(s);n&&_!=n&&(yield[n,r],r=[]),r.push(s),n=_}yield[n,r]}class k extends Error{}class T extends k{}function ee(i,t,r="Got %r, expected one of %s"){if(!t.includes(i))throw new T(u(r,i,t))}class F extends k{}class et extends k{}class z extends k{}class N extends k{pos_in_stream=null;_terminals_by_name=null;get_context(t,r=40){let n,s,_=this.pos_in_stream,l=max(_-r,0),a=_+r;return t instanceof bytes?(s=d(X(t.slice(l,_),`
|
|
2
|
+
`,1)),n=t.slice(_,a).split(`
|
|
3
|
+
`,1)[0],(s+n+`
|
|
4
|
+
`+" "*s.expandtabs().length+`^
|
|
5
|
+
`).decode("ascii","backslashreplace")):(s=d(X(t.slice(l,_),`
|
|
6
|
+
`,1)),n=t.slice(_,a).split(`
|
|
7
|
+
`,1)[0],s+n+`
|
|
8
|
+
`+" "*s.expandtabs().length+`^
|
|
9
|
+
`)}match_examples(t,r,n=!1){K(r)&&(r=f(r));let s=[null,!1];for(const[_,[l,a]]of I(r))for(const[p,o]of I(a))try{t(o)}catch(c){if(c instanceof N){if(c.state.eq(this.state)){if(c.token===this.token)return l;n&&c.token.type===this.token.type&&!d(s)&&(s=[l,!0]),s[0]===null&&(s=[l,!1])}}else throw c}return s[0]}_format_expected(t){let r;return this._terminals_by_name&&(r=this._terminals_by_name,t=t.map(n=>n in r?r[n].user_repr():n)),u(`Expected one of:
|
|
10
10
|
* %s
|
|
11
11
|
`,t.join(`
|
|
12
|
-
* `))}}class
|
|
12
|
+
* `))}}class tt extends N{constructor(t,r=null,n=null){super(),this.expected=t,this.state=r,this.token=new h("<EOF>",""),this.pos_in_stream=-1,this.line=-1,this.column=-1,this._terminals_by_name=n}}class O extends N{constructor({seq:t,lex_pos:r,line:n,column:s,allowed:_=null,considered_tokens:l=null,state:a=null,token_history:p=null,terminals_by_name:o=null,considered_rules:c=null}={}){super(),this.line=n,this.column=s,this.pos_in_stream=r,this.state=a,this._terminals_by_name=o,this.allowed=_,this.considered_tokens=l,this.considered_rules=c,this.token_history=p,this.char=t[r]}}class A extends N{constructor({token:t,expected:r,considered_rules:n=null,state:s=null,interactive_parser:_=null,terminals_by_name:l=null,token_history:a=null}={}){super(),this.line=t&&t.line||"?",this.column=t&&t.column||"?",this.pos_in_stream=t&&t.start_pos||null,this.state=s,this.token=t,this.expected=r,this._accepts=me,this.considered_rules=n,this.interactive_parser=_,this._terminals_by_name=l,this.token_history=a}get accepts(){return this._accepts===me&&(this._accepts=this.interactive_parser&&this.interactive_parser.accepts()),this._accepts}}class te extends k{constructor(t,r,n){let s=u(`Error trying to process rule "%s":
|
|
13
13
|
|
|
14
|
-
%s`,t,n);super(
|
|
15
|
-
`];let n=[
|
|
16
|
-
`];for(const
|
|
17
|
-
`);return n}pretty(t=" "){return this._pretty(0,t).join("")}eq(t){return t&&this&&t&&this&&t.children&&this.children&&t.data&&this.data?this.data===t.data&&this.children===t.children:!1}iter_subtrees(){let t=[this],r=new Map;for(const n of t)r.set(n,n),t.push(...[...n.children].reverse().filter(
|
|
18
|
-
`)||
|
|
19
|
-
`),this.last_token=n}eq(t){return t instanceof he?this.text===t.text&&this.line_ctr===t.line_ctr&&this.last_token===t.last_token:I}}class Pe{constructor(t,r){this.lexer=t,this.state=r}static from_text(t,r){return new this(t,new he(r))}lex(t){return this.lexer.lex(this.state,t)}}class W extends we{lex(t,r){return I}}function xt(s,t){s.sort((r,n)=>{let i=t(r),_=t(n);for(let a=0;a<i.length;a++){if(i[a]>_[a])return 1;if(i[a]<_[a])return-1}return 0})}class G extends W{constructor(t){super();let r=[...t.terminals];if(this.re=t.re_module,!t.skip_validation){for(const n of r){try{this.re.compile(n.pattern.to_regexp(),t.g_regex_flags)}catch(i){throw i instanceof this.re.error?new L(u("Cannot compile token %s: %s",n.name,n.pattern)):i}if(n.pattern.min_width===0)throw new L(u("Lexer does not allow zero-width terminals. (%s: %s)",n.name,n.pattern))}if(!(new Set(t.ignore)<=new Set(r.map(n=>n.name))))throw new L(u("Ignore terminals are not defined: %s",Te(new Set(t.ignore),new Set(r.map(n=>n.name)))))}this.newline_types=B(r.filter(n=>gt(n.pattern.to_regexp())).map(n=>n.name)),this.ignore_types=B(t.ignore),xt(r,n=>[-n.priority,-n.pattern.max_width,-n.pattern.value.length,n.name]),this.terminals=r,this.user_callbacks=t.callbacks,this.g_regex_flags=t.g_regex_flags,this.use_bytes=t.use_bytes,this.terminals_by_name=t.terminals_by_name,this._scanner=null}_build_scanner(){let t;[t,this.callback]=yt(this.terminals,this.g_regex_flags,this.re,this.use_bytes);for(const[r,n]of f(this.user_callbacks))r in this.callback?this.callback[r]=new dt(this.callback[r],n,i=>i.type===r):this.callback[r]=n;this._scanner=new ge(t,this.g_regex_flags,this.re,this.use_bytes)}get scanner(){return this._scanner===null&&this._build_scanner(),this._scanner}match(t,r){return this.scanner.match(t,r)}*lex(t,r){try{for(;;)yield this.next_token(t,r)}catch(n){if(!(n instanceof X))throw n}}next_token(t,r=null){let n,i,_,a,l=t.line_ctr;for(;l.char_pos<t.text.length;){if(i=this.match(t.text,l.char_pos),!i)throw n=Te(this.scanner.allowed_types,this.ignore_types),n||(n=new Set(["<END-OF-FILE>"])),new A({seq:t.text,lex_pos:l.char_pos,line:l.line,column:l.column,allowed:n,token_history:t.last_token&&[t.last_token],state:r,terminals_by_name:this.terminals_by_name});let[p,o]=i;if(this.ignore_types.has(o))o in this.callback&&(a=new h(o,p,l.char_pos,l.line,l.column),this.callback[o](a)),l.feed(p,this.newline_types.has(o));else{if(_=new h(o,p,l.char_pos,l.line,l.column),l.feed(p,this.newline_types.has(o)),_.end_line=l.line,_.end_column=l.column,_.end_pos=l.char_pos,_.type in this.callback&&(_=this.callback[_.type](_),!(_ instanceof h)))throw new L(u("Callbacks must return a token (returned %r)",_));return t.last_token=_,_}}throw new X(this)}}class wt extends W{constructor({conf:t,states:r,always_accept:n=[]}={}){super();let i,_,a,l=[...t.terminals],p=t.terminals_by_name,o=b(t);o.terminals=l;let c=new Map;this.lexers={};for(let[g,E]of f(r))i=B(E),c.has(i)?_=c.get(i):(E=He(new Set(E),[...new Set(t.ignore),...new Set(n)]),a=b(o),a.terminals=[...E].filter(x=>x in p).map(x=>p[x]),_=new G(a),c.set(i,_)),this.lexers[g]=_;this.root_lexer=new G(o)}*lex(t,r){let n,i,_;try{for(;;)i=this.lexers[r.position],yield i.next_token(t,r)}catch(a){if(!(a instanceof X))if(a instanceof A)try{throw n=t.last_token,_=this.root_lexer.next_token(t,r),new P({token:_,expected:a.allowed,state:r,token_history:[n],terminals_by_name:this.root_lexer.terminals_by_name})}catch(l){throw l}else throw a}}}class Se extends y{static get __serialize_fields__(){return["terminals","ignore","g_regex_flags","use_bytes","lexer_type"]}static get __serialize_namespace__(){return[M]}constructor({terminals:t,re_module:r,ignore:n=[],postlex:i=null,callbacks:_=null,g_regex_flags:a="",skip_validation:l=!1,use_bytes:p=!1}={}){super(),this.terminals=t,this.terminals_by_name=Object.fromEntries(this.terminals.map(o=>[o.name,o])),this.ignore=n,this.postlex=i,this.callbacks=Object.keys(_).length||{},this.g_regex_flags=a,this.re_module=r,this.skip_validation=l,this.use_bytes=p,this.lexer_type=null}_deserialize(){this.terminals_by_name=Object.fromEntries(this.terminals.map(t=>[t.name,t]))}}class De extends y{static get __serialize_fields__(){return["rules","start","parser_type"]}constructor(t,r,n){super(),this.rules=t,this.callbacks=r,this.start=n,this.parser_type=null}}class bt{constructor(t){this.node_builder=t}__call__(t){return t.length===1?t[0]:this.node_builder(t)}}const kt=O(bt);class Tt{constructor(t,r=null){this.node_builder=t,this.node_filter=r}__call__(t){let r,n,i,_=this.node_builder(t);return _ instanceof m&&(i=_.meta,r=this._pp_get_meta(t),r!==null&&("line"in i||(i.line=r&&r.container_line||r.line,i.column=r&&r.container_column||r.column,i.start_pos=r&&r.container_start_pos||r.start_pos,i.empty=!1),i.container_line=r&&r.container_line||r.line,i.container_column=r&&r.container_column||r.column),n=this._pp_get_meta([...t].reverse()),n!==null&&("end_line"in i||(i.end_line=n&&n.container_end_line||n.end_line,i.end_column=n&&n.container_end_column||n.end_column,i.end_pos=n&&n.container_end_pos||n.end_pos,i.empty=!1),i.container_end_line=n&&n.container_end_line||n.end_line,i.container_end_column=n&&n.container_end_column||n.end_column)),_}_pp_get_meta(t){for(const r of t)if(!(this.node_filter!==null&&!this.node_filter(r))){if(r instanceof m){if(!r.meta.empty)return r.meta}else if(r instanceof h)return r}}}const Ie=O(Tt);function Nt(s){if(Ye(s))return F({unknown_param_0:Ie,node_filter:s});if(s===!0)return Ie;if(s===!1)return null;throw new N(u("Invalid option for propagate_positions: %r",s))}class pe{constructor(t,r,n){this.node_builder=n,this.to_include=t,this.append_none=r}__call__(t){let r=[];for(const[n,i,_]of this.to_include)_&&r.push(...k([null],_)),i?r.push(...t[n].children):r.push(t[n]);return this.append_none&&r.push(...k([null],this.append_none)),this.node_builder(r)}}const Rt=O(pe);class vt extends pe{__call__(t){let r=[];for(const[n,i,_]of this.to_include)_&&r.push(...k([null],_)),i?r.length?r.push(...t[n].children):r=t[n].children:r.push(t[n]);return this.append_none&&r.push(...k([null],this.append_none)),this.node_builder(r)}}const Et=O(vt);class Ot extends pe{constructor(t,r){super(),this.node_builder=r,this.to_include=t}__call__(t){let r=[];for(const[n,i]of this.to_include)i?r.length?r.push(...t[n].children):r=t[n].children:r.push(t[n]);return this.node_builder(r)}}const At=O(Ot);function Pt(s){return!s.is_term&&s.name.startsWith("_")}function St(s,t,r,n){let i,_;n.length?(_=n.map(p=>(0+p).toString()).join(""),i=_.split("0").map(p=>p.length)):i=k([0],s.length+1);let a=[],l=0;for(const[p,o]of z(s))l+=i[p],(t||!(o.is_term&&o.filter_out))&&(a.push([p,Pt(o),l]),l=0);if(l+=i[s.length],n.length||a.length<s.length||et(a.map(([p,o,c])=>o)))return(n.length||r).length?F(r?Rt:Et,a,l):F(At,a.map(([p,o,c])=>[p,o]))}function Dt(s){function t(r){let n=new m(s.name,r);return s(n)}return t=wraps(s)(t),t}function It(s,t,r){if(r===_vargs_meta||r===_vargs_meta_inline)throw new NotImplementedError("Meta args not supported for internal transformer");function n(i){return r(s,t,i,null)}return n=wraps(s)(n),n}class zt{constructor(t,r,n=!1,i=!1,_=!1){this.tree_class=r,this.propagate_positions=n,this.ambiguous=i,this.maybe_placeholders=_,this.rule_builders=[...this._init_builders(t)]}*_init_builders(t){let r,n,i,_,a=Nt(this.propagate_positions);for(const l of t)i=l.options,n=i.keep_all_tokens,r=i.expand1,_=[...ve(null,[r&&!l.alias&&kt,St(l.expansion,n,this.ambiguous,this.maybe_placeholders?i.empty_indices:[]),a])],yield[l,_]}create_callback(t=null){let r,n,i,_=new Map;for(const[a,l]of this.rule_builders){n=a.alias||a.options.template_source||a.origin.name,t&&t[n]?(r=t&&t[n],i=r&&r.visit_wrapper||null,i!==null?r=It(r,n,i):t instanceof Ae&&(r=Dt(r))):r=F(this.tree_class,n);for(const p of l)r=p(r);if(_.has(a))throw new Q(u("Rule '%s' already exists",a));_.set(a,r)}return _}}class ze extends y{constructor({parser_conf:t,debug:r=!1}={}){super();let n=new LALR_Analyzer({unknown_param_0:t,debug:r});n.compute_lalr();let i=t.callbacks;this._parse_table=n.parse_table,this.parser_conf=t,this.parser=new Le(n.parse_table,i,r)}static deserialize(t,r,n,i=!1){let _=K(this);return _._parse_table=jt.deserialize(t,r),_.parser=new Le(_._parse_table,n,i),_}serialize(t){return this._parse_table.serialize(t)}parse_interactive(t,r){return this.parser.parse({lexer:t,start:r,start_interactive:!0})}parse({lexer:t,start:r,on_error:n=null}={}){let i,_;try{return this.parser.parse({lexer:t,start:r})}catch(a){if(a instanceof R){if(n===null)throw a;for(;;){if(a instanceof A&&(_=a.interactive_parser.lexer_thread.state,i=_.line_ctr.char_pos),!n(a))throw a;a instanceof A&&i===_.line_ctr.char_pos&&_.line_ctr.feed(_.text.slice(i,i+1));try{return a.interactive_parser.resume_parse()}catch(l){if(l instanceof P){if(a instanceof P&&a.token.type===l.token.type&&l.token.type==="$END"&&a.interactive_parser.eq(l.interactive_parser))throw l;a=l}else if(l instanceof A)a=l;else throw l}}}else throw a}}}class Lt{constructor(t,r,n){this.parse_table=t,this.start_state=this.parse_table.start_states[n],this.end_state=this.parse_table.end_states[n],this.states=this.parse_table.states,this.callbacks=r,this.start=n}}class me{constructor(t,r,n=null,i=null){this.parse_conf=t,this.lexer=r,this.state_stack=n||[this.parse_conf.start_state],this.value_stack=i||[]}get position(){return d(this.state_stack)}eq(t){return t instanceof me?this.state_stack.length===t.state_stack.length&&this.position===t.position:I}copy(){return b(this)}feed_token(t,r=!1){let n,i,_,a,l,p,o,c,g,E,x=this.state_stack,D=this.value_stack,j=this.parse_conf.states,Me=this.parse_conf.end_state,Z=this.parse_conf.callbacks;for(;;){if(g=d(x),t.type in j[g])[i,_]=j[g][t.type];else throw a=new Set(V(j[g]).filter(J=>Ee(J)).map(J=>J)),new P({token:t,expected:a,state:this,interactive_parser:null});if(i===ce){x.push(_),D.push(t.type in Z?Z[t.type](t):t);return}else if(p=_,c=p.expansion.length,c?(o=D.slice(-c),x.splice(-c),D.splice(-c)):o=[],E=Z.get(p)(o),[n,l]=j[d(x)][p.origin.name],x.push(l),D.push(E),r&&d(x)===Me)return d(D)}}}class Le{constructor(t,r,n=!1){this.parse_table=t,this.callbacks=r,this.debug=n}parse({lexer:t,start:r,value_stack:n=null,state_stack:i=null,start_interactive:_=!1}={}){let a=new Lt(this.parse_table,this.callbacks,r),l=new me(a,t,i,n);return _?new v(this,l,l.lexer):this.parse_from_state(l)}parse_from_state(t){let r,n;try{n=null;for(n of t.lexer.lex(t))t.feed_token(n);return r=n?h.new_borrow_pos("$END","",n):new h("$END","",0,1,1),t.feed_token(r,!0)}catch(i){if(i instanceof R){try{i.interactive_parser=new v(this,t,t.lexer)}catch(_){if(!(_ instanceof ReferenceError))throw _}throw i}else if(i instanceof Error){if(this.debug){console.log(""),console.log("STATE STACK DUMP"),console.log("----------------");for(const[_,a]of z(t.state_stack))console.log(u("%d)",_),a);console.log("")}throw i}else throw i}}}class v{constructor(t,r,n){this.parser=t,this.parser_state=r,this.lexer_thread=n,this.result=null}feed_token(t){return this.parser_state.feed_token(t,t.type==="$END")}*iter_parse(){for(const t of this.lexer_thread.lex(this.parser_state))yield t,this.result=this.feed_token(t)}exhaust_lexer(){return[...this.iter_parse()]}feed_eof(t=null){let r=t!==null?h.new_borrow_pos("$END","",t):new h("$END","",0,1,1);return this.feed_token(r)}copy(){return b(this)}eq(t){return t instanceof v?this.parser_state===t.parser_state&&this.lexer_thread===t.lexer_thread:!1}as_immutable(){let t=b(this);return new qe(t.parser,t.parser_state,t.lexer_thread)}pretty(){let t=["Parser choices:"];for(const[r,n]of f(this.choices()))t.push(u(" - %s -> %r",r,n));return t.push(u("stack size: %s",this.parser_state.state_stack.length)),t.join(`
|
|
20
|
-
`)}choices(){return this.parser_state.parse_conf.parse_table.states[this.parser_state.position]}accepts(){let t,r=new Set;for(const n of this.choices())if(Ee(n)){t=b(this);let i=null;try{t.feed_token(new h(n,""))}catch(_){if(i=_,!(_ instanceof P))throw _}i||r.add(n)}return r}resume_parse(){return this.parser.parse_from_state(this.parser_state)}}class qe extends v{constructor(){super(...arguments),w(this,"result",null)}feed_token(t){let r=b(this);return r.result=v.feed_token(r,t),r}exhaust_lexer(){let t=this.as_mutable();return t.exhaust_lexer(),t.as_immutable()}as_mutable(){let t=b(this);return new v(t.parser,t.parser_state,t.lexer_thread)}}class je{constructor(t){this.name=t}repr(){return this.toString()}}var ce=new je("Shift"),Ce=new je("Reduce");class qt{constructor(t,r,n){this.states=t,this.start_states=r,this.end_states=n}serialize(t){let r=new Enumerator,n=Object.fromEntries(f(this.states).map(([i,_])=>[i,Object.fromEntries(f(_).map(([a,[l,p]])=>[be(r,a),l===Ce?[1,p.serialize(t)]:[0,p]]))]));return{tokens:r.reversed(),states:n,start_states:this.start_states,end_states:this.end_states}}static deserialize(t,r){const n=this;let i=t.tokens,_=Object.fromEntries(f(t.states).map(([a,l])=>[a,Object.fromEntries(f(l).map(([p,[o,c]])=>[i[p],o===1?[Ce,S.deserialize(c,r)]:[ce,c]]))]));return new n(_,t.start_states,t.end_states)}}class jt extends qt{static from_ParseTable(t){const r=this;let n=[...t.states],i=Object.fromEntries(z(n).map(([p,o])=>[o,p])),_={};for(let[p,o]of f(t.states))o=Object.fromEntries(f(o).map(([c,g])=>[c,g[0]===ce?[g[0],i[g[1]]]:g])),_[i[p]]=o;let a=Object.fromEntries(f(t.start_states).map(([p,o])=>[p,i[o]])),l=Object.fromEntries(f(t.end_states).map(([p,o])=>[p,i[o]]));return new r(_,a,l)}}function Ct(s){if(s&&s.__future_interface__)return s;{class t extends W{constructor(n){super(),this.lexer=s(n)}lex(n,i){return this.lexer.lex(n.text)}}return t}}function Bt(s,t,r,n,i){let _=De.deserialize(s.parser_conf,t),a=ze.deserialize(s.parser,t,n,i.debug);return _.callbacks=n,new Ft({lexer_conf:r,parser_conf:_,options:i,parser:a})}var Be={};class Ft extends y{static get __serialize_fields__(){return["lexer_conf","parser_conf","parser"]}constructor({lexer_conf:t,parser_conf:r,options:n,parser:i=null}={}){super();let _,a;this.parser_conf=r,this.lexer_conf=t,this.options=n,i?this.parser=i:(a=be(Be,r.parser_type),this.parser=a(t,r,n));let l=t.lexer_type;if(this.skip_lexer=!1,["dynamic","dynamic_complete"].includes(l)){this.skip_lexer=!0;return}const p={basic:Mt,contextual:Wt};l in p?(_=p[l],this.lexer=_(t,this.parser,t.postlex,n)):this.lexer=Ct(l)(t),t.postlex&&(this.lexer=new $t(this.lexer,t.postlex))}_verify_start(t=null){let r;if(t===null){if(r=this.parser_conf.start,r.length>1)throw new N("Lark initialized with more than 1 possible start rule. Must specify which start rule to parse",r);[t]=r}else if(!this.parser_conf.start.includes(t))throw new N(u("Unknown start rule %s. Must be one of %r",t,this.parser_conf.start));return t}_make_lexer_thread(t){return this.skip_lexer?t:Pe.from_text(this.lexer,t)}parse(t,r=null,n=null){let i=this._verify_start(r),_=n===null?{}:{on_error:n},a=this._make_lexer_thread(t);return this.parser.parse({lexer:a,start:i,..._})}parse_interactive(t=null,r=null){let n=this._verify_start(r);if(this.parser_conf.parser_type!=="lalr")throw new N("parse_interactive() currently only works with parser='lalr' ");let i=this._make_lexer_thread(t);return this.parser.parse_interactive(i,n)}}function Qt(s,t){let r;te(s,["lalr","earley","cyk"]),typeof t!="object"&&(r={lalr:["basic","contextual"],earley:["basic","dynamic","dynamic_complete"],cyk:["basic"]}[s],te(t,r,u("Parser %r does not support lexer %%r, expected one of %%s",s)))}function Ut(s,t){let r,n={};for(const i of t)r=s&&s[i.name]||null,r!==null&&(n[i.name]=r);return n}class $t{constructor(t,r){this.lexer=t,this.postlexer=r}lex(t,r){let n=this.lexer.lex(t,r);return this.postlexer.process(n)}}function Mt(s,t,r,n){return new G(s)}function Wt(s,t,r,n){let i=Object.fromEntries(f(t._parse_table.states).map(([a,l])=>[a,[...V(l)]])),_=r?r.always_accept:[];return new wt({conf:s,states:i,always_accept:_})}function Gt(s,t,r=null){let n=r?r.debug:!1;return new ze({parser_conf:t,debug:n})}Be.lalr=Gt;class Fe extends we{constructor(){super(...arguments),w(this,"always_accept",[])}process(t){return t}}class Zt extends y{constructor(t){super(),w(this,"OPTIONS_DOC",'\n **=== General Options ===**\n\n start\n The start symbol. Either a string, or a list of strings for multiple possible starts (Default: "start")\n debug\n Display debug information and extra warnings. Use only when debugging (Default: ``False``)\n When used with Earley, it generates a forest graph as "sppf.png", if \'dot\' is installed.\n transformer\n Applies the transformer to every parse tree (equivalent to applying it after the parse, but faster)\n propagate_positions\n Propagates (line, column, end_line, end_column) attributes into all tree branches.\n Accepts ``False``, ``True``, or a callable, which will filter which nodes to ignore when propagating.\n maybe_placeholders\n When ``True``, the ``[]`` operator returns ``None`` when not matched.\n When ``False``, ``[]`` behaves like the ``?`` operator, and returns no value at all.\n (default= ``True``)\n cache\n Cache the results of the Lark grammar analysis, for x2 to x3 faster loading. LALR only for now.\n\n - When ``False``, does nothing (default)\n - When ``True``, caches to a temporary file in the local directory\n - When given a string, caches to the path pointed by the string\n regex\n When True, uses the ``regex`` module instead of the stdlib ``re``.\n g_regex_flags\n Flags that are applied to all terminals (both regex and strings)\n keep_all_tokens\n Prevent the tree builder from automagically removing "punctuation" tokens (Default: ``False``)\n tree_class\n Lark will produce trees comprised of instances of this class instead of the default ``lark.Tree``.\n\n **=== Algorithm Options ===**\n\n parser\n Decides which parser engine to use. Accepts "earley" or "lalr". (Default: "earley").\n (there is also a "cyk" option for legacy)\n lexer\n Decides whether or not to use a lexer stage\n\n - "auto" (default): Choose for me based on the parser\n - "basic": Use a basic lexer\n - "contextual": Stronger lexer (only works with parser="lalr")\n - "dynamic": Flexible and powerful (only with parser="earley")\n - "dynamic_complete": Same as dynamic, but tries *every* variation of tokenizing possible.\n ambiguity\n Decides how to handle ambiguity in the parse. Only relevant if parser="earley"\n\n - "resolve": The parser will automatically choose the simplest derivation\n (it chooses consistently: greedy for tokens, non-greedy for rules)\n - "explicit": The parser will return all derivations wrapped in "_ambig" tree nodes (i.e. a forest).\n - "forest": The parser will return the root of the shared packed parse forest.\n\n **=== Misc. / Domain Specific Options ===**\n\n postlex\n Lexer post-processing (Default: ``None``) Only works with the basic and contextual lexers.\n priority\n How priorities should be evaluated - "auto", ``None``, "normal", "invert" (Default: "auto")\n lexer_callbacks\n Dictionary of callbacks for the lexer. May alter tokens during lexing. Use with caution.\n use_bytes\n Accept an input of type ``bytes`` instead of ``str``.\n edit_terminals\n A callback for editing the terminals before parse.\n import_paths\n A List of either paths or loader functions to specify from where grammars are imported\n source_path\n Override the source of from where the grammar was loaded. Useful for relative imports and unconventional grammar loading\n **=== End of Options ===**\n '),w(this,"_defaults",{debug:!1,keep_all_tokens:!1,tree_class:null,cache:!1,postlex:null,parser:"earley",lexer:"auto",transformer:null,start:"start",priority:"auto",ambiguity:"auto",regex:!1,propagate_positions:!1,lexer_callbacks:{},maybe_placeholders:!0,edit_terminals:null,g_regex_flags:"",use_bytes:!1,import_paths:[],source_path:null,_plugins:null});let r,n=Ne(t),i=this;for(const[_,a]of f(this._defaults))_ in n?(r=Ve(n,_),typeof a=="boolean"&&!["cache","use_bytes","propagate_positions"].includes(_)&&(r=Re(r))):r=a,i[_]=r;if(typeof i.start=="string"&&(i.start=[i.start]),this.options=i,te(this.parser,["earley","lalr","cyk",null]),this.parser==="earley"&&this.transformer)throw new N("Cannot specify an embedded transformer when using the Earley algorithm. Please use your transformer on the resulting parse tree, or use a different algorithm (i.e. LALR)");if(Object.keys(n).length)throw new N(u("Unknown options: %s",V(n)))}serialize(t){return this.options}static deserialize(t,r){const n=this;return new n(t)}}class Qe extends y{static get __serialize_fields__(){return["parser","rules","options"]}_build_lexer(t=!1){let r=this.lexer_conf;return t&&(r=b(r),r.ignore=[]),new G(r)}_prepare_callbacks(){this._callbacks=new Map,this.options.ambiguity!=="forest"&&(this._parse_tree_builder=new zt(this.rules,this.options.tree_class||Ke(m),this.options.propagate_positions,this.options.parser!=="lalr"&&this.options.ambiguity==="explicit",this.options.maybe_placeholders),this._callbacks=this._parse_tree_builder.create_callback(this.options.transformer)),ke(this._callbacks,Ut(this.options.transformer,this.terminals))}_deserialize_lexer_conf(t,r,n){let i=Se.deserialize(t.lexer_conf,r);return i.callbacks=n.lexer_callbacks||{},i.re_module=n.regex?regex:ye,i.use_bytes=n.use_bytes,i.g_regex_flags=n.g_regex_flags||"",i.skip_validation=!0,i.postlex=n.postlex,i}_load({f:t,...r}={}){let n;H(t)?n=t:n=pickle.load(t);let i=n.memo,_=n.data,a=_t.deserialize(i,{Rule:S,TerminalDef:M},{}),l=Ne(_.options);return ke(l,r),this.options=Zt.deserialize(l,a),this.rules=_.rules.map(p=>S.deserialize(p,a)),this.source_path="<deserialized>",Qt(this.options.parser,this.options.lexer),this.lexer_conf=this._deserialize_lexer_conf(_.parser,a,this.options),this.terminals=this.lexer_conf.terminals,this._prepare_callbacks(),this._terminals_dict=Object.fromEntries(this.terminals.map(p=>[p.name,p])),this.parser=Bt(_.parser,a,this.lexer_conf,this._callbacks,this.options),this}static _load_from_dict({data:t,memo:r,...n}={}){return K(this)._load({f:{data:t,memo:r},...n})}repr(){return u("Lark(open(%r), parser=%r, lexer=%r, ...)",this.source_path,this.options.parser,this.options.lexer)}lex(t,r=!1){let n;!("lexer"in this)||r?n=this._build_lexer(r):n=this.lexer;let i=Pe.from_text(n,t).lex(null);return this.options.postlex?this.options.postlex.process(i):i}get_terminal(t){return this._terminals_dict[t]}parse_interactive(t=null,r=null){return this.parser.parse_interactive({unknown_param_0:t,start:r})}parse(t,r=null,n=null){return this.parser.parse(t,r,n)}}class Ue extends T{}class $e extends Fe{constructor(){super(),this.paren_level=0,this.indent_level=[0]}*handle_NL(t){if(this.paren_level>0)return;yield t;let r=Y(t.value,`
|
|
21
|
-
`,1)[1],n=
|
|
22
|
-
])+`,flags:[],raw:null,_width:[1,4294967295],__type__:"PatternRE"},priority:0,__type__:"TerminalDef"},1:{name:"IDENTIFIER",pattern:{value:"[a-zA-Z][a-zA-Z0-9_]*[a-zA-Z0-9]",flags:[],raw:"/[a-zA-Z][a-zA-Z0-9_]*[a-zA-Z0-9]/",_width:[2,4294967295],__type__:"PatternRE"},priority:0,__type__:"TerminalDef"},2:{name:"INT",pattern:{value:"-?[0-9]+",flags:[],raw:"/-?[0-9]+/",_width:[1,4294967295],__type__:"PatternRE"},priority:0,__type__:"TerminalDef"},3:{name:"STRING",pattern:{value:`(?:'[^\\']*'|"[^"]*")`,flags:[],raw:null,_width:[2,4294967295],__type__:"PatternRE"},priority:0,__type__:"TerminalDef"},4:{name:"OPERATOR",pattern:{value:"(?:regex_matches|not_contains|contains|==|!=|<=|>=|<|>)",flags:[],raw:null,_width:[1,13],__type__:"PatternRE"},priority:0,__type__:"TerminalDef"},5:{name:"CONJUNCTION",pattern:{value:"(?:and|or)",flags:[],raw:null,_width:[2,3],__type__:"PatternRE"},priority:0,__type__:"TerminalDef"},6:{name:"NEGATION",pattern:{value:"!",flags:[],raw:'"!"',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},7:{name:"TRUE",pattern:{value:"true",flags:[],raw:'"true"',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},8:{name:"FALSE",pattern:{value:"false",flags:[],raw:'"false"',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},9:{name:"DOT",pattern:{value:".",flags:[],raw:'"."',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},10:{name:"__ANON_0",pattern:{value:"selected(",flags:[],raw:'"selected("',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},11:{name:"LSQB",pattern:{value:"[",flags:[],raw:'"["',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},12:{name:"RSQB",pattern:{value:"]",flags:[],raw:'"]"',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},13:{name:"RPAR",pattern:{value:")",flags:[],raw:'")"',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},14:{name:"__ANON_1",pattern:{value:"selected_value(",flags:[],raw:'"selected_value("',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},15:{name:"__ANON_2",pattern:{value:"text(",flags:[],raw:'"text("',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},16:{name:"__ANON_3",pattern:{value:"text_ignore_case(",flags:[],raw:'"text_ignore_case("',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},17:{name:"__ANON_4",pattern:{value:"count_selected(",flags:[],raw:'"count_selected("',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},18:{name:"__ANON_5",pattern:{value:"count_choice_selections(",flags:[],raw:'"count_choice_selections("',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},19:{name:"LPAR",pattern:{value:"(",flags:[],raw:'"("',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},20:{origin:{name:"choice_ref",__type__:"NonTerminal"},expansion:[{name:"INT",filter_out:!1,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},21:{origin:{name:"choice_ref",__type__:"NonTerminal"},expansion:[{name:"IDENTIFIER",filter_out:!1,__type__:"Terminal"}],order:1,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},22:{origin:{name:"question_id",__type__:"NonTerminal"},expansion:[{name:"IDENTIFIER",filter_out:!1,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},23:{origin:{name:"matrix_statement_id",__type__:"NonTerminal"},expansion:[{name:"question_id",__type__:"NonTerminal"},{name:"DOT",filter_out:!0,__type__:"Terminal"},{name:"IDENTIFIER",filter_out:!1,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},24:{origin:{name:"question_choice_selected",__type__:"NonTerminal"},expansion:[{name:"NEGATION",filter_out:!1,__type__:"Terminal"},{name:"__ANON_0",filter_out:!0,__type__:"Terminal"},{name:"question_id",__type__:"NonTerminal"},{name:"LSQB",filter_out:!0,__type__:"Terminal"},{name:"choice_ref",__type__:"NonTerminal"},{name:"RSQB",filter_out:!0,__type__:"Terminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},25:{origin:{name:"question_choice_selected",__type__:"NonTerminal"},expansion:[{name:"NEGATION",filter_out:!1,__type__:"Terminal"},{name:"__ANON_0",filter_out:!0,__type__:"Terminal"},{name:"matrix_statement_id",__type__:"NonTerminal"},{name:"LSQB",filter_out:!0,__type__:"Terminal"},{name:"choice_ref",__type__:"NonTerminal"},{name:"RSQB",filter_out:!0,__type__:"Terminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"}],order:1,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},26:{origin:{name:"question_choice_selected",__type__:"NonTerminal"},expansion:[{name:"__ANON_0",filter_out:!0,__type__:"Terminal"},{name:"question_id",__type__:"NonTerminal"},{name:"LSQB",filter_out:!0,__type__:"Terminal"},{name:"choice_ref",__type__:"NonTerminal"},{name:"RSQB",filter_out:!0,__type__:"Terminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"}],order:2,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},27:{origin:{name:"question_choice_selected",__type__:"NonTerminal"},expansion:[{name:"__ANON_0",filter_out:!0,__type__:"Terminal"},{name:"matrix_statement_id",__type__:"NonTerminal"},{name:"LSQB",filter_out:!0,__type__:"Terminal"},{name:"choice_ref",__type__:"NonTerminal"},{name:"RSQB",filter_out:!0,__type__:"Terminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"}],order:3,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},28:{origin:{name:"question_choice_selected_value_comparison",__type__:"NonTerminal"},expansion:[{name:"__ANON_1",filter_out:!0,__type__:"Terminal"},{name:"question_id",__type__:"NonTerminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"},{name:"OPERATOR",filter_out:!1,__type__:"Terminal"},{name:"INT",filter_out:!1,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},29:{origin:{name:"question_choice_selected_value_comparison",__type__:"NonTerminal"},expansion:[{name:"__ANON_1",filter_out:!0,__type__:"Terminal"},{name:"matrix_statement_id",__type__:"NonTerminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"},{name:"OPERATOR",filter_out:!1,__type__:"Terminal"},{name:"INT",filter_out:!1,__type__:"Terminal"}],order:1,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},30:{origin:{name:"question_choice_text_comparison",__type__:"NonTerminal"},expansion:[{name:"__ANON_2",filter_out:!0,__type__:"Terminal"},{name:"question_id",__type__:"NonTerminal"},{name:"LSQB",filter_out:!0,__type__:"Terminal"},{name:"choice_ref",__type__:"NonTerminal"},{name:"RSQB",filter_out:!0,__type__:"Terminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"},{name:"OPERATOR",filter_out:!1,__type__:"Terminal"},{name:"STRING",filter_out:!1,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},31:{origin:{name:"question_choice_text_comparison_case_insensitive",__type__:"NonTerminal"},expansion:[{name:"__ANON_3",filter_out:!0,__type__:"Terminal"},{name:"question_id",__type__:"NonTerminal"},{name:"LSQB",filter_out:!0,__type__:"Terminal"},{name:"choice_ref",__type__:"NonTerminal"},{name:"RSQB",filter_out:!0,__type__:"Terminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"},{name:"OPERATOR",filter_out:!1,__type__:"Terminal"},{name:"STRING",filter_out:!1,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},32:{origin:{name:"selected_count_comparison",__type__:"NonTerminal"},expansion:[{name:"__ANON_4",filter_out:!0,__type__:"Terminal"},{name:"question_id",__type__:"NonTerminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"},{name:"OPERATOR",filter_out:!1,__type__:"Terminal"},{name:"INT",filter_out:!1,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},33:{origin:{name:"choice_selection_count_comparison",__type__:"NonTerminal"},expansion:[{name:"__ANON_5",filter_out:!0,__type__:"Terminal"},{name:"question_id",__type__:"NonTerminal"},{name:"LSQB",filter_out:!0,__type__:"Terminal"},{name:"choice_ref",__type__:"NonTerminal"},{name:"RSQB",filter_out:!0,__type__:"Terminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"},{name:"OPERATOR",filter_out:!1,__type__:"Terminal"},{name:"INT",filter_out:!1,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},34:{origin:{name:"bool_const",__type__:"NonTerminal"},expansion:[{name:"TRUE",filter_out:!1,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},35:{origin:{name:"bool_const",__type__:"NonTerminal"},expansion:[{name:"FALSE",filter_out:!1,__type__:"Terminal"}],order:1,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},36:{origin:{name:"condition",__type__:"NonTerminal"},expansion:[{name:"bool_const",__type__:"NonTerminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},37:{origin:{name:"condition",__type__:"NonTerminal"},expansion:[{name:"question_choice_selected",__type__:"NonTerminal"}],order:1,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},38:{origin:{name:"condition",__type__:"NonTerminal"},expansion:[{name:"question_choice_selected_value_comparison",__type__:"NonTerminal"}],order:2,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},39:{origin:{name:"condition",__type__:"NonTerminal"},expansion:[{name:"question_choice_text_comparison",__type__:"NonTerminal"}],order:3,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},40:{origin:{name:"condition",__type__:"NonTerminal"},expansion:[{name:"question_choice_text_comparison_case_insensitive",__type__:"NonTerminal"}],order:4,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},41:{origin:{name:"condition",__type__:"NonTerminal"},expansion:[{name:"selected_count_comparison",__type__:"NonTerminal"}],order:5,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},42:{origin:{name:"condition",__type__:"NonTerminal"},expansion:[{name:"choice_selection_count_comparison",__type__:"NonTerminal"}],order:6,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},43:{origin:{name:"bool_expr",__type__:"NonTerminal"},expansion:[{name:"condition",__type__:"NonTerminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},44:{origin:{name:"bool_expr",__type__:"NonTerminal"},expansion:[{name:"condition",__type__:"NonTerminal"},{name:"CONJUNCTION",filter_out:!1,__type__:"Terminal"},{name:"bool_expr",__type__:"NonTerminal"}],order:1,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},45:{origin:{name:"top_level_expr",__type__:"NonTerminal"},expansion:[{name:"LPAR",filter_out:!0,__type__:"Terminal"},{name:"bool_expr",__type__:"NonTerminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},46:{origin:{name:"top_level_expr",__type__:"NonTerminal"},expansion:[{name:"LPAR",filter_out:!0,__type__:"Terminal"},{name:"bool_expr",__type__:"NonTerminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"},{name:"CONJUNCTION",filter_out:!1,__type__:"Terminal"},{name:"top_level_expr",__type__:"NonTerminal"}],order:1,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},47:{origin:{name:"start",__type__:"NonTerminal"},expansion:[{name:"top_level_expr",__type__:"NonTerminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},48:{origin:{name:"start",__type__:"NonTerminal"},expansion:[{name:"bool_expr",__type__:"NonTerminal"}],order:1,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"}};export{h as Token,Kt as default};
|
|
14
|
+
%s`,t,n);super(s),this.rule=t,this.obj=r,this.orig_exc=n}}function rt(i,t=null,r=null){let n,s,_=new Map;for(const l of i)n=t!==null?t(l):l,s=r!==null?r(l):l,_.has(n)?_.get(n).push(s):_.set(n,[s]);return _}function Q(i,t,r){let n;return K(i)?"__type__"in i?(n=t[i.__type__],n.deserialize(i,r)):"@"in i?r[i["@"]]:Object.fromEntries(f(i).map(([s,_])=>[s,Q(_,t,r)])):Ve(i)?i.map(s=>Q(s,t,r)):i}class y{static deserialize(t,r){const n=this;let s=n&&n.__serialize_fields__;if("@"in t)return r[t["@"]];let _=V(n);for(const l of s)if(t&&l in t)_[l]=Q(t[l],Gt,r);else throw new KeyError("Cannot find key for class",n,e);return"_deserialize"in _&&_._deserialize(),_}}class nt extends y{static get __serialize_fields__(){return["memoized"]}constructor(t){super(),this.types_to_memoize=t,this.memoized=new Enumerator}in_types(t){return t instanceof this.types_to_memoize}serialize(){return _serialize(this.memoized.reversed(),null)}static deserialize(t,r,n){return Q(t,r,n)}}class Ee{constructor(){this.empty=!0}}class m{constructor(t,r,n=null){this.data=t,this.children=r,this._meta=n}get meta(){return this._meta===null&&(this._meta=new Ee),this._meta}repr(){return u("Tree(%r, %r)",this.data,this.children)}_pretty_label(){return this.data}_pretty(t,r){if(this.children.length===1&&!(this.children[0]instanceof m))return[b(r,t).join(""),this._pretty_label()," ",u("%s",this.children[0].value),`
|
|
15
|
+
`];let n=[b(r,t).join(""),this._pretty_label(),`
|
|
16
|
+
`];for(const s of this.children)s instanceof m?n.push(...s._pretty(t+1,r)):n.push(b(r,t+1).join(""),u("%s",s.value),`
|
|
17
|
+
`);return n}pretty(t=" "){return this._pretty(0,t).join("")}eq(t){return t&&this&&t&&this&&t.children&&this.children&&t.data&&this.data?this.data===t.data&&this.children===t.children:!1}iter_subtrees(){let t=[this],r=new Map;for(const n of t)r.set(n,n),t.push(...[...n.children].reverse().filter(s=>s instanceof m&&!r.has(s)).map(s=>s));return t=void 0,[...r.values()].reverse()}find_pred(t){return Re(t,this.iter_subtrees())}find_data(t){return this.find_pred(r=>r.data===t)}*scan_values(t){for(const r of this.children)if(r instanceof m)for(const n of r.scan_values(t))yield n;else t(r)&&(yield r)}*iter_subtrees_topdown(){let t,r=[this];for(;r.length;)if(t=r.pop(),t instanceof m){yield t;for(const n of[...t.children].reverse())r.push(n)}}copy(){return type(this)(this.data,this.children)}set(t,r){this.data=t,this.children=r}}class L extends fe{static get __visit_tokens__(){return!0}constructor(t=!0){super(),this.__visit_tokens__=t}static fromObj(t,...r){class n extends this{}for(let[s,_]of Object.entries(t))n.prototype[s]=_;return new n(...r)}_call_userfunc(t,r=null){let n,s,_=r!==null?r:t.children;if(t&&t.data&&this&&this[t.data]){n=this&&this[t.data];try{return s=n&&n.visit_wrapper||null,s!==null?n.visit_wrapper(n,t.data,_,t.meta):n(_)}catch(l){throw l instanceof F?l:l instanceof Error?new te(t.data,t,l):l}}else return this.__default__(t.data,_,t.meta)}_call_userfunc_token(t){let r;if(t&&t.type&&this&&this[t.type]){r=this&&this[t.type];try{return r(t)}catch(n){throw n instanceof F?n:n instanceof Error?new te(t.type,t,n):n}}else return this.__default_token__(t)}*_transform_children(t){let r;for(const n of t)n instanceof m?r=this._transform_tree(n):this.__visit_tokens__&&n instanceof h?r=this._call_userfunc_token(n):r=n,r!==j&&(yield r)}_transform_tree(t){let r=[...this._transform_children(t.children)];return this._call_userfunc(t,r)}transform(t){return this._transform_tree(t)}__default__(t,r,n){return new m(t,r,n)}__default_token__(t){return t}}class Oe extends L{_transform_tree(t){return this._call_userfunc(t)}transform(t){for(const r of t.iter_subtrees())r.children=[...this._transform_children(r.children)];return this._transform_tree(t)}}class st extends L{transform(t){let r,n,s,_=[],l=[t];for(;l.length;){const o=l.pop();_.push(o),o instanceof m&&l.push(...o.children)}let a=[];for(const o of[..._].reverse())o instanceof m?(s=o.children.length,s?(r=a.slice(-s),a.splice(-s)):r=[],n=this._call_userfunc(o,r),n!==j&&a.push(n)):this.__visit_tokens__&&o instanceof h?(n=this._call_userfunc_token(o),n!==j&&a.push(n)):a.push(o);let[p]=a;return p}}class it extends L{_transform_tree(t){return t.children=[...this._transform_children(t.children)],this._call_userfunc(t)}}class re{_call_userfunc(t){const r=this[t.data];return r?r(t):this.__default__(t)}__default__(t){return t}__class_getitem__(t){return cls}}class _t extends re{visit(t){for(const r of t.iter_subtrees())this._call_userfunc(r);return t}visit_topdown(t){for(const r of t.iter_subtrees_topdown())this._call_userfunc(r);return t}}class lt extends re{visit(t){for(const r of t.children)r instanceof m&&this.visit(r);return this._call_userfunc(t),t}visit_topdown(t){this._call_userfunc(t);for(const r of t.children)r instanceof m&&this.visit_topdown(r);return t}}class at extends fe{visit(t){return t.data in this?this[t.data](t):this.__default__(t)}visit_children(t){return t.children.map(r=>r instanceof m?this.visit(r):r)}__default__(t){return this.visit_children(t)}}var ot=0;class ne extends y{is_term=D;constructor(t){super(),this.name=t}eq(t){return this.is_term===t.is_term&&this.name===t.name}repr(){return u("%s(%r)",type(this).name,this.name)}static get fullrepr(){return property(__repr__)}get fullrepr(){return this.constructor.fullrepr}renamed(t){return type(this)(t(this.name))}}class se extends ne{static get __serialize_fields__(){return["name","filter_out"]}get is_term(){return!0}constructor(t,r=!1){super(),this.name=t,this.filter_out=r}get fullrepr(){return u("%s(%r, %r)",type(this).name,this.name,this.filter_out)}renamed(t){return type(this)(t(this.name),this.filter_out)}}class ie extends ne{static get __serialize_fields__(){return["name"]}get is_term(){return!1}}class U extends y{static get __serialize_fields__(){return["keep_all_tokens","expand1","priority","template_source","empty_indices"]}constructor(t=!1,r=!1,n=null,s=null,_=[]){super(),this.keep_all_tokens=t,this.expand1=r,this.priority=n,this.template_source=s,this.empty_indices=_}repr(){return u("RuleOptions(%r, %r, %r, %r)",this.keep_all_tokens,this.expand1,this.priority,this.template_source)}}class P extends y{static get __serialize_fields__(){return["origin","expansion","order","alias","options"]}static get __serialize_namespace__(){return[se,ie,U]}constructor(t,r,n=0,s=null,_=null){super(),this.origin=t,this.expansion=r,this.alias=s,this.order=n,this.options=_||new U,this._hash=[this.origin,this.expansion]}_deserialize(){this._hash=[this.origin,this.expansion]}repr(){return u("Rule(%r, %r, %r, %r)",this.origin,this.expansion,this.alias,this.options)}eq(t){return t instanceof P?this.origin===t.origin&&this.expansion===t.expansion:!1}}class _e extends y{constructor(t,r=[],n=null){super(),this.value=t,this.flags=C(r),this.raw=n}repr(){return repr(this.to_regexp())}eq(t){return type(this)===type(t)&&this.value===t.value&&this.flags===t.flags}to_regexp(){throw new NotImplementedError}get min_width(){throw new NotImplementedError}get max_width(){throw new NotImplementedError}_get_flags(t){return t}}class le extends _e{static get __serialize_fields__(){return["value","flags"]}static get type(){return"str"}to_regexp(){return this._get_flags(de.escape(this.value))}get min_width(){return this.value.length}get max_width(){return this.value.length}}class ae extends _e{static get __serialize_fields__(){return["value","flags","_width"]}static get type(){return"re"}to_regexp(){return this._get_flags(this.value)}_get_width(){return this._width===null&&(this._width=get_regexp_width(this.to_regexp())),this._width}get min_width(){return this._get_width()[0]}get max_width(){return this._get_width()[1]}}class $ extends y{static get __serialize_fields__(){return["name","pattern","priority"]}static get __serialize_namespace__(){return[le,ae]}constructor(t,r,n=ot){super(),this.name=t,this.pattern=r,this.priority=n}repr(){return u("%s(%r, %r)",type(this).name,this.name,this.pattern)}user_repr(){return this.name.startsWith("__")?this.pattern.raw||this.name:this.name}}class h{value;type;constructor(t,r,n=null,s=null,_=null,l=null,a=null,p=null){this.type=t,this.start_pos=n,this.value=r,this.line=s,this.column=_,this.end_line=l,this.end_column=a,this.end_pos=p}update(t=null,r=null){return h.new_borrow_pos(t!==null?t:this.type,r!==null?r:this.value,this)}static new_borrow_pos(t,r,n){const s=this;return new s(t,r,n.start_pos,n.line,n.column,n.end_line,n.end_column,n.end_pos)}repr(){return u("Token(%r, %r)",this.type,this.value)}eq(t){return t instanceof h&&this.type!==t.type?!1:str.__eq__(this,t)}static get __hash__(){return str.__hash__}}class ce{constructor(t){this.newline_char=t,this.char_pos=0,this.line=1,this.column=1,this.line_start_pos=0}eq(t){return t instanceof ce?this.char_pos===t.char_pos&&this.newline_char===t.newline_char:D}feed(t,r=!0){let n;r&&(n=Y(t,this.newline_char),n&&(this.line+=n,this.line_start_pos=this.char_pos+t.lastIndexOf(this.newline_char)+1)),this.char_pos+=t.length,this.column=this.char_pos-this.line_start_pos+1}}class pt{constructor(t){this.scanner=t}__call__(t){let r,n=this.scanner.match(t.value,0);return n&&([r,t.type]=n),t}}const ct=E(pt);class ut{constructor(t,r,n){this.callback1=t,this.callback2=r,this.cond=n}__call__(t){let r=this.callback1(t);return this.cond(r)?this.callback2(t):r}}const ht=E(ut);function mt(i,t,r,n){let s,_,l=rt(i,o=>o.pattern.constructor.type),a=new Set,p={};for(const o of l.get("re")||[]){_=[];for(const c of l.get("str")||[])c.priority===o.priority&&(s=c.pattern.value,s===We(r,o.pattern.to_regexp(),s,t)&&(_.push(c),Xe(new Set(c.pattern.flags),new Set(o.pattern.flags))&&a.add(c)));_.length&&(p[o.name]=new ct(new ye(_,t,r,n,!0)))}return[i.filter(o=>!a.has(o)).map(o=>o),p]}function ft(i){return i.includes(`
|
|
18
|
+
`)||i.includes("\\n")||i.includes("\\s")||i.includes("[^")||i.includes("(?s")&&i.includes(".")}class ue{constructor(t,r=null,n=null){this.text=t,this.line_ctr=r||new ce(`
|
|
19
|
+
`),this.last_token=n}eq(t){return t instanceof ue?this.text===t.text&&this.line_ctr===t.line_ctr&&this.last_token===t.last_token:D}}class Ae{constructor(t,r){this.lexer=t,this.state=r}static from_text(t,r){return new this(t,new ue(r))}lex(t){return this.lexer.lex(this.state,t)}}class M extends xe{lex(t,r){return D}}function dt(i,t){i.sort((r,n)=>{let s=t(r),_=t(n);for(let l=0;l<s.length;l++){if(s[l]>_[l])return 1;if(s[l]<_[l])return-1}return 0})}class W extends M{constructor(t){super();let r=[...t.terminals];if(this.re=t.re_module,!t.skip_validation){for(const n of r){try{this.re.compile(n.pattern.to_regexp(),t.g_regex_flags)}catch(s){throw s instanceof this.re.error?new z(u("Cannot compile token %s: %s",n.name,n.pattern)):s}if(n.pattern.min_width===0)throw new z(u("Lexer does not allow zero-width terminals. (%s: %s)",n.name,n.pattern))}if(!(new Set(t.ignore)<=new Set(r.map(n=>n.name))))throw new z(u("Ignore terminals are not defined: %s",ke(new Set(t.ignore),new Set(r.map(n=>n.name)))))}this.newline_types=C(r.filter(n=>ft(n.pattern.to_regexp())).map(n=>n.name)),this.ignore_types=C(t.ignore),dt(r,n=>[-n.priority,-n.pattern.max_width,-n.pattern.value.length,n.name]),this.terminals=r,this.user_callbacks=t.callbacks,this.g_regex_flags=t.g_regex_flags,this.use_bytes=t.use_bytes,this.terminals_by_name=t.terminals_by_name,this._scanner=null}_build_scanner(){let t;[t,this.callback]=mt(this.terminals,this.g_regex_flags,this.re,this.use_bytes);for(const[r,n]of f(this.user_callbacks))r in this.callback?this.callback[r]=new ht(this.callback[r],n,s=>s.type===r):this.callback[r]=n;this._scanner=new ye(t,this.g_regex_flags,this.re,this.use_bytes)}get scanner(){return this._scanner===null&&this._build_scanner(),this._scanner}match(t,r){return this.scanner.match(t,r)}*lex(t,r){try{for(;;)yield this.next_token(t,r)}catch(n){if(!(n instanceof H))throw n}}next_token(t,r=null){let n,s,_,l,a=t.line_ctr;for(;a.char_pos<t.text.length;){if(s=this.match(t.text,a.char_pos),!s)throw n=ke(this.scanner.allowed_types,this.ignore_types),n||(n=new Set(["<END-OF-FILE>"])),new O({seq:t.text,lex_pos:a.char_pos,line:a.line,column:a.column,allowed:n,token_history:t.last_token&&[t.last_token],state:r,terminals_by_name:this.terminals_by_name});let[p,o]=s;if(this.ignore_types.has(o))o in this.callback&&(l=new h(o,p,a.char_pos,a.line,a.column),this.callback[o](l)),a.feed(p,this.newline_types.has(o));else{if(_=new h(o,p,a.char_pos,a.line,a.column),a.feed(p,this.newline_types.has(o)),_.end_line=a.line,_.end_column=a.column,_.end_pos=a.char_pos,_.type in this.callback&&(_=this.callback[_.type](_),!(_ instanceof h)))throw new z(u("Callbacks must return a token (returned %r)",_));return t.last_token=_,_}}throw new H(this)}}class yt extends M{constructor({conf:t,states:r,always_accept:n=[]}={}){super();let s,_,l,a=[...t.terminals],p=t.terminals_by_name,o=w(t);o.terminals=a;let c=new Map;this.lexers={};for(let[g,v]of f(r))s=C(v),c.has(s)?_=c.get(s):(v=Je(new Set(v),[...new Set(t.ignore),...new Set(n)]),l=w(o),l.terminals=[...v].filter(x=>x in p).map(x=>p[x]),_=new W(l),c.set(s,_)),this.lexers[g]=_;this.root_lexer=new W(o)}*lex(t,r){let n,s,_;try{for(;;)s=this.lexers[r.position],yield s.next_token(t,r)}catch(l){if(!(l instanceof H))if(l instanceof O)try{throw n=t.last_token,_=this.root_lexer.next_token(t,r),new A({token:_,expected:l.allowed,state:r,token_history:[n],terminals_by_name:this.root_lexer.terminals_by_name})}catch(a){throw a}else throw l}}}class Pe extends y{static get __serialize_fields__(){return["terminals","ignore","g_regex_flags","use_bytes","lexer_type"]}static get __serialize_namespace__(){return[$]}constructor({terminals:t,re_module:r,ignore:n=[],postlex:s=null,callbacks:_=null,g_regex_flags:l="",skip_validation:a=!1,use_bytes:p=!1}={}){super(),this.terminals=t,this.terminals_by_name=Object.fromEntries(this.terminals.map(o=>[o.name,o])),this.ignore=n,this.postlex=s,this.callbacks=Object.keys(_).length||{},this.g_regex_flags=l,this.re_module=r,this.skip_validation=a,this.use_bytes=p,this.lexer_type=null}_deserialize(){this.terminals_by_name=Object.fromEntries(this.terminals.map(t=>[t.name,t]))}}class Se extends y{static get __serialize_fields__(){return["rules","start","parser_type"]}constructor(t,r,n){super(),this.rules=t,this.callbacks=r,this.start=n,this.parser_type=null}}class gt{constructor(t){this.node_builder=t}__call__(t){return t.length===1?t[0]:this.node_builder(t)}}const xt=E(gt);class wt{constructor(t,r=null){this.node_builder=t,this.node_filter=r}__call__(t){let r,n,s,_=this.node_builder(t);return _ instanceof m&&(s=_.meta,r=this._pp_get_meta(t),r!==null&&("line"in s||(s.line=r&&r.container_line||r.line,s.column=r&&r.container_column||r.column,s.start_pos=r&&r.container_start_pos||r.start_pos,s.empty=!1),s.container_line=r&&r.container_line||r.line,s.container_column=r&&r.container_column||r.column),n=this._pp_get_meta([...t].reverse()),n!==null&&("end_line"in s||(s.end_line=n&&n.container_end_line||n.end_line,s.end_column=n&&n.container_end_column||n.end_column,s.end_pos=n&&n.container_end_pos||n.end_pos,s.empty=!1),s.container_end_line=n&&n.container_end_line||n.end_line,s.container_end_column=n&&n.container_end_column||n.end_column)),_}_pp_get_meta(t){for(const r of t)if(!(this.node_filter!==null&&!this.node_filter(r))){if(r instanceof m){if(!r.meta.empty)return r.meta}else if(r instanceof h)return r}}}const De=E(wt);function bt(i){if(Ke(i))return B({unknown_param_0:De,node_filter:i});if(i===!0)return De;if(i===!1)return null;throw new T(u("Invalid option for propagate_positions: %r",i))}class oe{constructor(t,r,n){this.node_builder=n,this.to_include=t,this.append_none=r}__call__(t){let r=[];for(const[n,s,_]of this.to_include)_&&r.push(...b([null],_)),s?r.push(...t[n].children):r.push(t[n]);return this.append_none&&r.push(...b([null],this.append_none)),this.node_builder(r)}}const kt=E(oe);class Tt extends oe{__call__(t){let r=[];for(const[n,s,_]of this.to_include)_&&r.push(...b([null],_)),s?r.length?r.push(...t[n].children):r=t[n].children:r.push(t[n]);return this.append_none&&r.push(...b([null],this.append_none)),this.node_builder(r)}}const Nt=E(Tt);class Rt extends oe{constructor(t,r){super(),this.node_builder=r,this.to_include=t}__call__(t){let r=[];for(const[n,s]of this.to_include)s?r.length?r.push(...t[n].children):r=t[n].children:r.push(t[n]);return this.node_builder(r)}}const vt=E(Rt);function Et(i){return!i.is_term&&i.name.startsWith("_")}function Ot(i,t,r,n){let s,_;n.length?(_=n.map(p=>(0+p).toString()).join(""),s=_.split("0").map(p=>p.length)):s=b([0],i.length+1);let l=[],a=0;for(const[p,o]of I(i))a+=s[p],(t||!(o.is_term&&o.filter_out))&&(l.push([p,Et(o),a]),a=0);if(a+=s[i.length],n.length||l.length<i.length||He(l.map(([p,o,c])=>o)))return(n.length||r).length?B(r?kt:Nt,l,a):B(vt,l.map(([p,o,c])=>[p,o]))}function At(i){function t(r){let n=new m(i.name,r);return i(n)}return t=wraps(i)(t),t}function Pt(i,t,r){if(r===_vargs_meta||r===_vargs_meta_inline)throw new NotImplementedError("Meta args not supported for internal transformer");function n(s){return r(i,t,s,null)}return n=wraps(i)(n),n}class St{constructor(t,r,n=!1,s=!1,_=!1){this.tree_class=r,this.propagate_positions=n,this.ambiguous=s,this.maybe_placeholders=_,this.rule_builders=[...this._init_builders(t)]}*_init_builders(t){let r,n,s,_,l=bt(this.propagate_positions);for(const a of t)s=a.options,n=s.keep_all_tokens,r=s.expand1,_=[...Re(null,[r&&!a.alias&&xt,Ot(a.expansion,n,this.ambiguous,this.maybe_placeholders?s.empty_indices:[]),l])],yield[a,_]}create_callback(t=null){let r,n,s,_=new Map;for(const[l,a]of this.rule_builders){n=l.alias||l.options.template_source||l.origin.name,t&&t[n]?(r=t&&t[n],s=r&&r.visit_wrapper||null,s!==null?r=Pt(r,n,s):t instanceof Oe&&(r=At(r))):r=B(this.tree_class,n);for(const p of a)r=p(r);if(_.has(l))throw new F(u("Rule '%s' already exists",l));_.set(l,r)}return _}}class Ie extends y{constructor({parser_conf:t,debug:r=!1}={}){super();let n=new LALR_Analyzer({unknown_param_0:t,debug:r});n.compute_lalr();let s=t.callbacks;this._parse_table=n.parse_table,this.parser_conf=t,this.parser=new ze(n.parse_table,s,r)}static deserialize(t,r,n,s=!1){let _=V(this);return _._parse_table=zt.deserialize(t,r),_.parser=new ze(_._parse_table,n,s),_}serialize(t){return this._parse_table.serialize(t)}parse_interactive(t,r){return this.parser.parse({lexer:t,start:r,start_interactive:!0})}parse({lexer:t,start:r,on_error:n=null}={}){let s,_;try{return this.parser.parse({lexer:t,start:r})}catch(l){if(l instanceof N){if(n===null)throw l;for(;;){if(l instanceof O&&(_=l.interactive_parser.lexer_thread.state,s=_.line_ctr.char_pos),!n(l))throw l;l instanceof O&&s===_.line_ctr.char_pos&&_.line_ctr.feed(_.text.slice(s,s+1));try{return l.interactive_parser.resume_parse()}catch(a){if(a instanceof A){if(l instanceof A&&l.token.type===a.token.type&&a.token.type==="$END"&&l.interactive_parser.eq(a.interactive_parser))throw a;l=a}else if(a instanceof O)l=a;else throw a}}}else throw l}}}class Dt{constructor(t,r,n){this.parse_table=t,this.start_state=this.parse_table.start_states[n],this.end_state=this.parse_table.end_states[n],this.states=this.parse_table.states,this.callbacks=r,this.start=n}}class he{constructor(t,r,n=null,s=null){this.parse_conf=t,this.lexer=r,this.state_stack=n||[this.parse_conf.start_state],this.value_stack=s||[]}get position(){return d(this.state_stack)}eq(t){return t instanceof he?this.state_stack.length===t.state_stack.length&&this.position===t.position:D}copy(){return w(this)}feed_token(t,r=!1){let n,s,_,l,a,p,o,c,g,v,x=this.state_stack,S=this.value_stack,q=this.parse_conf.states,$e=this.parse_conf.end_state,G=this.parse_conf.callbacks;for(;;){if(g=d(x),t.type in q[g])[s,_]=q[g][t.type];else throw l=new Set(J(q[g]).filter(Z=>ve(Z)).map(Z=>Z)),new A({token:t,expected:l,state:this,interactive_parser:null});if(s===pe){x.push(_),S.push(t.type in G?G[t.type](t):t);return}else if(p=_,c=p.expansion.length,c?(o=S.slice(-c),x.splice(-c),S.splice(-c)):o=[],v=G.get(p)(o),[n,a]=q[d(x)][p.origin.name],x.push(a),S.push(v),r&&d(x)===$e)return d(S)}}}class ze{constructor(t,r,n=!1){this.parse_table=t,this.callbacks=r,this.debug=n}parse({lexer:t,start:r,value_stack:n=null,state_stack:s=null,start_interactive:_=!1}={}){let l=new Dt(this.parse_table,this.callbacks,r),a=new he(l,t,s,n);return _?new R(this,a,a.lexer):this.parse_from_state(a)}parse_from_state(t){let r,n;try{n=null;for(n of t.lexer.lex(t))t.feed_token(n);return r=n?h.new_borrow_pos("$END","",n):new h("$END","",0,1,1),t.feed_token(r,!0)}catch(s){if(s instanceof N){try{s.interactive_parser=new R(this,t,t.lexer)}catch(_){if(!(_ instanceof ReferenceError))throw _}throw s}else if(s instanceof Error){if(this.debug){console.log(""),console.log("STATE STACK DUMP"),console.log("----------------");for(const[_,l]of I(t.state_stack))console.log(u("%d)",_),l);console.log("")}throw s}else throw s}}}class R{constructor(t,r,n){this.parser=t,this.parser_state=r,this.lexer_thread=n,this.result=null}feed_token(t){return this.parser_state.feed_token(t,t.type==="$END")}*iter_parse(){for(const t of this.lexer_thread.lex(this.parser_state))yield t,this.result=this.feed_token(t)}exhaust_lexer(){return[...this.iter_parse()]}feed_eof(t=null){let r=t!==null?h.new_borrow_pos("$END","",t):new h("$END","",0,1,1);return this.feed_token(r)}copy(){return w(this)}eq(t){return t instanceof R?this.parser_state===t.parser_state&&this.lexer_thread===t.lexer_thread:!1}as_immutable(){let t=w(this);return new Le(t.parser,t.parser_state,t.lexer_thread)}pretty(){let t=["Parser choices:"];for(const[r,n]of f(this.choices()))t.push(u(" - %s -> %r",r,n));return t.push(u("stack size: %s",this.parser_state.state_stack.length)),t.join(`
|
|
20
|
+
`)}choices(){return this.parser_state.parse_conf.parse_table.states[this.parser_state.position]}accepts(){let t,r=new Set;for(const n of this.choices())if(ve(n)){t=w(this);let s=null;try{t.feed_token(new h(n,""))}catch(_){if(s=_,!(_ instanceof A))throw _}s||r.add(n)}return r}resume_parse(){return this.parser.parse_from_state(this.parser_state)}}class Le extends R{result=null;feed_token(t){let r=w(this);return r.result=R.feed_token(r,t),r}exhaust_lexer(){let t=this.as_mutable();return t.exhaust_lexer(),t.as_immutable()}as_mutable(){let t=w(this);return new R(t.parser,t.parser_state,t.lexer_thread)}}class qe{constructor(t){this.name=t}repr(){return this.toString()}}var pe=new qe("Shift"),je=new qe("Reduce");class It{constructor(t,r,n){this.states=t,this.start_states=r,this.end_states=n}serialize(t){let r=new Enumerator,n=Object.fromEntries(f(this.states).map(([s,_])=>[s,Object.fromEntries(f(_).map(([l,[a,p]])=>[we(r,l),a===je?[1,p.serialize(t)]:[0,p]]))]));return{tokens:r.reversed(),states:n,start_states:this.start_states,end_states:this.end_states}}static deserialize(t,r){const n=this;let s=t.tokens,_=Object.fromEntries(f(t.states).map(([l,a])=>[l,Object.fromEntries(f(a).map(([p,[o,c]])=>[s[p],o===1?[je,P.deserialize(c,r)]:[pe,c]]))]));return new n(_,t.start_states,t.end_states)}}class zt extends It{static from_ParseTable(t){const r=this;let n=[...t.states],s=Object.fromEntries(I(n).map(([p,o])=>[o,p])),_={};for(let[p,o]of f(t.states))o=Object.fromEntries(f(o).map(([c,g])=>[c,g[0]===pe?[g[0],s[g[1]]]:g])),_[s[p]]=o;let l=Object.fromEntries(f(t.start_states).map(([p,o])=>[p,s[o]])),a=Object.fromEntries(f(t.end_states).map(([p,o])=>[p,s[o]]));return new r(_,l,a)}}function Lt(i){if(i&&i.__future_interface__)return i;{class t extends M{constructor(n){super(),this.lexer=i(n)}lex(n,s){return this.lexer.lex(n.text)}}return t}}function qt(i,t,r,n,s){let _=Se.deserialize(i.parser_conf,t),l=Ie.deserialize(i.parser,t,n,s.debug);return _.callbacks=n,new jt({lexer_conf:r,parser_conf:_,options:s,parser:l})}var Ce={};class jt extends y{static get __serialize_fields__(){return["lexer_conf","parser_conf","parser"]}constructor({lexer_conf:t,parser_conf:r,options:n,parser:s=null}={}){super();let _,l;this.parser_conf=r,this.lexer_conf=t,this.options=n,s?this.parser=s:(l=we(Ce,r.parser_type),this.parser=l(t,r,n));let a=t.lexer_type;if(this.skip_lexer=!1,["dynamic","dynamic_complete"].includes(a)){this.skip_lexer=!0;return}const p={basic:Qt,contextual:Ut};a in p?(_=p[a],this.lexer=_(t,this.parser,t.postlex,n)):this.lexer=Lt(a)(t),t.postlex&&(this.lexer=new Ft(this.lexer,t.postlex))}_verify_start(t=null){let r;if(t===null){if(r=this.parser_conf.start,r.length>1)throw new T("Lark initialized with more than 1 possible start rule. Must specify which start rule to parse",r);[t]=r}else if(!this.parser_conf.start.includes(t))throw new T(u("Unknown start rule %s. Must be one of %r",t,this.parser_conf.start));return t}_make_lexer_thread(t){return this.skip_lexer?t:Ae.from_text(this.lexer,t)}parse(t,r=null,n=null){let s=this._verify_start(r),_=n===null?{}:{on_error:n},l=this._make_lexer_thread(t);return this.parser.parse({lexer:l,start:s,..._})}parse_interactive(t=null,r=null){let n=this._verify_start(r);if(this.parser_conf.parser_type!=="lalr")throw new T("parse_interactive() currently only works with parser='lalr' ");let s=this._make_lexer_thread(t);return this.parser.parse_interactive(s,n)}}function Ct(i,t){let r;ee(i,["lalr","earley","cyk"]),typeof t!="object"&&(r={lalr:["basic","contextual"],earley:["basic","dynamic","dynamic_complete"],cyk:["basic"]}[i],ee(t,r,u("Parser %r does not support lexer %%r, expected one of %%s",i)))}function Bt(i,t){let r,n={};for(const s of t)r=i&&i[s.name]||null,r!==null&&(n[s.name]=r);return n}class Ft{constructor(t,r){this.lexer=t,this.postlexer=r}lex(t,r){let n=this.lexer.lex(t,r);return this.postlexer.process(n)}}function Qt(i,t,r,n){return new W(i)}function Ut(i,t,r,n){let s=Object.fromEntries(f(t._parse_table.states).map(([l,a])=>[l,[...J(a)]])),_=r?r.always_accept:[];return new yt({conf:i,states:s,always_accept:_})}function $t(i,t,r=null){let n=r?r.debug:!1;return new Ie({parser_conf:t,debug:n})}Ce.lalr=$t;class Be extends xe{process(t){return t}always_accept=[]}class Mt extends y{OPTIONS_DOC='\n **=== General Options ===**\n\n start\n The start symbol. Either a string, or a list of strings for multiple possible starts (Default: "start")\n debug\n Display debug information and extra warnings. Use only when debugging (Default: ``False``)\n When used with Earley, it generates a forest graph as "sppf.png", if \'dot\' is installed.\n transformer\n Applies the transformer to every parse tree (equivalent to applying it after the parse, but faster)\n propagate_positions\n Propagates (line, column, end_line, end_column) attributes into all tree branches.\n Accepts ``False``, ``True``, or a callable, which will filter which nodes to ignore when propagating.\n maybe_placeholders\n When ``True``, the ``[]`` operator returns ``None`` when not matched.\n When ``False``, ``[]`` behaves like the ``?`` operator, and returns no value at all.\n (default= ``True``)\n cache\n Cache the results of the Lark grammar analysis, for x2 to x3 faster loading. LALR only for now.\n\n - When ``False``, does nothing (default)\n - When ``True``, caches to a temporary file in the local directory\n - When given a string, caches to the path pointed by the string\n regex\n When True, uses the ``regex`` module instead of the stdlib ``re``.\n g_regex_flags\n Flags that are applied to all terminals (both regex and strings)\n keep_all_tokens\n Prevent the tree builder from automagically removing "punctuation" tokens (Default: ``False``)\n tree_class\n Lark will produce trees comprised of instances of this class instead of the default ``lark.Tree``.\n\n **=== Algorithm Options ===**\n\n parser\n Decides which parser engine to use. Accepts "earley" or "lalr". (Default: "earley").\n (there is also a "cyk" option for legacy)\n lexer\n Decides whether or not to use a lexer stage\n\n - "auto" (default): Choose for me based on the parser\n - "basic": Use a basic lexer\n - "contextual": Stronger lexer (only works with parser="lalr")\n - "dynamic": Flexible and powerful (only with parser="earley")\n - "dynamic_complete": Same as dynamic, but tries *every* variation of tokenizing possible.\n ambiguity\n Decides how to handle ambiguity in the parse. Only relevant if parser="earley"\n\n - "resolve": The parser will automatically choose the simplest derivation\n (it chooses consistently: greedy for tokens, non-greedy for rules)\n - "explicit": The parser will return all derivations wrapped in "_ambig" tree nodes (i.e. a forest).\n - "forest": The parser will return the root of the shared packed parse forest.\n\n **=== Misc. / Domain Specific Options ===**\n\n postlex\n Lexer post-processing (Default: ``None``) Only works with the basic and contextual lexers.\n priority\n How priorities should be evaluated - "auto", ``None``, "normal", "invert" (Default: "auto")\n lexer_callbacks\n Dictionary of callbacks for the lexer. May alter tokens during lexing. Use with caution.\n use_bytes\n Accept an input of type ``bytes`` instead of ``str``.\n edit_terminals\n A callback for editing the terminals before parse.\n import_paths\n A List of either paths or loader functions to specify from where grammars are imported\n source_path\n Override the source of from where the grammar was loaded. Useful for relative imports and unconventional grammar loading\n **=== End of Options ===**\n ';_defaults={debug:!1,keep_all_tokens:!1,tree_class:null,cache:!1,postlex:null,parser:"earley",lexer:"auto",transformer:null,start:"start",priority:"auto",ambiguity:"auto",regex:!1,propagate_positions:!1,lexer_callbacks:{},maybe_placeholders:!0,edit_terminals:null,g_regex_flags:"",use_bytes:!1,import_paths:[],source_path:null,_plugins:null};constructor(t){super();let r,n=Te(t),s=this;for(const[_,l]of f(this._defaults))_ in n?(r=Ge(n,_),typeof l=="boolean"&&!["cache","use_bytes","propagate_positions"].includes(_)&&(r=Ne(r))):r=l,s[_]=r;if(typeof s.start=="string"&&(s.start=[s.start]),this.options=s,ee(this.parser,["earley","lalr","cyk",null]),this.parser==="earley"&&this.transformer)throw new T("Cannot specify an embedded transformer when using the Earley algorithm. Please use your transformer on the resulting parse tree, or use a different algorithm (i.e. LALR)");if(Object.keys(n).length)throw new T(u("Unknown options: %s",J(n)))}serialize(t){return this.options}static deserialize(t,r){const n=this;return new n(t)}}class Fe extends y{static get __serialize_fields__(){return["parser","rules","options"]}_build_lexer(t=!1){let r=this.lexer_conf;return t&&(r=w(r),r.ignore=[]),new W(r)}_prepare_callbacks(){this._callbacks=new Map,this.options.ambiguity!=="forest"&&(this._parse_tree_builder=new St(this.rules,this.options.tree_class||Ze(m),this.options.propagate_positions,this.options.parser!=="lalr"&&this.options.ambiguity==="explicit",this.options.maybe_placeholders),this._callbacks=this._parse_tree_builder.create_callback(this.options.transformer)),be(this._callbacks,Bt(this.options.transformer,this.terminals))}_deserialize_lexer_conf(t,r,n){let s=Pe.deserialize(t.lexer_conf,r);return s.callbacks=n.lexer_callbacks||{},s.re_module=n.regex?regex:de,s.use_bytes=n.use_bytes,s.g_regex_flags=n.g_regex_flags||"",s.skip_validation=!0,s.postlex=n.postlex,s}_load({f:t,...r}={}){let n;K(t)?n=t:n=pickle.load(t);let s=n.memo,_=n.data,l=nt.deserialize(s,{Rule:P,TerminalDef:$},{}),a=Te(_.options);return be(a,r),this.options=Mt.deserialize(a,l),this.rules=_.rules.map(p=>P.deserialize(p,l)),this.source_path="<deserialized>",Ct(this.options.parser,this.options.lexer),this.lexer_conf=this._deserialize_lexer_conf(_.parser,l,this.options),this.terminals=this.lexer_conf.terminals,this._prepare_callbacks(),this._terminals_dict=Object.fromEntries(this.terminals.map(p=>[p.name,p])),this.parser=qt(_.parser,l,this.lexer_conf,this._callbacks,this.options),this}static _load_from_dict({data:t,memo:r,...n}={}){return V(this)._load({f:{data:t,memo:r},...n})}repr(){return u("Lark(open(%r), parser=%r, lexer=%r, ...)",this.source_path,this.options.parser,this.options.lexer)}lex(t,r=!1){let n;!("lexer"in this)||r?n=this._build_lexer(r):n=this.lexer;let s=Ae.from_text(n,t).lex(null);return this.options.postlex?this.options.postlex.process(s):s}get_terminal(t){return this._terminals_dict[t]}parse_interactive(t=null,r=null){return this.parser.parse_interactive({unknown_param_0:t,start:r})}parse(t,r=null,n=null){return this.parser.parse(t,r,n)}}class Qe extends k{}class Ue extends Be{constructor(){super(),this.paren_level=0,this.indent_level=[0]}*handle_NL(t){if(this.paren_level>0)return;yield t;let r=X(t.value,`
|
|
21
|
+
`,1)[1],n=Y(r," ")+Y(r," ")*this.tab_len;if(n>d(this.indent_level))this.indent_level.push(n),yield h.new_borrow_pos(this.INDENT_type,r,t);else{for(;n<d(this.indent_level);)this.indent_level.pop(),yield h.new_borrow_pos(this.DEDENT_type,r,t);if(n!==d(this.indent_level))throw new Qe(u("Unexpected dedent to column %s. Expected dedent to %s",n,d(this.indent_level)))}}*_process(t){for(const r of t)r.type===this.NL_type?yield*this.handle_NL(r):yield r,this.OPEN_PAREN_types.includes(r.type)?this.paren_level+=1:this.CLOSE_PAREN_types.includes(r.type)&&(this.paren_level-=1);for(;this.indent_level.length>1;)this.indent_level.pop(),yield new h(this.DEDENT_type,"")}process(t){return this.paren_level=0,this.indent_level=[0],this._process(t)}get always_accept(){return[this.NL_type]}get NL_type(){throw new NotImplementedError}get OPEN_PAREN_types(){throw new NotImplementedError}get CLOSE_PAREN_types(){throw new NotImplementedError}get INDENT_type(){throw new NotImplementedError}get DEDENT_type(){throw new NotImplementedError}get tab_len(){throw new NotImplementedError}}class Wt extends Ue{static get NL_type(){return"_NEWLINE"}get NL_type(){return this.constructor.NL_type}static get OPEN_PAREN_types(){return["LPAR","LSQB","LBRACE"]}get OPEN_PAREN_types(){return this.constructor.OPEN_PAREN_types}static get CLOSE_PAREN_types(){return["RPAR","RSQB","RBRACE"]}get CLOSE_PAREN_types(){return this.constructor.CLOSE_PAREN_types}static get INDENT_type(){return"_INDENT"}get INDENT_type(){return this.constructor.INDENT_type}static get DEDENT_type(){return"_DEDENT"}get DEDENT_type(){return this.constructor.DEDENT_type}static get tab_len(){return 8}get tab_len(){return this.constructor.tab_len}}const Gt={Terminal:se,NonTerminal:ie,RuleOptions:U,PatternStr:le,PatternRE:ae,TerminalDef:$};var Zt={LarkError:k,ConfigurationError:T,GrammarError:F,ParseError:et,LexError:z,UnexpectedInput:N,UnexpectedEOF:tt,UnexpectedCharacters:O,UnexpectedToken:A,VisitError:te,Meta:Ee,Tree:m,Discard:j,Transformer:L,Transformer_InPlace:Oe,Transformer_NonRecursive:st,Transformer_InPlaceRecursive:it,VisitorBase:re,Visitor:_t,Visitor_Recursive:lt,Interpreter:at,Symbol:ne,Terminal:se,NonTerminal:ie,RuleOptions:U,Rule:P,Pattern:_e,PatternStr:le,PatternRE:ae,TerminalDef:$,Token:h,Lexer:M,LexerConf:Pe,ParserConf:Se,InteractiveParser:R,ImmutableInteractiveParser:Le,PostLex:Be,Lark:Fe,DedentError:Qe,Indenter:Ue,PythonIndenter:Wt,get_parser:Me},Jt={parser:{lexer_conf:{terminals:[{"@":0},{"@":1},{"@":2},{"@":3},{"@":4},{"@":5},{"@":6},{"@":7},{"@":8},{"@":9},{"@":10},{"@":11},{"@":12},{"@":13},{"@":14},{"@":15},{"@":16},{"@":17},{"@":18},{"@":19}],ignore:["WS"],g_regex_flags:0,use_bytes:!1,lexer_type:"contextual",__type__:"LexerConf"},parser_conf:{rules:[{"@":20},{"@":21},{"@":22},{"@":23},{"@":24},{"@":25},{"@":26},{"@":27},{"@":28},{"@":29},{"@":30},{"@":31},{"@":32},{"@":33},{"@":34},{"@":35},{"@":36},{"@":37},{"@":38},{"@":39},{"@":40},{"@":41},{"@":42},{"@":43},{"@":44},{"@":45},{"@":46},{"@":47},{"@":48}],start:["start"],parser_type:"lalr",__type__:"ParserConf"},parser:{tokens:{0:"STRING",1:"IDENTIFIER",2:"INT",3:"choice_ref",4:"$END",5:"RPAR",6:"LSQB",7:"RSQB",8:"question_id",9:"matrix_statement_id",10:"CONJUNCTION",11:"DOT",12:"top_level_expr",13:"LPAR",14:"OPERATOR",15:"TRUE",16:"__ANON_1",17:"__ANON_0",18:"__ANON_4",19:"question_choice_selected_value_comparison",20:"bool_const",21:"condition",22:"__ANON_5",23:"__ANON_3",24:"question_choice_selected",25:"selected_count_comparison",26:"FALSE",27:"question_choice_text_comparison",28:"NEGATION",29:"start",30:"__ANON_2",31:"bool_expr",32:"question_choice_text_comparison_case_insensitive",33:"choice_selection_count_comparison"},states:{0:{0:[0,25]},1:{1:[0,28],2:[0,23],3:[0,22]},2:{2:[0,21]},3:{2:[0,23],1:[0,28],3:[0,29]},4:{4:[1,{"@":44}],5:[1,{"@":44}]},5:{6:[0,19]},6:{2:[0,37]},7:{2:[0,23],3:[0,75],1:[0,28]},8:{5:[0,43]},9:{2:[0,70]},10:{5:[0,81]},11:{3:[0,50],2:[0,23],1:[0,28]},12:{7:[0,10]},13:{0:[0,34]},14:{2:[0,67]},15:{5:[1,{"@":23}],6:[1,{"@":23}]},16:{8:[0,46],9:[0,39],1:[0,82]},17:{10:[1,{"@":25}],4:[1,{"@":25}],5:[1,{"@":25}]},18:{6:[0,11],11:[0,74]},19:{2:[0,23],3:[0,53],1:[0,28]},20:{10:[0,24],4:[1,{"@":45}]},21:{10:[1,{"@":33}],4:[1,{"@":33}],5:[1,{"@":33}]},22:{7:[0,61]},23:{7:[1,{"@":20}]},24:{12:[0,77],13:[0,38]},25:{10:[1,{"@":31}],4:[1,{"@":31}],5:[1,{"@":31}]},26:{10:[1,{"@":24}],4:[1,{"@":24}],5:[1,{"@":24}]},27:{14:[0,6]},28:{7:[1,{"@":21}]},29:{7:[0,45]},30:{15:[0,33],16:[0,16],17:[0,31],18:[0,78],19:[0,41],20:[0,76],21:[0,52],22:[0,48],23:[0,72],24:[0,64],12:[0,84],25:[0,57],26:[0,36],27:[0,40],13:[0,38],28:[0,59],29:[0,42],30:[0,47],31:[0,68],32:[0,35],33:[0,54]},31:{8:[0,66],1:[0,82],9:[0,65]},32:{7:[0,8]},33:{10:[1,{"@":34}],4:[1,{"@":34}],5:[1,{"@":34}]},34:{10:[1,{"@":30}],4:[1,{"@":30}],5:[1,{"@":30}]},35:{10:[1,{"@":40}],4:[1,{"@":40}],5:[1,{"@":40}]},36:{10:[1,{"@":35}],4:[1,{"@":35}],5:[1,{"@":35}]},37:{10:[1,{"@":32}],4:[1,{"@":32}],5:[1,{"@":32}]},38:{15:[0,33],16:[0,16],17:[0,31],31:[0,62],18:[0,78],19:[0,41],20:[0,76],21:[0,52],22:[0,48],23:[0,72],24:[0,64],25:[0,57],26:[0,36],27:[0,40],28:[0,59],30:[0,47],32:[0,35],33:[0,54]},39:{5:[0,56]},40:{10:[1,{"@":39}],4:[1,{"@":39}],5:[1,{"@":39}]},41:{10:[1,{"@":38}],4:[1,{"@":38}],5:[1,{"@":38}]},42:{},43:{10:[1,{"@":27}],4:[1,{"@":27}],5:[1,{"@":27}]},44:{5:[0,17]},45:{5:[0,79]},46:{11:[0,74],5:[0,51]},47:{8:[0,71],1:[0,82]},48:{1:[0,82],8:[0,60]},49:{5:[0,26]},50:{7:[0,49]},51:{14:[0,14]},52:{10:[0,69],4:[1,{"@":43}],5:[1,{"@":43}]},53:{7:[0,44]},54:{10:[1,{"@":42}],4:[1,{"@":42}],5:[1,{"@":42}]},55:{2:[0,23],1:[0,28],3:[0,12]},56:{14:[0,9]},57:{10:[1,{"@":41}],4:[1,{"@":41}],5:[1,{"@":41}]},58:{6:[0,1]},59:{17:[0,85]},60:{6:[0,3]},61:{5:[0,73]},62:{5:[0,20]},63:{5:[0,80]},64:{10:[1,{"@":37}],4:[1,{"@":37}],5:[1,{"@":37}]},65:{6:[0,83]},66:{11:[0,74],6:[0,55]},67:{10:[1,{"@":28}],4:[1,{"@":28}],5:[1,{"@":28}]},68:{4:[1,{"@":48}]},69:{15:[0,33],16:[0,16],17:[0,31],18:[0,78],19:[0,41],20:[0,76],21:[0,52],22:[0,48],23:[0,72],24:[0,64],25:[0,57],26:[0,36],27:[0,40],28:[0,59],30:[0,47],32:[0,35],31:[0,4],33:[0,54]},70:{10:[1,{"@":29}],4:[1,{"@":29}],5:[1,{"@":29}]},71:{6:[0,7]},72:{8:[0,58],1:[0,82]},73:{14:[0,0]},74:{1:[0,15]},75:{7:[0,63]},76:{10:[1,{"@":36}],4:[1,{"@":36}],5:[1,{"@":36}]},77:{4:[1,{"@":46}]},78:{1:[0,82],8:[0,86]},79:{14:[0,2]},80:{14:[0,13]},81:{10:[1,{"@":26}],4:[1,{"@":26}],5:[1,{"@":26}]},82:{5:[1,{"@":22}],11:[1,{"@":22}],6:[1,{"@":22}]},83:{3:[0,32],2:[0,23],1:[0,28]},84:{4:[1,{"@":47}]},85:{8:[0,18],9:[0,5],1:[0,82]},86:{5:[0,27]}},start_states:{start:30},end_states:{start:42}},__type__:"ParsingFrontend"},rules:[{"@":20},{"@":21},{"@":22},{"@":23},{"@":24},{"@":25},{"@":26},{"@":27},{"@":28},{"@":29},{"@":30},{"@":31},{"@":32},{"@":33},{"@":34},{"@":35},{"@":36},{"@":37},{"@":38},{"@":39},{"@":40},{"@":41},{"@":42},{"@":43},{"@":44},{"@":45},{"@":46},{"@":47},{"@":48}],options:{debug:!1,keep_all_tokens:!1,tree_class:null,cache:!1,postlex:null,parser:"lalr",lexer:"contextual",transformer:null,start:["start"],priority:"normal",ambiguity:"auto",regex:!1,propagate_positions:!1,lexer_callbacks:{},maybe_placeholders:!1,edit_terminals:null,g_regex_flags:0,use_bytes:!1,import_paths:[],source_path:null,_plugins:{}},__type__:"Lark"},Vt={0:{name:"WS",pattern:{value:`(?:[ \f\r
|
|
22
|
+
])+`,flags:[],raw:null,_width:[1,4294967295],__type__:"PatternRE"},priority:0,__type__:"TerminalDef"},1:{name:"IDENTIFIER",pattern:{value:"[a-zA-Z][a-zA-Z0-9_]*[a-zA-Z0-9]",flags:[],raw:"/[a-zA-Z][a-zA-Z0-9_]*[a-zA-Z0-9]/",_width:[2,4294967295],__type__:"PatternRE"},priority:0,__type__:"TerminalDef"},2:{name:"INT",pattern:{value:"-?[0-9]+",flags:[],raw:"/-?[0-9]+/",_width:[1,4294967295],__type__:"PatternRE"},priority:0,__type__:"TerminalDef"},3:{name:"STRING",pattern:{value:`(?:'[^\\']*'|"[^"]*")`,flags:[],raw:null,_width:[2,4294967295],__type__:"PatternRE"},priority:0,__type__:"TerminalDef"},4:{name:"OPERATOR",pattern:{value:"(?:regex_matches|not_contains|contains|==|!=|<=|>=|<|>)",flags:[],raw:null,_width:[1,13],__type__:"PatternRE"},priority:0,__type__:"TerminalDef"},5:{name:"CONJUNCTION",pattern:{value:"(?:and|or)",flags:[],raw:null,_width:[2,3],__type__:"PatternRE"},priority:0,__type__:"TerminalDef"},6:{name:"NEGATION",pattern:{value:"!",flags:[],raw:'"!"',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},7:{name:"TRUE",pattern:{value:"true",flags:[],raw:'"true"',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},8:{name:"FALSE",pattern:{value:"false",flags:[],raw:'"false"',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},9:{name:"DOT",pattern:{value:".",flags:[],raw:'"."',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},10:{name:"__ANON_0",pattern:{value:"selected(",flags:[],raw:'"selected("',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},11:{name:"LSQB",pattern:{value:"[",flags:[],raw:'"["',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},12:{name:"RSQB",pattern:{value:"]",flags:[],raw:'"]"',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},13:{name:"RPAR",pattern:{value:")",flags:[],raw:'")"',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},14:{name:"__ANON_1",pattern:{value:"selected_value(",flags:[],raw:'"selected_value("',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},15:{name:"__ANON_2",pattern:{value:"text(",flags:[],raw:'"text("',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},16:{name:"__ANON_3",pattern:{value:"text_ignore_case(",flags:[],raw:'"text_ignore_case("',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},17:{name:"__ANON_4",pattern:{value:"count_selected(",flags:[],raw:'"count_selected("',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},18:{name:"__ANON_5",pattern:{value:"count_choice_selections(",flags:[],raw:'"count_choice_selections("',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},19:{name:"LPAR",pattern:{value:"(",flags:[],raw:'"("',__type__:"PatternStr"},priority:0,__type__:"TerminalDef"},20:{origin:{name:"choice_ref",__type__:"NonTerminal"},expansion:[{name:"INT",filter_out:!1,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},21:{origin:{name:"choice_ref",__type__:"NonTerminal"},expansion:[{name:"IDENTIFIER",filter_out:!1,__type__:"Terminal"}],order:1,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},22:{origin:{name:"question_id",__type__:"NonTerminal"},expansion:[{name:"IDENTIFIER",filter_out:!1,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},23:{origin:{name:"matrix_statement_id",__type__:"NonTerminal"},expansion:[{name:"question_id",__type__:"NonTerminal"},{name:"DOT",filter_out:!0,__type__:"Terminal"},{name:"IDENTIFIER",filter_out:!1,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},24:{origin:{name:"question_choice_selected",__type__:"NonTerminal"},expansion:[{name:"NEGATION",filter_out:!1,__type__:"Terminal"},{name:"__ANON_0",filter_out:!0,__type__:"Terminal"},{name:"question_id",__type__:"NonTerminal"},{name:"LSQB",filter_out:!0,__type__:"Terminal"},{name:"choice_ref",__type__:"NonTerminal"},{name:"RSQB",filter_out:!0,__type__:"Terminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},25:{origin:{name:"question_choice_selected",__type__:"NonTerminal"},expansion:[{name:"NEGATION",filter_out:!1,__type__:"Terminal"},{name:"__ANON_0",filter_out:!0,__type__:"Terminal"},{name:"matrix_statement_id",__type__:"NonTerminal"},{name:"LSQB",filter_out:!0,__type__:"Terminal"},{name:"choice_ref",__type__:"NonTerminal"},{name:"RSQB",filter_out:!0,__type__:"Terminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"}],order:1,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},26:{origin:{name:"question_choice_selected",__type__:"NonTerminal"},expansion:[{name:"__ANON_0",filter_out:!0,__type__:"Terminal"},{name:"question_id",__type__:"NonTerminal"},{name:"LSQB",filter_out:!0,__type__:"Terminal"},{name:"choice_ref",__type__:"NonTerminal"},{name:"RSQB",filter_out:!0,__type__:"Terminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"}],order:2,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},27:{origin:{name:"question_choice_selected",__type__:"NonTerminal"},expansion:[{name:"__ANON_0",filter_out:!0,__type__:"Terminal"},{name:"matrix_statement_id",__type__:"NonTerminal"},{name:"LSQB",filter_out:!0,__type__:"Terminal"},{name:"choice_ref",__type__:"NonTerminal"},{name:"RSQB",filter_out:!0,__type__:"Terminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"}],order:3,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},28:{origin:{name:"question_choice_selected_value_comparison",__type__:"NonTerminal"},expansion:[{name:"__ANON_1",filter_out:!0,__type__:"Terminal"},{name:"question_id",__type__:"NonTerminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"},{name:"OPERATOR",filter_out:!1,__type__:"Terminal"},{name:"INT",filter_out:!1,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},29:{origin:{name:"question_choice_selected_value_comparison",__type__:"NonTerminal"},expansion:[{name:"__ANON_1",filter_out:!0,__type__:"Terminal"},{name:"matrix_statement_id",__type__:"NonTerminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"},{name:"OPERATOR",filter_out:!1,__type__:"Terminal"},{name:"INT",filter_out:!1,__type__:"Terminal"}],order:1,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},30:{origin:{name:"question_choice_text_comparison",__type__:"NonTerminal"},expansion:[{name:"__ANON_2",filter_out:!0,__type__:"Terminal"},{name:"question_id",__type__:"NonTerminal"},{name:"LSQB",filter_out:!0,__type__:"Terminal"},{name:"choice_ref",__type__:"NonTerminal"},{name:"RSQB",filter_out:!0,__type__:"Terminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"},{name:"OPERATOR",filter_out:!1,__type__:"Terminal"},{name:"STRING",filter_out:!1,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},31:{origin:{name:"question_choice_text_comparison_case_insensitive",__type__:"NonTerminal"},expansion:[{name:"__ANON_3",filter_out:!0,__type__:"Terminal"},{name:"question_id",__type__:"NonTerminal"},{name:"LSQB",filter_out:!0,__type__:"Terminal"},{name:"choice_ref",__type__:"NonTerminal"},{name:"RSQB",filter_out:!0,__type__:"Terminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"},{name:"OPERATOR",filter_out:!1,__type__:"Terminal"},{name:"STRING",filter_out:!1,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},32:{origin:{name:"selected_count_comparison",__type__:"NonTerminal"},expansion:[{name:"__ANON_4",filter_out:!0,__type__:"Terminal"},{name:"question_id",__type__:"NonTerminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"},{name:"OPERATOR",filter_out:!1,__type__:"Terminal"},{name:"INT",filter_out:!1,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},33:{origin:{name:"choice_selection_count_comparison",__type__:"NonTerminal"},expansion:[{name:"__ANON_5",filter_out:!0,__type__:"Terminal"},{name:"question_id",__type__:"NonTerminal"},{name:"LSQB",filter_out:!0,__type__:"Terminal"},{name:"choice_ref",__type__:"NonTerminal"},{name:"RSQB",filter_out:!0,__type__:"Terminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"},{name:"OPERATOR",filter_out:!1,__type__:"Terminal"},{name:"INT",filter_out:!1,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},34:{origin:{name:"bool_const",__type__:"NonTerminal"},expansion:[{name:"TRUE",filter_out:!1,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},35:{origin:{name:"bool_const",__type__:"NonTerminal"},expansion:[{name:"FALSE",filter_out:!1,__type__:"Terminal"}],order:1,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},36:{origin:{name:"condition",__type__:"NonTerminal"},expansion:[{name:"bool_const",__type__:"NonTerminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},37:{origin:{name:"condition",__type__:"NonTerminal"},expansion:[{name:"question_choice_selected",__type__:"NonTerminal"}],order:1,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},38:{origin:{name:"condition",__type__:"NonTerminal"},expansion:[{name:"question_choice_selected_value_comparison",__type__:"NonTerminal"}],order:2,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},39:{origin:{name:"condition",__type__:"NonTerminal"},expansion:[{name:"question_choice_text_comparison",__type__:"NonTerminal"}],order:3,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},40:{origin:{name:"condition",__type__:"NonTerminal"},expansion:[{name:"question_choice_text_comparison_case_insensitive",__type__:"NonTerminal"}],order:4,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},41:{origin:{name:"condition",__type__:"NonTerminal"},expansion:[{name:"selected_count_comparison",__type__:"NonTerminal"}],order:5,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},42:{origin:{name:"condition",__type__:"NonTerminal"},expansion:[{name:"choice_selection_count_comparison",__type__:"NonTerminal"}],order:6,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},43:{origin:{name:"bool_expr",__type__:"NonTerminal"},expansion:[{name:"condition",__type__:"NonTerminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},44:{origin:{name:"bool_expr",__type__:"NonTerminal"},expansion:[{name:"condition",__type__:"NonTerminal"},{name:"CONJUNCTION",filter_out:!1,__type__:"Terminal"},{name:"bool_expr",__type__:"NonTerminal"}],order:1,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},45:{origin:{name:"top_level_expr",__type__:"NonTerminal"},expansion:[{name:"LPAR",filter_out:!0,__type__:"Terminal"},{name:"bool_expr",__type__:"NonTerminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},46:{origin:{name:"top_level_expr",__type__:"NonTerminal"},expansion:[{name:"LPAR",filter_out:!0,__type__:"Terminal"},{name:"bool_expr",__type__:"NonTerminal"},{name:"RPAR",filter_out:!0,__type__:"Terminal"},{name:"CONJUNCTION",filter_out:!1,__type__:"Terminal"},{name:"top_level_expr",__type__:"NonTerminal"}],order:1,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},47:{origin:{name:"start",__type__:"NonTerminal"},expansion:[{name:"top_level_expr",__type__:"NonTerminal"}],order:0,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"},48:{origin:{name:"start",__type__:"NonTerminal"},expansion:[{name:"bool_expr",__type__:"NonTerminal"}],order:1,alias:null,options:{keep_all_tokens:!1,expand1:!1,priority:null,template_source:null,empty_indices:[],__type__:"RuleOptions"},__type__:"Rule"}};export{h as Token,Zt as default};
|
|
23
23
|
//# sourceMappingURL=logic_parser.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{QuestionType as
|
|
1
|
+
import{QuestionType as l}from"../graphql/schema-types.generated.esm.js";import{getQuestionTypeEnum as f,extractQuestionNodes as q}from"./convertTemplateToNode.esm.js";import{hasAnswer as w,evaluateTemplateNode as h,getRelevantQuestionResponses as y}from"./evaluation.esm.js";const c=(s,e)=>e?`${s}.${e}`:s,g=(s,e,n,i)=>{if(!e.singleAnswer)return i?.warn("Response validation failed: No SingleAnswer provided in single answer question.",{surveyResponseId:n.surveyResponseId,questionId:e.questionId}),!1;const o=new Set(n.getQuestionChoicesFlattened(s).map(a=>a.id??a.value)),d=e.singleAnswer.choiceId??e.singleAnswer.choiceValue;return o.has(d)?!0:(i?.warn("Response validation failed: Selected choice in single answer question not available",{surveyResponseId:n.surveyResponseId,questionId:s.id,choiceKey:d}),!1)},M=(s,e,n,i)=>{if(!e.multipleAnswers)return i?.warn("Response validation failed: No MultipleAnswer provided in multi answer question",{surveyResponseId:n.surveyResponseId,questionId:e.questionId}),!1;const o=new Set(n.getQuestionChoicesFlattened(s).map(a=>a.id??a.value));let d=!1;return e.multipleAnswers.forEach(a=>{const u=a.choiceId??a.choiceValue;o.has(u)||(i?.warn("Response validation failed: Selected choice in multi answer question not available",{surveyResponseId:n.surveyResponseId,questionId:s.id,choiceKey:u}),d=!0)}),!d},S=(s,e,n)=>s.singleAnswer?.text?!0:(n?.warn("Response validation failed: No text provided",{surveyResponseId:e.surveyResponseId,questionId:s.questionId}),!1);function m(s,e,n,i){if(!w(e))return!0;switch(f(s.type)){case l.McSingle:case l.MatrixSingle:return g(s,e,n,i);case l.McMulti:case l.MatrixMulti:return M(s,e,n,i);case l.TextSingle:case l.TextMulti:return S(e,n,i);default:return i?.warn("Response validation failed: Unsupported question type",{questionId:s.id,questionType:s.type,surveyResponseId:n.surveyResponseId}),!1}}function A(s,e,n,i){const o={templateId:s.id,surveyResponseId:n.surveyResponseId};i?.debug("Validating response...",{questionResponses:e,...o});const d=h(s,n),a=q(d),u=y(d,e);if(new Set(u.map(t=>c(t.questionId,t.statementId))).size<u.length)return i?.warn("Response validation failed: Duplicate question/statement ID(s) in the response.",{relevantQuestionResponses:u,...o}),!1;const R=Object.fromEntries(a.filter(t=>t.id).map(t=>[t.id,t])),I=new Map;for(const t of u){const p=R[t.questionId];if(!p)return i?.warn("Response validation failed: Response provided to a question that's not in the template",{questionId:t.questionId,...o}),!1;let r=I.get(t.questionId);if(r===void 0&&(r=new Map(n.getQuestionStatementsFlattened(p).map(v=>[v.id,v])),I.set(t.questionId,r)),t.statementId){if(!r||!r.size)return i?.warn("Response validation failed: Response provided to a statement even to the question has no statements",{questionId:t.questionId,statementId:t.statementId,...o}),!1;if(!r.get(t.statementId))return i?.warn("Response validation failed: Response provided to an invalid question statement",{questionId:t.questionId,statementId:t.statementId,...o}),!1}else if(r&&r.size)return i?.warn("Response validation failed; Response provided to a question with statements but not statement provided.",{questionId:t.questionId,statementId:t.statementId,...o}),!1;if(!m(p,t,n,i))return!1}return!0}export{c as responseRef,m as validateQuestionResponse,A as validateResponse};
|
|
2
2
|
//# sourceMappingURL=validateResponse.esm.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import I from"ajv";import v from"ajv-formats";import{interpolateTemplate as q}from"./interpolation.esm.js";import{parseLocator as m,LOCATOR_EXPRESSION as f}from"./locators.esm.js";import{evaluateExpression as x,QUESTION_TEXT_LOCATOR_PATTERN as g}from"./logic.esm.js";import E from"./schema/survey-template-schema.json.esm.js";const p=new I({allowUnionTypes:!0});v(p);const w=p.compile(E);class u extends Error{}class r extends Error{}class l extends Error{}class c extends Error{}class _ extends Error{}class y{seenQuestions=new Set;seenMultiQuestions=new Set;seenQuestionStatements=new Map;seenQuestionChoices=new Map;seenTextChoices=new Map;evaluator={};constructor(){this.evaluator.isSelected=i=>(this.validateReference(i),!1),this.evaluator.countSelected=i=>(this.validateReference({questionId:i}),0),this.evaluator.selectedValue=i=>(this.validateReference({questionId:typeof i=="string"?i:i.questionId,statementId:typeof i=="string"?void 0:i.statementId,expectMulti:!1}),0),this.evaluator.countChoiceSelections=(i,s)=>(this.validateReference({questionId:i,choice:s}),0),this.evaluator.textEntry=i=>(this.validateReference({...i,expectText:!0}),"")}validateReference=i=>{if(!this.seenQuestions.has(i.questionId))throw new u(`Invalid question: ${i.questionId}`);if(i.statementId!==void 0&&!this.seenQuestionStatements.get(i.questionId)?.has(i.statementId))throw new u(`Invalid statement: ${i.questionId}.${i.statementId}`);if(i.choice!==void 0&&!this.seenQuestionChoices.get(i.questionId)?.has(i.choice))throw new u(`Invalid choice: ${i.questionId}[${i.choice}]`);if(i.choice!==void 0&&i.expectText===!0&&!this.seenTextChoices.get(i.questionId)?.has(i.choice))throw new u(`Invalid text reference: ${i.questionId}[${i.choice}]`);if(typeof i.expectMulti=="boolean"&&i.expectMulti&&!this.seenMultiQuestions.has(i.questionId))throw new r(`Invalid question reference: ${i.questionId}. Expected a multi-answer question.`);if(typeof i.expectMulti=="boolean"&&!i.expectMulti&&this.seenMultiQuestions.has(i.questionId))throw new r(`Invalid question reference: ${i.questionId}. Expected a non-multi-answer question.`)}}const d=(e,i,s)=>{if(s)try{x(s,e.evaluator)}catch(t){throw t instanceof u||t instanceof r||t instanceof c?t:new Error(`Syntax error parsing display logic at ${i}: ${s}`)}},Q=(e,i)=>{[...i.matchAll(g)].forEach(s=>{const t=m(s.groups.locator);if(!e.seenQuestions.has(t.questionId))throw new r(`Invalid question referenced in locator expression: ${t.questionId}/${t.expression}`);if(t.identifier&&!e.seenQuestionChoices.get(t.questionId)?.has(t.identifier))throw new r(`Invalid question choice referenced in locator expression: ${t.questionId}/${t.expression}(${t.identifier})`)})},h=(e,i,s)=>{if(s){const t=new Set(i);if(s.order){const o=s.order.split(" "),n=o.filter(a=>a==="$").length;if(n===0)throw new l(`Wildcard $ is missing in randomization order at ${e.id}`);if(n>1)throw new l(`Wildcard $ occurred multiples times in randomization order at ${e.id}`);if(o.forEach(a=>{if(a!=="$"&&!t.has(a))throw new l(`Unknown id ${a} in randomization ordering at ${e.id}`)}),s.total!==void 0&&s.total<o.length)throw new l(`Total value in randomization is too small at ${e.id}`)}}},$=(e,i)=>{const s=[f.FOR_MATRIX_CHOICE,f.UNSELECTED_FOR_MATRIX_CHOICE].includes(e.expression),t=(s?i.seenQuestionStatements:i.seenQuestionChoices).get(e.questionId);if(t===void 0)throw new r(`Invalid question referenced in locator expression: ${e.questionId}/${e.expression}`);if(s){const o=i.seenQuestionChoices.get(e.questionId);if(!e.identifier||!o?.has(e.identifier))throw new r(`Invalid choice referenced in locator expression: ${e.questionId}/${e.expression}(${e.identifier})`)}return t},S=(e,i)=>{if(Q(i,e.text),e.id!==void 0){if(d(i,e.id,e.display_logic),e.statements?.forEach(t=>{d(i,`${e.id}.${t.id}`,t.display_logic)}),e.choices?.forEach(t=>{d(i,`${e.id}[${t.id||t.value}]`,t.display_logic)}),e.type==="matrix-multi"||e.type==="matrix-single"?e.statement_groups?h(e,e.statement_groups.map(t=>t.id),e.randomization):h(e,e.statements?.map(t=>t.id)??[],e.randomization):e.choice_groups?h(e,e.choice_groups.map(t=>t.id),e.randomization):h(e,e.choices?.map(t=>`${t.id||t.value}`)??[],e.randomization),e.statement_groups?.forEach(t=>{t.statements.forEach(o=>{d(i,`${e.id}.${o.id}`,o.display_logic)}),h(e,t.statements.map(o=>o.id),t.randomization)}),e.choice_groups?.forEach(t=>{t.choices.forEach(o=>{d(i,`${e.id}[${o.id||o.value}]`,o.display_logic)}),h(e,t.choices.map(o=>`${o.id||o.value}`),t.randomization)}),i.seenQuestions.has(e.id))throw new c(`Duplicate question id: ${e.id}`);if(i.seenQuestions.add(e.id),e.type&&["matrix-multi","mc-multi"].includes(e.type)&&i.seenMultiQuestions.add(e.id),e.statements||e.dynamic_statements){const t=new Set;if(i.seenQuestionStatements.set(e.id,t),e.statements?.forEach(o=>{if(t.has(o.id))throw new c(`Duplicate statement id: ${e.id}.${o.id}`);t.add(o.id)}),e.dynamic_statements){const o=m(e.dynamic_statements);$(o,i).forEach(n=>{if(typeof n=="number")throw new r(`Dynamic statement in question ${e.id} refers to choices with values`);if(t.has(n))throw new c(`Duplicate statement ${n} via dynamic statements in question ${e.id}`);t.add(n)})}}const s=e.choices??[];if(e.choice_groups){if(new Set(e.choice_groups.map(t=>t.id)).size!==e.choice_groups.length)throw new c(`Choice groups must have a unique id in question ${e.id}`);e.choice_groups.forEach(t=>s.push(...t.choices))}if(s||e.dynamic_choices){const t=new Set;i.seenQuestionChoices.set(e.id,t);const o=new Set;if(i.seenTextChoices.set(e.id,o),s.forEach(n=>{const a=n.id??n.value;if(t.has(a))throw new c(`Duplicate choice: ${e.id}[${a}]`);t.add(a),n.text_input&&n.text_input!=="no"&&o.add(a)}),e.dynamic_choices){const n=m(e.dynamic_choices);$(n,i).forEach(a=>{if(t.has(a))throw new c(`Duplicate choice ${a} via dynamic choices in ${e.id}`);t.add(a)}),i.seenTextChoices.get(n.questionId)?.forEach(a=>o.add(a))}if(new Set([...t].map(n=>typeof n)).size>=2)throw new _("All choices in a question must either all have id's or all have values")}}},T=e=>{if(!w(e))throw new Error(`Invalid template: ${e.template.id}. Reason: ${JSON.stringify(w.errors,null,4)}`);q(e);const i=new y;e.sections.forEach(s=>{d(i,s.id,s.display_logic),s.pages.forEach(t=>{t.questions?.forEach(o=>{S(o,i)})})})};export{T as validateTemplate};
|
|
2
2
|
//# sourceMappingURL=validateTemplate.esm.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spotify/backstage-plugin-pulse-common",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.8",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
5
5
|
"homepage": "https://backstage.spotify.com",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -11,7 +11,13 @@
|
|
|
11
11
|
"types": "dist/index.d.ts"
|
|
12
12
|
},
|
|
13
13
|
"backstage": {
|
|
14
|
-
"role": "common-library"
|
|
14
|
+
"role": "common-library",
|
|
15
|
+
"pluginId": "pulse",
|
|
16
|
+
"pluginPackages": [
|
|
17
|
+
"@spotify/backstage-plugin-pulse",
|
|
18
|
+
"@spotify/backstage-plugin-pulse-backend",
|
|
19
|
+
"@spotify/backstage-plugin-pulse-common"
|
|
20
|
+
]
|
|
15
21
|
},
|
|
16
22
|
"sideEffects": false,
|
|
17
23
|
"scripts": {
|
|
@@ -25,7 +31,7 @@
|
|
|
25
31
|
},
|
|
26
32
|
"dependencies": {
|
|
27
33
|
"@backstage/config": "^1.2.0",
|
|
28
|
-
"@backstage/plugin-permission-common": "^0.
|
|
34
|
+
"@backstage/plugin-permission-common": "^0.8.0",
|
|
29
35
|
"@ungap/structured-clone": "^1.2.0",
|
|
30
36
|
"ajv": "^8.11.2",
|
|
31
37
|
"ajv-formats": "^3.0.0",
|
|
@@ -33,7 +39,7 @@
|
|
|
33
39
|
"lodash": "^4.17.21"
|
|
34
40
|
},
|
|
35
41
|
"devDependencies": {
|
|
36
|
-
"@backstage/cli": "^0.26.
|
|
42
|
+
"@backstage/cli": "^0.26.11",
|
|
37
43
|
"@types/ungap__structured-clone": "^1.0.0",
|
|
38
44
|
"js-yaml": "^4.1.0",
|
|
39
45
|
"json-schema-to-typescript": "^14.0.0",
|