{
  "artifactVersion": "loop.plan.artifact/v1",
  "compilerVersion": "loop.plan.compiler/v1",
  "apiVersion": "loop.plan/v1",
  "digest": "sha256:d97019e71594e7cf8bd4f2c71f50274badd621b83e19d78c0c811993277596a9",
  "contracts": {
    "input": [
      {
        "name": "value",
        "schema": {
          "type": "string",
          "required": true,
          "default": null,
          "values": [],
          "items": null
        }
      }
    ],
    "output": [
      {
        "name": "value",
        "schema": {
          "type": "string",
          "required": true,
          "default": null,
          "values": [],
          "items": null
        }
      }
    ],
    "state": []
  },
  "entry": {
    "nodeId": "fanout",
    "port": "in",
    "bindings": [
      {
        "target": "value",
        "value": {
          "op": "load",
          "resultType": "string",
          "load": {
            "space": "plan_input",
            "path": [
              "value"
            ]
          }
        }
      }
    ]
  },
  "nodes": [
    {
      "id": "failure",
      "opcode": "end.failed",
      "inputPorts": [
        {
          "name": "in",
          "contract": []
        }
      ],
      "outputPorts": [],
      "stateEffects": {
        "reads": [],
        "writes": []
      },
      "scopePath": [],
      "config": {
        "end": {
          "code": "join_failed"
        }
      }
    },
    {
      "id": "fanout",
      "opcode": "switch.all_match",
      "inputPorts": [
        {
          "name": "in",
          "contract": [
            {
              "name": "value",
              "schema": {
                "type": "string",
                "required": true,
                "default": null,
                "values": [],
                "items": null
              }
            }
          ]
        }
      ],
      "outputPorts": [
        {
          "name": "fallback",
          "contract": [
            {
              "name": "value",
              "schema": {
                "type": "string",
                "required": true,
                "default": null,
                "values": [],
                "items": null
              }
            }
          ]
        },
        {
          "name": "left",
          "contract": [
            {
              "name": "value",
              "schema": {
                "type": "string",
                "required": true,
                "default": null,
                "values": [],
                "items": null
              }
            }
          ]
        },
        {
          "name": "right",
          "contract": [
            {
              "name": "value",
              "schema": {
                "type": "string",
                "required": true,
                "default": null,
                "values": [],
                "items": null
              }
            }
          ]
        }
      ],
      "stateEffects": {
        "reads": [],
        "writes": []
      },
      "scopePath": [],
      "config": {
        "switch": {
          "cases": [
            {
              "port": "fallback",
              "default": true,
              "condition": null
            },
            {
              "port": "left",
              "default": false,
              "condition": {
                "op": "eq",
                "resultType": "boolean",
                "args": [
                  {
                    "op": "contains",
                    "resultType": "boolean",
                    "args": [
                      {
                        "op": "load",
                        "resultType": "string",
                        "load": {
                          "space": "activation_input",
                          "path": [
                            "value"
                          ]
                        }
                      },
                      {
                        "op": "const",
                        "resultType": "string",
                        "value": "left"
                      }
                    ]
                  },
                  {
                    "op": "const",
                    "resultType": "boolean",
                    "value": true
                  }
                ]
              }
            },
            {
              "port": "right",
              "default": false,
              "condition": {
                "op": "eq",
                "resultType": "boolean",
                "args": [
                  {
                    "op": "contains",
                    "resultType": "boolean",
                    "args": [
                      {
                        "op": "load",
                        "resultType": "string",
                        "load": {
                          "space": "activation_input",
                          "path": [
                            "value"
                          ]
                        }
                      },
                      {
                        "op": "const",
                        "resultType": "string",
                        "value": "right"
                      }
                    ]
                  },
                  {
                    "op": "const",
                    "resultType": "boolean",
                    "value": true
                  }
                ]
              }
            }
          ]
        }
      }
    },
    {
      "id": "gather",
      "opcode": "join.all",
      "inputPorts": [
        {
          "name": "fallback",
          "contract": [
            {
              "name": "value",
              "schema": {
                "type": "string",
                "required": true,
                "default": null,
                "values": [],
                "items": null
              }
            }
          ]
        },
        {
          "name": "left",
          "contract": [
            {
              "name": "value",
              "schema": {
                "type": "string",
                "required": true,
                "default": null,
                "values": [],
                "items": null
              }
            }
          ]
        },
        {
          "name": "right",
          "contract": [
            {
              "name": "value",
              "schema": {
                "type": "string",
                "required": true,
                "default": null,
                "values": [],
                "items": null
              }
            }
          ]
        }
      ],
      "outputPorts": [
        {
          "name": "completed",
          "contract": [
            {
              "name": "value",
              "schema": {
                "type": "string",
                "required": true,
                "default": null,
                "values": [],
                "items": null
              }
            }
          ]
        },
        {
          "name": "failed",
          "contract": []
        }
      ],
      "stateEffects": {
        "reads": [],
        "writes": []
      },
      "scopePath": [],
      "config": {
        "join": {
          "ownerId": "fanout",
          "result": [
            {
              "name": "value",
              "schema": {
                "type": "string",
                "required": true,
                "default": null,
                "values": [],
                "items": null
              }
            }
          ],
          "merge": [
            {
              "target": "value",
              "value": {
                "op": "load",
                "resultType": "string",
                "load": {
                  "space": "join_branch",
                  "scopeOwnerId": "fanout",
                  "branch": "left",
                  "path": [
                    "value"
                  ]
                }
              }
            }
          ]
        }
      }
    },
    {
      "id": "success",
      "opcode": "end.succeeded",
      "inputPorts": [
        {
          "name": "in",
          "contract": [
            {
              "name": "value",
              "schema": {
                "type": "string",
                "required": true,
                "default": null,
                "values": [],
                "items": null
              }
            }
          ]
        }
      ],
      "outputPorts": [],
      "stateEffects": {
        "reads": [],
        "writes": []
      },
      "scopePath": [],
      "config": {
        "end": {
          "code": ""
        }
      }
    }
  ],
  "edges": [
    {
      "id": "fallback",
      "source": {
        "nodeId": "fanout",
        "port": "fallback"
      },
      "target": {
        "nodeId": "gather",
        "port": "fallback"
      },
      "bindings": [
        {
          "target": "value",
          "value": {
            "op": "load",
            "resultType": "string",
            "load": {
              "space": "activation_input",
              "path": [
                "value"
              ]
            }
          }
        }
      ],
      "scopeTransitions": [
        {
          "scopeKind": "parallel",
          "ownerId": "fanout",
          "action": "arrive",
          "branch": "fallback"
        },
        {
          "scopeKind": "parallel",
          "ownerId": "fanout",
          "action": "enter",
          "branch": "fallback"
        }
      ]
    },
    {
      "id": "join_failed",
      "source": {
        "nodeId": "gather",
        "port": "failed"
      },
      "target": {
        "nodeId": "failure",
        "port": "in"
      },
      "bindings": [],
      "scopeTransitions": []
    },
    {
      "id": "joined",
      "source": {
        "nodeId": "gather",
        "port": "completed"
      },
      "target": {
        "nodeId": "success",
        "port": "in"
      },
      "bindings": [
        {
          "target": "value",
          "value": {
            "op": "load",
            "resultType": "string",
            "load": {
              "space": "activation_output",
              "path": [
                "value"
              ]
            }
          }
        }
      ],
      "scopeTransitions": []
    },
    {
      "id": "left",
      "source": {
        "nodeId": "fanout",
        "port": "left"
      },
      "target": {
        "nodeId": "gather",
        "port": "left"
      },
      "bindings": [
        {
          "target": "value",
          "value": {
            "op": "load",
            "resultType": "string",
            "load": {
              "space": "activation_input",
              "path": [
                "value"
              ]
            }
          }
        }
      ],
      "scopeTransitions": [
        {
          "scopeKind": "parallel",
          "ownerId": "fanout",
          "action": "arrive",
          "branch": "left"
        },
        {
          "scopeKind": "parallel",
          "ownerId": "fanout",
          "action": "enter",
          "branch": "left"
        }
      ]
    },
    {
      "id": "right",
      "source": {
        "nodeId": "fanout",
        "port": "right"
      },
      "target": {
        "nodeId": "gather",
        "port": "right"
      },
      "bindings": [
        {
          "target": "value",
          "value": {
            "op": "load",
            "resultType": "string",
            "load": {
              "space": "activation_input",
              "path": [
                "value"
              ]
            }
          }
        }
      ],
      "scopeTransitions": [
        {
          "scopeKind": "parallel",
          "ownerId": "fanout",
          "action": "arrive",
          "branch": "right"
        },
        {
          "scopeKind": "parallel",
          "ownerId": "fanout",
          "action": "enter",
          "branch": "right"
        }
      ]
    }
  ],
  "scopes": [
    {
      "kind": "parallel",
      "ownerId": "fanout",
      "parentPath": [],
      "parallel": {
        "activationSet": "matched",
        "joinId": "gather",
        "mode": "all",
        "branches": [
          {
            "port": "fallback",
            "members": [],
            "entryEdges": [
              "fallback"
            ],
            "successArrivals": [
              "fallback"
            ],
            "failedTerminals": []
          },
          {
            "port": "left",
            "members": [],
            "entryEdges": [
              "left"
            ],
            "successArrivals": [
              "left"
            ],
            "failedTerminals": []
          },
          {
            "port": "right",
            "members": [],
            "entryEdges": [
              "right"
            ],
            "successArrivals": [
              "right"
            ],
            "failedTerminals": []
          }
        ]
      }
    }
  ]
}
