{
  "version": 0,
  "entry": "b1",
  "blocks": {
    "b1": {
      "type": "createFolder",
      "inputs": {
        "path": "::HOME::/automation-agent-runtime-tests/semantic-probing"
      },
      "next": "b2"
    },
    "b2": {
      "type": "setVar",
      "inputs": {
        "name": "selectedItems",
        "value": {
          "type": "prListProjectItems",
          "inputs": {
            "onlySelected": true,
            "includeSubbins": "BIN_AND_SUBBINS"
          }
        }
      },
      "next": "b3"
    },
    "b3": {
      "type": "setVar",
      "inputs": {
        "name": "selectedCount",
        "value": {
          "type": "listLength",
          "inputs": {
            "list": {
              "var": "selectedItems"
            }
          }
        }
      },
      "next": "b4"
    },
    "b4": {
      "type": "if",
      "inputs": {
        "branches": [
          {
            "condition": {
              "type": "logicCompare",
              "inputs": {
                "op": "EQ",
                "a": {
                  "var": "selectedCount"
                },
                "b": 0
              }
            },
            "body": [
              {
                "type": "fail",
                "inputs": {
                  "message": "Select one clip project item before running this semantic transcript-plus-frame recipe."
                }
              }
            ]
          }
        ]
      },
      "next": "b5"
    },
    "b5": {
      "type": "setVar",
      "inputs": {
        "name": "itemRef",
        "value": {
          "type": "listGet",
          "inputs": {
            "list": {
              "var": "selectedItems"
            },
            "where": "FIRST"
          }
        }
      },
      "next": "b6"
    },
    "b6": {
      "type": "setVar",
      "inputs": {
        "name": "fileStem",
        "value": {
          "type": "prGetProjectItemProperty",
          "inputs": {
            "item": {
              "var": "itemRef"
            },
            "property": "MEDIA_FILENAME_WITHOUT_EXTENSION"
          }
        }
      },
      "next": "b7"
    },
    "b7": {
      "type": "setVar",
      "inputs": {
        "name": "seqName",
        "value": {
          "type": "textJoin",
          "inputs": {
            "items": [
              "Semantic Review - ",
              {
                "var": "fileStem"
              }
            ]
          }
        }
      },
      "next": "b8"
    },
    "b8": {
      "type": "prSequenceCreateFromItems",
      "inputs": {
        "name": {
          "var": "seqName"
        },
        "items": [
          {
            "var": "itemRef"
          }
        ],
        "onError": "STOP",
        "storeResultIn": "seqRef"
      },
      "next": "b9"
    },
    "b9": {
      "type": "prSequenceActivate",
      "inputs": {
        "sequence": {
          "var": "seqRef"
        },
        "onError": "STOP",
        "storeResultIn": "activateOk"
      },
      "next": "b10"
    },
    "b10": {
      "type": "sleep",
      "inputs": {
        "durationMs": 5000,
        "commitPendingActionsBeforeSleep": false,
        "flushFileBuffersBeforeSleep": false
      },
      "next": "b11"
    },
    "b11": {
      "type": "setVar",
      "inputs": {
        "name": "hasTranscript",
        "value": {
          "type": "prGetProjectItemProperty",
          "inputs": {
            "item": {
              "var": "itemRef"
            },
            "property": "HAS_TRANSCRIPT"
          }
        }
      },
      "next": "b12"
    },
    "b12": {
      "type": "setVar",
      "inputs": {
        "name": "transcriptJson",
        "value": ""
      },
      "next": "b13"
    },
    "b13": {
      "type": "setVar",
      "inputs": {
        "name": "transcriptPath",
        "value": {
          "type": "textJoin",
          "inputs": {
            "items": [
              "::HOME::/automation-agent-runtime-tests/semantic-probing/",
              {
                "var": "fileStem"
              },
              "-semantic-review-transcript.json"
            ]
          }
        }
      },
      "next": "b14"
    },
    "b14": {
      "type": "if",
      "inputs": {
        "branches": [
          {
            "condition": {
              "var": "hasTranscript"
            },
            "body": [
              {
                "type": "setVar",
                "inputs": {
                  "name": "transcriptJson",
                  "value": {
                    "type": "prExportTranscriptJson",
                    "inputs": {
                      "item": {
                        "var": "itemRef"
                      }
                    }
                  }
                }
              },
              {
                "type": "writeTextFile",
                "inputs": {
                  "path": {
                    "var": "transcriptPath"
                  },
                  "text": {
                    "var": "transcriptJson"
                  },
                  "append": false,
                  "flushNow": true
                }
              }
            ]
          }
        ]
      },
      "next": "b15"
    },
    "b15": {
      "type": "setVar",
      "inputs": {
        "name": "frameWidth",
        "value": {
          "type": "prGetSequenceProperty",
          "inputs": {
            "sequence": {
              "var": "seqRef"
            },
            "property": "FRAME_WIDTH"
          }
        }
      },
      "next": "b16"
    },
    "b16": {
      "type": "setVar",
      "inputs": {
        "name": "frameHeight",
        "value": {
          "type": "prGetSequenceProperty",
          "inputs": {
            "sequence": {
              "var": "seqRef"
            },
            "property": "FRAME_HEIGHT"
          }
        }
      },
      "next": "b17"
    },
    "b17": {
      "type": "setVar",
      "inputs": {
        "name": "framePath",
        "value": {
          "type": "textJoin",
          "inputs": {
            "items": [
              "::HOME::/automation-agent-runtime-tests/semantic-probing/",
              {
                "var": "fileStem"
              },
              "-reference-frame.png"
            ]
          }
        }
      },
      "next": "b18"
    },
    "b18": {
      "type": "prExportSequenceFrame",
      "inputs": {
        "sequence": {
          "var": "seqRef"
        },
        "timeSeconds": 0.5,
        "outputPath": {
          "var": "framePath"
        },
        "width": {
          "var": "frameWidth"
        },
        "height": {
          "var": "frameHeight"
        },
        "onError": "STOP",
        "storeResultIn": "frameExportOk"
      },
      "next": "b19"
    },
    "b19": {
      "type": "esConsoleLog",
      "inputs": {
        "message": {
          "type": "textJoin",
          "inputs": {
            "items": [
              "SUMMARY|recipe=semantic-transcript-and-reference-frame|seqRef=\"",
              {
                "var": "seqRef"
              },
              "\"|hasTranscript=",
              {
                "var": "hasTranscript"
              },
              "|frameExportOk=",
              {
                "var": "frameExportOk"
              },
              "|transcriptPath=\"",
              {
                "var": "transcriptPath"
              },
              "\"|framePath=\"",
              {
                "var": "framePath"
              },
              "\""
            ]
          }
        }
      },
      "next": null
    }
  }
}
