import"./hoisted.yFz1BYXO.js";const p=window.__PW_API||"",b=new URLSearchParams(window.location.search),d=b.get("token")||sessionStorage.getItem("pw_esign_token")||"";d&&sessionStorage.setItem("pw_esign_token",d);const w=()=>d?{Authorization:`Bearer ${d}`,"Content-Type":"application/json"}:{"Content-Type":"application/json"},i=t=>document.getElementById(t),g=i("loading-overlay"),k=i("main-ui"),L=i("success-screen"),P=i("hdr-entity"),S=i("entity-name-inline"),_=i("entity-name-confirm"),E=i("letter-preview-container"),f=i("letter-loading"),y=i("agree-chk"),l=i("submit-btn"),o=i("status-msg"),n=i("sig-canvas"),R=i("sig-clear"),C=i("sig-hint"),T=i("already-signed-card"),N=i("signed-at-display"),s=n.getContext("2d");let c=!1,u=!1;function h(t){const e=n.getBoundingClientRect(),r=n.width/e.width,a=n.height/e.height,v=t instanceof TouchEvent?t.touches[0]:t;return{x:(v.clientX-e.left)*r,y:(v.clientY-e.top)*a}}function H(){const t=n.getBoundingClientRect();n.width=t.width*devicePixelRatio,n.height=t.height*devicePixelRatio,s.scale(devicePixelRatio,devicePixelRatio),s.strokeStyle="#1e3a5f",s.lineWidth=2.5,s.lineCap="round",s.lineJoin="round"}n.addEventListener("mousedown",t=>{c=!0;const e=h(t);s.beginPath(),s.moveTo(e.x,e.y)});n.addEventListener("mousemove",t=>{if(!c)return;const e=h(t);s.lineTo(e.x,e.y),s.stroke(),x()});n.addEventListener("mouseup",()=>{c=!1});n.addEventListener("mouseleave",()=>{c=!1});n.addEventListener("touchstart",t=>{t.preventDefault(),c=!0;const e=h(t);s.beginPath(),s.moveTo(e.x,e.y)},{passive:!1});n.addEventListener("touchmove",t=>{if(t.preventDefault(),!c)return;const e=h(t);s.lineTo(e.x,e.y),s.stroke(),x()},{passive:!1});n.addEventListener("touchend",()=>{c=!1});function x(){u||(u=!0,n.classList.add("has-sig"),C.textContent="Signature drawn ✓",m())}R.addEventListener("click",()=>{s.clearRect(0,0,n.width/devicePixelRatio,n.height/devicePixelRatio),u=!1,n.classList.remove("has-sig"),C.textContent="Draw your signature above",m()});function m(){l.disabled=!(u&&y.checked)}y.addEventListener("change",m);async function I(){if(!d){g.innerHTML=`