@tung-engineering/agent-platform-web-sdk 0.0.87 → 0.0.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var m_=Object.defineProperty,b_=Object.defineProperties;var k_=Object.getOwnPropertyDescriptors;var Fl=Object.getOwnPropertySymbols;var __=Object.prototype.hasOwnProperty,v_=Object.prototype.propertyIsEnumerable;var Bl=Math.pow,Ei=(oe,ze,De)=>ze in oe?m_(oe,ze,{enumerable:!0,configurable:!0,writable:!0,value:De}):oe[ze]=De,y=(oe,ze)=>{for(var De in ze||(ze={}))__.call(ze,De)&&Ei(oe,De,ze[De]);if(Fl)for(var De of Fl(ze))v_.call(ze,De)&&Ei(oe,De,ze[De]);return oe},D=(oe,ze)=>b_(oe,k_(ze));var le=(oe,ze,De)=>Ei(oe,typeof ze!="symbol"?ze+"":ze,De);var I=(oe,ze,De)=>new Promise((Pi,ds)=>{var Ri=sn=>{try{Xr(De.next(sn))}catch(Kr){ds(Kr)}},Li=sn=>{try{Xr(De.throw(sn))}catch(Kr){ds(Kr)}},Xr=sn=>sn.done?Pi(sn.value):Promise.resolve(sn.value).then(Ri,Li);Xr((De=De.apply(oe,ze)).next())});var AgentPlatformWebSdk=(function(oe){"use strict";var Al,Yo;const Gl=[`
1
+ var Y_=Object.defineProperty,V_=Object.defineProperties;var X_=Object.getOwnPropertyDescriptors;var bu=Object.getOwnPropertySymbols;var K_=Object.prototype.hasOwnProperty,Q_=Object.prototype.propertyIsEnumerable;var ku=Math.pow,Fi=(ae,ze,Ue)=>ze in ae?Y_(ae,ze,{enumerable:!0,configurable:!0,writable:!0,value:Ue}):ae[ze]=Ue,v=(ae,ze)=>{for(var Ue in ze||(ze={}))K_.call(ze,Ue)&&Fi(ae,Ue,ze[Ue]);if(bu)for(var Ue of bu(ze))Q_.call(ze,Ue)&&Fi(ae,Ue,ze[Ue]);return ae},M=(ae,ze)=>V_(ae,X_(ze));var pe=(ae,ze,Ue)=>Fi(ae,typeof ze!="symbol"?ze+"":ze,Ue);var z=(ae,ze,Ue)=>new Promise((Wi,Ss)=>{var Ji=hn=>{try{po(Ue.next(hn))}catch(ho){Ss(ho)}},Yi=hn=>{try{po(Ue.throw(hn))}catch(ho){Ss(ho)}},po=hn=>hn.done?Wi(hn.value):Promise.resolve(hn.value).then(Ji,Yi);po((Ue=Ue.apply(ae,ze)).next())});var AgentPlatformWebSdk=(function(ae){"use strict";var eu,us;const _u=[`
2
2
  :where([data-ap-sdk][popover]) {
3
3
  position: fixed;
4
4
  margin: 0;
@@ -45,6 +45,8 @@ var m_=Object.defineProperty,b_=Object.defineProperties;var k_=Object.getOwnProp
45
45
  justify-content: space-between;
46
46
  padding: 14px 16px 10px;
47
47
  border-bottom: 1px solid #f3f4f6;
48
+ cursor: move;
49
+ touch-action: none;
48
50
  }
49
51
 
50
52
  .ap-sdk-panel__title {
@@ -110,6 +112,23 @@ var m_=Object.defineProperty,b_=Object.defineProperties;var k_=Object.getOwnProp
110
112
  background: oklch(95% 0.035 50);
111
113
  }
112
114
 
115
+ .ap-sdk-panel__clear {
116
+ background: none;
117
+ border: none;
118
+ padding: 4px;
119
+ cursor: pointer;
120
+ color: oklch(58% 0.13 42);
121
+ font-size: 14px;
122
+ line-height: 1;
123
+ border-radius: 4px;
124
+ transition: color 0.15s, background 0.15s;
125
+ }
126
+
127
+ .ap-sdk-panel__clear:hover {
128
+ color: oklch(47% 0.13 40);
129
+ background: oklch(95% 0.035 50);
130
+ }
131
+
113
132
  .ap-sdk-panel__body {
114
133
  padding: 14px 16px;
115
134
  display: flex;
@@ -553,6 +572,7 @@ var m_=Object.defineProperty,b_=Object.defineProperties;var k_=Object.getOwnProp
553
572
 
554
573
  .ap-sdk-panel--success .ap-sdk-pick-list,
555
574
  .ap-sdk-panel--success .ap-sdk-credentials-section,
575
+ .ap-sdk-panel--success .ap-sdk-panel__pick-actions,
556
576
  .ap-sdk-panel--success .ap-sdk-panel__body,
557
577
  .ap-sdk-panel--success .ap-sdk-panel__footer {
558
578
  display: none !important;
@@ -1467,102 +1487,142 @@ button.ap-sdk-list-item__link {
1467
1487
  border-right: 2px solid #d1d5db;
1468
1488
  border-bottom: 2px solid #d1d5db;
1469
1489
  }
1490
+ `,`
1491
+ .ap-sdk-resume-banner {
1492
+ position: fixed;
1493
+ bottom: 84px;
1494
+ right: 20px;
1495
+ display: flex;
1496
+ flex-direction: column;
1497
+ gap: 10px;
1498
+ width: 240px;
1499
+ max-width: calc(100vw - 40px);
1500
+ background: #fff;
1501
+ color: #1f2937;
1502
+ font-family: system-ui, -apple-system, sans-serif;
1503
+ padding: 14px;
1504
+ border-radius: 12px;
1505
+ box-shadow: 0 4px 16px rgba(0,0,0,0.18);
1506
+ z-index: 2147483646;
1507
+ animation: ap-sdk-card-in 0.25s cubic-bezier(0.22, 1, 0.36, 1);
1508
+ }
1509
+
1510
+ .ap-sdk-resume-banner__title {
1511
+ display: block;
1512
+ font-size: 14px;
1513
+ font-weight: 600;
1514
+ }
1515
+
1516
+ .ap-sdk-resume-banner__summary {
1517
+ display: block;
1518
+ margin-top: 2px;
1519
+ font-size: 13px;
1520
+ color: #6b7280;
1521
+ overflow: hidden;
1522
+ text-overflow: ellipsis;
1523
+ white-space: nowrap;
1524
+ }
1525
+
1526
+ .ap-sdk-resume-banner__actions {
1527
+ display: flex;
1528
+ gap: 8px;
1529
+ }
1470
1530
  `].join(`
1471
- `);let Ii=!1;function kr(){if(Ii)return;const e=document.createElement("style");e.setAttribute("data-ap-sdk","1"),e.textContent=Gl,document.head.appendChild(e),Ii=!0}function Qr(e){if(e===document.body)return"body";const t=[];let n=e;for(;n&&n!==document.body;){if(n.id){t.unshift(`#${CSS.escape(n.id)}`);break}let r=n.tagName.toLowerCase();const o=n.parentElement;if(o){const i=Array.from(o.children).filter(a=>a.tagName===n.tagName);if(i.length>1){const a=i.indexOf(n)+1;r+=`:nth-of-type(${a})`}}t.unshift(r),n=n.parentElement}return t.join(" > ")||e.tagName.toLowerCase()}function eo(e,t=200){var r;const n=((r=e.textContent)!=null?r:"").replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}const Wl=["role","type","name","href","src","alt","title","for","placeholder","data-testid"];function to(e){const t=e.tagName.toLowerCase(),n=e.id?`#${e.id}`:"",r=e.classList.length?"."+Array.from(e.classList).join("."):"",o=[],i=new Set,a=d=>{if(i.has(d)||o.length>=8)return;const u=e.getAttribute(d);if(!u)return;i.add(d);const p=u.length>80?u.slice(0,80)+"…":u;o.push(`[${d}="${p}"]`)};for(const d of Array.from(e.attributes))d.name.startsWith("aria-")&&a(d.name);for(const d of Wl)a(d);return`${t}${n}${r}${o.join("")}`}function Jl(e,t=80){const n=Array.from(e.childNodes).filter(r=>r.nodeType===Node.TEXT_NODE).map(r=>{var o;return((o=r.textContent)!=null?o:"").trim()}).filter(Boolean).join(" ");return n.length>t?n.slice(0,t)+"…":n}function Yl(e,t=5,n=10){function r(o,i){const a=to(o),d=" ".repeat(i),u=Array.from(o.children).slice(0,n);if(i>=t||u.length===0){const p=Jl(o);return p?`${d}${a} "${p}"`:`${d}${a}`}return[`${d}${a}`,...u.map(p=>r(p,i+1))].join(`
1472
- `)}return r(e,0)}const Vl='section, article, aside, nav, main, header, footer, form, fieldset, dialog, [role="region"], [role="navigation"], [role="main"], [role="complementary"], [role="banner"], [role="contentinfo"], [role="form"], [role="search"], [role="dialog"]',Xl={fieldset:"legend",table:"caption",figure:"figcaption",details:"summary"};function no(e,t){const n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}function Kl(e){var n;const t=e.querySelectorAll('h1, h2, h3, h4, h5, h6, [role="heading"]');for(const r of Array.from(t)){let o=r.parentElement;for(;o&&o!==e&&!o.matches(Vl);)o=o.parentElement;if(o===e){const i=((n=r.textContent)!=null?n:"").trim();if(i)return i}}return""}function Ql(e,t=80){var a,d,u;const n=Xl[e.tagName.toLowerCase()];if(n){const p=(d=(a=e.querySelector(n))==null?void 0:a.textContent)==null?void 0:d.trim();if(p)return no(p,t)}const r=Kl(e);if(r)return no(r,t);const o=(u=e.getAttribute("aria-label"))==null?void 0:u.trim();if(o)return no(o,t);const i=e.getAttribute("aria-labelledby");if(i){const p=i.split(/\s+/).map(h=>{var g,m,k;return(k=(m=(g=document.getElementById(h))==null?void 0:g.textContent)==null?void 0:m.trim())!=null?k:""}).filter(Boolean).join(" ");if(p)return no(p,t)}return""}function eu(e,t=6){const n=[],r=new Set;let o=e;for(;o&&o!==document.body&&n.length<t;){const i=o===e?"":Ql(o),a=i&&!r.has(i)?`${to(o)} ["${i}"]`:to(o);i&&r.add(i),n.unshift(a),o=o.parentElement}return n.join(" > ")||to(e)}function zi(e,t){return e.length>t?e.slice(0,t)+"… (truncated)":e}function _r(e){var r;const t=document.querySelector(e);return((r=t==null?void 0:t.content)==null?void 0:r.trim())||void 0}function $i(){const e=t=>{try{return t()}catch(n){return}};return{description:e(()=>_r('meta[name="description"]')),canonicalUrl:e(()=>{var t;return((t=document.querySelector('link[rel="canonical"]'))==null?void 0:t.href)||void 0}),lang:e(()=>document.documentElement.lang||void 0),ogTitle:e(()=>_r('meta[property="og:title"]')),ogDescription:e(()=>_r('meta[property="og:description"]')),ogType:e(()=>_r('meta[property="og:type"]')),ogSiteName:e(()=>_r('meta[property="og:site_name"]')),viewportWidth:e(()=>window.innerWidth),viewportHeight:e(()=>window.innerHeight),scrollX:e(()=>Math.round(window.scrollX)),scrollY:e(()=>Math.round(window.scrollY)),selectionText:e(()=>{var n;const t=(n=window.getSelection())==null?void 0:n.toString().trim();return t?zi(t,1e3):void 0}),capturedAt:new Date().toISOString()}}function tu(e){const t=[];let n=e;for(;n&&t.length<6;){let r=n.tagName.toLowerCase();n.id?r+=`#${n.id}`:n.classList.length&&(r+=`.${Array.from(n.classList).slice(0,2).join(".")}`),t.unshift(r),n=n.parentElement}return t.join(" > ")}function nu(e){const t=e.getAttribute("role")||void 0,n=e.getAttribute("aria-label")||void 0;let r;const o=e.closest("section, article, main, nav, aside, header, footer, [role]");if(o){const i=o.querySelector("h1, h2, h3, h4, h5, h6"),a=o.getAttribute("aria-label")||((i==null?void 0:i.textContent)||"").trim(),d=o.tagName.toLowerCase();r=a?`${d}: ${zi(a,120)}`:d}return{elementRole:t,elementAriaLabel:n,enclosingSection:r}}function ru(e,t){const n=[e.trim(),"",`Page: ${t.pageTitle} (${t.pageUrl})`];return t.description&&n.push(`Description: ${t.description}`),t.selectionText&&n.push(`Selection: ${t.selectionText}`),t.elementText&&n.push(`Selected element: ${t.elementText}`),t.elementRole&&n.push(` Role: ${t.elementRole}`),t.elementAriaLabel&&n.push(` ARIA label: ${t.elementAriaLabel}`),t.enclosingSection&&n.push(`Section: ${t.enclosingSection}`),t.ancestry&&n.push(`Ancestry: ${t.ancestry}`),t.cssSelector&&n.push(`Selector: ${t.cssSelector}`),n.join(`
1473
- `)}const qn=new Set;let Hn=null,ro=!1,ps=!1;function ou(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function su(){const e=document.querySelectorAll("dialog[open]");for(let n=0;n<e.length;n++)try{if(e[n].matches(":modal"))return!0}catch(r){}const t=document.querySelectorAll('[role="dialog"], [role="alertdialog"]');for(let n=0;n<t.length;n++){const r=t[n];if(!(qn.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&ou(r))return!0}return!1}function Oi(){const e=su(),t=e&&!ps;ps=e;for(const n of qn){n.hasAttribute("inert")&&n.removeAttribute("inert"),n.getAttribute("aria-hidden")==="true"&&n.removeAttribute("aria-hidden");const r=n.contains(document.activeElement);if(n.matches(":popover-open")){if(t&&!r){try{n.hidePopover()}catch(o){}try{n.showPopover()}catch(o){}}}else try{n.showPopover()}catch(o){}}}function Ni(e){if(!(e instanceof Node))return!1;for(const t of qn)if(t===e||t.contains(e))return!0;return!1}function Fn(e){(Ni(e.target)||"relatedTarget"in e&&Ni(e.relatedTarget))&&e.stopPropagation()}function iu(){ro||(window.addEventListener("focusin",Fn,!0),window.addEventListener("focusout",Fn,!0),window.addEventListener("pointerdown",Fn,!0),ro=!0),!Hn&&(Hn=new MutationObserver(e=>{e.some(n=>n.type==="childList"||n.attributeName==="open"&&n.target.tagName==="DIALOG"||n.attributeName==="inert"||n.attributeName==="aria-hidden"||n.attributeName==="role")&&Oi()}),Hn.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function Wt(e){"showPopover"in e&&(e.setAttribute("popover","manual"),qn.add(e),iu(),Oi())}function Jt(e){if(qn.delete(e),qn.size===0&&(Hn&&(Hn.disconnect(),Hn=null),ro&&(window.removeEventListener("focusin",Fn,!0),window.removeEventListener("focusout",Fn,!0),window.removeEventListener("pointerdown",Fn,!0),ro=!1),ps=!1),"hidePopover"in e)try{e.hidePopover()}catch(t){}}function hs(e="ap-sdk-highlight"){const t=document.createElement("div");return t.className=e,t.setAttribute("data-ap-sdk","1"),t.style.display="none",document.body.appendChild(t),Wt(t),{el:t,update:i=>{const a=i.getBoundingClientRect();t.style.top=`${a.top}px`,t.style.left=`${a.left}px`,t.style.width=`${a.width}px`,t.style.height=`${a.height}px`,t.style.display="block"},hide:()=>{t.style.display="none"},destroy:()=>{Jt(t),t.remove()}}}const Di=/^cc-|current-password|new-password/i,au=/token|secret|password|apikey|auth/i,fs="[redacted]";function cu(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&Di.test(t)}function Mi(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",fs);const r=n.getAttribute("autocomplete");r&&Di.test(r)&&n.setAttribute("value",fs);for(const o of Array.from(n.attributes))au.test(o.name)&&n.setAttribute(o.name,fs)}}const lu="🎯 Click any element to capture";let an=null,$e=null,qe=null;function vr(e){return e instanceof Element?e.closest("[data-ap-sdk]")!==null||e.closest(".ap-sdk-panel")!==null||e.closest(".ap-sdk-highlight")!==null||e.closest(".ap-sdk-picker-cursor")!==null:!1}function uu(){var e,t;return((t=(e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)!=null?t:!1)||"ontouchstart"in window}function Ui(e){an==null||an.update(e)}function ji(e){const t=$i(),n=tu(e),r=nu(e);let o;try{const i=e.cloneNode(!0);Mi(i),o=i.outerHTML.slice(0,4e3)}catch(i){}return y(y({pageUrl:window.location.href,pageTitle:document.title,elementText:eo(e),cssSelector:Qr(e),innerTree:Yl(e),outerTree:eu(e),elementOuterHtml:o,ancestry:n},r),t)}function gs(e,t){qe&&qe();const n=uu();an=hs(),$e=document.createElement("div"),$e.className="ap-sdk-picker-cursor",$e.setAttribute("data-ap-sdk","1"),$e.textContent=n?"Tap any element to preview":lu,document.body.appendChild($e),Wt($e);let r=null,o=null;const i=h=>{qe==null||qe(),e(ji(h),h)},a=h=>{if(o=h,Ui(h),!$e)return;$e.classList.add("ap-sdk-picker-cursor--confirm"),$e.innerHTML="";const g=document.createElement("span");g.className="ap-sdk-picker-cursor__label",g.textContent=`<${h.tagName.toLowerCase()}>`;const m=document.createElement("button");m.type="button",m.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--cancel",m.textContent="✕ Cancel",m.setAttribute("data-ap-sdk","1"),m.setAttribute("aria-label","Cancel picking"),m.addEventListener("click",v=>{v.preventDefault(),v.stopPropagation(),qe==null||qe(),t()});const k=document.createElement("button");k.type="button",k.className="ap-sdk-picker-cursor__btn",k.textContent="⬆ Parent",k.setAttribute("data-ap-sdk","1"),k.addEventListener("click",v=>{v.preventDefault(),v.stopPropagation(),o!=null&&o.parentElement&&a(o.parentElement)});const w=document.createElement("button");w.type="button",w.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",w.textContent="✓ Select",w.setAttribute("data-ap-sdk","1"),w.addEventListener("click",v=>{v.preventDefault(),v.stopPropagation(),o&&i(o)}),$e.appendChild(g),$e.appendChild(m),$e.appendChild(k),$e.appendChild(w)},d=h=>{vr(h.target)||(r=h.target,Ui(r))},u=h=>{var m;if(vr(h.target))return;h.preventDefault(),h.stopImmediatePropagation();const g=(m=h.target)!=null?m:r;if(g){if(n){a(g);return}i(g)}},p=h=>{h.key==="Escape"&&(qe==null||qe(),t())};n||document.addEventListener("mouseover",d,{capture:!0}),document.addEventListener("click",u,{capture:!0}),document.addEventListener("keydown",p,{capture:!0}),qe=()=>{n||document.removeEventListener("mouseover",d,{capture:!0}),document.removeEventListener("click",u,{capture:!0}),document.removeEventListener("keydown",p,{capture:!0}),$e&&Jt($e),$e==null||$e.remove(),an==null||an.destroy(),an=null,$e=null,o=null,qe=null}}function ms(){qe==null||qe()}function Bn(){return qe!==null}const oo={TASK_STATUS_UPDATED:"task:status:updated",TASK_INTERACTION_CREATED:"task:interaction:created",TASK_INTERACTION_ANSWERED:"task:interaction:answered",TASK_BROWSER_COMMAND_CREATED:"task:browser-command:created"};function x(e,t,n){var d;function r(u,p){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:p,constr:a,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,p);const h=a.prototype,g=Object.keys(h);for(let m=0;m<g.length;m++){const k=g[m];k in u||(u[k]=h[k].bind(u))}}const o=(d=n==null?void 0:n.Parent)!=null?d:Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(u){var g;var p;const h=n!=null&&n.Parent?new i:this;r(h,u),(g=(p=h._zod).deferred)!=null||(p.deferred=[]);for(const m of h._zod.deferred)m();return h}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:u=>{var p,h;return n!=null&&n.Parent&&u instanceof n.Parent?!0:(h=(p=u==null?void 0:u._zod)==null?void 0:p.traits)==null?void 0:h.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class Gn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Zi extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const qi={};function cn(e){return qi}function Hi(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function bs(e,t){return typeof t=="bigint"?t.toString():t}function so(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ks(e){return e==null}function _s(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function du(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const u=r.match(/\d?e-(\d?)/);u!=null&&u[1]&&(o=Number.parseInt(u[1]))}const i=n>o?n:o,a=Number.parseInt(e.toFixed(i).replace(".","")),d=Number.parseInt(t.toFixed(i).replace(".",""));return a%d/Bl(10,i)}const Fi=Symbol("evaluating");function te(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Fi)return r===void 0&&(r=Fi,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Tn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ln(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Bi(e){return JSON.stringify(e)}function pu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Gi="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function yr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const hu=so(()=>{var e;if(typeof navigator!="undefined"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch(t){return!1}});function Wn(e){if(yr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(yr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Wi(e){return Wn(e)?y({},e):Array.isArray(e)?[...e]:e}const fu=new Set(["string","number","symbol"]);function Jn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function un(e,t,n){const r=new e._zod.constr(t!=null?t:e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function M(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?D(y({},t),{error:()=>t.error}):t}function gu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const mu={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function bu(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=ln(e._zod.def,{get shape(){const a={};for(const d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&(a[d]=n.shape[d])}return Tn(this,"shape",a),a},checks:[]});return un(e,i)}function ku(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=ln(e._zod.def,{get shape(){const a=y({},e._zod.def.shape);for(const d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&delete a[d]}return Tn(this,"shape",a),a},checks:[]});return un(e,i)}function _u(e,t){if(!Wn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=ln(e._zod.def,{get shape(){const i=y(y({},e._zod.def.shape),t);return Tn(this,"shape",i),i}});return un(e,o)}function vu(e,t){if(!Wn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=ln(e._zod.def,{get shape(){const r=y(y({},e._zod.def.shape),t);return Tn(this,"shape",r),r}});return un(e,n)}function yu(e,t){const n=ln(e._zod.def,{get shape(){const r=y(y({},e._zod.def.shape),t._zod.def.shape);return Tn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return un(e,n)}function wu(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=ln(t._zod.def,{get shape(){const d=t._zod.def.shape,u=y({},d);if(n)for(const p in n){if(!(p in d))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(u[p]=e?new e({type:"optional",innerType:d[p]}):d[p])}else for(const p in d)u[p]=e?new e({type:"optional",innerType:d[p]}):d[p];return Tn(this,"shape",u),u},checks:[]});return un(t,a)}function xu(e,t,n){const r=ln(t._zod.def,{get shape(){const o=t._zod.def.shape,i=y({},o);if(n)for(const a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return Tn(this,"shape",i),i}});return un(t,r)}function Yn(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function Vn(e,t){return t.map(n=>{var o;var r;return(o=(r=n).path)!=null||(r.path=[]),n.path.unshift(e),n})}function io(e){return typeof e=="string"?e:e==null?void 0:e.message}function dn(e,t,n){var o,i,a,d,u,p,h,g,m,k,w;const r=D(y({},e),{path:(o=e.path)!=null?o:[]});if(!e.message){const v=(w=(k=(g=(p=io((d=(a=(i=e.inst)==null?void 0:i._zod.def)==null?void 0:a.error)==null?void 0:d.call(a,e)))!=null?p:io((u=t==null?void 0:t.error)==null?void 0:u.call(t,e)))!=null?g:io((h=n.customError)==null?void 0:h.call(n,e)))!=null?k:io((m=n.localeError)==null?void 0:m.call(n,e)))!=null?w:"Invalid input";r.message=v}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function vs(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function wr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:y({},t)}const Ji=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,bs,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Yi=x("$ZodError",Ji),Vi=x("$ZodError",Ji,{Parent:Error});function Su(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function Tu(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let a=n,d=0;for(;d<i.path.length;){const u=i.path[d];d===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(t(i))):a[u]=a[u]||{_errors:[]},a=a[u],d++}}};return r(e),n}const ys=e=>(t,n,r,o)=>{var d;const i=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Gn;if(a.issues.length){const u=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>dn(p,i,cn())));throw Gi(u,o==null?void 0:o.callee),u}return a.value},ws=e=>(t,n,r,o)=>I(null,null,function*(){var d;const i=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=yield a),a.issues.length){const u=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>dn(p,i,cn())));throw Gi(u,o==null?void 0:o.callee),u}return a.value}),ao=e=>(t,n,r)=>{const o=r?D(y({},r),{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Gn;return i.issues.length?{success:!1,error:new(e!=null?e:Yi)(i.issues.map(a=>dn(a,o,cn())))}:{success:!0,data:i.value}},Eu=ao(Vi),co=e=>(t,n,r)=>I(null,null,function*(){const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=yield i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>dn(a,o,cn())))}:{success:!0,data:i.value}}),Au=co(Vi),Cu=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ys(e)(t,n,o)},Pu=e=>(t,n,r)=>ys(e)(t,n,r),Ru=e=>(t,n,r)=>I(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ws(e)(t,n,o)}),Lu=e=>(t,n,r)=>I(null,null,function*(){return ws(e)(t,n,r)}),Iu=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ao(e)(t,n,o)},zu=e=>(t,n,r)=>ao(e)(t,n,r),$u=e=>(t,n,r)=>I(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return co(e)(t,n,o)}),Ou=e=>(t,n,r)=>I(null,null,function*(){return co(e)(t,n,r)}),Nu=/^[cC][^\s-]{8,}$/,Du=/^[0-9a-z]+$/,Mu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Uu=/^[0-9a-vA-V]{20}$/,ju=/^[A-Za-z0-9]{27}$/,Zu=/^[a-zA-Z0-9_-]{21}$/,qu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Hu=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Xi=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Fu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Bu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Gu(){return new RegExp(Bu,"u")}const Wu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ju=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Yu=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Vu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Xu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ki=/^[A-Za-z0-9_-]*$/,Ku=/^\+[1-9]\d{6,14}$/,Qi="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Qu=new RegExp(`^${Qi}$`);function ea(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ed(e){return new RegExp(`^${ea(e)}$`)}function td(e){const t=ea({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Qi}T(?:${r})$`)}const nd=e=>{var n,r;const t=e?`[\\s\\S]{${(n=e==null?void 0:e.minimum)!=null?n:0},${(r=e==null?void 0:e.maximum)!=null?r:""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},rd=/^-?\d+$/,ta=/^-?\d+(?:\.\d+)?$/,od=/^(?:true|false)$/i,sd=/^[^A-Z]*$/,id=/^[^a-z]*$/,at=x("$ZodCheck",(e,t)=>{var r,o;var n;(r=e._zod)!=null||(e._zod={}),e._zod.def=t,(o=(n=e._zod).onattach)!=null||(n.onattach=[])}),na={number:"number",bigint:"bigint",object:"date"},ra=x("$ZodCheckLessThan",(e,t)=>{at.init(e,t);const n=na[typeof t.value];e._zod.onattach.push(r=>{var a;const o=r._zod.bag,i=(a=t.inclusive?o.maximum:o.exclusiveMaximum)!=null?a:Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),oa=x("$ZodCheckGreaterThan",(e,t)=>{at.init(e,t);const n=na[typeof t.value];e._zod.onattach.push(r=>{var a;const o=r._zod.bag,i=(a=t.inclusive?o.minimum:o.exclusiveMinimum)!=null?a:Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ad=x("$ZodCheckMultipleOf",(e,t)=>{at.init(e,t),e._zod.onattach.push(n=>{var o;var r;(o=(r=n._zod.bag).multipleOf)!=null||(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):du(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),cd=x("$ZodCheckNumberFormat",(e,t)=>{var a;at.init(e,t),t.format=t.format||"float64";const n=(a=t.format)==null?void 0:a.includes("int"),r=n?"int":"number",[o,i]=mu[t.format];e._zod.onattach.push(d=>{const u=d._zod.bag;u.format=t.format,u.minimum=o,u.maximum=i,n&&(u.pattern=rd)}),e._zod.check=d=>{const u=d.value;if(n){if(!Number.isInteger(u)){d.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?d.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):d.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}u<o&&d.issues.push({origin:"number",input:u,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),u>i&&d.issues.push({origin:"number",input:u,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),ld=x("$ZodCheckMaxLength",(e,t)=>{var r;var n;at.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!ks(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{var a;const i=(a=o._zod.bag.maximum)!=null?a:Number.POSITIVE_INFINITY;t.maximum<i&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{const i=o.value;if(i.length<=t.maximum)return;const d=vs(i);o.issues.push({origin:d,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),ud=x("$ZodCheckMinLength",(e,t)=>{var r;var n;at.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!ks(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{var a;const i=(a=o._zod.bag.minimum)!=null?a:Number.NEGATIVE_INFINITY;t.minimum>i&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const i=o.value;if(i.length>=t.minimum)return;const d=vs(i);o.issues.push({origin:d,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),dd=x("$ZodCheckLengthEquals",(e,t)=>{var r;var n;at.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!ks(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{const i=o._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=o=>{const i=o.value,a=i.length;if(a===t.length)return;const d=vs(i),u=a>t.length;o.issues.push(D(y({origin:d},u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length}),{inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort}))}}),lo=x("$ZodCheckStringFormat",(e,t)=>{var o,i;var n,r;at.init(e,t),e._zod.onattach.push(a=>{var u;const d=a._zod.bag;d.format=t.format,t.pattern&&((u=d.patterns)!=null||(d.patterns=new Set),d.patterns.add(t.pattern))}),t.pattern?(o=(n=e._zod).check)!=null||(n.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push(D(y({origin:"string",code:"invalid_format",format:t.format,input:a.value},t.pattern?{pattern:t.pattern.toString()}:{}),{inst:e,continue:!t.abort}))}):(i=(r=e._zod).check)!=null||(r.check=()=>{})}),pd=x("$ZodCheckRegex",(e,t)=>{lo.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),hd=x("$ZodCheckLowerCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=sd),lo.init(e,t)}),fd=x("$ZodCheckUpperCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=id),lo.init(e,t)}),gd=x("$ZodCheckIncludes",(e,t)=>{at.init(e,t);const n=Jn(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),md=x("$ZodCheckStartsWith",(e,t)=>{var r;at.init(e,t);const n=new RegExp(`^${Jn(t.prefix)}.*`);(r=t.pattern)!=null||(t.pattern=n),e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),bd=x("$ZodCheckEndsWith",(e,t)=>{var r;at.init(e,t);const n=new RegExp(`.*${Jn(t.suffix)}$`);(r=t.pattern)!=null||(t.pattern=n),e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}}),kd=x("$ZodCheckOverwrite",(e,t)=>{at.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class _d{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
1531
+ `);let Vi=!1;function Er(){if(Vi)return;const e=document.createElement("style");e.setAttribute("data-ap-sdk","1"),e.textContent=_u,document.head.appendChild(e),Vi=!0}function fo(e){if(e===document.body)return"body";const t=[];let n=e;for(;n&&n!==document.body;){if(n.id){t.unshift(`#${CSS.escape(n.id)}`);break}let r=n.tagName.toLowerCase();const o=n.parentElement;if(o){const i=Array.from(o.children).filter(a=>a.tagName===n.tagName);if(i.length>1){const a=i.indexOf(n)+1;r+=`:nth-of-type(${a})`}}t.unshift(r),n=n.parentElement}return t.join(" > ")||e.tagName.toLowerCase()}function go(e,t=200){var r;const n=((r=e.textContent)!=null?r:"").replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}const vu=["role","type","name","href","src","alt","title","for","placeholder","data-testid"];function mo(e){const t=e.tagName.toLowerCase(),n=e.id?`#${e.id}`:"",r=e.classList.length?"."+Array.from(e.classList).join("."):"",o=[],i=new Set,a=d=>{if(i.has(d)||o.length>=8)return;const l=e.getAttribute(d);if(!l)return;i.add(d);const p=l.length>80?l.slice(0,80)+"…":l;o.push(`[${d}="${p}"]`)};for(const d of Array.from(e.attributes))d.name.startsWith("aria-")&&a(d.name);for(const d of vu)a(d);return`${t}${n}${r}${o.join("")}`}function yu(e,t=80){const n=Array.from(e.childNodes).filter(r=>r.nodeType===Node.TEXT_NODE).map(r=>{var o;return((o=r.textContent)!=null?o:"").trim()}).filter(Boolean).join(" ");return n.length>t?n.slice(0,t)+"…":n}function wu(e,t=5,n=10){function r(o,i){const a=mo(o),d=" ".repeat(i),l=Array.from(o.children).slice(0,n);if(i>=t||l.length===0){const p=yu(o);return p?`${d}${a} "${p}"`:`${d}${a}`}return[`${d}${a}`,...l.map(p=>r(p,i+1))].join(`
1532
+ `)}return r(e,0)}const xu='section, article, aside, nav, main, header, footer, form, fieldset, dialog, [role="region"], [role="navigation"], [role="main"], [role="complementary"], [role="banner"], [role="contentinfo"], [role="form"], [role="search"], [role="dialog"]',Su={fieldset:"legend",table:"caption",figure:"figcaption",details:"summary"};function bo(e,t){const n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}function Tu(e){var n;const t=e.querySelectorAll('h1, h2, h3, h4, h5, h6, [role="heading"]');for(const r of Array.from(t)){let o=r.parentElement;for(;o&&o!==e&&!o.matches(xu);)o=o.parentElement;if(o===e){const i=((n=r.textContent)!=null?n:"").trim();if(i)return i}}return""}function Eu(e,t=80){var a,d,l;const n=Su[e.tagName.toLowerCase()];if(n){const p=(d=(a=e.querySelector(n))==null?void 0:a.textContent)==null?void 0:d.trim();if(p)return bo(p,t)}const r=Tu(e);if(r)return bo(r,t);const o=(l=e.getAttribute("aria-label"))==null?void 0:l.trim();if(o)return bo(o,t);const i=e.getAttribute("aria-labelledby");if(i){const p=i.split(/\s+/).map(h=>{var g,m,k;return(k=(m=(g=document.getElementById(h))==null?void 0:g.textContent)==null?void 0:m.trim())!=null?k:""}).filter(Boolean).join(" ");if(p)return bo(p,t)}return""}function Au(e,t=6){const n=[],r=new Set;let o=e;for(;o&&o!==document.body&&n.length<t;){const i=o===e?"":Eu(o),a=i&&!r.has(i)?`${mo(o)} ["${i}"]`:mo(o);i&&r.add(i),n.unshift(a),o=o.parentElement}return n.join(" > ")||mo(e)}function Xi(e,t){return e.length>t?e.slice(0,t)+"… (truncated)":e}function Ar(e){var r;const t=document.querySelector(e);return((r=t==null?void 0:t.content)==null?void 0:r.trim())||void 0}function Ki(){const e=t=>{try{return t()}catch(n){return}};return{description:e(()=>Ar('meta[name="description"]')),canonicalUrl:e(()=>{var t;return((t=document.querySelector('link[rel="canonical"]'))==null?void 0:t.href)||void 0}),lang:e(()=>document.documentElement.lang||void 0),ogTitle:e(()=>Ar('meta[property="og:title"]')),ogDescription:e(()=>Ar('meta[property="og:description"]')),ogType:e(()=>Ar('meta[property="og:type"]')),ogSiteName:e(()=>Ar('meta[property="og:site_name"]')),viewportWidth:e(()=>window.innerWidth),viewportHeight:e(()=>window.innerHeight),scrollX:e(()=>Math.round(window.scrollX)),scrollY:e(()=>Math.round(window.scrollY)),selectionText:e(()=>{var n;const t=(n=window.getSelection())==null?void 0:n.toString().trim();return t?Xi(t,1e3):void 0}),capturedAt:new Date().toISOString()}}function Cu(e){const t=[];let n=e;for(;n&&t.length<6;){let r=n.tagName.toLowerCase();n.id?r+=`#${n.id}`:n.classList.length&&(r+=`.${Array.from(n.classList).slice(0,2).join(".")}`),t.unshift(r),n=n.parentElement}return t.join(" > ")}function Pu(e){const t=e.getAttribute("role")||void 0,n=e.getAttribute("aria-label")||void 0;let r;const o=e.closest("section, article, main, nav, aside, header, footer, [role]");if(o){const i=o.querySelector("h1, h2, h3, h4, h5, h6"),a=o.getAttribute("aria-label")||((i==null?void 0:i.textContent)||"").trim(),d=o.tagName.toLowerCase();r=a?`${d}: ${Xi(a,120)}`:d}return{elementRole:t,elementAriaLabel:n,enclosingSection:r}}function Ru(e,t){const n=[e.trim(),"",`Page: ${t.pageTitle} (${t.pageUrl})`];return t.description&&n.push(`Description: ${t.description}`),t.selectionText&&n.push(`Selection: ${t.selectionText}`),t.elementText&&n.push(`Selected element: ${t.elementText}`),t.elementRole&&n.push(` Role: ${t.elementRole}`),t.elementAriaLabel&&n.push(` ARIA label: ${t.elementAriaLabel}`),t.enclosingSection&&n.push(`Section: ${t.enclosingSection}`),t.ancestry&&n.push(`Ancestry: ${t.ancestry}`),t.cssSelector&&n.push(`Selector: ${t.cssSelector}`),n.join(`
1533
+ `)}const Yn=new Set;let Vn=null,ko=!1,Ts=!1;function Lu(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function Iu(){const e=document.querySelectorAll("dialog[open]");for(let n=0;n<e.length;n++)try{if(e[n].matches(":modal"))return!0}catch(r){}const t=document.querySelectorAll('[role="dialog"], [role="alertdialog"]');for(let n=0;n<t.length;n++){const r=t[n];if(!(Yn.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&Lu(r))return!0}return!1}function Qi(){const e=Iu(),t=e&&!Ts;Ts=e;for(const n of Yn){n.hasAttribute("inert")&&n.removeAttribute("inert"),n.getAttribute("aria-hidden")==="true"&&n.removeAttribute("aria-hidden");const r=n.contains(document.activeElement);if(n.matches(":popover-open")){if(t&&!r){try{n.hidePopover()}catch(o){}try{n.showPopover()}catch(o){}}}else try{n.showPopover()}catch(o){}}}function ea(e){if(!(e instanceof Node))return!1;for(const t of Yn)if(t===e||t.contains(e))return!0;return!1}function Xn(e){(ea(e.target)||"relatedTarget"in e&&ea(e.relatedTarget))&&e.stopPropagation()}function $u(){ko||(window.addEventListener("focusin",Xn,!0),window.addEventListener("focusout",Xn,!0),window.addEventListener("pointerdown",Xn,!0),ko=!0),!Vn&&(Vn=new MutationObserver(e=>{e.some(n=>n.type==="childList"||n.attributeName==="open"&&n.target.tagName==="DIALOG"||n.attributeName==="inert"||n.attributeName==="aria-hidden"||n.attributeName==="role")&&Qi()}),Vn.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function Mt(e){"showPopover"in e&&(e.setAttribute("popover","manual"),Yn.add(e),$u(),Qi())}function Ut(e){if(Yn.delete(e),Yn.size===0&&(Vn&&(Vn.disconnect(),Vn=null),ko&&(window.removeEventListener("focusin",Xn,!0),window.removeEventListener("focusout",Xn,!0),window.removeEventListener("pointerdown",Xn,!0),ko=!1),Ts=!1),"hidePopover"in e)try{e.hidePopover()}catch(t){}}function Es(e="ap-sdk-highlight"){const t=document.createElement("div");return t.className=e,t.setAttribute("data-ap-sdk","1"),t.style.display="none",document.body.appendChild(t),Mt(t),{el:t,update:i=>{const a=i.getBoundingClientRect();t.style.top=`${a.top}px`,t.style.left=`${a.left}px`,t.style.width=`${a.width}px`,t.style.height=`${a.height}px`,t.style.display="block"},hide:()=>{t.style.display="none"},destroy:()=>{Ut(t),t.remove()}}}const ta=/^cc-|current-password|new-password/i,zu=/token|secret|password|apikey|auth/i,As="[redacted]",Cs="[data-ap-sdk-exclude]";let Ps=null;function Ou(e){Ps=(e==null?void 0:e.trim())||null}function Nu(){return Ps?`${Cs}, ${Ps}`:Cs}function na(e){let t;try{if(t=Nu(),e.matches(t)){e.textContent="";return}for(const n of Array.from(e.querySelectorAll(t)))n.remove()}catch(n){for(const r of Array.from(e.querySelectorAll(Cs)))r.remove()}}function Du(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&ta.test(t)}function ra(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",As);const r=n.getAttribute("autocomplete");r&&ta.test(r)&&n.setAttribute("value",As);for(const o of Array.from(n.attributes))zu.test(o.name)&&n.setAttribute(o.name,As)}}const Mu="🎯 Click any element to capture";let fn=null,Oe=null,qe=null;function Cr(e){return e instanceof Element?e.closest("[data-ap-sdk]")!==null||e.closest(".ap-sdk-panel")!==null||e.closest(".ap-sdk-highlight")!==null||e.closest(".ap-sdk-picker-cursor")!==null:!1}function Uu(){var e,t;return((t=(e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)!=null?t:!1)||"ontouchstart"in window}function oa(e){fn==null||fn.update(e)}function sa(e){const t=Ki(),n=Cu(e),r=Pu(e);let o=e,i;try{const a=e.cloneNode(!0);ra(a),na(a),o=a,i=a.outerHTML.slice(0,4e3)}catch(a){}return v(v({pageUrl:window.location.href,pageTitle:document.title,elementText:go(o),cssSelector:fo(e),innerTree:wu(o),outerTree:Au(e),elementOuterHtml:i,ancestry:n},r),t)}function Rs(e,t){qe&&qe();const n=Uu();fn=Es(),Oe=document.createElement("div"),Oe.className="ap-sdk-picker-cursor",Oe.setAttribute("data-ap-sdk","1"),Oe.textContent=n?"Tap any element to preview":Mu,document.body.appendChild(Oe),Mt(Oe);let r=null,o=null;const i=h=>{qe==null||qe(),e(sa(h),h)},a=h=>{if(o=h,oa(h),!Oe)return;Oe.classList.add("ap-sdk-picker-cursor--confirm"),Oe.innerHTML="";const g=document.createElement("span");g.className="ap-sdk-picker-cursor__label",g.textContent=`<${h.tagName.toLowerCase()}>`;const m=document.createElement("button");m.type="button",m.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--cancel",m.textContent="✕ Cancel",m.setAttribute("data-ap-sdk","1"),m.setAttribute("aria-label","Cancel picking"),m.addEventListener("click",S=>{S.preventDefault(),S.stopPropagation(),qe==null||qe(),t()});const k=document.createElement("button");k.type="button",k.className="ap-sdk-picker-cursor__btn",k.textContent="⬆ Parent",k.setAttribute("data-ap-sdk","1"),k.addEventListener("click",S=>{S.preventDefault(),S.stopPropagation(),o!=null&&o.parentElement&&a(o.parentElement)});const y=document.createElement("button");y.type="button",y.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",y.textContent="✓ Select",y.setAttribute("data-ap-sdk","1"),y.addEventListener("click",S=>{S.preventDefault(),S.stopPropagation(),o&&i(o)}),Oe.appendChild(g),Oe.appendChild(m),Oe.appendChild(k),Oe.appendChild(y)},d=h=>{Cr(h.target)||(r=h.target,oa(r))},l=h=>{var m;if(Cr(h.target))return;h.preventDefault(),h.stopImmediatePropagation();const g=(m=h.target)!=null?m:r;if(g){if(n){a(g);return}i(g)}},p=h=>{h.key==="Escape"&&(qe==null||qe(),t())};n||document.addEventListener("mouseover",d,{capture:!0}),document.addEventListener("click",l,{capture:!0}),document.addEventListener("keydown",p,{capture:!0}),qe=()=>{n||document.removeEventListener("mouseover",d,{capture:!0}),document.removeEventListener("click",l,{capture:!0}),document.removeEventListener("keydown",p,{capture:!0}),Oe&&Ut(Oe),Oe==null||Oe.remove(),fn==null||fn.destroy(),fn=null,Oe=null,o=null,qe=null}}function Ls(){qe==null||qe()}function Kn(){return qe!==null}const _o={TASK_STATUS_UPDATED:"task:status:updated",TASK_INTERACTION_CREATED:"task:interaction:created",TASK_INTERACTION_ANSWERED:"task:interaction:answered",TASK_BROWSER_COMMAND_CREATED:"task:browser-command:created"};function w(e,t,n){var d;function r(l,p){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:p,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,p);const h=a.prototype,g=Object.keys(h);for(let m=0;m<g.length;m++){const k=g[m];k in l||(l[k]=h[k].bind(l))}}const o=(d=n==null?void 0:n.Parent)!=null?d:Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(l){var g;var p;const h=n!=null&&n.Parent?new i:this;r(h,l),(g=(p=h._zod).deferred)!=null||(p.deferred=[]);for(const m of h._zod.deferred)m();return h}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>{var p,h;return n!=null&&n.Parent&&l instanceof n.Parent?!0:(h=(p=l==null?void 0:l._zod)==null?void 0:p.traits)==null?void 0:h.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class Qn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ia extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const aa={};function gn(e){return aa}function ca(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Is(e,t){return typeof t=="bigint"?t.toString():t}function vo(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function $s(e){return e==null}function zs(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function ju(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const l=r.match(/\d?e-(\d?)/);l!=null&&l[1]&&(o=Number.parseInt(l[1]))}const i=n>o?n:o,a=Number.parseInt(e.toFixed(i).replace(".","")),d=Number.parseInt(t.toFixed(i).replace(".",""));return a%d/ku(10,i)}const la=Symbol("evaluating");function ne(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==la)return r===void 0&&(r=la,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Ln(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function mn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function ua(e){return JSON.stringify(e)}function Zu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const da="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Pr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const qu=vo(()=>{var e;if(typeof navigator!="undefined"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch(t){return!1}});function er(e){if(Pr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Pr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function pa(e){return er(e)?v({},e):Array.isArray(e)?[...e]:e}const Hu=new Set(["string","number","symbol"]);function tr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bn(e,t,n){const r=new e._zod.constr(t!=null?t:e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function U(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?M(v({},t),{error:()=>t.error}):t}function Fu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Bu={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Gu(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=mn(e._zod.def,{get shape(){const a={};for(const d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&(a[d]=n.shape[d])}return Ln(this,"shape",a),a},checks:[]});return bn(e,i)}function Wu(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=mn(e._zod.def,{get shape(){const a=v({},e._zod.def.shape);for(const d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&delete a[d]}return Ln(this,"shape",a),a},checks:[]});return bn(e,i)}function Ju(e,t){if(!er(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=mn(e._zod.def,{get shape(){const i=v(v({},e._zod.def.shape),t);return Ln(this,"shape",i),i}});return bn(e,o)}function Yu(e,t){if(!er(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=mn(e._zod.def,{get shape(){const r=v(v({},e._zod.def.shape),t);return Ln(this,"shape",r),r}});return bn(e,n)}function Vu(e,t){const n=mn(e._zod.def,{get shape(){const r=v(v({},e._zod.def.shape),t._zod.def.shape);return Ln(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return bn(e,n)}function Xu(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=mn(t._zod.def,{get shape(){const d=t._zod.def.shape,l=v({},d);if(n)for(const p in n){if(!(p in d))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(l[p]=e?new e({type:"optional",innerType:d[p]}):d[p])}else for(const p in d)l[p]=e?new e({type:"optional",innerType:d[p]}):d[p];return Ln(this,"shape",l),l},checks:[]});return bn(t,a)}function Ku(e,t,n){const r=mn(t._zod.def,{get shape(){const o=t._zod.def.shape,i=v({},o);if(n)for(const a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return Ln(this,"shape",i),i}});return bn(t,r)}function nr(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function rr(e,t){return t.map(n=>{var o;var r;return(o=(r=n).path)!=null||(r.path=[]),n.path.unshift(e),n})}function yo(e){return typeof e=="string"?e:e==null?void 0:e.message}function kn(e,t,n){var o,i,a,d,l,p,h,g,m,k,y;const r=M(v({},e),{path:(o=e.path)!=null?o:[]});if(!e.message){const S=(y=(k=(g=(p=yo((d=(a=(i=e.inst)==null?void 0:i._zod.def)==null?void 0:a.error)==null?void 0:d.call(a,e)))!=null?p:yo((l=t==null?void 0:t.error)==null?void 0:l.call(t,e)))!=null?g:yo((h=n.customError)==null?void 0:h.call(n,e)))!=null?k:yo((m=n.localeError)==null?void 0:m.call(n,e)))!=null?y:"Invalid input";r.message=S}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Os(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Rr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:v({},t)}const ha=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Is,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},fa=w("$ZodError",ha),ga=w("$ZodError",ha,{Parent:Error});function Qu(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function ed(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let a=n,d=0;for(;d<i.path.length;){const l=i.path[d];d===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(t(i))):a[l]=a[l]||{_errors:[]},a=a[l],d++}}};return r(e),n}const Ns=e=>(t,n,r,o)=>{var d;const i=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Qn;if(a.issues.length){const l=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>kn(p,i,gn())));throw da(l,o==null?void 0:o.callee),l}return a.value},Ds=e=>(t,n,r,o)=>z(null,null,function*(){var d;const i=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=yield a),a.issues.length){const l=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>kn(p,i,gn())));throw da(l,o==null?void 0:o.callee),l}return a.value}),wo=e=>(t,n,r)=>{const o=r?M(v({},r),{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Qn;return i.issues.length?{success:!1,error:new(e!=null?e:fa)(i.issues.map(a=>kn(a,o,gn())))}:{success:!0,data:i.value}},td=wo(ga),xo=e=>(t,n,r)=>z(null,null,function*(){const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=yield i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>kn(a,o,gn())))}:{success:!0,data:i.value}}),nd=xo(ga),rd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ns(e)(t,n,o)},od=e=>(t,n,r)=>Ns(e)(t,n,r),sd=e=>(t,n,r)=>z(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ds(e)(t,n,o)}),id=e=>(t,n,r)=>z(null,null,function*(){return Ds(e)(t,n,r)}),ad=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return wo(e)(t,n,o)},cd=e=>(t,n,r)=>wo(e)(t,n,r),ld=e=>(t,n,r)=>z(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return xo(e)(t,n,o)}),ud=e=>(t,n,r)=>z(null,null,function*(){return xo(e)(t,n,r)}),dd=/^[cC][^\s-]{8,}$/,pd=/^[0-9a-z]+$/,hd=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,fd=/^[0-9a-vA-V]{20}$/,gd=/^[A-Za-z0-9]{27}$/,md=/^[a-zA-Z0-9_-]{21}$/,bd=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,kd=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ma=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,_d=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,vd="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function yd(){return new RegExp(vd,"u")}const wd=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,xd=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Sd=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Td=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ed=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ba=/^[A-Za-z0-9_-]*$/,Ad=/^\+[1-9]\d{6,14}$/,ka="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Cd=new RegExp(`^${ka}$`);function _a(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Pd(e){return new RegExp(`^${_a(e)}$`)}function Rd(e){const t=_a({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${ka}T(?:${r})$`)}const Ld=e=>{var n,r;const t=e?`[\\s\\S]{${(n=e==null?void 0:e.minimum)!=null?n:0},${(r=e==null?void 0:e.maximum)!=null?r:""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Id=/^-?\d+$/,va=/^-?\d+(?:\.\d+)?$/,$d=/^(?:true|false)$/i,zd=/^[^A-Z]*$/,Od=/^[^a-z]*$/,st=w("$ZodCheck",(e,t)=>{var r,o;var n;(r=e._zod)!=null||(e._zod={}),e._zod.def=t,(o=(n=e._zod).onattach)!=null||(n.onattach=[])}),ya={number:"number",bigint:"bigint",object:"date"},wa=w("$ZodCheckLessThan",(e,t)=>{st.init(e,t);const n=ya[typeof t.value];e._zod.onattach.push(r=>{var a;const o=r._zod.bag,i=(a=t.inclusive?o.maximum:o.exclusiveMaximum)!=null?a:Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),xa=w("$ZodCheckGreaterThan",(e,t)=>{st.init(e,t);const n=ya[typeof t.value];e._zod.onattach.push(r=>{var a;const o=r._zod.bag,i=(a=t.inclusive?o.minimum:o.exclusiveMinimum)!=null?a:Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Nd=w("$ZodCheckMultipleOf",(e,t)=>{st.init(e,t),e._zod.onattach.push(n=>{var o;var r;(o=(r=n._zod.bag).multipleOf)!=null||(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):ju(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Dd=w("$ZodCheckNumberFormat",(e,t)=>{var a;st.init(e,t),t.format=t.format||"float64";const n=(a=t.format)==null?void 0:a.includes("int"),r=n?"int":"number",[o,i]=Bu[t.format];e._zod.onattach.push(d=>{const l=d._zod.bag;l.format=t.format,l.minimum=o,l.maximum=i,n&&(l.pattern=Id)}),e._zod.check=d=>{const l=d.value;if(n){if(!Number.isInteger(l)){d.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?d.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):d.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}l<o&&d.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>i&&d.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Md=w("$ZodCheckMaxLength",(e,t)=>{var r;var n;st.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!$s(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{var a;const i=(a=o._zod.bag.maximum)!=null?a:Number.POSITIVE_INFINITY;t.maximum<i&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{const i=o.value;if(i.length<=t.maximum)return;const d=Os(i);o.issues.push({origin:d,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Ud=w("$ZodCheckMinLength",(e,t)=>{var r;var n;st.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!$s(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{var a;const i=(a=o._zod.bag.minimum)!=null?a:Number.NEGATIVE_INFINITY;t.minimum>i&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const i=o.value;if(i.length>=t.minimum)return;const d=Os(i);o.issues.push({origin:d,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),jd=w("$ZodCheckLengthEquals",(e,t)=>{var r;var n;st.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!$s(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{const i=o._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=o=>{const i=o.value,a=i.length;if(a===t.length)return;const d=Os(i),l=a>t.length;o.issues.push(M(v({origin:d},l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length}),{inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort}))}}),So=w("$ZodCheckStringFormat",(e,t)=>{var o,i;var n,r;st.init(e,t),e._zod.onattach.push(a=>{var l;const d=a._zod.bag;d.format=t.format,t.pattern&&((l=d.patterns)!=null||(d.patterns=new Set),d.patterns.add(t.pattern))}),t.pattern?(o=(n=e._zod).check)!=null||(n.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push(M(v({origin:"string",code:"invalid_format",format:t.format,input:a.value},t.pattern?{pattern:t.pattern.toString()}:{}),{inst:e,continue:!t.abort}))}):(i=(r=e._zod).check)!=null||(r.check=()=>{})}),Zd=w("$ZodCheckRegex",(e,t)=>{So.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),qd=w("$ZodCheckLowerCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=zd),So.init(e,t)}),Hd=w("$ZodCheckUpperCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Od),So.init(e,t)}),Fd=w("$ZodCheckIncludes",(e,t)=>{st.init(e,t);const n=tr(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Bd=w("$ZodCheckStartsWith",(e,t)=>{var r;st.init(e,t);const n=new RegExp(`^${tr(t.prefix)}.*`);(r=t.pattern)!=null||(t.pattern=n),e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Gd=w("$ZodCheckEndsWith",(e,t)=>{var r;st.init(e,t);const n=new RegExp(`.*${tr(t.suffix)}$`);(r=t.pattern)!=null||(t.pattern=n),e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}}),Wd=w("$ZodCheckOverwrite",(e,t)=>{st.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Jd{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
1474
1534
  `).filter(a=>a),o=Math.min(...r.map(a=>a.length-a.trimStart().length)),i=r.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of i)this.content.push(a)}compile(){var i;const t=Function,n=this==null?void 0:this.args,o=[...((i=this==null?void 0:this.content)!=null?i:[""]).map(a=>` ${a}`)];return new t(...n,o.join(`
1475
- `))}}const vd={major:4,minor:3,patch:5},ge=x("$ZodType",(e,t)=>{var o,i,a;var n;e!=null||(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=vd;const r=[...(o=e._zod.def.checks)!=null?o:[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const d of r)for(const u of d._zod.onattach)u(e);if(r.length===0)(i=(n=e._zod).deferred)!=null||(n.deferred=[]),(a=e._zod.deferred)==null||a.push(()=>{e._zod.run=e._zod.parse});else{const d=(p,h,g)=>{let m=Yn(p),k;for(const w of h){if(w._zod.def.when){if(!w._zod.def.when(p))continue}else if(m)continue;const v=p.issues.length,Z=w._zod.check(p);if(Z instanceof Promise&&(g==null?void 0:g.async)===!1)throw new Gn;if(k||Z instanceof Promise)k=(k!=null?k:Promise.resolve()).then(()=>I(null,null,function*(){yield Z,p.issues.length!==v&&(m||(m=Yn(p,v)))}));else{if(p.issues.length===v)continue;m||(m=Yn(p,v))}}return k?k.then(()=>p):p},u=(p,h,g)=>{if(Yn(p))return p.aborted=!0,p;const m=d(h,r,g);if(m instanceof Promise){if(g.async===!1)throw new Gn;return m.then(k=>e._zod.parse(k,g))}return e._zod.parse(m,g)};e._zod.run=(p,h)=>{if(h.skipChecks)return e._zod.parse(p,h);if(h.direction==="backward"){const m=e._zod.parse({value:p.value,issues:[]},D(y({},h),{skipChecks:!0}));return m instanceof Promise?m.then(k=>u(k,p,h)):u(m,p,h)}const g=e._zod.parse(p,h);if(g instanceof Promise){if(h.async===!1)throw new Gn;return g.then(m=>d(m,r,h))}return d(g,r,h)}}te(e,"~standard",()=>({validate:d=>{var u;try{const p=Eu(e,d);return p.success?{value:p.data}:{issues:(u=p.error)==null?void 0:u.issues}}catch(p){return Au(e,d).then(h=>{var g;return h.success?{value:h.data}:{issues:(g=h.error)==null?void 0:g.issues}})}},vendor:"zod",version:1}))}),xs=x("$ZodString",(e,t)=>{var n,r,o;ge.init(e,t),e._zod.pattern=(o=[...(r=(n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)!=null?r:[]].pop())!=null?o:nd(e._zod.bag),e._zod.parse=(i,a)=>{if(t.coerce)try{i.value=String(i.value)}catch(d){}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),me=x("$ZodStringFormat",(e,t)=>{lo.init(e,t),xs.init(e,t)}),yd=x("$ZodGUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Hu),me.init(e,t)}),wd=x("$ZodUUID",(e,t)=>{var n,r;if(t.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);(n=t.pattern)!=null||(t.pattern=Xi(i))}else(r=t.pattern)!=null||(t.pattern=Xi());me.init(e,t)}),xd=x("$ZodEmail",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Fu),me.init(e,t)}),Sd=x("$ZodURL",(e,t)=>{me.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Td=x("$ZodEmoji",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Gu()),me.init(e,t)}),Ed=x("$ZodNanoID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Zu),me.init(e,t)}),Ad=x("$ZodCUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Nu),me.init(e,t)}),Cd=x("$ZodCUID2",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Du),me.init(e,t)}),Pd=x("$ZodULID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Mu),me.init(e,t)}),Rd=x("$ZodXID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Uu),me.init(e,t)}),Ld=x("$ZodKSUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ju),me.init(e,t)}),Id=x("$ZodISODateTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=td(t)),me.init(e,t)}),zd=x("$ZodISODate",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Qu),me.init(e,t)}),$d=x("$ZodISOTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ed(t)),me.init(e,t)}),Od=x("$ZodISODuration",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=qu),me.init(e,t)}),Nd=x("$ZodIPv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Wu),me.init(e,t),e._zod.bag.format="ipv4"}),Dd=x("$ZodIPv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ju),me.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch(o){r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Md=x("$ZodCIDRv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Yu),me.init(e,t)}),Ud=x("$ZodCIDRv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Vu),me.init(e,t),e._zod.check=r=>{const o=r.value.split("/");try{if(o.length!==2)throw new Error;const[i,a]=o;if(!a)throw new Error;const d=Number(a);if(`${d}`!==a)throw new Error;if(d<0||d>128)throw new Error;new URL(`http://[${i}]`)}catch(i){r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function sa(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch(t){return!1}}const jd=x("$ZodBase64",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Xu),me.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{sa(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Zd(e){if(!Ki.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return sa(n)}const qd=x("$ZodBase64URL",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ki),me.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Zd(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Hd=x("$ZodE164",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ku),me.init(e,t)});function Fd(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch(n){return!1}}const Bd=x("$ZodJWT",(e,t)=>{me.init(e,t),e._zod.check=n=>{Fd(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),ia=x("$ZodNumber",(e,t)=>{var n;ge.init(e,t),e._zod.pattern=(n=e._zod.bag.pattern)!=null?n:ta,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(d){}const i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;const a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push(y({expected:"number",code:"invalid_type",input:i,inst:e},a?{received:a}:{})),r}}),Gd=x("$ZodNumberFormat",(e,t)=>{cd.init(e,t),ia.init(e,t)}),Wd=x("$ZodBoolean",(e,t)=>{ge.init(e,t),e._zod.pattern=od,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch(i){}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),Jd=x("$ZodAny",(e,t)=>{ge.init(e,t),e._zod.parse=n=>n}),Yd=x("$ZodUnknown",(e,t)=>{ge.init(e,t),e._zod.parse=n=>n}),Vd=x("$ZodNever",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function aa(e,t,n){e.issues.length&&t.issues.push(...Vn(n,e.issues)),t.value[n]=e.value}const Xd=x("$ZodArray",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const d=o[a],u=t.element._zod.run({value:d,issues:[]},r);u instanceof Promise?i.push(u.then(p=>aa(p,n,a))):aa(u,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function uo(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Vn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function ca(e){var r,o,i,a;const t=Object.keys(e.shape);for(const d of t)if(!((a=(i=(o=(r=e.shape)==null?void 0:r[d])==null?void 0:o._zod)==null?void 0:i.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${d}": expected a Zod schema`);const n=gu(e.shape);return D(y({},e),{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)})}function la(e,t,n,r,o,i){const a=[],d=o.keySet,u=o.catchall._zod,p=u.def.type,h=u.optout==="optional";for(const g in t){if(d.has(g))continue;if(p==="never"){a.push(g);continue}const m=u.run({value:t[g],issues:[]},r);m instanceof Promise?e.push(m.then(k=>uo(k,n,g,t,h))):uo(m,n,g,t,h)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const Kd=x("$ZodObject",(e,t)=>{ge.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const d=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u=y({},d);return Object.defineProperty(t,"shape",{value:u}),u}})}const r=so(()=>ca(t));te(e._zod,"propValues",()=>{var p;const d=t.shape,u={};for(const h in d){const g=d[h]._zod;if(g.values){(p=u[h])!=null||(u[h]=new Set);for(const m of g.values)u[h].add(m)}}return u});const o=yr,i=t.catchall;let a;e._zod.parse=(d,u)=>{a!=null||(a=r.value);const p=d.value;if(!o(p))return d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d;d.value={};const h=[],g=a.shape;for(const m of a.keys){const k=g[m],w=k._zod.optout==="optional",v=k._zod.run({value:p[m],issues:[]},u);v instanceof Promise?h.push(v.then(Z=>uo(Z,d,m,p,w))):uo(v,d,m,p,w)}return i?la(h,p,d,u,r.value,e):h.length?Promise.all(h).then(()=>d):d}}),Qd=x("$ZodObjectJIT",(e,t)=>{Kd.init(e,t);const n=e._zod.parse,r=so(()=>ca(t)),o=m=>{var E;const k=new _d(["shape","payload","ctx"]),w=r.value,v=T=>{const A=Bi(T);return`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`};k.write("const input = payload.value;");const Z=Object.create(null);let K=0;for(const T of w.keys)Z[T]=`key_${K++}`;k.write("const newResult = {};");for(const T of w.keys){const A=Z[T],N=Bi(T),J=m[T],we=((E=J==null?void 0:J._zod)==null?void 0:E.optout)==="optional";k.write(`const ${A} = ${v(T)};`),we?k.write(`
1476
- if (${A}.issues.length) {
1477
- if (${N} in input) {
1478
- payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
1535
+ `))}}const Yd={major:4,minor:3,patch:5},me=w("$ZodType",(e,t)=>{var o,i,a;var n;e!=null||(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Yd;const r=[...(o=e._zod.def.checks)!=null?o:[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const d of r)for(const l of d._zod.onattach)l(e);if(r.length===0)(i=(n=e._zod).deferred)!=null||(n.deferred=[]),(a=e._zod.deferred)==null||a.push(()=>{e._zod.run=e._zod.parse});else{const d=(p,h,g)=>{let m=nr(p),k;for(const y of h){if(y._zod.def.when){if(!y._zod.def.when(p))continue}else if(m)continue;const S=p.issues.length,$=y._zod.check(p);if($ instanceof Promise&&(g==null?void 0:g.async)===!1)throw new Qn;if(k||$ instanceof Promise)k=(k!=null?k:Promise.resolve()).then(()=>z(null,null,function*(){yield $,p.issues.length!==S&&(m||(m=nr(p,S)))}));else{if(p.issues.length===S)continue;m||(m=nr(p,S))}}return k?k.then(()=>p):p},l=(p,h,g)=>{if(nr(p))return p.aborted=!0,p;const m=d(h,r,g);if(m instanceof Promise){if(g.async===!1)throw new Qn;return m.then(k=>e._zod.parse(k,g))}return e._zod.parse(m,g)};e._zod.run=(p,h)=>{if(h.skipChecks)return e._zod.parse(p,h);if(h.direction==="backward"){const m=e._zod.parse({value:p.value,issues:[]},M(v({},h),{skipChecks:!0}));return m instanceof Promise?m.then(k=>l(k,p,h)):l(m,p,h)}const g=e._zod.parse(p,h);if(g instanceof Promise){if(h.async===!1)throw new Qn;return g.then(m=>d(m,r,h))}return d(g,r,h)}}ne(e,"~standard",()=>({validate:d=>{var l;try{const p=td(e,d);return p.success?{value:p.data}:{issues:(l=p.error)==null?void 0:l.issues}}catch(p){return nd(e,d).then(h=>{var g;return h.success?{value:h.data}:{issues:(g=h.error)==null?void 0:g.issues}})}},vendor:"zod",version:1}))}),Ms=w("$ZodString",(e,t)=>{var n,r,o;me.init(e,t),e._zod.pattern=(o=[...(r=(n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)!=null?r:[]].pop())!=null?o:Ld(e._zod.bag),e._zod.parse=(i,a)=>{if(t.coerce)try{i.value=String(i.value)}catch(d){}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),be=w("$ZodStringFormat",(e,t)=>{So.init(e,t),Ms.init(e,t)}),Vd=w("$ZodGUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=kd),be.init(e,t)}),Xd=w("$ZodUUID",(e,t)=>{var n,r;if(t.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);(n=t.pattern)!=null||(t.pattern=ma(i))}else(r=t.pattern)!=null||(t.pattern=ma());be.init(e,t)}),Kd=w("$ZodEmail",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=_d),be.init(e,t)}),Qd=w("$ZodURL",(e,t)=>{be.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),ep=w("$ZodEmoji",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=yd()),be.init(e,t)}),tp=w("$ZodNanoID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=md),be.init(e,t)}),np=w("$ZodCUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=dd),be.init(e,t)}),rp=w("$ZodCUID2",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=pd),be.init(e,t)}),op=w("$ZodULID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=hd),be.init(e,t)}),sp=w("$ZodXID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=fd),be.init(e,t)}),ip=w("$ZodKSUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=gd),be.init(e,t)}),ap=w("$ZodISODateTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Rd(t)),be.init(e,t)}),cp=w("$ZodISODate",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Cd),be.init(e,t)}),lp=w("$ZodISOTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Pd(t)),be.init(e,t)}),up=w("$ZodISODuration",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=bd),be.init(e,t)}),dp=w("$ZodIPv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=wd),be.init(e,t),e._zod.bag.format="ipv4"}),pp=w("$ZodIPv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=xd),be.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch(o){r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),hp=w("$ZodCIDRv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Sd),be.init(e,t)}),fp=w("$ZodCIDRv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Td),be.init(e,t),e._zod.check=r=>{const o=r.value.split("/");try{if(o.length!==2)throw new Error;const[i,a]=o;if(!a)throw new Error;const d=Number(a);if(`${d}`!==a)throw new Error;if(d<0||d>128)throw new Error;new URL(`http://[${i}]`)}catch(i){r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Sa(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch(t){return!1}}const gp=w("$ZodBase64",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ed),be.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Sa(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function mp(e){if(!ba.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Sa(n)}const bp=w("$ZodBase64URL",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ba),be.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{mp(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),kp=w("$ZodE164",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ad),be.init(e,t)});function _p(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch(n){return!1}}const vp=w("$ZodJWT",(e,t)=>{be.init(e,t),e._zod.check=n=>{_p(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Ta=w("$ZodNumber",(e,t)=>{var n;me.init(e,t),e._zod.pattern=(n=e._zod.bag.pattern)!=null?n:va,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(d){}const i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;const a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push(v({expected:"number",code:"invalid_type",input:i,inst:e},a?{received:a}:{})),r}}),yp=w("$ZodNumberFormat",(e,t)=>{Dd.init(e,t),Ta.init(e,t)}),wp=w("$ZodBoolean",(e,t)=>{me.init(e,t),e._zod.pattern=$d,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch(i){}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),xp=w("$ZodAny",(e,t)=>{me.init(e,t),e._zod.parse=n=>n}),Sp=w("$ZodUnknown",(e,t)=>{me.init(e,t),e._zod.parse=n=>n}),Tp=w("$ZodNever",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Ea(e,t,n){e.issues.length&&t.issues.push(...rr(n,e.issues)),t.value[n]=e.value}const Ep=w("$ZodArray",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const d=o[a],l=t.element._zod.run({value:d,issues:[]},r);l instanceof Promise?i.push(l.then(p=>Ea(p,n,a))):Ea(l,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function To(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...rr(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Aa(e){var r,o,i,a;const t=Object.keys(e.shape);for(const d of t)if(!((a=(i=(o=(r=e.shape)==null?void 0:r[d])==null?void 0:o._zod)==null?void 0:i.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${d}": expected a Zod schema`);const n=Fu(e.shape);return M(v({},e),{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)})}function Ca(e,t,n,r,o,i){const a=[],d=o.keySet,l=o.catchall._zod,p=l.def.type,h=l.optout==="optional";for(const g in t){if(d.has(g))continue;if(p==="never"){a.push(g);continue}const m=l.run({value:t[g],issues:[]},r);m instanceof Promise?e.push(m.then(k=>To(k,n,g,t,h))):To(m,n,g,t,h)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const Ap=w("$ZodObject",(e,t)=>{me.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const d=t.shape;Object.defineProperty(t,"shape",{get:()=>{const l=v({},d);return Object.defineProperty(t,"shape",{value:l}),l}})}const r=vo(()=>Aa(t));ne(e._zod,"propValues",()=>{var p;const d=t.shape,l={};for(const h in d){const g=d[h]._zod;if(g.values){(p=l[h])!=null||(l[h]=new Set);for(const m of g.values)l[h].add(m)}}return l});const o=Pr,i=t.catchall;let a;e._zod.parse=(d,l)=>{a!=null||(a=r.value);const p=d.value;if(!o(p))return d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d;d.value={};const h=[],g=a.shape;for(const m of a.keys){const k=g[m],y=k._zod.optout==="optional",S=k._zod.run({value:p[m],issues:[]},l);S instanceof Promise?h.push(S.then($=>To($,d,m,p,y))):To(S,d,m,p,y)}return i?Ca(h,p,d,l,r.value,e):h.length?Promise.all(h).then(()=>d):d}}),Cp=w("$ZodObjectJIT",(e,t)=>{Ap.init(e,t);const n=e._zod.parse,r=vo(()=>Aa(t)),o=m=>{var A;const k=new Jd(["shape","payload","ctx"]),y=r.value,S=T=>{const L=ua(T);return`shape[${L}]._zod.run({ value: input[${L}], issues: [] }, ctx)`};k.write("const input = payload.value;");const $=Object.create(null);let E=0;for(const T of y.keys)$[T]=`key_${E++}`;k.write("const newResult = {};");for(const T of y.keys){const L=$[T],q=ua(T),H=m[T],se=((A=H==null?void 0:H._zod)==null?void 0:A.optout)==="optional";k.write(`const ${L} = ${S(T)};`),se?k.write(`
1536
+ if (${L}.issues.length) {
1537
+ if (${q} in input) {
1538
+ payload.issues = payload.issues.concat(${L}.issues.map(iss => ({
1479
1539
  ...iss,
1480
- path: iss.path ? [${N}, ...iss.path] : [${N}]
1540
+ path: iss.path ? [${q}, ...iss.path] : [${q}]
1481
1541
  })));
1482
1542
  }
1483
1543
  }
1484
1544
 
1485
- if (${A}.value === undefined) {
1486
- if (${N} in input) {
1487
- newResult[${N}] = undefined;
1545
+ if (${L}.value === undefined) {
1546
+ if (${q} in input) {
1547
+ newResult[${q}] = undefined;
1488
1548
  }
1489
1549
  } else {
1490
- newResult[${N}] = ${A}.value;
1550
+ newResult[${q}] = ${L}.value;
1491
1551
  }
1492
1552
 
1493
1553
  `):k.write(`
1494
- if (${A}.issues.length) {
1495
- payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
1554
+ if (${L}.issues.length) {
1555
+ payload.issues = payload.issues.concat(${L}.issues.map(iss => ({
1496
1556
  ...iss,
1497
- path: iss.path ? [${N}, ...iss.path] : [${N}]
1557
+ path: iss.path ? [${q}, ...iss.path] : [${q}]
1498
1558
  })));
1499
1559
  }
1500
1560
 
1501
- if (${A}.value === undefined) {
1502
- if (${N} in input) {
1503
- newResult[${N}] = undefined;
1561
+ if (${L}.value === undefined) {
1562
+ if (${q} in input) {
1563
+ newResult[${q}] = undefined;
1504
1564
  }
1505
1565
  } else {
1506
- newResult[${N}] = ${A}.value;
1566
+ newResult[${q}] = ${L}.value;
1507
1567
  }
1508
1568
 
1509
- `)}k.write("payload.value = newResult;"),k.write("return payload;");const U=k.compile();return(T,A)=>U(m,T,A)};let i;const a=yr,d=!qi.jitless,p=d&&hu.value,h=t.catchall;let g;e._zod.parse=(m,k)=>{g!=null||(g=r.value);const w=m.value;return a(w)?d&&p&&(k==null?void 0:k.async)===!1&&k.jitless!==!0?(i||(i=o(t.shape)),m=i(m,k),h?la([],w,m,k,g,e):m):n(m,k):(m.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),m)}});function ua(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!Yn(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(a=>dn(a,r,cn())))}),t)}const da=x("$ZodUnion",(e,t)=>{ge.init(e,t),te(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),te(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),te(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),te(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>_s(i.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let a=!1;const d=[];for(const u of t.options){const p=u._zod.run({value:o.value,issues:[]},i);if(p instanceof Promise)d.push(p),a=!0;else{if(p.issues.length===0)return p;d.push(p)}}return a?Promise.all(d).then(u=>ua(u,o,e,i)):ua(d,o,e,i)}}),ep=x("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,da.init(e,t);const n=e._zod.parse;te(e._zod,"propValues",()=>{const o={};for(const i of t.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[d,u]of Object.entries(a)){o[d]||(o[d]=new Set);for(const p of u)o[d].add(p)}}return o});const r=so(()=>{var a;const o=t.options,i=new Map;for(const d of o){const u=(a=d._zod.propValues)==null?void 0:a[t.discriminator];if(!u||u.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(d)}"`);for(const p of u){if(i.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);i.set(p,d)}}return i});e._zod.parse=(o,i)=>{const a=o.value;if(!yr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const d=r.value.get(a==null?void 0:a[t.discriminator]);return d?d._zod.run(o,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),tp=x("$ZodIntersection",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([u,p])=>pa(n,u,p)):pa(n,i,a)}});function Ss(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Wn(e)&&Wn(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o=y(y({},e),t);for(const i of r){const a=Ss(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],a=Ss(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function pa(e,t,n){const r=new Map;let o;for(const d of t.issues)if(d.code==="unrecognized_keys"){o!=null||(o=d);for(const u of d.keys)r.has(u)||r.set(u,{}),r.get(u).l=!0}else e.issues.push(d);for(const d of n.issues)if(d.code==="unrecognized_keys")for(const u of d.keys)r.has(u)||r.set(u,{}),r.get(u).r=!0;else e.issues.push(d);const i=[...r].filter(([,d])=>d.l&&d.r).map(([d])=>d);if(i.length&&o&&e.issues.push(D(y({},o),{keys:i})),Yn(e))return e;const a=Ss(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const np=x("$ZodRecord",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Wn(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],a=t.keyType._zod.values;if(a){n.value={};const d=new Set;for(const p of a)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){d.add(typeof p=="number"?p.toString():p);const h=t.valueType._zod.run({value:o[p],issues:[]},r);h instanceof Promise?i.push(h.then(g=>{g.issues.length&&n.issues.push(...Vn(p,g.issues)),n.value[p]=g.value})):(h.issues.length&&n.issues.push(...Vn(p,h.issues)),n.value[p]=h.value)}let u;for(const p in o)d.has(p)||(u=u!=null?u:[],u.push(p));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:u})}else{n.value={};for(const d of Reflect.ownKeys(o)){if(d==="__proto__")continue;let u=t.keyType._zod.run({value:d,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof d=="string"&&ta.test(d)&&u.issues.length&&u.issues.some(g=>g.code==="invalid_type"&&g.expected==="number")){const g=t.keyType._zod.run({value:Number(d),issues:[]},r);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(u=g)}if(u.issues.length){t.mode==="loose"?n.value[d]=o[d]:n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(g=>dn(g,r,cn())),input:d,path:[d],inst:e});continue}const h=t.valueType._zod.run({value:o[d],issues:[]},r);h instanceof Promise?i.push(h.then(g=>{g.issues.length&&n.issues.push(...Vn(d,g.issues)),n.value[u.value]=g.value})):(h.issues.length&&n.issues.push(...Vn(d,h.issues)),n.value[u.value]=h.value)}}return i.length?Promise.all(i).then(()=>n):n}}),rp=x("$ZodEnum",(e,t)=>{ge.init(e,t);const n=Hi(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>fu.has(typeof o)).map(o=>typeof o=="string"?Jn(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),op=x("$ZodLiteral",(e,t)=>{if(ge.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Jn(r):r?Jn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),sp=x("$ZodTransform",(e,t)=>{ge.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Zi(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new Gn;return n.value=o,n}});function ha(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const fa=x("$ZodOptional",(e,t)=>{ge.init(e,t),e._zod.optin="optional",e._zod.optout="optional",te(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),te(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${_s(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>ha(i,n.value)):ha(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),ip=x("$ZodExactOptional",(e,t)=>{fa.init(e,t),te(e._zod,"values",()=>t.innerType._zod.values),te(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),ap=x("$ZodNullable",(e,t)=>{ge.init(e,t),te(e._zod,"optin",()=>t.innerType._zod.optin),te(e._zod,"optout",()=>t.innerType._zod.optout),te(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${_s(n.source)}|null)$`):void 0}),te(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),cp=x("$ZodDefault",(e,t)=>{ge.init(e,t),e._zod.optin="optional",te(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>ga(i,t)):ga(o,t)}});function ga(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const lp=x("$ZodPrefault",(e,t)=>{ge.init(e,t),e._zod.optin="optional",te(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),up=x("$ZodNonOptional",(e,t)=>{ge.init(e,t),te(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>ma(i,e)):ma(o,e)}});function ma(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const dp=x("$ZodCatch",(e,t)=>{ge.init(e,t),te(e._zod,"optin",()=>t.innerType._zod.optin),te(e._zod,"optout",()=>t.innerType._zod.optout),te(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue(D(y({},n),{error:{issues:i.issues.map(a=>dn(a,r,cn()))},input:n.value})),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue(D(y({},n),{error:{issues:o.issues.map(i=>dn(i,r,cn()))},input:n.value})),n.issues=[]),n)}}),pp=x("$ZodPipe",(e,t)=>{ge.init(e,t),te(e._zod,"values",()=>t.in._zod.values),te(e._zod,"optin",()=>t.in._zod.optin),te(e._zod,"optout",()=>t.out._zod.optout),te(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(a=>po(a,t.in,r)):po(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>po(i,t.out,r)):po(o,t.out,r)}});function po(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const hp=x("$ZodReadonly",(e,t)=>{ge.init(e,t),te(e._zod,"propValues",()=>t.innerType._zod.propValues),te(e._zod,"values",()=>t.innerType._zod.values),te(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),te(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(ba):ba(o)}});function ba(e){return e.value=Object.freeze(e.value),e}const fp=x("$ZodCustom",(e,t)=>{at.init(e,t),ge.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>ka(i,n,r,e));ka(o,n,r,e)}});function ka(e,t,n,r){var o;if(!e){const i={code:"custom",input:n,inst:r,path:[...(o=r._zod.def.path)!=null?o:[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(wr(i))}}var _a;class gp{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){var r;const n=t._zod.parent;if(n){const o=y({},(r=this.get(n))!=null?r:{});delete o.id;const i=y(y({},o),this._map.get(t));return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function mp(){return new gp}(Al=(_a=globalThis).__zod_globalRegistry)!=null||(_a.__zod_globalRegistry=mp());const xr=globalThis.__zod_globalRegistry;function bp(e,t){return new e(y({type:"string"},M(t)))}function kp(e,t){return new e(y({type:"string",format:"email",check:"string_format",abort:!1},M(t)))}function va(e,t){return new e(y({type:"string",format:"guid",check:"string_format",abort:!1},M(t)))}function _p(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1},M(t)))}function vp(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4"},M(t)))}function yp(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6"},M(t)))}function wp(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7"},M(t)))}function xp(e,t){return new e(y({type:"string",format:"url",check:"string_format",abort:!1},M(t)))}function Sp(e,t){return new e(y({type:"string",format:"emoji",check:"string_format",abort:!1},M(t)))}function Tp(e,t){return new e(y({type:"string",format:"nanoid",check:"string_format",abort:!1},M(t)))}function Ep(e,t){return new e(y({type:"string",format:"cuid",check:"string_format",abort:!1},M(t)))}function Ap(e,t){return new e(y({type:"string",format:"cuid2",check:"string_format",abort:!1},M(t)))}function Cp(e,t){return new e(y({type:"string",format:"ulid",check:"string_format",abort:!1},M(t)))}function Pp(e,t){return new e(y({type:"string",format:"xid",check:"string_format",abort:!1},M(t)))}function Rp(e,t){return new e(y({type:"string",format:"ksuid",check:"string_format",abort:!1},M(t)))}function Lp(e,t){return new e(y({type:"string",format:"ipv4",check:"string_format",abort:!1},M(t)))}function Ip(e,t){return new e(y({type:"string",format:"ipv6",check:"string_format",abort:!1},M(t)))}function zp(e,t){return new e(y({type:"string",format:"cidrv4",check:"string_format",abort:!1},M(t)))}function $p(e,t){return new e(y({type:"string",format:"cidrv6",check:"string_format",abort:!1},M(t)))}function Op(e,t){return new e(y({type:"string",format:"base64",check:"string_format",abort:!1},M(t)))}function Np(e,t){return new e(y({type:"string",format:"base64url",check:"string_format",abort:!1},M(t)))}function Dp(e,t){return new e(y({type:"string",format:"e164",check:"string_format",abort:!1},M(t)))}function Mp(e,t){return new e(y({type:"string",format:"jwt",check:"string_format",abort:!1},M(t)))}function Up(e,t){return new e(y({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null},M(t)))}function jp(e,t){return new e(y({type:"string",format:"date",check:"string_format"},M(t)))}function Zp(e,t){return new e(y({type:"string",format:"time",check:"string_format",precision:null},M(t)))}function qp(e,t){return new e(y({type:"string",format:"duration",check:"string_format"},M(t)))}function Hp(e,t){return new e(y({type:"number",checks:[]},M(t)))}function Fp(e,t){return new e(y({type:"number",check:"number_format",abort:!1,format:"safeint"},M(t)))}function Bp(e,t){return new e(y({type:"boolean"},M(t)))}function Gp(e){return new e({type:"any"})}function Wp(e){return new e({type:"unknown"})}function Jp(e,t){return new e(y({type:"never"},M(t)))}function ya(e,t){return new ra(D(y({check:"less_than"},M(t)),{value:e,inclusive:!1}))}function Ts(e,t){return new ra(D(y({check:"less_than"},M(t)),{value:e,inclusive:!0}))}function wa(e,t){return new oa(D(y({check:"greater_than"},M(t)),{value:e,inclusive:!1}))}function Es(e,t){return new oa(D(y({check:"greater_than"},M(t)),{value:e,inclusive:!0}))}function xa(e,t){return new ad(D(y({check:"multiple_of"},M(t)),{value:e}))}function Sa(e,t){return new ld(D(y({check:"max_length"},M(t)),{maximum:e}))}function ho(e,t){return new ud(D(y({check:"min_length"},M(t)),{minimum:e}))}function Ta(e,t){return new dd(D(y({check:"length_equals"},M(t)),{length:e}))}function Yp(e,t){return new pd(D(y({check:"string_format",format:"regex"},M(t)),{pattern:e}))}function Vp(e){return new hd(y({check:"string_format",format:"lowercase"},M(e)))}function Xp(e){return new fd(y({check:"string_format",format:"uppercase"},M(e)))}function Kp(e,t){return new gd(D(y({check:"string_format",format:"includes"},M(t)),{includes:e}))}function Qp(e,t){return new md(D(y({check:"string_format",format:"starts_with"},M(t)),{prefix:e}))}function eh(e,t){return new bd(D(y({check:"string_format",format:"ends_with"},M(t)),{suffix:e}))}function Xn(e){return new kd({check:"overwrite",tx:e})}function th(e){return Xn(t=>t.normalize(e))}function nh(){return Xn(e=>e.trim())}function rh(){return Xn(e=>e.toLowerCase())}function oh(){return Xn(e=>e.toUpperCase())}function sh(){return Xn(e=>pu(e))}function ih(e,t,n){return new e(y({type:"array",element:t},M(n)))}function ah(e,t,n){return new e(y({type:"custom",check:"custom",fn:t},M(n)))}function ch(e){const t=lh(n=>(n.addIssue=r=>{var o,i,a,d;if(typeof r=="string")n.issues.push(wr(r,n.value,t._zod.def));else{const u=r;u.fatal&&(u.continue=!1),(o=u.code)!=null||(u.code="custom"),(i=u.input)!=null||(u.input=n.value),(a=u.inst)!=null||(u.inst=t),(d=u.continue)!=null||(u.continue=!t._zod.def.abort),n.issues.push(wr(u))}},e(n.value,n)));return t}function lh(e,t){const n=new at(y({check:"custom"},M(t)));return n._zod.check=e,n}function Ea(e){var n,r,o,i,a,d,u,p,h;let t=(n=e==null?void 0:e.target)!=null?n:"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:(r=e.processors)!=null?r:{},metadataRegistry:(o=e==null?void 0:e.metadata)!=null?o:xr,target:t,unrepresentable:(i=e==null?void 0:e.unrepresentable)!=null?i:"throw",override:(a=e==null?void 0:e.override)!=null?a:(()=>{}),io:(d=e==null?void 0:e.io)!=null?d:"output",counter:0,seen:new Map,cycles:(u=e==null?void 0:e.cycles)!=null?u:"ref",reused:(p=e==null?void 0:e.reused)!=null?p:"inline",external:(h=e==null?void 0:e.external)!=null?h:void 0}}function Ce(e,t,n={path:[],schemaPath:[]}){var h,g,m;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const d=(g=(h=e._zod).toJSONSchema)==null?void 0:g.call(h);if(d)a.schema=d;else{const k=D(y({},n),{schemaPath:[...n.schemaPath,e],path:n.path});if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,k);else{const v=a.schema,Z=t.processors[o.type];if(!Z)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);Z(e,t,v,k)}const w=e._zod.parent;w&&(a.ref||(a.ref=w),Ce(w,t,k),t.seen.get(w).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),t.io==="input"&&Qe(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((m=(r=a.schema).default)!=null||(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function Aa(e,t){var a,d,u,p;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const h of e.seen.entries()){const g=(a=e.metadataRegistry.get(h[0]))==null?void 0:a.id;if(g){const m=r.get(g);if(m&&m!==h[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(g,h[0])}}const o=h=>{var v,Z,K,U,E;const g=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const T=(v=e.external.registry.get(h[0]))==null?void 0:v.id,A=(Z=e.external.uri)!=null?Z:(J=>J);if(T)return{ref:A(T)};const N=(U=(K=h[1].defId)!=null?K:h[1].schema.id)!=null?U:`schema${e.counter++}`;return h[1].defId=N,{defId:N,ref:`${A("__shared")}#/${g}/${N}`}}if(h[1]===n)return{ref:"#"};const k=`#/${g}/`,w=(E=h[1].schema.id)!=null?E:`__schema${e.counter++}`;return{defId:w,ref:k+w}},i=h=>{if(h[1].schema.$ref)return;const g=h[1],{ref:m,defId:k}=o(h);g.def=y({},g.schema),k&&(g.defId=k);const w=g.schema;for(const v in w)delete w[v];w.$ref=m};if(e.cycles==="throw")for(const h of e.seen.entries()){const g=h[1];if(g.cycle)throw new Error(`Cycle detected: #/${(d=g.cycle)==null?void 0:d.join("/")}/<root>
1569
+ `)}k.write("payload.value = newResult;"),k.write("return payload;");const j=k.compile();return(T,L)=>j(m,T,L)};let i;const a=Pr,d=!aa.jitless,p=d&&qu.value,h=t.catchall;let g;e._zod.parse=(m,k)=>{g!=null||(g=r.value);const y=m.value;return a(y)?d&&p&&(k==null?void 0:k.async)===!1&&k.jitless!==!0?(i||(i=o(t.shape)),m=i(m,k),h?Ca([],y,m,k,g,e):m):n(m,k):(m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m)}});function Pa(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!nr(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(a=>kn(a,r,gn())))}),t)}const Ra=w("$ZodUnion",(e,t)=>{me.init(e,t),ne(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),ne(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),ne(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),ne(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>zs(i.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let a=!1;const d=[];for(const l of t.options){const p=l._zod.run({value:o.value,issues:[]},i);if(p instanceof Promise)d.push(p),a=!0;else{if(p.issues.length===0)return p;d.push(p)}}return a?Promise.all(d).then(l=>Pa(l,o,e,i)):Pa(d,o,e,i)}}),Pp=w("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ra.init(e,t);const n=e._zod.parse;ne(e._zod,"propValues",()=>{const o={};for(const i of t.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[d,l]of Object.entries(a)){o[d]||(o[d]=new Set);for(const p of l)o[d].add(p)}}return o});const r=vo(()=>{var a;const o=t.options,i=new Map;for(const d of o){const l=(a=d._zod.propValues)==null?void 0:a[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(d)}"`);for(const p of l){if(i.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);i.set(p,d)}}return i});e._zod.parse=(o,i)=>{const a=o.value;if(!Pr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const d=r.value.get(a==null?void 0:a[t.discriminator]);return d?d._zod.run(o,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),Rp=w("$ZodIntersection",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([l,p])=>La(n,l,p)):La(n,i,a)}});function Us(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(er(e)&&er(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o=v(v({},e),t);for(const i of r){const a=Us(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],a=Us(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function La(e,t,n){const r=new Map;let o;for(const d of t.issues)if(d.code==="unrecognized_keys"){o!=null||(o=d);for(const l of d.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else e.issues.push(d);for(const d of n.issues)if(d.code==="unrecognized_keys")for(const l of d.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else e.issues.push(d);const i=[...r].filter(([,d])=>d.l&&d.r).map(([d])=>d);if(i.length&&o&&e.issues.push(M(v({},o),{keys:i})),nr(e))return e;const a=Us(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const Lp=w("$ZodRecord",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!er(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],a=t.keyType._zod.values;if(a){n.value={};const d=new Set;for(const p of a)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){d.add(typeof p=="number"?p.toString():p);const h=t.valueType._zod.run({value:o[p],issues:[]},r);h instanceof Promise?i.push(h.then(g=>{g.issues.length&&n.issues.push(...rr(p,g.issues)),n.value[p]=g.value})):(h.issues.length&&n.issues.push(...rr(p,h.issues)),n.value[p]=h.value)}let l;for(const p in o)d.has(p)||(l=l!=null?l:[],l.push(p));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l})}else{n.value={};for(const d of Reflect.ownKeys(o)){if(d==="__proto__")continue;let l=t.keyType._zod.run({value:d,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof d=="string"&&va.test(d)&&l.issues.length&&l.issues.some(g=>g.code==="invalid_type"&&g.expected==="number")){const g=t.keyType._zod.run({value:Number(d),issues:[]},r);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(l=g)}if(l.issues.length){t.mode==="loose"?n.value[d]=o[d]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>kn(g,r,gn())),input:d,path:[d],inst:e});continue}const h=t.valueType._zod.run({value:o[d],issues:[]},r);h instanceof Promise?i.push(h.then(g=>{g.issues.length&&n.issues.push(...rr(d,g.issues)),n.value[l.value]=g.value})):(h.issues.length&&n.issues.push(...rr(d,h.issues)),n.value[l.value]=h.value)}}return i.length?Promise.all(i).then(()=>n):n}}),Ip=w("$ZodEnum",(e,t)=>{me.init(e,t);const n=ca(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Hu.has(typeof o)).map(o=>typeof o=="string"?tr(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),$p=w("$ZodLiteral",(e,t)=>{if(me.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?tr(r):r?tr(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),zp=w("$ZodTransform",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ia(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new Qn;return n.value=o,n}});function Ia(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const $a=w("$ZodOptional",(e,t)=>{me.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ne(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ne(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${zs(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Ia(i,n.value)):Ia(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Op=w("$ZodExactOptional",(e,t)=>{$a.init(e,t),ne(e._zod,"values",()=>t.innerType._zod.values),ne(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Np=w("$ZodNullable",(e,t)=>{me.init(e,t),ne(e._zod,"optin",()=>t.innerType._zod.optin),ne(e._zod,"optout",()=>t.innerType._zod.optout),ne(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${zs(n.source)}|null)$`):void 0}),ne(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Dp=w("$ZodDefault",(e,t)=>{me.init(e,t),e._zod.optin="optional",ne(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>za(i,t)):za(o,t)}});function za(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Mp=w("$ZodPrefault",(e,t)=>{me.init(e,t),e._zod.optin="optional",ne(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Up=w("$ZodNonOptional",(e,t)=>{me.init(e,t),ne(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Oa(i,e)):Oa(o,e)}});function Oa(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const jp=w("$ZodCatch",(e,t)=>{me.init(e,t),ne(e._zod,"optin",()=>t.innerType._zod.optin),ne(e._zod,"optout",()=>t.innerType._zod.optout),ne(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue(M(v({},n),{error:{issues:i.issues.map(a=>kn(a,r,gn()))},input:n.value})),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue(M(v({},n),{error:{issues:o.issues.map(i=>kn(i,r,gn()))},input:n.value})),n.issues=[]),n)}}),Zp=w("$ZodPipe",(e,t)=>{me.init(e,t),ne(e._zod,"values",()=>t.in._zod.values),ne(e._zod,"optin",()=>t.in._zod.optin),ne(e._zod,"optout",()=>t.out._zod.optout),ne(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(a=>Eo(a,t.in,r)):Eo(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>Eo(i,t.out,r)):Eo(o,t.out,r)}});function Eo(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const qp=w("$ZodReadonly",(e,t)=>{me.init(e,t),ne(e._zod,"propValues",()=>t.innerType._zod.propValues),ne(e._zod,"values",()=>t.innerType._zod.values),ne(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),ne(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Na):Na(o)}});function Na(e){return e.value=Object.freeze(e.value),e}const Hp=w("$ZodCustom",(e,t)=>{st.init(e,t),me.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>Da(i,n,r,e));Da(o,n,r,e)}});function Da(e,t,n,r){var o;if(!e){const i={code:"custom",input:n,inst:r,path:[...(o=r._zod.def.path)!=null?o:[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(Rr(i))}}var Ma;class Fp{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){var r;const n=t._zod.parent;if(n){const o=v({},(r=this.get(n))!=null?r:{});delete o.id;const i=v(v({},o),this._map.get(t));return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Bp(){return new Fp}(eu=(Ma=globalThis).__zod_globalRegistry)!=null||(Ma.__zod_globalRegistry=Bp());const Lr=globalThis.__zod_globalRegistry;function Gp(e,t){return new e(v({type:"string"},U(t)))}function Wp(e,t){return new e(v({type:"string",format:"email",check:"string_format",abort:!1},U(t)))}function Ua(e,t){return new e(v({type:"string",format:"guid",check:"string_format",abort:!1},U(t)))}function Jp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1},U(t)))}function Yp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4"},U(t)))}function Vp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6"},U(t)))}function Xp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7"},U(t)))}function Kp(e,t){return new e(v({type:"string",format:"url",check:"string_format",abort:!1},U(t)))}function Qp(e,t){return new e(v({type:"string",format:"emoji",check:"string_format",abort:!1},U(t)))}function eh(e,t){return new e(v({type:"string",format:"nanoid",check:"string_format",abort:!1},U(t)))}function th(e,t){return new e(v({type:"string",format:"cuid",check:"string_format",abort:!1},U(t)))}function nh(e,t){return new e(v({type:"string",format:"cuid2",check:"string_format",abort:!1},U(t)))}function rh(e,t){return new e(v({type:"string",format:"ulid",check:"string_format",abort:!1},U(t)))}function oh(e,t){return new e(v({type:"string",format:"xid",check:"string_format",abort:!1},U(t)))}function sh(e,t){return new e(v({type:"string",format:"ksuid",check:"string_format",abort:!1},U(t)))}function ih(e,t){return new e(v({type:"string",format:"ipv4",check:"string_format",abort:!1},U(t)))}function ah(e,t){return new e(v({type:"string",format:"ipv6",check:"string_format",abort:!1},U(t)))}function ch(e,t){return new e(v({type:"string",format:"cidrv4",check:"string_format",abort:!1},U(t)))}function lh(e,t){return new e(v({type:"string",format:"cidrv6",check:"string_format",abort:!1},U(t)))}function uh(e,t){return new e(v({type:"string",format:"base64",check:"string_format",abort:!1},U(t)))}function dh(e,t){return new e(v({type:"string",format:"base64url",check:"string_format",abort:!1},U(t)))}function ph(e,t){return new e(v({type:"string",format:"e164",check:"string_format",abort:!1},U(t)))}function hh(e,t){return new e(v({type:"string",format:"jwt",check:"string_format",abort:!1},U(t)))}function fh(e,t){return new e(v({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null},U(t)))}function gh(e,t){return new e(v({type:"string",format:"date",check:"string_format"},U(t)))}function mh(e,t){return new e(v({type:"string",format:"time",check:"string_format",precision:null},U(t)))}function bh(e,t){return new e(v({type:"string",format:"duration",check:"string_format"},U(t)))}function kh(e,t){return new e(v({type:"number",checks:[]},U(t)))}function _h(e,t){return new e(v({type:"number",check:"number_format",abort:!1,format:"safeint"},U(t)))}function vh(e,t){return new e(v({type:"boolean"},U(t)))}function yh(e){return new e({type:"any"})}function wh(e){return new e({type:"unknown"})}function xh(e,t){return new e(v({type:"never"},U(t)))}function ja(e,t){return new wa(M(v({check:"less_than"},U(t)),{value:e,inclusive:!1}))}function js(e,t){return new wa(M(v({check:"less_than"},U(t)),{value:e,inclusive:!0}))}function Za(e,t){return new xa(M(v({check:"greater_than"},U(t)),{value:e,inclusive:!1}))}function Zs(e,t){return new xa(M(v({check:"greater_than"},U(t)),{value:e,inclusive:!0}))}function qa(e,t){return new Nd(M(v({check:"multiple_of"},U(t)),{value:e}))}function Ha(e,t){return new Md(M(v({check:"max_length"},U(t)),{maximum:e}))}function Ao(e,t){return new Ud(M(v({check:"min_length"},U(t)),{minimum:e}))}function Fa(e,t){return new jd(M(v({check:"length_equals"},U(t)),{length:e}))}function Sh(e,t){return new Zd(M(v({check:"string_format",format:"regex"},U(t)),{pattern:e}))}function Th(e){return new qd(v({check:"string_format",format:"lowercase"},U(e)))}function Eh(e){return new Hd(v({check:"string_format",format:"uppercase"},U(e)))}function Ah(e,t){return new Fd(M(v({check:"string_format",format:"includes"},U(t)),{includes:e}))}function Ch(e,t){return new Bd(M(v({check:"string_format",format:"starts_with"},U(t)),{prefix:e}))}function Ph(e,t){return new Gd(M(v({check:"string_format",format:"ends_with"},U(t)),{suffix:e}))}function or(e){return new Wd({check:"overwrite",tx:e})}function Rh(e){return or(t=>t.normalize(e))}function Lh(){return or(e=>e.trim())}function Ih(){return or(e=>e.toLowerCase())}function $h(){return or(e=>e.toUpperCase())}function zh(){return or(e=>Zu(e))}function Oh(e,t,n){return new e(v({type:"array",element:t},U(n)))}function Nh(e,t,n){return new e(v({type:"custom",check:"custom",fn:t},U(n)))}function Dh(e){const t=Mh(n=>(n.addIssue=r=>{var o,i,a,d;if(typeof r=="string")n.issues.push(Rr(r,n.value,t._zod.def));else{const l=r;l.fatal&&(l.continue=!1),(o=l.code)!=null||(l.code="custom"),(i=l.input)!=null||(l.input=n.value),(a=l.inst)!=null||(l.inst=t),(d=l.continue)!=null||(l.continue=!t._zod.def.abort),n.issues.push(Rr(l))}},e(n.value,n)));return t}function Mh(e,t){const n=new st(v({check:"custom"},U(t)));return n._zod.check=e,n}function Ba(e){var n,r,o,i,a,d,l,p,h;let t=(n=e==null?void 0:e.target)!=null?n:"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:(r=e.processors)!=null?r:{},metadataRegistry:(o=e==null?void 0:e.metadata)!=null?o:Lr,target:t,unrepresentable:(i=e==null?void 0:e.unrepresentable)!=null?i:"throw",override:(a=e==null?void 0:e.override)!=null?a:(()=>{}),io:(d=e==null?void 0:e.io)!=null?d:"output",counter:0,seen:new Map,cycles:(l=e==null?void 0:e.cycles)!=null?l:"ref",reused:(p=e==null?void 0:e.reused)!=null?p:"inline",external:(h=e==null?void 0:e.external)!=null?h:void 0}}function Re(e,t,n={path:[],schemaPath:[]}){var h,g,m;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const d=(g=(h=e._zod).toJSONSchema)==null?void 0:g.call(h);if(d)a.schema=d;else{const k=M(v({},n),{schemaPath:[...n.schemaPath,e],path:n.path});if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,k);else{const S=a.schema,$=t.processors[o.type];if(!$)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);$(e,t,S,k)}const y=e._zod.parent;y&&(a.ref||(a.ref=y),Re(y,t,k),t.seen.get(y).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),t.io==="input"&&Ye(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((m=(r=a.schema).default)!=null||(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function Ga(e,t){var a,d,l,p;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const h of e.seen.entries()){const g=(a=e.metadataRegistry.get(h[0]))==null?void 0:a.id;if(g){const m=r.get(g);if(m&&m!==h[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(g,h[0])}}const o=h=>{var S,$,E,j,A;const g=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const T=(S=e.external.registry.get(h[0]))==null?void 0:S.id,L=($=e.external.uri)!=null?$:(H=>H);if(T)return{ref:L(T)};const q=(j=(E=h[1].defId)!=null?E:h[1].schema.id)!=null?j:`schema${e.counter++}`;return h[1].defId=q,{defId:q,ref:`${L("__shared")}#/${g}/${q}`}}if(h[1]===n)return{ref:"#"};const k=`#/${g}/`,y=(A=h[1].schema.id)!=null?A:`__schema${e.counter++}`;return{defId:y,ref:k+y}},i=h=>{if(h[1].schema.$ref)return;const g=h[1],{ref:m,defId:k}=o(h);g.def=v({},g.schema),k&&(g.defId=k);const y=g.schema;for(const S in y)delete y[S];y.$ref=m};if(e.cycles==="throw")for(const h of e.seen.entries()){const g=h[1];if(g.cycle)throw new Error(`Cycle detected: #/${(d=g.cycle)==null?void 0:d.join("/")}/<root>
1510
1570
 
1511
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const g=h[1];if(t===h[0]){i(h);continue}if(e.external){const k=(u=e.external.registry.get(h[0]))==null?void 0:u.id;if(t!==h[0]&&k){i(h);continue}}if((p=e.metadataRegistry.get(h[0]))==null?void 0:p.id){i(h);continue}if(g.cycle){i(h);continue}if(g.count>1&&e.reused==="ref"){i(h);continue}}}function Ca(e,t){var a,d,u,p,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=g=>{var K,U,E;const m=e.seen.get(g);if(m.ref===null)return;const k=(K=m.def)!=null?K:m.schema,w=y({},k),v=m.ref;if(m.ref=null,v){r(v);const T=e.seen.get(v),A=T.schema;if(A.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=(U=k.allOf)!=null?U:[],k.allOf.push(A)):Object.assign(k,A),Object.assign(k,w),g._zod.parent===v)for(const J in k)J==="$ref"||J==="allOf"||J in w||delete k[J];if(A.$ref)for(const J in k)J==="$ref"||J==="allOf"||J in T.def&&JSON.stringify(k[J])===JSON.stringify(T.def[J])&&delete k[J]}const Z=g._zod.parent;if(Z&&Z!==v){r(Z);const T=e.seen.get(Z);if(T!=null&&T.schema.$ref&&(k.$ref=T.schema.$ref,T.def))for(const A in k)A==="$ref"||A==="allOf"||A in T.def&&JSON.stringify(k[A])===JSON.stringify(T.def[A])&&delete k[A]}e.override({zodSchema:g,jsonSchema:k,path:(E=m.path)!=null?E:[]})};for(const g of[...e.seen.entries()].reverse())r(g[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const g=(d=e.external.registry.get(t))==null?void 0:d.id;if(!g)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(g)}Object.assign(o,(u=n.def)!=null?u:n.schema);const i=(h=(p=e.external)==null?void 0:p.defs)!=null?h:{};for(const g of e.seen.entries()){const m=g[1];m.def&&m.defId&&(i[m.defId]=m.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const g=JSON.parse(JSON.stringify(o));return Object.defineProperty(g,"~standard",{value:D(y({},t["~standard"]),{jsonSchema:{input:fo(t,"input",e.processors),output:fo(t,"output",e.processors)}}),enumerable:!1,writable:!1}),g}catch(g){throw new Error("Error converting schema to JSON.")}}function Qe(e,t){const n=t!=null?t:{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Qe(r.element,n);if(r.type==="set")return Qe(r.valueType,n);if(r.type==="lazy")return Qe(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Qe(r.innerType,n);if(r.type==="intersection")return Qe(r.left,n)||Qe(r.right,n);if(r.type==="record"||r.type==="map")return Qe(r.keyType,n)||Qe(r.valueType,n);if(r.type==="pipe")return Qe(r.in,n)||Qe(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Qe(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Qe(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Qe(o,n))return!0;return!!(r.rest&&Qe(r.rest,n))}return!1}const uh=(e,t={})=>n=>{const r=Ea(D(y({},n),{processors:t}));return Ce(e,r),Aa(r,e),Ca(r,e)},fo=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=Ea(D(y({},o!=null?o:{}),{target:i,io:t,processors:n}));return Ce(e,a),Aa(a,e),Ca(a,e)},dh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ph=(e,t,n,r)=>{var h;const o=n;o.type="string";const{minimum:i,maximum:a,format:d,patterns:u,contentEncoding:p}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),d&&(o.format=(h=dh[d])!=null?h:d,o.format===""&&delete o.format,d==="time"&&delete o.format),p&&(o.contentEncoding=p),u&&u.size>0){const g=[...u];g.length===1?o.pattern=g[0].source:g.length>1&&(o.allOf=[...g.map(m=>D(y({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:m.source}))])}},hh=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:d,multipleOf:u,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof d=="string"&&d.includes("int")?o.type="integer":o.type="number",typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=h,o.exclusiveMinimum=!0):o.exclusiveMinimum=h),typeof i=="number"&&(o.minimum=i,typeof h=="number"&&t.target!=="draft-04"&&(h>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p),typeof a=="number"&&(o.maximum=a,typeof p=="number"&&t.target!=="draft-04"&&(p<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof u=="number"&&(o.multipleOf=u)},fh=(e,t,n,r)=>{n.type="boolean"},gh=(e,t,n,r)=>{n.not={}},mh=(e,t,n,r)=>{},bh=(e,t,n,r)=>{},kh=(e,t,n,r)=>{const o=e._zod.def,i=Hi(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},_h=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i},vh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},yh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},wh=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:a,maximum:d}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof d=="number"&&(o.maxItems=d),o.type="array",o.items=Ce(i.element,t,D(y({},r),{path:[...r.path,"items"]}))},xh=(e,t,n,r)=>{var p;const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const h in a)o.properties[h]=Ce(a[h],t,D(y({},r),{path:[...r.path,"properties",h]}));const d=new Set(Object.keys(a)),u=new Set([...d].filter(h=>{const g=i.shape[h]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));u.size>0&&(o.required=Array.from(u)),((p=i.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Ce(i.catchall,t,D(y({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},Sh=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((d,u)=>Ce(d,t,D(y({},r),{path:[...r.path,i?"oneOf":"anyOf",u]})));i?n.oneOf=a:n.anyOf=a},Th=(e,t,n,r)=>{const o=e._zod.def,i=Ce(o.left,t,D(y({},r),{path:[...r.path,"allOf",0]})),a=Ce(o.right,t,D(y({},r),{path:[...r.path,"allOf",1]})),d=p=>"allOf"in p&&Object.keys(p).length===1,u=[...d(i)?i.allOf:[i],...d(a)?a.allOf:[a]];n.allOf=u},Eh=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,d=a._zod.bag,u=d==null?void 0:d.patterns;if(i.mode==="loose"&&u&&u.size>0){const h=Ce(i.valueType,t,D(y({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const g of u)o.patternProperties[g.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Ce(i.keyType,t,D(y({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=Ce(i.valueType,t,D(y({},r),{path:[...r.path,"additionalProperties"]}));const p=a._zod.values;if(p){const h=[...p].filter(g=>typeof g=="string"||typeof g=="number");h.length>0&&(o.required=h)}},Ah=(e,t,n,r)=>{const o=e._zod.def,i=Ce(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},Ch=(e,t,n,r)=>{const o=e._zod.def;Ce(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Ph=(e,t,n,r)=>{const o=e._zod.def;Ce(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Rh=(e,t,n,r)=>{const o=e._zod.def;Ce(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Lh=(e,t,n,r)=>{const o=e._zod.def;Ce(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch(d){throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},Ih=(e,t,n,r)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Ce(i,t,r);const a=t.seen.get(e);a.ref=i},zh=(e,t,n,r)=>{const o=e._zod.def;Ce(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},Pa=(e,t,n,r)=>{const o=e._zod.def;Ce(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},$h=x("ZodISODateTime",(e,t)=>{Id.init(e,t),ve.init(e,t)});function Oh(e){return Up($h,e)}const Nh=x("ZodISODate",(e,t)=>{zd.init(e,t),ve.init(e,t)});function Dh(e){return jp(Nh,e)}const Mh=x("ZodISOTime",(e,t)=>{$d.init(e,t),ve.init(e,t)});function Uh(e){return Zp(Mh,e)}const jh=x("ZodISODuration",(e,t)=>{Od.init(e,t),ve.init(e,t)});function Zh(e){return qp(jh,e)}const ft=x("ZodError",(e,t)=>{Yi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Tu(e,n)},flatten:{value:n=>Su(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,bs,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,bs,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),qh=ys(ft),Hh=ws(ft),Fh=ao(ft),Bh=co(ft),Gh=Cu(ft),Wh=Pu(ft),Jh=Ru(ft),Yh=Lu(ft),Vh=Iu(ft),Xh=zu(ft),Kh=$u(ft),Qh=Ou(ft),be=x("ZodType",(e,t)=>(ge.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:fo(e,"input"),output:fo(e,"output")}}),e.toJSONSchema=uh(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(ln(t,{checks:[...(r=t.checks)!=null?r:[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},e.with=e.check,e.clone=(n,r)=>un(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>qh(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Fh(e,n,r),e.parseAsync=(n,r)=>I(null,null,function*(){return Hh(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>I(null,null,function*(){return Bh(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>Gh(e,n,r),e.decode=(n,r)=>Wh(e,n,r),e.encodeAsync=(n,r)=>I(null,null,function*(){return Jh(e,n,r)}),e.decodeAsync=(n,r)=>I(null,null,function*(){return Yh(e,n,r)}),e.safeEncode=(n,r)=>Vh(e,n,r),e.safeDecode=(n,r)=>Xh(e,n,r),e.safeEncodeAsync=(n,r)=>I(null,null,function*(){return Kh(e,n,r)}),e.safeDecodeAsync=(n,r)=>I(null,null,function*(){return Qh(e,n,r)}),e.refine=(n,r)=>e.check(Yf(n,r)),e.superRefine=n=>e.check(Vf(n)),e.overwrite=n=>e.check(Xn(n)),e.optional=()=>Ua(e),e.exactOptional=()=>Nf(e),e.nullable=()=>ja(e),e.nullish=()=>Ua(ja(e)),e.nonoptional=n=>qf(e,n),e.array=()=>dt(e),e.or=n=>Af([e,n]),e.and=n=>Rf(e,n),e.transform=n=>qa(e,$f(n)),e.default=n=>Uf(e,n),e.prefault=n=>Zf(e,n),e.catch=n=>Ff(e,n),e.pipe=n=>qa(e,n),e.readonly=()=>Wf(e),e.describe=n=>{const r=e.clone();return xr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=xr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return xr.get(e);const r=e.clone();return xr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Ra=x("_ZodString",(e,t)=>{var r,o,i;xs.init(e,t),be.init(e,t),e._zod.processJSONSchema=(a,d,u)=>ph(e,a,d);const n=e._zod.bag;e.format=(r=n.format)!=null?r:null,e.minLength=(o=n.minimum)!=null?o:null,e.maxLength=(i=n.maximum)!=null?i:null,e.regex=(...a)=>e.check(Yp(...a)),e.includes=(...a)=>e.check(Kp(...a)),e.startsWith=(...a)=>e.check(Qp(...a)),e.endsWith=(...a)=>e.check(eh(...a)),e.min=(...a)=>e.check(ho(...a)),e.max=(...a)=>e.check(Sa(...a)),e.length=(...a)=>e.check(Ta(...a)),e.nonempty=(...a)=>e.check(ho(1,...a)),e.lowercase=a=>e.check(Vp(a)),e.uppercase=a=>e.check(Xp(a)),e.trim=()=>e.check(nh()),e.normalize=(...a)=>e.check(th(...a)),e.toLowerCase=()=>e.check(rh()),e.toUpperCase=()=>e.check(oh()),e.slugify=()=>e.check(sh())}),ef=x("ZodString",(e,t)=>{xs.init(e,t),Ra.init(e,t),e.email=n=>e.check(kp(tf,n)),e.url=n=>e.check(xp(nf,n)),e.jwt=n=>e.check(Mp(kf,n)),e.emoji=n=>e.check(Sp(rf,n)),e.guid=n=>e.check(va(La,n)),e.uuid=n=>e.check(_p(go,n)),e.uuidv4=n=>e.check(vp(go,n)),e.uuidv6=n=>e.check(yp(go,n)),e.uuidv7=n=>e.check(wp(go,n)),e.nanoid=n=>e.check(Tp(of,n)),e.guid=n=>e.check(va(La,n)),e.cuid=n=>e.check(Ep(sf,n)),e.cuid2=n=>e.check(Ap(af,n)),e.ulid=n=>e.check(Cp(cf,n)),e.base64=n=>e.check(Op(gf,n)),e.base64url=n=>e.check(Np(mf,n)),e.xid=n=>e.check(Pp(lf,n)),e.ksuid=n=>e.check(Rp(uf,n)),e.ipv4=n=>e.check(Lp(df,n)),e.ipv6=n=>e.check(Ip(pf,n)),e.cidrv4=n=>e.check(zp(hf,n)),e.cidrv6=n=>e.check($p(ff,n)),e.e164=n=>e.check(Dp(bf,n)),e.datetime=n=>e.check(Oh(n)),e.date=n=>e.check(Dh(n)),e.time=n=>e.check(Uh(n)),e.duration=n=>e.check(Zh(n))});function P(e){return bp(ef,e)}const ve=x("ZodStringFormat",(e,t)=>{me.init(e,t),Ra.init(e,t)}),tf=x("ZodEmail",(e,t)=>{xd.init(e,t),ve.init(e,t)}),La=x("ZodGUID",(e,t)=>{yd.init(e,t),ve.init(e,t)}),go=x("ZodUUID",(e,t)=>{wd.init(e,t),ve.init(e,t)}),nf=x("ZodURL",(e,t)=>{Sd.init(e,t),ve.init(e,t)}),rf=x("ZodEmoji",(e,t)=>{Td.init(e,t),ve.init(e,t)}),of=x("ZodNanoID",(e,t)=>{Ed.init(e,t),ve.init(e,t)}),sf=x("ZodCUID",(e,t)=>{Ad.init(e,t),ve.init(e,t)}),af=x("ZodCUID2",(e,t)=>{Cd.init(e,t),ve.init(e,t)}),cf=x("ZodULID",(e,t)=>{Pd.init(e,t),ve.init(e,t)}),lf=x("ZodXID",(e,t)=>{Rd.init(e,t),ve.init(e,t)}),uf=x("ZodKSUID",(e,t)=>{Ld.init(e,t),ve.init(e,t)}),df=x("ZodIPv4",(e,t)=>{Nd.init(e,t),ve.init(e,t)}),pf=x("ZodIPv6",(e,t)=>{Dd.init(e,t),ve.init(e,t)}),hf=x("ZodCIDRv4",(e,t)=>{Md.init(e,t),ve.init(e,t)}),ff=x("ZodCIDRv6",(e,t)=>{Ud.init(e,t),ve.init(e,t)}),gf=x("ZodBase64",(e,t)=>{jd.init(e,t),ve.init(e,t)}),mf=x("ZodBase64URL",(e,t)=>{qd.init(e,t),ve.init(e,t)}),bf=x("ZodE164",(e,t)=>{Hd.init(e,t),ve.init(e,t)}),kf=x("ZodJWT",(e,t)=>{Bd.init(e,t),ve.init(e,t)}),Ia=x("ZodNumber",(e,t)=>{var r,o,i,a,d,u,p,h,g;ia.init(e,t),be.init(e,t),e._zod.processJSONSchema=(m,k,w)=>hh(e,m,k),e.gt=(m,k)=>e.check(wa(m,k)),e.gte=(m,k)=>e.check(Es(m,k)),e.min=(m,k)=>e.check(Es(m,k)),e.lt=(m,k)=>e.check(ya(m,k)),e.lte=(m,k)=>e.check(Ts(m,k)),e.max=(m,k)=>e.check(Ts(m,k)),e.int=m=>e.check(za(m)),e.safe=m=>e.check(za(m)),e.positive=m=>e.check(wa(0,m)),e.nonnegative=m=>e.check(Es(0,m)),e.negative=m=>e.check(ya(0,m)),e.nonpositive=m=>e.check(Ts(0,m)),e.multipleOf=(m,k)=>e.check(xa(m,k)),e.step=(m,k)=>e.check(xa(m,k)),e.finite=()=>e;const n=e._zod.bag;e.minValue=(i=Math.max((r=n.minimum)!=null?r:Number.NEGATIVE_INFINITY,(o=n.exclusiveMinimum)!=null?o:Number.NEGATIVE_INFINITY))!=null?i:null,e.maxValue=(u=Math.min((a=n.maximum)!=null?a:Number.POSITIVE_INFINITY,(d=n.exclusiveMaximum)!=null?d:Number.POSITIVE_INFINITY))!=null?u:null,e.isInt=((p=n.format)!=null?p:"").includes("int")||Number.isSafeInteger((h=n.multipleOf)!=null?h:.5),e.isFinite=!0,e.format=(g=n.format)!=null?g:null});function Nt(e){return Hp(Ia,e)}const _f=x("ZodNumberFormat",(e,t)=>{Gd.init(e,t),Ia.init(e,t)});function za(e){return Fp(_f,e)}const vf=x("ZodBoolean",(e,t)=>{Wd.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fh(e,n,r)});function ke(e){return Bp(vf,e)}const yf=x("ZodAny",(e,t)=>{Jd.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mh()});function $a(){return Gp(yf)}const wf=x("ZodUnknown",(e,t)=>{Yd.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bh()});function Oa(){return Wp(wf)}const xf=x("ZodNever",(e,t)=>{Vd.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gh(e,n,r)});function Sf(e){return Jp(xf,e)}const Tf=x("ZodArray",(e,t)=>{Xd.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wh(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(ho(n,r)),e.nonempty=n=>e.check(ho(1,n)),e.max=(n,r)=>e.check(Sa(n,r)),e.length=(n,r)=>e.check(Ta(n,r)),e.unwrap=()=>e.element});function dt(e,t){return ih(Tf,e,t)}const Ef=x("ZodObject",(e,t)=>{Qd.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xh(e,n,r,o),te(e,"shape",()=>t.shape),e.keyof=()=>gt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone(D(y({},e._zod.def),{catchall:n})),e.passthrough=()=>e.clone(D(y({},e._zod.def),{catchall:Oa()})),e.loose=()=>e.clone(D(y({},e._zod.def),{catchall:Oa()})),e.strict=()=>e.clone(D(y({},e._zod.def),{catchall:Sf()})),e.strip=()=>e.clone(D(y({},e._zod.def),{catchall:void 0})),e.extend=n=>_u(e,n),e.safeExtend=n=>vu(e,n),e.merge=n=>yu(e,n),e.pick=n=>bu(e,n),e.omit=n=>ku(e,n),e.partial=(...n)=>wu(Ma,e,n[0]),e.required=(...n)=>xu(Za,e,n[0])});function he(e,t){const n=y({type:"object",shape:e!=null?e:{}},M(t));return new Ef(n)}const Na=x("ZodUnion",(e,t)=>{da.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sh(e,n,r,o),e.options=t.options});function Af(e,t){return new Na(y({type:"union",options:e},M(t)))}const Cf=x("ZodDiscriminatedUnion",(e,t)=>{Na.init(e,t),ep.init(e,t)});function Da(e,t,n){return new Cf(y({type:"union",options:t,discriminator:e},M(n)))}const Pf=x("ZodIntersection",(e,t)=>{tp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Th(e,n,r,o)});function Rf(e,t){return new Pf({type:"intersection",left:e,right:t})}const Lf=x("ZodRecord",(e,t)=>{np.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eh(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Dt(e,t,n){return new Lf(y({type:"record",keyType:e,valueType:t},M(n)))}const As=x("ZodEnum",(e,t)=>{rp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(r,o,i)=>kh(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const a of r)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new As(D(y(D(y({},t),{checks:[]}),M(o)),{entries:i}))},e.exclude=(r,o)=>{const i=y({},t.entries);for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new As(D(y(D(y({},t),{checks:[]}),M(o)),{entries:i}))}});function gt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new As(y({type:"enum",entries:n},M(t)))}const If=x("ZodLiteral",(e,t)=>{op.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_h(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function mt(e,t){return new If(y({type:"literal",values:Array.isArray(e)?e:[e]},M(t)))}const zf=x("ZodTransform",(e,t)=>{sp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yh(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Zi(e.constructor.name);n.addIssue=i=>{var a,d,u;if(typeof i=="string")n.issues.push(wr(i,n.value,t));else{const p=i;p.fatal&&(p.continue=!1),(a=p.code)!=null||(p.code="custom"),(d=p.input)!=null||(p.input=n.value),(u=p.inst)!=null||(p.inst=e),n.issues.push(wr(p))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function $f(e){return new zf({type:"transform",transform:e})}const Ma=x("ZodOptional",(e,t)=>{fa.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pa(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ua(e){return new Ma({type:"optional",innerType:e})}const Of=x("ZodExactOptional",(e,t)=>{ip.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pa(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Nf(e){return new Of({type:"optional",innerType:e})}const Df=x("ZodNullable",(e,t)=>{ap.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ah(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ja(e){return new Df({type:"nullable",innerType:e})}const Mf=x("ZodDefault",(e,t)=>{cp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ph(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Uf(e,t){return new Mf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Wi(t)}})}const jf=x("ZodPrefault",(e,t)=>{lp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Zf(e,t){return new jf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Wi(t)}})}const Za=x("ZodNonOptional",(e,t)=>{up.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ch(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function qf(e,t){return new Za(y({type:"nonoptional",innerType:e},M(t)))}const Hf=x("ZodCatch",(e,t)=>{dp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ff(e,t){return new Hf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Bf=x("ZodPipe",(e,t)=>{pp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ih(e,n,r,o),e.in=t.in,e.out=t.out});function qa(e,t){return new Bf({type:"pipe",in:e,out:t})}const Gf=x("ZodReadonly",(e,t)=>{hp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Wf(e){return new Gf({type:"readonly",innerType:e})}const Jf=x("ZodCustom",(e,t)=>{fp.init(e,t),be.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vh(e,n)});function Yf(e,t={}){return ah(Jf,e,t)}function Vf(e){return ch(e)}const Xf=he({name:P().min(1).max(100).optional(),command:P().min(1).max(500),args:dt(P()).optional(),failOnError:ke().default(!0).optional(),timeout:Nt().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:P().optional(),env:Dt(P(),P()).optional(),runOnBackground:ke().optional(),agentTags:dt(P()).optional()});he({name:P(),command:P(),success:ke(),exitCode:Nt().optional(),stdout:P().optional(),stderr:P().optional(),error:P().optional(),duration:Nt(),failOnError:ke()});const En=he({path:P(),extraCommands:dt(Xf).optional(),id:P().uuid().optional(),rotationKey:P().optional(),usageStatus:gt(["free","in_use"]).optional(),agentTags:dt(P()).optional()}),Kf=Da("operation",[En.extend({operation:mt("create"),content:P().optional(),contentPath:P().optional(),encoding:gt(["utf-8","base64"]).optional()}),En.extend({operation:mt("merge"),data:Dt(P(),$a()),mergeStrategy:gt(["deep","shallow"]).optional(),arrayMergeStrategy:gt(["concat","replace"]).optional()}),En.extend({operation:mt("modify"),content:P().optional(),contentPath:P().optional(),createIfMissing:ke().optional()}),En.extend({operation:mt("delete"),ignoreIfMissing:ke().optional()}),En.extend({operation:mt("createDirectory"),contentPath:P().optional(),mode:Nt().optional(),ignoreIfExists:ke().optional()}),En.extend({operation:mt("download"),url:P().url(),headers:Dt(P(),P()).optional(),timeout:Nt().min(1e3).max(3e5).optional()}),En.extend({operation:mt("gitClone"),gitUrl:P(),gitSecretKey:P().optional(),sourceBranch:P().optional(),targetBranch:P().optional(),originalBranch:P().optional(),defaultBranch:P().optional()})]);var Ee=(e=>(e.PENDING="pending",e.ASSIGNED="assigned",e.IN_PROGRESS="in_progress",e.WAITING_FOR_INPUT="waiting_for_input",e.WAITING_FOR_PLAN_APPROVAL="waiting_for_plan_approval",e.PLAN_APPROVED="plan_approved",e.PLAN_REJECTED="plan_rejected",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.RESULT_REJECTED="result_rejected",e))(Ee||{});const Qf=he({type:gt(["json","file","regex"]).describe("Extraction method"),source:P().describe("Source to extract from (file path or stdout/stderr)"),schema:he({}).passthrough().optional().describe("JSON schema for validation"),pattern:P().optional().describe("Regex pattern for extraction")}),eg=he({type:gt(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:$a().describe("Hook-specific configuration")});he({command:P().optional().describe("Legacy — unused in SDK mode"),args:dt(P()).optional().describe("Legacy — unused in SDK mode"),env:Dt(P(),P()).optional().describe("Environment variables"),workingDirectory:P().optional().describe("Working directory for command execution"),fileOperations:dt(Kf).optional().describe("File operations to perform during setup"),gitUrl:P().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:P().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:P().optional().describe("Commit message for git operations"),resultExtraction:Qf.optional().describe("Schema for extracting result data"),postExecutionHooks:dt(eg).optional().describe("Hooks to run after task completion"),executionMode:gt(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:Da("executionMode",[he({executionMode:mt("claudeAgentSdk"),promptText:P(),sdkOptions:he({model:P(),permissionMode:gt(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:dt(P()),allowDangerouslySkipPermissions:ke(),persistSession:ke(),streamSdkEvents:ke().optional(),allowedTools:dt(P()).optional(),settings:he({enabledPlugins:Dt(P(),ke())}),env:Dt(P(),P()).optional()}),resume:he({sessionId:P().optional(),continue:ke()}).optional()}),he({executionMode:mt("opencodeSdk"),promptText:P(),sdkOptions:he({provider:P(),model:P(),allowedTools:dt(P()).optional(),env:Dt(P(),P()).optional()}),resume:he({sessionId:P().optional(),continue:ke()}).optional()}),he({executionMode:mt("openaiAgentSdk"),promptText:P(),sdkOptions:he({model:P(),env:Dt(P(),P()).optional()}),resume:he({sessionId:P().optional(),continue:ke()}).optional()}),he({executionMode:mt("codexSdk"),promptText:P(),sdkOptions:he({model:P().optional(),sandboxMode:gt(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:gt(["never","on-request","on-failure","untrusted"]).optional(),env:Dt(P(),P()).optional()}),resume:he({sessionId:P().optional(),continue:ke()}).optional()}),he({executionMode:mt("cursorSdk"),promptText:P(),sdkOptions:he({model:P(),env:Dt(P(),P()).optional()}),resume:he({sessionId:P().optional(),continue:ke()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:ke().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:P().optional().describe("Final approved plan content"),planApproved:ke().optional().describe("Plan approval status"),planApprovedAt:P().optional().describe("ISO timestamp of approval"),planRejected:ke().optional().describe("Plan rejection flag"),planRejectionFeedback:P().optional().describe("User rejection feedback"),rejectedPlanContent:P().optional().describe("Previously rejected plan content"),planCompletedAt:P().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:P().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:P().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:P().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:dt(he({feedback:P(),rejectedAt:P()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:Nt().optional(),notificationChannelPlanMessageSentAt:P().optional(),notificationChannelCompletedMessageId:Nt().optional(),notificationChannelFailedMessageId:Nt().optional(),streamSdkEvents:ke().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:P().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:ke().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:dt(he({id:P(),selectedText:P(),startOffset:Nt(),endOffset:Nt(),commentText:P(),createdAt:P()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:ke().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:ke().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:gt(["all","ignoreExistingMcpServers"]).optional().describe("MCP server strategy for this run; 'ignoreExistingMcpServers' overrides the existing .mcp.json with only the template's configured servers plus the agent-platform server"),enableBrowserTools:ke().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")}),Ee.PENDING+"",Ee.CANCELLED,Ee.ASSIGNED+"",Ee.CANCELLED,Ee.IN_PROGRESS+"",Ee.CANCELLED,Ee.FAILED,Ee.WAITING_FOR_INPUT+"",Ee.CANCELLED,Ee.WAITING_FOR_PLAN_APPROVAL+"",Ee.CANCELLED,Ee.PLAN_APPROVED+"",Ee.CANCELLED,Ee.PLAN_REJECTED+"",Ee.CANCELLED,Ee.COMPLETED+"",Ee.RESULT_REJECTED+"",Ee.CANCELLED,Ee.FAILED+"",Ee.CANCELLED+"";const Ha="browser_capture",tg="browser_automate";function Fa(e){let t=(e||"").trim().toLowerCase();const n=t.indexOf("@");return n>=0&&(t=t.slice(n+1)),t=t.split("/")[0].split(":")[0],t.startsWith("www.")&&(t=t.slice(4)),t}function ng(e,t){const n=Fa(e),r=(t||"").trim().toLowerCase();if(!n||!r)return!1;if(r.startsWith("*.")){const o=r.slice(2);return n===o||n.endsWith("."+o)}return n===Fa(r)}function Ba(e,t){var i;let n;try{const a=new URL(e);if(a.protocol!=="http:"&&a.protocol!=="https:")return null;n=a.hostname}catch(a){return null}let r=null,o=-1;for(const a of t)for(const d of(i=a.domains)!=null?i:[])ng(n,d)&&d.length>o&&(o=d.length,r=a.id);return r}class Ga extends Error{}function Wa(e){return I(this,null,function*(){if(!e.ok){const t=yield e.json().catch(()=>({message:`HTTP ${e.status}`})),n=t.message||t.error||`HTTP ${e.status}`;throw e.status===401?new Ga(n):new Error(n)}return e.json()})}const rg=3e4;function mo(r){return I(this,arguments,function*(e,t={},n=rg){const o=new AbortController,i=setTimeout(()=>o.abort(),n);try{return yield fetch(e,D(y({},t),{signal:o.signal}))}catch(a){throw a instanceof DOMException&&a.name==="AbortError"?new Error(`Request timed out after ${Math.round(n/1e3)}s. Please check your connection and try again.`):a}finally{clearTimeout(i)}})}function He(e,t,n,r){return I(this,null,function*(){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=yield mo(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return Wa(a)})}function og(e,t){return I(this,null,function*(){return He(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)})}const sg=["project","note","ctx"];function ig(e){var n,r;const t=sg.filter(o=>e[o]===void 0||e[o]===null);if(t.length>0)throw new Error(`createTask: missing required field(s): ${t.join(", ")}`);if(!((n=e.project)!=null&&n.id)&&!((r=e.project)!=null&&r.key))throw new Error("createTask: project must have an id or key")}function Cs(e,t){return I(this,null,function*(){var h,g,m,k,w,v;ig(t);const{project:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:d,allowSubmit:u,type:p=Ha}=t;return He(e,"POST","/tasks",D(y(y(y(y(y(y(y(y(y(y(y(y(D(y({type:p,title:a||r.slice(0,120)||o.pageTitle||"Browser capture",titleInstruction:d!=null?d:r},n.id?{projectId:n.id}:{projectKey:n.key}),{autoAssign:!0}),i!=null&&i.claudeTemplateId?{claudeTemplateId:i.claudeTemplateId}:{}),(i==null?void 0:i.quickMode)!==void 0?{quickMode:i.quickMode}:{}),(i==null?void 0:i.modelOverride)!=null?{modelOverride:i.modelOverride}:{}),(i==null?void 0:i.claudeProfileId)!=null?{claudeProfileId:i.claudeProfileId}:{}),(i==null?void 0:i.effort)!=null?{effort:i.effort}:{}),(i==null?void 0:i.executionMode)!=null?{executionMode:i.executionMode}:{}),(h=i==null?void 0:i.selectedPluginIds)!=null&&h.length?{selectedPluginIds:i.selectedPluginIds}:{}),(g=i==null?void 0:i.selectedSkillIds)!=null&&g.length?{selectedSkillIds:i.selectedSkillIds}:{}),(m=i==null?void 0:i.selectedPluginSkillIds)!=null&&m.length?{selectedPluginSkillIds:i.selectedPluginSkillIds}:{}),(k=i==null?void 0:i.selectedMcpServerIds)!=null&&k.length?{selectedMcpServerIds:i.selectedMcpServerIds}:{}),(w=i==null?void 0:i.selectedSlashCommandIds)!=null&&w.length?{selectedSlashCommandIds:i.selectedSlashCommandIds}:{}),(v=i==null?void 0:i.selectedRemoteContextProviderIds)!=null&&v.length?{selectedRemoteContextProviderIds:i.selectedRemoteContextProviderIds}:{}),{metadata:y({type:p,note:r,source:"web-sdk",pageUrl:o.pageUrl,pageTitle:o.pageTitle,elementText:o.elementText,cssSelector:o.cssSelector,elementOuterHtml:o.elementOuterHtml,ancestry:o.ancestry,elementRole:o.elementRole,elementAriaLabel:o.elementAriaLabel,enclosingSection:o.enclosingSection,description:o.description,canonicalUrl:o.canonicalUrl,lang:o.lang,ogTitle:o.ogTitle,ogDescription:o.ogDescription,ogType:o.ogType,ogSiteName:o.ogSiteName,viewportWidth:o.viewportWidth,viewportHeight:o.viewportHeight,scrollX:o.scrollX,scrollY:o.scrollY,selectionText:o.selectionText,capturedAt:o.capturedAt,interactionSteps:o.interactionSteps},u!==void 0?{allowSubmit:u}:{})}))})}function Ja(e,t){return I(this,null,function*(){return Cs(e,D(y({},t),{type:tg}))})}function Ya(e,t,n,r){return I(this,null,function*(){var o;return He(e,"POST","/planning-sessions",y(D(y({},t.id?{projectId:t.id}:{projectKey:t.key}),{instruction:n,quickMode:(o=r==null?void 0:r.quickMode)!=null?o:!1}),r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}))})}function ag(e,t){return I(this,null,function*(){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return He(e,"GET",`/claude-templates${n}`)})}function Va(e,t){return I(this,null,function*(){return He(e,"GET",`/tasks/${t}`)})}function cg(e,t){return I(this,null,function*(){return He(e,"GET",`/planning-sessions/${t}`)})}function Xa(e){return I(this,null,function*(){return He(e,"GET","/projects")})}function lg(e){return I(this,null,function*(){return(yield He(e,"GET","/tenants/current")).membership})}function Ka(e,t){if(!e||e.includes("tenant:*")||e.includes(t))return!0;const n=t.split(":")[0];return e.includes(`${n}:*`)}function Ps(e,t,n){return I(this,null,function*(){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=yield mo(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return Wa(i)})}function ug(e,t){return I(this,null,function*(){return He(e,"GET",`/tasks/${t}/browser-commands/pending`)})}function dg(e,t,n,r,o){return I(this,null,function*(){return He(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})})}function pg(e,t){return I(this,null,function*(){return He(e,"GET",`/tasks/${t}/chunks`)})}function hg(e,t,n){return I(this,null,function*(){return He(e,"POST",`/tasks/${t}/instructions`,{content:n})})}function fg(e,t){return I(this,null,function*(){return He(e,"POST",`/tasks/${t}/cancel`)})}function gg(e,t){return I(this,null,function*(){return He(e,"POST",`/tasks/${t}/approve-result`)})}function mg(e,t,n){return I(this,null,function*(){return He(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})})}function bo(e,t){return I(this,null,function*(){return He(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)})}function Qa(e,t,n,r){return I(this,null,function*(){return He(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})})}function bg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Rs={exports:{}};/*!
1571
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const g=h[1];if(t===h[0]){i(h);continue}if(e.external){const k=(l=e.external.registry.get(h[0]))==null?void 0:l.id;if(t!==h[0]&&k){i(h);continue}}if((p=e.metadataRegistry.get(h[0]))==null?void 0:p.id){i(h);continue}if(g.cycle){i(h);continue}if(g.count>1&&e.reused==="ref"){i(h);continue}}}function Wa(e,t){var a,d,l,p,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=g=>{var E,j,A;const m=e.seen.get(g);if(m.ref===null)return;const k=(E=m.def)!=null?E:m.schema,y=v({},k),S=m.ref;if(m.ref=null,S){r(S);const T=e.seen.get(S),L=T.schema;if(L.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=(j=k.allOf)!=null?j:[],k.allOf.push(L)):Object.assign(k,L),Object.assign(k,y),g._zod.parent===S)for(const H in k)H==="$ref"||H==="allOf"||H in y||delete k[H];if(L.$ref)for(const H in k)H==="$ref"||H==="allOf"||H in T.def&&JSON.stringify(k[H])===JSON.stringify(T.def[H])&&delete k[H]}const $=g._zod.parent;if($&&$!==S){r($);const T=e.seen.get($);if(T!=null&&T.schema.$ref&&(k.$ref=T.schema.$ref,T.def))for(const L in k)L==="$ref"||L==="allOf"||L in T.def&&JSON.stringify(k[L])===JSON.stringify(T.def[L])&&delete k[L]}e.override({zodSchema:g,jsonSchema:k,path:(A=m.path)!=null?A:[]})};for(const g of[...e.seen.entries()].reverse())r(g[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const g=(d=e.external.registry.get(t))==null?void 0:d.id;if(!g)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(g)}Object.assign(o,(l=n.def)!=null?l:n.schema);const i=(h=(p=e.external)==null?void 0:p.defs)!=null?h:{};for(const g of e.seen.entries()){const m=g[1];m.def&&m.defId&&(i[m.defId]=m.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const g=JSON.parse(JSON.stringify(o));return Object.defineProperty(g,"~standard",{value:M(v({},t["~standard"]),{jsonSchema:{input:Co(t,"input",e.processors),output:Co(t,"output",e.processors)}}),enumerable:!1,writable:!1}),g}catch(g){throw new Error("Error converting schema to JSON.")}}function Ye(e,t){const n=t!=null?t:{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Ye(r.element,n);if(r.type==="set")return Ye(r.valueType,n);if(r.type==="lazy")return Ye(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Ye(r.innerType,n);if(r.type==="intersection")return Ye(r.left,n)||Ye(r.right,n);if(r.type==="record"||r.type==="map")return Ye(r.keyType,n)||Ye(r.valueType,n);if(r.type==="pipe")return Ye(r.in,n)||Ye(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Ye(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Ye(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Ye(o,n))return!0;return!!(r.rest&&Ye(r.rest,n))}return!1}const Uh=(e,t={})=>n=>{const r=Ba(M(v({},n),{processors:t}));return Re(e,r),Ga(r,e),Wa(r,e)},Co=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=Ba(M(v({},o!=null?o:{}),{target:i,io:t,processors:n}));return Re(e,a),Ga(a,e),Wa(a,e)},jh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Zh=(e,t,n,r)=>{var h;const o=n;o.type="string";const{minimum:i,maximum:a,format:d,patterns:l,contentEncoding:p}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),d&&(o.format=(h=jh[d])!=null?h:d,o.format===""&&delete o.format,d==="time"&&delete o.format),p&&(o.contentEncoding=p),l&&l.size>0){const g=[...l];g.length===1?o.pattern=g[0].source:g.length>1&&(o.allOf=[...g.map(m=>M(v({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:m.source}))])}},qh=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:d,multipleOf:l,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof d=="string"&&d.includes("int")?o.type="integer":o.type="number",typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=h,o.exclusiveMinimum=!0):o.exclusiveMinimum=h),typeof i=="number"&&(o.minimum=i,typeof h=="number"&&t.target!=="draft-04"&&(h>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p),typeof a=="number"&&(o.maximum=a,typeof p=="number"&&t.target!=="draft-04"&&(p<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof l=="number"&&(o.multipleOf=l)},Hh=(e,t,n,r)=>{n.type="boolean"},Fh=(e,t,n,r)=>{n.not={}},Bh=(e,t,n,r)=>{},Gh=(e,t,n,r)=>{},Wh=(e,t,n,r)=>{const o=e._zod.def,i=ca(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},Jh=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i},Yh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Vh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Xh=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:a,maximum:d}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof d=="number"&&(o.maxItems=d),o.type="array",o.items=Re(i.element,t,M(v({},r),{path:[...r.path,"items"]}))},Kh=(e,t,n,r)=>{var p;const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const h in a)o.properties[h]=Re(a[h],t,M(v({},r),{path:[...r.path,"properties",h]}));const d=new Set(Object.keys(a)),l=new Set([...d].filter(h=>{const g=i.shape[h]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));l.size>0&&(o.required=Array.from(l)),((p=i.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Re(i.catchall,t,M(v({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},Qh=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((d,l)=>Re(d,t,M(v({},r),{path:[...r.path,i?"oneOf":"anyOf",l]})));i?n.oneOf=a:n.anyOf=a},ef=(e,t,n,r)=>{const o=e._zod.def,i=Re(o.left,t,M(v({},r),{path:[...r.path,"allOf",0]})),a=Re(o.right,t,M(v({},r),{path:[...r.path,"allOf",1]})),d=p=>"allOf"in p&&Object.keys(p).length===1,l=[...d(i)?i.allOf:[i],...d(a)?a.allOf:[a]];n.allOf=l},tf=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,d=a._zod.bag,l=d==null?void 0:d.patterns;if(i.mode==="loose"&&l&&l.size>0){const h=Re(i.valueType,t,M(v({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const g of l)o.patternProperties[g.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Re(i.keyType,t,M(v({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=Re(i.valueType,t,M(v({},r),{path:[...r.path,"additionalProperties"]}));const p=a._zod.values;if(p){const h=[...p].filter(g=>typeof g=="string"||typeof g=="number");h.length>0&&(o.required=h)}},nf=(e,t,n,r)=>{const o=e._zod.def,i=Re(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},rf=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},of=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},sf=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},af=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch(d){throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},cf=(e,t,n,r)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Re(i,t,r);const a=t.seen.get(e);a.ref=i},lf=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},Ja=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},uf=w("ZodISODateTime",(e,t)=>{ap.init(e,t),we.init(e,t)});function df(e){return fh(uf,e)}const pf=w("ZodISODate",(e,t)=>{cp.init(e,t),we.init(e,t)});function hf(e){return gh(pf,e)}const ff=w("ZodISOTime",(e,t)=>{lp.init(e,t),we.init(e,t)});function gf(e){return mh(ff,e)}const mf=w("ZodISODuration",(e,t)=>{up.init(e,t),we.init(e,t)});function bf(e){return bh(mf,e)}const dt=w("ZodError",(e,t)=>{fa.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>ed(e,n)},flatten:{value:n=>Qu(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Is,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Is,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),kf=Ns(dt),_f=Ds(dt),vf=wo(dt),yf=xo(dt),wf=rd(dt),xf=od(dt),Sf=sd(dt),Tf=id(dt),Ef=ad(dt),Af=cd(dt),Cf=ld(dt),Pf=ud(dt),ke=w("ZodType",(e,t)=>(me.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Co(e,"input"),output:Co(e,"output")}}),e.toJSONSchema=Uh(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(mn(t,{checks:[...(r=t.checks)!=null?r:[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},e.with=e.check,e.clone=(n,r)=>bn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>kf(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>vf(e,n,r),e.parseAsync=(n,r)=>z(null,null,function*(){return _f(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>z(null,null,function*(){return yf(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>wf(e,n,r),e.decode=(n,r)=>xf(e,n,r),e.encodeAsync=(n,r)=>z(null,null,function*(){return Sf(e,n,r)}),e.decodeAsync=(n,r)=>z(null,null,function*(){return Tf(e,n,r)}),e.safeEncode=(n,r)=>Ef(e,n,r),e.safeDecode=(n,r)=>Af(e,n,r),e.safeEncodeAsync=(n,r)=>z(null,null,function*(){return Cf(e,n,r)}),e.safeDecodeAsync=(n,r)=>z(null,null,function*(){return Pf(e,n,r)}),e.refine=(n,r)=>e.check(Sg(n,r)),e.superRefine=n=>e.check(Tg(n)),e.overwrite=n=>e.check(or(n)),e.optional=()=>oc(e),e.exactOptional=()=>dg(e),e.nullable=()=>sc(e),e.nullish=()=>oc(sc(e)),e.nonoptional=n=>bg(e,n),e.array=()=>ct(e),e.or=n=>ng([e,n]),e.and=n=>sg(e,n),e.transform=n=>ac(e,lg(n)),e.default=n=>fg(e,n),e.prefault=n=>mg(e,n),e.catch=n=>_g(e,n),e.pipe=n=>ac(e,n),e.readonly=()=>wg(e),e.describe=n=>{const r=e.clone();return Lr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Lr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Lr.get(e);const r=e.clone();return Lr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Ya=w("_ZodString",(e,t)=>{var r,o,i;Ms.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(a,d,l)=>Zh(e,a,d);const n=e._zod.bag;e.format=(r=n.format)!=null?r:null,e.minLength=(o=n.minimum)!=null?o:null,e.maxLength=(i=n.maximum)!=null?i:null,e.regex=(...a)=>e.check(Sh(...a)),e.includes=(...a)=>e.check(Ah(...a)),e.startsWith=(...a)=>e.check(Ch(...a)),e.endsWith=(...a)=>e.check(Ph(...a)),e.min=(...a)=>e.check(Ao(...a)),e.max=(...a)=>e.check(Ha(...a)),e.length=(...a)=>e.check(Fa(...a)),e.nonempty=(...a)=>e.check(Ao(1,...a)),e.lowercase=a=>e.check(Th(a)),e.uppercase=a=>e.check(Eh(a)),e.trim=()=>e.check(Lh()),e.normalize=(...a)=>e.check(Rh(...a)),e.toLowerCase=()=>e.check(Ih()),e.toUpperCase=()=>e.check($h()),e.slugify=()=>e.check(zh())}),Rf=w("ZodString",(e,t)=>{Ms.init(e,t),Ya.init(e,t),e.email=n=>e.check(Wp(Lf,n)),e.url=n=>e.check(Kp(If,n)),e.jwt=n=>e.check(hh(Wf,n)),e.emoji=n=>e.check(Qp($f,n)),e.guid=n=>e.check(Ua(Va,n)),e.uuid=n=>e.check(Jp(Po,n)),e.uuidv4=n=>e.check(Yp(Po,n)),e.uuidv6=n=>e.check(Vp(Po,n)),e.uuidv7=n=>e.check(Xp(Po,n)),e.nanoid=n=>e.check(eh(zf,n)),e.guid=n=>e.check(Ua(Va,n)),e.cuid=n=>e.check(th(Of,n)),e.cuid2=n=>e.check(nh(Nf,n)),e.ulid=n=>e.check(rh(Df,n)),e.base64=n=>e.check(uh(Ff,n)),e.base64url=n=>e.check(dh(Bf,n)),e.xid=n=>e.check(oh(Mf,n)),e.ksuid=n=>e.check(sh(Uf,n)),e.ipv4=n=>e.check(ih(jf,n)),e.ipv6=n=>e.check(ah(Zf,n)),e.cidrv4=n=>e.check(ch(qf,n)),e.cidrv6=n=>e.check(lh(Hf,n)),e.e164=n=>e.check(ph(Gf,n)),e.datetime=n=>e.check(df(n)),e.date=n=>e.check(hf(n)),e.time=n=>e.check(gf(n)),e.duration=n=>e.check(bf(n))});function P(e){return Gp(Rf,e)}const we=w("ZodStringFormat",(e,t)=>{be.init(e,t),Ya.init(e,t)}),Lf=w("ZodEmail",(e,t)=>{Kd.init(e,t),we.init(e,t)}),Va=w("ZodGUID",(e,t)=>{Vd.init(e,t),we.init(e,t)}),Po=w("ZodUUID",(e,t)=>{Xd.init(e,t),we.init(e,t)}),If=w("ZodURL",(e,t)=>{Qd.init(e,t),we.init(e,t)}),$f=w("ZodEmoji",(e,t)=>{ep.init(e,t),we.init(e,t)}),zf=w("ZodNanoID",(e,t)=>{tp.init(e,t),we.init(e,t)}),Of=w("ZodCUID",(e,t)=>{np.init(e,t),we.init(e,t)}),Nf=w("ZodCUID2",(e,t)=>{rp.init(e,t),we.init(e,t)}),Df=w("ZodULID",(e,t)=>{op.init(e,t),we.init(e,t)}),Mf=w("ZodXID",(e,t)=>{sp.init(e,t),we.init(e,t)}),Uf=w("ZodKSUID",(e,t)=>{ip.init(e,t),we.init(e,t)}),jf=w("ZodIPv4",(e,t)=>{dp.init(e,t),we.init(e,t)}),Zf=w("ZodIPv6",(e,t)=>{pp.init(e,t),we.init(e,t)}),qf=w("ZodCIDRv4",(e,t)=>{hp.init(e,t),we.init(e,t)}),Hf=w("ZodCIDRv6",(e,t)=>{fp.init(e,t),we.init(e,t)}),Ff=w("ZodBase64",(e,t)=>{gp.init(e,t),we.init(e,t)}),Bf=w("ZodBase64URL",(e,t)=>{bp.init(e,t),we.init(e,t)}),Gf=w("ZodE164",(e,t)=>{kp.init(e,t),we.init(e,t)}),Wf=w("ZodJWT",(e,t)=>{vp.init(e,t),we.init(e,t)}),Xa=w("ZodNumber",(e,t)=>{var r,o,i,a,d,l,p,h,g;Ta.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(m,k,y)=>qh(e,m,k),e.gt=(m,k)=>e.check(Za(m,k)),e.gte=(m,k)=>e.check(Zs(m,k)),e.min=(m,k)=>e.check(Zs(m,k)),e.lt=(m,k)=>e.check(ja(m,k)),e.lte=(m,k)=>e.check(js(m,k)),e.max=(m,k)=>e.check(js(m,k)),e.int=m=>e.check(Ka(m)),e.safe=m=>e.check(Ka(m)),e.positive=m=>e.check(Za(0,m)),e.nonnegative=m=>e.check(Zs(0,m)),e.negative=m=>e.check(ja(0,m)),e.nonpositive=m=>e.check(js(0,m)),e.multipleOf=(m,k)=>e.check(qa(m,k)),e.step=(m,k)=>e.check(qa(m,k)),e.finite=()=>e;const n=e._zod.bag;e.minValue=(i=Math.max((r=n.minimum)!=null?r:Number.NEGATIVE_INFINITY,(o=n.exclusiveMinimum)!=null?o:Number.NEGATIVE_INFINITY))!=null?i:null,e.maxValue=(l=Math.min((a=n.maximum)!=null?a:Number.POSITIVE_INFINITY,(d=n.exclusiveMaximum)!=null?d:Number.POSITIVE_INFINITY))!=null?l:null,e.isInt=((p=n.format)!=null?p:"").includes("int")||Number.isSafeInteger((h=n.multipleOf)!=null?h:.5),e.isFinite=!0,e.format=(g=n.format)!=null?g:null});function jt(e){return kh(Xa,e)}const Jf=w("ZodNumberFormat",(e,t)=>{yp.init(e,t),Xa.init(e,t)});function Ka(e){return _h(Jf,e)}const Yf=w("ZodBoolean",(e,t)=>{wp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hh(e,n,r)});function _e(e){return vh(Yf,e)}const Vf=w("ZodAny",(e,t)=>{xp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bh()});function Qa(){return yh(Vf)}const Xf=w("ZodUnknown",(e,t)=>{Sp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gh()});function ec(){return wh(Xf)}const Kf=w("ZodNever",(e,t)=>{Tp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fh(e,n,r)});function Qf(e){return xh(Kf,e)}const eg=w("ZodArray",(e,t)=>{Ep.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xh(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(Ao(n,r)),e.nonempty=n=>e.check(Ao(1,n)),e.max=(n,r)=>e.check(Ha(n,r)),e.length=(n,r)=>e.check(Fa(n,r)),e.unwrap=()=>e.element});function ct(e,t){return Oh(eg,e,t)}const tg=w("ZodObject",(e,t)=>{Cp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Kh(e,n,r,o),ne(e,"shape",()=>t.shape),e.keyof=()=>pt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone(M(v({},e._zod.def),{catchall:n})),e.passthrough=()=>e.clone(M(v({},e._zod.def),{catchall:ec()})),e.loose=()=>e.clone(M(v({},e._zod.def),{catchall:ec()})),e.strict=()=>e.clone(M(v({},e._zod.def),{catchall:Qf()})),e.strip=()=>e.clone(M(v({},e._zod.def),{catchall:void 0})),e.extend=n=>Ju(e,n),e.safeExtend=n=>Yu(e,n),e.merge=n=>Vu(e,n),e.pick=n=>Gu(e,n),e.omit=n=>Wu(e,n),e.partial=(...n)=>Xu(rc,e,n[0]),e.required=(...n)=>Ku(ic,e,n[0])});function fe(e,t){const n=v({type:"object",shape:e!=null?e:{}},U(t));return new tg(n)}const tc=w("ZodUnion",(e,t)=>{Ra.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qh(e,n,r,o),e.options=t.options});function ng(e,t){return new tc(v({type:"union",options:e},U(t)))}const rg=w("ZodDiscriminatedUnion",(e,t)=>{tc.init(e,t),Pp.init(e,t)});function nc(e,t,n){return new rg(v({type:"union",options:t,discriminator:e},U(n)))}const og=w("ZodIntersection",(e,t)=>{Rp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ef(e,n,r,o)});function sg(e,t){return new og({type:"intersection",left:e,right:t})}const ig=w("ZodRecord",(e,t)=>{Lp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tf(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Zt(e,t,n){return new ig(v({type:"record",keyType:e,valueType:t},U(n)))}const qs=w("ZodEnum",(e,t)=>{Ip.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Wh(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const a of r)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new qs(M(v(M(v({},t),{checks:[]}),U(o)),{entries:i}))},e.exclude=(r,o)=>{const i=v({},t.entries);for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new qs(M(v(M(v({},t),{checks:[]}),U(o)),{entries:i}))}});function pt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new qs(v({type:"enum",entries:n},U(t)))}const ag=w("ZodLiteral",(e,t)=>{$p.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jh(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function ht(e,t){return new ag(v({type:"literal",values:Array.isArray(e)?e:[e]},U(t)))}const cg=w("ZodTransform",(e,t)=>{zp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vh(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ia(e.constructor.name);n.addIssue=i=>{var a,d,l;if(typeof i=="string")n.issues.push(Rr(i,n.value,t));else{const p=i;p.fatal&&(p.continue=!1),(a=p.code)!=null||(p.code="custom"),(d=p.input)!=null||(p.input=n.value),(l=p.inst)!=null||(p.inst=e),n.issues.push(Rr(p))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function lg(e){return new cg({type:"transform",transform:e})}const rc=w("ZodOptional",(e,t)=>{$a.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ja(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function oc(e){return new rc({type:"optional",innerType:e})}const ug=w("ZodExactOptional",(e,t)=>{Op.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ja(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function dg(e){return new ug({type:"optional",innerType:e})}const pg=w("ZodNullable",(e,t)=>{Np.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>nf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function sc(e){return new pg({type:"nullable",innerType:e})}const hg=w("ZodDefault",(e,t)=>{Dp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>of(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fg(e,t){return new hg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():pa(t)}})}const gg=w("ZodPrefault",(e,t)=>{Mp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function mg(e,t){return new gg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():pa(t)}})}const ic=w("ZodNonOptional",(e,t)=>{Up.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function bg(e,t){return new ic(v({type:"nonoptional",innerType:e},U(t)))}const kg=w("ZodCatch",(e,t)=>{jp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>af(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _g(e,t){return new kg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const vg=w("ZodPipe",(e,t)=>{Zp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cf(e,n,r,o),e.in=t.in,e.out=t.out});function ac(e,t){return new vg({type:"pipe",in:e,out:t})}const yg=w("ZodReadonly",(e,t)=>{qp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function wg(e){return new yg({type:"readonly",innerType:e})}const xg=w("ZodCustom",(e,t)=>{Hp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yh(e,n)});function Sg(e,t={}){return Nh(xg,e,t)}function Tg(e){return Dh(e)}const Eg=fe({name:P().min(1).max(100).optional(),command:P().min(1).max(500),args:ct(P()).optional(),failOnError:_e().default(!0).optional(),timeout:jt().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:P().optional(),env:Zt(P(),P()).optional(),runOnBackground:_e().optional(),agentTags:ct(P()).optional()});fe({name:P(),command:P(),success:_e(),exitCode:jt().optional(),stdout:P().optional(),stderr:P().optional(),error:P().optional(),duration:jt(),failOnError:_e()});const In=fe({path:P(),extraCommands:ct(Eg).optional(),id:P().uuid().optional(),rotationKey:P().optional(),usageStatus:pt(["free","in_use"]).optional(),agentTags:ct(P()).optional()}),Ag=nc("operation",[In.extend({operation:ht("create"),content:P().optional(),contentPath:P().optional(),encoding:pt(["utf-8","base64"]).optional()}),In.extend({operation:ht("merge"),data:Zt(P(),Qa()),mergeStrategy:pt(["deep","shallow"]).optional(),arrayMergeStrategy:pt(["concat","replace"]).optional()}),In.extend({operation:ht("modify"),content:P().optional(),contentPath:P().optional(),createIfMissing:_e().optional()}),In.extend({operation:ht("delete"),ignoreIfMissing:_e().optional()}),In.extend({operation:ht("createDirectory"),contentPath:P().optional(),mode:jt().optional(),ignoreIfExists:_e().optional()}),In.extend({operation:ht("download"),url:P().url(),headers:Zt(P(),P()).optional(),timeout:jt().min(1e3).max(3e5).optional()}),In.extend({operation:ht("gitClone"),gitUrl:P(),gitSecretKey:P().optional(),sourceBranch:P().optional(),targetBranch:P().optional(),originalBranch:P().optional(),defaultBranch:P().optional()})]);var Ae=(e=>(e.PENDING="pending",e.ASSIGNED="assigned",e.IN_PROGRESS="in_progress",e.WAITING_FOR_INPUT="waiting_for_input",e.WAITING_FOR_PLAN_APPROVAL="waiting_for_plan_approval",e.PLAN_APPROVED="plan_approved",e.PLAN_REJECTED="plan_rejected",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.RESULT_REJECTED="result_rejected",e))(Ae||{});const Cg=fe({type:pt(["json","file","regex"]).describe("Extraction method"),source:P().describe("Source to extract from (file path or stdout/stderr)"),schema:fe({}).passthrough().optional().describe("JSON schema for validation"),pattern:P().optional().describe("Regex pattern for extraction")}),Pg=fe({type:pt(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:Qa().describe("Hook-specific configuration")});fe({command:P().optional().describe("Legacy — unused in SDK mode"),args:ct(P()).optional().describe("Legacy — unused in SDK mode"),env:Zt(P(),P()).optional().describe("Environment variables"),workingDirectory:P().optional().describe("Working directory for command execution"),fileOperations:ct(Ag).optional().describe("File operations to perform during setup"),gitUrl:P().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:P().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:P().optional().describe("Commit message for git operations"),resultExtraction:Cg.optional().describe("Schema for extracting result data"),postExecutionHooks:ct(Pg).optional().describe("Hooks to run after task completion"),executionMode:pt(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:nc("executionMode",[fe({executionMode:ht("claudeAgentSdk"),promptText:P(),sdkOptions:fe({model:P(),permissionMode:pt(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:ct(P()),allowDangerouslySkipPermissions:_e(),persistSession:_e(),streamSdkEvents:_e().optional(),allowedTools:ct(P()).optional(),settings:fe({enabledPlugins:Zt(P(),_e())}),env:Zt(P(),P()).optional()}),resume:fe({sessionId:P().optional(),continue:_e()}).optional()}),fe({executionMode:ht("opencodeSdk"),promptText:P(),sdkOptions:fe({provider:P(),model:P(),allowedTools:ct(P()).optional(),env:Zt(P(),P()).optional()}),resume:fe({sessionId:P().optional(),continue:_e()}).optional()}),fe({executionMode:ht("openaiAgentSdk"),promptText:P(),sdkOptions:fe({model:P(),env:Zt(P(),P()).optional()}),resume:fe({sessionId:P().optional(),continue:_e()}).optional()}),fe({executionMode:ht("codexSdk"),promptText:P(),sdkOptions:fe({model:P().optional(),sandboxMode:pt(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:pt(["never","on-request","on-failure","untrusted"]).optional(),env:Zt(P(),P()).optional()}),resume:fe({sessionId:P().optional(),continue:_e()}).optional()}),fe({executionMode:ht("cursorSdk"),promptText:P(),sdkOptions:fe({model:P(),env:Zt(P(),P()).optional()}),resume:fe({sessionId:P().optional(),continue:_e()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:_e().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:P().optional().describe("Final approved plan content"),planApproved:_e().optional().describe("Plan approval status"),planApprovedAt:P().optional().describe("ISO timestamp of approval"),planRejected:_e().optional().describe("Plan rejection flag"),planRejectionFeedback:P().optional().describe("User rejection feedback"),rejectedPlanContent:P().optional().describe("Previously rejected plan content"),planCompletedAt:P().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:P().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:P().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:P().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:ct(fe({feedback:P(),rejectedAt:P()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:jt().optional(),notificationChannelPlanMessageSentAt:P().optional(),notificationChannelCompletedMessageId:jt().optional(),notificationChannelFailedMessageId:jt().optional(),streamSdkEvents:_e().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:P().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:_e().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:ct(fe({id:P(),selectedText:P(),startOffset:jt(),endOffset:jt(),commentText:P(),createdAt:P()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:_e().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:_e().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:pt(["all","ignoreExistingMcpServers"]).optional().describe("MCP server strategy for this run; 'ignoreExistingMcpServers' overrides the existing .mcp.json with only the template's configured servers plus the agent-platform server"),enableBrowserTools:_e().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")}),Ae.PENDING+"",Ae.CANCELLED,Ae.ASSIGNED+"",Ae.CANCELLED,Ae.IN_PROGRESS+"",Ae.CANCELLED,Ae.FAILED,Ae.WAITING_FOR_INPUT+"",Ae.CANCELLED,Ae.WAITING_FOR_PLAN_APPROVAL+"",Ae.CANCELLED,Ae.PLAN_APPROVED+"",Ae.CANCELLED,Ae.PLAN_REJECTED+"",Ae.CANCELLED,Ae.COMPLETED+"",Ae.RESULT_REJECTED+"",Ae.CANCELLED,Ae.FAILED+"",Ae.CANCELLED+"";const cc="browser_capture",Rg="browser_automate";function lc(e){let t=(e||"").trim().toLowerCase();const n=t.indexOf("@");return n>=0&&(t=t.slice(n+1)),t=t.split("/")[0].split(":")[0],t.startsWith("www.")&&(t=t.slice(4)),t}function Lg(e,t){const n=lc(e),r=(t||"").trim().toLowerCase();if(!n||!r)return!1;if(r.startsWith("*.")){const o=r.slice(2);return n===o||n.endsWith("."+o)}return n===lc(r)}function uc(e,t){var i;let n;try{const a=new URL(e);if(a.protocol!=="http:"&&a.protocol!=="https:")return null;n=a.hostname}catch(a){return null}let r=null,o=-1;for(const a of t)for(const d of(i=a.domains)!=null?i:[])Lg(n,d)&&d.length>o&&(o=d.length,r=a.id);return r}class dc extends Error{}function pc(e){return z(this,null,function*(){if(!e.ok){const t=yield e.json().catch(()=>({message:`HTTP ${e.status}`})),n=t.message||t.error||`HTTP ${e.status}`;throw e.status===401?new dc(n):new Error(n)}return e.json()})}let hc=3e4;function Ig(e){Number.isFinite(e)&&e>0&&(hc=e)}function Ro(r){return z(this,arguments,function*(e,t={},n=hc){const o=new AbortController,i=setTimeout(()=>o.abort(),n);try{return yield fetch(e,M(v({},t),{credentials:"omit",signal:o.signal}))}catch(a){throw a instanceof DOMException&&a.name==="AbortError"?new Error(`Request timed out after ${Math.round(n/1e3)}s. Please check your connection and try again.`):a}finally{clearTimeout(i)}})}function He(e,t,n,r){return z(this,null,function*(){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=yield Ro(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return pc(a)})}function $g(e,t){return z(this,null,function*(){return He(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)})}const zg=["project","note","ctx"];function Og(e){var n,r;const t=zg.filter(o=>e[o]===void 0||e[o]===null);if(t.length>0)throw new Error(`createTask: missing required field(s): ${t.join(", ")}`);if(!((n=e.project)!=null&&n.id)&&!((r=e.project)!=null&&r.key))throw new Error("createTask: project must have an id or key")}function Hs(e,t){return z(this,null,function*(){var h,g,m,k,y,S;Og(t);const{project:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:d,allowSubmit:l,type:p=cc}=t;return He(e,"POST","/tasks",M(v(v(v(v(v(v(v(v(v(v(v(v(M(v({type:p,title:a||r.slice(0,120)||o.pageTitle||"Browser capture",titleInstruction:d!=null?d:r},n.id?{projectId:n.id}:{projectKey:n.key}),{autoAssign:!0}),i!=null&&i.claudeTemplateId?{claudeTemplateId:i.claudeTemplateId}:{}),(i==null?void 0:i.quickMode)!==void 0?{quickMode:i.quickMode}:{}),(i==null?void 0:i.modelOverride)!=null?{modelOverride:i.modelOverride}:{}),(i==null?void 0:i.claudeProfileId)!=null?{claudeProfileId:i.claudeProfileId}:{}),(i==null?void 0:i.effort)!=null?{effort:i.effort}:{}),(i==null?void 0:i.executionMode)!=null?{executionMode:i.executionMode}:{}),(h=i==null?void 0:i.selectedPluginIds)!=null&&h.length?{selectedPluginIds:i.selectedPluginIds}:{}),(g=i==null?void 0:i.selectedSkillIds)!=null&&g.length?{selectedSkillIds:i.selectedSkillIds}:{}),(m=i==null?void 0:i.selectedPluginSkillIds)!=null&&m.length?{selectedPluginSkillIds:i.selectedPluginSkillIds}:{}),(k=i==null?void 0:i.selectedMcpServerIds)!=null&&k.length?{selectedMcpServerIds:i.selectedMcpServerIds}:{}),(y=i==null?void 0:i.selectedSlashCommandIds)!=null&&y.length?{selectedSlashCommandIds:i.selectedSlashCommandIds}:{}),(S=i==null?void 0:i.selectedRemoteContextProviderIds)!=null&&S.length?{selectedRemoteContextProviderIds:i.selectedRemoteContextProviderIds}:{}),{metadata:v({type:p,note:r,source:"web-sdk",pageUrl:o.pageUrl,pageTitle:o.pageTitle,elementText:o.elementText,cssSelector:o.cssSelector,elementOuterHtml:o.elementOuterHtml,ancestry:o.ancestry,elementRole:o.elementRole,elementAriaLabel:o.elementAriaLabel,enclosingSection:o.enclosingSection,description:o.description,canonicalUrl:o.canonicalUrl,lang:o.lang,ogTitle:o.ogTitle,ogDescription:o.ogDescription,ogType:o.ogType,ogSiteName:o.ogSiteName,viewportWidth:o.viewportWidth,viewportHeight:o.viewportHeight,scrollX:o.scrollX,scrollY:o.scrollY,selectionText:o.selectionText,capturedAt:o.capturedAt,interactionSteps:o.interactionSteps},l!==void 0?{allowSubmit:l}:{})}))})}function fc(e,t){return z(this,null,function*(){return Hs(e,M(v({},t),{type:Rg}))})}function gc(e,t,n,r){return z(this,null,function*(){var o;return He(e,"POST","/planning-sessions",v(M(v({},t.id?{projectId:t.id}:{projectKey:t.key}),{instruction:n,quickMode:(o=r==null?void 0:r.quickMode)!=null?o:!1}),r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}))})}function Ng(e,t){return z(this,null,function*(){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return He(e,"GET",`/claude-templates${n}`)})}function mc(e,t){return z(this,null,function*(){return He(e,"GET",`/tasks/${t}`)})}function Dg(e,t){return z(this,null,function*(){return He(e,"GET",`/planning-sessions/${t}`)})}function bc(e){return z(this,null,function*(){return He(e,"GET","/projects")})}function Mg(e){return z(this,null,function*(){return(yield He(e,"GET","/tenants/current")).membership})}function kc(e,t){if(!e||e.includes("tenant:*")||e.includes(t))return!0;const n=t.split(":")[0];return e.includes(`${n}:*`)}function Fs(e,t,n){return z(this,null,function*(){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=yield Ro(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return pc(i)})}function Ug(e,t){return z(this,null,function*(){return He(e,"GET",`/tasks/${t}/browser-commands/pending`)})}function jg(e,t,n,r,o){return z(this,null,function*(){return He(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})})}function Zg(e,t){return z(this,null,function*(){return He(e,"GET",`/tasks/${t}/chunks`)})}function qg(e,t,n){return z(this,null,function*(){return He(e,"POST",`/tasks/${t}/instructions`,{content:n})})}function Hg(e,t){return z(this,null,function*(){return He(e,"POST",`/tasks/${t}/cancel`)})}function Fg(e,t){return z(this,null,function*(){return He(e,"POST",`/tasks/${t}/approve-result`)})}function Bg(e,t,n){return z(this,null,function*(){return He(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})})}function Lo(e,t){return z(this,null,function*(){return He(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)})}function _c(e,t,n,r){return z(this,null,function*(){return He(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})})}function Gg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Bs={exports:{}};/*!
1512
1572
  * Pusher JavaScript Library v8.5.0
1513
1573
  * https://pusher.com/
1514
1574
  *
1515
1575
  * Copyright 2020, Pusher
1516
1576
  * Released under the MIT licence.
1517
- */var ec;function kg(){return ec||(ec=1,(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(a,d){var u=this&&this.__extends||(function(){var U=function(E,T){return U=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,N){A.__proto__=N}||function(A,N){for(var J in N)N.hasOwnProperty(J)&&(A[J]=N[J])},U(E,T)};return function(E,T){U(E,T);function A(){this.constructor=E}E.prototype=T===null?Object.create(T):(A.prototype=T.prototype,new A)}})();Object.defineProperty(d,"__esModule",{value:!0});var p=256,h=(function(){function U(E){E===void 0&&(E="="),this._paddingCharacter=E}return U.prototype.encodedLength=function(E){return this._paddingCharacter?(E+2)/3*4|0:(E*8+5)/6|0},U.prototype.encode=function(E){for(var T="",A=0;A<E.length-2;A+=3){var N=E[A]<<16|E[A+1]<<8|E[A+2];T+=this._encodeByte(N>>>18&63),T+=this._encodeByte(N>>>12&63),T+=this._encodeByte(N>>>6&63),T+=this._encodeByte(N>>>0&63)}var J=E.length-A;if(J>0){var N=E[A]<<16|(J===2?E[A+1]<<8:0);T+=this._encodeByte(N>>>18&63),T+=this._encodeByte(N>>>12&63),J===2?T+=this._encodeByte(N>>>6&63):T+=this._paddingCharacter||"",T+=this._paddingCharacter||""}return T},U.prototype.maxDecodedLength=function(E){return this._paddingCharacter?E/4*3|0:(E*6+7)/8|0},U.prototype.decodedLength=function(E){return this.maxDecodedLength(E.length-this._getPaddingLength(E))},U.prototype.decode=function(E){if(E.length===0)return new Uint8Array(0);for(var T=this._getPaddingLength(E),A=E.length-T,N=new Uint8Array(this.maxDecodedLength(A)),J=0,we=0,Me=0,Ye=0,ne=0,xe=0,lt=0;we<A-4;we+=4)Ye=this._decodeChar(E.charCodeAt(we+0)),ne=this._decodeChar(E.charCodeAt(we+1)),xe=this._decodeChar(E.charCodeAt(we+2)),lt=this._decodeChar(E.charCodeAt(we+3)),N[J++]=Ye<<2|ne>>>4,N[J++]=ne<<4|xe>>>2,N[J++]=xe<<6|lt,Me|=Ye&p,Me|=ne&p,Me|=xe&p,Me|=lt&p;if(we<A-1&&(Ye=this._decodeChar(E.charCodeAt(we)),ne=this._decodeChar(E.charCodeAt(we+1)),N[J++]=Ye<<2|ne>>>4,Me|=Ye&p,Me|=ne&p),we<A-2&&(xe=this._decodeChar(E.charCodeAt(we+2)),N[J++]=ne<<4|xe>>>2,Me|=xe&p),we<A-3&&(lt=this._decodeChar(E.charCodeAt(we+3)),N[J++]=xe<<6|lt,Me|=lt&p),Me!==0)throw new Error("Base64Coder: incorrect characters for decoding");return N},U.prototype._encodeByte=function(E){var T=E;return T+=65,T+=25-E>>>8&6,T+=51-E>>>8&-75,T+=61-E>>>8&-15,T+=62-E>>>8&3,String.fromCharCode(T)},U.prototype._decodeChar=function(E){var T=p;return T+=(42-E&E-44)>>>8&-p+E-43+62,T+=(46-E&E-48)>>>8&-p+E-47+63,T+=(47-E&E-58)>>>8&-p+E-48+52,T+=(64-E&E-91)>>>8&-p+E-65+0,T+=(96-E&E-123)>>>8&-p+E-97+26,T},U.prototype._getPaddingLength=function(E){var T=0;if(this._paddingCharacter){for(var A=E.length-1;A>=0&&E[A]===this._paddingCharacter;A--)T++;if(E.length<4||T>2)throw new Error("Base64Coder: incorrect padding")}return T},U})();d.Coder=h;var g=new h;function m(U){return g.encode(U)}d.encode=m;function k(U){return g.decode(U)}d.decode=k;var w=(function(U){u(E,U);function E(){return U!==null&&U.apply(this,arguments)||this}return E.prototype._encodeByte=function(T){var A=T;return A+=65,A+=25-T>>>8&6,A+=51-T>>>8&-75,A+=61-T>>>8&-13,A+=62-T>>>8&49,String.fromCharCode(A)},E.prototype._decodeChar=function(T){var A=p;return A+=(44-T&T-46)>>>8&-p+T-45+62,A+=(94-T&T-96)>>>8&-p+T-95+63,A+=(47-T&T-58)>>>8&-p+T-48+52,A+=(64-T&T-91)>>>8&-p+T-65+0,A+=(96-T&T-123)>>>8&-p+T-97+26,A},E})(h);d.URLSafeCoder=w;var v=new w;function Z(U){return v.encode(U)}d.encodeURLSafe=Z;function K(U){return v.decode(U)}d.decodeURLSafe=K,d.encodedLength=function(U){return g.encodedLength(U)},d.maxDecodedLength=function(U){return g.maxDecodedLength(U)},d.decodedLength=function(U){return g.decodedLength(U)}},978(a,d){var u="utf8: invalid source encoding";function p(h){for(var g=[],m=0;m<h.length;m++){var k=h[m];if(k&128){var w=void 0;if(k<224){if(m>=h.length)throw new Error(u);var v=h[++m];if((v&192)!==128)throw new Error(u);k=(k&31)<<6|v&63,w=128}else if(k<240){if(m>=h.length-1)throw new Error(u);var v=h[++m],Z=h[++m];if((v&192)!==128||(Z&192)!==128)throw new Error(u);k=(k&15)<<12|(v&63)<<6|Z&63,w=2048}else if(k<248){if(m>=h.length-2)throw new Error(u);var v=h[++m],Z=h[++m],K=h[++m];if((v&192)!==128||(Z&192)!==128||(K&192)!==128)throw new Error(u);k=(k&15)<<18|(v&63)<<12|(Z&63)<<6|K&63,w=65536}else throw new Error(u);if(k<w||k>=55296&&k<=57343)throw new Error(u);if(k>=65536){if(k>1114111)throw new Error(u);k-=65536,g.push(String.fromCharCode(55296|k>>10)),k=56320|k&1023}}g.push(String.fromCharCode(k))}return g.join("")}d.D4=p},721(a,d,u){a.exports=u(207).default},207(a,d,u){u.d(d,{default:()=>ls});class p{constructor(s,c){this.lastId=0,this.prefix=s,this.name=c}create(s){this.lastId++;var c=this.lastId,f=this.prefix+c,b=this.name+"["+c+"]",S=!1,R=function(){S||(s.apply(null,arguments),S=!0)};return this[c]=R,{number:c,id:f,name:b,callback:R}}remove(s){delete this[s.number]}}var h=new p("_pusher_script_","Pusher.ScriptReceivers"),g={VERSION:"8.5.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""};const m=g;class k{constructor(s){this.options=s,this.receivers=s.receivers||h,this.loading={}}load(s,c,f){var b=this;if(b.loading[s]&&b.loading[s].length>0)b.loading[s].push(f);else{b.loading[s]=[f];var S=G.createScriptRequest(b.getPath(s,c)),R=b.receivers.create(function(O){if(b.receivers.remove(R),b.loading[s]){var B=b.loading[s];delete b.loading[s];for(var ee=function(Ie){Ie||S.cleanup()},re=0;re<B.length;re++)B[re](O,ee)}});S.send(R)}}getRoot(s){var c,f=G.getDocument().location.protocol;return s&&s.useTLS||f==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(s,c){return this.getRoot(c)+"/"+s+this.options.suffix+".js"}}var w=new p("_pusher_dependencies","Pusher.DependenciesReceivers"),v=new k({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:w});const Z={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}},U={buildLogSuffix:function(l){const s="See:",c=Z.urls[l];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=Z.baseUrl+c.path),f?`${s} ${f}`:""}};var E;(function(l){l.UserAuthentication="user-authentication",l.ChannelAuthorization="channel-authorization"})(E||(E={}));class T extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class A extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class N extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class J extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class we extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Me extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Ye extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class ne extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class xe extends Error{constructor(s,c){super(c),this.status=s,Object.setPrototypeOf(this,new.target.prototype)}}const kn=function(l,s,c,f,b){const S=G.createXHR();S.open("POST",c.endpoint,!0),S.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var R in c.headers)S.setRequestHeader(R,c.headers[R]);if(c.headersProvider!=null){let O=c.headersProvider();for(var R in O)S.setRequestHeader(R,O[R])}return S.onreadystatechange=function(){if(S.readyState===4)if(S.status===200){let O,B=!1;try{O=JSON.parse(S.responseText),B=!0}catch(ee){b(new xe(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${S.responseText}`),null)}B&&b(null,O)}else{let O="";switch(f){case E.UserAuthentication:O=U.buildLogSuffix("authenticationEndpoint");break;case E.ChannelAuthorization:O=`Clients must be authorized to join private or presence channels. ${U.buildLogSuffix("authorizationEndpoint")}`;break}b(new xe(S.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${S.status} from ${c.endpoint}. ${O}`),null)}},S.send(s),S};function _n(l){return fe(yn(l))}var vt=String.fromCharCode,Ft="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vn=function(l){var s=l.charCodeAt(0);return s<128?l:s<2048?vt(192|s>>>6)+vt(128|s&63):vt(224|s>>>12&15)+vt(128|s>>>6&63)+vt(128|s&63)},yn=function(l){return l.replace(/[^\x00-\x7F]/g,vn)},Bt=function(l){var s=[0,2,1][l.length%3],c=l.charCodeAt(0)<<16|(l.length>1?l.charCodeAt(1):0)<<8|(l.length>2?l.charCodeAt(2):0),f=[Ft.charAt(c>>>18),Ft.charAt(c>>>12&63),s>=2?"=":Ft.charAt(c>>>6&63),s>=1?"=":Ft.charAt(c&63)];return f.join("")},fe=window.btoa||function(l){return l.replace(/[\s\S]{1,3}/g,Bt)};class Ct{constructor(s,c,f,b){this.clear=c,this.timer=s(()=>{this.timer&&(this.timer=b(this.timer))},f)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const ye=Ct;function Dn(l){window.clearTimeout(l)}function ue(l){window.clearInterval(l)}class Ve extends ye{constructor(s,c){super(setTimeout,Dn,s,function(f){return c(),null})}}class wn extends ye{constructor(s,c){super(setInterval,ue,s,function(f){return c(),f})}}var Pt={now(){return Date.now?Date.now():new Date().valueOf()},defer(l){return new Ve(0,l)},method(l,...s){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[l].apply(f,c.concat(arguments))}}};const Se=Pt;function Ae(l,...s){for(var c=0;c<s.length;c++){var f=s[c];for(var b in f)f[b]&&f[b].constructor&&f[b].constructor===Object?l[b]=Ae(l[b]||{},f[b]):l[b]=f[b]}return l}function H(){for(var l=["Pusher"],s=0;s<arguments.length;s++)typeof arguments[s]=="string"?l.push(arguments[s]):l.push(Le(arguments[s]));return l.join(" : ")}function ae(l,s){var c=Array.prototype.indexOf;if(l===null)return-1;if(c&&l.indexOf===c)return l.indexOf(s);for(var f=0,b=l.length;f<b;f++)if(l[f]===s)return f;return-1}function Q(l,s){for(var c in l)Object.prototype.hasOwnProperty.call(l,c)&&s(l[c],c,l)}function Ue(l){var s=[];return Q(l,function(c,f){s.push(f)}),s}function Xe(l){var s=[];return Q(l,function(c){s.push(c)}),s}function Be(l,s,c){for(var f=0;f<l.length;f++)s.call(c||window,l[f],f,l)}function tn(l,s){for(var c=[],f=0;f<l.length;f++)c.push(s(l[f],f,l,c));return c}function Rt(l,s){var c={};return Q(l,function(f,b){c[b]=s(f)}),c}function je(l,s){s=s||function(b){return!!b};for(var c=[],f=0;f<l.length;f++)s(l[f],f,l,c)&&c.push(l[f]);return c}function Re(l,s){var c={};return Q(l,function(f,b){(s&&s(f,b,l,c)||f)&&(c[b]=f)}),c}function Oe(l){var s=[];return Q(l,function(c,f){s.push([f,c])}),s}function Ge(l,s){for(var c=0;c<l.length;c++)if(s(l[c],c,l))return!0;return!1}function jr(l,s){for(var c=0;c<l.length;c++)if(!s(l[c],c,l))return!1;return!0}function it(l){return Rt(l,function(s){return typeof s=="object"&&(s=Le(s)),encodeURIComponent(_n(s.toString()))})}function ut(l){var s=Re(l,function(f){return f!==void 0}),c=tn(Oe(it(s)),Se.method("join","=")).join("&");return c}function Lt(l){var s=[],c=[];return(function f(b,S){var R,O,B;switch(typeof b){case"object":if(!b)return null;for(R=0;R<s.length;R+=1)if(s[R]===b)return{$ref:c[R]};if(s.push(b),c.push(S),Object.prototype.toString.apply(b)==="[object Array]")for(B=[],R=0;R<b.length;R+=1)B[R]=f(b[R],S+"["+R+"]");else{B={};for(O in b)Object.prototype.hasOwnProperty.call(b,O)&&(B[O]=f(b[O],S+"["+JSON.stringify(O)+"]"))}return B;case"number":case"string":case"boolean":return b}})(l,"$")}function Le(l){try{return JSON.stringify(l)}catch(s){return JSON.stringify(Lt(l))}}class Zr{constructor(){this.globalLog=s=>{window.console&&window.console.log&&window.console.log(s)}}debug(...s){this.log(this.globalLog,s)}warn(...s){this.log(this.globalLogWarn,s)}error(...s){this.log(this.globalLogError,s)}globalLogWarn(s){window.console&&window.console.warn?window.console.warn(s):this.globalLog(s)}globalLogError(s){window.console&&window.console.error?window.console.error(s):this.globalLogWarn(s)}log(s,...c){var f=H.apply(this,arguments);ls.log?ls.log(f):ls.logToConsole&&s.bind(this)(f)}}const de=new Zr;var Vo=function(l,s,c,f,b){(c.headers!==void 0||c.headersProvider!=null)&&de.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var S=l.nextAuthCallbackID.toString();l.nextAuthCallbackID++;var R=l.getDocument(),O=R.createElement("script");l.auth_callbacks[S]=function(re){b(null,re)};var B="Pusher.auth_callbacks['"+S+"']";O.src=c.endpoint+"?callback="+encodeURIComponent(B)+"&"+s;var ee=R.getElementsByTagName("head")[0]||R.documentElement;ee.insertBefore(O,ee.firstChild)};const qr=Vo;class Xo{constructor(s){this.src=s}send(s){var c=this,f="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=s.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){s.callback(f)},c.script.onload=function(){s.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&s.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=s.id+"_error",c.errorScript.text=s.name+"('"+f+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var b=document.getElementsByTagName("head")[0];b.insertBefore(c.script,b.firstChild),c.errorScript&&b.insertBefore(c.errorScript,c.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class hr{constructor(s,c){this.url=s,this.data=c}send(s){if(!this.request){var c=ut(this.data),f=this.url+"/"+s.number+"?"+c;this.request=G.createScriptRequest(f),this.request.send(s)}}cleanup(){this.request&&this.request.cleanup()}}var fr=function(l,s){return function(c,f){var b="http"+(s?"s":"")+"://",S=b+(l.host||l.options.host)+l.options.path,R=G.createJSONPRequest(S,c),O=G.ScriptReceivers.create(function(B,ee){h.remove(O),R.cleanup(),ee&&ee.host&&(l.host=ee.host),f&&f(B,ee)});R.send(O)}},It={name:"jsonp",getAgent:fr};const xn=It;function Mn(l,s,c){var f=l+(s.useTLS?"s":""),b=s.useTLS?s.hostTLS:s.hostNonTLS;return f+"://"+b+c}function Un(l,s){var c="/app/"+l,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(s?"&"+s:"");return c+f}var mi={getInitial:function(l,s){var c=(s.httpPath||"")+Un(l,"flash=false");return Mn("ws",s,c)}},gr={getInitial:function(l,s){var c=(s.httpPath||"/pusher")+Un(l);return Mn("http",s,c)}},mr={getInitial:function(l,s){return Mn("http",s,s.httpPath||"/pusher")},getPath:function(l,s){return Un(l)}};class bi{constructor(){this._callbacks={}}get(s){return this._callbacks[nn(s)]}add(s,c,f){var b=nn(s);this._callbacks[b]=this._callbacks[b]||[],this._callbacks[b].push({fn:c,context:f})}remove(s,c,f){if(!s&&!c&&!f){this._callbacks={};return}var b=s?[nn(s)]:Ue(this._callbacks);c||f?this.removeCallback(b,c,f):this.removeAllCallbacks(b)}removeCallback(s,c,f){Be(s,function(b){this._callbacks[b]=je(this._callbacks[b]||[],function(S){return c&&c!==S.fn||f&&f!==S.context}),this._callbacks[b].length===0&&delete this._callbacks[b]},this)}removeAllCallbacks(s){Be(s,function(c){delete this._callbacks[c]},this)}}function nn(l){return"_"+l}class zt{constructor(s){this.callbacks=new bi,this.global_callbacks=[],this.failThrough=s}bind(s,c,f){return this.callbacks.add(s,c,f),this}bind_global(s){return this.global_callbacks.push(s),this}unbind(s,c,f){return this.callbacks.remove(s,c,f),this}unbind_global(s){return s?(this.global_callbacks=je(this.global_callbacks||[],c=>c!==s),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(s,c,f){for(var b=0;b<this.global_callbacks.length;b++)this.global_callbacks[b](s,c);var S=this.callbacks.get(s),R=[];if(f?R.push(c,f):c&&R.push(c),S&&S.length>0)for(var b=0;b<S.length;b++)S[b].fn.apply(S[b].context||window,R);else this.failThrough&&this.failThrough(s,c);return this}}class ki extends zt{constructor(s,c,f,b,S){super(),this.initialize=G.transportConnectionInitializer,this.hooks=s,this.name=c,this.priority=f,this.key=b,this.options=S,this.state="new",this.timeline=S.timeline,this.activityTimeout=S.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var s=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(s,this.options)}catch(c){return Se.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),de.debug("Connecting",{transport:this.name,url:s}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(s){return this.state==="open"?(Se.defer(()=>{this.socket&&this.socket.send(s)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(s){this.emit("error",{type:"WebSocketError",error:s}),this.timeline.error(this.buildTimelineMessage({error:s.toString()}))}onClose(s){s?this.changeState("closed",{code:s.code,reason:s.reason,wasClean:s.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(s){this.emit("message",s)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=s=>{this.onError(s)},this.socket.onclose=s=>{this.onClose(s)},this.socket.onmessage=s=>{this.onMessage(s)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(s,c){this.state=s,this.timeline.info(this.buildTimelineMessage({state:s,params:c})),this.emit(s,c)}buildTimelineMessage(s){return Ae({cid:this.id},s)}}class pe{constructor(s){this.hooks=s}isSupported(s){return this.hooks.isSupported(s)}createConnection(s,c,f,b){return new ki(this.hooks,s,c,f,b)}}var Sn=new pe({urls:mi,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!G.getWebSocketAPI()},isSupported:function(){return!!G.getWebSocketAPI()},getSocket:function(l){return G.createWebSocket(l)}}),Ko={urls:gr,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Hr=Ae({getSocket:function(l){return G.HTTPFactory.createStreamingSocket(l)}},Ko),br=Ae({getSocket:function(l){return G.HTTPFactory.createPollingSocket(l)}},Ko),Fr={isSupported:function(){return G.isXHRSupported()}},Qo=new pe(Ae({},Hr,Fr)),_i=new pe(Ae({},br,Fr)),yt={ws:Sn,xhr_streaming:Qo,xhr_polling:_i};const wt=yt;var es=new pe({file:"sockjs",urls:mr,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(l,s){return new window.SockJS(l,null,{js_path:v.getPath("sockjs",{useTLS:s.useTLS}),ignore_null_origin:s.ignoreNullOrigin})},beforeOpen:function(l,s){l.send(JSON.stringify({path:s}))}}),Br={isSupported:function(l){var s=G.isXDRSupported(l.useTLS);return s}},Gr=new pe(Ae({},Hr,Br)),ts=new pe(Ae({},br,Br));wt.xdr_streaming=Gr,wt.xdr_polling=ts,wt.sockjs=es;const $t=wt;class ns extends zt{constructor(){super();var s=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){s.emit("online")},!1),window.addEventListener("offline",function(){s.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var rs=new ns;class os{constructor(s,c,f){this.manager=s,this.transport=c,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(s,c,f,b){b=Ae({},b,{activityTimeout:this.pingDelay});var S=this.transport.createConnection(s,c,f,b),R=null,O=function(){S.unbind("open",O),S.bind("closed",B),R=Se.now()},B=ee=>{if(S.unbind("closed",B),ee.code===1002||ee.code===1003)this.manager.reportDeath();else if(!ee.wasClean&&R){var re=Se.now()-R;re<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(re/2,this.minPingDelay))}};return S.bind("open",O),S}isSupported(s){return this.manager.isAlive()&&this.transport.isSupported(s)}}const Wr={decodeMessage:function(l){try{var s=JSON.parse(l.data),c=s.data;if(typeof c=="string")try{c=JSON.parse(s.data)}catch(b){}var f={event:s.event,channel:s.channel,data:c};return s.user_id&&(f.user_id=s.user_id),f}catch(b){throw{type:"MessageParseError",error:b,data:l.data}}},encodeMessage:function(l){return JSON.stringify(l)},processHandshake:function(l){var s=Wr.decodeMessage(l);if(s.event==="pusher:connection_established"){if(!s.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:s.data.socket_id,activityTimeout:s.data.activity_timeout*1e3}}else{if(s.event==="pusher:error")return{action:this.getCloseAction(s.data),error:this.getCloseError(s.data)};throw"Invalid handshake"}},getCloseAction:function(l){return l.code<4e3?l.code>=1002&&l.code<=1004?"backoff":null:l.code===4e3?"tls_only":l.code<4100?"refused":l.code<4200?"backoff":l.code<4300?"retry":"refused"},getCloseError:function(l){return l.code!==1e3&&l.code!==1001?{type:"PusherError",data:{code:l.code,message:l.reason||l.message}}:null}},rn=Wr;class j extends zt{constructor(s,c){super(),this.id=s,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(s){return this.transport.send(s)}send_event(s,c,f){var b={event:s,data:c};return f&&(b.channel=f),de.debug("Event sent",b),this.send(rn.encodeMessage(b))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var s={message:f=>{var b;try{b=rn.decodeMessage(f)}catch(S){this.emit("error",{type:"MessageParseError",error:S,data:f.data})}if(b!==void 0){switch(de.debug("Event recd",b),b.event){case"pusher:error":this.emit("error",{type:"PusherError",data:b.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",b)}},activity:()=>{this.emit("activity")},error:f=>{this.emit("error",f)},closed:f=>{c(),f&&f.code&&this.handleCloseEvent(f),this.transport=null,this.emit("closed")}},c=()=>{Q(s,(f,b)=>{this.transport.unbind(b,f)})};Q(s,(f,b)=>{this.transport.bind(b,f)})}handleCloseEvent(s){var c=rn.getCloseAction(s),f=rn.getCloseError(s);f&&this.emit("error",f),c&&this.emit(c,{action:c,error:f})}}class _{constructor(s,c){this.transport=s,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=s=>{this.unbindListeners();var c;try{c=rn.processHandshake(s)}catch(f){this.finish("error",{error:f}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new j(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=s=>{this.unbindListeners();var c=rn.getCloseAction(s)||"backoff",f=rn.getCloseError(s);this.finish(c,{error:f})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(s,c){this.callback(Ae({transport:this.transport,action:s},c))}}class C{constructor(s,c){this.timeline=s,this.options=c||{}}send(s,c){this.timeline.isEmpty()||this.timeline.send(G.TimelineTransport.getAgent(this,s),c)}}class z extends zt{constructor(s,c){super(function(f,b){de.debug("No callbacks on "+s+" for "+f)}),this.name=s,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(s,c){return c(null,{auth:""})}trigger(s,c){if(s.indexOf("client-")!==0)throw new T("Event '"+s+"' does not start with 'client-'");if(!this.subscribed){var f=U.buildLogSuffix("triggeringClientEvents");de.warn(`Client event triggered before channel 'subscription_succeeded' event . ${f}`)}return this.pusher.send_event(s,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(s){var c=s.event,f=s.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(s);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(s);else if(c.indexOf("pusher_internal:")!==0){var b={};this.emit(c,f,b)}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",s.data)}handleSubscriptionCountEvent(s){s.data.subscription_count&&(this.subscriptionCount=s.data.subscription_count),this.emit("pusher:subscription_count",s.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(s,c)=>{s?(this.subscriptionPending=!1,de.error(s.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:s.message},s instanceof xe?{status:s.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:c.auth,channel_data:c.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class ce extends z{authorize(s,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:s},c)}}class Ze{constructor(){this.reset()}get(s){return Object.prototype.hasOwnProperty.call(this.members,s)?{id:s,info:this.members[s]}:null}each(s){Q(this.members,(c,f)=>{s(this.get(f))})}setMyID(s){this.myID=s}onSubscription(s){this.members=s.presence.hash,this.count=s.presence.count,this.me=this.get(this.myID)}addMember(s){return this.get(s.user_id)===null&&this.count++,this.members[s.user_id]=s.user_info,this.get(s.user_id)}removeMember(s){var c=this.get(s.user_id);return c&&(delete this.members[s.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var Te=function(l,s,c,f){function b(S){return S instanceof c?S:new c(function(R){R(S)})}return new(c||(c=Promise))(function(S,R){function O(re){try{ee(f.next(re))}catch(Ie){R(Ie)}}function B(re){try{ee(f.throw(re))}catch(Ie){R(Ie)}}function ee(re){re.done?S(re.value):b(re.value).then(O,B)}ee((f=f.apply(l,s||[])).next())})};class Ke extends ce{constructor(s,c){super(s,c),this.members=new Ze}authorize(s,c){super.authorize(s,(f,b)=>Te(this,void 0,void 0,function*(){if(!f)if(b=b,b.channel_data!=null){var S=JSON.parse(b.channel_data);this.members.setMyID(S.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let R=U.buildLogSuffix("authorizationEndpoint");de.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${R}, or the user should be signed in.`),c("Invalid auth response");return}c(f,b)}))}handleEvent(s){var c=s.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(s);else{var f=s.data,b={};s.user_id&&(b.user_id=s.user_id),this.emit(c,f,b)}}handleInternalEvent(s){var c=s.event,f=s.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(s);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(s);break;case"pusher_internal:member_added":var b=this.members.addMember(f);this.emit("pusher:member_added",b);break;case"pusher_internal:member_removed":var S=this.members.removeMember(f);S&&this.emit("pusher:member_removed",S);break}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(s.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var Ot=u(978),Gt=u(594);class Jr extends ce{constructor(s,c,f){super(s,c),this.key=null,this.nacl=f}authorize(s,c){super.authorize(s,(f,b)=>{if(f){c(f,b);return}let S=b.shared_secret;if(!S){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,Gt.decode)(S),delete b.shared_secret,c(null,b)})}trigger(s,c){throw new Me("Client events are not currently supported for encrypted channels")}handleEvent(s){var c=s.event,f=s.data;if(c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0){super.handleEvent(s);return}this.handleEncryptedEvent(c,f)}handleEncryptedEvent(s,c){if(!this.key){de.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){de.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let f=(0,Gt.decode)(c.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){de.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let b=(0,Gt.decode)(c.nonce);if(b.length<this.nacl.secretbox.nonceLength){de.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${b.length}`);return}let S=this.nacl.secretbox.open(f,b,this.key);if(S===null){de.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(R,O)=>{if(R){de.error(`Failed to make a request to the authEndpoint: ${O}. Unable to fetch new key, so dropping encrypted event`);return}if(S=this.nacl.secretbox.open(f,b,this.key),S===null){de.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(s,this.getDataToEmit(S))});return}this.emit(s,this.getDataToEmit(S))}getDataToEmit(s){let c=(0,Ot.D4)(s);try{return JSON.parse(c)}catch(f){return c}}}class Ne extends zt{constructor(s,c){super(),this.state="initialized",this.connection=null,this.key=s,this.options=c,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var f=G.getNetwork();f.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),f.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(s){this.key=s,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(s){return this.connection?this.connection.send(s):!1}send_event(s,c,f){return this.connection?this.connection.send_event(s,c,f):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var s=(c,f)=>{c?this.runner=this.strategy.connect(0,s):f.action==="error"?(this.emit("error",{type:"HandshakeError",error:f.error}),this.timeline.error({handshakeError:f.error})):(this.abortConnecting(),this.handshakeCallbacks[f.action](f))};this.runner=this.strategy.connect(0,s)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var s=this.abandonConnection();s.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(s){this.timeline.info({action:"retry",delay:s}),s>0&&this.emit("connecting_in",Math.round(s/1e3)),this.retryTimer=new Ve(s||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new Ve(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new Ve(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new Ve(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(s){return Ae({},s,{message:c=>{this.resetActivityCheck(),this.emit("message",c)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:c=>{this.emit("error",c)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(s){return Ae({},s,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let s=c=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),c(f)};return{tls_only:s(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:s(()=>{this.disconnect()}),backoff:s(()=>{this.retryIn(1e3)}),retry:s(()=>{this.retryIn(0)})}}setConnection(s){this.connection=s;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var s in this.connectionCallbacks)this.connection.unbind(s,this.connectionCallbacks[s]);var c=this.connection;return this.connection=null,c}}updateState(s,c){var f=this.state;if(this.state=s,f!==s){var b=s;b==="connected"&&(b+=" with new socket ID "+c.socket_id),de.debug("State changed",f+" -> "+b),this.timeline.info({state:s,params:c}),this.emit("state_change",{previous:f,current:s}),this.emit(s,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class ss{constructor(){this.channels={}}add(s,c){return this.channels[s]||(this.channels[s]=is(s,c)),this.channels[s]}all(){return Xe(this.channels)}find(s){return this.channels[s]}remove(s){var c=this.channels[s];return delete this.channels[s],c}disconnect(){Q(this.channels,function(s){s.disconnect()})}}function is(l,s){if(l.indexOf("private-encrypted-")===0){if(s.config.nacl)return on.createEncryptedChannel(l,s,s.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=U.buildLogSuffix("encryptedChannelSupport");throw new Me(`${c}. ${f}`)}else{if(l.indexOf("private-")===0)return on.createPrivateChannel(l,s);if(l.indexOf("presence-")===0)return on.createPresenceChannel(l,s);if(l.indexOf("#")===0)throw new A('Cannot create a channel with name "'+l+'".');return on.createChannel(l,s)}}var ak={createChannels(){return new ss},createConnectionManager(l,s){return new Ne(l,s)},createChannel(l,s){return new z(l,s)},createPrivateChannel(l,s){return new ce(l,s)},createPresenceChannel(l,s){return new Ke(l,s)},createEncryptedChannel(l,s,c){return new Jr(l,s,c)},createTimelineSender(l,s){return new C(l,s)},createHandshake(l,s){return new _(l,s)},createAssistantToTheTransportManager(l,s,c){return new os(l,s,c)}};const on=ak;class Cl{constructor(s){this.options=s||{},this.livesLeft=this.options.lives||1/0}getAssistant(s){return on.createAssistantToTheTransportManager(this,s,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class jn{constructor(s,c){this.strategies=s,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return Ge(this.strategies,Se.method("isSupported"))}connect(s,c){var f=this.strategies,b=0,S=this.timeout,R=null,O=(B,ee)=>{ee?c(null,ee):(b=b+1,this.loop&&(b=b%f.length),b<f.length?(S&&(S=S*2,this.timeoutLimit&&(S=Math.min(S,this.timeoutLimit))),R=this.tryStrategy(f[b],s,{timeout:S,failFast:this.failFast},O)):c(!0))};return R=this.tryStrategy(f[b],s,{timeout:S,failFast:this.failFast},O),{abort:function(){R.abort()},forceMinPriority:function(B){s=B,R&&R.forceMinPriority(B)}}}tryStrategy(s,c,f,b){var S=null,R=null;return f.timeout>0&&(S=new Ve(f.timeout,function(){R.abort(),b(!0)})),R=s.connect(c,function(O,B){O&&S&&S.isRunning()&&!f.failFast||(S&&S.ensureAborted(),b(O,B))}),{abort:function(){S&&S.ensureAborted(),R.abort()},forceMinPriority:function(O){R.forceMinPriority(O)}}}}class vi{constructor(s){this.strategies=s}isSupported(){return Ge(this.strategies,Se.method("isSupported"))}connect(s,c){return ck(this.strategies,s,function(f,b){return function(S,R){if(b[f].error=S,S){lk(b)&&c(!0);return}Be(b,function(O){O.forceMinPriority(R.transport.priority)}),c(null,R)}})}}function ck(l,s,c){var f=tn(l,function(b,S,R,O){return b.connect(s,c(S,O))});return{abort:function(){Be(f,uk)},forceMinPriority:function(b){Be(f,function(S){S.forceMinPriority(b)})}}}function lk(l){return jr(l,function(s){return!!s.error})}function uk(l){!l.error&&!l.aborted&&(l.abort(),l.aborted=!0)}class dk{constructor(s,c,f){this.strategy=s,this.transports=c,this.ttl=f.ttl||18e5,this.usingTLS=f.useTLS,this.timeline=f.timeline}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.usingTLS,b=pk(f),S=b&&b.cacheSkipCount?b.cacheSkipCount:0,R=[this.strategy];if(b&&b.timestamp+this.ttl>=Se.now()){var O=this.transports[b.transport];O&&(["ws","wss"].includes(b.transport)||S>3?(this.timeline.info({cached:!0,transport:b.transport,latency:b.latency}),R.push(new jn([O],{timeout:b.latency*2+1e3,failFast:!0}))):S++)}var B=Se.now(),ee=R.pop().connect(s,function re(Ie,us){Ie?(Pl(f),R.length>0?(B=Se.now(),ee=R.pop().connect(s,re)):c(Ie)):(hk(f,us.transport.name,Se.now()-B,S),c(null,us))});return{abort:function(){ee.abort()},forceMinPriority:function(re){s=re,ee&&ee.forceMinPriority(re)}}}}function yi(l){return"pusherTransport"+(l?"TLS":"NonTLS")}function pk(l){var s=G.getLocalStorage();if(s)try{var c=s[yi(l)];if(c)return JSON.parse(c)}catch(f){Pl(l)}return null}function hk(l,s,c,f){var b=G.getLocalStorage();if(b)try{b[yi(l)]=Le({timestamp:Se.now(),transport:s,latency:c,cacheSkipCount:f})}catch(S){}}function Pl(l){var s=G.getLocalStorage();if(s)try{delete s[yi(l)]}catch(c){}}class as{constructor(s,{delay:c}){this.strategy=s,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy,b,S=new Ve(this.options.delay,function(){b=f.connect(s,c)});return{abort:function(){S.ensureAborted(),b&&b.abort()},forceMinPriority:function(R){s=R,b&&b.forceMinPriority(R)}}}}class Yr{constructor(s,c,f){this.test=s,this.trueBranch=c,this.falseBranch=f}isSupported(){var s=this.test()?this.trueBranch:this.falseBranch;return s.isSupported()}connect(s,c){var f=this.test()?this.trueBranch:this.falseBranch;return f.connect(s,c)}}class fk{constructor(s){this.strategy=s}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy.connect(s,function(b,S){S&&f.abort(),c(b,S)});return f}}function Vr(l){return function(){return l.isSupported()}}var gk=function(l,s,c){var f={};function b(ql,p_,h_,f_,g_){var Hl=c(l,ql,p_,h_,f_,g_);return f[ql]=Hl,Hl}var S=Object.assign({},s,{hostNonTLS:l.wsHost+":"+l.wsPort,hostTLS:l.wsHost+":"+l.wssPort,httpPath:l.wsPath}),R=Object.assign({},S,{useTLS:!0}),O=Object.assign({},s,{hostNonTLS:l.httpHost+":"+l.httpPort,hostTLS:l.httpHost+":"+l.httpsPort,httpPath:l.httpPath}),B={loop:!0,timeout:15e3,timeoutLimit:6e4},ee=new Cl({minPingDelay:1e4,maxPingDelay:l.activityTimeout}),re=new Cl({lives:2,minPingDelay:1e4,maxPingDelay:l.activityTimeout}),Ie=b("ws","ws",3,S,ee),us=b("wss","ws",3,R,ee),a_=b("sockjs","sockjs",1,O),Nl=b("xhr_streaming","xhr_streaming",1,O,re),c_=b("xdr_streaming","xdr_streaming",1,O,re),Dl=b("xhr_polling","xhr_polling",1,O),l_=b("xdr_polling","xdr_polling",1,O),Ml=new jn([Ie],B),u_=new jn([us],B),d_=new jn([a_],B),Ul=new jn([new Yr(Vr(Nl),Nl,c_)],B),jl=new jn([new Yr(Vr(Dl),Dl,l_)],B),Zl=new jn([new Yr(Vr(Ul),new vi([Ul,new as(jl,{delay:4e3})]),jl)],B),Si=new Yr(Vr(Zl),Zl,d_),Ti;return s.useTLS?Ti=new vi([Ml,new as(Si,{delay:2e3})]):Ti=new vi([Ml,new as(u_,{delay:2e3}),new as(Si,{delay:5e3})]),new dk(new fk(new Yr(Vr(Ie),Ti,Si)),f,{ttl:18e5,timeline:s.timeline,useTLS:s.useTLS})};const mk=gk;function bk(){var l=this;l.timeline.info(l.buildTimelineMessage({transport:l.name+(l.options.useTLS?"s":"")})),l.hooks.isInitialized()?l.changeState("initialized"):l.hooks.file?(l.changeState("initializing"),v.load(l.hooks.file,{useTLS:l.options.useTLS},function(s,c){l.hooks.isInitialized()?(l.changeState("initialized"),c(!0)):(s&&l.onError(s),l.onClose(),c(!1))})):l.onClose()}var kk={getRequest:function(l){var s=new window.XDomainRequest;return s.ontimeout=function(){l.emit("error",new N),l.close()},s.onerror=function(c){l.emit("error",c),l.close()},s.onprogress=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText)},s.onload=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText),l.emit("finished",200),l.close()},s},abortRequest:function(l){l.ontimeout=l.onerror=l.onprogress=l.onload=null,l.abort()}};const _k=kk,vk=256*1024;class yk extends zt{constructor(s,c,f){super(),this.hooks=s,this.method=c,this.url=f}start(s){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},G.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(s)}close(){this.unloader&&(G.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(s,c){for(;;){var f=this.advanceBuffer(c);if(f)this.emit("chunk",{status:s,data:f});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(s){var c=s.slice(this.position),f=c.indexOf(`
1518
- `);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(s){return this.position===s.length&&s.length>vk}}var wi;(function(l){l[l.CONNECTING=0]="CONNECTING",l[l.OPEN=1]="OPEN",l[l.CLOSED=3]="CLOSED"})(wi||(wi={}));const Zn=wi;var wk=1;class xk{constructor(s,c){this.hooks=s,this.session=Ll(1e3)+"/"+Ak(8),this.location=Sk(c),this.readyState=Zn.CONNECTING,this.openStream()}send(s){return this.sendRaw(JSON.stringify([s]))}ping(){this.hooks.sendHeartbeat(this)}close(s,c){this.onClose(s,c,!0)}sendRaw(s){if(this.readyState===Zn.OPEN)try{return G.createSocketRequest("POST",Rl(Tk(this.location,this.session))).start(s),!0}catch(c){return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(s,c,f){this.closeStream(),this.readyState=Zn.CLOSED,this.onclose&&this.onclose({code:s,reason:c,wasClean:f})}onChunk(s){if(s.status===200){this.readyState===Zn.OPEN&&this.onActivity();var c,f=s.data.slice(0,1);switch(f){case"o":c=JSON.parse(s.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(s.data.slice(1)||"[]");for(var b=0;b<c.length;b++)this.onEvent(c[b]);break;case"m":c=JSON.parse(s.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(s.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(s){this.readyState===Zn.CONNECTING?(s&&s.hostname&&(this.location.base=Ek(this.location.base,s.hostname)),this.readyState=Zn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(s){this.readyState===Zn.OPEN&&this.onmessage&&this.onmessage({data:s})}onActivity(){this.onactivity&&this.onactivity()}onError(s){this.onerror&&this.onerror(s)}openStream(){this.stream=G.createSocketRequest("POST",Rl(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",s=>{this.onChunk(s)}),this.stream.bind("finished",s=>{this.hooks.onFinished(this,s)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(s){Se.defer(()=>{this.onError(s),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function Sk(l){var s=/([^\?]*)\/*(\??.*)/.exec(l);return{base:s[1],queryString:s[2]}}function Tk(l,s){return l.base+"/"+s+"/xhr_send"}function Rl(l){var s=l.indexOf("?")===-1?"?":"&";return l+s+"t="+ +new Date+"&n="+wk++}function Ek(l,s){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(l);return c[1]+s+c[3]}function Ll(l){return G.randomInt(l)}function Ak(l){for(var s=[],c=0;c<l;c++)s.push(Ll(32).toString(32));return s.join("")}const Ck=xk;var Pk={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr_streaming"+l.queryString},onHeartbeat:function(l){l.sendRaw("[]")},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const Rk=Pk;var Lk={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr"+l.queryString},onHeartbeat:function(){},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){s===200?l.reconnect():l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const Ik=Lk;var zk={getRequest:function(l){var s=G.getXHRAPI(),c=new s;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText),l.emit("finished",c.status),l.close();break}},c},abortRequest:function(l){l.onreadystatechange=null,l.abort()}};const $k=zk;var Ok={createStreamingSocket(l){return this.createSocket(Rk,l)},createPollingSocket(l){return this.createSocket(Ik,l)},createSocket(l,s){return new Ck(l,s)},createXHR(l,s){return this.createRequest($k,l,s)},createRequest(l,s,c){return new yk(l,s,c)}};const Il=Ok;Il.createXDR=function(l,s){return this.createRequest(_k,l,s)};var Nk={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:w,getDefaultStrategy:mk,Transports:$t,transportConnectionInitializer:bk,HTTPFactory:Il,TimelineTransport:xn,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(l){window.Pusher=l;var s=()=>{this.onDocumentBody(l.ready)};window.JSON?s():v.load("json2",{},s)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:kn,jsonp:qr}},onDocumentBody(l){document.body?l():setTimeout(()=>{this.onDocumentBody(l)},0)},createJSONPRequest(l,s){return new hr(l,s)},createScriptRequest(l){return new Xo(l)},getLocalStorage(){try{return window.localStorage}catch(l){return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var l=this.getXHRAPI();return new l},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return rs},createWebSocket(l){var s=this.getWebSocketAPI();return new s(l)},createSocketRequest(l,s){if(this.isXHRSupported())return this.HTTPFactory.createXHR(l,s);if(this.isXDRSupported(s.indexOf("https:")===0))return this.HTTPFactory.createXDR(l,s);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var l=this.getXHRAPI();return!!l&&new l().withCredentials!==void 0},isXDRSupported(l){var s=l?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===s},addUnloadListener(l){window.addEventListener!==void 0?window.addEventListener("unload",l,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",l)},removeUnloadListener(l){window.addEventListener!==void 0?window.removeEventListener("unload",l,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",l)},randomInt(l){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*l)}};const G=Nk;var xi;(function(l){l[l.ERROR=3]="ERROR",l[l.INFO=6]="INFO",l[l.DEBUG=7]="DEBUG"})(xi||(xi={}));const cs=xi;class Dk{constructor(s,c,f){this.key=s,this.session=c,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(s,c){s<=this.options.level&&(this.events.push(Ae({},c,{timestamp:Se.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(s){this.log(cs.ERROR,s)}info(s){this.log(cs.INFO,s)}debug(s){this.log(cs.DEBUG,s)}isEmpty(){return this.events.length===0}send(s,c){var f=Ae({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],s(f,(b,S)=>{b||this.sent++,c&&c(b,S)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class Mk{constructor(s,c,f,b){this.name=s,this.priority=c,this.transport=f,this.options=b||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(s,c){if(this.isSupported()){if(this.priority<s)return zl(new J,c)}else return zl(new ne,c);var f=!1,b=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),S=null,R=function(){b.unbind("initialized",R),b.connect()},O=function(){S=on.createHandshake(b,function(Ie){f=!0,re(),c(null,Ie)})},B=function(Ie){re(),c(Ie)},ee=function(){re();var Ie;Ie=Le(b),c(new we(Ie))},re=function(){b.unbind("initialized",R),b.unbind("open",O),b.unbind("error",B),b.unbind("closed",ee)};return b.bind("initialized",R),b.bind("open",O),b.bind("error",B),b.bind("closed",ee),b.initialize(),{abort:()=>{f||(re(),S?S.close():b.close())},forceMinPriority:Ie=>{f||this.priority<Ie&&(S?S.close():b.close())}}}}function zl(l,s){return Se.defer(function(){s(l)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Uk}=G;var jk=function(l,s,c,f,b,S){var R=Uk[c];if(!R)throw new Ye(c);var O=(!l.enabledTransports||ae(l.enabledTransports,s)!==-1)&&(!l.disabledTransports||ae(l.disabledTransports,s)===-1),B;return O?(b=Object.assign({ignoreNullOrigin:l.ignoreNullOrigin},b),B=new Mk(s,f,S?S.getAssistant(R):R,b)):B=Zk,B},Zk={isSupported:function(){return!1},connect:function(l,s){var c=Se.defer(function(){s(new ne)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function qk(l){if(l==null)throw"You must pass an options object";if(l.cluster==null)throw"Options object must provide a cluster";"disableStats"in l&&de.warn("The disableStats option is deprecated in favor of enableStats")}const Hk=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},Fk=l=>{if(typeof G.getAuthorizers()[l.transport]=="undefined")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=Hk(s,l);G.getAuthorizers()[l.transport](G,f,l,E.UserAuthentication,c)}},Bk=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);c+="&channel_name="+encodeURIComponent(l.channelName);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},Gk=l=>{if(typeof G.getAuthorizers()[l.transport]=="undefined")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=Bk(s,l);G.getAuthorizers()[l.transport](G,f,l,E.ChannelAuthorization,c)}},Wk=(l,s,c)=>{const f={authTransport:s.transport,authEndpoint:s.endpoint,auth:{params:s.params,headers:s.headers}};return(b,S)=>{const R=l.channel(b.channelName);c(R,f).authorize(b.socketId,S)}};function $l(l,s){let c={activityTimeout:l.activityTimeout||m.activityTimeout,cluster:l.cluster,httpPath:l.httpPath||m.httpPath,httpPort:l.httpPort||m.httpPort,httpsPort:l.httpsPort||m.httpsPort,pongTimeout:l.pongTimeout||m.pongTimeout,statsHost:l.statsHost||m.stats_host,unavailableTimeout:l.unavailableTimeout||m.unavailableTimeout,wsPath:l.wsPath||m.wsPath,wsPort:l.wsPort||m.wsPort,wssPort:l.wssPort||m.wssPort,enableStats:Kk(l),httpHost:Jk(l),useTLS:Xk(l),wsHost:Yk(l),userAuthenticator:Qk(l),channelAuthorizer:t_(l,s)};return"disabledTransports"in l&&(c.disabledTransports=l.disabledTransports),"enabledTransports"in l&&(c.enabledTransports=l.enabledTransports),"ignoreNullOrigin"in l&&(c.ignoreNullOrigin=l.ignoreNullOrigin),"timelineParams"in l&&(c.timelineParams=l.timelineParams),"nacl"in l&&(c.nacl=l.nacl),c}function Jk(l){return l.httpHost?l.httpHost:l.cluster?`sockjs-${l.cluster}.pusher.com`:m.httpHost}function Yk(l){return l.wsHost?l.wsHost:Vk(l.cluster)}function Vk(l){return`ws-${l}.pusher.com`}function Xk(l){return G.getProtocol()==="https:"?!0:l.forceTLS!==!1}function Kk(l){return"enableStats"in l?l.enableStats:"disableStats"in l?!l.disableStats:!1}const Ol=l=>"customHandler"in l&&l.customHandler!=null;function Qk(l){const s=Object.assign(Object.assign({},m.userAuthentication),l.userAuthentication);return Ol(s)?s.customHandler:Fk(s)}function e_(l,s){let c;if("channelAuthorization"in l)c=Object.assign(Object.assign({},m.channelAuthorization),l.channelAuthorization);else if(c={transport:l.authTransport||m.authTransport,endpoint:l.authEndpoint||m.authEndpoint},"auth"in l&&("params"in l.auth&&(c.params=l.auth.params),"headers"in l.auth&&(c.headers=l.auth.headers)),"authorizer"in l)return{customHandler:Wk(s,c,l.authorizer)};return c}function t_(l,s){const c=e_(l,s);return Ol(c)?c.customHandler:Gk(c)}class n_ extends zt{constructor(s){super(function(c,f){de.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=s,this.bindWatchlistInternalEvent()}handleEvent(s){s.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",s=>{var c=s.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(s)})}}function r_(){let l,s;return{promise:new Promise((f,b)=>{l=f,s=b}),resolve:l,reject:s}}const o_=r_;class s_ extends zt{constructor(s){super(function(c,f){de.debug("No callbacks on user for "+c)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(c,f)=>{if(c){de.warn(`Error during signin: ${c}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:f.auth,user_data:f.user_data})},this.pusher=s,this.pusher.connection.bind("state_change",({previous:c,current:f})=>{c!=="connected"&&f==="connected"&&this._signin(),c==="connected"&&f!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new n_(s),this.pusher.connection.bind("message",c=>{var f=c.event;f==="pusher:signin_success"&&this._onSigninSuccess(c.data),this.serverToUserChannel&&this.serverToUserChannel.name===c.channel&&this.serverToUserChannel.handleEvent(c)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(s){try{this.user_data=JSON.parse(s.user_data)}catch(c){de.error(`Failed parsing user data after signin: ${s.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){de.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const s=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new z(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((c,f)=>{c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0||this.emit(c,f)}),s(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:s,resolve:c}=o_();s.done=!1;const f=()=>{s.done=!0};s.then(f).catch(f),this.signinDonePromise=s,this._signinDoneResolve=c}}class We{static ready(){We.isReady=!0;for(var s=0,c=We.instances.length;s<c;s++)We.instances[s].connect()}static getClientFeatures(){return Ue(Re({ws:G.Transports.ws},function(s){return s.isSupported({})}))}constructor(s,c){i_(s),qk(c),this.key=s,this.options=c,this.config=$l(this.options,this),this.channels=on.createChannels(),this.global_emitter=new zt,this.sessionID=G.randomInt(1e9),this.timeline=new Dk(this.key,this.sessionID,{cluster:this.config.cluster,features:We.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:cs.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=on.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+G.TimelineTransport.name}));var f=b=>G.getDefaultStrategy(this.config,b,jk);this.connection=on.createConnectionManager(this.key,{getStrategy:f,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",b=>{var S=b.event,R=S.indexOf("pusher_internal:")===0;if(b.channel){var O=this.channel(b.channel);O&&O.handleEvent(b)}R||this.global_emitter.emit(b.event,b.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",b=>{de.warn(b)}),We.instances.push(this),this.timeline.info({instances:We.instances.length}),this.user=new s_(this),We.isReady&&this.connect()}switchCluster(s){const{appKey:c,cluster:f}=s;this.key=c,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=$l(this.options,this),this.connection.switchCluster(this.key)}channel(s){return this.channels.find(s)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var s=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new wn(6e4,function(){c.send(s)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(s,c,f){return this.global_emitter.bind(s,c,f),this}unbind(s,c,f){return this.global_emitter.unbind(s,c,f),this}bind_global(s){return this.global_emitter.bind_global(s),this}unbind_global(s){return this.global_emitter.unbind_global(s),this}unbind_all(s){return this.global_emitter.unbind_all(),this}subscribeAll(){var s;for(s in this.channels.channels)this.channels.channels.hasOwnProperty(s)&&this.subscribe(s)}subscribe(s){var c=this.channels.add(s,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(s){var c=this.channels.find(s);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(s),c&&c.subscribed&&c.unsubscribe())}send_event(s,c,f){return this.connection.send_event(s,c,f)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}We.instances=[],We.isReady=!1,We.logToConsole=!1,We.Runtime=G,We.ScriptReceivers=G.ScriptReceivers,We.DependenciesReceivers=G.DependenciesReceivers,We.auth_callbacks=G.auth_callbacks;const ls=We;function i_(l){if(l==null)throw"You must pass your app key when you instantiate Pusher."}G.setup(We)}},r={};function o(a){var d=r[a];if(d!==void 0)return d.exports;var u=r[a]={exports:{}};return n[a].call(u.exports,u,u.exports,o),u.exports}o.d=(a,d)=>{for(var u in d)o.o(d,u)&&!o.o(a,u)&&Object.defineProperty(a,u,{enumerable:!0,get:d[u]})},o.o=(a,d)=>Object.prototype.hasOwnProperty.call(a,d);var i=o(721);return i})())})(Rs)),Rs.exports}var _g=kg();const vg=bg(_g);let xt=null,Kn=null;function yg(e){return I(this,null,function*(){return Kn||(Kn=I(null,null,function*(){const t=e.backendUrl.replace(/\/+$/,""),n=yield mo(`${t}/api/settings`,{headers:{Authorization:`Bearer ${e.token}`}});if(!n.ok)throw new Error(`Failed to fetch settings: HTTP ${n.status}`);const r=yield n.json();xt=new vg(r.pusher.key,{cluster:r.pusher.cluster||"local",forceTLS:!0,wsHost:r.pusher.wsHost||void 0,wsPort:r.pusher.wssPort,wssPort:r.pusher.wssPort,enabledTransports:r.pusher.wsHost?["ws"]:void 0,channelAuthorization:{customHandler:({socketId:o,channelName:i},a)=>{mo(`${t}/api/pusher/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({socket_id:o,channel_name:i})}).then(d=>d.json()).then(d=>a(null,d)).catch(d=>a(d instanceof Error?d:new Error(String(d)),null))}}})}),Kn.catch(()=>{Kn=null}),Kn)})}function wg(e){if(!e||!xt)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return xt.connection.bind("state_change",n),()=>xt==null?void 0:xt.connection.unbind("state_change",n)}function xg(e,t,n){return I(this,null,function*(){if(yield yg(e),!xt)return()=>{};const r=xt.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(oo.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(oo.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(oo.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(oo.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=wg(n.onReconnect);return()=>{r.unbind_all(),xt==null||xt.unsubscribe(`private-task-${t}`),o==null||o()}})}const Ls="ap-sdk-active-automation";function Sg(){try{const e=sessionStorage.getItem(Ls);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.taskId&&(t!=null&&t.backendUrl)&&(t!=null&&t.title)?t:null}catch(e){return null}}function tc(e){try{sessionStorage.setItem(Ls,JSON.stringify(e))}catch(t){}}function nc(){try{sessionStorage.removeItem(Ls)}catch(e){}}function Tg(e){return I(this,null,function*(){var i;try{(i=e.focus)==null||i.call(e)}catch(a){}e.scrollIntoView({block:"center",inline:"center",behavior:"instant"});let t=e.getBoundingClientRect();t.width===0&&t.height===0&&(yield Eg(),t=e.getBoundingClientRect());const n=t.left+t.width/2,r=t.top+t.height/2,o={bubbles:!0,cancelable:!0,clientX:n,clientY:r};typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerdown",o)),e.dispatchEvent(new MouseEvent("mousedown",o)),typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerup",o)),e.dispatchEvent(new MouseEvent("mouseup",o)),e.click()})}function Eg(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const Is="shared",rc="ap-sdk-panel-size:",oc=280,sc=200;function Ag(e){try{const t=sessionStorage.getItem(rc+e);if(!t)return null;const n=JSON.parse(t);return typeof(n==null?void 0:n.width)=="number"&&typeof(n==null?void 0:n.height)=="number"?n:null}catch(t){return null}}function Cg(e,t){try{sessionStorage.setItem(rc+e,JSON.stringify(t))}catch(n){}}function ko(e,t,n){return Math.min(Math.max(e,t),n)}function ic(){return window.innerWidth-32}function ac(){return window.innerHeight-64}function zs(e,t){const n=Ag(t);n&&(e.style.width=`${ko(n.width,oc,ic())}px`,e.style.height=`${ko(n.height,sc,ac())}px`);const r=document.createElement("div");r.className="ap-sdk-resize-handle",r.setAttribute("data-ap-sdk","1"),e.appendChild(r);let o=!1,i=0,a=0,d=0,u=0,p=0,h=0;const g=k=>{o&&(p=ko(d+(k.clientX-i),oc,ic()),h=ko(u+(k.clientY-a),sc,ac()),e.style.width=`${p}px`,e.style.height=`${h}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",m),Cg(t,{width:p,height:h}))};r.addEventListener("pointerdown",k=>{k.preventDefault(),k.stopPropagation(),o=!0,i=k.clientX,a=k.clientY;const w=e.getBoundingClientRect();d=w.width,u=w.height,p=d,h=u,document.addEventListener("pointermove",g),document.addEventListener("pointerup",m)})}function $s(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var An=$s();function cc(e){An=e}var Cn={exec:()=>null};function Qn(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),o=t[r];return o||(o=e(r),t[r]=o),o}}function V(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(o,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(Je.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var Pg=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch(t){return!1}})(),Je={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Qn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Qn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Qn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Qn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Qn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Qn(e=>new RegExp(`^ {0,${e}}>`))},Rg=/^(?:[ \t]*(?:\n|$))+/,Lg=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ig=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Sr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,zg=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Os=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,lc=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,uc=V(lc).replace(/bull/g,Os).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),$g=V(lc).replace(/bull/g,Os).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ns=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Og=/^[^\n]+/,Ds=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ng=V(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ds).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Dg=V(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Os).getRegex(),_o="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ms=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Mg=V("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ms).replace("tag",_o).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),dc=e=>V(Ns).replace("hr",Sr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list",e).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_o).getRegex(),Ug=dc(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),jg=dc(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Zg=V(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",jg).getRegex(),Us={blockquote:Zg,code:Lg,def:Ng,fences:Ig,heading:zg,hr:Sr,html:Mg,lheading:uc,list:Dg,newline:Rg,paragraph:Ug,table:Cn,text:Og},pc=V("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Sr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_o).getRegex(),qg=D(y({},Us),{lheading:$g,table:pc,paragraph:V(Ns).replace("hr",Sr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",pc).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_o).getRegex()}),Hg=D(y({},Us),{html:V(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ms).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Cn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:V(Ns).replace("hr",Sr).replace("heading",` *#{1,6} *[^
1519
- ]`).replace("lheading",uc).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),Fg=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Bg=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,hc=/^( {2,}|\\)\n(?!\s*$)/,Gg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Yt=/[\p{P}\p{S}]/u,er=/[\s\p{P}\p{S}]/u,Tr=/[^\s\p{P}\p{S}]/u,Wg=V(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,er).getRegex(),Jg=/[\p{Pi}\p{Ps}"']/u,fc=/(?!~)[\p{P}\p{S}]/u,Yg=/(?!~)[\s\p{P}\p{S}]/u,Vg=/(?:[^\s\p{P}\p{S}]|~)/u,Xg=V(/link|precode-code|html/,"g").replace("link",new RegExp("\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)")).replace("precode-",Pg?"(?<!`)()":"(^^|[^`])").replace("code",new RegExp("(?<b>`+)[^`]+\\k<b>(?!`)")).replace("html",/<(?! )[^<>]*?>/).getRegex(),gc=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Kg=V(gc,"u").replace(/punct/g,Yt).getRegex(),Qg=V(gc,"u").replace(/punct/g,fc).getRegex(),em=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,tm=V(em,"u").replace(/openQuote/g,Jg).replace(/punct/g,Yt).getRegex(),mc="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",nm=V(mc,"gu").replace(/notPunctSpace/g,Tr).replace(/punctSpace/g,er).replace(/punct/g,Yt).getRegex(),rm=V(mc,"gu").replace(/notPunctSpace/g,Vg).replace(/punctSpace/g,Yg).replace(/punct/g,fc).getRegex(),om="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",sm=V(om,"gu").replace(/notPunctSpace/g,Tr).replace(/punctSpace/g,er).replace(/punct/g,Yt).getRegex(),im=V("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Tr).replace(/punctSpace/g,er).replace(/punct/g,Yt).getRegex(),am="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",cm=V(am,"gu").replace(/notPunctSpace/g,Tr).replace(/punctSpace/g,er).replace(/punct/g,Yt).getRegex(),lm=V(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Yt).getRegex(),um="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",dm=V(um,"gu").replace(/notPunctSpace/g,Tr).replace(/punctSpace/g,er).replace(/punct/g,Yt).getRegex(),pm=V(/\\(punct)/,"gu").replace(/punct/g,Yt).getRegex(),hm=V(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),fm=V(Ms).replace("(?:-->|$)","-->").getRegex(),gm=V("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",fm).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),vo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,mm=V(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",vo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),bc=V(/^!?\[(label)\]\[(ref)\]/).replace("label",vo).replace("ref",Ds).getRegex(),kc=V(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ds).getRegex(),bm=V("reflink|nolink(?!\\()","g").replace("reflink",bc).replace("nolink",kc).getRegex(),_c=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,js={_backpedal:Cn,anyPunctuation:pm,autolink:hm,blockSkip:Xg,br:hc,code:Bg,del:Cn,delLDelim:Cn,delRDelim:Cn,emStrongLDelim:Kg,emStrongRDelimAst:nm,emStrongRDelimUnd:im,escape:Fg,link:mm,nolink:kc,punctuation:Wg,reflink:bc,reflinkSearch:bm,tag:gm,text:Gg,url:Cn},km=D(y({},js),{emStrongLDelim:tm,emStrongRDelimAst:sm,emStrongRDelimUnd:cm,link:V(/^!?\[(label)\]\((.*?)\)/).replace("label",vo).getRegex(),reflink:V(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",vo).getRegex()}),Zs=D(y({},js),{emStrongRDelimAst:rm,emStrongLDelim:Qg,delLDelim:lm,delRDelim:dm,url:V(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",_c).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:V(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",_c).getRegex()}),_m=D(y({},Zs),{br:V(hc).replace("{2,}","*").getRegex(),text:V(Zs.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),yo={normal:Us,gfm:qg,pedantic:Hg},Er={normal:js,gfm:Zs,breaks:_m,pedantic:km},vm={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},vc=e=>vm[e];function Mt(e,t){if(t){if(Je.escapeTest.test(e))return e.replace(Je.escapeReplace,vc)}else if(Je.escapeTestNoEncode.test(e))return e.replace(Je.escapeReplaceNoEncode,vc);return e}function yc(e){try{e=encodeURI(e).replace(Je.percentDecode,"%")}catch(t){return null}return e}function wc(e,t){var i;let n=e.replace(Je.findPipe,(a,d,u)=>{let p=!1,h=d;for(;--h>=0&&u[h]==="\\";)p=!p;return p?"|":" |"}),r=n.split(Je.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(Je.slashPipe,"|");return r}function pn(e,t,n){let r=e.length;if(r===0)return"";let o=0;for(;o<r&&e.charAt(r-o-1)===t;)o++;return e.slice(0,r-o)}function xc(e){let t=e.split(`
1520
- `),n=t.length-1;for(;n>=0&&Je.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
1521
- `)}function ym(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function wm(e,t=0){let n=t,r="";for(let o of e)if(o===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=o,n++;return r}function Sc(e,t,n,r,o){let i=t.href,a=t.title||null,d=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let u={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:d,tokens:r.inlineTokens(d)};return r.state.inLink=!1,u}function xm(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
1577
+ */var vc;function Wg(){return vc||(vc=1,(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(a,d){var l=this&&this.__extends||(function(){var j=function(A,T){return j=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,q){L.__proto__=q}||function(L,q){for(var H in q)q.hasOwnProperty(H)&&(L[H]=q[H])},j(A,T)};return function(A,T){j(A,T);function L(){this.constructor=A}A.prototype=T===null?Object.create(T):(L.prototype=T.prototype,new L)}})();Object.defineProperty(d,"__esModule",{value:!0});var p=256,h=(function(){function j(A){A===void 0&&(A="="),this._paddingCharacter=A}return j.prototype.encodedLength=function(A){return this._paddingCharacter?(A+2)/3*4|0:(A*8+5)/6|0},j.prototype.encode=function(A){for(var T="",L=0;L<A.length-2;L+=3){var q=A[L]<<16|A[L+1]<<8|A[L+2];T+=this._encodeByte(q>>>18&63),T+=this._encodeByte(q>>>12&63),T+=this._encodeByte(q>>>6&63),T+=this._encodeByte(q>>>0&63)}var H=A.length-L;if(H>0){var q=A[L]<<16|(H===2?A[L+1]<<8:0);T+=this._encodeByte(q>>>18&63),T+=this._encodeByte(q>>>12&63),H===2?T+=this._encodeByte(q>>>6&63):T+=this._paddingCharacter||"",T+=this._paddingCharacter||""}return T},j.prototype.maxDecodedLength=function(A){return this._paddingCharacter?A/4*3|0:(A*6+7)/8|0},j.prototype.decodedLength=function(A){return this.maxDecodedLength(A.length-this._getPaddingLength(A))},j.prototype.decode=function(A){if(A.length===0)return new Uint8Array(0);for(var T=this._getPaddingLength(A),L=A.length-T,q=new Uint8Array(this.maxDecodedLength(L)),H=0,se=0,je=0,nt=0,ee=0,Se=0,at=0;se<L-4;se+=4)nt=this._decodeChar(A.charCodeAt(se+0)),ee=this._decodeChar(A.charCodeAt(se+1)),Se=this._decodeChar(A.charCodeAt(se+2)),at=this._decodeChar(A.charCodeAt(se+3)),q[H++]=nt<<2|ee>>>4,q[H++]=ee<<4|Se>>>2,q[H++]=Se<<6|at,je|=nt&p,je|=ee&p,je|=Se&p,je|=at&p;if(se<L-1&&(nt=this._decodeChar(A.charCodeAt(se)),ee=this._decodeChar(A.charCodeAt(se+1)),q[H++]=nt<<2|ee>>>4,je|=nt&p,je|=ee&p),se<L-2&&(Se=this._decodeChar(A.charCodeAt(se+2)),q[H++]=ee<<4|Se>>>2,je|=Se&p),se<L-3&&(at=this._decodeChar(A.charCodeAt(se+3)),q[H++]=Se<<6|at,je|=at&p),je!==0)throw new Error("Base64Coder: incorrect characters for decoding");return q},j.prototype._encodeByte=function(A){var T=A;return T+=65,T+=25-A>>>8&6,T+=51-A>>>8&-75,T+=61-A>>>8&-15,T+=62-A>>>8&3,String.fromCharCode(T)},j.prototype._decodeChar=function(A){var T=p;return T+=(42-A&A-44)>>>8&-p+A-43+62,T+=(46-A&A-48)>>>8&-p+A-47+63,T+=(47-A&A-58)>>>8&-p+A-48+52,T+=(64-A&A-91)>>>8&-p+A-65+0,T+=(96-A&A-123)>>>8&-p+A-97+26,T},j.prototype._getPaddingLength=function(A){var T=0;if(this._paddingCharacter){for(var L=A.length-1;L>=0&&A[L]===this._paddingCharacter;L--)T++;if(A.length<4||T>2)throw new Error("Base64Coder: incorrect padding")}return T},j})();d.Coder=h;var g=new h;function m(j){return g.encode(j)}d.encode=m;function k(j){return g.decode(j)}d.decode=k;var y=(function(j){l(A,j);function A(){return j!==null&&j.apply(this,arguments)||this}return A.prototype._encodeByte=function(T){var L=T;return L+=65,L+=25-T>>>8&6,L+=51-T>>>8&-75,L+=61-T>>>8&-13,L+=62-T>>>8&49,String.fromCharCode(L)},A.prototype._decodeChar=function(T){var L=p;return L+=(44-T&T-46)>>>8&-p+T-45+62,L+=(94-T&T-96)>>>8&-p+T-95+63,L+=(47-T&T-58)>>>8&-p+T-48+52,L+=(64-T&T-91)>>>8&-p+T-65+0,L+=(96-T&T-123)>>>8&-p+T-97+26,L},A})(h);d.URLSafeCoder=y;var S=new y;function $(j){return S.encode(j)}d.encodeURLSafe=$;function E(j){return S.decode(j)}d.decodeURLSafe=E,d.encodedLength=function(j){return g.encodedLength(j)},d.maxDecodedLength=function(j){return g.maxDecodedLength(j)},d.decodedLength=function(j){return g.decodedLength(j)}},978(a,d){var l="utf8: invalid source encoding";function p(h){for(var g=[],m=0;m<h.length;m++){var k=h[m];if(k&128){var y=void 0;if(k<224){if(m>=h.length)throw new Error(l);var S=h[++m];if((S&192)!==128)throw new Error(l);k=(k&31)<<6|S&63,y=128}else if(k<240){if(m>=h.length-1)throw new Error(l);var S=h[++m],$=h[++m];if((S&192)!==128||($&192)!==128)throw new Error(l);k=(k&15)<<12|(S&63)<<6|$&63,y=2048}else if(k<248){if(m>=h.length-2)throw new Error(l);var S=h[++m],$=h[++m],E=h[++m];if((S&192)!==128||($&192)!==128||(E&192)!==128)throw new Error(l);k=(k&15)<<18|(S&63)<<12|($&63)<<6|E&63,y=65536}else throw new Error(l);if(k<y||k>=55296&&k<=57343)throw new Error(l);if(k>=65536){if(k>1114111)throw new Error(l);k-=65536,g.push(String.fromCharCode(55296|k>>10)),k=56320|k&1023}}g.push(String.fromCharCode(k))}return g.join("")}d.D4=p},721(a,d,l){a.exports=l(207).default},207(a,d,l){l.d(d,{default:()=>ws});class p{constructor(s,c){this.lastId=0,this.prefix=s,this.name=c}create(s){this.lastId++;var c=this.lastId,f=this.prefix+c,b=this.name+"["+c+"]",x=!1,R=function(){x||(s.apply(null,arguments),x=!0)};return this[c]=R,{number:c,id:f,name:b,callback:R}}remove(s){delete this[s.number]}}var h=new p("_pusher_script_","Pusher.ScriptReceivers"),g={VERSION:"8.5.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""};const m=g;class k{constructor(s){this.options=s,this.receivers=s.receivers||h,this.loading={}}load(s,c,f){var b=this;if(b.loading[s]&&b.loading[s].length>0)b.loading[s].push(f);else{b.loading[s]=[f];var x=Y.createScriptRequest(b.getPath(s,c)),R=b.receivers.create(function(D){if(b.receivers.remove(R),b.loading[s]){var J=b.loading[s];delete b.loading[s];for(var te=function($e){$e||x.cleanup()},ie=0;ie<J.length;ie++)J[ie](D,te)}});x.send(R)}}getRoot(s){var c,f=Y.getDocument().location.protocol;return s&&s.useTLS||f==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(s,c){return this.getRoot(c)+"/"+s+this.options.suffix+".js"}}var y=new p("_pusher_dependencies","Pusher.DependenciesReceivers"),S=new k({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:y});const $={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}},j={buildLogSuffix:function(u){const s="See:",c=$.urls[u];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=$.baseUrl+c.path),f?`${s} ${f}`:""}};var A;(function(u){u.UserAuthentication="user-authentication",u.ChannelAuthorization="channel-authorization"})(A||(A={}));class T extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class L extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class q extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class H extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class se extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class je extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class nt extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class ee extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Se extends Error{constructor(s,c){super(c),this.status=s,Object.setPrototypeOf(this,new.target.prototype)}}const At=function(u,s,c,f,b){const x=Y.createXHR();x.open("POST",c.endpoint,!0),x.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var R in c.headers)x.setRequestHeader(R,c.headers[R]);if(c.headersProvider!=null){let D=c.headersProvider();for(var R in D)x.setRequestHeader(R,D[R])}return x.onreadystatechange=function(){if(x.readyState===4)if(x.status===200){let D,J=!1;try{D=JSON.parse(x.responseText),J=!0}catch(te){b(new Se(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${x.responseText}`),null)}J&&b(null,D)}else{let D="";switch(f){case A.UserAuthentication:D=j.buildLogSuffix("authenticationEndpoint");break;case A.ChannelAuthorization:D=`Clients must be authorized to join private or presence channels. ${j.buildLogSuffix("authorizationEndpoint")}`;break}b(new Se(x.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${x.status} from ${c.endpoint}. ${D}`),null)}},x.send(s),x};function vr(u){return ye(Yt(u))}var Jt=String.fromCharCode,Ct="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",yr=function(u){var s=u.charCodeAt(0);return s<128?u:s<2048?Jt(192|s>>>6)+Jt(128|s&63):Jt(224|s>>>12&15)+Jt(128|s>>>6&63)+Jt(128|s&63)},Yt=function(u){return u.replace(/[^\x00-\x7F]/g,yr)},an=function(u){var s=[0,2,1][u.length%3],c=u.charCodeAt(0)<<16|(u.length>1?u.charCodeAt(1):0)<<8|(u.length>2?u.charCodeAt(2):0),f=[Ct.charAt(c>>>18),Ct.charAt(c>>>12&63),s>=2?"=":Ct.charAt(c>>>6&63),s>=1?"=":Ct.charAt(c&63)];return f.join("")},ye=window.btoa||function(u){return u.replace(/[\s\S]{1,3}/g,an)};class Vt{constructor(s,c,f,b){this.clear=c,this.timer=s(()=>{this.timer&&(this.timer=b(this.timer))},f)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const ge=Vt;function Pt(u){window.clearTimeout(u)}function le(u){window.clearInterval(u)}class Le extends ge{constructor(s,c){super(setTimeout,Pt,s,function(f){return c(),null})}}class En extends ge{constructor(s,c){super(setInterval,le,s,function(f){return c(),f})}}var Rt={now(){return Date.now?Date.now():new Date().valueOf()},defer(u){return new Le(0,u)},method(u,...s){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[u].apply(f,c.concat(arguments))}}};const Te=Rt;function Pe(u,...s){for(var c=0;c<s.length;c++){var f=s[c];for(var b in f)f[b]&&f[b].constructor&&f[b].constructor===Object?u[b]=Pe(u[b]||{},f[b]):u[b]=f[b]}return u}function Fn(){for(var u=["Pusher"],s=0;s<arguments.length;s++)typeof arguments[s]=="string"?u.push(arguments[s]):u.push(ue(arguments[s]));return u.join(" : ")}function An(u,s){var c=Array.prototype.indexOf;if(u===null)return-1;if(c&&u.indexOf===c)return u.indexOf(s);for(var f=0,b=u.length;f<b;f++)if(u[f]===s)return f;return-1}function Ne(u,s){for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&s(u[c],c,u)}function Xt(u){var s=[];return Ne(u,function(c,f){s.push(f)}),s}function bt(u){var s=[];return Ne(u,function(c){s.push(c)}),s}function kt(u,s,c){for(var f=0;f<u.length;f++)s.call(c||window,u[f],f,u)}function cn(u,s){for(var c=[],f=0;f<u.length;f++)c.push(s(u[f],f,u,c));return c}function F(u,s){var c={};return Ne(u,function(f,b){c[b]=s(f)}),c}function re(u,s){s=s||function(b){return!!b};for(var c=[],f=0;f<u.length;f++)s(u[f],f,u,c)&&c.push(u[f]);return c}function xe(u,s){var c={};return Ne(u,function(f,b){(s&&s(f,b,u,c)||f)&&(c[b]=f)}),c}function rt(u){var s=[];return Ne(u,function(c,f){s.push([f,c])}),s}function _t(u,s){for(var c=0;c<u.length;c++)if(s(u[c],c,u))return!0;return!1}function Lt(u,s){for(var c=0;c<u.length;c++)if(!s(u[c],c,u))return!1;return!0}function Cn(u){return F(u,function(s){return typeof s=="object"&&(s=ue(s)),encodeURIComponent(vr(s.toString()))})}function Kt(u){var s=xe(u,function(f){return f!==void 0}),c=cn(rt(Cn(s)),Te.method("join","=")).join("&");return c}function De(u){var s=[],c=[];return(function f(b,x){var R,D,J;switch(typeof b){case"object":if(!b)return null;for(R=0;R<s.length;R+=1)if(s[R]===b)return{$ref:c[R]};if(s.push(b),c.push(x),Object.prototype.toString.apply(b)==="[object Array]")for(J=[],R=0;R<b.length;R+=1)J[R]=f(b[R],x+"["+R+"]");else{J={};for(D in b)Object.prototype.hasOwnProperty.call(b,D)&&(J[D]=f(b[D],x+"["+JSON.stringify(D)+"]"))}return J;case"number":case"string":case"boolean":return b}})(u,"$")}function ue(u){try{return JSON.stringify(u)}catch(s){return JSON.stringify(De(u))}}class Ie{constructor(){this.globalLog=s=>{window.console&&window.console.log&&window.console.log(s)}}debug(...s){this.log(this.globalLog,s)}warn(...s){this.log(this.globalLogWarn,s)}error(...s){this.log(this.globalLogError,s)}globalLogWarn(s){window.console&&window.console.warn?window.console.warn(s):this.globalLog(s)}globalLogError(s){window.console&&window.console.error?window.console.error(s):this.globalLogWarn(s)}log(s,...c){var f=Fn.apply(this,arguments);ws.log?ws.log(f):ws.logToConsole&&s.bind(this)(f)}}const X=new Ie;var wr=function(u,s,c,f,b){(c.headers!==void 0||c.headersProvider!=null)&&X.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var x=u.nextAuthCallbackID.toString();u.nextAuthCallbackID++;var R=u.getDocument(),D=R.createElement("script");u.auth_callbacks[x]=function(ie){b(null,ie)};var J="Pusher.auth_callbacks['"+x+"']";D.src=c.endpoint+"?callback="+encodeURIComponent(J)+"&"+s;var te=R.getElementsByTagName("head")[0]||R.documentElement;te.insertBefore(D,te.firstChild)};const ot=wr;class It{constructor(s){this.src=s}send(s){var c=this,f="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=s.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){s.callback(f)},c.script.onload=function(){s.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&s.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=s.id+"_error",c.errorScript.text=s.name+"('"+f+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var b=document.getElementsByTagName("head")[0];b.insertBefore(c.script,b.firstChild),c.errorScript&&b.insertBefore(c.errorScript,c.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class ln{constructor(s,c){this.url=s,this.data=c}send(s){if(!this.request){var c=Kt(this.data),f=this.url+"/"+s.number+"?"+c;this.request=Y.createScriptRequest(f),this.request.send(s)}}cleanup(){this.request&&this.request.cleanup()}}var $t=function(u,s){return function(c,f){var b="http"+(s?"s":"")+"://",x=b+(u.host||u.options.host)+u.options.path,R=Y.createJSONPRequest(x,c),D=Y.ScriptReceivers.create(function(J,te){h.remove(D),R.cleanup(),te&&te.host&&(u.host=te.host),f&&f(J,te)});R.send(D)}},zt={name:"jsonp",getAgent:$t};const Pn=zt;function Bn(u,s,c){var f=u+(s.useTLS?"s":""),b=s.useTLS?s.hostTLS:s.hostNonTLS;return f+"://"+b+c}function Gn(u,s){var c="/app/"+u,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(s?"&"+s:"");return c+f}var zi={getInitial:function(u,s){var c=(s.httpPath||"")+Gn(u,"flash=false");return Bn("ws",s,c)}},xr={getInitial:function(u,s){var c=(s.httpPath||"/pusher")+Gn(u);return Bn("http",s,c)}},Sr={getInitial:function(u,s){return Bn("http",s,s.httpPath||"/pusher")},getPath:function(u,s){return Gn(u)}};class Oi{constructor(){this._callbacks={}}get(s){return this._callbacks[un(s)]}add(s,c,f){var b=un(s);this._callbacks[b]=this._callbacks[b]||[],this._callbacks[b].push({fn:c,context:f})}remove(s,c,f){if(!s&&!c&&!f){this._callbacks={};return}var b=s?[un(s)]:Xt(this._callbacks);c||f?this.removeCallback(b,c,f):this.removeAllCallbacks(b)}removeCallback(s,c,f){kt(s,function(b){this._callbacks[b]=re(this._callbacks[b]||[],function(x){return c&&c!==x.fn||f&&f!==x.context}),this._callbacks[b].length===0&&delete this._callbacks[b]},this)}removeAllCallbacks(s){kt(s,function(c){delete this._callbacks[c]},this)}}function un(u){return"_"+u}class Ot{constructor(s){this.callbacks=new Oi,this.global_callbacks=[],this.failThrough=s}bind(s,c,f){return this.callbacks.add(s,c,f),this}bind_global(s){return this.global_callbacks.push(s),this}unbind(s,c,f){return this.callbacks.remove(s,c,f),this}unbind_global(s){return s?(this.global_callbacks=re(this.global_callbacks||[],c=>c!==s),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(s,c,f){for(var b=0;b<this.global_callbacks.length;b++)this.global_callbacks[b](s,c);var x=this.callbacks.get(s),R=[];if(f?R.push(c,f):c&&R.push(c),x&&x.length>0)for(var b=0;b<x.length;b++)x[b].fn.apply(x[b].context||window,R);else this.failThrough&&this.failThrough(s,c);return this}}class Ni extends Ot{constructor(s,c,f,b,x){super(),this.initialize=Y.transportConnectionInitializer,this.hooks=s,this.name=c,this.priority=f,this.key=b,this.options=x,this.state="new",this.timeline=x.timeline,this.activityTimeout=x.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var s=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(s,this.options)}catch(c){return Te.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),X.debug("Connecting",{transport:this.name,url:s}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(s){return this.state==="open"?(Te.defer(()=>{this.socket&&this.socket.send(s)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(s){this.emit("error",{type:"WebSocketError",error:s}),this.timeline.error(this.buildTimelineMessage({error:s.toString()}))}onClose(s){s?this.changeState("closed",{code:s.code,reason:s.reason,wasClean:s.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(s){this.emit("message",s)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=s=>{this.onError(s)},this.socket.onclose=s=>{this.onClose(s)},this.socket.onmessage=s=>{this.onMessage(s)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(s,c){this.state=s,this.timeline.info(this.buildTimelineMessage({state:s,params:c})),this.emit(s,c)}buildTimelineMessage(s){return Pe({cid:this.id},s)}}class he{constructor(s){this.hooks=s}isSupported(s){return this.hooks.isSupported(s)}createConnection(s,c,f,b){return new Ni(this.hooks,s,c,f,b)}}var Rn=new he({urls:zi,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!Y.getWebSocketAPI()},isSupported:function(){return!!Y.getWebSocketAPI()},getSocket:function(u){return Y.createWebSocket(u)}}),ds={urls:xr,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},ro=Pe({getSocket:function(u){return Y.HTTPFactory.createStreamingSocket(u)}},ds),Tr=Pe({getSocket:function(u){return Y.HTTPFactory.createPollingSocket(u)}},ds),oo={isSupported:function(){return Y.isXHRSupported()}},ps=new he(Pe({},ro,oo)),Di=new he(Pe({},Tr,oo)),vt={ws:Rn,xhr_streaming:ps,xhr_polling:Di};const yt=vt;var hs=new he({file:"sockjs",urls:Sr,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(u,s){return new window.SockJS(u,null,{js_path:S.getPath("sockjs",{useTLS:s.useTLS}),ignore_null_origin:s.ignoreNullOrigin})},beforeOpen:function(u,s){u.send(JSON.stringify({path:s}))}}),so={isSupported:function(u){var s=Y.isXDRSupported(u.useTLS);return s}},io=new he(Pe({},ro,so)),fs=new he(Pe({},Tr,so));yt.xdr_streaming=io,yt.xdr_polling=fs,yt.sockjs=hs;const Nt=yt;class gs extends Ot{constructor(){super();var s=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){s.emit("online")},!1),window.addEventListener("offline",function(){s.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var ms=new gs;class bs{constructor(s,c,f){this.manager=s,this.transport=c,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(s,c,f,b){b=Pe({},b,{activityTimeout:this.pingDelay});var x=this.transport.createConnection(s,c,f,b),R=null,D=function(){x.unbind("open",D),x.bind("closed",J),R=Te.now()},J=te=>{if(x.unbind("closed",J),te.code===1002||te.code===1003)this.manager.reportDeath();else if(!te.wasClean&&R){var ie=Te.now()-R;ie<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(ie/2,this.minPingDelay))}};return x.bind("open",D),x}isSupported(s){return this.manager.isAlive()&&this.transport.isSupported(s)}}const ao={decodeMessage:function(u){try{var s=JSON.parse(u.data),c=s.data;if(typeof c=="string")try{c=JSON.parse(s.data)}catch(b){}var f={event:s.event,channel:s.channel,data:c};return s.user_id&&(f.user_id=s.user_id),f}catch(b){throw{type:"MessageParseError",error:b,data:u.data}}},encodeMessage:function(u){return JSON.stringify(u)},processHandshake:function(u){var s=ao.decodeMessage(u);if(s.event==="pusher:connection_established"){if(!s.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:s.data.socket_id,activityTimeout:s.data.activity_timeout*1e3}}else{if(s.event==="pusher:error")return{action:this.getCloseAction(s.data),error:this.getCloseError(s.data)};throw"Invalid handshake"}},getCloseAction:function(u){return u.code<4e3?u.code>=1002&&u.code<=1004?"backoff":null:u.code===4e3?"tls_only":u.code<4100?"refused":u.code<4200?"backoff":u.code<4300?"retry":"refused"},getCloseError:function(u){return u.code!==1e3&&u.code!==1001?{type:"PusherError",data:{code:u.code,message:u.reason||u.message}}:null}},dn=ao;class Z extends Ot{constructor(s,c){super(),this.id=s,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(s){return this.transport.send(s)}send_event(s,c,f){var b={event:s,data:c};return f&&(b.channel=f),X.debug("Event sent",b),this.send(dn.encodeMessage(b))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var s={message:f=>{var b;try{b=dn.decodeMessage(f)}catch(x){this.emit("error",{type:"MessageParseError",error:x,data:f.data})}if(b!==void 0){switch(X.debug("Event recd",b),b.event){case"pusher:error":this.emit("error",{type:"PusherError",data:b.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",b)}},activity:()=>{this.emit("activity")},error:f=>{this.emit("error",f)},closed:f=>{c(),f&&f.code&&this.handleCloseEvent(f),this.transport=null,this.emit("closed")}},c=()=>{Ne(s,(f,b)=>{this.transport.unbind(b,f)})};Ne(s,(f,b)=>{this.transport.bind(b,f)})}handleCloseEvent(s){var c=dn.getCloseAction(s),f=dn.getCloseError(s);f&&this.emit("error",f),c&&this.emit(c,{action:c,error:f})}}class _{constructor(s,c){this.transport=s,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=s=>{this.unbindListeners();var c;try{c=dn.processHandshake(s)}catch(f){this.finish("error",{error:f}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new Z(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=s=>{this.unbindListeners();var c=dn.getCloseAction(s)||"backoff",f=dn.getCloseError(s);this.finish(c,{error:f})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(s,c){this.callback(Pe({transport:this.transport,action:s},c))}}class C{constructor(s,c){this.timeline=s,this.options=c||{}}send(s,c){this.timeline.isEmpty()||this.timeline.send(Y.TimelineTransport.getAgent(this,s),c)}}class O extends Ot{constructor(s,c){super(function(f,b){X.debug("No callbacks on "+s+" for "+f)}),this.name=s,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(s,c){return c(null,{auth:""})}trigger(s,c){if(s.indexOf("client-")!==0)throw new T("Event '"+s+"' does not start with 'client-'");if(!this.subscribed){var f=j.buildLogSuffix("triggeringClientEvents");X.warn(`Client event triggered before channel 'subscription_succeeded' event . ${f}`)}return this.pusher.send_event(s,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(s){var c=s.event,f=s.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(s);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(s);else if(c.indexOf("pusher_internal:")!==0){var b={};this.emit(c,f,b)}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",s.data)}handleSubscriptionCountEvent(s){s.data.subscription_count&&(this.subscriptionCount=s.data.subscription_count),this.emit("pusher:subscription_count",s.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(s,c)=>{s?(this.subscriptionPending=!1,X.error(s.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:s.message},s instanceof Se?{status:s.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:c.auth,channel_data:c.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class de extends O{authorize(s,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:s},c)}}class Ze{constructor(){this.reset()}get(s){return Object.prototype.hasOwnProperty.call(this.members,s)?{id:s,info:this.members[s]}:null}each(s){Ne(this.members,(c,f)=>{s(this.get(f))})}setMyID(s){this.myID=s}onSubscription(s){this.members=s.presence.hash,this.count=s.presence.count,this.me=this.get(this.myID)}addMember(s){return this.get(s.user_id)===null&&this.count++,this.members[s.user_id]=s.user_info,this.get(s.user_id)}removeMember(s){var c=this.get(s.user_id);return c&&(delete this.members[s.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var Ee=function(u,s,c,f){function b(x){return x instanceof c?x:new c(function(R){R(x)})}return new(c||(c=Promise))(function(x,R){function D(ie){try{te(f.next(ie))}catch($e){R($e)}}function J(ie){try{te(f.throw(ie))}catch($e){R($e)}}function te(ie){ie.done?x(ie.value):b(ie.value).then(D,J)}te((f=f.apply(u,s||[])).next())})};class Je extends de{constructor(s,c){super(s,c),this.members=new Ze}authorize(s,c){super.authorize(s,(f,b)=>Ee(this,void 0,void 0,function*(){if(!f)if(b=b,b.channel_data!=null){var x=JSON.parse(b.channel_data);this.members.setMyID(x.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let R=j.buildLogSuffix("authorizationEndpoint");X.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${R}, or the user should be signed in.`),c("Invalid auth response");return}c(f,b)}))}handleEvent(s){var c=s.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(s);else{var f=s.data,b={};s.user_id&&(b.user_id=s.user_id),this.emit(c,f,b)}}handleInternalEvent(s){var c=s.event,f=s.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(s);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(s);break;case"pusher_internal:member_added":var b=this.members.addMember(f);this.emit("pusher:member_added",b);break;case"pusher_internal:member_removed":var x=this.members.removeMember(f);x&&this.emit("pusher:member_removed",x);break}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(s.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var Dt=l(978),Qt=l(594);class co extends de{constructor(s,c,f){super(s,c),this.key=null,this.nacl=f}authorize(s,c){super.authorize(s,(f,b)=>{if(f){c(f,b);return}let x=b.shared_secret;if(!x){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,Qt.decode)(x),delete b.shared_secret,c(null,b)})}trigger(s,c){throw new je("Client events are not currently supported for encrypted channels")}handleEvent(s){var c=s.event,f=s.data;if(c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0){super.handleEvent(s);return}this.handleEncryptedEvent(c,f)}handleEncryptedEvent(s,c){if(!this.key){X.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){X.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let f=(0,Qt.decode)(c.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){X.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let b=(0,Qt.decode)(c.nonce);if(b.length<this.nacl.secretbox.nonceLength){X.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${b.length}`);return}let x=this.nacl.secretbox.open(f,b,this.key);if(x===null){X.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(R,D)=>{if(R){X.error(`Failed to make a request to the authEndpoint: ${D}. Unable to fetch new key, so dropping encrypted event`);return}if(x=this.nacl.secretbox.open(f,b,this.key),x===null){X.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(s,this.getDataToEmit(x))});return}this.emit(s,this.getDataToEmit(x))}getDataToEmit(s){let c=(0,Dt.D4)(s);try{return JSON.parse(c)}catch(f){return c}}}class Me extends Ot{constructor(s,c){super(),this.state="initialized",this.connection=null,this.key=s,this.options=c,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var f=Y.getNetwork();f.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),f.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(s){this.key=s,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(s){return this.connection?this.connection.send(s):!1}send_event(s,c,f){return this.connection?this.connection.send_event(s,c,f):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var s=(c,f)=>{c?this.runner=this.strategy.connect(0,s):f.action==="error"?(this.emit("error",{type:"HandshakeError",error:f.error}),this.timeline.error({handshakeError:f.error})):(this.abortConnecting(),this.handshakeCallbacks[f.action](f))};this.runner=this.strategy.connect(0,s)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var s=this.abandonConnection();s.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(s){this.timeline.info({action:"retry",delay:s}),s>0&&this.emit("connecting_in",Math.round(s/1e3)),this.retryTimer=new Le(s||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new Le(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new Le(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new Le(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(s){return Pe({},s,{message:c=>{this.resetActivityCheck(),this.emit("message",c)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:c=>{this.emit("error",c)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(s){return Pe({},s,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let s=c=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),c(f)};return{tls_only:s(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:s(()=>{this.disconnect()}),backoff:s(()=>{this.retryIn(1e3)}),retry:s(()=>{this.retryIn(0)})}}setConnection(s){this.connection=s;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var s in this.connectionCallbacks)this.connection.unbind(s,this.connectionCallbacks[s]);var c=this.connection;return this.connection=null,c}}updateState(s,c){var f=this.state;if(this.state=s,f!==s){var b=s;b==="connected"&&(b+=" with new socket ID "+c.socket_id),X.debug("State changed",f+" -> "+b),this.timeline.info({state:s,params:c}),this.emit("state_change",{previous:f,current:s}),this.emit(s,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class ks{constructor(){this.channels={}}add(s,c){return this.channels[s]||(this.channels[s]=_s(s,c)),this.channels[s]}all(){return bt(this.channels)}find(s){return this.channels[s]}remove(s){var c=this.channels[s];return delete this.channels[s],c}disconnect(){Ne(this.channels,function(s){s.disconnect()})}}function _s(u,s){if(u.indexOf("private-encrypted-")===0){if(s.config.nacl)return pn.createEncryptedChannel(u,s,s.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=j.buildLogSuffix("encryptedChannelSupport");throw new je(`${c}. ${f}`)}else{if(u.indexOf("private-")===0)return pn.createPrivateChannel(u,s);if(u.indexOf("presence-")===0)return pn.createPresenceChannel(u,s);if(u.indexOf("#")===0)throw new L('Cannot create a channel with name "'+u+'".');return pn.createChannel(u,s)}}var jk={createChannels(){return new ks},createConnectionManager(u,s){return new Me(u,s)},createChannel(u,s){return new O(u,s)},createPrivateChannel(u,s){return new de(u,s)},createPresenceChannel(u,s){return new Je(u,s)},createEncryptedChannel(u,s,c){return new co(u,s,c)},createTimelineSender(u,s){return new C(u,s)},createHandshake(u,s){return new _(u,s)},createAssistantToTheTransportManager(u,s,c){return new bs(u,s,c)}};const pn=jk;class tu{constructor(s){this.options=s||{},this.livesLeft=this.options.lives||1/0}getAssistant(s){return pn.createAssistantToTheTransportManager(this,s,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Wn{constructor(s,c){this.strategies=s,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return _t(this.strategies,Te.method("isSupported"))}connect(s,c){var f=this.strategies,b=0,x=this.timeout,R=null,D=(J,te)=>{te?c(null,te):(b=b+1,this.loop&&(b=b%f.length),b<f.length?(x&&(x=x*2,this.timeoutLimit&&(x=Math.min(x,this.timeoutLimit))),R=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},D)):c(!0))};return R=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},D),{abort:function(){R.abort()},forceMinPriority:function(J){s=J,R&&R.forceMinPriority(J)}}}tryStrategy(s,c,f,b){var x=null,R=null;return f.timeout>0&&(x=new Le(f.timeout,function(){R.abort(),b(!0)})),R=s.connect(c,function(D,J){D&&x&&x.isRunning()&&!f.failFast||(x&&x.ensureAborted(),b(D,J))}),{abort:function(){x&&x.ensureAborted(),R.abort()},forceMinPriority:function(D){R.forceMinPriority(D)}}}}class Mi{constructor(s){this.strategies=s}isSupported(){return _t(this.strategies,Te.method("isSupported"))}connect(s,c){return Zk(this.strategies,s,function(f,b){return function(x,R){if(b[f].error=x,x){qk(b)&&c(!0);return}kt(b,function(D){D.forceMinPriority(R.transport.priority)}),c(null,R)}})}}function Zk(u,s,c){var f=cn(u,function(b,x,R,D){return b.connect(s,c(x,D))});return{abort:function(){kt(f,Hk)},forceMinPriority:function(b){kt(f,function(x){x.forceMinPriority(b)})}}}function qk(u){return Lt(u,function(s){return!!s.error})}function Hk(u){!u.error&&!u.aborted&&(u.abort(),u.aborted=!0)}class Fk{constructor(s,c,f){this.strategy=s,this.transports=c,this.ttl=f.ttl||18e5,this.usingTLS=f.useTLS,this.timeline=f.timeline}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.usingTLS,b=Bk(f),x=b&&b.cacheSkipCount?b.cacheSkipCount:0,R=[this.strategy];if(b&&b.timestamp+this.ttl>=Te.now()){var D=this.transports[b.transport];D&&(["ws","wss"].includes(b.transport)||x>3?(this.timeline.info({cached:!0,transport:b.transport,latency:b.latency}),R.push(new Wn([D],{timeout:b.latency*2+1e3,failFast:!0}))):x++)}var J=Te.now(),te=R.pop().connect(s,function ie($e,xs){$e?(nu(f),R.length>0?(J=Te.now(),te=R.pop().connect(s,ie)):c($e)):(Gk(f,xs.transport.name,Te.now()-J,x),c(null,xs))});return{abort:function(){te.abort()},forceMinPriority:function(ie){s=ie,te&&te.forceMinPriority(ie)}}}}function Ui(u){return"pusherTransport"+(u?"TLS":"NonTLS")}function Bk(u){var s=Y.getLocalStorage();if(s)try{var c=s[Ui(u)];if(c)return JSON.parse(c)}catch(f){nu(u)}return null}function Gk(u,s,c,f){var b=Y.getLocalStorage();if(b)try{b[Ui(u)]=ue({timestamp:Te.now(),transport:s,latency:c,cacheSkipCount:f})}catch(x){}}function nu(u){var s=Y.getLocalStorage();if(s)try{delete s[Ui(u)]}catch(c){}}class vs{constructor(s,{delay:c}){this.strategy=s,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy,b,x=new Le(this.options.delay,function(){b=f.connect(s,c)});return{abort:function(){x.ensureAborted(),b&&b.abort()},forceMinPriority:function(R){s=R,b&&b.forceMinPriority(R)}}}}class lo{constructor(s,c,f){this.test=s,this.trueBranch=c,this.falseBranch=f}isSupported(){var s=this.test()?this.trueBranch:this.falseBranch;return s.isSupported()}connect(s,c){var f=this.test()?this.trueBranch:this.falseBranch;return f.connect(s,c)}}class Wk{constructor(s){this.strategy=s}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy.connect(s,function(b,x){x&&f.abort(),c(b,x)});return f}}function uo(u){return function(){return u.isSupported()}}var Jk=function(u,s,c){var f={};function b(gu,B_,G_,W_,J_){var mu=c(u,gu,B_,G_,W_,J_);return f[gu]=mu,mu}var x=Object.assign({},s,{hostNonTLS:u.wsHost+":"+u.wsPort,hostTLS:u.wsHost+":"+u.wssPort,httpPath:u.wsPath}),R=Object.assign({},x,{useTLS:!0}),D=Object.assign({},s,{hostNonTLS:u.httpHost+":"+u.httpPort,hostTLS:u.httpHost+":"+u.httpsPort,httpPath:u.httpPath}),J={loop:!0,timeout:15e3,timeoutLimit:6e4},te=new tu({minPingDelay:1e4,maxPingDelay:u.activityTimeout}),ie=new tu({lives:2,minPingDelay:1e4,maxPingDelay:u.activityTimeout}),$e=b("ws","ws",3,x,te),xs=b("wss","ws",3,R,te),j_=b("sockjs","sockjs",1,D),lu=b("xhr_streaming","xhr_streaming",1,D,ie),Z_=b("xdr_streaming","xdr_streaming",1,D,ie),uu=b("xhr_polling","xhr_polling",1,D),q_=b("xdr_polling","xdr_polling",1,D),du=new Wn([$e],J),H_=new Wn([xs],J),F_=new Wn([j_],J),pu=new Wn([new lo(uo(lu),lu,Z_)],J),hu=new Wn([new lo(uo(uu),uu,q_)],J),fu=new Wn([new lo(uo(pu),new Mi([pu,new vs(hu,{delay:4e3})]),hu)],J),qi=new lo(uo(fu),fu,F_),Hi;return s.useTLS?Hi=new Mi([du,new vs(qi,{delay:2e3})]):Hi=new Mi([du,new vs(H_,{delay:2e3}),new vs(qi,{delay:5e3})]),new Fk(new Wk(new lo(uo($e),Hi,qi)),f,{ttl:18e5,timeline:s.timeline,useTLS:s.useTLS})};const Yk=Jk;function Vk(){var u=this;u.timeline.info(u.buildTimelineMessage({transport:u.name+(u.options.useTLS?"s":"")})),u.hooks.isInitialized()?u.changeState("initialized"):u.hooks.file?(u.changeState("initializing"),S.load(u.hooks.file,{useTLS:u.options.useTLS},function(s,c){u.hooks.isInitialized()?(u.changeState("initialized"),c(!0)):(s&&u.onError(s),u.onClose(),c(!1))})):u.onClose()}var Xk={getRequest:function(u){var s=new window.XDomainRequest;return s.ontimeout=function(){u.emit("error",new q),u.close()},s.onerror=function(c){u.emit("error",c),u.close()},s.onprogress=function(){s.responseText&&s.responseText.length>0&&u.onChunk(200,s.responseText)},s.onload=function(){s.responseText&&s.responseText.length>0&&u.onChunk(200,s.responseText),u.emit("finished",200),u.close()},s},abortRequest:function(u){u.ontimeout=u.onerror=u.onprogress=u.onload=null,u.abort()}};const Kk=Xk,Qk=256*1024;class e_ extends Ot{constructor(s,c,f){super(),this.hooks=s,this.method=c,this.url=f}start(s){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},Y.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(s)}close(){this.unloader&&(Y.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(s,c){for(;;){var f=this.advanceBuffer(c);if(f)this.emit("chunk",{status:s,data:f});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(s){var c=s.slice(this.position),f=c.indexOf(`
1578
+ `);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(s){return this.position===s.length&&s.length>Qk}}var ji;(function(u){u[u.CONNECTING=0]="CONNECTING",u[u.OPEN=1]="OPEN",u[u.CLOSED=3]="CLOSED"})(ji||(ji={}));const Jn=ji;var t_=1;class n_{constructor(s,c){this.hooks=s,this.session=ou(1e3)+"/"+i_(8),this.location=r_(c),this.readyState=Jn.CONNECTING,this.openStream()}send(s){return this.sendRaw(JSON.stringify([s]))}ping(){this.hooks.sendHeartbeat(this)}close(s,c){this.onClose(s,c,!0)}sendRaw(s){if(this.readyState===Jn.OPEN)try{return Y.createSocketRequest("POST",ru(o_(this.location,this.session))).start(s),!0}catch(c){return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(s,c,f){this.closeStream(),this.readyState=Jn.CLOSED,this.onclose&&this.onclose({code:s,reason:c,wasClean:f})}onChunk(s){if(s.status===200){this.readyState===Jn.OPEN&&this.onActivity();var c,f=s.data.slice(0,1);switch(f){case"o":c=JSON.parse(s.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(s.data.slice(1)||"[]");for(var b=0;b<c.length;b++)this.onEvent(c[b]);break;case"m":c=JSON.parse(s.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(s.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(s){this.readyState===Jn.CONNECTING?(s&&s.hostname&&(this.location.base=s_(this.location.base,s.hostname)),this.readyState=Jn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(s){this.readyState===Jn.OPEN&&this.onmessage&&this.onmessage({data:s})}onActivity(){this.onactivity&&this.onactivity()}onError(s){this.onerror&&this.onerror(s)}openStream(){this.stream=Y.createSocketRequest("POST",ru(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",s=>{this.onChunk(s)}),this.stream.bind("finished",s=>{this.hooks.onFinished(this,s)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(s){Te.defer(()=>{this.onError(s),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function r_(u){var s=/([^\?]*)\/*(\??.*)/.exec(u);return{base:s[1],queryString:s[2]}}function o_(u,s){return u.base+"/"+s+"/xhr_send"}function ru(u){var s=u.indexOf("?")===-1?"?":"&";return u+s+"t="+ +new Date+"&n="+t_++}function s_(u,s){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(u);return c[1]+s+c[3]}function ou(u){return Y.randomInt(u)}function i_(u){for(var s=[],c=0;c<u;c++)s.push(ou(32).toString(32));return s.join("")}const a_=n_;var c_={getReceiveURL:function(u,s){return u.base+"/"+s+"/xhr_streaming"+u.queryString},onHeartbeat:function(u){u.sendRaw("[]")},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,s){u.onClose(1006,"Connection interrupted ("+s+")",!1)}};const l_=c_;var u_={getReceiveURL:function(u,s){return u.base+"/"+s+"/xhr"+u.queryString},onHeartbeat:function(){},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,s){s===200?u.reconnect():u.onClose(1006,"Connection interrupted ("+s+")",!1)}};const d_=u_;var p_={getRequest:function(u){var s=Y.getXHRAPI(),c=new s;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&u.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&u.onChunk(c.status,c.responseText),u.emit("finished",c.status),u.close();break}},c},abortRequest:function(u){u.onreadystatechange=null,u.abort()}};const h_=p_;var f_={createStreamingSocket(u){return this.createSocket(l_,u)},createPollingSocket(u){return this.createSocket(d_,u)},createSocket(u,s){return new a_(u,s)},createXHR(u,s){return this.createRequest(h_,u,s)},createRequest(u,s,c){return new e_(u,s,c)}};const su=f_;su.createXDR=function(u,s){return this.createRequest(Kk,u,s)};var g_={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:y,getDefaultStrategy:Yk,Transports:Nt,transportConnectionInitializer:Vk,HTTPFactory:su,TimelineTransport:Pn,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(u){window.Pusher=u;var s=()=>{this.onDocumentBody(u.ready)};window.JSON?s():S.load("json2",{},s)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:At,jsonp:ot}},onDocumentBody(u){document.body?u():setTimeout(()=>{this.onDocumentBody(u)},0)},createJSONPRequest(u,s){return new ln(u,s)},createScriptRequest(u){return new It(u)},getLocalStorage(){try{return window.localStorage}catch(u){return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var u=this.getXHRAPI();return new u},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return ms},createWebSocket(u){var s=this.getWebSocketAPI();return new s(u)},createSocketRequest(u,s){if(this.isXHRSupported())return this.HTTPFactory.createXHR(u,s);if(this.isXDRSupported(s.indexOf("https:")===0))return this.HTTPFactory.createXDR(u,s);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var u=this.getXHRAPI();return!!u&&new u().withCredentials!==void 0},isXDRSupported(u){var s=u?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===s},addUnloadListener(u){window.addEventListener!==void 0?window.addEventListener("unload",u,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",u)},removeUnloadListener(u){window.addEventListener!==void 0?window.removeEventListener("unload",u,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",u)},randomInt(u){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*u)}};const Y=g_;var Zi;(function(u){u[u.ERROR=3]="ERROR",u[u.INFO=6]="INFO",u[u.DEBUG=7]="DEBUG"})(Zi||(Zi={}));const ys=Zi;class m_{constructor(s,c,f){this.key=s,this.session=c,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(s,c){s<=this.options.level&&(this.events.push(Pe({},c,{timestamp:Te.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(s){this.log(ys.ERROR,s)}info(s){this.log(ys.INFO,s)}debug(s){this.log(ys.DEBUG,s)}isEmpty(){return this.events.length===0}send(s,c){var f=Pe({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],s(f,(b,x)=>{b||this.sent++,c&&c(b,x)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class b_{constructor(s,c,f,b){this.name=s,this.priority=c,this.transport=f,this.options=b||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(s,c){if(this.isSupported()){if(this.priority<s)return iu(new H,c)}else return iu(new ee,c);var f=!1,b=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),x=null,R=function(){b.unbind("initialized",R),b.connect()},D=function(){x=pn.createHandshake(b,function($e){f=!0,ie(),c(null,$e)})},J=function($e){ie(),c($e)},te=function(){ie();var $e;$e=ue(b),c(new se($e))},ie=function(){b.unbind("initialized",R),b.unbind("open",D),b.unbind("error",J),b.unbind("closed",te)};return b.bind("initialized",R),b.bind("open",D),b.bind("error",J),b.bind("closed",te),b.initialize(),{abort:()=>{f||(ie(),x?x.close():b.close())},forceMinPriority:$e=>{f||this.priority<$e&&(x?x.close():b.close())}}}}function iu(u,s){return Te.defer(function(){s(u)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:k_}=Y;var __=function(u,s,c,f,b,x){var R=k_[c];if(!R)throw new nt(c);var D=(!u.enabledTransports||An(u.enabledTransports,s)!==-1)&&(!u.disabledTransports||An(u.disabledTransports,s)===-1),J;return D?(b=Object.assign({ignoreNullOrigin:u.ignoreNullOrigin},b),J=new b_(s,f,x?x.getAssistant(R):R,b)):J=v_,J},v_={isSupported:function(){return!1},connect:function(u,s){var c=Te.defer(function(){s(new ee)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function y_(u){if(u==null)throw"You must pass an options object";if(u.cluster==null)throw"Options object must provide a cluster";"disableStats"in u&&X.warn("The disableStats option is deprecated in favor of enableStats")}const w_=(u,s)=>{var c="socket_id="+encodeURIComponent(u.socketId);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},x_=u=>{if(typeof Y.getAuthorizers()[u.transport]=="undefined")throw`'${u.transport}' is not a recognized auth transport`;return(s,c)=>{const f=w_(s,u);Y.getAuthorizers()[u.transport](Y,f,u,A.UserAuthentication,c)}},S_=(u,s)=>{var c="socket_id="+encodeURIComponent(u.socketId);c+="&channel_name="+encodeURIComponent(u.channelName);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},T_=u=>{if(typeof Y.getAuthorizers()[u.transport]=="undefined")throw`'${u.transport}' is not a recognized auth transport`;return(s,c)=>{const f=S_(s,u);Y.getAuthorizers()[u.transport](Y,f,u,A.ChannelAuthorization,c)}},E_=(u,s,c)=>{const f={authTransport:s.transport,authEndpoint:s.endpoint,auth:{params:s.params,headers:s.headers}};return(b,x)=>{const R=u.channel(b.channelName);c(R,f).authorize(b.socketId,x)}};function au(u,s){let c={activityTimeout:u.activityTimeout||m.activityTimeout,cluster:u.cluster,httpPath:u.httpPath||m.httpPath,httpPort:u.httpPort||m.httpPort,httpsPort:u.httpsPort||m.httpsPort,pongTimeout:u.pongTimeout||m.pongTimeout,statsHost:u.statsHost||m.stats_host,unavailableTimeout:u.unavailableTimeout||m.unavailableTimeout,wsPath:u.wsPath||m.wsPath,wsPort:u.wsPort||m.wsPort,wssPort:u.wssPort||m.wssPort,enableStats:L_(u),httpHost:A_(u),useTLS:R_(u),wsHost:C_(u),userAuthenticator:I_(u),channelAuthorizer:z_(u,s)};return"disabledTransports"in u&&(c.disabledTransports=u.disabledTransports),"enabledTransports"in u&&(c.enabledTransports=u.enabledTransports),"ignoreNullOrigin"in u&&(c.ignoreNullOrigin=u.ignoreNullOrigin),"timelineParams"in u&&(c.timelineParams=u.timelineParams),"nacl"in u&&(c.nacl=u.nacl),c}function A_(u){return u.httpHost?u.httpHost:u.cluster?`sockjs-${u.cluster}.pusher.com`:m.httpHost}function C_(u){return u.wsHost?u.wsHost:P_(u.cluster)}function P_(u){return`ws-${u}.pusher.com`}function R_(u){return Y.getProtocol()==="https:"?!0:u.forceTLS!==!1}function L_(u){return"enableStats"in u?u.enableStats:"disableStats"in u?!u.disableStats:!1}const cu=u=>"customHandler"in u&&u.customHandler!=null;function I_(u){const s=Object.assign(Object.assign({},m.userAuthentication),u.userAuthentication);return cu(s)?s.customHandler:x_(s)}function $_(u,s){let c;if("channelAuthorization"in u)c=Object.assign(Object.assign({},m.channelAuthorization),u.channelAuthorization);else if(c={transport:u.authTransport||m.authTransport,endpoint:u.authEndpoint||m.authEndpoint},"auth"in u&&("params"in u.auth&&(c.params=u.auth.params),"headers"in u.auth&&(c.headers=u.auth.headers)),"authorizer"in u)return{customHandler:E_(s,c,u.authorizer)};return c}function z_(u,s){const c=$_(u,s);return cu(c)?c.customHandler:T_(c)}class O_ extends Ot{constructor(s){super(function(c,f){X.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=s,this.bindWatchlistInternalEvent()}handleEvent(s){s.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",s=>{var c=s.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(s)})}}function N_(){let u,s;return{promise:new Promise((f,b)=>{u=f,s=b}),resolve:u,reject:s}}const D_=N_;class M_ extends Ot{constructor(s){super(function(c,f){X.debug("No callbacks on user for "+c)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(c,f)=>{if(c){X.warn(`Error during signin: ${c}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:f.auth,user_data:f.user_data})},this.pusher=s,this.pusher.connection.bind("state_change",({previous:c,current:f})=>{c!=="connected"&&f==="connected"&&this._signin(),c==="connected"&&f!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new O_(s),this.pusher.connection.bind("message",c=>{var f=c.event;f==="pusher:signin_success"&&this._onSigninSuccess(c.data),this.serverToUserChannel&&this.serverToUserChannel.name===c.channel&&this.serverToUserChannel.handleEvent(c)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(s){try{this.user_data=JSON.parse(s.user_data)}catch(c){X.error(`Failed parsing user data after signin: ${s.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){X.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const s=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new O(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((c,f)=>{c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0||this.emit(c,f)}),s(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:s,resolve:c}=D_();s.done=!1;const f=()=>{s.done=!0};s.then(f).catch(f),this.signinDonePromise=s,this._signinDoneResolve=c}}class Be{static ready(){Be.isReady=!0;for(var s=0,c=Be.instances.length;s<c;s++)Be.instances[s].connect()}static getClientFeatures(){return Xt(xe({ws:Y.Transports.ws},function(s){return s.isSupported({})}))}constructor(s,c){U_(s),y_(c),this.key=s,this.options=c,this.config=au(this.options,this),this.channels=pn.createChannels(),this.global_emitter=new Ot,this.sessionID=Y.randomInt(1e9),this.timeline=new m_(this.key,this.sessionID,{cluster:this.config.cluster,features:Be.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:ys.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=pn.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+Y.TimelineTransport.name}));var f=b=>Y.getDefaultStrategy(this.config,b,__);this.connection=pn.createConnectionManager(this.key,{getStrategy:f,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",b=>{var x=b.event,R=x.indexOf("pusher_internal:")===0;if(b.channel){var D=this.channel(b.channel);D&&D.handleEvent(b)}R||this.global_emitter.emit(b.event,b.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",b=>{X.warn(b)}),Be.instances.push(this),this.timeline.info({instances:Be.instances.length}),this.user=new M_(this),Be.isReady&&this.connect()}switchCluster(s){const{appKey:c,cluster:f}=s;this.key=c,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=au(this.options,this),this.connection.switchCluster(this.key)}channel(s){return this.channels.find(s)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var s=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new En(6e4,function(){c.send(s)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(s,c,f){return this.global_emitter.bind(s,c,f),this}unbind(s,c,f){return this.global_emitter.unbind(s,c,f),this}bind_global(s){return this.global_emitter.bind_global(s),this}unbind_global(s){return this.global_emitter.unbind_global(s),this}unbind_all(s){return this.global_emitter.unbind_all(),this}subscribeAll(){var s;for(s in this.channels.channels)this.channels.channels.hasOwnProperty(s)&&this.subscribe(s)}subscribe(s){var c=this.channels.add(s,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(s){var c=this.channels.find(s);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(s),c&&c.subscribed&&c.unsubscribe())}send_event(s,c,f){return this.connection.send_event(s,c,f)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}Be.instances=[],Be.isReady=!1,Be.logToConsole=!1,Be.Runtime=Y,Be.ScriptReceivers=Y.ScriptReceivers,Be.DependenciesReceivers=Y.DependenciesReceivers,Be.auth_callbacks=Y.auth_callbacks;const ws=Be;function U_(u){if(u==null)throw"You must pass your app key when you instantiate Pusher."}Y.setup(Be)}},r={};function o(a){var d=r[a];if(d!==void 0)return d.exports;var l=r[a]={exports:{}};return n[a].call(l.exports,l,l.exports,o),l.exports}o.d=(a,d)=>{for(var l in d)o.o(d,l)&&!o.o(a,l)&&Object.defineProperty(a,l,{enumerable:!0,get:d[l]})},o.o=(a,d)=>Object.prototype.hasOwnProperty.call(a,d);var i=o(721);return i})())})(Bs)),Bs.exports}var Jg=Wg();const Yg=Gg(Jg);let wt=null,sr=null;function Vg(e){return z(this,null,function*(){return sr||(sr=z(null,null,function*(){const t=e.backendUrl.replace(/\/+$/,""),n=yield Ro(`${t}/api/settings`,{headers:{Authorization:`Bearer ${e.token}`}});if(!n.ok)throw new Error(`Failed to fetch settings: HTTP ${n.status}`);const r=yield n.json();wt=new Yg(r.pusher.key,{cluster:r.pusher.cluster||"local",forceTLS:!0,wsHost:r.pusher.wsHost||void 0,wsPort:r.pusher.wssPort,wssPort:r.pusher.wssPort,enabledTransports:r.pusher.wsHost?["ws"]:void 0,channelAuthorization:{customHandler:({socketId:o,channelName:i},a)=>{Ro(`${t}/api/pusher/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({socket_id:o,channel_name:i})}).then(d=>d.json()).then(d=>a(null,d)).catch(d=>a(d instanceof Error?d:new Error(String(d)),null))}}})}),sr.catch(()=>{sr=null}),sr)})}function Xg(e){if(!e||!wt)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return wt.connection.bind("state_change",n),()=>wt==null?void 0:wt.connection.unbind("state_change",n)}function Kg(e,t,n){return z(this,null,function*(){if(yield Vg(e),!wt)return()=>{};const r=wt.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(_o.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(_o.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(_o.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(_o.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=Xg(n.onReconnect);return()=>{r.unbind_all(),wt==null||wt.unsubscribe(`private-task-${t}`),o==null||o()}})}const Gs="ap-sdk-active-automation";function Qg(){try{const e=sessionStorage.getItem(Gs);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.taskId&&(t!=null&&t.backendUrl)&&(t!=null&&t.title)?t:null}catch(e){return null}}function yc(e){try{sessionStorage.setItem(Gs,JSON.stringify(e))}catch(t){}}function wc(){try{sessionStorage.removeItem(Gs)}catch(e){}}function em(e){return z(this,null,function*(){var i;try{(i=e.focus)==null||i.call(e)}catch(a){}e.scrollIntoView({block:"center",inline:"center",behavior:"instant"});let t=e.getBoundingClientRect();t.width===0&&t.height===0&&(yield tm(),t=e.getBoundingClientRect());const n=t.left+t.width/2,r=t.top+t.height/2,o={bubbles:!0,cancelable:!0,clientX:n,clientY:r};typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerdown",o)),e.dispatchEvent(new MouseEvent("mousedown",o)),typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerup",o)),e.dispatchEvent(new MouseEvent("mouseup",o)),e.click()})}function tm(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const Ws="shared",xc="ap-sdk-panel-size:",Sc=280,Tc=200;function nm(e){try{const t=sessionStorage.getItem(xc+e);if(!t)return null;const n=JSON.parse(t);return typeof(n==null?void 0:n.width)=="number"&&typeof(n==null?void 0:n.height)=="number"?n:null}catch(t){return null}}function rm(e,t){try{sessionStorage.setItem(xc+e,JSON.stringify(t))}catch(n){}}function Io(e,t,n){return Math.min(Math.max(e,t),n)}function Ec(){return window.innerWidth-32}function Ac(){return window.innerHeight-64}function Js(e,t){const n=nm(t);n&&(e.style.width=`${Io(n.width,Sc,Ec())}px`,e.style.height=`${Io(n.height,Tc,Ac())}px`);const r=document.createElement("div");r.className="ap-sdk-resize-handle",r.setAttribute("data-ap-sdk","1"),e.appendChild(r);let o=!1,i=0,a=0,d=0,l=0,p=0,h=0;const g=y=>{o&&(p=Io(d+(y.clientX-i),Sc,Ec()),h=Io(l+(y.clientY-a),Tc,Ac()),e.style.width=`${p}px`,e.style.height=`${h}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",m),rm(t,{width:p,height:h}))},k=y=>{const S=y.target;if(!(S===r||r.contains(S)))return;y.preventDefault(),y.stopPropagation(),o=!0,i=y.clientX,a=y.clientY;const $=e.getBoundingClientRect();d=$.width,l=$.height,p=d,h=l,document.addEventListener("pointermove",g),document.addEventListener("pointerup",m)};return window.addEventListener("pointerdown",k,{capture:!0}),()=>{window.removeEventListener("pointerdown",k,{capture:!0}),document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",m)}}const Ir="shared",Cc="ap-sdk-panel-pos:";function om(e){try{const t=sessionStorage.getItem(Cc+e);if(!t)return null;const n=JSON.parse(t);return typeof(n==null?void 0:n.left)=="number"&&typeof(n==null?void 0:n.top)=="number"?n:null}catch(t){return null}}function sm(e,t){try{sessionStorage.setItem(Cc+e,JSON.stringify(t))}catch(n){}}function Pc(e,t,n){return Math.min(Math.max(e,t),n)}function $r(e,t){const n=(y,S)=>{const $=Math.max(0,window.innerWidth-e.offsetWidth),E=Math.max(0,window.innerHeight-e.offsetHeight);e.style.left=`${Pc(y,0,$)}px`,e.style.top=`${Pc(S,0,E)}px`,e.style.right="auto",e.style.transform="none"},r=om(t);r&&n(r.left,r.top);let o=!1,i=0,a=0,d=0,l=0,p=0,h=0;const g=y=>{o&&(p=d+(y.clientX-i),h=l+(y.clientY-a),n(p,h))},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",m),sm(t,{left:p,top:h}))},k=y=>{const S=y.target;if(!(S===e||e.contains(S))||!S.closest(".ap-sdk-panel__header")||S.closest("button, a, input, select, textarea"))return;y.preventDefault(),o=!0,i=y.clientX,a=y.clientY;const $=e.getBoundingClientRect();d=$.left,l=$.top,p=d,h=l,document.addEventListener("pointermove",g),document.addEventListener("pointerup",m)};return window.addEventListener("pointerdown",k,{capture:!0}),()=>{window.removeEventListener("pointerdown",k,{capture:!0}),document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",m)}}function Ys(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var $n=Ys();function Rc(e){$n=e}var zn={exec:()=>null};function ir(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),o=t[r];return o||(o=e(r),t[r]=o),o}}function K(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(o,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(Ge.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var im=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch(t){return!1}})(),Ge={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:ir(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:ir(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:ir(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:ir(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:ir(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:ir(e=>new RegExp(`^ {0,${e}}>`))},am=/^(?:[ \t]*(?:\n|$))+/,cm=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,lm=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,zr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,um=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Vs=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Lc=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ic=K(Lc).replace(/bull/g,Vs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),dm=K(Lc).replace(/bull/g,Vs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Xs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,pm=/^[^\n]+/,Ks=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,hm=K(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ks).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),fm=K(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Vs).getRegex(),$o="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Qs=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,gm=K("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Qs).replace("tag",$o).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),$c=e=>K(Xs).replace("hr",zr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list",e).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$o).getRegex(),mm=$c(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),bm=$c(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),km=K(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",bm).getRegex(),ei={blockquote:km,code:cm,def:hm,fences:lm,heading:um,hr:zr,html:gm,lheading:Ic,list:fm,newline:am,paragraph:mm,table:zn,text:pm},zc=K("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",zr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$o).getRegex(),_m=M(v({},ei),{lheading:dm,table:zc,paragraph:K(Xs).replace("hr",zr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",zc).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$o).getRegex()}),vm=M(v({},ei),{html:K(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Qs).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:zn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:K(Xs).replace("hr",zr).replace("heading",` *#{1,6} *[^
1579
+ ]`).replace("lheading",Ic).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),ym=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,wm=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Oc=/^( {2,}|\\)\n(?!\s*$)/,xm=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,en=/[\p{P}\p{S}]/u,ar=/[\s\p{P}\p{S}]/u,Or=/[^\s\p{P}\p{S}]/u,Sm=K(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ar).getRegex(),Tm=/[\p{Pi}\p{Ps}"']/u,Nc=/(?!~)[\p{P}\p{S}]/u,Em=/(?!~)[\s\p{P}\p{S}]/u,Am=/(?:[^\s\p{P}\p{S}]|~)/u,Cm=K(/link|precode-code|html/,"g").replace("link",new RegExp("\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)")).replace("precode-",im?"(?<!`)()":"(^^|[^`])").replace("code",new RegExp("(?<b>`+)[^`]+\\k<b>(?!`)")).replace("html",/<(?! )[^<>]*?>/).getRegex(),Dc=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Pm=K(Dc,"u").replace(/punct/g,en).getRegex(),Rm=K(Dc,"u").replace(/punct/g,Nc).getRegex(),Lm=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Im=K(Lm,"u").replace(/openQuote/g,Tm).replace(/punct/g,en).getRegex(),Mc="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",$m=K(Mc,"gu").replace(/notPunctSpace/g,Or).replace(/punctSpace/g,ar).replace(/punct/g,en).getRegex(),zm=K(Mc,"gu").replace(/notPunctSpace/g,Am).replace(/punctSpace/g,Em).replace(/punct/g,Nc).getRegex(),Om="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Nm=K(Om,"gu").replace(/notPunctSpace/g,Or).replace(/punctSpace/g,ar).replace(/punct/g,en).getRegex(),Dm=K("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Or).replace(/punctSpace/g,ar).replace(/punct/g,en).getRegex(),Mm="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Um=K(Mm,"gu").replace(/notPunctSpace/g,Or).replace(/punctSpace/g,ar).replace(/punct/g,en).getRegex(),jm=K(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,en).getRegex(),Zm="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",qm=K(Zm,"gu").replace(/notPunctSpace/g,Or).replace(/punctSpace/g,ar).replace(/punct/g,en).getRegex(),Hm=K(/\\(punct)/,"gu").replace(/punct/g,en).getRegex(),Fm=K(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Bm=K(Qs).replace("(?:-->|$)","-->").getRegex(),Gm=K("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Bm).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),zo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Wm=K(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",zo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Uc=K(/^!?\[(label)\]\[(ref)\]/).replace("label",zo).replace("ref",Ks).getRegex(),jc=K(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ks).getRegex(),Jm=K("reflink|nolink(?!\\()","g").replace("reflink",Uc).replace("nolink",jc).getRegex(),Zc=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ti={_backpedal:zn,anyPunctuation:Hm,autolink:Fm,blockSkip:Cm,br:Oc,code:wm,del:zn,delLDelim:zn,delRDelim:zn,emStrongLDelim:Pm,emStrongRDelimAst:$m,emStrongRDelimUnd:Dm,escape:ym,link:Wm,nolink:jc,punctuation:Sm,reflink:Uc,reflinkSearch:Jm,tag:Gm,text:xm,url:zn},Ym=M(v({},ti),{emStrongLDelim:Im,emStrongRDelimAst:Nm,emStrongRDelimUnd:Um,link:K(/^!?\[(label)\]\((.*?)\)/).replace("label",zo).getRegex(),reflink:K(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",zo).getRegex()}),ni=M(v({},ti),{emStrongRDelimAst:zm,emStrongLDelim:Rm,delLDelim:jm,delRDelim:qm,url:K(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Zc).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:K(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Zc).getRegex()}),Vm=M(v({},ni),{br:K(Oc).replace("{2,}","*").getRegex(),text:K(ni.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),Oo={normal:ei,gfm:_m,pedantic:vm},Nr={normal:ti,gfm:ni,breaks:Vm,pedantic:Ym},Xm={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},qc=e=>Xm[e];function qt(e,t){if(t){if(Ge.escapeTest.test(e))return e.replace(Ge.escapeReplace,qc)}else if(Ge.escapeTestNoEncode.test(e))return e.replace(Ge.escapeReplaceNoEncode,qc);return e}function Hc(e){try{e=encodeURI(e).replace(Ge.percentDecode,"%")}catch(t){return null}return e}function Fc(e,t){var i;let n=e.replace(Ge.findPipe,(a,d,l)=>{let p=!1,h=d;for(;--h>=0&&l[h]==="\\";)p=!p;return p?"|":" |"}),r=n.split(Ge.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(Ge.slashPipe,"|");return r}function _n(e,t,n){let r=e.length;if(r===0)return"";let o=0;for(;o<r&&e.charAt(r-o-1)===t;)o++;return e.slice(0,r-o)}function Bc(e){let t=e.split(`
1580
+ `),n=t.length-1;for(;n>=0&&Ge.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
1581
+ `)}function Km(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function Qm(e,t=0){let n=t,r="";for(let o of e)if(o===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=o,n++;return r}function Gc(e,t,n,r,o){let i=t.href,a=t.title||null,d=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:d,tokens:r.inlineTokens(d)};return r.state.inLink=!1,l}function eb(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
1522
1582
  `).map(i=>{let a=i.match(n.other.beginningSpace);if(a===null)return i;let[d]=a;return d.length>=o.length?i.slice(o.length):i}).join(`
1523
- `)}var wo=class{constructor(e){le(this,"options");le(this,"rules");le(this,"lexer");this.options=e||An}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=this.options.pedantic?t[0]:xc(t[0]),r=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:r}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=xm(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=pn(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:pn(t[0],`
1524
- `),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:pn(t[0],`
1525
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=pn(t[0],`
1583
+ `)}var No=class{constructor(e){pe(this,"options");pe(this,"rules");pe(this,"lexer");this.options=e||$n}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=this.options.pedantic?t[0]:Bc(t[0]),r=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:r}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=eb(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=_n(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:_n(t[0],`
1584
+ `),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:_n(t[0],`
1585
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=_n(t[0],`
1526
1586
  `).split(`
1527
- `),r="",o="",i=[];for(;n.length>0;){let a=!1,d=[],u;for(u=0;u<n.length;u++)if(this.rules.other.blockquoteStart.test(n[u]))d.push(n[u]),a=!0;else if(!a)d.push(n[u]);else break;n=n.slice(u);let p=d.join(`
1587
+ `),r="",o="",i=[];for(;n.length>0;){let a=!1,d=[],l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))d.push(n[l]),a=!0;else if(!a)d.push(n[l]);else break;n=n.slice(l);let p=d.join(`
1528
1588
  `),h=p.replace(this.rules.other.blockquoteSetextReplace,`
1529
1589
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
1530
1590
  ${p}`:p,o=o?`${o}
1531
- ${h}`:h;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,i,!0),this.lexer.state.top=g,n.length===0)break;let m=i.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){let k=m,w=n.join(`
1532
- `),v=k.raw+`
1533
- `+w.replace(this.rules.other.blockquoteSetextReplace2,""),Z=this.blockquote(v);i[i.length-1]=Z,r=`${r}
1534
- ${w}`,o=o.substring(0,o.length-k.text.length)+Z.text;break}else if((m==null?void 0:m.type)==="list"){let k=m,w=k.raw+`
1591
+ ${h}`:h;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,i,!0),this.lexer.state.top=g,n.length===0)break;let m=i.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){let k=m,y=n.join(`
1592
+ `),S=k.raw+`
1593
+ `+y.replace(this.rules.other.blockquoteSetextReplace2,""),$=this.blockquote(S);i[i.length-1]=$,r=`${r}
1594
+ ${y}`,o=o.substring(0,o.length-k.text.length)+$.text;break}else if((m==null?void 0:m.type)==="list"){let k=m,y=k.raw+`
1535
1595
  `+n.join(`
1536
- `),v=this.list(w);i[i.length-1]=v,r=r.substring(0,r.length-m.raw.length)+v.raw,o=o.substring(0,o.length-k.raw.length)+v.raw,n=w.substring(i.at(-1).raw.length).split(`
1537
- `);continue}}return{type:"blockquote",raw:r,tokens:i,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,o={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let i=this.rules.other.listItemRegex(n),a=!1;for(;e;){let u=!1,p="",h="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let g=wm(t[2].split(`
1596
+ `),S=this.list(y);i[i.length-1]=S,r=r.substring(0,r.length-m.raw.length)+S.raw,o=o.substring(0,o.length-k.raw.length)+S.raw,n=y.substring(i.at(-1).raw.length).split(`
1597
+ `);continue}}return{type:"blockquote",raw:r,tokens:i,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,o={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let i=this.rules.other.listItemRegex(n),a=!1;for(;e;){let l=!1,p="",h="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let g=Qm(t[2].split(`
1538
1598
  `,1)[0],t[1].length),m=e.split(`
1539
- `,1)[0],k=!g.trim(),w=0;if(this.options.pedantic?(w=2,h=g.trimStart()):k?w=t[1].length+1:(w=g.search(this.rules.other.nonSpaceChar),w=w>4?1:w,h=g.slice(w),w+=t[1].length),k&&this.rules.other.blankLine.test(m)&&(p+=m+`
1540
- `,e=e.substring(m.length+1),u=!0),!u){let v=this.rules.other.nextBulletRegex(w),Z=this.rules.other.hrRegex(w),K=this.rules.other.fencesBeginRegex(w),U=this.rules.other.headingBeginRegex(w),E=this.rules.other.htmlBeginRegex(w),T=this.rules.other.blockquoteBeginRegex(w);for(;e;){let A=e.split(`
1541
- `,1)[0],N;if(m=A,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),N=m):N=m.replace(this.rules.other.tabCharGlobal," "),K.test(m)||U.test(m)||E.test(m)||T.test(m)||v.test(m)||Z.test(m))break;if(N.search(this.rules.other.nonSpaceChar)>=w||!m.trim())h+=`
1542
- `+N.slice(w);else{if(k||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||K.test(g)||U.test(g)||Z.test(g))break;h+=`
1543
- `+m}k=!m.trim(),p+=A+`
1544
- `,e=e.substring(A.length+1),g=N.slice(w)}}o.loose||(a?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(a=!0)),o.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),o.raw+=p}let d=o.items.at(-1);if(d)d.raw=d.raw.trimEnd(),d.text=d.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let u of o.items){this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]);let p=u.tokens[0];if(u.task&&((p==null?void 0:p.type)==="text"||(p==null?void 0:p.type)==="paragraph")){u.text=u.text.replace(this.rules.other.listReplaceTask,""),p.raw=p.raw.replace(this.rules.other.listReplaceTask,""),p.text=p.text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}let h=this.rules.other.listTaskCheckbox.exec(u.raw);if(h){let g={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};u.checked=g.checked,o.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=g.raw+u.tokens[0].raw,u.tokens[0].text=g.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(g)):u.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):u.tokens.unshift(g)}}else u.task&&(u.task=!1);if(!o.loose){let h=u.tokens.filter(m=>m.type==="space"),g=h.length>0&&h.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=g}}if(o.loose)for(let u of o.items){u.loose=!0;for(let p of u.tokens)p.type==="text"&&(p.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=xc(t[0]);return{type:"html",block:!0,raw:n,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:n}}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:pn(t[0],`
1545
- `),href:r,title:o}}}table(e){var a;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=wc(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
1546
- `):[],i={type:"table",raw:pn(t[0],`
1547
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let d of r)this.rules.other.tableAlignRight.test(d)?i.align.push("right"):this.rules.other.tableAlignCenter.test(d)?i.align.push("center"):this.rules.other.tableAlignLeft.test(d)?i.align.push("left"):i.align.push(null);for(let d=0;d<n.length;d++)i.header.push({text:n[d],tokens:this.lexer.inline(n[d]),header:!0,align:i.align[d]});for(let d of o)i.rows.push(wc(d,i.header.length).map((u,p)=>({text:u,tokens:this.lexer.inline(u),header:!1,align:i.align[p]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:pn(t[0],`
1599
+ `,1)[0],k=!g.trim(),y=0;if(this.options.pedantic?(y=2,h=g.trimStart()):k?y=t[1].length+1:(y=g.search(this.rules.other.nonSpaceChar),y=y>4?1:y,h=g.slice(y),y+=t[1].length),k&&this.rules.other.blankLine.test(m)&&(p+=m+`
1600
+ `,e=e.substring(m.length+1),l=!0),!l){let S=this.rules.other.nextBulletRegex(y),$=this.rules.other.hrRegex(y),E=this.rules.other.fencesBeginRegex(y),j=this.rules.other.headingBeginRegex(y),A=this.rules.other.htmlBeginRegex(y),T=this.rules.other.blockquoteBeginRegex(y);for(;e;){let L=e.split(`
1601
+ `,1)[0],q;if(m=L,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),q=m):q=m.replace(this.rules.other.tabCharGlobal," "),E.test(m)||j.test(m)||A.test(m)||T.test(m)||S.test(m)||$.test(m))break;if(q.search(this.rules.other.nonSpaceChar)>=y||!m.trim())h+=`
1602
+ `+q.slice(y);else{if(k||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||E.test(g)||j.test(g)||$.test(g))break;h+=`
1603
+ `+m}k=!m.trim(),p+=L+`
1604
+ `,e=e.substring(L.length+1),g=q.slice(y)}}o.loose||(a?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(a=!0)),o.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),o.raw+=p}let d=o.items.at(-1);if(d)d.raw=d.raw.trimEnd(),d.text=d.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let l of o.items){this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]);let p=l.tokens[0];if(l.task&&((p==null?void 0:p.type)==="text"||(p==null?void 0:p.type)==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),p.raw=p.raw.replace(this.rules.other.listReplaceTask,""),p.text=p.text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}let h=this.rules.other.listTaskCheckbox.exec(l.raw);if(h){let g={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};l.checked=g.checked,o.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=g.raw+l.tokens[0].raw,l.tokens[0].text=g.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(g)):l.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):l.tokens.unshift(g)}}else l.task&&(l.task=!1);if(!o.loose){let h=l.tokens.filter(m=>m.type==="space"),g=h.length>0&&h.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=g}}if(o.loose)for(let l of o.items){l.loose=!0;for(let p of l.tokens)p.type==="text"&&(p.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=Bc(t[0]);return{type:"html",block:!0,raw:n,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:n}}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:_n(t[0],`
1605
+ `),href:r,title:o}}}table(e){var a;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Fc(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
1606
+ `):[],i={type:"table",raw:_n(t[0],`
1607
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let d of r)this.rules.other.tableAlignRight.test(d)?i.align.push("right"):this.rules.other.tableAlignCenter.test(d)?i.align.push("center"):this.rules.other.tableAlignLeft.test(d)?i.align.push("left"):i.align.push(null);for(let d=0;d<n.length;d++)i.header.push({text:n[d],tokens:this.lexer.inline(n[d]),header:!0,align:i.align[d]});for(let d of o)i.rows.push(Fc(d,i.header.length).map((l,p)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[p]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:_n(t[0],`
1548
1608
  `),depth:t[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
1549
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=pn(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=ym(t[2],"()");if(i===-2)return;if(i>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],o=i[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Sc(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[r.toLowerCase()];if(!o){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return Sc(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,d=o,u=0,p=r[0][0],h=n===p,g=p==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(g.lastIndex=0,t=t.slice(-1*e.length+o);(r=g.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){d+=a;continue}else if(r[5]||r[6]){if(o%3&&!((o+a)%3)){u+=a;continue}if(h)break}if(d-=a,d>0)continue;a=Math.min(a,a+d+u);let m=[...r[0]][0].length,k=e.slice(0,o+r.index+m+a);if(Math.min(o,a)%2){let v=k.slice(1,-1);return{type:"em",raw:k,text:v,tokens:this.lexer.inlineTokens(v)}}let w=k.slice(2,-2);return{type:"strong",raw:k,text:w,tokens:this.lexer.inlineTokens(w)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,d=o,u=this.rules.inline.delRDelim;for(u.lastIndex=0,t=t.slice(-1*e.length+o);(r=u.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==o))continue;if(r[3]||r[4]){d+=a;continue}if(d-=a,d>0)continue;a=Math.min(a,a+d);let p=[...r[0]][0].length,h=e.slice(0,o+r.index+p+a),g=h.slice(o,-o);return{type:"del",raw:h,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,r;let t;if(t=this.rules.inline.url.exec(e)){let o,i;if(t[2]==="@")o=t[0],i="mailto:"+o;else{let a;do a=t[0],t[0]=(r=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?r:"";while(a!==t[0]);o=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:o,href:i,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},St=class Ai{constructor(t){le(this,"tokens");le(this,"options");le(this,"state");le(this,"inlineQueue");le(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||An,this.options.tokenizer=this.options.tokenizer||new wo,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Je,block:yo.normal,inline:Er.normal};this.options.pedantic?(n.block=yo.pedantic,n.inline=Er.pedantic):this.options.gfm&&(n.block=yo.gfm,this.options.breaks?n.inline=Er.breaks:n.inline=Er.gfm),this.tokenizer.rules=n}static get rules(){return{block:yo,inline:Er}}static lex(t,n){return new Ai(n).lex(t)}static lexInline(t,n){return new Ai(n).inlineTokens(t)}lex(t){t=t.replace(Je.carriageReturn,`
1550
- `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var i,a,d;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(Je.tabCharGlobal," ").replace(Je.spaceLine,""));let o=1/0;for(;t;){if(t.length<o)o=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let u;if((a=(i=this.options.extensions)==null?void 0:i.block)!=null&&a.some(h=>(u=h.call({lexer:this},t,n))?(t=t.substring(u.raw.length),n.push(u),!0):!1))continue;if(u=this.tokenizer.space(t)){t=t.substring(u.raw.length);let h=n.at(-1);u.raw.length===1&&h!==void 0?h.raw+=`
1551
- `:n.push(u);continue}if(u=this.tokenizer.code(t)){t=t.substring(u.raw.length);let h=n.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
1609
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=_n(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=Km(t[2],"()");if(i===-2)return;if(i>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],o=i[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Gc(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[r.toLowerCase()];if(!o){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return Gc(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,d=o,l=0,p=r[0][0],h=n===p,g=p==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(g.lastIndex=0,t=t.slice(-1*e.length+o);(r=g.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){d+=a;continue}else if(r[5]||r[6]){if(o%3&&!((o+a)%3)){l+=a;continue}if(h)break}if(d-=a,d>0)continue;a=Math.min(a,a+d+l);let m=[...r[0]][0].length,k=e.slice(0,o+r.index+m+a);if(Math.min(o,a)%2){let S=k.slice(1,-1);return{type:"em",raw:k,text:S,tokens:this.lexer.inlineTokens(S)}}let y=k.slice(2,-2);return{type:"strong",raw:k,text:y,tokens:this.lexer.inlineTokens(y)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,d=o,l=this.rules.inline.delRDelim;for(l.lastIndex=0,t=t.slice(-1*e.length+o);(r=l.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==o))continue;if(r[3]||r[4]){d+=a;continue}if(d-=a,d>0)continue;a=Math.min(a,a+d);let p=[...r[0]][0].length,h=e.slice(0,o+r.index+p+a),g=h.slice(o,-o);return{type:"del",raw:h,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,r;let t;if(t=this.rules.inline.url.exec(e)){let o,i;if(t[2]==="@")o=t[0],i="mailto:"+o;else{let a;do a=t[0],t[0]=(r=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?r:"";while(a!==t[0]);o=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:o,href:i,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},xt=class Bi{constructor(t){pe(this,"tokens");pe(this,"options");pe(this,"state");pe(this,"inlineQueue");pe(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||$n,this.options.tokenizer=this.options.tokenizer||new No,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Ge,block:Oo.normal,inline:Nr.normal};this.options.pedantic?(n.block=Oo.pedantic,n.inline=Nr.pedantic):this.options.gfm&&(n.block=Oo.gfm,this.options.breaks?n.inline=Nr.breaks:n.inline=Nr.gfm),this.tokenizer.rules=n}static get rules(){return{block:Oo,inline:Nr}}static lex(t,n){return new Bi(n).lex(t)}static lexInline(t,n){return new Bi(n).inlineTokens(t)}lex(t){t=t.replace(Ge.carriageReturn,`
1610
+ `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var i,a,d;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(Ge.tabCharGlobal," ").replace(Ge.spaceLine,""));let o=1/0;for(;t;){if(t.length<o)o=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let l;if((a=(i=this.options.extensions)==null?void 0:i.block)!=null&&a.some(h=>(l=h.call({lexer:this},t,n))?(t=t.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);let h=n.at(-1);l.raw.length===1&&h!==void 0?h.raw+=`
1611
+ `:n.push(l);continue}if(l=this.tokenizer.code(t)){t=t.substring(l.raw.length);let h=n.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
1552
1612
  `)?"":`
1553
- `)+u.raw,h.text+=`
1554
- `+u.text,this.inlineQueue.at(-1).src=h.text):n.push(u);continue}if(u=this.tokenizer.fences(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.heading(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.hr(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.blockquote(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.list(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.html(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.def(t)){t=t.substring(u.raw.length);let h=n.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
1613
+ `)+l.raw,h.text+=`
1614
+ `+l.text,this.inlineQueue.at(-1).src=h.text):n.push(l);continue}if(l=this.tokenizer.fences(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.heading(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.hr(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.blockquote(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.list(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.html(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.def(t)){t=t.substring(l.raw.length);let h=n.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
1555
1615
  `)?"":`
1556
- `)+u.raw,h.text+=`
1557
- `+u.raw,this.inlineQueue.at(-1).src=h.text):this.tokens.links[u.tag]||(this.tokens.links[u.tag]={href:u.href,title:u.title},n.push(u));continue}if(u=this.tokenizer.table(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.lheading(t)){t=t.substring(u.raw.length),n.push(u);continue}let p=t;if((d=this.options.extensions)!=null&&d.startBlock){let h=1/0,g=t.slice(1),m;this.options.extensions.startBlock.forEach(k=>{m=k.call({lexer:this},g),typeof m=="number"&&m>=0&&(h=Math.min(h,m))}),h<1/0&&h>=0&&(p=t.substring(0,h+1))}if(this.state.top&&(u=this.tokenizer.paragraph(p))){let h=n.at(-1);r&&(h==null?void 0:h.type)==="paragraph"?(h.raw+=(h.raw.endsWith(`
1616
+ `)+l.raw,h.text+=`
1617
+ `+l.raw,this.inlineQueue.at(-1).src=h.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title},n.push(l));continue}if(l=this.tokenizer.table(t)){t=t.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.lheading(t)){t=t.substring(l.raw.length),n.push(l);continue}let p=t;if((d=this.options.extensions)!=null&&d.startBlock){let h=1/0,g=t.slice(1),m;this.options.extensions.startBlock.forEach(k=>{m=k.call({lexer:this},g),typeof m=="number"&&m>=0&&(h=Math.min(h,m))}),h<1/0&&h>=0&&(p=t.substring(0,h+1))}if(this.state.top&&(l=this.tokenizer.paragraph(p))){let h=n.at(-1);r&&(h==null?void 0:h.type)==="paragraph"?(h.raw+=(h.raw.endsWith(`
1558
1618
  `)?"":`
1559
- `)+u.raw,h.text+=`
1560
- `+u.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(u),r=p.length!==t.length,t=t.substring(u.raw.length);continue}if(u=this.tokenizer.text(t)){t=t.substring(u.raw.length);let h=n.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
1619
+ `)+l.raw,h.text+=`
1620
+ `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(l),r=p.length!==t.length,t=t.substring(l.raw.length);continue}if(l=this.tokenizer.text(t)){t=t.substring(l.raw.length);let h=n.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
1561
1621
  `)?"":`
1562
- `)+u.raw,h.text+=`
1563
- `+u.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(u);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var d,u,p,h,g,m;this.tokenizer.lexer=this;let r=t;if(this.tokens.links){let k=Object.keys(this.tokens.links);k.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,w=>k.includes(w.slice(w.lastIndexOf("[")+1,-1))?"["+"a".repeat(w.length-2)+"]":w))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(k,w,v)=>{let Z=v?v.length:0;return k.slice(0,Z)+"["+"a".repeat(k.length-Z-2)+"]"}),r=(p=(u=(d=this.options.hooks)==null?void 0:d.emStrongMask)==null?void 0:u.call({lexer:this},r))!=null?p:r;let o=!1,i="",a=1/0;for(;t;){if(t.length<a)a=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}o||(i=""),o=!1;let k;if((g=(h=this.options.extensions)==null?void 0:h.inline)!=null&&g.some(v=>(k=v.call({lexer:this},t,n))?(t=t.substring(k.raw.length),n.push(k),!0):!1))continue;if(k=this.tokenizer.escape(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.tag(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.link(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(k.raw.length);let v=n.at(-1);k.type==="text"&&(v==null?void 0:v.type)==="text"?(v.raw+=k.raw,v.text+=k.text):n.push(k);continue}if(k=this.tokenizer.emStrong(t,r,i)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.codespan(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.br(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.del(t,r,i)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.autolink(t)){t=t.substring(k.raw.length),n.push(k);continue}if(!this.state.inLink&&(k=this.tokenizer.url(t))){t=t.substring(k.raw.length),n.push(k);continue}let w=t;if((m=this.options.extensions)!=null&&m.startInline){let v=1/0,Z=t.slice(1),K;this.options.extensions.startInline.forEach(U=>{K=U.call({lexer:this},Z),typeof K=="number"&&K>=0&&(v=Math.min(v,K))}),v<1/0&&v>=0&&(w=t.substring(0,v+1))}if(k=this.tokenizer.inlineText(w)){t=t.substring(k.raw.length),k.raw.slice(-1)!=="_"&&(i=k.raw.slice(-1)),o=!0;let v=n.at(-1);(v==null?void 0:v.type)==="text"?(v.raw+=k.raw,v.text+=k.text):n.push(k);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return n}infiniteLoopError(t){let n="Infinite loop on byte: "+t;if(this.options.silent)console.error(n);else throw new Error(n)}},xo=class{constructor(e){le(this,"options");le(this,"parser");this.options=e||An}space(e){return""}code({text:e,lang:t,escaped:n}){var i;let r=(i=(t||"").match(Je.notSpaceStart))==null?void 0:i[0],o=e.replace(Je.endingNewline,"")+`
1564
- `;return r?'<pre><code class="language-'+Mt(r)+'">'+(n?o:Mt(o,!0))+`</code></pre>
1565
- `:"<pre><code>"+(n?o:Mt(o,!0))+`</code></pre>
1622
+ `)+l.raw,h.text+=`
1623
+ `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(l);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var d,l,p,h,g,m;this.tokenizer.lexer=this;let r=t;if(this.tokens.links){let k=Object.keys(this.tokens.links);k.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,y=>k.includes(y.slice(y.lastIndexOf("[")+1,-1))?"["+"a".repeat(y.length-2)+"]":y))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(k,y,S)=>{let $=S?S.length:0;return k.slice(0,$)+"["+"a".repeat(k.length-$-2)+"]"}),r=(p=(l=(d=this.options.hooks)==null?void 0:d.emStrongMask)==null?void 0:l.call({lexer:this},r))!=null?p:r;let o=!1,i="",a=1/0;for(;t;){if(t.length<a)a=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}o||(i=""),o=!1;let k;if((g=(h=this.options.extensions)==null?void 0:h.inline)!=null&&g.some(S=>(k=S.call({lexer:this},t,n))?(t=t.substring(k.raw.length),n.push(k),!0):!1))continue;if(k=this.tokenizer.escape(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.tag(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.link(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(k.raw.length);let S=n.at(-1);k.type==="text"&&(S==null?void 0:S.type)==="text"?(S.raw+=k.raw,S.text+=k.text):n.push(k);continue}if(k=this.tokenizer.emStrong(t,r,i)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.codespan(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.br(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.del(t,r,i)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.autolink(t)){t=t.substring(k.raw.length),n.push(k);continue}if(!this.state.inLink&&(k=this.tokenizer.url(t))){t=t.substring(k.raw.length),n.push(k);continue}let y=t;if((m=this.options.extensions)!=null&&m.startInline){let S=1/0,$=t.slice(1),E;this.options.extensions.startInline.forEach(j=>{E=j.call({lexer:this},$),typeof E=="number"&&E>=0&&(S=Math.min(S,E))}),S<1/0&&S>=0&&(y=t.substring(0,S+1))}if(k=this.tokenizer.inlineText(y)){t=t.substring(k.raw.length),k.raw.slice(-1)!=="_"&&(i=k.raw.slice(-1)),o=!0;let S=n.at(-1);(S==null?void 0:S.type)==="text"?(S.raw+=k.raw,S.text+=k.text):n.push(k);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return n}infiniteLoopError(t){let n="Infinite loop on byte: "+t;if(this.options.silent)console.error(n);else throw new Error(n)}},Do=class{constructor(e){pe(this,"options");pe(this,"parser");this.options=e||$n}space(e){return""}code({text:e,lang:t,escaped:n}){var i;let r=(i=(t||"").match(Ge.notSpaceStart))==null?void 0:i[0],o=e.replace(Ge.endingNewline,"")+`
1624
+ `;return r?'<pre><code class="language-'+qt(r)+'">'+(n?o:qt(o,!0))+`</code></pre>
1625
+ `:"<pre><code>"+(n?o:qt(o,!0))+`</code></pre>
1566
1626
  `}blockquote({tokens:e}){return`<blockquote>
1567
1627
  ${this.parser.parse(e)}</blockquote>
1568
1628
  `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
@@ -1578,9 +1638,9 @@ ${this.parser.parse(e)}</blockquote>
1578
1638
  `}tablerow({text:e}){return`<tr>
1579
1639
  ${e}</tr>
1580
1640
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
1581
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Mt(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),o=yc(e);if(o===null)return r;e=o;let i='<a href="'+e+'"';return t&&(i+=' title="'+Mt(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let o=yc(e);if(o===null)return Mt(n);e=o;let i=`<img src="${e}" alt="${Mt(n)}"`;return t&&(i+=` title="${Mt(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Mt(e.text)}},qs=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Tt=class Ci{constructor(t){le(this,"options");le(this,"renderer");le(this,"textRenderer");this.options=t||An,this.options.renderer=this.options.renderer||new xo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new qs}static parse(t,n){return new Ci(n).parse(t)}static parseInline(t,n){return new Ci(n).parseInline(t)}parse(t){var r,o;this.renderer.parser=this;let n="";for(let i=0;i<t.length;i++){let a=t[i];if((o=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&o[a.type]){let u=a,p=this.options.extensions.renderers[u.type].call({parser:this},u);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(u.type)){n+=p||"";continue}}let d=a;switch(d.type){case"space":{n+=this.renderer.space(d);break}case"hr":{n+=this.renderer.hr(d);break}case"heading":{n+=this.renderer.heading(d);break}case"code":{n+=this.renderer.code(d);break}case"table":{n+=this.renderer.table(d);break}case"blockquote":{n+=this.renderer.blockquote(d);break}case"list":{n+=this.renderer.list(d);break}case"checkbox":{n+=this.renderer.checkbox(d);break}case"html":{n+=this.renderer.html(d);break}case"def":{n+=this.renderer.def(d);break}case"paragraph":{n+=this.renderer.paragraph(d);break}case"text":{n+=this.renderer.text(d);break}default:{let u='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return n}parseInline(t,n=this.renderer){var o,i;this.renderer.parser=this;let r="";for(let a=0;a<t.length;a++){let d=t[a];if((i=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&i[d.type]){let p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(d.type)){r+=p||"";continue}}let u=d;switch(u.type){case"escape":{r+=n.text(u);break}case"html":{r+=n.html(u);break}case"link":{r+=n.link(u);break}case"image":{r+=n.image(u);break}case"checkbox":{r+=n.checkbox(u);break}case"strong":{r+=n.strong(u);break}case"em":{r+=n.em(u);break}case"codespan":{r+=n.codespan(u);break}case"br":{r+=n.br(u);break}case"del":{r+=n.del(u);break}case"text":{r+=n.text(u);break}default:{let p='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return r}},Ar=(Yo=class{constructor(e){le(this,"options");le(this,"block");this.options=e||An}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?St.lex:St.lexInline}provideParser(e=this.block){return e?Tt.parse:Tt.parseInline}},le(Yo,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),le(Yo,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Yo),Sm=class{constructor(...e){le(this,"defaults",$s());le(this,"options",this.setOptions);le(this,"parse",this.parseMarkdown(!0));le(this,"parseInline",this.parseMarkdown(!1));le(this,"Parser",Tt);le(this,"Renderer",xo);le(this,"TextRenderer",qs);le(this,"Lexer",St);le(this,"Tokenizer",wo);le(this,"Hooks",Ar);this.use(...e)}walkTokens(e,t){var r,o;let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let a=i;for(let d of a.header)n=n.concat(this.walkTokens(d.tokens,t));for(let d of a.rows)for(let u of d)n=n.concat(this.walkTokens(u.tokens,t));break}case"list":{let a=i;n=n.concat(this.walkTokens(a.items,t));break}default:{let a=i;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(d=>{let u=a[d].flat(1/0);n=n.concat(this.walkTokens(u,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r=y({},n);if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let i=t.renderers[o.name];i?t.renderers[o.name]=function(...a){let d=o.renderer.apply(this,a);return d===!1&&(d=i.apply(this,a)),d}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[o.level];i?i.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),r.extensions=t),n.renderer){let o=this.defaults.renderer||new xo(this.defaults);for(let i in n.renderer){if(!(i in o))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let a=i,d=n.renderer[a],u=o[a];o[a]=(...p)=>{let h=d.apply(o,p);return h===!1&&(h=u.apply(o,p)),h||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new wo(this.defaults);for(let i in n.tokenizer){if(!(i in o))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,d=n.tokenizer[a],u=o[a];o[a]=(...p)=>{let h=d.apply(o,p);return h===!1&&(h=u.apply(o,p)),h}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new Ar;for(let i in n.hooks){if(!(i in o))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,d=n.hooks[a],u=o[a];Ar.passThroughHooks.has(i)?o[a]=p=>{if(this.defaults.async&&Ar.passThroughHooksRespectAsync.has(i))return I(this,null,function*(){let g=yield d.call(o,p);return u.call(o,g)});let h=d.call(o,p);return u.call(o,h)}:o[a]=(...p)=>{if(this.defaults.async)return I(this,null,function*(){let g=yield d.apply(o,p);return g===!1&&(g=yield u.apply(o,p)),g});let h=d.apply(o,p);return h===!1&&(h=u.apply(o,p)),h}}r.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(a){let d=[];return d.push(i.call(this,a)),o&&(d=d.concat(o.call(this,a))),d}}this.defaults=y(y({},this.defaults),r)}),this}setOptions(e){return this.defaults=y(y({},this.defaults),e),this}lexer(e,t){return St.lex(e,t!=null?t:this.defaults)}parser(e,t){return Tt.parse(e,t!=null?t:this.defaults)}parseMarkdown(e){return(t,n)=>{let r=y({},n),o=y(y({},this.defaults),r),i=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return I(this,null,function*(){let a=o.hooks?yield o.hooks.preprocess(t):t,d=yield(o.hooks?yield o.hooks.provideLexer(e):e?St.lex:St.lexInline)(a,o),u=o.hooks?yield o.hooks.processAllTokens(d):d;o.walkTokens&&(yield Promise.all(this.walkTokens(u,o.walkTokens)));let p=yield(o.hooks?yield o.hooks.provideParser(e):e?Tt.parse:Tt.parseInline)(u,o);return o.hooks?yield o.hooks.postprocess(p):p}).catch(i);try{o.hooks&&(t=o.hooks.preprocess(t));let a=(o.hooks?o.hooks.provideLexer(e):e?St.lex:St.lexInline)(t,o);o.hooks&&(a=o.hooks.processAllTokens(a)),o.walkTokens&&this.walkTokens(a,o.walkTokens);let d=(o.hooks?o.hooks.provideParser(e):e?Tt.parse:Tt.parseInline)(a,o);return o.hooks&&(d=o.hooks.postprocess(d)),d}catch(a){return i(a)}}}onError(e,t){return n=>{if(n.message+=`
1582
- Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+Mt(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},Pn=new Sm;function se(e,t){return Pn.parse(e,t)}se.options=se.setOptions=function(e){return Pn.setOptions(e),se.defaults=Pn.defaults,cc(se.defaults),se},se.getDefaults=$s,se.defaults=An;function Tm(...e){return Pn.use(...e),se.defaults=Pn.defaults,cc(se.defaults),se}se.use=Tm,se.walkTokens=function(e,t){return Pn.walkTokens(e,t)},se.parseInline=Pn.parseInline,se.Parser=Tt,se.parser=Tt.parse,se.Renderer=xo,se.TextRenderer=qs,se.Lexer=St,se.lexer=St.lex,se.Tokenizer=wo,se.Hooks=Ar,se.parse=se,se.options,se.setOptions,se.walkTokens,se.parseInline,Tt.parse,St.lex;/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:Tc,setPrototypeOf:Ec,isFrozen:Em,getPrototypeOf:Am,getOwnPropertyDescriptor:Cm}=Object;let{freeze:et,seal:bt,create:Hs}=Object,{apply:Fs,construct:Bs}=typeof Reflect!="undefined"&&Reflect;et||(et=function(t){return t}),bt||(bt=function(t){return t}),Fs||(Fs=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return t.apply(n,o)}),Bs||(Bs=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new t(...r)});const So=nt(Array.prototype.forEach),Pm=nt(Array.prototype.lastIndexOf),Ac=nt(Array.prototype.pop),Cr=nt(Array.prototype.push),Rm=nt(Array.prototype.splice),To=nt(String.prototype.toLowerCase),Gs=nt(String.prototype.toString),Ws=nt(String.prototype.match),Pr=nt(String.prototype.replace),Lm=nt(String.prototype.indexOf),Im=nt(String.prototype.trim),Et=nt(Object.prototype.hasOwnProperty),tt=nt(RegExp.prototype.test),Rr=zm(TypeError);function nt(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Fs(e,t,r)}}function zm(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Bs(e,n)}}function Y(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:To;Ec&&Ec(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(Em(t)||(t[r]=i),o=i)}e[o]=!0}return e}function $m(e){for(let t=0;t<e.length;t++)Et(e,t)||(e[t]=null);return e}function Ut(e){const t=Hs(null);for(const[n,r]of Tc(e))Et(e,n)&&(Array.isArray(r)?t[n]=$m(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=Ut(r):t[n]=r);return t}function Lr(e,t){for(;e!==null;){const r=Cm(e,t);if(r){if(r.get)return nt(r.get);if(typeof r.value=="function")return nt(r.value)}e=Am(e)}function n(){return null}return n}const Cc=et(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Js=et(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ys=et(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Om=et(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Vs=et(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Nm=et(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Pc=et(["#text"]),Rc=et(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Xs=et(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Lc=et(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Eo=et(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Dm=bt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Mm=bt(/<%[\w\W]*|[\w\W]*%>/gm),Um=bt(/\$\{[\w\W]*/gm),jm=bt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Zm=bt(/^aria-[\-\w]+$/),Ic=bt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),qm=bt(/^(?:\w+script|data):/i),Hm=bt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),zc=bt(/^html$/i),Fm=bt(/^[a-z][.\w]*(-[.\w]+)+$/i);var $c=Object.freeze({__proto__:null,ARIA_ATTR:Zm,ATTR_WHITESPACE:Hm,CUSTOM_ELEMENT:Fm,DATA_ATTR:jm,DOCTYPE_NAME:zc,ERB_EXPR:Mm,IS_ALLOWED_URI:Ic,IS_SCRIPT_OR_DATA:qm,MUSTACHE_EXPR:Dm,TMPLIT_EXPR:Um});const Ir={element:1,text:3,progressingInstruction:7,comment:8,document:9},Bm=function(){return typeof window=="undefined"?null:window},Gm=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch(a){return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Oc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Nc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Bm();const t=j=>Nc(j);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Ir.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:d,Element:u,NodeFilter:p,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:m,trustedTypes:k}=e,w=u.prototype,v=Lr(w,"cloneNode"),Z=Lr(w,"remove"),K=Lr(w,"nextSibling"),U=Lr(w,"childNodes"),E=Lr(w,"parentNode");if(typeof a=="function"){const j=n.createElement("template");j.content&&j.content.ownerDocument&&(n=j.content.ownerDocument)}let T,A="";const{implementation:N,createNodeIterator:J,createDocumentFragment:we,getElementsByTagName:Me}=n,{importNode:Ye}=r;let ne=Oc();t.isSupported=typeof Tc=="function"&&typeof E=="function"&&N&&N.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:xe,ERB_EXPR:lt,TMPLIT_EXPR:kn,DATA_ATTR:_n,ARIA_ATTR:vt,IS_SCRIPT_OR_DATA:Ft,ATTR_WHITESPACE:vn,CUSTOM_ELEMENT:yn}=$c;let{IS_ALLOWED_URI:Bt}=$c,fe=null;const Ct=Y({},[...Cc,...Js,...Ys,...Vs,...Pc]);let ye=null;const Dn=Y({},[...Rc,...Xs,...Lc,...Eo]);let ue=Object.seal(Hs(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ve=null,wn=null;const Pt=Object.seal(Hs(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Se=!0,Ae=!0,H=!1,ae=!0,Q=!1,Ue=!0,Xe=!1,Be=!1,tn=!1,Rt=!1,je=!1,Re=!1,Oe=!0,Ge=!1;const jr="user-content-";let it=!0,ut=!1,Lt={},Le=null;const Zr=Y({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let de=null;const Vo=Y({},["audio","video","img","source","image","track"]);let qr=null;const Xo=Y({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),hr="http://www.w3.org/1998/Math/MathML",fr="http://www.w3.org/2000/svg",It="http://www.w3.org/1999/xhtml";let xn=It,Mn=!1,Un=null;const mi=Y({},[hr,fr,It],Gs);let gr=Y({},["mi","mo","mn","ms","mtext"]),mr=Y({},["annotation-xml"]);const bi=Y({},["title","style","font","a","script"]);let nn=null;const zt=["application/xhtml+xml","text/html"],ki="text/html";let pe=null,Sn=null;const Ko=n.createElement("form"),Hr=function(_){return _ instanceof RegExp||_ instanceof Function},br=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Sn&&Sn===_)){if((!_||typeof _!="object")&&(_={}),_=Ut(_),nn=zt.indexOf(_.PARSER_MEDIA_TYPE)===-1?ki:_.PARSER_MEDIA_TYPE,pe=nn==="application/xhtml+xml"?Gs:To,fe=Et(_,"ALLOWED_TAGS")?Y({},_.ALLOWED_TAGS,pe):Ct,ye=Et(_,"ALLOWED_ATTR")?Y({},_.ALLOWED_ATTR,pe):Dn,Un=Et(_,"ALLOWED_NAMESPACES")?Y({},_.ALLOWED_NAMESPACES,Gs):mi,qr=Et(_,"ADD_URI_SAFE_ATTR")?Y(Ut(Xo),_.ADD_URI_SAFE_ATTR,pe):Xo,de=Et(_,"ADD_DATA_URI_TAGS")?Y(Ut(Vo),_.ADD_DATA_URI_TAGS,pe):Vo,Le=Et(_,"FORBID_CONTENTS")?Y({},_.FORBID_CONTENTS,pe):Zr,Ve=Et(_,"FORBID_TAGS")?Y({},_.FORBID_TAGS,pe):Ut({}),wn=Et(_,"FORBID_ATTR")?Y({},_.FORBID_ATTR,pe):Ut({}),Lt=Et(_,"USE_PROFILES")?_.USE_PROFILES:!1,Se=_.ALLOW_ARIA_ATTR!==!1,Ae=_.ALLOW_DATA_ATTR!==!1,H=_.ALLOW_UNKNOWN_PROTOCOLS||!1,ae=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Q=_.SAFE_FOR_TEMPLATES||!1,Ue=_.SAFE_FOR_XML!==!1,Xe=_.WHOLE_DOCUMENT||!1,Rt=_.RETURN_DOM||!1,je=_.RETURN_DOM_FRAGMENT||!1,Re=_.RETURN_TRUSTED_TYPE||!1,tn=_.FORCE_BODY||!1,Oe=_.SANITIZE_DOM!==!1,Ge=_.SANITIZE_NAMED_PROPS||!1,it=_.KEEP_CONTENT!==!1,ut=_.IN_PLACE||!1,Bt=_.ALLOWED_URI_REGEXP||Ic,xn=_.NAMESPACE||It,gr=_.MATHML_TEXT_INTEGRATION_POINTS||gr,mr=_.HTML_INTEGRATION_POINTS||mr,ue=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&Hr(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ue.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&Hr(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ue.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ue.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Q&&(Ae=!1),je&&(Rt=!0),Lt&&(fe=Y({},Pc),ye=[],Lt.html===!0&&(Y(fe,Cc),Y(ye,Rc)),Lt.svg===!0&&(Y(fe,Js),Y(ye,Xs),Y(ye,Eo)),Lt.svgFilters===!0&&(Y(fe,Ys),Y(ye,Xs),Y(ye,Eo)),Lt.mathMl===!0&&(Y(fe,Vs),Y(ye,Lc),Y(ye,Eo))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?Pt.tagCheck=_.ADD_TAGS:(fe===Ct&&(fe=Ut(fe)),Y(fe,_.ADD_TAGS,pe))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?Pt.attributeCheck=_.ADD_ATTR:(ye===Dn&&(ye=Ut(ye)),Y(ye,_.ADD_ATTR,pe))),_.ADD_URI_SAFE_ATTR&&Y(qr,_.ADD_URI_SAFE_ATTR,pe),_.FORBID_CONTENTS&&(Le===Zr&&(Le=Ut(Le)),Y(Le,_.FORBID_CONTENTS,pe)),_.ADD_FORBID_CONTENTS&&(Le===Zr&&(Le=Ut(Le)),Y(Le,_.ADD_FORBID_CONTENTS,pe)),it&&(fe["#text"]=!0),Xe&&Y(fe,["html","head","body"]),fe.table&&(Y(fe,["tbody"]),delete Ve.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw Rr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Rr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=_.TRUSTED_TYPES_POLICY,A=T.createHTML("")}else T===void 0&&(T=Gm(k,o)),T!==null&&typeof A=="string"&&(A=T.createHTML(""));et&&et(_),Sn=_}},Fr=Y({},[...Js,...Ys,...Om]),Qo=Y({},[...Vs,...Nm]),_i=function(_){let C=E(_);(!C||!C.tagName)&&(C={namespaceURI:xn,tagName:"template"});const z=To(_.tagName),ce=To(C.tagName);return Un[_.namespaceURI]?_.namespaceURI===fr?C.namespaceURI===It?z==="svg":C.namespaceURI===hr?z==="svg"&&(ce==="annotation-xml"||gr[ce]):!!Fr[z]:_.namespaceURI===hr?C.namespaceURI===It?z==="math":C.namespaceURI===fr?z==="math"&&mr[ce]:!!Qo[z]:_.namespaceURI===It?C.namespaceURI===fr&&!mr[ce]||C.namespaceURI===hr&&!gr[ce]?!1:!Qo[z]&&(bi[z]||!Fr[z]):!!(nn==="application/xhtml+xml"&&Un[_.namespaceURI]):!1},yt=function(_){Cr(t.removed,{element:_});try{E(_).removeChild(_)}catch(C){Z(_)}},wt=function(_,C){try{Cr(t.removed,{attribute:C.getAttributeNode(_),from:C})}catch(z){Cr(t.removed,{attribute:null,from:C})}if(C.removeAttribute(_),_==="is")if(Rt||je)try{yt(C)}catch(z){}else try{C.setAttribute(_,"")}catch(z){}},es=function(_){let C=null,z=null;if(tn)_="<remove></remove>"+_;else{const Te=Ws(_,/^[\r\n\t ]+/);z=Te&&Te[0]}nn==="application/xhtml+xml"&&xn===It&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const ce=T?T.createHTML(_):_;if(xn===It)try{C=new m().parseFromString(ce,nn)}catch(Te){}if(!C||!C.documentElement){C=N.createDocument(xn,"template",null);try{C.documentElement.innerHTML=Mn?A:ce}catch(Te){}}const Ze=C.body||C.documentElement;return _&&z&&Ze.insertBefore(n.createTextNode(z),Ze.childNodes[0]||null),xn===It?Me.call(C,Xe?"html":"body")[0]:Xe?C.documentElement:Ze},Br=function(_){return J.call(_.ownerDocument||_,_,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Gr=function(_){return _ instanceof g&&(typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||!(_.attributes instanceof h)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function")},ts=function(_){return typeof d=="function"&&_ instanceof d};function $t(j,_,C){So(j,z=>{z.call(t,_,C,Sn)})}const ns=function(_){let C=null;if($t(ne.beforeSanitizeElements,_,null),Gr(_))return yt(_),!0;const z=pe(_.nodeName);if($t(ne.uponSanitizeElement,_,{tagName:z,allowedTags:fe}),Ue&&_.hasChildNodes()&&!ts(_.firstElementChild)&&tt(/<[/\w!]/g,_.innerHTML)&&tt(/<[/\w!]/g,_.textContent)||_.nodeType===Ir.progressingInstruction||Ue&&_.nodeType===Ir.comment&&tt(/<[/\w]/g,_.data))return yt(_),!0;if(!(Pt.tagCheck instanceof Function&&Pt.tagCheck(z))&&(!fe[z]||Ve[z])){if(!Ve[z]&&os(z)&&(ue.tagNameCheck instanceof RegExp&&tt(ue.tagNameCheck,z)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(z)))return!1;if(it&&!Le[z]){const ce=E(_)||_.parentNode,Ze=U(_)||_.childNodes;if(Ze&&ce){const Te=Ze.length;for(let Ke=Te-1;Ke>=0;--Ke){const Ot=v(Ze[Ke],!0);Ot.__removalCount=(_.__removalCount||0)+1,ce.insertBefore(Ot,K(_))}}}return yt(_),!0}return _ instanceof u&&!_i(_)||(z==="noscript"||z==="noembed"||z==="noframes")&&tt(/<\/no(script|embed|frames)/i,_.innerHTML)?(yt(_),!0):(Q&&_.nodeType===Ir.text&&(C=_.textContent,So([xe,lt,kn],ce=>{C=Pr(C,ce," ")}),_.textContent!==C&&(Cr(t.removed,{element:_.cloneNode()}),_.textContent=C)),$t(ne.afterSanitizeElements,_,null),!1)},rs=function(_,C,z){if(Oe&&(C==="id"||C==="name")&&(z in n||z in Ko))return!1;if(!(Ae&&!wn[C]&&tt(_n,C))){if(!(Se&&tt(vt,C))){if(!(Pt.attributeCheck instanceof Function&&Pt.attributeCheck(C,_))){if(!ye[C]||wn[C]){if(!(os(_)&&(ue.tagNameCheck instanceof RegExp&&tt(ue.tagNameCheck,_)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(_))&&(ue.attributeNameCheck instanceof RegExp&&tt(ue.attributeNameCheck,C)||ue.attributeNameCheck instanceof Function&&ue.attributeNameCheck(C,_))||C==="is"&&ue.allowCustomizedBuiltInElements&&(ue.tagNameCheck instanceof RegExp&&tt(ue.tagNameCheck,z)||ue.tagNameCheck instanceof Function&&ue.tagNameCheck(z))))return!1}else if(!qr[C]){if(!tt(Bt,Pr(z,vn,""))){if(!((C==="src"||C==="xlink:href"||C==="href")&&_!=="script"&&Lm(z,"data:")===0&&de[_])){if(!(H&&!tt(Ft,Pr(z,vn,"")))){if(z)return!1}}}}}}}return!0},os=function(_){return _!=="annotation-xml"&&Ws(_,yn)},Wr=function(_){$t(ne.beforeSanitizeAttributes,_,null);const{attributes:C}=_;if(!C||Gr(_))return;const z={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ye,forceKeepAttr:void 0};let ce=C.length;for(;ce--;){const Ze=C[ce],{name:Te,namespaceURI:Ke,value:Ot}=Ze,Gt=pe(Te),Jr=Ot;let Ne=Te==="value"?Jr:Im(Jr);if(z.attrName=Gt,z.attrValue=Ne,z.keepAttr=!0,z.forceKeepAttr=void 0,$t(ne.uponSanitizeAttribute,_,z),Ne=z.attrValue,Ge&&(Gt==="id"||Gt==="name")&&(wt(Te,_),Ne=jr+Ne),Ue&&tt(/((--!?|])>)|<\/(style|title|textarea)/i,Ne)){wt(Te,_);continue}if(Gt==="attributename"&&Ws(Ne,"href")){wt(Te,_);continue}if(z.forceKeepAttr)continue;if(!z.keepAttr){wt(Te,_);continue}if(!ae&&tt(/\/>/i,Ne)){wt(Te,_);continue}Q&&So([xe,lt,kn],is=>{Ne=Pr(Ne,is," ")});const ss=pe(_.nodeName);if(!rs(ss,Gt,Ne)){wt(Te,_);continue}if(T&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!Ke)switch(k.getAttributeType(ss,Gt)){case"TrustedHTML":{Ne=T.createHTML(Ne);break}case"TrustedScriptURL":{Ne=T.createScriptURL(Ne);break}}if(Ne!==Jr)try{Ke?_.setAttributeNS(Ke,Te,Ne):_.setAttribute(Te,Ne),Gr(_)?yt(_):Ac(t.removed)}catch(is){wt(Te,_)}}$t(ne.afterSanitizeAttributes,_,null)},rn=function j(_){let C=null;const z=Br(_);for($t(ne.beforeSanitizeShadowDOM,_,null);C=z.nextNode();)$t(ne.uponSanitizeShadowNode,C,null),ns(C),Wr(C),C.content instanceof i&&j(C.content);$t(ne.afterSanitizeShadowDOM,_,null)};return t.sanitize=function(j){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=null,z=null,ce=null,Ze=null;if(Mn=!j,Mn&&(j="<!-->"),typeof j!="string"&&!ts(j))if(typeof j.toString=="function"){if(j=j.toString(),typeof j!="string")throw Rr("dirty is not a string, aborting")}else throw Rr("toString is not a function");if(!t.isSupported)return j;if(Be||br(_),t.removed=[],typeof j=="string"&&(ut=!1),ut){if(j.nodeName){const Ot=pe(j.nodeName);if(!fe[Ot]||Ve[Ot])throw Rr("root node is forbidden and cannot be sanitized in-place")}}else if(j instanceof d)C=es("<!---->"),z=C.ownerDocument.importNode(j,!0),z.nodeType===Ir.element&&z.nodeName==="BODY"||z.nodeName==="HTML"?C=z:C.appendChild(z);else{if(!Rt&&!Q&&!Xe&&j.indexOf("<")===-1)return T&&Re?T.createHTML(j):j;if(C=es(j),!C)return Rt?null:Re?A:""}C&&tn&&yt(C.firstChild);const Te=Br(ut?j:C);for(;ce=Te.nextNode();)ns(ce),Wr(ce),ce.content instanceof i&&rn(ce.content);if(ut)return j;if(Rt){if(je)for(Ze=we.call(C.ownerDocument);C.firstChild;)Ze.appendChild(C.firstChild);else Ze=C;return(ye.shadowroot||ye.shadowrootmode)&&(Ze=Ye.call(r,Ze,!0)),Ze}let Ke=Xe?C.outerHTML:C.innerHTML;return Xe&&fe["!doctype"]&&C.ownerDocument&&C.ownerDocument.doctype&&C.ownerDocument.doctype.name&&tt(zc,C.ownerDocument.doctype.name)&&(Ke="<!DOCTYPE "+C.ownerDocument.doctype.name+`>
1583
- `+Ke),Q&&So([xe,lt,kn],Ot=>{Ke=Pr(Ke,Ot," ")}),T&&Re?T.createHTML(Ke):Ke},t.setConfig=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};br(j),Be=!0},t.clearConfig=function(){Sn=null,Be=!1},t.isValidAttribute=function(j,_,C){Sn||br({});const z=pe(j),ce=pe(_);return rs(z,ce,C)},t.addHook=function(j,_){typeof _=="function"&&Cr(ne[j],_)},t.removeHook=function(j,_){if(_!==void 0){const C=Pm(ne[j],_);return C===-1?void 0:Rm(ne[j],C,1)[0]}return Ac(ne[j])},t.removeHooks=function(j){ne[j]=[]},t.removeAllHooks=function(){ne=Oc()},t}var Wm=Nc();function Dc(e){const t=se.parse(e,{gfm:!0,breaks:!0,async:!1});return Wm.sanitize(t)}const Mc=1e3,Jm=32,Uc=15e3,Ym=new Set(["completed","failed","cancelled"]),Vm=4e3;let L=null,jt=null,Fe=null,Ks=null,Ao=null,Qs=!1,Co=null,zr=null,F={kind:"connecting"},tr=[],pt=!0,nr=null,_e=null,rr=null,Vt=null,$r=-1,rt=null,Xt=!1,Kt=null,Rn=new Set;function ei(){Ro(),nc(),jt&&clearInterval(jt),jt=null,Kt==null||Kt(),Kt=null,Fe==null||Fe.destroy(),Fe=null,L&&Jt(L),L==null||L.remove(),L=null,Ks=null,F={kind:"connecting"},tr=[],pt=!0,nr=null,_e=null,rr=null,Vt=null,Ao=null,$r=-1,rt=null,Xt=!1,Rn=new Set}function ti(e,t,n,r,o){L&&ei(),Ks=o!=null?o:null,F={kind:"connecting"},tr=[],pt=!0,nr=null,$r=-1,rt=null,Xt=!1,Rn=new Set,_e=e,rr=n,Vt=t,Ao=r,tc({taskId:e,backendUrl:n,title:r}),L=document.createElement("div"),L.className="ap-sdk-panel",L.setAttribute("data-ap-sdk","1"),L.setAttribute("role","dialog"),L.setAttribute("aria-modal","true"),L.setAttribute("aria-label","Automation in progress");const i=r.length>55?`${r.slice(0,52)}…`:r;L.innerHTML=`
1641
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${qt(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),o=Hc(e);if(o===null)return r;e=o;let i='<a href="'+e+'"';return t&&(i+=' title="'+qt(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let o=Hc(e);if(o===null)return qt(n);e=o;let i=`<img src="${e}" alt="${qt(n)}"`;return t&&(i+=` title="${qt(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:qt(e.text)}},ri=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},St=class Gi{constructor(t){pe(this,"options");pe(this,"renderer");pe(this,"textRenderer");this.options=t||$n,this.options.renderer=this.options.renderer||new Do,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ri}static parse(t,n){return new Gi(n).parse(t)}static parseInline(t,n){return new Gi(n).parseInline(t)}parse(t){var r,o;this.renderer.parser=this;let n="";for(let i=0;i<t.length;i++){let a=t[i];if((o=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&o[a.type]){let l=a,p=this.options.extensions.renderers[l.type].call({parser:this},l);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(l.type)){n+=p||"";continue}}let d=a;switch(d.type){case"space":{n+=this.renderer.space(d);break}case"hr":{n+=this.renderer.hr(d);break}case"heading":{n+=this.renderer.heading(d);break}case"code":{n+=this.renderer.code(d);break}case"table":{n+=this.renderer.table(d);break}case"blockquote":{n+=this.renderer.blockquote(d);break}case"list":{n+=this.renderer.list(d);break}case"checkbox":{n+=this.renderer.checkbox(d);break}case"html":{n+=this.renderer.html(d);break}case"def":{n+=this.renderer.def(d);break}case"paragraph":{n+=this.renderer.paragraph(d);break}case"text":{n+=this.renderer.text(d);break}default:{let l='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(t,n=this.renderer){var o,i;this.renderer.parser=this;let r="";for(let a=0;a<t.length;a++){let d=t[a];if((i=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&i[d.type]){let p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(d.type)){r+=p||"";continue}}let l=d;switch(l.type){case"escape":{r+=n.text(l);break}case"html":{r+=n.html(l);break}case"link":{r+=n.link(l);break}case"image":{r+=n.image(l);break}case"checkbox":{r+=n.checkbox(l);break}case"strong":{r+=n.strong(l);break}case"em":{r+=n.em(l);break}case"codespan":{r+=n.codespan(l);break}case"br":{r+=n.br(l);break}case"del":{r+=n.del(l);break}case"text":{r+=n.text(l);break}default:{let p='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return r}},Dr=(us=class{constructor(e){pe(this,"options");pe(this,"block");this.options=e||$n}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?xt.lex:xt.lexInline}provideParser(e=this.block){return e?St.parse:St.parseInline}},pe(us,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),pe(us,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),us),tb=class{constructor(...e){pe(this,"defaults",Ys());pe(this,"options",this.setOptions);pe(this,"parse",this.parseMarkdown(!0));pe(this,"parseInline",this.parseMarkdown(!1));pe(this,"Parser",St);pe(this,"Renderer",Do);pe(this,"TextRenderer",ri);pe(this,"Lexer",xt);pe(this,"Tokenizer",No);pe(this,"Hooks",Dr);this.use(...e)}walkTokens(e,t){var r,o;let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let a=i;for(let d of a.header)n=n.concat(this.walkTokens(d.tokens,t));for(let d of a.rows)for(let l of d)n=n.concat(this.walkTokens(l.tokens,t));break}case"list":{let a=i;n=n.concat(this.walkTokens(a.items,t));break}default:{let a=i;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(d=>{let l=a[d].flat(1/0);n=n.concat(this.walkTokens(l,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r=v({},n);if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let i=t.renderers[o.name];i?t.renderers[o.name]=function(...a){let d=o.renderer.apply(this,a);return d===!1&&(d=i.apply(this,a)),d}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[o.level];i?i.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),r.extensions=t),n.renderer){let o=this.defaults.renderer||new Do(this.defaults);for(let i in n.renderer){if(!(i in o))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let a=i,d=n.renderer[a],l=o[a];o[a]=(...p)=>{let h=d.apply(o,p);return h===!1&&(h=l.apply(o,p)),h||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new No(this.defaults);for(let i in n.tokenizer){if(!(i in o))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,d=n.tokenizer[a],l=o[a];o[a]=(...p)=>{let h=d.apply(o,p);return h===!1&&(h=l.apply(o,p)),h}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new Dr;for(let i in n.hooks){if(!(i in o))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,d=n.hooks[a],l=o[a];Dr.passThroughHooks.has(i)?o[a]=p=>{if(this.defaults.async&&Dr.passThroughHooksRespectAsync.has(i))return z(this,null,function*(){let g=yield d.call(o,p);return l.call(o,g)});let h=d.call(o,p);return l.call(o,h)}:o[a]=(...p)=>{if(this.defaults.async)return z(this,null,function*(){let g=yield d.apply(o,p);return g===!1&&(g=yield l.apply(o,p)),g});let h=d.apply(o,p);return h===!1&&(h=l.apply(o,p)),h}}r.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(a){let d=[];return d.push(i.call(this,a)),o&&(d=d.concat(o.call(this,a))),d}}this.defaults=v(v({},this.defaults),r)}),this}setOptions(e){return this.defaults=v(v({},this.defaults),e),this}lexer(e,t){return xt.lex(e,t!=null?t:this.defaults)}parser(e,t){return St.parse(e,t!=null?t:this.defaults)}parseMarkdown(e){return(t,n)=>{let r=v({},n),o=v(v({},this.defaults),r),i=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return z(this,null,function*(){let a=o.hooks?yield o.hooks.preprocess(t):t,d=yield(o.hooks?yield o.hooks.provideLexer(e):e?xt.lex:xt.lexInline)(a,o),l=o.hooks?yield o.hooks.processAllTokens(d):d;o.walkTokens&&(yield Promise.all(this.walkTokens(l,o.walkTokens)));let p=yield(o.hooks?yield o.hooks.provideParser(e):e?St.parse:St.parseInline)(l,o);return o.hooks?yield o.hooks.postprocess(p):p}).catch(i);try{o.hooks&&(t=o.hooks.preprocess(t));let a=(o.hooks?o.hooks.provideLexer(e):e?xt.lex:xt.lexInline)(t,o);o.hooks&&(a=o.hooks.processAllTokens(a)),o.walkTokens&&this.walkTokens(a,o.walkTokens);let d=(o.hooks?o.hooks.provideParser(e):e?St.parse:St.parseInline)(a,o);return o.hooks&&(d=o.hooks.postprocess(d)),d}catch(a){return i(a)}}}onError(e,t){return n=>{if(n.message+=`
1642
+ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+qt(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},On=new tb;function ce(e,t){return On.parse(e,t)}ce.options=ce.setOptions=function(e){return On.setOptions(e),ce.defaults=On.defaults,Rc(ce.defaults),ce},ce.getDefaults=Ys,ce.defaults=$n;function nb(...e){return On.use(...e),ce.defaults=On.defaults,Rc(ce.defaults),ce}ce.use=nb,ce.walkTokens=function(e,t){return On.walkTokens(e,t)},ce.parseInline=On.parseInline,ce.Parser=St,ce.parser=St.parse,ce.Renderer=Do,ce.TextRenderer=ri,ce.Lexer=xt,ce.lexer=xt.lex,ce.Tokenizer=No,ce.Hooks=Dr,ce.parse=ce,ce.options,ce.setOptions,ce.walkTokens,ce.parseInline,St.parse,xt.lex;/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:Wc,setPrototypeOf:Jc,isFrozen:rb,getPrototypeOf:ob,getOwnPropertyDescriptor:sb}=Object;let{freeze:Ve,seal:ft,create:oi}=Object,{apply:si,construct:ii}=typeof Reflect!="undefined"&&Reflect;Ve||(Ve=function(t){return t}),ft||(ft=function(t){return t}),si||(si=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return t.apply(n,o)}),ii||(ii=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new t(...r)});const Mo=Ke(Array.prototype.forEach),ib=Ke(Array.prototype.lastIndexOf),Yc=Ke(Array.prototype.pop),Mr=Ke(Array.prototype.push),ab=Ke(Array.prototype.splice),Uo=Ke(String.prototype.toLowerCase),ai=Ke(String.prototype.toString),ci=Ke(String.prototype.match),Ur=Ke(String.prototype.replace),cb=Ke(String.prototype.indexOf),lb=Ke(String.prototype.trim),Tt=Ke(Object.prototype.hasOwnProperty),Xe=Ke(RegExp.prototype.test),jr=ub(TypeError);function Ke(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return si(e,t,r)}}function ub(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return ii(e,n)}}function V(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Uo;Jc&&Jc(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(rb(t)||(t[r]=i),o=i)}e[o]=!0}return e}function db(e){for(let t=0;t<e.length;t++)Tt(e,t)||(e[t]=null);return e}function Ht(e){const t=oi(null);for(const[n,r]of Wc(e))Tt(e,n)&&(Array.isArray(r)?t[n]=db(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=Ht(r):t[n]=r);return t}function Zr(e,t){for(;e!==null;){const r=sb(e,t);if(r){if(r.get)return Ke(r.get);if(typeof r.value=="function")return Ke(r.value)}e=ob(e)}function n(){return null}return n}const Vc=Ve(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),li=Ve(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ui=Ve(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),pb=Ve(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),di=Ve(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),hb=Ve(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Xc=Ve(["#text"]),Kc=Ve(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),pi=Ve(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Qc=Ve(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),jo=Ve(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),fb=ft(/\{\{[\w\W]*|[\w\W]*\}\}/gm),gb=ft(/<%[\w\W]*|[\w\W]*%>/gm),mb=ft(/\$\{[\w\W]*/gm),bb=ft(/^data-[\-\w.\u00B7-\uFFFF]+$/),kb=ft(/^aria-[\-\w]+$/),el=ft(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),_b=ft(/^(?:\w+script|data):/i),vb=ft(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),tl=ft(/^html$/i),yb=ft(/^[a-z][.\w]*(-[.\w]+)+$/i);var nl=Object.freeze({__proto__:null,ARIA_ATTR:kb,ATTR_WHITESPACE:vb,CUSTOM_ELEMENT:yb,DATA_ATTR:bb,DOCTYPE_NAME:tl,ERB_EXPR:gb,IS_ALLOWED_URI:el,IS_SCRIPT_OR_DATA:_b,MUSTACHE_EXPR:fb,TMPLIT_EXPR:mb});const qr={element:1,text:3,progressingInstruction:7,comment:8,document:9},wb=function(){return typeof window=="undefined"?null:window},xb=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch(a){return console.warn("TrustedTypes policy "+i+" could not be created."),null}},rl=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ol(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:wb();const t=Z=>ol(Z);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==qr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:d,Element:l,NodeFilter:p,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:m,trustedTypes:k}=e,y=l.prototype,S=Zr(y,"cloneNode"),$=Zr(y,"remove"),E=Zr(y,"nextSibling"),j=Zr(y,"childNodes"),A=Zr(y,"parentNode");if(typeof a=="function"){const Z=n.createElement("template");Z.content&&Z.content.ownerDocument&&(n=Z.content.ownerDocument)}let T,L="";const{implementation:q,createNodeIterator:H,createDocumentFragment:se,getElementsByTagName:je}=n,{importNode:nt}=r;let ee=rl();t.isSupported=typeof Wc=="function"&&typeof A=="function"&&q&&q.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Se,ERB_EXPR:at,TMPLIT_EXPR:At,DATA_ATTR:vr,ARIA_ATTR:Jt,IS_SCRIPT_OR_DATA:Ct,ATTR_WHITESPACE:yr,CUSTOM_ELEMENT:Yt}=nl;let{IS_ALLOWED_URI:an}=nl,ye=null;const Vt=V({},[...Vc,...li,...ui,...di,...Xc]);let ge=null;const Pt=V({},[...Kc,...pi,...Qc,...jo]);let le=Object.seal(oi(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Le=null,En=null;const Rt=Object.seal(oi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Te=!0,Pe=!0,Fn=!1,An=!0,Ne=!1,Xt=!0,bt=!1,kt=!1,cn=!1,F=!1,re=!1,xe=!1,rt=!0,_t=!1;const Lt="user-content-";let Cn=!0,Kt=!1,De={},ue=null;const Ie=V({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let X=null;const wr=V({},["audio","video","img","source","image","track"]);let ot=null;const It=V({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ln="http://www.w3.org/1998/Math/MathML",$t="http://www.w3.org/2000/svg",zt="http://www.w3.org/1999/xhtml";let Pn=zt,Bn=!1,Gn=null;const zi=V({},[ln,$t,zt],ai);let xr=V({},["mi","mo","mn","ms","mtext"]),Sr=V({},["annotation-xml"]);const Oi=V({},["title","style","font","a","script"]);let un=null;const Ot=["application/xhtml+xml","text/html"],Ni="text/html";let he=null,Rn=null;const ds=n.createElement("form"),ro=function(_){return _ instanceof RegExp||_ instanceof Function},Tr=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Rn&&Rn===_)){if((!_||typeof _!="object")&&(_={}),_=Ht(_),un=Ot.indexOf(_.PARSER_MEDIA_TYPE)===-1?Ni:_.PARSER_MEDIA_TYPE,he=un==="application/xhtml+xml"?ai:Uo,ye=Tt(_,"ALLOWED_TAGS")?V({},_.ALLOWED_TAGS,he):Vt,ge=Tt(_,"ALLOWED_ATTR")?V({},_.ALLOWED_ATTR,he):Pt,Gn=Tt(_,"ALLOWED_NAMESPACES")?V({},_.ALLOWED_NAMESPACES,ai):zi,ot=Tt(_,"ADD_URI_SAFE_ATTR")?V(Ht(It),_.ADD_URI_SAFE_ATTR,he):It,X=Tt(_,"ADD_DATA_URI_TAGS")?V(Ht(wr),_.ADD_DATA_URI_TAGS,he):wr,ue=Tt(_,"FORBID_CONTENTS")?V({},_.FORBID_CONTENTS,he):Ie,Le=Tt(_,"FORBID_TAGS")?V({},_.FORBID_TAGS,he):Ht({}),En=Tt(_,"FORBID_ATTR")?V({},_.FORBID_ATTR,he):Ht({}),De=Tt(_,"USE_PROFILES")?_.USE_PROFILES:!1,Te=_.ALLOW_ARIA_ATTR!==!1,Pe=_.ALLOW_DATA_ATTR!==!1,Fn=_.ALLOW_UNKNOWN_PROTOCOLS||!1,An=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ne=_.SAFE_FOR_TEMPLATES||!1,Xt=_.SAFE_FOR_XML!==!1,bt=_.WHOLE_DOCUMENT||!1,F=_.RETURN_DOM||!1,re=_.RETURN_DOM_FRAGMENT||!1,xe=_.RETURN_TRUSTED_TYPE||!1,cn=_.FORCE_BODY||!1,rt=_.SANITIZE_DOM!==!1,_t=_.SANITIZE_NAMED_PROPS||!1,Cn=_.KEEP_CONTENT!==!1,Kt=_.IN_PLACE||!1,an=_.ALLOWED_URI_REGEXP||el,Pn=_.NAMESPACE||zt,xr=_.MATHML_TEXT_INTEGRATION_POINTS||xr,Sr=_.HTML_INTEGRATION_POINTS||Sr,le=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&ro(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(le.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&ro(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(le.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(le.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ne&&(Pe=!1),re&&(F=!0),De&&(ye=V({},Xc),ge=[],De.html===!0&&(V(ye,Vc),V(ge,Kc)),De.svg===!0&&(V(ye,li),V(ge,pi),V(ge,jo)),De.svgFilters===!0&&(V(ye,ui),V(ge,pi),V(ge,jo)),De.mathMl===!0&&(V(ye,di),V(ge,Qc),V(ge,jo))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?Rt.tagCheck=_.ADD_TAGS:(ye===Vt&&(ye=Ht(ye)),V(ye,_.ADD_TAGS,he))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?Rt.attributeCheck=_.ADD_ATTR:(ge===Pt&&(ge=Ht(ge)),V(ge,_.ADD_ATTR,he))),_.ADD_URI_SAFE_ATTR&&V(ot,_.ADD_URI_SAFE_ATTR,he),_.FORBID_CONTENTS&&(ue===Ie&&(ue=Ht(ue)),V(ue,_.FORBID_CONTENTS,he)),_.ADD_FORBID_CONTENTS&&(ue===Ie&&(ue=Ht(ue)),V(ue,_.ADD_FORBID_CONTENTS,he)),Cn&&(ye["#text"]=!0),bt&&V(ye,["html","head","body"]),ye.table&&(V(ye,["tbody"]),delete Le.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw jr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw jr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=_.TRUSTED_TYPES_POLICY,L=T.createHTML("")}else T===void 0&&(T=xb(k,o)),T!==null&&typeof L=="string"&&(L=T.createHTML(""));Ve&&Ve(_),Rn=_}},oo=V({},[...li,...ui,...pb]),ps=V({},[...di,...hb]),Di=function(_){let C=A(_);(!C||!C.tagName)&&(C={namespaceURI:Pn,tagName:"template"});const O=Uo(_.tagName),de=Uo(C.tagName);return Gn[_.namespaceURI]?_.namespaceURI===$t?C.namespaceURI===zt?O==="svg":C.namespaceURI===ln?O==="svg"&&(de==="annotation-xml"||xr[de]):!!oo[O]:_.namespaceURI===ln?C.namespaceURI===zt?O==="math":C.namespaceURI===$t?O==="math"&&Sr[de]:!!ps[O]:_.namespaceURI===zt?C.namespaceURI===$t&&!Sr[de]||C.namespaceURI===ln&&!xr[de]?!1:!ps[O]&&(Oi[O]||!oo[O]):!!(un==="application/xhtml+xml"&&Gn[_.namespaceURI]):!1},vt=function(_){Mr(t.removed,{element:_});try{A(_).removeChild(_)}catch(C){$(_)}},yt=function(_,C){try{Mr(t.removed,{attribute:C.getAttributeNode(_),from:C})}catch(O){Mr(t.removed,{attribute:null,from:C})}if(C.removeAttribute(_),_==="is")if(F||re)try{vt(C)}catch(O){}else try{C.setAttribute(_,"")}catch(O){}},hs=function(_){let C=null,O=null;if(cn)_="<remove></remove>"+_;else{const Ee=ci(_,/^[\r\n\t ]+/);O=Ee&&Ee[0]}un==="application/xhtml+xml"&&Pn===zt&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const de=T?T.createHTML(_):_;if(Pn===zt)try{C=new m().parseFromString(de,un)}catch(Ee){}if(!C||!C.documentElement){C=q.createDocument(Pn,"template",null);try{C.documentElement.innerHTML=Bn?L:de}catch(Ee){}}const Ze=C.body||C.documentElement;return _&&O&&Ze.insertBefore(n.createTextNode(O),Ze.childNodes[0]||null),Pn===zt?je.call(C,bt?"html":"body")[0]:bt?C.documentElement:Ze},so=function(_){return H.call(_.ownerDocument||_,_,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},io=function(_){return _ instanceof g&&(typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||!(_.attributes instanceof h)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function")},fs=function(_){return typeof d=="function"&&_ instanceof d};function Nt(Z,_,C){Mo(Z,O=>{O.call(t,_,C,Rn)})}const gs=function(_){let C=null;if(Nt(ee.beforeSanitizeElements,_,null),io(_))return vt(_),!0;const O=he(_.nodeName);if(Nt(ee.uponSanitizeElement,_,{tagName:O,allowedTags:ye}),Xt&&_.hasChildNodes()&&!fs(_.firstElementChild)&&Xe(/<[/\w!]/g,_.innerHTML)&&Xe(/<[/\w!]/g,_.textContent)||_.nodeType===qr.progressingInstruction||Xt&&_.nodeType===qr.comment&&Xe(/<[/\w]/g,_.data))return vt(_),!0;if(!(Rt.tagCheck instanceof Function&&Rt.tagCheck(O))&&(!ye[O]||Le[O])){if(!Le[O]&&bs(O)&&(le.tagNameCheck instanceof RegExp&&Xe(le.tagNameCheck,O)||le.tagNameCheck instanceof Function&&le.tagNameCheck(O)))return!1;if(Cn&&!ue[O]){const de=A(_)||_.parentNode,Ze=j(_)||_.childNodes;if(Ze&&de){const Ee=Ze.length;for(let Je=Ee-1;Je>=0;--Je){const Dt=S(Ze[Je],!0);Dt.__removalCount=(_.__removalCount||0)+1,de.insertBefore(Dt,E(_))}}}return vt(_),!0}return _ instanceof l&&!Di(_)||(O==="noscript"||O==="noembed"||O==="noframes")&&Xe(/<\/no(script|embed|frames)/i,_.innerHTML)?(vt(_),!0):(Ne&&_.nodeType===qr.text&&(C=_.textContent,Mo([Se,at,At],de=>{C=Ur(C,de," ")}),_.textContent!==C&&(Mr(t.removed,{element:_.cloneNode()}),_.textContent=C)),Nt(ee.afterSanitizeElements,_,null),!1)},ms=function(_,C,O){if(rt&&(C==="id"||C==="name")&&(O in n||O in ds))return!1;if(!(Pe&&!En[C]&&Xe(vr,C))){if(!(Te&&Xe(Jt,C))){if(!(Rt.attributeCheck instanceof Function&&Rt.attributeCheck(C,_))){if(!ge[C]||En[C]){if(!(bs(_)&&(le.tagNameCheck instanceof RegExp&&Xe(le.tagNameCheck,_)||le.tagNameCheck instanceof Function&&le.tagNameCheck(_))&&(le.attributeNameCheck instanceof RegExp&&Xe(le.attributeNameCheck,C)||le.attributeNameCheck instanceof Function&&le.attributeNameCheck(C,_))||C==="is"&&le.allowCustomizedBuiltInElements&&(le.tagNameCheck instanceof RegExp&&Xe(le.tagNameCheck,O)||le.tagNameCheck instanceof Function&&le.tagNameCheck(O))))return!1}else if(!ot[C]){if(!Xe(an,Ur(O,yr,""))){if(!((C==="src"||C==="xlink:href"||C==="href")&&_!=="script"&&cb(O,"data:")===0&&X[_])){if(!(Fn&&!Xe(Ct,Ur(O,yr,"")))){if(O)return!1}}}}}}}return!0},bs=function(_){return _!=="annotation-xml"&&ci(_,Yt)},ao=function(_){Nt(ee.beforeSanitizeAttributes,_,null);const{attributes:C}=_;if(!C||io(_))return;const O={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ge,forceKeepAttr:void 0};let de=C.length;for(;de--;){const Ze=C[de],{name:Ee,namespaceURI:Je,value:Dt}=Ze,Qt=he(Ee),co=Dt;let Me=Ee==="value"?co:lb(co);if(O.attrName=Qt,O.attrValue=Me,O.keepAttr=!0,O.forceKeepAttr=void 0,Nt(ee.uponSanitizeAttribute,_,O),Me=O.attrValue,_t&&(Qt==="id"||Qt==="name")&&(yt(Ee,_),Me=Lt+Me),Xt&&Xe(/((--!?|])>)|<\/(style|title|textarea)/i,Me)){yt(Ee,_);continue}if(Qt==="attributename"&&ci(Me,"href")){yt(Ee,_);continue}if(O.forceKeepAttr)continue;if(!O.keepAttr){yt(Ee,_);continue}if(!An&&Xe(/\/>/i,Me)){yt(Ee,_);continue}Ne&&Mo([Se,at,At],_s=>{Me=Ur(Me,_s," ")});const ks=he(_.nodeName);if(!ms(ks,Qt,Me)){yt(Ee,_);continue}if(T&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!Je)switch(k.getAttributeType(ks,Qt)){case"TrustedHTML":{Me=T.createHTML(Me);break}case"TrustedScriptURL":{Me=T.createScriptURL(Me);break}}if(Me!==co)try{Je?_.setAttributeNS(Je,Ee,Me):_.setAttribute(Ee,Me),io(_)?vt(_):Yc(t.removed)}catch(_s){yt(Ee,_)}}Nt(ee.afterSanitizeAttributes,_,null)},dn=function Z(_){let C=null;const O=so(_);for(Nt(ee.beforeSanitizeShadowDOM,_,null);C=O.nextNode();)Nt(ee.uponSanitizeShadowNode,C,null),gs(C),ao(C),C.content instanceof i&&Z(C.content);Nt(ee.afterSanitizeShadowDOM,_,null)};return t.sanitize=function(Z){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},C=null,O=null,de=null,Ze=null;if(Bn=!Z,Bn&&(Z="<!-->"),typeof Z!="string"&&!fs(Z))if(typeof Z.toString=="function"){if(Z=Z.toString(),typeof Z!="string")throw jr("dirty is not a string, aborting")}else throw jr("toString is not a function");if(!t.isSupported)return Z;if(kt||Tr(_),t.removed=[],typeof Z=="string"&&(Kt=!1),Kt){if(Z.nodeName){const Dt=he(Z.nodeName);if(!ye[Dt]||Le[Dt])throw jr("root node is forbidden and cannot be sanitized in-place")}}else if(Z instanceof d)C=hs("<!---->"),O=C.ownerDocument.importNode(Z,!0),O.nodeType===qr.element&&O.nodeName==="BODY"||O.nodeName==="HTML"?C=O:C.appendChild(O);else{if(!F&&!Ne&&!bt&&Z.indexOf("<")===-1)return T&&xe?T.createHTML(Z):Z;if(C=hs(Z),!C)return F?null:xe?L:""}C&&cn&&vt(C.firstChild);const Ee=so(Kt?Z:C);for(;de=Ee.nextNode();)gs(de),ao(de),de.content instanceof i&&dn(de.content);if(Kt)return Z;if(F){if(re)for(Ze=se.call(C.ownerDocument);C.firstChild;)Ze.appendChild(C.firstChild);else Ze=C;return(ge.shadowroot||ge.shadowrootmode)&&(Ze=nt.call(r,Ze,!0)),Ze}let Je=bt?C.outerHTML:C.innerHTML;return bt&&ye["!doctype"]&&C.ownerDocument&&C.ownerDocument.doctype&&C.ownerDocument.doctype.name&&Xe(tl,C.ownerDocument.doctype.name)&&(Je="<!DOCTYPE "+C.ownerDocument.doctype.name+`>
1643
+ `+Je),Ne&&Mo([Se,at,At],Dt=>{Je=Ur(Je,Dt," ")}),T&&xe?T.createHTML(Je):Je},t.setConfig=function(){let Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Tr(Z),kt=!0},t.clearConfig=function(){Rn=null,kt=!1},t.isValidAttribute=function(Z,_,C){Rn||Tr({});const O=he(Z),de=he(_);return ms(O,de,C)},t.addHook=function(Z,_){typeof _=="function"&&Mr(ee[Z],_)},t.removeHook=function(Z,_){if(_!==void 0){const C=ib(ee[Z],_);return C===-1?void 0:ab(ee[Z],C,1)[0]}return Yc(ee[Z])},t.removeHooks=function(Z){ee[Z]=[]},t.removeAllHooks=function(){ee=rl()},t}var Sb=ol();function sl(e){const t=ce.parse(e,{gfm:!0,breaks:!0,async:!1});return Sb.sanitize(t)}const il=1e3,Tb=32,al=15e3,Eb=new Set(["completed","failed","cancelled"]),Ab=4e3;let I=null,Hr=null,Fr=null,Ft=null,Fe=null,hi=null,Zo=null,fi=!1,qo=null,Br=null,G={kind:"connecting"},cr=[],lt=!0,lr=null,ve=null,ur=null,tn=null,Gr=-1,Qe=null,nn=!1,rn=null,Nn=new Set;function gi(){Fo(),wc(),Ft&&clearInterval(Ft),Ft=null,rn==null||rn(),rn=null,Fe==null||Fe.destroy(),Fe=null,I&&Ut(I),I==null||I.remove(),I=null,Hr==null||Hr(),Hr=null,Fr==null||Fr(),Fr=null,hi=null,G={kind:"connecting"},cr=[],lt=!0,lr=null,ve=null,ur=null,tn=null,Zo=null,Gr=-1,Qe=null,nn=!1,Nn=new Set}function mi(e,t,n,r,o){I&&gi(),hi=o!=null?o:null,G={kind:"connecting"},cr=[],lt=!0,lr=null,Gr=-1,Qe=null,nn=!1,Nn=new Set,ve=e,ur=n,tn=t,Zo=r,yc({taskId:e,backendUrl:n,title:r}),I=document.createElement("div"),I.className="ap-sdk-panel",I.setAttribute("data-ap-sdk","1"),I.setAttribute("role","dialog"),I.setAttribute("aria-modal","true"),I.setAttribute("aria-label","Automation in progress");const i=r.length>55?`${r.slice(0,52)}…`:r;I.innerHTML=`
1584
1644
  <div class="ap-sdk-panel__header">
1585
1645
  <span class="ap-sdk-panel__title">
1586
1646
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1593,7 +1653,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
1593
1653
  <div class="ap-sdk-runner__meta">
1594
1654
  <div class="ap-sdk-runner__meta-row">
1595
1655
  <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--automate">Automate</span>
1596
- <span class="ap-sdk-runner__title" title="${cb(r)}">${ri(i)}</span>
1656
+ <span class="ap-sdk-runner__title" title="${Ub(r)}">${ki(i)}</span>
1597
1657
  </div>
1598
1658
  <div class="ap-sdk-runner__meta-row ap-sdk-runner__meta-row--controls">
1599
1659
  <span class="ap-sdk-runner__counter" data-ap-runner-counter>0 actions</span>
@@ -1623,17 +1683,17 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
1623
1683
  </div>
1624
1684
  <div class="ap-sdk-runner__hint" data-ap-runner-hint>Closing keeps the task running — resume anytime from My Captures.</div>
1625
1685
  <div class="ap-sdk-panel__status" data-ap-runner-summary style="display:none"></div>
1626
- `,L.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),L.addEventListener("touchmove",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild(L),Fe=hs(),Wt(L),zs(L,Is),L.querySelector("[data-ap-close]").addEventListener("click",()=>{ei(),o==null||o()}),L.querySelector("[data-ap-runner-chat-form]").addEventListener("submit",a=>{a.preventDefault(),Qm(t,e)}),L.querySelector("[data-ap-runner-cancel]").addEventListener("click",a=>{a.stopPropagation();const d=a.currentTarget;if(!Qs){Qs=!0,d.textContent="Confirm",Co=setTimeout(Ro,Vm),zr=u=>{u.target!==d&&Ro()},document.addEventListener("click",zr,!0);return}Ro(),Xm(t,e)}),L.querySelector("[data-ap-runner-scroll-toggle]").addEventListener("click",()=>{pt=!pt,pt&&jc(),Po()}),L.querySelector("[data-ap-runner-scroll-jump]").addEventListener("click",()=>{pt=!0,jc(),Po()}),L.querySelector("[data-ap-runner-log]").addEventListener("scroll",()=>{if(!pt||!L)return;const a=L.querySelector("[data-ap-runner-log]");a.scrollHeight-a.scrollTop-a.clientHeight>Jm&&(pt=!1,Po())}),ni(),Zc(e,t)}function jc(){const e=L==null?void 0:L.querySelector("[data-ap-runner-log]");e&&(e.scrollTop=e.scrollHeight)}function Po(){if(!L)return;const e=L.querySelector("[data-ap-runner-scroll-toggle]");e&&(e.textContent=pt?"Auto ↓":"Manual",e.title=pt?"Disable auto-scroll":"Enable auto-scroll",e.classList.toggle("ap-sdk-runner__scroll-toggle--active",pt))}function Zc(e,t){const n=d=>I(null,null,function*(){if(_e!==e||!L||F.kind!=="idle"&&F.kind!=="connecting"||Rn.has(d.commandId))return;Rn.add(d.commandId);const u={id:d.commandId,taskId:d.taskId,action:d.action,selector:d.selector,value:d.value,description:d.description,status:"pending",createdAt:new Date().toISOString()};Ln({kind:"executing",command:u,actionsRun:F.kind==="idle"?F.actionsRun:0}),yield Hc(u,t,e)}),r=d=>{if(!(_e!==e||!L)&&Ym.has(d)){if(F.kind==="executing")Ln({kind:"finishing",status:d,actionsRun:F.actionsRun});else if(F.kind==="connecting"||F.kind==="idle"){const u=F.kind==="idle"?F.actionsRun:0;Ln({kind:"finished",status:d,actionsRun:u})}}},o=d=>{_e!==e||!L||(d.outputChunk&&Fc([d.outputChunk]),r(d.status))},i=()=>I(null,null,function*(){var d;if(!(_e!==e||!L))try{const u=yield bo(t,e);_e===e&&L&&(rt=(d=u[0])!=null?d:null,In())}catch(u){}}),a=()=>I(null,null,function*(){var d;try{const[u,p,h,g]=yield Promise.all([Va(t,e),pg(t,e),bo(t,e),ug(t,e)]);if(_e!==e||!L)return;Fc(p),rt=(d=h[0])!=null?d:null,In(),r(u.status),g&&g.status==="pending"&&(F.kind==="idle"||F.kind==="connecting")&&!Rn.has(g.id)?(Rn.add(g.id),Ln({kind:"executing",command:g,actionsRun:F.kind==="idle"?F.actionsRun:0}),yield Hc(g,t,e)):F.kind==="connecting"&&Ln({kind:"idle",actionsRun:0})}catch(u){}});a(),xg(t,e,{onStatusUpdate:o,onInteractionCreated:i,onInteractionAnswered:i,onBrowserCommandCreated:n,onReconnect:()=>{a()}}).then(d=>{if(_e!==e||F.kind==="finished"){d();return}Kt=d})}function Ln(e){F=e,F.kind==="idle"&&nr===null&&(nr=Date.now(),Lo(),jt=setInterval(Lo,Mc)),F.kind==="finished"&&(jt&&(clearInterval(jt),jt=null),Kt==null||Kt(),Kt=null,Fe==null||Fe.hide(),nc()),ni()}function Ro(){Qs=!1,Co&&(clearTimeout(Co),Co=null),zr&&(document.removeEventListener("click",zr,!0),zr=null);const e=L==null?void 0:L.querySelector("[data-ap-runner-cancel]");e&&(e.textContent="Cancel task")}function Xm(e,t){return I(this,null,function*(){if(_e!==t||!L)return;const n=L.querySelector("[data-ap-runner-cancel]");n&&(n.disabled=!0);try{yield fg(e,t)}catch(r){n&&(n.disabled=!1)}})}function qc(){if(!_e||!Vt||!rr||!Ao)return;const e=_e,t=Vt;tc({taskId:e,backendUrl:rr,title:Ao}),jt&&clearInterval(jt),Lo(),jt=setInterval(Lo,Mc);const n=F.kind==="finished"?F.actionsRun:0;Rn=new Set,F={kind:"idle",actionsRun:n},ni(),Zc(e,t)}function ni(){if(!L)return;const e=L.querySelector("[data-ap-runner-status]"),t=L.querySelector("[data-ap-runner-counter]"),n=L.querySelector("[data-ap-runner-log]"),r=L.querySelector("[data-ap-runner-hint]");if(!e||!t||!n||!r)return;const o="actionsRun"in F?F.actionsRun:0;t.textContent=`${o} action${o===1?"":"s"}`,Po(),F.kind==="finished"?(e.textContent=F.status.replace(/_/g," "),e.className=`ap-sdk-status-badge ap-sdk-status-badge--${F.status.replace(/_/g,"-")}`,r.style.display="none",ib(F.status)):(e.textContent="running",e.className="ap-sdk-status-badge ap-sdk-status-badge--in-progress",r.style.display="block");const i=n.querySelector("[data-ap-runner-placeholder]");if(tr.length===0&&(F.kind==="connecting"||F.kind==="idle")){if(!i){const h=document.createElement("div");h.className="ap-sdk-runner__placeholder",h.setAttribute("data-ap-runner-placeholder","1"),h.textContent="Waiting for the agent's first action…",n.appendChild(h)}}else i==null||i.remove();In();const a=L.querySelector("[data-ap-runner-chat-input]"),d=L.querySelector("[data-ap-runner-chat-send]");if(a&&d){const h=F.kind==="finished"&&F.status==="failed";a.disabled=h,d.disabled=h||Xt,h&&(a.placeholder="This task failed — start a new automation to continue.")}const u=L.querySelector("[data-ap-runner-cancel]");u&&(u.style.display=F.kind==="finished"?"none":"");const p=L.querySelector("[data-ap-runner-summary]");p&&F.kind!=="finished"&&(p.style.display="none",p.innerHTML="")}function In(){var o;if(!L)return;const e=L.querySelector("[data-ap-runner-question]"),t=L.querySelector("[data-ap-runner-chat-input]");if(!e||!t)return;if(!rt){e.style.display="none",e.innerHTML="",t.placeholder="Send a message to the agent…";return}const n=rt.questionMetadata,r=(o=n==null?void 0:n.options)!=null?o:[];if(t.placeholder="Type your answer…",e.style.display="block",e.innerHTML=`
1627
- <div class="ap-sdk-runner__question-label">${ri((n==null?void 0:n.header)||"The agent has a question")}</div>
1628
- <div class="ap-sdk-runner__question-text ap-sdk-markdown">${Dc((n==null?void 0:n.question)||rt.question)}</div>
1686
+ `,I.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),I.addEventListener("touchmove",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild(I),Fe=Es(),Mt(I),Hr=Js(I,Ws),Fr=$r(I,Ir),I.querySelector("[data-ap-close]").addEventListener("click",()=>{gi(),o==null||o()}),I.querySelector("[data-ap-runner-chat-form]").addEventListener("submit",a=>{a.preventDefault(),Rb(t,e)}),I.querySelector("[data-ap-runner-cancel]").addEventListener("click",a=>{a.stopPropagation();const d=a.currentTarget;if(!fi){fi=!0,d.textContent="Confirm",qo=setTimeout(Fo,Ab),Br=l=>{l.target!==d&&Fo()},document.addEventListener("click",Br,!0);return}Fo(),Cb(t,e)}),I.querySelector("[data-ap-runner-scroll-toggle]").addEventListener("click",()=>{lt=!lt,lt&&cl(),Ho()}),I.querySelector("[data-ap-runner-scroll-jump]").addEventListener("click",()=>{lt=!0,cl(),Ho()}),I.querySelector("[data-ap-runner-log]").addEventListener("scroll",()=>{if(!lt||!I)return;const a=I.querySelector("[data-ap-runner-log]");a.scrollHeight-a.scrollTop-a.clientHeight>Tb&&(lt=!1,Ho())}),bi(),ll(e,t)}function cl(){const e=I==null?void 0:I.querySelector("[data-ap-runner-log]");e&&(e.scrollTop=e.scrollHeight)}function Ho(){if(!I)return;const e=I.querySelector("[data-ap-runner-scroll-toggle]");e&&(e.textContent=lt?"Auto ↓":"Manual",e.title=lt?"Disable auto-scroll":"Enable auto-scroll",e.classList.toggle("ap-sdk-runner__scroll-toggle--active",lt))}function ll(e,t){const n=d=>z(null,null,function*(){if(ve!==e||!I||G.kind!=="idle"&&G.kind!=="connecting"||Nn.has(d.commandId))return;Nn.add(d.commandId);const l={id:d.commandId,taskId:d.taskId,action:d.action,selector:d.selector,value:d.value,description:d.description,status:"pending",createdAt:new Date().toISOString()};Dn({kind:"executing",command:l,actionsRun:G.kind==="idle"?G.actionsRun:0}),yield dl(l,t,e)}),r=d=>{if(!(ve!==e||!I)&&Eb.has(d)){if(G.kind==="executing")Dn({kind:"finishing",status:d,actionsRun:G.actionsRun});else if(G.kind==="connecting"||G.kind==="idle"){const l=G.kind==="idle"?G.actionsRun:0;Dn({kind:"finished",status:d,actionsRun:l})}}},o=d=>{ve!==e||!I||(d.outputChunk&&pl([d.outputChunk]),r(d.status))},i=()=>z(null,null,function*(){var d;if(!(ve!==e||!I))try{const l=yield Lo(t,e);ve===e&&I&&(Qe=(d=l[0])!=null?d:null,Mn())}catch(l){}}),a=()=>z(null,null,function*(){var d;try{const[l,p,h,g]=yield Promise.all([mc(t,e),Zg(t,e),Lo(t,e),Ug(t,e)]);if(ve!==e||!I)return;pl(p),Qe=(d=h[0])!=null?d:null,Mn(),r(l.status),g&&g.status==="pending"&&(G.kind==="idle"||G.kind==="connecting")&&!Nn.has(g.id)?(Nn.add(g.id),Dn({kind:"executing",command:g,actionsRun:G.kind==="idle"?G.actionsRun:0}),yield dl(g,t,e)):G.kind==="connecting"&&Dn({kind:"idle",actionsRun:0})}catch(l){}});a(),Kg(t,e,{onStatusUpdate:o,onInteractionCreated:i,onInteractionAnswered:i,onBrowserCommandCreated:n,onReconnect:()=>{a()}}).then(d=>{if(ve!==e||G.kind==="finished"){d();return}rn=d})}function Dn(e){G=e,G.kind==="idle"&&lr===null&&(lr=Date.now(),Bo(),Ft=setInterval(Bo,il)),G.kind==="finished"&&(Ft&&(clearInterval(Ft),Ft=null),rn==null||rn(),rn=null,Fe==null||Fe.hide(),wc()),bi()}function Fo(){fi=!1,qo&&(clearTimeout(qo),qo=null),Br&&(document.removeEventListener("click",Br,!0),Br=null);const e=I==null?void 0:I.querySelector("[data-ap-runner-cancel]");e&&(e.textContent="Cancel task")}function Cb(e,t){return z(this,null,function*(){if(ve!==t||!I)return;const n=I.querySelector("[data-ap-runner-cancel]");n&&(n.disabled=!0);try{yield Hg(e,t)}catch(r){n&&(n.disabled=!1)}})}function ul(){if(!ve||!tn||!ur||!Zo)return;const e=ve,t=tn;yc({taskId:e,backendUrl:ur,title:Zo}),Ft&&clearInterval(Ft),Bo(),Ft=setInterval(Bo,il);const n=G.kind==="finished"?G.actionsRun:0;Nn=new Set,G={kind:"idle",actionsRun:n},bi(),ll(e,t)}function bi(){if(!I)return;const e=I.querySelector("[data-ap-runner-status]"),t=I.querySelector("[data-ap-runner-counter]"),n=I.querySelector("[data-ap-runner-log]"),r=I.querySelector("[data-ap-runner-hint]");if(!e||!t||!n||!r)return;const o="actionsRun"in G?G.actionsRun:0;t.textContent=`${o} action${o===1?"":"s"}`,Ho(),G.kind==="finished"?(e.textContent=G.status.replace(/_/g," "),e.className=`ap-sdk-status-badge ap-sdk-status-badge--${G.status.replace(/_/g,"-")}`,r.style.display="none",Db(G.status)):(e.textContent="running",e.className="ap-sdk-status-badge ap-sdk-status-badge--in-progress",r.style.display="block");const i=n.querySelector("[data-ap-runner-placeholder]");if(cr.length===0&&(G.kind==="connecting"||G.kind==="idle")){if(!i){const h=document.createElement("div");h.className="ap-sdk-runner__placeholder",h.setAttribute("data-ap-runner-placeholder","1"),h.textContent="Waiting for the agent's first action…",n.appendChild(h)}}else i==null||i.remove();Mn();const a=I.querySelector("[data-ap-runner-chat-input]"),d=I.querySelector("[data-ap-runner-chat-send]");if(a&&d){const h=G.kind==="finished"&&G.status==="failed";a.disabled=h,d.disabled=h||nn,h&&(a.placeholder="This task failed — start a new automation to continue.")}const l=I.querySelector("[data-ap-runner-cancel]");l&&(l.style.display=G.kind==="finished"?"none":"");const p=I.querySelector("[data-ap-runner-summary]");p&&G.kind!=="finished"&&(p.style.display="none",p.innerHTML="")}function Mn(){var o;if(!I)return;const e=I.querySelector("[data-ap-runner-question]"),t=I.querySelector("[data-ap-runner-chat-input]");if(!e||!t)return;if(!Qe){e.style.display="none",e.innerHTML="",t.placeholder="Send a message to the agent…";return}const n=Qe.questionMetadata,r=(o=n==null?void 0:n.options)!=null?o:[];if(t.placeholder="Type your answer…",e.style.display="block",e.innerHTML=`
1687
+ <div class="ap-sdk-runner__question-label">${ki((n==null?void 0:n.header)||"The agent has a question")}</div>
1688
+ <div class="ap-sdk-runner__question-text ap-sdk-markdown">${sl((n==null?void 0:n.question)||Qe.question)}</div>
1629
1689
  ${r.length>0?'<div class="ap-sdk-runner__question-options" data-ap-runner-question-options></div>':""}
1630
- `,r.length>0){const i=e.querySelector("[data-ap-runner-question-options]");for(const a of r){const d=document.createElement("button");d.type="button",d.className="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-runner__question-option",d.textContent=a.label,d.addEventListener("click",()=>void Km(a.label)),i.appendChild(d)}}}function Km(e){return I(this,null,function*(){var r;if(!L||!rt||!_e||Xt)return;const t=_e,n=Vt;if(n){Xt=!0;try{const o={selectedOption:e};yield Qa(n,t,rt.id,o),rt=null,In();const i=yield bo(n,t);_e===t&&L&&(rt=(r=i[0])!=null?r:null,In())}catch(o){const i=L.querySelector("[data-ap-runner-chat-error]");i&&(i.textContent="Failed to send your answer — try again.",i.style.display="block")}finally{Xt=!1}}})}function Lo(){if(!L||nr===null)return;const e=L.querySelector("[data-ap-runner-timer]");if(!e)return;const t=Math.max(0,Math.floor((Date.now()-nr)/1e3)),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");e.textContent=`${n}:${r}`}function Hc(e,t,n){return I(this,null,function*(){let r="done",o;try{if(e.action==="getContext"){const a=e.selector?document.querySelector(e.selector):document.body;if(!a)throw new Error(`element not found (${e.selector})`);Fe==null||Fe.update(a),o=tb(a)}else{if(!e.selector)throw new Error(`${e.action} command is missing a selector`);const a=document.querySelector(e.selector);if(!a)throw new Error(`element not found (${e.selector})`);if(Fe==null||Fe.update(a),e.action==="click")yield Tg(a),o="Clicked";else{if(e.value===void 0)throw new Error("inputText command is missing a value");nb(a,e.value),o="Entered text"}}}catch(a){r="error",o=a instanceof Error?a.message:"Unknown error executing command"}if(_e===n&&L&&rb(r,e,o),yield eb(t,n,e.id,r,o),_e!==n||!L)return;Fe==null||Fe.hide();const i=(F.kind==="executing"||F.kind==="finishing"?F.actionsRun:0)+1;F.kind==="finishing"?Ln({kind:"finished",status:F.status,actionsRun:i}):F.kind==="executing"&&Ln({kind:"idle",actionsRun:i})})}function Qm(e,t){return I(this,null,function*(){var a;if(!L||Xt||F.kind==="finished"&&F.status==="failed")return;const n=L.querySelector("[data-ap-runner-chat-input]"),r=L.querySelector("[data-ap-runner-chat-error]"),o=L.querySelector("[data-ap-runner-chat-send]");if(!n||!r||!o)return;const i=n.value.trim();if(i){Xt=!0,o.disabled=!0,r.style.display="none";try{if(rt){yield Qa(e,t,rt.id,i),rt=null,In();try{const d=yield bo(e,t);_e===t&&L&&(rt=(a=d[0])!=null?a:null,In())}catch(d){}}else yield hg(e,t,i),F.kind==="finished"&&qc();n.value=""}catch(d){r.textContent=d instanceof Error?d.message:"Failed to send — try again.",r.style.display="block"}finally{Xt=!1,o.disabled=!1}}})}function eb(e,t,n,r,o){return I(this,null,function*(){try{yield dg(e,t,n,r,o)}catch(i){}})}function tb(e){const t=e.cloneNode(!0);t.querySelectorAll("script, style, noscript").forEach(o=>o.remove()),Mi(t);let n=t.outerHTML,r=!1;return n.length>Uc&&(n=n.slice(0,Uc),r=!0),`URL: ${location.href}
1690
+ `,r.length>0){const i=e.querySelector("[data-ap-runner-question-options]");for(const a of r){const d=document.createElement("button");d.type="button",d.className="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-runner__question-option",d.textContent=a.label,d.addEventListener("click",()=>void Pb(a.label)),i.appendChild(d)}}}function Pb(e){return z(this,null,function*(){var r;if(!I||!Qe||!ve||nn)return;const t=ve,n=tn;if(n){nn=!0;try{const o={selectedOption:e};yield _c(n,t,Qe.id,o),Qe=null,Mn();const i=yield Lo(n,t);ve===t&&I&&(Qe=(r=i[0])!=null?r:null,Mn())}catch(o){const i=I.querySelector("[data-ap-runner-chat-error]");i&&(i.textContent="Failed to send your answer — try again.",i.style.display="block")}finally{nn=!1}}})}function Bo(){if(!I||lr===null)return;const e=I.querySelector("[data-ap-runner-timer]");if(!e)return;const t=Math.max(0,Math.floor((Date.now()-lr)/1e3)),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");e.textContent=`${n}:${r}`}function dl(e,t,n){return z(this,null,function*(){let r="done",o;try{if(e.action==="getContext"){const a=e.selector?document.querySelector(e.selector):document.body;if(!a)throw new Error(`element not found (${e.selector})`);Fe==null||Fe.update(a),o=Ib(a)}else{if(!e.selector)throw new Error(`${e.action} command is missing a selector`);const a=document.querySelector(e.selector);if(!a)throw new Error(`element not found (${e.selector})`);if(Fe==null||Fe.update(a),e.action==="click")yield em(a),o="Clicked";else{if(e.value===void 0)throw new Error("inputText command is missing a value");$b(a,e.value),o="Entered text"}}}catch(a){r="error",o=a instanceof Error?a.message:"Unknown error executing command"}if(ve===n&&I&&zb(r,e,o),yield Lb(t,n,e.id,r,o),ve!==n||!I)return;Fe==null||Fe.hide();const i=(G.kind==="executing"||G.kind==="finishing"?G.actionsRun:0)+1;G.kind==="finishing"?Dn({kind:"finished",status:G.status,actionsRun:i}):G.kind==="executing"&&Dn({kind:"idle",actionsRun:i})})}function Rb(e,t){return z(this,null,function*(){var a;if(!I||nn||G.kind==="finished"&&G.status==="failed")return;const n=I.querySelector("[data-ap-runner-chat-input]"),r=I.querySelector("[data-ap-runner-chat-error]"),o=I.querySelector("[data-ap-runner-chat-send]");if(!n||!r||!o)return;const i=n.value.trim();if(i){nn=!0,o.disabled=!0,r.style.display="none";try{if(Qe){yield _c(e,t,Qe.id,i),Qe=null,Mn();try{const d=yield Lo(e,t);ve===t&&I&&(Qe=(a=d[0])!=null?a:null,Mn())}catch(d){}}else yield qg(e,t,i),G.kind==="finished"&&ul();n.value=""}catch(d){r.textContent=d instanceof Error?d.message:"Failed to send — try again.",r.style.display="block"}finally{nn=!1,o.disabled=!1}}})}function Lb(e,t,n,r,o){return z(this,null,function*(){try{yield jg(e,t,n,r,o)}catch(i){}})}function Ib(e){const t=e.cloneNode(!0);t.querySelectorAll("script, style, noscript").forEach(o=>o.remove()),ra(t),na(t);let n=t.outerHTML,r=!1;return n.length>al&&(n=n.slice(0,al),r=!0),`URL: ${location.href}
1631
1691
  Title: ${document.title}
1632
1692
 
1633
1693
  ${n}${r?`
1634
- … (truncated)`:""}`}function nb(e,t){var i;const r=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,o=(i=Object.getOwnPropertyDescriptor(r,"value"))==null?void 0:i.set;if(!o)throw new Error("target element does not accept text input");o.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function rb(e,t,n){var h,g;const r=e==="done"?"✓":"✗",o=t.selector?` \`${t.selector}\``:"",i=t.description||`${t.action}${o}`,a=e==="done"&&t.action==="getContext"?`read context (${(h=n==null?void 0:n.length)!=null?h:0} chars)`:n,d=a?` — ${a}`:"";if(tr.push({status:e,text:`${r} ${i}${d}`}),!L)return;const u=L.querySelector("[data-ap-runner-log]");if(!u)return;(g=u.querySelector("[data-ap-runner-placeholder]"))==null||g.remove();const p=document.createElement("div");p.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--${e}`,p.textContent=tr[tr.length-1].text,u.appendChild(p),pt&&(u.scrollTop=u.scrollHeight)}function ob(e){var t,n;return(n=(t=e.display)==null?void 0:t.variant)!=null?n:e.sdkEventType}function sb(e){const t=ob(e);return(e.stream==="stdout"||e.stream==="stderr"||e.stream==="sdk_event"&&(t==="text"||t==="thinking"))&&e.data.trim()||null}function Fc(e){var r;const t=e.filter(o=>o.sequence>$r).sort((o,i)=>o.sequence-i.sequence);if(t.length===0||($r=Math.max($r,...t.map(o=>o.sequence)),!L))return;const n=L.querySelector("[data-ap-runner-log]");if(n)for(const o of t){const i=sb(o);if(!i)continue;(r=n.querySelector("[data-ap-runner-placeholder]"))==null||r.remove();const a=document.createElement("div");a.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--output ap-sdk-runner__log-entry--${o.stream}`,o.stream==="sdk_event"?(a.classList.add("ap-sdk-markdown"),a.innerHTML=Dc(i)):a.textContent=i,n.appendChild(a),pt&&(n.scrollTop=n.scrollHeight)}}function ib(e){if(!L||!_e||!rr)return;const t=L.querySelector("[data-ap-runner-summary]");if(!t)return;const n=`${rr.replace(/\/+$/,"")}/tasks/${_e}`,r=e==="completed"?"Automation complete!":"Automation ended",o=e==="completed",i=o?"ap-sdk-panel__btn--secondary":"ap-sdk-panel__btn--primary";t.style.display="block",t.innerHTML=`
1694
+ … (truncated)`:""}`}function $b(e,t){var i;const r=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,o=(i=Object.getOwnPropertyDescriptor(r,"value"))==null?void 0:i.set;if(!o)throw new Error("target element does not accept text input");o.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function zb(e,t,n){var h,g;const r=e==="done"?"✓":"✗",o=t.selector?` \`${t.selector}\``:"",i=t.description||`${t.action}${o}`,a=e==="done"&&t.action==="getContext"?`read context (${(h=n==null?void 0:n.length)!=null?h:0} chars)`:n,d=a?` — ${a}`:"";if(cr.push({status:e,text:`${r} ${i}${d}`}),!I)return;const l=I.querySelector("[data-ap-runner-log]");if(!l)return;(g=l.querySelector("[data-ap-runner-placeholder]"))==null||g.remove();const p=document.createElement("div");p.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--${e}`,p.textContent=cr[cr.length-1].text,l.appendChild(p),lt&&(l.scrollTop=l.scrollHeight)}function Ob(e){var t,n;return(n=(t=e.display)==null?void 0:t.variant)!=null?n:e.sdkEventType}function Nb(e){const t=Ob(e);return(e.stream==="stdout"||e.stream==="stderr"||e.stream==="sdk_event"&&(t==="text"||t==="thinking"))&&e.data.trim()||null}function pl(e){var r;const t=e.filter(o=>o.sequence>Gr).sort((o,i)=>o.sequence-i.sequence);if(t.length===0||(Gr=Math.max(Gr,...t.map(o=>o.sequence)),!I))return;const n=I.querySelector("[data-ap-runner-log]");if(n)for(const o of t){const i=Nb(o);if(!i)continue;(r=n.querySelector("[data-ap-runner-placeholder]"))==null||r.remove();const a=document.createElement("div");a.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--output ap-sdk-runner__log-entry--${o.stream}`,o.stream==="sdk_event"?(a.classList.add("ap-sdk-markdown"),a.innerHTML=sl(i)):a.textContent=i,n.appendChild(a),lt&&(n.scrollTop=n.scrollHeight)}}function Db(e){if(!I||!ve||!ur)return;const t=I.querySelector("[data-ap-runner-summary]");if(!t)return;const n=`${ur.replace(/\/+$/,"")}/tasks/${ve}`,r=e==="completed"?"Automation complete!":"Automation ended",o=e==="completed",i=o?"ap-sdk-panel__btn--secondary":"ap-sdk-panel__btn--primary";t.style.display="block",t.innerHTML=`
1635
1695
  <div class="ap-sdk-success-card">
1636
- <p class="ap-sdk-success-headline">${ri(r)}</p>
1696
+ <p class="ap-sdk-success-headline">${ki(r)}</p>
1637
1697
  ${o?`
1638
1698
  <div class="ap-sdk-runner__approval" data-ap-runner-approval>
1639
1699
  <div class="ap-sdk-runner__approval-actions">
@@ -1653,7 +1713,7 @@ ${n}${r?`
1653
1713
  <button class="ap-sdk-runner__text-btn" data-ap-runner-close>Close</button>
1654
1714
  </div>
1655
1715
  </div>
1656
- `,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const a=Ks;ei(),a==null||a()}),o&&ab(t)}function ab(e){const t=e.querySelector("[data-ap-runner-approve]"),n=e.querySelector("[data-ap-runner-reject]"),r=e.querySelector("[data-ap-runner-reject-form]"),o=e.querySelector("[data-ap-runner-reject-feedback]"),i=e.querySelector("[data-ap-runner-reject-submit]"),a=e.querySelector("[data-ap-runner-approval-error]"),d=e.querySelector(".ap-sdk-runner__approval-actions"),u=h=>{a.textContent=h,a.style.display="block"};t.addEventListener("click",()=>I(null,null,function*(){if(!_e||!Vt)return;const h=_e,g=Vt;t.disabled=!0,n.disabled=!0,a.style.display="none";try{yield gg(g,h),d.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--approved">✓ Approved</span>',r.style.display="none"}catch(m){t.disabled=!1,n.disabled=!1,u(m instanceof Error?m.message:"Failed to approve — try again.")}})),n.addEventListener("click",()=>{r.style.display=r.style.display==="none"?"block":"none",r.style.display==="block"&&o.focus()});const p=()=>{i.textContent=o.value.trim()?"Reject & Continue":"Reject Permanently"};o.addEventListener("input",p),i.addEventListener("click",()=>I(null,null,function*(){if(!_e||!Vt)return;const h=_e,g=Vt,m=o.value.trim();i.disabled=!0,t.disabled=!0,a.style.display="none",i.textContent="Rejecting…";try{yield mg(g,h,m),m?qc():(d.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--rejected">✕ Rejected</span>',r.style.display="none")}catch(k){i.disabled=!1,t.disabled=!1,p(),u(k instanceof Error?k.message:"Failed to reject — try again.")}}))}function cb(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ri(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function lb(e,t,n){const r=!!(t.backendUrl&&t.token),o=document.createElement("div");o.className="ap-sdk-advanced",o.innerHTML=`
1716
+ `,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const a=hi;gi(),a==null||a()}),o&&Mb(t)}function Mb(e){const t=e.querySelector("[data-ap-runner-approve]"),n=e.querySelector("[data-ap-runner-reject]"),r=e.querySelector("[data-ap-runner-reject-form]"),o=e.querySelector("[data-ap-runner-reject-feedback]"),i=e.querySelector("[data-ap-runner-reject-submit]"),a=e.querySelector("[data-ap-runner-approval-error]"),d=e.querySelector(".ap-sdk-runner__approval-actions"),l=h=>{a.textContent=h,a.style.display="block"};t.addEventListener("click",()=>z(null,null,function*(){if(!ve||!tn)return;const h=ve,g=tn;t.disabled=!0,n.disabled=!0,a.style.display="none";try{yield Fg(g,h),d.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--approved">✓ Approved</span>',r.style.display="none"}catch(m){t.disabled=!1,n.disabled=!1,l(m instanceof Error?m.message:"Failed to approve — try again.")}})),n.addEventListener("click",()=>{r.style.display=r.style.display==="none"?"block":"none",r.style.display==="block"&&o.focus()});const p=()=>{i.textContent=o.value.trim()?"Reject & Continue":"Reject Permanently"};o.addEventListener("input",p),i.addEventListener("click",()=>z(null,null,function*(){if(!ve||!tn)return;const h=ve,g=tn,m=o.value.trim();i.disabled=!0,t.disabled=!0,a.style.display="none",i.textContent="Rejecting…";try{yield Bg(g,h,m),m?ul():(d.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--rejected">✕ Rejected</span>',r.style.display="none")}catch(k){i.disabled=!1,t.disabled=!1,p(),l(k instanceof Error?k.message:"Failed to reject — try again.")}}))}function Ub(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ki(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function jb(e,t,n){const r=!!(t.backendUrl&&t.token),o=document.createElement("div");o.className="ap-sdk-advanced",o.innerHTML=`
1657
1717
  <details class="ap-sdk-advanced__details">
1658
1718
  <summary class="ap-sdk-advanced__summary">Advanced options</summary>
1659
1719
  <div class="ap-sdk-advanced__body">
@@ -1672,12 +1732,12 @@ ${n}${r?`
1672
1732
  </div>
1673
1733
  </div>
1674
1734
  </details>
1675
- `,e.appendChild(o);const i=o.querySelector("[data-ap-adv-template-field]"),a=o.querySelector("[data-ap-template]"),d=o.querySelector("[data-ap-quickmode]");let u=[];if(r){const p={backendUrl:t.backendUrl,token:t.token};ag(p,n!=null?n:void 0).then(h=>{var m,k;if(u=h,h.length===0){i.style.display="none";return}const g=(m=h.find(w=>w.isDefault&&w.scope==="project"))!=null?m:h.find(w=>w.isDefault&&w.scope==="global");a.innerHTML='<option value="">None (use default)</option>'+h.map(w=>`<option value="${ub(w.id)}">${db(w.name)}${w.isDefault?" (Default)":""}</option>`).join(""),a.value=(k=g==null?void 0:g.id)!=null?k:""}).catch(()=>{i.style.display="none"})}else{a.innerHTML='<option value="">None</option>',a.disabled=!0;const p=document.createElement("span");p.className="ap-sdk-advanced__hint",p.textContent="Connect credentials to enable template selection",i.appendChild(p)}return{getOptions(){var g,m,k,w,v,Z,K,U;const p=a.value||null,h=p?(m=(g=u.find(E=>E.id===p))==null?void 0:g.templateData)!=null?m:{}:{};return y(y(y(y(y(y(y(y(y(y({claudeTemplateId:p,quickMode:d.checked},h.modelOverride!=null?{modelOverride:h.modelOverride}:{}),h.claudeProfileId!=null?{claudeProfileId:h.claudeProfileId}:{}),h.effort!=null?{effort:h.effort}:{}),h.executionMode!=null?{executionMode:h.executionMode}:{}),(k=h.selectedPluginIds)!=null&&k.length?{selectedPluginIds:h.selectedPluginIds}:{}),(w=h.selectedSkillIds)!=null&&w.length?{selectedSkillIds:h.selectedSkillIds}:{}),(v=h.selectedPluginSkillIds)!=null&&v.length?{selectedPluginSkillIds:h.selectedPluginSkillIds}:{}),(Z=h.selectedMcpServerIds)!=null&&Z.length?{selectedMcpServerIds:h.selectedMcpServerIds}:{}),(K=h.selectedSlashCommandIds)!=null&&K.length?{selectedSlashCommandIds:h.selectedSlashCommandIds}:{}),(U=h.selectedRemoteContextProviderIds)!=null&&U.length?{selectedRemoteContextProviderIds:h.selectedRemoteContextProviderIds}:{})}}}function ub(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function db(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const oi="ap-sdk-captures",pb=50;function or(){try{const e=localStorage.getItem(oi);return e?JSON.parse(e):[]}catch(e){return[]}}function hb(e){const t=or(),n=[e,...t].slice(0,pb);try{localStorage.setItem(oi,JSON.stringify(n))}catch(r){}}function fb(){try{localStorage.removeItem(oi)}catch(e){}}function Bc(e){var a,d,u,p,h;if(e.id){const g=document.querySelector(`label[for="${CSS.escape(e.id)}"]`),m=(a=g==null?void 0:g.textContent)==null?void 0:a.trim();if(m)return m}const t=e.closest("label"),n=(d=t==null?void 0:t.textContent)==null?void 0:d.trim();if(n)return n;const r=(u=e.getAttribute("aria-label"))==null?void 0:u.trim();if(r)return r;const o=(p=e.placeholder)==null?void 0:p.trim();if(o)return o;const i=(h=e.getAttribute("name"))==null?void 0:h.trim();return i||e.tagName.toLowerCase()}function gb(e,t){return`Click "${e}" ${t.toLowerCase()}`}function Gc(e,t,n){return n?`Typed [redacted] into ${e}`:`Typed "${t}" into ${e}`}function Wc(e,t){return`Scrolled to (${e}, ${t})`}function mb(e,t){return t?`Pressed "${e}" in ${t}`:`Pressed "${e}"`}function Jc(e){return e.map((t,n)=>`${n+1}. ${t.description}`).join(`
1676
- `)}const bb=400,kb=new Set(["Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),_b=new Set(["Control","Meta","Alt","Shift"]);function vb(e){if(_b.has(e.key))return null;const t=[];return e.ctrlKey&&t.push("Ctrl"),e.metaKey&&t.push("Cmd"),e.altKey&&t.push("Alt"),t.length>0?(t.push(e.key.length===1?e.key.toUpperCase():e.key),t.join("+")):kb.has(e.key)?e.key:null}function yb(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?Bc(e):eo(e)||e.tagName.toLowerCase()}let sr=[],ot=null,Io=null,ct=null,Zt=null,qt=null;function Yc(){Io&&(Io.textContent=`● Recording — ${sr.length} step${sr.length===1?"":"s"}`)}function si(){qt&&(clearTimeout(qt),qt=null),Zt&&(sr.push(Zt),Zt=null,Yc())}function ii(e){si(),sr.push(e),Yc()}function wb(e){var t,n,r;return e instanceof HTMLSelectElement&&(r=(n=(t=e.selectedOptions[0])==null?void 0:t.textContent)==null?void 0:n.trim())!=null?r:e.value}function xb(e,t){ct&&ct(),sr=[],Zt=null,ot=document.createElement("div"),ot.className="ap-sdk-recorder-bar",ot.setAttribute("data-ap-sdk","1"),ot.innerHTML=`
1735
+ `,e.appendChild(o);const i=o.querySelector("[data-ap-adv-template-field]"),a=o.querySelector("[data-ap-template]"),d=o.querySelector("[data-ap-quickmode]");let l=[];if(r){const p={backendUrl:t.backendUrl,token:t.token};Ng(p,n!=null?n:void 0).then(h=>{var m,k;if(l=h,h.length===0){i.style.display="none";return}const g=(m=h.find(y=>y.isDefault&&y.scope==="project"))!=null?m:h.find(y=>y.isDefault&&y.scope==="global");a.innerHTML='<option value="">None (use default)</option>'+h.map(y=>`<option value="${Zb(y.id)}">${qb(y.name)}${y.isDefault?" (Default)":""}</option>`).join(""),a.value=(k=g==null?void 0:g.id)!=null?k:""}).catch(()=>{i.style.display="none"})}else{a.innerHTML='<option value="">None</option>',a.disabled=!0;const p=document.createElement("span");p.className="ap-sdk-advanced__hint",p.textContent="Connect credentials to enable template selection",i.appendChild(p)}return{getOptions(){var g,m,k,y,S,$,E,j;const p=a.value||null,h=p?(m=(g=l.find(A=>A.id===p))==null?void 0:g.templateData)!=null?m:{}:{};return v(v(v(v(v(v(v(v(v(v({claudeTemplateId:p,quickMode:d.checked},h.modelOverride!=null?{modelOverride:h.modelOverride}:{}),h.claudeProfileId!=null?{claudeProfileId:h.claudeProfileId}:{}),h.effort!=null?{effort:h.effort}:{}),h.executionMode!=null?{executionMode:h.executionMode}:{}),(k=h.selectedPluginIds)!=null&&k.length?{selectedPluginIds:h.selectedPluginIds}:{}),(y=h.selectedSkillIds)!=null&&y.length?{selectedSkillIds:h.selectedSkillIds}:{}),(S=h.selectedPluginSkillIds)!=null&&S.length?{selectedPluginSkillIds:h.selectedPluginSkillIds}:{}),($=h.selectedMcpServerIds)!=null&&$.length?{selectedMcpServerIds:h.selectedMcpServerIds}:{}),(E=h.selectedSlashCommandIds)!=null&&E.length?{selectedSlashCommandIds:h.selectedSlashCommandIds}:{}),(j=h.selectedRemoteContextProviderIds)!=null&&j.length?{selectedRemoteContextProviderIds:h.selectedRemoteContextProviderIds}:{})}}}function Zb(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function qb(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const _i="ap-sdk-captures",Hb=50;function dr(){try{const e=localStorage.getItem(_i);return e?JSON.parse(e):[]}catch(e){return[]}}function Fb(e){const t=dr(),n=[e,...t].slice(0,Hb);try{localStorage.setItem(_i,JSON.stringify(n))}catch(r){}}function Bb(){try{localStorage.removeItem(_i)}catch(e){}}function hl(e){var a,d,l,p,h;if(e.id){const g=document.querySelector(`label[for="${CSS.escape(e.id)}"]`),m=(a=g==null?void 0:g.textContent)==null?void 0:a.trim();if(m)return m}const t=e.closest("label"),n=(d=t==null?void 0:t.textContent)==null?void 0:d.trim();if(n)return n;const r=(l=e.getAttribute("aria-label"))==null?void 0:l.trim();if(r)return r;const o=(p=e.placeholder)==null?void 0:p.trim();if(o)return o;const i=(h=e.getAttribute("name"))==null?void 0:h.trim();return i||e.tagName.toLowerCase()}function Gb(e,t){return`Click "${e}" ${t.toLowerCase()}`}function fl(e,t,n){return n?`Typed [redacted] into ${e}`:`Typed "${t}" into ${e}`}function gl(e,t){return`Scrolled to (${e}, ${t})`}function Wb(e,t){return t?`Pressed "${e}" in ${t}`:`Pressed "${e}"`}function ml(e){return e.map((t,n)=>`${n+1}. ${t.description}`).join(`
1736
+ `)}const Jb=400,Yb=new Set(["Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),Vb=new Set(["Control","Meta","Alt","Shift"]);function Xb(e){if(Vb.has(e.key))return null;const t=[];return e.ctrlKey&&t.push("Ctrl"),e.metaKey&&t.push("Cmd"),e.altKey&&t.push("Alt"),t.length>0?(t.push(e.key.length===1?e.key.toUpperCase():e.key),t.join("+")):Yb.has(e.key)?e.key:null}function Kb(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?hl(e):go(e)||e.tagName.toLowerCase()}let pr=[],et=null,Go=null,it=null,Bt=null,Gt=null;function bl(){Go&&(Go.textContent=`● Recording — ${pr.length} step${pr.length===1?"":"s"}`)}function vi(){Gt&&(clearTimeout(Gt),Gt=null),Bt&&(pr.push(Bt),Bt=null,bl())}function yi(e){vi(),pr.push(e),bl()}function Qb(e){var t,n,r;return e instanceof HTMLSelectElement&&(r=(n=(t=e.selectedOptions[0])==null?void 0:t.textContent)==null?void 0:n.trim())!=null?r:e.value}function ek(e,t){it&&it(),pr=[],Bt=null,et=document.createElement("div"),et.className="ap-sdk-recorder-bar",et.setAttribute("data-ap-sdk","1"),et.innerHTML=`
1677
1737
  <span class="ap-sdk-recorder-bar__counter" data-ap-recorder-counter>● Recording — 0 steps</span>
1678
1738
  <button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--stop" data-ap-recorder-stop type="button">Stop</button>
1679
1739
  <button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--discard" data-ap-recorder-discard type="button">Discard</button>
1680
- `,document.body.appendChild(ot),Wt(ot),Io=ot.querySelector("[data-ap-recorder-counter]");const n=()=>{si();const u=sr;ct==null||ct(),e(u)},r=()=>{ct==null||ct()};ot.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),ot.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=u=>{if(vr(u.target))return;const p=u.target;ii({action:"click",cssSelector:Qr(p),elementText:eo(p),description:gb(eo(p),p.tagName),capturedAt:new Date().toISOString()})},i=u=>{if(vr(u.target))return;const p=u.target;if(!(p instanceof HTMLInputElement)&&!(p instanceof HTMLTextAreaElement)&&!(p instanceof HTMLSelectElement))return;const h=Bc(p),g=cu(p),m=g?"[redacted]":wb(p);ii(D(y({action:"inputText",cssSelector:Qr(p),elementText:h,value:m},g?{redacted:!0}:{}),{description:Gc(h,m,g),capturedAt:new Date().toISOString()}))},a=()=>{const u=Math.round(window.scrollX),p=Math.round(window.scrollY);Zt?(Zt.scrollX=u,Zt.scrollY=p,Zt.description=Wc(u,p)):Zt={action:"scroll",scrollX:u,scrollY:p,description:Wc(u,p),capturedAt:new Date().toISOString()},qt&&clearTimeout(qt),qt=setTimeout(()=>{qt=null,si()},bb)},d=u=>{if(u.key==="Escape"){r();return}if(vr(u.target))return;const p=vb(u);if(!p)return;const h=u.target instanceof Element?u.target:document.body,g=yb(h);ii({action:"keypress",cssSelector:Qr(h),elementText:g,key:p,description:mb(p,g),capturedAt:new Date().toISOString()})};document.addEventListener("click",o,{capture:!0}),document.addEventListener("change",i,{capture:!0}),window.addEventListener("scroll",a,{capture:!0,passive:!0}),document.addEventListener("keydown",d,{capture:!0}),ct=()=>{document.removeEventListener("click",o,{capture:!0}),document.removeEventListener("change",i,{capture:!0}),window.removeEventListener("scroll",a,{capture:!0}),document.removeEventListener("keydown",d,{capture:!0}),qt&&(clearTimeout(qt),qt=null),Zt=null,ot&&Jt(ot),ot==null||ot.remove(),ot=null,Io=null,ct=null}}function Sb(){ct==null||ct()}function zo(){return ct!==null}const Tb="data-ap-sdk",Eb="ap-sdk-fab",Vc="ap-sdk-fab--dragging",ai="ap-sdk-fab--open",Xc="ap-sdk-fab-pos",$o="ap-sdk-fab--left-edge",Ab='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>',Cb='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m3 3 7.07 16.97 2.51-7.39 7.39-2.51L3 3z"/><path d="m13 13 6 6"/></svg>',Pb='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="8"/></svg>',Rb='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>';let $=null,Ht=null,hn=null,fn=null,kt=null,ir=null,ar=null,cr=null,Oo=null,Or=null,lr=null,No=null,Do=null,Mo=null,Kc=0,Qc=0,el=0,tl=0,ur=!1,At=!1,Nr=null,zn=null;function Lb(){Nr=e=>{if(!$){Uo();return}if(!ur){if(Math.hypot(e.clientX-el,e.clientY-tl)<5)return;ur=!0,At=!0,$.classList.add(Vc)}Ib(e.clientX-Kc,e.clientY-Qc)},zn=()=>{if(!$){Uo();return}ur?(ur=!1,$.classList.remove(Vc),$.style.transition="",zb($.getBoundingClientRect())):$.style.transition="",Uo()},window.addEventListener("pointermove",Nr),window.addEventListener("pointerup",zn),window.addEventListener("pointercancel",zn)}function Uo(){Nr&&(window.removeEventListener("pointermove",Nr),Nr=null),zn&&(window.removeEventListener("pointerup",zn),window.removeEventListener("pointercancel",zn),zn=null)}function Ib(e,t){if(!$)return;const n=$.offsetWidth||52,r=$.offsetHeight||52;$.style.top=`${Math.max(0,Math.min(t,window.innerHeight-r))}px`,$.style.left=`${Math.max(0,Math.min(e,window.innerWidth-n))}px`,$.style.bottom="auto",$.style.right="auto"}function zb(e){if(!$)return;const n=Math.max(16,Math.min(window.innerHeight-e.bottom,window.innerHeight-52-16)),r=e.left+e.width/2<window.innerWidth/2?"left":"right";$.style.top="auto",$.style.bottom=`${n}px`,r==="left"?($.style.right="auto",$.style.left="16px",$.classList.add($o)):($.style.left="auto",$.style.right="16px",$.classList.remove($o));try{localStorage.setItem(Xc,JSON.stringify({edge:r,bottom:n}))}catch(o){}}function $b(){if($)try{const e=localStorage.getItem(Xc);if(!e)return;const t=JSON.parse(e);if(typeof t.bottom!="number"||t.edge!=="left"&&t.edge!=="right")return;const r=Math.max(16,Math.min(t.bottom,window.innerHeight-52-16));$.style.top="auto",$.style.bottom=`${r}px`,t.edge==="left"?($.style.right="auto",$.style.left="16px",$.classList.add($o)):($.style.left="auto",$.style.right="16px",$.classList.remove($o))}catch(e){}}function dr(){$==null||$.classList.remove(ai),lr&&(window.removeEventListener("pointerdown",lr,{capture:!0}),lr=null)}function Ob(){$&&($.classList.add(ai),lr=e=>{!$||$.contains(e.target)||dr()},requestAnimationFrame(()=>{lr&&window.addEventListener("pointerdown",lr,{capture:!0})}))}function jo(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function nl(e,t,n){var d;if(No=e,Do=t,Mo=n,$)return;$=document.createElement("div"),$.className=Eb,$.setAttribute(Tb,"1"),ir=document.createElement("div"),ir.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="View captures",kt=document.createElement("button"),kt.className="ap-sdk-fab__list ap-sdk-fab__sub",kt.setAttribute("aria-label","My captures"),kt.setAttribute("title","View my captures"),kt.appendChild(jo(Rb));const o=document.createElement("span");o.className="ap-sdk-fab__badge",o.setAttribute("data-ap-badge",""),o.style.display="none",kt.appendChild(o),ir.appendChild(r),ir.appendChild(kt),ar=document.createElement("div"),ar.className="ap-sdk-fab__row";const i=document.createElement("span");i.className="ap-sdk-fab__label",i.textContent="Capture element",hn=document.createElement("button"),hn.className="ap-sdk-fab__capture ap-sdk-fab__sub",hn.setAttribute("aria-label","Capture element"),hn.setAttribute("title","Capture element to Agent Platform"),hn.appendChild(jo(Cb)),ar.appendChild(i),ar.appendChild(hn),cr=document.createElement("div"),cr.className="ap-sdk-fab__row";const a=document.createElement("span");a.className="ap-sdk-fab__label",a.textContent="Record interaction",fn=document.createElement("button"),fn.className="ap-sdk-fab__record ap-sdk-fab__sub",fn.setAttribute("aria-label","Record interaction"),fn.setAttribute("title","Record a sequence of interactions"),fn.appendChild(jo(Pb)),cr.appendChild(a),cr.appendChild(fn),Ht=document.createElement("button"),Ht.className="ap-sdk-fab__main",Ht.setAttribute("aria-label","Agent Platform"),Ht.setAttribute("title","Agent Platform"),Ht.appendChild(jo(Ab)),$.appendChild(ir),$.appendChild(ar),$.appendChild(cr),$.appendChild(Ht),Ht.addEventListener("click",u=>{if(At){At=!1;return}u.preventDefault(),u.stopPropagation(),$!=null&&$.classList.contains(ai)?dr():Ob()}),hn.addEventListener("click",u=>{if(At){At=!1;return}u.preventDefault(),u.stopPropagation(),dr(),!Bn()&&!zo()&&No&&No()}),fn.addEventListener("click",u=>{if(At){At=!1;return}u.preventDefault(),u.stopPropagation(),dr(),!Bn()&&!zo()&&Do&&Do()}),kt.addEventListener("click",u=>{if(At){At=!1;return}u.preventDefault(),u.stopPropagation(),dr(),Mo&&Mo()}),Or=u=>{if(!$||!($===u.target||$.contains(u.target)))return;const p=$.getBoundingClientRect();Kc=u.clientX-p.left,Qc=u.clientY-p.top,el=u.clientX,tl=u.clientY,ur=!1,At=!1,$.style.transition="none",u.stopPropagation(),Lb()},window.addEventListener("pointerdown",Or,{capture:!0}),((d=document.body)!=null?d:document.documentElement).appendChild($),Wt($),$b(),Oo=setInterval(()=>{Ht&&Ht.classList.toggle("ap-sdk-fab__main--active",Bn()||zo())},200)}function $n(e){const t=kt==null?void 0:kt.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function rl(){ur=!1,At=!1,Uo(),dr(),Oo&&(clearInterval(Oo),Oo=null),Or&&(window.removeEventListener("pointerdown",Or,{capture:!0}),Or=null),$&&Jt($),$==null||$.remove(),$=null,Ht=null,hn=null,fn=null,kt=null,ir=null,ar=null,cr=null,No=null,Do=null,Mo=null}function ol(e,t){return I(this,null,function*(){try{if(e.type==="planning"){const r=yield cg(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=yield Va(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch(n){return{capture:e,status:"unavailable",approved:!1}}})}function sl(e){return e.filter(t=>!t.approved).length}function il(e){return I(this,null,function*(){const t=or();if(!e||t.length===0){$n(t.length);return}const n=yield Promise.all(t.map(r=>ol(r,e)));$n(sl(n))})}let gn=null;function Nb(){const e=new Uint32Array(4);return crypto.getRandomValues(e),Array.from(e,t=>t.toString(16)).join("")}function ci(e){if(gn){const d=gn;d.cleanup(),d.popup.closed||d.popup.close(),gn=null}const t=e.replace(/\/+$/,""),n=new URL(t).origin,r=Nb(),o=window.location.origin,i=`${t}/oauth/authorize?origin=${encodeURIComponent(o)}&state=${encodeURIComponent(r)}`,a=window.open(i,"ap-sdk-oauth","width=480,height=640");return a?new Promise((d,u)=>{let p=!1;function h(){window.removeEventListener("message",g),clearInterval(m),(gn==null?void 0:gn.popup)===a&&(gn=null)}function g(k){if(k.origin!==n)return;const w=k.data;!w||w.type!=="ap-sdk-oauth"||w.state!==r||!w.code||(p=!0,h(),d({code:w.code}))}window.addEventListener("message",g);const m=window.setInterval(()=>{a.closed&&(h(),p||u(new Error("Connection cancelled.")))},500);gn={popup:a,cleanup:h}}):Promise.reject(new Error("Popup blocked — please allow popups for this site and try again."))}const Db="https://agent-platform.tung.engineering",li="ap-sdk-config";function Mb(){try{const e=sessionStorage.getItem(li);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.token)||!(t!=null&&t.projectCode)||!(t!=null&&t.expiresAt)?null:new Date(t.expiresAt).getTime()<=Date.now()?(al(),null):t}catch(e){return null}}function Zo(e){sessionStorage.setItem(li,JSON.stringify(e)),jb({backendUrl:e.backendUrl,projectCode:e.projectCode})}function al(){sessionStorage.removeItem(li)}const cl="ap-sdk-last-connection";function Ub(){try{const e=localStorage.getItem(cl);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.projectCode)?null:t}catch(e){return null}}function jb(e){try{localStorage.setItem(cl,JSON.stringify(e))}catch(t){}}let X=null;function Qt(){X&&Jt(X),X==null||X.remove(),X=null}function ui(e){X&&Qt(),X=document.createElement("div"),X.className="ap-sdk-panel",X.setAttribute("data-ap-sdk","1"),X.setAttribute("role","dialog"),X.setAttribute("aria-modal","true"),X.setAttribute("aria-label","Connect to Agent Platform");const t=Ub();t?n(t):r(Db),document.body.appendChild(X),Wt(X);function n(i){if(!X)return;X.innerHTML=`
1740
+ `,document.body.appendChild(et),Mt(et),Go=et.querySelector("[data-ap-recorder-counter]");const n=()=>{vi();const l=pr;it==null||it(),e(l)},r=()=>{it==null||it()};et.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),et.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=l=>{if(Cr(l.target))return;const p=l.target;yi({action:"click",cssSelector:fo(p),elementText:go(p),description:Gb(go(p),p.tagName),capturedAt:new Date().toISOString()})},i=l=>{if(Cr(l.target))return;const p=l.target;if(!(p instanceof HTMLInputElement)&&!(p instanceof HTMLTextAreaElement)&&!(p instanceof HTMLSelectElement))return;const h=hl(p),g=Du(p),m=g?"[redacted]":Qb(p);yi(M(v({action:"inputText",cssSelector:fo(p),elementText:h,value:m},g?{redacted:!0}:{}),{description:fl(h,m,g),capturedAt:new Date().toISOString()}))},a=()=>{const l=Math.round(window.scrollX),p=Math.round(window.scrollY);Bt?(Bt.scrollX=l,Bt.scrollY=p,Bt.description=gl(l,p)):Bt={action:"scroll",scrollX:l,scrollY:p,description:gl(l,p),capturedAt:new Date().toISOString()},Gt&&clearTimeout(Gt),Gt=setTimeout(()=>{Gt=null,vi()},Jb)},d=l=>{if(l.key==="Escape"){r();return}if(Cr(l.target))return;const p=Xb(l);if(!p)return;const h=l.target instanceof Element?l.target:document.body,g=Kb(h);yi({action:"keypress",cssSelector:fo(h),elementText:g,key:p,description:Wb(p,g),capturedAt:new Date().toISOString()})};document.addEventListener("click",o,{capture:!0}),document.addEventListener("change",i,{capture:!0}),window.addEventListener("scroll",a,{capture:!0,passive:!0}),document.addEventListener("keydown",d,{capture:!0}),it=()=>{document.removeEventListener("click",o,{capture:!0}),document.removeEventListener("change",i,{capture:!0}),window.removeEventListener("scroll",a,{capture:!0}),document.removeEventListener("keydown",d,{capture:!0}),Gt&&(clearTimeout(Gt),Gt=null),Bt=null,et&&Ut(et),et==null||et.remove(),et=null,Go=null,it=null}}function tk(){it==null||it()}function Wo(){return it!==null}const nk="data-ap-sdk",rk="ap-sdk-fab",kl="ap-sdk-fab--dragging",wi="ap-sdk-fab--open",_l="ap-sdk-fab-pos",Jo="ap-sdk-fab--left-edge",ok='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>',sk='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m3 3 7.07 16.97 2.51-7.39 7.39-2.51L3 3z"/><path d="m13 13 6 6"/></svg>',ik='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="8"/></svg>',ak='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>';let N=null,Wt=null,vn=null,yn=null,gt=null,hr=null,fr=null,gr=null,Yo=null,Wr=null,mr=null,Vo=null,Xo=null,Ko=null,vl=0,yl=0,wl=0,xl=0,br=!1,Et=!1,Jr=null,Un=null;function ck(){Jr=e=>{if(!N){Qo();return}if(!br){if(Math.hypot(e.clientX-wl,e.clientY-xl)<5)return;br=!0,Et=!0,N.classList.add(kl)}lk(e.clientX-vl,e.clientY-yl)},Un=()=>{if(!N){Qo();return}br?(br=!1,N.classList.remove(kl),N.style.transition="",uk(N.getBoundingClientRect())):N.style.transition="",Qo()},window.addEventListener("pointermove",Jr),window.addEventListener("pointerup",Un),window.addEventListener("pointercancel",Un)}function Qo(){Jr&&(window.removeEventListener("pointermove",Jr),Jr=null),Un&&(window.removeEventListener("pointerup",Un),window.removeEventListener("pointercancel",Un),Un=null)}function lk(e,t){if(!N)return;const n=N.offsetWidth||52,r=N.offsetHeight||52;N.style.top=`${Math.max(0,Math.min(t,window.innerHeight-r))}px`,N.style.left=`${Math.max(0,Math.min(e,window.innerWidth-n))}px`,N.style.bottom="auto",N.style.right="auto"}function uk(e){if(!N)return;const n=Math.max(16,Math.min(window.innerHeight-e.bottom,window.innerHeight-52-16)),r=e.left+e.width/2<window.innerWidth/2?"left":"right";N.style.top="auto",N.style.bottom=`${n}px`,r==="left"?(N.style.right="auto",N.style.left="16px",N.classList.add(Jo)):(N.style.left="auto",N.style.right="16px",N.classList.remove(Jo));try{localStorage.setItem(_l,JSON.stringify({edge:r,bottom:n}))}catch(o){}}function dk(){if(N)try{const e=localStorage.getItem(_l);if(!e)return;const t=JSON.parse(e);if(typeof t.bottom!="number"||t.edge!=="left"&&t.edge!=="right")return;const r=Math.max(16,Math.min(t.bottom,window.innerHeight-52-16));N.style.top="auto",N.style.bottom=`${r}px`,t.edge==="left"?(N.style.right="auto",N.style.left="16px",N.classList.add(Jo)):(N.style.left="auto",N.style.right="16px",N.classList.remove(Jo))}catch(e){}}function kr(){N==null||N.classList.remove(wi),mr&&(window.removeEventListener("pointerdown",mr,{capture:!0}),mr=null)}function pk(){N&&(N.classList.add(wi),mr=e=>{!N||N.contains(e.target)||kr()},requestAnimationFrame(()=>{mr&&window.addEventListener("pointerdown",mr,{capture:!0})}))}function es(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function Sl(e,t,n){var d;if(Vo=e,Xo=t,Ko=n,N)return;N=document.createElement("div"),N.className=rk,N.setAttribute(nk,"1"),hr=document.createElement("div"),hr.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="View captures",gt=document.createElement("button"),gt.className="ap-sdk-fab__list ap-sdk-fab__sub",gt.setAttribute("aria-label","My captures"),gt.setAttribute("title","View my captures"),gt.appendChild(es(ak));const o=document.createElement("span");o.className="ap-sdk-fab__badge",o.setAttribute("data-ap-badge",""),o.style.display="none",gt.appendChild(o),hr.appendChild(r),hr.appendChild(gt),fr=document.createElement("div"),fr.className="ap-sdk-fab__row";const i=document.createElement("span");i.className="ap-sdk-fab__label",i.textContent="Capture element",vn=document.createElement("button"),vn.className="ap-sdk-fab__capture ap-sdk-fab__sub",vn.setAttribute("aria-label","Capture element"),vn.setAttribute("title","Capture element to Agent Platform"),vn.appendChild(es(sk)),fr.appendChild(i),fr.appendChild(vn),gr=document.createElement("div"),gr.className="ap-sdk-fab__row";const a=document.createElement("span");a.className="ap-sdk-fab__label",a.textContent="Record interaction",yn=document.createElement("button"),yn.className="ap-sdk-fab__record ap-sdk-fab__sub",yn.setAttribute("aria-label","Record interaction"),yn.setAttribute("title","Record a sequence of interactions"),yn.appendChild(es(ik)),gr.appendChild(a),gr.appendChild(yn),Wt=document.createElement("button"),Wt.className="ap-sdk-fab__main",Wt.setAttribute("aria-label","Agent Platform"),Wt.setAttribute("title","Agent Platform"),Wt.appendChild(es(ok)),N.appendChild(hr),N.appendChild(fr),N.appendChild(gr),N.appendChild(Wt),Wt.addEventListener("click",l=>{if(Et){Et=!1;return}l.preventDefault(),l.stopPropagation(),N!=null&&N.classList.contains(wi)?kr():pk()}),vn.addEventListener("click",l=>{if(Et){Et=!1;return}l.preventDefault(),l.stopPropagation(),kr(),!Kn()&&!Wo()&&Vo&&Vo()}),yn.addEventListener("click",l=>{if(Et){Et=!1;return}l.preventDefault(),l.stopPropagation(),kr(),!Kn()&&!Wo()&&Xo&&Xo()}),gt.addEventListener("click",l=>{if(Et){Et=!1;return}l.preventDefault(),l.stopPropagation(),kr(),Ko&&Ko()}),Wr=l=>{if(!N||!(N===l.target||N.contains(l.target)))return;const p=N.getBoundingClientRect();vl=l.clientX-p.left,yl=l.clientY-p.top,wl=l.clientX,xl=l.clientY,br=!1,Et=!1,N.style.transition="none",l.stopPropagation(),ck()},window.addEventListener("pointerdown",Wr,{capture:!0}),((d=document.body)!=null?d:document.documentElement).appendChild(N),Mt(N),dk(),Yo=setInterval(()=>{Wt&&Wt.classList.toggle("ap-sdk-fab__main--active",Kn()||Wo())},200)}function jn(e){const t=gt==null?void 0:gt.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function Tl(){br=!1,Et=!1,Qo(),kr(),Yo&&(clearInterval(Yo),Yo=null),Wr&&(window.removeEventListener("pointerdown",Wr,{capture:!0}),Wr=null),N&&Ut(N),N==null||N.remove(),N=null,Wt=null,vn=null,yn=null,gt=null,hr=null,fr=null,gr=null,Vo=null,Xo=null,Ko=null}function El(e,t){return z(this,null,function*(){try{if(e.type==="planning"){const r=yield Dg(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=yield mc(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch(n){return{capture:e,status:"unavailable",approved:!1}}})}function Al(e){return e.filter(t=>!t.approved).length}function Cl(e){return z(this,null,function*(){const t=dr();if(!e||t.length===0){jn(t.length);return}const n=yield Promise.all(t.map(r=>El(r,e)));jn(Al(n))})}let wn=null;function hk(){const e=new Uint32Array(4);return crypto.getRandomValues(e),Array.from(e,t=>t.toString(16)).join("")}function xi(e){if(wn){const d=wn;d.cleanup(),d.popup.closed||d.popup.close(),wn=null}const t=e.replace(/\/+$/,""),n=new URL(t).origin,r=hk(),o=window.location.origin,i=`${t}/oauth/authorize?origin=${encodeURIComponent(o)}&state=${encodeURIComponent(r)}`,a=window.open(i,"ap-sdk-oauth","width=480,height=640");return a?new Promise((d,l)=>{let p=!1;function h(){window.removeEventListener("message",g),clearInterval(m),(wn==null?void 0:wn.popup)===a&&(wn=null)}function g(k){if(k.origin!==n)return;const y=k.data;!y||y.type!=="ap-sdk-oauth"||y.state!==r||!y.code||(p=!0,h(),d({code:y.code}))}window.addEventListener("message",g);const m=window.setInterval(()=>{a.closed&&(h(),p||l(new Error("Connection cancelled.")))},500);wn={popup:a,cleanup:h}}):Promise.reject(new Error("Popup blocked — please allow popups for this site and try again."))}const fk="https://agent-platform.tung.engineering",Si="ap-sdk-config";function gk(){try{const e=sessionStorage.getItem(Si);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.token)||!(t!=null&&t.projectCode)||!(t!=null&&t.expiresAt)?null:new Date(t.expiresAt).getTime()<=Date.now()?(Pl(),null):t}catch(e){return null}}function ts(e){sessionStorage.setItem(Si,JSON.stringify(e)),bk({backendUrl:e.backendUrl,projectCode:e.projectCode})}function Pl(){sessionStorage.removeItem(Si)}const Rl="ap-sdk-last-connection";function mk(){try{const e=localStorage.getItem(Rl);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.projectCode)?null:t}catch(e){return null}}function bk(e){try{localStorage.setItem(Rl,JSON.stringify(e))}catch(t){}}let Q=null,Yr=null;function on(){Q&&Ut(Q),Q==null||Q.remove(),Q=null,Yr==null||Yr(),Yr=null}function Ti(e){Q&&on(),Q=document.createElement("div"),Q.className="ap-sdk-panel",Q.setAttribute("data-ap-sdk","1"),Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label","Connect to Agent Platform");const t=mk();t?n(t):r(fk),document.body.appendChild(Q),Mt(Q),Yr=$r(Q,Ir);function n(i){if(!Q)return;Q.innerHTML=`
1681
1741
  <div class="ap-sdk-panel__header">
1682
1742
  <span class="ap-sdk-panel__title">
1683
1743
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1687,7 +1747,7 @@ ${n}${r?`
1687
1747
  </div>
1688
1748
  <div class="ap-sdk-panel__body">
1689
1749
  <p class="ap-sdk-config-hint">
1690
- Reconnect to <strong>${di(i.backendUrl)}</strong>. You'll be asked to
1750
+ Reconnect to <strong>${Ei(i.backendUrl)}</strong>. You'll be asked to
1691
1751
  approve this connection on Agent Platform's own sign-in page.
1692
1752
  </p>
1693
1753
  </div>
@@ -1696,7 +1756,7 @@ ${n}${r?`
1696
1756
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-reconnect>Reconnect</button>
1697
1757
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-use-different>Use a different connection</button>
1698
1758
  </div>
1699
- `;const a=X.querySelector("[data-ap-cfg-status]"),d=X.querySelector("[data-ap-reconnect]");X.querySelector("[data-ap-close]").addEventListener("click",()=>{Qt()}),X.querySelector("[data-ap-use-different]").addEventListener("click",()=>r(i.backendUrl)),d.addEventListener("click",()=>I(null,null,function*(){d.disabled=!0,d.textContent="Connecting…",mn(a,null,"");try{const{code:u}=yield ci(i.backendUrl),{token:p,expiresAt:h}=yield Ps({backendUrl:i.backendUrl},u,window.location.origin),g={backendUrl:i.backendUrl,token:p},m=yield Xa(g);if(m.length===0){mn(a,"error","No projects found — check your account permissions."),d.disabled=!1,d.textContent="Reconnect";return}const k=m.find(Z=>Z.key===i.projectCode);if(k){Qt(),e({backendUrl:i.backendUrl,token:p,projectCode:k.key,expiresAt:h});return}const w=Ba(window.location.href,m),v=w?m.find(Z=>Z.id===w):void 0;v?(Qt(),e({backendUrl:i.backendUrl,token:p,projectCode:v.key,expiresAt:h})):o(i.backendUrl,p,h,m)}catch(u){mn(a,"error",`Could not connect — ${u instanceof Error?u.message:"please try again"}`),d.disabled=!1,d.textContent="Reconnect"}}))}function r(i){if(!X)return;X.innerHTML=`
1759
+ `;const a=Q.querySelector("[data-ap-cfg-status]"),d=Q.querySelector("[data-ap-reconnect]");Q.querySelector("[data-ap-close]").addEventListener("click",()=>{on()}),Q.querySelector("[data-ap-use-different]").addEventListener("click",()=>r(i.backendUrl)),d.addEventListener("click",()=>z(null,null,function*(){d.disabled=!0,d.textContent="Connecting…",xn(a,null,"");try{const{code:l}=yield xi(i.backendUrl),{token:p,expiresAt:h}=yield Fs({backendUrl:i.backendUrl},l,window.location.origin),g={backendUrl:i.backendUrl,token:p},m=yield bc(g);if(m.length===0){xn(a,"error","No projects found — check your account permissions."),d.disabled=!1,d.textContent="Reconnect";return}const k=m.find($=>$.key===i.projectCode);if(k){on(),e({backendUrl:i.backendUrl,token:p,projectCode:k.key,expiresAt:h});return}const y=uc(window.location.href,m),S=y?m.find($=>$.id===y):void 0;S?(on(),e({backendUrl:i.backendUrl,token:p,projectCode:S.key,expiresAt:h})):o(i.backendUrl,p,h,m)}catch(l){xn(a,"error",`Could not connect — ${l instanceof Error?l.message:"please try again"}`),d.disabled=!1,d.textContent="Reconnect"}}))}function r(i){if(!Q)return;Q.innerHTML=`
1700
1760
  <div class="ap-sdk-panel__header">
1701
1761
  <span class="ap-sdk-panel__title">
1702
1762
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1709,7 +1769,7 @@ ${n}${r?`
1709
1769
  <label class="ap-sdk-panel__label" for="ap-sdk-cfg-url">Backend URL</label>
1710
1770
  <input id="ap-sdk-cfg-url" class="ap-sdk-panel__input" type="url"
1711
1771
  placeholder="https://your-platform.example.com"
1712
- value="${ll(i)}" autocomplete="off" data-ap-cfg-url />
1772
+ value="${Ll(i)}" autocomplete="off" data-ap-cfg-url />
1713
1773
  </div>
1714
1774
  <p class="ap-sdk-config-hint">
1715
1775
  You'll be asked to approve this connection on Agent Platform's own sign-in page.
@@ -1720,7 +1780,7 @@ ${n}${r?`
1720
1780
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-connect>Connect via Agent Platform</button>
1721
1781
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-cancel>Cancel</button>
1722
1782
  </div>
1723
- `;const a=X.querySelector("[data-ap-cfg-url]"),d=X.querySelector("[data-ap-cfg-status]"),u=X.querySelector("[data-ap-connect]");X.querySelector("[data-ap-close]").addEventListener("click",()=>{Qt()}),X.querySelector("[data-ap-cancel]").addEventListener("click",()=>{Qt()}),u.addEventListener("click",()=>I(null,null,function*(){const p=a.value.trim();if(!p){mn(d,"error","Backend URL is required.");return}u.disabled=!0,u.textContent="Connecting…",mn(d,null,"");try{const{code:h}=yield ci(p),{token:g,expiresAt:m}=yield Ps({backendUrl:p},h,window.location.origin),w=yield Xa({backendUrl:p,token:g});if(w.length===0){mn(d,"error","No projects found — check your account permissions."),u.disabled=!1,u.textContent="Connect via Agent Platform";return}const v=Ba(window.location.href,w),Z=v?w.find(K=>K.id===v):void 0;if(Z){Qt(),e({backendUrl:p,token:g,projectCode:Z.key,expiresAt:m});return}o(p,g,m,w)}catch(h){mn(d,"error",`Could not connect — ${h instanceof Error?h.message:"please try again"}`),u.disabled=!1,u.textContent="Connect via Agent Platform"}})),setTimeout(()=>a.focus(),50)}function o(i,a,d,u){if(!X)return;const p=u.map(m=>`<option value="${ll(m.key)}"${m.key===(t==null?void 0:t.projectCode)?" selected":""}>${di(m.name)} (${di(m.key)})</option>`).join("");X.innerHTML=`
1783
+ `;const a=Q.querySelector("[data-ap-cfg-url]"),d=Q.querySelector("[data-ap-cfg-status]"),l=Q.querySelector("[data-ap-connect]");Q.querySelector("[data-ap-close]").addEventListener("click",()=>{on()}),Q.querySelector("[data-ap-cancel]").addEventListener("click",()=>{on()}),l.addEventListener("click",()=>z(null,null,function*(){const p=a.value.trim();if(!p){xn(d,"error","Backend URL is required.");return}l.disabled=!0,l.textContent="Connecting…",xn(d,null,"");try{const{code:h}=yield xi(p),{token:g,expiresAt:m}=yield Fs({backendUrl:p},h,window.location.origin),y=yield bc({backendUrl:p,token:g});if(y.length===0){xn(d,"error","No projects found — check your account permissions."),l.disabled=!1,l.textContent="Connect via Agent Platform";return}const S=uc(window.location.href,y),$=S?y.find(E=>E.id===S):void 0;if($){on(),e({backendUrl:p,token:g,projectCode:$.key,expiresAt:m});return}o(p,g,m,y)}catch(h){xn(d,"error",`Could not connect — ${h instanceof Error?h.message:"please try again"}`),l.disabled=!1,l.textContent="Connect via Agent Platform"}})),setTimeout(()=>a.focus(),50)}function o(i,a,d,l){if(!Q)return;const p=l.map(m=>`<option value="${Ll(m.key)}"${m.key===(t==null?void 0:t.projectCode)?" selected":""}>${Ei(m.name)} (${Ei(m.key)})</option>`).join("");Q.innerHTML=`
1724
1784
  <div class="ap-sdk-panel__header">
1725
1785
  <span class="ap-sdk-panel__title">
1726
1786
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1742,26 +1802,27 @@ ${n}${r?`
1742
1802
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-save>Save</button>
1743
1803
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-back>Back</button>
1744
1804
  </div>
1745
- `;const h=X.querySelector("[data-ap-cfg-project]"),g=X.querySelector("[data-ap-cfg-status]");X.querySelector("[data-ap-close]").addEventListener("click",()=>{Qt()}),X.querySelector("[data-ap-back]").addEventListener("click",()=>r(i)),X.querySelector("[data-ap-save]").addEventListener("click",()=>{const m=h.value;if(!m){mn(g,"error","Please select a project.");return}Qt(),e({backendUrl:i,token:a,projectCode:m,expiresAt:d})})}}function mn(e,t,n){if(!t){e.style.display="none",e.textContent="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function ll(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function di(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let W=null,st=null,en=null;function Dr(){return W!==null}function Mr(){W&&Jt(W),W==null||W.remove(),W=null,en==null||en(),en=null,st==null||st.destroy(),st=null}function ul(e,t,n,r,o,i,a,d,u,p,h=null,g){var wn,Pt,Se,Ae;W&&Mr();const m=!n.backendUrl||!n.token,k=Ka(h,"tasks:write"),w=Ka(h,"planning-sessions:write"),v={captureType:(wn=g==null?void 0:g.captureType)!=null?wn:!k&&w?"planning":"task",submitting:!1,completedPicks:(Pt=g==null?void 0:g.completedPicks)!=null?Pt:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1,allowSubmit:(Se=g==null?void 0:g.allowSubmit)!=null?Se:!1};W=document.createElement("div"),W.className="ap-sdk-panel",W.setAttribute("data-ap-sdk","1"),W.setAttribute("role","dialog"),W.setAttribute("aria-modal","true"),W.setAttribute("aria-label","Capture to Agent Platform"),W.innerHTML=`
1805
+ `;const h=Q.querySelector("[data-ap-cfg-project]"),g=Q.querySelector("[data-ap-cfg-status]");Q.querySelector("[data-ap-close]").addEventListener("click",()=>{on()}),Q.querySelector("[data-ap-back]").addEventListener("click",()=>r(i)),Q.querySelector("[data-ap-save]").addEventListener("click",()=>{const m=h.value;if(!m){xn(g,"error","Please select a project.");return}on(),e({backendUrl:i,token:a,projectCode:m,expiresAt:d})})}}function xn(e,t,n){if(!t){e.style.display="none",e.textContent="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function Ll(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ei(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let W=null,tt=null,sn=null,Vr=null,Xr=null;const ns="ap-sdk-panel-draft";function Il(){var e,t;try{const n=localStorage.getItem(ns);if(!n)return null;const r=JSON.parse(n);return!Array.isArray(r.completedPicks)||!r.currentCtx||typeof r.currentCtx!="object"?null:{captureType:(e=r.captureType)!=null?e:"task",note:(t=r.note)!=null?t:"",completedPicks:r.completedPicks,allowSubmit:!!r.allowSubmit,currentCtx:r.currentCtx}}catch(n){return null}}function kk(e){try{if(!e.note&&e.completedPicks.length===0&&!e.allowSubmit){localStorage.removeItem(ns);return}localStorage.setItem(ns,JSON.stringify(e))}catch(t){}}function Ai(){try{localStorage.removeItem(ns)}catch(e){}}function Kr(){return W!==null}function Qr(){W&&Ut(W),W==null||W.remove(),W=null,sn==null||sn(),sn=null,Vr==null||Vr(),Vr=null,Xr==null||Xr(),Xr=null,tt==null||tt.destroy(),tt=null}function $l(e,t,n,r,o,i,a,d,l,p,h=null,g){var Fn,An,Ne,Xt,bt,kt,cn;W&&Qr();const m=!n.backendUrl||!n.token,k=kc(h,"tasks:write"),y=kc(h,"planning-sessions:write"),S=!k&&y?"planning":"task",$=g?null:Il(),E={captureType:(An=(Fn=g==null?void 0:g.captureType)!=null?Fn:$==null?void 0:$.captureType)!=null?An:S,submitting:!1,completedPicks:(Xt=(Ne=g==null?void 0:g.completedPicks)!=null?Ne:$==null?void 0:$.completedPicks)!=null?Xt:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1,allowSubmit:(kt=(bt=g==null?void 0:g.allowSubmit)!=null?bt:$==null?void 0:$.allowSubmit)!=null?kt:!1};W=document.createElement("div"),W.className="ap-sdk-panel",W.setAttribute("data-ap-sdk","1"),W.setAttribute("role","dialog"),W.setAttribute("aria-modal","true"),W.setAttribute("aria-label","Capture to Agent Platform"),W.innerHTML=`
1746
1806
  <div class="ap-sdk-panel__header">
1747
1807
  <span class="ap-sdk-panel__title">
1748
1808
  <span class="ap-sdk-panel__logo">AP</span>
1749
1809
  Capture to Agent Platform
1750
1810
  </span>
1751
1811
  <div class="ap-sdk-panel__header-actions">
1812
+ <button class="ap-sdk-panel__clear" aria-label="Clear selections" title="Clear selections" data-ap-clear-selections type="button">⟲</button>
1752
1813
  <button class="ap-sdk-panel__config" aria-label="Configure" data-ap-reconfigure>⚙</button>
1753
1814
  <button class="ap-sdk-panel__close" aria-label="Close" data-ap-close>×</button>
1754
1815
  </div>
1755
1816
  </div>
1756
1817
  <div class="ap-sdk-pick-list" data-ap-pick-list style="display:none"></div>
1757
1818
  <div class="ap-sdk-panel__context" data-ap-context>
1758
- ${dl(e)}
1819
+ ${zl(e)}
1759
1820
  </div>
1760
1821
  <div class="ap-sdk-panel__pick-actions" data-ap-pick-actions>
1761
1822
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-panel__btn--select-parent" data-ap-select-parent type="button">
1762
1823
  ⬆ Select parent
1763
1824
  </button>
1764
- ${u?`
1825
+ ${l?`
1765
1826
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-panel__btn--reselect" data-ap-reselect type="button">
1766
1827
  ↻ Re-select
1767
1828
  </button>`:""}
@@ -1785,9 +1846,9 @@ ${n}${r?`
1785
1846
  <div class="ap-sdk-panel__field">
1786
1847
  <div class="ap-sdk-panel__label">Type</div>
1787
1848
  <div class="ap-sdk-panel__toggle">
1788
- ${w?`<button class="ap-sdk-panel__toggle-btn${v.captureType==="planning"?" ap-sdk-active":""}" data-ap-type="planning">Planning Session</button>`:""}
1789
- ${k?`<button class="ap-sdk-panel__toggle-btn${v.captureType==="task"?" ap-sdk-active":""}" data-ap-type="task">Task</button>`:""}
1790
- ${k?`<button class="ap-sdk-panel__toggle-btn${v.captureType==="automate"?" ap-sdk-active":""}" data-ap-type="automate">Automate</button>`:""}
1849
+ ${y?`<button class="ap-sdk-panel__toggle-btn${E.captureType==="planning"?" ap-sdk-active":""}" data-ap-type="planning">Planning Session</button>`:""}
1850
+ ${k?`<button class="ap-sdk-panel__toggle-btn${E.captureType==="task"?" ap-sdk-active":""}" data-ap-type="task">Task</button>`:""}
1851
+ ${k?`<button class="ap-sdk-panel__toggle-btn${E.captureType==="automate"?" ap-sdk-active":""}" data-ap-type="automate">Automate</button>`:""}
1791
1852
  </div>
1792
1853
  </div>
1793
1854
  <div class="ap-sdk-panel__field" data-ap-automate-options style="display:none">
@@ -1803,41 +1864,41 @@ ${n}${r?`
1803
1864
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-submit>Submit</button>
1804
1865
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-cancel>Cancel</button>
1805
1866
  </div>
1806
- `,W.addEventListener("wheel",H=>{H.stopPropagation()},{passive:!0}),W.addEventListener("touchmove",H=>{H.stopPropagation()},{passive:!0});const Z=W.querySelector(".ap-sdk-panel__body"),K=lb(Z,n,(Ae=r==null?void 0:r.id)!=null?Ae:null);document.body.appendChild(W),st=hs(),v.currentPickedEl&&st.update(v.currentPickedEl),Wt(W),zs(W,Is);const U=W.querySelector("[data-ap-close]"),E=W.querySelector("[data-ap-cancel]"),T=W.querySelector("[data-ap-submit]"),A=W.querySelector("[data-ap-note]"),N=W.querySelector("[data-ap-status]"),J=W.querySelectorAll("[data-ap-type]"),we=W.querySelector("[data-ap-automate-options]"),Me=W.querySelector("[data-ap-allow-submit]"),Ye=W.querySelector("[data-ap-pick-list]"),ne=W.querySelector("[data-ap-context]"),xe=W.querySelector("[data-ap-add-another]"),lt=W.querySelector("[data-ap-pick-actions]"),kn=W.querySelector("[data-ap-select-parent]"),_n=W.querySelector("[data-ap-reselect]"),vt=()=>{v.currentPickedEl&&(st==null||st.update(v.currentPickedEl))};window.addEventListener("scroll",vt,{capture:!0,passive:!0}),window.addEventListener("resize",vt),en=()=>{window.removeEventListener("scroll",vt,!0),window.removeEventListener("resize",vt)};const Ft=H=>{H?(ne.innerHTML=dl(H),A.disabled=!1,A.placeholder="Describe the task or planning session…",setTimeout(()=>A.focus(),50)):(ne.innerHTML=`
1867
+ `,W.addEventListener("wheel",F=>{F.stopPropagation()},{passive:!0}),W.addEventListener("touchmove",F=>{F.stopPropagation()},{passive:!0});const j=W.querySelector(".ap-sdk-panel__body"),A=jb(j,n,(cn=r==null?void 0:r.id)!=null?cn:null);document.body.appendChild(W),tt=Es(),E.currentPickedEl&&tt.update(E.currentPickedEl),Mt(W),Vr=Js(W,Ws),Xr=$r(W,Ir);const T=W.querySelector("[data-ap-close]"),L=W.querySelector("[data-ap-cancel]"),q=W.querySelector("[data-ap-submit]"),H=W.querySelector("[data-ap-note]"),se=W.querySelector("[data-ap-status]"),je=W.querySelectorAll("[data-ap-type]"),nt=W.querySelector("[data-ap-automate-options]"),ee=W.querySelector("[data-ap-allow-submit]"),Se=W.querySelector("[data-ap-pick-list]"),at=W.querySelector("[data-ap-context]"),At=W.querySelector("[data-ap-add-another]"),vr=W.querySelector("[data-ap-pick-actions]"),Jt=W.querySelector("[data-ap-select-parent]"),Ct=W.querySelector("[data-ap-reselect]"),yr=W.querySelector("[data-ap-clear-selections]"),Yt=()=>{kk({captureType:E.captureType,note:H.value,completedPicks:E.completedPicks,allowSubmit:E.allowSubmit,currentCtx:E.currentCtx})},an=()=>{E.currentPickedEl&&(tt==null||tt.update(E.currentPickedEl))};window.addEventListener("scroll",an,{capture:!0,passive:!0}),window.addEventListener("resize",an),sn=()=>{window.removeEventListener("scroll",an,!0),window.removeEventListener("resize",an)};const ye=F=>{F?(at.innerHTML=zl(F),H.disabled=!1,H.placeholder="Describe the task or planning session…",setTimeout(()=>H.focus(),50)):(at.innerHTML=`
1807
1868
  <div class="ap-sdk-panel__context-label">Next element</div>
1808
1869
  <div class="ap-sdk-panel__context-text ap-sdk-awaiting-pick">👆 Hover and click any element on the page</div>
1809
- `,A.disabled=!0,A.placeholder="Pick an element to continue…")},vn=()=>{if(v.completedPicks.length===0){Ye.style.display="none",Ye.innerHTML="";return}Ye.style.display="block",Ye.innerHTML=v.completedPicks.map((H,ae)=>{var Q;return`
1810
- <div class="ap-sdk-pick-entry" data-pick-index="${ae}">
1870
+ `,H.disabled=!0,H.placeholder="Pick an element to continue…")},Vt=()=>{if(E.completedPicks.length===0){Se.style.display="none",Se.innerHTML="";return}Se.style.display="block",Se.innerHTML=E.completedPicks.map((F,re)=>{var xe;return`
1871
+ <div class="ap-sdk-pick-entry" data-pick-index="${re}">
1811
1872
  <div class="ap-sdk-pick-entry__header">
1812
- <span class="ap-sdk-pick-entry__number">${ae+1}</span>
1813
- <span class="ap-sdk-pick-entry__element" title="${ht((Q=H.ctx.elementText)!=null?Q:"")}">${ht(H.ctx.elementText||"(no text)")}</span>
1814
- <button class="ap-sdk-pick-entry__remove" data-ap-remove="${ae}" aria-label="Remove pick ${ae+1}">×</button>
1873
+ <span class="ap-sdk-pick-entry__number">${re+1}</span>
1874
+ <span class="ap-sdk-pick-entry__element" title="${ut((xe=F.ctx.elementText)!=null?xe:"")}">${ut(F.ctx.elementText||"(no text)")}</span>
1875
+ <button class="ap-sdk-pick-entry__remove" data-ap-remove="${re}" aria-label="Remove pick ${re+1}">×</button>
1815
1876
  </div>
1816
- <div class="ap-sdk-pick-entry__instruction">${ht(H.instruction)}</div>
1877
+ <div class="ap-sdk-pick-entry__instruction">${ut(F.instruction)}</div>
1817
1878
  </div>
1818
- `}).join(""),Ye.querySelectorAll("[data-ap-remove]").forEach(H=>{H.addEventListener("click",()=>{const ae=parseInt(H.dataset.apRemove,10);v.completedPicks.splice(ae,1),vn()})})},yn=()=>{if(!v.currentPickedEl){lt.style.display="none";return}lt.style.display="",kn.disabled=!v.currentPickedEl.parentElement||v.awaitingPick,_n&&(_n.disabled=v.awaitingPick)},Bt=()=>{xe&&(xe.disabled=!A.value.trim()||v.submitting||v.awaitingPick)},fe=(H,ae)=>{v.currentCtx=H,v.currentPickedEl=ae,Ft(H),st==null||st.update(ae),yn()};yn(),g&&(A.value=g.note,Me.checked=g.allowSubmit,we.style.display=v.captureType==="automate"?"":"none",vn(),pr(N,"success","Reconnected — your draft was kept.")),kn.addEventListener("click",()=>{var ae;const H=(ae=v.currentPickedEl)==null?void 0:ae.parentElement;H&&fe(ji(H),H)}),_n&&u&&_n.addEventListener("click",()=>{if(v.awaitingPick)return;const H=v.currentCtx,ae=v.currentPickedEl;v.awaitingPick=!0,yn(),Bt(),Ft(null),u((Q,Ue)=>{v.awaitingPick=!1,fe(Q,Ue),Bt()},()=>{v.awaitingPick=!1,ae&&fe(H,ae),Bt()})});const Ct=()=>{Mr(),p==null||p()},ye=()=>({captureType:v.captureType,note:A.value,completedPicks:v.completedPicks,currentCtx:v.currentCtx,currentPickedEl:v.currentPickedEl,allowSubmit:v.allowSubmit});U.addEventListener("click",Ct),E.addEventListener("click",Ct);const Dn=W.querySelector("[data-ap-connect-required]");Dn&&a&&Dn.addEventListener("click",()=>{const H=ye();Ct(),a(H)}),J.forEach(H=>{H.addEventListener("click",()=>{v.captureType=H.dataset.apType,J.forEach(ae=>ae.classList.toggle("ap-sdk-active",ae===H)),we.style.display=v.captureType==="automate"?"":"none"})}),Me.addEventListener("change",()=>{v.allowSubmit=Me.checked});const ue=W.querySelector("[data-ap-reconfigure]");a?ue.addEventListener("click",()=>{const H=ye();Ct(),a(H)}):ue.style.display="none",xe&&d&&(A.addEventListener("input",Bt),xe.addEventListener("click",()=>{const H=A.value.trim();!H||v.awaitingPick||(v.completedPicks.push({ctx:v.currentCtx,instruction:H}),vn(),A.value="",v.awaitingPick=!0,xe.disabled=!0,yn(),Ft(null),d((ae,Q)=>{v.awaitingPick=!1,fe(ae,Q),Bt()}))}));const Ve=()=>I(null,null,function*(){var tn,Rt;if(v.submitting)return;if(m){pr(N,"error","Connect to Agent Platform first.");return}const H=n.backendUrl,ae=n.token,Q=A.value.trim();if(!Q){pr(N,"error","Please enter an instruction.");return}v.submitting=!0,pi(W,!0),pr(N,null,""),T.textContent="Submitting…";const Ue={backendUrl:H,token:ae},Xe=K.getOptions(),Be=[...v.completedPicks,{ctx:v.currentCtx,instruction:Q}];try{const je={id:r==null?void 0:r.id,key:o};let Re,Oe,Ge;if(Be.length===1)if(v.captureType==="task")Re=(yield Cs(Ue,{project:je,note:Q,ctx:v.currentCtx,advancedOpts:Xe})).id,Oe="task",Ge=Q.slice(0,120)||v.currentCtx.pageTitle||"Browser capture";else if(v.captureType==="planning"){let it=ru(Q,D(y({},v.currentCtx),{ancestry:v.currentCtx.outerTree||v.currentCtx.ancestry}));(tn=v.currentCtx.innerTree)!=null&&tn.trim()&&(it+=`
1879
+ `}).join(""),Se.querySelectorAll("[data-ap-remove]").forEach(F=>{F.addEventListener("click",()=>{const re=parseInt(F.dataset.apRemove,10);E.completedPicks.splice(re,1),Vt(),Yt()})})},ge=()=>{if(!E.currentPickedEl){vr.style.display="none";return}vr.style.display="",Jt.disabled=!E.currentPickedEl.parentElement||E.awaitingPick,Ct&&(Ct.disabled=E.awaitingPick)},Pt=()=>{At&&(At.disabled=!H.value.trim()||E.submitting||E.awaitingPick)},le=(F,re)=>{E.currentCtx=F,E.currentPickedEl=re,ye(F),tt==null||tt.update(re),ge(),Yt()};ge(),g?(H.value=g.note,ee.checked=g.allowSubmit,nt.style.display=E.captureType==="automate"?"":"none",Vt(),Sn(se,"success","Reconnected — your draft was kept.")):$&&(H.value=$.note,ee.checked=$.allowSubmit,nt.style.display=E.captureType==="automate"?"":"none",Vt(),Sn(se,"success","Restored your previous selections.")),yr.addEventListener("click",()=>{E.completedPicks=[],E.allowSubmit=!1,E.captureType=S,H.value="",ee.checked=!1,je.forEach(F=>F.classList.toggle("ap-sdk-active",F.dataset.apType===E.captureType)),nt.style.display="none",Vt(),Ai(),Sn(se,null,""),Pt(),H.focus()}),Jt.addEventListener("click",()=>{var re;const F=(re=E.currentPickedEl)==null?void 0:re.parentElement;F&&le(sa(F),F)}),Ct&&l&&Ct.addEventListener("click",()=>{if(E.awaitingPick)return;const F=E.currentCtx,re=E.currentPickedEl;E.awaitingPick=!0,ge(),Pt(),ye(null),l((xe,rt)=>{E.awaitingPick=!1,le(xe,rt),Pt()},()=>{E.awaitingPick=!1,re&&le(F,re),Pt()})});const Le=()=>{Qr(),p==null||p()},En=()=>({captureType:E.captureType,note:H.value,completedPicks:E.completedPicks,currentCtx:E.currentCtx,currentPickedEl:E.currentPickedEl,allowSubmit:E.allowSubmit});T.addEventListener("click",Le),L.addEventListener("click",Le);const Rt=W.querySelector("[data-ap-connect-required]");Rt&&a&&Rt.addEventListener("click",()=>{const F=En();Le(),a(F)}),je.forEach(F=>{F.addEventListener("click",()=>{E.captureType=F.dataset.apType,je.forEach(re=>re.classList.toggle("ap-sdk-active",re===F)),nt.style.display=E.captureType==="automate"?"":"none",Yt()})}),ee.addEventListener("change",()=>{E.allowSubmit=ee.checked,Yt()}),H.addEventListener("input",Yt);const Te=W.querySelector("[data-ap-reconfigure]");a?Te.addEventListener("click",()=>{const F=En();Le(),a(F)}):Te.style.display="none",At&&d&&(H.addEventListener("input",Pt),At.addEventListener("click",()=>{const F=H.value.trim();!F||E.awaitingPick||(E.completedPicks.push({ctx:E.currentCtx,instruction:F}),Vt(),H.value="",E.awaitingPick=!0,At.disabled=!0,ge(),ye(null),Yt(),d((re,xe)=>{E.awaitingPick=!1,le(re,xe),Pt()}))}));const Pe=()=>z(null,null,function*(){var Cn,Kt;if(E.submitting)return;if(m){Sn(se,"error","Connect to Agent Platform first.");return}const F=n.backendUrl,re=n.token,xe=H.value.trim();if(!xe){Sn(se,"error","Please enter an instruction.");return}E.submitting=!0,Ci(W,!0),Sn(se,null,""),q.textContent="Submitting…";const rt={backendUrl:F,token:re},_t=A.getOptions(),Lt=[...E.completedPicks,{ctx:E.currentCtx,instruction:xe}];try{const De={id:r==null?void 0:r.id,key:o};let ue,Ie,X;if(Lt.length===1)if(E.captureType==="task")ue=(yield Hs(rt,{project:De,note:xe,ctx:E.currentCtx,advancedOpts:_t})).id,Ie="task",X=xe.slice(0,120)||E.currentCtx.pageTitle||"Browser capture";else if(E.captureType==="planning"){let ot=Ru(xe,M(v({},E.currentCtx),{ancestry:E.currentCtx.outerTree||E.currentCtx.ancestry}));(Cn=E.currentCtx.innerTree)!=null&&Cn.trim()&&(ot+=`
1819
1880
 
1820
1881
  Element tree:
1821
- ${v.currentCtx.innerTree}`),(Rt=v.currentCtx.interactionSteps)!=null&&Rt.length&&(it+=`
1882
+ ${E.currentCtx.innerTree}`),(Kt=E.currentCtx.interactionSteps)!=null&&Kt.length&&(ot+=`
1822
1883
 
1823
1884
  Recorded steps:
1824
- ${Jc(v.currentCtx.interactionSteps)}`),Re=(yield Ya(Ue,je,it,Xe)).id,Oe="planning",Ge=Q.slice(0,120)||v.currentCtx.pageTitle||"Planning session"}else Re=(yield Ja(Ue,{project:je,note:Q,ctx:v.currentCtx,advancedOpts:Xe,allowSubmit:v.allowSubmit})).id,Oe="automate",Ge=Q.slice(0,120)||v.currentCtx.pageTitle||"Browser automation";else{const it=qb(Be),ut=Be[0].instruction.slice(0,120)||Be[0].ctx.pageTitle||"Multi-element capture",Lt=Be.map(Le=>Le.instruction).filter(Boolean).join(`
1885
+ ${ml(E.currentCtx.interactionSteps)}`),ue=(yield gc(rt,De,ot,_t)).id,Ie="planning",X=xe.slice(0,120)||E.currentCtx.pageTitle||"Planning session"}else ue=(yield fc(rt,{project:De,note:xe,ctx:E.currentCtx,advancedOpts:_t,allowSubmit:E.allowSubmit})).id,Ie="automate",X=xe.slice(0,120)||E.currentCtx.pageTitle||"Browser automation";else{const ot=vk(Lt),It=Lt[0].instruction.slice(0,120)||Lt[0].ctx.pageTitle||"Multi-element capture",ln=Lt.map($t=>$t.instruction).filter(Boolean).join(`
1825
1886
 
1826
- `);v.captureType==="task"?(Re=(yield Cs(Ue,{project:je,note:it,ctx:Be[0].ctx,advancedOpts:Xe,titleOverride:ut,type:Ha,titleInstruction:Lt})).id,Oe="task",Ge=ut):v.captureType==="planning"?(Re=(yield Ya(Ue,je,it,Xe)).id,Oe="planning",Ge=ut):(Re=(yield Ja(Ue,{project:je,note:it,ctx:Be[0].ctx,advancedOpts:Xe,titleOverride:ut,titleInstruction:Lt,allowSubmit:v.allowSubmit})).id,Oe="automate",Ge=ut)}if(hb({id:Re,type:Oe,title:Ge,backendUrl:H,createdAt:new Date().toISOString()}),il(Ue).catch(()=>{}),Oe==="automate"){Ct(),ti(Re,Ue,H,Ge,p);return}const jr=Oe==="task"?`${H.replace(/\/+$/,"")}/tasks/${Re}`:`${H.replace(/\/+$/,"")}/planning/${Re}`;Fb(N,Oe,Ge,jr,Ct),W.classList.add("ap-sdk-panel--success"),en==null||en(),en=null,st==null||st.hide(),v.submitting=!1,pi(W,!1)}catch(je){je instanceof Ga?Hb(N,()=>I(null,null,function*(){const{code:Re}=yield ci(H),{token:Oe,expiresAt:Ge}=yield Ps({backendUrl:H},Re,window.location.origin);Zo({backendUrl:H,token:Oe,projectCode:o,expiresAt:Ge}),n.token=Oe,i({backendUrl:H,token:Oe}),yield Ve()})):pr(N,"error",je instanceof Error?je.message:"An unexpected error occurred."),v.submitting=!1,pi(W,!1),T.textContent="Submit"}});T.addEventListener("click",Ve),setTimeout(()=>A.focus(),50)}const Zb={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};function dl(e){var t,n;return(t=e.interactionSteps)!=null&&t.length?`
1887
+ `);E.captureType==="task"?(ue=(yield Hs(rt,{project:De,note:ot,ctx:Lt[0].ctx,advancedOpts:_t,titleOverride:It,type:cc,titleInstruction:ln})).id,Ie="task",X=It):E.captureType==="planning"?(ue=(yield gc(rt,De,ot,_t)).id,Ie="planning",X=It):(ue=(yield fc(rt,{project:De,note:ot,ctx:Lt[0].ctx,advancedOpts:_t,titleOverride:It,titleInstruction:ln,allowSubmit:E.allowSubmit})).id,Ie="automate",X=It)}if(Fb({id:ue,type:Ie,title:X,backendUrl:F,createdAt:new Date().toISOString()}),Ai(),Cl(rt).catch(()=>{}),Ie==="automate"){Le(),mi(ue,rt,F,X,p);return}const wr=Ie==="task"?`${F.replace(/\/+$/,"")}/tasks/${ue}`:`${F.replace(/\/+$/,"")}/planning/${ue}`;wk(se,Ie,X,wr,Le),W.classList.add("ap-sdk-panel--success"),sn==null||sn(),sn=null,tt==null||tt.hide(),E.submitting=!1,Ci(W,!1)}catch(De){De instanceof dc?yk(se,()=>z(null,null,function*(){const{code:ue}=yield xi(F),{token:Ie,expiresAt:X}=yield Fs({backendUrl:F},ue,window.location.origin);ts({backendUrl:F,token:Ie,projectCode:o,expiresAt:X}),n.token=Ie,i({backendUrl:F,token:Ie}),yield Pe()})):Sn(se,"error",De instanceof Error?De.message:"An unexpected error occurred."),E.submitting=!1,Ci(W,!1),q.textContent="Submit"}});q.addEventListener("click",Pe),setTimeout(()=>H.focus(),50)}const _k={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};function zl(e){var t,n;return(t=e.interactionSteps)!=null&&t.length?`
1827
1888
  <div class="ap-sdk-panel__context-label">Recorded steps (${e.interactionSteps.length})</div>
1828
1889
  <div class="ap-sdk-panel__context-steps">
1829
1890
  ${e.interactionSteps.map(r=>`
1830
1891
  <div class="ap-sdk-panel__context-step">
1831
- <span class="ap-sdk-panel__context-step-icon">${Zb[r.action]}</span>
1832
- <span class="ap-sdk-panel__context-step-text">${ht(r.description)}</span>
1892
+ <span class="ap-sdk-panel__context-step-icon">${_k[r.action]}</span>
1893
+ <span class="ap-sdk-panel__context-step-text">${ut(r.description)}</span>
1833
1894
  </div>
1834
1895
  `).join("")}
1835
1896
  </div>
1836
1897
  `:`
1837
1898
  <div class="ap-sdk-panel__context-label">Captured element</div>
1838
- <div class="ap-sdk-panel__context-text" title="${ht((n=e.elementText)!=null?n:"")}">${ht(e.elementText||"(no text)")}</div>
1839
- ${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${ht(e.cssSelector)}">${ht(e.cssSelector)}</div>`:""}
1840
- `}function qb(e){return e.map((t,n)=>{var o,i;const r=[`## Pick ${n+1}`,""];return(o=t.ctx.interactionSteps)!=null&&o.length?r.push("Recorded steps:",Jc(t.ctx.interactionSteps)):(r.push(`Element: ${t.ctx.elementText||"(no text)"}`),t.ctx.cssSelector&&r.push(`Selector: ${t.ctx.cssSelector}`),t.ctx.ancestry&&r.push(`Ancestry: ${t.ctx.ancestry}`)),r.push(`Page: ${t.ctx.pageTitle} (${t.ctx.pageUrl})`),(i=t.ctx.innerTree)!=null&&i.trim()&&r.push(`
1899
+ <div class="ap-sdk-panel__context-text" title="${ut((n=e.elementText)!=null?n:"")}">${ut(e.elementText||"(no text)")}</div>
1900
+ ${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${ut(e.cssSelector)}">${ut(e.cssSelector)}</div>`:""}
1901
+ `}function vk(e){return e.map((t,n)=>{var o,i;const r=[`## Pick ${n+1}`,""];return(o=t.ctx.interactionSteps)!=null&&o.length?r.push("Recorded steps:",ml(t.ctx.interactionSteps)):(r.push(`Element: ${t.ctx.elementText||"(no text)"}`),t.ctx.cssSelector&&r.push(`Selector: ${t.ctx.cssSelector}`),t.ctx.ancestry&&r.push(`Ancestry: ${t.ctx.ancestry}`)),r.push(`Page: ${t.ctx.pageTitle} (${t.ctx.pageUrl})`),(i=t.ctx.innerTree)!=null&&i.trim()&&r.push(`
1841
1902
  Element tree:
1842
1903
  ${t.ctx.innerTree}`),r.push("",`Instruction:
1843
1904
  ${t.instruction}`),r.join(`
@@ -1845,26 +1906,26 @@ ${t.instruction}`),r.join(`
1845
1906
 
1846
1907
  ---
1847
1908
 
1848
- `)}function pr(e,t,n){if(!t){e.style.display="none",e.textContent="",e.innerHTML="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function Hb(e,t){e.style.display="block",e.className="ap-sdk-panel__status ap-sdk-panel__status--error",e.innerHTML=`
1909
+ `)}function Sn(e,t,n){if(!t){e.style.display="none",e.textContent="",e.innerHTML="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function yk(e,t){e.style.display="block",e.className="ap-sdk-panel__status ap-sdk-panel__status--error",e.innerHTML=`
1849
1910
  <p>Your session expired.</p>
1850
1911
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-reconnect type="button">Reconnect</button>
1851
- `;const n=e.querySelector("[data-ap-reconnect]");n.addEventListener("click",()=>I(null,null,function*(){n.disabled=!0,n.textContent="Connecting…";try{yield t()}catch(r){pr(e,"error",r instanceof Error?r.message:"Could not reconnect — please try again.")}}))}function Fb(e,t,n,r,o){const i=t==="task"?"Task":"Planning",a=t==="task"?"Task created successfully!":"Planning session created!",d=t==="task"?"View task →":"View planning session →",u=n.length>55?`${n.slice(0,52)}…`:n;e.style.display="block",e.className="ap-sdk-panel__status",e.innerHTML=`
1912
+ `;const n=e.querySelector("[data-ap-reconnect]");n.addEventListener("click",()=>z(null,null,function*(){n.disabled=!0,n.textContent="Connecting…";try{yield t()}catch(r){Sn(e,"error",r instanceof Error?r.message:"Could not reconnect — please try again.")}}))}function wk(e,t,n,r,o){const i=t==="task"?"Task":"Planning",a=t==="task"?"Task created successfully!":"Planning session created!",d=t==="task"?"View task →":"View planning session →",l=n.length>55?`${n.slice(0,52)}…`:n;e.style.display="block",e.className="ap-sdk-panel__status",e.innerHTML=`
1852
1913
  <div class="ap-sdk-success-card">
1853
1914
  <svg class="ap-sdk-success-check" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
1854
1915
  <circle class="ap-sdk-success-check__circle" cx="24" cy="24" r="22"/>
1855
1916
  <path class="ap-sdk-success-check__tick" d="M14 24l7 7 13-14"/>
1856
1917
  </svg>
1857
- <p class="ap-sdk-success-headline">${ht(a)}</p>
1918
+ <p class="ap-sdk-success-headline">${ut(a)}</p>
1858
1919
  <div class="ap-sdk-success-meta">
1859
- <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${ht(i)}</span>
1860
- <span class="ap-sdk-success-title" title="${ht(n)}">${ht(u)}</span>
1920
+ <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${ut(i)}</span>
1921
+ <span class="ap-sdk-success-title" title="${ut(n)}">${ut(l)}</span>
1861
1922
  </div>
1862
1923
  <div class="ap-sdk-success-actions">
1863
- <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${ht(d)}</button>
1924
+ <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${ut(d)}</button>
1864
1925
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-success-close>Close</button>
1865
1926
  </div>
1866
1927
  </div>
1867
- `,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function pi(e,t){e.querySelectorAll("button, input, textarea, select").forEach(n=>{n.disabled=t})}function ht(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}let ie=null;function pl(){return ie!==null}function On(){ie&&Jt(ie),ie==null||ie.remove(),ie=null}function Bb(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function Gb(e){if(ie){On();return}ie=document.createElement("div"),ie.className="ap-sdk-panel",ie.setAttribute("data-ap-sdk","1"),ie.setAttribute("role","dialog"),ie.setAttribute("aria-modal","true"),ie.setAttribute("aria-label","My captures"),ie.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),ie.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),ie.innerHTML=`
1928
+ `,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function Ci(e,t){e.querySelectorAll("button, input, textarea, select").forEach(n=>{n.disabled=t})}function ut(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}let oe=null,eo=null,to=null;function Ol(){return oe!==null}function Zn(){oe&&Ut(oe),oe==null||oe.remove(),oe=null,eo==null||eo(),eo=null,to==null||to(),to=null}function xk(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function Sk(e){if(oe){Zn();return}oe=document.createElement("div"),oe.className="ap-sdk-panel",oe.setAttribute("data-ap-sdk","1"),oe.setAttribute("role","dialog"),oe.setAttribute("aria-modal","true"),oe.setAttribute("aria-label","My captures"),oe.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),oe.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),oe.innerHTML=`
1868
1929
  <div class="ap-sdk-panel__header">
1869
1930
  <span class="ap-sdk-panel__title">
1870
1931
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1877,18 +1938,27 @@ ${t.instruction}`),r.join(`
1877
1938
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-clear-history>Clear history</button>
1878
1939
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-close-list>Close</button>
1879
1940
  </div>
1880
- `,document.body.appendChild(ie),Wt(ie),zs(ie,Is),ie.querySelector("[data-ap-close]").addEventListener("click",()=>{On()}),ie.querySelector("[data-ap-close-list]").addEventListener("click",()=>{On()}),ie.querySelector("[data-ap-clear-history]").addEventListener("click",()=>{fb(),$n(0),hl(e)}),hl(e)}function hl(e){if(!ie)return;const t=ie.querySelector("[data-ap-list-body]"),n=or();if(n.length===0){t.innerHTML='<p class="ap-sdk-list-empty">No captures yet. Use the capture button to get started.</p>';return}if(t.innerHTML=n.map(r=>`
1941
+ `,document.body.appendChild(oe),Mt(oe),eo=Js(oe,Ws),to=$r(oe,Ir),oe.querySelector("[data-ap-close]").addEventListener("click",()=>{Zn()}),oe.querySelector("[data-ap-close-list]").addEventListener("click",()=>{Zn()}),oe.querySelector("[data-ap-clear-history]").addEventListener("click",()=>{Bb(),jn(0),Nl(e)}),Nl(e)}function Nl(e){if(!oe)return;const t=oe.querySelector("[data-ap-list-body]"),n=dr();if(n.length===0){t.innerHTML='<p class="ap-sdk-list-empty">No captures yet. Use the capture button to get started.</p>';return}if(t.innerHTML=n.map(r=>`
1881
1942
  <div class="ap-sdk-list-item">
1882
1943
  <div class="ap-sdk-list-item__row">
1883
- <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${Bb(r.type)}</span>
1884
- <span class="ap-sdk-list-item__title" title="${qo(r.title)}">${Yb(r.title)}</span>
1944
+ <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${xk(r.type)}</span>
1945
+ <span class="ap-sdk-list-item__title" title="${rs(r.title)}">${Ak(r.title)}</span>
1885
1946
  </div>
1886
1947
  <div class="ap-sdk-list-item__row">
1887
- <span class="ap-sdk-status-badge" data-ap-status="${qo(r.id)}">${e?"…":"—"}</span>
1888
- ${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${qo(r.id)}">Resume →</button>`:`<a class="ap-sdk-list-item__link" href="${qo(Jb(r))}" target="_blank" rel="noopener noreferrer">View →</a>`}
1948
+ <span class="ap-sdk-status-badge" data-ap-status="${rs(r.id)}">${e?"…":"—"}</span>
1949
+ ${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${rs(r.id)}">Resume →</button>`:`<a class="ap-sdk-list-item__link" href="${rs(Ek(r))}" target="_blank" rel="noopener noreferrer">View →</a>`}
1889
1950
  </div>
1890
1951
  </div>
1891
- `).join(""),e){const r=e;Promise.all(n.map(o=>Wb(o,r))).then(o=>{$n(sl(o))}),t.querySelectorAll("[data-ap-resume]").forEach(o=>{o.addEventListener("click",()=>{const i=o.dataset.apResume,a=n.find(d=>d.id===i);a&&(On(),ti(a.id,r,a.backendUrl,a.title,()=>{}))})})}}function Wb(e,t){return I(this,null,function*(){const n=yield ol(e,t),r=ie==null?void 0:ie.querySelector(`[data-ap-status="${CSS.escape(e.id)}"]`);return r&&(r.textContent=n.status.replace(/_/g," "),r.className=`ap-sdk-status-badge ap-sdk-status-badge--${n.status.replace(/_/g,"-")}`),n})}function Jb(e){const t=e.backendUrl.replace(/\/+$/,"");return e.type==="planning"?`${t}/planning/${e.id}`:`${t}/tasks/${e.id}`}function qo(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Yb(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let _t=null,Ho=!1;function Vb(){_t==null||_t.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),_t&&_t.observe(document.body,{childList:!0}),Ho=!1}function fl(){_t||(_t=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||Ho||(Ho=!0,queueMicrotask(Vb))}),_t.observe(document.body,{childList:!0}))}function Xb(){_t==null||_t.disconnect(),_t=null,Ho=!1}const Kb={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};let Pe=null,bn=[];function Fo(){Pe&&Jt(Pe),Pe==null||Pe.remove(),Pe=null,bn=[]}function Qb(e,t,n){Pe&&Fo(),bn=[...e],Pe=document.createElement("div"),Pe.className="ap-sdk-panel ap-sdk-record-review",Pe.setAttribute("data-ap-sdk","1"),Pe.setAttribute("role","dialog"),Pe.setAttribute("aria-modal","true"),Pe.setAttribute("aria-label","Review recorded steps"),Pe.innerHTML=`
1952
+ `).join(""),e){const r=e;Promise.all(n.map(o=>Tk(o,r))).then(o=>{jn(Al(o))}),t.querySelectorAll("[data-ap-resume]").forEach(o=>{o.addEventListener("click",()=>{const i=o.dataset.apResume,a=n.find(d=>d.id===i);a&&(Zn(),mi(a.id,r,a.backendUrl,a.title,()=>{}))})})}}function Tk(e,t){return z(this,null,function*(){const n=yield El(e,t),r=oe==null?void 0:oe.querySelector(`[data-ap-status="${CSS.escape(e.id)}"]`);return r&&(r.textContent=n.status.replace(/_/g," "),r.className=`ap-sdk-status-badge ap-sdk-status-badge--${n.status.replace(/_/g,"-")}`),n})}function Ek(e){const t=e.backendUrl.replace(/\/+$/,"");return e.type==="planning"?`${t}/planning/${e.id}`:`${t}/tasks/${e.id}`}function rs(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ak(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let mt=null,os=!1;function Ck(){mt==null||mt.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),mt&&mt.observe(document.body,{childList:!0}),os=!1}function Dl(){mt||(mt=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||os||(os=!0,queueMicrotask(Ck))}),mt.observe(document.body,{childList:!0}))}function Pk(){mt==null||mt.disconnect(),mt=null,os=!1}let We=null;function qn(){We&&Ut(We),We==null||We.remove(),We=null}function Ml(e){const t=e.note.trim();return t?t.length>80?`${t.slice(0,77)}…`:t:e.completedPicks.length>0?`${e.completedPicks.length} saved pick${e.completedPicks.length===1?"":"s"}`:"Untitled draft"}function Ul(e){if(We)return;const t=Il();t&&(We=document.createElement("div"),We.className="ap-sdk-resume-banner",We.setAttribute("data-ap-sdk","1"),We.setAttribute("role","status"),We.innerHTML=`
1953
+ <div>
1954
+ <span class="ap-sdk-resume-banner__title">Resume your draft?</span>
1955
+ <span class="ap-sdk-resume-banner__summary" title="${Rk(Ml(t))}">${jl(Ml(t))}</span>
1956
+ </div>
1957
+ <div class="ap-sdk-resume-banner__actions">
1958
+ <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-resume-draft type="button">Resume</button>
1959
+ <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-discard-draft type="button">Discard</button>
1960
+ </div>
1961
+ `,document.body.appendChild(We),Mt(We),We.querySelector("[data-ap-resume-draft]").addEventListener("click",()=>{qn(),e(t)}),We.querySelector("[data-ap-discard-draft]").addEventListener("click",()=>{Ai(),qn()}))}function jl(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Rk(e){return jl(e)}const Lk={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};let Ce=null,Tn=[],no=null;function ss(){Ce&&Ut(Ce),Ce==null||Ce.remove(),Ce=null,Tn=[],no==null||no(),no=null}function Ik(e,t,n){Ce&&ss(),Tn=[...e],Ce=document.createElement("div"),Ce.className="ap-sdk-panel ap-sdk-record-review",Ce.setAttribute("data-ap-sdk","1"),Ce.setAttribute("role","dialog"),Ce.setAttribute("aria-modal","true"),Ce.setAttribute("aria-label","Review recorded steps"),Ce.innerHTML=`
1892
1962
  <div class="ap-sdk-panel__header">
1893
1963
  <span class="ap-sdk-panel__title">
1894
1964
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1903,11 +1973,11 @@ ${t.instruction}`),r.join(`
1903
1973
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-review-continue>Continue</button>
1904
1974
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-review-cancel>Cancel</button>
1905
1975
  </div>
1906
- `,document.body.appendChild(Pe),Wt(Pe);const r=Pe.querySelector("[data-ap-review-list]"),o=Pe.querySelector("[data-ap-review-continue]"),i=()=>{if(bn.length===0){r.innerHTML='<p class="ap-sdk-list-empty">No steps recorded.</p>',o.disabled=!0;return}o.disabled=!1,r.innerHTML=bn.map((d,u)=>{var p;return`
1907
- <div class="ap-sdk-record-step" data-step-index="${u}">
1908
- <span class="ap-sdk-record-step__icon">${Kb[d.action]}</span>
1909
- ${d.action==="inputText"&&!d.redacted?`<input class="ap-sdk-record-step__input" type="text" value="${ek((p=d.value)!=null?p:"")}" data-ap-step-value />`:`<span class="ap-sdk-record-step__description">${gl(d.description)}</span>`}
1910
- <button class="ap-sdk-record-step__remove" data-ap-step-remove="${u}" aria-label="Remove step ${u+1}">✕</button>
1976
+ `,document.body.appendChild(Ce),Mt(Ce),no=$r(Ce,Ir);const r=Ce.querySelector("[data-ap-review-list]"),o=Ce.querySelector("[data-ap-review-continue]"),i=()=>{if(Tn.length===0){r.innerHTML='<p class="ap-sdk-list-empty">No steps recorded.</p>',o.disabled=!0;return}o.disabled=!1,r.innerHTML=Tn.map((d,l)=>{var p;return`
1977
+ <div class="ap-sdk-record-step" data-step-index="${l}">
1978
+ <span class="ap-sdk-record-step__icon">${Lk[d.action]}</span>
1979
+ ${d.action==="inputText"&&!d.redacted?`<input class="ap-sdk-record-step__input" type="text" value="${$k((p=d.value)!=null?p:"")}" data-ap-step-value />`:`<span class="ap-sdk-record-step__description">${Zl(d.description)}</span>`}
1980
+ <button class="ap-sdk-record-step__remove" data-ap-step-remove="${l}" aria-label="Remove step ${l+1}">✕</button>
1911
1981
  </div>
1912
- `}).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(d=>{d.addEventListener("click",()=>{const u=parseInt(d.dataset.apStepRemove,10);bn.splice(u,1),i()})}),r.querySelectorAll("[data-ap-step-value]").forEach(d=>{const u=d.closest("[data-step-index]"),p=parseInt(u.dataset.stepIndex,10);d.addEventListener("input",()=>{var g;const h=bn[p];h.value=d.value,h.description=Gc((g=h.elementText)!=null?g:"",d.value,!1)})})};i();const a=()=>{Fo()};Pe.querySelector("[data-ap-review-close]").addEventListener("click",a),Pe.querySelector("[data-ap-review-cancel]").addEventListener("click",a),o.addEventListener("click",()=>{if(bn.length===0)return;const d=bn,u=D(y({},$i()),{pageUrl:window.location.href,pageTitle:document.title,interactionSteps:d});Fo(),t(u)})}function gl(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function ek(e){return gl(e)}let q=null,Bo=null,Go=null,Wo=null;function hi(e,t,n){Bo=e,Go=t,Wo=n,nl(e,t,n)}const ml="#agent-platform-web-sdk",bl="ap-sdk-fab-unlocked";let Nn=null;function kl(){try{if(localStorage.getItem(bl)==="1")return!0}catch(e){}return window.location.hash===ml}function _l(){try{localStorage.setItem(bl,"1")}catch(e){}}function vl(e){return I(this,null,function*(){var t,n,r,o;if(kr(),!(q&&q.projectCode===e.projectCode&&q.backendUrl===((t=e.backendUrl)!=null?t:null)&&q.token===((n=e.token)!=null?n:null))){if(q={projectCode:e.projectCode,backendUrl:(r=e.backendUrl)!=null?r:null,token:(o=e.token)!=null?o:null,project:null,resolvingProject:!1,permissions:null},hi(()=>yl(),()=>nk(),()=>gi()),$n(or().length),q.backendUrl&&q.token){const i=q.backendUrl,a=q.token;yield El(),il({backendUrl:i,token:a}).catch(()=>{}),Tl({backendUrl:i,token:a}).catch(()=>{});const d=Sg();d&&ti(d.taskId,{backendUrl:i,token:a},d.backendUrl,d.title,()=>{})}fl()}})}function fi(e,t){return I(this,null,function*(){if(!q)throw new Error("AgentPlatformSDK: call init() first.");q.backendUrl=e,q.token=t,q.project=null,q.permissions=null,yield El(),Tl({backendUrl:e,token:t}).catch(()=>{})})}function yl(){if(!q)throw new Error("AgentPlatformSDK: call init() first.");if(Bn())return;kr();const e=(t,n,r)=>{ul(t,n,{backendUrl:q.backendUrl,token:q.token},q.project,q.projectCode,o=>I(null,null,function*(){yield fi(o.backendUrl,o.token)}),o=>{ui(i=>{Zo(i),Jo(i).then(()=>e(o.currentCtx,o.currentPickedEl,o)).catch(console.error)})},o=>{gs((i,a)=>{Dr()&&o(i,a)},()=>{wl()})},(o,i)=>{gs((a,d)=>{Dr()&&o(a,d)},()=>{Dr()&&i()})},()=>{Bn()&&ms()},q.permissions,r)};gs((t,n)=>I(null,null,function*(){pl()&&On(),e(t,n)}),()=>{})}function tk(){ms()}function nk(){if(!q)throw new Error("AgentPlatformSDK: call init() first.");if(zo())return;kr();const e=(t,n)=>{ul(t,null,{backendUrl:q.backendUrl,token:q.token},q.project,q.projectCode,r=>I(null,null,function*(){yield fi(r.backendUrl,r.token)}),r=>{ui(o=>{Zo(o),Jo(o).then(()=>e(r.currentCtx,r)).catch(console.error)})},void 0,void 0,()=>{},q.permissions,n)};xb(t=>{Qb(t,n=>e(n))})}function wl(){Dr()&&Mr()}function rk(){return Bn()}function xl(){Xb(),Nn&&(window.removeEventListener("hashchange",Nn),Nn=null),ms(),Sb(),Fo(),Mr(),On(),rl(),Bo=null,Go=null,Wo=null,q=null}function Sl(){if(typeof window=="undefined"||typeof document=="undefined")return;kr();const e=Mb(),t=()=>{e?Jo(e).catch(console.error):(hi(()=>Ur(),()=>Ur(),()=>gi()),$n(or().length),fl())};if(kl()){_l(),t();return}Nn=()=>{window.location.hash===ml&&(_l(),window.removeEventListener("hashchange",Nn),Nn=null,t())},window.addEventListener("hashchange",Nn)}function ok(){Bo&&Go&&Wo&&nl(Bo,Go,Wo)}function sk(){rl()}function Ur(){ui(e=>{Zo(e),Jo(e).catch(console.error)})}function ik(){al(),xl(),kr(),kl()&&(hi(()=>Ur(),()=>Ur(),()=>gi()),$n(or().length))}function Jo(e){return I(this,null,function*(){yield vl({projectCode:e.projectCode,backendUrl:e.backendUrl,token:e.token})})}function gi(){if(pl()){On();return}Dr()&&Mr();const e=q!=null&&q.backendUrl&&(q!=null&&q.token)?{backendUrl:q.backendUrl,token:q.token}:null;Gb(e)}function Tl(e){return I(this,null,function*(){const t=yield lg(e);q&&(q.permissions=t.permissions)})}function El(){return I(this,null,function*(){if(!(!q||!q.backendUrl||!q.token||q.project||q.resolvingProject)){q.resolvingProject=!0;try{q.project=yield og({backendUrl:q.backendUrl,token:q.token},q.projectCode)}catch(e){}finally{q&&(q.resolvingProject=!1)}}})}return Sl(),oe.activateElementPicker=yl,oe.autoInit=Sl,oe.clearConfig=ik,oe.closePanelIfOpen=wl,oe.configure=Ur,oe.deactivateElementPicker=tk,oe.destroy=xl,oe.hideFab=sk,oe.init=vl,oe.isPickerRunning=rk,oe.showFab=ok,oe.updateCredentials=fi,Object.defineProperty(oe,Symbol.toStringTag,{value:"Module"}),oe})({});
1982
+ `}).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(d=>{d.addEventListener("click",()=>{const l=parseInt(d.dataset.apStepRemove,10);Tn.splice(l,1),i()})}),r.querySelectorAll("[data-ap-step-value]").forEach(d=>{const l=d.closest("[data-step-index]"),p=parseInt(l.dataset.stepIndex,10);d.addEventListener("input",()=>{var g;const h=Tn[p];h.value=d.value,h.description=fl((g=h.elementText)!=null?g:"",d.value,!1)})})};i();const a=()=>{ss()};Ce.querySelector("[data-ap-review-close]").addEventListener("click",a),Ce.querySelector("[data-ap-review-cancel]").addEventListener("click",a),o.addEventListener("click",()=>{if(Tn.length===0)return;const d=Tn,l=M(v({},Ki()),{pageUrl:window.location.href,pageTitle:document.title,interactionSteps:d});ss(),t(l)})}function Zl(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function $k(e){return Zl(e)}let B=null,is=null,as=null,cs=null;function Pi(e,t,n){is=e,as=t,cs=n,Sl(e,t,n)}const ql="#agent-platform-web-sdk",Hl="ap-sdk-fab-unlocked";let Hn=null;function Fl(){try{if(localStorage.getItem(Hl)==="1")return!0}catch(e){}return window.location.hash===ql}function Bl(){try{localStorage.setItem(Hl,"1")}catch(e){}}function Gl(e){return z(this,null,function*(){var n,r,o,i,a;if(Er(),e.requestTimeoutMs!=null&&Ig(e.requestTimeoutMs),Ou((n=e.exclusionSelector)!=null?n:null),B&&B.projectCode===e.projectCode&&B.backendUrl===((r=e.backendUrl)!=null?r:null)&&B.token===((o=e.token)!=null?o:null))return;B={projectCode:e.projectCode,backendUrl:(i=e.backendUrl)!=null?i:null,token:(a=e.token)!=null?a:null,project:null,resolvingProject:!1,permissions:null},Pi(()=>Jl(),()=>Ok(),()=>$i()),jn(dr().length);let t=!1;if(B.backendUrl&&B.token){const d=B.backendUrl,l=B.token;yield Ql(),Cl({backendUrl:d,token:l}).catch(()=>{}),Kl({backendUrl:d,token:l}).catch(()=>{});const p=Qg();p&&(mi(p.taskId,{backendUrl:d,token:l},p.backendUrl,p.title,()=>{}),t=!0)}t||Ul(Wl),Dl()})}function Ri(e,t){return z(this,null,function*(){if(!B)throw new Error("AgentPlatformSDK: call init() first.");B.backendUrl=e,B.token=t,B.project=null,B.permissions=null,yield Ql(),Kl({backendUrl:e,token:t}).catch(()=>{})})}function Li(e,t,n){if(!B)throw new Error("AgentPlatformSDK: call init() first.");$l(e,t,{backendUrl:B.backendUrl,token:B.token},B.project,B.projectCode,r=>z(null,null,function*(){yield Ri(r.backendUrl,r.token)}),r=>{Ti(o=>{ts(o),ls(o).then(()=>Li(r.currentCtx,r.currentPickedEl,r)).catch(console.error)})},r=>{Rs((o,i)=>{Kr()&&r(o,i)},()=>{Yl()})},(r,o)=>{Rs((i,a)=>{Kr()&&r(i,a)},()=>{Kr()&&o()})},()=>{Kn()&&Ls()},B.permissions,n)}function Ii(e,t){if(!B)throw new Error("AgentPlatformSDK: call init() first.");$l(e,null,{backendUrl:B.backendUrl,token:B.token},B.project,B.projectCode,n=>z(null,null,function*(){yield Ri(n.backendUrl,n.token)}),n=>{Ti(r=>{ts(r),ls(r).then(()=>Ii(n.currentCtx,n)).catch(console.error)})},void 0,void 0,()=>{},B.permissions,t)}function Wl(e){var t;if(!B){_r();return}(t=e.currentCtx.interactionSteps)!=null&&t.length?Ii(e.currentCtx,void 0):Li(e.currentCtx,null,void 0)}function Jl(){if(!B)throw new Error("AgentPlatformSDK: call init() first.");Kn()||(qn(),Er(),Rs((e,t)=>z(null,null,function*(){Ol()&&Zn(),Li(e,t)}),()=>{}))}function zk(){Ls()}function Ok(){if(!B)throw new Error("AgentPlatformSDK: call init() first.");Wo()||(qn(),Er(),ek(e=>{Ik(e,t=>Ii(t))}))}function Yl(){Kr()&&Qr()}function Nk(){return Kn()}function Vl(){Pk(),Hn&&(window.removeEventListener("hashchange",Hn),Hn=null),Ls(),tk(),ss(),Qr(),Zn(),qn(),Tl(),is=null,as=null,cs=null,B=null}function Xl(){if(typeof window=="undefined"||typeof document=="undefined")return;Er();const e=gk(),t=()=>{e?ls(e).catch(console.error):(Pi(()=>_r(),()=>_r(),()=>$i()),jn(dr().length),Ul(Wl),Dl())};if(Fl()){Bl(),t();return}Hn=()=>{window.location.hash===ql&&(Bl(),window.removeEventListener("hashchange",Hn),Hn=null,t())},window.addEventListener("hashchange",Hn)}function Dk(){is&&as&&cs&&Sl(is,as,cs)}function Mk(){Tl()}function _r(){qn(),Ti(e=>{ts(e),ls(e).catch(console.error)})}function Uk(){Pl(),Vl(),Er(),Fl()&&(Pi(()=>_r(),()=>_r(),()=>$i()),jn(dr().length))}function ls(e){return z(this,null,function*(){yield Gl({projectCode:e.projectCode,backendUrl:e.backendUrl,token:e.token})})}function $i(){if(Ol()){Zn();return}qn(),Kr()&&Qr();const e=B!=null&&B.backendUrl&&(B!=null&&B.token)?{backendUrl:B.backendUrl,token:B.token}:null;Sk(e)}function Kl(e){return z(this,null,function*(){const t=yield Mg(e);B&&(B.permissions=t.permissions)})}function Ql(){return z(this,null,function*(){if(!(!B||!B.backendUrl||!B.token||B.project||B.resolvingProject)){B.resolvingProject=!0;try{B.project=yield $g({backendUrl:B.backendUrl,token:B.token},B.projectCode)}catch(e){}finally{B&&(B.resolvingProject=!1)}}})}return Xl(),ae.activateElementPicker=Jl,ae.autoInit=Xl,ae.clearConfig=Uk,ae.closePanelIfOpen=Yl,ae.configure=_r,ae.deactivateElementPicker=zk,ae.destroy=Vl,ae.hideFab=Mk,ae.init=Gl,ae.isPickerRunning=Nk,ae.showFab=Dk,ae.updateCredentials=Ri,Object.defineProperty(ae,Symbol.toStringTag,{value:"Module"}),ae})({});
1913
1983
  //# sourceMappingURL=web-sdk.min.js.map