{
  "name": "Vexday | T05 - Fornecedor comprometido (v0.1)",
  "nodes": [
    {
      "name": "A cada 4 horas",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        100
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 4
            }
          ]
        }
      },
      "id": "cfa04f99-5a0f-4f1a-46d3-4f18b64da46b"
    },
    {
      "name": "Executar agora (POST)",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        300
      ],
      "webhookId": "3b043c5a-ba8c-c0e1-e15c-ef1b6f119bf9",
      "parameters": {
        "httpMethod": "POST",
        "path": "vexday-t05-executar",
        "authentication": "basicAuth",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "02cb2db4-6c1d-26f1-8760-b3404cf5a1ad"
    },
    {
      "name": "Config",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        240,
        200
      ],
      "parameters": {
        "mode": "manual",
        "includeOtherFields": false,
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "eb827e89-ab3b-6d59-ceff-783ac1ca2f5e",
              "name": "vexday_mcp_url",
              "value": "https://api.vexday.io/mcp",
              "type": "string"
            },
            {
              "id": "af8032dd-4f4f-e072-eb88-682b72524cd5",
              "name": "fornecedores",
              "value": "[{\"nome\": \"Fornecedor Exemplo Ltda\", \"apelidos\": [\"Fornecedor Exemplo\"], \"dominio\": \"fornecedorexemplo.com.br\", \"clientes\": []}]",
              "type": "string"
            },
            {
              "id": "a17fa375-9141-e547-5be7-45c99ae76790",
              "name": "janela_dias",
              "value": "3",
              "type": "string"
            },
            {
              "id": "66e6c627-5ffd-d558-a8ea-57ed101f990c",
              "name": "canais",
              "value": "[]",
              "type": "string"
            }
          ]
        }
      },
      "id": "a608068f-6e26-94d7-6452-f24e988d037f"
    },
    {
      "name": "Pede vítimas",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        460,
        200
      ],
      "parameters": {
        "jsCode": "// ===== Vexday templates :: lib comum (injetada no build) =====\n// Texto vindo do Vexday é dado de terceiro: sempre escapado, nunca tratado como instrução.\n\nconst safeJson = (s) => { try { return JSON.parse(s); } catch (e) { return null; } };\nconst num = (x) => (x === null || x === undefined || x === '' || isNaN(Number(x)) ? null : Number(x));\nconst day = (iso) => (iso ? String(iso).slice(0, 10) : null);\nconst pct = (x) => (x === null || x === undefined ? 'n/d' : (x * 100).toFixed(1) + '%');\nconst esc = (s) => String(s ?? '')\n  .replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')\n  .replace(/\"/g, '&quot;').replace(/'/g, '&#39;');\nconst para = (s) => esc(s).replace(/\\r?\\n/g, '<br>');\nconst safeUrl = (u) => (/^https?:\\/\\//i.test(String(u || '')) ? String(u) : '#');\nconst slackEsc = (s) => String(s ?? '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\nconst isoDaysAgo = (n) => new Date(Date.now() - n * 86400000).toISOString().slice(0, 10);\n\n// Lê um campo de texto do Config que deve conter JSON; erro claro se estiver malformado.\nfunction cfgJson(cfg, field, fallback) {\n  const v = cfg[field];\n  if (v === undefined || v === null || v === '') return fallback;\n  if (typeof v === 'object') return v;\n  const p = safeJson(v);\n  if (p === null) throw new Error(`Config: o campo \"${field}\" não é um JSON válido.`);\n  return p;\n}\n\n// Corpo da resposta HTTP: JSON direto ou SSE (usa a última linha \"data:\").\nfunction parseBody(raw) {\n  if (raw === null || raw === undefined) return null;\n  if (typeof raw === 'object') return raw;\n  const s = String(raw).trim();\n  if (s.startsWith('{')) return safeJson(s);\n  const lines = s.split(/\\r?\\n/).filter((l) => l.startsWith('data:'));\n  return lines.length ? safeJson(lines[lines.length - 1].slice(5).trim()) : null;\n}\n\n// Corpo de um HTTP Request com fullResponse (o n8n usa \"data\" no modo texto e \"body\" no JSON).\nconst respText = (j) => (j ? (j.body ?? j.data ?? null) : null);\n\n// Interpreta a saída de um HTTP Request (fullResponse + neverError + text) que chamou tools/call.\n// Retorna { data } ou { err, fatal, toolError }.\nconst RATE_RE = /muitas requisi|too many requests|rate.?limit/i;\nfunction parseMcpResp(resp, tool) {\n  if (!resp) return { err: `${tool} não executou.`, fatal: true };\n  const status = Number(resp.statusCode ?? 0);\n  const body = parseBody(respText(resp));\n  if (status === 401 || body?.error === 'invalid_token')\n    return { err: 'Chave da API do Vexday inválida ou revogada (HTTP 401). Confira a credencial \"Vexday API\".', fatal: true, auth: true };\n  if (status === 403) return { err: `O plano da conta não libera ${tool} (HTTP 403).`, fatal: true };\n  if (status === 429) return { err: 'Limite diário de consultas do Vexday atingido (HTTP 429).', fatal: true, quota: true };\n  if (status >= 400) return { err: `Erro HTTP ${status} ao chamar ${tool}.`, fatal: true };\n  if (!body) return { err: `Resposta ilegível de ${tool}.`, fatal: true };\n  if (body.error) return { err: `Erro em ${tool}: ${body.error.message || JSON.stringify(body.error)}`, fatal: true };\n  const r = body.result || {};\n  const text = r.content?.[0]?.text ?? '';\n  if (r.isError) {\n    const msg = String(text).replace(/^Error executing tool [\\w]+:\\s*/, '');\n    // Limite por minuto: o Vexday devolve como erro da tool com HTTP 200, não 429 (visto em 20/11: \"máx 30/min\").\n    if (RATE_RE.test(msg)) return { err: `Limite por minuto do Vexday atingido em ${tool}: ${msg.slice(0, 160)}`, fatal: true, quota: true, rate: true };\n    return { err: msg, toolError: true };\n  }\n  const data = safeJson(text);\n  if (data === null) return { err: `Resposta inesperada de ${tool}.`, fatal: true };\n  return { data };\n}\n\n// Item de requisição para o nó \"Vexday MCP\". O corpo JSON-RPC vai pronto em \"rpc\":\n// o sandbox de expressões do n8n bloqueia acesso a campos chamados \"arguments\".\nfunction mcpReq(tool, args, ctx) {\n  return { json: { tool, args: args || {}, ctx: ctx ?? null,\n    rpc: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: tool, arguments: args || {} } }) } };\n}\n\n// Junta as requisições preparadas com as respostas do HTTP Request (mesma ordem, 1 para 1).\nfunction zipMcp(reqItems, respItems) {\n  return reqItems.map((rq, i) => {\n    const r = parseMcpResp(respItems[i]?.json, rq.json.tool);\n    return { ...r, tool: rq.json.tool, args: rq.json.args, ctx: rq.json.ctx };\n  });\n}\n\nfunction attributionOf(results) {\n  const names = new Set();\n  for (const r of results) for (const s of (r?.data?.attribution?.sources || [])) names.add(s.name);\n  return [...names];\n}\n\n// Página HTML com CSP rígida no <meta> (sem script). opts.claro = tema claro, mais seguro em e-mail.\nconst CSS_ESCURO = `body{margin:0;background:#0b0b0c;color:#f2f1ee;font:16px/1.55 system-ui,-apple-system,Segoe UI,Roboto,sans-serif}\nmain{max-width:880px;margin:0 auto;padding:32px 20px 64px}\nh1{font-size:26px;margin:0 0 4px}h2{font-size:17px;margin:32px 0 8px;border-top:1px solid #26262a;padding-top:20px}\n.muted{color:#8e8e93}.tag{display:inline-block;padding:2px 10px;border-radius:99px;font-size:13px;font-weight:600;margin-right:6px}\n.crit{background:#ff453a22;color:#ff6b61}.high{background:#ff9f0a22;color:#ffb340}.med{background:#ffd60a22;color:#ffd60a}.low{background:#30d15822;color:#4cd964}\n.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px;margin:16px 0}\n.card{background:#141416;border:1px solid #26262a;border-radius:10px;padding:12px 14px}.card b{display:block;font-size:20px}\ntable{width:100%;border-collapse:collapse;font-size:14px}th,td{text-align:left;padding:7px 8px;border-bottom:1px solid #26262a;vertical-align:top}th{color:#8e8e93;font-weight:600}\na{color:#f96a02}ul{padding-left:20px}li{margin:3px 0}.warn{background:#ff9f0a14;border:1px solid #ff9f0a55;border-radius:10px;padding:10px 14px}\n.err{background:#ff453a14;border:1px solid #ff453a55;border-radius:10px;padding:14px}footer{margin-top:40px;font-size:13px;color:#8e8e93}`;\nconst CSS_CLARO = `body{margin:0;background:#ffffff;color:#1c1c1e;font:15px/1.55 -apple-system,Segoe UI,Roboto,Arial,sans-serif}\nmain{max-width:720px;margin:0 auto;padding:28px 20px 48px}h1{font-size:24px;margin:0 0 4px}\nh2{font-size:16px;margin:28px 0 8px;border-top:1px solid #e5e5ea;padding-top:18px}.muted{color:#6e6e73}\ntable{width:100%;border-collapse:collapse;font-size:14px}th,td{text-align:left;padding:7px 8px;border-bottom:1px solid #e5e5ea;vertical-align:top}th{color:#6e6e73;font-weight:600}\na{color:#c2410c}ul{padding-left:20px}li{margin:3px 0}.warn{background:#fff4e5;border:1px solid #f5c27a;border-radius:8px;padding:10px 14px}\nfooter{margin-top:36px;font-size:12px;color:#6e6e73}`;\nfunction page(title, inner, opts) {\n  const claro = !!(opts && opts.claro);\n  const bodyStyle = claro ? ' style=\"margin:0;background:#ffffff;color:#1c1c1e\"' : '';\n  return `<!DOCTYPE html><html lang=\"pt-BR\"><head><meta charset=\"utf-8\">\n<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none'; style-src 'unsafe-inline'; img-src https: data:\">\n<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><title>${esc(title)}</title>\n<style>${claro ? CSS_CLARO : CSS_ESCURO}</style></head><body${bodyStyle}><main>${inner}</main></body></html>`;\n}\n\n// ---------- notificações ----------\n// canais: [{ \"tipo\": \"discord|slack|teams|json\", \"url\": \"https://...\", \"tags\": [\"cliente-acme\"] (opcional) }]\n// msg: { titulo, linhas: [string], url, nivel: 0..3, rodape }\n// Retorna itens prontos para um HTTP Request genérico: { url, body }.\nconst NIVEL_TAG = ['[BAIXA]', '[MÉDIA]', '[ALTA]', '[CRÍTICA]'];\nconst NIVEL_TEAMS = ['Good', 'Default', 'Warning', 'Attention'];\nconst NIVEL_COR = ['2ECC71', 'F1C40F', 'E67E22', 'E74C3C'];\n\nfunction canaisPara(canais, tags) {\n  const ts = (tags && tags.length) ? tags : [];\n  return (canais || []).filter((c) => {\n    if (!/^https:\\/\\//i.test(String(c.url || '')) && !/^http:\\/\\/(127\\.0\\.0\\.1|localhost)(:\\d+)?\\//i.test(String(c.url || ''))) return false; // http só local\n    if (!c.tags || !c.tags.length) return true;           // canal geral recebe tudo\n    return ts.some((t) => c.tags.includes(t));            // canal de cliente só recebe o cliente\n  });\n}\n\nfunction buildNotify(canais, msg, tags) {\n  const nivel = Math.max(0, Math.min(3, msg.nivel ?? 0));\n  const out = [];\n  for (const c of canaisPara(canais, tags)) {\n    const tipo = String(c.tipo || 'json').toLowerCase();\n    let body;\n    if (tipo === 'discord') {\n      const txt = [`**${NIVEL_TAG[nivel]} ${msg.titulo}**`, ...(msg.linhas || []), msg.url || '', msg.rodape ? `-# ${msg.rodape}` : '']\n        .filter(Boolean).join('\\n');\n      body = { content: txt.slice(0, 1990), allowed_mentions: { parse: [] } };\n    } else if (tipo === 'slack') {\n      const txt = [`*${NIVEL_TAG[nivel]} ${slackEsc(msg.titulo)}*`, ...(msg.linhas || []).map(slackEsc),\n        msg.url ? `<${msg.url}|Abrir>` : '', msg.rodape ? `_${slackEsc(msg.rodape)}_` : ''].filter(Boolean).join('\\n');\n      body = { text: txt.slice(0, 39000) };\n    } else if (tipo === 'teams') {\n      // Webhook de Workflows do Teams (Power Automate) com Adaptive Card.\n      const items = [\n        { type: 'TextBlock', text: `${NIVEL_TAG[nivel]} ${msg.titulo}`, color: NIVEL_TEAMS[nivel], weight: 'Bolder', size: 'Medium', wrap: true },\n        ...(msg.linhas || []).map((l) => ({ type: 'TextBlock', text: l, wrap: true, spacing: 'Small' })),\n      ];\n      if (msg.rodape) items.push({ type: 'TextBlock', text: msg.rodape, isSubtle: true, size: 'Small', wrap: true });\n      const card = { $schema: 'http://adaptivecards.io/schemas/adaptive-card.json', type: 'AdaptiveCard', version: '1.4', body: items };\n      if (msg.url) card.actions = [{ type: 'Action.OpenUrl', title: 'Abrir', url: msg.url }];\n      body = { type: 'message', attachments: [{ contentType: 'application/vnd.microsoft.card.adaptive', content: card }] };\n    } else {\n      body = { titulo: msg.titulo, linhas: msg.linhas || [], url: msg.url || null, nivel, tags: tags || [], rodape: msg.rodape || null };\n    }\n    out.push({ url: c.url, tipo, body });\n  }\n  return out;\n}\n\n// ---------- normalização de nomes (fornecedores x vítimas) ----------\nconst LEGAL = /\\b(ltda|ltd|eireli|me|epp|s\\.?\\s?a\\.?|sa|inc|incorporated|corp|corporation|co|company|cia|companhia|llc|plc|gmbh|ag|bv|nv|srl|spa|group|grupo|holding|holdings)\\b/g;\nfunction normName(s) {\n  return String(s || '')\n    .normalize('NFD').replace(/[̀-ͯ]/g, '')\n    .toLowerCase()\n    .replace(/^https?:\\/\\//, '').replace(/^www\\./, '')\n    .replace(/\\.(com|net|org|gov|edu|io|co)(\\.[a-z]{2})?$/, '').replace(/\\.[a-z]{2}$/, '')\n    .replace(/[^a-z0-9 ]+/g, ' ')\n    .replace(LEGAL, ' ')\n    .replace(/\\s+/g, ' ').trim();\n}\n\n// Comparação de tempo constante para hex (HMAC).\nfunction timingSafeEqualHex(a, b) {\n  a = String(a || ''); b = String(b || '');\n  let diff = a.length ^ b.length;\n  const n = Math.max(a.length, b.length);\n  for (let i = 0; i < n; i++) diff |= (a.charCodeAt(i) || 0) ^ (b.charCodeAt(i) || 0);\n  return diff === 0;\n}\n// ===== fim da lib =====\n\n// Vítimas recentes no mundo todo (fornecedor pode estar em qualquer país). Até 3 páginas de 100.\nconst cfg = $('Config').first().json;\nconst forn = cfgJson(cfg, 'fornecedores', []);\nif (!Array.isArray(forn) || !forn.length) throw new Error('Preencha \"fornecedores\" no Config.');\nconst desde = isoDaysAgo(Math.max(1, Number(cfg.janela_dias || 3)));\nreturn [1, 2, 3].map((p) => mcpReq('search_victims', { since: desde, page: p, page_size: 100 }, { p }));\n"
      },
      "id": "37c9baec-5fab-0be8-0714-39ef8d3fef4a"
    },
    {
      "name": "Vexday MCP vítimas",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        680,
        200
      ],
      "parameters": {
        "method": "POST",
        "url": "={{ $('Config').first().json.vexday_mcp_url }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json, text/event-stream"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ $json.rpc }}",
        "options": {
          "timeout": 45000,
          "batching": {
            "batch": {
              "batchSize": 1,
              "batchInterval": 2200
            }
          },
          "response": {
            "response": {
              "fullResponse": true,
              "neverError": true,
              "responseFormat": "text"
            }
          }
        }
      },
      "id": "93443778-c9c6-71bd-1f59-1f3733239581"
    },
    {
      "name": "Casa fornecedores",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        900,
        200
      ],
      "parameters": {
        "jsCode": "// ===== Vexday templates :: lib comum (injetada no build) =====\n// Texto vindo do Vexday é dado de terceiro: sempre escapado, nunca tratado como instrução.\n\nconst safeJson = (s) => { try { return JSON.parse(s); } catch (e) { return null; } };\nconst num = (x) => (x === null || x === undefined || x === '' || isNaN(Number(x)) ? null : Number(x));\nconst day = (iso) => (iso ? String(iso).slice(0, 10) : null);\nconst pct = (x) => (x === null || x === undefined ? 'n/d' : (x * 100).toFixed(1) + '%');\nconst esc = (s) => String(s ?? '')\n  .replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')\n  .replace(/\"/g, '&quot;').replace(/'/g, '&#39;');\nconst para = (s) => esc(s).replace(/\\r?\\n/g, '<br>');\nconst safeUrl = (u) => (/^https?:\\/\\//i.test(String(u || '')) ? String(u) : '#');\nconst slackEsc = (s) => String(s ?? '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\nconst isoDaysAgo = (n) => new Date(Date.now() - n * 86400000).toISOString().slice(0, 10);\n\n// Lê um campo de texto do Config que deve conter JSON; erro claro se estiver malformado.\nfunction cfgJson(cfg, field, fallback) {\n  const v = cfg[field];\n  if (v === undefined || v === null || v === '') return fallback;\n  if (typeof v === 'object') return v;\n  const p = safeJson(v);\n  if (p === null) throw new Error(`Config: o campo \"${field}\" não é um JSON válido.`);\n  return p;\n}\n\n// Corpo da resposta HTTP: JSON direto ou SSE (usa a última linha \"data:\").\nfunction parseBody(raw) {\n  if (raw === null || raw === undefined) return null;\n  if (typeof raw === 'object') return raw;\n  const s = String(raw).trim();\n  if (s.startsWith('{')) return safeJson(s);\n  const lines = s.split(/\\r?\\n/).filter((l) => l.startsWith('data:'));\n  return lines.length ? safeJson(lines[lines.length - 1].slice(5).trim()) : null;\n}\n\n// Corpo de um HTTP Request com fullResponse (o n8n usa \"data\" no modo texto e \"body\" no JSON).\nconst respText = (j) => (j ? (j.body ?? j.data ?? null) : null);\n\n// Interpreta a saída de um HTTP Request (fullResponse + neverError + text) que chamou tools/call.\n// Retorna { data } ou { err, fatal, toolError }.\nconst RATE_RE = /muitas requisi|too many requests|rate.?limit/i;\nfunction parseMcpResp(resp, tool) {\n  if (!resp) return { err: `${tool} não executou.`, fatal: true };\n  const status = Number(resp.statusCode ?? 0);\n  const body = parseBody(respText(resp));\n  if (status === 401 || body?.error === 'invalid_token')\n    return { err: 'Chave da API do Vexday inválida ou revogada (HTTP 401). Confira a credencial \"Vexday API\".', fatal: true, auth: true };\n  if (status === 403) return { err: `O plano da conta não libera ${tool} (HTTP 403).`, fatal: true };\n  if (status === 429) return { err: 'Limite diário de consultas do Vexday atingido (HTTP 429).', fatal: true, quota: true };\n  if (status >= 400) return { err: `Erro HTTP ${status} ao chamar ${tool}.`, fatal: true };\n  if (!body) return { err: `Resposta ilegível de ${tool}.`, fatal: true };\n  if (body.error) return { err: `Erro em ${tool}: ${body.error.message || JSON.stringify(body.error)}`, fatal: true };\n  const r = body.result || {};\n  const text = r.content?.[0]?.text ?? '';\n  if (r.isError) {\n    const msg = String(text).replace(/^Error executing tool [\\w]+:\\s*/, '');\n    // Limite por minuto: o Vexday devolve como erro da tool com HTTP 200, não 429 (visto em 20/11: \"máx 30/min\").\n    if (RATE_RE.test(msg)) return { err: `Limite por minuto do Vexday atingido em ${tool}: ${msg.slice(0, 160)}`, fatal: true, quota: true, rate: true };\n    return { err: msg, toolError: true };\n  }\n  const data = safeJson(text);\n  if (data === null) return { err: `Resposta inesperada de ${tool}.`, fatal: true };\n  return { data };\n}\n\n// Item de requisição para o nó \"Vexday MCP\". O corpo JSON-RPC vai pronto em \"rpc\":\n// o sandbox de expressões do n8n bloqueia acesso a campos chamados \"arguments\".\nfunction mcpReq(tool, args, ctx) {\n  return { json: { tool, args: args || {}, ctx: ctx ?? null,\n    rpc: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: tool, arguments: args || {} } }) } };\n}\n\n// Junta as requisições preparadas com as respostas do HTTP Request (mesma ordem, 1 para 1).\nfunction zipMcp(reqItems, respItems) {\n  return reqItems.map((rq, i) => {\n    const r = parseMcpResp(respItems[i]?.json, rq.json.tool);\n    return { ...r, tool: rq.json.tool, args: rq.json.args, ctx: rq.json.ctx };\n  });\n}\n\nfunction attributionOf(results) {\n  const names = new Set();\n  for (const r of results) for (const s of (r?.data?.attribution?.sources || [])) names.add(s.name);\n  return [...names];\n}\n\n// Página HTML com CSP rígida no <meta> (sem script). opts.claro = tema claro, mais seguro em e-mail.\nconst CSS_ESCURO = `body{margin:0;background:#0b0b0c;color:#f2f1ee;font:16px/1.55 system-ui,-apple-system,Segoe UI,Roboto,sans-serif}\nmain{max-width:880px;margin:0 auto;padding:32px 20px 64px}\nh1{font-size:26px;margin:0 0 4px}h2{font-size:17px;margin:32px 0 8px;border-top:1px solid #26262a;padding-top:20px}\n.muted{color:#8e8e93}.tag{display:inline-block;padding:2px 10px;border-radius:99px;font-size:13px;font-weight:600;margin-right:6px}\n.crit{background:#ff453a22;color:#ff6b61}.high{background:#ff9f0a22;color:#ffb340}.med{background:#ffd60a22;color:#ffd60a}.low{background:#30d15822;color:#4cd964}\n.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px;margin:16px 0}\n.card{background:#141416;border:1px solid #26262a;border-radius:10px;padding:12px 14px}.card b{display:block;font-size:20px}\ntable{width:100%;border-collapse:collapse;font-size:14px}th,td{text-align:left;padding:7px 8px;border-bottom:1px solid #26262a;vertical-align:top}th{color:#8e8e93;font-weight:600}\na{color:#f96a02}ul{padding-left:20px}li{margin:3px 0}.warn{background:#ff9f0a14;border:1px solid #ff9f0a55;border-radius:10px;padding:10px 14px}\n.err{background:#ff453a14;border:1px solid #ff453a55;border-radius:10px;padding:14px}footer{margin-top:40px;font-size:13px;color:#8e8e93}`;\nconst CSS_CLARO = `body{margin:0;background:#ffffff;color:#1c1c1e;font:15px/1.55 -apple-system,Segoe UI,Roboto,Arial,sans-serif}\nmain{max-width:720px;margin:0 auto;padding:28px 20px 48px}h1{font-size:24px;margin:0 0 4px}\nh2{font-size:16px;margin:28px 0 8px;border-top:1px solid #e5e5ea;padding-top:18px}.muted{color:#6e6e73}\ntable{width:100%;border-collapse:collapse;font-size:14px}th,td{text-align:left;padding:7px 8px;border-bottom:1px solid #e5e5ea;vertical-align:top}th{color:#6e6e73;font-weight:600}\na{color:#c2410c}ul{padding-left:20px}li{margin:3px 0}.warn{background:#fff4e5;border:1px solid #f5c27a;border-radius:8px;padding:10px 14px}\nfooter{margin-top:36px;font-size:12px;color:#6e6e73}`;\nfunction page(title, inner, opts) {\n  const claro = !!(opts && opts.claro);\n  const bodyStyle = claro ? ' style=\"margin:0;background:#ffffff;color:#1c1c1e\"' : '';\n  return `<!DOCTYPE html><html lang=\"pt-BR\"><head><meta charset=\"utf-8\">\n<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none'; style-src 'unsafe-inline'; img-src https: data:\">\n<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><title>${esc(title)}</title>\n<style>${claro ? CSS_CLARO : CSS_ESCURO}</style></head><body${bodyStyle}><main>${inner}</main></body></html>`;\n}\n\n// ---------- notificações ----------\n// canais: [{ \"tipo\": \"discord|slack|teams|json\", \"url\": \"https://...\", \"tags\": [\"cliente-acme\"] (opcional) }]\n// msg: { titulo, linhas: [string], url, nivel: 0..3, rodape }\n// Retorna itens prontos para um HTTP Request genérico: { url, body }.\nconst NIVEL_TAG = ['[BAIXA]', '[MÉDIA]', '[ALTA]', '[CRÍTICA]'];\nconst NIVEL_TEAMS = ['Good', 'Default', 'Warning', 'Attention'];\nconst NIVEL_COR = ['2ECC71', 'F1C40F', 'E67E22', 'E74C3C'];\n\nfunction canaisPara(canais, tags) {\n  const ts = (tags && tags.length) ? tags : [];\n  return (canais || []).filter((c) => {\n    if (!/^https:\\/\\//i.test(String(c.url || '')) && !/^http:\\/\\/(127\\.0\\.0\\.1|localhost)(:\\d+)?\\//i.test(String(c.url || ''))) return false; // http só local\n    if (!c.tags || !c.tags.length) return true;           // canal geral recebe tudo\n    return ts.some((t) => c.tags.includes(t));            // canal de cliente só recebe o cliente\n  });\n}\n\nfunction buildNotify(canais, msg, tags) {\n  const nivel = Math.max(0, Math.min(3, msg.nivel ?? 0));\n  const out = [];\n  for (const c of canaisPara(canais, tags)) {\n    const tipo = String(c.tipo || 'json').toLowerCase();\n    let body;\n    if (tipo === 'discord') {\n      const txt = [`**${NIVEL_TAG[nivel]} ${msg.titulo}**`, ...(msg.linhas || []), msg.url || '', msg.rodape ? `-# ${msg.rodape}` : '']\n        .filter(Boolean).join('\\n');\n      body = { content: txt.slice(0, 1990), allowed_mentions: { parse: [] } };\n    } else if (tipo === 'slack') {\n      const txt = [`*${NIVEL_TAG[nivel]} ${slackEsc(msg.titulo)}*`, ...(msg.linhas || []).map(slackEsc),\n        msg.url ? `<${msg.url}|Abrir>` : '', msg.rodape ? `_${slackEsc(msg.rodape)}_` : ''].filter(Boolean).join('\\n');\n      body = { text: txt.slice(0, 39000) };\n    } else if (tipo === 'teams') {\n      // Webhook de Workflows do Teams (Power Automate) com Adaptive Card.\n      const items = [\n        { type: 'TextBlock', text: `${NIVEL_TAG[nivel]} ${msg.titulo}`, color: NIVEL_TEAMS[nivel], weight: 'Bolder', size: 'Medium', wrap: true },\n        ...(msg.linhas || []).map((l) => ({ type: 'TextBlock', text: l, wrap: true, spacing: 'Small' })),\n      ];\n      if (msg.rodape) items.push({ type: 'TextBlock', text: msg.rodape, isSubtle: true, size: 'Small', wrap: true });\n      const card = { $schema: 'http://adaptivecards.io/schemas/adaptive-card.json', type: 'AdaptiveCard', version: '1.4', body: items };\n      if (msg.url) card.actions = [{ type: 'Action.OpenUrl', title: 'Abrir', url: msg.url }];\n      body = { type: 'message', attachments: [{ contentType: 'application/vnd.microsoft.card.adaptive', content: card }] };\n    } else {\n      body = { titulo: msg.titulo, linhas: msg.linhas || [], url: msg.url || null, nivel, tags: tags || [], rodape: msg.rodape || null };\n    }\n    out.push({ url: c.url, tipo, body });\n  }\n  return out;\n}\n\n// ---------- normalização de nomes (fornecedores x vítimas) ----------\nconst LEGAL = /\\b(ltda|ltd|eireli|me|epp|s\\.?\\s?a\\.?|sa|inc|incorporated|corp|corporation|co|company|cia|companhia|llc|plc|gmbh|ag|bv|nv|srl|spa|group|grupo|holding|holdings)\\b/g;\nfunction normName(s) {\n  return String(s || '')\n    .normalize('NFD').replace(/[̀-ͯ]/g, '')\n    .toLowerCase()\n    .replace(/^https?:\\/\\//, '').replace(/^www\\./, '')\n    .replace(/\\.(com|net|org|gov|edu|io|co)(\\.[a-z]{2})?$/, '').replace(/\\.[a-z]{2}$/, '')\n    .replace(/[^a-z0-9 ]+/g, ' ')\n    .replace(LEGAL, ' ')\n    .replace(/\\s+/g, ' ').trim();\n}\n\n// Comparação de tempo constante para hex (HMAC).\nfunction timingSafeEqualHex(a, b) {\n  a = String(a || ''); b = String(b || '');\n  let diff = a.length ^ b.length;\n  const n = Math.max(a.length, b.length);\n  for (let i = 0; i < n; i++) diff |= (a.charCodeAt(i) || 0) ^ (b.charCodeAt(i) || 0);\n  return diff === 0;\n}\n// ===== fim da lib =====\n\n// Casa as vítimas com a lista de fornecedores (nome, apelidos e domínio normalizados) e descarta o que já foi avisado.\nconst cfg = $('Config').first().json;\nconst forn = cfgJson(cfg, 'fornecedores', []);\nconst res = zipMcp($('Pede vítimas').all(), $input.all());\nconst fatal = res.find((r) => r.quota || r.auth);\nif (fatal) throw new Error(`Vexday: ${fatal.err}`);\nconst vit = [];\nconst vistos = new Set();\nfor (const r of res) for (const v of (r.data?.results || [])) {\n  const k = `${v.victim}|${v.group_name}|${v.attack_date}`;\n  if (!vistos.has(k)) { vistos.add(k); vit.push(v); }\n}\nconst tok = (s) => normName(s).split(' ').filter((t) => t.length >= 3);\nconst dominioBase = (d) => normName(String(d || '').toLowerCase().replace(/^https?:\\/\\//, '').split('/')[0]).replace(/\\s+/g, '');\n\nfunction casa(v, f) {\n  const nv = normName(v.victim), tv = new Set(tok(v.victim)), nvCompacto = nv.replace(/\\s+/g, '');\n  const nomes = [f.nome, ...(f.apelidos || [])].filter(Boolean);\n  for (const n of nomes) {\n    const nn = normName(n);\n    if (nn.length >= 4 && nn === nv) return { forca: 'exata', por: `nome \"${n}\"` };\n    const tn = tok(n);\n    if (tn.length >= 2 && tn.every((t) => tv.has(t))) return { forca: 'forte', por: `todas as palavras de \"${n}\"` };\n    if (tn.length === 1 && tn[0].length >= 5 && tv.has(tn[0]) && tv.size <= 3) return { forca: 'média', por: `palavra \"${tn[0]}\"` };\n  }\n  const db = dominioBase(f.dominio);\n  if (db && db.length >= 4) {\n    if (nvCompacto === db || String(v.victim).toLowerCase().includes(String(f.dominio).toLowerCase())) return { forca: 'forte', por: `domínio ${f.dominio}` };\n    if (tv.has(db)) return { forca: 'média', por: `palavra do domínio \"${db}\"` };\n  }\n  return null;\n}\n\nconst sd = $getWorkflowStaticData('global');\nsd.avisados = sd.avisados || {};\nconst lim = Date.now() - 60 * 86400000;\nfor (const [k, ts] of Object.entries(sd.avisados)) if (ts < lim) delete sd.avisados[k];\n\nconst achados = [];\nfor (const v of vit) for (const f of forn) {\n  const m = casa(v, f);\n  if (!m) continue;\n  const chave = `${f.nome}|${v.victim}|${v.group_name}|${v.attack_date}`;\n  if (sd.avisados[chave]) continue;\n  achados.push({ chave, fornecedor: f, vitima: v, ...m });\n}\nconst atores = [...new Set(achados.map((a) => a.vitima.actor_id).filter(Boolean))];\nconst reqs = atores.flatMap((id) => [mcpReq('get_actor', { actor_id: id }, { id, k: 'actor' }).json, mcpReq('get_detection_pack', { actor_id: id }, { id, k: 'pack' }).json]);\nreturn [{ json: { achados, reqs, tem: achados.length > 0, analisadas: vit.length } }];\n"
      },
      "id": "9ce806dc-8922-ac23-f055-7b35c1beefd3"
    },
    {
      "name": "Achou?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1120,
        200
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "a88ad4b2-0a7f-2f3a-2ad9-a9f65653f881",
              "leftValue": "={{ $json.tem }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "6e309b47-1779-9ad7-611e-cf48fab8b01f"
    },
    {
      "name": "Perfis e pacotes",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1340,
        100
      ],
      "parameters": {
        "jsCode": "// ===== Vexday templates :: lib comum (injetada no build) =====\n// Texto vindo do Vexday é dado de terceiro: sempre escapado, nunca tratado como instrução.\n\nconst safeJson = (s) => { try { return JSON.parse(s); } catch (e) { return null; } };\nconst num = (x) => (x === null || x === undefined || x === '' || isNaN(Number(x)) ? null : Number(x));\nconst day = (iso) => (iso ? String(iso).slice(0, 10) : null);\nconst pct = (x) => (x === null || x === undefined ? 'n/d' : (x * 100).toFixed(1) + '%');\nconst esc = (s) => String(s ?? '')\n  .replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')\n  .replace(/\"/g, '&quot;').replace(/'/g, '&#39;');\nconst para = (s) => esc(s).replace(/\\r?\\n/g, '<br>');\nconst safeUrl = (u) => (/^https?:\\/\\//i.test(String(u || '')) ? String(u) : '#');\nconst slackEsc = (s) => String(s ?? '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\nconst isoDaysAgo = (n) => new Date(Date.now() - n * 86400000).toISOString().slice(0, 10);\n\n// Lê um campo de texto do Config que deve conter JSON; erro claro se estiver malformado.\nfunction cfgJson(cfg, field, fallback) {\n  const v = cfg[field];\n  if (v === undefined || v === null || v === '') return fallback;\n  if (typeof v === 'object') return v;\n  const p = safeJson(v);\n  if (p === null) throw new Error(`Config: o campo \"${field}\" não é um JSON válido.`);\n  return p;\n}\n\n// Corpo da resposta HTTP: JSON direto ou SSE (usa a última linha \"data:\").\nfunction parseBody(raw) {\n  if (raw === null || raw === undefined) return null;\n  if (typeof raw === 'object') return raw;\n  const s = String(raw).trim();\n  if (s.startsWith('{')) return safeJson(s);\n  const lines = s.split(/\\r?\\n/).filter((l) => l.startsWith('data:'));\n  return lines.length ? safeJson(lines[lines.length - 1].slice(5).trim()) : null;\n}\n\n// Corpo de um HTTP Request com fullResponse (o n8n usa \"data\" no modo texto e \"body\" no JSON).\nconst respText = (j) => (j ? (j.body ?? j.data ?? null) : null);\n\n// Interpreta a saída de um HTTP Request (fullResponse + neverError + text) que chamou tools/call.\n// Retorna { data } ou { err, fatal, toolError }.\nconst RATE_RE = /muitas requisi|too many requests|rate.?limit/i;\nfunction parseMcpResp(resp, tool) {\n  if (!resp) return { err: `${tool} não executou.`, fatal: true };\n  const status = Number(resp.statusCode ?? 0);\n  const body = parseBody(respText(resp));\n  if (status === 401 || body?.error === 'invalid_token')\n    return { err: 'Chave da API do Vexday inválida ou revogada (HTTP 401). Confira a credencial \"Vexday API\".', fatal: true, auth: true };\n  if (status === 403) return { err: `O plano da conta não libera ${tool} (HTTP 403).`, fatal: true };\n  if (status === 429) return { err: 'Limite diário de consultas do Vexday atingido (HTTP 429).', fatal: true, quota: true };\n  if (status >= 400) return { err: `Erro HTTP ${status} ao chamar ${tool}.`, fatal: true };\n  if (!body) return { err: `Resposta ilegível de ${tool}.`, fatal: true };\n  if (body.error) return { err: `Erro em ${tool}: ${body.error.message || JSON.stringify(body.error)}`, fatal: true };\n  const r = body.result || {};\n  const text = r.content?.[0]?.text ?? '';\n  if (r.isError) {\n    const msg = String(text).replace(/^Error executing tool [\\w]+:\\s*/, '');\n    // Limite por minuto: o Vexday devolve como erro da tool com HTTP 200, não 429 (visto em 20/11: \"máx 30/min\").\n    if (RATE_RE.test(msg)) return { err: `Limite por minuto do Vexday atingido em ${tool}: ${msg.slice(0, 160)}`, fatal: true, quota: true, rate: true };\n    return { err: msg, toolError: true };\n  }\n  const data = safeJson(text);\n  if (data === null) return { err: `Resposta inesperada de ${tool}.`, fatal: true };\n  return { data };\n}\n\n// Item de requisição para o nó \"Vexday MCP\". O corpo JSON-RPC vai pronto em \"rpc\":\n// o sandbox de expressões do n8n bloqueia acesso a campos chamados \"arguments\".\nfunction mcpReq(tool, args, ctx) {\n  return { json: { tool, args: args || {}, ctx: ctx ?? null,\n    rpc: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: tool, arguments: args || {} } }) } };\n}\n\n// Junta as requisições preparadas com as respostas do HTTP Request (mesma ordem, 1 para 1).\nfunction zipMcp(reqItems, respItems) {\n  return reqItems.map((rq, i) => {\n    const r = parseMcpResp(respItems[i]?.json, rq.json.tool);\n    return { ...r, tool: rq.json.tool, args: rq.json.args, ctx: rq.json.ctx };\n  });\n}\n\nfunction attributionOf(results) {\n  const names = new Set();\n  for (const r of results) for (const s of (r?.data?.attribution?.sources || [])) names.add(s.name);\n  return [...names];\n}\n\n// Página HTML com CSP rígida no <meta> (sem script). opts.claro = tema claro, mais seguro em e-mail.\nconst CSS_ESCURO = `body{margin:0;background:#0b0b0c;color:#f2f1ee;font:16px/1.55 system-ui,-apple-system,Segoe UI,Roboto,sans-serif}\nmain{max-width:880px;margin:0 auto;padding:32px 20px 64px}\nh1{font-size:26px;margin:0 0 4px}h2{font-size:17px;margin:32px 0 8px;border-top:1px solid #26262a;padding-top:20px}\n.muted{color:#8e8e93}.tag{display:inline-block;padding:2px 10px;border-radius:99px;font-size:13px;font-weight:600;margin-right:6px}\n.crit{background:#ff453a22;color:#ff6b61}.high{background:#ff9f0a22;color:#ffb340}.med{background:#ffd60a22;color:#ffd60a}.low{background:#30d15822;color:#4cd964}\n.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px;margin:16px 0}\n.card{background:#141416;border:1px solid #26262a;border-radius:10px;padding:12px 14px}.card b{display:block;font-size:20px}\ntable{width:100%;border-collapse:collapse;font-size:14px}th,td{text-align:left;padding:7px 8px;border-bottom:1px solid #26262a;vertical-align:top}th{color:#8e8e93;font-weight:600}\na{color:#f96a02}ul{padding-left:20px}li{margin:3px 0}.warn{background:#ff9f0a14;border:1px solid #ff9f0a55;border-radius:10px;padding:10px 14px}\n.err{background:#ff453a14;border:1px solid #ff453a55;border-radius:10px;padding:14px}footer{margin-top:40px;font-size:13px;color:#8e8e93}`;\nconst CSS_CLARO = `body{margin:0;background:#ffffff;color:#1c1c1e;font:15px/1.55 -apple-system,Segoe UI,Roboto,Arial,sans-serif}\nmain{max-width:720px;margin:0 auto;padding:28px 20px 48px}h1{font-size:24px;margin:0 0 4px}\nh2{font-size:16px;margin:28px 0 8px;border-top:1px solid #e5e5ea;padding-top:18px}.muted{color:#6e6e73}\ntable{width:100%;border-collapse:collapse;font-size:14px}th,td{text-align:left;padding:7px 8px;border-bottom:1px solid #e5e5ea;vertical-align:top}th{color:#6e6e73;font-weight:600}\na{color:#c2410c}ul{padding-left:20px}li{margin:3px 0}.warn{background:#fff4e5;border:1px solid #f5c27a;border-radius:8px;padding:10px 14px}\nfooter{margin-top:36px;font-size:12px;color:#6e6e73}`;\nfunction page(title, inner, opts) {\n  const claro = !!(opts && opts.claro);\n  const bodyStyle = claro ? ' style=\"margin:0;background:#ffffff;color:#1c1c1e\"' : '';\n  return `<!DOCTYPE html><html lang=\"pt-BR\"><head><meta charset=\"utf-8\">\n<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none'; style-src 'unsafe-inline'; img-src https: data:\">\n<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><title>${esc(title)}</title>\n<style>${claro ? CSS_CLARO : CSS_ESCURO}</style></head><body${bodyStyle}><main>${inner}</main></body></html>`;\n}\n\n// ---------- notificações ----------\n// canais: [{ \"tipo\": \"discord|slack|teams|json\", \"url\": \"https://...\", \"tags\": [\"cliente-acme\"] (opcional) }]\n// msg: { titulo, linhas: [string], url, nivel: 0..3, rodape }\n// Retorna itens prontos para um HTTP Request genérico: { url, body }.\nconst NIVEL_TAG = ['[BAIXA]', '[MÉDIA]', '[ALTA]', '[CRÍTICA]'];\nconst NIVEL_TEAMS = ['Good', 'Default', 'Warning', 'Attention'];\nconst NIVEL_COR = ['2ECC71', 'F1C40F', 'E67E22', 'E74C3C'];\n\nfunction canaisPara(canais, tags) {\n  const ts = (tags && tags.length) ? tags : [];\n  return (canais || []).filter((c) => {\n    if (!/^https:\\/\\//i.test(String(c.url || '')) && !/^http:\\/\\/(127\\.0\\.0\\.1|localhost)(:\\d+)?\\//i.test(String(c.url || ''))) return false; // http só local\n    if (!c.tags || !c.tags.length) return true;           // canal geral recebe tudo\n    return ts.some((t) => c.tags.includes(t));            // canal de cliente só recebe o cliente\n  });\n}\n\nfunction buildNotify(canais, msg, tags) {\n  const nivel = Math.max(0, Math.min(3, msg.nivel ?? 0));\n  const out = [];\n  for (const c of canaisPara(canais, tags)) {\n    const tipo = String(c.tipo || 'json').toLowerCase();\n    let body;\n    if (tipo === 'discord') {\n      const txt = [`**${NIVEL_TAG[nivel]} ${msg.titulo}**`, ...(msg.linhas || []), msg.url || '', msg.rodape ? `-# ${msg.rodape}` : '']\n        .filter(Boolean).join('\\n');\n      body = { content: txt.slice(0, 1990), allowed_mentions: { parse: [] } };\n    } else if (tipo === 'slack') {\n      const txt = [`*${NIVEL_TAG[nivel]} ${slackEsc(msg.titulo)}*`, ...(msg.linhas || []).map(slackEsc),\n        msg.url ? `<${msg.url}|Abrir>` : '', msg.rodape ? `_${slackEsc(msg.rodape)}_` : ''].filter(Boolean).join('\\n');\n      body = { text: txt.slice(0, 39000) };\n    } else if (tipo === 'teams') {\n      // Webhook de Workflows do Teams (Power Automate) com Adaptive Card.\n      const items = [\n        { type: 'TextBlock', text: `${NIVEL_TAG[nivel]} ${msg.titulo}`, color: NIVEL_TEAMS[nivel], weight: 'Bolder', size: 'Medium', wrap: true },\n        ...(msg.linhas || []).map((l) => ({ type: 'TextBlock', text: l, wrap: true, spacing: 'Small' })),\n      ];\n      if (msg.rodape) items.push({ type: 'TextBlock', text: msg.rodape, isSubtle: true, size: 'Small', wrap: true });\n      const card = { $schema: 'http://adaptivecards.io/schemas/adaptive-card.json', type: 'AdaptiveCard', version: '1.4', body: items };\n      if (msg.url) card.actions = [{ type: 'Action.OpenUrl', title: 'Abrir', url: msg.url }];\n      body = { type: 'message', attachments: [{ contentType: 'application/vnd.microsoft.card.adaptive', content: card }] };\n    } else {\n      body = { titulo: msg.titulo, linhas: msg.linhas || [], url: msg.url || null, nivel, tags: tags || [], rodape: msg.rodape || null };\n    }\n    out.push({ url: c.url, tipo, body });\n  }\n  return out;\n}\n\n// ---------- normalização de nomes (fornecedores x vítimas) ----------\nconst LEGAL = /\\b(ltda|ltd|eireli|me|epp|s\\.?\\s?a\\.?|sa|inc|incorporated|corp|corporation|co|company|cia|companhia|llc|plc|gmbh|ag|bv|nv|srl|spa|group|grupo|holding|holdings)\\b/g;\nfunction normName(s) {\n  return String(s || '')\n    .normalize('NFD').replace(/[̀-ͯ]/g, '')\n    .toLowerCase()\n    .replace(/^https?:\\/\\//, '').replace(/^www\\./, '')\n    .replace(/\\.(com|net|org|gov|edu|io|co)(\\.[a-z]{2})?$/, '').replace(/\\.[a-z]{2}$/, '')\n    .replace(/[^a-z0-9 ]+/g, ' ')\n    .replace(LEGAL, ' ')\n    .replace(/\\s+/g, ' ').trim();\n}\n\n// Comparação de tempo constante para hex (HMAC).\nfunction timingSafeEqualHex(a, b) {\n  a = String(a || ''); b = String(b || '');\n  let diff = a.length ^ b.length;\n  const n = Math.max(a.length, b.length);\n  for (let i = 0; i < n; i++) diff |= (a.charCodeAt(i) || 0) ^ (b.charCodeAt(i) || 0);\n  return diff === 0;\n}\n// ===== fim da lib =====\n\nreturn $input.first().json.reqs.map((r) => ({ json: r }));\n"
      },
      "id": "fa219976-defa-445d-f785-c43ef9851a26"
    },
    {
      "name": "Vexday MCP ator",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1560,
        100
      ],
      "parameters": {
        "method": "POST",
        "url": "={{ $('Config').first().json.vexday_mcp_url }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json, text/event-stream"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ $json.rpc }}",
        "options": {
          "timeout": 45000,
          "batching": {
            "batch": {
              "batchSize": 1,
              "batchInterval": 2200
            }
          },
          "response": {
            "response": {
              "fullResponse": true,
              "neverError": true,
              "responseFormat": "text"
            }
          }
        }
      },
      "id": "ff23e7ac-c3de-004a-7157-1ab8c0846bf0"
    },
    {
      "name": "Monta alerta",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1780,
        100
      ],
      "parameters": {
        "jsCode": "// ===== Vexday templates :: lib comum (injetada no build) =====\n// Texto vindo do Vexday é dado de terceiro: sempre escapado, nunca tratado como instrução.\n\nconst safeJson = (s) => { try { return JSON.parse(s); } catch (e) { return null; } };\nconst num = (x) => (x === null || x === undefined || x === '' || isNaN(Number(x)) ? null : Number(x));\nconst day = (iso) => (iso ? String(iso).slice(0, 10) : null);\nconst pct = (x) => (x === null || x === undefined ? 'n/d' : (x * 100).toFixed(1) + '%');\nconst esc = (s) => String(s ?? '')\n  .replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')\n  .replace(/\"/g, '&quot;').replace(/'/g, '&#39;');\nconst para = (s) => esc(s).replace(/\\r?\\n/g, '<br>');\nconst safeUrl = (u) => (/^https?:\\/\\//i.test(String(u || '')) ? String(u) : '#');\nconst slackEsc = (s) => String(s ?? '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\nconst isoDaysAgo = (n) => new Date(Date.now() - n * 86400000).toISOString().slice(0, 10);\n\n// Lê um campo de texto do Config que deve conter JSON; erro claro se estiver malformado.\nfunction cfgJson(cfg, field, fallback) {\n  const v = cfg[field];\n  if (v === undefined || v === null || v === '') return fallback;\n  if (typeof v === 'object') return v;\n  const p = safeJson(v);\n  if (p === null) throw new Error(`Config: o campo \"${field}\" não é um JSON válido.`);\n  return p;\n}\n\n// Corpo da resposta HTTP: JSON direto ou SSE (usa a última linha \"data:\").\nfunction parseBody(raw) {\n  if (raw === null || raw === undefined) return null;\n  if (typeof raw === 'object') return raw;\n  const s = String(raw).trim();\n  if (s.startsWith('{')) return safeJson(s);\n  const lines = s.split(/\\r?\\n/).filter((l) => l.startsWith('data:'));\n  return lines.length ? safeJson(lines[lines.length - 1].slice(5).trim()) : null;\n}\n\n// Corpo de um HTTP Request com fullResponse (o n8n usa \"data\" no modo texto e \"body\" no JSON).\nconst respText = (j) => (j ? (j.body ?? j.data ?? null) : null);\n\n// Interpreta a saída de um HTTP Request (fullResponse + neverError + text) que chamou tools/call.\n// Retorna { data } ou { err, fatal, toolError }.\nconst RATE_RE = /muitas requisi|too many requests|rate.?limit/i;\nfunction parseMcpResp(resp, tool) {\n  if (!resp) return { err: `${tool} não executou.`, fatal: true };\n  const status = Number(resp.statusCode ?? 0);\n  const body = parseBody(respText(resp));\n  if (status === 401 || body?.error === 'invalid_token')\n    return { err: 'Chave da API do Vexday inválida ou revogada (HTTP 401). Confira a credencial \"Vexday API\".', fatal: true, auth: true };\n  if (status === 403) return { err: `O plano da conta não libera ${tool} (HTTP 403).`, fatal: true };\n  if (status === 429) return { err: 'Limite diário de consultas do Vexday atingido (HTTP 429).', fatal: true, quota: true };\n  if (status >= 400) return { err: `Erro HTTP ${status} ao chamar ${tool}.`, fatal: true };\n  if (!body) return { err: `Resposta ilegível de ${tool}.`, fatal: true };\n  if (body.error) return { err: `Erro em ${tool}: ${body.error.message || JSON.stringify(body.error)}`, fatal: true };\n  const r = body.result || {};\n  const text = r.content?.[0]?.text ?? '';\n  if (r.isError) {\n    const msg = String(text).replace(/^Error executing tool [\\w]+:\\s*/, '');\n    // Limite por minuto: o Vexday devolve como erro da tool com HTTP 200, não 429 (visto em 20/11: \"máx 30/min\").\n    if (RATE_RE.test(msg)) return { err: `Limite por minuto do Vexday atingido em ${tool}: ${msg.slice(0, 160)}`, fatal: true, quota: true, rate: true };\n    return { err: msg, toolError: true };\n  }\n  const data = safeJson(text);\n  if (data === null) return { err: `Resposta inesperada de ${tool}.`, fatal: true };\n  return { data };\n}\n\n// Item de requisição para o nó \"Vexday MCP\". O corpo JSON-RPC vai pronto em \"rpc\":\n// o sandbox de expressões do n8n bloqueia acesso a campos chamados \"arguments\".\nfunction mcpReq(tool, args, ctx) {\n  return { json: { tool, args: args || {}, ctx: ctx ?? null,\n    rpc: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: tool, arguments: args || {} } }) } };\n}\n\n// Junta as requisições preparadas com as respostas do HTTP Request (mesma ordem, 1 para 1).\nfunction zipMcp(reqItems, respItems) {\n  return reqItems.map((rq, i) => {\n    const r = parseMcpResp(respItems[i]?.json, rq.json.tool);\n    return { ...r, tool: rq.json.tool, args: rq.json.args, ctx: rq.json.ctx };\n  });\n}\n\nfunction attributionOf(results) {\n  const names = new Set();\n  for (const r of results) for (const s of (r?.data?.attribution?.sources || [])) names.add(s.name);\n  return [...names];\n}\n\n// Página HTML com CSP rígida no <meta> (sem script). opts.claro = tema claro, mais seguro em e-mail.\nconst CSS_ESCURO = `body{margin:0;background:#0b0b0c;color:#f2f1ee;font:16px/1.55 system-ui,-apple-system,Segoe UI,Roboto,sans-serif}\nmain{max-width:880px;margin:0 auto;padding:32px 20px 64px}\nh1{font-size:26px;margin:0 0 4px}h2{font-size:17px;margin:32px 0 8px;border-top:1px solid #26262a;padding-top:20px}\n.muted{color:#8e8e93}.tag{display:inline-block;padding:2px 10px;border-radius:99px;font-size:13px;font-weight:600;margin-right:6px}\n.crit{background:#ff453a22;color:#ff6b61}.high{background:#ff9f0a22;color:#ffb340}.med{background:#ffd60a22;color:#ffd60a}.low{background:#30d15822;color:#4cd964}\n.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px;margin:16px 0}\n.card{background:#141416;border:1px solid #26262a;border-radius:10px;padding:12px 14px}.card b{display:block;font-size:20px}\ntable{width:100%;border-collapse:collapse;font-size:14px}th,td{text-align:left;padding:7px 8px;border-bottom:1px solid #26262a;vertical-align:top}th{color:#8e8e93;font-weight:600}\na{color:#f96a02}ul{padding-left:20px}li{margin:3px 0}.warn{background:#ff9f0a14;border:1px solid #ff9f0a55;border-radius:10px;padding:10px 14px}\n.err{background:#ff453a14;border:1px solid #ff453a55;border-radius:10px;padding:14px}footer{margin-top:40px;font-size:13px;color:#8e8e93}`;\nconst CSS_CLARO = `body{margin:0;background:#ffffff;color:#1c1c1e;font:15px/1.55 -apple-system,Segoe UI,Roboto,Arial,sans-serif}\nmain{max-width:720px;margin:0 auto;padding:28px 20px 48px}h1{font-size:24px;margin:0 0 4px}\nh2{font-size:16px;margin:28px 0 8px;border-top:1px solid #e5e5ea;padding-top:18px}.muted{color:#6e6e73}\ntable{width:100%;border-collapse:collapse;font-size:14px}th,td{text-align:left;padding:7px 8px;border-bottom:1px solid #e5e5ea;vertical-align:top}th{color:#6e6e73;font-weight:600}\na{color:#c2410c}ul{padding-left:20px}li{margin:3px 0}.warn{background:#fff4e5;border:1px solid #f5c27a;border-radius:8px;padding:10px 14px}\nfooter{margin-top:36px;font-size:12px;color:#6e6e73}`;\nfunction page(title, inner, opts) {\n  const claro = !!(opts && opts.claro);\n  const bodyStyle = claro ? ' style=\"margin:0;background:#ffffff;color:#1c1c1e\"' : '';\n  return `<!DOCTYPE html><html lang=\"pt-BR\"><head><meta charset=\"utf-8\">\n<meta http-equiv=\"Content-Security-Policy\" content=\"default-src 'none'; style-src 'unsafe-inline'; img-src https: data:\">\n<meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><title>${esc(title)}</title>\n<style>${claro ? CSS_CLARO : CSS_ESCURO}</style></head><body${bodyStyle}><main>${inner}</main></body></html>`;\n}\n\n// ---------- notificações ----------\n// canais: [{ \"tipo\": \"discord|slack|teams|json\", \"url\": \"https://...\", \"tags\": [\"cliente-acme\"] (opcional) }]\n// msg: { titulo, linhas: [string], url, nivel: 0..3, rodape }\n// Retorna itens prontos para um HTTP Request genérico: { url, body }.\nconst NIVEL_TAG = ['[BAIXA]', '[MÉDIA]', '[ALTA]', '[CRÍTICA]'];\nconst NIVEL_TEAMS = ['Good', 'Default', 'Warning', 'Attention'];\nconst NIVEL_COR = ['2ECC71', 'F1C40F', 'E67E22', 'E74C3C'];\n\nfunction canaisPara(canais, tags) {\n  const ts = (tags && tags.length) ? tags : [];\n  return (canais || []).filter((c) => {\n    if (!/^https:\\/\\//i.test(String(c.url || '')) && !/^http:\\/\\/(127\\.0\\.0\\.1|localhost)(:\\d+)?\\//i.test(String(c.url || ''))) return false; // http só local\n    if (!c.tags || !c.tags.length) return true;           // canal geral recebe tudo\n    return ts.some((t) => c.tags.includes(t));            // canal de cliente só recebe o cliente\n  });\n}\n\nfunction buildNotify(canais, msg, tags) {\n  const nivel = Math.max(0, Math.min(3, msg.nivel ?? 0));\n  const out = [];\n  for (const c of canaisPara(canais, tags)) {\n    const tipo = String(c.tipo || 'json').toLowerCase();\n    let body;\n    if (tipo === 'discord') {\n      const txt = [`**${NIVEL_TAG[nivel]} ${msg.titulo}**`, ...(msg.linhas || []), msg.url || '', msg.rodape ? `-# ${msg.rodape}` : '']\n        .filter(Boolean).join('\\n');\n      body = { content: txt.slice(0, 1990), allowed_mentions: { parse: [] } };\n    } else if (tipo === 'slack') {\n      const txt = [`*${NIVEL_TAG[nivel]} ${slackEsc(msg.titulo)}*`, ...(msg.linhas || []).map(slackEsc),\n        msg.url ? `<${msg.url}|Abrir>` : '', msg.rodape ? `_${slackEsc(msg.rodape)}_` : ''].filter(Boolean).join('\\n');\n      body = { text: txt.slice(0, 39000) };\n    } else if (tipo === 'teams') {\n      // Webhook de Workflows do Teams (Power Automate) com Adaptive Card.\n      const items = [\n        { type: 'TextBlock', text: `${NIVEL_TAG[nivel]} ${msg.titulo}`, color: NIVEL_TEAMS[nivel], weight: 'Bolder', size: 'Medium', wrap: true },\n        ...(msg.linhas || []).map((l) => ({ type: 'TextBlock', text: l, wrap: true, spacing: 'Small' })),\n      ];\n      if (msg.rodape) items.push({ type: 'TextBlock', text: msg.rodape, isSubtle: true, size: 'Small', wrap: true });\n      const card = { $schema: 'http://adaptivecards.io/schemas/adaptive-card.json', type: 'AdaptiveCard', version: '1.4', body: items };\n      if (msg.url) card.actions = [{ type: 'Action.OpenUrl', title: 'Abrir', url: msg.url }];\n      body = { type: 'message', attachments: [{ contentType: 'application/vnd.microsoft.card.adaptive', content: card }] };\n    } else {\n      body = { titulo: msg.titulo, linhas: msg.linhas || [], url: msg.url || null, nivel, tags: tags || [], rodape: msg.rodape || null };\n    }\n    out.push({ url: c.url, tipo, body });\n  }\n  return out;\n}\n\n// ---------- normalização de nomes (fornecedores x vítimas) ----------\nconst LEGAL = /\\b(ltda|ltd|eireli|me|epp|s\\.?\\s?a\\.?|sa|inc|incorporated|corp|corporation|co|company|cia|companhia|llc|plc|gmbh|ag|bv|nv|srl|spa|group|grupo|holding|holdings)\\b/g;\nfunction normName(s) {\n  return String(s || '')\n    .normalize('NFD').replace(/[̀-ͯ]/g, '')\n    .toLowerCase()\n    .replace(/^https?:\\/\\//, '').replace(/^www\\./, '')\n    .replace(/\\.(com|net|org|gov|edu|io|co)(\\.[a-z]{2})?$/, '').replace(/\\.[a-z]{2}$/, '')\n    .replace(/[^a-z0-9 ]+/g, ' ')\n    .replace(LEGAL, ' ')\n    .replace(/\\s+/g, ' ').trim();\n}\n\n// Comparação de tempo constante para hex (HMAC).\nfunction timingSafeEqualHex(a, b) {\n  a = String(a || ''); b = String(b || '');\n  let diff = a.length ^ b.length;\n  const n = Math.max(a.length, b.length);\n  for (let i = 0; i < n; i++) diff |= (a.charCodeAt(i) || 0) ^ (b.charCodeAt(i) || 0);\n  return diff === 0;\n}\n// ===== fim da lib =====\n\n// Monta o alerta de terceiro comprometido com perfil do grupo, pacote de detecção e playbook.\nconst cfg = $('Config').first().json;\nconst canais = cfgJson(cfg, 'canais', []);\nconst base = $('Casa fornecedores').first().json;\nconst res = zipMcp($('Perfis e pacotes').all(), $input.all());\nconst info = {};\nfor (const r of res) { info[r.ctx.id] = info[r.ctx.id] || {}; info[r.ctx.id][r.ctx.k] = r.data?.data || null; if (r.err) info[r.ctx.id][r.ctx.k + '_err'] = r.err; }\n\nconst PLAYBOOK = [\n  'Confirme com o fornecedor por um canal já conhecido (nunca pelo contato que chegar junto com a notícia).',\n  'Revise e restrinja os acessos dele: VPN, contas de serviço, chaves de API, integrações e SSO federado.',\n  'Troque credenciais e segredos compartilhados com o fornecedor.',\n  'Aumente a monitoração de logins e tráfego vindos dele e cace os IOCs do pacote de detecção.',\n  'Levante quais dados seus estão com ele. Se houver dado pessoal exposto, avalie a comunicação à ANPD e aos titulares (LGPD).',\n  'Avise os usuários sobre phishing se passando pelo fornecedor.',\n];\nconst sd = $getWorkflowStaticData('global');\nsd.avisados = sd.avisados || {};\nconst out = [];\nfor (const a of base.achados) {\n  const v = a.vitima, f = a.fornecedor, i = info[v.actor_id] || {};\n  const ac = i.actor || {}, pk = i.pack || {};\n  const iocs = pk.iocs || [];\n  const porTipo = Object.entries(iocs.filter((x) => !x.restricted).reduce((m, x) => { m[x.type || 'outro'] = (m[x.type || 'outro'] || 0) + 1; return m; }, {}));\n  const restritos = iocs.filter((x) => x.restricted).length;\n  // Vítima sem actor_id (2 de 15 na coleta de 20/11): o pacote nem é consultado, então \"vazio\" seria falso.\n  const linhaPacote = !v.actor_id ? 'Pacote de detecção: não consultado (grupo sem perfil vinculado no Vexday).'\n    : i.pack_err ? `Pacote de detecção: a consulta falhou (${i.pack_err}).`\n    : (!(pk.yara || []).length && !iocs.length) ? 'Pacote de detecção: ainda vazio para este grupo no Vexday.'\n    : `Pacote de detecção: ${(pk.yara || []).length} regra(s) YARA, ${iocs.length - restritos} indicador(es)${porTipo.length ? ' (' + porTipo.map(([t, n]) => `${n} ${t}`).join(', ') + ')' : ''}${restritos ? ` + ${restritos} restrito(s) só no Vexday` : ''}`;\n  // TTPs de acesso inicial do grupo (TA0001, do get_actor que já foi consultado: custo zero)\n  const ini = (ac.rwl?.ttps || []).filter((t) => t.tactic_id === 'TA0001' || /initial access|acesso inicial/i.test(t.tactic_name || ''))\n    .flatMap((t) => t.techniques || []).filter((t) => t.technique_id);\n  const tIni = [...new Map(ini.map((t) => [t.technique_id, `${t.technique_id} ${t.technique_name || ''}`.trim()])).values()].slice(0, 6);\n  const passoIni = !v.actor_id ? null\n    : i.actor_err ? `Acesso inicial do grupo: a consulta do perfil falhou (${i.actor_err}).`\n    : tIni.length ? `Reforce a defesa contra o acesso inicial que o grupo usa (MITRE ATT&CK): ${tIni.join('; ')}.`\n    : 'Acesso inicial do grupo: sem TTP registrada no Vexday.';\n  const pb = [...PLAYBOOK.slice(0, 2), ...(passoIni ? [passoIni] : []), ...PLAYBOOK.slice(2)];\n  const linhas = [\n    `Fornecedor: ${f.nome} · vítima listada como \"${v.victim}\" (casamento ${a.forca}, por ${a.por})`,\n    `Grupo: ${v.group_name || 'não informado'}${ac.rwl?.victims ? ` · ${ac.rwl.victims} vítimas no total` : ''}${ac.victims_br ? ` · ${ac.victims_br} no Brasil` : ''}${(ac.leak_sites || [])[0]?.status ? ` · leak site ${(ac.leak_sites || [])[0].status}` : ''}`,\n    `Data do ataque: ${v.attack_date || 'n/d'} · descoberto ${day(v.discovered) || 'n/d'} · setor ${v.sector || 'n/d'} · país ${v.country || 'n/d'}`,\n    linhaPacote,\n    'É alegação do grupo, não confirmação do fornecedor.',\n    'Playbook:', ...pb.map((p, k) => `${k + 1}. ${p}`),\n  ];\n  out.push(...buildNotify(canais, { titulo: `Fornecedor possivelmente comprometido: ${f.nome}`, linhas,\n    url: ac.rwl?.url && /^https:\\/\\//.test(ac.rwl.url) ? ac.rwl.url : null, nivel: a.forca === 'média' ? 2 : 3, rodape: 'Vexday | T05' }, f.clientes || []));\n  sd.avisados[a.chave] = Date.now();\n}\nreturn out.map((n) => ({ json: n }));\n"
      },
      "id": "cd43307b-8b8a-8b3c-db7a-177c4dab1f68"
    },
    {
      "name": "Envia notificações",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        2000,
        100
      ],
      "parameters": {
        "method": "POST",
        "url": "={{ $json.url }}",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json.body) }}",
        "options": {
          "timeout": 15000,
          "batching": {
            "batch": {
              "batchSize": 1,
              "batchInterval": 400
            }
          },
          "response": {
            "response": {
              "fullResponse": true,
              "neverError": true,
              "responseFormat": "text"
            }
          }
        }
      },
      "id": "0cf480b6-203c-96ca-2a4d-a491b56f86c5"
    },
    {
      "name": "Leia-me",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -480,
        -360
      ],
      "parameters": {
        "content": "## Vexday | T05 - Fornecedor comprometido\n\nA cada 4 horas, compara as vítimas recentes em sites de extorsão de ransomware (mundo todo) com a sua lista de fornecedores. Quando um aparece, avisa com o perfil do grupo, o pacote de detecção (YARA e IOCs para caçar no ambiente) e um playbook de terceiro comprometido.\n\nO seu próprio domínio o Vexday já vigia nativamente (alerta `domain_ransomware`). Este fluxo cobre a cadeia de fornecedores.\n\n### Setup\n1. Credencial `Vexday API` (Header Auth): Name `Authorization`, Value `Bearer vx_live_SUA_CHAVE` (painel do Vexday → Integrações). Selecione em todo nó `Vexday MCP`.\n2. Credencial Basic Auth no webhook `Executar agora`.\n3. Preencha `fornecedores` e `canais` e ative.\n\nPlano: SOC/MSSP\nCusto: 3 consultas por rodada (18 por dia) + 2 por grupo encontrado",
        "width": 440,
        "height": 500
      },
      "id": "b5936808-ed0d-009e-61af-94ff12525c03"
    },
    {
      "name": "Ajuda do Config",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        200,
        -520
      ],
      "parameters": {
        "content": "### Config\n`fornecedores`:\n```json\n[{\"nome\":\"Acme Logística Ltda\",\n  \"apelidos\":[\"Acme Log\"],\n  \"dominio\":\"acmelog.com.br\",\n  \"clientes\":[\"cliente-x\"]}]\n```\n`clientes` (opcional) roteia o aviso para os canais desses clientes.\n\nO casamento ignora acento, caixa e sufixos (Ltda, S.A., Inc…). Nome de uma palavra só precisa ter 5+ letras. Cada achado é avisado uma vez.\n\n`canais`: lista JSON de destinos. Ex.:\n```json\n[{\"tipo\":\"discord\",\"url\":\"https://discord.com/api/webhooks/...\"},\n {\"tipo\":\"teams\",\"url\":\"https://...logic.azure.com/...\",\"tags\":[\"cliente-acme\"]}]\n```\nTipos: `discord`, `slack`, `teams` (webhook de Workflows), `json`. Com `tags`, o canal só recebe aquele cliente.",
        "width": 460,
        "height": 470,
        "color": 5
      },
      "id": "94f93283-055a-8253-6454-61da8c344ef3"
    }
  ],
  "connections": {
    "A cada 4 horas": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Executar agora (POST)": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Config": {
      "main": [
        [
          {
            "node": "Pede vítimas",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pede vítimas": {
      "main": [
        [
          {
            "node": "Vexday MCP vítimas",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Vexday MCP vítimas": {
      "main": [
        [
          {
            "node": "Casa fornecedores",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Casa fornecedores": {
      "main": [
        [
          {
            "node": "Achou?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Achou?": {
      "main": [
        [
          {
            "node": "Perfis e pacotes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Perfis e pacotes": {
      "main": [
        [
          {
            "node": "Vexday MCP ator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Vexday MCP ator": {
      "main": [
        [
          {
            "node": "Monta alerta",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Monta alerta": {
      "main": [
        [
          {
            "node": "Envia notificações",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}
