[
  {
    "id": "b000000000000001",
    "type": "tab",
    "label": "除錯與狀態觀察",
    "disabled": false,
    "info": "三個手動入口分別示範正常輸出、可擷取測試錯誤與有界狀態；Catch、Status、Complete 預設停用，Complete 只監看示範 Function。",
    "env": []
  },
  {
    "id": "b000000000000002",
    "type": "inject",
    "z": "b000000000000001",
    "name": "手動測試正常輸出",
    "props": [
      {
        "p": "payload"
      },
      {
        "p": "mode",
        "v": "normal",
        "vt": "str"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": 0.1,
    "topic": "",
    "payload": "4",
    "payloadType": "num",
    "x": 170,
    "y": 80,
    "wires": [
      [
        "b000000000000005"
      ]
    ]
  },
  {
    "id": "b000000000000003",
    "type": "inject",
    "z": "b000000000000001",
    "name": "手動測試 Catch",
    "props": [
      {
        "p": "payload"
      },
      {
        "p": "mode",
        "v": "catch",
        "vt": "str"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": 0.1,
    "topic": "",
    "payload": "測試錯誤",
    "payloadType": "str",
    "x": 160,
    "y": 140,
    "wires": [
      [
        "b000000000000005"
      ]
    ]
  },
  {
    "id": "b000000000000004",
    "type": "inject",
    "z": "b000000000000001",
    "name": "手動測試 Status",
    "props": [
      {
        "p": "payload"
      },
      {
        "p": "mode",
        "v": "status",
        "vt": "str"
      }
    ],
    "repeat": "",
    "crontab": "",
    "once": false,
    "onceDelay": 0.1,
    "topic": "",
    "payload": "狀態測試",
    "payloadType": "str",
    "x": 160,
    "y": 200,
    "wires": [
      [
        "b000000000000005"
      ]
    ]
  },
  {
    "id": "b000000000000005",
    "type": "function",
    "z": "b000000000000001",
    "name": "產生有限診斷事件",
    "func": "const mode = msg.mode;\nif (mode === \"catch\") {\n    node.error(\"TEST_ERROR\", msg);\n    return null;\n}\nif (mode === \"status\") {\n    node.status({ fill: \"blue\", shape: \"dot\", text: \"TEST_STATUS\" });\n    return null;\n}\nif (mode !== \"normal\" || typeof msg.payload !== \"number\" || !Number.isFinite(msg.payload)) {\n    node.error(\"TEST_INVALID_INPUT\", msg);\n    return null;\n}\nmsg.payload = { caseName: \"normal\", doubled: msg.payload * 2 };\nreturn msg;",
    "outputs": 1,
    "timeout": 0,
    "noerr": 0,
    "initialize": "",
    "finalize": "",
    "libs": [],
    "x": 430,
    "y": 140,
    "wires": [
      [
        "b000000000000006"
      ]
    ]
  },
  {
    "id": "b000000000000006",
    "type": "debug",
    "z": "b000000000000001",
    "name": "檢視正常 payload",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "payload",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 730,
    "y": 80,
    "wires": []
  },
  {
    "id": "b000000000000007",
    "type": "catch",
    "z": "b000000000000001",
    "name": "擷取測試錯誤",
    "scope": [
      "b000000000000005"
    ],
    "uncaught": false,
    "d": true,
    "x": 430,
    "y": 240,
    "wires": [
      [
        "b000000000000009"
      ]
    ]
  },
  {
    "id": "b000000000000008",
    "type": "status",
    "z": "b000000000000001",
    "name": "觀察測試狀態",
    "scope": [
      "b000000000000005"
    ],
    "d": true,
    "x": 430,
    "y": 300,
    "wires": [
      [
        "b000000000000010"
      ]
    ]
  },
  {
    "id": "b000000000000009",
    "type": "debug",
    "z": "b000000000000001",
    "name": "檢視 error",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "error",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 720,
    "y": 240,
    "wires": []
  },
  {
    "id": "b000000000000010",
    "type": "debug",
    "z": "b000000000000001",
    "name": "檢視 status",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "status",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 720,
    "y": 300,
    "wires": []
  },
  {
    "id": "b000000000000011",
    "type": "complete",
    "z": "b000000000000001",
    "name": "觀察 Function 完成",
    "scope": [
      "b000000000000005"
    ],
    "uncaught": false,
    "d": true,
    "x": 430,
    "y": 360,
    "wires": [
      [
        "b000000000000012"
      ]
    ]
  },
  {
    "id": "b000000000000012",
    "type": "debug",
    "z": "b000000000000001",
    "name": "檢視 complete",
    "active": true,
    "tosidebar": true,
    "console": false,
    "tostatus": false,
    "complete": "complete",
    "targetType": "msg",
    "statusVal": "",
    "statusType": "auto",
    "x": 720,
    "y": 360,
    "wires": []
  }
]
