javascript:!function(){if(window._heidiTabStop)return;function e(){return document.querySelector(".tiptap.ProseMirror")}function t(e){const t=window.getSelection();return!(!t||0===t.rangeCount)&&e.contains(t.getRangeAt(0).commonAncestorContainer)}function n(e){const t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null),n=[];let o;for(;o=t.nextNode();)n.push(o);return n}function o(e){const t=[];let n="";for(const o of e)t.push(n.length),n+=o.textContent;return{str:n,pos:t}}function r(e,t,n){for(let o=e.length-1;o>=0;o--)if(n>=t[o])return{node:e[o],offset:n-t[o]};return{node:e[0],offset:0}}function s(e,t){const n=window.getSelection();if(!n||0===n.rangeCount)return 0;const o=n.getRangeAt(0),r=e.indexOf(o.startContainer);return r>=0?t[r]+o.startOffset:0}function i(e){const t=[];let n=0;for(;n<e.length;)if("["===e[n]){let o=1,r=n+1;for(;r<e.length&&o>0;)"["===e[r]?o++:"]"===e[r]&&o--,r++;0===o?(t.push({open:n,close:r-1}),n=r):n++}else n++;return t}function c(){const t=e();return t?i(o(n(t)).str).length:0}function a(){const e=document.getElementById("_heidiTabBadge");if(!e)return;const t=c();0===t?(e.innerHTML="⌨️",e.style.background="#6b78ff"):e.innerHTML='⌨️<span style="position:absolute;top:-5px;right:-5px;background:#e53e3e;color:#fff;border-radius:10px;font-size:10px;font-weight:700;min-width:18px;height:18px;display:flex;align-items:center;justify-content:center;padding:0 4px;font-family:system-ui,sans-serif;">'+t+"</span>"}function d(){const t=e();if(!t)return;const s=function(){const e=Array.from(document.querySelectorAll("button")).find(e=>e.querySelector("svg.lucide-calendar"));if(!e)return null;const t=e.textContent.trim(),n=t.match(/(\d{1,2}):(\d{2})(AM|PM)/i);if(!n)return null;let o=parseInt(n[1],10);const r=n[2],s=n[3].toUpperCase();"PM"===s&&12!==o&&(o+=12),"AM"===s&&12===o&&(o=0);const i=String(o).padStart(2,"0")+r;let c;if(/^Today/i.test(t))c=(a=new Date).getDate()+" "+["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][a.getMonth()]+" "+a.getFullYear();else{const e=t.match(/(\d{1,2})\s+(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+(\d{4})/i);c=e?e[1]+" "+e[2]+" "+e[3]:null}var a;return c?i+", "+c:null}();if(!s)return;const c=o(n(t)),d=i(c.str),f=function(e,t){const n=e.indexOf("ER @");if(-1===n)return null;const o=n+4;return t.find(e=>e.open>=o&&e.open<=o+1)||null}(c.str,d);f&&(!function(t,s,i){const c=e(),a=n(c),d=r(a,o(a).pos,s),f=document.createRange();f.setStart(d.node,d.offset),f.setEnd(d.node,d.offset+1),f.deleteContents();const l=n(c),u=r(l,o(l).pos,t),p=document.createRange();p.setStart(u.node,u.offset),p.setEnd(u.node,u.offset+1),p.deleteContents();const g=n(c),m=r(g,o(g).pos,t),h=document.createTextNode(i),b=document.createRange();b.setStart(m.node,m.offset),b.collapse(!0),b.insertNode(h);const x=window.getSelection(),y=document.createRange();y.setStartAfter(h),y.collapse(!0),x.removeAllRanges(),x.addRange(y),c.dispatchEvent(new Event("input",{bubbles:!0}))}(f.open,f.close,s),setTimeout(a,50))}function f(e){e.target.closest("button:has(.lucide-copy)")&&c()>0&&(e.preventDefault(),e.stopPropagation(),function(e,t){const n=document.createElement("div");n.textContent=e,n.style.cssText="position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:"+t+";color:#fff;padding:8px 18px;border-radius:20px;font-size:13px;font-family:system-ui,sans-serif;font-weight:600;z-index:99999;box-shadow:0 2px 12px rgba(0,0,0,0.25);opacity:1;transition:opacity 0.5s ease;pointer-events:none;",document.body.appendChild(n),setTimeout(()=>{n.style.opacity="0",setTimeout(()=>n.remove(),500)},2500)}("⚠️ Unfilled fields remaining -- complete all [ ] before copying","#e53e3e"))}function l(c){if(c.ctrlKey&&c.shiftKey&&"D"===c.key)return c.preventDefault(),c.stopPropagation(),void d();if("Tab"===c.key){const d=e();if(!d||!t(d))return;const f=n(d);if(!f.length)return;const{str:l,pos:u}=o(f),p=i(l);if(!p.length)return;let g=null;if(c.shiftKey){const e=s(f,u);if(e<=0)g=p[p.length-1];else for(let t=p.length-1;t>=0;t--)if(p[t].open<e){g=p[t];break}}else{const e=s(f,u);if(e<=0)g=p[0];else for(let t=0;t<p.length;t++)if(p[t].open>=e){g=p[t];break}g||(g=p[0])}if(!g)return;c.preventDefault(),c.stopPropagation(),function(e,t,n,o){const s=r(e,t,n),i=r(e,t,o),c=document.createRange();c.setStart(i.node,i.offset),c.setEnd(i.node,i.offset+1),c.deleteContents();const a=document.createRange();a.setStart(s.node,s.offset),a.setEnd(s.node,s.offset+1),a.deleteContents();const d=window.getSelection(),f=document.createRange();f.setStart(s.node,s.offset),s.node===i.node?f.setEnd(s.node,s.offset+(o-n-1)):f.setEnd(i.node,i.offset),d.removeAllRanges(),d.addRange(f)}(f,u,g.open,g.close),setTimeout(a,50)}else if("Enter"===c.key){const n=e();if(!n||!t(n))return;!function(){if(!e())return;const t=window.getSelection();if(!t||0===t.rangeCount)return;const n=t.getRangeAt(0);if(!n.collapsed)return;const o=n.startContainer;if(o.nodeType!==Node.TEXT_NODE)return;const r=n.startOffset,s=o.nodeValue,i=s.slice(0,r).match(/(\.[a-zA-Z][a-zA-Z0-9]*)$/);if(!i)return;const c=i[1],a=r-c.length;o.nodeValue=s.slice(0,a)+"/"+c.slice(1)+s.slice(r);const d=document.createRange();d.setStart(o,a+c.length),d.collapse(!0),t.removeAllRanges(),t.addRange(d)}()}}document.addEventListener("keydown",l,!0),document.addEventListener("click",f,!0);const u=document.createElement("div");u.id="_heidiTabBadge",u.style.cssText="position:fixed;bottom:12px;right:12px;background:#6b78ff;color:#fff;width:32px;height:32px;border-radius:50%;font-size:16px;display:flex;align-items:center;justify-content:center;z-index:99999;box-shadow:0 2px 8px rgba(0,0,0,0.3);cursor:pointer;user-select:none;",u.title="HeidiTab active -- click to deactivate",u.innerHTML="⌨️",u.addEventListener("click",()=>{document.removeEventListener("keydown",l,!0),document.removeEventListener("click",f,!0),window._heidiTabObserver&&(window._heidiTabObserver.disconnect(),delete window._heidiTabObserver),u.remove(),window._heidiTabStop=!1}),document.body.appendChild(u),window._heidiTabStop=!0,a(),function(){const t=e();if(!t)return;const n=new MutationObserver(()=>a());n.observe(t,{childList:!0,subtree:!0,characterData:!0}),window._heidiTabObserver=n}()}();