function resolve_trade_from_row(e){if(!e)return null;let t=null;try{t=angular?.element(e)?.scope?.()||angular?.element(e)?.isolateScope?.()}catch{}return t?.trade||t?.$parent?.trade||t?.$parent?.$parent?.trade||null}function parse_trade_time_value(e){if(null==e||""===e)return 0;let t="number"==typeof e||"string"==typeof e&&/^\d+(\.\d+)?$/.test(e.trim()),r=t?Number(e):new Date(e).getTime();return t&&r>0&&r<1e10&&(r*=1e3),Number.isFinite(r)&&r>0?r:0}function get_trade_time_from_object(e){if(!e||"object"!=typeof e)return 0;let t=["completed","completedAt","completedTime","completedUtc","completedDate","completedOn","updated","updatedAt","updatedTime","updatedUtc","modified","modifiedAt","created","createdAt","createdTime","createdUtc","createdDate","createdOn","date","dateCreated","timestamp","tradeStatusDate"];for(let r of t){let t=parse_trade_time_value(e[r]);if(t>0)return t}return 0}function assign_trade_row_meta(e,t){let r=get_trade_time_from_object(t);r>0&&e.setAttribute("data-nte-trade-time",String(r))}document.addEventListener("nru_add_trade_id_to_row",e=>{let t=e.detail,r=t;if("string"==typeof t)try{r=JSON.parse(t)}catch(e){r=t}let a=Number("object"==typeof r&&null!==r?r.index:r),d="object"==typeof r&&null!==r?r.token:null;if(!Number.isInteger(a)||a<0)return;let n=0;!function e(){let t=d&&document.querySelector(`[data-nru-row-token="${d}"]`)||document.querySelectorAll(".trade-row")[a];if(!t)return;let r=resolve_trade_from_row(t)||{id:t.getAttribute("data-trade-id")||t.dataset.tradeId};if(r?.id)return t.setAttribute("nruTradeId",String(r.id)),assign_trade_row_meta(t,r),void t.removeAttribute("data-nru-row-token");t.removeAttribute("nruTradeId"),++n<20?setTimeout(e,100):t.removeAttribute("data-nru-row-token")}()});