@testsmith/testblocks 0.8.2 → 0.8.3

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.
@@ -833,7 +833,7 @@ Blockly.YourGeneratorName.nameDB_.setVariableMap(workspace.getVariableMap());`),
833
833
  `))this.quarkIds_=x;else{if(x.length!==C.length)throw RangeError("paramNames and paramIds must be the same length.");this.quarkIds_||(this.quarkConnections_={},this.quarkIds_=[]);for(let ge=0;ge<this.arguments_.length;ge++){var Y=this.getInput("ARG"+ge);Y&&(Y=Y.connection.targetConnection,this.quarkConnections_[this.quarkIds_[ge]]=Y,P&&Y&&!x.includes(this.quarkIds_[ge])&&(Y.disconnect(),Y.getSourceBlock().bumpNeighbours()))}for(this.arguments_=[].concat(C),this.argumentVarModels_=[],C=0;C<this.arguments_.length;C++)P=a.getOrCreateVariablePackage$$module$build$src$core$variables(this.workspace,null,this.arguments_[C],""),this.argumentVarModels_.push(P);if(this.updateShape_(),this.quarkIds_=x){for(x=0;x<this.arguments_.length;x++)if(C=this.quarkIds_[x],C in this.quarkConnections_){let ge;(ge=this.quarkConnections_[C])!=null&&ge.reconnect(this,"ARG"+x)||delete this.quarkConnections_[C]}}}},updateShape_:function(){for(var C=0;C<this.arguments_.length;C++){var x=this.getField("ARGNAME"+C);if(x){a.disable$$module$build$src$core$events$utils();try{x.setValue(this.arguments_[C])}finally{a.enable$$module$build$src$core$events$utils()}}else x=a.fromJson$$module$build$src$core$field_registry({type:"field_label",text:this.arguments_[C]}),this.appendValueInput("ARG"+C).setAlign(a.Align$$module$build$src$core$inputs$align.RIGHT).appendField(x,"ARGNAME"+C)}for(C=this.arguments_.length;this.getInput("ARG"+C);C++)this.removeInput("ARG"+C);(C=this.getInput("TOPROW"))&&(this.arguments_.length?this.getField("WITH")||C.appendField(a.Msg$$module$build$src$core$msg.PROCEDURES_CALL_BEFORE_PARAMS,"WITH"):this.getField("WITH")&&C.removeField("WITH"))},mutationToDom:function(){const C=a.createElement$$module$build$src$core$utils$xml("mutation");C.setAttribute("name",this.getProcedureCall());for(let x=0;x<this.arguments_.length;x++){const P=a.createElement$$module$build$src$core$utils$xml("arg");P.setAttribute("name",this.arguments_[x]),C.appendChild(P)}return C},domToMutation:function(C){var x=C.getAttribute("name");this.renameProcedure(this.getProcedureCall(),x),x=[];const P=[];for(let Y=0,ge;ge=C.childNodes[Y];Y++)ge.nodeName.toLowerCase()==="arg"&&(x.push(ge.getAttribute("name")),P.push(ge.getAttribute("paramId")));this.setProcedureParameters_(x,P)},saveExtraState:function(){const C=Object.create(null);return C.name=this.getProcedureCall(),this.arguments_.length&&(C.params=this.arguments_),C},loadExtraState:function(C){if(this.renameProcedure(this.getProcedureCall(),C.name),C=C.params){const x=[];x.length=C.length,x.fill(null),this.setProcedureParameters_(C,x)}},getVars:function(){return this.arguments_},getVarModels:function(){return this.argumentVarModels_},onchange:function(C){if(this.workspace&&!this.workspace.isFlyout&&C.recordUndo)if(C.type===a.BLOCK_CREATE$$module$build$src$core$events$events&&C.ids.includes(this.id)){var x=this.getProcedureCall(),P=a.getDefinition$$module$build$src$core$procedures(x,this.workspace);if(!P||P.type===this.defType_&&JSON.stringify(P.getVars())===JSON.stringify(this.arguments_)||(P=null),P)P.isEnabled()||(this.setDisabledReason(!0,we),this.setWarningText(a.Msg$$module$build$src$core$msg.PROCEDURES_CALL_DISABLED_DEF_WARNING.replace("%1",x)));else{a.setGroup$$module$build$src$core$events$utils(C.group),C=a.createElement$$module$build$src$core$utils$xml("xml"),x=a.createElement$$module$build$src$core$utils$xml("block"),x.setAttribute("type",this.defType_),P=this.getRelativeToSurfaceXY();var Y=P.y+a.config$$module$build$src$core$config.snapRadius*2;x.setAttribute("x",`${P.x+a.config$$module$build$src$core$config.snapRadius*(this.RTL?-1:1)}`),x.setAttribute("y",`${Y}`),P=this.mutationToDom(),x.appendChild(P),P=a.createElement$$module$build$src$core$utils$xml("field"),P.setAttribute("name","NAME"),Y=this.getProcedureCall();const ge=a.findLegalName$$module$build$src$core$procedures(Y,this);Y!==ge&&this.renameProcedure(Y,ge),P.appendChild(a.createTextNode$$module$build$src$core$utils$xml(Y)),x.appendChild(P),C.appendChild(x),a.domToWorkspace$$module$build$src$core$xml(C,this.workspace),a.setGroup$$module$build$src$core$events$utils(!1)}}else C.type===a.BLOCK_DELETE$$module$build$src$core$events$events?(x=this.getProcedureCall(),a.getDefinition$$module$build$src$core$procedures(x,this.workspace)||(a.setGroup$$module$build$src$core$events$utils(C.group),this.dispose(!0),a.setGroup$$module$build$src$core$events$utils(!1))):C.type===a.BLOCK_CHANGE$$module$build$src$core$events$events&&C.element==="disabled"&&(x=this.getProcedureCall(),(Y=a.getDefinition$$module$build$src$core$procedures(x,this.workspace))&&Y.id===C.blockId&&((P=a.getGroup$$module$build$src$core$events$utils())&&console.log("Saw an existing group while responding to a definition change"),a.setGroup$$module$build$src$core$events$utils(C.group),C=Y.isEnabled(),this.setDisabledReason(!C,we),this.setWarningText(C?null:a.Msg$$module$build$src$core$msg.PROCEDURES_CALL_DISABLED_DEF_WARNING.replace("%1",x)),a.setGroup$$module$build$src$core$events$utils(P)))},customContextMenu:function(C){if(this.workspace.isMovable()){var x=this.getProcedureCall(),P=this.workspace;C.push({enabled:!0,text:a.Msg$$module$build$src$core$msg.PROCEDURES_HIGHLIGHT_DEF,callback:function(){const Y=a.getDefinition$$module$build$src$core$procedures(x,P);Y&&(P.centerOnBlock(Y.id),a.getFocusManager$$module$build$src$core$focus_manager().focusNode(Y))}})}}};Ve.procedures_callnoreturn=Object.assign({},Qe,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME"),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setHelpUrl(a.Msg$$module$build$src$core$msg.PROCEDURES_CALLNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.quarkConnections_={},this.quarkIds_=null},defType_:"procedures_defnoreturn"}),Ve.procedures_callreturn=Object.assign({},Qe,{init:function(){this.appendDummyInput("TOPROW").appendField("","NAME"),this.setOutput(!0),this.setStyle("procedure_blocks"),this.setHelpUrl(a.Msg$$module$build$src$core$msg.PROCEDURES_CALLRETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.quarkConnections_={},this.quarkIds_=null},defType_:"procedures_defreturn"});var De="UNPARENTED_IFRETURN",me={init:function(){this.appendValueInput("CONDITION").setCheck("Boolean").appendField(a.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_IF),this.appendValueInput("VALUE").appendField(a.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setStyle("procedure_blocks"),this.setTooltip(a.Msg$$module$build$src$core$msg.PROCEDURES_IFRETURN_TOOLTIP),this.setHelpUrl(a.Msg$$module$build$src$core$msg.PROCEDURES_IFRETURN_HELPURL),this.hasReturnValue_=!0},mutationToDom:function(){const C=a.createElement$$module$build$src$core$utils$xml("mutation");return C.setAttribute("value",String(Number(this.hasReturnValue_))),C},domToMutation:function(C){this.hasReturnValue_=C.getAttribute("value")==="1",this.hasReturnValue_||(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(a.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN))},onchange:function(C){if(!(this.workspace.isDragging&&this.workspace.isDragging()||C.type!==a.BLOCK_MOVE$$module$build$src$core$events$events&&C.type!==a.BLOCK_CREATE$$module$build$src$core$events$events)){C=!1;var x=this;do{if(this.FUNCTION_TYPES.includes(x.type)){C=!0;break}x=x.getSurroundParent()}while(x);if(C?(x.type==="procedures_defnoreturn"&&this.hasReturnValue_?(this.removeInput("VALUE"),this.appendDummyInput("VALUE").appendField(a.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!1):x.type!=="procedures_defreturn"||this.hasReturnValue_||(this.removeInput("VALUE"),this.appendValueInput("VALUE").appendField(a.Msg$$module$build$src$core$msg.PROCEDURES_DEFRETURN_RETURN),this.hasReturnValue_=!0),this.setWarningText(null)):this.setWarningText(a.Msg$$module$build$src$core$msg.PROCEDURES_IFRETURN_WARNING),!this.isInFlyout)try{a.setRecordUndo$$module$build$src$core$events$utils(!1),this.setDisabledReason(!C,De)}finally{a.setRecordUndo$$module$build$src$core$events$utils(!0)}}},FUNCTION_TYPES:["procedures_defnoreturn","procedures_defreturn"]};Ve.procedures_ifreturn=me,a.defineBlocks$$module$build$src$core$common(Ve);var ue={blocks:Ve},Le=a.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD"],["%{BKY_MATH_SUBTRACTION_SYMBOL}","MINUS"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}","MULTIPLY"],["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE"],["%{BKY_MATH_POWER_SYMBOL}","POWER"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}","ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN"],["%{BKY_MATH_TRIG_COS}","COS"],["%{BKY_MATH_TRIG_TAN}","TAN"],["%{BKY_MATH_TRIG_ASIN}","ASIN"],["%{BKY_MATH_TRIG_ACOS}","ACOS"],["%{BKY_MATH_TRIG_ATAN}","ATAN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_TRIG_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_constant",message0:"%1",args0:[{type:"field_dropdown",name:"CONSTANT",options:[["π","PI"],["e","E"],["φ","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(½)","SQRT1_2"],["∞","INFINITY"]]}],output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTANT_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTANT_HELPURL}"},{type:"math_number_property",message0:"%1 %2",args0:[{type:"input_value",name:"NUMBER_TO_CHECK",check:"Number"},{type:"field_dropdown",name:"PROPERTY",options:[["%{BKY_MATH_IS_EVEN}","EVEN"],["%{BKY_MATH_IS_ODD}","ODD"],["%{BKY_MATH_IS_PRIME}","PRIME"],["%{BKY_MATH_IS_WHOLE}","WHOLE"],["%{BKY_MATH_IS_POSITIVE}","POSITIVE"],["%{BKY_MATH_IS_NEGATIVE}","NEGATIVE"],["%{BKY_MATH_IS_DIVISIBLE_BY}","DIVISIBLE_BY"]]}],inputsInline:!0,output:"Boolean",style:"math_blocks",tooltip:"%{BKY_MATH_IS_TOOLTIP}",mutator:"math_is_divisibleby_mutator"},{type:"math_change",message0:"%{BKY_MATH_CHANGE_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_MATH_CHANGE_TITLE_ITEM}"},{type:"input_value",name:"DELTA",check:"Number"}],previousStatement:null,nextStatement:null,style:"variable_blocks",helpUrl:"%{BKY_MATH_CHANGE_HELPURL}",extensions:["math_change_tooltip"]},{type:"math_round",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ROUND_OPERATOR_ROUND}","ROUND"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDUP}","ROUNDUP"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDDOWN}","ROUNDDOWN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ROUND_HELPURL}",tooltip:"%{BKY_MATH_ROUND_TOOLTIP}"},{type:"math_on_list",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ONLIST_OPERATOR_SUM}","SUM"],["%{BKY_MATH_ONLIST_OPERATOR_MIN}","MIN"],["%{BKY_MATH_ONLIST_OPERATOR_MAX}","MAX"],["%{BKY_MATH_ONLIST_OPERATOR_AVERAGE}","AVERAGE"],["%{BKY_MATH_ONLIST_OPERATOR_MEDIAN}","MEDIAN"],["%{BKY_MATH_ONLIST_OPERATOR_MODE}","MODE"],["%{BKY_MATH_ONLIST_OPERATOR_STD_DEV}","STD_DEV"],["%{BKY_MATH_ONLIST_OPERATOR_RANDOM}","RANDOM"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ONLIST_HELPURL}",mutator:"math_modes_of_list_mutator",extensions:["math_op_tooltip"]},{type:"math_modulo",message0:"%{BKY_MATH_MODULO_TITLE}",args0:[{type:"input_value",name:"DIVIDEND",check:"Number"},{type:"input_value",name:"DIVISOR",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_MODULO_TOOLTIP}",helpUrl:"%{BKY_MATH_MODULO_HELPURL}"},{type:"math_constrain",message0:"%{BKY_MATH_CONSTRAIN_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"Number"},{type:"input_value",name:"LOW",check:"Number"},{type:"input_value",name:"HIGH",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTRAIN_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTRAIN_HELPURL}"},{type:"math_random_int",message0:"%{BKY_MATH_RANDOM_INT_TITLE}",args0:[{type:"input_value",name:"FROM",check:"Number"},{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_INT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_INT_HELPURL}"},{type:"math_random_float",message0:"%{BKY_MATH_RANDOM_FLOAT_TITLE_RANDOM}",output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_FLOAT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_FLOAT_HELPURL}"},{type:"math_atan2",message0:"%{BKY_MATH_ATAN2_TITLE}",args0:[{type:"input_value",name:"X",check:"Number"},{type:"input_value",name:"Y",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_ATAN2_TOOLTIP}",helpUrl:"%{BKY_MATH_ATAN2_HELPURL}"}]),se={ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}",MULTIPLY:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}",DIVIDE:"%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}",POWER:"%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}",ROOT:"%{BKY_MATH_SINGLE_TOOLTIP_ROOT}",ABS:"%{BKY_MATH_SINGLE_TOOLTIP_ABS}",NEG:"%{BKY_MATH_SINGLE_TOOLTIP_NEG}",LN:"%{BKY_MATH_SINGLE_TOOLTIP_LN}",LOG10:"%{BKY_MATH_SINGLE_TOOLTIP_LOG10}",EXP:"%{BKY_MATH_SINGLE_TOOLTIP_EXP}",POW10:"%{BKY_MATH_SINGLE_TOOLTIP_POW10}",SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"};a.register$$module$build$src$core$extensions("math_op_tooltip",a.buildTooltipForDropdown$$module$build$src$core$extensions("OP",se));var Q={mutationToDom:function(){const C=a.createElement$$module$build$src$core$utils$xml("mutation"),x=this.getFieldValue("PROPERTY")==="DIVISIBLE_BY";return C.setAttribute("divisor_input",String(x)),C},domToMutation:function(C){C=C.getAttribute("divisor_input")==="true",this.updateShape_(C)},updateShape_:function(C){const x=this.getInput("DIVISOR");C?x||this.appendValueInput("DIVISOR").setCheck("Number"):x&&this.removeInput("DIVISOR")}},ce=function(){this.getField("PROPERTY").setValidator(function(C){C=C==="DIVISIBLE_BY",this.getSourceBlock().updateShape_(C)})};a.registerMutator$$module$build$src$core$extensions("math_is_divisibleby_mutator",Q,ce),a.register$$module$build$src$core$extensions("math_change_tooltip",a.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_MATH_CHANGE_TOOLTIP}","VAR"));var Ze={updateType_:function(C){C==="MODE"?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){const C=a.createElement$$module$build$src$core$utils$xml("mutation");return C.setAttribute("op",this.getFieldValue("OP")),C},domToMutation:function(C){if(C=C.getAttribute("op"),C===null)throw new TypeError("xmlElement had no op attribute");this.updateType_(C)}},Ae=function(){this.getField("OP").setValidator((function(C){this.updateType_(C)}).bind(this))};a.registerMutator$$module$build$src$core$extensions("math_modes_of_list_mutator",Ze,Ae),a.defineBlocks$$module$build$src$core$common(Le);var it={blocks:Le},ze=a.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",name:"TIMES",value:10,min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}","UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_for_tooltip"]},{type:"controls_forEach",message0:"%{BKY_CONTROLS_FOREACH_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"LIST",check:"Array"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",suppressPrefixSuffix:!0,extensions:["controls_flow_tooltip","controls_flow_in_loop_check"]}]),gt={WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"};a.register$$module$build$src$core$extensions("controls_whileUntil_tooltip",a.buildTooltipForDropdown$$module$build$src$core$extensions("MODE",gt));var rt={BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"};a.register$$module$build$src$core$extensions("controls_flow_tooltip",a.buildTooltipForDropdown$$module$build$src$core$extensions("FLOW",rt));var Ot={customContextMenu:function(C){if(!this.isInFlyout){var x=this.getField("VAR"),P=x.getVariable().getName();this.isCollapsed()||P===null||(x={type:"variables_get",fields:{VAR:x.saveState(!0)}},C.push({enabled:!0,text:a.Msg$$module$build$src$core$msg.VARIABLES_SET_CREATE_GET.replace("%1",P),callback:a.callbackFactory$$module$build$src$core$contextmenu(this,x)}))}}};a.registerMixin$$module$build$src$core$extensions("contextMenu_newGetVariableBlock",Ot),a.register$$module$build$src$core$extensions("controls_for_tooltip",a.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_CONTROLS_FOR_TOOLTIP}","VAR")),a.register$$module$build$src$core$extensions("controls_forEach_tooltip",a.buildTooltipWithFieldText$$module$build$src$core$extensions("%{BKY_CONTROLS_FOREACH_TOOLTIP}","VAR"));var qe=new Set(["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"]),Ut="CONTROL_FLOW_NOT_IN_LOOP",Oe={getSurroundLoop:function(){let C=this;do{if(qe.has(C.type))return C;C=C.getSurroundParent()}while(C);return null},onchange:function(C){const x=this.workspace;if(x.isDragging&&!x.isDragging()&&(C.type===a.BLOCK_MOVE$$module$build$src$core$events$events||C.type===a.BLOCK_CREATE$$module$build$src$core$events$events)&&(C=!!this.getSurroundLoop(),this.setWarningText(C?null:a.Msg$$module$build$src$core$msg.CONTROLS_FLOW_STATEMENTS_WARNING),!this.isInFlyout))try{a.setRecordUndo$$module$build$src$core$events$utils(!1),this.setDisabledReason(!C,Ut)}finally{a.setRecordUndo$$module$build$src$core$events$utils(!0)}}};a.registerMixin$$module$build$src$core$extensions("controls_flow_in_loop_check",Oe),a.defineBlocks$$module$build$src$core$common(ze);var L={blocks:ze,loopTypes:qe},ae=a.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"logic_boolean",message0:"%1",args0:[{type:"field_dropdown",name:"BOOL",options:[["%{BKY_LOGIC_BOOLEAN_TRUE}","TRUE"],["%{BKY_LOGIC_BOOLEAN_FALSE}","FALSE"]]}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_BOOLEAN_TOOLTIP}",helpUrl:"%{BKY_LOGIC_BOOLEAN_HELPURL}"},{type:"controls_if",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],previousStatement:null,nextStatement:null,style:"logic_blocks",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",suppressPrefixSuffix:!0,mutator:"controls_if_mutator",extensions:["controls_if_tooltip"]},{type:"controls_ifelse",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],message2:"%{BKY_CONTROLS_IF_MSG_ELSE} %1",args2:[{type:"input_statement",name:"ELSE"}],previousStatement:null,nextStatement:null,style:"logic_blocks",tooltip:"%{BKYCONTROLS_IF_TOOLTIP_2}",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",suppressPrefixSuffix:!0,extensions:["controls_if_tooltip"]},{type:"logic_compare",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A"},{type:"field_dropdown",name:"OP",options:[["=","EQ"],["≠","NEQ"],["‏<","LT"],["‏≤","LTE"],["‏>","GT"],["‏≥","GTE"]]},{type:"input_value",name:"B"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",check:"Boolean"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},{type:"logic_negate",message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",check:"Boolean"}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value",name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",extensions:["logic_ternary"]},{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",previousStatement:null,nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]),U={EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"};a.register$$module$build$src$core$extensions("logic_op_tooltip",a.buildTooltipForDropdown$$module$build$src$core$extensions("OP",U));var Te={elseifCount_:0,elseCount_:0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;const C=a.createElement$$module$build$src$core$utils$xml("mutation");return this.elseifCount_&&C.setAttribute("elseif",String(this.elseifCount_)),this.elseCount_&&C.setAttribute("else","1"),C},domToMutation:function(C){this.elseifCount_=parseInt(C.getAttribute("elseif"),10)||0,this.elseCount_=parseInt(C.getAttribute("else"),10)||0,this.rebuildShape_()},saveExtraState:function(){if(!this.elseifCount_&&!this.elseCount_)return null;const C=Object.create(null);return this.elseifCount_&&(C.elseIfCount=this.elseifCount_),this.elseCount_&&(C.hasElse=!0),C},loadExtraState:function(C){this.elseifCount_=C.elseIfCount||0,this.elseCount_=C.hasElse?1:0,this.updateShape_()},decompose:function(C){const x=C.newBlock("controls_if_if");x.initSvg();let P=x.nextConnection;for(let Y=1;Y<=this.elseifCount_;Y++){const ge=C.newBlock("controls_if_elseif");ge.initSvg(),P.connect(ge.previousConnection),P=ge.nextConnection}return this.elseCount_&&(C=C.newBlock("controls_if_else"),C.initSvg(),P.connect(C.previousConnection)),x},compose:function(C){C=C.nextConnection.targetBlock(),this.elseCount_=this.elseifCount_=0;const x=[null],P=[null];let Y=null;for(;C;){if(!C.isInsertionMarker())switch(C.type){case"controls_if_elseif":this.elseifCount_++,x.push(C.valueConnection_),P.push(C.statementConnection_);break;case"controls_if_else":this.elseCount_++,Y=C.statementConnection_;break;default:throw TypeError("Unknown block type: "+C.type)}C=C.getNextBlock()}this.updateShape_(),this.reconnectChildBlocks_(x,P,Y)},saveConnections:function(C){C=C.nextConnection.targetBlock();let x=1;for(;C;){if(!C.isInsertionMarker())switch(C.type){case"controls_if_elseif":var P=this.getInput("IF"+x);const Y=this.getInput("DO"+x);C.valueConnection_=P&&P.connection.targetConnection,C.statementConnection_=Y&&Y.connection.targetConnection,x++;break;case"controls_if_else":P=this.getInput("ELSE"),C.statementConnection_=P&&P.connection.targetConnection;break;default:throw TypeError("Unknown block type: "+C.type)}C=C.getNextBlock()}},rebuildShape_:function(){const C=[null],x=[null];let P=null;this.getInput("ELSE")&&(P=this.getInput("ELSE").connection.targetConnection);for(let Y=1;this.getInput("IF"+Y);Y++){const ge=this.getInput("IF"+Y),$=this.getInput("DO"+Y);C.push(ge.connection.targetConnection),x.push($.connection.targetConnection)}this.updateShape_(),this.reconnectChildBlocks_(C,x,P)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var C=1;this.getInput("IF"+C);C++)this.removeInput("IF"+C),this.removeInput("DO"+C);for(C=1;C<=this.elseifCount_;C++)this.appendValueInput("IF"+C).setCheck("Boolean").appendField(a.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+C).appendField(a.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(a.Msg$$module$build$src$core$msg.CONTROLS_IF_MSG_ELSE)},reconnectChildBlocks_:function(C,x,P){for(let Y=1;Y<=this.elseifCount_;Y++){let ge;(ge=C[Y])==null||ge.reconnect(this,"IF"+Y);let $;($=x[Y])==null||$.reconnect(this,"DO"+Y)}P==null||P.reconnect(this,"ELSE")}};a.registerMutator$$module$build$src$core$extensions("controls_if_mutator",Te,null,["controls_if_elseif","controls_if_else"]);var ne=function(){this.setTooltip((function(){if(this.elseifCount_||this.elseCount_){if(!this.elseifCount_&&this.elseCount_)return a.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_2;if(this.elseifCount_&&!this.elseCount_)return a.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_3;if(this.elseifCount_&&this.elseCount_)return a.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_4}else return a.Msg$$module$build$src$core$msg.CONTROLS_IF_TOOLTIP_1;return""}).bind(this))};a.register$$module$build$src$core$extensions("controls_if_tooltip",ne);var fe={onchange:function(C){this.prevBlocks_||(this.prevBlocks_=[null,null]);var x=this.getInputTargetBlock("A");const P=this.getInputTargetBlock("B");x&&P&&!this.workspace.connectionChecker.doTypeChecks(x.outputConnection,P.outputConnection)&&(a.setGroup$$module$build$src$core$events$utils(C.group),C=this.prevBlocks_[0],C!==x&&(x.unplug(),!C||C.isDisposed()||C.isShadow()||this.getInput("A").connection.connect(C.outputConnection)),x=this.prevBlocks_[1],x!==P&&(P.unplug(),!x||x.isDisposed()||x.isShadow()||this.getInput("B").connection.connect(x.outputConnection)),this.bumpNeighbours(),a.setGroup$$module$build$src$core$events$utils(!1)),this.prevBlocks_[0]=this.getInputTargetBlock("A"),this.prevBlocks_[1]=this.getInputTargetBlock("B")}},Ue=function(){this.mixin(fe)};a.register$$module$build$src$core$extensions("logic_compare",Ue);var Ne={prevParentConnection_:null,onchange:function(C){const x=this.getInputTargetBlock("THEN"),P=this.getInputTargetBlock("ELSE"),Y=this.outputConnection.targetConnection;if((x||P)&&Y)for(let ge=0;ge<2;ge++){const $=ge===1?x:P;$&&!$.workspace.connectionChecker.doTypeChecks($.outputConnection,Y)&&(a.setGroup$$module$build$src$core$events$utils(C.group),Y===this.prevParentConnection_?(this.unplug(),Y.getSourceBlock().bumpNeighbours()):($.unplug(),$.bumpNeighbours()),a.setGroup$$module$build$src$core$events$utils(!1))}this.prevParentConnection_=Y}};a.registerMixin$$module$build$src$core$extensions("logic_ternary",Ne),a.defineBlocks$$module$build$src$core$common(ae);var pe={blocks:ae},$e=a.createBlockDefinitionsFromJsonArray$$module$build$src$core$common([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM"},{type:"input_value",name:"NUM",check:"Number"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_LISTS_REPEAT_HELPURL}"},{type:"lists_reverse",message0:"%{BKY_LISTS_REVERSE_MESSAGE0}",args0:[{type:"input_value",name:"LIST",check:"Array"}],output:"Array",inputsInline:!0,style:"list_blocks",tooltip:"%{BKY_LISTS_REVERSE_TOOLTIP}",helpUrl:"%{BKY_LISTS_REVERSE_HELPURL}"},{type:"lists_isEmpty",message0:"%{BKY_LISTS_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"list_blocks",tooltip:"%{BKY_LISTS_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_ISEMPTY_HELPURL}"},{type:"lists_length",message0:"%{BKY_LISTS_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",style:"list_blocks",tooltip:"%{BKY_LISTS_LENGTH_TOOLTIP}",helpUrl:"%{BKY_LISTS_LENGTH_HELPURL}"}]),et={init:function(){this.setHelpUrl(a.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_HELPURL),this.setStyle("list_blocks"),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new a.MutatorIcon$$module$build$src$core$icons$mutator_icon(["lists_create_with_item"],this)),this.setTooltip(a.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){const C=a.createElement$$module$build$src$core$utils$xml("mutation");return C.setAttribute("items",String(this.itemCount_)),C},domToMutation:function(C){if(C=C.getAttribute("items"),!C)throw new TypeError("element did not have items");this.itemCount_=parseInt(C,10),this.updateShape_()},saveExtraState:function(){return{itemCount:this.itemCount_}},loadExtraState:function(C){this.itemCount_=C.itemCount,this.updateShape_()},decompose:function(C){const x=C.newBlock("lists_create_with_container");x.initSvg();let P=x.getInput("STACK").connection;for(let Y=0;Y<this.itemCount_;Y++){const ge=C.newBlock("lists_create_with_item");if(ge.initSvg(),!ge.previousConnection)throw Error("itemBlock has no previousConnection");P.connect(ge.previousConnection),P=ge.nextConnection}return x},compose:function(C){var x=C.getInputTargetBlock("STACK");for(C=[];x;)x.isInsertionMarker()||C.push(x.valueConnection_),x=x.getNextBlock();for(x=0;x<this.itemCount_;x++){const P=this.getInput("ADD"+x).connection.targetConnection;P&&!C.includes(P)&&P.disconnect()}for(this.itemCount_=C.length,this.updateShape_(),x=0;x<this.itemCount_;x++){let P;(P=C[x])==null||P.reconnect(this,"ADD"+x)}},saveConnections:function(C){C=C.getInputTargetBlock("STACK");let x=0;for(;C;){if(C.isInsertionMarker()){C=C.getNextBlock();continue}const P=this.getInput("ADD"+x);let Y;C.valueConnection_=(Y=P)==null?void 0:Y.connection.targetConnection,C=C.getNextBlock(),x++}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(a.Msg$$module$build$src$core$msg.LISTS_CREATE_EMPTY_TITLE);for(var C=0;C<this.itemCount_;C++)if(!this.getInput("ADD"+C)){const x=this.appendValueInput("ADD"+C).setAlign(a.Align$$module$build$src$core$inputs$align.RIGHT);C===0&&x.appendField(a.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_INPUT_WITH)}for(C=this.itemCount_;this.getInput("ADD"+C);C++)this.removeInput("ADD"+C)}};$e.lists_create_with=et;var M={init:function(){this.setStyle("list_blocks"),this.appendDummyInput().appendField(a.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD),this.appendStatementInput("STACK"),this.setTooltip(a.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}};$e.lists_create_with_container=M;var h={init:function(){this.setStyle("list_blocks"),this.appendDummyInput().appendField(a.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(a.Msg$$module$build$src$core$msg.LISTS_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}};$e.lists_create_with_item=h;var w={init:function(){var C=[[a.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_FIRST,"FIRST"],[a.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_LAST,"LAST"]];if(this.setHelpUrl(a.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_HELPURL),this.setStyle("list_blocks"),this.setOutput(!0,"Number"),this.appendValueInput("VALUE").setCheck("Array").appendField(a.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_INPUT_IN_LIST),C=a.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:C}),!C)throw Error("field_dropdown not found");this.appendValueInput("FIND").appendField(C,"END"),this.setInputsInline(!0),this.setTooltip(()=>a.Msg$$module$build$src$core$msg.LISTS_INDEX_OF_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"0":"-1"))}};$e.lists_indexOf=w;var Z={init:function(){var C=[[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_GET,"GET"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.WHERE_OPTIONS=[[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FIRST,"FIRST"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_LAST,"LAST"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]],this.setHelpUrl(a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_HELPURL),this.setStyle("list_blocks"),C=a.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:C}),C.setValidator(function(x){x=x==="REMOVE",this.getSourceBlock().updateStatement_(x)}),this.appendValueInput("VALUE").setCheck("Array").appendField(a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_INPUT_IN_LIST),this.appendDummyInput().appendField(C,"MODE").appendField("","SPACE"),C=a.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this.WHERE_OPTIONS}),C.setValidator(function(x){const P=this.getValue();x=x==="FROM_START"||x==="FROM_END",x!==(P==="FROM_START"||P==="FROM_END")&&this.getSourceBlock().updateAt_(x)}),this.appendDummyInput().appendField(C,"WHERE"),this.appendDummyInput("AT"),a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField(a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL),this.setInputsInline(!0),this.setOutput(!0),this.updateAt_(!0),this.setTooltip(()=>{const x=this.getFieldValue("MODE"),P=this.getFieldValue("WHERE");let Y="";switch(x+" "+P){case"GET FROM_START":case"GET FROM_END":Y=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM;break;case"GET FIRST":Y=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;break;case"GET LAST":Y=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST;break;case"GET RANDOM":Y=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case"GET_REMOVE FROM_START":case"GET_REMOVE FROM_END":Y=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case"GET_REMOVE FIRST":Y=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;break;case"GET_REMOVE LAST":Y=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST;break;case"GET_REMOVE RANDOM":Y=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM;break;case"REMOVE FROM_START":case"REMOVE FROM_END":Y=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM;break;case"REMOVE FIRST":Y=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST;break;case"REMOVE LAST":Y=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST;break;case"REMOVE RANDOM":Y=a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM}return(P==="FROM_START"||P==="FROM_END")&&(Y+=" "+(P==="FROM_START"?a.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_START_TOOLTIP:a.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_END_TOOLTIP).replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),Y})},mutationToDom:function(){const C=a.createElement$$module$build$src$core$utils$xml("mutation");C.setAttribute("statement",String(!this.outputConnection));const x=this.getInput("AT")instanceof a.ValueInput$$module$build$src$core$inputs$value_input;return C.setAttribute("at",String(x)),C},domToMutation:function(C){const x=C.getAttribute("statement")==="true";this.updateStatement_(x),C=C.getAttribute("at")!=="false",this.updateAt_(C)},saveExtraState:function(){return this.outputConnection?null:{isStatement:!0}},loadExtraState:function(C){C.isStatement?this.updateStatement_(!0):typeof C=="string"&&this.domToMutation(a.textToDom$$module$build$src$core$utils$xml(C))},updateStatement_:function(C){C!==!this.outputConnection&&(this.unplug(!0,!0),C?(this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)):(this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)))},updateAt_:function(C){this.removeInput("AT"),this.removeInput("ORDINAL",!0),C?(this.appendValueInput("AT").setCheck("Number"),a.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(a.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"),a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}};$e.lists_getIndex=Z;var H={init:function(){var C=[[a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_SET,"SET"],[a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_INSERT,"INSERT"]];this.WHERE_OPTIONS=[[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_FIRST,"FIRST"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_LAST,"LAST"],[a.Msg$$module$build$src$core$msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]],this.setHelpUrl(a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("LIST").setCheck("Array").appendField(a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_INPUT_IN_LIST),C=a.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:C}),this.appendDummyInput().appendField(C,"MODE").appendField("","SPACE"),C=a.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this.WHERE_OPTIONS}),C.setValidator(function(x){const P=this.getValue();x=x==="FROM_START"||x==="FROM_END",x!==(P==="FROM_START"||P==="FROM_END")&&this.getSourceBlock().updateAt_(x)}),this.appendDummyInput().appendField(C,"WHERE"),this.appendDummyInput("AT"),this.appendValueInput("TO").appendField(a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_INPUT_TO),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP),this.updateAt_(!0),this.setTooltip(()=>{const x=this.getFieldValue("MODE"),P=this.getFieldValue("WHERE");let Y="";switch(x+" "+P){case"SET FROM_START":case"SET FROM_END":Y=a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM;break;case"SET FIRST":Y=a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;break;case"SET LAST":Y=a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST;break;case"SET RANDOM":Y=a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;break;case"INSERT FROM_START":case"INSERT FROM_END":Y=a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;break;case"INSERT FIRST":Y=a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;break;case"INSERT LAST":Y=a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;break;case"INSERT RANDOM":Y=a.Msg$$module$build$src$core$msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM}return(P==="FROM_START"||P==="FROM_END")&&(Y+=" "+a.Msg$$module$build$src$core$msg.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",this.workspace.options.oneBasedIndex?"#1":"#0")),Y})},mutationToDom:function(){const C=a.createElement$$module$build$src$core$utils$xml("mutation"),x=this.getInput("AT")instanceof a.ValueInput$$module$build$src$core$inputs$value_input;return C.setAttribute("at",String(x)),C},domToMutation:function(C){C=C.getAttribute("at")!=="false",this.updateAt_(C)},saveExtraState:function(){return null},loadExtraState:function(){},updateAt_:function(C){this.removeInput("AT"),this.removeInput("ORDINAL",!0),C?(this.appendValueInput("AT").setCheck("Number"),a.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(a.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"),this.moveInputBefore("AT","TO"),this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL","TO")}};$e.lists_setIndex=H;var Re={init:function(){this.WHERE_OPTIONS_1=[[a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]],this.setHelpUrl(a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("LIST").setCheck("Array").appendField(a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_INPUT_IN_LIST);const C=x=>{const P=a.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:this["WHERE_OPTIONS_"+x]});return P.setValidator(function(Y){const ge=this.getValue();Y=Y==="FROM_START"||Y==="FROM_END",Y!==(ge==="FROM_START"||ge==="FROM_END")&&this.getSourceBlock().updateAt_(x,Y)}),P};this.appendDummyInput("WHERE1_INPUT").appendField(C(1),"WHERE1"),this.appendDummyInput("AT1"),this.appendDummyInput("WHERE2_INPUT").appendField(C(2),"WHERE2"),this.appendDummyInput("AT2"),a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL&&this.appendDummyInput("TAIL").appendField(a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL),this.setInputsInline(!0),this.setOutput(!0,"Array"),this.updateAt_(1,!0),this.updateAt_(2,!0),this.setTooltip(a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){const C=a.createElement$$module$build$src$core$utils$xml("mutation");var x=this.getInput("AT1")instanceof a.ValueInput$$module$build$src$core$inputs$value_input;return C.setAttribute("at1",String(x)),x=this.getInput("AT2")instanceof a.ValueInput$$module$build$src$core$inputs$value_input,C.setAttribute("at2",String(x)),C},domToMutation:function(C){const x=C.getAttribute("at1")==="true";C=C.getAttribute("at2")==="true",this.updateAt_(1,x),this.updateAt_(2,C)},saveExtraState:function(){return null},loadExtraState:function(){},updateAt_:function(C,x){this.removeInput("AT"+C),this.removeInput("ORDINAL"+C,!0),x?(this.appendValueInput("AT"+C).setCheck("Number"),a.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+C).appendField(a.Msg$$module$build$src$core$msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+C),C===1&&(this.moveInputBefore("AT1","WHERE2_INPUT"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","WHERE2_INPUT")),a.Msg$$module$build$src$core$msg.LISTS_GET_SUBLIST_TAIL&&this.moveInputBefore("TAIL",null)}};$e.lists_getSublist=Re,$e.lists_sort={init:function(){this.jsonInit({message0:"%{BKY_LISTS_SORT_TITLE}",args0:[{type:"field_dropdown",name:"TYPE",options:[["%{BKY_LISTS_SORT_TYPE_NUMERIC}","NUMERIC"],["%{BKY_LISTS_SORT_TYPE_TEXT}","TEXT"],["%{BKY_LISTS_SORT_TYPE_IGNORECASE}","IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[["%{BKY_LISTS_SORT_ORDER_ASCENDING}","1"],["%{BKY_LISTS_SORT_ORDER_DESCENDING}","-1"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_SORT_TOOLTIP}",helpUrl:"%{BKY_LISTS_SORT_HELPURL}"})}},$e.lists_split={init:function(){const C=a.fromJson$$module$build$src$core$field_registry({type:"field_dropdown",options:[[a.Msg$$module$build$src$core$msg.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[a.Msg$$module$build$src$core$msg.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]]});if(!C)throw Error("field_dropdown not found");C.setValidator(x=>{this.updateType_(x)}),this.setHelpUrl(a.Msg$$module$build$src$core$msg.LISTS_SPLIT_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("INPUT").setCheck("String").appendField(C,"MODE"),this.appendValueInput("DELIM").setCheck("String").appendField(a.Msg$$module$build$src$core$msg.LISTS_SPLIT_WITH_DELIMITER),this.setInputsInline(!0),this.setOutput(!0,"Array"),this.setTooltip(()=>{const x=this.getFieldValue("MODE");if(x==="SPLIT")return a.Msg$$module$build$src$core$msg.LISTS_SPLIT_TOOLTIP_SPLIT;if(x==="JOIN")return a.Msg$$module$build$src$core$msg.LISTS_SPLIT_TOOLTIP_JOIN;throw Error("Unknown mode: "+x)})},updateType_:function(C){if(this.getFieldValue("MODE")!==C){const x=this.getInput("INPUT").connection;x.setShadowDom(null);const P=x.targetBlock();P&&(x.disconnect(),P.isShadow()?P.dispose(!1):this.bumpNeighbours())}C==="SPLIT"?(this.outputConnection.setCheck("Array"),this.getInput("INPUT").setCheck("String")):(this.outputConnection.setCheck("String"),this.getInput("INPUT").setCheck("Array"))},mutationToDom:function(){const C=a.createElement$$module$build$src$core$utils$xml("mutation");return C.setAttribute("mode",this.getFieldValue("MODE")),C},domToMutation:function(C){this.updateType_(C.getAttribute("mode"))},saveExtraState:function(){return{mode:this.getFieldValue("MODE")}},loadExtraState:function(C){this.updateType_(C.mode)}},a.defineBlocks$$module$build$src$core$common($e);var _e={blocks:$e},lt=Object.assign({},$e,ae,ze,Le,Ve,re,ee,v),Ye={blocks:lt,lists:_e,logic:pe,loops:L,math:it,procedures:ue,texts:ve,variables:X,variablesDynamic:j};return Ye.__namespace__=a,Ye})})(A$)),A$.exports}var FT=N$.exports,D_;function BT(){return D_||(D_=1,(function(f,g){(function(i,a){f.exports=a(Ml(),DT(),PT())})(FT,function(i,a,v){return i.setLocale(a),i})})(N$)),N$.exports}var UT=BT();const VT=P$(UT),{Block:ev,BlockFlyoutInflater:tv,BlockNavigationPolicy:rv,BlockSvg:nv,Blocks:HT,ButtonFlyoutInflater:sv,COLLAPSED_FIELD_NAME:ov,COLLAPSED_INPUT_NAME:iv,COLLAPSE_CHARS:lv,CodeGenerator:av,CollapsibleToolboxCategory:uv,ComponentManager:cv,Connection:dv,ConnectionChecker:hv,ConnectionDB:pv,ConnectionNavigationPolicy:$v,ConnectionType:gv,ContextMenu:fv,ContextMenuItems:mv,ContextMenuRegistry:jr,Css:_v,DELETE_VARIABLE_ID:Ev,DeleteArea:Tv,DragTarget:bv,DropDownDiv:yv,Events:_n,Extensions:vv,Field:Iv,FieldCheckbox:GT,FieldDropdown:jT,FieldImage:Nv,FieldLabel:Cv,FieldLabelSerializable:Sv,FieldNavigationPolicy:Av,FieldNumber:WT,FieldTextInput:rf,FieldVariable:Ov,Flyout:Rv,FlyoutButton:wv,FlyoutButtonNavigationPolicy:kv,FlyoutItem:xv,FlyoutMetricsManager:Lv,FlyoutNavigationPolicy:Dv,FlyoutNavigator:Mv,FlyoutSeparator:Pv,FlyoutSeparatorNavigationPolicy:Fv,FocusManager:Bv,FocusableTreeTraverser:Uv,Generator:Vv,Gesture:Hv,Grid:Gv,HorizontalFlyout:jv,INPUT_VALUE:Wv,Input:Xv,InsertionMarkerPreviewer:zv,KeyboardNavigationController:Yv,LabelFlyoutInflater:Kv,LineCursor:qv,Marker:Jv,MarkerManager:Qv,Menu:Zv,MenuItem:eI,MetricsManager:tI,Msg:rI,NEXT_STATEMENT:nI,Names:sI,Navigator:oI,OPPOSITE_TYPE:iI,OUTPUT_VALUE:lI,Options:aI,PREVIOUS_STATEMENT:uI,PROCEDURE_CATEGORY_NAME:cI,Procedures:dI,RENAME_VARIABLE_ID:hI,RenderedConnection:pI,Scrollbar:$I,ScrollbarPair:gI,SeparatorFlyoutInflater:fI,ShortcutItems:mI,ShortcutRegistry:_I,TOOLBOX_AT_BOTTOM:EI,TOOLBOX_AT_LEFT:TI,TOOLBOX_AT_RIGHT:bI,TOOLBOX_AT_TOP:yI,Theme:vI,ThemeManager:II,Themes:yE,Toast:NI,Toolbox:CI,ToolboxCategory:SI,ToolboxItem:AI,ToolboxSeparator:OI,Tooltip:RI,Touch:wI,Trashcan:kI,UnattachedFieldError:xI,VARIABLE_CATEGORY_NAME:LI,VARIABLE_DYNAMIC_CATEGORY_NAME:DI,VERSION:MI,VariableMap:PI,VariableModel:FI,Variables:BI,VariablesDynamic:UI,VerticalFlyout:VI,WidgetDiv:HI,Workspace:GI,WorkspaceAudio:jI,WorkspaceDragger:WI,WorkspaceNavigationPolicy:XI,WorkspaceSvg:zI,Xml:YI,ZoomControls:KI,blockAnimations:qI,blockRendering:JI,browserEvents:QI,bubbles:ZI,bumpObjects:eN,clipboard:tN,comments:rN,common:M_,config:nN,constants:sN,defineBlocksWithJsonArray:oN,dialog:iN,dragging:lN,fieldRegistry:$f,geras:aN,getFocusManager:uN,getMainWorkspace:cN,getSelected:dN,hasBubble:hN,hideChaff:pN,icons:$N,inject:vE,inputs:lp,isCopyable:gN,isDeletable:fN,isDraggable:mN,isIcon:_N,isObservable:EN,isPaster:TN,isRenderedElement:bN,isSelectable:yN,isSerializable:vN,isVariableBackedParameterModel:IN,keyboardNavigationController:NN,layers:CN,navigateBlock:SN,navigateStacks:AN,procedures:ON,registry:RN,renderManagement:wN,serialization:nd,setLocale:kN,setParentContainer:xN,svgResize:IE,thrasos:LN,uiPosition:DN,utils:MN,zelos:PN}=VT;class XT{add(g,i,a){if(typeof arguments[0]!="string")for(let v in arguments[0])this.add(v,arguments[0][v],arguments[1]);else(Array.isArray(g)?g:[g]).forEach(function(v){this[v]=this[v]||[],i&&this[v][a?"unshift":"push"](i)},this)}run(g,i){this[g]=this[g]||[],this[g].forEach(function(a){a.call(i&&i.context?i.context:i,i)})}}class zT{constructor(g){this.jsep=g,this.registered={}}register(){for(var g=arguments.length,i=new Array(g),a=0;a<g;a++)i[a]=arguments[a];i.forEach(v=>{if(typeof v!="object"||!v.name||!v.init)throw new Error("Invalid JSEP plugin format");this.registered[v.name]||(v.init(this.jsep),this.registered[v.name]=v)})}}class je{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+je.version}static addUnaryOp(g){return je.max_unop_len=Math.max(g.length,je.max_unop_len),je.unary_ops[g]=1,je}static addBinaryOp(g,i,a){return je.max_binop_len=Math.max(g.length,je.max_binop_len),je.binary_ops[g]=i,a?je.right_associative.add(g):je.right_associative.delete(g),je}static addIdentifierChar(g){return je.additional_identifier_chars.add(g),je}static addLiteral(g,i){return je.literals[g]=i,je}static removeUnaryOp(g){return delete je.unary_ops[g],g.length===je.max_unop_len&&(je.max_unop_len=je.getMaxKeyLen(je.unary_ops)),je}static removeAllUnaryOps(){return je.unary_ops={},je.max_unop_len=0,je}static removeIdentifierChar(g){return je.additional_identifier_chars.delete(g),je}static removeBinaryOp(g){return delete je.binary_ops[g],g.length===je.max_binop_len&&(je.max_binop_len=je.getMaxKeyLen(je.binary_ops)),je.right_associative.delete(g),je}static removeAllBinaryOps(){return je.binary_ops={},je.max_binop_len=0,je}static removeLiteral(g){return delete je.literals[g],je}static removeAllLiterals(){return je.literals={},je}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(g){this.expr=g,this.index=0}static parse(g){return new je(g).parse()}static getMaxKeyLen(g){return Math.max(0,...Object.keys(g).map(i=>i.length))}static isDecimalDigit(g){return g>=48&&g<=57}static binaryPrecedence(g){return je.binary_ops[g]||0}static isIdentifierStart(g){return g>=65&&g<=90||g>=97&&g<=122||g>=128&&!je.binary_ops[String.fromCharCode(g)]||je.additional_identifier_chars.has(String.fromCharCode(g))}static isIdentifierPart(g){return je.isIdentifierStart(g)||je.isDecimalDigit(g)}throwError(g){const i=new Error(g+" at character "+this.index);throw i.index=this.index,i.description=g,i}runHook(g,i){if(je.hooks[g]){const a={context:this,node:i};return je.hooks.run(g,a),a.node}return i}searchHook(g){if(je.hooks[g]){const i={context:this};return je.hooks[g].find(function(a){return a.call(i.context,i),i.node}),i.node}}gobbleSpaces(){let g=this.code;for(;g===je.SPACE_CODE||g===je.TAB_CODE||g===je.LF_CODE||g===je.CR_CODE;)g=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");const g=this.gobbleExpressions(),i=g.length===1?g[0]:{type:je.COMPOUND,body:g};return this.runHook("after-all",i)}gobbleExpressions(g){let i=[],a,v;for(;this.index<this.expr.length;)if(a=this.code,a===je.SEMCOL_CODE||a===je.COMMA_CODE)this.index++;else if(v=this.gobbleExpression())i.push(v);else if(this.index<this.expr.length){if(a===g)break;this.throwError('Unexpected "'+this.char+'"')}return i}gobbleExpression(){const g=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",g)}gobbleBinaryOp(){this.gobbleSpaces();let g=this.expr.substr(this.index,je.max_binop_len),i=g.length;for(;i>0;){if(je.binary_ops.hasOwnProperty(g)&&(!je.isIdentifierStart(this.code)||this.index+g.length<this.expr.length&&!je.isIdentifierPart(this.expr.charCodeAt(this.index+g.length))))return this.index+=i,g;g=g.substr(0,--i)}return!1}gobbleBinaryExpression(){let g,i,a,v,A,R,V,j,ee;if(R=this.gobbleToken(),!R||(i=this.gobbleBinaryOp(),!i))return R;for(A={value:i,prec:je.binaryPrecedence(i),right_a:je.right_associative.has(i)},V=this.gobbleToken(),V||this.throwError("Expected expression after "+i),v=[R,A,V];i=this.gobbleBinaryOp();){if(a=je.binaryPrecedence(i),a===0){this.index-=i.length;break}A={value:i,prec:a,right_a:je.right_associative.has(i)},ee=i;const he=J=>A.right_a&&J.right_a?a>J.prec:a<=J.prec;for(;v.length>2&&he(v[v.length-2]);)V=v.pop(),i=v.pop().value,R=v.pop(),g={type:je.BINARY_EXP,operator:i,left:R,right:V},v.push(g);g=this.gobbleToken(),g||this.throwError("Expected expression after "+ee),v.push(A,g)}for(j=v.length-1,g=v[j];j>1;)g={type:je.BINARY_EXP,operator:v[j-1].value,left:v[j-2],right:g},j-=2;return g}gobbleToken(){let g,i,a,v;if(this.gobbleSpaces(),v=this.searchHook("gobble-token"),v)return this.runHook("after-token",v);if(g=this.code,je.isDecimalDigit(g)||g===je.PERIOD_CODE)return this.gobbleNumericLiteral();if(g===je.SQUOTE_CODE||g===je.DQUOTE_CODE)v=this.gobbleStringLiteral();else if(g===je.OBRACK_CODE)v=this.gobbleArray();else{for(i=this.expr.substr(this.index,je.max_unop_len),a=i.length;a>0;){if(je.unary_ops.hasOwnProperty(i)&&(!je.isIdentifierStart(this.code)||this.index+i.length<this.expr.length&&!je.isIdentifierPart(this.expr.charCodeAt(this.index+i.length)))){this.index+=a;const A=this.gobbleToken();return A||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:je.UNARY_EXP,operator:i,argument:A,prefix:!0})}i=i.substr(0,--a)}je.isIdentifierStart(g)?(v=this.gobbleIdentifier(),je.literals.hasOwnProperty(v.name)?v={type:je.LITERAL,value:je.literals[v.name],raw:v.name}:v.name===je.this_str&&(v={type:je.THIS_EXP})):g===je.OPAREN_CODE&&(v=this.gobbleGroup())}return v?(v=this.gobbleTokenProperty(v),this.runHook("after-token",v)):this.runHook("after-token",!1)}gobbleTokenProperty(g){this.gobbleSpaces();let i=this.code;for(;i===je.PERIOD_CODE||i===je.OBRACK_CODE||i===je.OPAREN_CODE||i===je.QUMARK_CODE;){let a;if(i===je.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==je.PERIOD_CODE)break;a=!0,this.index+=2,this.gobbleSpaces(),i=this.code}this.index++,i===je.OBRACK_CODE?(g={type:je.MEMBER_EXP,computed:!0,object:g,property:this.gobbleExpression()},g.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),i=this.code,i!==je.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):i===je.OPAREN_CODE?g={type:je.CALL_EXP,arguments:this.gobbleArguments(je.CPAREN_CODE),callee:g}:(i===je.PERIOD_CODE||a)&&(a&&this.index--,this.gobbleSpaces(),g={type:je.MEMBER_EXP,computed:!1,object:g,property:this.gobbleIdentifier()}),a&&(g.optional=!0),this.gobbleSpaces(),i=this.code}return g}gobbleNumericLiteral(){let g="",i,a;for(;je.isDecimalDigit(this.code);)g+=this.expr.charAt(this.index++);if(this.code===je.PERIOD_CODE)for(g+=this.expr.charAt(this.index++);je.isDecimalDigit(this.code);)g+=this.expr.charAt(this.index++);if(i=this.char,i==="e"||i==="E"){for(g+=this.expr.charAt(this.index++),i=this.char,(i==="+"||i==="-")&&(g+=this.expr.charAt(this.index++));je.isDecimalDigit(this.code);)g+=this.expr.charAt(this.index++);je.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+g+this.char+")")}return a=this.code,je.isIdentifierStart(a)?this.throwError("Variable names cannot start with a number ("+g+this.char+")"):(a===je.PERIOD_CODE||g.length===1&&g.charCodeAt(0)===je.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:je.LITERAL,value:parseFloat(g),raw:g}}gobbleStringLiteral(){let g="";const i=this.index,a=this.expr.charAt(this.index++);let v=!1;for(;this.index<this.expr.length;){let A=this.expr.charAt(this.index++);if(A===a){v=!0;break}else if(A==="\\")switch(A=this.expr.charAt(this.index++),A){case"n":g+=`
834
834
  `;break;case"r":g+="\r";break;case"t":g+=" ";break;case"b":g+="\b";break;case"f":g+="\f";break;case"v":g+="\v";break;default:g+=A}else g+=A}return v||this.throwError('Unclosed quote after "'+g+'"'),{type:je.LITERAL,value:g,raw:this.expr.substring(i,this.index)}}gobbleIdentifier(){let g=this.code,i=this.index;for(je.isIdentifierStart(g)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(g=this.code,je.isIdentifierPart(g));)this.index++;return{type:je.IDENTIFIER,name:this.expr.slice(i,this.index)}}gobbleArguments(g){const i=[];let a=!1,v=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let A=this.code;if(A===g){a=!0,this.index++,g===je.CPAREN_CODE&&v&&v>=i.length&&this.throwError("Unexpected token "+String.fromCharCode(g));break}else if(A===je.COMMA_CODE){if(this.index++,v++,v!==i.length){if(g===je.CPAREN_CODE)this.throwError("Unexpected token ,");else if(g===je.CBRACK_CODE)for(let R=i.length;R<v;R++)i.push(null)}}else if(i.length!==v&&v!==0)this.throwError("Expected comma");else{const R=this.gobbleExpression();(!R||R.type===je.COMPOUND)&&this.throwError("Expected comma"),i.push(R)}}return a||this.throwError("Expected "+String.fromCharCode(g)),i}gobbleGroup(){this.index++;let g=this.gobbleExpressions(je.CPAREN_CODE);if(this.code===je.CPAREN_CODE)return this.index++,g.length===1?g[0]:g.length?{type:je.SEQUENCE_EXP,expressions:g}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:je.ARRAY_EXP,elements:this.gobbleArguments(je.CBRACK_CODE)}}}const YT=new XT;Object.assign(je,{hooks:YT,plugins:new zT(je),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});je.max_unop_len=je.getMaxKeyLen(je.unary_ops);je.max_binop_len=je.getMaxKeyLen(je.binary_ops);const Xi=f=>new je(f).parse(),KT=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(je).filter(f=>!KT.includes(f)&&Xi[f]===void 0).forEach(f=>{Xi[f]=je[f]});Xi.Jsep=je;const qT="ConditionalExpression";var JT={name:"ternary",init(f){f.hooks.add("after-expression",function(i){if(i.node&&this.code===f.QUMARK_CODE){this.index++;const a=i.node,v=this.gobbleExpression();if(v||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===f.COLON_CODE){this.index++;const A=this.gobbleExpression();if(A||this.throwError("Expected expression"),i.node={type:qT,test:a,consequent:v,alternate:A},a.operator&&f.binary_ops[a.operator]<=.9){let R=a;for(;R.right.operator&&f.binary_ops[R.right.operator]<=.9;)R=R.right;i.node.test=R.right,R.right=i.node,i.node=a}}else this.throwError("Expected :")}})}};Xi.plugins.register(JT);const P_=47,QT=92;var ZT={name:"regex",init(f){f.hooks.add("gobble-token",function(i){if(this.code===P_){const a=++this.index;let v=!1;for(;this.index<this.expr.length;){if(this.code===P_&&!v){const A=this.expr.slice(a,this.index);let R="";for(;++this.index<this.expr.length;){const j=this.code;if(j>=97&&j<=122||j>=65&&j<=90||j>=48&&j<=57)R+=this.char;else break}let V;try{V=new RegExp(A,R)}catch(j){this.throwError(j.message)}return i.node={type:f.LITERAL,value:V,raw:this.expr.slice(a-1,this.index)},i.node=this.gobbleTokenProperty(i.node),i.node}this.code===f.OBRACK_CODE?v=!0:v&&this.code===f.CBRACK_CODE&&(v=!1),this.index+=this.code===QT?2:1}this.throwError("Unclosed Regex")}})}};const qg=43,eb=45,ld={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[qg,eb],assignmentPrecedence:.9,init(f){const g=[f.IDENTIFIER,f.MEMBER_EXP];ld.assignmentOperators.forEach(a=>f.addBinaryOp(a,ld.assignmentPrecedence,!0)),f.hooks.add("gobble-token",function(v){const A=this.code;ld.updateOperators.some(R=>R===A&&R===this.expr.charCodeAt(this.index+1))&&(this.index+=2,v.node={type:"UpdateExpression",operator:A===qg?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!v.node.argument||!g.includes(v.node.argument.type))&&this.throwError(`Unexpected ${v.node.operator}`))}),f.hooks.add("after-token",function(v){if(v.node){const A=this.code;ld.updateOperators.some(R=>R===A&&R===this.expr.charCodeAt(this.index+1))&&(g.includes(v.node.type)||this.throwError(`Unexpected ${v.node.operator}`),this.index+=2,v.node={type:"UpdateExpression",operator:A===qg?"++":"--",argument:v.node,prefix:!1})}}),f.hooks.add("after-expression",function(v){v.node&&i(v.node)});function i(a){ld.assignmentOperators.has(a.operator)?(a.type="AssignmentExpression",i(a.left),i(a.right)):a.operator||Object.values(a).forEach(v=>{v&&typeof v=="object"&&i(v)})}}};Xi.plugins.register(ZT,ld);Xi.addUnaryOp("typeof");Xi.addLiteral("null",null);Xi.addLiteral("undefined",void 0);const tb=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),hr={evalAst(f,g){switch(f.type){case"BinaryExpression":case"LogicalExpression":return hr.evalBinaryExpression(f,g);case"Compound":return hr.evalCompound(f,g);case"ConditionalExpression":return hr.evalConditionalExpression(f,g);case"Identifier":return hr.evalIdentifier(f,g);case"Literal":return hr.evalLiteral(f,g);case"MemberExpression":return hr.evalMemberExpression(f,g);case"UnaryExpression":return hr.evalUnaryExpression(f,g);case"ArrayExpression":return hr.evalArrayExpression(f,g);case"CallExpression":return hr.evalCallExpression(f,g);case"AssignmentExpression":return hr.evalAssignmentExpression(f,g);default:throw SyntaxError("Unexpected expression",f)}},evalBinaryExpression(f,g){return{"||":(a,v)=>a||v(),"&&":(a,v)=>a&&v(),"|":(a,v)=>a|v(),"^":(a,v)=>a^v(),"&":(a,v)=>a&v(),"==":(a,v)=>a==v(),"!=":(a,v)=>a!=v(),"===":(a,v)=>a===v(),"!==":(a,v)=>a!==v(),"<":(a,v)=>a<v(),">":(a,v)=>a>v(),"<=":(a,v)=>a<=v(),">=":(a,v)=>a>=v(),"<<":(a,v)=>a<<v(),">>":(a,v)=>a>>v(),">>>":(a,v)=>a>>>v(),"+":(a,v)=>a+v(),"-":(a,v)=>a-v(),"*":(a,v)=>a*v(),"/":(a,v)=>a/v(),"%":(a,v)=>a%v()}[f.operator](hr.evalAst(f.left,g),()=>hr.evalAst(f.right,g))},evalCompound(f,g){let i;for(let a=0;a<f.body.length;a++){f.body[a].type==="Identifier"&&["var","let","const"].includes(f.body[a].name)&&f.body[a+1]&&f.body[a+1].type==="AssignmentExpression"&&(a+=1);const v=f.body[a];i=hr.evalAst(v,g)}return i},evalConditionalExpression(f,g){return hr.evalAst(f.test,g)?hr.evalAst(f.consequent,g):hr.evalAst(f.alternate,g)},evalIdentifier(f,g){if(Object.hasOwn(g,f.name))return g[f.name];throw ReferenceError(`${f.name} is not defined`)},evalLiteral(f){return f.value},evalMemberExpression(f,g){const i=String(f.computed?hr.evalAst(f.property):f.property.name),a=hr.evalAst(f.object,g);if(a==null)throw TypeError(`Cannot read properties of ${a} (reading '${i}')`);if(!Object.hasOwn(a,i)&&tb.has(i))throw TypeError(`Cannot read properties of ${a} (reading '${i}')`);const v=a[i];return typeof v=="function"?v.bind(a):v},evalUnaryExpression(f,g){return{"-":a=>-hr.evalAst(a,g),"!":a=>!hr.evalAst(a,g),"~":a=>~hr.evalAst(a,g),"+":a=>+hr.evalAst(a,g),typeof:a=>typeof hr.evalAst(a,g)}[f.operator](f.argument)},evalArrayExpression(f,g){return f.elements.map(i=>hr.evalAst(i,g))},evalCallExpression(f,g){const i=f.arguments.map(v=>hr.evalAst(v,g));return hr.evalAst(f.callee,g)(...i)},evalAssignmentExpression(f,g){if(f.left.type!=="Identifier")throw SyntaxError("Invalid left-hand side in assignment");const i=f.left.name,a=hr.evalAst(f.right,g);return g[i]=a,g[i]}};class rb{constructor(g){this.code=g,this.ast=Xi(this.code)}runInNewContext(g){const i=Object.assign(Object.create(null),g);return hr.evalAst(this.ast,i)}}function Ll(f,g){return f=f.slice(),f.push(g),f}function nf(f,g){return g=g.slice(),g.unshift(f),g}class nb extends Error{constructor(g){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=g,this.name="NewError"}}function Jt(f,g,i,a,v){if(!(this instanceof Jt))try{return new Jt(f,g,i,a,v)}catch(R){if(!R.avoidNew)throw R;return R.value}typeof f=="string"&&(v=a,a=i,i=g,g=f,f=null);const A=f&&typeof f=="object";if(f=f||{},this.json=f.json||i,this.path=f.path||g,this.resultType=f.resultType||"value",this.flatten=f.flatten||!1,this.wrap=Object.hasOwn(f,"wrap")?f.wrap:!0,this.sandbox=f.sandbox||{},this.eval=f.eval===void 0?"safe":f.eval,this.ignoreEvalErrors=typeof f.ignoreEvalErrors>"u"?!1:f.ignoreEvalErrors,this.parent=f.parent||null,this.parentProperty=f.parentProperty||null,this.callback=f.callback||a||null,this.otherTypeCallback=f.otherTypeCallback||v||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},f.autostart!==!1){const R={path:A?f.path:g};A?"json"in f&&(R.json=f.json):R.json=i;const V=this.evaluate(R);if(!V||typeof V!="object")throw new nb(V);return V}}Jt.prototype.evaluate=function(f,g,i,a){let v=this.parent,A=this.parentProperty,{flatten:R,wrap:V}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,i=i||this.callback,this.currOtherTypeCallback=a||this.otherTypeCallback,g=g||this.json,f=f||this.path,f&&typeof f=="object"&&!Array.isArray(f)){if(!f.path&&f.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(f,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:g}=f),R=Object.hasOwn(f,"flatten")?f.flatten:R,this.currResultType=Object.hasOwn(f,"resultType")?f.resultType:this.currResultType,this.currSandbox=Object.hasOwn(f,"sandbox")?f.sandbox:this.currSandbox,V=Object.hasOwn(f,"wrap")?f.wrap:V,this.currEval=Object.hasOwn(f,"eval")?f.eval:this.currEval,i=Object.hasOwn(f,"callback")?f.callback:i,this.currOtherTypeCallback=Object.hasOwn(f,"otherTypeCallback")?f.otherTypeCallback:this.currOtherTypeCallback,v=Object.hasOwn(f,"parent")?f.parent:v,A=Object.hasOwn(f,"parentProperty")?f.parentProperty:A,f=f.path}if(v=v||null,A=A||null,Array.isArray(f)&&(f=Jt.toPathString(f)),!f&&f!==""||!g)return;const j=Jt.toPathArray(f);j[0]==="$"&&j.length>1&&j.shift(),this._hasParentSelector=null;const ee=this._trace(j,g,["$"],v,A,i).filter(function(he){return he&&!he.isParentSelector});return ee.length?!V&&ee.length===1&&!ee[0].hasArrExpr?this._getPreferredOutput(ee[0]):ee.reduce((he,J)=>{const W=this._getPreferredOutput(J);return R&&Array.isArray(W)?he=he.concat(W):he.push(W),he},[]):V?[]:void 0};Jt.prototype._getPreferredOutput=function(f){const g=this.currResultType;switch(g){case"all":{const i=Array.isArray(f.path)?f.path:Jt.toPathArray(f.path);return f.pointer=Jt.toPointer(i),f.path=typeof f.path=="string"?f.path:Jt.toPathString(f.path),f}case"value":case"parent":case"parentProperty":return f[g];case"path":return Jt.toPathString(f[g]);case"pointer":return Jt.toPointer(f.path);default:throw new TypeError("Unknown result type")}};Jt.prototype._handleCallback=function(f,g,i){if(g){const a=this._getPreferredOutput(f);f.path=typeof f.path=="string"?f.path:Jt.toPathString(f.path),g(a,i,f)}};Jt.prototype._trace=function(f,g,i,a,v,A,R,V){let j;if(!f.length)return j={path:i,value:g,parent:a,parentProperty:v,hasArrExpr:R},this._handleCallback(j,A,"value"),j;const ee=f[0],he=f.slice(1),J=[];function W(X){Array.isArray(X)?X.forEach(re=>{J.push(re)}):J.push(X)}if((typeof ee!="string"||V)&&g&&Object.hasOwn(g,ee))W(this._trace(he,g[ee],Ll(i,ee),g,ee,A,R));else if(ee==="*")this._walk(g,X=>{W(this._trace(he,g[X],Ll(i,X),g,X,A,!0,!0))});else if(ee==="..")W(this._trace(he,g,i,a,v,A,R)),this._walk(g,X=>{typeof g[X]=="object"&&W(this._trace(f.slice(),g[X],Ll(i,X),g,X,A,!0))});else{if(ee==="^")return this._hasParentSelector=!0,{path:i.slice(0,-1),expr:he,isParentSelector:!0};if(ee==="~")return j={path:Ll(i,ee),value:v,parent:a,parentProperty:null},this._handleCallback(j,A,"property"),j;if(ee==="$")W(this._trace(he,g,i,null,null,A,R));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(ee))W(this._slice(ee,he,g,i,a,v,A));else if(ee.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");const X=ee.replace(/^\?\((.*?)\)$/u,"$1"),re=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(X);re?this._walk(g,ye=>{const Me=[re[2]],Pe=re[1]?g[ye][re[1]]:g[ye];this._trace(Me,Pe,i,a,v,A,!0).length>0&&W(this._trace(he,g[ye],Ll(i,ye),g,ye,A,!0))}):this._walk(g,ye=>{this._eval(X,g[ye],ye,i,a,v)&&W(this._trace(he,g[ye],Ll(i,ye),g,ye,A,!0))})}else if(ee[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");W(this._trace(nf(this._eval(ee,g,i.at(-1),i.slice(0,-1),a,v),he),g,i,a,v,A,R))}else if(ee[0]==="@"){let X=!1;const re=ee.slice(1,-2);switch(re){case"scalar":(!g||!["object","function"].includes(typeof g))&&(X=!0);break;case"boolean":case"string":case"undefined":case"function":typeof g===re&&(X=!0);break;case"integer":Number.isFinite(g)&&!(g%1)&&(X=!0);break;case"number":Number.isFinite(g)&&(X=!0);break;case"nonFinite":typeof g=="number"&&!Number.isFinite(g)&&(X=!0);break;case"object":g&&typeof g===re&&(X=!0);break;case"array":Array.isArray(g)&&(X=!0);break;case"other":X=this.currOtherTypeCallback(g,i,a,v);break;case"null":g===null&&(X=!0);break;default:throw new TypeError("Unknown value type "+re)}if(X)return j={path:i,value:g,parent:a,parentProperty:v},this._handleCallback(j,A,"value"),j}else if(ee[0]==="`"&&g&&Object.hasOwn(g,ee.slice(1))){const X=ee.slice(1);W(this._trace(he,g[X],Ll(i,X),g,X,A,R,!0))}else if(ee.includes(",")){const X=ee.split(",");for(const re of X)W(this._trace(nf(re,he),g,i,a,v,A,!0))}else!V&&g&&Object.hasOwn(g,ee)&&W(this._trace(he,g[ee],Ll(i,ee),g,ee,A,R,!0))}if(this._hasParentSelector)for(let X=0;X<J.length;X++){const re=J[X];if(re&&re.isParentSelector){const ye=this._trace(re.expr,g,re.path,a,v,A,R);if(Array.isArray(ye)){J[X]=ye[0];const Me=ye.length;for(let Pe=1;Pe<Me;Pe++)X++,J.splice(X,0,ye[Pe])}else J[X]=ye}}return J};Jt.prototype._walk=function(f,g){if(Array.isArray(f)){const i=f.length;for(let a=0;a<i;a++)g(a)}else f&&typeof f=="object"&&Object.keys(f).forEach(i=>{g(i)})};Jt.prototype._slice=function(f,g,i,a,v,A,R){if(!Array.isArray(i))return;const V=i.length,j=f.split(":"),ee=j[2]&&Number.parseInt(j[2])||1;let he=j[0]&&Number.parseInt(j[0])||0,J=j[1]&&Number.parseInt(j[1])||V;he=he<0?Math.max(0,he+V):Math.min(V,he),J=J<0?Math.max(0,J+V):Math.min(V,J);const W=[];for(let X=he;X<J;X+=ee)this._trace(nf(X,g),i,a,v,A,R,!0).forEach(ye=>{W.push(ye)});return W};Jt.prototype._eval=function(f,g,i,a,v,A){this.currSandbox._$_parentProperty=A,this.currSandbox._$_parent=v,this.currSandbox._$_property=i,this.currSandbox._$_root=this.json,this.currSandbox._$_v=g;const R=f.includes("@path");R&&(this.currSandbox._$_path=Jt.toPathString(a.concat([i])));const V=this.currEval+"Script:"+f;if(!Jt.cache[V]){let j=f.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(R&&(j=j.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)Jt.cache[V]=new this.safeVm.Script(j);else if(this.currEval==="native")Jt.cache[V]=new this.vm.Script(j);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){const ee=this.currEval;Jt.cache[V]=new ee(j)}else if(typeof this.currEval=="function")Jt.cache[V]={runInNewContext:ee=>this.currEval(j,ee)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return Jt.cache[V].runInNewContext(this.currSandbox)}catch(j){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+j.message+": "+f)}};Jt.cache={};Jt.toPathString=function(f){const g=f,i=g.length;let a="$";for(let v=1;v<i;v++)/^(~|\^|@.*?\(\))$/u.test(g[v])||(a+=/^[0-9*]+$/u.test(g[v])?"["+g[v]+"]":"['"+g[v]+"']");return a};Jt.toPointer=function(f){const g=f,i=g.length;let a="";for(let v=1;v<i;v++)/^(~|\^|@.*?\(\))$/u.test(g[v])||(a+="/"+g[v].toString().replaceAll("~","~0").replaceAll("/","~1"));return a};Jt.toPathArray=function(f){const{cache:g}=Jt;if(g[f])return g[f].concat();const i=[],v=f.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(A,R){return"[#"+(i.push(R)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(A,R){return"['"+R.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(A,R){return";"+R.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(A){const R=A.match(/#(\d+)/u);return!R||!R[1]?A:i[R[1]]});return g[f]=v,g[f].concat()};Jt.prototype.safeVm={Script:rb};const sb=function(f,g,i){const a=f.length;for(let v=0;v<a;v++){const A=f[v];i(A)&&g.push(f.splice(v--,1)[0])}};class ob{constructor(g){this.code=g}runInNewContext(g){let i=this.code;const a=Object.keys(g),v=[];sb(a,v,ee=>typeof g[ee]=="function");const A=a.map(ee=>g[ee]);i=v.reduce((ee,he)=>{let J=g[he].toString();return/function/u.test(J)||(J="function "+J),"var "+he+"="+J+";"+ee},"")+i,!/(['"])use strict\1/u.test(i)&&!a.includes("arguments")&&(i="var arguments = undefined;"+i),i=i.replace(/;\s*$/u,"");const V=i.lastIndexOf(";"),j=V!==-1?i.slice(0,V+1)+" return "+i.slice(V+1):" return "+i;return new Function(...a,j)(...A)}}Jt.prototype.vm={Script:ob};var Jg={},F_;function ib(){return F_||(F_=1,(function(f){var g=f;(function(i){var a="__namespace",v=function(l){return l==null},A=function(l){return l===a||Number.isInteger(l)&&l>=1&&l<=11},R=function(l){return l&&A(l.nodeType)&&typeof l.nodeName=="string"};function V(l){var N=Array.prototype.slice,F=l.length,q=function(ie,ct){return function(){return ct.apply(this,ie.concat(N.call(arguments)))}},G=function(){var ie=N.call(arguments);return ie.length<F?q(ie,G):l.apply(this,N.apply(arguments,[0,F]))};return G}var j=function(l,N){for(var F=0;F<N.length;F+=1)l(N[F],F,N)},ee=function(l,N,F){var q=N;return j(function(G,ie){q=l(q,G,ie)},F),q},he=function(l,N){var F=new Array(N.length);return j(function(q,G){F[G]=l(q)},N),F},J=function(l,N){var F=[];return j(function(q,G){l(q,G)&&F.push(q)},N),F},W=function(l,N){for(var F=0;F<l.length;F+=1)if(l[F]===N)return!0;return!1};function X(l){return function(){return l}}function re(l){return l.toString()}var ye=function(l,N){return N.join(l)},Me=function(l,N,F){return l+F+N},Pe=Array.prototype.concat,Be=function(l,N){var F=new H;F.addArray(l);var q=F.toArray();return N?q.reverse():q},ut=32767;function st(l){for(var N=[],F=0;F<l.length;F+=ut){var q=l.slice(F,F+ut);N=Pe.apply(N,q)}return N}function $t(l,N){for(var F=Object(l),q=1;q<arguments.length;q++){var G=arguments[q];if(G!=null)for(var ie in G)Object.prototype.hasOwnProperty.call(G,ie)&&(F[ie]=G[ie])}return F}var He={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NAMESPACE_NODE:a};te.prototype=new Object,te.prototype.constructor=te,te.superclass=Object.prototype;function te(){this.init()}te.prototype.init=function(){this.reduceActions=[],this.reduceActions[3]=function(l){return new we(l[0],l[2])},this.reduceActions[5]=function(l){return new Qe(l[0],l[2])},this.reduceActions[7]=function(l){return new De(l[0],l[2])},this.reduceActions[8]=function(l){return new me(l[0],l[2])},this.reduceActions[10]=function(l){return new ue(l[0],l[2])},this.reduceActions[11]=function(l){return new Le(l[0],l[2])},this.reduceActions[12]=function(l){return new se(l[0],l[2])},this.reduceActions[13]=function(l){return new Q(l[0],l[2])},this.reduceActions[15]=function(l){return new ce(l[0],l[2])},this.reduceActions[16]=function(l){return new Ze(l[0],l[2])},this.reduceActions[18]=function(l){return new Ae(l[0],l[2])},this.reduceActions[19]=function(l){return new it(l[0],l[2])},this.reduceActions[20]=function(l){return new ze(l[0],l[2])},this.reduceActions[22]=function(l){return new ot(l[1])},this.reduceActions[24]=function(l){return new gt(l[0],l[2])},this.reduceActions[25]=function(l){return new rt(void 0,void 0,l[0])},this.reduceActions[27]=function(l){return l[0].locationPath=l[2],l[0]},this.reduceActions[28]=function(l){return l[0].locationPath=l[2],l[0].locationPath.steps.unshift(new U(U.DESCENDANTORSELF,ne.nodeTest,[])),l[0]},this.reduceActions[29]=function(l){return new rt(l[0],[],void 0)},this.reduceActions[30]=function(l){return P.instance_of(l[0],rt)?(l[0].filterPredicates==null&&(l[0].filterPredicates=[]),l[0].filterPredicates.push(l[1]),l[0]):new rt(l[0],[l[1]],void 0)},this.reduceActions[32]=function(l){return l[1]},this.reduceActions[33]=function(l){return new pe(l[0])},this.reduceActions[34]=function(l){return new $e(l[0])},this.reduceActions[36]=function(l){return new Ue(l[0],[])},this.reduceActions[37]=function(l){return new Ue(l[0],l[2])},this.reduceActions[38]=function(l){return[l[0]]},this.reduceActions[39]=function(l){return l[2].unshift(l[0]),l[2]},this.reduceActions[43]=function(l){return new ae(!0,[])},this.reduceActions[44]=function(l){return l[1].absolute=!0,l[1]},this.reduceActions[46]=function(l){return new ae(!1,[l[0]])},this.reduceActions[47]=function(l){return l[0].steps.push(l[2]),l[0]},this.reduceActions[49]=function(l){return new U(l[0],l[1],[])},this.reduceActions[50]=function(l){return new U(U.CHILD,l[0],[])},this.reduceActions[51]=function(l){return new U(l[0],l[1],l[2])},this.reduceActions[52]=function(l){return new U(U.CHILD,l[0],l[1])},this.reduceActions[54]=function(l){return[l[0]]},this.reduceActions[55]=function(l){return l[1].unshift(l[0]),l[1]},this.reduceActions[56]=function(l){return l[0]=="ancestor"?U.ANCESTOR:l[0]=="ancestor-or-self"?U.ANCESTORORSELF:l[0]=="attribute"?U.ATTRIBUTE:l[0]=="child"?U.CHILD:l[0]=="descendant"?U.DESCENDANT:l[0]=="descendant-or-self"?U.DESCENDANTORSELF:l[0]=="following"?U.FOLLOWING:l[0]=="following-sibling"?U.FOLLOWINGSIBLING:l[0]=="namespace"?U.NAMESPACE:l[0]=="parent"?U.PARENT:l[0]=="preceding"?U.PRECEDING:l[0]=="preceding-sibling"?U.PRECEDINGSIBLING:l[0]=="self"?U.SELF:-1},this.reduceActions[57]=function(l){return U.ATTRIBUTE},this.reduceActions[59]=function(l){return l[0]=="comment"?ne.commentTest:l[0]=="text"?ne.textTest:l[0]=="processing-instruction"?ne.anyPiTest:l[0]=="node"?ne.nodeTest:new ne(-1,void 0)},this.reduceActions[60]=function(l){return new ne.PITest(l[2])},this.reduceActions[61]=function(l){return l[1]},this.reduceActions[63]=function(l){return l[1].absolute=!0,l[1].steps.unshift(new U(U.DESCENDANTORSELF,ne.nodeTest,[])),l[1]},this.reduceActions[64]=function(l){return l[0].steps.push(new U(U.DESCENDANTORSELF,ne.nodeTest,[])),l[0].steps.push(l[2]),l[0]},this.reduceActions[65]=function(l){return new U(U.SELF,ne.nodeTest,[])},this.reduceActions[66]=function(l){return new U(U.PARENT,ne.nodeTest,[])},this.reduceActions[67]=function(l){return new fe(l[1])},this.reduceActions[68]=function(l){return ne.nameTestAny},this.reduceActions[69]=function(l){return new ne.NameTestPrefixAny(l[0].split(":")[0])},this.reduceActions[70]=function(l){return new ne.NameTestQName(l[0])}},te.actionTable=[" s s sssssssss s ss s ss"," s ","r rrrrrrrrr rrrrrrr rr r "," rrrrr "," s s sssssssss s ss s ss","rs rrrrrrrr s sssssrrrrrr rrs rs "," s s sssssssss s ss s ss"," s "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s "," s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr r ","a ","r s rr r ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrs rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r srrrrrrrr rrrrrrs rr sr ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r "," sssss ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrr rrrrr rr r "," s "," s "," rrrrr "," s s sssssssss s sss s ss","r srrrrrrrr rrrrrrs rr r "," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss ss s ss"," s s sssssssss s ss s ss"," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr rr "," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," rr "," s "," rs ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrr rr r "," r "," s ","r srrrrrrrr rrrrrrs rr r ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s s sssssssss s ss s ss","r rrrrrrrrr rrrrrrr rr rr "," r "],te.actionTableNumber=[` 1 0 /.-,+*)(' & %$ # "!`," J ","a aaaaaaaaa aaaaaaa aa a "," YYYYY ",` 1 0 /.-,+*)(' & %$ # "!`,`K1 KKKKKKKK . +*)('KKKKKK KK# K" `,` 1 0 /.-,+*)(' & %$ # "!`," N "," O ","e eeeeeeeee eeeeeee ee ee ","f fffffffff fffffff ff ff ","d ddddddddd ddddddd dd dd ","B BBBBBBBBB BBBBBBB BB BB ","A AAAAAAAAA AAAAAAA AA AA "," P "," Q ",` 1 . +*)(' # " `,"b bbbbbbbbb bbbbbbb bb b "," ","! S !! ! ",'" T" "" " ',"$ V $$ U $$ $ ","& &ZY&& &XW && & ",") ))))) )))\\[ )) ) ",". ....._^] ..... .. . ","1 11111111 11111 11 1 ","5 55555555 55555` 55 5 ","7 77777777 777777 77 7 ","9 99999999 999999 99 9 ",": c:::::::: ::::::b :: a: ","I fIIIIIIII IIIIIIe II I ","= ========= ======= == == ","? ????????? ??????? ?? ?? ","C CCCCCCCCC CCCCCCC CC CC ","J JJJJJJJJ JJJJJJ JJ J ","M MMMMMMMM MMMMMM MM M ","N NNNNNNNNN NNNNNNN NN N ","P PPPPPPPPP PPPPPPP PP P "," +*)(' ","R RRRRRRRRR RRRRRRR RR aR ","U UUUUUUUUU UUUUUUU UU U ","Z ZZZZZZZZZ ZZZZZZZ ZZ ZZ ","c ccccccccc ccccccc cc cc "," j ","L fLLLLLLLL LLLLLLe LL L ","6 66666666 66666 66 6 "," k "," l "," XXXXX ",` 1 0 /.-,+*)(' & %$m # "!`,"_ f________ ______e __ _ ",` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 . +*)(' # " `,` 1 . +*)(' # " `,"> >>>>>>>>> >>>>>>> >> >> ",` 1 . +*)(' # " `,` 1 . +*)(' # " `,"Q QQQQQQQQQ QQQQQQQ QQ aQ ","V VVVVVVVVV VVVVVVV VV aV ","T TTTTTTTTT TTTTTTT TT T ","@ @@@@@@@@@ @@@@@@@ @@ @@ "," ‡ ","[ [[[[[[[[[ [[[[[[[ [[ [[ ","D DDDDDDDDD DDDDDDD DD DD "," HH "," ˆ "," F‰ ","# T# ## # ","% V %% U %% % ","' 'ZY'' 'XW '' ' ","( (ZY(( (XW (( ( ","+ +++++ +++\\[ ++ + ","* ***** ***\\[ ** * ","- ----- ---\\[ -- - ",", ,,,,, ,,,\\[ ,, , ","0 00000_^] 00000 00 0 ","/ /////_^] ///// // / ","2 22222222 22222 22 2 ","3 33333333 33333 33 3 ","4 44444444 44444 44 4 ","8 88888888 888888 88 8 "," ^ "," Š ","; f;;;;;;;; ;;;;;;e ;; ; ","< f<<<<<<<< <<<<<<e << < ","O OOOOOOOOO OOOOOOO OO O ","` ````````` ``````` `` ` ","S SSSSSSSSS SSSSSSS SS S ","W WWWWWWWWW WWWWWWW WW W ","\\ \\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\ \\\\ \\\\ ","E EEEEEEEEE EEEEEEE EE EE ",` 1 0 /.-,+*)(' & %$ # "!`,"] ]]]]]]]]] ]]]]]]] ]] ]] "," G "],te.gotoTable=["3456789:;<=>?@ AB CDEFGH IJ "," "," "," ","L456789:;<=>?@ AB CDEFGH IJ "," M EFGH IJ "," N;<=>?@ AB CDEFGH IJ "," "," "," "," "," "," "," "," "," "," S EFGH IJ "," "," "," "," "," "," "," "," "," "," "," "," "," e "," "," "," "," "," "," "," "," "," h J "," i j "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABpqCDEFGH IJ "," "," r6789:;<=>?@ AB CDEFGH IJ "," s789:;<=>?@ AB CDEFGH IJ "," t89:;<=>?@ AB CDEFGH IJ "," u89:;<=>?@ AB CDEFGH IJ "," v9:;<=>?@ AB CDEFGH IJ "," w9:;<=>?@ AB CDEFGH IJ "," x9:;<=>?@ AB CDEFGH IJ "," y9:;<=>?@ AB CDEFGH IJ "," z:;<=>?@ AB CDEFGH IJ "," {:;<=>?@ AB CDEFGH IJ "," |;<=>?@ AB CDEFGH IJ "," };<=>?@ AB CDEFGH IJ "," ~;<=>?@ AB CDEFGH IJ "," =>?@ AB CDEFGH IJ ","€456789:;<=>?@ AB CDEFGH IJ"," ‚ EFGH IJ "," ƒ EFGH IJ "," "," „ GH IJ "," … GH IJ "," i † "," i ‡ "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABŒqCDEFGH IJ "," "," "],te.productions=[[1,1,2],[2,1,3],[3,1,4],[3,3,3,-9,4],[4,1,5],[4,3,4,-8,5],[5,1,6],[5,3,5,-22,6],[5,3,5,-5,6],[6,1,7],[6,3,6,-23,7],[6,3,6,-24,7],[6,3,6,-6,7],[6,3,6,-7,7],[7,1,8],[7,3,7,-25,8],[7,3,7,-26,8],[8,1,9],[8,3,8,-12,9],[8,3,8,-11,9],[8,3,8,-10,9],[9,1,10],[9,2,-26,9],[10,1,11],[10,3,10,-27,11],[11,1,12],[11,1,13],[11,3,13,-28,14],[11,3,13,-4,14],[13,1,15],[13,2,13,16],[15,1,17],[15,3,-29,2,-30],[15,1,-15],[15,1,-16],[15,1,18],[18,3,-13,-29,-30],[18,4,-13,-29,19,-30],[19,1,20],[19,3,20,-31,19],[20,1,2],[12,1,14],[12,1,21],[21,1,-28],[21,2,-28,14],[21,1,22],[14,1,23],[14,3,14,-28,23],[14,1,24],[23,2,25,26],[23,1,26],[23,3,25,26,27],[23,2,26,27],[23,1,28],[27,1,16],[27,2,16,27],[25,2,-14,-3],[25,1,-32],[26,1,29],[26,3,-20,-29,-30],[26,4,-21,-29,-15,-30],[16,3,-33,30,-34],[30,1,2],[22,2,-4,14],[24,3,14,-4,23],[28,1,-35],[28,1,-2],[17,2,-36,-18],[29,1,-17],[29,1,-19],[29,1,-18]],te.DOUBLEDOT=2,te.DOUBLECOLON=3,te.DOUBLESLASH=4,te.NOTEQUAL=5,te.LESSTHANOREQUAL=6,te.GREATERTHANOREQUAL=7,te.AND=8,te.OR=9,te.MOD=10,te.DIV=11,te.MULTIPLYOPERATOR=12,te.FUNCTIONNAME=13,te.AXISNAME=14,te.LITERAL=15,te.NUMBER=16,te.ASTERISKNAMETEST=17,te.QNAME=18,te.NCNAMECOLONASTERISK=19,te.NODETYPE=20,te.PROCESSINGINSTRUCTIONWITHLITERAL=21,te.EQUALS=22,te.LESSTHAN=23,te.GREATERTHAN=24,te.PLUS=25,te.MINUS=26,te.BAR=27,te.SLASH=28,te.LEFTPARENTHESIS=29,te.RIGHTPARENTHESIS=30,te.COMMA=31,te.AT=32,te.LEFTBRACKET=33,te.RIGHTBRACKET=34,te.DOT=35,te.DOLLAR=36,te.prototype.tokenize=function(l){for(var N=[],F=[],q=l+"\0",G=0,ie=q.charAt(G++);;){for(;ie==" "||ie==" "||ie=="\r"||ie==`
835
835
  `;)ie=q.charAt(G++);if(ie=="\0"||G>=q.length)break;if(ie=="("){N.push(te.LEFTPARENTHESIS),F.push(ie),ie=q.charAt(G++);continue}if(ie==")"){N.push(te.RIGHTPARENTHESIS),F.push(ie),ie=q.charAt(G++);continue}if(ie=="["){N.push(te.LEFTBRACKET),F.push(ie),ie=q.charAt(G++);continue}if(ie=="]"){N.push(te.RIGHTBRACKET),F.push(ie),ie=q.charAt(G++);continue}if(ie=="@"){N.push(te.AT),F.push(ie),ie=q.charAt(G++);continue}if(ie==","){N.push(te.COMMA),F.push(ie),ie=q.charAt(G++);continue}if(ie=="|"){N.push(te.BAR),F.push(ie),ie=q.charAt(G++);continue}if(ie=="+"){N.push(te.PLUS),F.push(ie),ie=q.charAt(G++);continue}if(ie=="-"){N.push(te.MINUS),F.push(ie),ie=q.charAt(G++);continue}if(ie=="="){N.push(te.EQUALS),F.push(ie),ie=q.charAt(G++);continue}if(ie=="$"){N.push(te.DOLLAR),F.push(ie),ie=q.charAt(G++);continue}if(ie=="."){if(ie=q.charAt(G++),ie=="."){N.push(te.DOUBLEDOT),F.push(".."),ie=q.charAt(G++);continue}if(ie>="0"&&ie<="9"){var ct="."+ie;for(ie=q.charAt(G++);ie>="0"&&ie<="9";)ct+=ie,ie=q.charAt(G++);N.push(te.NUMBER),F.push(ct);continue}N.push(te.DOT),F.push(".");continue}if(ie=="'"||ie=='"'){for(var Mt=ie,Pt="";G<q.length&&(ie=q.charAt(G))!==Mt;)Pt+=ie,G+=1;if(ie!==Mt)throw ge.fromMessage("Unterminated string literal: "+Mt+Pt);G+=1,N.push(te.LITERAL),F.push(Pt),ie=q.charAt(G++);continue}if(ie>="0"&&ie<="9"){var ct=ie;for(ie=q.charAt(G++);ie>="0"&&ie<="9";)ct+=ie,ie=q.charAt(G++);if(ie=="."&&q.charAt(G)>="0"&&q.charAt(G)<="9")for(ct+=ie,ct+=q.charAt(G++),ie=q.charAt(G++);ie>="0"&&ie<="9";)ct+=ie,ie=q.charAt(G++);N.push(te.NUMBER),F.push(ct);continue}if(ie=="*"){if(N.length>0){var ft=N[N.length-1];if(ft!=te.AT&&ft!=te.DOUBLECOLON&&ft!=te.LEFTPARENTHESIS&&ft!=te.LEFTBRACKET&&ft!=te.AND&&ft!=te.OR&&ft!=te.MOD&&ft!=te.DIV&&ft!=te.MULTIPLYOPERATOR&&ft!=te.SLASH&&ft!=te.DOUBLESLASH&&ft!=te.BAR&&ft!=te.PLUS&&ft!=te.MINUS&&ft!=te.EQUALS&&ft!=te.NOTEQUAL&&ft!=te.LESSTHAN&&ft!=te.LESSTHANOREQUAL&&ft!=te.GREATERTHAN&&ft!=te.GREATERTHANOREQUAL){N.push(te.MULTIPLYOPERATOR),F.push(ie),ie=q.charAt(G++);continue}}N.push(te.ASTERISKNAMETEST),F.push(ie),ie=q.charAt(G++);continue}if(ie==":"&&q.charAt(G)==":"){N.push(te.DOUBLECOLON),F.push("::"),G++,ie=q.charAt(G++);continue}if(ie=="/"){if(ie=q.charAt(G++),ie=="/"){N.push(te.DOUBLESLASH),F.push("//"),ie=q.charAt(G++);continue}N.push(te.SLASH),F.push("/");continue}if(ie=="!"&&q.charAt(G)=="="){N.push(te.NOTEQUAL),F.push("!="),G++,ie=q.charAt(G++);continue}if(ie=="<"){if(q.charAt(G)=="="){N.push(te.LESSTHANOREQUAL),F.push("<="),G++,ie=q.charAt(G++);continue}N.push(te.LESSTHAN),F.push("<"),ie=q.charAt(G++);continue}if(ie==">"){if(q.charAt(G)=="="){N.push(te.GREATERTHANOREQUAL),F.push(">="),G++,ie=q.charAt(G++);continue}N.push(te.GREATERTHAN),F.push(">"),ie=q.charAt(G++);continue}if(ie=="_"||P.isLetter(ie.charCodeAt(0))){var Nt=ie;for(ie=q.charAt(G++);P.isNCNameChar(ie.charCodeAt(0));)Nt+=ie,ie=q.charAt(G++);if(N.length>0){var ft=N[N.length-1];if(ft!=te.AT&&ft!=te.DOUBLECOLON&&ft!=te.LEFTPARENTHESIS&&ft!=te.LEFTBRACKET&&ft!=te.AND&&ft!=te.OR&&ft!=te.MOD&&ft!=te.DIV&&ft!=te.MULTIPLYOPERATOR&&ft!=te.SLASH&&ft!=te.DOUBLESLASH&&ft!=te.BAR&&ft!=te.PLUS&&ft!=te.MINUS&&ft!=te.EQUALS&&ft!=te.NOTEQUAL&&ft!=te.LESSTHAN&&ft!=te.LESSTHANOREQUAL&&ft!=te.GREATERTHAN&&ft!=te.GREATERTHANOREQUAL){if(Nt=="and"){N.push(te.AND),F.push(Nt);continue}if(Nt=="or"){N.push(te.OR),F.push(Nt);continue}if(Nt=="mod"){N.push(te.MOD),F.push(Nt);continue}if(Nt=="div"){N.push(te.DIV),F.push(Nt);continue}}}if(ie==":"){if(q.charAt(G)=="*"){N.push(te.NCNAMECOLONASTERISK),F.push(Nt+":*"),G++,ie=q.charAt(G++);continue}if(q.charAt(G)=="_"||P.isLetter(q.charCodeAt(G))){for(Nt+=":",ie=q.charAt(G++);P.isNCNameChar(ie.charCodeAt(0));)Nt+=ie,ie=q.charAt(G++);if(ie=="("){N.push(te.FUNCTIONNAME),F.push(Nt);continue}N.push(te.QNAME),F.push(Nt);continue}if(q.charAt(G)==":"){N.push(te.AXISNAME),F.push(Nt);continue}}if(ie=="("){if(Nt=="comment"||Nt=="text"||Nt=="node"){N.push(te.NODETYPE),F.push(Nt);continue}if(Nt=="processing-instruction"){q.charAt(G)==")"?N.push(te.NODETYPE):N.push(te.PROCESSINGINSTRUCTIONWITHLITERAL),F.push(Nt);continue}N.push(te.FUNCTIONNAME),F.push(Nt);continue}N.push(te.QNAME),F.push(Nt);continue}throw new Error("Unexpected character "+ie)}return N.push(1),F.push("[EOF]"),[N,F]},te.SHIFT="s",te.REDUCE="r",te.ACCEPT="a",te.prototype.parse=function(Pt){if(!Pt)throw new Error("XPath expression unspecified.");if(typeof Pt!="string")throw new Error("XPath expression must be a string.");var N,F,q=this.tokenize(Pt);if(q!=null){N=q[0],F=q[1];var G=0,ie=[],ct=[],Mt=[],Pt,ft,Nt;for(ie.push(0),ct.push(1),Mt.push("_S"),ft=N[G],Nt=F[G++];;)switch(Pt=ie[ie.length-1],te.actionTable[Pt].charAt(ft-1)){case te.SHIFT:ct.push(-ft),Mt.push(Nt),ie.push(te.actionTableNumber[Pt].charCodeAt(ft-1)-32),ft=N[G],Nt=F[G++];break;case te.REDUCE:for(var an=te.productions[te.actionTableNumber[Pt].charCodeAt(ft-1)-32][1],Sn=[],Zn=0;Zn<an;Zn++)ct.pop(),Sn.unshift(Mt.pop()),ie.pop();var es=ie[ie.length-1];ct.push(te.productions[te.actionTableNumber[Pt].charCodeAt(ft-1)-32][0]),this.reduceActions[te.actionTableNumber[Pt].charCodeAt(ft-1)-32]==null?Mt.push(Sn[0]):Mt.push(this.reduceActions[te.actionTableNumber[Pt].charCodeAt(ft-1)-32](Sn)),ie.push(te.gotoTable[es].charCodeAt(te.productions[te.actionTableNumber[Pt].charCodeAt(ft-1)-32][0]-2)-33);break;case te.ACCEPT:return new ve(Mt.pop());default:throw new Error("XPath parse error")}}},ve.prototype=new Object,ve.prototype.constructor=ve,ve.superclass=Object.prototype;function ve(l){this.expression=l}ve.prototype.toString=function(){return this.expression.toString()};function Ve(l,N,F){N in l||(l[N]=F)}ve.prototype.evaluate=function(l){var N=l.expressionContextNode;if(!(v(N)||R(N)))throw new Error("Context node does not appear to be a valid DOM node.");return l.contextNode=l.expressionContextNode,l.contextSize=1,l.contextPosition=1,l.isHtml&&(Ve(l,"caseInsensitive",!0),Ve(l,"allowAnyNamespaceForNoPrefix",!0)),Ve(l,"caseInsensitive",!1),this.expression.evaluate(l)},ve.XML_NAMESPACE_URI="http://www.w3.org/XML/1998/namespace",ve.XMLNS_NAMESPACE_URI="http://www.w3.org/2000/xmlns/",Xe.prototype=new Object,Xe.prototype.constructor=Xe,Xe.superclass=Object.prototype;function Xe(){}Xe.prototype.init=function(){},Xe.prototype.toString=function(){return"<Expression>"},Xe.prototype.evaluate=function(l){throw new Error("Could not evaluate expression.")},dt.prototype=new Xe,dt.prototype.constructor=dt,dt.superclass=Xe.prototype;function dt(l){arguments.length>0&&this.init(l)}dt.prototype.init=function(l){this.rhs=l},ot.prototype=new dt,ot.prototype.constructor=ot,ot.superclass=dt.prototype;function ot(l){arguments.length>0&&this.init(l)}ot.prototype.init=function(l){ot.superclass.init.call(this,l)},ot.prototype.evaluate=function(l){return this.rhs.evaluate(l).number().negate()},ot.prototype.toString=function(){return"-"+this.rhs.toString()},Ke.prototype=new Xe,Ke.prototype.constructor=Ke,Ke.superclass=Xe.prototype;function Ke(l,N){arguments.length>0&&this.init(l,N)}Ke.prototype.init=function(l,N){this.lhs=l,this.rhs=N},we.prototype=new Ke,we.prototype.constructor=we,we.superclass=Ke.prototype;function we(l,N){arguments.length>0&&this.init(l,N)}we.prototype.init=function(l,N){we.superclass.init.call(this,l,N)},we.prototype.toString=function(){return"("+this.lhs.toString()+" or "+this.rhs.toString()+")"},we.prototype.evaluate=function(l){var N=this.lhs.evaluate(l).bool();return N.booleanValue()?N:this.rhs.evaluate(l).bool()},Qe.prototype=new Ke,Qe.prototype.constructor=Qe,Qe.superclass=Ke.prototype;function Qe(l,N){arguments.length>0&&this.init(l,N)}Qe.prototype.init=function(l,N){Qe.superclass.init.call(this,l,N)},Qe.prototype.toString=function(){return"("+this.lhs.toString()+" and "+this.rhs.toString()+")"},Qe.prototype.evaluate=function(l){var N=this.lhs.evaluate(l).bool();return N.booleanValue()?this.rhs.evaluate(l).bool():N},De.prototype=new Ke,De.prototype.constructor=De,De.superclass=Ke.prototype;function De(l,N){arguments.length>0&&this.init(l,N)}De.prototype.init=function(l,N){De.superclass.init.call(this,l,N)},De.prototype.toString=function(){return"("+this.lhs.toString()+" = "+this.rhs.toString()+")"},De.prototype.evaluate=function(l){return this.lhs.evaluate(l).equals(this.rhs.evaluate(l))},me.prototype=new Ke,me.prototype.constructor=me,me.superclass=Ke.prototype;function me(l,N){arguments.length>0&&this.init(l,N)}me.prototype.init=function(l,N){me.superclass.init.call(this,l,N)},me.prototype.toString=function(){return"("+this.lhs.toString()+" != "+this.rhs.toString()+")"},me.prototype.evaluate=function(l){return this.lhs.evaluate(l).notequal(this.rhs.evaluate(l))},ue.prototype=new Ke,ue.prototype.constructor=ue,ue.superclass=Ke.prototype;function ue(l,N){arguments.length>0&&this.init(l,N)}ue.prototype.init=function(l,N){ue.superclass.init.call(this,l,N)},ue.prototype.evaluate=function(l){return this.lhs.evaluate(l).lessthan(this.rhs.evaluate(l))},ue.prototype.toString=function(){return"("+this.lhs.toString()+" < "+this.rhs.toString()+")"},Le.prototype=new Ke,Le.prototype.constructor=Le,Le.superclass=Ke.prototype;function Le(l,N){arguments.length>0&&this.init(l,N)}Le.prototype.init=function(l,N){Le.superclass.init.call(this,l,N)},Le.prototype.evaluate=function(l){return this.lhs.evaluate(l).greaterthan(this.rhs.evaluate(l))},Le.prototype.toString=function(){return"("+this.lhs.toString()+" > "+this.rhs.toString()+")"},se.prototype=new Ke,se.prototype.constructor=se,se.superclass=Ke.prototype;function se(l,N){arguments.length>0&&this.init(l,N)}se.prototype.init=function(l,N){se.superclass.init.call(this,l,N)},se.prototype.evaluate=function(l){return this.lhs.evaluate(l).lessthanorequal(this.rhs.evaluate(l))},se.prototype.toString=function(){return"("+this.lhs.toString()+" <= "+this.rhs.toString()+")"},Q.prototype=new Ke,Q.prototype.constructor=Q,Q.superclass=Ke.prototype;function Q(l,N){arguments.length>0&&this.init(l,N)}Q.prototype.init=function(l,N){Q.superclass.init.call(this,l,N)},Q.prototype.evaluate=function(l){return this.lhs.evaluate(l).greaterthanorequal(this.rhs.evaluate(l))},Q.prototype.toString=function(){return"("+this.lhs.toString()+" >= "+this.rhs.toString()+")"},ce.prototype=new Ke,ce.prototype.constructor=ce,ce.superclass=Ke.prototype;function ce(l,N){arguments.length>0&&this.init(l,N)}ce.prototype.init=function(l,N){ce.superclass.init.call(this,l,N)},ce.prototype.evaluate=function(l){return this.lhs.evaluate(l).number().plus(this.rhs.evaluate(l).number())},ce.prototype.toString=function(){return"("+this.lhs.toString()+" + "+this.rhs.toString()+")"},Ze.prototype=new Ke,Ze.prototype.constructor=Ze,Ze.superclass=Ke.prototype;function Ze(l,N){arguments.length>0&&this.init(l,N)}Ze.prototype.init=function(l,N){Ze.superclass.init.call(this,l,N)},Ze.prototype.evaluate=function(l){return this.lhs.evaluate(l).number().minus(this.rhs.evaluate(l).number())},Ze.prototype.toString=function(){return"("+this.lhs.toString()+" - "+this.rhs.toString()+")"},Ae.prototype=new Ke,Ae.prototype.constructor=Ae,Ae.superclass=Ke.prototype;function Ae(l,N){arguments.length>0&&this.init(l,N)}Ae.prototype.init=function(l,N){Ae.superclass.init.call(this,l,N)},Ae.prototype.evaluate=function(l){return this.lhs.evaluate(l).number().multiply(this.rhs.evaluate(l).number())},Ae.prototype.toString=function(){return"("+this.lhs.toString()+" * "+this.rhs.toString()+")"},it.prototype=new Ke,it.prototype.constructor=it,it.superclass=Ke.prototype;function it(l,N){arguments.length>0&&this.init(l,N)}it.prototype.init=function(l,N){it.superclass.init.call(this,l,N)},it.prototype.evaluate=function(l){return this.lhs.evaluate(l).number().div(this.rhs.evaluate(l).number())},it.prototype.toString=function(){return"("+this.lhs.toString()+" div "+this.rhs.toString()+")"},ze.prototype=new Ke,ze.prototype.constructor=ze,ze.superclass=Ke.prototype;function ze(l,N){arguments.length>0&&this.init(l,N)}ze.prototype.init=function(l,N){ze.superclass.init.call(this,l,N)},ze.prototype.evaluate=function(l){return this.lhs.evaluate(l).number().mod(this.rhs.evaluate(l).number())},ze.prototype.toString=function(){return"("+this.lhs.toString()+" mod "+this.rhs.toString()+")"},gt.prototype=new Ke,gt.prototype.constructor=gt,gt.superclass=Ke.prototype;function gt(l,N){arguments.length>0&&this.init(l,N)}gt.prototype.init=function(l,N){gt.superclass.init.call(this,l,N)},gt.prototype.evaluate=function(l){return this.lhs.evaluate(l).nodeset().union(this.rhs.evaluate(l).nodeset())},gt.prototype.toString=function(){return he(re,[this.lhs,this.rhs]).join(" | ")},rt.prototype=new Xe,rt.prototype.constructor=rt,rt.superclass=Xe.prototype;function rt(l,N,F){arguments.length>0&&this.init(l,N,F)}rt.prototype.init=function(l,N,F){rt.superclass.init.call(this),this.filter=l,this.filterPredicates=N,this.locationPath=F};function Ot(l){for(;l&&l.parentNode;)l=l.parentNode;return l}var qe=function(l,N,F,q){if(l.length===0)return F;var G=N.extend({});return ee(function(ie,ct){return G.contextSize=ie.length,J(function(Mt,Pt){return G.contextNode=Mt,G.contextPosition=Pt+1,rt.predicateMatches(ct,G)},ie)},Be(F,q),l)};rt.getRoot=function(l,N){var F=N[0];if(F&&F.nodeType===He.DOCUMENT_NODE)return F;if(l.virtualRoot)return l.virtualRoot;if(!F)throw new Error("Context node not found when determining document root.");var q=F.ownerDocument;if(q)return q;for(var G=F;G.parentNode!=null;)G=G.parentNode;return G};var Ut=function(l){var N=String(l.name);return N==="xmlns"?"":N.substring(0,6)==="xmlns:"?N.substring(6,N.length):null};rt.applyStep=function(l,N,F){if(!F)throw new Error("Context node not found when evaluating XPath step: "+l);var q=[];switch(N.contextNode=F,l.axis){case U.ANCESTOR:if(N.contextNode===N.virtualRoot)break;var G;for(N.contextNode.nodeType==He.ATTRIBUTE_NODE?G=rt.getOwnerElement(N.contextNode):G=N.contextNode.parentNode;G!=null&&(l.nodeTest.matches(G,N)&&q.push(G),G!==N.virtualRoot);)G=G.parentNode;break;case U.ANCESTORORSELF:for(var G=N.contextNode;G!=null&&(l.nodeTest.matches(G,N)&&q.push(G),G!==N.virtualRoot);G=G.nodeType==He.ATTRIBUTE_NODE?rt.getOwnerElement(G):G.parentNode);break;case U.ATTRIBUTE:var ie=N.contextNode.attributes;if(ie!=null)for(var ct=0;ct<ie.length;ct++){var G=ie.item(ct);l.nodeTest.matches(G,N)&&q.push(G)}break;case U.CHILD:for(var G=N.contextNode.firstChild;G!=null;G=G.nextSibling)l.nodeTest.matches(G,N)&&q.push(G);break;case U.DESCENDANT:for(var Nt=[N.contextNode.firstChild];Nt.length>0;)for(var G=Nt.pop();G!=null;)l.nodeTest.matches(G,N)&&q.push(G),G.firstChild!=null?(Nt.push(G.nextSibling),G=G.firstChild):G=G.nextSibling;break;case U.DESCENDANTORSELF:l.nodeTest.matches(N.contextNode,N)&&q.push(N.contextNode);for(var Nt=[N.contextNode.firstChild];Nt.length>0;)for(var G=Nt.pop();G!=null;)l.nodeTest.matches(G,N)&&q.push(G),G.firstChild!=null?(Nt.push(G.nextSibling),G=G.firstChild):G=G.nextSibling;break;case U.FOLLOWING:if(N.contextNode===N.virtualRoot)break;var Nt=[];N.contextNode.firstChild!=null?Nt.unshift(N.contextNode.firstChild):Nt.unshift(N.contextNode.nextSibling);for(var G=N.contextNode.parentNode;G!=null&&G.nodeType!=He.DOCUMENT_NODE&&G!==N.virtualRoot;G=G.parentNode)Nt.unshift(G.nextSibling);do for(var G=Nt.pop();G!=null;)l.nodeTest.matches(G,N)&&q.push(G),G.firstChild!=null?(Nt.push(G.nextSibling),G=G.firstChild):G=G.nextSibling;while(Nt.length>0);break;case U.FOLLOWINGSIBLING:if(N.contextNode===N.virtualRoot)break;for(var G=N.contextNode.nextSibling;G!=null;G=G.nextSibling)l.nodeTest.matches(G,N)&&q.push(G);break;case U.NAMESPACE:var Mt={};if(N.contextNode.nodeType==He.ELEMENT_NODE){Mt.xml=new Re("xml",null,ve.XML_NAMESPACE_URI,N.contextNode);for(var G=N.contextNode;G!=null&&G.nodeType==He.ELEMENT_NODE;G=G.parentNode)for(var ct=0;ct<G.attributes.length;ct++){var Pt=G.attributes.item(ct),ft=Ut(Pt);ft!=null&&Mt[ft]==null&&(Mt[ft]=new Re(ft,Pt,Pt.value,N.contextNode))}for(var ft in Mt){var F=Mt[ft];l.nodeTest.matches(F,N)&&q.push(F)}}break;case U.PARENT:G=null,N.contextNode!==N.virtualRoot&&(N.contextNode.nodeType==He.ATTRIBUTE_NODE?G=rt.getOwnerElement(N.contextNode):G=N.contextNode.parentNode),G!=null&&l.nodeTest.matches(G,N)&&q.push(G);break;case U.PRECEDING:var Nt;N.virtualRoot!=null?Nt=[N.virtualRoot]:Nt=[Ot(N.contextNode)];e:for(;Nt.length>0;)for(var G=Nt.pop();G!=null;){if(G==N.contextNode)break e;l.nodeTest.matches(G,N)&&q.unshift(G),G.firstChild!=null?(Nt.push(G.nextSibling),G=G.firstChild):G=G.nextSibling}break;case U.PRECEDINGSIBLING:if(N.contextNode===N.virtualRoot)break;for(var G=N.contextNode.previousSibling;G!=null;G=G.previousSibling)l.nodeTest.matches(G,N)&&q.push(G);break;case U.SELF:l.nodeTest.matches(N.contextNode,N)&&q.push(N.contextNode);break}return q};function Oe(l,N,F){return qe(l.predicates,N,rt.applyStep(l,N,F),W(Te,l.axis))}function L(l,N,F){return st(he(Oe.bind(null,F,l),N))}rt.applySteps=function(l,N,F){return ee(L.bind(null,N),F,l)},rt.prototype.applyFilter=function(l,N){if(!this.filter)return{nodes:[l.contextNode]};var F=this.filter.evaluate(l);if(!P.instance_of(F,H)){if(this.filterPredicates!=null&&this.filterPredicates.length>0||this.locationPath!=null)throw new Error("Path expression filter must evaluate to a nodeset if predicates or location path are used");return{nonNodes:F}}return{nodes:qe(this.filterPredicates||[],N,F.toUnsortedArray(),!1)}},rt.applyLocationPath=function(l,N,F){if(!l)return F;var q=l.absolute?[rt.getRoot(N,F)]:F;return rt.applySteps(l.steps,N,q)},rt.prototype.evaluate=function(l){var N=$t(new _e,l),F=this.applyFilter(l,N);if("nonNodes"in F)return F.nonNodes;var q=new H;return q.addArray(rt.applyLocationPath(this.locationPath,N,F.nodes)),q},rt.predicateMatches=function(l,N){var F=l.evaluate(N);return P.instance_of(F,$e)?N.contextPosition===F.numberValue():F.booleanValue()},rt.predicateString=function(l){return Me("[","]",l.toString())},rt.predicatesString=function(l){return ye("",he(rt.predicateString,l))},rt.prototype.toString=function(){if(this.filter!=null){var l=re(this.filter);return P.instance_of(this.filter,pe)?Me("'","'",l):this.filterPredicates!=null&&this.filterPredicates.length?Me("(",")",l)+rt.predicatesString(this.filterPredicates):this.locationPath!=null?l+(this.locationPath.absolute?"":"/")+re(this.locationPath):l}return re(this.locationPath)},rt.getOwnerElement=function(l){if(l.ownerElement)return l.ownerElement;try{if(l.selectSingleNode)return l.selectSingleNode("..")}catch{}for(var N=l.nodeType==He.DOCUMENT_NODE?l:l.ownerDocument,F=N.getElementsByTagName("*"),q=0;q<F.length;q++)for(var G=F.item(q),ie=G.attributes,ct=0;ct<ie.length;ct++){var Mt=ie.item(ct);if(Mt===l)return G}return null},ae.prototype=new Object,ae.prototype.constructor=ae,ae.superclass=Object.prototype;function ae(l,N){arguments.length>0&&this.init(l,N)}ae.prototype.init=function(l,N){this.absolute=l,this.steps=N},ae.prototype.toString=function(){return(this.absolute?"/":"")+he(re,this.steps).join("/")},U.prototype=new Object,U.prototype.constructor=U,U.superclass=Object.prototype;function U(l,N,F){arguments.length>0&&this.init(l,N,F)}U.prototype.init=function(l,N,F){this.axis=l,this.nodeTest=N,this.predicates=F},U.prototype.toString=function(){return U.STEPNAMES[this.axis]+"::"+this.nodeTest.toString()+rt.predicatesString(this.predicates)},U.ANCESTOR=0,U.ANCESTORORSELF=1,U.ATTRIBUTE=2,U.CHILD=3,U.DESCENDANT=4,U.DESCENDANTORSELF=5,U.FOLLOWING=6,U.FOLLOWINGSIBLING=7,U.NAMESPACE=8,U.PARENT=9,U.PRECEDING=10,U.PRECEDINGSIBLING=11,U.SELF=12,U.STEPNAMES=ee(function(l,N){return l[N[0]]=N[1],l},{},[[U.ANCESTOR,"ancestor"],[U.ANCESTORORSELF,"ancestor-or-self"],[U.ATTRIBUTE,"attribute"],[U.CHILD,"child"],[U.DESCENDANT,"descendant"],[U.DESCENDANTORSELF,"descendant-or-self"],[U.FOLLOWING,"following"],[U.FOLLOWINGSIBLING,"following-sibling"],[U.NAMESPACE,"namespace"],[U.PARENT,"parent"],[U.PRECEDING,"preceding"],[U.PRECEDINGSIBLING,"preceding-sibling"],[U.SELF,"self"]]);var Te=[U.ANCESTOR,U.ANCESTORORSELF,U.PARENT,U.PRECEDING,U.PRECEDINGSIBLING];ne.prototype=new Object,ne.prototype.constructor=ne,ne.superclass=Object.prototype;function ne(l,N){arguments.length>0&&this.init(l,N)}ne.prototype.init=function(l,N){this.type=l,this.value=N},ne.prototype.toString=function(){return"<unknown nodetest type>"},ne.prototype.matches=function(l,N){console.warn("unknown node test type")},ne.NAMETESTANY=0,ne.NAMETESTPREFIXANY=1,ne.NAMETESTQNAME=2,ne.COMMENT=3,ne.TEXT=4,ne.PI=5,ne.NODE=6,ne.isNodeType=function(l){return function(N){return W(l,N.nodeType)}},ne.makeNodeTestType=function(l,N,F){var q=F||function(){};return q.prototype=new ne(l),q.prototype.constructor=q,$t(q.prototype,N),q},ne.makeNodeTypeTest=function(l,N,F){return new(ne.makeNodeTestType(l,{matches:ne.isNodeType(N),toString:X(F)}))},ne.hasPrefix=function(l){return l.prefix||(l.nodeName||l.tagName).indexOf(":")!==-1},ne.isElementOrAttribute=ne.isNodeType([1,2]),ne.nameSpaceMatches=function(l,N,F){var q=F.namespaceURI||"";if(!l)return!q||N.allowAnyNamespaceForNoPrefix&&!ne.hasPrefix(F);var G=N.namespaceResolver.getNamespace(l,N.expressionContextNode);if(G==null)throw new Error("Cannot resolve QName "+l);return G===q},ne.localNameMatches=function(l,N,F){var q=F.localName||F.nodeName;return N.caseInsensitive?l.toLowerCase()===q.toLowerCase():l===q},ne.NameTestPrefixAny=ne.makeNodeTestType(ne.NAMETESTPREFIXANY,{matches:function(l,N){return ne.isElementOrAttribute(l)&&ne.nameSpaceMatches(this.prefix,N,l)},toString:function(){return this.prefix+":*"}},function(N){this.prefix=N}),ne.NameTestQName=ne.makeNodeTestType(ne.NAMETESTQNAME,{matches:function(l,N){return ne.isNodeType([He.ELEMENT_NODE,He.ATTRIBUTE_NODE,He.NAMESPACE_NODE])(l)&&ne.nameSpaceMatches(this.prefix,N,l)&&ne.localNameMatches(this.localName,N,l)},toString:function(){return this.name}},function(N){var F=N.split(":");this.name=N,this.prefix=F.length>1?F[0]:null,this.localName=F[F.length>1?1:0]}),ne.PITest=ne.makeNodeTestType(ne.PI,{matches:function(l,N){return ne.isNodeType([He.PROCESSING_INSTRUCTION_NODE])(l)&&(l.target||l.nodeName)===this.name},toString:function(){return Me('processing-instruction("','")',this.name)}},function(l){this.name=l}),ne.nameTestAny=ne.makeNodeTypeTest(ne.NAMETESTANY,[He.ELEMENT_NODE,He.ATTRIBUTE_NODE,He.NAMESPACE_NODE],"*"),ne.textTest=ne.makeNodeTypeTest(ne.TEXT,[He.TEXT_NODE,He.CDATA_SECTION_NODE],"text()"),ne.commentTest=ne.makeNodeTypeTest(ne.COMMENT,[He.COMMENT_NODE],"comment()"),ne.nodeTest=ne.makeNodeTypeTest(ne.NODE,[He.ELEMENT_NODE,He.ATTRIBUTE_NODE,He.TEXT_NODE,He.CDATA_SECTION_NODE,He.PROCESSING_INSTRUCTION_NODE,He.COMMENT_NODE,He.DOCUMENT_NODE],"node()"),ne.anyPiTest=ne.makeNodeTypeTest(ne.PI,[He.PROCESSING_INSTRUCTION_NODE],"processing-instruction()"),fe.prototype=new Xe,fe.prototype.constructor=fe,fe.superclass=Xe.prototype;function fe(l){arguments.length>0&&this.init(l)}fe.prototype.init=function(l){this.variable=l},fe.prototype.toString=function(){return"$"+this.variable},fe.prototype.evaluate=function(l){var N=P.resolveQName(this.variable,l.namespaceResolver,l.contextNode,!1);if(N[0]==null)throw new Error("Cannot resolve QName "+fn);var F=l.variableResolver.getVariable(N[1],N[0]);if(!F)throw ge.fromMessage("Undeclared variable: "+this.toString());return F},Ue.prototype=new Xe,Ue.prototype.constructor=Ue,Ue.superclass=Xe.prototype;function Ue(l,N){arguments.length>0&&this.init(l,N)}Ue.prototype.init=function(l,N){this.functionName=l,this.arguments=N},Ue.prototype.toString=function(){for(var l=this.functionName+"(",N=0;N<this.arguments.length;N++)N>0&&(l+=", "),l+=this.arguments[N].toString();return l+")"},Ue.prototype.evaluate=function(l){var N=Ye.getFunctionFromContext(this.functionName,l);if(!N)throw new Error("Unknown function "+this.functionName);var F=[l].concat(this.arguments);return N.apply(l.functionResolver.thisArg,F)};var Ne=new Object;Ne.equals=function(l,N){return l.equals(N)},Ne.notequal=function(l,N){return l.notequal(N)},Ne.lessthan=function(l,N){return l.lessthan(N)},Ne.greaterthan=function(l,N){return l.greaterthan(N)},Ne.lessthanorequal=function(l,N){return l.lessthanorequal(N)},Ne.greaterthanorequal=function(l,N){return l.greaterthanorequal(N)},pe.prototype=new Xe,pe.prototype.constructor=pe,pe.superclass=Xe.prototype;function pe(l){arguments.length>0&&this.init(l)}pe.prototype.init=function(l){this.str=String(l)},pe.prototype.toString=function(){return this.str},pe.prototype.evaluate=function(l){return this},pe.prototype.string=function(){return this},pe.prototype.number=function(){return new $e(this.str)},pe.prototype.bool=function(){return new h(this.str)},pe.prototype.nodeset=function(){throw new Error("Cannot convert string to nodeset")},pe.prototype.stringValue=function(){return this.str},pe.prototype.numberValue=function(){return this.number().numberValue()},pe.prototype.booleanValue=function(){return this.bool().booleanValue()},pe.prototype.equals=function(l){return P.instance_of(l,h)?this.bool().equals(l):P.instance_of(l,$e)?this.number().equals(l):P.instance_of(l,H)?l.compareWithString(this,Ne.equals):new h(this.str==l.str)},pe.prototype.notequal=function(l){return P.instance_of(l,h)?this.bool().notequal(l):P.instance_of(l,$e)?this.number().notequal(l):P.instance_of(l,H)?l.compareWithString(this,Ne.notequal):new h(this.str!=l.str)},pe.prototype.lessthan=function(l){return this.number().lessthan(l)},pe.prototype.greaterthan=function(l){return this.number().greaterthan(l)},pe.prototype.lessthanorequal=function(l){return this.number().lessthanorequal(l)},pe.prototype.greaterthanorequal=function(l){return this.number().greaterthanorequal(l)},$e.prototype=new Xe,$e.prototype.constructor=$e,$e.superclass=Xe.prototype;function $e(l){arguments.length>0&&this.init(l)}$e.prototype.init=function(l){this.num=typeof l=="string"?this.parse(l):Number(l)},$e.prototype.numberFormat=/^\s*-?[0-9]*\.?[0-9]+\s*$/,$e.prototype.parse=function(l){return this.numberFormat.test(l)?parseFloat(l):Number.NaN};function et(l){for(var N=l.split("e-"),F=N[0].replace(".",""),q=Number(N[1]),G=0;G<q-1;G+=1)F="0"+F;return"0."+F}function M(l){for(var N=l.split("e"),F=N[0].replace(".",""),q=Number(N[1]),G=q+1-F.length,ie=0;ie<G;ie+=1)F+="0";return F}$e.prototype.toString=function(){var l=this.num.toString();return l.indexOf("e-")!==-1?et(l):l.indexOf("e")!==-1?M(l):l},$e.prototype.evaluate=function(l){return this},$e.prototype.string=function(){return new pe(this.toString())},$e.prototype.number=function(){return this},$e.prototype.bool=function(){return new h(this.num)},$e.prototype.nodeset=function(){throw new Error("Cannot convert number to nodeset")},$e.prototype.stringValue=function(){return this.string().stringValue()},$e.prototype.numberValue=function(){return this.num},$e.prototype.booleanValue=function(){return this.bool().booleanValue()},$e.prototype.negate=function(){return new $e(-this.num)},$e.prototype.equals=function(l){return P.instance_of(l,h)?this.bool().equals(l):P.instance_of(l,pe)?this.equals(l.number()):P.instance_of(l,H)?l.compareWithNumber(this,Ne.equals):new h(this.num==l.num)},$e.prototype.notequal=function(l){return P.instance_of(l,h)?this.bool().notequal(l):P.instance_of(l,pe)?this.notequal(l.number()):P.instance_of(l,H)?l.compareWithNumber(this,Ne.notequal):new h(this.num!=l.num)},$e.prototype.lessthan=function(l){return P.instance_of(l,H)?l.compareWithNumber(this,Ne.greaterthan):P.instance_of(l,h)||P.instance_of(l,pe)?this.lessthan(l.number()):new h(this.num<l.num)},$e.prototype.greaterthan=function(l){return P.instance_of(l,H)?l.compareWithNumber(this,Ne.lessthan):P.instance_of(l,h)||P.instance_of(l,pe)?this.greaterthan(l.number()):new h(this.num>l.num)},$e.prototype.lessthanorequal=function(l){return P.instance_of(l,H)?l.compareWithNumber(this,Ne.greaterthanorequal):P.instance_of(l,h)||P.instance_of(l,pe)?this.lessthanorequal(l.number()):new h(this.num<=l.num)},$e.prototype.greaterthanorequal=function(l){return P.instance_of(l,H)?l.compareWithNumber(this,Ne.lessthanorequal):P.instance_of(l,h)||P.instance_of(l,pe)?this.greaterthanorequal(l.number()):new h(this.num>=l.num)},$e.prototype.plus=function(l){return new $e(this.num+l.num)},$e.prototype.minus=function(l){return new $e(this.num-l.num)},$e.prototype.multiply=function(l){return new $e(this.num*l.num)},$e.prototype.div=function(l){return new $e(this.num/l.num)},$e.prototype.mod=function(l){return new $e(this.num%l.num)},h.prototype=new Xe,h.prototype.constructor=h,h.superclass=Xe.prototype;function h(l){arguments.length>0&&this.init(l)}h.prototype.init=function(l){this.b=!!l},h.prototype.toString=function(){return this.b.toString()},h.prototype.evaluate=function(l){return this},h.prototype.string=function(){return new pe(this.b)},h.prototype.number=function(){return new $e(this.b)},h.prototype.bool=function(){return this},h.prototype.nodeset=function(){throw new Error("Cannot convert boolean to nodeset")},h.prototype.stringValue=function(){return this.string().stringValue()},h.prototype.numberValue=function(){return this.number().numberValue()},h.prototype.booleanValue=function(){return this.b},h.prototype.not=function(){return new h(!this.b)},h.prototype.equals=function(l){return P.instance_of(l,pe)||P.instance_of(l,$e)?this.equals(l.bool()):P.instance_of(l,H)?l.compareWithBoolean(this,Ne.equals):new h(this.b==l.b)},h.prototype.notequal=function(l){return P.instance_of(l,pe)||P.instance_of(l,$e)?this.notequal(l.bool()):P.instance_of(l,H)?l.compareWithBoolean(this,Ne.notequal):new h(this.b!=l.b)},h.prototype.lessthan=function(l){return this.number().lessthan(l)},h.prototype.greaterthan=function(l){return this.number().greaterthan(l)},h.prototype.lessthanorequal=function(l){return this.number().lessthanorequal(l)},h.prototype.greaterthanorequal=function(l){return this.number().greaterthanorequal(l)},h.true_=new h(!0),h.false_=new h(!1),w.prototype=new Object,w.prototype.constructor=w,w.superclass=Object.prototype;function w(l){this.init(l)}w.prototype.init=function(l){this.left=null,this.right=null,this.node=l,this.depth=1},w.prototype.balance=function(){var l=this.left==null?0:this.left.depth,N=this.right==null?0:this.right.depth;if(l>N+1){var F=this.left.left==null?0:this.left.left.depth,q=this.left.right==null?0:this.left.right.depth;F<q&&this.left.rotateRR(),this.rotateLL()}else if(l+1<N){var G=this.right.right==null?0:this.right.right.depth,ie=this.right.left==null?0:this.right.left.depth;ie>G&&this.right.rotateLL(),this.rotateRR()}},w.prototype.rotateLL=function(){var l=this.node,N=this.right;this.node=this.left.node,this.right=this.left,this.left=this.left.left,this.right.left=this.right.right,this.right.right=N,this.right.node=l,this.right.updateInNewLocation(),this.updateInNewLocation()},w.prototype.rotateRR=function(){var l=this.node,N=this.left;this.node=this.right.node,this.left=this.right,this.right=this.right.right,this.left.right=this.left.left,this.left.left=N,this.left.node=l,this.left.updateInNewLocation(),this.updateInNewLocation()},w.prototype.updateInNewLocation=function(){this.getDepthFromChildren()},w.prototype.getDepthFromChildren=function(){this.depth=this.node==null?0:1,this.left!=null&&(this.depth=this.left.depth+1),this.right!=null&&this.depth<=this.right.depth&&(this.depth=this.right.depth+1)};function Z(l,N){if(l===N)return 0;if(l.compareDocumentPosition){var F=l.compareDocumentPosition(N);return F&1||F&10?1:F&20?-1:0}for(var q=0,G=0,ie=l;ie!=null;ie=ie.parentNode||ie.ownerElement)q++;for(var ct=N;ct!=null;ct=ct.parentNode||ct.ownerElement)G++;if(q>G){for(;q>G;)l=l.parentNode||l.ownerElement,q--;if(l===N)return 1}else if(G>q){for(;G>q;)N=N.parentNode||N.ownerElement,G--;if(l===N)return-1}for(var Mt=l.parentNode||l.ownerElement,Pt=N.parentNode||N.ownerElement;Mt!==Pt;)l=Mt,N=Pt,Mt=l.parentNode||l.ownerElement,Pt=N.parentNode||N.ownerElement;var ft=Y(l),Nt=Y(N);if(ft&&!Nt)return-1;if(!ft&&Nt)return 1;if(l.isXPathNamespace){if(l.nodeValue===ve.XML_NAMESPACE_URI||!N.isXPathNamespace)return-1;if(N.nodeValue===ve.XML_NAMESPACE_URI)return 1}else if(N.isXPathNamespace)return 1;if(Mt)for(var an=ft?Mt.attributes:Mt.childNodes,Sn=an.length,Zn=l.baseNode||l,es=N.baseNode||N,un=0;un<Sn;un+=1){var Hn=an[un];if(Hn===Zn)return-1;if(Hn===es)return 1}throw new Error("Unexpected: could not determine node order")}w.prototype.add=function(l){if(l===this.node)return!1;var N=Z(l,this.node),F=!1;return N==-1?this.left==null?(this.left=new w(l),F=!0):(F=this.left.add(l),F&&this.balance()):N==1&&(this.right==null?(this.right=new w(l),F=!0):(F=this.right.add(l),F&&this.balance())),F&&this.getDepthFromChildren(),F},H.prototype=new Xe,H.prototype.constructor=H,H.superclass=Xe.prototype;function H(){this.init()}H.prototype.init=function(){this.tree=null,this.nodes=[],this.size=0},H.prototype.toString=function(){var l=this.first();return l==null?"":this.stringForNode(l)},H.prototype.evaluate=function(l){return this},H.prototype.string=function(){return new pe(this.toString())},H.prototype.stringValue=function(){return this.toString()},H.prototype.number=function(){return new $e(this.string())},H.prototype.numberValue=function(){return Number(this.string())},H.prototype.bool=function(){return new h(this.booleanValue())},H.prototype.booleanValue=function(){return!!this.size},H.prototype.nodeset=function(){return this},H.prototype.stringForNode=function(l){return l.nodeType==He.DOCUMENT_NODE||l.nodeType==He.ELEMENT_NODE||l.nodeType===He.DOCUMENT_FRAGMENT_NODE?this.stringForContainerNode(l):l.nodeType===He.ATTRIBUTE_NODE?l.value||l.nodeValue:l.isNamespaceNode?l.namespace:l.nodeValue},H.prototype.stringForContainerNode=function(l){for(var N="",F=l.firstChild;F!=null;F=F.nextSibling){var q=F.nodeType;(q===1||q===3||q===4||q===9||q===11)&&(N+=this.stringForNode(F))}return N},H.prototype.buildTree=function(){if(!this.tree&&this.nodes.length){this.tree=new w(this.nodes[0]);for(var l=1;l<this.nodes.length;l+=1)this.tree.add(this.nodes[l])}return this.tree},H.prototype.first=function(){var l=this.buildTree();if(l==null)return null;for(;l.left!=null;)l=l.left;return l.node},H.prototype.add=function(l){for(var N=0;N<this.nodes.length;N+=1)if(l===this.nodes[N])return;this.tree=null,this.nodes.push(l),this.size+=1},H.prototype.addArray=function(l){var N=this;j(function(F){N.add(F)},l)},H.prototype.toArray=function(){var l=[];return this.toArrayRec(this.buildTree(),l),l},H.prototype.toArrayRec=function(l,N){l!=null&&(this.toArrayRec(l.left,N),N.push(l.node),this.toArrayRec(l.right,N))},H.prototype.toUnsortedArray=function(){return this.nodes.slice()},H.prototype.compareWithString=function(l,N){for(var F=this.toUnsortedArray(),q=0;q<F.length;q++){var G=F[q],ie=new pe(this.stringForNode(G)),ct=N(ie,l);if(ct.booleanValue())return ct}return new h(!1)},H.prototype.compareWithNumber=function(l,N){for(var F=this.toUnsortedArray(),q=0;q<F.length;q++){var G=F[q],ie=new $e(this.stringForNode(G)),ct=N(ie,l);if(ct.booleanValue())return ct}return new h(!1)},H.prototype.compareWithBoolean=function(l,N){return N(this.bool(),l)},H.prototype.compareWithNodeSet=function(l,N){for(var F=this.toUnsortedArray(),q=function(Mt,Pt){return N(Pt,Mt)},G=0;G<F.length;G++){var ie=new pe(this.stringForNode(F[G])),ct=l.compareWithString(ie,q);if(ct.booleanValue())return ct}return new h(!1)},H.compareWith=V(function(l,N){return P.instance_of(N,pe)?this.compareWithString(N,l):P.instance_of(N,$e)?this.compareWithNumber(N,l):P.instance_of(N,h)?this.compareWithBoolean(N,l):this.compareWithNodeSet(N,l)}),H.prototype.equals=H.compareWith(Ne.equals),H.prototype.notequal=H.compareWith(Ne.notequal),H.prototype.lessthan=H.compareWith(Ne.lessthan),H.prototype.greaterthan=H.compareWith(Ne.greaterthan),H.prototype.lessthanorequal=H.compareWith(Ne.lessthanorequal),H.prototype.greaterthanorequal=H.compareWith(Ne.greaterthanorequal),H.prototype.union=function(l){var N=new H;return N.addArray(this.toUnsortedArray()),N.addArray(l.toUnsortedArray()),N},Re.prototype=new Object,Re.prototype.constructor=Re,Re.superclass=Object.prototype;function Re(l,N,F,q){this.isXPathNamespace=!0,this.baseNode=N,this.ownerDocument=q.ownerDocument,this.nodeName=l,this.prefix=l,this.localName=l,this.namespaceURI=null,this.nodeValue=F,this.ownerElement=q,this.nodeType=He.NAMESPACE_NODE}Re.prototype.toString=function(){return'{ "'+this.prefix+'", "'+this.namespaceURI+'" }'},_e.prototype=new Object,_e.prototype.constructor=_e,_e.superclass=Object.prototype;function _e(l,N,F){this.variableResolver=l??new lt,this.namespaceResolver=N??new C,this.functionResolver=F??new Ye}_e.prototype.extend=function(l){return $t(new _e,this,l)},lt.prototype=new Object,lt.prototype.constructor=lt,lt.superclass=Object.prototype;function lt(){}lt.prototype.getVariable=function(l,N){return null},Ye.prototype=new Object,Ye.prototype.constructor=Ye,Ye.superclass=Object.prototype;function Ye(l){this.thisArg=l??x,this.functions=new Object,this.addStandardFunctions()}Ye.prototype.addStandardFunctions=function(){this.functions["{}last"]=x.last,this.functions["{}position"]=x.position,this.functions["{}count"]=x.count,this.functions["{}id"]=x.id,this.functions["{}local-name"]=x.localName,this.functions["{}namespace-uri"]=x.namespaceURI,this.functions["{}name"]=x.name,this.functions["{}string"]=x.string,this.functions["{}concat"]=x.concat,this.functions["{}starts-with"]=x.startsWith,this.functions["{}contains"]=x.contains,this.functions["{}substring-before"]=x.substringBefore,this.functions["{}substring-after"]=x.substringAfter,this.functions["{}substring"]=x.substring,this.functions["{}string-length"]=x.stringLength,this.functions["{}normalize-space"]=x.normalizeSpace,this.functions["{}translate"]=x.translate,this.functions["{}boolean"]=x.boolean_,this.functions["{}not"]=x.not,this.functions["{}true"]=x.true_,this.functions["{}false"]=x.false_,this.functions["{}lang"]=x.lang,this.functions["{}number"]=x.number,this.functions["{}sum"]=x.sum,this.functions["{}floor"]=x.floor,this.functions["{}ceiling"]=x.ceiling,this.functions["{}round"]=x.round},Ye.prototype.addFunction=function(l,N,F){this.functions["{"+l+"}"+N]=F},Ye.getFunctionFromContext=function(l,N){var F=P.resolveQName(l,N.namespaceResolver,N.contextNode,!1);if(F[0]===null)throw new Error("Cannot resolve QName "+name);return N.functionResolver.getFunction(F[1],F[0])},Ye.prototype.getFunction=function(l,N){return this.functions["{"+N+"}"+l]},C.prototype=new Object,C.prototype.constructor=C,C.superclass=Object.prototype;function C(){}C.prototype.getNamespace=function(l,N){if(l=="xml")return ve.XML_NAMESPACE_URI;if(l=="xmlns")return ve.XMLNS_NAMESPACE_URI;for(N.nodeType==He.DOCUMENT_NODE?N=N.documentElement:N.nodeType==He.ATTRIBUTE_NODE?N=rt.getOwnerElement(N):N.nodeType!=He.ELEMENT_NODE&&(N=N.parentNode);N!=null&&N.nodeType==He.ELEMENT_NODE;){for(var F=N.attributes,q=0;q<F.length;q++){var G=F.item(q),ie=G.name||G.nodeName;if(ie==="xmlns"&&l===""||ie==="xmlns:"+l)return String(G.value||G.nodeValue)}N=N.parentNode}return null};var x=new Object;x.last=function(l){if(arguments.length!=1)throw new Error("Function last expects ()");return new $e(l.contextSize)},x.position=function(l){if(arguments.length!=1)throw new Error("Function position expects ()");return new $e(l.contextPosition)},x.count=function(){var l=arguments[0],N;if(arguments.length!=2||!P.instance_of(N=arguments[1].evaluate(l),H))throw new Error("Function count expects (node-set)");return new $e(N.size)},x.id=function(){var l=arguments[0],N;if(arguments.length!=2)throw new Error("Function id expects (object)");N=arguments[1].evaluate(l),P.instance_of(N,H)?N=N.toArray().join(" "):N=N.stringValue();for(var F=N.split(/[\x0d\x0a\x09\x20]+/),q=new H,G=l.contextNode.nodeType==He.DOCUMENT_NODE?l.contextNode:l.contextNode.ownerDocument,ie=0;ie<F.length;ie++){var ct;G.getElementById?ct=G.getElementById(F[ie]):ct=P.getElementById(G,F[ie]),ct!=null&&q.add(ct)}return q},x.localName=function(l,N){var F;if(arguments.length==1)F=l.contextNode;else if(arguments.length==2)F=N.evaluate(l).first();else throw new Error("Function local-name expects (node-set?)");return F==null?new pe(""):new pe(F.localName||F.baseName||F.target||F.nodeName||"")},x.namespaceURI=function(){var l=arguments[0],N;if(arguments.length==1)N=l.contextNode;else if(arguments.length==2)N=arguments[1].evaluate(l).first();else throw new Error("Function namespace-uri expects (node-set?)");return N==null?new pe(""):new pe(N.namespaceURI||"")},x.name=function(){var l=arguments[0],N;if(arguments.length==1)N=l.contextNode;else if(arguments.length==2)N=arguments[1].evaluate(l).first();else throw new Error("Function name expects (node-set?)");return N==null?new pe(""):N.nodeType==He.ELEMENT_NODE?new pe(N.nodeName):N.nodeType==He.ATTRIBUTE_NODE?new pe(N.name||N.nodeName):N.nodeType===He.PROCESSING_INSTRUCTION_NODE?new pe(N.target||N.nodeName):N.localName==null?new pe(""):new pe(N.localName)},x.string=function(){var l=arguments[0];if(arguments.length==1)return new pe(H.prototype.stringForNode(l.contextNode));if(arguments.length==2)return arguments[1].evaluate(l).string();throw new Error("Function string expects (object?)")},x.concat=function(l){if(arguments.length<3)throw new Error("Function concat expects (string, string[, string]*)");for(var N="",F=1;F<arguments.length;F++)N+=arguments[F].evaluate(l).stringValue();return new pe(N)},x.startsWith=function(){var l=arguments[0];if(arguments.length!=3)throw new Error("Function startsWith expects (string, string)");var N=arguments[1].evaluate(l).stringValue(),F=arguments[2].evaluate(l).stringValue();return new h(N.substring(0,F.length)==F)},x.contains=function(){var l=arguments[0];if(arguments.length!=3)throw new Error("Function contains expects (string, string)");var N=arguments[1].evaluate(l).stringValue(),F=arguments[2].evaluate(l).stringValue();return new h(N.indexOf(F)!==-1)},x.substringBefore=function(){var l=arguments[0];if(arguments.length!=3)throw new Error("Function substring-before expects (string, string)");var N=arguments[1].evaluate(l).stringValue(),F=arguments[2].evaluate(l).stringValue();return new pe(N.substring(0,N.indexOf(F)))},x.substringAfter=function(){var l=arguments[0];if(arguments.length!=3)throw new Error("Function substring-after expects (string, string)");var N=arguments[1].evaluate(l).stringValue(),F=arguments[2].evaluate(l).stringValue();if(F.length==0)return new pe(N);var q=N.indexOf(F);return q==-1?new pe(""):new pe(N.substring(q+F.length))},x.substring=function(){var l=arguments[0];if(!(arguments.length==3||arguments.length==4))throw new Error("Function substring expects (string, number, number?)");var N=arguments[1].evaluate(l).stringValue(),F=Math.round(arguments[2].evaluate(l).numberValue())-1,q=arguments.length==4?F+Math.round(arguments[3].evaluate(l).numberValue()):void 0;return new pe(N.substring(F,q))},x.stringLength=function(){var l=arguments[0],N;if(arguments.length==1)N=H.prototype.stringForNode(l.contextNode);else if(arguments.length==2)N=arguments[1].evaluate(l).stringValue();else throw new Error("Function string-length expects (string?)");return new $e(N.length)},x.normalizeSpace=function(){var l=arguments[0],N;if(arguments.length==1)N=H.prototype.stringForNode(l.contextNode);else if(arguments.length==2)N=arguments[1].evaluate(l).stringValue();else throw new Error("Function normalize-space expects (string?)");for(var F=0,q=N.length-1;P.isSpace(N.charCodeAt(q));)q--;for(var G="";F<=q&&P.isSpace(N.charCodeAt(F));)F++;for(;F<=q;)if(P.isSpace(N.charCodeAt(F)))for(G+=" ";F<=q&&P.isSpace(N.charCodeAt(F));)F++;else G+=N.charAt(F),F++;return new pe(G)},x.translate=function(l,N,F,q){if(arguments.length!=4)throw new Error("Function translate expects (string, string, string)");var G=N.evaluate(l).stringValue(),ie=F.evaluate(l).stringValue(),ct=q.evaluate(l).stringValue(),Mt=ee(function(ft,Nt,an){return Nt in ft||(ft[Nt]=an>ct.length?"":ct[an]),ft},{},ie),Pt=ye("",he(function(ft){return ft in Mt?Mt[ft]:ft},G));return new pe(Pt)},x.boolean_=function(){var l=arguments[0];if(arguments.length!=2)throw new Error("Function boolean expects (object)");return arguments[1].evaluate(l).bool()},x.not=function(l,N){if(arguments.length!=2)throw new Error("Function not expects (object)");return N.evaluate(l).bool().not()},x.true_=function(){if(arguments.length!=1)throw new Error("Function true expects ()");return h.true_},x.false_=function(){if(arguments.length!=1)throw new Error("Function false expects ()");return h.false_},x.lang=function(){var l=arguments[0];if(arguments.length!=2)throw new Error("Function lang expects (string)");for(var N,F=l.contextNode;F!=null&&F.nodeType!=He.DOCUMENT_NODE;F=F.parentNode){var q=F.getAttributeNS(ve.XML_NAMESPACE_URI,"lang");if(q!=null){N=String(q);break}}if(N==null)return h.false_;var G=arguments[1].evaluate(l).stringValue();return new h(N.substring(0,G.length)==G&&(N.length==G.length||N.charAt(G.length)=="-"))},x.number=function(){var l=arguments[0];if(!(arguments.length==1||arguments.length==2))throw new Error("Function number expects (object?)");return arguments.length==1?new $e(H.prototype.stringForNode(l.contextNode)):arguments[1].evaluate(l).number()},x.sum=function(){var l=arguments[0],N;if(arguments.length!=2||!P.instance_of(N=arguments[1].evaluate(l),H))throw new Error("Function sum expects (node-set)");N=N.toUnsortedArray();for(var F=0,q=0;q<N.length;q++)F+=new $e(H.prototype.stringForNode(N[q])).numberValue();return new $e(F)},x.floor=function(){var l=arguments[0];if(arguments.length!=2)throw new Error("Function floor expects (number)");return new $e(Math.floor(arguments[1].evaluate(l).numberValue()))},x.ceiling=function(){var l=arguments[0];if(arguments.length!=2)throw new Error("Function ceiling expects (number)");return new $e(Math.ceil(arguments[1].evaluate(l).numberValue()))},x.round=function(){var l=arguments[0];if(arguments.length!=2)throw new Error("Function round expects (number)");return new $e(Math.round(arguments[1].evaluate(l).numberValue()))};var P=new Object,Y=function(l){return l&&(l.nodeType===He.ATTRIBUTE_NODE||l.ownerElement||l.isXPathNamespace)};P.splitQName=function(l){var N=l.indexOf(":");return N==-1?[null,l]:[l.substring(0,N),l.substring(N+1)]},P.resolveQName=function(l,N,F,q){var G=P.splitQName(l);return G[0]!=null?G[0]=N.getNamespace(G[0],F):q?(G[0]=N.getNamespace("",F),G[0]==null&&(G[0]="")):G[0]="",G},P.isSpace=function(l){return l==9||l==13||l==10||l==32},P.isLetter=function(l){return l>=65&&l<=90||l>=97&&l<=122||l>=192&&l<=214||l>=216&&l<=246||l>=248&&l<=255||l>=256&&l<=305||l>=308&&l<=318||l>=321&&l<=328||l>=330&&l<=382||l>=384&&l<=451||l>=461&&l<=496||l>=500&&l<=501||l>=506&&l<=535||l>=592&&l<=680||l>=699&&l<=705||l==902||l>=904&&l<=906||l==908||l>=910&&l<=929||l>=931&&l<=974||l>=976&&l<=982||l==986||l==988||l==990||l==992||l>=994&&l<=1011||l>=1025&&l<=1036||l>=1038&&l<=1103||l>=1105&&l<=1116||l>=1118&&l<=1153||l>=1168&&l<=1220||l>=1223&&l<=1224||l>=1227&&l<=1228||l>=1232&&l<=1259||l>=1262&&l<=1269||l>=1272&&l<=1273||l>=1329&&l<=1366||l==1369||l>=1377&&l<=1414||l>=1488&&l<=1514||l>=1520&&l<=1522||l>=1569&&l<=1594||l>=1601&&l<=1610||l>=1649&&l<=1719||l>=1722&&l<=1726||l>=1728&&l<=1742||l>=1744&&l<=1747||l==1749||l>=1765&&l<=1766||l>=2309&&l<=2361||l==2365||l>=2392&&l<=2401||l>=2437&&l<=2444||l>=2447&&l<=2448||l>=2451&&l<=2472||l>=2474&&l<=2480||l==2482||l>=2486&&l<=2489||l>=2524&&l<=2525||l>=2527&&l<=2529||l>=2544&&l<=2545||l>=2565&&l<=2570||l>=2575&&l<=2576||l>=2579&&l<=2600||l>=2602&&l<=2608||l>=2610&&l<=2611||l>=2613&&l<=2614||l>=2616&&l<=2617||l>=2649&&l<=2652||l==2654||l>=2674&&l<=2676||l>=2693&&l<=2699||l==2701||l>=2703&&l<=2705||l>=2707&&l<=2728||l>=2730&&l<=2736||l>=2738&&l<=2739||l>=2741&&l<=2745||l==2749||l==2784||l>=2821&&l<=2828||l>=2831&&l<=2832||l>=2835&&l<=2856||l>=2858&&l<=2864||l>=2866&&l<=2867||l>=2870&&l<=2873||l==2877||l>=2908&&l<=2909||l>=2911&&l<=2913||l>=2949&&l<=2954||l>=2958&&l<=2960||l>=2962&&l<=2965||l>=2969&&l<=2970||l==2972||l>=2974&&l<=2975||l>=2979&&l<=2980||l>=2984&&l<=2986||l>=2990&&l<=2997||l>=2999&&l<=3001||l>=3077&&l<=3084||l>=3086&&l<=3088||l>=3090&&l<=3112||l>=3114&&l<=3123||l>=3125&&l<=3129||l>=3168&&l<=3169||l>=3205&&l<=3212||l>=3214&&l<=3216||l>=3218&&l<=3240||l>=3242&&l<=3251||l>=3253&&l<=3257||l==3294||l>=3296&&l<=3297||l>=3333&&l<=3340||l>=3342&&l<=3344||l>=3346&&l<=3368||l>=3370&&l<=3385||l>=3424&&l<=3425||l>=3585&&l<=3630||l==3632||l>=3634&&l<=3635||l>=3648&&l<=3653||l>=3713&&l<=3714||l==3716||l>=3719&&l<=3720||l==3722||l==3725||l>=3732&&l<=3735||l>=3737&&l<=3743||l>=3745&&l<=3747||l==3749||l==3751||l>=3754&&l<=3755||l>=3757&&l<=3758||l==3760||l>=3762&&l<=3763||l==3773||l>=3776&&l<=3780||l>=3904&&l<=3911||l>=3913&&l<=3945||l>=4256&&l<=4293||l>=4304&&l<=4342||l==4352||l>=4354&&l<=4355||l>=4357&&l<=4359||l==4361||l>=4363&&l<=4364||l>=4366&&l<=4370||l==4412||l==4414||l==4416||l==4428||l==4430||l==4432||l>=4436&&l<=4437||l==4441||l>=4447&&l<=4449||l==4451||l==4453||l==4455||l==4457||l>=4461&&l<=4462||l>=4466&&l<=4467||l==4469||l==4510||l==4520||l==4523||l>=4526&&l<=4527||l>=4535&&l<=4536||l==4538||l>=4540&&l<=4546||l==4587||l==4592||l==4601||l>=7680&&l<=7835||l>=7840&&l<=7929||l>=7936&&l<=7957||l>=7960&&l<=7965||l>=7968&&l<=8005||l>=8008&&l<=8013||l>=8016&&l<=8023||l==8025||l==8027||l==8029||l>=8031&&l<=8061||l>=8064&&l<=8116||l>=8118&&l<=8124||l==8126||l>=8130&&l<=8132||l>=8134&&l<=8140||l>=8144&&l<=8147||l>=8150&&l<=8155||l>=8160&&l<=8172||l>=8178&&l<=8180||l>=8182&&l<=8188||l==8486||l>=8490&&l<=8491||l==8494||l>=8576&&l<=8578||l>=12353&&l<=12436||l>=12449&&l<=12538||l>=12549&&l<=12588||l>=44032&&l<=55203||l>=19968&&l<=40869||l==12295||l>=12321&&l<=12329},P.isNCNameChar=function(l){return l>=48&&l<=57||l>=1632&&l<=1641||l>=1776&&l<=1785||l>=2406&&l<=2415||l>=2534&&l<=2543||l>=2662&&l<=2671||l>=2790&&l<=2799||l>=2918&&l<=2927||l>=3047&&l<=3055||l>=3174&&l<=3183||l>=3302&&l<=3311||l>=3430&&l<=3439||l>=3664&&l<=3673||l>=3792&&l<=3801||l>=3872&&l<=3881||l==46||l==45||l==95||P.isLetter(l)||l>=768&&l<=837||l>=864&&l<=865||l>=1155&&l<=1158||l>=1425&&l<=1441||l>=1443&&l<=1465||l>=1467&&l<=1469||l==1471||l>=1473&&l<=1474||l==1476||l>=1611&&l<=1618||l==1648||l>=1750&&l<=1756||l>=1757&&l<=1759||l>=1760&&l<=1764||l>=1767&&l<=1768||l>=1770&&l<=1773||l>=2305&&l<=2307||l==2364||l>=2366&&l<=2380||l==2381||l>=2385&&l<=2388||l>=2402&&l<=2403||l>=2433&&l<=2435||l==2492||l==2494||l==2495||l>=2496&&l<=2500||l>=2503&&l<=2504||l>=2507&&l<=2509||l==2519||l>=2530&&l<=2531||l==2562||l==2620||l==2622||l==2623||l>=2624&&l<=2626||l>=2631&&l<=2632||l>=2635&&l<=2637||l>=2672&&l<=2673||l>=2689&&l<=2691||l==2748||l>=2750&&l<=2757||l>=2759&&l<=2761||l>=2763&&l<=2765||l>=2817&&l<=2819||l==2876||l>=2878&&l<=2883||l>=2887&&l<=2888||l>=2891&&l<=2893||l>=2902&&l<=2903||l>=2946&&l<=2947||l>=3006&&l<=3010||l>=3014&&l<=3016||l>=3018&&l<=3021||l==3031||l>=3073&&l<=3075||l>=3134&&l<=3140||l>=3142&&l<=3144||l>=3146&&l<=3149||l>=3157&&l<=3158||l>=3202&&l<=3203||l>=3262&&l<=3268||l>=3270&&l<=3272||l>=3274&&l<=3277||l>=3285&&l<=3286||l>=3330&&l<=3331||l>=3390&&l<=3395||l>=3398&&l<=3400||l>=3402&&l<=3405||l==3415||l==3633||l>=3636&&l<=3642||l>=3655&&l<=3662||l==3761||l>=3764&&l<=3769||l>=3771&&l<=3772||l>=3784&&l<=3789||l>=3864&&l<=3865||l==3893||l==3895||l==3897||l==3902||l==3903||l>=3953&&l<=3972||l>=3974&&l<=3979||l>=3984&&l<=3989||l==3991||l>=3993&&l<=4013||l>=4017&&l<=4023||l==4025||l>=8400&&l<=8412||l==8417||l>=12330&&l<=12335||l==12441||l==12442||l==183||l==720||l==721||l==903||l==1600||l==3654||l==3782||l==12293||l>=12337&&l<=12341||l>=12445&&l<=12446||l>=12540&&l<=12542},P.coalesceText=function(l){for(var N=l.firstChild;N!=null;N=N.nextSibling)if(N.nodeType==He.TEXT_NODE||N.nodeType==He.CDATA_SECTION_NODE){var F=N.nodeValue,q=N;for(N=N.nextSibling;N!=null&&(N.nodeType==He.TEXT_NODE||N.nodeType==He.CDATA_SECTION_NODE);){F+=N.nodeValue;var G=N;N=N.nextSibling,G.parentNode.removeChild(G)}if(q.nodeType==He.CDATA_SECTION_NODE){var ie=q.parentNode;if(q.nextSibling==null)ie.removeChild(q),ie.appendChild(ie.ownerDocument.createTextNode(F));else{var ct=q.nextSibling;ie.removeChild(q),ie.insertBefore(ie.ownerDocument.createTextNode(F),ct)}}else q.nodeValue=F;if(N==null)break}else N.nodeType==He.ELEMENT_NODE&&P.coalesceText(N)},P.instance_of=function(l,N){for(;l!=null;){if(l.constructor===N)return!0;if(l===Object)return!1;l=l.constructor.superclass}return!1},P.getElementById=function(l,N){if(l.nodeType==He.ELEMENT_NODE&&(l.getAttribute("id")==N||l.getAttributeNS(null,"id")==N))return l;for(var F=l.firstChild;F!=null;F=F.nextSibling){var q=P.getElementById(F,N);if(q!=null)return q}return null};var ge=(function(){function l(F,q){var G=q?": "+q.toString():"";switch(F){case N.INVALID_EXPRESSION_ERR:return"Invalid expression"+G;case N.TYPE_ERR:return"Type error"+G}return null}function N(F,q,G){var ie=Error.call(this,l(F,q)||G);return ie.code=F,ie.exception=q,ie}return N.prototype=Object.create(Error.prototype),N.prototype.constructor=N,N.superclass=Error,N.prototype.toString=function(){return this.message},N.fromMessage=function(F,q){return new N(null,q,F)},N.INVALID_EXPRESSION_ERR=51,N.TYPE_ERR=52,N})();$.prototype={},$.prototype.constructor=$,$.superclass=Object.prototype;function $(l,N,F){this.xpath=F.parse(l),this.context=new _e,this.context.namespaceResolver=new y(N)}$.getOwnerDocument=function(l){return l.nodeType===He.DOCUMENT_NODE?l:l.ownerDocument},$.detectHtmlDom=function(l){if(!l)return!1;var N=$.getOwnerDocument(l);try{return N.implementation.hasFeature("HTML","2.0")}catch{return!0}},$.prototype.evaluate=function(l,N,F){this.context.expressionContextNode=l,this.context.caseInsensitive=$.detectHtmlDom(l);var q=this.xpath.evaluate(this.context);return new p(q,N)},y.prototype={},y.prototype.constructor=y,y.superclass=Object.prototype;function y(l){this.xpathNSResolver=l}y.prototype.getNamespace=function(l,N){return this.xpathNSResolver==null?null:this.xpathNSResolver.lookupNamespaceURI(l)},_.prototype={},_.prototype.constructor=_,_.superclass=Object.prototype;function _(l){this.node=l,this.namespaceResolver=new C}_.prototype.lookupNamespaceURI=function(l){return this.namespaceResolver.getNamespace(l,this.node)},p.prototype={},p.prototype.constructor=p,p.superclass=Object.prototype;function p(l,N){switch(N==p.ANY_TYPE&&(l.constructor===pe?N=p.STRING_TYPE:l.constructor===$e?N=p.NUMBER_TYPE:l.constructor===h?N=p.BOOLEAN_TYPE:l.constructor===H&&(N=p.UNORDERED_NODE_ITERATOR_TYPE)),this.resultType=N,N){case p.NUMBER_TYPE:this.numberValue=l.numberValue();return;case p.STRING_TYPE:this.stringValue=l.stringValue();return;case p.BOOLEAN_TYPE:this.booleanValue=l.booleanValue();return;case p.ANY_UNORDERED_NODE_TYPE:case p.FIRST_ORDERED_NODE_TYPE:if(l.constructor===H){this.singleNodeValue=l.first();return}break;case p.UNORDERED_NODE_ITERATOR_TYPE:case p.ORDERED_NODE_ITERATOR_TYPE:if(l.constructor===H){this.invalidIteratorState=!1,this.nodes=l.toArray(),this.iteratorIndex=0;return}break;case p.UNORDERED_NODE_SNAPSHOT_TYPE:case p.ORDERED_NODE_SNAPSHOT_TYPE:if(l.constructor===H){this.nodes=l.toArray(),this.snapshotLength=this.nodes.length;return}break}throw new ge(ge.TYPE_ERR)}p.prototype.iterateNext=function(){if(this.resultType!=p.UNORDERED_NODE_ITERATOR_TYPE&&this.resultType!=p.ORDERED_NODE_ITERATOR_TYPE)throw new ge(ge.TYPE_ERR);return this.nodes[this.iteratorIndex++]},p.prototype.snapshotItem=function(l){if(this.resultType!=p.UNORDERED_NODE_SNAPSHOT_TYPE&&this.resultType!=p.ORDERED_NODE_SNAPSHOT_TYPE)throw new ge(ge.TYPE_ERR);return this.nodes[l]},p.ANY_TYPE=0,p.NUMBER_TYPE=1,p.STRING_TYPE=2,p.BOOLEAN_TYPE=3,p.UNORDERED_NODE_ITERATOR_TYPE=4,p.ORDERED_NODE_ITERATOR_TYPE=5,p.UNORDERED_NODE_SNAPSHOT_TYPE=6,p.ORDERED_NODE_SNAPSHOT_TYPE=7,p.ANY_UNORDERED_NODE_TYPE=8,p.FIRST_ORDERED_NODE_TYPE=9;function d(l,N){l.createExpression=function(F,q){try{return new $(F,q,N)}catch(G){throw new ge(ge.INVALID_EXPRESSION_ERR,G)}},l.createNSResolver=function(F){return new _(F)},l.evaluate=function(F,q,G,ie,ct){if(ie<0||ie>9)throw{code:0,toString:function(){return"Request type not supported"}};return l.createExpression(F,G,N).evaluate(q,ie,ct)}}try{var T=!0;try{document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("XPath",null)&&(T=!1)}catch{}T&&d(document,new te)}catch{}d(i,new te),(function(){var l=new te,N=new C,F=new Ye,q=new lt;function G(ht){return{getNamespace:function(Ft,kr){var An=ht(Ft,kr);return An||N.getNamespace(Ft,kr)}}}function ie(ht){return G(ht.getNamespace.bind(ht))}function ct(ht){return G(function(Ft){return ht[Ft]})}function Mt(ht){return ht&&typeof ht.getNamespace=="function"?ie(ht):typeof ht=="function"?G(ht):typeof ht=="object"?ct(ht):N}function Pt(ht){if(ht===null||typeof ht>"u"||ht instanceof pe||ht instanceof h||ht instanceof $e||ht instanceof H)return ht;switch(typeof ht){case"string":return new pe(ht);case"boolean":return new h(ht);case"number":return new $e(ht)}var Ft=new H;return Ft.addArray([].concat(ht)),Ft}function ft(ht){return function(Ft){var kr=Array.prototype.slice.call(arguments,1).map(function(mr){return mr.evaluate(Ft)}),An=ht.apply(this,[].concat(Ft,kr));return Pt(An)}}function Nt(ht){return{getFunction:function(Ft,kr){var An=ht(Ft,kr);return An?ft(An):F.getFunction(Ft,kr)}}}function an(ht){return Nt(ht.getFunction.bind(ht))}function Sn(ht){return Nt(function(Ft){return ht[Ft]})}function Zn(ht){return ht&&typeof ht.getFunction=="function"?an(ht):typeof ht=="function"?Nt(ht):typeof ht=="object"?Sn(ht):F}function es(ht){return{getVariable:function(Ft,kr){var An=ht(Ft,kr);return Pt(An)}}}function un(ht){if(ht){if(typeof ht.getVariable=="function")return es(ht.getVariable.bind(ht));if(typeof ht=="function")return es(ht);if(typeof ht=="object")return es(function(Ft){return ht[Ft]})}return q}function Hn(ht,Ft,kr){ht in kr&&(Ft[ht]=kr[ht])}function Ws(ht){var Ft=new _e;return ht?(Ft.namespaceResolver=Mt(ht.namespaces),Ft.functionResolver=Zn(ht.functions),Ft.variableResolver=un(ht.variables),Ft.expressionContextNode=ht.node,Hn("allowAnyNamespaceForNoPrefix",Ft,ht),Hn("isHtml",Ft,ht)):Ft.namespaceResolver=N,Ft}function ou(ht,Ft){var kr=Ws(Ft);return ht.evaluate(kr)}var Xs={evaluate:function(ht){return ou(this.expression,ht)},evaluateNumber:function(ht){return this.evaluate(ht).numberValue()},evaluateString:function(ht){return this.evaluate(ht).stringValue()},evaluateBoolean:function(ht){return this.evaluate(ht).booleanValue()},evaluateNodeSet:function(ht){return this.evaluate(ht).nodeset()},select:function(ht){return this.evaluateNodeSet(ht).toArray()},select1:function(ht){return this.select(ht)[0]}};function Pl(ht){var Ft=l.parse(ht);return Object.create(Xs,{expression:{value:Ft}})}i.parse=Pl})(),$t(i,{XPath:ve,XPathParser:te,XPathResult:p,Step:U,PathExpr:rt,NodeTest:ne,LocationPath:ae,OrOperation:we,AndOperation:Qe,BarOperation:gt,EqualsOperation:De,NotEqualOperation:me,LessThanOperation:ue,GreaterThanOperation:Le,LessThanOrEqualOperation:se,GreaterThanOrEqualOperation:Q,PlusOperation:ce,MinusOperation:Ze,MultiplyOperation:Ae,DivOperation:it,ModOperation:ze,UnaryMinusOperation:ot,FunctionCall:Ue,VariableReference:fe,XPathContext:_e,XNodeSet:H,XBoolean:h,XString:pe,XNumber:$e,NamespaceResolver:C,FunctionResolver:Ye,VariableResolver:lt,Utilities:P}),i.select=function(l,N,F){return i.selectWithResolver(l,N,null,F)},i.useNamespaces=function(l){var N={mappings:l||{},lookupNamespaceURI:function(F){return this.mappings[F]}};return function(F,q,G){return i.selectWithResolver(F,q,N,G)}},i.selectWithResolver=function(l,N,F,q){var G=new $(l,F,new te),ie=p.ANY_TYPE,ct=G.evaluate(N,ie,null);return ct.resultType==p.STRING_TYPE?ct=ct.stringValue:ct.resultType==p.NUMBER_TYPE?ct=ct.numberValue:ct.resultType==p.BOOLEAN_TYPE?ct=ct.booleanValue:(ct=ct.nodes,q&&(ct=ct[0])),ct},i.select1=function(l,N){return i.select(l,N,!0)};var O=function(l){return Array.isArray(l)&&l.every(R)},B=function(l){return function(N){return R(N)&&N.nodeType===l}};$t(i,{isNodeLike:R,isArrayOfNodes:O,isElement:B(He.ELEMENT_NODE),isAttribute:B(He.ATTRIBUTE_NODE),isTextNode:B(He.TEXT_NODE),isCDATASection:B(He.CDATA_SECTION_NODE),isProcessingInstruction:B(He.PROCESSING_INSTRUCTION_NODE),isComment:B(He.COMMENT_NODE),isDocumentNode:B(He.DOCUMENT_NODE),isDocumentTypeNode:B(He.DOCUMENT_TYPE_NODE),isDocumentFragment:B(He.DOCUMENT_FRAGMENT_NODE)})})(g)})(Jg)),Jg}var lb=ib();const ab=P$(lb);var sd={},Qg={},B_;function ub(){return B_||(B_=1,Qg.entityMap={lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),Qg}var y$={},U_;function cb(){if(U_)return y$;U_=1;var f=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,g=new RegExp("[\\-\\.0-9"+f.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),i=new RegExp("^"+f.source+g.source+"*(?::"+f.source+g.source+"*)?$"),a=0,v=1,A=2,R=3,V=4,j=5,ee=6,he=7;function J(ve,Ve){this.message=ve,this.locator=Ve,Error.captureStackTrace&&Error.captureStackTrace(this,J)}J.prototype=new Error,J.prototype.name=J.name;function W(){}W.prototype={parse:function(ve,Ve,Xe){var dt=this.domBuilder;dt.startDocument(),ut(Ve,Ve={}),X(ve,Ve,Xe,dt,this.errorHandler),dt.endDocument()}};function X(ve,Ve,Xe,dt,ot){function Ke(Ne){if(Ne>65535){Ne-=65536;var pe=55296+(Ne>>10),$e=56320+(Ne&1023);return String.fromCharCode(pe,$e)}else return String.fromCharCode(Ne)}function we(Ne){var pe=Ne.slice(1,-1);return pe in Xe?Xe[pe]:pe.charAt(0)==="#"?Ke(parseInt(pe.substr(1).replace("x","0x"))):(ot.error("entity not found:"+Ne),Ne)}function Qe(Ne){if(Ne>Ze){var pe=ve.substring(Ze,Ne).replace(/&#?\w+;/g,we);se&&De(Ze),dt.characters(pe,0,Ne-Ze),Ze=Ne}}function De(Ne,pe){for(;Ne>=ue&&(pe=Le.exec(ve));)me=pe.index,ue=me+pe[0].length,se.lineNumber++;se.columnNumber=Ne-me+1}for(var me=0,ue=0,Le=/.*(?:\r\n?|\n)|.*$/g,se=dt.locator,Q=[{currentNSMap:Ve}],ce={},Ze=0;;){try{var Ae=ve.indexOf("<",Ze);if(Ae<0){if(!ve.substr(Ze).match(/^\s*$/)){var it=dt.doc,ze=it.createTextNode(ve.substr(Ze));it.appendChild(ze),dt.currentElement=ze}return}switch(Ae>Ze&&Qe(Ae),ve.charAt(Ae+1)){case"/":var U=ve.indexOf(">",Ae+3),gt=ve.substring(Ae+2,U),rt=Q.pop();U<0?(gt=ve.substring(Ae+2).replace(/[\s<].*/,""),ot.error("end tag name: "+gt+" is not complete:"+rt.tagName),U=Ae+1+gt.length):gt.match(/\s</)&&(gt=gt.replace(/[\s<].*/,""),ot.error("end tag name: "+gt+" maybe not complete"),U=Ae+1+gt.length);var Ot=rt.localNSMap,qe=rt.tagName==gt,Ut=qe||rt.tagName&&rt.tagName.toLowerCase()==gt.toLowerCase();if(Ut){if(dt.endElement(rt.uri,rt.localName,gt),Ot)for(var Oe in Ot)dt.endPrefixMapping(Oe);qe||ot.fatalError("end tag name: "+gt+" is not match the current start tagName:"+rt.tagName)}else Q.push(rt);U++;break;case"?":se&&De(Ae),U=$t(ve,Ae,dt);break;case"!":se&&De(Ae),U=st(ve,Ae,dt,ot);break;default:se&&De(Ae);var L=new He,ae=Q[Q.length-1].currentNSMap,U=ye(ve,Ae,L,ae,we,ot),Te=L.length;if(!L.closed&&Be(ve,U,L.tagName,ce)&&(L.closed=!0,Xe.nbsp||ot.warning("unclosed xml attribute")),se&&Te){for(var ne=re(se,{}),fe=0;fe<Te;fe++){var Ue=L[fe];De(Ue.offset),Ue.locator=re(se,{})}dt.locator=ne,Me(L,dt,ae)&&Q.push(L),dt.locator=se}else Me(L,dt,ae)&&Q.push(L);L.uri==="http://www.w3.org/1999/xhtml"&&!L.closed?U=Pe(ve,U,L.tagName,we,dt):U++}}catch(Ne){if(Ne instanceof J)throw Ne;ot.error("element parse error: "+Ne),U=-1}U>Ze?Ze=U:Qe(Math.max(Ae,Ze)+1)}}function re(ve,Ve){return Ve.lineNumber=ve.lineNumber,Ve.columnNumber=ve.columnNumber,Ve}function ye(ve,Ve,Xe,dt,ot,Ke){function we(se,Q,ce){se in Xe.attributeNames&&Ke.fatalError("Attribute "+se+" redefined"),Xe.addValue(se,Q,ce)}for(var Qe,De,me=++Ve,ue=a;;){var Le=ve.charAt(me);switch(Le){case"=":if(ue===v)Qe=ve.slice(Ve,me),ue=R;else if(ue===A)ue=R;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(ue===R||ue===v)if(ue===v&&(Ke.warning('attribute value must after "="'),Qe=ve.slice(Ve,me)),Ve=me+1,me=ve.indexOf(Le,Ve),me>0)De=ve.slice(Ve,me).replace(/&#?\w+;/g,ot),we(Qe,De,Ve-1),ue=j;else throw new Error("attribute value no end '"+Le+"' match");else if(ue==V)De=ve.slice(Ve,me).replace(/&#?\w+;/g,ot),we(Qe,De,Ve),Ke.warning('attribute "'+Qe+'" missed start quot('+Le+")!!"),Ve=me+1,ue=j;else throw new Error('attribute value must after "="');break;case"/":switch(ue){case a:Xe.setTagName(ve.slice(Ve,me));case j:case ee:case he:ue=he,Xe.closed=!0;case V:case v:case A:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return Ke.error("unexpected end of input"),ue==a&&Xe.setTagName(ve.slice(Ve,me)),me;case">":switch(ue){case a:Xe.setTagName(ve.slice(Ve,me));case j:case ee:case he:break;case V:case v:De=ve.slice(Ve,me),De.slice(-1)==="/"&&(Xe.closed=!0,De=De.slice(0,-1));case A:ue===A&&(De=Qe),ue==V?(Ke.warning('attribute "'+De+'" missed quot(")!'),we(Qe,De.replace(/&#?\w+;/g,ot),Ve)):((dt[""]!=="http://www.w3.org/1999/xhtml"||!De.match(/^(?:disabled|checked|selected)$/i))&&Ke.warning('attribute "'+De+'" missed value!! "'+De+'" instead!!'),we(De,De,Ve));break;case R:throw new Error("attribute value missed!!")}return me;case"€":Le=" ";default:if(Le<=" ")switch(ue){case a:Xe.setTagName(ve.slice(Ve,me)),ue=ee;break;case v:Qe=ve.slice(Ve,me),ue=A;break;case V:var De=ve.slice(Ve,me).replace(/&#?\w+;/g,ot);Ke.warning('attribute "'+De+'" missed quot(")!!'),we(Qe,De,Ve);case j:ue=ee;break}else switch(ue){case A:Xe.tagName,(dt[""]!=="http://www.w3.org/1999/xhtml"||!Qe.match(/^(?:disabled|checked|selected)$/i))&&Ke.warning('attribute "'+Qe+'" missed value!! "'+Qe+'" instead2!!'),we(Qe,Qe,Ve),Ve=me,ue=v;break;case j:Ke.warning('attribute space is required"'+Qe+'"!!');case ee:ue=v,Ve=me;break;case R:ue=V,Ve=me;break;case he:throw new Error("elements closed character '/' and '>' must be connected to")}}me++}}function Me(ve,Ve,Xe){for(var dt=ve.tagName,ot=null,Le=ve.length;Le--;){var Ke=ve[Le],we=Ke.qName,Qe=Ke.value,se=we.indexOf(":");if(se>0)var De=Ke.prefix=we.slice(0,se),me=we.slice(se+1),ue=De==="xmlns"&&me;else me=we,De=null,ue=we==="xmlns"&&"";Ke.localName=me,ue!==!1&&(ot==null&&(ot={},ut(Xe,Xe={})),Xe[ue]=ot[ue]=Qe,Ke.uri="http://www.w3.org/2000/xmlns/",Ve.startPrefixMapping(ue,Qe))}for(var Le=ve.length;Le--;){Ke=ve[Le];var De=Ke.prefix;De&&(De==="xml"&&(Ke.uri="http://www.w3.org/XML/1998/namespace"),De!=="xmlns"&&(Ke.uri=Xe[De||""]))}var se=dt.indexOf(":");se>0?(De=ve.prefix=dt.slice(0,se),me=ve.localName=dt.slice(se+1)):(De=null,me=ve.localName=dt);var Q=ve.uri=Xe[De||""];if(Ve.startElement(Q,me,dt,ve),ve.closed){if(Ve.endElement(Q,me,dt),ot)for(De in ot)Ve.endPrefixMapping(De)}else return ve.currentNSMap=Xe,ve.localNSMap=ot,!0}function Pe(ve,Ve,Xe,dt,ot){if(/^(?:script|textarea)$/i.test(Xe)){var Ke=ve.indexOf("</"+Xe+">",Ve),we=ve.substring(Ve+1,Ke);if(/[&<]/.test(we))return/^script$/i.test(Xe)?(ot.characters(we,0,we.length),Ke):(we=we.replace(/&#?\w+;/g,dt),ot.characters(we,0,we.length),Ke)}return Ve+1}function Be(ve,Ve,Xe,dt){var ot=dt[Xe];return ot==null&&(ot=ve.lastIndexOf("</"+Xe+">"),ot<Ve&&(ot=ve.lastIndexOf("</"+Xe)),dt[Xe]=ot),ot<Ve}function ut(ve,Ve){for(var Xe in ve)Ve[Xe]=ve[Xe]}function st(ve,Ve,Xe,dt){var ot=ve.charAt(Ve+2);switch(ot){case"-":if(ve.charAt(Ve+3)==="-"){var Ke=ve.indexOf("-->",Ve+4);return Ke>Ve?(Xe.comment(ve,Ve+4,Ke-Ve-4),Ke+3):(dt.error("Unclosed comment"),-1)}else return-1;default:if(ve.substr(Ve+3,6)=="CDATA["){var Ke=ve.indexOf("]]>",Ve+9);return Xe.startCDATA(),Xe.characters(ve,Ve+9,Ke-Ve-9),Xe.endCDATA(),Ke+3}var we=te(ve,Ve),Qe=we.length;if(Qe>1&&/!doctype/i.test(we[0][0])){var De=we[1][0],me=!1,ue=!1;Qe>3&&(/^public$/i.test(we[2][0])?(me=we[3][0],ue=Qe>4&&we[4][0]):/^system$/i.test(we[2][0])&&(ue=we[3][0]));var Le=we[Qe-1];return Xe.startDTD(De,me,ue),Xe.endDTD(),Le.index+Le[0].length}}return-1}function $t(ve,Ve,Xe){var dt=ve.indexOf("?>",Ve);if(dt){var ot=ve.substring(Ve,dt).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return ot?(ot[0].length,Xe.processingInstruction(ot[1],ot[2]),dt+2):-1}return-1}function He(){this.attributeNames={}}He.prototype={setTagName:function(ve){if(!i.test(ve))throw new Error("invalid tagName:"+ve);this.tagName=ve},addValue:function(ve,Ve,Xe){if(!i.test(ve))throw new Error("invalid attribute:"+ve);this.attributeNames[ve]=this.length,this[this.length++]={qName:ve,value:Ve,offset:Xe}},length:0,getLocalName:function(ve){return this[ve].localName},getLocator:function(ve){return this[ve].locator},getQName:function(ve){return this[ve].qName},getURI:function(ve){return this[ve].uri},getValue:function(ve){return this[ve].value}};function te(ve,Ve){var Xe,dt=[],ot=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(ot.lastIndex=Ve,ot.exec(ve);Xe=ot.exec(ve);)if(dt.push(Xe),Xe[1])return dt}return y$.XMLReader=W,y$.ParseError=J,y$}var od={},V_;function H_(){if(V_)return od;V_=1;function f(M,h){for(var w in M)h[w]=M[w]}function g(M,h){var w=M.prototype;if(!(w instanceof h)){let H=function(){};var Z=H;H.prototype=h.prototype,H=new H,f(w,H),M.prototype=w=H}w.constructor!=M&&(typeof M!="function"&&console.error("unknow Class:"+M),w.constructor=M)}var i="http://www.w3.org/1999/xhtml",a={},v=a.ELEMENT_NODE=1,A=a.ATTRIBUTE_NODE=2,R=a.TEXT_NODE=3,V=a.CDATA_SECTION_NODE=4,j=a.ENTITY_REFERENCE_NODE=5,ee=a.ENTITY_NODE=6,he=a.PROCESSING_INSTRUCTION_NODE=7,J=a.COMMENT_NODE=8,W=a.DOCUMENT_NODE=9,X=a.DOCUMENT_TYPE_NODE=10,re=a.DOCUMENT_FRAGMENT_NODE=11,ye=a.NOTATION_NODE=12,Me={},Pe={};Me.INDEX_SIZE_ERR=(Pe[1]="Index size error",1),Me.DOMSTRING_SIZE_ERR=(Pe[2]="DOMString size error",2);var Be=Me.HIERARCHY_REQUEST_ERR=(Pe[3]="Hierarchy request error",3);Me.WRONG_DOCUMENT_ERR=(Pe[4]="Wrong document",4),Me.INVALID_CHARACTER_ERR=(Pe[5]="Invalid character",5),Me.NO_DATA_ALLOWED_ERR=(Pe[6]="No data allowed",6),Me.NO_MODIFICATION_ALLOWED_ERR=(Pe[7]="No modification allowed",7);var ut=Me.NOT_FOUND_ERR=(Pe[8]="Not found",8);Me.NOT_SUPPORTED_ERR=(Pe[9]="Not supported",9);var st=Me.INUSE_ATTRIBUTE_ERR=(Pe[10]="Attribute in use",10);Me.INVALID_STATE_ERR=(Pe[11]="Invalid state",11),Me.SYNTAX_ERR=(Pe[12]="Syntax error",12),Me.INVALID_MODIFICATION_ERR=(Pe[13]="Invalid modification",13),Me.NAMESPACE_ERR=(Pe[14]="Invalid namespace",14),Me.INVALID_ACCESS_ERR=(Pe[15]="Invalid access",15);function $t(M,h){if(h instanceof Error)var w=h;else w=this,Error.call(this,Pe[M]),this.message=Pe[M],Error.captureStackTrace&&Error.captureStackTrace(this,$t);return w.code=M,h&&(this.message=this.message+": "+h),w}$t.prototype=Error.prototype,f(Me,$t);function He(){}He.prototype={length:0,item:function(M){return this[M]||null},toString:function(M,h){for(var w=[],Z=0;Z<this.length;Z++)Ue(this[Z],w,M,h);return w.join("")}};function te(M,h){this._node=M,this._refresh=h,ve(this)}function ve(M){var h=M._node._inc||M._node.ownerDocument._inc;if(M._inc!=h){var w=M._refresh(M._node);$e(M,"length",w.length),f(w,M),M._inc=h}}te.prototype.item=function(M){return ve(this),this[M]},g(te,He);function Ve(){}function Xe(M,h){for(var w=M.length;w--;)if(M[w]===h)return w}function dt(M,h,w,Z){if(Z?h[Xe(h,Z)]=w:h[h.length++]=w,M){w.ownerElement=M;var H=M.ownerDocument;H&&(Z&&Le(H,M,Z),ue(H,M,w))}}function ot(M,h,w){var Z=Xe(h,w);if(Z>=0){for(var H=h.length-1;Z<H;)h[Z]=h[++Z];if(h.length=H,M){var Re=M.ownerDocument;Re&&(Le(Re,M,w),w.ownerElement=null)}}else throw $t(ut,new Error(M.tagName+"@"+w))}Ve.prototype={length:0,item:He.prototype.item,getNamedItem:function(M){for(var h=this.length;h--;){var w=this[h];if(w.nodeName==M)return w}},setNamedItem:function(M){var h=M.ownerElement;if(h&&h!=this._ownerElement)throw new $t(st);var w=this.getNamedItem(M.nodeName);return dt(this._ownerElement,this,M,w),w},setNamedItemNS:function(M){var h=M.ownerElement,w;if(h&&h!=this._ownerElement)throw new $t(st);return w=this.getNamedItemNS(M.namespaceURI,M.localName),dt(this._ownerElement,this,M,w),w},removeNamedItem:function(M){var h=this.getNamedItem(M);return ot(this._ownerElement,this,h),h},removeNamedItemNS:function(M,h){var w=this.getNamedItemNS(M,h);return ot(this._ownerElement,this,w),w},getNamedItemNS:function(M,h){for(var w=this.length;w--;){var Z=this[w];if(Z.localName==h&&Z.namespaceURI==M)return Z}return null}};function Ke(M){if(this._features={},M)for(var h in M)this._features=M[h]}Ke.prototype={hasFeature:function(M,h){var w=this._features[M.toLowerCase()];return!!(w&&(!h||h in w))},createDocument:function(M,h,w){var Z=new me;if(Z.implementation=this,Z.childNodes=new He,Z.doctype=w,w&&Z.appendChild(w),h){var H=Z.createElementNS(M,h);Z.appendChild(H)}return Z},createDocumentType:function(M,h,w){var Z=new qe;return Z.name=M,Z.nodeName=M,Z.publicId=h,Z.systemId=w,Z}};function we(){}we.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(M,h){return ce(this,M,h)},replaceChild:function(M,h){this.insertBefore(M,h),h&&this.removeChild(h)},removeChild:function(M){return Q(this,M)},appendChild:function(M){return this.insertBefore(M,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(M){return pe(this.ownerDocument||this,this,M)},normalize:function(){for(var M=this.firstChild;M;){var h=M.nextSibling;h&&h.nodeType==R&&M.nodeType==R?(this.removeChild(h),M.appendData(h.data)):(M.normalize(),M=h)}},isSupported:function(M,h){return this.ownerDocument.implementation.hasFeature(M,h)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(M){for(var h=this;h;){var w=h._nsMap;if(w){for(var Z in w)if(w[Z]==M)return Z}h=h.nodeType==A?h.ownerDocument:h.parentNode}return null},lookupNamespaceURI:function(M){for(var h=this;h;){var w=h._nsMap;if(w&&M in w)return w[M];h=h.nodeType==A?h.ownerDocument:h.parentNode}return null},isDefaultNamespace:function(M){var h=this.lookupPrefix(M);return h==null}};function Qe(M){return M=="<"&&"&lt;"||M==">"&&"&gt;"||M=="&"&&"&amp;"||M=='"'&&"&quot;"||"&#"+M.charCodeAt()+";"}f(a,we),f(a,we.prototype);function De(M,h){if(h(M))return!0;if(M=M.firstChild)do if(De(M,h))return!0;while(M=M.nextSibling)}function me(){}function ue(M,h,w){M&&M._inc++;var Z=w.namespaceURI;Z=="http://www.w3.org/2000/xmlns/"&&(h._nsMap[w.prefix?w.localName:""]=w.value)}function Le(M,h,w,Z){M&&M._inc++;var H=w.namespaceURI;H=="http://www.w3.org/2000/xmlns/"&&delete h._nsMap[w.prefix?w.localName:""]}function se(M,h,w){if(M&&M._inc){M._inc++;var Z=h.childNodes;if(w)Z[Z.length++]=w;else{for(var H=h.firstChild,Re=0;H;)Z[Re++]=H,H=H.nextSibling;Z.length=Re}}}function Q(M,h){var w=h.previousSibling,Z=h.nextSibling;return w?w.nextSibling=Z:M.firstChild=Z,Z?Z.previousSibling=w:M.lastChild=w,se(M.ownerDocument,M),h}function ce(M,h,w){var Z=h.parentNode;if(Z&&Z.removeChild(h),h.nodeType===re){var H=h.firstChild;if(H==null)return h;var Re=h.lastChild}else H=Re=h;var _e=w?w.previousSibling:M.lastChild;H.previousSibling=_e,Re.nextSibling=w,_e?_e.nextSibling=H:M.firstChild=H,w==null?M.lastChild=Re:w.previousSibling=Re;do H.parentNode=M;while(H!==Re&&(H=H.nextSibling));return se(M.ownerDocument||M,M),h.nodeType==re&&(h.firstChild=h.lastChild=null),h}function Ze(M,h){var w=h.parentNode;if(w){var Z=M.lastChild;w.removeChild(h);var Z=M.lastChild}var Z=M.lastChild;return h.parentNode=M,h.previousSibling=Z,h.nextSibling=null,Z?Z.nextSibling=h:M.firstChild=h,M.lastChild=h,se(M.ownerDocument,M,h),h}me.prototype={nodeName:"#document",nodeType:W,doctype:null,documentElement:null,_inc:1,insertBefore:function(M,h){if(M.nodeType==re){for(var w=M.firstChild;w;){var Z=w.nextSibling;this.insertBefore(w,h),w=Z}return M}return this.documentElement==null&&M.nodeType==v&&(this.documentElement=M),ce(this,M,h),M.ownerDocument=this,M},removeChild:function(M){return this.documentElement==M&&(this.documentElement=null),Q(this,M)},importNode:function(M,h){return Ne(this,M,h)},getElementById:function(M){var h=null;return De(this.documentElement,function(w){if(w.nodeType==v&&w.getAttribute("id")==M)return h=w,!0}),h},getElementsByClassName:function(M){var h=new RegExp("(^|\\s)"+M+"(\\s|$)");return new te(this,function(w){var Z=[];return De(w.documentElement,function(H){H!==w&&H.nodeType==v&&h.test(H.getAttribute("class"))&&Z.push(H)}),Z})},createElement:function(M){var h=new Ae;h.ownerDocument=this,h.nodeName=M,h.tagName=M,h.childNodes=new He;var w=h.attributes=new Ve;return w._ownerElement=h,h},createDocumentFragment:function(){var M=new ae;return M.ownerDocument=this,M.childNodes=new He,M},createTextNode:function(M){var h=new gt;return h.ownerDocument=this,h.appendData(M),h},createComment:function(M){var h=new rt;return h.ownerDocument=this,h.appendData(M),h},createCDATASection:function(M){var h=new Ot;return h.ownerDocument=this,h.appendData(M),h},createProcessingInstruction:function(M,h){var w=new U;return w.ownerDocument=this,w.tagName=w.target=M,w.nodeValue=w.data=h,w},createAttribute:function(M){var h=new it;return h.ownerDocument=this,h.name=M,h.nodeName=M,h.localName=M,h.specified=!0,h},createEntityReference:function(M){var h=new L;return h.ownerDocument=this,h.nodeName=M,h},createElementNS:function(M,h){var w=new Ae,Z=h.split(":"),H=w.attributes=new Ve;return w.childNodes=new He,w.ownerDocument=this,w.nodeName=h,w.tagName=h,w.namespaceURI=M,Z.length==2?(w.prefix=Z[0],w.localName=Z[1]):w.localName=h,H._ownerElement=w,w},createAttributeNS:function(M,h){var w=new it,Z=h.split(":");return w.ownerDocument=this,w.nodeName=h,w.name=h,w.namespaceURI=M,w.specified=!0,Z.length==2?(w.prefix=Z[0],w.localName=Z[1]):w.localName=h,w}},g(me,we);function Ae(){this._nsMap={}}Ae.prototype={nodeType:v,hasAttribute:function(M){return this.getAttributeNode(M)!=null},getAttribute:function(M){var h=this.getAttributeNode(M);return h&&h.value||""},getAttributeNode:function(M){return this.attributes.getNamedItem(M)},setAttribute:function(M,h){var w=this.ownerDocument.createAttribute(M);w.value=w.nodeValue=""+h,this.setAttributeNode(w)},removeAttribute:function(M){var h=this.getAttributeNode(M);h&&this.removeAttributeNode(h)},appendChild:function(M){return M.nodeType===re?this.insertBefore(M,null):Ze(this,M)},setAttributeNode:function(M){return this.attributes.setNamedItem(M)},setAttributeNodeNS:function(M){return this.attributes.setNamedItemNS(M)},removeAttributeNode:function(M){return this.attributes.removeNamedItem(M.nodeName)},removeAttributeNS:function(M,h){var w=this.getAttributeNodeNS(M,h);w&&this.removeAttributeNode(w)},hasAttributeNS:function(M,h){return this.getAttributeNodeNS(M,h)!=null},getAttributeNS:function(M,h){var w=this.getAttributeNodeNS(M,h);return w&&w.value||""},setAttributeNS:function(M,h,w){var Z=this.ownerDocument.createAttributeNS(M,h);Z.value=Z.nodeValue=""+w,this.setAttributeNode(Z)},getAttributeNodeNS:function(M,h){return this.attributes.getNamedItemNS(M,h)},getElementsByTagName:function(M){return new te(this,function(h){var w=[];return De(h,function(Z){Z!==h&&Z.nodeType==v&&(M==="*"||Z.tagName==M)&&w.push(Z)}),w})},getElementsByTagNameNS:function(M,h){return new te(this,function(w){var Z=[];return De(w,function(H){H!==w&&H.nodeType===v&&(M==="*"||H.namespaceURI===M)&&(h==="*"||H.localName==h)&&Z.push(H)}),Z})}},me.prototype.getElementsByTagName=Ae.prototype.getElementsByTagName,me.prototype.getElementsByTagNameNS=Ae.prototype.getElementsByTagNameNS,g(Ae,we);function it(){}it.prototype.nodeType=A,g(it,we);function ze(){}ze.prototype={data:"",substringData:function(M,h){return this.data.substring(M,M+h)},appendData:function(M){M=this.data+M,this.nodeValue=this.data=M,this.length=M.length},insertData:function(M,h){this.replaceData(M,0,h)},appendChild:function(M){throw new Error(Pe[Be])},deleteData:function(M,h){this.replaceData(M,h,"")},replaceData:function(M,h,w){var Z=this.data.substring(0,M),H=this.data.substring(M+h);w=Z+w+H,this.nodeValue=this.data=w,this.length=w.length}},g(ze,we);function gt(){}gt.prototype={nodeName:"#text",nodeType:R,splitText:function(M){var h=this.data,w=h.substring(M);h=h.substring(0,M),this.data=this.nodeValue=h,this.length=h.length;var Z=this.ownerDocument.createTextNode(w);return this.parentNode&&this.parentNode.insertBefore(Z,this.nextSibling),Z}},g(gt,ze);function rt(){}rt.prototype={nodeName:"#comment",nodeType:J},g(rt,ze);function Ot(){}Ot.prototype={nodeName:"#cdata-section",nodeType:V},g(Ot,ze);function qe(){}qe.prototype.nodeType=X,g(qe,we);function Ut(){}Ut.prototype.nodeType=ye,g(Ut,we);function Oe(){}Oe.prototype.nodeType=ee,g(Oe,we);function L(){}L.prototype.nodeType=j,g(L,we);function ae(){}ae.prototype.nodeName="#document-fragment",ae.prototype.nodeType=re,g(ae,we);function U(){}U.prototype.nodeType=he,g(U,we);function Te(){}Te.prototype.serializeToString=function(M,h,w){return ne.call(M,h,w)},we.prototype.toString=ne;function ne(M,h){var w=[],Z=this.nodeType==9&&this.documentElement||this,H=Z.prefix,Re=Z.namespaceURI;if(Re&&H==null){var H=Z.lookupPrefix(Re);if(H==null)var _e=[{namespace:Re,prefix:null}]}return Ue(this,w,M,h,_e),w.join("")}function fe(M,h,w){var Z=M.prefix||"",H=M.namespaceURI;if(!Z&&!H||Z==="xml"&&H==="http://www.w3.org/XML/1998/namespace"||H=="http://www.w3.org/2000/xmlns/")return!1;for(var Re=w.length;Re--;){var _e=w[Re];if(_e.prefix==Z)return _e.namespace!=H}return!0}function Ue(M,h,w,Z,H){if(Z)if(M=Z(M),M){if(typeof M=="string"){h.push(M);return}}else return;switch(M.nodeType){case v:H||(H=[]),H.length;var Re=M.attributes,_e=Re.length,ge=M.firstChild,lt=M.tagName;w=i===M.namespaceURI||w,h.push("<",lt);for(var Ye=0;Ye<_e;Ye++){var C=Re.item(Ye);C.prefix=="xmlns"?H.push({prefix:C.localName,namespace:C.value}):C.nodeName=="xmlns"&&H.push({prefix:"",namespace:C.value})}for(var Ye=0;Ye<_e;Ye++){var C=Re.item(Ye);if(fe(C,w,H)){var x=C.prefix||"",P=C.namespaceURI,Y=x?" xmlns:"+x:" xmlns";h.push(Y,'="',P,'"'),H.push({prefix:x,namespace:P})}Ue(C,h,w,Z,H)}if(fe(M,w,H)){var x=M.prefix||"",P=M.namespaceURI;if(P){var Y=x?" xmlns:"+x:" xmlns";h.push(Y,'="',P,'"'),H.push({prefix:x,namespace:P})}}if(ge||w&&!/^(?:meta|link|img|br|hr|input)$/i.test(lt)){if(h.push(">"),w&&/^script$/i.test(lt))for(;ge;)ge.data?h.push(ge.data):Ue(ge,h,w,Z,H),ge=ge.nextSibling;else for(;ge;)Ue(ge,h,w,Z,H),ge=ge.nextSibling;h.push("</",lt,">")}else h.push("/>");return;case W:case re:for(var ge=M.firstChild;ge;)Ue(ge,h,w,Z,H),ge=ge.nextSibling;return;case A:return h.push(" ",M.name,'="',M.value.replace(/[<&"]/g,Qe),'"');case R:return h.push(M.data.replace(/[<&]/g,Qe).replace(/]]>/g,"]]&gt;"));case V:return h.push("<![CDATA[",M.data,"]]>");case J:return h.push("<!--",M.data,"-->");case X:var $=M.publicId,y=M.systemId;if(h.push("<!DOCTYPE ",M.name),$)h.push(" PUBLIC ",$),y&&y!="."&&h.push(" ",y),h.push(">");else if(y&&y!=".")h.push(" SYSTEM ",y,">");else{var _=M.internalSubset;_&&h.push(" [",_,"]"),h.push(">")}return;case he:return h.push("<?",M.target," ",M.data,"?>");case j:return h.push("&",M.nodeName,";");default:h.push("??",M.nodeName)}}function Ne(M,h,w){var Z;switch(h.nodeType){case v:Z=h.cloneNode(!1),Z.ownerDocument=M;case re:break;case A:w=!0;break}if(Z||(Z=h.cloneNode(!1)),Z.ownerDocument=M,Z.parentNode=null,w)for(var H=h.firstChild;H;)Z.appendChild(Ne(M,H,w)),H=H.nextSibling;return Z}function pe(M,h,w){var Z=new h.constructor;for(var H in h){var Re=h[H];typeof Re!="object"&&Re!=Z[H]&&(Z[H]=Re)}switch(h.childNodes&&(Z.childNodes=new He),Z.ownerDocument=M,Z.nodeType){case v:var _e=h.attributes,lt=Z.attributes=new Ve,Ye=_e.length;lt._ownerElement=Z;for(var C=0;C<Ye;C++)Z.setAttributeNode(pe(M,_e.item(C),!0));break;case A:w=!0}if(w)for(var x=h.firstChild;x;)Z.appendChild(pe(M,x,w)),x=x.nextSibling;return Z}function $e(M,h,w){M[h]=w}try{if(Object.defineProperty){let M=function(h){switch(h.nodeType){case v:case re:var w=[];for(h=h.firstChild;h;)h.nodeType!==7&&h.nodeType!==8&&w.push(M(h)),h=h.nextSibling;return w.join("");default:return h.nodeValue}};var et=M;Object.defineProperty(te.prototype,"length",{get:function(){return ve(this),this.$$length}}),Object.defineProperty(we.prototype,"textContent",{get:function(){return M(this)},set:function(h){switch(this.nodeType){case v:case re:for(;this.firstChild;)this.removeChild(this.firstChild);(h||String(h))&&this.appendChild(this.ownerDocument.createTextNode(h));break;default:this.data=h,this.value=h,this.nodeValue=h}}}),$e=function(h,w,Z){h["$$"+w]=Z}}}catch{}return od.Node=we,od.DOMException=$t,od.DOMImplementation=Ke,od.XMLSerializer=Te,od}var G_;function db(){if(G_)return sd;G_=1;function f(W){this.options=W||{locator:{}}}f.prototype.parseFromString=function(W,X){var re=this.options,ye=new ee,Me=re.domBuilder||new i,Pe=re.errorHandler,Be=re.locator,ut=re.xmlns||{},st=/\/x?html?$/.test(X),$t=st?V.entityMap:{lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return Be&&Me.setDocumentLocator(Be),ye.errorHandler=g(Pe,Me,Be),ye.domBuilder=re.domBuilder||Me,st&&(ut[""]="http://www.w3.org/1999/xhtml"),ut.xml=ut.xml||"http://www.w3.org/XML/1998/namespace",W&&typeof W=="string"?ye.parse(W,ut,$t):ye.errorHandler.error("invalid doc source"),Me.doc};function g(W,X,re){if(!W){if(X instanceof i)return X;W=X}var ye={},Me=W instanceof Function;re=re||{};function Pe(Be){var ut=W[Be];!ut&&Me&&(ut=W.length==2?function(st){W(Be,st)}:W),ye[Be]=ut&&function(st){ut("[xmldom "+Be+"] "+st+v(re))}||function(){}}return Pe("warning"),Pe("error"),Pe("fatalError"),ye}function i(){this.cdata=!1}function a(W,X){X.lineNumber=W.lineNumber,X.columnNumber=W.columnNumber}i.prototype={startDocument:function(){this.doc=new J().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(W,X,re,ye){var Me=this.doc,Pe=Me.createElementNS(W,re||X),Be=ye.length;R(this,Pe),this.currentElement=Pe,this.locator&&a(this.locator,Pe);for(var ut=0;ut<Be;ut++){var W=ye.getURI(ut),st=ye.getValue(ut),re=ye.getQName(ut),$t=Me.createAttributeNS(W,re);this.locator&&a(ye.getLocator(ut),$t),$t.value=$t.nodeValue=st,Pe.setAttributeNode($t)}},endElement:function(W,X,re){var ye=this.currentElement;ye.tagName,this.currentElement=ye.parentNode},startPrefixMapping:function(W,X){},endPrefixMapping:function(W){},processingInstruction:function(W,X){var re=this.doc.createProcessingInstruction(W,X);this.locator&&a(this.locator,re),R(this,re)},ignorableWhitespace:function(W,X,re){},characters:function(W,X,re){if(W=A.apply(this,arguments),W){if(this.cdata)var ye=this.doc.createCDATASection(W);else var ye=this.doc.createTextNode(W);this.currentElement?this.currentElement.appendChild(ye):/^\s*$/.test(W)&&this.doc.appendChild(ye),this.locator&&a(this.locator,ye)}},skippedEntity:function(W){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(W){(this.locator=W)&&(W.lineNumber=0)},comment:function(W,X,re){W=A.apply(this,arguments);var ye=this.doc.createComment(W);this.locator&&a(this.locator,ye),R(this,ye)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(W,X,re){var ye=this.doc.implementation;if(ye&&ye.createDocumentType){var Me=ye.createDocumentType(W,X,re);this.locator&&a(this.locator,Me),R(this,Me)}},warning:function(W){console.warn("[xmldom warning] "+W,v(this.locator))},error:function(W){console.error("[xmldom error] "+W,v(this.locator))},fatalError:function(W){throw new he(W,this.locator)}};function v(W){if(W)return`
836
- @`+(W.systemId||"")+"#[line:"+W.lineNumber+",col:"+W.columnNumber+"]"}function A(W,X,re){return typeof W=="string"?W.substr(X,re):W.length>=X+re||X?new java.lang.String(W,X,re)+"":W}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(W){i.prototype[W]=function(){return null}});function R(W,X){W.currentElement?W.currentElement.appendChild(X):W.doc.appendChild(X)}var V=ub(),j=cb(),ee=j.XMLReader,he=j.ParseError,J=sd.DOMImplementation=H_().DOMImplementation;return sd.XMLSerializer=H_().XMLSerializer,sd.DOMParser=f,sd.__DOMHandler=i,sd}var hb=db();function sf(f,g,i,a){if(!g)if(f.softAssertions){const v={message:i,stepId:a==null?void 0:a.stepId,stepType:a==null?void 0:a.stepType,expected:a==null?void 0:a.expected,actual:a==null?void 0:a.actual,timestamp:new Date().toISOString()};f.softAssertionErrors||(f.softAssertionErrors=[]),f.softAssertionErrors.push(v),f.logger.warn(`Soft assertion failed: ${i}`)}else throw new Error(i)}const pb=[{type:"api_set_header",category:"API",color:"#7B1FA2",tooltip:"Set a request header (applies to subsequent requests)",inputs:[{name:"NAME",type:"field",fieldType:"text",required:!0,default:"Authorization"},{name:"VALUE",type:"field",fieldType:"text",required:!0,default:"Bearer token"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.NAME,a=Qn(f.VALUE,g);let v=g.variables.get("__requestHeaders");return v||(v={}),v[i]=a,g.variables.set("__requestHeaders",v),g.logger.info(`Set header: ${i}: ${a.substring(0,30)}${a.length>30?"...":""}`),{_summary:`${i}: ${a.substring(0,30)}${a.length>30?"...":""}`,name:i,value:a}}},{type:"api_set_headers",category:"API",color:"#7B1FA2",tooltip:"Set multiple request headers from JSON object",inputs:[{name:"HEADERS",type:"field",fieldType:"text",required:!0,default:'{"Content-Type": "application/json"}'}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.HEADERS,g);try{const a=JSON.parse(i);let v=g.variables.get("__requestHeaders");v||(v={}),Object.assign(v,a),g.variables.set("__requestHeaders",v);const A=Object.keys(a).join(", ");return g.logger.info(`Set headers: ${A}`),{_summary:`Set ${Object.keys(a).length} headers`,headers:a}}catch{throw new Error(`Invalid JSON for headers: ${i}`)}}},{type:"api_clear_headers",category:"API",color:"#7B1FA2",tooltip:"Clear all request headers",inputs:[],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>(g.variables.delete("__requestHeaders"),g.logger.info("Cleared all request headers"),{_summary:"Headers cleared"})},{type:"api_get",category:"API",color:"#4CAF50",tooltip:"Perform HTTP GET request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=g.variables.get("__requestHeaders")||{},v=np(f.HEADERS,g),A={...a,...v};g.logger.info(`GET ${i}`);const R=await fetch(i,{headers:A,signal:g.abortSignal}),V=await sp(R);return g.variables.set("__lastResponse",V),V}},{type:"api_post",category:"API",color:"#4CAF50",tooltip:"Perform HTTP POST request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"BODY",type:"field",fieldType:"text",default:"{}"},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=Qn(f.BODY||"{}",g),v=g.variables.get("__requestHeaders")||{},A=np(f.HEADERS,g);let R;try{R=JSON.parse(a)}catch{R=a}g.logger.info(`POST ${i}`);const V=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",...v,...A},body:typeof R=="string"?R:JSON.stringify(R),signal:g.abortSignal}),j=await sp(V);return g.variables.set("__lastResponse",j),j}},{type:"api_put",category:"API",color:"#4CAF50",tooltip:"Perform HTTP PUT request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"BODY",type:"field",fieldType:"text",default:"{}"},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=Qn(f.BODY||"{}",g),v=g.variables.get("__requestHeaders")||{},A=np(f.HEADERS,g);let R;try{R=JSON.parse(a)}catch{R=a}g.logger.info(`PUT ${i}`);const V=await fetch(i,{method:"PUT",headers:{"Content-Type":"application/json",...v,...A},body:typeof R=="string"?R:JSON.stringify(R),signal:g.abortSignal}),j=await sp(V);return g.variables.set("__lastResponse",j),j}},{type:"api_patch",category:"API",color:"#4CAF50",tooltip:"Perform HTTP PATCH request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"BODY",type:"field",fieldType:"text",default:"{}"},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=Qn(f.BODY||"{}",g),v=g.variables.get("__requestHeaders")||{},A=np(f.HEADERS,g);let R;try{R=JSON.parse(a)}catch{R=a}g.logger.info(`PATCH ${i}`);const V=await fetch(i,{method:"PATCH",headers:{"Content-Type":"application/json",...v,...A},body:typeof R=="string"?R:JSON.stringify(R),signal:g.abortSignal}),j=await sp(V);return g.variables.set("__lastResponse",j),j}},{type:"api_delete",category:"API",color:"#4CAF50",tooltip:"Perform HTTP DELETE request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=g.variables.get("__requestHeaders")||{},v=np(f.HEADERS,g),A={...a,...v};g.logger.info(`DELETE ${i}`);const R=await fetch(i,{method:"DELETE",headers:A,signal:g.abortSignal}),V=await sp(R);return g.variables.set("__lastResponse",V),V}},{type:"api_assert_status",category:"API",color:"#FF9800",tooltip:"Assert that response has expected status code",inputs:[{name:"STATUS",type:"field",fieldType:"number",default:200,required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.STATUS;return sf(g,i.status===a,`Expected status ${a} but got ${i.status}`,{stepType:"api_assert_status",expected:a,actual:i.status}),g.logger.info(`✓ Status is ${a}`),{_summary:`✓ Status ${i.status} === ${a}`,expected:a,actual:i.status}}},{type:"api_assert_body_contains",category:"API",color:"#FF9800",tooltip:"Assert that response body contains expected value",inputs:[{name:"PATH",type:"field",fieldType:"text",default:""},{name:"VALUE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.PATH,v=Qn(f.VALUE,g),A=a?j_(i.body,a):i.body,R=typeof A=="string"?A:JSON.stringify(A);return sf(g,R.includes(v),`Expected ${a||"body"} to contain "${v}" but got "${R}"`,{stepType:"api_assert_body_contains",expected:v,actual:R}),g.logger.info(`✓ ${a||"body"} contains "${v}"`),{_summary:`✓ ${a||"body"} contains "${v}"`,path:a||"body",expected:v,actual:R.substring(0,100)+(R.length>100?"...":"")}}},{type:"api_extract_jsonpath",category:"API",color:"#2196F3",tooltip:"Extract a value from JSON response using JSONPath expression",inputs:[{name:"JSONPATH",type:"field",fieldType:"text",required:!0,default:"$.data.id"},{name:"VARIABLE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.JSONPATH,v=f.VARIABLE;try{const A=Jt({path:a,json:i.body}),R=A.length===1?A[0]:A;g.variables.set(v,R);const V=JSON.stringify(R);return g.logger.info(`Extracted (JSONPath) ${a} → ${v} = ${V}`),{_summary:`${v} = ${V.substring(0,50)}${V.length>50?"...":""}`,variable:v,jsonPath:a,value:R}}catch(A){throw new Error(`Invalid JSONPath expression: ${a}. Error: ${A.message}`)}}},{type:"api_extract_xpath",category:"API",color:"#2196F3",tooltip:"Extract a value from XML/HTML response using XPath expression",inputs:[{name:"XPATH",type:"field",fieldType:"text",required:!0,default:"//title/text()"},{name:"VARIABLE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.XPATH,v=f.VARIABLE;try{const A=typeof i.body=="string"?i.body:JSON.stringify(i.body),R=new hb.DOMParser().parseFromString(A,"text/xml"),V=ab.select(a,R);let j;Array.isArray(V)?V.length===0?j=null:V.length===1?j=W_(V[0]):j=V.map(W_):j=V,g.variables.set(v,j);const ee=JSON.stringify(j);return g.logger.info(`Extracted (XPath) ${a} → ${v} = ${ee}`),{_summary:`${v} = ${ee.substring(0,50)}${ee.length>50?"...":""}`,variable:v,xpath:a,value:j}}catch(A){throw new Error(`XPath extraction failed: ${a}. Error: ${A.message}`)}}},{type:"api_extract",category:"API",color:"#2196F3",tooltip:"Extract a value from response using dot notation (e.g., data.user.name)",inputs:[{name:"PATH",type:"field",fieldType:"text",required:!0},{name:"VARIABLE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.PATH,v=f.VARIABLE,A=j_(i.body,a);g.variables.set(v,A);const R=JSON.stringify(A);return g.logger.info(`Extracted ${a} → ${v} = ${R}`),{_summary:`${v} = ${R.substring(0,50)}${R.length>50?"...":""}`,variable:v,path:a,value:A}}},{type:"api_headers",category:"API",color:"#9C27B0",tooltip:"Create a headers object",inputs:[{name:"AUTH_TYPE",type:"field",fieldType:"dropdown",options:[["None","none"],["Bearer Token","bearer"],["Basic Auth","basic"],["API Key","apikey"]]},{name:"AUTH_VALUE",type:"field",fieldType:"text"},{name:"CUSTOM",type:"value",check:"Object"}],output:{type:"Object"},execute:async(f,g)=>{const i=f.AUTH_TYPE,a=Qn(f.AUTH_VALUE||"",g),A={...f.CUSTOM||{}};switch(i){case"bearer":A.Authorization=`Bearer ${a}`;break;case"basic":A.Authorization=`Basic ${Buffer.from(a).toString("base64")}`;break;case"apikey":A["X-API-Key"]=a;break}return A}},{type:"api_json_body",category:"API",color:"#9C27B0",tooltip:"Create a JSON body from key-value pairs or raw JSON",inputs:[{name:"JSON",type:"field",fieldType:"text",default:"{}"}],output:{type:"Object"},execute:async(f,g)=>{const i=Qn(f.JSON,g);return JSON.parse(i)}}];function Qn(f,g){return f.replace(/\$\{([\w.]+)\}/g,(i,a)=>{const v=a.split("."),A=v[0];let R=g.variables.get(A);if(v.length>1&&R!==void 0&&R!==null)for(let V=1;V<v.length&&R!=null;V++)R=R[v[V]];return R==null?i:typeof R=="object"?JSON.stringify(R):String(R)})}function np(f,g){if(!f||!f.trim())return{};const i=Qn(f,g);try{const A=JSON.parse(i);if(typeof A=="object"&&A!==null)return A}catch{}const a={},v=i.split(/[;\n]/).map(A=>A.trim()).filter(A=>A);for(const A of v){const R=A.indexOf(":");if(R>0){const V=A.slice(0,R).trim(),j=A.slice(R+1).trim();a[V]=j}}return a}async function sp(f){const g={};f.headers.forEach((v,A)=>{g[A]=v});let i;return(f.headers.get("content-type")||"").includes("application/json")?i=await f.json():i=await f.text(),{status:f.status,headers:g,body:i}}function j_(f,g){if(!g)return f;const i=g.split(".");let a=f;for(const v of i){if(a==null)return;const A=v.match(/^(\w+)\[(\d+)\]$/);if(A){const[,R,V]=A;a=a[R],Array.isArray(a)&&(a=a[parseInt(V,10)])}else a=a[v]}return a}function W_(f){if(!f)return null;const g=f;return g.nodeValue!==void 0?g.nodeValue:g.textContent!==void 0?g.textContent:g.toString?g.toString():null}let Zg=null;async function ri(){if(!Zg){const f="@playwright/test",{expect:g}=await import(f);Zg=g}return Zg}async function ni(f,g,i,a){try{await g()}catch(v){if(f.softAssertions){const A={message:v.message||i,stepType:a==null?void 0:a.stepType,expected:a==null?void 0:a.expected,actual:a==null?void 0:a.actual,timestamp:new Date().toISOString()};f.softAssertionErrors||(f.softAssertionErrors=[]),f.softAssertionErrors.push(A),f.logger.warn(`Soft assertion failed: ${A.message}`)}else throw v}}function js(f,g){return f.replace(/\$\{([\w.]+)\}/g,(i,a)=>{const v=a.split("."),A=v[0];let R=g.variables.get(A);if(v.length>1&&R!==void 0&&R!==null)for(let V=1;V<v.length&&R!=null;V++)R=R[v[V]];return R==null?i:typeof R=="object"?JSON.stringify(R):String(R)})}function Kr(f,g){const i=js(f.SELECTOR,g);if(i.startsWith("testid:")){const a=i.substring(7);return`[${g.testIdAttribute||"data-testid"}="${a}"]`}return i}function Dl(f,g){const i=f.SELECTOR;if(i.startsWith("testid:")){const a=i.substring(7);return`[${g.testIdAttribute||"data-testid"}="${a}"]`}return i}const $b=[{type:"web_navigate",category:"Web",color:"#E91E63",tooltip:"Navigate to a URL",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"WAIT_UNTIL",type:"field",fieldType:"dropdown",options:[["Load","load"],["DOM Content Loaded","domcontentloaded"],["Network Idle","networkidle"]],default:"load"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=js(f.URL,g),v=f.WAIT_UNTIL;return g.logger.info(`Navigating to ${a}`),await i.goto(a,{waitUntil:v}),{_summary:a,url:a,waitUntil:v}}},{type:"web_wait_for_element",category:"Web",color:"#9C27B0",tooltip:"Wait for an element to appear/disappear",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"STATE",type:"field",fieldType:"dropdown",options:[["Visible","visible"],["Hidden","hidden"],["Attached","attached"],["Detached","detached"]]},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.STATE,A=f.TIMEOUT;return g.logger.info(`Waiting for ${a} to be ${v}`),await i.waitForSelector(a,{state:v,timeout:A}),{_summary:`${f.SELECTOR} is ${v}`,selector:a,state:v}}},{type:"web_wait_for_url",category:"Web",color:"#9C27B0",tooltip:"Wait for URL to match",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=js(f.URL,g),v=f.TIMEOUT;return g.logger.info(`Waiting for URL to match: ${a}`),await i.waitForURL(a,{timeout:v}),{_summary:a,url:a}}},{type:"web_wait",category:"Web",color:"#9C27B0",tooltip:"Wait for a specified time",inputs:[{name:"MILLISECONDS",type:"field",fieldType:"number",default:1e3}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=f.MILLISECONDS;return g.logger.info(`Waiting ${a}ms`),await i.waitForTimeout(a),{_summary:`${a}ms`,milliseconds:a}}},{type:"web_screenshot",category:"Web",color:"#607D8B",tooltip:"Take a screenshot",inputs:[{name:"NAME",type:"field",fieldType:"text",default:"screenshot"},{name:"FULL_PAGE",type:"field",fieldType:"checkbox",default:!1}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=f.NAME,v=f.FULL_PAGE;g.logger.info(`Taking screenshot: ${a}`);const A=await i.screenshot({fullPage:v});return{_summary:`${a}${v?" (full page)":""}`,name:a,fullPage:v,buffer:A.toString("base64")}}}],gb=[{type:"web_click",category:"Web",color:"#E91E63",tooltip:"Click on an element",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.TIMEOUT;return g.logger.info(`Clicking: ${a}`),await i.click(a,{timeout:v}),{_summary:f.SELECTOR,selector:a}}},{type:"web_fill",category:"Web",color:"#E91E63",tooltip:"Fill an input field (clears existing value)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.VALUE,A=js(v,g);g.logger.info(`Filling ${a} with "${A}"`),await i.fill(a,A);const R=A.length>30?A.substring(0,30)+"...":A;return{_summary:`${f.SELECTOR} = "${R}"`,selector:a,value:A}}},{type:"web_type",category:"Web",color:"#E91E63",tooltip:"Type text character by character",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"DELAY",type:"field",fieldType:"number",default:50}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=js(f.TEXT,g),A=f.DELAY;g.logger.info(`Typing "${v}" into ${a}`),await i.type(a,v,{delay:A});const R=v.length>30?v.substring(0,30)+"...":v;return{_summary:`${f.SELECTOR} = "${R}"`,selector:a,text:v,delay:A}}},{type:"web_press_key",category:"Web",color:"#E91E63",tooltip:"Press a keyboard key",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"KEY",type:"field",fieldType:"dropdown",options:[["Enter","Enter"],["Tab","Tab"],["Escape","Escape"],["Backspace","Backspace"],["ArrowUp","ArrowUp"],["ArrowDown","ArrowDown"],["ArrowLeft","ArrowLeft"],["ArrowRight","ArrowRight"]]}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.KEY;return g.logger.info(`Pressing ${v} on ${a}`),await i.press(a,v),{_summary:`${v} on ${f.SELECTOR}`,selector:a,key:v}}},{type:"web_select",category:"Web",color:"#E91E63",tooltip:"Select an option from a dropdown",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=js(f.VALUE,g);return g.logger.info(`Selecting "${v}" in ${a}`),await i.selectOption(a,v),{_summary:`${f.SELECTOR} = "${v}"`,selector:a,value:v}}},{type:"web_checkbox",category:"Web",color:"#E91E63",tooltip:"Check or uncheck a checkbox",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"ACTION",type:"field",fieldType:"dropdown",options:[["Check","check"],["Uncheck","uncheck"]]}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.ACTION;return g.logger.info(`${v==="check"?"Checking":"Unchecking"} ${a}`),v==="check"?await i.check(a):await i.uncheck(a),{_summary:`${v} ${f.SELECTOR}`,selector:a,action:v}}},{type:"web_hover",category:"Web",color:"#E91E63",tooltip:"Hover over an element",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g);return g.logger.info(`Hovering over ${a}`),await i.hover(a),{_summary:f.SELECTOR,selector:a}}}],fb=[{type:"web_get_text",category:"Web",color:"#2196F3",tooltip:"Get text content of an element",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0}],output:{type:"String"},execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=await i.textContent(a);return g.logger.debug(`Text content of ${a}: "${v}"`),{_summary:`"${v&&v.length>40?v.substring(0,40)+"...":v}"`,_value:v,selector:a,text:v}}},{type:"web_get_attribute",category:"Web",color:"#2196F3",tooltip:"Get attribute value of an element",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"ATTRIBUTE",type:"field",fieldType:"text",required:!0}],output:{type:"String"},execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.ATTRIBUTE,A=await i.getAttribute(a,v);return g.logger.debug(`Attribute ${v} of ${a}: "${A}"`),{_summary:`${v} = "${A}"`,_value:A,selector:a,attribute:v,value:A}}},{type:"web_get_input_value",category:"Web",color:"#2196F3",tooltip:"Get current value of an input field",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0}],output:{type:"String"},execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=await i.inputValue(a);return g.logger.debug(`Input value of ${a}: "${v}"`),{_summary:`"${v.length>40?v.substring(0,40)+"...":v}"`,_value:v,selector:a,value:v}}},{type:"web_get_title",category:"Web",color:"#2196F3",tooltip:"Get the page title",inputs:[],output:{type:"String"},execute:async(f,g)=>{const a=await g.page.title();return g.logger.debug(`Page title: "${a}"`),{_summary:`"${a}"`,_value:a,title:a}}},{type:"web_get_url",category:"Web",color:"#2196F3",tooltip:"Get the current URL",inputs:[],output:{type:"String"},execute:async(f,g)=>{const a=g.page.url();return g.logger.debug(`Current URL: "${a}"`),{_summary:a,_value:a,url:a}}},{type:"web_count_elements",category:"Web",color:"#2196F3",tooltip:"Count the number of elements matching a selector",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0}],output:{type:"Number"},execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=await i.locator(a).count();return g.logger.debug(`Found ${v} elements matching ${a}`),{_summary:`${v} elements`,_value:v,selector:a,count:v}}}],mb=[{type:"web_assert_visible",category:"Web",color:"#FF9800",tooltip:"Assert that an element is visible (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=f.TIMEOUT,R=await ri(),V=i.locator(a);return g.logger.info(`Asserting ${v} is visible`),await ni(g,async()=>{await R(V).toBeVisible({timeout:A})},`Expected element ${v} to be visible`,{stepType:"web_assert_visible",expected:"visible",actual:"not visible"}),g.logger.info(`✓ Element ${v} is visible`),{_summary:`${v} is visible`,selector:a,isVisible:!0}}},{type:"web_assert_not_visible",category:"Web",color:"#FF9800",tooltip:"Assert that an element is not visible (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=f.TIMEOUT,R=await ri(),V=i.locator(a);return g.logger.info(`Asserting ${v} is not visible`),await ni(g,async()=>{await R(V).toBeHidden({timeout:A})},`Expected element ${v} to be hidden`,{stepType:"web_assert_not_visible",expected:"hidden",actual:"visible"}),g.logger.info(`✓ Element ${v} is not visible`),{_summary:`${v} is not visible`,selector:a,isVisible:!1}}},{type:"web_assert_text_contains",category:"Web",color:"#FF9800",tooltip:"Assert that element text contains expected value (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=js(f.TEXT,g),R=f.TIMEOUT,V=await ri(),j=i.locator(a);return g.logger.info(`Asserting ${v} contains "${A}"`),await ni(g,async()=>{await V(j).toContainText(A,{timeout:R})},`Expected element ${v} to contain text "${A}"`,{stepType:"web_assert_text_contains",expected:A}),g.logger.info(`✓ Element ${v} contains text "${A}"`),{_summary:`"${A}" found`,selector:a,expectedText:A}}},{type:"web_assert_text_equals",category:"Web",color:"#FF9800",tooltip:"Assert that element text equals expected value (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=js(f.TEXT,g),R=f.TIMEOUT,V=await ri(),j=i.locator(a);return g.logger.info(`Asserting ${v} text equals "${A}"`),await ni(g,async()=>{await V(j).toHaveText(A,{timeout:R})},`Expected element ${v} text to equal "${A}"`,{stepType:"web_assert_text_equals",expected:A}),g.logger.info(`✓ Element ${v} text equals "${A}"`),{_summary:`"${A}" matches`,selector:a,expectedText:A}}},{type:"web_assert_url_contains",category:"Web",color:"#FF9800",tooltip:"Assert that current URL contains expected value (auto-waits)",inputs:[{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=js(f.TEXT,g),v=f.TIMEOUT,A=await ri(),R=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),V=new RegExp(R);return g.logger.info(`Asserting URL contains "${a}"`),await ni(g,async()=>{await A(i).toHaveURL(V,{timeout:v})},`Expected URL to contain "${a}"`,{stepType:"web_assert_url_contains",expected:a,actual:i.url()}),g.logger.info(`✓ URL contains "${a}"`),{_summary:`"${a}" in URL`,expectedText:a,actualUrl:i.url()}}},{type:"web_assert_title_contains",category:"Web",color:"#FF9800",tooltip:"Assert that page title contains expected value (auto-waits)",inputs:[{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=js(f.TEXT,g),v=f.TIMEOUT,A=await ri(),R=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),V=new RegExp(R);return g.logger.info(`Asserting title contains "${a}"`),await ni(g,async()=>{await A(i).toHaveTitle(V,{timeout:v})},`Expected title to contain "${a}"`,{stepType:"web_assert_title_contains",expected:a}),g.logger.info(`✓ Title contains "${a}"`),{_summary:`"${a}" in title`,expectedText:a}}},{type:"web_assert_enabled",category:"Web",color:"#FF9800",tooltip:"Assert that an element is enabled (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=f.TIMEOUT,R=await ri(),V=i.locator(a);return g.logger.info(`Asserting ${v} is enabled`),await ni(g,async()=>{await R(V).toBeEnabled({timeout:A})},`Expected element ${v} to be enabled`,{stepType:"web_assert_enabled",expected:"enabled",actual:"disabled"}),g.logger.info(`✓ Element ${v} is enabled`),{_summary:`${v} is enabled`,selector:a,isEnabled:!0}}},{type:"web_assert_checked",category:"Web",color:"#FF9800",tooltip:"Assert that a checkbox is checked (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"EXPECTED",type:"field",fieldType:"checkbox",default:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=f.EXPECTED,R=f.TIMEOUT,V=await ri(),j=i.locator(a);return g.logger.info(`Asserting ${v} is ${A?"checked":"unchecked"}`),await ni(g,async()=>{A?await V(j).toBeChecked({timeout:R}):await V(j).not.toBeChecked({timeout:R})},`Expected checkbox ${v} to be ${A?"checked":"unchecked"}`,{stepType:"web_assert_checked",expected:A?"checked":"unchecked"}),g.logger.info(`✓ Checkbox ${v} is ${A?"checked":"unchecked"}`),{_summary:`${v} is ${A?"checked":"unchecked"}`,selector:a,expected:A}}},{type:"web_assert_value",category:"Web",color:"#FF9800",tooltip:"Assert that an input field has a specific value (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=js(f.VALUE,g),R=f.TIMEOUT,V=await ri(),j=i.locator(a);return g.logger.info(`Asserting ${v} has value "${A}"`),await ni(g,async()=>{await V(j).toHaveValue(A,{timeout:R})},`Expected input ${v} to have value "${A}"`,{stepType:"web_assert_value",expected:A}),g.logger.info(`✓ Input ${v} has value "${A}"`),{_summary:`${v} = "${A}"`,selector:a,expected:A}}},{type:"web_assert_value_contains",category:"Web",color:"#FF9800",tooltip:"Assert that an input field value contains specific text (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=js(f.VALUE,g),R=f.TIMEOUT,V=await ri(),j=i.locator(a);return g.logger.info(`Asserting ${v} value contains "${A}"`),await ni(g,async()=>{await V(j).toHaveValue(new RegExp(A),{timeout:R})},`Expected input ${v} value to contain "${A}"`,{stepType:"web_assert_value_contains",expected:A}),g.logger.info(`✓ Input ${v} value contains "${A}"`),{_summary:`${v} contains "${A}"`,selector:a,expected:A}}}],_b=[...$b,...gb,...fb,...mb],Eb=[{type:"logic_set_variable",category:"Logic",color:"#795548",tooltip:"Set a variable value",inputs:[{name:"NAME",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"value",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.NAME,a=f.VALUE;g.variables.set(i,a),g.logger.debug(`Set variable ${i} = ${JSON.stringify(a)}`)}},{type:"logic_get_variable",category:"Logic",color:"#795548",tooltip:"Get a variable value",inputs:[{name:"NAME",type:"field",fieldType:"text",required:!0}],output:{type:["String","Number","Boolean","Object","Array"]},execute:async(f,g)=>{const i=f.NAME;return g.variables.get(i)}},{type:"logic_if",category:"Logic",color:"#5C6BC0",tooltip:"Execute blocks if condition is true",inputs:[{name:"CONDITION",type:"value",check:"Boolean",required:!0},{name:"DO",type:"statement"},{name:"ELSE",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.CONDITION;if(i&&f.DO)return{branch:"DO"};if(!i&&f.ELSE)return{branch:"ELSE"}}},{type:"logic_compare",category:"Logic",color:"#5C6BC0",tooltip:"Compare two values",inputs:[{name:"A",type:"value",required:!0},{name:"OP",type:"field",fieldType:"dropdown",options:[["=","eq"],["≠","neq"],["<","lt"],["≤","lte"],[">","gt"],["≥","gte"],["contains","contains"]]},{name:"B",type:"value",required:!0}],output:{type:"Boolean"},execute:async(f,g)=>{const i=f.A,a=f.B;switch(f.OP){case"eq":return JSON.stringify(i)===JSON.stringify(a);case"neq":return JSON.stringify(i)!==JSON.stringify(a);case"lt":return i<a;case"lte":return i<=a;case"gt":return i>a;case"gte":return i>=a;case"contains":return typeof i=="string"||Array.isArray(i)?i.includes(a):!1;default:return!1}}},{type:"logic_boolean_op",category:"Logic",color:"#5C6BC0",tooltip:"Combine boolean values",inputs:[{name:"A",type:"value",check:"Boolean",required:!0},{name:"OP",type:"field",fieldType:"dropdown",options:[["and","and"],["or","or"]]},{name:"B",type:"value",check:"Boolean",required:!0}],output:{type:"Boolean"},execute:async f=>{const g=f.A,i=f.B;return f.OP==="and"?g&&i:g||i}},{type:"logic_not",category:"Logic",color:"#5C6BC0",tooltip:"Negate a boolean value",inputs:[{name:"VALUE",type:"value",check:"Boolean",required:!0}],output:{type:"Boolean"},execute:async f=>!f.VALUE},{type:"logic_repeat",category:"Logic",color:"#5C6BC0",tooltip:"Repeat blocks a specified number of times",inputs:[{name:"TIMES",type:"field",fieldType:"number",default:10,required:!0},{name:"DO",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>({loop:!0,times:f.TIMES,statement:"DO"})},{type:"logic_foreach",category:"Logic",color:"#5C6BC0",tooltip:"Iterate over an array",inputs:[{name:"ARRAY",type:"value",check:"Array",required:!0},{name:"VAR",type:"field",fieldType:"text",default:"item",required:!0},{name:"DO",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.ARRAY,a=f.VAR;return{loop:!0,array:i,varName:a,statement:"DO"}}},{type:"logic_try_catch",category:"Logic",color:"#5C6BC0",tooltip:"Handle errors gracefully",inputs:[{name:"TRY",type:"statement"},{name:"CATCH",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>({tryCatch:!0})},{type:"logic_log",category:"Logic",color:"#607D8B",tooltip:"Log a message",inputs:[{name:"LEVEL",type:"field",fieldType:"dropdown",options:[["Info","info"],["Warning","warn"],["Error","error"],["Debug","debug"]]},{name:"MESSAGE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.LEVEL||"info",a=id(f.MESSAGE,g);return g.logger[i](a),{_message:a,_summary:a}}},{type:"logic_comment",category:"Logic",color:"#9E9E9E",tooltip:"Add a comment (does nothing)",inputs:[{name:"TEXT",type:"field",fieldType:"text",default:"Comment"}],previousStatement:!0,nextStatement:!0,execute:async()=>{}},{type:"logic_text",category:"Logic",color:"#795548",tooltip:"A text value",inputs:[{name:"TEXT",type:"field",fieldType:"text",default:""}],output:{type:"String"},execute:async(f,g)=>id(f.TEXT,g)},{type:"logic_number",category:"Logic",color:"#795548",tooltip:"A number value",inputs:[{name:"NUM",type:"field",fieldType:"number",default:0}],output:{type:"Number"},execute:async f=>f.NUM},{type:"logic_boolean",category:"Logic",color:"#795548",tooltip:"A boolean value",inputs:[{name:"BOOL",type:"field",fieldType:"dropdown",options:[["true","true"],["false","false"]]}],output:{type:"Boolean"},execute:async f=>f.BOOL==="true"},{type:"logic_object",category:"Logic",color:"#795548",tooltip:"Create a JSON object",inputs:[{name:"JSON",type:"field",fieldType:"text",default:"{}"}],output:{type:"Object"},execute:async(f,g)=>{const i=id(f.JSON,g);return JSON.parse(i)}},{type:"logic_array",category:"Logic",color:"#795548",tooltip:"Create an array",inputs:[{name:"JSON",type:"field",fieldType:"text",default:"[]"}],output:{type:"Array"},execute:async(f,g)=>{const i=id(f.JSON,g);return JSON.parse(i)}},{type:"logic_fail",category:"Logic",color:"#f44336",tooltip:"Fail the test with a message",inputs:[{name:"MESSAGE",type:"field",fieldType:"text",default:"Test failed"}],previousStatement:!0,execute:async(f,g)=>{const i=id(f.MESSAGE,g);throw new Error(i)}},{type:"logic_assert",category:"Logic",color:"#FF9800",tooltip:"Assert a condition is true",inputs:[{name:"CONDITION",type:"value",check:"Boolean",required:!0},{name:"MESSAGE",type:"field",fieldType:"text",default:"Assertion failed"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.CONDITION,a=id(f.MESSAGE,g);sf(g,i,a,{stepType:"logic_assert",expected:!0,actual:i}),g.logger.info("✓ Assertion passed")}}];function id(f,g){return f.replace(/\$\{([\w.]+)\}/g,(i,a)=>{const v=a.split("."),A=v[0];let R=g.variables.get(A);if(v.length>1&&R!==void 0&&R!==null)for(let V=1;V<v.length&&R!=null;V++)R=R[v[V]];return R==null?i:typeof R=="object"?JSON.stringify(R):String(R)})}const Tb=[{type:"test_case",category:"Tests",color:"#1E88E5",tooltip:"A test case containing steps to execute",inputs:[{name:"NAME",type:"field",fieldType:"multiline",default:"Test Case"},{name:"SOFT_ASSERTIONS",type:"field",fieldType:"checkbox",default:!1},{name:"STEPS",type:"statement"}],execute:async(f,g)=>({testCase:!0,name:f.NAME,softAssertions:f.SOFT_ASSERTIONS,statement:"STEPS"})},{type:"test_case_data_driven",category:"Tests",color:"#1565C0",tooltip:"A data-driven test case that runs for each row of data (CSV format: header row, then data rows)",inputs:[{name:"NAME",type:"field",fieldType:"text",default:"Data-Driven Test"},{name:"SOFT_ASSERTIONS",type:"field",fieldType:"checkbox",default:!1},{name:"DATA",type:"field",fieldType:"multiline",default:`username,password,expected
836
+ @`+(W.systemId||"")+"#[line:"+W.lineNumber+",col:"+W.columnNumber+"]"}function A(W,X,re){return typeof W=="string"?W.substr(X,re):W.length>=X+re||X?new java.lang.String(W,X,re)+"":W}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(W){i.prototype[W]=function(){return null}});function R(W,X){W.currentElement?W.currentElement.appendChild(X):W.doc.appendChild(X)}var V=ub(),j=cb(),ee=j.XMLReader,he=j.ParseError,J=sd.DOMImplementation=H_().DOMImplementation;return sd.XMLSerializer=H_().XMLSerializer,sd.DOMParser=f,sd.__DOMHandler=i,sd}var hb=db();function sf(f,g,i,a){if(!g)if(f.softAssertions){const v={message:i,stepId:a==null?void 0:a.stepId,stepType:a==null?void 0:a.stepType,expected:a==null?void 0:a.expected,actual:a==null?void 0:a.actual,timestamp:new Date().toISOString()};f.softAssertionErrors||(f.softAssertionErrors=[]),f.softAssertionErrors.push(v),f.logger.warn(`Soft assertion failed: ${i}`)}else throw new Error(i)}const pb=[{type:"api_set_header",category:"API",color:"#7B1FA2",tooltip:"Set a request header (applies to subsequent requests)",inputs:[{name:"NAME",type:"field",fieldType:"text",required:!0,default:"Authorization"},{name:"VALUE",type:"field",fieldType:"text",required:!0,default:"Bearer token"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.NAME,a=Qn(f.VALUE,g);let v=g.variables.get("__requestHeaders");return v||(v={}),v[i]=a,g.variables.set("__requestHeaders",v),g.logger.info(`Set header: ${i}: ${a.substring(0,30)}${a.length>30?"...":""}`),{_summary:`${i}: ${a.substring(0,30)}${a.length>30?"...":""}`,name:i,value:a}}},{type:"api_set_headers",category:"API",color:"#7B1FA2",tooltip:"Set multiple request headers from JSON object",inputs:[{name:"HEADERS",type:"field",fieldType:"text",required:!0,default:'{"Content-Type": "application/json"}'}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.HEADERS,g);try{const a=JSON.parse(i);let v=g.variables.get("__requestHeaders");v||(v={}),Object.assign(v,a),g.variables.set("__requestHeaders",v);const A=Object.keys(a).join(", ");return g.logger.info(`Set headers: ${A}`),{_summary:`Set ${Object.keys(a).length} headers`,headers:a}}catch{throw new Error(`Invalid JSON for headers: ${i}`)}}},{type:"api_clear_headers",category:"API",color:"#7B1FA2",tooltip:"Clear all request headers",inputs:[],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>(g.variables.delete("__requestHeaders"),g.logger.info("Cleared all request headers"),{_summary:"Headers cleared"})},{type:"api_get",category:"API",color:"#4CAF50",tooltip:"Perform HTTP GET request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=g.variables.get("__requestHeaders")||{},v=np(f.HEADERS,g),A={...a,...v};g.logger.info(`GET ${i}`);const R=await fetch(i,{headers:A,signal:g.abortSignal}),V=await sp(R);return g.variables.set("__lastResponse",V),V}},{type:"api_post",category:"API",color:"#4CAF50",tooltip:"Perform HTTP POST request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"BODY",type:"field",fieldType:"text",default:"{}"},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=Qn(f.BODY||"{}",g),v=g.variables.get("__requestHeaders")||{},A=np(f.HEADERS,g);let R;try{R=JSON.parse(a)}catch{R=a}g.logger.info(`POST ${i}`);const V=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json",...v,...A},body:typeof R=="string"?R:JSON.stringify(R),signal:g.abortSignal}),j=await sp(V);return g.variables.set("__lastResponse",j),j}},{type:"api_put",category:"API",color:"#4CAF50",tooltip:"Perform HTTP PUT request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"BODY",type:"field",fieldType:"text",default:"{}"},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=Qn(f.BODY||"{}",g),v=g.variables.get("__requestHeaders")||{},A=np(f.HEADERS,g);let R;try{R=JSON.parse(a)}catch{R=a}g.logger.info(`PUT ${i}`);const V=await fetch(i,{method:"PUT",headers:{"Content-Type":"application/json",...v,...A},body:typeof R=="string"?R:JSON.stringify(R),signal:g.abortSignal}),j=await sp(V);return g.variables.set("__lastResponse",j),j}},{type:"api_patch",category:"API",color:"#4CAF50",tooltip:"Perform HTTP PATCH request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"BODY",type:"field",fieldType:"text",default:"{}"},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=Qn(f.BODY||"{}",g),v=g.variables.get("__requestHeaders")||{},A=np(f.HEADERS,g);let R;try{R=JSON.parse(a)}catch{R=a}g.logger.info(`PATCH ${i}`);const V=await fetch(i,{method:"PATCH",headers:{"Content-Type":"application/json",...v,...A},body:typeof R=="string"?R:JSON.stringify(R),signal:g.abortSignal}),j=await sp(V);return g.variables.set("__lastResponse",j),j}},{type:"api_delete",category:"API",color:"#4CAF50",tooltip:"Perform HTTP DELETE request and store response",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"HEADERS",type:"field",fieldType:"text",default:""}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=Qn(f.URL,g),a=g.variables.get("__requestHeaders")||{},v=np(f.HEADERS,g),A={...a,...v};g.logger.info(`DELETE ${i}`);const R=await fetch(i,{method:"DELETE",headers:A,signal:g.abortSignal}),V=await sp(R);return g.variables.set("__lastResponse",V),V}},{type:"api_assert_status",category:"API",color:"#FF9800",tooltip:"Assert that response has expected status code",inputs:[{name:"STATUS",type:"field",fieldType:"number",default:200,required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.STATUS;return sf(g,i.status===a,`Expected status ${a} but got ${i.status}`,{stepType:"api_assert_status",expected:a,actual:i.status}),g.logger.info(`✓ Status is ${a}`),{_summary:`✓ Status ${i.status} === ${a}`,expected:a,actual:i.status}}},{type:"api_assert_body_contains",category:"API",color:"#FF9800",tooltip:"Assert that response body contains expected value",inputs:[{name:"PATH",type:"field",fieldType:"text",default:""},{name:"VALUE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.PATH,v=Qn(f.VALUE,g),A=a?j_(i.body,a):i.body,R=typeof A=="string"?A:JSON.stringify(A);return sf(g,R.includes(v),`Expected ${a||"body"} to contain "${v}" but got "${R}"`,{stepType:"api_assert_body_contains",expected:v,actual:R}),g.logger.info(`✓ ${a||"body"} contains "${v}"`),{_summary:`✓ ${a||"body"} contains "${v}"`,path:a||"body",expected:v,actual:R.substring(0,100)+(R.length>100?"...":"")}}},{type:"api_extract_jsonpath",category:"API",color:"#2196F3",tooltip:"Extract a value from JSON response using JSONPath expression",inputs:[{name:"JSONPATH",type:"field",fieldType:"text",required:!0,default:"$.data.id"},{name:"VARIABLE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.JSONPATH,v=f.VARIABLE;try{const A=Jt({path:a,json:i.body}),R=A.length===1?A[0]:A;g.variables.set(v,R);const V=JSON.stringify(R);return g.logger.info(`Extracted (JSONPath) ${a} → ${v} = ${V}`),{_summary:`${v} = ${V.substring(0,50)}${V.length>50?"...":""}`,variable:v,jsonPath:a,value:R}}catch(A){throw new Error(`Invalid JSONPath expression: ${a}. Error: ${A.message}`)}}},{type:"api_extract_xpath",category:"API",color:"#2196F3",tooltip:"Extract a value from XML/HTML response using XPath expression",inputs:[{name:"XPATH",type:"field",fieldType:"text",required:!0,default:"//title/text()"},{name:"VARIABLE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.XPATH,v=f.VARIABLE;try{const A=typeof i.body=="string"?i.body:JSON.stringify(i.body),R=new hb.DOMParser().parseFromString(A,"text/xml"),V=ab.select(a,R);let j;Array.isArray(V)?V.length===0?j=null:V.length===1?j=W_(V[0]):j=V.map(W_):j=V,g.variables.set(v,j);const ee=JSON.stringify(j);return g.logger.info(`Extracted (XPath) ${a} → ${v} = ${ee}`),{_summary:`${v} = ${ee.substring(0,50)}${ee.length>50?"...":""}`,variable:v,xpath:a,value:j}}catch(A){throw new Error(`XPath extraction failed: ${a}. Error: ${A.message}`)}}},{type:"api_extract",category:"API",color:"#2196F3",tooltip:"Extract a value from response using dot notation (e.g., data.user.name)",inputs:[{name:"PATH",type:"field",fieldType:"text",required:!0},{name:"VARIABLE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.variables.get("__lastResponse");if(!i)throw new Error("No response available. Make sure to call an API request first.");const a=f.PATH,v=f.VARIABLE,A=j_(i.body,a);g.variables.set(v,A);const R=JSON.stringify(A);return g.logger.info(`Extracted ${a} → ${v} = ${R}`),{_summary:`${v} = ${R.substring(0,50)}${R.length>50?"...":""}`,variable:v,path:a,value:A}}},{type:"api_headers",category:"API",color:"#9C27B0",tooltip:"Create a headers object",inputs:[{name:"AUTH_TYPE",type:"field",fieldType:"dropdown",options:[["None","none"],["Bearer Token","bearer"],["Basic Auth","basic"],["API Key","apikey"]]},{name:"AUTH_VALUE",type:"field",fieldType:"text"},{name:"CUSTOM",type:"value",check:"Object"}],output:{type:"Object"},execute:async(f,g)=>{const i=f.AUTH_TYPE,a=Qn(f.AUTH_VALUE||"",g),A={...f.CUSTOM||{}};switch(i){case"bearer":A.Authorization=`Bearer ${a}`;break;case"basic":A.Authorization=`Basic ${Buffer.from(a).toString("base64")}`;break;case"apikey":A["X-API-Key"]=a;break}return A}},{type:"api_json_body",category:"API",color:"#9C27B0",tooltip:"Create a JSON body from key-value pairs or raw JSON",inputs:[{name:"JSON",type:"field",fieldType:"text",default:"{}"}],output:{type:"Object"},execute:async(f,g)=>{const i=Qn(f.JSON,g);return JSON.parse(i)}}];function Qn(f,g){return f.replace(/\$\{([\w.]+)\}/g,(i,a)=>{const v=a.split("."),A=v[0];let R=g.variables.get(A);if(v.length>1&&R!==void 0&&R!==null)for(let V=1;V<v.length&&R!=null;V++)R=R[v[V]];return R==null?i:typeof R=="object"?JSON.stringify(R):String(R)})}function np(f,g){if(!f||!f.trim())return{};const i=Qn(f,g);try{const A=JSON.parse(i);if(typeof A=="object"&&A!==null)return A}catch{}const a={},v=i.split(/[;\n]/).map(A=>A.trim()).filter(A=>A);for(const A of v){const R=A.indexOf(":");if(R>0){const V=A.slice(0,R).trim(),j=A.slice(R+1).trim();a[V]=j}}return a}async function sp(f){const g={};f.headers.forEach((v,A)=>{g[A]=v});let i;return(f.headers.get("content-type")||"").includes("application/json")?i=await f.json():i=await f.text(),{status:f.status,headers:g,body:i}}function j_(f,g){if(!g)return f;const i=g.split(".");let a=f;for(const v of i){if(a==null)return;const A=v.match(/^(\w+)\[(\d+)\]$/);if(A){const[,R,V]=A;a=a[R],Array.isArray(a)&&(a=a[parseInt(V,10)])}else a=a[v]}return a}function W_(f){if(!f)return null;const g=f;return g.nodeValue!==void 0?g.nodeValue:g.textContent!==void 0?g.textContent:g.toString?g.toString():null}let Zg=null;async function ri(){if(!Zg){const f="@playwright/test",{expect:g}=await import(f);Zg=g}return Zg}async function ni(f,g,i,a){try{await g()}catch(v){if(f.softAssertions){const A={message:v.message||i,stepType:a==null?void 0:a.stepType,expected:a==null?void 0:a.expected,actual:a==null?void 0:a.actual,timestamp:new Date().toISOString()};f.softAssertionErrors||(f.softAssertionErrors=[]),f.softAssertionErrors.push(A),f.logger.warn(`Soft assertion failed: ${A.message}`)}else throw v}}function js(f,g){return f.replace(/\$\{([\w.]+)\}/g,(i,a)=>{const v=a.split("."),A=v[0];let R=g.variables.get(A);if(v.length>1&&R!==void 0&&R!==null)for(let V=1;V<v.length&&R!=null;V++)R=R[v[V]];return R==null?i:typeof R=="object"?JSON.stringify(R):String(R)})}function Kr(f,g){const i=js(f.SELECTOR,g);if(i.startsWith("testid:")){const a=i.substring(7);return`[${g.testIdAttribute||"data-testid"}="${a}"]`}return i}function Dl(f,g){const i=f.SELECTOR;if(i.startsWith("testid:")){const a=i.substring(7);return`[${g.testIdAttribute||"data-testid"}="${a}"]`}return i}const $b=[{type:"web_navigate",category:"Web",color:"#E91E63",tooltip:"Navigate to a URL",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"WAIT_UNTIL",type:"field",fieldType:"dropdown",options:[["Load","load"],["DOM Content Loaded","domcontentloaded"],["Network Idle","networkidle"]],default:"load"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=js(f.URL,g),v=f.WAIT_UNTIL;return g.logger.info(`Navigating to ${a}`),await i.goto(a,{waitUntil:v}),{_summary:a,url:a,waitUntil:v}}},{type:"web_wait_for_element",category:"Web",color:"#9C27B0",tooltip:"Wait for an element to appear/disappear",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"STATE",type:"field",fieldType:"dropdown",options:[["Visible","visible"],["Hidden","hidden"],["Attached","attached"],["Detached","detached"]]},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.STATE,A=f.TIMEOUT;return g.logger.info(`Waiting for ${a} to be ${v}`),await i.waitForSelector(a,{state:v,timeout:A}),{_summary:`${f.SELECTOR} is ${v}`,selector:a,state:v}}},{type:"web_wait_for_url",category:"Web",color:"#9C27B0",tooltip:"Wait for URL to match",inputs:[{name:"URL",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=js(f.URL,g),v=f.TIMEOUT;return g.logger.info(`Waiting for URL to match: ${a}`),await i.waitForURL(a,{timeout:v}),{_summary:a,url:a}}},{type:"web_wait",category:"Web",color:"#9C27B0",tooltip:"Wait for a specified time",inputs:[{name:"MILLISECONDS",type:"field",fieldType:"number",default:1e3}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=f.MILLISECONDS;return g.logger.info(`Waiting ${a}ms`),await i.waitForTimeout(a),{_summary:`${a}ms`,milliseconds:a}}},{type:"web_screenshot",category:"Web",color:"#607D8B",tooltip:"Take a screenshot",inputs:[{name:"NAME",type:"field",fieldType:"text",default:"screenshot"},{name:"FULL_PAGE",type:"field",fieldType:"checkbox",default:!1}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=f.NAME,v=f.FULL_PAGE;g.logger.info(`Taking screenshot: ${a}`);const A=await i.screenshot({fullPage:v});return{_summary:`${a}${v?" (full page)":""}`,name:a,fullPage:v,buffer:A.toString("base64")}}}],gb=[{type:"web_click",category:"Web",color:"#E91E63",tooltip:"Click on an element",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.TIMEOUT;return g.logger.info(`Clicking: ${a}`),await i.click(a,{timeout:v}),{_summary:f.SELECTOR,selector:a}}},{type:"web_fill",category:"Web",color:"#E91E63",tooltip:"Fill an input field (clears existing value)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.VALUE,A=js(v,g);g.logger.info(`Filling ${a} with "${A}"`),await i.fill(a,A);const R=A.length>30?A.substring(0,30)+"...":A;return{_summary:`${f.SELECTOR} = "${R}"`,selector:a,value:A}}},{type:"web_type",category:"Web",color:"#E91E63",tooltip:"Type text character by character",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"DELAY",type:"field",fieldType:"number",default:50}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=js(f.TEXT,g),A=f.DELAY;g.logger.info(`Typing "${v}" into ${a}`),await i.type(a,v,{delay:A});const R=v.length>30?v.substring(0,30)+"...":v;return{_summary:`${f.SELECTOR} = "${R}"`,selector:a,text:v,delay:A}}},{type:"web_press_key",category:"Web",color:"#E91E63",tooltip:"Press a keyboard key",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"KEY",type:"field",fieldType:"dropdown",options:[["Enter","Enter"],["Tab","Tab"],["Escape","Escape"],["Backspace","Backspace"],["ArrowUp","ArrowUp"],["ArrowDown","ArrowDown"],["ArrowLeft","ArrowLeft"],["ArrowRight","ArrowRight"]]}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.KEY;return g.logger.info(`Pressing ${v} on ${a}`),await i.press(a,v),{_summary:`${v} on ${f.SELECTOR}`,selector:a,key:v}}},{type:"web_select",category:"Web",color:"#E91E63",tooltip:"Select an option from a dropdown",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=js(f.VALUE,g);return g.logger.info(`Selecting "${v}" in ${a}`),await i.selectOption(a,v),{_summary:`${f.SELECTOR} = "${v}"`,selector:a,value:v}}},{type:"web_checkbox",category:"Web",color:"#E91E63",tooltip:"Check or uncheck a checkbox",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"ACTION",type:"field",fieldType:"dropdown",options:[["Check","check"],["Uncheck","uncheck"]]}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.ACTION;return g.logger.info(`${v==="check"?"Checking":"Unchecking"} ${a}`),v==="check"?await i.check(a):await i.uncheck(a),{_summary:`${v} ${f.SELECTOR}`,selector:a,action:v}}},{type:"web_hover",category:"Web",color:"#E91E63",tooltip:"Hover over an element",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g);return g.logger.info(`Hovering over ${a}`),await i.hover(a),{_summary:f.SELECTOR,selector:a}}}],fb=[{type:"web_get_text",category:"Web",color:"#2196F3",tooltip:"Get text content of an element",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0}],output:{type:"String"},execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=await i.textContent(a);return g.logger.debug(`Text content of ${a}: "${v}"`),{_summary:`"${v&&v.length>40?v.substring(0,40)+"...":v}"`,_value:v,selector:a,text:v}}},{type:"web_get_attribute",category:"Web",color:"#2196F3",tooltip:"Get attribute value of an element",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"ATTRIBUTE",type:"field",fieldType:"text",required:!0}],output:{type:"String"},execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=f.ATTRIBUTE,A=await i.getAttribute(a,v);return g.logger.debug(`Attribute ${v} of ${a}: "${A}"`),{_summary:`${v} = "${A}"`,_value:A,selector:a,attribute:v,value:A}}},{type:"web_get_input_value",category:"Web",color:"#2196F3",tooltip:"Get current value of an input field",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0}],output:{type:"String"},execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=await i.inputValue(a);return g.logger.debug(`Input value of ${a}: "${v}"`),{_summary:`"${v.length>40?v.substring(0,40)+"...":v}"`,_value:v,selector:a,value:v}}},{type:"web_get_title",category:"Web",color:"#2196F3",tooltip:"Get the page title",inputs:[],output:{type:"String"},execute:async(f,g)=>{const a=await g.page.title();return g.logger.debug(`Page title: "${a}"`),{_summary:`"${a}"`,_value:a,title:a}}},{type:"web_get_url",category:"Web",color:"#2196F3",tooltip:"Get the current URL",inputs:[],output:{type:"String"},execute:async(f,g)=>{const a=g.page.url();return g.logger.debug(`Current URL: "${a}"`),{_summary:a,_value:a,url:a}}},{type:"web_count_elements",category:"Web",color:"#2196F3",tooltip:"Count the number of elements matching a selector",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0}],output:{type:"Number"},execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=await i.locator(a).count();return g.logger.debug(`Found ${v} elements matching ${a}`),{_summary:`${v} elements`,_value:v,selector:a,count:v}}}],mb=[{type:"web_assert_visible",category:"Web",color:"#FF9800",tooltip:"Assert that an element is visible (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=f.TIMEOUT,R=await ri(),V=i.locator(a);return g.logger.info(`Asserting ${v} is visible`),await ni(g,async()=>{await R(V).toBeVisible({timeout:A})},`Expected element ${v} to be visible`,{stepType:"web_assert_visible",expected:"visible",actual:"not visible"}),g.logger.info(`✓ Element ${v} is visible`),{_summary:`${v} is visible`,selector:a,isVisible:!0}}},{type:"web_assert_not_visible",category:"Web",color:"#FF9800",tooltip:"Assert that an element is not visible (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=f.TIMEOUT,R=await ri(),V=i.locator(a);return g.logger.info(`Asserting ${v} is not visible`),await ni(g,async()=>{await R(V).toBeHidden({timeout:A})},`Expected element ${v} to be hidden`,{stepType:"web_assert_not_visible",expected:"hidden",actual:"visible"}),g.logger.info(`✓ Element ${v} is not visible`),{_summary:`${v} is not visible`,selector:a,isVisible:!1}}},{type:"web_assert_text_contains",category:"Web",color:"#FF9800",tooltip:"Assert that element text contains expected value (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=js(f.TEXT,g),R=f.TIMEOUT,V=await ri(),j=i.locator(a);return g.logger.info(`Asserting ${v} contains "${A}"`),await ni(g,async()=>{await V(j).toContainText(A,{timeout:R})},`Expected element ${v} to contain text "${A}"`,{stepType:"web_assert_text_contains",expected:A}),g.logger.info(`✓ Element ${v} contains text "${A}"`),{_summary:`"${A}" found`,selector:a,expectedText:A}}},{type:"web_assert_text_equals",category:"Web",color:"#FF9800",tooltip:"Assert that element text equals expected value (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=js(f.TEXT,g),R=f.TIMEOUT,V=await ri(),j=i.locator(a);return g.logger.info(`Asserting ${v} text equals "${A}"`),await ni(g,async()=>{await V(j).toHaveText(A,{timeout:R})},`Expected element ${v} text to equal "${A}"`,{stepType:"web_assert_text_equals",expected:A}),g.logger.info(`✓ Element ${v} text equals "${A}"`),{_summary:`"${A}" matches`,selector:a,expectedText:A}}},{type:"web_assert_url_contains",category:"Web",color:"#FF9800",tooltip:"Assert that current URL contains expected value (auto-waits)",inputs:[{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=js(f.TEXT,g),v=f.TIMEOUT,A=await ri(),R=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),V=new RegExp(R);return g.logger.info(`Asserting URL contains "${a}"`),await ni(g,async()=>{await A(i).toHaveURL(V,{timeout:v})},`Expected URL to contain "${a}"`,{stepType:"web_assert_url_contains",expected:a,actual:i.url()}),g.logger.info(`✓ URL contains "${a}"`),{_summary:`"${a}" in URL`,expectedText:a,actualUrl:i.url()}}},{type:"web_assert_title_contains",category:"Web",color:"#FF9800",tooltip:"Assert that page title contains expected value (auto-waits)",inputs:[{name:"TEXT",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=js(f.TEXT,g),v=f.TIMEOUT,A=await ri(),R=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),V=new RegExp(R);return g.logger.info(`Asserting title contains "${a}"`),await ni(g,async()=>{await A(i).toHaveTitle(V,{timeout:v})},`Expected title to contain "${a}"`,{stepType:"web_assert_title_contains",expected:a}),g.logger.info(`✓ Title contains "${a}"`),{_summary:`"${a}" in title`,expectedText:a}}},{type:"web_assert_enabled",category:"Web",color:"#FF9800",tooltip:"Assert that an element is enabled (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=f.TIMEOUT,R=await ri(),V=i.locator(a);return g.logger.info(`Asserting ${v} is enabled`),await ni(g,async()=>{await R(V).toBeEnabled({timeout:A})},`Expected element ${v} to be enabled`,{stepType:"web_assert_enabled",expected:"enabled",actual:"disabled"}),g.logger.info(`✓ Element ${v} is enabled`),{_summary:`${v} is enabled`,selector:a,isEnabled:!0}}},{type:"web_assert_checked",category:"Web",color:"#FF9800",tooltip:"Assert that a checkbox is checked (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"EXPECTED",type:"field",fieldType:"checkbox",default:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=f.EXPECTED,R=f.TIMEOUT,V=await ri(),j=i.locator(a);return g.logger.info(`Asserting ${v} is ${A?"checked":"unchecked"}`),await ni(g,async()=>{A?await V(j).toBeChecked({timeout:R}):await V(j).not.toBeChecked({timeout:R})},`Expected checkbox ${v} to be ${A?"checked":"unchecked"}`,{stepType:"web_assert_checked",expected:A?"checked":"unchecked"}),g.logger.info(`✓ Checkbox ${v} is ${A?"checked":"unchecked"}`),{_summary:`${v} is ${A?"checked":"unchecked"}`,selector:a,expected:A}}},{type:"web_assert_value",category:"Web",color:"#FF9800",tooltip:"Assert that an input field has a specific value (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=js(f.VALUE,g),R=f.TIMEOUT,V=await ri(),j=i.locator(a);return g.logger.info(`Asserting ${v} has value "${A}"`),await ni(g,async()=>{await V(j).toHaveValue(A,{timeout:R})},`Expected input ${v} to have value "${A}"`,{stepType:"web_assert_value",expected:A}),g.logger.info(`✓ Input ${v} has value "${A}"`),{_summary:`${v} = "${A}"`,selector:a,expected:A}}},{type:"web_assert_value_contains",category:"Web",color:"#FF9800",tooltip:"Assert that an input field value contains specific text (auto-waits)",inputs:[{name:"SELECTOR",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"field",fieldType:"text",required:!0},{name:"TIMEOUT",type:"field",fieldType:"number",default:3e4}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=g.page,a=Kr(f,g),v=Dl(f,g),A=js(f.VALUE,g),R=f.TIMEOUT,V=await ri(),j=i.locator(a);return g.logger.info(`Asserting ${v} value contains "${A}"`),await ni(g,async()=>{await V(j).toHaveValue(new RegExp(A),{timeout:R})},`Expected input ${v} value to contain "${A}"`,{stepType:"web_assert_value_contains",expected:A}),g.logger.info(`✓ Input ${v} value contains "${A}"`),{_summary:`${v} contains "${A}"`,selector:a,expected:A}}}],_b=[...$b,...gb,...fb,...mb],Eb=[{type:"logic_set_variable",category:"Logic",color:"#795548",tooltip:"Set a variable value",inputs:[{name:"NAME",type:"field",fieldType:"text",required:!0},{name:"VALUE",type:"value",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.NAME;let a=f.VALUE;a&&typeof a=="object"&&"_value"in a&&(a=a._value),g.variables.set(i,a),g.logger.debug(`Set variable ${i} = ${JSON.stringify(a)}`)}},{type:"logic_get_variable",category:"Logic",color:"#795548",tooltip:"Get a variable value",inputs:[{name:"NAME",type:"field",fieldType:"text",required:!0}],output:{type:["String","Number","Boolean","Object","Array"]},execute:async(f,g)=>{const i=f.NAME;return g.variables.get(i)}},{type:"logic_if",category:"Logic",color:"#5C6BC0",tooltip:"Execute blocks if condition is true",inputs:[{name:"CONDITION",type:"value",check:"Boolean",required:!0},{name:"DO",type:"statement"},{name:"ELSE",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.CONDITION;if(i&&f.DO)return{branch:"DO"};if(!i&&f.ELSE)return{branch:"ELSE"}}},{type:"logic_compare",category:"Logic",color:"#5C6BC0",tooltip:"Compare two values",inputs:[{name:"A",type:"value",required:!0},{name:"OP",type:"field",fieldType:"dropdown",options:[["=","eq"],["≠","neq"],["<","lt"],["≤","lte"],[">","gt"],["≥","gte"],["contains","contains"]]},{name:"B",type:"value",required:!0}],output:{type:"Boolean"},execute:async(f,g)=>{const i=f.A,a=f.B;switch(f.OP){case"eq":return JSON.stringify(i)===JSON.stringify(a);case"neq":return JSON.stringify(i)!==JSON.stringify(a);case"lt":return i<a;case"lte":return i<=a;case"gt":return i>a;case"gte":return i>=a;case"contains":return typeof i=="string"||Array.isArray(i)?i.includes(a):!1;default:return!1}}},{type:"logic_boolean_op",category:"Logic",color:"#5C6BC0",tooltip:"Combine boolean values",inputs:[{name:"A",type:"value",check:"Boolean",required:!0},{name:"OP",type:"field",fieldType:"dropdown",options:[["and","and"],["or","or"]]},{name:"B",type:"value",check:"Boolean",required:!0}],output:{type:"Boolean"},execute:async f=>{const g=f.A,i=f.B;return f.OP==="and"?g&&i:g||i}},{type:"logic_not",category:"Logic",color:"#5C6BC0",tooltip:"Negate a boolean value",inputs:[{name:"VALUE",type:"value",check:"Boolean",required:!0}],output:{type:"Boolean"},execute:async f=>!f.VALUE},{type:"logic_repeat",category:"Logic",color:"#5C6BC0",tooltip:"Repeat blocks a specified number of times",inputs:[{name:"TIMES",type:"field",fieldType:"number",default:10,required:!0},{name:"DO",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>({loop:!0,times:f.TIMES,statement:"DO"})},{type:"logic_foreach",category:"Logic",color:"#5C6BC0",tooltip:"Iterate over an array",inputs:[{name:"ARRAY",type:"value",check:"Array",required:!0},{name:"VAR",type:"field",fieldType:"text",default:"item",required:!0},{name:"DO",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.ARRAY,a=f.VAR;return{loop:!0,array:i,varName:a,statement:"DO"}}},{type:"logic_try_catch",category:"Logic",color:"#5C6BC0",tooltip:"Handle errors gracefully",inputs:[{name:"TRY",type:"statement"},{name:"CATCH",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>({tryCatch:!0})},{type:"logic_log",category:"Logic",color:"#607D8B",tooltip:"Log a message",inputs:[{name:"LEVEL",type:"field",fieldType:"dropdown",options:[["Info","info"],["Warning","warn"],["Error","error"],["Debug","debug"]]},{name:"MESSAGE",type:"field",fieldType:"text",required:!0}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.LEVEL||"info",a=id(f.MESSAGE,g);return g.logger[i](a),{_message:a,_summary:a}}},{type:"logic_comment",category:"Logic",color:"#9E9E9E",tooltip:"Add a comment (does nothing)",inputs:[{name:"TEXT",type:"field",fieldType:"text",default:"Comment"}],previousStatement:!0,nextStatement:!0,execute:async()=>{}},{type:"logic_text",category:"Logic",color:"#795548",tooltip:"A text value",inputs:[{name:"TEXT",type:"field",fieldType:"text",default:""}],output:{type:"String"},execute:async(f,g)=>id(f.TEXT,g)},{type:"logic_number",category:"Logic",color:"#795548",tooltip:"A number value",inputs:[{name:"NUM",type:"field",fieldType:"number",default:0}],output:{type:"Number"},execute:async f=>f.NUM},{type:"logic_boolean",category:"Logic",color:"#795548",tooltip:"A boolean value",inputs:[{name:"BOOL",type:"field",fieldType:"dropdown",options:[["true","true"],["false","false"]]}],output:{type:"Boolean"},execute:async f=>f.BOOL==="true"},{type:"logic_object",category:"Logic",color:"#795548",tooltip:"Create a JSON object",inputs:[{name:"JSON",type:"field",fieldType:"text",default:"{}"}],output:{type:"Object"},execute:async(f,g)=>{const i=id(f.JSON,g);return JSON.parse(i)}},{type:"logic_array",category:"Logic",color:"#795548",tooltip:"Create an array",inputs:[{name:"JSON",type:"field",fieldType:"text",default:"[]"}],output:{type:"Array"},execute:async(f,g)=>{const i=id(f.JSON,g);return JSON.parse(i)}},{type:"logic_fail",category:"Logic",color:"#f44336",tooltip:"Fail the test with a message",inputs:[{name:"MESSAGE",type:"field",fieldType:"text",default:"Test failed"}],previousStatement:!0,execute:async(f,g)=>{const i=id(f.MESSAGE,g);throw new Error(i)}},{type:"logic_assert",category:"Logic",color:"#FF9800",tooltip:"Assert a condition is true",inputs:[{name:"CONDITION",type:"value",check:"Boolean",required:!0},{name:"MESSAGE",type:"field",fieldType:"text",default:"Assertion failed"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.CONDITION,a=id(f.MESSAGE,g);sf(g,i,a,{stepType:"logic_assert",expected:!0,actual:i}),g.logger.info("✓ Assertion passed")}}];function id(f,g){return f.replace(/\$\{([\w.]+)\}/g,(i,a)=>{const v=a.split("."),A=v[0];let R=g.variables.get(A);if(v.length>1&&R!==void 0&&R!==null)for(let V=1;V<v.length&&R!=null;V++)R=R[v[V]];return R==null?i:typeof R=="object"?JSON.stringify(R):String(R)})}const Tb=[{type:"test_case",category:"Tests",color:"#1E88E5",tooltip:"A test case containing steps to execute",inputs:[{name:"NAME",type:"field",fieldType:"multiline",default:"Test Case"},{name:"SOFT_ASSERTIONS",type:"field",fieldType:"checkbox",default:!1},{name:"STEPS",type:"statement"}],execute:async(f,g)=>({testCase:!0,name:f.NAME,softAssertions:f.SOFT_ASSERTIONS,statement:"STEPS"})},{type:"test_case_data_driven",category:"Tests",color:"#1565C0",tooltip:"A data-driven test case that runs for each row of data (CSV format: header row, then data rows)",inputs:[{name:"NAME",type:"field",fieldType:"text",default:"Data-Driven Test"},{name:"SOFT_ASSERTIONS",type:"field",fieldType:"checkbox",default:!1},{name:"DATA",type:"field",fieldType:"multiline",default:`username,password,expected
837
837
  user1,pass1,true
838
838
  user2,pass2,false`},{name:"STEPS",type:"statement"}],execute:async(f,g)=>{const a=f.DATA.trim().split(`
839
839
  `).map(R=>R.split(",").map(V=>V.trim()));if(a.length<2)return{testCase:!0,name:f.NAME,softAssertions:f.SOFT_ASSERTIONS,dataDriven:!0,data:[],statement:"STEPS"};const v=a[0],A=a.slice(1).map((R,V)=>{const j={};return v.forEach((ee,he)=>{let J=R[he]||"";J==="true"?J=!0:J==="false"?J=!1:!isNaN(Number(J))&&J!==""&&(J=Number(J)),j[ee]=J}),{name:`Row ${V+1}`,values:j}});return{testCase:!0,name:f.NAME,softAssertions:f.SOFT_ASSERTIONS,dataDriven:!0,data:A,statement:"STEPS"}}},{type:"lifecycle_before_all",category:"Lifecycle",color:"#8E24AA",tooltip:"Steps to run once before all tests in the suite",inputs:[{name:"DO",type:"statement"}],execute:async(f,g)=>({lifecycle:"beforeAll",statement:"DO"})},{type:"lifecycle_after_all",category:"Lifecycle",color:"#8E24AA",tooltip:"Steps to run once after all tests in the suite",inputs:[{name:"DO",type:"statement"}],execute:async(f,g)=>({lifecycle:"afterAll",statement:"DO"})},{type:"lifecycle_before_each",category:"Lifecycle",color:"#8E24AA",tooltip:"Steps to run before each test",inputs:[{name:"DO",type:"statement"}],execute:async(f,g)=>({lifecycle:"beforeEach",statement:"DO"})},{type:"lifecycle_after_each",category:"Lifecycle",color:"#8E24AA",tooltip:"Steps to run after each test",inputs:[{name:"DO",type:"statement"}],execute:async(f,g)=>({lifecycle:"afterEach",statement:"DO"})},{type:"lifecycle_setup",category:"Lifecycle",color:"#8E24AA",tooltip:"Setup steps to run before the test",inputs:[{name:"DESCRIPTION",type:"field",fieldType:"text",default:"Setup"},{name:"DO",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>(g.logger.info(`Setup: ${f.DESCRIPTION}`),{lifecycle:"setup",statement:"DO"})},{type:"lifecycle_teardown",category:"Lifecycle",color:"#8E24AA",tooltip:"Teardown steps to run after the test",inputs:[{name:"DESCRIPTION",type:"field",fieldType:"text",default:"Teardown"},{name:"DO",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>(g.logger.info(`Teardown: ${f.DESCRIPTION}`),{lifecycle:"teardown",statement:"DO"})},{type:"lifecycle_on_failure",category:"Lifecycle",color:"#C62828",tooltip:"Steps to run only if the test fails",inputs:[{name:"DO",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>({lifecycle:"onFailure",statement:"DO"})},{type:"lifecycle_skip_if",category:"Lifecycle",color:"#757575",tooltip:"Skip the rest of the test if condition is true",inputs:[{name:"CONDITION",type:"value",check:"Boolean",required:!0},{name:"REASON",type:"field",fieldType:"text",default:"Condition not met"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.CONDITION,a=f.REASON;if(i)throw{skip:!0,reason:a}}},{type:"lifecycle_retry",category:"Lifecycle",color:"#FF6F00",tooltip:"Retry steps on failure",inputs:[{name:"TIMES",type:"field",fieldType:"number",default:3},{name:"DELAY",type:"field",fieldType:"number",default:1e3},{name:"DO",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.TIMES,a=f.DELAY;return{retry:!0,times:i,delay:a,statement:"DO"}}}],bb=[{type:"data_define",category:"Data",color:"#00897B",tooltip:"Define test data sets for data-driven testing",inputs:[{name:"DATA_JSON",type:"field",fieldType:"text",default:'[{"name": "test1", "value": 1}]'}],output:{type:"Array"},execute:async(f,g)=>{const i=v$(f.DATA_JSON,g);return JSON.parse(i)}},{type:"data_from_variable",category:"Data",color:"#00897B",tooltip:"Get test data from a variable",inputs:[{name:"NAME",type:"field",fieldType:"text",required:!0}],output:{type:"Array"},execute:async(f,g)=>{const i=f.NAME;return g.variables.get(i)||[]}},{type:"data_get_current",category:"Data",color:"#00897B",tooltip:"Get a value from the current data set",inputs:[{name:"KEY",type:"field",fieldType:"text",required:!0}],output:{type:["String","Number","Boolean","Object","Array"]},execute:async(f,g)=>{const i=f.KEY;if(!g.currentData)throw new Error("No data set available. This block must be used inside a data-driven test.");const a=g.currentData.values[i];return a===void 0&&g.logger.warn(`Data key "${i}" not found in current data set`),a}},{type:"data_get_index",category:"Data",color:"#00897B",tooltip:"Get the current data iteration index (0-based)",inputs:[],output:{type:"Number"},execute:async(f,g)=>g.dataIndex??0},{type:"data_get_name",category:"Data",color:"#00897B",tooltip:"Get the name of the current data set",inputs:[],output:{type:"String"},execute:async(f,g)=>{var i;return((i=g.currentData)==null?void 0:i.name)??`Iteration ${(g.dataIndex??0)+1}`}},{type:"data_foreach",category:"Data",color:"#00897B",tooltip:"Run steps for each item in a data set",inputs:[{name:"DATA",type:"value",check:"Array",required:!0},{name:"ITEM_VAR",type:"field",fieldType:"text",default:"item"},{name:"INDEX_VAR",type:"field",fieldType:"text",default:"index"},{name:"DO",type:"statement"}],previousStatement:!0,nextStatement:!0,execute:async(f,g)=>{const i=f.DATA,a=f.ITEM_VAR,v=f.INDEX_VAR;return{dataLoop:!0,data:i,itemVar:a,indexVar:v,statement:"DO"}}},{type:"data_row",category:"Data",color:"#00897B",tooltip:"Create a single data row with key-value pairs",inputs:[{name:"NAME",type:"field",fieldType:"text",default:""},{name:"JSON",type:"field",fieldType:"text",default:"{}"}],output:{type:"Object"},execute:async(f,g)=>{const i=f.NAME,a=v$(f.JSON,g);return{name:i||void 0,values:JSON.parse(a)}}},{type:"data_table",category:"Data",color:"#00897B",tooltip:"Create a data table with headers and rows",inputs:[{name:"HEADERS",type:"field",fieldType:"text",default:"username, password, expected"},{name:"ROWS",type:"field",fieldType:"text",default:`user1, pass1, true
@@ -2192,4 +2192,4 @@ def ${p.FUNCTION_NAME_PLACEHOLDER_}(msg):
2192
2192
  ]`})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Using Data Values"}),E.jsxs("ol",{children:[E.jsxs("li",{children:["Use ",E.jsx("strong",{children:"Get Current Value"})," block with field name"]}),E.jsxs("li",{children:["Example: Get Current Value ",E.jsx("code",{children:"username"})]}),E.jsxs("li",{children:["Or use in text: ",E.jsx("code",{children:"${data.username}"})]})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Other Data Blocks"}),E.jsxs("ul",{children:[E.jsxs("li",{children:[E.jsx("strong",{children:"Data Table"})," - define data with headers and rows"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"CSV Data"})," - parse CSV-style data"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Range"})," - generate number sequences (1 to 10)"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"For Each Data"})," - iterate within a test"]})]})]}),E.jsxs("div",{className:"help-tip",children:[E.jsx("strong",{children:"Example Use Case:"})," Test login with valid users, invalid passwords, empty fields, and special characters all in one test."]})]})},{id:"custom-blocks",title:"Custom Blocks",content:E.jsxs(E.Fragment,{children:[E.jsx("h3",{children:"Creating Reusable Blocks"}),E.jsx("p",{children:"Turn any sequence of blocks into a reusable custom block."}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Creating a Custom Block"}),E.jsxs("ol",{children:[E.jsx("li",{children:"Build your block sequence in the workspace"}),E.jsxs("li",{children:[E.jsx("strong",{children:"Select multiple blocks"})," using Shift+Click or Ctrl/Cmd+Click"]}),E.jsxs("li",{children:["Right-click and choose ",E.jsx("strong",{children:'"Create Reusable Block"'})]}),E.jsx("li",{children:'Name your block (e.g., "Login", "Add to Cart")'}),E.jsx("li",{children:"Choose which values should be parameters"}),E.jsxs("li",{children:["Click ",E.jsx("strong",{children:"Create Block"})]})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Using Custom Blocks"}),E.jsxs("ol",{children:[E.jsxs("li",{children:["Find your block in the ",E.jsx("strong",{children:"Custom"})," category in the toolbox"]}),E.jsx("li",{children:"Drag it into any test"}),E.jsx("li",{children:"Fill in the parameter values"})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Editing Custom Blocks"}),E.jsxs("ol",{children:[E.jsx("li",{children:"Right-click on any instance of your custom block"}),E.jsxs("li",{children:["Choose ",E.jsx("strong",{children:'"Edit Reusable Block"'})]}),E.jsx("li",{children:"Modify the steps or parameters"}),E.jsxs("li",{children:["Click ",E.jsx("strong",{children:"Save Changes"})]})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Parameters"}),E.jsx("p",{children:"When creating a custom block, you can choose which field values become parameters:"}),E.jsxs("ul",{children:[E.jsx("li",{children:"Checked = user can customize this value when using the block"}),E.jsx("li",{children:"Unchecked = value is fixed inside the block"})]})]}),E.jsxs("div",{className:"help-tip",children:[E.jsx("strong",{children:"Best Practice:"})," Create custom blocks for common flows like login, navigation, or form filling to keep tests DRY (Don't Repeat Yourself)."]})]})},{id:"lifecycle",title:"Lifecycle Hooks",content:E.jsxs(E.Fragment,{children:[E.jsx("h3",{children:"Setup & Teardown"}),E.jsx("p",{children:"Run code before/after tests using lifecycle hooks."}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Available Hooks"}),E.jsxs("ul",{children:[E.jsxs("li",{children:[E.jsx("strong",{children:"Before All"})," - runs once before all tests start"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"After All"})," - runs once after all tests complete"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Before Each"})," - runs before each individual test"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"After Each"})," - runs after each individual test"]})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Accessing Lifecycle Tabs"}),E.jsxs("ol",{children:[E.jsxs("li",{children:["Click the tabs above the workspace: ",E.jsx("strong",{children:"Test | Before All | After All | Before Each | After Each"})]}),E.jsx("li",{children:"Add blocks to the selected lifecycle phase"}),E.jsx("li",{children:"Blocks run automatically at the appropriate time"})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Common Use Cases"}),E.jsxs("ul",{children:[E.jsxs("li",{children:[E.jsx("strong",{children:"Before All:"})," Set up test data, authenticate API"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Before Each:"})," Navigate to starting page, reset state"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"After Each:"})," Take screenshot, log out user"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"After All:"})," Clean up test data, close connections"]})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Special Lifecycle Blocks"}),E.jsxs("ul",{children:[E.jsxs("li",{children:[E.jsx("strong",{children:"On Failure"})," - only runs if the test fails"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Skip If"})," - skip test based on condition"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Retry"})," - retry failed steps automatically"]})]})]}),E.jsxs("div",{className:"help-tip",children:[E.jsx("strong",{children:"Tip:"})," Use Before Each to ensure each test starts from a clean state, making tests independent and reliable."]})]})},{id:"logic",title:"Logic & Control Flow",content:E.jsxs(E.Fragment,{children:[E.jsx("h3",{children:"Control Flow"}),E.jsx("p",{children:"Add conditional logic, loops, and error handling to your tests."}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Conditional Execution (If/Else)"}),E.jsxs("ol",{children:[E.jsxs("li",{children:["Use the ",E.jsx("strong",{children:"If"})," block from Logic category"]}),E.jsxs("li",{children:["Connect a condition block (e.g., ",E.jsx("strong",{children:"Compare"}),")"]}),E.jsx("li",{children:'Add blocks inside the "then" section'}),E.jsx("li",{children:'Optionally add blocks to the "else" section'})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Comparisons"}),E.jsxs("p",{children:["Use the ",E.jsx("strong",{children:"Compare"})," block to check:"]}),E.jsxs("ul",{children:[E.jsxs("li",{children:[E.jsx("code",{children:"="})," equals"]}),E.jsxs("li",{children:[E.jsx("code",{children:"≠"})," not equals"]}),E.jsxs("li",{children:[E.jsx("code",{children:"<"})," ",E.jsx("code",{children:">"})," ",E.jsx("code",{children:"≤"})," ",E.jsx("code",{children:"≥"})," numeric comparisons"]}),E.jsxs("li",{children:[E.jsx("code",{children:"contains"})," text contains"]})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Loops"}),E.jsxs("ul",{children:[E.jsxs("li",{children:[E.jsx("strong",{children:"Repeat"})," - run blocks N times"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"For Each"})," - iterate over an array"]})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Error Handling"}),E.jsxs("ol",{children:[E.jsxs("li",{children:["Use ",E.jsx("strong",{children:"Try/Catch"})," to handle potential failures"]}),E.jsx("li",{children:'Blocks in "try" run first'}),E.jsx("li",{children:'If they fail, "catch" blocks run instead'})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Logging & Debugging"}),E.jsxs("ul",{children:[E.jsxs("li",{children:[E.jsx("strong",{children:"Log"})," - output messages (info, warn, error, debug)"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Comment"})," - add notes (doesn't run)"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Fail"})," - force test to fail with message"]})]})]})]})},{id:"tips",title:"Tips & Tricks",content:E.jsxs(E.Fragment,{children:[E.jsx("h3",{children:"Pro Tips"}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Selectors"}),E.jsx("p",{children:"Best practices for finding elements:"}),E.jsxs("ul",{children:[E.jsxs("li",{children:[E.jsx("code",{children:"#id"})," - by ID (most reliable)"]}),E.jsxs("li",{children:[E.jsx("code",{children:'[data-testid="value"]'})," - by test ID attribute"]}),E.jsxs("li",{children:[E.jsx("code",{children:".class-name"})," - by CSS class"]}),E.jsxs("li",{children:[E.jsx("code",{children:"text=Click me"})," - by visible text"]}),E.jsxs("li",{children:[E.jsx("code",{children:'button:has-text("Submit")'})," - button containing text"]})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Keyboard Shortcuts"}),E.jsxs("ul",{children:[E.jsxs("li",{children:[E.jsx("strong",{children:"Delete/Backspace"})," - delete selected block"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Ctrl/Cmd + C/V"})," - copy/paste blocks"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Ctrl/Cmd + Z"})," - undo"]}),E.jsxs("li",{children:[E.jsx("strong",{children:"Shift + Click"})," - select multiple blocks"]})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Debugging Failed Tests"}),E.jsxs("ol",{children:[E.jsxs("li",{children:["Turn off ",E.jsx("strong",{children:"Headless"})," mode to watch the browser"]}),E.jsxs("li",{children:["Add ",E.jsx("strong",{children:"Wait"})," blocks to slow down execution"]}),E.jsxs("li",{children:["Use ",E.jsx("strong",{children:"Screenshot"})," blocks to capture state"]}),E.jsx("li",{children:"Check the Results panel for error details"})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Test Organization"}),E.jsxs("ul",{children:[E.jsx("li",{children:"One test file per feature or page"}),E.jsx("li",{children:"Use descriptive test names"}),E.jsx("li",{children:"Keep tests independent (don't rely on other tests)"}),E.jsx("li",{children:"Use lifecycle hooks for common setup"})]})]}),E.jsxs("div",{className:"help-feature",children:[E.jsx("h4",{children:"Performance Tips"}),E.jsxs("ul",{children:[E.jsxs("li",{children:["Avoid fixed ",E.jsx("strong",{children:"Wait"})," blocks - use ",E.jsx("strong",{children:"Wait for Element"})," instead"]}),E.jsxs("li",{children:["Run tests in ",E.jsx("strong",{children:"Headless"})," mode for speed"]}),E.jsx("li",{children:"Use API calls to set up test data (faster than UI)"})]})]})]})}];function By({isOpen:f,onClose:g}){const[i,a]=xe.useState("getting-started");if(!f)return null;const v=EE.find(A=>A.id===i);return E.jsx("div",{className:"modal-overlay",onClick:g,children:E.jsxs("div",{className:"modal help-modal",onClick:A=>A.stopPropagation(),children:[E.jsxs("div",{className:"help-header",children:[E.jsx("h2",{children:"TestBlocks Guide"}),E.jsx("button",{className:"btn-close",onClick:g,children:"×"})]}),E.jsxs("div",{className:"help-layout",children:[E.jsx("nav",{className:"help-nav",children:EE.map(A=>E.jsx("button",{className:`help-nav-item ${i===A.id?"active":""}`,onClick:()=>a(A.id),children:A.title},A.id))}),E.jsx("div",{className:"help-content",children:v==null?void 0:v.content})]})]})})}function Uy(f){switch(f.type){case"web_navigate":return`Navigate → ${f.params.URL}`;case"web_click":return`Click → ${f.params.SELECTOR}`;case"web_fill":return`Fill → ${f.params.SELECTOR}`;case"web_type":return`Type → ${f.params.SELECTOR}`;case"web_checkbox":return`${f.params.ACTION==="check"?"Check":"Uncheck"} → ${f.params.SELECTOR}`;case"web_select":return`Select → ${f.params.SELECTOR}`;case"web_hover":return`Hover → ${f.params.SELECTOR}`;case"web_press_key":return`Press Key → ${f.params.KEY}`;case"web_wait_for_element":return`Wait for → ${f.params.SELECTOR}`;case"web_wait":return`Wait → ${f.params.DURATION}ms`;default:return f.type}}function Vy({isOpen:f,onClose:g,onStepsRecorded:i}){const[a,v]=xe.useState({stage:"url-input",url:"https://",sessionId:null,steps:[],error:null,showAdvanced:!1,options:{testIdAttribute:"data-testid"}}),A=xe.useRef(null);xe.useEffect(()=>(f&&fetch("/api/globals").then(J=>J.json()).then(J=>{v({stage:"url-input",url:"https://",sessionId:null,steps:[],error:null,showAdvanced:!1,options:{testIdAttribute:J.testIdAttribute||"data-testid"}})}).catch(()=>{v({stage:"url-input",url:"https://",sessionId:null,steps:[],error:null,showAdvanced:!1,options:{testIdAttribute:"data-testid"}})}),()=>{A.current&&(clearInterval(A.current),A.current=null)}),[f]),xe.useEffect(()=>{if(a.stage==="recording"&&a.sessionId)return A.current=setInterval(async()=>{try{const W=await(await fetch(`/api/record/status/${a.sessionId}`)).json();W.status==="completed"?V():W.status==="error"&&(v(X=>({...X,stage:"error",error:W.error||"Recording failed"})),A.current&&(clearInterval(A.current),A.current=null))}catch(J){console.error("Failed to poll recording status:",J)}},2e3),()=>{A.current&&(clearInterval(A.current),A.current=null)}},[a.stage,a.sessionId]);const R=xe.useCallback(async()=>{if(!a.url||a.url==="https://"){v(J=>({...J,error:"Please enter a valid URL"}));return}v(J=>({...J,stage:"processing",error:null}));try{const J=await fetch("/api/record/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:a.url,testIdAttribute:a.options.testIdAttribute||void 0})}),W=await J.json();if(!J.ok)throw new Error(W.message||W.error||"Failed to start recording");v(X=>({...X,stage:"recording",sessionId:W.sessionId}))}catch(J){v(W=>({...W,stage:"error",error:J.message}))}},[a.url,a.options.testIdAttribute]),V=xe.useCallback(async()=>{if(a.sessionId){A.current&&(clearInterval(A.current),A.current=null),v(J=>({...J,stage:"processing"}));try{const J=await fetch("/api/record/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:a.sessionId})}),W=await J.json();if(!J.ok)throw new Error(W.message||W.error||"Failed to stop recording");v(X=>({...X,stage:"preview",steps:W.steps||[]}))}catch(J){v(W=>({...W,stage:"error",error:J.message}))}}},[a.sessionId]),j=xe.useCallback(()=>{i(a.steps,"append"),g()},[a.steps,i,g]),ee=xe.useCallback(()=>{i(a.steps,"new"),g()},[a.steps,i,g]),he=xe.useCallback(()=>{if(a.stage==="recording"){if(!confirm("Recording is in progress. Are you sure you want to cancel?"))return;a.sessionId&&fetch("/api/record/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:a.sessionId})}).catch(()=>{})}g()},[a.stage,a.sessionId,g]);return f?E.jsx("div",{className:"modal-overlay",onClick:he,children:E.jsxs("div",{className:"modal record-dialog",onClick:J=>J.stopPropagation(),children:[E.jsxs("div",{className:"modal-header",children:[E.jsx("h2",{children:"Record Browser Actions"}),E.jsx("button",{className:"btn-close",onClick:he,children:"×"})]}),E.jsxs("div",{className:"modal-body",children:[a.stage==="url-input"&&E.jsxs("div",{className:"record-url-input",children:[E.jsx("p",{children:"Enter the starting URL for recording:"}),E.jsx("input",{type:"url",className:"url-input",value:a.url,onChange:J=>v(W=>({...W,url:J.target.value,error:null})),placeholder:"https://example.com",autoFocus:!0}),a.error&&E.jsx("div",{className:"record-error",children:a.error}),E.jsx("p",{className:"record-hint",children:"A browser window will open where you can perform actions. Close the browser when you're done recording."}),E.jsxs("div",{className:"advanced-options",children:[E.jsxs("button",{type:"button",className:"advanced-toggle",onClick:()=>v(J=>({...J,showAdvanced:!J.showAdvanced})),children:[E.jsx("span",{className:"toggle-icon",children:a.showAdvanced?"▼":"▶"}),"Advanced Options"]}),a.showAdvanced&&E.jsxs("div",{className:"advanced-content",children:[E.jsxs("div",{className:"option-row",children:[E.jsx("label",{htmlFor:"testIdAttribute",children:"Test ID Attribute:"}),E.jsx("input",{id:"testIdAttribute",type:"text",className:"option-input",value:a.options.testIdAttribute,onChange:J=>{const W=J.target.value;v(X=>({...X,options:{...X.options,testIdAttribute:W}}))},onBlur:J=>{const W=J.target.value.trim();W&&fetch("/api/globals/test-id-attribute",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({testIdAttribute:W})}).catch(console.error)},placeholder:"data-testid"})]}),E.jsx("p",{className:"option-hint",children:"Attribute used to identify elements (e.g., data-testid, data-test, data-cy). This setting is saved globally."})]})]})]}),a.stage==="recording"&&E.jsxs("div",{className:"record-status recording",children:[E.jsx("div",{className:"recording-indicator"}),E.jsxs("div",{className:"recording-info",children:[E.jsx("h3",{children:"Recording in progress..."}),E.jsx("p",{children:"Perform your test actions in the browser window."}),E.jsx("p",{children:'Close the browser or click "Stop Recording" when done.'})]})]}),a.stage==="processing"&&E.jsxs("div",{className:"record-status processing",children:[E.jsx("div",{className:"processing-spinner"}),E.jsx("p",{children:"Processing recorded actions..."})]}),a.stage==="preview"&&E.jsx("div",{className:"record-preview",children:a.steps.length===0?E.jsxs("div",{className:"record-empty",children:[E.jsx("p",{children:"No actions were recorded."}),E.jsx("p",{className:"record-hint",children:"Make sure to interact with elements in the browser (click, type, navigate, etc.)"})]}):E.jsxs(E.Fragment,{children:[E.jsxs("h3",{children:["Recorded ",a.steps.length," action",a.steps.length!==1?"s":"",":"]}),E.jsx("div",{className:"steps-preview",children:a.steps.map((J,W)=>E.jsxs("div",{className:"step-preview-item",children:[E.jsxs("span",{className:"step-number",children:[W+1,"."]}),E.jsx("span",{className:"step-description",children:Uy(J)})]},J.id))})]})}),a.stage==="error"&&E.jsxs("div",{className:"record-error-state",children:[E.jsx("h3",{children:"Recording Failed"}),E.jsx("p",{className:"record-error",children:a.error}),E.jsx("button",{className:"btn btn-secondary",onClick:()=>v(J=>({...J,stage:"url-input",error:null})),children:"Try Again"})]})]}),E.jsxs("div",{className:"modal-actions",children:[E.jsx("button",{className:"btn btn-secondary",onClick:he,children:"Cancel"}),a.stage==="url-input"&&E.jsx("button",{className:"btn btn-primary",onClick:R,children:"Start Recording"}),a.stage==="recording"&&E.jsx("button",{className:"btn btn-warning",onClick:V,children:"Stop Recording"}),a.stage==="preview"&&a.steps.length>0&&E.jsxs(E.Fragment,{children:[E.jsx("button",{className:"btn btn-secondary",onClick:j,children:"Add to Current Test"}),E.jsx("button",{className:"btn btn-primary",onClick:ee,children:"Create New Test"})]})]})]})}):null}function Hy({isOpen:f,title:g,fields:i,onSubmit:a,onCancel:v,submitLabel:A="Create"}){const[R,V]=xe.useState({}),j=xe.useRef(null);if(xe.useEffect(()=>{if(f){const J={};i.forEach(W=>{J[W.name]=W.defaultValue||""}),V(J),setTimeout(()=>{var W;return(W=j.current)==null?void 0:W.focus()},50)}},[f,i]),!f)return null;const ee=J=>{J.preventDefault(),i.every(X=>{var re;return!X.required||((re=R[X.name])==null?void 0:re.trim())})&&a(R)},he=J=>{J.key==="Escape"&&v()};return E.jsx("div",{className:"modal-overlay",onClick:v,children:E.jsxs("div",{className:"modal prompt-dialog",onClick:J=>J.stopPropagation(),onKeyDown:he,children:[E.jsxs("div",{className:"modal-header",children:[E.jsx("h2",{children:g}),E.jsx("button",{className:"btn-close",onClick:v,children:"×"})]}),E.jsxs("form",{onSubmit:ee,children:[E.jsx("div",{className:"modal-body",children:i.map((J,W)=>E.jsxs("div",{className:"prompt-field",children:[E.jsx("label",{htmlFor:`prompt-${J.name}`,children:J.label}),E.jsx("input",{ref:W===0?j:void 0,type:"text",id:`prompt-${J.name}`,value:R[J.name]||"",onChange:X=>V(re=>({...re,[J.name]:X.target.value})),placeholder:J.placeholder,required:J.required})]},J.name))}),E.jsxs("div",{className:"modal-actions",children:[E.jsx("button",{type:"button",className:"btn btn-secondary",onClick:v,children:"Cancel"}),E.jsx("button",{type:"submit",className:"btn btn-primary",children:A})]})]})]})})}const Gy=150,jy={global:"#4CAF50",file:"#2196F3",folder:"#9C27B0",test:"#FF9800",procedure:"#607D8B"};function TE({variables:f,onChange:g,title:i="Variables",emptyMessage:a="No variables defined"}){const[v,A]=xe.useState(f),R=xe.useRef(f);xe.useEffect(()=>{JSON.stringify(f)!==JSON.stringify(R.current)&&(v.some(re=>!re.name.trim())||A(f),R.current=f)},[f,v]);const V=xe.useCallback(W=>{const X=W.filter(Me=>Me.name.trim()!==""),re=new Set;let ye=!1;for(const Me of X){const Pe=Me.name.trim().toLowerCase();if(re.has(Pe)){ye=!0;break}re.add(Pe)}ye||(R.current=X,g(X))},[g]),j=()=>{const W=[...v,{name:"",value:""}];A(W)},ee=(W,X,re)=>{const ye=[...v];ye[W]={...ye[W],[X]:re},A(ye),V(ye)},he=W=>{const X=v.filter((re,ye)=>ye!==W);A(X),V(X)},J=xe.useMemo(()=>{const W=new Map;for(const X of v)if(X.name.trim()){const re=X.name.trim().toLowerCase();W.set(re,(W.get(re)||0)+1)}return new Set([...W.entries()].filter(([,X])=>X>1).map(([X])=>X))},[v]);return E.jsxs("div",{className:"variables-editor",children:[i&&E.jsx("div",{className:"variables-section-header",children:E.jsx("h4",{children:i})}),v.length===0?E.jsx("div",{className:"variables-empty",children:a}):v.map((W,X)=>E.jsx(Wy,{variable:W,isDuplicate:J.has(W.name.trim().toLowerCase()),onUpdate:(re,ye)=>ee(X,re,ye),onDelete:()=>he(X)},X)),E.jsx("button",{className:"add-variable-btn",onClick:j,children:"+ Add Variable"})]})}function Wy({variable:f,isDuplicate:g,onUpdate:i,onDelete:a}){const[v,A]=xe.useState([]),[R,V]=xe.useState(-1),[j,ee]=xe.useState(!1),he=xe.useRef(null),J=xe.useRef(null);xe.useEffect(()=>{f.name===""&&J.current&&J.current.focus()},[]);const W=xe.useCallback((Pe,Be)=>{const ut=Pe.substring(0,Be),st=ut.lastIndexOf("${");if(st!==-1){const $t=ut.substring(st);if(!$t.includes("}")){const He=$t.substring(2),te=F$(He);if(te.length>0){A(te),V(-1),ee(!0);return}}}ee(!1),A([])},[]),X=Pe=>{const Be=Pe.target.value;i("value",Be),W(Be,Pe.target.selectionStart||0)},re=xe.useCallback(Pe=>{if(Pe<0||Pe>=v.length||!he.current)return;const Be=v[Pe],ut=he.current,st=ut.selectionStart||0,$t=f.value,te=$t.substring(0,st).lastIndexOf("${");if(te!==-1){const ve=$t.substring(0,te)+"${"+Be.name+"}"+$t.substring(st);i("value",ve);const Ve=te+Be.name.length+3;setTimeout(()=>{ut.setSelectionRange(Ve,Ve),ut.focus()},0)}ee(!1),A([])},[v,f.value,i]),ye=Pe=>{if(j)switch(Pe.key){case"ArrowDown":Pe.preventDefault(),V(Be=>Be<v.length-1?Be+1:0);break;case"ArrowUp":Pe.preventDefault(),V(Be=>Be>0?Be-1:v.length-1);break;case"Enter":case"Tab":R>=0?(Pe.preventDefault(),re(R)):v.length>0&&Pe.key==="Tab"&&(Pe.preventDefault(),re(0));break;case"Escape":Pe.preventDefault(),ee(!1);break}},Me=()=>{setTimeout(()=>{ee(!1)},Gy)};return E.jsxs("div",{className:`variable-editor-item ${g?"duplicate":""}`,children:[E.jsxs("div",{className:"var-name",children:[E.jsx("input",{ref:J,type:"text",value:f.name,onChange:Pe=>i("name",Pe.target.value),onBlur:Me,placeholder:"name",style:g?{borderColor:"#f44336"}:void 0}),g&&E.jsx("span",{className:"duplicate-warning",title:"Duplicate variable name",children:"⚠"})]}),E.jsxs("div",{className:"var-value",style:{position:"relative"},children:[E.jsx("input",{ref:he,type:"text",value:f.value,onChange:X,onKeyDown:ye,onBlur:Me,placeholder:"value (use ${var} for references)"}),j&&v.length>0&&E.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,background:"white",border:"1px solid #ccc",borderRadius:"4px",boxShadow:"0 2px 8px rgba(0,0,0,0.15)",maxHeight:"150px",overflowY:"auto",zIndex:1e3},children:v.map((Pe,Be)=>E.jsxs("div",{style:{padding:"6px 10px",cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",background:Be===R?"#e3f2fd":"white",borderBottom:"1px solid #eee",fontSize:"12px"},onMouseEnter:()=>V(Be),onMouseDown:ut=>{ut.preventDefault(),re(Be)},children:[E.jsx("span",{style:{background:jy[Pe.scope]||"#999",color:"white",padding:"1px 5px",borderRadius:"3px",fontSize:"9px",textTransform:"uppercase"},children:Pe.scope.charAt(0)}),E.jsx("span",{style:{fontFamily:"monospace",flex:1},children:"${"+Pe.name+"}"})]},Pe.name))})]}),E.jsx("div",{className:"var-actions",children:E.jsx("button",{className:"btn-icon delete",onClick:a,title:"Delete variable",children:"×"})})]})}function Xy(f){return f?Object.entries(f).map(([g,i])=>({name:g,value:typeof i=="string"?i:JSON.stringify(i)})):[]}function zy(f){const g={};for(const i of f)if(i.name.trim())try{i.value.startsWith("{")||i.value.startsWith("[")||i.value==="true"||i.value==="false"||!isNaN(Number(i.value))&&i.value!==""?g[i.name]=JSON.parse(i.value):g[i.name]=i.value}catch{g[i.name]=i.value}return g}const Yy="testblocks-storage",cd="handles";async function ME(){return new Promise((f,g)=>{const i=indexedDB.open(Yy,1);i.onerror=()=>g(i.error),i.onsuccess=()=>f(i.result),i.onupgradeneeded=()=>{const a=i.result;a.objectStoreNames.contains(cd)||a.createObjectStore(cd)}})}async function Ky(f){const g=await ME();return new Promise((i,a)=>{const R=g.transaction(cd,"readwrite").objectStore(cd).put(f,"lastDirectory");R.onerror=()=>a(R.error),R.onsuccess=()=>i()})}async function bE(){try{const f=await ME();return new Promise((g,i)=>{const A=f.transaction(cd,"readonly").objectStore(cd).get("lastDirectory");A.onerror=()=>i(A.error),A.onsuccess=()=>g(A.result||null)})}catch{return null}}async function hf(f,g=""){const i={name:f.name,path:g||f.name,type:"folder",children:[],folderHandle:f},a=[];for await(const v of f.values())a.push({name:v.name,kind:v.kind,handle:v});a.sort((v,A)=>v.kind!==A.kind?v.kind==="directory"?-1:1:v.name.localeCompare(A.name));for(const v of a){const A=g?`${g}/${v.name}`:v.name;if(v.kind==="directory"){const R=await hf(v.handle,A);R.children&&R.children.length>0&&i.children.push(R)}else if(v.name==="_hooks.testblocks.json")try{const R=v.handle,j=await(await R.getFile()).text(),ee=JSON.parse(j);i.folderHooks=ee,i.hooksFileHandle=R}catch(R){console.warn(`Skipping invalid hooks file: ${v.name}`,R)}else if(v.name.endsWith(".testblocks.json")||v.name.endsWith(".json"))try{const R=v.handle,j=await(await R.getFile()).text(),ee=JSON.parse(j);ee.version&&ee.tests&&Array.isArray(ee.tests)&&i.children.push({name:v.name,path:A,type:"file",testFile:ee,handle:R})}catch(R){console.warn(`Skipping invalid file: ${v.name}`,R)}}return i}async function qy(f){try{const g=await f.getFileHandle("globals.json"),a=await(await g.getFile()).text(),v=JSON.parse(a);return console.log("[loadGlobalsFile] Loaded globals:",v),{variables:v.variables||null,handle:g,fullContent:v}}catch{return console.log("[loadGlobalsFile] No globals.json found"),{variables:null,handle:null,fullContent:null}}}function op(f,g){if(!f||!g)return null;if(f.path===g)return f;if(f.children)for(const i of f.children){const a=op(i,g);if(a)return a}return null}function Jy(f,g,i){const a=JSON.parse(JSON.stringify(f)),v=g.split(".");let A=a;for(let R=0;R<v.length-1;R++)v[R]in A||(A[v[R]]={}),A=A[v[R]];return A[v[v.length-1]]=i,a}const Qy={version:"1.0.0",name:"Untitled Test Suite",description:"",variables:{},tests:[{id:"test-1",name:"Test Case 1",description:"",steps:[],tags:[]}]};function Zy(){var Ut,Oe;const{toasts:f,dismissToast:g}=by(),[i,a]=xe.useState({projectRoot:null,lastFolderName:null,selectedFilePath:null,globalVariables:null,globalsFileContent:null,testFile:Qy,selectedTestIndex:0,editingFolderHooks:null,folderHooks:{version:"1.0.0"},results:[],isRunning:!1,runningTestId:null,showVariables:!1,showGlobalVariables:!1,headless:localStorage.getItem("testblocks-headless")!=="false",editorTab:"test",sidebarTab:"files",showHelpDialog:!1,showRecordDialog:!1,pluginsLoaded:!1,autoSaveStatus:"idle",resultsPanelCollapsed:!1,sidebarCollapsed:!1,failedFiles:new Set,failedTestsMap:new Map,version:null}),[v,A]=xe.useState(null),R=xe.useCallback((L,ae,U)=>{A({isOpen:!0,title:L,fields:ae,onSubmit:U})},[]),V=xe.useCallback(()=>{A(null)},[]),j=xe.useRef(null),ee=xe.useRef(null),he=xe.useRef(null),J=xe.useRef(null),W=xe.useRef(null),X=xe.useRef(!0),re=i.testFile.tests[i.selectedTestIndex];xe.useEffect(()=>{if(X.current){X.current=!1;return}if(!(!i.selectedFilePath||!i.projectRoot))return W.current&&clearTimeout(W.current),a(L=>({...L,autoSaveStatus:"saving"})),W.current=setTimeout(async()=>{const L=op(i.projectRoot,i.selectedFilePath);if(L!=null&&L.handle)try{const ae=await L.handle.createWritable();await ae.write(JSON.stringify(i.testFile,null,2)),await ae.close(),L.testFile=i.testFile,console.log("[Auto-save] Saved:",i.selectedFilePath),a(U=>({...U,autoSaveStatus:"saved"})),setTimeout(()=>{a(U=>U.autoSaveStatus==="saved"?{...U,autoSaveStatus:"idle"}:U)},2e3)}catch(ae){console.error("[Auto-save] Failed to save:",ae),a(U=>({...U,autoSaveStatus:"idle"}))}else a(ae=>({...ae,autoSaveStatus:"idle"}))},1e3),()=>{W.current&&clearTimeout(W.current)}},[i.testFile,i.selectedFilePath,i.projectRoot]),xe.useEffect(()=>{if(i.editingFolderHooks){if(X.current){X.current=!1;return}return W.current&&clearTimeout(W.current),a(L=>({...L,autoSaveStatus:"saving"})),W.current=setTimeout(async()=>{var ae,U,Te,ne;const L=i.editingFolderHooks;if(!(L!=null&&L.folderHandle)){a(fe=>({...fe,autoSaveStatus:"idle"}));return}try{if(((ae=i.folderHooks.beforeAll)==null?void 0:ae.length)||((U=i.folderHooks.afterAll)==null?void 0:U.length)||((Te=i.folderHooks.beforeEach)==null?void 0:Te.length)||((ne=i.folderHooks.afterEach)==null?void 0:ne.length)){const Ue=L.hooksFileHandle||await L.folderHandle.getFileHandle("_hooks.testblocks.json",{create:!0}),Ne=await Ue.createWritable();await Ne.write(JSON.stringify(i.folderHooks,null,2)),await Ne.close(),L.folderHooks=i.folderHooks,L.hooksFileHandle=Ue,console.log("[Auto-save] Saved folder hooks:",L.path)}else if(L.hooksFileHandle)try{await L.folderHandle.removeEntry("_hooks.testblocks.json"),L.folderHooks=void 0,L.hooksFileHandle=void 0,console.log("[Auto-save] Removed empty folder hooks:",L.path)}catch{}a(Ue=>({...Ue,autoSaveStatus:"saved"})),setTimeout(()=>{a(Ue=>Ue.autoSaveStatus==="saved"?{...Ue,autoSaveStatus:"idle"}:Ue)},2e3)}catch(fe){console.error("[Auto-save] Failed to save folder hooks:",fe),a(Ue=>({...Ue,autoSaveStatus:"idle"}))}},1e3),()=>{W.current&&clearTimeout(W.current)}}},[i.folderHooks,i.editingFolderHooks]);const ye=xe.useCallback(async L=>{he.current=L;const[ae,U]=await Promise.all([hf(L),qy(L)]);J.current=U.handle,a(Te=>({...Te,projectRoot:ae,globalVariables:U.variables,globalsFileContent:U.fullContent,selectedFilePath:null,sidebarTab:"files"}))},[]);xe.useEffect(()=>{(async()=>{try{const ae=await bE();ae&&(await ae.queryPermission({mode:"readwrite"})==="granted"?(await ye(ae),console.log("Restored last opened folder:",ae.name)):(a(Te=>({...Te,lastFolderName:ae.name})),console.log("Last folder needs permission:",ae.name)))}catch(ae){console.log("Could not restore last folder:",ae.message)}})()},[ye]),xe.useEffect(()=>{fetch("/api/version").then(L=>L.json()).then(L=>{L.version&&a(ae=>({...ae,version:L.version}))}).catch(()=>{})},[]),xe.useEffect(()=>{(async()=>{try{const ae=await fetch("/api/plugins");if(!ae.ok){console.warn("Failed to fetch plugins from server"),a(Te=>({...Te,pluginsLoaded:!0}));return}const U=await ae.json();if(U.loaded&&Array.isArray(U.loaded)){for(const Te of U.loaded)Te.blocks&&Array.isArray(Te.blocks)&&xE({name:Te.name,version:Te.version,description:Te.description,blocks:Te.blocks});console.log(`Loaded ${U.loaded.length} plugin(s) from server`)}}catch(ae){console.warn("Could not fetch plugins from server:",ae.message)}a(ae=>({...ae,pluginsLoaded:!0}))})()},[]),xe.useEffect(()=>{Fb(i.globalVariables),i.editingFolderHooks?tE(null):tE(i.testFile.variables||null),Bb(i.editingFolderHooks?"folder":"file");const L=i.testFile.tests[i.selectedTestIndex];if(L!=null&&L.data&&L.data.length>0){const ae=Object.keys(L.data[0].values||{});rE(ae)}else rE([])},[i.globalVariables,i.testFile.variables,i.editingFolderHooks,i.testFile.tests,i.selectedTestIndex]);const Me=xe.useCallback(async()=>{try{const L=await bE();L&&await L.requestPermission({mode:"readwrite"})==="granted"&&(await ye(L),a(U=>({...U,lastFolderName:null})))}catch(L){console.error("Failed to reopen folder:",L),a(ae=>({...ae,lastFolderName:null}))}},[ye]),Pe=xe.useCallback(async()=>{var L;if("showDirectoryPicker"in window)try{const ae=await window.showDirectoryPicker();await Ky(ae),await ye(ae),a(U=>({...U,lastFolderName:null}))}catch(ae){ae.name!=="AbortError"&&(console.error("Failed to open folder:",ae),Rt.error("Failed to open folder: "+ae.message))}else(L=ee.current)==null||L.click()},[ye]),Be=xe.useCallback(L=>{const ae=L.target.files;if(!ae||ae.length===0)return;const U={name:"Selected Folder",path:"",type:"folder",children:[]},Te=new Map;Te.set("",U);const ne=[];for(let fe=0;fe<ae.length;fe++){const Ue=ae[fe],Ne=Ue.webkitRelativePath||Ue.name;if(!Ne.endsWith(".testblocks.json")&&!Ne.endsWith(".json"))continue;const pe=Ne.split("/"),$e=pe.pop();let et="",M=U;for(const Z of pe){const H=et?`${et}/${Z}`:Z;if(!Te.has(H)){const Re={name:Z,path:H,type:"folder",children:[]};M.children.push(Re),Te.set(H,Re)}M=Te.get(H),et=H}const h=Ne,w=Ue.text().then(Z=>{try{const H=JSON.parse(Z);H.version&&H.tests&&Array.isArray(H.tests)&&M.children.push({name:$e,path:h,type:"file",testFile:H})}catch(H){console.warn(`Skipping invalid file: ${$e}`,H)}});ne.push(w)}Promise.all(ne).then(()=>{var Ue;const fe=Ne=>{Ne.children&&(Ne.children.sort((pe,$e)=>pe.type!==$e.type?pe.type==="folder"?-1:1:pe.name.localeCompare($e.name)),Ne.children.forEach(fe))};fe(U),(Ue=ae[0])!=null&&Ue.webkitRelativePath&&(U.name=ae[0].webkitRelativePath.split("/")[0]),a(Ne=>({...Ne,projectRoot:U,selectedFilePath:null,sidebarTab:"files"}))}),L.target.value=""},[]),ut=xe.useCallback(async()=>{if(he.current)try{const L=await hf(he.current);a(ae=>({...ae,projectRoot:L}))}catch(L){console.error("Failed to refresh folder:",L)}},[]),st=xe.useCallback(L=>{L.type!=="file"||!L.testFile||(L.testFile.procedures?lE(L.testFile.procedures):aE(),X.current=!0,a(ae=>({...ae,selectedFilePath:L.path,testFile:L.testFile,selectedTestIndex:0,results:[],editorTab:"test",sidebarTab:"tests",editingFolderHooks:null,folderHooks:{version:"1.0.0"}})))},[]),$t=xe.useCallback(L=>{if(L.type!=="folder")return;const ae=L.folderHooks||{version:"1.0.0"};a(U=>({...U,editingFolderHooks:L,folderHooks:ae,selectedFilePath:null,editorTab:"beforeAll",sidebarTab:"files"}))},[]),He=xe.useCallback(L=>{if(!L.folderHandle){Rt.error("Cannot create file: folder handle not available");return}R("Create Test File",[{name:"fileName",label:"File name",defaultValue:"new-test",placeholder:"Enter file name",required:!0}],async ae=>{const U=ae.fileName;if(!U)return;const Te=U.endsWith(".testblocks.json")?U:U.endsWith(".json")?U.replace(".json",".testblocks.json"):`${U}.testblocks.json`;try{const ne=await L.folderHandle.getFileHandle(Te,{create:!0}),fe={version:"1.0.0",name:Te.replace(".testblocks.json",""),description:"",variables:{},tests:[{id:`test-${Date.now()}`,name:"New Test",description:"",steps:[],tags:[]}]},Ue=await ne.createWritable();await Ue.write(JSON.stringify(fe,null,2)),await Ue.close();const Ne=`${L.path}/${Te}`,pe={name:Te,path:Ne,type:"file",testFile:fe,handle:ne};a($e=>{const et=h=>{const w={...h};return h.children&&(w.children=h.children.map(et)),w},M=$e.projectRoot?et($e.projectRoot):null;if(M){const h=w=>{if(w.path===L.path)return w.children||(w.children=[]),w.children.push(pe),w.children.sort((Z,H)=>Z.type!==H.type?Z.type==="folder"?-1:1:Z.name.localeCompare(H.name)),!0;if(w.children){for(const Z of w.children)if(h(Z))return!0}return!1};h(M)}return{...$e,projectRoot:M,selectedFilePath:Ne,testFile:fe,selectedTestIndex:0,editorTab:"test",editingFolderHooks:null}}),Rt.success(`Created: ${Te}`)}catch(ne){console.error("Failed to create file:",ne),Rt.error("Failed to create file")}})},[R]),te=xe.useCallback(L=>{if(!L.folderHandle){Rt.error("Cannot create folder: folder handle not available");return}R("Create Folder",[{name:"folderName",label:"Folder name",placeholder:"Enter folder name",required:!0}],async ae=>{const U=ae.folderName;if(U)try{const Te=await L.folderHandle.getDirectoryHandle(U,{create:!0}),ne=`${L.path}/${U}`,fe={name:U,path:ne,type:"folder",children:[],folderHandle:Te};a(Ue=>{const Ne=$e=>{const et={...$e};return $e.children&&(et.children=$e.children.map(Ne)),et},pe=Ue.projectRoot?Ne(Ue.projectRoot):null;if(pe){const $e=et=>{if(et.path===L.path)return et.children||(et.children=[]),et.children.push(fe),et.children.sort((M,h)=>M.type!==h.type?M.type==="folder"?-1:1:M.name.localeCompare(h.name)),!0;if(et.children){for(const M of et.children)if($e(M))return!0}return!1};$e(pe)}return{...Ue,projectRoot:pe}}),Rt.success(`Created folder: ${U}`)}catch(Te){console.error("Failed to create folder:",Te),Rt.error("Failed to create folder")}})},[R]),ve=xe.useCallback(L=>{const ae=L.type==="folder",U=ae?L.name:L.name.replace(".testblocks.json","");R(ae?"Rename Folder":"Rename File",[{name:"newName",label:"New name",defaultValue:U,placeholder:"Enter new name",required:!0}],async Te=>{var $e;const ne=($e=Te.newName)==null?void 0:$e.trim();if(!ne||ne===U)return;const fe=L.path.split("/");fe.pop();const Ue=fe.join("/"),Ne=(et,M)=>{if(!et)return null;if(et.path===M)return et;if(et.children)for(const h of et.children){const w=Ne(h,M);if(w)return w}return null},pe=Ne(i.projectRoot,Ue);if(!(pe!=null&&pe.folderHandle)){Rt.error("Cannot rename: parent folder handle not available");return}try{if(ae){const et=await pe.folderHandle.getDirectoryHandle(ne,{create:!0}),M=async(w,Z)=>{for await(const H of w.values())if(H.kind==="file"){const Re=await H.getFile(),lt=await(await Z.getFileHandle(H.name,{create:!0})).createWritable();await lt.write(await Re.arrayBuffer()),await lt.close()}else if(H.kind==="directory"){const Re=await Z.getDirectoryHandle(H.name,{create:!0});await M(H,Re)}};L.folderHandle&&await M(L.folderHandle,et),await pe.folderHandle.removeEntry(L.name,{recursive:!0});const h=`${Ue}/${ne}`;a(w=>{var _e;const Z=lt=>{if(lt.path===L.path){const Ye=(C,x,P)=>{const Y={...C,path:C.path.replace(x,P),name:C.path===L.path?ne:C.name,folderHandle:C.path===L.path?et:C.folderHandle};return C.children&&(Y.children=C.children.map(ge=>Ye(ge,x,P))),Y};return Ye(lt,L.path,h)}return lt.children?{...lt,children:lt.children.map(Z)}:lt},H=w.projectRoot?Z(w.projectRoot):null;let Re=w.selectedFilePath;return(_e=w.selectedFilePath)!=null&&_e.startsWith(L.path+"/")?Re=w.selectedFilePath.replace(L.path,h):w.selectedFilePath===L.path&&(Re=h),{...w,projectRoot:H,selectedFilePath:Re}}),Rt.success(`Renamed to: ${ne}`)}else{const et=ne.endsWith(".testblocks.json")?ne:`${ne}.testblocks.json`;if(!L.handle){Rt.error("Cannot rename: file handle not available");return}const h=await(await L.handle.getFile()).text(),w=await pe.folderHandle.getFileHandle(et,{create:!0}),Z=await w.createWritable();await Z.write(h),await Z.close(),await pe.folderHandle.removeEntry(L.name);const H=`${Ue}/${et}`;a(Re=>{const _e=C=>C.path===L.path?{...C,name:et,path:H,handle:w}:C.children?{...C,children:C.children.map(_e)}:C,lt=Re.projectRoot?_e(Re.projectRoot):null,Ye=Re.selectedFilePath===L.path?H:Re.selectedFilePath;return{...Re,projectRoot:lt,selectedFilePath:Ye}}),Rt.success(`Renamed to: ${et}`)}}catch(et){console.error("Failed to rename:",et),Rt.error(`Failed to rename: ${et instanceof Error?et.message:"Unknown error"}`)}})},[R,i.projectRoot]),Ve=xe.useCallback(L=>{const ae=L.type==="folder",U=ae?"folder":"file",Te=ae?L.name:L.name.replace(".testblocks.json","");if(!confirm(`Are you sure you want to delete the ${U} "${Te}"?${ae?`
2193
2193
 
2194
2194
  This will delete all files and subfolders inside it.`:""}`))return;const ne=L.path.split("/");ne.pop();const fe=ne.join("/"),Ue=(pe,$e)=>{if(!pe)return null;if(pe.path===$e)return pe;if(pe.children)for(const et of pe.children){const M=Ue(et,$e);if(M)return M}return null},Ne=Ue(i.projectRoot,fe);if(!(Ne!=null&&Ne.folderHandle)){Rt.error("Cannot delete: parent folder handle not available");return}(async()=>{try{await Ne.folderHandle.removeEntry(L.name,{recursive:ae}),a(pe=>{var Z;const $e=H=>H.children?{...H,children:H.children.filter(Re=>Re.path!==L.path).map($e)}:H,et=pe.projectRoot?$e(pe.projectRoot):null;let M=pe.selectedFilePath,h=pe.selectedTestIndex,w=pe.testFile;return(pe.selectedFilePath===L.path||(Z=pe.selectedFilePath)!=null&&Z.startsWith(L.path+"/"))&&(M=null,h=0,w=null),{...pe,projectRoot:et,selectedFilePath:M,selectedTestIndex:h,testFile:w}}),Rt.success(`Deleted: ${Te}`)}catch(pe){console.error("Failed to delete:",pe),Rt.error(`Failed to delete: ${pe instanceof Error?pe.message:"Unknown error"}`)}})()},[i.projectRoot]),Xe=xe.useCallback(async(L,ae)=>{const U=L.type==="folder",Te=L.path.split("/");Te.pop();const ne=Te.join("/"),fe=(Ne,pe)=>{if(!Ne)return null;if(Ne.path===pe)return Ne;if(Ne.children)for(const $e of Ne.children){const et=fe($e,pe);if(et)return et}return null},Ue=fe(i.projectRoot,ne);if(!(Ue!=null&&Ue.folderHandle)){Rt.error("Cannot move: source parent folder handle not available");return}if(!ae.folderHandle){Rt.error("Cannot move: target folder handle not available");return}try{if(U){const Ne=await ae.folderHandle.getDirectoryHandle(L.name,{create:!0}),pe=async(et,M)=>{for await(const h of et.values())if(h.kind==="file"){const w=await h.getFile(),H=await(await M.getFileHandle(h.name,{create:!0})).createWritable();await H.write(await w.arrayBuffer()),await H.close()}else if(h.kind==="directory"){const w=await M.getDirectoryHandle(h.name,{create:!0});await pe(h,w)}};L.folderHandle&&await pe(L.folderHandle,Ne),await Ue.folderHandle.removeEntry(L.name,{recursive:!0});const $e=`${ae.path}/${L.name}`;a(et=>{var H;const M=Re=>Re.children?{...Re,children:Re.children.filter(_e=>_e.path!==L.path).map(M)}:Re,h=Re=>{if(Re.path===ae.path){const _e=(Ye,C,x)=>{const P={...Ye,path:Ye.path.replace(C,x),folderHandle:Ye.path===L.path?Ne:Ye.folderHandle};return Ye.children&&(P.children=Ye.children.map(Y=>_e(Y,C,x))),P},lt=_e(L,L.path,$e);return{...Re,children:[...Re.children||[],lt].sort((Ye,C)=>Ye.type!==C.type?Ye.type==="folder"?-1:1:Ye.name.localeCompare(C.name))}}return Re.children?{...Re,children:Re.children.map(h)}:Re};let w=et.projectRoot?M(et.projectRoot):null;w=w?h(w):null;let Z=et.selectedFilePath;return(H=et.selectedFilePath)!=null&&H.startsWith(L.path+"/")?Z=et.selectedFilePath.replace(L.path,$e):et.selectedFilePath===L.path&&(Z=$e),{...et,projectRoot:w,selectedFilePath:Z}}),Rt.success(`Moved ${L.name} to ${ae.name}`)}else{if(!L.handle){Rt.error("Cannot move: file handle not available");return}const pe=await(await L.handle.getFile()).text(),$e=await ae.folderHandle.getFileHandle(L.name,{create:!0}),et=await $e.createWritable();await et.write(pe),await et.close(),await Ue.folderHandle.removeEntry(L.name);const M=`${ae.path}/${L.name}`;a(h=>{const w=_e=>_e.children?{..._e,children:_e.children.filter(lt=>lt.path!==L.path).map(w)}:_e,Z=_e=>{if(_e.path===ae.path){const lt={...L,path:M,handle:$e};return{..._e,children:[..._e.children||[],lt].sort((Ye,C)=>Ye.type!==C.type?Ye.type==="folder"?-1:1:Ye.name.localeCompare(C.name))}}return _e.children?{..._e,children:_e.children.map(Z)}:_e};let H=h.projectRoot?w(h.projectRoot):null;H=H?Z(H):null;const Re=h.selectedFilePath===L.path?M:h.selectedFilePath;return{...h,projectRoot:H,selectedFilePath:Re}}),Rt.success(`Moved ${L.name} to ${ae.name}`)}}catch(Ne){console.error("Failed to move:",Ne),Rt.error(`Failed to move: ${Ne instanceof Error?Ne.message:"Unknown error"}`)}},[i.projectRoot]),dt=xe.useCallback((L,ae,U,Te)=>{a(ne=>{if(ne.editingFolderHooks){const Ue=ne.editorTab;return Ue==="test"?ne:{...ne,folderHooks:{...ne.folderHooks,[Ue]:L.length>0?L:void 0}}}if(ne.editorTab!=="test")return{...ne,testFile:{...ne.testFile,[ne.editorTab]:L}};const fe=[...ne.testFile.tests];return fe[ne.selectedTestIndex]={...fe[ne.selectedTestIndex],steps:L,...ae&&{name:ae},...U!==void 0&&{data:U.length>0?U:void 0},...Te!==void 0&&{softAssertions:Te}},{...ne,testFile:{...ne.testFile,tests:fe}}})},[]),ot=xe.useCallback(async(L,ae)=>{const{selectedMatches:U,config:Te}=L;console.log("[handleReplaceMatches] Processing",U.length,"matches for blockType:",ae);const ne={name:Te.name,description:Te.description,params:Te.parameters.map(fe=>({name:fe.name,type:fe.fieldType==="number"?"number":"string",default:fe.defaultValue,description:`From ${fe.blockType}.${fe.originalFieldName}`})),steps:Te.steps};a(fe=>{if(!fe.projectRoot)return console.log("[handleReplaceMatches] No projectRoot, skipping"),fe;const Ue=new Map;for(const M of U){const h=Ue.get(M.filePath)||[];h.push(M),Ue.set(M.filePath,h)}console.log("[handleReplaceMatches] Grouped into",Ue.size,"files");const Ne=M=>{const h={...M};return M.testFile&&(h.testFile=JSON.parse(JSON.stringify(M.testFile))),M.children&&(h.children=M.children.map(Ne)),h.handle=M.handle,h},pe=Ne(fe.projectRoot);let $e=null;const et=(M,h,w)=>{if(M.type==="file"&&M.path===h&&M.testFile){console.log("[handleReplaceMatches] Updating file:",h,"with",w.length,"matches");const Z=new Map;for(const _e of w){const lt=`${_e.location}:${_e.testCaseId}`,Ye=Z.get(lt)||[];Ye.push(_e),Z.set(lt,Ye)}const H=[];for(const _e of Z.values())_e.sort((lt,Ye)=>Ye.startIndex-lt.startIndex),H.push(..._e);console.log("[handleReplaceMatches] Sorted matches:",H.map(_e=>`${_e.testCaseId}:${_e.location}:${_e.startIndex}-${_e.endIndex}`));let Re=M.testFile;for(const _e of H)console.log("[handleReplaceMatches] Applying match:",_e.testCaseId,_e.location,_e.startIndex,"-",_e.endIndex),Re=hy(Re,_e,ae,{});if(Re={...Re,procedures:{...Re.procedures,[Te.name]:ne}},console.log("[handleReplaceMatches] Added procedure to file:",Te.name),M.testFile=Re,h===fe.selectedFilePath&&(console.log("[handleReplaceMatches] This is the current file, updating testFile state"),$e=Re),M.handle){const _e=M.handle,lt=Re;(async()=>{try{const Ye=await _e.createWritable();await Ye.write(JSON.stringify(lt,null,2)),await Ye.close(),console.log("[handleReplaceMatches] Saved file:",h)}catch(Ye){console.error("[handleReplaceMatches] Failed to save file",h,":",Ye)}})()}else console.log("[handleReplaceMatches] No file handle for:",h,"- file will not be saved to disk");return M}if(M.children)for(const Z of M.children){const H=et(Z,h,w);if(H)return H}return null};for(const[M,h]of Ue)et(pe,M,h)||console.warn("[handleReplaceMatches] Could not find file in tree:",M);if(fe.selectedFilePath){console.log("[handleReplaceMatches] Updating current file:",fe.selectedFilePath);const M=w=>{if(w.type==="file"&&w.path===fe.selectedFilePath)return w;if(w.children)for(const Z of w.children){const H=M(Z);if(H)return H}return null},h=M(pe);if(h&&h.testFile){const w=fe.testFile.tests[fe.selectedTestIndex],Z=h.testFile.tests.map((Re,_e)=>_e===fe.selectedTestIndex?w:Re),H={...h.testFile,tests:Z,...fe.editorTab!=="test"&&fe.editorTab!=="beforeAll"&&{beforeAll:fe.testFile.beforeAll},...fe.editorTab!=="test"&&fe.editorTab!=="afterAll"&&{afterAll:fe.testFile.afterAll},...fe.editorTab!=="test"&&fe.editorTab!=="beforeEach"&&{beforeEach:fe.testFile.beforeEach},...fe.editorTab!=="test"&&fe.editorTab!=="afterEach"&&{afterEach:fe.testFile.afterEach},procedures:{...h.testFile.procedures,[Te.name]:ne}};if(fe.editorTab==="beforeAll"?H.beforeAll=fe.testFile.beforeAll:fe.editorTab==="afterAll"?H.afterAll=fe.testFile.afterAll:fe.editorTab==="beforeEach"?H.beforeEach=fe.testFile.beforeEach:fe.editorTab==="afterEach"&&(H.afterEach=fe.testFile.afterEach),h.testFile=H,$e=H,h.handle){const Re=h.handle;(async()=>{try{const _e=await Re.createWritable();await _e.write(JSON.stringify(H,null,2)),await _e.close(),console.log("[handleReplaceMatches] Saved current file:",fe.selectedFilePath)}catch(_e){console.error("[handleReplaceMatches] Failed to save current file:",_e)}})()}else console.log("[handleReplaceMatches] No file handle for current file - will not auto-save")}}return{...fe,projectRoot:pe,...$e&&{testFile:$e}}})},[]),Ke=xe.useCallback(()=>{if(i.editingFolderHooks){const L=i.editorTab;return i.folderHooks[L]||[]}return i.editorTab==="test"?re==null?void 0:re.steps:i.testFile[i.editorTab]||[]},[i.editorTab,i.testFile,i.editingFolderHooks,i.folderHooks,re]),we=xe.useCallback(()=>{const L=i.editingFolderHooks?"Folder ":"";switch(i.editorTab){case"beforeAll":return`${L}Before All`;case"afterAll":return`${L}After All`;case"beforeEach":return`${L}Before Each`;case"afterEach":return`${L}After Each`;default:return(re==null?void 0:re.name)||"Test"}},[i.editorTab,i.editingFolderHooks,re]),Qe=xe.useCallback(async()=>{const L=document.querySelector(".blocklySvg"),ae=L==null?void 0:L.workspace,U=ly(),Te={...i.testFile,procedures:{...i.testFile.procedures,...U},tests:i.testFile.tests.map((pe,$e)=>{if($e===i.selectedTestIndex&&ae){const et=ad(ae);return{...pe,steps:et}}return pe})},ne=op(i.projectRoot,i.selectedFilePath);if(ne!=null&&ne.handle)try{const pe=await ne.handle.createWritable();await pe.write(JSON.stringify(Te,null,2)),await pe.close(),ne.testFile=Te,a($e=>({...$e,testFile:Te}));return}catch(pe){console.error("Failed to save file:",pe)}const fe=new Blob([JSON.stringify(Te,null,2)],{type:"application/json"}),Ue=URL.createObjectURL(fe),Ne=document.createElement("a");Ne.href=Ue,Ne.download=`${i.testFile.name.toLowerCase().replace(/\s+/g,"-")}.testblocks.json`,Ne.click(),URL.revokeObjectURL(Ue)},[i.testFile,i.selectedTestIndex,i.projectRoot,i.selectedFilePath]),De=xe.useCallback(()=>{var L;(L=j.current)==null||L.click()},[]),me=xe.useCallback(L=>{var Te;const ae=(Te=L.target.files)==null?void 0:Te[0];if(!ae)return;const U=new FileReader;U.onload=ne=>{var fe;try{const Ue=JSON.parse((fe=ne.target)==null?void 0:fe.result);Ue.variables||(Ue.variables={}),Ue.procedures?lE(Ue.procedures):aE(),a(Ne=>({...Ne,testFile:Ue,selectedTestIndex:0,selectedFilePath:null,results:[],sidebarTab:"tests"}))}catch(Ue){Rt.error("Failed to load test file: "+Ue.message)}},U.readAsText(ae),L.target.value=""},[]),ue=xe.useCallback(()=>{const L={id:`test-${Date.now()}`,name:`Test Case ${i.testFile.tests.length+1}`,description:"",steps:[],tags:[]};a(ae=>({...ae,testFile:{...ae.testFile,tests:[...ae.testFile.tests,L]},selectedTestIndex:ae.testFile.tests.length}))},[i.testFile.tests.length]),Le=xe.useCallback(L=>{if(i.testFile.tests.length<=1){Rt.warning("Cannot delete the last test case");return}a(ae=>{const U=ae.testFile.tests.filter((Te,ne)=>ne!==L);return{...ae,testFile:{...ae.testFile,tests:U},selectedTestIndex:Math.min(ae.selectedTestIndex,U.length-1)}})},[i.testFile.tests.length]),se=xe.useCallback(async()=>{a(L=>({...L,isRunning:!0,runningTestId:null,results:[]}));try{const L=tf(i.projectRoot,i.selectedFilePath),ae=await fetch(`/api/run?headless=${i.headless}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testFile:i.testFile,folderHooks:L.length>0?L:void 0})}),U=await ae.json();if(!ae.ok||!Array.isArray(U)){const fe=U.message||U.error||"Unknown error";console.error("Test run failed:",fe),a(Ue=>({...Ue,isRunning:!1})),Rt.error(`Test run failed: ${fe}`);return}const Te=U.some(fe=>fe.status!=="passed"),ne=new Set;U.forEach(fe=>{fe.status!=="passed"&&ne.add(fe.testId)}),a(fe=>{const Ue=new Set(fe.failedFiles),Ne=new Map(fe.failedTestsMap);return fe.selectedFilePath&&(Te?(Ue.add(fe.selectedFilePath),Ne.set(fe.selectedFilePath,ne)):(Ue.delete(fe.selectedFilePath),Ne.delete(fe.selectedFilePath))),{...fe,results:U,isRunning:!1,failedFiles:Ue,failedTestsMap:Ne}})}catch(L){console.error("Failed to run tests:",L),a(ae=>({...ae,isRunning:!1})),Rt.error("Failed to run tests. Make sure the server is running.")}},[i.testFile,i.headless,i.projectRoot,i.selectedFilePath]),Q=xe.useCallback(async(L,ae)=>{ae&&ae.stopPropagation(),a(U=>({...U,isRunning:!0,runningTestId:L,results:[]}));try{const U=tf(i.projectRoot,i.selectedFilePath),Te=await fetch(`/api/run?headless=${i.headless}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testFile:{...i.testFile,tests:i.testFile.tests.filter(fe=>fe.id===L)},folderHooks:U.length>0?U:void 0})}),ne=await Te.json();if(!Te.ok||!Array.isArray(ne)){const fe=ne.message||ne.error||"Unknown error";console.error("Test run failed:",fe),a(Ue=>({...Ue,isRunning:!1,runningTestId:null})),Rt.error(`Test run failed: ${fe}`);return}a(fe=>{const Ue=new Set(fe.failedFiles),Ne=new Map(fe.failedTestsMap);if(fe.selectedFilePath){const pe=new Set(Ne.get(fe.selectedFilePath)||[]);ne.forEach($e=>{$e.status!=="passed"?pe.add($e.testId):pe.delete($e.testId)}),pe.size>0?(Ne.set(fe.selectedFilePath,pe),Ue.add(fe.selectedFilePath)):(Ne.delete(fe.selectedFilePath),Ue.delete(fe.selectedFilePath))}return{...fe,results:ne,isRunning:!1,runningTestId:null,failedFiles:Ue,failedTestsMap:Ne}})}catch(U){console.error("Failed to run test:",U),a(Te=>({...Te,isRunning:!1,runningTestId:null})),Rt.error("Failed to run test. Make sure the server is running.")}},[i.testFile,i.headless,i.projectRoot,i.selectedFilePath]),ce=xe.useCallback(async L=>{const ae=Ne=>{const pe=[];if(Ne.type==="file"&&Ne.testFile&&pe.push(Ne),Ne.children)for(const $e of Ne.children)pe.push(...ae($e));return pe},U=ae(L);if(U.length===0){Rt.warning("No test files found in this folder");return}a(Ne=>({...Ne,isRunning:!0,runningTestId:null,results:[]})),Rt.info(`Running ${U.length} test file(s)...`);const Te=[],ne=new Map,fe=new Map;let Ue=0;try{for(const $e of U){if(!$e.testFile)continue;Ue++,Rt.info(`Running ${$e.name} (${Ue}/${U.length})...`);const et=tf(i.projectRoot,$e.path),M=await fetch(`/api/run?headless=${i.headless}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testFile:$e.testFile,folderHooks:et.length>0?et:void 0})}),h=await M.json();if(M.ok&&Array.isArray(h)){const w=h.map(Re=>({...Re,fileName:$e.name.replace(".testblocks.json","")}));Te.push(...w);const Z=new Set;h.forEach(Re=>{Re.status!=="passed"&&Z.add(Re.testId)});const H=Z.size>0;ne.set($e.path,H),H&&fe.set($e.path,Z)}else Te.push({testId:`file-error-${$e.path}`,testName:`${$e.name} (Error)`,status:"error",duration:0,steps:[],error:{message:h.message||h.error||"Unknown error"},startedAt:new Date().toISOString(),finishedAt:new Date().toISOString(),fileName:$e.name.replace(".testblocks.json","")}),ne.set($e.path,!0);a(w=>({...w,results:[...Te]}))}const Ne=Te.filter($e=>$e.status==="passed").length,pe=Te.filter($e=>$e.status==="failed"||$e.status==="error").length;pe>0?Rt.error(`Completed: ${Ne} passed, ${pe} failed`):Rt.success(`All ${Ne} tests passed!`),a($e=>{const et=new Set($e.failedFiles),M=new Map($e.failedTestsMap);for(const[h,w]of ne)if(w){et.add(h);const Z=fe.get(h);Z&&M.set(h,Z)}else et.delete(h),M.delete(h);return{...$e,isRunning:!1,failedFiles:et,failedTestsMap:M}})}catch(Ne){console.error("Failed to run folder tests:",Ne),a(pe=>({...pe,isRunning:!1,results:Te})),Rt.error("Failed to run tests. Make sure the server is running.")}},[i.headless,i.projectRoot]),Ze=xe.useCallback(L=>{a(ae=>{const U=[...ae.testFile.tests];return U[ae.selectedTestIndex]={...U[ae.selectedTestIndex],name:L},{...ae,testFile:{...ae.testFile,tests:U}}})},[]);xe.useCallback(L=>{a(ae=>({...ae,testFile:{...ae.testFile,name:L}}))},[]),xe.useCallback(()=>{R("Add Variable",[{name:"name",label:"Variable name",placeholder:"Enter variable name",required:!0},{name:"defaultValue",label:"Default value",placeholder:"Enter default value"}],L=>{const ae=L.name;ae&&a(U=>({...U,testFile:{...U.testFile,variables:{...U.testFile.variables,[ae]:{type:"string",default:L.defaultValue||""}}}}))})},[R]),xe.useCallback((L,ae)=>{a(U=>{var Te;return{...U,testFile:{...U.testFile,variables:{...U.testFile.variables,[L]:{...(Te=U.testFile.variables)==null?void 0:Te[L],type:"string",default:ae}}}}})},[]),xe.useCallback(L=>{a(ae=>{const U={...ae.testFile.variables};return delete U[L],{...ae,testFile:{...ae.testFile,variables:U}}})},[]),xe.useCallback((L,ae)=>{a(U=>{if(!U.globalVariables)return U;const Te=Jy(U.globalVariables,L,ae),ne={...U.globalsFileContent,variables:Te};return J.current&&(async()=>{try{const fe=await J.current.createWritable();await fe.write(JSON.stringify(ne,null,2)),await fe.close(),console.log("[handleUpdateGlobalVariable] Saved globals.json")}catch(fe){console.error("[handleUpdateGlobalVariable] Failed to save globals.json:",fe)}})(),{...U,globalVariables:Te,globalsFileContent:ne}})},[]);const Ae=xe.useCallback(L=>{const ae=zy(L);a(U=>{const Te={...U.globalsFileContent,variables:ae};return J.current&&(async()=>{try{const ne=await J.current.createWritable();await ne.write(JSON.stringify(Te,null,2)),await ne.close(),console.log("[handleGlobalVariablesChange] Saved globals.json")}catch(ne){console.error("[handleGlobalVariablesChange] Failed to save globals.json:",ne)}})(),{...U,globalVariables:ae,globalsFileContent:Te}})},[]),it=xe.useCallback(L=>{a(ae=>{const U={};for(const Te of L)if(Te.name.trim()){let ne=Te.value;try{(Te.value.startsWith("{")||Te.value.startsWith("[")||Te.value==="true"||Te.value==="false"||!isNaN(Number(Te.value))&&Te.value!=="")&&(ne=JSON.parse(Te.value))}catch{}U[Te.name]={default:ne}}return{...ae,testFile:{...ae.testFile,variables:U}}})},[]),ze=xe.useCallback((L,ae)=>{if(ae==="append")a(U=>{const Te=[...U.testFile.tests],ne=Array.isArray(Te[U.selectedTestIndex].steps)?Te[U.selectedTestIndex].steps:[];Te[U.selectedTestIndex]={...Te[U.selectedTestIndex],steps:[...ne,...L]};const fe={...U.testFile,tests:Te},Ue=op(U.projectRoot,U.selectedFilePath);return Ue!=null&&Ue.handle&&(async()=>{try{const Ne=await Ue.handle.createWritable();await Ne.write(JSON.stringify(fe,null,2)),await Ne.close(),console.log("[handleStepsRecorded] Saved recorded steps to:",U.selectedFilePath)}catch(Ne){console.error("[handleStepsRecorded] Failed to save:",Ne)}})(),{...U,testFile:fe,showRecordDialog:!1}});else{const Te=`recorded-${new Date().toISOString().replace(/[:.]/g,"-").slice(0,19)}.testblocks.json`,ne={id:`test-${Date.now()}`,name:"Recorded Test",description:"Test recorded from browser actions",steps:L,tags:["recorded"]},fe={version:"1.0.0",name:"Recorded Test Suite",description:`Recorded on ${new Date().toLocaleString()}`,variables:{},tests:[ne]};a(Ue=>{var $e;let Ne=null,pe="";if(Ue.selectedFilePath&&Ue.projectRoot){const et=Ue.selectedFilePath.split("/");et.pop();const M=et.join("/");if(M){const h=op(Ue.projectRoot,M);h!=null&&h.folderHandle&&(Ne=h.folderHandle,pe=M)}}return!Ne&&(($e=Ue.projectRoot)!=null&&$e.folderHandle)&&(Ne=Ue.projectRoot.folderHandle,pe=Ue.projectRoot.path),Ne?(async()=>{try{const et=await Ne.getFileHandle(Te,{create:!0}),M=await et.createWritable();await M.write(JSON.stringify(fe,null,2)),await M.close(),console.log("[handleStepsRecorded] Created new file:",Te);const h=pe?`${pe}/${Te}`:Te,w={name:Te,path:h,type:"file",testFile:fe,handle:et},Z=Re=>{const _e={...Re};return Re.children&&(_e.children=Re.children.map(Z)),_e},H=Ue.projectRoot?Z(Ue.projectRoot):null;if(H){const Re=_e=>{if(_e.path===pe||_e.path===_e.name&&pe===_e.name)return _e.children||(_e.children=[]),_e.children.push(w),_e.children.sort((lt,Ye)=>lt.type!==Ye.type?lt.type==="folder"?-1:1:lt.name.localeCompare(Ye.name)),!0;if(_e.children){for(const lt of _e.children)if(Re(lt))return!0}return!1};Re(H),a(_e=>({..._e,projectRoot:H,selectedFilePath:h,testFile:fe,selectedTestIndex:0,editorTab:"test"}))}Rt.success(`Created new test file: ${Te}`)}catch(et){console.error("[handleStepsRecorded] Failed to create file:",et),Rt.error("Failed to create test file")}})():Rt.warning("No project folder open. Please open a folder first."),{...Ue,showRecordDialog:!1}})}},[]),gt=L=>i.results.find(ae=>ae.testId===L),rt=xe.useCallback(async()=>{if(i.results.length!==0)try{const L=await fetch("/api/reports/html",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testFile:i.testFile,results:i.results})});if(!L.ok)throw new Error("Failed to generate report");const ae=await L.blob(),U=L.headers.get("Content-Disposition"),Te=U==null?void 0:U.match(/filename="(.+)"/),ne=Te?Te[1]:"report.html",fe=URL.createObjectURL(ae),Ue=document.createElement("a");Ue.href=fe,Ue.download=ne,Ue.click(),URL.revokeObjectURL(fe)}catch(L){console.error("Failed to download HTML report:",L),Rt.error("Failed to download HTML report")}},[i.testFile,i.results]),Ot=xe.useCallback(async()=>{if(i.results.length!==0)try{const L=await fetch("/api/reports/junit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testFile:i.testFile,results:i.results})});if(!L.ok)throw new Error("Failed to generate report");const ae=await L.blob(),U=L.headers.get("Content-Disposition"),Te=U==null?void 0:U.match(/filename="(.+)"/),ne=Te?Te[1]:"junit.xml",fe=URL.createObjectURL(ae),Ue=document.createElement("a");Ue.href=fe,Ue.download=ne,Ue.click(),URL.revokeObjectURL(fe)}catch(L){console.error("Failed to download JUnit report:",L),Rt.error("Failed to download JUnit report")}},[i.testFile,i.results]),qe=xe.useCallback((L,ae,U)=>{if(ae==="global"){const Te={...i.globalVariables||{},[U]:L},ne={...i.globalsFileContent,variables:Te};J.current&&(async()=>{try{const fe=await J.current.createWritable();await fe.write(JSON.stringify(ne,null,2)),await fe.close(),console.log("[handleCreateVariable] Saved globals.json")}catch(fe){console.error("[handleCreateVariable] Failed to save globals.json:",fe)}})(),a(fe=>({...fe,globalVariables:Te,globalsFileContent:ne})),Rt.success(`Created global variable: ${U}`)}else a(Te=>({...Te,testFile:{...Te.testFile,variables:{...Te.testFile.variables,[U]:{default:L}}}})),Rt.success(`Created file variable: ${U}`)},[i.globalVariables,i.globalsFileContent]);return E.jsxs("div",{className:"app",children:[E.jsxs("header",{className:"header",children:[E.jsxs("h1",{children:[E.jsx("span",{children:"TestBlocks"}),i.version&&E.jsxs("span",{className:"header-version",children:["v",i.version]}),(i.selectedFilePath||i.editingFolderHooks)&&E.jsxs("span",{className:"header-file-path",children:[i.editingFolderHooks?E.jsxs(E.Fragment,{children:[E.jsx("span",{className:"folder-hooks-label",children:"Folder Hooks:"})," ",i.editingFolderHooks.path]}):i.selectedFilePath,i.autoSaveStatus==="saving"&&E.jsx("span",{className:"auto-save-indicator saving",children:"Saving..."}),i.autoSaveStatus==="saved"&&E.jsx("span",{className:"auto-save-indicator saved",children:"Saved"})]})]}),E.jsxs("div",{className:"header-actions",children:[E.jsx("button",{className:"btn btn-secondary",onClick:()=>a(L=>({...L,showHelpDialog:!0})),title:"Help",children:"Help"}),E.jsx("button",{className:"btn btn-secondary",onClick:Pe,children:"Open Folder"}),E.jsx("button",{className:"btn btn-secondary",onClick:De,children:"Open File"}),E.jsx("button",{className:"btn btn-secondary",onClick:Qe,children:"Save"}),E.jsx("button",{className:"btn btn-secondary",onClick:()=>a(L=>({...L,showRecordDialog:!0})),title:"Record browser actions",children:"Record"}),((Ut=i.globalsFileContent)==null?void 0:Ut.testIdAttribute)&&E.jsxs("span",{className:"test-id-indicator",title:"Test ID Attribute (from globals.json)",children:["TestID: ",E.jsx("code",{children:i.globalsFileContent.testIdAttribute})]}),E.jsxs("label",{className:"headless-toggle",children:[E.jsx("input",{type:"checkbox",checked:i.headless,onChange:L=>{localStorage.setItem("testblocks-headless",String(L.target.checked)),a(ae=>({...ae,headless:L.target.checked}))}}),E.jsx("span",{children:"Headless"})]}),E.jsx("button",{className:"btn btn-primary",onClick:se,disabled:i.isRunning,children:i.isRunning&&!i.runningTestId?"Running...":"Run All Tests"})]})]}),E.jsx("input",{ref:j,type:"file",accept:".json,.testblocks.json",style:{display:"none"},onChange:me}),E.jsx("input",{ref:ee,type:"file",accept:".json,.testblocks.json",style:{display:"none"},onChange:Be,webkitdirectory:"",directory:"",multiple:!0}),E.jsxs("main",{className:"main-content",children:[E.jsxs("aside",{className:`sidebar${i.sidebarCollapsed?" collapsed":""}`,children:[E.jsx("div",{className:"sidebar-toggle-header",children:E.jsx("button",{className:"panel-toggle-btn",onClick:()=>{a(L=>({...L,sidebarCollapsed:!L.sidebarCollapsed})),setTimeout(()=>window.dispatchEvent(new Event("resize")),250)},title:i.sidebarCollapsed?"Expand panel":"Collapse panel",children:i.sidebarCollapsed?"▶":"◀"})}),!i.sidebarCollapsed&&E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"sidebar-tabs",children:[E.jsx("button",{className:`sidebar-tab ${i.sidebarTab==="files"?"active":""}`,onClick:()=>a(L=>({...L,sidebarTab:"files"})),children:"Files"}),E.jsx("button",{className:`sidebar-tab ${i.sidebarTab==="tests"?"active":""}`,onClick:()=>a(L=>({...L,sidebarTab:"tests"})),children:"Tests"})]}),i.sidebarTab==="files"?E.jsxs("div",{className:"sidebar-section file-tree-section",children:[!i.projectRoot&&i.lastFolderName&&E.jsxs("div",{className:"reopen-folder-prompt",children:[E.jsxs("span",{children:["Last folder: ",E.jsx("strong",{children:i.lastFolderName})]}),E.jsx("button",{className:"btn btn-small btn-primary",onClick:Me,children:"Reopen"})]}),E.jsx(Fy,{root:i.projectRoot,selectedPath:i.selectedFilePath,onSelectFile:st,onSelectFolder:$t,onRefresh:i.projectRoot?ut:void 0,onCreateFile:He,onCreateFolder:te,onRename:ve,onDelete:Ve,onMove:Xe,onRunFolder:ce,isRunning:i.isRunning,failedFiles:i.failedFiles})]}):E.jsxs(E.Fragment,{children:[E.jsxs("div",{className:"sidebar-section",children:[E.jsx("div",{className:"sidebar-header clickable",onClick:()=>a(L=>({...L,showGlobalVariables:!L.showGlobalVariables})),children:E.jsxs("h2",{children:[E.jsx("span",{style:{marginRight:"8px"},children:i.showGlobalVariables?"▼":"▶"}),"Global Variables",E.jsx("span",{className:"global-badge",title:"From globals.json",children:"🌐"})]})}),i.showGlobalVariables&&E.jsx("div",{className:"variables-list global-variables",style:{padding:"8px"},children:E.jsx(TE,{variables:Xy(i.globalVariables),onChange:Ae,title:"",emptyMessage:"No global variables. Add variables here to use across all test files."})})]}),E.jsxs("div",{className:"sidebar-section",children:[E.jsx("div",{className:"sidebar-header clickable",onClick:()=>a(L=>({...L,showVariables:!L.showVariables})),children:E.jsxs("h2",{children:[E.jsx("span",{style:{marginRight:"8px"},children:i.showVariables?"▼":"▶"}),"File Variables"]})}),i.showVariables&&E.jsx("div",{className:"variables-list",style:{padding:"8px"},children:E.jsx(TE,{variables:Object.entries(i.testFile.variables||{}).map(([L,ae])=>({name:L,value:typeof ae.default=="string"?ae.default:JSON.stringify(ae.default)})),onChange:it,title:"",emptyMessage:"No file variables. Add variables specific to this test file."})})]}),E.jsxs("div",{className:"sidebar-section",children:[E.jsx("div",{className:"sidebar-header",children:E.jsx("h2",{children:"Test Cases"})}),E.jsx("div",{className:"test-list",children:i.testFile.tests.map((L,ae)=>{var ne;const U=gt(L.id),Te=i.runningTestId===L.id;return E.jsxs("div",{className:`test-item ${ae===i.selectedTestIndex?"active":""} ${(U==null?void 0:U.status)||""}`,onClick:()=>a(fe=>({...fe,selectedTestIndex:ae,editorTab:"test"})),children:[E.jsxs("div",{className:"test-item-content",children:[E.jsxs("div",{className:"test-item-name",children:[U?E.jsx("span",{className:`status-dot ${U.status}`}):i.selectedFilePath&&((ne=i.failedTestsMap.get(i.selectedFilePath))!=null&&ne.has(L.id))?E.jsx("span",{className:"status-dot failed",title:"Failed in previous run"}):null,L.name,L.data&&L.data.length>0&&E.jsxs("span",{className:"data-driven-badge",title:`Data-driven: ${L.data.length} iterations`,children:["×",L.data.length]})]}),E.jsxs("div",{className:"test-item-steps",children:[Array.isArray(L.steps)?L.steps.length:0," steps"]})]}),E.jsx("button",{className:"btn-run-test",onClick:fe=>Q(L.id,fe),disabled:i.isRunning,title:"Run this test",children:Te?"...":"▶"})]},L.id)})}),E.jsx("button",{className:"add-test-btn",onClick:ue,children:"+ Add Test Case"})]})]})]})]}),E.jsxs("div",{className:"editor-area",children:[E.jsxs("div",{className:"editor-tabs",children:[E.jsxs("button",{className:`editor-tab ${i.editorTab==="beforeAll"?"active":""}`,onClick:()=>a(L=>({...L,editorTab:"beforeAll"})),children:["Before All",i.editingFolderHooks?i.folderHooks.beforeAll&&i.folderHooks.beforeAll.length>0&&E.jsx("span",{className:"tab-badge",children:i.folderHooks.beforeAll.length}):i.testFile.beforeAll&&i.testFile.beforeAll.length>0&&E.jsx("span",{className:"tab-badge",children:i.testFile.beforeAll.length})]}),E.jsxs("button",{className:`editor-tab ${i.editorTab==="beforeEach"?"active":""}`,onClick:()=>a(L=>({...L,editorTab:"beforeEach"})),children:["Before Each",i.editingFolderHooks?i.folderHooks.beforeEach&&i.folderHooks.beforeEach.length>0&&E.jsx("span",{className:"tab-badge",children:i.folderHooks.beforeEach.length}):i.testFile.beforeEach&&i.testFile.beforeEach.length>0&&E.jsx("span",{className:"tab-badge",children:i.testFile.beforeEach.length})]}),!i.editingFolderHooks&&E.jsx("button",{className:`editor-tab test-tab ${i.editorTab==="test"?"active":""}`,onClick:()=>a(L=>({...L,editorTab:"test"})),children:"Test Steps"}),E.jsxs("button",{className:`editor-tab ${i.editorTab==="afterEach"?"active":""}`,onClick:()=>a(L=>({...L,editorTab:"afterEach"})),children:["After Each",i.editingFolderHooks?i.folderHooks.afterEach&&i.folderHooks.afterEach.length>0&&E.jsx("span",{className:"tab-badge",children:i.folderHooks.afterEach.length}):i.testFile.afterEach&&i.testFile.afterEach.length>0&&E.jsx("span",{className:"tab-badge",children:i.testFile.afterEach.length})]}),E.jsxs("button",{className:`editor-tab ${i.editorTab==="afterAll"?"active":""}`,onClick:()=>a(L=>({...L,editorTab:"afterAll"})),children:["After All",i.editingFolderHooks?i.folderHooks.afterAll&&i.folderHooks.afterAll.length>0&&E.jsx("span",{className:"tab-badge",children:i.folderHooks.afterAll.length}):i.testFile.afterAll&&i.testFile.afterAll.length>0&&E.jsx("span",{className:"tab-badge",children:i.testFile.afterAll.length})]})]}),E.jsx("div",{className:"editor-toolbar",children:i.editorTab==="test"&&!i.editingFolderHooks?E.jsxs(E.Fragment,{children:[E.jsx("input",{type:"text",className:"test-name-input",value:(re==null?void 0:re.name)||"",onChange:L=>Ze(L.target.value),placeholder:"Test name"}),E.jsx("button",{className:"btn btn-success",onClick:()=>Q(re==null?void 0:re.id),disabled:i.isRunning,style:{padding:"6px 12px",fontSize:"12px",marginRight:"8px"},children:i.runningTestId===(re==null?void 0:re.id)?"Running...":"Run Test"}),E.jsx("button",{className:"btn btn-danger",onClick:()=>Le(i.selectedTestIndex),style:{padding:"6px 12px",fontSize:"12px"},children:"Delete"})]}):E.jsxs("div",{className:"lifecycle-toolbar-info",children:[E.jsx("span",{className:"lifecycle-icon",children:i.editingFolderHooks?"📁":"⚡"}),E.jsx("span",{children:we()}),E.jsx("span",{className:"lifecycle-hint",children:i.editingFolderHooks?E.jsxs(E.Fragment,{children:["— Applies to all tests in this folder",i.editorTab==="beforeAll"||i.editorTab==="afterAll"?"":" and subfolders"]}):E.jsxs(E.Fragment,{children:[i.editorTab==="beforeAll"&&"— Runs once before all tests",i.editorTab==="afterAll"&&"— Runs once after all tests",i.editorTab==="beforeEach"&&"— Runs before each test",i.editorTab==="afterEach"&&"— Runs after each test"]})})]})}),E.jsx("div",{className:"blockly-container",children:E.jsx(wy,{onWorkspaceChange:dt,onReplaceMatches:ot,onCreateVariable:qe,initialSteps:Ke(),testName:i.editorTab==="test"?re==null?void 0:re.name:we(),lifecycleType:i.editorTab!=="test"?i.editorTab:void 0,testData:i.editorTab==="test"?re==null?void 0:re.data:void 0,softAssertions:i.editorTab==="test"?re==null?void 0:re.softAssertions:void 0,projectRoot:i.projectRoot,currentFilePath:i.selectedFilePath||void 0},`${i.editorTab}-${i.editorTab==="test"?re==null?void 0:re.id:"lifecycle"}-${i.selectedFilePath||((Oe=i.editingFolderHooks)==null?void 0:Oe.path)}-${i.pluginsLoaded}`)})]}),E.jsxs("aside",{className:`results-panel${i.resultsPanelCollapsed?" collapsed":""}`,children:[E.jsxs("div",{className:"results-header",children:[E.jsx("button",{className:"panel-toggle-btn",onClick:()=>{a(L=>({...L,resultsPanelCollapsed:!L.resultsPanelCollapsed})),setTimeout(()=>window.dispatchEvent(new Event("resize")),250)},title:i.resultsPanelCollapsed?"Expand panel":"Collapse panel",children:i.resultsPanelCollapsed?"◀":"▶"}),!i.resultsPanelCollapsed&&E.jsxs(E.Fragment,{children:[E.jsxs("h2",{children:["Results",i.results.length>0&&E.jsxs("span",{className:"results-summary",children:[E.jsxs("span",{className:"passed-count",children:[i.results.filter(L=>L.status==="passed").length," passed"]}),i.results.filter(L=>L.status==="failed"||L.status==="error").length>0&&E.jsxs("span",{className:"failed-count",children:[i.results.filter(L=>L.status==="failed"||L.status==="error").length," failed"]})]})]}),i.results.length>0&&E.jsxs("div",{className:"results-actions",children:[E.jsx("button",{className:"btn-report",onClick:rt,title:"Download HTML Report",children:"HTML"}),E.jsx("button",{className:"btn-report",onClick:Ot,title:"Download JUnit XML Report",children:"xUnit"})]})]})]}),!i.resultsPanelCollapsed&&E.jsx("div",{className:"results-content",children:i.results.length===0?E.jsxs("div",{className:"empty-state",children:[E.jsx("h3",{children:"No results yet"}),E.jsx("p",{children:"Run your tests to see results here"})]}):i.results.map(L=>E.jsxs("div",{className:`result-item ${L.status}${L.isLifecycle?" lifecycle":""}`,children:[E.jsxs("div",{className:"result-test-header",children:[E.jsx("span",{className:`status-indicator ${L.status}`}),L.isLifecycle&&E.jsx("span",{className:"lifecycle-badge",children:L.lifecycleType}),L.fileName&&E.jsxs("span",{className:"result-file-name",children:[L.fileName," /"]}),E.jsx("span",{className:"result-test-name",children:L.testName}),E.jsxs("span",{className:"result-duration",children:[L.duration,"ms"]})]}),L.error&&E.jsx("div",{className:"result-error",children:L.error.message}),L.steps&&L.steps.length>0&&E.jsx("div",{className:"result-steps",children:L.steps.map((ae,U)=>E.jsx(Dy,{step:ae},ae.stepId||U))})]},L.testId))})]})]}),E.jsx(By,{isOpen:i.showHelpDialog,onClose:()=>a(L=>({...L,showHelpDialog:!1}))}),E.jsx(Vy,{isOpen:i.showRecordDialog,onClose:()=>a(L=>({...L,showRecordDialog:!1})),onStepsRecorded:ze}),v&&E.jsx(Hy,{isOpen:v.isOpen,title:v.title,fields:v.fields,onSubmit:L=>{v.onSubmit(L),V()},onCancel:V}),E.jsx(Ty,{toasts:f,onDismiss:g})]})}function tf(f,g){if(!f||!g)return[];function i(a,v,A){const R=a.folderHooks?[...A,a.folderHooks]:A;if(a.children)for(const V of a.children){if(V.type==="file"&&V.path===v)return R;if(V.type==="folder"){const j=i(V,v,R);if(j!==null)return j}}return null}return i(f,g,[])||[]}kT.createRoot(document.getElementById("root")).render(E.jsx(NT.StrictMode,{children:E.jsx(Zy,{})}));
2195
- //# sourceMappingURL=index-Boo8ZrY_.js.map
2195
+ //# sourceMappingURL=index-BLK0dtIi.js.map