@tung-engineering/agent-platform-web-sdk 0.0.55 → 0.0.56

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 AgentPlatformWebSdk=function(we){"use strict";var Wb=Object.defineProperty;var Gb=(we,Et,Yt)=>Et in we?Wb(we,Et,{enumerable:!0,configurable:!0,writable:!0,value:Yt}):we[Et]=Yt;var ie=(we,Et,Yt)=>Gb(we,typeof Et!="symbol"?Et+"":Et,Yt);var _o;const Et=`
1
+ var AgentPlatformWebSdk=function(Se){"use strict";var zk=Object.defineProperty;var Ik=(Se,Rt,an)=>Rt in Se?zk(Se,Rt,{enumerable:!0,configurable:!0,writable:!0,value:an}):Se[Rt]=an;var ie=(Se,Rt,an)=>Ik(Se,typeof Rt!="symbol"?Rt+"":Rt,an);var Uo;const Rt=`
2
2
  /* ── Agent Platform SDK — namespaced styles ────────────────────────────── */
3
3
 
4
4
  /* Reset Popover API UA defaults so top-layer-promoted elements keep our own
@@ -96,6 +96,61 @@ var AgentPlatformWebSdk=function(we){"use strict";var Wb=Object.defineProperty;v
96
96
  background: oklch(95% 0.035 50);
97
97
  }
98
98
 
99
+ /* Floating bar shown while recorder.ts is capturing a workflow */
100
+ .ap-sdk-recorder-bar {
101
+ position: fixed;
102
+ bottom: 16px;
103
+ left: 50%;
104
+ transform: translateX(-50%);
105
+ display: flex;
106
+ align-items: center;
107
+ gap: 8px;
108
+ background: oklch(58% 0.13 42);
109
+ color: #fff;
110
+ font-family: system-ui, -apple-system, sans-serif;
111
+ font-size: 13px;
112
+ font-weight: 500;
113
+ padding: 8px 10px 8px 14px;
114
+ border-radius: 999px;
115
+ z-index: 2147483646;
116
+ box-shadow: 0 4px 12px rgba(0,0,0,0.25);
117
+ white-space: nowrap;
118
+ pointer-events: all;
119
+ }
120
+
121
+ .ap-sdk-recorder-bar__counter {
122
+ white-space: nowrap;
123
+ }
124
+
125
+ .ap-sdk-recorder-bar__btn {
126
+ pointer-events: all;
127
+ background: rgba(255, 255, 255, 0.16);
128
+ color: #fff;
129
+ border: 1px solid rgba(255, 255, 255, 0.4);
130
+ border-radius: 999px;
131
+ padding: 5px 10px;
132
+ font-size: 12px;
133
+ font-weight: 500;
134
+ font-family: inherit;
135
+ cursor: pointer;
136
+ white-space: nowrap;
137
+ transition: background 0.15s;
138
+ }
139
+
140
+ .ap-sdk-recorder-bar__btn:hover {
141
+ background: rgba(255, 255, 255, 0.28);
142
+ }
143
+
144
+ .ap-sdk-recorder-bar__btn--stop {
145
+ background: #fff;
146
+ color: oklch(48% 0.13 40);
147
+ border-color: #fff;
148
+ }
149
+
150
+ .ap-sdk-recorder-bar__btn--stop:hover {
151
+ background: oklch(95% 0.035 50);
152
+ }
153
+
99
154
  @keyframes ap-sdk-panel-in {
100
155
  from { opacity: 0; transform: translateY(-50%) translateX(16px) scale(0.98); }
101
156
  to { opacity: 1; transform: translateY(-50%) translateX(0) scale(1); }
@@ -242,6 +297,32 @@ var AgentPlatformWebSdk=function(we){"use strict";var Wb=Object.defineProperty;v
242
297
  white-space: nowrap;
243
298
  }
244
299
 
300
+ .ap-sdk-panel__context-steps {
301
+ display: flex;
302
+ flex-direction: column;
303
+ gap: 4px;
304
+ max-height: 160px;
305
+ overflow-y: auto;
306
+ }
307
+
308
+ .ap-sdk-panel__context-step {
309
+ display: flex;
310
+ align-items: center;
311
+ gap: 6px;
312
+ font-size: 12px;
313
+ color: #111827;
314
+ }
315
+
316
+ .ap-sdk-panel__context-step-icon {
317
+ flex-shrink: 0;
318
+ }
319
+
320
+ .ap-sdk-panel__context-step-text {
321
+ overflow: hidden;
322
+ text-overflow: ellipsis;
323
+ white-space: nowrap;
324
+ }
325
+
245
326
  .ap-sdk-panel__body {
246
327
  padding: 14px 16px;
247
328
  display: flex;
@@ -836,6 +917,69 @@ button.ap-sdk-list-item__link {
836
917
  -webkit-box-orient: vertical;
837
918
  }
838
919
 
920
+ /* ── Record review list ─────────────────────────────────────────────────── */
921
+
922
+ .ap-sdk-record-review__list {
923
+ max-height: 320px;
924
+ overflow-y: auto;
925
+ overscroll-behavior: contain;
926
+ border-bottom: 1px solid #f3f4f6;
927
+ }
928
+
929
+ .ap-sdk-record-step {
930
+ display: flex;
931
+ align-items: center;
932
+ gap: 8px;
933
+ padding: 8px 16px;
934
+ border-bottom: 1px solid #f3f4f6;
935
+ font-size: 12px;
936
+ }
937
+
938
+ .ap-sdk-record-step:last-child {
939
+ border-bottom: none;
940
+ }
941
+
942
+ .ap-sdk-record-step__icon {
943
+ flex-shrink: 0;
944
+ }
945
+
946
+ .ap-sdk-record-step__description {
947
+ flex: 1;
948
+ color: #374151;
949
+ overflow: hidden;
950
+ text-overflow: ellipsis;
951
+ white-space: nowrap;
952
+ }
953
+
954
+ .ap-sdk-record-step__input {
955
+ flex: 1;
956
+ box-sizing: border-box;
957
+ border: 1px solid oklch(58% 0.13 42);
958
+ border-radius: 6px;
959
+ padding: 4px 8px;
960
+ font-size: 12px;
961
+ font-family: inherit;
962
+ color: #111827;
963
+ }
964
+
965
+ .ap-sdk-record-step__remove {
966
+ background: none;
967
+ border: none;
968
+ cursor: pointer;
969
+ color: oklch(58% 0.13 42);
970
+ font-size: 13px;
971
+ line-height: 1;
972
+ padding: 0 2px;
973
+ border-radius: 3px;
974
+ flex-shrink: 0;
975
+ transition: color 0.1s, background 0.1s;
976
+ }
977
+
978
+ .ap-sdk-record-step__remove:hover {
979
+ color: #ef4444;
980
+ background: #fee2e2;
981
+ }
982
+
839
983
  /* "Add another" button */
840
984
  .ap-sdk-panel__btn--add-another {
841
985
  width: 100%;
@@ -1181,11 +1325,11 @@ button.ap-sdk-list-item__link {
1181
1325
  border-right: 2px solid #d1d5db;
1182
1326
  border-bottom: 2px solid #d1d5db;
1183
1327
  }
1184
- `;let Yt=!1;function Lr(){if(Yt)return;const e=document.createElement("style");e.setAttribute("data-ap-sdk","1"),e.textContent=Et,document.head.appendChild(e),Yt=!0}function qc(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 s=Array.from(o.children).filter(c=>c.tagName===n.tagName);if(s.length>1){const c=s.indexOf(n)+1;r+=`:nth-of-type(${c})`}}t.unshift(r),n=n.parentElement}return t.join(" > ")||e.tagName.toLowerCase()}function Fc(e,t=200){const n=(e.textContent??"").replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}const Hc=["role","type","name","href","src","alt","title","for","placeholder","data-testid"];function Ir(e){const t=e.tagName.toLowerCase(),n=e.id?`#${e.id}`:"",r=e.classList.length?"."+Array.from(e.classList).join("."):"",o=[],s=new Set,c=u=>{if(s.has(u)||o.length>=8)return;const d=e.getAttribute(u);if(!d)return;s.add(u);const p=d.length>80?d.slice(0,80)+"…":d;o.push(`[${u}="${p}"]`)};for(const u of Array.from(e.attributes))u.name.startsWith("aria-")&&c(u.name);for(const u of Hc)c(u);return`${t}${n}${r}${o.join("")}`}function Bc(e,t=80){const n=Array.from(e.childNodes).filter(r=>r.nodeType===Node.TEXT_NODE).map(r=>(r.textContent??"").trim()).filter(Boolean).join(" ");return n.length>t?n.slice(0,t)+"…":n}function Wc(e,t=5,n=10){function r(o,s){const c=Ir(o),u=" ".repeat(s),d=Array.from(o.children).slice(0,n);if(s>=t||d.length===0){const p=Bc(o);return p?`${u}${c} "${p}"`:`${u}${c}`}return[`${u}${c}`,...d.map(p=>r(p,s+1))].join(`
1185
- `)}return r(e,0)}const Gc='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"]',Jc={fieldset:"legend",table:"caption",figure:"figcaption",details:"summary"};function $r(e,t){const n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}function Xc(e){const t=e.querySelectorAll('h1, h2, h3, h4, h5, h6, [role="heading"]');for(const n of Array.from(t)){let r=n.parentElement;for(;r&&r!==e&&!r.matches(Gc);)r=r.parentElement;if(r===e){const o=(n.textContent??"").trim();if(o)return o}}return""}function Vc(e,t=80){var c,u,d;const n=Jc[e.tagName.toLowerCase()];if(n){const p=(u=(c=e.querySelector(n))==null?void 0:c.textContent)==null?void 0:u.trim();if(p)return $r(p,t)}const r=Xc(e);if(r)return $r(r,t);const o=(d=e.getAttribute("aria-label"))==null?void 0:d.trim();if(o)return $r(o,t);const s=e.getAttribute("aria-labelledby");if(s){const p=s.split(/\s+/).map(h=>{var k,m;return((m=(k=document.getElementById(h))==null?void 0:k.textContent)==null?void 0:m.trim())??""}).filter(Boolean).join(" ");if(p)return $r(p,t)}return""}function Yc(e,t=6){const n=[],r=new Set;let o=e;for(;o&&o!==document.body&&n.length<t;){const s=o===e?"":Vc(o),c=s&&!r.has(s)?`${Ir(o)} ["${s}"]`:Ir(o);s&&r.add(s),n.unshift(c),o=o.parentElement}return n.join(" > ")||Ir(e)}function Wi(e,t){return e.length>t?e.slice(0,t)+"… (truncated)":e}function Jn(e){var r;const t=document.querySelector(e);return((r=t==null?void 0:t.content)==null?void 0:r.trim())||void 0}function Kc(){const e=t=>{try{return t()}catch{return}};return{description:e(()=>Jn('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(()=>Jn('meta[property="og:title"]')),ogDescription:e(()=>Jn('meta[property="og:description"]')),ogType:e(()=>Jn('meta[property="og:type"]')),ogSiteName:e(()=>Jn('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?Wi(t,1e3):void 0}),capturedAt:new Date().toISOString()}}function Qc(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 el(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 s=o.querySelector("h1, h2, h3, h4, h5, h6"),c=o.getAttribute("aria-label")||((s==null?void 0:s.textContent)||"").trim(),u=o.tagName.toLowerCase();r=c?`${u}: ${Wi(c,120)}`:u}return{elementRole:t,elementAriaLabel:n,enclosingSection:r}}function tl(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(`
1186
- `)}const vn=new Set;let yn=null,Nr=!1,Do=!1;function nl(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function rl(){const e=document.querySelectorAll("dialog[open]");for(let n=0;n<e.length;n++)try{if(e[n].matches(":modal"))return!0}catch{}const t=document.querySelectorAll('[role="dialog"], [role="alertdialog"]');for(let n=0;n<t.length;n++){const r=t[n];if(!(vn.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&nl(r))return!0}return!1}function Gi(){const e=rl(),t=e&&!Do;Do=e;for(const n of vn){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{}try{n.showPopover()}catch{}}}else try{n.showPopover()}catch{}}}function Ji(e){if(!(e instanceof Node))return!1;for(const t of vn)if(t===e||t.contains(e))return!0;return!1}function wn(e){(Ji(e.target)||"relatedTarget"in e&&Ji(e.relatedTarget))&&e.stopPropagation()}function ol(){Nr||(window.addEventListener("focusin",wn,!0),window.addEventListener("focusout",wn,!0),window.addEventListener("pointerdown",wn,!0),Nr=!0),!yn&&(yn=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")&&Gi()}),yn.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function Kt(e){"showPopover"in e&&(e.setAttribute("popover","manual"),vn.add(e),ol(),Gi())}function Qt(e){if(vn.delete(e),vn.size===0&&(yn&&(yn.disconnect(),yn=null),Nr&&(window.removeEventListener("focusin",wn,!0),window.removeEventListener("focusout",wn,!0),window.removeEventListener("pointerdown",wn,!0),Nr=!1),Do=!1),"hidePopover"in e)try{e.hidePopover()}catch{}}function Mo(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),Kt(t),{el:t,update:s=>{const c=s.getBoundingClientRect();t.style.top=`${c.top}px`,t.style.left=`${c.left}px`,t.style.width=`${c.width}px`,t.style.height=`${c.height}px`,t.style.display="block"},hide:()=>{t.style.display="none"},destroy:()=>{Qt(t),t.remove()}}}const il="🎯 Click any element to capture";let Dt=null,Ae=null,Je=null;function Xi(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 sl(){var e;return(((e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)??!1)||"ontouchstart"in window}function Vi(e){Dt==null||Dt.update(e)}function Yi(e){const t=Kc(),n=Qc(e),r=el(e);let o;try{o=e.outerHTML.slice(0,4e3)}catch{}return{pageUrl:window.location.href,pageTitle:document.title,elementText:Fc(e),cssSelector:qc(e),innerTree:Wc(e),outerTree:Yc(e),elementOuterHtml:o,ancestry:n,...r,...t}}function Ki(e,t){Je&&Je();const n=sl();Dt=Mo(),Ae=document.createElement("div"),Ae.className="ap-sdk-picker-cursor",Ae.setAttribute("data-ap-sdk","1"),Ae.textContent=n?"Tap any element to preview":il,document.body.appendChild(Ae),Kt(Ae);let r=null,o=null;const s=h=>{Je==null||Je(),e(Yi(h),h)},c=h=>{if(o=h,Vi(h),!Ae)return;Ae.classList.add("ap-sdk-picker-cursor--confirm"),Ae.innerHTML="";const k=document.createElement("span");k.className="ap-sdk-picker-cursor__label",k.textContent=`<${h.tagName.toLowerCase()}>`;const m=document.createElement("button");m.type="button",m.className="ap-sdk-picker-cursor__btn",m.textContent="⬆ Parent",m.setAttribute("data-ap-sdk","1"),m.addEventListener("click",w=>{w.preventDefault(),w.stopPropagation(),o!=null&&o.parentElement&&c(o.parentElement)});const _=document.createElement("button");_.type="button",_.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",_.textContent="✓ Select",_.setAttribute("data-ap-sdk","1"),_.addEventListener("click",w=>{w.preventDefault(),w.stopPropagation(),o&&s(o)}),Ae.appendChild(k),Ae.appendChild(m),Ae.appendChild(_)},u=h=>{Xi(h.target)||(r=h.target,Vi(r))},d=h=>{if(Xi(h.target))return;h.preventDefault(),h.stopImmediatePropagation();const k=h.target??r;if(k){if(n){c(k);return}s(k)}},p=h=>{h.key==="Escape"&&(Je==null||Je(),t())};n||document.addEventListener("mouseover",u,{capture:!0}),document.addEventListener("click",d,{capture:!0}),document.addEventListener("keydown",p,{capture:!0}),Je=()=>{n||document.removeEventListener("mouseover",u,{capture:!0}),document.removeEventListener("click",d,{capture:!0}),document.removeEventListener("keydown",p,{capture:!0}),Ae&&Qt(Ae),Ae==null||Ae.remove(),Dt==null||Dt.destroy(),Dt=null,Ae=null,o=null,Je=null}}function Uo(){Je==null||Je()}function Xn(){return Je!==null}function v(e,t,n){function r(u,d){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:d,constr:c,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,d);const p=c.prototype,h=Object.keys(p);for(let k=0;k<h.length;k++){const m=h[k];m in u||(u[m]=p[m].bind(u))}}const o=(n==null?void 0:n.Parent)??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function c(u){var d;const p=n!=null&&n.Parent?new s:this;r(p,u),(d=p._zod).deferred??(d.deferred=[]);for(const h of p._zod.deferred)h();return p}return Object.defineProperty(c,"init",{value:r}),Object.defineProperty(c,Symbol.hasInstance,{value:u=>{var d,p;return n!=null&&n.Parent&&u instanceof n.Parent?!0:(p=(d=u==null?void 0:u._zod)==null?void 0:d.traits)==null?void 0:p.has(e)}}),Object.defineProperty(c,"name",{value:e}),c}class xn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Qi extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const es={};function Mt(e){return es}function ts(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 jo(e,t){return typeof t=="bigint"?t.toString():t}function Or(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Zo(e){return e==null}function qo(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function al(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 d=r.match(/\d?e-(\d?)/);d!=null&&d[1]&&(o=Number.parseInt(d[1]))}const s=n>o?n:o,c=Number.parseInt(e.toFixed(s).replace(".","")),u=Number.parseInt(t.toFixed(s).replace(".",""));return c%u/10**s}const ns=Symbol("evaluating");function V(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ns)return r===void 0&&(r=ns,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function en(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ut(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function rs(e){return JSON.stringify(e)}function cl(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const os="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Vn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const ll=Or(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Sn(e){if(Vn(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Vn(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function is(e){return Sn(e)?{...e}:Array.isArray(e)?[...e]:e}const ul=new Set(["string","number","symbol"]);function Tn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function jt(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function O(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"?{...t,error:()=>t.error}:t}function dl(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const pl={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 hl(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 s=Ut(e._zod.def,{get shape(){const c={};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(c[u]=n.shape[u])}return en(this,"shape",c),c},checks:[]});return jt(e,s)}function fl(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 s=Ut(e._zod.def,{get shape(){const c={...e._zod.def.shape};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&delete c[u]}return en(this,"shape",c),c},checks:[]});return jt(e,s)}function gl(e,t){if(!Sn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const c in t)if(Object.getOwnPropertyDescriptor(s,c)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Ut(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return en(this,"shape",s),s}});return jt(e,o)}function ml(e,t){if(!Sn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Ut(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return en(this,"shape",r),r}});return jt(e,n)}function bl(e,t){const n=Ut(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return en(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return jt(e,n)}function kl(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 c=Ut(t._zod.def,{get shape(){const u=t._zod.def.shape,d={...u};if(n)for(const p in n){if(!(p in u))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(d[p]=e?new e({type:"optional",innerType:u[p]}):u[p])}else for(const p in u)d[p]=e?new e({type:"optional",innerType:u[p]}):u[p];return en(this,"shape",d),d},checks:[]});return jt(t,c)}function _l(e,t,n){const r=Ut(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const c in n){if(!(c in s))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(s[c]=new e({type:"nonoptional",innerType:o[c]}))}else for(const c in o)s[c]=new e({type:"nonoptional",innerType:o[c]});return en(this,"shape",s),s}});return jt(t,r)}function En(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 An(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Dr(e){return typeof e=="string"?e:e==null?void 0:e.message}function Zt(e,t,n){var o,s,c,u,d,p;const r={...e,path:e.path??[]};if(!e.message){const h=Dr((c=(s=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:s.error)==null?void 0:c.call(s,e))??Dr((u=t==null?void 0:t.error)==null?void 0:u.call(t,e))??Dr((d=n.customError)==null?void 0:d.call(n,e))??Dr((p=n.localeError)==null?void 0:p.call(n,e))??"Invalid input";r.message=h}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Fo(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Yn(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const ss=(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,jo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},as=v("$ZodError",ss),cs=v("$ZodError",ss,{Parent:Error});function vl(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 yl(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(c=>r({issues:c}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let c=n,u=0;for(;u<s.path.length;){const d=s.path[u];u===s.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(t(s))):c[d]=c[d]||{_errors:[]},c=c[d],u++}}};return r(e),n}const Ho=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new xn;if(c.issues.length){const u=new((o==null?void 0:o.Err)??e)(c.issues.map(d=>Zt(d,s,Mt())));throw os(u,o==null?void 0:o.callee),u}return c.value},Bo=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise&&(c=await c),c.issues.length){const u=new((o==null?void 0:o.Err)??e)(c.issues.map(d=>Zt(d,s,Mt())));throw os(u,o==null?void 0:o.callee),u}return c.value},Mr=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new xn;return s.issues.length?{success:!1,error:new(e??as)(s.issues.map(c=>Zt(c,o,Mt())))}:{success:!0,data:s.value}},wl=Mr(cs),Ur=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(c=>Zt(c,o,Mt())))}:{success:!0,data:s.value}},xl=Ur(cs),Sl=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ho(e)(t,n,o)},Tl=e=>(t,n,r)=>Ho(e)(t,n,r),El=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Bo(e)(t,n,o)},Al=e=>async(t,n,r)=>Bo(e)(t,n,r),Cl=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Mr(e)(t,n,o)},Pl=e=>(t,n,r)=>Mr(e)(t,n,r),Rl=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ur(e)(t,n,o)},zl=e=>async(t,n,r)=>Ur(e)(t,n,r),Ll=/^[cC][^\s-]{8,}$/,Il=/^[0-9a-z]+$/,$l=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Nl=/^[0-9a-vA-V]{20}$/,Ol=/^[A-Za-z0-9]{27}$/,Dl=/^[a-zA-Z0-9_-]{21}$/,Ml=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ul=/^([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})$/,ls=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)$/,jl=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Zl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ql(){return new RegExp(Zl,"u")}const Fl=/^(?:(?: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])$/,Hl=/^(([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}|:))$/,Bl=/^((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])$/,Wl=/^(([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])$/,Gl=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,us=/^[A-Za-z0-9_-]*$/,Jl=/^\+[1-9]\d{6,14}$/,ds="(?:(?:\\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])))",Xl=new RegExp(`^${ds}$`);function ps(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 Vl(e){return new RegExp(`^${ps(e)}$`)}function Yl(e){const t=ps({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(`^${ds}T(?:${r})$`)}const Kl=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ql=/^-?\d+$/,hs=/^-?\d+(?:\.\d+)?$/,eu=/^(?:true|false)$/i,tu=/^[^A-Z]*$/,nu=/^[^a-z]*$/,Xe=v("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),fs={number:"number",bigint:"bigint",object:"date"},gs=v("$ZodCheckLessThan",(e,t)=>{Xe.init(e,t);const n=fs[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(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})}}),ms=v("$ZodCheckGreaterThan",(e,t)=>{Xe.init(e,t);const n=fs[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(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})}}),ru=v("$ZodCheckMultipleOf",(e,t)=>{Xe.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(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):al(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})}}),ou=v("$ZodCheckNumberFormat",(e,t)=>{var c;Xe.init(e,t),t.format=t.format||"float64";const n=(c=t.format)==null?void 0:c.includes("int"),r=n?"int":"number",[o,s]=pl[t.format];e._zod.onattach.push(u=>{const d=u._zod.bag;d.format=t.format,d.minimum=o,d.maximum=s,n&&(d.pattern=Ql)}),e._zod.check=u=>{const d=u.value;if(n){if(!Number.isInteger(d)){u.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:d,inst:e});return}if(!Number.isSafeInteger(d)){d>0?u.issues.push({input:d,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}):u.issues.push({input:d,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}}d<o&&u.issues.push({origin:"number",input:d,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),d>s&&u.issues.push({origin:"number",input:d,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),iu=v("$ZodCheckMaxLength",(e,t)=>{var n;Xe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Zo(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const c=Fo(o);r.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),su=v("$ZodCheckMinLength",(e,t)=>{var n;Xe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Zo(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const c=Fo(o);r.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),au=v("$ZodCheckLengthEquals",(e,t)=>{var n;Xe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Zo(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const c=Fo(o),u=s>t.length;r.issues.push({origin:c,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),jr=v("$ZodCheckStringFormat",(e,t)=>{var n,r;Xe.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),cu=v("$ZodCheckRegex",(e,t)=>{jr.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})}}),lu=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=tu),jr.init(e,t)}),uu=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=nu),jr.init(e,t)}),du=v("$ZodCheckIncludes",(e,t)=>{Xe.init(e,t);const n=Tn(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.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})}}),pu=v("$ZodCheckStartsWith",(e,t)=>{Xe.init(e,t);const n=new RegExp(`^${Tn(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),hu=v("$ZodCheckEndsWith",(e,t)=>{Xe.init(e,t);const n=new RegExp(`.*${Tn(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),fu=v("$ZodCheckOverwrite",(e,t)=>{Xe.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class gu{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(`
1328
+ `;let an=!1;function cr(){if(an)return;const e=document.createElement("style");e.setAttribute("data-ap-sdk","1"),e.textContent=Rt,document.head.appendChild(e),an=!0}function Gr(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 s=Array.from(o.children).filter(c=>c.tagName===n.tagName);if(s.length>1){const c=s.indexOf(n)+1;r+=`:nth-of-type(${c})`}}t.unshift(r),n=n.parentElement}return t.join(" > ")||e.tagName.toLowerCase()}function Wr(e,t=200){const n=(e.textContent??"").replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}const bl=["role","type","name","href","src","alt","title","for","placeholder","data-testid"];function Jr(e){const t=e.tagName.toLowerCase(),n=e.id?`#${e.id}`:"",r=e.classList.length?"."+Array.from(e.classList).join("."):"",o=[],s=new Set,c=u=>{if(s.has(u)||o.length>=8)return;const d=e.getAttribute(u);if(!d)return;s.add(u);const p=d.length>80?d.slice(0,80)+"…":d;o.push(`[${u}="${p}"]`)};for(const u of Array.from(e.attributes))u.name.startsWith("aria-")&&c(u.name);for(const u of bl)c(u);return`${t}${n}${r}${o.join("")}`}function kl(e,t=80){const n=Array.from(e.childNodes).filter(r=>r.nodeType===Node.TEXT_NODE).map(r=>(r.textContent??"").trim()).filter(Boolean).join(" ");return n.length>t?n.slice(0,t)+"…":n}function _l(e,t=5,n=10){function r(o,s){const c=Jr(o),u=" ".repeat(s),d=Array.from(o.children).slice(0,n);if(s>=t||d.length===0){const p=kl(o);return p?`${u}${c} "${p}"`:`${u}${c}`}return[`${u}${c}`,...d.map(p=>r(p,s+1))].join(`
1329
+ `)}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"]',yl={fieldset:"legend",table:"caption",figure:"figcaption",details:"summary"};function Xr(e,t){const n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}function wl(e){const t=e.querySelectorAll('h1, h2, h3, h4, h5, h6, [role="heading"]');for(const n of Array.from(t)){let r=n.parentElement;for(;r&&r!==e&&!r.matches(vl);)r=r.parentElement;if(r===e){const o=(n.textContent??"").trim();if(o)return o}}return""}function xl(e,t=80){var c,u,d;const n=yl[e.tagName.toLowerCase()];if(n){const p=(u=(c=e.querySelector(n))==null?void 0:c.textContent)==null?void 0:u.trim();if(p)return Xr(p,t)}const r=wl(e);if(r)return Xr(r,t);const o=(d=e.getAttribute("aria-label"))==null?void 0:d.trim();if(o)return Xr(o,t);const s=e.getAttribute("aria-labelledby");if(s){const p=s.split(/\s+/).map(h=>{var b,m;return((m=(b=document.getElementById(h))==null?void 0:b.textContent)==null?void 0:m.trim())??""}).filter(Boolean).join(" ");if(p)return Xr(p,t)}return""}function Sl(e,t=6){const n=[],r=new Set;let o=e;for(;o&&o!==document.body&&n.length<t;){const s=o===e?"":xl(o),c=s&&!r.has(s)?`${Jr(o)} ["${s}"]`:Jr(o);s&&r.add(s),n.unshift(c),o=o.parentElement}return n.join(" > ")||Jr(e)}function hs(e,t){return e.length>t?e.slice(0,t)+"… (truncated)":e}function lr(e){var r;const t=document.querySelector(e);return((r=t==null?void 0:t.content)==null?void 0:r.trim())||void 0}function fs(){const e=t=>{try{return t()}catch{return}};return{description:e(()=>lr('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(()=>lr('meta[property="og:title"]')),ogDescription:e(()=>lr('meta[property="og:description"]')),ogType:e(()=>lr('meta[property="og:type"]')),ogSiteName:e(()=>lr('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?hs(t,1e3):void 0}),capturedAt:new Date().toISOString()}}function Tl(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 El(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 s=o.querySelector("h1, h2, h3, h4, h5, h6"),c=o.getAttribute("aria-label")||((s==null?void 0:s.textContent)||"").trim(),u=o.tagName.toLowerCase();r=c?`${u}: ${hs(c,120)}`:u}return{elementRole:t,elementAriaLabel:n,enclosingSection:r}}function Al(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(`
1330
+ `)}const Rn=new Set;let Ln=null,Vr=!1,ni=!1;function Cl(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function Pl(){const e=document.querySelectorAll("dialog[open]");for(let n=0;n<e.length;n++)try{if(e[n].matches(":modal"))return!0}catch{}const t=document.querySelectorAll('[role="dialog"], [role="alertdialog"]');for(let n=0;n<t.length;n++){const r=t[n];if(!(Rn.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&Cl(r))return!0}return!1}function gs(){const e=Pl(),t=e&&!ni;ni=e;for(const n of Rn){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{}try{n.showPopover()}catch{}}}else try{n.showPopover()}catch{}}}function ms(e){if(!(e instanceof Node))return!1;for(const t of Rn)if(t===e||t.contains(e))return!0;return!1}function zn(e){(ms(e.target)||"relatedTarget"in e&&ms(e.relatedTarget))&&e.stopPropagation()}function Rl(){Vr||(window.addEventListener("focusin",zn,!0),window.addEventListener("focusout",zn,!0),window.addEventListener("pointerdown",zn,!0),Vr=!0),!Ln&&(Ln=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")&&gs()}),Ln.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function Lt(e){"showPopover"in e&&(e.setAttribute("popover","manual"),Rn.add(e),Rl(),gs())}function zt(e){if(Rn.delete(e),Rn.size===0&&(Ln&&(Ln.disconnect(),Ln=null),Vr&&(window.removeEventListener("focusin",zn,!0),window.removeEventListener("focusout",zn,!0),window.removeEventListener("pointerdown",zn,!0),Vr=!1),ni=!1),"hidePopover"in e)try{e.hidePopover()}catch{}}function ri(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),Lt(t),{el:t,update:s=>{const c=s.getBoundingClientRect();t.style.top=`${c.top}px`,t.style.left=`${c.left}px`,t.style.width=`${c.width}px`,t.style.height=`${c.height}px`,t.style.display="block"},hide:()=>{t.style.display="none"},destroy:()=>{zt(t),t.remove()}}}const Ll="🎯 Click any element to capture";let Ft=null,Pe=null,Ve=null;function ur(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 zl(){var e;return(((e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)??!1)||"ontouchstart"in window}function bs(e){Ft==null||Ft.update(e)}function ks(e){const t=fs(),n=Tl(e),r=El(e);let o;try{o=e.outerHTML.slice(0,4e3)}catch{}return{pageUrl:window.location.href,pageTitle:document.title,elementText:Wr(e),cssSelector:Gr(e),innerTree:_l(e),outerTree:Sl(e),elementOuterHtml:o,ancestry:n,...r,...t}}function _s(e,t){Ve&&Ve();const n=zl();Ft=ri(),Pe=document.createElement("div"),Pe.className="ap-sdk-picker-cursor",Pe.setAttribute("data-ap-sdk","1"),Pe.textContent=n?"Tap any element to preview":Ll,document.body.appendChild(Pe),Lt(Pe);let r=null,o=null;const s=h=>{Ve==null||Ve(),e(ks(h),h)},c=h=>{if(o=h,bs(h),!Pe)return;Pe.classList.add("ap-sdk-picker-cursor--confirm"),Pe.innerHTML="";const b=document.createElement("span");b.className="ap-sdk-picker-cursor__label",b.textContent=`<${h.tagName.toLowerCase()}>`;const m=document.createElement("button");m.type="button",m.className="ap-sdk-picker-cursor__btn",m.textContent="⬆ Parent",m.setAttribute("data-ap-sdk","1"),m.addEventListener("click",w=>{w.preventDefault(),w.stopPropagation(),o!=null&&o.parentElement&&c(o.parentElement)});const _=document.createElement("button");_.type="button",_.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",_.textContent="✓ Select",_.setAttribute("data-ap-sdk","1"),_.addEventListener("click",w=>{w.preventDefault(),w.stopPropagation(),o&&s(o)}),Pe.appendChild(b),Pe.appendChild(m),Pe.appendChild(_)},u=h=>{ur(h.target)||(r=h.target,bs(r))},d=h=>{if(ur(h.target))return;h.preventDefault(),h.stopImmediatePropagation();const b=h.target??r;if(b){if(n){c(b);return}s(b)}},p=h=>{h.key==="Escape"&&(Ve==null||Ve(),t())};n||document.addEventListener("mouseover",u,{capture:!0}),document.addEventListener("click",d,{capture:!0}),document.addEventListener("keydown",p,{capture:!0}),Ve=()=>{n||document.removeEventListener("mouseover",u,{capture:!0}),document.removeEventListener("click",d,{capture:!0}),document.removeEventListener("keydown",p,{capture:!0}),Pe&&zt(Pe),Pe==null||Pe.remove(),Ft==null||Ft.destroy(),Ft=null,Pe=null,o=null,Ve=null}}function oi(){Ve==null||Ve()}function In(){return Ve!==null}function v(e,t,n){function r(u,d){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:d,constr:c,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,d);const p=c.prototype,h=Object.keys(p);for(let b=0;b<h.length;b++){const m=h[b];m in u||(u[m]=p[m].bind(u))}}const o=(n==null?void 0:n.Parent)??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function c(u){var d;const p=n!=null&&n.Parent?new s:this;r(p,u),(d=p._zod).deferred??(d.deferred=[]);for(const h of p._zod.deferred)h();return p}return Object.defineProperty(c,"init",{value:r}),Object.defineProperty(c,Symbol.hasInstance,{value:u=>{var d,p;return n!=null&&n.Parent&&u instanceof n.Parent?!0:(p=(d=u==null?void 0:u._zod)==null?void 0:d.traits)==null?void 0:p.has(e)}}),Object.defineProperty(c,"name",{value:e}),c}class $n extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class vs extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const ys={};function Bt(e){return ys}function ws(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 ii(e,t){return typeof t=="bigint"?t.toString():t}function Yr(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function si(e){return e==null}function ai(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Il(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 d=r.match(/\d?e-(\d?)/);d!=null&&d[1]&&(o=Number.parseInt(d[1]))}const s=n>o?n:o,c=Number.parseInt(e.toFixed(s).replace(".","")),u=Number.parseInt(t.toFixed(s).replace(".",""));return c%u/10**s}const xs=Symbol("evaluating");function Y(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==xs)return r===void 0&&(r=xs,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function cn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Gt(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Ss(e){return JSON.stringify(e)}function $l(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Ts="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function dr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Nl=Yr(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Nn(e){if(dr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(dr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Es(e){return Nn(e)?{...e}:Array.isArray(e)?[...e]:e}const Ol=new Set(["string","number","symbol"]);function On(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Wt(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function O(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"?{...t,error:()=>t.error}:t}function Dl(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Ml={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 Ul(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 s=Gt(e._zod.def,{get shape(){const c={};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(c[u]=n.shape[u])}return cn(this,"shape",c),c},checks:[]});return Wt(e,s)}function jl(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 s=Gt(e._zod.def,{get shape(){const c={...e._zod.def.shape};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&delete c[u]}return cn(this,"shape",c),c},checks:[]});return Wt(e,s)}function Zl(e,t){if(!Nn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const c in t)if(Object.getOwnPropertyDescriptor(s,c)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Gt(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return cn(this,"shape",s),s}});return Wt(e,o)}function ql(e,t){if(!Nn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Gt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return cn(this,"shape",r),r}});return Wt(e,n)}function Hl(e,t){const n=Gt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return cn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Wt(e,n)}function Fl(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 c=Gt(t._zod.def,{get shape(){const u=t._zod.def.shape,d={...u};if(n)for(const p in n){if(!(p in u))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(d[p]=e?new e({type:"optional",innerType:u[p]}):u[p])}else for(const p in u)d[p]=e?new e({type:"optional",innerType:u[p]}):u[p];return cn(this,"shape",d),d},checks:[]});return Wt(t,c)}function Bl(e,t,n){const r=Gt(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const c in n){if(!(c in s))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(s[c]=new e({type:"nonoptional",innerType:o[c]}))}else for(const c in o)s[c]=new e({type:"nonoptional",innerType:o[c]});return cn(this,"shape",s),s}});return Wt(t,r)}function Dn(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 Mn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Kr(e){return typeof e=="string"?e:e==null?void 0:e.message}function Jt(e,t,n){var o,s,c,u,d,p;const r={...e,path:e.path??[]};if(!e.message){const h=Kr((c=(s=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:s.error)==null?void 0:c.call(s,e))??Kr((u=t==null?void 0:t.error)==null?void 0:u.call(t,e))??Kr((d=n.customError)==null?void 0:d.call(n,e))??Kr((p=n.localeError)==null?void 0:p.call(n,e))??"Invalid input";r.message=h}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function ci(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function pr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const As=(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,ii,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Cs=v("$ZodError",As),Ps=v("$ZodError",As,{Parent:Error});function Gl(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 Wl(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(c=>r({issues:c}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let c=n,u=0;for(;u<s.path.length;){const d=s.path[u];u===s.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(t(s))):c[d]=c[d]||{_errors:[]},c=c[d],u++}}};return r(e),n}const li=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new $n;if(c.issues.length){const u=new((o==null?void 0:o.Err)??e)(c.issues.map(d=>Jt(d,s,Bt())));throw Ts(u,o==null?void 0:o.callee),u}return c.value},ui=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise&&(c=await c),c.issues.length){const u=new((o==null?void 0:o.Err)??e)(c.issues.map(d=>Jt(d,s,Bt())));throw Ts(u,o==null?void 0:o.callee),u}return c.value},Qr=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new $n;return s.issues.length?{success:!1,error:new(e??Cs)(s.issues.map(c=>Jt(c,o,Bt())))}:{success:!0,data:s.value}},Jl=Qr(Ps),eo=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(c=>Jt(c,o,Bt())))}:{success:!0,data:s.value}},Xl=eo(Ps),Vl=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return li(e)(t,n,o)},Yl=e=>(t,n,r)=>li(e)(t,n,r),Kl=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ui(e)(t,n,o)},Ql=e=>async(t,n,r)=>ui(e)(t,n,r),eu=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Qr(e)(t,n,o)},tu=e=>(t,n,r)=>Qr(e)(t,n,r),nu=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return eo(e)(t,n,o)},ru=e=>async(t,n,r)=>eo(e)(t,n,r),ou=/^[cC][^\s-]{8,}$/,iu=/^[0-9a-z]+$/,su=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,au=/^[0-9a-vA-V]{20}$/,cu=/^[A-Za-z0-9]{27}$/,lu=/^[a-zA-Z0-9_-]{21}$/,uu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,du=/^([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})$/,Rs=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)$/,pu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,hu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function fu(){return new RegExp(hu,"u")}const gu=/^(?:(?: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])$/,mu=/^(([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}|:))$/,bu=/^((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])$/,ku=/^(([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])$/,_u=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ls=/^[A-Za-z0-9_-]*$/,vu=/^\+[1-9]\d{6,14}$/,zs="(?:(?:\\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])))",yu=new RegExp(`^${zs}$`);function Is(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 wu(e){return new RegExp(`^${Is(e)}$`)}function xu(e){const t=Is({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(`^${zs}T(?:${r})$`)}const Su=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Tu=/^-?\d+$/,$s=/^-?\d+(?:\.\d+)?$/,Eu=/^(?:true|false)$/i,Au=/^[^A-Z]*$/,Cu=/^[^a-z]*$/,Ye=v("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ns={number:"number",bigint:"bigint",object:"date"},Os=v("$ZodCheckLessThan",(e,t)=>{Ye.init(e,t);const n=Ns[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(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})}}),Ds=v("$ZodCheckGreaterThan",(e,t)=>{Ye.init(e,t);const n=Ns[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(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})}}),Pu=v("$ZodCheckMultipleOf",(e,t)=>{Ye.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(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):Il(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})}}),Ru=v("$ZodCheckNumberFormat",(e,t)=>{var c;Ye.init(e,t),t.format=t.format||"float64";const n=(c=t.format)==null?void 0:c.includes("int"),r=n?"int":"number",[o,s]=Ml[t.format];e._zod.onattach.push(u=>{const d=u._zod.bag;d.format=t.format,d.minimum=o,d.maximum=s,n&&(d.pattern=Tu)}),e._zod.check=u=>{const d=u.value;if(n){if(!Number.isInteger(d)){u.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:d,inst:e});return}if(!Number.isSafeInteger(d)){d>0?u.issues.push({input:d,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}):u.issues.push({input:d,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}}d<o&&u.issues.push({origin:"number",input:d,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),d>s&&u.issues.push({origin:"number",input:d,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Lu=v("$ZodCheckMaxLength",(e,t)=>{var n;Ye.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!si(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const c=ci(o);r.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),zu=v("$ZodCheckMinLength",(e,t)=>{var n;Ye.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!si(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const c=ci(o);r.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Iu=v("$ZodCheckLengthEquals",(e,t)=>{var n;Ye.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!si(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const c=ci(o),u=s>t.length;r.issues.push({origin:c,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),to=v("$ZodCheckStringFormat",(e,t)=>{var n,r;Ye.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),$u=v("$ZodCheckRegex",(e,t)=>{to.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})}}),Nu=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Au),to.init(e,t)}),Ou=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Cu),to.init(e,t)}),Du=v("$ZodCheckIncludes",(e,t)=>{Ye.init(e,t);const n=On(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.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})}}),Mu=v("$ZodCheckStartsWith",(e,t)=>{Ye.init(e,t);const n=new RegExp(`^${On(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Uu=v("$ZodCheckEndsWith",(e,t)=>{Ye.init(e,t);const n=new RegExp(`.*${On(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),ju=v("$ZodCheckOverwrite",(e,t)=>{Ye.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Zu{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(`
1187
1331
  `).filter(c=>c),o=Math.min(...r.map(c=>c.length-c.trimStart().length)),s=r.map(c=>c.slice(o)).map(c=>" ".repeat(this.indent*2)+c);for(const c of s)this.content.push(c)}compile(){const t=Function,n=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new t(...n,o.join(`
1188
- `))}}const mu={major:4,minor:3,patch:5},ue=v("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=mu;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const s of r)for(const c of s._zod.onattach)c(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const s=(u,d,p)=>{let h=En(u),k;for(const m of d){if(m._zod.def.when){if(!m._zod.def.when(u))continue}else if(h)continue;const _=u.issues.length,w=m._zod.check(u);if(w instanceof Promise&&(p==null?void 0:p.async)===!1)throw new xn;if(k||w instanceof Promise)k=(k??Promise.resolve()).then(async()=>{await w,u.issues.length!==_&&(h||(h=En(u,_)))});else{if(u.issues.length===_)continue;h||(h=En(u,_))}}return k?k.then(()=>u):u},c=(u,d,p)=>{if(En(u))return u.aborted=!0,u;const h=s(d,r,p);if(h instanceof Promise){if(p.async===!1)throw new xn;return h.then(k=>e._zod.parse(k,p))}return e._zod.parse(h,p)};e._zod.run=(u,d)=>{if(d.skipChecks)return e._zod.parse(u,d);if(d.direction==="backward"){const h=e._zod.parse({value:u.value,issues:[]},{...d,skipChecks:!0});return h instanceof Promise?h.then(k=>c(k,u,d)):c(h,u,d)}const p=e._zod.parse(u,d);if(p instanceof Promise){if(d.async===!1)throw new xn;return p.then(h=>s(h,r,d))}return s(p,r,d)}}V(e,"~standard",()=>({validate:s=>{var c;try{const u=wl(e,s);return u.success?{value:u.data}:{issues:(c=u.error)==null?void 0:c.issues}}catch{return xl(e,s).then(d=>{var p;return d.success?{value:d.data}:{issues:(p=d.error)==null?void 0:p.issues}})}},vendor:"zod",version:1}))}),Wo=v("$ZodString",(e,t)=>{var n;ue.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??Kl(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),de=v("$ZodStringFormat",(e,t)=>{jr.init(e,t),Wo.init(e,t)}),bu=v("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ul),de.init(e,t)}),ku=v("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ls(r))}else t.pattern??(t.pattern=ls());de.init(e,t)}),_u=v("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=jl),de.init(e,t)}),vu=v("$ZodURL",(e,t)=>{de.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{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),yu=v("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ql()),de.init(e,t)}),wu=v("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Dl),de.init(e,t)}),xu=v("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ll),de.init(e,t)}),Su=v("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Il),de.init(e,t)}),Tu=v("$ZodULID",(e,t)=>{t.pattern??(t.pattern=$l),de.init(e,t)}),Eu=v("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Nl),de.init(e,t)}),Au=v("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ol),de.init(e,t)}),Cu=v("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Yl(t)),de.init(e,t)}),Pu=v("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Xl),de.init(e,t)}),Ru=v("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Vl(t)),de.init(e,t)}),zu=v("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ml),de.init(e,t)}),Lu=v("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Fl),de.init(e,t),e._zod.bag.format="ipv4"}),Iu=v("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Hl),de.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),$u=v("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Bl),de.init(e,t)}),Nu=v("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Wl),de.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,s]=r;if(!s)throw new Error;const c=Number(s);if(`${c}`!==s)throw new Error;if(c<0||c>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function bs(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Ou=v("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Gl),de.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{bs(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Du(e){if(!us.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return bs(n)}const Mu=v("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=us),de.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Du(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Uu=v("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Jl),de.init(e,t)});function ju(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{return!1}}const Zu=v("$ZodJWT",(e,t)=>{de.init(e,t),e._zod.check=n=>{ju(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),ks=v("$ZodNumber",(e,t)=>{ue.init(e,t),e._zod.pattern=e._zod.bag.pattern??hs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),qu=v("$ZodNumberFormat",(e,t)=>{ou.init(e,t),ks.init(e,t)}),Fu=v("$ZodBoolean",(e,t)=>{ue.init(e,t),e._zod.pattern=eu,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),Hu=v("$ZodAny",(e,t)=>{ue.init(e,t),e._zod.parse=n=>n}),Bu=v("$ZodUnknown",(e,t)=>{ue.init(e,t),e._zod.parse=n=>n}),Wu=v("$ZodNever",(e,t)=>{ue.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function _s(e,t,n){e.issues.length&&t.issues.push(...An(n,e.issues)),t.value[n]=e.value}const Gu=v("$ZodArray",(e,t)=>{ue.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 s=[];for(let c=0;c<o.length;c++){const u=o[c],d=t.element._zod.run({value:u,issues:[]},r);d instanceof Promise?s.push(d.then(p=>_s(p,n,c))):_s(d,n,c)}return s.length?Promise.all(s).then(()=>n):n}});function Zr(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...An(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function vs(e){var r,o,s,c;const t=Object.keys(e.shape);for(const u of t)if(!((c=(s=(o=(r=e.shape)==null?void 0:r[u])==null?void 0:o._zod)==null?void 0:s.traits)!=null&&c.has("$ZodType")))throw new Error(`Invalid element at key "${u}": expected a Zod schema`);const n=dl(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ys(e,t,n,r,o,s){const c=[],u=o.keySet,d=o.catchall._zod,p=d.def.type,h=d.optout==="optional";for(const k in t){if(u.has(k))continue;if(p==="never"){c.push(k);continue}const m=d.run({value:t[k],issues:[]},r);m instanceof Promise?e.push(m.then(_=>Zr(_,n,k,t,h))):Zr(m,n,k,t,h)}return c.length&&n.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const Ju=v("$ZodObject",(e,t)=>{ue.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const u=t.shape;Object.defineProperty(t,"shape",{get:()=>{const d={...u};return Object.defineProperty(t,"shape",{value:d}),d}})}const r=Or(()=>vs(t));V(e._zod,"propValues",()=>{const u=t.shape,d={};for(const p in u){const h=u[p]._zod;if(h.values){d[p]??(d[p]=new Set);for(const k of h.values)d[p].add(k)}}return d});const o=Vn,s=t.catchall;let c;e._zod.parse=(u,d)=>{c??(c=r.value);const p=u.value;if(!o(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value={};const h=[],k=c.shape;for(const m of c.keys){const _=k[m],w=_._zod.optout==="optional",P=_._zod.run({value:p[m],issues:[]},d);P instanceof Promise?h.push(P.then(N=>Zr(N,u,m,p,w))):Zr(P,u,m,p,w)}return s?ys(h,p,u,d,r.value,e):h.length?Promise.all(h).then(()=>u):u}}),Xu=v("$ZodObjectJIT",(e,t)=>{Ju.init(e,t);const n=e._zod.parse,r=Or(()=>vs(t)),o=m=>{var x;const _=new gu(["shape","payload","ctx"]),w=r.value,P=S=>{const C=rs(S);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};_.write("const input = payload.value;");const N=Object.create(null);let re=0;for(const S of w.keys)N[S]=`key_${re++}`;_.write("const newResult = {};");for(const S of w.keys){const C=N[S],M=rs(S),se=m[S],ke=((x=se==null?void 0:se._zod)==null?void 0:x.optout)==="optional";_.write(`const ${C} = ${P(S)};`),ke?_.write(`
1332
+ `))}}const qu={major:4,minor:3,patch:5},de=v("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=qu;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const s of r)for(const c of s._zod.onattach)c(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const s=(u,d,p)=>{let h=Dn(u),b;for(const m of d){if(m._zod.def.when){if(!m._zod.def.when(u))continue}else if(h)continue;const _=u.issues.length,w=m._zod.check(u);if(w instanceof Promise&&(p==null?void 0:p.async)===!1)throw new $n;if(b||w instanceof Promise)b=(b??Promise.resolve()).then(async()=>{await w,u.issues.length!==_&&(h||(h=Dn(u,_)))});else{if(u.issues.length===_)continue;h||(h=Dn(u,_))}}return b?b.then(()=>u):u},c=(u,d,p)=>{if(Dn(u))return u.aborted=!0,u;const h=s(d,r,p);if(h instanceof Promise){if(p.async===!1)throw new $n;return h.then(b=>e._zod.parse(b,p))}return e._zod.parse(h,p)};e._zod.run=(u,d)=>{if(d.skipChecks)return e._zod.parse(u,d);if(d.direction==="backward"){const h=e._zod.parse({value:u.value,issues:[]},{...d,skipChecks:!0});return h instanceof Promise?h.then(b=>c(b,u,d)):c(h,u,d)}const p=e._zod.parse(u,d);if(p instanceof Promise){if(d.async===!1)throw new $n;return p.then(h=>s(h,r,d))}return s(p,r,d)}}Y(e,"~standard",()=>({validate:s=>{var c;try{const u=Jl(e,s);return u.success?{value:u.data}:{issues:(c=u.error)==null?void 0:c.issues}}catch{return Xl(e,s).then(d=>{var p;return d.success?{value:d.data}:{issues:(p=d.error)==null?void 0:p.issues}})}},vendor:"zod",version:1}))}),di=v("$ZodString",(e,t)=>{var n;de.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??Su(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),pe=v("$ZodStringFormat",(e,t)=>{to.init(e,t),di.init(e,t)}),Hu=v("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=du),pe.init(e,t)}),Fu=v("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Rs(r))}else t.pattern??(t.pattern=Rs());pe.init(e,t)}),Bu=v("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=pu),pe.init(e,t)}),Gu=v("$ZodURL",(e,t)=>{pe.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{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Wu=v("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=fu()),pe.init(e,t)}),Ju=v("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=lu),pe.init(e,t)}),Xu=v("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ou),pe.init(e,t)}),Vu=v("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=iu),pe.init(e,t)}),Yu=v("$ZodULID",(e,t)=>{t.pattern??(t.pattern=su),pe.init(e,t)}),Ku=v("$ZodXID",(e,t)=>{t.pattern??(t.pattern=au),pe.init(e,t)}),Qu=v("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=cu),pe.init(e,t)}),ed=v("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=xu(t)),pe.init(e,t)}),td=v("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=yu),pe.init(e,t)}),nd=v("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=wu(t)),pe.init(e,t)}),rd=v("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=uu),pe.init(e,t)}),od=v("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=gu),pe.init(e,t),e._zod.bag.format="ipv4"}),id=v("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=mu),pe.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),sd=v("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=bu),pe.init(e,t)}),ad=v("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ku),pe.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,s]=r;if(!s)throw new Error;const c=Number(s);if(`${c}`!==s)throw new Error;if(c<0||c>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Ms(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const cd=v("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=_u),pe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Ms(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function ld(e){if(!Ls.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ms(n)}const ud=v("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ls),pe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{ld(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),dd=v("$ZodE164",(e,t)=>{t.pattern??(t.pattern=vu),pe.init(e,t)});function pd(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{return!1}}const hd=v("$ZodJWT",(e,t)=>{pe.init(e,t),e._zod.check=n=>{pd(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Us=v("$ZodNumber",(e,t)=>{de.init(e,t),e._zod.pattern=e._zod.bag.pattern??$s,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),fd=v("$ZodNumberFormat",(e,t)=>{Ru.init(e,t),Us.init(e,t)}),gd=v("$ZodBoolean",(e,t)=>{de.init(e,t),e._zod.pattern=Eu,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),md=v("$ZodAny",(e,t)=>{de.init(e,t),e._zod.parse=n=>n}),bd=v("$ZodUnknown",(e,t)=>{de.init(e,t),e._zod.parse=n=>n}),kd=v("$ZodNever",(e,t)=>{de.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function js(e,t,n){e.issues.length&&t.issues.push(...Mn(n,e.issues)),t.value[n]=e.value}const _d=v("$ZodArray",(e,t)=>{de.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 s=[];for(let c=0;c<o.length;c++){const u=o[c],d=t.element._zod.run({value:u,issues:[]},r);d instanceof Promise?s.push(d.then(p=>js(p,n,c))):js(d,n,c)}return s.length?Promise.all(s).then(()=>n):n}});function no(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Mn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Zs(e){var r,o,s,c;const t=Object.keys(e.shape);for(const u of t)if(!((c=(s=(o=(r=e.shape)==null?void 0:r[u])==null?void 0:o._zod)==null?void 0:s.traits)!=null&&c.has("$ZodType")))throw new Error(`Invalid element at key "${u}": expected a Zod schema`);const n=Dl(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function qs(e,t,n,r,o,s){const c=[],u=o.keySet,d=o.catchall._zod,p=d.def.type,h=d.optout==="optional";for(const b in t){if(u.has(b))continue;if(p==="never"){c.push(b);continue}const m=d.run({value:t[b],issues:[]},r);m instanceof Promise?e.push(m.then(_=>no(_,n,b,t,h))):no(m,n,b,t,h)}return c.length&&n.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const vd=v("$ZodObject",(e,t)=>{de.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const u=t.shape;Object.defineProperty(t,"shape",{get:()=>{const d={...u};return Object.defineProperty(t,"shape",{value:d}),d}})}const r=Yr(()=>Zs(t));Y(e._zod,"propValues",()=>{const u=t.shape,d={};for(const p in u){const h=u[p]._zod;if(h.values){d[p]??(d[p]=new Set);for(const b of h.values)d[p].add(b)}}return d});const o=dr,s=t.catchall;let c;e._zod.parse=(u,d)=>{c??(c=r.value);const p=u.value;if(!o(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value={};const h=[],b=c.shape;for(const m of c.keys){const _=b[m],w=_._zod.optout==="optional",P=_._zod.run({value:p[m],issues:[]},d);P instanceof Promise?h.push(P.then(N=>no(N,u,m,p,w))):no(P,u,m,p,w)}return s?qs(h,p,u,d,r.value,e):h.length?Promise.all(h).then(()=>u):u}}),yd=v("$ZodObjectJIT",(e,t)=>{vd.init(e,t);const n=e._zod.parse,r=Yr(()=>Zs(t)),o=m=>{var x;const _=new Zu(["shape","payload","ctx"]),w=r.value,P=S=>{const C=Ss(S);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};_.write("const input = payload.value;");const N=Object.create(null);let re=0;for(const S of w.keys)N[S]=`key_${re++}`;_.write("const newResult = {};");for(const S of w.keys){const C=N[S],M=Ss(S),se=m[S],ve=((x=se==null?void 0:se._zod)==null?void 0:x.optout)==="optional";_.write(`const ${C} = ${P(S)};`),ve?_.write(`
1189
1333
  if (${C}.issues.length) {
1190
1334
  if (${M} in input) {
1191
1335
  payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
@@ -1219,63 +1363,63 @@ button.ap-sdk-list-item__link {
1219
1363
  newResult[${M}] = ${C}.value;
1220
1364
  }
1221
1365
 
1222
- `)}_.write("payload.value = newResult;"),_.write("return payload;");const R=_.compile();return(S,C)=>R(m,S,C)};let s;const c=Vn,u=!es.jitless,p=u&&ll.value,h=t.catchall;let k;e._zod.parse=(m,_)=>{k??(k=r.value);const w=m.value;return c(w)?u&&p&&(_==null?void 0:_.async)===!1&&_.jitless!==!0?(s||(s=o(t.shape)),m=s(m,_),h?ys([],w,m,_,k,e):m):n(m,_):(m.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),m)}});function ws(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!En(s));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(s=>s.issues.map(c=>Zt(c,r,Mt())))}),t)}const xs=v("$ZodUnion",(e,t)=>{ue.init(e,t),V(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),V(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),V(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),V(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>qo(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(n)return r(o,s);let c=!1;const u=[];for(const d of t.options){const p=d._zod.run({value:o.value,issues:[]},s);if(p instanceof Promise)u.push(p),c=!0;else{if(p.issues.length===0)return p;u.push(p)}}return c?Promise.all(u).then(d=>ws(d,o,e,s)):ws(u,o,e,s)}}),Vu=v("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,xs.init(e,t);const n=e._zod.parse;V(e._zod,"propValues",()=>{const o={};for(const s of t.options){const c=s._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[u,d]of Object.entries(c)){o[u]||(o[u]=new Set);for(const p of d)o[u].add(p)}}return o});const r=Or(()=>{var c;const o=t.options,s=new Map;for(const u of o){const d=(c=u._zod.propValues)==null?void 0:c[t.discriminator];if(!d||d.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(u)}"`);for(const p of d){if(s.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);s.set(p,u)}}return s});e._zod.parse=(o,s)=>{const c=o.value;if(!Vn(c))return o.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),o;const u=r.value.get(c==null?void 0:c[t.discriminator]);return u?u._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:c,path:[t.discriminator],inst:e}),o)}}),Yu=v("$ZodIntersection",(e,t)=>{ue.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),c=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||c instanceof Promise?Promise.all([s,c]).then(([d,p])=>Ss(n,d,p)):Ss(n,s,c)}});function Go(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(Sn(e)&&Sn(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const c=Go(e[s],t[s]);if(!c.valid)return{valid:!1,mergeErrorPath:[s,...c.mergeErrorPath]};o[s]=c.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],s=t[r],c=Go(o,s);if(!c.valid)return{valid:!1,mergeErrorPath:[r,...c.mergeErrorPath]};n.push(c.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ss(e,t,n){const r=new Map;let o;for(const u of t.issues)if(u.code==="unrecognized_keys"){o??(o=u);for(const d of u.keys)r.has(d)||r.set(d,{}),r.get(d).l=!0}else e.issues.push(u);for(const u of n.issues)if(u.code==="unrecognized_keys")for(const d of u.keys)r.has(d)||r.set(d,{}),r.get(d).r=!0;else e.issues.push(u);const s=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(s.length&&o&&e.issues.push({...o,keys:s}),En(e))return e;const c=Go(t.value,n.value);if(!c.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`);return e.value=c.data,e}const Ku=v("$ZodRecord",(e,t)=>{ue.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Sn(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[],c=t.keyType._zod.values;if(c){n.value={};const u=new Set;for(const p of c)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){u.add(typeof p=="number"?p.toString():p);const h=t.valueType._zod.run({value:o[p],issues:[]},r);h instanceof Promise?s.push(h.then(k=>{k.issues.length&&n.issues.push(...An(p,k.issues)),n.value[p]=k.value})):(h.issues.length&&n.issues.push(...An(p,h.issues)),n.value[p]=h.value)}let d;for(const p in o)u.has(p)||(d=d??[],d.push(p));d&&d.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:d})}else{n.value={};for(const u of Reflect.ownKeys(o)){if(u==="__proto__")continue;let d=t.keyType._zod.run({value:u,issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&hs.test(u)&&d.issues.length&&d.issues.some(k=>k.code==="invalid_type"&&k.expected==="number")){const k=t.keyType._zod.run({value:Number(u),issues:[]},r);if(k instanceof Promise)throw new Error("Async schemas not supported in object keys currently");k.issues.length===0&&(d=k)}if(d.issues.length){t.mode==="loose"?n.value[u]=o[u]:n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(k=>Zt(k,r,Mt())),input:u,path:[u],inst:e});continue}const h=t.valueType._zod.run({value:o[u],issues:[]},r);h instanceof Promise?s.push(h.then(k=>{k.issues.length&&n.issues.push(...An(u,k.issues)),n.value[d.value]=k.value})):(h.issues.length&&n.issues.push(...An(u,h.issues)),n.value[d.value]=h.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Qu=v("$ZodEnum",(e,t)=>{ue.init(e,t);const n=ts(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>ul.has(typeof o)).map(o=>typeof o=="string"?Tn(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const c=o.value;return r.has(c)||o.issues.push({code:"invalid_value",values:n,input:c,inst:e}),o}}),ed=v("$ZodLiteral",(e,t)=>{if(ue.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"?Tn(r):r?Tn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),td=v("$ZodTransform",(e,t)=>{ue.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Qi(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(c=>(n.value=c,n));if(o instanceof Promise)throw new xn;return n.value=o,n}});function Ts(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Es=v("$ZodOptional",(e,t)=>{ue.init(e,t),e._zod.optin="optional",e._zod.optout="optional",V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),V(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${qo(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(s=>Ts(s,n.value)):Ts(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),nd=v("$ZodExactOptional",(e,t)=>{Es.init(e,t),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),rd=v("$ZodNullable",(e,t)=>{ue.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${qo(n.source)}|null)$`):void 0}),V(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)}),od=v("$ZodDefault",(e,t)=>{ue.init(e,t),e._zod.optin="optional",V(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(s=>As(s,t)):As(o,t)}});function As(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const id=v("$ZodPrefault",(e,t)=>{ue.init(e,t),e._zod.optin="optional",V(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))}),sd=v("$ZodNonOptional",(e,t)=>{ue.init(e,t),V(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(s=>Cs(s,e)):Cs(o,e)}});function Cs(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 ad=v("$ZodCatch",(e,t)=>{ue.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(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(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(c=>Zt(c,r,Mt()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>Zt(s,r,Mt()))},input:n.value}),n.issues=[]),n)}}),cd=v("$ZodPipe",(e,t)=>{ue.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(c=>qr(c,t.in,r)):qr(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>qr(s,t.out,r)):qr(o,t.out,r)}});function qr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const ld=v("$ZodReadonly",(e,t)=>{ue.init(e,t),V(e._zod,"propValues",()=>t.innerType._zod.propValues),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),V(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(Ps):Ps(o)}});function Ps(e){return e.value=Object.freeze(e.value),e}const ud=v("$ZodCustom",(e,t)=>{Xe.init(e,t),ue.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(s=>Rs(s,n,r,e));Rs(o,n,r,e)}});function Rs(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Yn(o))}}var zs;class dd{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){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function pd(){return new dd}(zs=globalThis).__zod_globalRegistry??(zs.__zod_globalRegistry=pd());const Kn=globalThis.__zod_globalRegistry;function hd(e,t){return new e({type:"string",...O(t)})}function fd(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function Ls(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function gd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function md(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function bd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function kd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function _d(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function vd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function yd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function wd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function xd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function Sd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function Td(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function Ed(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function Ad(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function Cd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function Pd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function Rd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function zd(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function Ld(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function Id(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function $d(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}function Nd(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function Od(e,t){return new e({type:"string",format:"date",check:"string_format",...O(t)})}function Dd(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function Md(e,t){return new e({type:"string",format:"duration",check:"string_format",...O(t)})}function Ud(e,t){return new e({type:"number",checks:[],...O(t)})}function jd(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function Zd(e,t){return new e({type:"boolean",...O(t)})}function qd(e){return new e({type:"any"})}function Fd(e){return new e({type:"unknown"})}function Hd(e,t){return new e({type:"never",...O(t)})}function Is(e,t){return new gs({check:"less_than",...O(t),value:e,inclusive:!1})}function Jo(e,t){return new gs({check:"less_than",...O(t),value:e,inclusive:!0})}function $s(e,t){return new ms({check:"greater_than",...O(t),value:e,inclusive:!1})}function Xo(e,t){return new ms({check:"greater_than",...O(t),value:e,inclusive:!0})}function Ns(e,t){return new ru({check:"multiple_of",...O(t),value:e})}function Os(e,t){return new iu({check:"max_length",...O(t),maximum:e})}function Fr(e,t){return new su({check:"min_length",...O(t),minimum:e})}function Ds(e,t){return new au({check:"length_equals",...O(t),length:e})}function Bd(e,t){return new cu({check:"string_format",format:"regex",...O(t),pattern:e})}function Wd(e){return new lu({check:"string_format",format:"lowercase",...O(e)})}function Gd(e){return new uu({check:"string_format",format:"uppercase",...O(e)})}function Jd(e,t){return new du({check:"string_format",format:"includes",...O(t),includes:e})}function Xd(e,t){return new pu({check:"string_format",format:"starts_with",...O(t),prefix:e})}function Vd(e,t){return new hu({check:"string_format",format:"ends_with",...O(t),suffix:e})}function Cn(e){return new fu({check:"overwrite",tx:e})}function Yd(e){return Cn(t=>t.normalize(e))}function Kd(){return Cn(e=>e.trim())}function Qd(){return Cn(e=>e.toLowerCase())}function ep(){return Cn(e=>e.toUpperCase())}function tp(){return Cn(e=>cl(e))}function np(e,t,n){return new e({type:"array",element:t,...O(n)})}function rp(e,t,n){return new e({type:"custom",check:"custom",fn:t,...O(n)})}function op(e){const t=ip(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Yn(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(Yn(o))}},e(n.value,n)));return t}function ip(e,t){const n=new Xe({check:"custom",...O(t)});return n._zod.check=e,n}function Ms(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Kn,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function xe(e,t,n={path:[],schemaPath:[]}){var h,k;var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const c={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,c);const u=(k=(h=e._zod).toJSONSchema)==null?void 0:k.call(h);if(u)c.schema=u;else{const m={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,m);else{const w=c.schema,P=t.processors[o.type];if(!P)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);P(e,t,w,m)}const _=e._zod.parent;_&&(c.ref||(c.ref=_),xe(_,t,m),t.seen.get(_).isParent=!0)}const d=t.metadataRegistry.get(e);return d&&Object.assign(c.schema,d),t.io==="input"&&Ue(e)&&(delete c.schema.examples,delete c.schema.default),t.io==="input"&&c.schema._prefault&&((r=c.schema).default??(r.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}function Us(e,t){var c,u,d,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 k=(c=e.metadataRegistry.get(h[0]))==null?void 0:c.id;if(k){const m=r.get(k);if(m&&m!==h[0])throw new Error(`Duplicate schema id "${k}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(k,h[0])}}const o=h=>{var P;const k=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const N=(P=e.external.registry.get(h[0]))==null?void 0:P.id,re=e.external.uri??(x=>x);if(N)return{ref:re(N)};const R=h[1].defId??h[1].schema.id??`schema${e.counter++}`;return h[1].defId=R,{defId:R,ref:`${re("__shared")}#/${k}/${R}`}}if(h[1]===n)return{ref:"#"};const _=`#/${k}/`,w=h[1].schema.id??`__schema${e.counter++}`;return{defId:w,ref:_+w}},s=h=>{if(h[1].schema.$ref)return;const k=h[1],{ref:m,defId:_}=o(h);k.def={...k.schema},_&&(k.defId=_);const w=k.schema;for(const P in w)delete w[P];w.$ref=m};if(e.cycles==="throw")for(const h of e.seen.entries()){const k=h[1];if(k.cycle)throw new Error(`Cycle detected: #/${(u=k.cycle)==null?void 0:u.join("/")}/<root>
1366
+ `)}_.write("payload.value = newResult;"),_.write("return payload;");const R=_.compile();return(S,C)=>R(m,S,C)};let s;const c=dr,u=!ys.jitless,p=u&&Nl.value,h=t.catchall;let b;e._zod.parse=(m,_)=>{b??(b=r.value);const w=m.value;return c(w)?u&&p&&(_==null?void 0:_.async)===!1&&_.jitless!==!0?(s||(s=o(t.shape)),m=s(m,_),h?qs([],w,m,_,b,e):m):n(m,_):(m.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),m)}});function Hs(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Dn(s));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(s=>s.issues.map(c=>Jt(c,r,Bt())))}),t)}const Fs=v("$ZodUnion",(e,t)=>{de.init(e,t),Y(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Y(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Y(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Y(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>ai(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(n)return r(o,s);let c=!1;const u=[];for(const d of t.options){const p=d._zod.run({value:o.value,issues:[]},s);if(p instanceof Promise)u.push(p),c=!0;else{if(p.issues.length===0)return p;u.push(p)}}return c?Promise.all(u).then(d=>Hs(d,o,e,s)):Hs(u,o,e,s)}}),wd=v("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Fs.init(e,t);const n=e._zod.parse;Y(e._zod,"propValues",()=>{const o={};for(const s of t.options){const c=s._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[u,d]of Object.entries(c)){o[u]||(o[u]=new Set);for(const p of d)o[u].add(p)}}return o});const r=Yr(()=>{var c;const o=t.options,s=new Map;for(const u of o){const d=(c=u._zod.propValues)==null?void 0:c[t.discriminator];if(!d||d.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(u)}"`);for(const p of d){if(s.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);s.set(p,u)}}return s});e._zod.parse=(o,s)=>{const c=o.value;if(!dr(c))return o.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),o;const u=r.value.get(c==null?void 0:c[t.discriminator]);return u?u._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:c,path:[t.discriminator],inst:e}),o)}}),xd=v("$ZodIntersection",(e,t)=>{de.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),c=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||c instanceof Promise?Promise.all([s,c]).then(([d,p])=>Bs(n,d,p)):Bs(n,s,c)}});function pi(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(Nn(e)&&Nn(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const c=pi(e[s],t[s]);if(!c.valid)return{valid:!1,mergeErrorPath:[s,...c.mergeErrorPath]};o[s]=c.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],s=t[r],c=pi(o,s);if(!c.valid)return{valid:!1,mergeErrorPath:[r,...c.mergeErrorPath]};n.push(c.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Bs(e,t,n){const r=new Map;let o;for(const u of t.issues)if(u.code==="unrecognized_keys"){o??(o=u);for(const d of u.keys)r.has(d)||r.set(d,{}),r.get(d).l=!0}else e.issues.push(u);for(const u of n.issues)if(u.code==="unrecognized_keys")for(const d of u.keys)r.has(d)||r.set(d,{}),r.get(d).r=!0;else e.issues.push(u);const s=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(s.length&&o&&e.issues.push({...o,keys:s}),Dn(e))return e;const c=pi(t.value,n.value);if(!c.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`);return e.value=c.data,e}const Sd=v("$ZodRecord",(e,t)=>{de.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Nn(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[],c=t.keyType._zod.values;if(c){n.value={};const u=new Set;for(const p of c)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){u.add(typeof p=="number"?p.toString():p);const h=t.valueType._zod.run({value:o[p],issues:[]},r);h instanceof Promise?s.push(h.then(b=>{b.issues.length&&n.issues.push(...Mn(p,b.issues)),n.value[p]=b.value})):(h.issues.length&&n.issues.push(...Mn(p,h.issues)),n.value[p]=h.value)}let d;for(const p in o)u.has(p)||(d=d??[],d.push(p));d&&d.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:d})}else{n.value={};for(const u of Reflect.ownKeys(o)){if(u==="__proto__")continue;let d=t.keyType._zod.run({value:u,issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&$s.test(u)&&d.issues.length&&d.issues.some(b=>b.code==="invalid_type"&&b.expected==="number")){const b=t.keyType._zod.run({value:Number(u),issues:[]},r);if(b instanceof Promise)throw new Error("Async schemas not supported in object keys currently");b.issues.length===0&&(d=b)}if(d.issues.length){t.mode==="loose"?n.value[u]=o[u]:n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(b=>Jt(b,r,Bt())),input:u,path:[u],inst:e});continue}const h=t.valueType._zod.run({value:o[u],issues:[]},r);h instanceof Promise?s.push(h.then(b=>{b.issues.length&&n.issues.push(...Mn(u,b.issues)),n.value[d.value]=b.value})):(h.issues.length&&n.issues.push(...Mn(u,h.issues)),n.value[d.value]=h.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Td=v("$ZodEnum",(e,t)=>{de.init(e,t);const n=ws(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Ol.has(typeof o)).map(o=>typeof o=="string"?On(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const c=o.value;return r.has(c)||o.issues.push({code:"invalid_value",values:n,input:c,inst:e}),o}}),Ed=v("$ZodLiteral",(e,t)=>{if(de.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"?On(r):r?On(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),Ad=v("$ZodTransform",(e,t)=>{de.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new vs(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(c=>(n.value=c,n));if(o instanceof Promise)throw new $n;return n.value=o,n}});function Gs(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Ws=v("$ZodOptional",(e,t)=>{de.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Y(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Y(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ai(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(s=>Gs(s,n.value)):Gs(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Cd=v("$ZodExactOptional",(e,t)=>{Ws.init(e,t),Y(e._zod,"values",()=>t.innerType._zod.values),Y(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Pd=v("$ZodNullable",(e,t)=>{de.init(e,t),Y(e._zod,"optin",()=>t.innerType._zod.optin),Y(e._zod,"optout",()=>t.innerType._zod.optout),Y(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ai(n.source)}|null)$`):void 0}),Y(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)}),Rd=v("$ZodDefault",(e,t)=>{de.init(e,t),e._zod.optin="optional",Y(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(s=>Js(s,t)):Js(o,t)}});function Js(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Ld=v("$ZodPrefault",(e,t)=>{de.init(e,t),e._zod.optin="optional",Y(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))}),zd=v("$ZodNonOptional",(e,t)=>{de.init(e,t),Y(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(s=>Xs(s,e)):Xs(o,e)}});function Xs(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 Id=v("$ZodCatch",(e,t)=>{de.init(e,t),Y(e._zod,"optin",()=>t.innerType._zod.optin),Y(e._zod,"optout",()=>t.innerType._zod.optout),Y(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(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(c=>Jt(c,r,Bt()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>Jt(s,r,Bt()))},input:n.value}),n.issues=[]),n)}}),$d=v("$ZodPipe",(e,t)=>{de.init(e,t),Y(e._zod,"values",()=>t.in._zod.values),Y(e._zod,"optin",()=>t.in._zod.optin),Y(e._zod,"optout",()=>t.out._zod.optout),Y(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(c=>ro(c,t.in,r)):ro(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>ro(s,t.out,r)):ro(o,t.out,r)}});function ro(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Nd=v("$ZodReadonly",(e,t)=>{de.init(e,t),Y(e._zod,"propValues",()=>t.innerType._zod.propValues),Y(e._zod,"values",()=>t.innerType._zod.values),Y(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),Y(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(Vs):Vs(o)}});function Vs(e){return e.value=Object.freeze(e.value),e}const Od=v("$ZodCustom",(e,t)=>{Ye.init(e,t),de.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(s=>Ys(s,n,r,e));Ys(o,n,r,e)}});function Ys(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(pr(o))}}var Ks;class Dd{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){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Md(){return new Dd}(Ks=globalThis).__zod_globalRegistry??(Ks.__zod_globalRegistry=Md());const hr=globalThis.__zod_globalRegistry;function Ud(e,t){return new e({type:"string",...O(t)})}function jd(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function Qs(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function Zd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function qd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function Hd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function Fd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function Bd(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function Gd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function Wd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function Jd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function Xd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function Vd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function Yd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function Kd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function Qd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function ep(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function tp(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function np(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function rp(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function op(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function ip(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function sp(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}function ap(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function cp(e,t){return new e({type:"string",format:"date",check:"string_format",...O(t)})}function lp(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function up(e,t){return new e({type:"string",format:"duration",check:"string_format",...O(t)})}function dp(e,t){return new e({type:"number",checks:[],...O(t)})}function pp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function hp(e,t){return new e({type:"boolean",...O(t)})}function fp(e){return new e({type:"any"})}function gp(e){return new e({type:"unknown"})}function mp(e,t){return new e({type:"never",...O(t)})}function ea(e,t){return new Os({check:"less_than",...O(t),value:e,inclusive:!1})}function hi(e,t){return new Os({check:"less_than",...O(t),value:e,inclusive:!0})}function ta(e,t){return new Ds({check:"greater_than",...O(t),value:e,inclusive:!1})}function fi(e,t){return new Ds({check:"greater_than",...O(t),value:e,inclusive:!0})}function na(e,t){return new Pu({check:"multiple_of",...O(t),value:e})}function ra(e,t){return new Lu({check:"max_length",...O(t),maximum:e})}function oo(e,t){return new zu({check:"min_length",...O(t),minimum:e})}function oa(e,t){return new Iu({check:"length_equals",...O(t),length:e})}function bp(e,t){return new $u({check:"string_format",format:"regex",...O(t),pattern:e})}function kp(e){return new Nu({check:"string_format",format:"lowercase",...O(e)})}function _p(e){return new Ou({check:"string_format",format:"uppercase",...O(e)})}function vp(e,t){return new Du({check:"string_format",format:"includes",...O(t),includes:e})}function yp(e,t){return new Mu({check:"string_format",format:"starts_with",...O(t),prefix:e})}function wp(e,t){return new Uu({check:"string_format",format:"ends_with",...O(t),suffix:e})}function Un(e){return new ju({check:"overwrite",tx:e})}function xp(e){return Un(t=>t.normalize(e))}function Sp(){return Un(e=>e.trim())}function Tp(){return Un(e=>e.toLowerCase())}function Ep(){return Un(e=>e.toUpperCase())}function Ap(){return Un(e=>$l(e))}function Cp(e,t,n){return new e({type:"array",element:t,...O(n)})}function Pp(e,t,n){return new e({type:"custom",check:"custom",fn:t,...O(n)})}function Rp(e){const t=Lp(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(pr(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(pr(o))}},e(n.value,n)));return t}function Lp(e,t){const n=new Ye({check:"custom",...O(t)});return n._zod.check=e,n}function ia(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??hr,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function Te(e,t,n={path:[],schemaPath:[]}){var h,b;var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const c={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,c);const u=(b=(h=e._zod).toJSONSchema)==null?void 0:b.call(h);if(u)c.schema=u;else{const m={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,m);else{const w=c.schema,P=t.processors[o.type];if(!P)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);P(e,t,w,m)}const _=e._zod.parent;_&&(c.ref||(c.ref=_),Te(_,t,m),t.seen.get(_).isParent=!0)}const d=t.metadataRegistry.get(e);return d&&Object.assign(c.schema,d),t.io==="input"&&qe(e)&&(delete c.schema.examples,delete c.schema.default),t.io==="input"&&c.schema._prefault&&((r=c.schema).default??(r.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}function sa(e,t){var c,u,d,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 b=(c=e.metadataRegistry.get(h[0]))==null?void 0:c.id;if(b){const m=r.get(b);if(m&&m!==h[0])throw new Error(`Duplicate schema id "${b}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(b,h[0])}}const o=h=>{var P;const b=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const N=(P=e.external.registry.get(h[0]))==null?void 0:P.id,re=e.external.uri??(x=>x);if(N)return{ref:re(N)};const R=h[1].defId??h[1].schema.id??`schema${e.counter++}`;return h[1].defId=R,{defId:R,ref:`${re("__shared")}#/${b}/${R}`}}if(h[1]===n)return{ref:"#"};const _=`#/${b}/`,w=h[1].schema.id??`__schema${e.counter++}`;return{defId:w,ref:_+w}},s=h=>{if(h[1].schema.$ref)return;const b=h[1],{ref:m,defId:_}=o(h);b.def={...b.schema},_&&(b.defId=_);const w=b.schema;for(const P in w)delete w[P];w.$ref=m};if(e.cycles==="throw")for(const h of e.seen.entries()){const b=h[1];if(b.cycle)throw new Error(`Cycle detected: #/${(u=b.cycle)==null?void 0:u.join("/")}/<root>
1223
1367
 
1224
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const k=h[1];if(t===h[0]){s(h);continue}if(e.external){const _=(d=e.external.registry.get(h[0]))==null?void 0:d.id;if(t!==h[0]&&_){s(h);continue}}if((p=e.metadataRegistry.get(h[0]))==null?void 0:p.id){s(h);continue}if(k.cycle){s(h);continue}if(k.count>1&&e.reused==="ref"){s(h);continue}}}function js(e,t){var c,u,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=p=>{const h=e.seen.get(p);if(h.ref===null)return;const k=h.def??h.schema,m={...k},_=h.ref;if(h.ref=null,_){r(_);const P=e.seen.get(_),N=P.schema;if(N.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=k.allOf??[],k.allOf.push(N)):Object.assign(k,N),Object.assign(k,m),p._zod.parent===_)for(const R in k)R==="$ref"||R==="allOf"||R in m||delete k[R];if(N.$ref)for(const R in k)R==="$ref"||R==="allOf"||R in P.def&&JSON.stringify(k[R])===JSON.stringify(P.def[R])&&delete k[R]}const w=p._zod.parent;if(w&&w!==_){r(w);const P=e.seen.get(w);if(P!=null&&P.schema.$ref&&(k.$ref=P.schema.$ref,P.def))for(const N in k)N==="$ref"||N==="allOf"||N in P.def&&JSON.stringify(k[N])===JSON.stringify(P.def[N])&&delete k[N]}e.override({zodSchema:p,jsonSchema:k,path:h.path??[]})};for(const p of[...e.seen.entries()].reverse())r(p[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,(c=e.external)!=null&&c.uri){const p=(u=e.external.registry.get(t))==null?void 0:u.id;if(!p)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(p)}Object.assign(o,n.def??n.schema);const s=((d=e.external)==null?void 0:d.defs)??{};for(const p of e.seen.entries()){const h=p[1];h.def&&h.defId&&(s[h.defId]=h.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const p=JSON.parse(JSON.stringify(o));return Object.defineProperty(p,"~standard",{value:{...t["~standard"],jsonSchema:{input:Hr(t,"input",e.processors),output:Hr(t,"output",e.processors)}},enumerable:!1,writable:!1}),p}catch{throw new Error("Error converting schema to JSON.")}}function Ue(e,t){const n=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 Ue(r.element,n);if(r.type==="set")return Ue(r.valueType,n);if(r.type==="lazy")return Ue(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 Ue(r.innerType,n);if(r.type==="intersection")return Ue(r.left,n)||Ue(r.right,n);if(r.type==="record"||r.type==="map")return Ue(r.keyType,n)||Ue(r.valueType,n);if(r.type==="pipe")return Ue(r.in,n)||Ue(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Ue(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Ue(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Ue(o,n))return!0;return!!(r.rest&&Ue(r.rest,n))}return!1}const sp=(e,t={})=>n=>{const r=Ms({...n,processors:t});return xe(e,r),Us(r,e),js(r,e)},Hr=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},c=Ms({...o??{},target:s,io:t,processors:n});return xe(e,c),Us(c,e),js(c,e)},ap={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},cp=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:c,format:u,patterns:d,contentEncoding:p}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof c=="number"&&(o.maxLength=c),u&&(o.format=ap[u]??u,o.format===""&&delete o.format,u==="time"&&delete o.format),p&&(o.contentEncoding=p),d&&d.size>0){const h=[...d];h.length===1?o.pattern=h[0].source:h.length>1&&(o.allOf=[...h.map(k=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:k.source}))])}},lp=(e,t,n,r)=>{const o=n,{minimum:s,maximum:c,format:u,multipleOf:d,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof u=="string"&&u.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 s=="number"&&(o.minimum=s,typeof h=="number"&&t.target!=="draft-04"&&(h>=s?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 c=="number"&&(o.maximum=c,typeof p=="number"&&t.target!=="draft-04"&&(p<=c?delete o.maximum:delete o.exclusiveMaximum)),typeof d=="number"&&(o.multipleOf=d)},up=(e,t,n,r)=>{n.type="boolean"},dp=(e,t,n,r)=>{n.not={}},pp=(e,t,n,r)=>{},hp=(e,t,n,r)=>{},fp=(e,t,n,r)=>{const o=e._zod.def,s=ts(o.entries);s.every(c=>typeof c=="number")&&(n.type="number"),s.every(c=>typeof c=="string")&&(n.type="string"),n.enum=s},gp=(e,t,n,r)=>{const o=e._zod.def,s=[];for(const c of o.values)if(c===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof c=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(c))}else s.push(c);if(s.length!==0)if(s.length===1){const c=s[0];n.type=c===null?"null":typeof c,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[c]:n.const=c}else s.every(c=>typeof c=="number")&&(n.type="number"),s.every(c=>typeof c=="string")&&(n.type="string"),s.every(c=>typeof c=="boolean")&&(n.type="boolean"),s.every(c=>c===null)&&(n.type="null"),n.enum=s},mp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},bp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},kp=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:c,maximum:u}=e._zod.bag;typeof c=="number"&&(o.minItems=c),typeof u=="number"&&(o.maxItems=u),o.type="array",o.items=xe(s.element,t,{...r,path:[...r.path,"items"]})},_p=(e,t,n,r)=>{var p;const o=n,s=e._zod.def;o.type="object",o.properties={};const c=s.shape;for(const h in c)o.properties[h]=xe(c[h],t,{...r,path:[...r.path,"properties",h]});const u=new Set(Object.keys(c)),d=new Set([...u].filter(h=>{const k=s.shape[h]._zod;return t.io==="input"?k.optin===void 0:k.optout===void 0}));d.size>0&&(o.required=Array.from(d)),((p=s.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=xe(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},vp=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,c=o.options.map((u,d)=>xe(u,t,{...r,path:[...r.path,s?"oneOf":"anyOf",d]}));s?n.oneOf=c:n.anyOf=c},yp=(e,t,n,r)=>{const o=e._zod.def,s=xe(o.left,t,{...r,path:[...r.path,"allOf",0]}),c=xe(o.right,t,{...r,path:[...r.path,"allOf",1]}),u=p=>"allOf"in p&&Object.keys(p).length===1,d=[...u(s)?s.allOf:[s],...u(c)?c.allOf:[c]];n.allOf=d},wp=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const c=s.keyType,u=c._zod.bag,d=u==null?void 0:u.patterns;if(s.mode==="loose"&&d&&d.size>0){const h=xe(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const k of d)o.patternProperties[k.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=xe(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=xe(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const p=c._zod.values;if(p){const h=[...p].filter(k=>typeof k=="string"||typeof k=="number");h.length>0&&(o.required=h)}},xp=(e,t,n,r)=>{const o=e._zod.def,s=xe(o.innerType,t,r),c=t.seen.get(e);t.target==="openapi-3.0"?(c.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},Sp=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Tp=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Ep=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Ap=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let c;try{c=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=c},Cp=(e,t,n,r)=>{const o=e._zod.def,s=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;xe(s,t,r);const c=t.seen.get(e);c.ref=s},Pp=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},Zs=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Rp=v("ZodISODateTime",(e,t)=>{Cu.init(e,t),ge.init(e,t)});function zp(e){return Nd(Rp,e)}const Lp=v("ZodISODate",(e,t)=>{Pu.init(e,t),ge.init(e,t)});function Ip(e){return Od(Lp,e)}const $p=v("ZodISOTime",(e,t)=>{Ru.init(e,t),ge.init(e,t)});function Np(e){return Dd($p,e)}const Op=v("ZodISODuration",(e,t)=>{zu.init(e,t),ge.init(e,t)});function Dp(e){return Md(Op,e)}const et=v("ZodError",(e,t)=>{as.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>yl(e,n)},flatten:{value:n=>vl(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,jo,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,jo,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Mp=Ho(et),Up=Bo(et),jp=Mr(et),Zp=Ur(et),qp=Sl(et),Fp=Tl(et),Hp=El(et),Bp=Al(et),Wp=Cl(et),Gp=Pl(et),Jp=Rl(et),Xp=zl(et),pe=v("ZodType",(e,t)=>(ue.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Hr(e,"input"),output:Hr(e,"output")}}),e.toJSONSchema=sp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Ut(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>jt(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>Mp(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>jp(e,n,r),e.parseAsync=async(n,r)=>Up(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Zp(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>qp(e,n,r),e.decode=(n,r)=>Fp(e,n,r),e.encodeAsync=async(n,r)=>Hp(e,n,r),e.decodeAsync=async(n,r)=>Bp(e,n,r),e.safeEncode=(n,r)=>Wp(e,n,r),e.safeDecode=(n,r)=>Gp(e,n,r),e.safeEncodeAsync=async(n,r)=>Jp(e,n,r),e.safeDecodeAsync=async(n,r)=>Xp(e,n,r),e.refine=(n,r)=>e.check(Hh(n,r)),e.superRefine=n=>e.check(Bh(n)),e.overwrite=n=>e.check(Cn(n)),e.optional=()=>Ys(e),e.exactOptional=()=>zh(e),e.nullable=()=>Ks(e),e.nullish=()=>Ys(Ks(e)),e.nonoptional=n=>Dh(e,n),e.array=()=>_t(e),e.or=n=>wh([e,n]),e.and=n=>Th(e,n),e.transform=n=>ea(e,Ph(n)),e.default=n=>$h(e,n),e.prefault=n=>Oh(e,n),e.catch=n=>Uh(e,n),e.pipe=n=>ea(e,n),e.readonly=()=>qh(e),e.describe=n=>{const r=e.clone();return Kn.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Kn.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Kn.get(e);const r=e.clone();return Kn.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),qs=v("_ZodString",(e,t)=>{Wo.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>cp(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(Bd(...r)),e.includes=(...r)=>e.check(Jd(...r)),e.startsWith=(...r)=>e.check(Xd(...r)),e.endsWith=(...r)=>e.check(Vd(...r)),e.min=(...r)=>e.check(Fr(...r)),e.max=(...r)=>e.check(Os(...r)),e.length=(...r)=>e.check(Ds(...r)),e.nonempty=(...r)=>e.check(Fr(1,...r)),e.lowercase=r=>e.check(Wd(r)),e.uppercase=r=>e.check(Gd(r)),e.trim=()=>e.check(Kd()),e.normalize=(...r)=>e.check(Yd(...r)),e.toLowerCase=()=>e.check(Qd()),e.toUpperCase=()=>e.check(ep()),e.slugify=()=>e.check(tp())}),Vp=v("ZodString",(e,t)=>{Wo.init(e,t),qs.init(e,t),e.email=n=>e.check(fd(Yp,n)),e.url=n=>e.check(_d(Kp,n)),e.jwt=n=>e.check($d(hh,n)),e.emoji=n=>e.check(vd(Qp,n)),e.guid=n=>e.check(Ls(Fs,n)),e.uuid=n=>e.check(gd(Br,n)),e.uuidv4=n=>e.check(md(Br,n)),e.uuidv6=n=>e.check(bd(Br,n)),e.uuidv7=n=>e.check(kd(Br,n)),e.nanoid=n=>e.check(yd(eh,n)),e.guid=n=>e.check(Ls(Fs,n)),e.cuid=n=>e.check(wd(th,n)),e.cuid2=n=>e.check(xd(nh,n)),e.ulid=n=>e.check(Sd(rh,n)),e.base64=n=>e.check(zd(uh,n)),e.base64url=n=>e.check(Ld(dh,n)),e.xid=n=>e.check(Td(oh,n)),e.ksuid=n=>e.check(Ed(ih,n)),e.ipv4=n=>e.check(Ad(sh,n)),e.ipv6=n=>e.check(Cd(ah,n)),e.cidrv4=n=>e.check(Pd(ch,n)),e.cidrv6=n=>e.check(Rd(lh,n)),e.e164=n=>e.check(Id(ph,n)),e.datetime=n=>e.check(zp(n)),e.date=n=>e.check(Ip(n)),e.time=n=>e.check(Np(n)),e.duration=n=>e.check(Dp(n))});function A(e){return hd(Vp,e)}const ge=v("ZodStringFormat",(e,t)=>{de.init(e,t),qs.init(e,t)}),Yp=v("ZodEmail",(e,t)=>{_u.init(e,t),ge.init(e,t)}),Fs=v("ZodGUID",(e,t)=>{bu.init(e,t),ge.init(e,t)}),Br=v("ZodUUID",(e,t)=>{ku.init(e,t),ge.init(e,t)}),Kp=v("ZodURL",(e,t)=>{vu.init(e,t),ge.init(e,t)}),Qp=v("ZodEmoji",(e,t)=>{yu.init(e,t),ge.init(e,t)}),eh=v("ZodNanoID",(e,t)=>{wu.init(e,t),ge.init(e,t)}),th=v("ZodCUID",(e,t)=>{xu.init(e,t),ge.init(e,t)}),nh=v("ZodCUID2",(e,t)=>{Su.init(e,t),ge.init(e,t)}),rh=v("ZodULID",(e,t)=>{Tu.init(e,t),ge.init(e,t)}),oh=v("ZodXID",(e,t)=>{Eu.init(e,t),ge.init(e,t)}),ih=v("ZodKSUID",(e,t)=>{Au.init(e,t),ge.init(e,t)}),sh=v("ZodIPv4",(e,t)=>{Lu.init(e,t),ge.init(e,t)}),ah=v("ZodIPv6",(e,t)=>{Iu.init(e,t),ge.init(e,t)}),ch=v("ZodCIDRv4",(e,t)=>{$u.init(e,t),ge.init(e,t)}),lh=v("ZodCIDRv6",(e,t)=>{Nu.init(e,t),ge.init(e,t)}),uh=v("ZodBase64",(e,t)=>{Ou.init(e,t),ge.init(e,t)}),dh=v("ZodBase64URL",(e,t)=>{Mu.init(e,t),ge.init(e,t)}),ph=v("ZodE164",(e,t)=>{Uu.init(e,t),ge.init(e,t)}),hh=v("ZodJWT",(e,t)=>{Zu.init(e,t),ge.init(e,t)}),Hs=v("ZodNumber",(e,t)=>{ks.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>lp(e,r,o),e.gt=(r,o)=>e.check($s(r,o)),e.gte=(r,o)=>e.check(Xo(r,o)),e.min=(r,o)=>e.check(Xo(r,o)),e.lt=(r,o)=>e.check(Is(r,o)),e.lte=(r,o)=>e.check(Jo(r,o)),e.max=(r,o)=>e.check(Jo(r,o)),e.int=r=>e.check(Bs(r)),e.safe=r=>e.check(Bs(r)),e.positive=r=>e.check($s(0,r)),e.nonnegative=r=>e.check(Xo(0,r)),e.negative=r=>e.check(Is(0,r)),e.nonpositive=r=>e.check(Jo(0,r)),e.multipleOf=(r,o)=>e.check(Ns(r,o)),e.step=(r,o)=>e.check(Ns(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function kt(e){return Ud(Hs,e)}const fh=v("ZodNumberFormat",(e,t)=>{qu.init(e,t),Hs.init(e,t)});function Bs(e){return jd(fh,e)}const gh=v("ZodBoolean",(e,t)=>{Fu.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>up(e,n,r)});function he(e){return Zd(gh,e)}const mh=v("ZodAny",(e,t)=>{Hu.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>pp()});function Ws(){return qd(mh)}const bh=v("ZodUnknown",(e,t)=>{Bu.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hp()});function Gs(){return Fd(bh)}const kh=v("ZodNever",(e,t)=>{Wu.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dp(e,n,r)});function _h(e){return Hd(kh,e)}const vh=v("ZodArray",(e,t)=>{Gu.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kp(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(Fr(n,r)),e.nonempty=n=>e.check(Fr(1,n)),e.max=(n,r)=>e.check(Os(n,r)),e.length=(n,r)=>e.check(Ds(n,r)),e.unwrap=()=>e.element});function _t(e,t){return np(vh,e,t)}const yh=v("ZodObject",(e,t)=>{Xu.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_p(e,n,r,o),V(e,"shape",()=>t.shape),e.keyof=()=>tt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Gs()}),e.loose=()=>e.clone({...e._zod.def,catchall:Gs()}),e.strict=()=>e.clone({...e._zod.def,catchall:_h()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>gl(e,n),e.safeExtend=n=>ml(e,n),e.merge=n=>bl(e,n),e.pick=n=>hl(e,n),e.omit=n=>fl(e,n),e.partial=(...n)=>kl(Vs,e,n[0]),e.required=(...n)=>_l(Qs,e,n[0])});function le(e,t){const n={type:"object",shape:e??{},...O(t)};return new yh(n)}const Js=v("ZodUnion",(e,t)=>{xs.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vp(e,n,r,o),e.options=t.options});function wh(e,t){return new Js({type:"union",options:e,...O(t)})}const xh=v("ZodDiscriminatedUnion",(e,t)=>{Js.init(e,t),Vu.init(e,t)});function Xs(e,t,n){return new xh({type:"union",options:t,discriminator:e,...O(n)})}const Sh=v("ZodIntersection",(e,t)=>{Yu.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yp(e,n,r,o)});function Th(e,t){return new Sh({type:"intersection",left:e,right:t})}const Eh=v("ZodRecord",(e,t)=>{Ku.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wp(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function vt(e,t,n){return new Eh({type:"record",keyType:e,valueType:t,...O(n)})}const Vo=v("ZodEnum",(e,t)=>{Qu.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>fp(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 s={};for(const c of r)if(n.has(c))s[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new Vo({...t,checks:[],...O(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const c of r)if(n.has(c))delete s[c];else throw new Error(`Key ${c} not found in enum`);return new Vo({...t,checks:[],...O(o),entries:s})}});function tt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Vo({type:"enum",entries:n,...O(t)})}const Ah=v("ZodLiteral",(e,t)=>{ed.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gp(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 nt(e,t){return new Ah({type:"literal",values:Array.isArray(e)?e:[e],...O(t)})}const Ch=v("ZodTransform",(e,t)=>{td.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bp(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Qi(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Yn(s,n.value,t));else{const c=s;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=n.value),c.inst??(c.inst=e),n.issues.push(Yn(c))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function Ph(e){return new Ch({type:"transform",transform:e})}const Vs=v("ZodOptional",(e,t)=>{Es.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zs(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ys(e){return new Vs({type:"optional",innerType:e})}const Rh=v("ZodExactOptional",(e,t)=>{nd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zs(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function zh(e){return new Rh({type:"optional",innerType:e})}const Lh=v("ZodNullable",(e,t)=>{rd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ks(e){return new Lh({type:"nullable",innerType:e})}const Ih=v("ZodDefault",(e,t)=>{od.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $h(e,t){return new Ih({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():is(t)}})}const Nh=v("ZodPrefault",(e,t)=>{id.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ep(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Oh(e,t){return new Nh({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():is(t)}})}const Qs=v("ZodNonOptional",(e,t)=>{sd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Dh(e,t){return new Qs({type:"nonoptional",innerType:e,...O(t)})}const Mh=v("ZodCatch",(e,t)=>{ad.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ap(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Uh(e,t){return new Mh({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const jh=v("ZodPipe",(e,t)=>{cd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cp(e,n,r,o),e.in=t.in,e.out=t.out});function ea(e,t){return new jh({type:"pipe",in:e,out:t})}const Zh=v("ZodReadonly",(e,t)=>{ld.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function qh(e){return new Zh({type:"readonly",innerType:e})}const Fh=v("ZodCustom",(e,t)=>{ud.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mp(e,n)});function Hh(e,t={}){return rp(Fh,e,t)}function Bh(e){return op(e)}const Wh=le({name:A().min(1).max(100).optional(),command:A().min(1).max(500),args:_t(A()).optional(),failOnError:he().default(!0).optional(),timeout:kt().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:A().optional(),env:vt(A(),A()).optional(),runOnBackground:he().optional()});le({name:A(),command:A(),success:he(),exitCode:kt().optional(),stdout:A().optional(),stderr:A().optional(),error:A().optional(),duration:kt(),failOnError:he()});const tn=le({path:A(),extraCommands:_t(Wh).optional(),id:A().uuid().optional(),rotationKey:A().optional(),usageStatus:tt(["free","in_use"]).optional()}),Gh=Xs("operation",[tn.extend({operation:nt("create"),content:A().optional(),contentPath:A().optional(),encoding:tt(["utf-8","base64"]).optional()}),tn.extend({operation:nt("merge"),data:vt(A(),Ws()),mergeStrategy:tt(["deep","shallow"]).optional(),arrayMergeStrategy:tt(["concat","replace"]).optional()}),tn.extend({operation:nt("modify"),content:A().optional(),contentPath:A().optional(),createIfMissing:he().optional()}),tn.extend({operation:nt("delete"),ignoreIfMissing:he().optional()}),tn.extend({operation:nt("createDirectory"),contentPath:A().optional(),mode:kt().optional(),ignoreIfExists:he().optional()}),tn.extend({operation:nt("download"),url:A().url(),headers:vt(A(),A()).optional(),timeout:kt().min(1e3).max(3e5).optional()}),tn.extend({operation:nt("gitClone"),gitUrl:A(),gitSecretKey:A().optional(),sourceBranch:A().optional(),targetBranch:A().optional()})]);var ye=(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))(ye||{});const Jh=le({type:tt(["json","file","regex"]).describe("Extraction method"),source:A().describe("Source to extract from (file path or stdout/stderr)"),schema:le({}).passthrough().optional().describe("JSON schema for validation"),pattern:A().optional().describe("Regex pattern for extraction")}),Xh=le({type:tt(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:Ws().describe("Hook-specific configuration")});le({command:A().optional().describe("Legacy — unused in SDK mode"),args:_t(A()).optional().describe("Legacy — unused in SDK mode"),env:vt(A(),A()).optional().describe("Environment variables"),workingDirectory:A().optional().describe("Working directory for command execution"),fileOperations:_t(Gh).optional().describe("File operations to perform during setup"),gitUrl:A().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:A().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:A().optional().describe("Commit message for git operations"),resultExtraction:Jh.optional().describe("Schema for extracting result data"),postExecutionHooks:_t(Xh).optional().describe("Hooks to run after task completion"),executionMode:tt(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:Xs("executionMode",[le({executionMode:nt("claudeAgentSdk"),promptText:A(),sdkOptions:le({model:A(),permissionMode:tt(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:_t(A()),allowDangerouslySkipPermissions:he(),persistSession:he(),streamSdkEvents:he().optional(),allowedTools:_t(A()).optional(),settings:le({enabledPlugins:vt(A(),he())}),env:vt(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:he()}).optional()}),le({executionMode:nt("opencodeSdk"),promptText:A(),sdkOptions:le({provider:A(),model:A(),env:vt(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:he()}).optional()}),le({executionMode:nt("openaiAgentSdk"),promptText:A(),sdkOptions:le({model:A(),env:vt(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:he()}).optional()}),le({executionMode:nt("codexSdk"),promptText:A(),sdkOptions:le({model:A().optional(),sandboxMode:tt(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:tt(["never","on-request","on-failure","untrusted"]).optional(),env:vt(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:he()}).optional()}),le({executionMode:nt("cursorSdk"),promptText:A(),sdkOptions:le({model:A(),env:vt(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:he()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:he().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:A().optional().describe("Final approved plan content"),planApproved:he().optional().describe("Plan approval status"),planApprovedAt:A().optional().describe("ISO timestamp of approval"),planRejected:he().optional().describe("Plan rejection flag"),planRejectionFeedback:A().optional().describe("User rejection feedback"),rejectedPlanContent:A().optional().describe("Previously rejected plan content"),planCompletedAt:A().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:A().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:A().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:A().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:_t(le({feedback:A(),rejectedAt:A()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:kt().optional(),notificationChannelPlanMessageSentAt:A().optional(),notificationChannelCompletedMessageId:kt().optional(),notificationChannelFailedMessageId:kt().optional(),streamSdkEvents:he().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:A().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:he().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:_t(le({id:A(),selectedText:A(),startOffset:kt(),endOffset:kt(),commentText:A(),createdAt:A()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:he().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:he().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:tt(["all","agentPlatformOnly"]).optional().describe("MCP server strategy for this run; 'agentPlatformOnly' strips every other MCP server and keeps only the agent-platform server"),enableBrowserTools:he().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")}),ye.PENDING+"",ye.CANCELLED,ye.ASSIGNED+"",ye.CANCELLED,ye.IN_PROGRESS+"",ye.CANCELLED,ye.FAILED,ye.WAITING_FOR_INPUT+"",ye.CANCELLED,ye.WAITING_FOR_PLAN_APPROVAL+"",ye.CANCELLED,ye.PLAN_APPROVED+"",ye.CANCELLED,ye.PLAN_REJECTED+"",ye.CANCELLED,ye.COMPLETED+"",ye.RESULT_REJECTED+"",ye.CANCELLED,ye.FAILED+"",ye.CANCELLED+"";const Vh="browser_capture",Yh="browser_automate";async function $e(e,t,n,r){const s=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,c=await fetch(s,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});if(!c.ok){const u=await c.json().catch(()=>({message:`HTTP ${c.status}`}));throw new Error(u.message||u.error||`HTTP ${c.status}`)}return c.json()}async function ta(e,t){return $e(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)}async function Yo(e,t,n,r,o,s,c=Vh){var u,d,p,h,k,m;return $e(e,"POST","/tasks",{type:c,title:s||n.slice(0,120)||r.pageTitle||"Browser capture",projectId:t,autoAssign:!0,...o!=null&&o.claudeTemplateId?{claudeTemplateId:o.claudeTemplateId}:{},...(o==null?void 0:o.quickMode)!==void 0?{quickMode:o.quickMode}:{},...(o==null?void 0:o.modelOverride)!=null?{modelOverride:o.modelOverride}:{},...(o==null?void 0:o.claudeProfileId)!=null?{claudeProfileId:o.claudeProfileId}:{},...(o==null?void 0:o.effort)!=null?{effort:o.effort}:{},...(o==null?void 0:o.executionMode)!=null?{executionMode:o.executionMode}:{},...(u=o==null?void 0:o.selectedPluginIds)!=null&&u.length?{selectedPluginIds:o.selectedPluginIds}:{},...(d=o==null?void 0:o.selectedSkillIds)!=null&&d.length?{selectedSkillIds:o.selectedSkillIds}:{},...(p=o==null?void 0:o.selectedPluginSkillIds)!=null&&p.length?{selectedPluginSkillIds:o.selectedPluginSkillIds}:{},...(h=o==null?void 0:o.selectedMcpServerIds)!=null&&h.length?{selectedMcpServerIds:o.selectedMcpServerIds}:{},...(k=o==null?void 0:o.selectedSlashCommandIds)!=null&&k.length?{selectedSlashCommandIds:o.selectedSlashCommandIds}:{},...(m=o==null?void 0:o.selectedRemoteContextProviderIds)!=null&&m.length?{selectedRemoteContextProviderIds:o.selectedRemoteContextProviderIds}:{},metadata:{type:c,note:n,source:"web-sdk",pageUrl:r.pageUrl,pageTitle:r.pageTitle,elementText:r.elementText,cssSelector:r.cssSelector,elementOuterHtml:r.elementOuterHtml,ancestry:r.ancestry,elementRole:r.elementRole,elementAriaLabel:r.elementAriaLabel,enclosingSection:r.enclosingSection,description:r.description,canonicalUrl:r.canonicalUrl,lang:r.lang,ogTitle:r.ogTitle,ogDescription:r.ogDescription,ogType:r.ogType,ogSiteName:r.ogSiteName,viewportWidth:r.viewportWidth,viewportHeight:r.viewportHeight,scrollX:r.scrollX,scrollY:r.scrollY,selectionText:r.selectionText,capturedAt:r.capturedAt}})}async function na(e,t,n,r,o,s){return Yo(e,t,n,r,o,s,Yh)}async function ra(e,t,n,r){return $e(e,"POST","/planning-sessions",{projectId:t,instruction:n,quickMode:(r==null?void 0:r.quickMode)??!1,...r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}})}async function Kh(e,t){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return $e(e,"GET",`/claude-templates${n}`)}async function oa(e,t){return $e(e,"GET",`/tasks/${t}`)}async function Qh(e,t){return $e(e,"GET",`/planning-sessions/${t}`)}async function ef(e){return $e(e,"GET","/projects")}async function tf(e,t){return $e(e,"GET",`/tasks/${t}/browser-commands/pending`)}async function nf(e,t,n,r,o){return $e(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})}async function rf(e,t){return $e(e,"GET",`/tasks/${t}/chunks`)}async function of(e,t,n){return $e(e,"POST",`/tasks/${t}/instructions`,{content:n})}async function sf(e,t){return $e(e,"POST",`/tasks/${t}/cancel`)}async function af(e,t){return $e(e,"POST",`/tasks/${t}/approve-result`)}async function cf(e,t,n){return $e(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})}async function Wr(e,t){return $e(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)}async function ia(e,t,n,r){return $e(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})}const lf=/^cc-|current-password|new-password/i,uf=/token|secret|password|apikey|auth/i,Ko="[redacted]";function df(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",Ko);const r=n.getAttribute("autocomplete");r&&lf.test(r)&&n.setAttribute("value",Ko);for(const o of Array.from(n.attributes))uf.test(o.name)&&n.setAttribute(o.name,Ko)}}function pf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var sa={exports:{}};/*!
1368
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const b=h[1];if(t===h[0]){s(h);continue}if(e.external){const _=(d=e.external.registry.get(h[0]))==null?void 0:d.id;if(t!==h[0]&&_){s(h);continue}}if((p=e.metadataRegistry.get(h[0]))==null?void 0:p.id){s(h);continue}if(b.cycle){s(h);continue}if(b.count>1&&e.reused==="ref"){s(h);continue}}}function aa(e,t){var c,u,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=p=>{const h=e.seen.get(p);if(h.ref===null)return;const b=h.def??h.schema,m={...b},_=h.ref;if(h.ref=null,_){r(_);const P=e.seen.get(_),N=P.schema;if(N.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(b.allOf=b.allOf??[],b.allOf.push(N)):Object.assign(b,N),Object.assign(b,m),p._zod.parent===_)for(const R in b)R==="$ref"||R==="allOf"||R in m||delete b[R];if(N.$ref)for(const R in b)R==="$ref"||R==="allOf"||R in P.def&&JSON.stringify(b[R])===JSON.stringify(P.def[R])&&delete b[R]}const w=p._zod.parent;if(w&&w!==_){r(w);const P=e.seen.get(w);if(P!=null&&P.schema.$ref&&(b.$ref=P.schema.$ref,P.def))for(const N in b)N==="$ref"||N==="allOf"||N in P.def&&JSON.stringify(b[N])===JSON.stringify(P.def[N])&&delete b[N]}e.override({zodSchema:p,jsonSchema:b,path:h.path??[]})};for(const p of[...e.seen.entries()].reverse())r(p[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,(c=e.external)!=null&&c.uri){const p=(u=e.external.registry.get(t))==null?void 0:u.id;if(!p)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(p)}Object.assign(o,n.def??n.schema);const s=((d=e.external)==null?void 0:d.defs)??{};for(const p of e.seen.entries()){const h=p[1];h.def&&h.defId&&(s[h.defId]=h.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const p=JSON.parse(JSON.stringify(o));return Object.defineProperty(p,"~standard",{value:{...t["~standard"],jsonSchema:{input:io(t,"input",e.processors),output:io(t,"output",e.processors)}},enumerable:!1,writable:!1}),p}catch{throw new Error("Error converting schema to JSON.")}}function qe(e,t){const n=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 zp=(e,t={})=>n=>{const r=ia({...n,processors:t});return Te(e,r),sa(r,e),aa(r,e)},io=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},c=ia({...o??{},target:s,io:t,processors:n});return Te(e,c),sa(c,e),aa(c,e)},Ip={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},$p=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:c,format:u,patterns:d,contentEncoding:p}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof c=="number"&&(o.maxLength=c),u&&(o.format=Ip[u]??u,o.format===""&&delete o.format,u==="time"&&delete o.format),p&&(o.contentEncoding=p),d&&d.size>0){const h=[...d];h.length===1?o.pattern=h[0].source:h.length>1&&(o.allOf=[...h.map(b=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:b.source}))])}},Np=(e,t,n,r)=>{const o=n,{minimum:s,maximum:c,format:u,multipleOf:d,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof u=="string"&&u.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 s=="number"&&(o.minimum=s,typeof h=="number"&&t.target!=="draft-04"&&(h>=s?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 c=="number"&&(o.maximum=c,typeof p=="number"&&t.target!=="draft-04"&&(p<=c?delete o.maximum:delete o.exclusiveMaximum)),typeof d=="number"&&(o.multipleOf=d)},Op=(e,t,n,r)=>{n.type="boolean"},Dp=(e,t,n,r)=>{n.not={}},Mp=(e,t,n,r)=>{},Up=(e,t,n,r)=>{},jp=(e,t,n,r)=>{const o=e._zod.def,s=ws(o.entries);s.every(c=>typeof c=="number")&&(n.type="number"),s.every(c=>typeof c=="string")&&(n.type="string"),n.enum=s},Zp=(e,t,n,r)=>{const o=e._zod.def,s=[];for(const c of o.values)if(c===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof c=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(c))}else s.push(c);if(s.length!==0)if(s.length===1){const c=s[0];n.type=c===null?"null":typeof c,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[c]:n.const=c}else s.every(c=>typeof c=="number")&&(n.type="number"),s.every(c=>typeof c=="string")&&(n.type="string"),s.every(c=>typeof c=="boolean")&&(n.type="boolean"),s.every(c=>c===null)&&(n.type="null"),n.enum=s},qp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Hp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Fp=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:c,maximum:u}=e._zod.bag;typeof c=="number"&&(o.minItems=c),typeof u=="number"&&(o.maxItems=u),o.type="array",o.items=Te(s.element,t,{...r,path:[...r.path,"items"]})},Bp=(e,t,n,r)=>{var p;const o=n,s=e._zod.def;o.type="object",o.properties={};const c=s.shape;for(const h in c)o.properties[h]=Te(c[h],t,{...r,path:[...r.path,"properties",h]});const u=new Set(Object.keys(c)),d=new Set([...u].filter(h=>{const b=s.shape[h]._zod;return t.io==="input"?b.optin===void 0:b.optout===void 0}));d.size>0&&(o.required=Array.from(d)),((p=s.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=Te(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Gp=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,c=o.options.map((u,d)=>Te(u,t,{...r,path:[...r.path,s?"oneOf":"anyOf",d]}));s?n.oneOf=c:n.anyOf=c},Wp=(e,t,n,r)=>{const o=e._zod.def,s=Te(o.left,t,{...r,path:[...r.path,"allOf",0]}),c=Te(o.right,t,{...r,path:[...r.path,"allOf",1]}),u=p=>"allOf"in p&&Object.keys(p).length===1,d=[...u(s)?s.allOf:[s],...u(c)?c.allOf:[c]];n.allOf=d},Jp=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const c=s.keyType,u=c._zod.bag,d=u==null?void 0:u.patterns;if(s.mode==="loose"&&d&&d.size>0){const h=Te(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const b of d)o.patternProperties[b.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Te(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Te(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const p=c._zod.values;if(p){const h=[...p].filter(b=>typeof b=="string"||typeof b=="number");h.length>0&&(o.required=h)}},Xp=(e,t,n,r)=>{const o=e._zod.def,s=Te(o.innerType,t,r),c=t.seen.get(e);t.target==="openapi-3.0"?(c.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},Vp=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Yp=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Kp=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Qp=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let c;try{c=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=c},eh=(e,t,n,r)=>{const o=e._zod.def,s=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Te(s,t,r);const c=t.seen.get(e);c.ref=s},th=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},ca=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},nh=v("ZodISODateTime",(e,t)=>{ed.init(e,t),me.init(e,t)});function rh(e){return ap(nh,e)}const oh=v("ZodISODate",(e,t)=>{td.init(e,t),me.init(e,t)});function ih(e){return cp(oh,e)}const sh=v("ZodISOTime",(e,t)=>{nd.init(e,t),me.init(e,t)});function ah(e){return lp(sh,e)}const ch=v("ZodISODuration",(e,t)=>{rd.init(e,t),me.init(e,t)});function lh(e){return up(ch,e)}const rt=v("ZodError",(e,t)=>{Cs.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Wl(e,n)},flatten:{value:n=>Gl(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ii,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ii,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),uh=li(rt),dh=ui(rt),ph=Qr(rt),hh=eo(rt),fh=Vl(rt),gh=Yl(rt),mh=Kl(rt),bh=Ql(rt),kh=eu(rt),_h=tu(rt),vh=nu(rt),yh=ru(rt),he=v("ZodType",(e,t)=>(de.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:io(e,"input"),output:io(e,"output")}}),e.toJSONSchema=zp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Gt(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>Wt(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>uh(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>ph(e,n,r),e.parseAsync=async(n,r)=>dh(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>hh(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>fh(e,n,r),e.decode=(n,r)=>gh(e,n,r),e.encodeAsync=async(n,r)=>mh(e,n,r),e.decodeAsync=async(n,r)=>bh(e,n,r),e.safeEncode=(n,r)=>kh(e,n,r),e.safeDecode=(n,r)=>_h(e,n,r),e.safeEncodeAsync=async(n,r)=>vh(e,n,r),e.safeDecodeAsync=async(n,r)=>yh(e,n,r),e.refine=(n,r)=>e.check(bf(n,r)),e.superRefine=n=>e.check(kf(n)),e.overwrite=n=>e.check(Un(n)),e.optional=()=>ka(e),e.exactOptional=()=>rf(e),e.nullable=()=>_a(e),e.nullish=()=>ka(_a(e)),e.nonoptional=n=>uf(e,n),e.array=()=>yt(e),e.or=n=>Jh([e,n]),e.and=n=>Yh(e,n),e.transform=n=>ya(e,tf(n)),e.default=n=>af(e,n),e.prefault=n=>lf(e,n),e.catch=n=>pf(e,n),e.pipe=n=>ya(e,n),e.readonly=()=>gf(e),e.describe=n=>{const r=e.clone();return hr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=hr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return hr.get(e);const r=e.clone();return hr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),la=v("_ZodString",(e,t)=>{di.init(e,t),he.init(e,t),e._zod.processJSONSchema=(r,o,s)=>$p(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(bp(...r)),e.includes=(...r)=>e.check(vp(...r)),e.startsWith=(...r)=>e.check(yp(...r)),e.endsWith=(...r)=>e.check(wp(...r)),e.min=(...r)=>e.check(oo(...r)),e.max=(...r)=>e.check(ra(...r)),e.length=(...r)=>e.check(oa(...r)),e.nonempty=(...r)=>e.check(oo(1,...r)),e.lowercase=r=>e.check(kp(r)),e.uppercase=r=>e.check(_p(r)),e.trim=()=>e.check(Sp()),e.normalize=(...r)=>e.check(xp(...r)),e.toLowerCase=()=>e.check(Tp()),e.toUpperCase=()=>e.check(Ep()),e.slugify=()=>e.check(Ap())}),wh=v("ZodString",(e,t)=>{di.init(e,t),la.init(e,t),e.email=n=>e.check(jd(xh,n)),e.url=n=>e.check(Bd(Sh,n)),e.jwt=n=>e.check(sp(Uh,n)),e.emoji=n=>e.check(Gd(Th,n)),e.guid=n=>e.check(Qs(ua,n)),e.uuid=n=>e.check(Zd(so,n)),e.uuidv4=n=>e.check(qd(so,n)),e.uuidv6=n=>e.check(Hd(so,n)),e.uuidv7=n=>e.check(Fd(so,n)),e.nanoid=n=>e.check(Wd(Eh,n)),e.guid=n=>e.check(Qs(ua,n)),e.cuid=n=>e.check(Jd(Ah,n)),e.cuid2=n=>e.check(Xd(Ch,n)),e.ulid=n=>e.check(Vd(Ph,n)),e.base64=n=>e.check(rp(Oh,n)),e.base64url=n=>e.check(op(Dh,n)),e.xid=n=>e.check(Yd(Rh,n)),e.ksuid=n=>e.check(Kd(Lh,n)),e.ipv4=n=>e.check(Qd(zh,n)),e.ipv6=n=>e.check(ep(Ih,n)),e.cidrv4=n=>e.check(tp($h,n)),e.cidrv6=n=>e.check(np(Nh,n)),e.e164=n=>e.check(ip(Mh,n)),e.datetime=n=>e.check(rh(n)),e.date=n=>e.check(ih(n)),e.time=n=>e.check(ah(n)),e.duration=n=>e.check(lh(n))});function A(e){return Ud(wh,e)}const me=v("ZodStringFormat",(e,t)=>{pe.init(e,t),la.init(e,t)}),xh=v("ZodEmail",(e,t)=>{Bu.init(e,t),me.init(e,t)}),ua=v("ZodGUID",(e,t)=>{Hu.init(e,t),me.init(e,t)}),so=v("ZodUUID",(e,t)=>{Fu.init(e,t),me.init(e,t)}),Sh=v("ZodURL",(e,t)=>{Gu.init(e,t),me.init(e,t)}),Th=v("ZodEmoji",(e,t)=>{Wu.init(e,t),me.init(e,t)}),Eh=v("ZodNanoID",(e,t)=>{Ju.init(e,t),me.init(e,t)}),Ah=v("ZodCUID",(e,t)=>{Xu.init(e,t),me.init(e,t)}),Ch=v("ZodCUID2",(e,t)=>{Vu.init(e,t),me.init(e,t)}),Ph=v("ZodULID",(e,t)=>{Yu.init(e,t),me.init(e,t)}),Rh=v("ZodXID",(e,t)=>{Ku.init(e,t),me.init(e,t)}),Lh=v("ZodKSUID",(e,t)=>{Qu.init(e,t),me.init(e,t)}),zh=v("ZodIPv4",(e,t)=>{od.init(e,t),me.init(e,t)}),Ih=v("ZodIPv6",(e,t)=>{id.init(e,t),me.init(e,t)}),$h=v("ZodCIDRv4",(e,t)=>{sd.init(e,t),me.init(e,t)}),Nh=v("ZodCIDRv6",(e,t)=>{ad.init(e,t),me.init(e,t)}),Oh=v("ZodBase64",(e,t)=>{cd.init(e,t),me.init(e,t)}),Dh=v("ZodBase64URL",(e,t)=>{ud.init(e,t),me.init(e,t)}),Mh=v("ZodE164",(e,t)=>{dd.init(e,t),me.init(e,t)}),Uh=v("ZodJWT",(e,t)=>{hd.init(e,t),me.init(e,t)}),da=v("ZodNumber",(e,t)=>{Us.init(e,t),he.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Np(e,r,o),e.gt=(r,o)=>e.check(ta(r,o)),e.gte=(r,o)=>e.check(fi(r,o)),e.min=(r,o)=>e.check(fi(r,o)),e.lt=(r,o)=>e.check(ea(r,o)),e.lte=(r,o)=>e.check(hi(r,o)),e.max=(r,o)=>e.check(hi(r,o)),e.int=r=>e.check(pa(r)),e.safe=r=>e.check(pa(r)),e.positive=r=>e.check(ta(0,r)),e.nonnegative=r=>e.check(fi(0,r)),e.negative=r=>e.check(ea(0,r)),e.nonpositive=r=>e.check(hi(0,r)),e.multipleOf=(r,o)=>e.check(na(r,o)),e.step=(r,o)=>e.check(na(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function vt(e){return dp(da,e)}const jh=v("ZodNumberFormat",(e,t)=>{fd.init(e,t),da.init(e,t)});function pa(e){return pp(jh,e)}const Zh=v("ZodBoolean",(e,t)=>{gd.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Op(e,n,r)});function fe(e){return hp(Zh,e)}const qh=v("ZodAny",(e,t)=>{md.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mp()});function ha(){return fp(qh)}const Hh=v("ZodUnknown",(e,t)=>{bd.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Up()});function fa(){return gp(Hh)}const Fh=v("ZodNever",(e,t)=>{kd.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Dp(e,n,r)});function Bh(e){return mp(Fh,e)}const Gh=v("ZodArray",(e,t)=>{_d.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fp(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(oo(n,r)),e.nonempty=n=>e.check(oo(1,n)),e.max=(n,r)=>e.check(ra(n,r)),e.length=(n,r)=>e.check(oa(n,r)),e.unwrap=()=>e.element});function yt(e,t){return Cp(Gh,e,t)}const Wh=v("ZodObject",(e,t)=>{yd.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bp(e,n,r,o),Y(e,"shape",()=>t.shape),e.keyof=()=>ot(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:fa()}),e.loose=()=>e.clone({...e._zod.def,catchall:fa()}),e.strict=()=>e.clone({...e._zod.def,catchall:Bh()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Zl(e,n),e.safeExtend=n=>ql(e,n),e.merge=n=>Hl(e,n),e.pick=n=>Ul(e,n),e.omit=n=>jl(e,n),e.partial=(...n)=>Fl(ba,e,n[0]),e.required=(...n)=>Bl(va,e,n[0])});function ue(e,t){const n={type:"object",shape:e??{},...O(t)};return new Wh(n)}const ga=v("ZodUnion",(e,t)=>{Fs.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gp(e,n,r,o),e.options=t.options});function Jh(e,t){return new ga({type:"union",options:e,...O(t)})}const Xh=v("ZodDiscriminatedUnion",(e,t)=>{ga.init(e,t),wd.init(e,t)});function ma(e,t,n){return new Xh({type:"union",options:t,discriminator:e,...O(n)})}const Vh=v("ZodIntersection",(e,t)=>{xd.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wp(e,n,r,o)});function Yh(e,t){return new Vh({type:"intersection",left:e,right:t})}const Kh=v("ZodRecord",(e,t)=>{Sd.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jp(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function wt(e,t,n){return new Kh({type:"record",keyType:e,valueType:t,...O(n)})}const gi=v("ZodEnum",(e,t)=>{Td.init(e,t),he.init(e,t),e._zod.processJSONSchema=(r,o,s)=>jp(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 s={};for(const c of r)if(n.has(c))s[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new gi({...t,checks:[],...O(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const c of r)if(n.has(c))delete s[c];else throw new Error(`Key ${c} not found in enum`);return new gi({...t,checks:[],...O(o),entries:s})}});function ot(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new gi({type:"enum",entries:n,...O(t)})}const Qh=v("ZodLiteral",(e,t)=>{Ed.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zp(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 it(e,t){return new Qh({type:"literal",values:Array.isArray(e)?e:[e],...O(t)})}const ef=v("ZodTransform",(e,t)=>{Ad.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hp(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new vs(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(pr(s,n.value,t));else{const c=s;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=n.value),c.inst??(c.inst=e),n.issues.push(pr(c))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function tf(e){return new ef({type:"transform",transform:e})}const ba=v("ZodOptional",(e,t)=>{Ws.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ca(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ka(e){return new ba({type:"optional",innerType:e})}const nf=v("ZodExactOptional",(e,t)=>{Cd.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ca(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function rf(e){return new nf({type:"optional",innerType:e})}const of=v("ZodNullable",(e,t)=>{Pd.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function _a(e){return new of({type:"nullable",innerType:e})}const sf=v("ZodDefault",(e,t)=>{Rd.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function af(e,t){return new sf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Es(t)}})}const cf=v("ZodPrefault",(e,t)=>{Ld.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Kp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function lf(e,t){return new cf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Es(t)}})}const va=v("ZodNonOptional",(e,t)=>{zd.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function uf(e,t){return new va({type:"nonoptional",innerType:e,...O(t)})}const df=v("ZodCatch",(e,t)=>{Id.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function pf(e,t){return new df({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const hf=v("ZodPipe",(e,t)=>{$d.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>eh(e,n,r,o),e.in=t.in,e.out=t.out});function ya(e,t){return new hf({type:"pipe",in:e,out:t})}const ff=v("ZodReadonly",(e,t)=>{Nd.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>th(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function gf(e){return new ff({type:"readonly",innerType:e})}const mf=v("ZodCustom",(e,t)=>{Od.init(e,t),he.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qp(e,n)});function bf(e,t={}){return Pp(mf,e,t)}function kf(e){return Rp(e)}const _f=ue({name:A().min(1).max(100).optional(),command:A().min(1).max(500),args:yt(A()).optional(),failOnError:fe().default(!0).optional(),timeout:vt().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:A().optional(),env:wt(A(),A()).optional(),runOnBackground:fe().optional()});ue({name:A(),command:A(),success:fe(),exitCode:vt().optional(),stdout:A().optional(),stderr:A().optional(),error:A().optional(),duration:vt(),failOnError:fe()});const ln=ue({path:A(),extraCommands:yt(_f).optional(),id:A().uuid().optional(),rotationKey:A().optional(),usageStatus:ot(["free","in_use"]).optional()}),vf=ma("operation",[ln.extend({operation:it("create"),content:A().optional(),contentPath:A().optional(),encoding:ot(["utf-8","base64"]).optional()}),ln.extend({operation:it("merge"),data:wt(A(),ha()),mergeStrategy:ot(["deep","shallow"]).optional(),arrayMergeStrategy:ot(["concat","replace"]).optional()}),ln.extend({operation:it("modify"),content:A().optional(),contentPath:A().optional(),createIfMissing:fe().optional()}),ln.extend({operation:it("delete"),ignoreIfMissing:fe().optional()}),ln.extend({operation:it("createDirectory"),contentPath:A().optional(),mode:vt().optional(),ignoreIfExists:fe().optional()}),ln.extend({operation:it("download"),url:A().url(),headers:wt(A(),A()).optional(),timeout:vt().min(1e3).max(3e5).optional()}),ln.extend({operation:it("gitClone"),gitUrl:A(),gitSecretKey:A().optional(),sourceBranch:A().optional(),targetBranch:A().optional()})]);var we=(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))(we||{});const yf=ue({type:ot(["json","file","regex"]).describe("Extraction method"),source:A().describe("Source to extract from (file path or stdout/stderr)"),schema:ue({}).passthrough().optional().describe("JSON schema for validation"),pattern:A().optional().describe("Regex pattern for extraction")}),wf=ue({type:ot(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:ha().describe("Hook-specific configuration")});ue({command:A().optional().describe("Legacy — unused in SDK mode"),args:yt(A()).optional().describe("Legacy — unused in SDK mode"),env:wt(A(),A()).optional().describe("Environment variables"),workingDirectory:A().optional().describe("Working directory for command execution"),fileOperations:yt(vf).optional().describe("File operations to perform during setup"),gitUrl:A().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:A().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:A().optional().describe("Commit message for git operations"),resultExtraction:yf.optional().describe("Schema for extracting result data"),postExecutionHooks:yt(wf).optional().describe("Hooks to run after task completion"),executionMode:ot(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:ma("executionMode",[ue({executionMode:it("claudeAgentSdk"),promptText:A(),sdkOptions:ue({model:A(),permissionMode:ot(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:yt(A()),allowDangerouslySkipPermissions:fe(),persistSession:fe(),streamSdkEvents:fe().optional(),allowedTools:yt(A()).optional(),settings:ue({enabledPlugins:wt(A(),fe())}),env:wt(A(),A()).optional()}),resume:ue({sessionId:A().optional(),continue:fe()}).optional()}),ue({executionMode:it("opencodeSdk"),promptText:A(),sdkOptions:ue({provider:A(),model:A(),env:wt(A(),A()).optional()}),resume:ue({sessionId:A().optional(),continue:fe()}).optional()}),ue({executionMode:it("openaiAgentSdk"),promptText:A(),sdkOptions:ue({model:A(),env:wt(A(),A()).optional()}),resume:ue({sessionId:A().optional(),continue:fe()}).optional()}),ue({executionMode:it("codexSdk"),promptText:A(),sdkOptions:ue({model:A().optional(),sandboxMode:ot(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:ot(["never","on-request","on-failure","untrusted"]).optional(),env:wt(A(),A()).optional()}),resume:ue({sessionId:A().optional(),continue:fe()}).optional()}),ue({executionMode:it("cursorSdk"),promptText:A(),sdkOptions:ue({model:A(),env:wt(A(),A()).optional()}),resume:ue({sessionId:A().optional(),continue:fe()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:fe().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:A().optional().describe("Final approved plan content"),planApproved:fe().optional().describe("Plan approval status"),planApprovedAt:A().optional().describe("ISO timestamp of approval"),planRejected:fe().optional().describe("Plan rejection flag"),planRejectionFeedback:A().optional().describe("User rejection feedback"),rejectedPlanContent:A().optional().describe("Previously rejected plan content"),planCompletedAt:A().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:A().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:A().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:A().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:yt(ue({feedback:A(),rejectedAt:A()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:vt().optional(),notificationChannelPlanMessageSentAt:A().optional(),notificationChannelCompletedMessageId:vt().optional(),notificationChannelFailedMessageId:vt().optional(),streamSdkEvents:fe().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:A().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:fe().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:yt(ue({id:A(),selectedText:A(),startOffset:vt(),endOffset:vt(),commentText:A(),createdAt:A()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:fe().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:fe().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:ot(["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:fe().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")}),we.PENDING+"",we.CANCELLED,we.ASSIGNED+"",we.CANCELLED,we.IN_PROGRESS+"",we.CANCELLED,we.FAILED,we.WAITING_FOR_INPUT+"",we.CANCELLED,we.WAITING_FOR_PLAN_APPROVAL+"",we.CANCELLED,we.PLAN_APPROVED+"",we.CANCELLED,we.PLAN_REJECTED+"",we.CANCELLED,we.COMPLETED+"",we.RESULT_REJECTED+"",we.CANCELLED,we.FAILED+"",we.CANCELLED+"";const wa="browser_capture",xf="browser_automate";async function De(e,t,n,r){const s=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,c=await fetch(s,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});if(!c.ok){const u=await c.json().catch(()=>({message:`HTTP ${c.status}`}));throw new Error(u.message||u.error||`HTTP ${c.status}`)}return c.json()}async function xa(e,t){return De(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)}async function mi(e,t,n,r,o,s,c=wa,u){var d,p,h,b,m,_;return De(e,"POST","/tasks",{type:c,title:s||n.slice(0,120)||r.pageTitle||"Browser capture",titleInstruction:u??n,projectId:t,autoAssign:!0,...o!=null&&o.claudeTemplateId?{claudeTemplateId:o.claudeTemplateId}:{},...(o==null?void 0:o.quickMode)!==void 0?{quickMode:o.quickMode}:{},...(o==null?void 0:o.modelOverride)!=null?{modelOverride:o.modelOverride}:{},...(o==null?void 0:o.claudeProfileId)!=null?{claudeProfileId:o.claudeProfileId}:{},...(o==null?void 0:o.effort)!=null?{effort:o.effort}:{},...(o==null?void 0:o.executionMode)!=null?{executionMode:o.executionMode}:{},...(d=o==null?void 0:o.selectedPluginIds)!=null&&d.length?{selectedPluginIds:o.selectedPluginIds}:{},...(p=o==null?void 0:o.selectedSkillIds)!=null&&p.length?{selectedSkillIds:o.selectedSkillIds}:{},...(h=o==null?void 0:o.selectedPluginSkillIds)!=null&&h.length?{selectedPluginSkillIds:o.selectedPluginSkillIds}:{},...(b=o==null?void 0:o.selectedMcpServerIds)!=null&&b.length?{selectedMcpServerIds:o.selectedMcpServerIds}:{},...(m=o==null?void 0:o.selectedSlashCommandIds)!=null&&m.length?{selectedSlashCommandIds:o.selectedSlashCommandIds}:{},...(_=o==null?void 0:o.selectedRemoteContextProviderIds)!=null&&_.length?{selectedRemoteContextProviderIds:o.selectedRemoteContextProviderIds}:{},metadata:{type:c,note:n,source:"web-sdk",pageUrl:r.pageUrl,pageTitle:r.pageTitle,elementText:r.elementText,cssSelector:r.cssSelector,elementOuterHtml:r.elementOuterHtml,ancestry:r.ancestry,elementRole:r.elementRole,elementAriaLabel:r.elementAriaLabel,enclosingSection:r.enclosingSection,description:r.description,canonicalUrl:r.canonicalUrl,lang:r.lang,ogTitle:r.ogTitle,ogDescription:r.ogDescription,ogType:r.ogType,ogSiteName:r.ogSiteName,viewportWidth:r.viewportWidth,viewportHeight:r.viewportHeight,scrollX:r.scrollX,scrollY:r.scrollY,selectionText:r.selectionText,capturedAt:r.capturedAt,interactionSteps:r.interactionSteps}})}async function Sa(e,t,n,r,o,s,c){return mi(e,t,n,r,o,s,xf,c)}async function Ta(e,t,n,r){return De(e,"POST","/planning-sessions",{projectId:t,instruction:n,quickMode:(r==null?void 0:r.quickMode)??!1,...r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}})}async function Sf(e,t){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return De(e,"GET",`/claude-templates${n}`)}async function Ea(e,t){return De(e,"GET",`/tasks/${t}`)}async function Tf(e,t){return De(e,"GET",`/planning-sessions/${t}`)}async function Ef(e){return De(e,"GET","/projects")}async function Af(e,t){return De(e,"GET",`/tasks/${t}/browser-commands/pending`)}async function Cf(e,t,n,r,o){return De(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})}async function Pf(e,t){return De(e,"GET",`/tasks/${t}/chunks`)}async function Rf(e,t,n){return De(e,"POST",`/tasks/${t}/instructions`,{content:n})}async function Lf(e,t){return De(e,"POST",`/tasks/${t}/cancel`)}async function zf(e,t){return De(e,"POST",`/tasks/${t}/approve-result`)}async function If(e,t,n){return De(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})}async function ao(e,t){return De(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)}async function Aa(e,t,n,r){return De(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})}const Ca=/^cc-|current-password|new-password/i,$f=/token|secret|password|apikey|auth/i,bi="[redacted]";function Nf(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&Ca.test(t)}function Of(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",bi);const r=n.getAttribute("autocomplete");r&&Ca.test(r)&&n.setAttribute("value",bi);for(const o of Array.from(n.attributes))$f.test(o.name)&&n.setAttribute(o.name,bi)}}function Df(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pa={exports:{}};/*!
1225
1369
  * Pusher JavaScript Library v8.5.0
1226
1370
  * https://pusher.com/
1227
1371
  *
1228
1372
  * Copyright 2020, Pusher
1229
1373
  * Released under the MIT licence.
1230
- */(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(c,u){var d=this&&this.__extends||function(){var R=function(x,S){return R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,M){C.__proto__=M}||function(C,M){for(var se in M)M.hasOwnProperty(se)&&(C[se]=M[se])},R(x,S)};return function(x,S){R(x,S);function C(){this.constructor=x}x.prototype=S===null?Object.create(S):(C.prototype=S.prototype,new C)}}();Object.defineProperty(u,"__esModule",{value:!0});var p=256,h=function(){function R(x){x===void 0&&(x="="),this._paddingCharacter=x}return R.prototype.encodedLength=function(x){return this._paddingCharacter?(x+2)/3*4|0:(x*8+5)/6|0},R.prototype.encode=function(x){for(var S="",C=0;C<x.length-2;C+=3){var M=x[C]<<16|x[C+1]<<8|x[C+2];S+=this._encodeByte(M>>>3*6&63),S+=this._encodeByte(M>>>2*6&63),S+=this._encodeByte(M>>>1*6&63),S+=this._encodeByte(M>>>0*6&63)}var se=x.length-C;if(se>0){var M=x[C]<<16|(se===2?x[C+1]<<8:0);S+=this._encodeByte(M>>>3*6&63),S+=this._encodeByte(M>>>2*6&63),se===2?S+=this._encodeByte(M>>>1*6&63):S+=this._paddingCharacter||"",S+=this._paddingCharacter||""}return S},R.prototype.maxDecodedLength=function(x){return this._paddingCharacter?x/4*3|0:(x*6+7)/8|0},R.prototype.decodedLength=function(x){return this.maxDecodedLength(x.length-this._getPaddingLength(x))},R.prototype.decode=function(x){if(x.length===0)return new Uint8Array(0);for(var S=this._getPaddingLength(x),C=x.length-S,M=new Uint8Array(this.maxDecodedLength(C)),se=0,ke=0,ze=0,Ye=0,K=0,me=0,Ke=0;ke<C-4;ke+=4)Ye=this._decodeChar(x.charCodeAt(ke+0)),K=this._decodeChar(x.charCodeAt(ke+1)),me=this._decodeChar(x.charCodeAt(ke+2)),Ke=this._decodeChar(x.charCodeAt(ke+3)),M[se++]=Ye<<2|K>>>4,M[se++]=K<<4|me>>>2,M[se++]=me<<6|Ke,ze|=Ye&p,ze|=K&p,ze|=me&p,ze|=Ke&p;if(ke<C-1&&(Ye=this._decodeChar(x.charCodeAt(ke)),K=this._decodeChar(x.charCodeAt(ke+1)),M[se++]=Ye<<2|K>>>4,ze|=Ye&p,ze|=K&p),ke<C-2&&(me=this._decodeChar(x.charCodeAt(ke+2)),M[se++]=K<<4|me>>>2,ze|=me&p),ke<C-3&&(Ke=this._decodeChar(x.charCodeAt(ke+3)),M[se++]=me<<6|Ke,ze|=Ke&p),ze!==0)throw new Error("Base64Coder: incorrect characters for decoding");return M},R.prototype._encodeByte=function(x){var S=x;return S+=65,S+=25-x>>>8&6,S+=51-x>>>8&-75,S+=61-x>>>8&-15,S+=62-x>>>8&3,String.fromCharCode(S)},R.prototype._decodeChar=function(x){var S=p;return S+=(42-x&x-44)>>>8&-p+x-43+62,S+=(46-x&x-48)>>>8&-p+x-47+63,S+=(47-x&x-58)>>>8&-p+x-48+52,S+=(64-x&x-91)>>>8&-p+x-65+0,S+=(96-x&x-123)>>>8&-p+x-97+26,S},R.prototype._getPaddingLength=function(x){var S=0;if(this._paddingCharacter){for(var C=x.length-1;C>=0&&x[C]===this._paddingCharacter;C--)S++;if(x.length<4||S>2)throw new Error("Base64Coder: incorrect padding")}return S},R}();u.Coder=h;var k=new h;function m(R){return k.encode(R)}u.encode=m;function _(R){return k.decode(R)}u.decode=_;var w=function(R){d(x,R);function x(){return R!==null&&R.apply(this,arguments)||this}return x.prototype._encodeByte=function(S){var C=S;return C+=65,C+=25-S>>>8&6,C+=51-S>>>8&-75,C+=61-S>>>8&-13,C+=62-S>>>8&49,String.fromCharCode(C)},x.prototype._decodeChar=function(S){var C=p;return C+=(44-S&S-46)>>>8&-p+S-45+62,C+=(94-S&S-96)>>>8&-p+S-95+63,C+=(47-S&S-58)>>>8&-p+S-48+52,C+=(64-S&S-91)>>>8&-p+S-65+0,C+=(96-S&S-123)>>>8&-p+S-97+26,C},x}(h);u.URLSafeCoder=w;var P=new w;function N(R){return P.encode(R)}u.encodeURLSafe=N;function re(R){return P.decode(R)}u.decodeURLSafe=re,u.encodedLength=function(R){return k.encodedLength(R)},u.maxDecodedLength=function(R){return k.maxDecodedLength(R)},u.decodedLength=function(R){return k.decodedLength(R)}},978(c,u){var d="utf8: invalid source encoding";function p(h){for(var k=[],m=0;m<h.length;m++){var _=h[m];if(_&128){var w=void 0;if(_<224){if(m>=h.length)throw new Error(d);var P=h[++m];if((P&192)!==128)throw new Error(d);_=(_&31)<<6|P&63,w=128}else if(_<240){if(m>=h.length-1)throw new Error(d);var P=h[++m],N=h[++m];if((P&192)!==128||(N&192)!==128)throw new Error(d);_=(_&15)<<12|(P&63)<<6|N&63,w=2048}else if(_<248){if(m>=h.length-2)throw new Error(d);var P=h[++m],N=h[++m],re=h[++m];if((P&192)!==128||(N&192)!==128||(re&192)!==128)throw new Error(d);_=(_&15)<<18|(P&63)<<12|(N&63)<<6|re&63,w=65536}else throw new Error(d);if(_<w||_>=55296&&_<=57343)throw new Error(d);if(_>=65536){if(_>1114111)throw new Error(d);_-=65536,k.push(String.fromCharCode(55296|_>>10)),_=56320|_&1023}}k.push(String.fromCharCode(_))}return k.join("")}u.D4=p},721(c,u,d){c.exports=d(207).default},207(c,u,d){d.d(u,{default:()=>No});class p{constructor(i,a){this.lastId=0,this.prefix=i,this.name=a}create(i){this.lastId++;var a=this.lastId,f=this.prefix+a,g=this.name+"["+a+"]",y=!1,E=function(){y||(i.apply(null,arguments),y=!0)};return this[a]=E,{number:a,id:f,name:g,callback:E}}remove(i){delete this[i.number]}}var h=new p("_pusher_script_","Pusher.ScriptReceivers"),k={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=k;class _{constructor(i){this.options=i,this.receivers=i.receivers||h,this.loading={}}load(i,a,f){var g=this;if(g.loading[i]&&g.loading[i].length>0)g.loading[i].push(f);else{g.loading[i]=[f];var y=q.createScriptRequest(g.getPath(i,a)),E=g.receivers.create(function($){if(g.receivers.remove(E),g.loading[i]){var Z=g.loading[i];delete g.loading[i];for(var X=function(Se){Se||y.cleanup()},ee=0;ee<Z.length;ee++)Z[ee]($,X)}});y.send(E)}}getRoot(i){var a,f=q.getDocument().location.protocol;return i&&i.useTLS||f==="https:"?a=this.options.cdn_https:a=this.options.cdn_http,a.replace(/\/*$/,"")+"/"+this.options.version}getPath(i,a){return this.getRoot(a)+"/"+i+this.options.suffix+".js"}}var w=new p("_pusher_dependencies","Pusher.DependenciesReceivers"),P=new _({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:w});const N={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"}}},R={buildLogSuffix:function(l){const i="See:",a=N.urls[l];if(!a)return"";let f;return a.fullUrl?f=a.fullUrl:a.path&&(f=N.baseUrl+a.path),f?`${i} ${f}`:""}};var x;(function(l){l.UserAuthentication="user-authentication",l.ChannelAuthorization="channel-authorization"})(x||(x={}));class S extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class C extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class se extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class ke extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class ze extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class Ye extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class K extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class me extends Error{constructor(i,a){super(a),this.status=i,Object.setPrototypeOf(this,new.target.prototype)}}const Wt=function(l,i,a,f,g){const y=q.createXHR();y.open("POST",a.endpoint,!0),y.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var E in a.headers)y.setRequestHeader(E,a.headers[E]);if(a.headersProvider!=null){let $=a.headersProvider();for(var E in $)y.setRequestHeader(E,$[E])}return y.onreadystatechange=function(){if(y.readyState===4)if(y.status===200){let $,Z=!1;try{$=JSON.parse(y.responseText),Z=!0}catch{g(new me(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${y.responseText}`),null)}Z&&g(null,$)}else{let $="";switch(f){case x.UserAuthentication:$=R.buildLogSuffix("authenticationEndpoint");break;case x.ChannelAuthorization:$=`Clients must be authorized to join private or presence channels. ${R.buildLogSuffix("authorizationEndpoint")}`;break}g(new me(y.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${y.status} from ${a.endpoint}. ${$}`),null)}},y.send(i),y};function j(l){return be(St(l))}var Q=String.fromCharCode,Le="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Oe=function(l){var i=l.charCodeAt(0);return i<128?l:i<2048?Q(192|i>>>6)+Q(128|i&63):Q(224|i>>>12&15)+Q(128|i>>>6&63)+Q(128|i&63)},St=function(l){return l.replace(/[^\x00-\x7F]/g,Oe)},ht=function(l){var i=[0,2,1][l.length%3],a=l.charCodeAt(0)<<16|(l.length>1?l.charCodeAt(1):0)<<8|(l.length>2?l.charCodeAt(2):0),f=[Le.charAt(a>>>18),Le.charAt(a>>>12&63),i>=2?"=":Le.charAt(a>>>6&63),i>=1?"=":Le.charAt(a&63)];return f.join("")},be=window.btoa||function(l){return l.replace(/[\s\S]{1,3}/g,ht)};class Te{constructor(i,a,f,g){this.clear=a,this.timer=i(()=>{this.timer&&(this.timer=g(this.timer))},f)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const G=Te;function He(l){window.clearTimeout(l)}function J(l){window.clearInterval(l)}class Be extends G{constructor(i,a){super(setTimeout,He,i,function(f){return a(),null})}}class Qe extends G{constructor(i,a){super(setInterval,J,i,function(f){return a(),f})}}var We={now(){return Date.now?Date.now():new Date().valueOf()},defer(l){return new Be(0,l)},method(l,...i){var a=Array.prototype.slice.call(arguments,1);return function(f){return f[l].apply(f,a.concat(arguments))}}};const _e=We;function Ce(l,...i){for(var a=0;a<i.length;a++){var f=i[a];for(var g in f)f[g]&&f[g].constructor&&f[g].constructor===Object?l[g]=Ce(l[g]||{},f[g]):l[g]=f[g]}return l}function vo(){for(var l=["Pusher"],i=0;i<arguments.length;i++)typeof arguments[i]=="string"?l.push(arguments[i]):l.push(Ge(arguments[i]));return l.join(" : ")}function _r(l,i){var a=Array.prototype.indexOf;if(l===null)return-1;if(a&&l.indexOf===a)return l.indexOf(i);for(var f=0,g=l.length;f<g;f++)if(l[f]===i)return f;return-1}function De(l,i){for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&i(l[a],a,l)}function pn(l){var i=[];return De(l,function(a,f){i.push(f)}),i}function Lt(l){var i=[];return De(l,function(a){i.push(a)}),i}function It(l,i,a){for(var f=0;f<l.length;f++)i.call(a||window,l[f],f,l)}function qn(l,i){for(var a=[],f=0;f<l.length;f++)a.push(i(l[f],f,l,a));return a}function Gt(l,i){var a={};return De(l,function(f,g){a[g]=i(f)}),a}function hn(l,i){i=i||function(g){return!!g};for(var a=[],f=0;f<l.length;f++)i(l[f],f,l,a)&&a.push(l[f]);return a}function fn(l,i){var a={};return De(l,function(f,g){(i&&i(f,g,l,a)||f)&&(a[g]=f)}),a}function yo(l){var i=[];return De(l,function(a,f){i.push([f,a])}),i}function vr(l,i){for(var a=0;a<l.length;a++)if(i(l[a],a,l))return!0;return!1}function Ii(l,i){for(var a=0;a<l.length;a++)if(!i(l[a],a,l))return!1;return!0}function yr(l){return Gt(l,function(i){return typeof i=="object"&&(i=Ge(i)),encodeURIComponent(j(i.toString()))})}function gn(l){var i=fn(l,function(f){return f!==void 0}),a=qn(yo(yr(i)),_e.method("join","=")).join("&");return a}function Jt(l){var i=[],a=[];return function f(g,y){var E,$,Z;switch(typeof g){case"object":if(!g)return null;for(E=0;E<i.length;E+=1)if(i[E]===g)return{$ref:a[E]};if(i.push(g),a.push(y),Object.prototype.toString.apply(g)==="[object Array]")for(Z=[],E=0;E<g.length;E+=1)Z[E]=f(g[E],y+"["+E+"]");else{Z={};for($ in g)Object.prototype.hasOwnProperty.call(g,$)&&(Z[$]=f(g[$],y+"["+JSON.stringify($)+"]"))}return Z;case"number":case"string":case"boolean":return g}}(l,"$")}function Ge(l){try{return JSON.stringify(l)}catch{return JSON.stringify(Jt(l))}}class wr{constructor(){this.globalLog=i=>{window.console&&window.console.log&&window.console.log(i)}}debug(...i){this.log(this.globalLog,i)}warn(...i){this.log(this.globalLogWarn,i)}error(...i){this.log(this.globalLogError,i)}globalLogWarn(i){window.console&&window.console.warn?window.console.warn(i):this.globalLog(i)}globalLogError(i){window.console&&window.console.error?window.console.error(i):this.globalLogWarn(i)}log(i,...a){var f=vo.apply(this,arguments);No.log?No.log(f):No.logToConsole&&i.bind(this)(f)}}const ae=new wr;var wo=function(l,i,a,f,g){(a.headers!==void 0||a.headersProvider!=null)&&ae.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var y=l.nextAuthCallbackID.toString();l.nextAuthCallbackID++;var E=l.getDocument(),$=E.createElement("script");l.auth_callbacks[y]=function(ee){g(null,ee)};var Z="Pusher.auth_callbacks['"+y+"']";$.src=a.endpoint+"?callback="+encodeURIComponent(Z)+"&"+i;var X=E.getElementsByTagName("head")[0]||E.documentElement;X.insertBefore($,X.firstChild)};const xr=wo;class xo{constructor(i){this.src=i}send(i){var a=this,f="Error loading "+a.src;a.script=document.createElement("script"),a.script.id=i.id,a.script.src=a.src,a.script.type="text/javascript",a.script.charset="UTF-8",a.script.addEventListener?(a.script.onerror=function(){i.callback(f)},a.script.onload=function(){i.callback(null)}):a.script.onreadystatechange=function(){(a.script.readyState==="loaded"||a.script.readyState==="complete")&&i.callback(null)},a.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(a.errorScript=document.createElement("script"),a.errorScript.id=i.id+"_error",a.errorScript.text=i.name+"('"+f+"');",a.script.async=a.errorScript.async=!1):a.script.async=!0;var g=document.getElementsByTagName("head")[0];g.insertBefore(a.script,g.firstChild),a.errorScript&&g.insertBefore(a.errorScript,a.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 Fn{constructor(i,a){this.url=i,this.data=a}send(i){if(!this.request){var a=gn(this.data),f=this.url+"/"+i.number+"?"+a;this.request=q.createScriptRequest(f),this.request.send(i)}}cleanup(){this.request&&this.request.cleanup()}}var Hn=function(l,i){return function(a,f){var g="http"+(i?"s":"")+"://",y=g+(l.host||l.options.host)+l.options.path,E=q.createJSONPRequest(y,a),$=q.ScriptReceivers.create(function(Z,X){h.remove($),E.cleanup(),X&&X.host&&(l.host=X.host),f&&f(Z,X)});E.send($)}},ft={name:"jsonp",getAgent:Hn};const Xt=ft;function mn(l,i,a){var f=l+(i.useTLS?"s":""),g=i.useTLS?i.hostTLS:i.hostNonTLS;return f+"://"+g+a}function bn(l,i){var a="/app/"+l,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(i?"&"+i:"");return a+f}var $i={getInitial:function(l,i){var a=(i.httpPath||"")+bn(l,"flash=false");return mn("ws",i,a)}},Bn={getInitial:function(l,i){var a=(i.httpPath||"/pusher")+bn(l);return mn("http",i,a)}},Wn={getInitial:function(l,i){return mn("http",i,i.httpPath||"/pusher")},getPath:function(l,i){return bn(l)}};class Ni{constructor(){this._callbacks={}}get(i){return this._callbacks[$t(i)]}add(i,a,f){var g=$t(i);this._callbacks[g]=this._callbacks[g]||[],this._callbacks[g].push({fn:a,context:f})}remove(i,a,f){if(!i&&!a&&!f){this._callbacks={};return}var g=i?[$t(i)]:pn(this._callbacks);a||f?this.removeCallback(g,a,f):this.removeAllCallbacks(g)}removeCallback(i,a,f){It(i,function(g){this._callbacks[g]=hn(this._callbacks[g]||[],function(y){return a&&a!==y.fn||f&&f!==y.context}),this._callbacks[g].length===0&&delete this._callbacks[g]},this)}removeAllCallbacks(i){It(i,function(a){delete this._callbacks[a]},this)}}function $t(l){return"_"+l}class gt{constructor(i){this.callbacks=new Ni,this.global_callbacks=[],this.failThrough=i}bind(i,a,f){return this.callbacks.add(i,a,f),this}bind_global(i){return this.global_callbacks.push(i),this}unbind(i,a,f){return this.callbacks.remove(i,a,f),this}unbind_global(i){return i?(this.global_callbacks=hn(this.global_callbacks||[],a=>a!==i),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(i,a,f){for(var g=0;g<this.global_callbacks.length;g++)this.global_callbacks[g](i,a);var y=this.callbacks.get(i),E=[];if(f?E.push(a,f):a&&E.push(a),y&&y.length>0)for(var g=0;g<y.length;g++)y[g].fn.apply(y[g].context||window,E);else this.failThrough&&this.failThrough(i,a);return this}}class Oi extends gt{constructor(i,a,f,g,y){super(),this.initialize=q.transportConnectionInitializer,this.hooks=i,this.name=a,this.priority=f,this.key=g,this.options=y,this.state="new",this.timeline=y.timeline,this.activityTimeout=y.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 i=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(i,this.options)}catch(a){return _e.defer(()=>{this.onError(a),this.changeState("closed")}),!1}return this.bindListeners(),ae.debug("Connecting",{transport:this.name,url:i}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(i){return this.state==="open"?(_e.defer(()=>{this.socket&&this.socket.send(i)}),!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(i){this.emit("error",{type:"WebSocketError",error:i}),this.timeline.error(this.buildTimelineMessage({error:i.toString()}))}onClose(i){i?this.changeState("closed",{code:i.code,reason:i.reason,wasClean:i.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(i){this.emit("message",i)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=i=>{this.onError(i)},this.socket.onclose=i=>{this.onClose(i)},this.socket.onmessage=i=>{this.onMessage(i)},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(i,a){this.state=i,this.timeline.info(this.buildTimelineMessage({state:i,params:a})),this.emit(i,a)}buildTimelineMessage(i){return Ce({cid:this.id},i)}}class ce{constructor(i){this.hooks=i}isSupported(i){return this.hooks.isSupported(i)}createConnection(i,a,f,g){return new Oi(this.hooks,i,a,f,g)}}var Vt=new ce({urls:$i,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!q.getWebSocketAPI()},isSupported:function(){return!!q.getWebSocketAPI()},getSocket:function(l){return q.createWebSocket(l)}}),So={urls:Bn,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Sr=Ce({getSocket:function(l){return q.HTTPFactory.createStreamingSocket(l)}},So),Gn=Ce({getSocket:function(l){return q.HTTPFactory.createPollingSocket(l)}},So),Tr={isSupported:function(){return q.isXHRSupported()}},To=new ce(Ce({},Sr,Tr)),Di=new ce(Ce({},Gn,Tr)),at={ws:Vt,xhr_streaming:To,xhr_polling:Di};const ct=at;var Eo=new ce({file:"sockjs",urls:Wn,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(l,i){return new window.SockJS(l,null,{js_path:P.getPath("sockjs",{useTLS:i.useTLS}),ignore_null_origin:i.ignoreNullOrigin})},beforeOpen:function(l,i){l.send(JSON.stringify({path:i}))}}),Er={isSupported:function(l){var i=q.isXDRSupported(l.useTLS);return i}},Ar=new ce(Ce({},Sr,Er)),Ao=new ce(Ce({},Gn,Er));ct.xdr_streaming=Ar,ct.xdr_polling=Ao,ct.sockjs=Eo;const mt=ct;class Co extends gt{constructor(){super();var i=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){i.emit("online")},!1),window.addEventListener("offline",function(){i.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Po=new Co;class Ro{constructor(i,a,f){this.manager=i,this.transport=a,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(i,a,f,g){g=Ce({},g,{activityTimeout:this.pingDelay});var y=this.transport.createConnection(i,a,f,g),E=null,$=function(){y.unbind("open",$),y.bind("closed",Z),E=_e.now()},Z=X=>{if(y.unbind("closed",Z),X.code===1002||X.code===1003)this.manager.reportDeath();else if(!X.wasClean&&E){var ee=_e.now()-E;ee<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(ee/2,this.minPingDelay))}};return y.bind("open",$),y}isSupported(i){return this.manager.isAlive()&&this.transport.isSupported(i)}}const Cr={decodeMessage:function(l){try{var i=JSON.parse(l.data),a=i.data;if(typeof a=="string")try{a=JSON.parse(i.data)}catch{}var f={event:i.event,channel:i.channel,data:a};return i.user_id&&(f.user_id=i.user_id),f}catch(g){throw{type:"MessageParseError",error:g,data:l.data}}},encodeMessage:function(l){return JSON.stringify(l)},processHandshake:function(l){var i=Cr.decodeMessage(l);if(i.event==="pusher:connection_established"){if(!i.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:i.data.socket_id,activityTimeout:i.data.activity_timeout*1e3}}else{if(i.event==="pusher:error")return{action:this.getCloseAction(i.data),error:this.getCloseError(i.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}},Nt=Cr;class D extends gt{constructor(i,a){super(),this.id=i,this.transport=a,this.activityTimeout=a.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(i){return this.transport.send(i)}send_event(i,a,f){var g={event:i,data:a};return f&&(g.channel=f),ae.debug("Event sent",g),this.send(Nt.encodeMessage(g))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var i={message:f=>{var g;try{g=Nt.decodeMessage(f)}catch(y){this.emit("error",{type:"MessageParseError",error:y,data:f.data})}if(g!==void 0){switch(ae.debug("Event recd",g),g.event){case"pusher:error":this.emit("error",{type:"PusherError",data:g.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",g)}},activity:()=>{this.emit("activity")},error:f=>{this.emit("error",f)},closed:f=>{a(),f&&f.code&&this.handleCloseEvent(f),this.transport=null,this.emit("closed")}},a=()=>{De(i,(f,g)=>{this.transport.unbind(g,f)})};De(i,(f,g)=>{this.transport.bind(g,f)})}handleCloseEvent(i){var a=Nt.getCloseAction(i),f=Nt.getCloseError(i);f&&this.emit("error",f),a&&this.emit(a,{action:a,error:f})}}class b{constructor(i,a){this.transport=i,this.callback=a,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=i=>{this.unbindListeners();var a;try{a=Nt.processHandshake(i)}catch(f){this.finish("error",{error:f}),this.transport.close();return}a.action==="connected"?this.finish("connected",{connection:new D(a.id,this.transport),activityTimeout:a.activityTimeout}):(this.finish(a.action,{error:a.error}),this.transport.close())},this.onClosed=i=>{this.unbindListeners();var a=Nt.getCloseAction(i)||"backoff",f=Nt.getCloseError(i);this.finish(a,{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(i,a){this.callback(Ce({transport:this.transport,action:i},a))}}class T{constructor(i,a){this.timeline=i,this.options=a||{}}send(i,a){this.timeline.isEmpty()||this.timeline.send(q.TimelineTransport.getAgent(this,i),a)}}class z extends gt{constructor(i,a){super(function(f,g){ae.debug("No callbacks on "+i+" for "+f)}),this.name=i,this.pusher=a,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(i,a){return a(null,{auth:""})}trigger(i,a){if(i.indexOf("client-")!==0)throw new S("Event '"+i+"' does not start with 'client-'");if(!this.subscribed){var f=R.buildLogSuffix("triggeringClientEvents");ae.warn(`Client event triggered before channel 'subscription_succeeded' event . ${f}`)}return this.pusher.send_event(i,a,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(i){var a=i.event,f=i.data;if(a==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(i);else if(a==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(i);else if(a.indexOf("pusher_internal:")!==0){var g={};this.emit(a,f,g)}}handleSubscriptionSucceededEvent(i){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",i.data)}handleSubscriptionCountEvent(i){i.data.subscription_count&&(this.subscriptionCount=i.data.subscription_count),this.emit("pusher:subscription_count",i.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(i,a)=>{i?(this.subscriptionPending=!1,ae.error(i.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:i.message},i instanceof me?{status:i.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:a.auth,channel_data:a.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 oe extends z{authorize(i,a){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:i},a)}}class Pe{constructor(){this.reset()}get(i){return Object.prototype.hasOwnProperty.call(this.members,i)?{id:i,info:this.members[i]}:null}each(i){De(this.members,(a,f)=>{i(this.get(f))})}setMyID(i){this.myID=i}onSubscription(i){this.members=i.presence.hash,this.count=i.presence.count,this.me=this.get(this.myID)}addMember(i){return this.get(i.user_id)===null&&this.count++,this.members[i.user_id]=i.user_info,this.get(i.user_id)}removeMember(i){var a=this.get(i.user_id);return a&&(delete this.members[i.user_id],this.count--),a}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var ve=function(l,i,a,f){function g(y){return y instanceof a?y:new a(function(E){E(y)})}return new(a||(a=Promise))(function(y,E){function $(ee){try{X(f.next(ee))}catch(Se){E(Se)}}function Z(ee){try{X(f.throw(ee))}catch(Se){E(Se)}}function X(ee){ee.done?y(ee.value):g(ee.value).then($,Z)}X((f=f.apply(l,i||[])).next())})};class Me extends oe{constructor(i,a){super(i,a),this.members=new Pe}authorize(i,a){super.authorize(i,(f,g)=>ve(this,void 0,void 0,function*(){if(!f)if(g=g,g.channel_data!=null){var y=JSON.parse(g.channel_data);this.members.setMyID(y.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 E=R.buildLogSuffix("authorizationEndpoint");ae.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${E}, or the user should be signed in.`),a("Invalid auth response");return}a(f,g)}))}handleEvent(i){var a=i.event;if(a.indexOf("pusher_internal:")===0)this.handleInternalEvent(i);else{var f=i.data,g={};i.user_id&&(g.user_id=i.user_id),this.emit(a,f,g)}}handleInternalEvent(i){var a=i.event,f=i.data;switch(a){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(i);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(i);break;case"pusher_internal:member_added":var g=this.members.addMember(f);this.emit("pusher:member_added",g);break;case"pusher_internal:member_removed":var y=this.members.removeMember(f);y&&this.emit("pusher:member_removed",y);break}}handleSubscriptionSucceededEvent(i){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(i.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var bt=d(978),Tt=d(594);class Pr extends oe{constructor(i,a,f){super(i,a),this.key=null,this.nacl=f}authorize(i,a){super.authorize(i,(f,g)=>{if(f){a(f,g);return}let y=g.shared_secret;if(!y){a(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,Tt.decode)(y),delete g.shared_secret,a(null,g)})}trigger(i,a){throw new ze("Client events are not currently supported for encrypted channels")}handleEvent(i){var a=i.event,f=i.data;if(a.indexOf("pusher_internal:")===0||a.indexOf("pusher:")===0){super.handleEvent(i);return}this.handleEncryptedEvent(a,f)}handleEncryptedEvent(i,a){if(!this.key){ae.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!a.ciphertext||!a.nonce){ae.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+a);return}let f=(0,Tt.decode)(a.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){ae.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let g=(0,Tt.decode)(a.nonce);if(g.length<this.nacl.secretbox.nonceLength){ae.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${g.length}`);return}let y=this.nacl.secretbox.open(f,g,this.key);if(y===null){ae.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,(E,$)=>{if(E){ae.error(`Failed to make a request to the authEndpoint: ${$}. Unable to fetch new key, so dropping encrypted event`);return}if(y=this.nacl.secretbox.open(f,g,this.key),y===null){ae.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(i,this.getDataToEmit(y))});return}this.emit(i,this.getDataToEmit(y))}getDataToEmit(i){let a=(0,bt.D4)(i);try{return JSON.parse(a)}catch{return a}}}class Ee extends gt{constructor(i,a){super(),this.state="initialized",this.connection=null,this.key=i,this.options=a,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=q.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(i){this.key=i,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(i){return this.connection?this.connection.send(i):!1}send_event(i,a,f){return this.connection?this.connection.send_event(i,a,f):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var i=(a,f)=>{a?this.runner=this.strategy.connect(0,i):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,i)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var i=this.abandonConnection();i.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(i){this.timeline.info({action:"retry",delay:i}),i>0&&this.emit("connecting_in",Math.round(i/1e3)),this.retryTimer=new Be(i||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new Be(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new Be(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 Be(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(i){return Ce({},i,{message:a=>{this.resetActivityCheck(),this.emit("message",a)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:a=>{this.emit("error",a)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(i){return Ce({},i,{connected:a=>{this.activityTimeout=Math.min(this.options.activityTimeout,a.activityTimeout,a.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(a.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let i=a=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),a(f)};return{tls_only:i(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:i(()=>{this.disconnect()}),backoff:i(()=>{this.retryIn(1e3)}),retry:i(()=>{this.retryIn(0)})}}setConnection(i){this.connection=i;for(var a in this.connectionCallbacks)this.connection.bind(a,this.connectionCallbacks[a]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var i in this.connectionCallbacks)this.connection.unbind(i,this.connectionCallbacks[i]);var a=this.connection;return this.connection=null,a}}updateState(i,a){var f=this.state;if(this.state=i,f!==i){var g=i;g==="connected"&&(g+=" with new socket ID "+a.socket_id),ae.debug("State changed",f+" -> "+g),this.timeline.info({state:i,params:a}),this.emit("state_change",{previous:f,current:i}),this.emit(i,a)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class zo{constructor(){this.channels={}}add(i,a){return this.channels[i]||(this.channels[i]=Lo(i,a)),this.channels[i]}all(){return Lt(this.channels)}find(i){return this.channels[i]}remove(i){var a=this.channels[i];return delete this.channels[i],a}disconnect(){De(this.channels,function(i){i.disconnect()})}}function Lo(l,i){if(l.indexOf("private-encrypted-")===0){if(i.config.nacl)return Ot.createEncryptedChannel(l,i,i.config.nacl);let a="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=R.buildLogSuffix("encryptedChannelSupport");throw new ze(`${a}. ${f}`)}else{if(l.indexOf("private-")===0)return Ot.createPrivateChannel(l,i);if(l.indexOf("presence-")===0)return Ot.createPresenceChannel(l,i);if(l.indexOf("#")===0)throw new C('Cannot create a channel with name "'+l+'".');return Ot.createChannel(l,i)}}var Dm={createChannels(){return new zo},createConnectionManager(l,i){return new Ee(l,i)},createChannel(l,i){return new z(l,i)},createPrivateChannel(l,i){return new oe(l,i)},createPresenceChannel(l,i){return new Me(l,i)},createEncryptedChannel(l,i,a){return new Pr(l,i,a)},createTimelineSender(l,i){return new T(l,i)},createHandshake(l,i){return new b(l,i)},createAssistantToTheTransportManager(l,i,a){return new Ro(l,i,a)}};const Ot=Dm;class Ec{constructor(i){this.options=i||{},this.livesLeft=this.options.lives||1/0}getAssistant(i){return Ot.createAssistantToTheTransportManager(this,i,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class kn{constructor(i,a){this.strategies=i,this.loop=!!a.loop,this.failFast=!!a.failFast,this.timeout=a.timeout,this.timeoutLimit=a.timeoutLimit}isSupported(){return vr(this.strategies,_e.method("isSupported"))}connect(i,a){var f=this.strategies,g=0,y=this.timeout,E=null,$=(Z,X)=>{X?a(null,X):(g=g+1,this.loop&&(g=g%f.length),g<f.length?(y&&(y=y*2,this.timeoutLimit&&(y=Math.min(y,this.timeoutLimit))),E=this.tryStrategy(f[g],i,{timeout:y,failFast:this.failFast},$)):a(!0))};return E=this.tryStrategy(f[g],i,{timeout:y,failFast:this.failFast},$),{abort:function(){E.abort()},forceMinPriority:function(Z){i=Z,E&&E.forceMinPriority(Z)}}}tryStrategy(i,a,f,g){var y=null,E=null;return f.timeout>0&&(y=new Be(f.timeout,function(){E.abort(),g(!0)})),E=i.connect(a,function($,Z){$&&y&&y.isRunning()&&!f.failFast||(y&&y.ensureAborted(),g($,Z))}),{abort:function(){y&&y.ensureAborted(),E.abort()},forceMinPriority:function($){E.forceMinPriority($)}}}}class Mi{constructor(i){this.strategies=i}isSupported(){return vr(this.strategies,_e.method("isSupported"))}connect(i,a){return Mm(this.strategies,i,function(f,g){return function(y,E){if(g[f].error=y,y){Um(g)&&a(!0);return}It(g,function($){$.forceMinPriority(E.transport.priority)}),a(null,E)}})}}function Mm(l,i,a){var f=qn(l,function(g,y,E,$){return g.connect(i,a(y,$))});return{abort:function(){It(f,jm)},forceMinPriority:function(g){It(f,function(y){y.forceMinPriority(g)})}}}function Um(l){return Ii(l,function(i){return!!i.error})}function jm(l){!l.error&&!l.aborted&&(l.abort(),l.aborted=!0)}class Zm{constructor(i,a,f){this.strategy=i,this.transports=a,this.ttl=f.ttl||18e5,this.usingTLS=f.useTLS,this.timeline=f.timeline}isSupported(){return this.strategy.isSupported()}connect(i,a){var f=this.usingTLS,g=qm(f),y=g&&g.cacheSkipCount?g.cacheSkipCount:0,E=[this.strategy];if(g&&g.timestamp+this.ttl>=_e.now()){var $=this.transports[g.transport];$&&(["ws","wss"].includes(g.transport)||y>3?(this.timeline.info({cached:!0,transport:g.transport,latency:g.latency}),E.push(new kn([$],{timeout:g.latency*2+1e3,failFast:!0}))):y++)}var Z=_e.now(),X=E.pop().connect(i,function ee(Se,Oo){Se?(Ac(f),E.length>0?(Z=_e.now(),X=E.pop().connect(i,ee)):a(Se)):(Fm(f,Oo.transport.name,_e.now()-Z,y),a(null,Oo))});return{abort:function(){X.abort()},forceMinPriority:function(ee){i=ee,X&&X.forceMinPriority(ee)}}}}function Ui(l){return"pusherTransport"+(l?"TLS":"NonTLS")}function qm(l){var i=q.getLocalStorage();if(i)try{var a=i[Ui(l)];if(a)return JSON.parse(a)}catch{Ac(l)}return null}function Fm(l,i,a,f){var g=q.getLocalStorage();if(g)try{g[Ui(l)]=Ge({timestamp:_e.now(),transport:i,latency:a,cacheSkipCount:f})}catch{}}function Ac(l){var i=q.getLocalStorage();if(i)try{delete i[Ui(l)]}catch{}}class Io{constructor(i,{delay:a}){this.strategy=i,this.options={delay:a}}isSupported(){return this.strategy.isSupported()}connect(i,a){var f=this.strategy,g,y=new Be(this.options.delay,function(){g=f.connect(i,a)});return{abort:function(){y.ensureAborted(),g&&g.abort()},forceMinPriority:function(E){i=E,g&&g.forceMinPriority(E)}}}}class Rr{constructor(i,a,f){this.test=i,this.trueBranch=a,this.falseBranch=f}isSupported(){var i=this.test()?this.trueBranch:this.falseBranch;return i.isSupported()}connect(i,a){var f=this.test()?this.trueBranch:this.falseBranch;return f.connect(i,a)}}class Hm{constructor(i){this.strategy=i}isSupported(){return this.strategy.isSupported()}connect(i,a){var f=this.strategy.connect(i,function(g,y){y&&f.abort(),a(g,y)});return f}}function zr(l){return function(){return l.isSupported()}}var Bm=function(l,i,a){var f={};function g(jc,qb,Fb,Hb,Bb){var Zc=a(l,jc,qb,Fb,Hb,Bb);return f[jc]=Zc,Zc}var y=Object.assign({},i,{hostNonTLS:l.wsHost+":"+l.wsPort,hostTLS:l.wsHost+":"+l.wssPort,httpPath:l.wsPath}),E=Object.assign({},y,{useTLS:!0}),$=Object.assign({},i,{hostNonTLS:l.httpHost+":"+l.httpPort,hostTLS:l.httpHost+":"+l.httpsPort,httpPath:l.httpPath}),Z={loop:!0,timeout:15e3,timeoutLimit:6e4},X=new Ec({minPingDelay:1e4,maxPingDelay:l.activityTimeout}),ee=new Ec({lives:2,minPingDelay:1e4,maxPingDelay:l.activityTimeout}),Se=g("ws","ws",3,y,X),Oo=g("wss","ws",3,E,X),Db=g("sockjs","sockjs",1,$),$c=g("xhr_streaming","xhr_streaming",1,$,ee),Mb=g("xdr_streaming","xdr_streaming",1,$,ee),Nc=g("xhr_polling","xhr_polling",1,$),Ub=g("xdr_polling","xdr_polling",1,$),Oc=new kn([Se],Z),jb=new kn([Oo],Z),Zb=new kn([Db],Z),Dc=new kn([new Rr(zr($c),$c,Mb)],Z),Mc=new kn([new Rr(zr(Nc),Nc,Ub)],Z),Uc=new kn([new Rr(zr(Dc),new Mi([Dc,new Io(Mc,{delay:4e3})]),Mc)],Z),qi=new Rr(zr(Uc),Uc,Zb),Fi;return i.useTLS?Fi=new Mi([Oc,new Io(qi,{delay:2e3})]):Fi=new Mi([Oc,new Io(jb,{delay:2e3}),new Io(qi,{delay:5e3})]),new Zm(new Hm(new Rr(zr(Se),Fi,qi)),f,{ttl:18e5,timeline:i.timeline,useTLS:i.useTLS})};const Wm=Bm;function Gm(){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"),P.load(l.hooks.file,{useTLS:l.options.useTLS},function(i,a){l.hooks.isInitialized()?(l.changeState("initialized"),a(!0)):(i&&l.onError(i),l.onClose(),a(!1))})):l.onClose()}var Jm={getRequest:function(l){var i=new window.XDomainRequest;return i.ontimeout=function(){l.emit("error",new M),l.close()},i.onerror=function(a){l.emit("error",a),l.close()},i.onprogress=function(){i.responseText&&i.responseText.length>0&&l.onChunk(200,i.responseText)},i.onload=function(){i.responseText&&i.responseText.length>0&&l.onChunk(200,i.responseText),l.emit("finished",200),l.close()},i},abortRequest:function(l){l.ontimeout=l.onerror=l.onprogress=l.onload=null,l.abort()}};const Xm=Jm,Vm=256*1024;class Ym extends gt{constructor(i,a,f){super(),this.hooks=i,this.method=a,this.url=f}start(i){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},q.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(i)}close(){this.unloader&&(q.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(i,a){for(;;){var f=this.advanceBuffer(a);if(f)this.emit("chunk",{status:i,data:f});else break}this.isBufferTooLong(a)&&this.emit("buffer_too_long")}advanceBuffer(i){var a=i.slice(this.position),f=a.indexOf(`
1231
- `);return f!==-1?(this.position+=f+1,a.slice(0,f)):null}isBufferTooLong(i){return this.position===i.length&&i.length>Vm}}var ji;(function(l){l[l.CONNECTING=0]="CONNECTING",l[l.OPEN=1]="OPEN",l[l.CLOSED=3]="CLOSED"})(ji||(ji={}));const _n=ji;var Km=1;class Qm{constructor(i,a){this.hooks=i,this.session=Pc(1e3)+"/"+rb(8),this.location=eb(a),this.readyState=_n.CONNECTING,this.openStream()}send(i){return this.sendRaw(JSON.stringify([i]))}ping(){this.hooks.sendHeartbeat(this)}close(i,a){this.onClose(i,a,!0)}sendRaw(i){if(this.readyState===_n.OPEN)try{return q.createSocketRequest("POST",Cc(tb(this.location,this.session))).start(i),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(i,a,f){this.closeStream(),this.readyState=_n.CLOSED,this.onclose&&this.onclose({code:i,reason:a,wasClean:f})}onChunk(i){if(i.status===200){this.readyState===_n.OPEN&&this.onActivity();var a,f=i.data.slice(0,1);switch(f){case"o":a=JSON.parse(i.data.slice(1)||"{}"),this.onOpen(a);break;case"a":a=JSON.parse(i.data.slice(1)||"[]");for(var g=0;g<a.length;g++)this.onEvent(a[g]);break;case"m":a=JSON.parse(i.data.slice(1)||"null"),this.onEvent(a);break;case"h":this.hooks.onHeartbeat(this);break;case"c":a=JSON.parse(i.data.slice(1)||"[]"),this.onClose(a[0],a[1],!0);break}}}onOpen(i){this.readyState===_n.CONNECTING?(i&&i.hostname&&(this.location.base=nb(this.location.base,i.hostname)),this.readyState=_n.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(i){this.readyState===_n.OPEN&&this.onmessage&&this.onmessage({data:i})}onActivity(){this.onactivity&&this.onactivity()}onError(i){this.onerror&&this.onerror(i)}openStream(){this.stream=q.createSocketRequest("POST",Cc(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",i=>{this.onChunk(i)}),this.stream.bind("finished",i=>{this.hooks.onFinished(this,i)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(i){_e.defer(()=>{this.onError(i),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function eb(l){var i=/([^\?]*)\/*(\??.*)/.exec(l);return{base:i[1],queryString:i[2]}}function tb(l,i){return l.base+"/"+i+"/xhr_send"}function Cc(l){var i=l.indexOf("?")===-1?"?":"&";return l+i+"t="+ +new Date+"&n="+Km++}function nb(l,i){var a=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(l);return a[1]+i+a[3]}function Pc(l){return q.randomInt(l)}function rb(l){for(var i=[],a=0;a<l;a++)i.push(Pc(32).toString(32));return i.join("")}const ob=Qm;var ib={getReceiveURL:function(l,i){return l.base+"/"+i+"/xhr_streaming"+l.queryString},onHeartbeat:function(l){l.sendRaw("[]")},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,i){l.onClose(1006,"Connection interrupted ("+i+")",!1)}};const sb=ib;var ab={getReceiveURL:function(l,i){return l.base+"/"+i+"/xhr"+l.queryString},onHeartbeat:function(){},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,i){i===200?l.reconnect():l.onClose(1006,"Connection interrupted ("+i+")",!1)}};const cb=ab;var lb={getRequest:function(l){var i=q.getXHRAPI(),a=new i;return a.onreadystatechange=a.onprogress=function(){switch(a.readyState){case 3:a.responseText&&a.responseText.length>0&&l.onChunk(a.status,a.responseText);break;case 4:a.responseText&&a.responseText.length>0&&l.onChunk(a.status,a.responseText),l.emit("finished",a.status),l.close();break}},a},abortRequest:function(l){l.onreadystatechange=null,l.abort()}};const ub=lb;var db={createStreamingSocket(l){return this.createSocket(sb,l)},createPollingSocket(l){return this.createSocket(cb,l)},createSocket(l,i){return new ob(l,i)},createXHR(l,i){return this.createRequest(ub,l,i)},createRequest(l,i,a){return new Ym(l,i,a)}};const Rc=db;Rc.createXDR=function(l,i){return this.createRequest(Xm,l,i)};var pb={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:w,getDefaultStrategy:Wm,Transports:mt,transportConnectionInitializer:Gm,HTTPFactory:Rc,TimelineTransport:Xt,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(l){window.Pusher=l;var i=()=>{this.onDocumentBody(l.ready)};window.JSON?i():P.load("json2",{},i)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:Wt,jsonp:xr}},onDocumentBody(l){document.body?l():setTimeout(()=>{this.onDocumentBody(l)},0)},createJSONPRequest(l,i){return new Fn(l,i)},createScriptRequest(l){return new xo(l)},getLocalStorage(){try{return window.localStorage}catch{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 Po},createWebSocket(l){var i=this.getWebSocketAPI();return new i(l)},createSocketRequest(l,i){if(this.isXHRSupported())return this.HTTPFactory.createXHR(l,i);if(this.isXDRSupported(i.indexOf("https:")===0))return this.HTTPFactory.createXDR(l,i);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var l=this.getXHRAPI();return!!l&&new l().withCredentials!==void 0},isXDRSupported(l){var i=l?"https:":"http:",a=this.getProtocol();return!!window.XDomainRequest&&a===i},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 q=pb;var Zi;(function(l){l[l.ERROR=3]="ERROR",l[l.INFO=6]="INFO",l[l.DEBUG=7]="DEBUG"})(Zi||(Zi={}));const $o=Zi;class hb{constructor(i,a,f){this.key=i,this.session=a,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(i,a){i<=this.options.level&&(this.events.push(Ce({},a,{timestamp:_e.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(i){this.log($o.ERROR,i)}info(i){this.log($o.INFO,i)}debug(i){this.log($o.DEBUG,i)}isEmpty(){return this.events.length===0}send(i,a){var f=Ce({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=[],i(f,(g,y)=>{g||this.sent++,a&&a(g,y)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class fb{constructor(i,a,f,g){this.name=i,this.priority=a,this.transport=f,this.options=g||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(i,a){if(this.isSupported()){if(this.priority<i)return zc(new se,a)}else return zc(new K,a);var f=!1,g=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),y=null,E=function(){g.unbind("initialized",E),g.connect()},$=function(){y=Ot.createHandshake(g,function(Se){f=!0,ee(),a(null,Se)})},Z=function(Se){ee(),a(Se)},X=function(){ee();var Se;Se=Ge(g),a(new ke(Se))},ee=function(){g.unbind("initialized",E),g.unbind("open",$),g.unbind("error",Z),g.unbind("closed",X)};return g.bind("initialized",E),g.bind("open",$),g.bind("error",Z),g.bind("closed",X),g.initialize(),{abort:()=>{f||(ee(),y?y.close():g.close())},forceMinPriority:Se=>{f||this.priority<Se&&(y?y.close():g.close())}}}}function zc(l,i){return _e.defer(function(){i(l)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:gb}=q;var mb=function(l,i,a,f,g,y){var E=gb[a];if(!E)throw new Ye(a);var $=(!l.enabledTransports||_r(l.enabledTransports,i)!==-1)&&(!l.disabledTransports||_r(l.disabledTransports,i)===-1),Z;return $?(g=Object.assign({ignoreNullOrigin:l.ignoreNullOrigin},g),Z=new fb(i,f,y?y.getAssistant(E):E,g)):Z=bb,Z},bb={isSupported:function(){return!1},connect:function(l,i){var a=_e.defer(function(){i(new K)});return{abort:function(){a.ensureAborted()},forceMinPriority:function(){}}}};function kb(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&&ae.warn("The disableStats option is deprecated in favor of enableStats")}const _b=(l,i)=>{var a="socket_id="+encodeURIComponent(l.socketId);for(var f in i.params)a+="&"+encodeURIComponent(f)+"="+encodeURIComponent(i.params[f]);if(i.paramsProvider!=null){let g=i.paramsProvider();for(var f in g)a+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return a},vb=l=>{if(typeof q.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(i,a)=>{const f=_b(i,l);q.getAuthorizers()[l.transport](q,f,l,x.UserAuthentication,a)}},yb=(l,i)=>{var a="socket_id="+encodeURIComponent(l.socketId);a+="&channel_name="+encodeURIComponent(l.channelName);for(var f in i.params)a+="&"+encodeURIComponent(f)+"="+encodeURIComponent(i.params[f]);if(i.paramsProvider!=null){let g=i.paramsProvider();for(var f in g)a+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return a},wb=l=>{if(typeof q.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(i,a)=>{const f=yb(i,l);q.getAuthorizers()[l.transport](q,f,l,x.ChannelAuthorization,a)}},xb=(l,i,a)=>{const f={authTransport:i.transport,authEndpoint:i.endpoint,auth:{params:i.params,headers:i.headers}};return(g,y)=>{const E=l.channel(g.channelName);a(E,f).authorize(g.socketId,y)}};function Lc(l,i){let a={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:Cb(l),httpHost:Sb(l),useTLS:Ab(l),wsHost:Tb(l),userAuthenticator:Pb(l),channelAuthorizer:zb(l,i)};return"disabledTransports"in l&&(a.disabledTransports=l.disabledTransports),"enabledTransports"in l&&(a.enabledTransports=l.enabledTransports),"ignoreNullOrigin"in l&&(a.ignoreNullOrigin=l.ignoreNullOrigin),"timelineParams"in l&&(a.timelineParams=l.timelineParams),"nacl"in l&&(a.nacl=l.nacl),a}function Sb(l){return l.httpHost?l.httpHost:l.cluster?`sockjs-${l.cluster}.pusher.com`:m.httpHost}function Tb(l){return l.wsHost?l.wsHost:Eb(l.cluster)}function Eb(l){return`ws-${l}.pusher.com`}function Ab(l){return q.getProtocol()==="https:"?!0:l.forceTLS!==!1}function Cb(l){return"enableStats"in l?l.enableStats:"disableStats"in l?!l.disableStats:!1}const Ic=l=>"customHandler"in l&&l.customHandler!=null;function Pb(l){const i=Object.assign(Object.assign({},m.userAuthentication),l.userAuthentication);return Ic(i)?i.customHandler:vb(i)}function Rb(l,i){let a;if("channelAuthorization"in l)a=Object.assign(Object.assign({},m.channelAuthorization),l.channelAuthorization);else if(a={transport:l.authTransport||m.authTransport,endpoint:l.authEndpoint||m.authEndpoint},"auth"in l&&("params"in l.auth&&(a.params=l.auth.params),"headers"in l.auth&&(a.headers=l.auth.headers)),"authorizer"in l)return{customHandler:xb(i,a,l.authorizer)};return a}function zb(l,i){const a=Rb(l,i);return Ic(a)?a.customHandler:wb(a)}class Lb extends gt{constructor(i){super(function(a,f){ae.debug(`No callbacks on watchlist events for ${a}`)}),this.pusher=i,this.bindWatchlistInternalEvent()}handleEvent(i){i.data.events.forEach(a=>{this.emit(a.name,a)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",i=>{var a=i.event;a==="pusher_internal:watchlist_events"&&this.handleEvent(i)})}}function Ib(){let l,i;return{promise:new Promise((f,g)=>{l=f,i=g}),resolve:l,reject:i}}const $b=Ib;class Nb extends gt{constructor(i){super(function(a,f){ae.debug("No callbacks on user for "+a)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(a,f)=>{if(a){ae.warn(`Error during signin: ${a}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:f.auth,user_data:f.user_data})},this.pusher=i,this.pusher.connection.bind("state_change",({previous:a,current:f})=>{a!=="connected"&&f==="connected"&&this._signin(),a==="connected"&&f!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new Lb(i),this.pusher.connection.bind("message",a=>{var f=a.event;f==="pusher:signin_success"&&this._onSigninSuccess(a.data),this.serverToUserChannel&&this.serverToUserChannel.name===a.channel&&this.serverToUserChannel.handleEvent(a)})}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(i){try{this.user_data=JSON.parse(i.user_data)}catch{ae.error(`Failed parsing user data after signin: ${i.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){ae.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const i=a=>{a.subscriptionPending&&a.subscriptionCancelled?a.reinstateSubscription():!a.subscriptionPending&&this.pusher.connection.state==="connected"&&a.subscribe()};this.serverToUserChannel=new z(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((a,f)=>{a.indexOf("pusher_internal:")===0||a.indexOf("pusher:")===0||this.emit(a,f)}),i(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:i,resolve:a}=$b();i.done=!1;const f=()=>{i.done=!0};i.then(f).catch(f),this.signinDonePromise=i,this._signinDoneResolve=a}}class Ie{static ready(){Ie.isReady=!0;for(var i=0,a=Ie.instances.length;i<a;i++)Ie.instances[i].connect()}static getClientFeatures(){return pn(fn({ws:q.Transports.ws},function(i){return i.isSupported({})}))}constructor(i,a){Ob(i),kb(a),this.key=i,this.options=a,this.config=Lc(this.options,this),this.channels=Ot.createChannels(),this.global_emitter=new gt,this.sessionID=q.randomInt(1e9),this.timeline=new hb(this.key,this.sessionID,{cluster:this.config.cluster,features:Ie.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:$o.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=Ot.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+q.TimelineTransport.name}));var f=g=>q.getDefaultStrategy(this.config,g,mb);this.connection=Ot.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",g=>{var y=g.event,E=y.indexOf("pusher_internal:")===0;if(g.channel){var $=this.channel(g.channel);$&&$.handleEvent(g)}E||this.global_emitter.emit(g.event,g.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",g=>{ae.warn(g)}),Ie.instances.push(this),this.timeline.info({instances:Ie.instances.length}),this.user=new Nb(this),Ie.isReady&&this.connect()}switchCluster(i){const{appKey:a,cluster:f}=i;this.key=a,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=Lc(this.options,this),this.connection.switchCluster(this.key)}channel(i){return this.channels.find(i)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var i=this.connection.isUsingTLS(),a=this.timelineSender;this.timelineSenderTimer=new Qe(6e4,function(){a.send(i)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(i,a,f){return this.global_emitter.bind(i,a,f),this}unbind(i,a,f){return this.global_emitter.unbind(i,a,f),this}bind_global(i){return this.global_emitter.bind_global(i),this}unbind_global(i){return this.global_emitter.unbind_global(i),this}unbind_all(i){return this.global_emitter.unbind_all(),this}subscribeAll(){var i;for(i in this.channels.channels)this.channels.channels.hasOwnProperty(i)&&this.subscribe(i)}subscribe(i){var a=this.channels.add(i,this);return a.subscriptionPending&&a.subscriptionCancelled?a.reinstateSubscription():!a.subscriptionPending&&this.connection.state==="connected"&&a.subscribe(),a}unsubscribe(i){var a=this.channels.find(i);a&&a.subscriptionPending?a.cancelSubscription():(a=this.channels.remove(i),a&&a.subscribed&&a.unsubscribe())}send_event(i,a,f){return this.connection.send_event(i,a,f)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}Ie.instances=[],Ie.isReady=!1,Ie.logToConsole=!1,Ie.Runtime=q,Ie.ScriptReceivers=q.ScriptReceivers,Ie.DependenciesReceivers=q.DependenciesReceivers,Ie.auth_callbacks=q.auth_callbacks;const No=Ie;function Ob(l){if(l==null)throw"You must pass your app key when you instantiate Pusher."}q.setup(Ie)}},r={};function o(c){var u=r[c];if(u!==void 0)return u.exports;var d=r[c]={exports:{}};return n[c].call(d.exports,d,d.exports,o),d.exports}o.d=(c,u)=>{for(var d in u)o.o(u,d)&&!o.o(c,d)&&Object.defineProperty(c,d,{enumerable:!0,get:u[d]})},o.o=(c,u)=>Object.prototype.hasOwnProperty.call(c,u);var s=o(721);return s})())})(sa);var hf=sa.exports;const ff=pf(hf),Gr={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"};let lt=null,Pn=null;async function gf(e){return Pn||(Pn=(async()=>{const t=e.backendUrl.replace(/\/+$/,""),n=await fetch(`${t}/api/settings`,{headers:{Authorization:`Bearer ${e.token}`}});if(!n.ok)throw new Error(`Failed to fetch settings: HTTP ${n.status}`);const r=await n.json();lt=new ff(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:s},c)=>{fetch(`${t}/api/pusher/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({socket_id:o,channel_name:s})}).then(u=>u.json()).then(u=>c(null,u)).catch(u=>c(u instanceof Error?u:new Error(String(u)),null))}}})})(),Pn.catch(()=>{Pn=null}),Pn)}function mf(e){if(!e||!lt)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return lt.connection.bind("state_change",n),()=>lt==null?void 0:lt.connection.unbind("state_change",n)}async function bf(e,t,n){if(await gf(e),!lt)return()=>{};const r=lt.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(Gr.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(Gr.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(Gr.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(Gr.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=mf(n.onReconnect);return()=>{r.unbind_all(),lt==null||lt.unsubscribe(`private-task-${t}`),o==null||o()}}const Qo="ap-sdk-active-automation";function kf(){try{const e=sessionStorage.getItem(Qo);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{return null}}function aa(e){try{sessionStorage.setItem(Qo,JSON.stringify(e))}catch{}}function ca(){try{sessionStorage.removeItem(Qo)}catch{}}async function _f(e){var s;try{(s=e.focus)==null||s.call(e)}catch{}e.scrollIntoView({block:"center",inline:"center",behavior:"instant"});let t=e.getBoundingClientRect();t.width===0&&t.height===0&&(await vf(),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 vf(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const ei="shared",la="ap-sdk-panel-size:",ua=280,da=200;function yf(e){try{const t=sessionStorage.getItem(la+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{return null}}function wf(e,t){try{sessionStorage.setItem(la+e,JSON.stringify(t))}catch{}}function Jr(e,t,n){return Math.min(Math.max(e,t),n)}function pa(){return window.innerWidth-32}function ha(){return window.innerHeight-64}function ti(e,t){const n=yf(t);n&&(e.style.width=`${Jr(n.width,ua,pa())}px`,e.style.height=`${Jr(n.height,da,ha())}px`);const r=document.createElement("div");r.className="ap-sdk-resize-handle",r.setAttribute("data-ap-sdk","1"),e.appendChild(r);let o=!1,s=0,c=0,u=0,d=0,p=0,h=0;const k=_=>{o&&(p=Jr(u+(_.clientX-s),ua,pa()),h=Jr(d+(_.clientY-c),da,ha()),e.style.width=`${p}px`,e.style.height=`${h}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",m),wf(t,{width:p,height:h}))};r.addEventListener("pointerdown",_=>{_.preventDefault(),_.stopPropagation(),o=!0,s=_.clientX,c=_.clientY;const w=e.getBoundingClientRect();u=w.width,d=w.height,p=u,h=d,document.addEventListener("pointermove",k),document.addEventListener("pointerup",m)})}function ni(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var nn=ni();function fa(e){nn=e}var rn={exec:()=>null};function Rn(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 W(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(o,s)=>{let c=typeof s=="string"?s:s.source;return c=c.replace(Ne.caret,"$1"),n=n.replace(o,c),r},getRegex:()=>new RegExp(n,t)};return r}var xf=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),Ne={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:Rn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Rn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Rn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Rn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Rn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Rn(e=>new RegExp(`^ {0,${e}}>`))},Sf=/^(?:[ \t]*(?:\n|$))+/,Tf=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ef=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Qn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Af=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ri=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ga=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ma=W(ga).replace(/bull/g,ri).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(),Cf=W(ga).replace(/bull/g,ri).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(),oi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Pf=/^[^\n]+/,ii=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Rf=W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ii).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),zf=W(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ri).getRegex(),Xr="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",si=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Lf=W("^ {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",si).replace("tag",Xr).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ba=e=>W(oi).replace("hr",Qn).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",Xr).getRegex(),If=ba(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),$f=ba(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Nf=W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",$f).getRegex(),ai={blockquote:Nf,code:Tf,def:Rf,fences:Ef,heading:Af,hr:Qn,html:Lf,lheading:ma,list:zf,newline:Sf,paragraph:If,table:rn,text:Pf},ka=W("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Qn).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",Xr).getRegex(),Of={...ai,lheading:Cf,table:ka,paragraph:W(oi).replace("hr",Qn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ka).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",Xr).getRegex()},Df={...ai,html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",si).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:rn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(oi).replace("hr",Qn).replace("heading",` *#{1,6} *[^
1232
- ]`).replace("lheading",ma).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Mf=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Uf=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,_a=/^( {2,}|\\)\n(?!\s*$)/,jf=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,At=/[\p{P}\p{S}]/u,zn=/[\s\p{P}\p{S}]/u,er=/[^\s\p{P}\p{S}]/u,Zf=W(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,zn).getRegex(),qf=/[\p{Pi}\p{Ps}"']/u,va=/(?!~)[\p{P}\p{S}]/u,Ff=/(?!~)[\s\p{P}\p{S}]/u,Hf=/(?:[^\s\p{P}\p{S}]|~)/u,Bf=W(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",xf?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ya=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Wf=W(ya,"u").replace(/punct/g,At).getRegex(),Gf=W(ya,"u").replace(/punct/g,va).getRegex(),Jf=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Xf=W(Jf,"u").replace(/openQuote/g,qf).replace(/punct/g,At).getRegex(),wa="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Vf=W(wa,"gu").replace(/notPunctSpace/g,er).replace(/punctSpace/g,zn).replace(/punct/g,At).getRegex(),Yf=W(wa,"gu").replace(/notPunctSpace/g,Hf).replace(/punctSpace/g,Ff).replace(/punct/g,va).getRegex(),Kf="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Qf=W(Kf,"gu").replace(/notPunctSpace/g,er).replace(/punctSpace/g,zn).replace(/punct/g,At).getRegex(),eg=W("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,er).replace(/punctSpace/g,zn).replace(/punct/g,At).getRegex(),tg="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",ng=W(tg,"gu").replace(/notPunctSpace/g,er).replace(/punctSpace/g,zn).replace(/punct/g,At).getRegex(),rg=W(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,At).getRegex(),og="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",ig=W(og,"gu").replace(/notPunctSpace/g,er).replace(/punctSpace/g,zn).replace(/punct/g,At).getRegex(),sg=W(/\\(punct)/,"gu").replace(/punct/g,At).getRegex(),ag=W(/^<(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(),cg=W(si).replace("(?:-->|$)","-->").getRegex(),lg=W("^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",cg).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Vr=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ug=W(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Vr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),xa=W(/^!?\[(label)\]\[(ref)\]/).replace("label",Vr).replace("ref",ii).getRegex(),Sa=W(/^!?\[(ref)\](?:\[\])?/).replace("ref",ii).getRegex(),dg=W("reflink|nolink(?!\\()","g").replace("reflink",xa).replace("nolink",Sa).getRegex(),Ta=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ci={_backpedal:rn,anyPunctuation:sg,autolink:ag,blockSkip:Bf,br:_a,code:Uf,del:rn,delLDelim:rn,delRDelim:rn,emStrongLDelim:Wf,emStrongRDelimAst:Vf,emStrongRDelimUnd:eg,escape:Mf,link:ug,nolink:Sa,punctuation:Zf,reflink:xa,reflinkSearch:dg,tag:lg,text:jf,url:rn},pg={...ci,emStrongLDelim:Xf,emStrongRDelimAst:Qf,emStrongRDelimUnd:ng,link:W(/^!?\[(label)\]\((.*?)\)/).replace("label",Vr).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Vr).getRegex()},li={...ci,emStrongRDelimAst:Yf,emStrongLDelim:Gf,delLDelim:rg,delRDelim:ig,url:W(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ta).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:W(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ta).getRegex()},hg={...li,br:W(_a).replace("{2,}","*").getRegex(),text:W(li.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Yr={normal:ai,gfm:Of,pedantic:Df},tr={normal:ci,gfm:li,breaks:hg,pedantic:pg},fg={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Ea=e=>fg[e];function yt(e,t){if(t){if(Ne.escapeTest.test(e))return e.replace(Ne.escapeReplace,Ea)}else if(Ne.escapeTestNoEncode.test(e))return e.replace(Ne.escapeReplaceNoEncode,Ea);return e}function Aa(e){try{e=encodeURI(e).replace(Ne.percentDecode,"%")}catch{return null}return e}function Ca(e,t){var s;let n=e.replace(Ne.findPipe,(c,u,d)=>{let p=!1,h=u;for(;--h>=0&&d[h]==="\\";)p=!p;return p?"|":" |"}),r=n.split(Ne.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!((s=r.at(-1))!=null&&s.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(Ne.slashPipe,"|");return r}function qt(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 Pa(e){let t=e.split(`
1233
- `),n=t.length-1;for(;n>=0&&Ne.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
1234
- `)}function gg(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 mg(e,t=0){let n=t,r="";for(let o of e)if(o===" "){let s=4-n%4;r+=" ".repeat(s),n+=s}else r+=o,n++;return r}function Ra(e,t,n,r,o){let s=t.href,c=t.title||null,u=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let d={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:c,text:u,tokens:r.inlineTokens(u)};return r.state.inLink=!1,d}function bg(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
1374
+ */(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(c,u){var d=this&&this.__extends||function(){var R=function(x,S){return R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,M){C.__proto__=M}||function(C,M){for(var se in M)M.hasOwnProperty(se)&&(C[se]=M[se])},R(x,S)};return function(x,S){R(x,S);function C(){this.constructor=x}x.prototype=S===null?Object.create(S):(C.prototype=S.prototype,new C)}}();Object.defineProperty(u,"__esModule",{value:!0});var p=256,h=function(){function R(x){x===void 0&&(x="="),this._paddingCharacter=x}return R.prototype.encodedLength=function(x){return this._paddingCharacter?(x+2)/3*4|0:(x*8+5)/6|0},R.prototype.encode=function(x){for(var S="",C=0;C<x.length-2;C+=3){var M=x[C]<<16|x[C+1]<<8|x[C+2];S+=this._encodeByte(M>>>3*6&63),S+=this._encodeByte(M>>>2*6&63),S+=this._encodeByte(M>>>1*6&63),S+=this._encodeByte(M>>>0*6&63)}var se=x.length-C;if(se>0){var M=x[C]<<16|(se===2?x[C+1]<<8:0);S+=this._encodeByte(M>>>3*6&63),S+=this._encodeByte(M>>>2*6&63),se===2?S+=this._encodeByte(M>>>1*6&63):S+=this._paddingCharacter||"",S+=this._paddingCharacter||""}return S},R.prototype.maxDecodedLength=function(x){return this._paddingCharacter?x/4*3|0:(x*6+7)/8|0},R.prototype.decodedLength=function(x){return this.maxDecodedLength(x.length-this._getPaddingLength(x))},R.prototype.decode=function(x){if(x.length===0)return new Uint8Array(0);for(var S=this._getPaddingLength(x),C=x.length-S,M=new Uint8Array(this.maxDecodedLength(C)),se=0,ve=0,$e=0,et=0,Q=0,be=0,tt=0;ve<C-4;ve+=4)et=this._decodeChar(x.charCodeAt(ve+0)),Q=this._decodeChar(x.charCodeAt(ve+1)),be=this._decodeChar(x.charCodeAt(ve+2)),tt=this._decodeChar(x.charCodeAt(ve+3)),M[se++]=et<<2|Q>>>4,M[se++]=Q<<4|be>>>2,M[se++]=be<<6|tt,$e|=et&p,$e|=Q&p,$e|=be&p,$e|=tt&p;if(ve<C-1&&(et=this._decodeChar(x.charCodeAt(ve)),Q=this._decodeChar(x.charCodeAt(ve+1)),M[se++]=et<<2|Q>>>4,$e|=et&p,$e|=Q&p),ve<C-2&&(be=this._decodeChar(x.charCodeAt(ve+2)),M[se++]=Q<<4|be>>>2,$e|=be&p),ve<C-3&&(tt=this._decodeChar(x.charCodeAt(ve+3)),M[se++]=be<<6|tt,$e|=tt&p),$e!==0)throw new Error("Base64Coder: incorrect characters for decoding");return M},R.prototype._encodeByte=function(x){var S=x;return S+=65,S+=25-x>>>8&6,S+=51-x>>>8&-75,S+=61-x>>>8&-15,S+=62-x>>>8&3,String.fromCharCode(S)},R.prototype._decodeChar=function(x){var S=p;return S+=(42-x&x-44)>>>8&-p+x-43+62,S+=(46-x&x-48)>>>8&-p+x-47+63,S+=(47-x&x-58)>>>8&-p+x-48+52,S+=(64-x&x-91)>>>8&-p+x-65+0,S+=(96-x&x-123)>>>8&-p+x-97+26,S},R.prototype._getPaddingLength=function(x){var S=0;if(this._paddingCharacter){for(var C=x.length-1;C>=0&&x[C]===this._paddingCharacter;C--)S++;if(x.length<4||S>2)throw new Error("Base64Coder: incorrect padding")}return S},R}();u.Coder=h;var b=new h;function m(R){return b.encode(R)}u.encode=m;function _(R){return b.decode(R)}u.decode=_;var w=function(R){d(x,R);function x(){return R!==null&&R.apply(this,arguments)||this}return x.prototype._encodeByte=function(S){var C=S;return C+=65,C+=25-S>>>8&6,C+=51-S>>>8&-75,C+=61-S>>>8&-13,C+=62-S>>>8&49,String.fromCharCode(C)},x.prototype._decodeChar=function(S){var C=p;return C+=(44-S&S-46)>>>8&-p+S-45+62,C+=(94-S&S-96)>>>8&-p+S-95+63,C+=(47-S&S-58)>>>8&-p+S-48+52,C+=(64-S&S-91)>>>8&-p+S-65+0,C+=(96-S&S-123)>>>8&-p+S-97+26,C},x}(h);u.URLSafeCoder=w;var P=new w;function N(R){return P.encode(R)}u.encodeURLSafe=N;function re(R){return P.decode(R)}u.decodeURLSafe=re,u.encodedLength=function(R){return b.encodedLength(R)},u.maxDecodedLength=function(R){return b.maxDecodedLength(R)},u.decodedLength=function(R){return b.decodedLength(R)}},978(c,u){var d="utf8: invalid source encoding";function p(h){for(var b=[],m=0;m<h.length;m++){var _=h[m];if(_&128){var w=void 0;if(_<224){if(m>=h.length)throw new Error(d);var P=h[++m];if((P&192)!==128)throw new Error(d);_=(_&31)<<6|P&63,w=128}else if(_<240){if(m>=h.length-1)throw new Error(d);var P=h[++m],N=h[++m];if((P&192)!==128||(N&192)!==128)throw new Error(d);_=(_&15)<<12|(P&63)<<6|N&63,w=2048}else if(_<248){if(m>=h.length-2)throw new Error(d);var P=h[++m],N=h[++m],re=h[++m];if((P&192)!==128||(N&192)!==128||(re&192)!==128)throw new Error(d);_=(_&15)<<18|(P&63)<<12|(N&63)<<6|re&63,w=65536}else throw new Error(d);if(_<w||_>=55296&&_<=57343)throw new Error(d);if(_>=65536){if(_>1114111)throw new Error(d);_-=65536,b.push(String.fromCharCode(55296|_>>10)),_=56320|_&1023}}b.push(String.fromCharCode(_))}return b.join("")}u.D4=p},721(c,u,d){c.exports=d(207).default},207(c,u,d){d.d(u,{default:()=>ei});class p{constructor(i,a){this.lastId=0,this.prefix=i,this.name=a}create(i){this.lastId++;var a=this.lastId,f=this.prefix+a,g=this.name+"["+a+"]",y=!1,E=function(){y||(i.apply(null,arguments),y=!0)};return this[a]=E,{number:a,id:f,name:g,callback:E}}remove(i){delete this[i.number]}}var h=new p("_pusher_script_","Pusher.ScriptReceivers"),b={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=b;class _{constructor(i){this.options=i,this.receivers=i.receivers||h,this.loading={}}load(i,a,f){var g=this;if(g.loading[i]&&g.loading[i].length>0)g.loading[i].push(f);else{g.loading[i]=[f];var y=H.createScriptRequest(g.getPath(i,a)),E=g.receivers.create(function($){if(g.receivers.remove(E),g.loading[i]){var q=g.loading[i];delete g.loading[i];for(var V=function(Ae){Ae||y.cleanup()},ee=0;ee<q.length;ee++)q[ee]($,V)}});y.send(E)}}getRoot(i){var a,f=H.getDocument().location.protocol;return i&&i.useTLS||f==="https:"?a=this.options.cdn_https:a=this.options.cdn_http,a.replace(/\/*$/,"")+"/"+this.options.version}getPath(i,a){return this.getRoot(a)+"/"+i+this.options.suffix+".js"}}var w=new p("_pusher_dependencies","Pusher.DependenciesReceivers"),P=new _({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:w});const N={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"}}},R={buildLogSuffix:function(l){const i="See:",a=N.urls[l];if(!a)return"";let f;return a.fullUrl?f=a.fullUrl:a.path&&(f=N.baseUrl+a.path),f?`${i} ${f}`:""}};var x;(function(l){l.UserAuthentication="user-authentication",l.ChannelAuthorization="channel-authorization"})(x||(x={}));class S extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class C extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class se extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class ve extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class $e extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class et extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class Q extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class be extends Error{constructor(i,a){super(a),this.status=i,Object.setPrototypeOf(this,new.target.prototype)}}const tn=function(l,i,a,f,g){const y=H.createXHR();y.open("POST",a.endpoint,!0),y.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var E in a.headers)y.setRequestHeader(E,a.headers[E]);if(a.headersProvider!=null){let $=a.headersProvider();for(var E in $)y.setRequestHeader(E,$[E])}return y.onreadystatechange=function(){if(y.readyState===4)if(y.status===200){let $,q=!1;try{$=JSON.parse(y.responseText),q=!0}catch{g(new be(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${y.responseText}`),null)}q&&g(null,$)}else{let $="";switch(f){case x.UserAuthentication:$=R.buildLogSuffix("authenticationEndpoint");break;case x.ChannelAuthorization:$=`Clients must be authorized to join private or presence channels. ${R.buildLogSuffix("authorizationEndpoint")}`;break}g(new be(y.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${y.status} from ${a.endpoint}. ${$}`),null)}},y.send(i),y};function Z(l){return ke(Ct(l))}var X=String.fromCharCode,Ne="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ue=function(l){var i=l.charCodeAt(0);return i<128?l:i<2048?X(192|i>>>6)+X(128|i&63):X(224|i>>>12&15)+X(128|i>>>6&63)+X(128|i&63)},Ct=function(l){return l.replace(/[^\x00-\x7F]/g,Ue)},ct=function(l){var i=[0,2,1][l.length%3],a=l.charCodeAt(0)<<16|(l.length>1?l.charCodeAt(1):0)<<8|(l.length>2?l.charCodeAt(2):0),f=[Ne.charAt(a>>>18),Ne.charAt(a>>>12&63),i>=2?"=":Ne.charAt(a>>>6&63),i>=1?"=":Ne.charAt(a&63)];return f.join("")},ke=window.btoa||function(l){return l.replace(/[\s\S]{1,3}/g,ct)};class vn{constructor(i,a,f,g){this.clear=a,this.timer=i(()=>{this.timer&&(this.timer=g(this.timer))},f)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const W=vn;function Re(l){window.clearTimeout(l)}function J(l){window.clearInterval(l)}class _e extends W{constructor(i,a){super(setTimeout,Re,i,function(f){return a(),null})}}class yn extends W{constructor(i,a){super(setInterval,J,i,function(f){return a(),f})}}var Le={now(){return Date.now?Date.now():new Date().valueOf()},defer(l){return new _e(0,l)},method(l,...i){var a=Array.prototype.slice.call(arguments,1);return function(f){return f[l].apply(f,a.concat(arguments))}}};const ae=Le;function xe(l,...i){for(var a=0;a<i.length;a++){var f=i[a];for(var g in f)f[g]&&f[g].constructor&&f[g].constructor===Object?l[g]=xe(l[g]||{},f[g]):l[g]=f[g]}return l}function Mt(){for(var l=["Pusher"],i=0;i<arguments.length;i++)typeof arguments[i]=="string"?l.push(arguments[i]):l.push(Xe(arguments[i]));return l.join(" : ")}function Ir(l,i){var a=Array.prototype.indexOf;if(l===null)return-1;if(a&&l.indexOf===a)return l.indexOf(i);for(var f=0,g=l.length;f<g;f++)if(l[f]===i)return f;return-1}function je(l,i){for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&i(l[a],a,l)}function wn(l){var i=[];return je(l,function(a,f){i.push(f)}),i}function Ut(l){var i=[];return je(l,function(a){i.push(a)}),i}function jt(l,i,a){for(var f=0;f<l.length;f++)i.call(a||window,l[f],f,l)}function nr(l,i){for(var a=[],f=0;f<l.length;f++)a.push(i(l[f],f,l,a));return a}function nn(l,i){var a={};return je(l,function(f,g){a[g]=i(f)}),a}function xn(l,i){i=i||function(g){return!!g};for(var a=[],f=0;f<l.length;f++)i(l[f],f,l,a)&&a.push(l[f]);return a}function Sn(l,i){var a={};return je(l,function(f,g){(i&&i(f,g,l,a)||f)&&(a[g]=f)}),a}function jo(l){var i=[];return je(l,function(a,f){i.push([f,a])}),i}function $r(l,i){for(var a=0;a<l.length;a++)if(i(l[a],a,l))return!0;return!1}function es(l,i){for(var a=0;a<l.length;a++)if(!i(l[a],a,l))return!1;return!0}function Nr(l){return nn(l,function(i){return typeof i=="object"&&(i=Xe(i)),encodeURIComponent(Z(i.toString()))})}function Tn(l){var i=Sn(l,function(f){return f!==void 0}),a=nr(jo(Nr(i)),ae.method("join","=")).join("&");return a}function rn(l){var i=[],a=[];return function f(g,y){var E,$,q;switch(typeof g){case"object":if(!g)return null;for(E=0;E<i.length;E+=1)if(i[E]===g)return{$ref:a[E]};if(i.push(g),a.push(y),Object.prototype.toString.apply(g)==="[object Array]")for(q=[],E=0;E<g.length;E+=1)q[E]=f(g[E],y+"["+E+"]");else{q={};for($ in g)Object.prototype.hasOwnProperty.call(g,$)&&(q[$]=f(g[$],y+"["+JSON.stringify($)+"]"))}return q;case"number":case"string":case"boolean":return g}}(l,"$")}function Xe(l){try{return JSON.stringify(l)}catch{return JSON.stringify(rn(l))}}class Or{constructor(){this.globalLog=i=>{window.console&&window.console.log&&window.console.log(i)}}debug(...i){this.log(this.globalLog,i)}warn(...i){this.log(this.globalLogWarn,i)}error(...i){this.log(this.globalLogError,i)}globalLogWarn(i){window.console&&window.console.warn?window.console.warn(i):this.globalLog(i)}globalLogError(i){window.console&&window.console.error?window.console.error(i):this.globalLogWarn(i)}log(i,...a){var f=Mt.apply(this,arguments);ei.log?ei.log(f):ei.logToConsole&&i.bind(this)(f)}}const ce=new Or;var Zo=function(l,i,a,f,g){(a.headers!==void 0||a.headersProvider!=null)&&ce.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var y=l.nextAuthCallbackID.toString();l.nextAuthCallbackID++;var E=l.getDocument(),$=E.createElement("script");l.auth_callbacks[y]=function(ee){g(null,ee)};var q="Pusher.auth_callbacks['"+y+"']";$.src=a.endpoint+"?callback="+encodeURIComponent(q)+"&"+i;var V=E.getElementsByTagName("head")[0]||E.documentElement;V.insertBefore($,V.firstChild)};const Dr=Zo;class qo{constructor(i){this.src=i}send(i){var a=this,f="Error loading "+a.src;a.script=document.createElement("script"),a.script.id=i.id,a.script.src=a.src,a.script.type="text/javascript",a.script.charset="UTF-8",a.script.addEventListener?(a.script.onerror=function(){i.callback(f)},a.script.onload=function(){i.callback(null)}):a.script.onreadystatechange=function(){(a.script.readyState==="loaded"||a.script.readyState==="complete")&&i.callback(null)},a.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(a.errorScript=document.createElement("script"),a.errorScript.id=i.id+"_error",a.errorScript.text=i.name+"('"+f+"');",a.script.async=a.errorScript.async=!1):a.script.async=!0;var g=document.getElementsByTagName("head")[0];g.insertBefore(a.script,g.firstChild),a.errorScript&&g.insertBefore(a.errorScript,a.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 rr{constructor(i,a){this.url=i,this.data=a}send(i){if(!this.request){var a=Tn(this.data),f=this.url+"/"+i.number+"?"+a;this.request=H.createScriptRequest(f),this.request.send(i)}}cleanup(){this.request&&this.request.cleanup()}}var or=function(l,i){return function(a,f){var g="http"+(i?"s":"")+"://",y=g+(l.host||l.options.host)+l.options.path,E=H.createJSONPRequest(y,a),$=H.ScriptReceivers.create(function(q,V){h.remove($),E.cleanup(),V&&V.host&&(l.host=V.host),f&&f(q,V)});E.send($)}},mt={name:"jsonp",getAgent:or};const on=mt;function En(l,i,a){var f=l+(i.useTLS?"s":""),g=i.useTLS?i.hostTLS:i.hostNonTLS;return f+"://"+g+a}function An(l,i){var a="/app/"+l,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(i?"&"+i:"");return a+f}var ts={getInitial:function(l,i){var a=(i.httpPath||"")+An(l,"flash=false");return En("ws",i,a)}},ir={getInitial:function(l,i){var a=(i.httpPath||"/pusher")+An(l);return En("http",i,a)}},sr={getInitial:function(l,i){return En("http",i,i.httpPath||"/pusher")},getPath:function(l,i){return An(l)}};class ns{constructor(){this._callbacks={}}get(i){return this._callbacks[Zt(i)]}add(i,a,f){var g=Zt(i);this._callbacks[g]=this._callbacks[g]||[],this._callbacks[g].push({fn:a,context:f})}remove(i,a,f){if(!i&&!a&&!f){this._callbacks={};return}var g=i?[Zt(i)]:wn(this._callbacks);a||f?this.removeCallback(g,a,f):this.removeAllCallbacks(g)}removeCallback(i,a,f){jt(i,function(g){this._callbacks[g]=xn(this._callbacks[g]||[],function(y){return a&&a!==y.fn||f&&f!==y.context}),this._callbacks[g].length===0&&delete this._callbacks[g]},this)}removeAllCallbacks(i){jt(i,function(a){delete this._callbacks[a]},this)}}function Zt(l){return"_"+l}class bt{constructor(i){this.callbacks=new ns,this.global_callbacks=[],this.failThrough=i}bind(i,a,f){return this.callbacks.add(i,a,f),this}bind_global(i){return this.global_callbacks.push(i),this}unbind(i,a,f){return this.callbacks.remove(i,a,f),this}unbind_global(i){return i?(this.global_callbacks=xn(this.global_callbacks||[],a=>a!==i),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(i,a,f){for(var g=0;g<this.global_callbacks.length;g++)this.global_callbacks[g](i,a);var y=this.callbacks.get(i),E=[];if(f?E.push(a,f):a&&E.push(a),y&&y.length>0)for(var g=0;g<y.length;g++)y[g].fn.apply(y[g].context||window,E);else this.failThrough&&this.failThrough(i,a);return this}}class rs extends bt{constructor(i,a,f,g,y){super(),this.initialize=H.transportConnectionInitializer,this.hooks=i,this.name=a,this.priority=f,this.key=g,this.options=y,this.state="new",this.timeline=y.timeline,this.activityTimeout=y.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 i=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(i,this.options)}catch(a){return ae.defer(()=>{this.onError(a),this.changeState("closed")}),!1}return this.bindListeners(),ce.debug("Connecting",{transport:this.name,url:i}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(i){return this.state==="open"?(ae.defer(()=>{this.socket&&this.socket.send(i)}),!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(i){this.emit("error",{type:"WebSocketError",error:i}),this.timeline.error(this.buildTimelineMessage({error:i.toString()}))}onClose(i){i?this.changeState("closed",{code:i.code,reason:i.reason,wasClean:i.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(i){this.emit("message",i)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=i=>{this.onError(i)},this.socket.onclose=i=>{this.onClose(i)},this.socket.onmessage=i=>{this.onMessage(i)},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(i,a){this.state=i,this.timeline.info(this.buildTimelineMessage({state:i,params:a})),this.emit(i,a)}buildTimelineMessage(i){return xe({cid:this.id},i)}}class le{constructor(i){this.hooks=i}isSupported(i){return this.hooks.isSupported(i)}createConnection(i,a,f,g){return new rs(this.hooks,i,a,f,g)}}var sn=new le({urls:ts,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!H.getWebSocketAPI()},isSupported:function(){return!!H.getWebSocketAPI()},getSocket:function(l){return H.createWebSocket(l)}}),Ho={urls:ir,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Mr=xe({getSocket:function(l){return H.HTTPFactory.createStreamingSocket(l)}},Ho),ar=xe({getSocket:function(l){return H.HTTPFactory.createPollingSocket(l)}},Ho),Ur={isSupported:function(){return H.isXHRSupported()}},Fo=new le(xe({},Mr,Ur)),os=new le(xe({},ar,Ur)),lt={ws:sn,xhr_streaming:Fo,xhr_polling:os};const ut=lt;var Bo=new le({file:"sockjs",urls:sr,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(l,i){return new window.SockJS(l,null,{js_path:P.getPath("sockjs",{useTLS:i.useTLS}),ignore_null_origin:i.ignoreNullOrigin})},beforeOpen:function(l,i){l.send(JSON.stringify({path:i}))}}),jr={isSupported:function(l){var i=H.isXDRSupported(l.useTLS);return i}},Zr=new le(xe({},Mr,jr)),Go=new le(xe({},ar,jr));ut.xdr_streaming=Zr,ut.xdr_polling=Go,ut.sockjs=Bo;const kt=ut;class Wo extends bt{constructor(){super();var i=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){i.emit("online")},!1),window.addEventListener("offline",function(){i.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Jo=new Wo;class Xo{constructor(i,a,f){this.manager=i,this.transport=a,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(i,a,f,g){g=xe({},g,{activityTimeout:this.pingDelay});var y=this.transport.createConnection(i,a,f,g),E=null,$=function(){y.unbind("open",$),y.bind("closed",q),E=ae.now()},q=V=>{if(y.unbind("closed",q),V.code===1002||V.code===1003)this.manager.reportDeath();else if(!V.wasClean&&E){var ee=ae.now()-E;ee<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(ee/2,this.minPingDelay))}};return y.bind("open",$),y}isSupported(i){return this.manager.isAlive()&&this.transport.isSupported(i)}}const qr={decodeMessage:function(l){try{var i=JSON.parse(l.data),a=i.data;if(typeof a=="string")try{a=JSON.parse(i.data)}catch{}var f={event:i.event,channel:i.channel,data:a};return i.user_id&&(f.user_id=i.user_id),f}catch(g){throw{type:"MessageParseError",error:g,data:l.data}}},encodeMessage:function(l){return JSON.stringify(l)},processHandshake:function(l){var i=qr.decodeMessage(l);if(i.event==="pusher:connection_established"){if(!i.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:i.data.socket_id,activityTimeout:i.data.activity_timeout*1e3}}else{if(i.event==="pusher:error")return{action:this.getCloseAction(i.data),error:this.getCloseError(i.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}},qt=qr;class D extends bt{constructor(i,a){super(),this.id=i,this.transport=a,this.activityTimeout=a.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(i){return this.transport.send(i)}send_event(i,a,f){var g={event:i,data:a};return f&&(g.channel=f),ce.debug("Event sent",g),this.send(qt.encodeMessage(g))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var i={message:f=>{var g;try{g=qt.decodeMessage(f)}catch(y){this.emit("error",{type:"MessageParseError",error:y,data:f.data})}if(g!==void 0){switch(ce.debug("Event recd",g),g.event){case"pusher:error":this.emit("error",{type:"PusherError",data:g.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",g)}},activity:()=>{this.emit("activity")},error:f=>{this.emit("error",f)},closed:f=>{a(),f&&f.code&&this.handleCloseEvent(f),this.transport=null,this.emit("closed")}},a=()=>{je(i,(f,g)=>{this.transport.unbind(g,f)})};je(i,(f,g)=>{this.transport.bind(g,f)})}handleCloseEvent(i){var a=qt.getCloseAction(i),f=qt.getCloseError(i);f&&this.emit("error",f),a&&this.emit(a,{action:a,error:f})}}class k{constructor(i,a){this.transport=i,this.callback=a,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=i=>{this.unbindListeners();var a;try{a=qt.processHandshake(i)}catch(f){this.finish("error",{error:f}),this.transport.close();return}a.action==="connected"?this.finish("connected",{connection:new D(a.id,this.transport),activityTimeout:a.activityTimeout}):(this.finish(a.action,{error:a.error}),this.transport.close())},this.onClosed=i=>{this.unbindListeners();var a=qt.getCloseAction(i)||"backoff",f=qt.getCloseError(i);this.finish(a,{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(i,a){this.callback(xe({transport:this.transport,action:i},a))}}class T{constructor(i,a){this.timeline=i,this.options=a||{}}send(i,a){this.timeline.isEmpty()||this.timeline.send(H.TimelineTransport.getAgent(this,i),a)}}class L extends bt{constructor(i,a){super(function(f,g){ce.debug("No callbacks on "+i+" for "+f)}),this.name=i,this.pusher=a,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(i,a){return a(null,{auth:""})}trigger(i,a){if(i.indexOf("client-")!==0)throw new S("Event '"+i+"' does not start with 'client-'");if(!this.subscribed){var f=R.buildLogSuffix("triggeringClientEvents");ce.warn(`Client event triggered before channel 'subscription_succeeded' event . ${f}`)}return this.pusher.send_event(i,a,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(i){var a=i.event,f=i.data;if(a==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(i);else if(a==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(i);else if(a.indexOf("pusher_internal:")!==0){var g={};this.emit(a,f,g)}}handleSubscriptionSucceededEvent(i){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",i.data)}handleSubscriptionCountEvent(i){i.data.subscription_count&&(this.subscriptionCount=i.data.subscription_count),this.emit("pusher:subscription_count",i.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(i,a)=>{i?(this.subscriptionPending=!1,ce.error(i.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:i.message},i instanceof be?{status:i.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:a.auth,channel_data:a.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 oe extends L{authorize(i,a){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:i},a)}}class ze{constructor(){this.reset()}get(i){return Object.prototype.hasOwnProperty.call(this.members,i)?{id:i,info:this.members[i]}:null}each(i){je(this.members,(a,f)=>{i(this.get(f))})}setMyID(i){this.myID=i}onSubscription(i){this.members=i.presence.hash,this.count=i.presence.count,this.me=this.get(this.myID)}addMember(i){return this.get(i.user_id)===null&&this.count++,this.members[i.user_id]=i.user_info,this.get(i.user_id)}removeMember(i){var a=this.get(i.user_id);return a&&(delete this.members[i.user_id],this.count--),a}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var ye=function(l,i,a,f){function g(y){return y instanceof a?y:new a(function(E){E(y)})}return new(a||(a=Promise))(function(y,E){function $(ee){try{V(f.next(ee))}catch(Ae){E(Ae)}}function q(ee){try{V(f.throw(ee))}catch(Ae){E(Ae)}}function V(ee){ee.done?y(ee.value):g(ee.value).then($,q)}V((f=f.apply(l,i||[])).next())})};class Ze extends oe{constructor(i,a){super(i,a),this.members=new ze}authorize(i,a){super.authorize(i,(f,g)=>ye(this,void 0,void 0,function*(){if(!f)if(g=g,g.channel_data!=null){var y=JSON.parse(g.channel_data);this.members.setMyID(y.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 E=R.buildLogSuffix("authorizationEndpoint");ce.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${E}, or the user should be signed in.`),a("Invalid auth response");return}a(f,g)}))}handleEvent(i){var a=i.event;if(a.indexOf("pusher_internal:")===0)this.handleInternalEvent(i);else{var f=i.data,g={};i.user_id&&(g.user_id=i.user_id),this.emit(a,f,g)}}handleInternalEvent(i){var a=i.event,f=i.data;switch(a){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(i);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(i);break;case"pusher_internal:member_added":var g=this.members.addMember(f);this.emit("pusher:member_added",g);break;case"pusher_internal:member_removed":var y=this.members.removeMember(f);y&&this.emit("pusher:member_removed",y);break}}handleSubscriptionSucceededEvent(i){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(i.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var _t=d(978),Pt=d(594);class Hr extends oe{constructor(i,a,f){super(i,a),this.key=null,this.nacl=f}authorize(i,a){super.authorize(i,(f,g)=>{if(f){a(f,g);return}let y=g.shared_secret;if(!y){a(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,Pt.decode)(y),delete g.shared_secret,a(null,g)})}trigger(i,a){throw new $e("Client events are not currently supported for encrypted channels")}handleEvent(i){var a=i.event,f=i.data;if(a.indexOf("pusher_internal:")===0||a.indexOf("pusher:")===0){super.handleEvent(i);return}this.handleEncryptedEvent(a,f)}handleEncryptedEvent(i,a){if(!this.key){ce.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!a.ciphertext||!a.nonce){ce.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+a);return}let f=(0,Pt.decode)(a.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){ce.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let g=(0,Pt.decode)(a.nonce);if(g.length<this.nacl.secretbox.nonceLength){ce.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${g.length}`);return}let y=this.nacl.secretbox.open(f,g,this.key);if(y===null){ce.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,(E,$)=>{if(E){ce.error(`Failed to make a request to the authEndpoint: ${$}. Unable to fetch new key, so dropping encrypted event`);return}if(y=this.nacl.secretbox.open(f,g,this.key),y===null){ce.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(i,this.getDataToEmit(y))});return}this.emit(i,this.getDataToEmit(y))}getDataToEmit(i){let a=(0,_t.D4)(i);try{return JSON.parse(a)}catch{return a}}}class Ce extends bt{constructor(i,a){super(),this.state="initialized",this.connection=null,this.key=i,this.options=a,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=H.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(i){this.key=i,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(i){return this.connection?this.connection.send(i):!1}send_event(i,a,f){return this.connection?this.connection.send_event(i,a,f):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var i=(a,f)=>{a?this.runner=this.strategy.connect(0,i):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,i)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var i=this.abandonConnection();i.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(i){this.timeline.info({action:"retry",delay:i}),i>0&&this.emit("connecting_in",Math.round(i/1e3)),this.retryTimer=new _e(i||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new _e(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new _e(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 _e(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(i){return xe({},i,{message:a=>{this.resetActivityCheck(),this.emit("message",a)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:a=>{this.emit("error",a)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(i){return xe({},i,{connected:a=>{this.activityTimeout=Math.min(this.options.activityTimeout,a.activityTimeout,a.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(a.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let i=a=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),a(f)};return{tls_only:i(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:i(()=>{this.disconnect()}),backoff:i(()=>{this.retryIn(1e3)}),retry:i(()=>{this.retryIn(0)})}}setConnection(i){this.connection=i;for(var a in this.connectionCallbacks)this.connection.bind(a,this.connectionCallbacks[a]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var i in this.connectionCallbacks)this.connection.unbind(i,this.connectionCallbacks[i]);var a=this.connection;return this.connection=null,a}}updateState(i,a){var f=this.state;if(this.state=i,f!==i){var g=i;g==="connected"&&(g+=" with new socket ID "+a.socket_id),ce.debug("State changed",f+" -> "+g),this.timeline.info({state:i,params:a}),this.emit("state_change",{previous:f,current:i}),this.emit(i,a)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class Vo{constructor(){this.channels={}}add(i,a){return this.channels[i]||(this.channels[i]=Yo(i,a)),this.channels[i]}all(){return Ut(this.channels)}find(i){return this.channels[i]}remove(i){var a=this.channels[i];return delete this.channels[i],a}disconnect(){je(this.channels,function(i){i.disconnect()})}}function Yo(l,i){if(l.indexOf("private-encrypted-")===0){if(i.config.nacl)return Ht.createEncryptedChannel(l,i,i.config.nacl);let a="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=R.buildLogSuffix("encryptedChannelSupport");throw new $e(`${a}. ${f}`)}else{if(l.indexOf("private-")===0)return Ht.createPrivateChannel(l,i);if(l.indexOf("presence-")===0)return Ht.createPresenceChannel(l,i);if(l.indexOf("#")===0)throw new C('Cannot create a channel with name "'+l+'".');return Ht.createChannel(l,i)}}var xb={createChannels(){return new Vo},createConnectionManager(l,i){return new Ce(l,i)},createChannel(l,i){return new L(l,i)},createPrivateChannel(l,i){return new oe(l,i)},createPresenceChannel(l,i){return new Ze(l,i)},createEncryptedChannel(l,i,a){return new Hr(l,i,a)},createTimelineSender(l,i){return new T(l,i)},createHandshake(l,i){return new k(l,i)},createAssistantToTheTransportManager(l,i,a){return new Xo(l,i,a)}};const Ht=xb;class tl{constructor(i){this.options=i||{},this.livesLeft=this.options.lives||1/0}getAssistant(i){return Ht.createAssistantToTheTransportManager(this,i,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Cn{constructor(i,a){this.strategies=i,this.loop=!!a.loop,this.failFast=!!a.failFast,this.timeout=a.timeout,this.timeoutLimit=a.timeoutLimit}isSupported(){return $r(this.strategies,ae.method("isSupported"))}connect(i,a){var f=this.strategies,g=0,y=this.timeout,E=null,$=(q,V)=>{V?a(null,V):(g=g+1,this.loop&&(g=g%f.length),g<f.length?(y&&(y=y*2,this.timeoutLimit&&(y=Math.min(y,this.timeoutLimit))),E=this.tryStrategy(f[g],i,{timeout:y,failFast:this.failFast},$)):a(!0))};return E=this.tryStrategy(f[g],i,{timeout:y,failFast:this.failFast},$),{abort:function(){E.abort()},forceMinPriority:function(q){i=q,E&&E.forceMinPriority(q)}}}tryStrategy(i,a,f,g){var y=null,E=null;return f.timeout>0&&(y=new _e(f.timeout,function(){E.abort(),g(!0)})),E=i.connect(a,function($,q){$&&y&&y.isRunning()&&!f.failFast||(y&&y.ensureAborted(),g($,q))}),{abort:function(){y&&y.ensureAborted(),E.abort()},forceMinPriority:function($){E.forceMinPriority($)}}}}class is{constructor(i){this.strategies=i}isSupported(){return $r(this.strategies,ae.method("isSupported"))}connect(i,a){return Sb(this.strategies,i,function(f,g){return function(y,E){if(g[f].error=y,y){Tb(g)&&a(!0);return}jt(g,function($){$.forceMinPriority(E.transport.priority)}),a(null,E)}})}}function Sb(l,i,a){var f=nr(l,function(g,y,E,$){return g.connect(i,a(y,$))});return{abort:function(){jt(f,Eb)},forceMinPriority:function(g){jt(f,function(y){y.forceMinPriority(g)})}}}function Tb(l){return es(l,function(i){return!!i.error})}function Eb(l){!l.error&&!l.aborted&&(l.abort(),l.aborted=!0)}class Ab{constructor(i,a,f){this.strategy=i,this.transports=a,this.ttl=f.ttl||18e5,this.usingTLS=f.useTLS,this.timeline=f.timeline}isSupported(){return this.strategy.isSupported()}connect(i,a){var f=this.usingTLS,g=Cb(f),y=g&&g.cacheSkipCount?g.cacheSkipCount:0,E=[this.strategy];if(g&&g.timestamp+this.ttl>=ae.now()){var $=this.transports[g.transport];$&&(["ws","wss"].includes(g.transport)||y>3?(this.timeline.info({cached:!0,transport:g.transport,latency:g.latency}),E.push(new Cn([$],{timeout:g.latency*2+1e3,failFast:!0}))):y++)}var q=ae.now(),V=E.pop().connect(i,function ee(Ae,ti){Ae?(nl(f),E.length>0?(q=ae.now(),V=E.pop().connect(i,ee)):a(Ae)):(Pb(f,ti.transport.name,ae.now()-q,y),a(null,ti))});return{abort:function(){V.abort()},forceMinPriority:function(ee){i=ee,V&&V.forceMinPriority(ee)}}}}function ss(l){return"pusherTransport"+(l?"TLS":"NonTLS")}function Cb(l){var i=H.getLocalStorage();if(i)try{var a=i[ss(l)];if(a)return JSON.parse(a)}catch{nl(l)}return null}function Pb(l,i,a,f){var g=H.getLocalStorage();if(g)try{g[ss(l)]=Xe({timestamp:ae.now(),transport:i,latency:a,cacheSkipCount:f})}catch{}}function nl(l){var i=H.getLocalStorage();if(i)try{delete i[ss(l)]}catch{}}class Ko{constructor(i,{delay:a}){this.strategy=i,this.options={delay:a}}isSupported(){return this.strategy.isSupported()}connect(i,a){var f=this.strategy,g,y=new _e(this.options.delay,function(){g=f.connect(i,a)});return{abort:function(){y.ensureAborted(),g&&g.abort()},forceMinPriority:function(E){i=E,g&&g.forceMinPriority(E)}}}}class Fr{constructor(i,a,f){this.test=i,this.trueBranch=a,this.falseBranch=f}isSupported(){var i=this.test()?this.trueBranch:this.falseBranch;return i.isSupported()}connect(i,a){var f=this.test()?this.trueBranch:this.falseBranch;return f.connect(i,a)}}class Rb{constructor(i){this.strategy=i}isSupported(){return this.strategy.isSupported()}connect(i,a){var f=this.strategy.connect(i,function(g,y){y&&f.abort(),a(g,y)});return f}}function Br(l){return function(){return l.isSupported()}}var Lb=function(l,i,a){var f={};function g(gl,Ck,Pk,Rk,Lk){var ml=a(l,gl,Ck,Pk,Rk,Lk);return f[gl]=ml,ml}var y=Object.assign({},i,{hostNonTLS:l.wsHost+":"+l.wsPort,hostTLS:l.wsHost+":"+l.wssPort,httpPath:l.wsPath}),E=Object.assign({},y,{useTLS:!0}),$=Object.assign({},i,{hostNonTLS:l.httpHost+":"+l.httpPort,hostTLS:l.httpHost+":"+l.httpsPort,httpPath:l.httpPath}),q={loop:!0,timeout:15e3,timeoutLimit:6e4},V=new tl({minPingDelay:1e4,maxPingDelay:l.activityTimeout}),ee=new tl({lives:2,minPingDelay:1e4,maxPingDelay:l.activityTimeout}),Ae=g("ws","ws",3,y,V),ti=g("wss","ws",3,E,V),xk=g("sockjs","sockjs",1,$),ll=g("xhr_streaming","xhr_streaming",1,$,ee),Sk=g("xdr_streaming","xdr_streaming",1,$,ee),ul=g("xhr_polling","xhr_polling",1,$),Tk=g("xdr_polling","xdr_polling",1,$),dl=new Cn([Ae],q),Ek=new Cn([ti],q),Ak=new Cn([xk],q),pl=new Cn([new Fr(Br(ll),ll,Sk)],q),hl=new Cn([new Fr(Br(ul),ul,Tk)],q),fl=new Cn([new Fr(Br(pl),new is([pl,new Ko(hl,{delay:4e3})]),hl)],q),ls=new Fr(Br(fl),fl,Ak),us;return i.useTLS?us=new is([dl,new Ko(ls,{delay:2e3})]):us=new is([dl,new Ko(Ek,{delay:2e3}),new Ko(ls,{delay:5e3})]),new Ab(new Rb(new Fr(Br(Ae),us,ls)),f,{ttl:18e5,timeline:i.timeline,useTLS:i.useTLS})};const zb=Lb;function Ib(){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"),P.load(l.hooks.file,{useTLS:l.options.useTLS},function(i,a){l.hooks.isInitialized()?(l.changeState("initialized"),a(!0)):(i&&l.onError(i),l.onClose(),a(!1))})):l.onClose()}var $b={getRequest:function(l){var i=new window.XDomainRequest;return i.ontimeout=function(){l.emit("error",new M),l.close()},i.onerror=function(a){l.emit("error",a),l.close()},i.onprogress=function(){i.responseText&&i.responseText.length>0&&l.onChunk(200,i.responseText)},i.onload=function(){i.responseText&&i.responseText.length>0&&l.onChunk(200,i.responseText),l.emit("finished",200),l.close()},i},abortRequest:function(l){l.ontimeout=l.onerror=l.onprogress=l.onload=null,l.abort()}};const Nb=$b,Ob=256*1024;class Db extends bt{constructor(i,a,f){super(),this.hooks=i,this.method=a,this.url=f}start(i){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},H.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(i)}close(){this.unloader&&(H.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(i,a){for(;;){var f=this.advanceBuffer(a);if(f)this.emit("chunk",{status:i,data:f});else break}this.isBufferTooLong(a)&&this.emit("buffer_too_long")}advanceBuffer(i){var a=i.slice(this.position),f=a.indexOf(`
1375
+ `);return f!==-1?(this.position+=f+1,a.slice(0,f)):null}isBufferTooLong(i){return this.position===i.length&&i.length>Ob}}var as;(function(l){l[l.CONNECTING=0]="CONNECTING",l[l.OPEN=1]="OPEN",l[l.CLOSED=3]="CLOSED"})(as||(as={}));const Pn=as;var Mb=1;class Ub{constructor(i,a){this.hooks=i,this.session=ol(1e3)+"/"+Hb(8),this.location=jb(a),this.readyState=Pn.CONNECTING,this.openStream()}send(i){return this.sendRaw(JSON.stringify([i]))}ping(){this.hooks.sendHeartbeat(this)}close(i,a){this.onClose(i,a,!0)}sendRaw(i){if(this.readyState===Pn.OPEN)try{return H.createSocketRequest("POST",rl(Zb(this.location,this.session))).start(i),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(i,a,f){this.closeStream(),this.readyState=Pn.CLOSED,this.onclose&&this.onclose({code:i,reason:a,wasClean:f})}onChunk(i){if(i.status===200){this.readyState===Pn.OPEN&&this.onActivity();var a,f=i.data.slice(0,1);switch(f){case"o":a=JSON.parse(i.data.slice(1)||"{}"),this.onOpen(a);break;case"a":a=JSON.parse(i.data.slice(1)||"[]");for(var g=0;g<a.length;g++)this.onEvent(a[g]);break;case"m":a=JSON.parse(i.data.slice(1)||"null"),this.onEvent(a);break;case"h":this.hooks.onHeartbeat(this);break;case"c":a=JSON.parse(i.data.slice(1)||"[]"),this.onClose(a[0],a[1],!0);break}}}onOpen(i){this.readyState===Pn.CONNECTING?(i&&i.hostname&&(this.location.base=qb(this.location.base,i.hostname)),this.readyState=Pn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(i){this.readyState===Pn.OPEN&&this.onmessage&&this.onmessage({data:i})}onActivity(){this.onactivity&&this.onactivity()}onError(i){this.onerror&&this.onerror(i)}openStream(){this.stream=H.createSocketRequest("POST",rl(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",i=>{this.onChunk(i)}),this.stream.bind("finished",i=>{this.hooks.onFinished(this,i)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(i){ae.defer(()=>{this.onError(i),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function jb(l){var i=/([^\?]*)\/*(\??.*)/.exec(l);return{base:i[1],queryString:i[2]}}function Zb(l,i){return l.base+"/"+i+"/xhr_send"}function rl(l){var i=l.indexOf("?")===-1?"?":"&";return l+i+"t="+ +new Date+"&n="+Mb++}function qb(l,i){var a=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(l);return a[1]+i+a[3]}function ol(l){return H.randomInt(l)}function Hb(l){for(var i=[],a=0;a<l;a++)i.push(ol(32).toString(32));return i.join("")}const Fb=Ub;var Bb={getReceiveURL:function(l,i){return l.base+"/"+i+"/xhr_streaming"+l.queryString},onHeartbeat:function(l){l.sendRaw("[]")},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,i){l.onClose(1006,"Connection interrupted ("+i+")",!1)}};const Gb=Bb;var Wb={getReceiveURL:function(l,i){return l.base+"/"+i+"/xhr"+l.queryString},onHeartbeat:function(){},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,i){i===200?l.reconnect():l.onClose(1006,"Connection interrupted ("+i+")",!1)}};const Jb=Wb;var Xb={getRequest:function(l){var i=H.getXHRAPI(),a=new i;return a.onreadystatechange=a.onprogress=function(){switch(a.readyState){case 3:a.responseText&&a.responseText.length>0&&l.onChunk(a.status,a.responseText);break;case 4:a.responseText&&a.responseText.length>0&&l.onChunk(a.status,a.responseText),l.emit("finished",a.status),l.close();break}},a},abortRequest:function(l){l.onreadystatechange=null,l.abort()}};const Vb=Xb;var Yb={createStreamingSocket(l){return this.createSocket(Gb,l)},createPollingSocket(l){return this.createSocket(Jb,l)},createSocket(l,i){return new Fb(l,i)},createXHR(l,i){return this.createRequest(Vb,l,i)},createRequest(l,i,a){return new Db(l,i,a)}};const il=Yb;il.createXDR=function(l,i){return this.createRequest(Nb,l,i)};var Kb={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:w,getDefaultStrategy:zb,Transports:kt,transportConnectionInitializer:Ib,HTTPFactory:il,TimelineTransport:on,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(l){window.Pusher=l;var i=()=>{this.onDocumentBody(l.ready)};window.JSON?i():P.load("json2",{},i)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:tn,jsonp:Dr}},onDocumentBody(l){document.body?l():setTimeout(()=>{this.onDocumentBody(l)},0)},createJSONPRequest(l,i){return new rr(l,i)},createScriptRequest(l){return new qo(l)},getLocalStorage(){try{return window.localStorage}catch{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 Jo},createWebSocket(l){var i=this.getWebSocketAPI();return new i(l)},createSocketRequest(l,i){if(this.isXHRSupported())return this.HTTPFactory.createXHR(l,i);if(this.isXDRSupported(i.indexOf("https:")===0))return this.HTTPFactory.createXDR(l,i);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var l=this.getXHRAPI();return!!l&&new l().withCredentials!==void 0},isXDRSupported(l){var i=l?"https:":"http:",a=this.getProtocol();return!!window.XDomainRequest&&a===i},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 H=Kb;var cs;(function(l){l[l.ERROR=3]="ERROR",l[l.INFO=6]="INFO",l[l.DEBUG=7]="DEBUG"})(cs||(cs={}));const Qo=cs;class Qb{constructor(i,a,f){this.key=i,this.session=a,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(i,a){i<=this.options.level&&(this.events.push(xe({},a,{timestamp:ae.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(i){this.log(Qo.ERROR,i)}info(i){this.log(Qo.INFO,i)}debug(i){this.log(Qo.DEBUG,i)}isEmpty(){return this.events.length===0}send(i,a){var f=xe({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=[],i(f,(g,y)=>{g||this.sent++,a&&a(g,y)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class ek{constructor(i,a,f,g){this.name=i,this.priority=a,this.transport=f,this.options=g||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(i,a){if(this.isSupported()){if(this.priority<i)return sl(new se,a)}else return sl(new Q,a);var f=!1,g=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),y=null,E=function(){g.unbind("initialized",E),g.connect()},$=function(){y=Ht.createHandshake(g,function(Ae){f=!0,ee(),a(null,Ae)})},q=function(Ae){ee(),a(Ae)},V=function(){ee();var Ae;Ae=Xe(g),a(new ve(Ae))},ee=function(){g.unbind("initialized",E),g.unbind("open",$),g.unbind("error",q),g.unbind("closed",V)};return g.bind("initialized",E),g.bind("open",$),g.bind("error",q),g.bind("closed",V),g.initialize(),{abort:()=>{f||(ee(),y?y.close():g.close())},forceMinPriority:Ae=>{f||this.priority<Ae&&(y?y.close():g.close())}}}}function sl(l,i){return ae.defer(function(){i(l)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:tk}=H;var nk=function(l,i,a,f,g,y){var E=tk[a];if(!E)throw new et(a);var $=(!l.enabledTransports||Ir(l.enabledTransports,i)!==-1)&&(!l.disabledTransports||Ir(l.disabledTransports,i)===-1),q;return $?(g=Object.assign({ignoreNullOrigin:l.ignoreNullOrigin},g),q=new ek(i,f,y?y.getAssistant(E):E,g)):q=rk,q},rk={isSupported:function(){return!1},connect:function(l,i){var a=ae.defer(function(){i(new Q)});return{abort:function(){a.ensureAborted()},forceMinPriority:function(){}}}};function ok(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&&ce.warn("The disableStats option is deprecated in favor of enableStats")}const ik=(l,i)=>{var a="socket_id="+encodeURIComponent(l.socketId);for(var f in i.params)a+="&"+encodeURIComponent(f)+"="+encodeURIComponent(i.params[f]);if(i.paramsProvider!=null){let g=i.paramsProvider();for(var f in g)a+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return a},sk=l=>{if(typeof H.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(i,a)=>{const f=ik(i,l);H.getAuthorizers()[l.transport](H,f,l,x.UserAuthentication,a)}},ak=(l,i)=>{var a="socket_id="+encodeURIComponent(l.socketId);a+="&channel_name="+encodeURIComponent(l.channelName);for(var f in i.params)a+="&"+encodeURIComponent(f)+"="+encodeURIComponent(i.params[f]);if(i.paramsProvider!=null){let g=i.paramsProvider();for(var f in g)a+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return a},ck=l=>{if(typeof H.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(i,a)=>{const f=ak(i,l);H.getAuthorizers()[l.transport](H,f,l,x.ChannelAuthorization,a)}},lk=(l,i,a)=>{const f={authTransport:i.transport,authEndpoint:i.endpoint,auth:{params:i.params,headers:i.headers}};return(g,y)=>{const E=l.channel(g.channelName);a(E,f).authorize(g.socketId,y)}};function al(l,i){let a={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:fk(l),httpHost:uk(l),useTLS:hk(l),wsHost:dk(l),userAuthenticator:gk(l),channelAuthorizer:bk(l,i)};return"disabledTransports"in l&&(a.disabledTransports=l.disabledTransports),"enabledTransports"in l&&(a.enabledTransports=l.enabledTransports),"ignoreNullOrigin"in l&&(a.ignoreNullOrigin=l.ignoreNullOrigin),"timelineParams"in l&&(a.timelineParams=l.timelineParams),"nacl"in l&&(a.nacl=l.nacl),a}function uk(l){return l.httpHost?l.httpHost:l.cluster?`sockjs-${l.cluster}.pusher.com`:m.httpHost}function dk(l){return l.wsHost?l.wsHost:pk(l.cluster)}function pk(l){return`ws-${l}.pusher.com`}function hk(l){return H.getProtocol()==="https:"?!0:l.forceTLS!==!1}function fk(l){return"enableStats"in l?l.enableStats:"disableStats"in l?!l.disableStats:!1}const cl=l=>"customHandler"in l&&l.customHandler!=null;function gk(l){const i=Object.assign(Object.assign({},m.userAuthentication),l.userAuthentication);return cl(i)?i.customHandler:sk(i)}function mk(l,i){let a;if("channelAuthorization"in l)a=Object.assign(Object.assign({},m.channelAuthorization),l.channelAuthorization);else if(a={transport:l.authTransport||m.authTransport,endpoint:l.authEndpoint||m.authEndpoint},"auth"in l&&("params"in l.auth&&(a.params=l.auth.params),"headers"in l.auth&&(a.headers=l.auth.headers)),"authorizer"in l)return{customHandler:lk(i,a,l.authorizer)};return a}function bk(l,i){const a=mk(l,i);return cl(a)?a.customHandler:ck(a)}class kk extends bt{constructor(i){super(function(a,f){ce.debug(`No callbacks on watchlist events for ${a}`)}),this.pusher=i,this.bindWatchlistInternalEvent()}handleEvent(i){i.data.events.forEach(a=>{this.emit(a.name,a)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",i=>{var a=i.event;a==="pusher_internal:watchlist_events"&&this.handleEvent(i)})}}function _k(){let l,i;return{promise:new Promise((f,g)=>{l=f,i=g}),resolve:l,reject:i}}const vk=_k;class yk extends bt{constructor(i){super(function(a,f){ce.debug("No callbacks on user for "+a)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(a,f)=>{if(a){ce.warn(`Error during signin: ${a}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:f.auth,user_data:f.user_data})},this.pusher=i,this.pusher.connection.bind("state_change",({previous:a,current:f})=>{a!=="connected"&&f==="connected"&&this._signin(),a==="connected"&&f!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new kk(i),this.pusher.connection.bind("message",a=>{var f=a.event;f==="pusher:signin_success"&&this._onSigninSuccess(a.data),this.serverToUserChannel&&this.serverToUserChannel.name===a.channel&&this.serverToUserChannel.handleEvent(a)})}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(i){try{this.user_data=JSON.parse(i.user_data)}catch{ce.error(`Failed parsing user data after signin: ${i.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){ce.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const i=a=>{a.subscriptionPending&&a.subscriptionCancelled?a.reinstateSubscription():!a.subscriptionPending&&this.pusher.connection.state==="connected"&&a.subscribe()};this.serverToUserChannel=new L(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((a,f)=>{a.indexOf("pusher_internal:")===0||a.indexOf("pusher:")===0||this.emit(a,f)}),i(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:i,resolve:a}=vk();i.done=!1;const f=()=>{i.done=!0};i.then(f).catch(f),this.signinDonePromise=i,this._signinDoneResolve=a}}class Oe{static ready(){Oe.isReady=!0;for(var i=0,a=Oe.instances.length;i<a;i++)Oe.instances[i].connect()}static getClientFeatures(){return wn(Sn({ws:H.Transports.ws},function(i){return i.isSupported({})}))}constructor(i,a){wk(i),ok(a),this.key=i,this.options=a,this.config=al(this.options,this),this.channels=Ht.createChannels(),this.global_emitter=new bt,this.sessionID=H.randomInt(1e9),this.timeline=new Qb(this.key,this.sessionID,{cluster:this.config.cluster,features:Oe.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:Qo.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=Ht.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+H.TimelineTransport.name}));var f=g=>H.getDefaultStrategy(this.config,g,nk);this.connection=Ht.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",g=>{var y=g.event,E=y.indexOf("pusher_internal:")===0;if(g.channel){var $=this.channel(g.channel);$&&$.handleEvent(g)}E||this.global_emitter.emit(g.event,g.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",g=>{ce.warn(g)}),Oe.instances.push(this),this.timeline.info({instances:Oe.instances.length}),this.user=new yk(this),Oe.isReady&&this.connect()}switchCluster(i){const{appKey:a,cluster:f}=i;this.key=a,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=al(this.options,this),this.connection.switchCluster(this.key)}channel(i){return this.channels.find(i)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var i=this.connection.isUsingTLS(),a=this.timelineSender;this.timelineSenderTimer=new yn(6e4,function(){a.send(i)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(i,a,f){return this.global_emitter.bind(i,a,f),this}unbind(i,a,f){return this.global_emitter.unbind(i,a,f),this}bind_global(i){return this.global_emitter.bind_global(i),this}unbind_global(i){return this.global_emitter.unbind_global(i),this}unbind_all(i){return this.global_emitter.unbind_all(),this}subscribeAll(){var i;for(i in this.channels.channels)this.channels.channels.hasOwnProperty(i)&&this.subscribe(i)}subscribe(i){var a=this.channels.add(i,this);return a.subscriptionPending&&a.subscriptionCancelled?a.reinstateSubscription():!a.subscriptionPending&&this.connection.state==="connected"&&a.subscribe(),a}unsubscribe(i){var a=this.channels.find(i);a&&a.subscriptionPending?a.cancelSubscription():(a=this.channels.remove(i),a&&a.subscribed&&a.unsubscribe())}send_event(i,a,f){return this.connection.send_event(i,a,f)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}Oe.instances=[],Oe.isReady=!1,Oe.logToConsole=!1,Oe.Runtime=H,Oe.ScriptReceivers=H.ScriptReceivers,Oe.DependenciesReceivers=H.DependenciesReceivers,Oe.auth_callbacks=H.auth_callbacks;const ei=Oe;function wk(l){if(l==null)throw"You must pass your app key when you instantiate Pusher."}H.setup(Oe)}},r={};function o(c){var u=r[c];if(u!==void 0)return u.exports;var d=r[c]={exports:{}};return n[c].call(d.exports,d,d.exports,o),d.exports}o.d=(c,u)=>{for(var d in u)o.o(u,d)&&!o.o(c,d)&&Object.defineProperty(c,d,{enumerable:!0,get:u[d]})},o.o=(c,u)=>Object.prototype.hasOwnProperty.call(c,u);var s=o(721);return s})())})(Pa);var Mf=Pa.exports;const Uf=Df(Mf),co={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"};let dt=null,jn=null;async function jf(e){return jn||(jn=(async()=>{const t=e.backendUrl.replace(/\/+$/,""),n=await fetch(`${t}/api/settings`,{headers:{Authorization:`Bearer ${e.token}`}});if(!n.ok)throw new Error(`Failed to fetch settings: HTTP ${n.status}`);const r=await n.json();dt=new Uf(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:s},c)=>{fetch(`${t}/api/pusher/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({socket_id:o,channel_name:s})}).then(u=>u.json()).then(u=>c(null,u)).catch(u=>c(u instanceof Error?u:new Error(String(u)),null))}}})})(),jn.catch(()=>{jn=null}),jn)}function Zf(e){if(!e||!dt)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return dt.connection.bind("state_change",n),()=>dt==null?void 0:dt.connection.unbind("state_change",n)}async function qf(e,t,n){if(await jf(e),!dt)return()=>{};const r=dt.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(co.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(co.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(co.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(co.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=Zf(n.onReconnect);return()=>{r.unbind_all(),dt==null||dt.unsubscribe(`private-task-${t}`),o==null||o()}}const ki="ap-sdk-active-automation";function Hf(){try{const e=sessionStorage.getItem(ki);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{return null}}function Ra(e){try{sessionStorage.setItem(ki,JSON.stringify(e))}catch{}}function La(){try{sessionStorage.removeItem(ki)}catch{}}async function Ff(e){var s;try{(s=e.focus)==null||s.call(e)}catch{}e.scrollIntoView({block:"center",inline:"center",behavior:"instant"});let t=e.getBoundingClientRect();t.width===0&&t.height===0&&(await Bf(),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 Bf(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const _i="shared",za="ap-sdk-panel-size:",Ia=280,$a=200;function Gf(e){try{const t=sessionStorage.getItem(za+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{return null}}function Wf(e,t){try{sessionStorage.setItem(za+e,JSON.stringify(t))}catch{}}function lo(e,t,n){return Math.min(Math.max(e,t),n)}function Na(){return window.innerWidth-32}function Oa(){return window.innerHeight-64}function vi(e,t){const n=Gf(t);n&&(e.style.width=`${lo(n.width,Ia,Na())}px`,e.style.height=`${lo(n.height,$a,Oa())}px`);const r=document.createElement("div");r.className="ap-sdk-resize-handle",r.setAttribute("data-ap-sdk","1"),e.appendChild(r);let o=!1,s=0,c=0,u=0,d=0,p=0,h=0;const b=_=>{o&&(p=lo(u+(_.clientX-s),Ia,Na()),h=lo(d+(_.clientY-c),$a,Oa()),e.style.width=`${p}px`,e.style.height=`${h}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",b),document.removeEventListener("pointerup",m),Wf(t,{width:p,height:h}))};r.addEventListener("pointerdown",_=>{_.preventDefault(),_.stopPropagation(),o=!0,s=_.clientX,c=_.clientY;const w=e.getBoundingClientRect();u=w.width,d=w.height,p=u,h=d,document.addEventListener("pointermove",b),document.addEventListener("pointerup",m)})}function yi(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var un=yi();function Da(e){un=e}var dn={exec:()=>null};function Zn(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 G(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(o,s)=>{let c=typeof s=="string"?s:s.source;return c=c.replace(Me.caret,"$1"),n=n.replace(o,c),r},getRegex:()=>new RegExp(n,t)};return r}var Jf=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),Me={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:Zn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Zn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Zn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Zn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Zn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Zn(e=>new RegExp(`^ {0,${e}}>`))},Xf=/^(?:[ \t]*(?:\n|$))+/,Vf=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Yf=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,fr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Kf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,wi=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Ma=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Ua=G(Ma).replace(/bull/g,wi).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(),Qf=G(Ma).replace(/bull/g,wi).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(),xi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,eg=/^[^\n]+/,Si=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,tg=G(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Si).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ng=G(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,wi).getRegex(),uo="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",Ti=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,rg=G("^ {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",Ti).replace("tag",uo).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ja=e=>G(xi).replace("hr",fr).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",uo).getRegex(),og=ja(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),ig=ja(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),sg=G(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ig).getRegex(),Ei={blockquote:sg,code:Vf,def:tg,fences:Yf,heading:Kf,hr:fr,html:rg,lheading:Ua,list:ng,newline:Xf,paragraph:og,table:dn,text:eg},Za=G("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",fr).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",uo).getRegex(),ag={...Ei,lheading:Qf,table:Za,paragraph:G(xi).replace("hr",fr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Za).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",uo).getRegex()},cg={...Ei,html:G(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ti).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:dn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:G(xi).replace("hr",fr).replace("heading",` *#{1,6} *[^
1376
+ ]`).replace("lheading",Ua).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},lg=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ug=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,qa=/^( {2,}|\\)\n(?!\s*$)/,dg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,It=/[\p{P}\p{S}]/u,qn=/[\s\p{P}\p{S}]/u,gr=/[^\s\p{P}\p{S}]/u,pg=G(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,qn).getRegex(),hg=/[\p{Pi}\p{Ps}"']/u,Ha=/(?!~)[\p{P}\p{S}]/u,fg=/(?!~)[\s\p{P}\p{S}]/u,gg=/(?:[^\s\p{P}\p{S}]|~)/u,mg=G(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Jf?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Fa=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,bg=G(Fa,"u").replace(/punct/g,It).getRegex(),kg=G(Fa,"u").replace(/punct/g,Ha).getRegex(),_g=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,vg=G(_g,"u").replace(/openQuote/g,hg).replace(/punct/g,It).getRegex(),Ba="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",yg=G(Ba,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,qn).replace(/punct/g,It).getRegex(),wg=G(Ba,"gu").replace(/notPunctSpace/g,gg).replace(/punctSpace/g,fg).replace(/punct/g,Ha).getRegex(),xg="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Sg=G(xg,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,qn).replace(/punct/g,It).getRegex(),Tg=G("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,qn).replace(/punct/g,It).getRegex(),Eg="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Ag=G(Eg,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,qn).replace(/punct/g,It).getRegex(),Cg=G(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,It).getRegex(),Pg="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Rg=G(Pg,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,qn).replace(/punct/g,It).getRegex(),Lg=G(/\\(punct)/,"gu").replace(/punct/g,It).getRegex(),zg=G(/^<(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(),Ig=G(Ti).replace("(?:-->|$)","-->").getRegex(),$g=G("^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",Ig).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),po=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Ng=G(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",po).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ga=G(/^!?\[(label)\]\[(ref)\]/).replace("label",po).replace("ref",Si).getRegex(),Wa=G(/^!?\[(ref)\](?:\[\])?/).replace("ref",Si).getRegex(),Og=G("reflink|nolink(?!\\()","g").replace("reflink",Ga).replace("nolink",Wa).getRegex(),Ja=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ai={_backpedal:dn,anyPunctuation:Lg,autolink:zg,blockSkip:mg,br:qa,code:ug,del:dn,delLDelim:dn,delRDelim:dn,emStrongLDelim:bg,emStrongRDelimAst:yg,emStrongRDelimUnd:Tg,escape:lg,link:Ng,nolink:Wa,punctuation:pg,reflink:Ga,reflinkSearch:Og,tag:$g,text:dg,url:dn},Dg={...Ai,emStrongLDelim:vg,emStrongRDelimAst:Sg,emStrongRDelimUnd:Ag,link:G(/^!?\[(label)\]\((.*?)\)/).replace("label",po).getRegex(),reflink:G(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",po).getRegex()},Ci={...Ai,emStrongRDelimAst:wg,emStrongLDelim:kg,delLDelim:Cg,delRDelim:Rg,url:G(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ja).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:G(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ja).getRegex()},Mg={...Ci,br:G(qa).replace("{2,}","*").getRegex(),text:G(Ci.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ho={normal:Ei,gfm:ag,pedantic:cg},mr={normal:Ai,gfm:Ci,breaks:Mg,pedantic:Dg},Ug={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Xa=e=>Ug[e];function xt(e,t){if(t){if(Me.escapeTest.test(e))return e.replace(Me.escapeReplace,Xa)}else if(Me.escapeTestNoEncode.test(e))return e.replace(Me.escapeReplaceNoEncode,Xa);return e}function Va(e){try{e=encodeURI(e).replace(Me.percentDecode,"%")}catch{return null}return e}function Ya(e,t){var s;let n=e.replace(Me.findPipe,(c,u,d)=>{let p=!1,h=u;for(;--h>=0&&d[h]==="\\";)p=!p;return p?"|":" |"}),r=n.split(Me.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!((s=r.at(-1))!=null&&s.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(Me.slashPipe,"|");return r}function Xt(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 Ka(e){let t=e.split(`
1377
+ `),n=t.length-1;for(;n>=0&&Me.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
1378
+ `)}function jg(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 Zg(e,t=0){let n=t,r="";for(let o of e)if(o===" "){let s=4-n%4;r+=" ".repeat(s),n+=s}else r+=o,n++;return r}function Qa(e,t,n,r,o){let s=t.href,c=t.title||null,u=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let d={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:c,text:u,tokens:r.inlineTokens(u)};return r.state.inLink=!1,d}function qg(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
1235
1379
  `).map(s=>{let c=s.match(n.other.beginningSpace);if(c===null)return s;let[u]=c;return u.length>=o.length?s.slice(o.length):s}).join(`
1236
- `)}var Kr=class{constructor(e){ie(this,"options");ie(this,"rules");ie(this,"lexer");this.options=e||nn}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]:Pa(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=bg(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=qt(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:qt(t[0],`
1237
- `),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:qt(t[0],`
1238
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=qt(t[0],`
1380
+ `)}var fo=class{constructor(e){ie(this,"options");ie(this,"rules");ie(this,"lexer");this.options=e||un}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]:Ka(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=qg(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=Xt(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:Xt(t[0],`
1381
+ `),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:Xt(t[0],`
1382
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Xt(t[0],`
1239
1383
  `).split(`
1240
1384
  `),r="",o="",s=[];for(;n.length>0;){let c=!1,u=[],d;for(d=0;d<n.length;d++)if(this.rules.other.blockquoteStart.test(n[d]))u.push(n[d]),c=!0;else if(!c)u.push(n[d]);else break;n=n.slice(d);let p=u.join(`
1241
1385
  `),h=p.replace(this.rules.other.blockquoteSetextReplace,`
1242
1386
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
1243
1387
  ${p}`:p,o=o?`${o}
1244
- ${h}`:h;let k=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,s,!0),this.lexer.state.top=k,n.length===0)break;let m=s.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){let _=m,w=n.join(`
1388
+ ${h}`:h;let b=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,s,!0),this.lexer.state.top=b,n.length===0)break;let m=s.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){let _=m,w=n.join(`
1245
1389
  `),P=_.raw+`
1246
1390
  `+w.replace(this.rules.other.blockquoteSetextReplace2,""),N=this.blockquote(P);s[s.length-1]=N,r=`${r}
1247
1391
  ${w}`,o=o.substring(0,o.length-_.text.length)+N.text;break}else if((m==null?void 0:m.type)==="list"){let _=m,w=_.raw+`
1248
1392
  `+n.join(`
1249
1393
  `),P=this.list(w);s[s.length-1]=P,r=r.substring(0,r.length-m.raw.length)+P.raw,o=o.substring(0,o.length-_.raw.length)+P.raw,n=w.substring(s.at(-1).raw.length).split(`
1250
- `);continue}}return{type:"blockquote",raw:r,tokens:s,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 s=this.rules.other.listItemRegex(n),c=!1;for(;e;){let d=!1,p="",h="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let k=mg(t[2].split(`
1394
+ `);continue}}return{type:"blockquote",raw:r,tokens:s,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 s=this.rules.other.listItemRegex(n),c=!1;for(;e;){let d=!1,p="",h="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let b=Zg(t[2].split(`
1251
1395
  `,1)[0],t[1].length),m=e.split(`
1252
- `,1)[0],_=!k.trim(),w=0;if(this.options.pedantic?(w=2,h=k.trimStart()):_?w=t[1].length+1:(w=k.search(this.rules.other.nonSpaceChar),w=w>4?1:w,h=k.slice(w),w+=t[1].length),_&&this.rules.other.blankLine.test(m)&&(p+=m+`
1396
+ `,1)[0],_=!b.trim(),w=0;if(this.options.pedantic?(w=2,h=b.trimStart()):_?w=t[1].length+1:(w=b.search(this.rules.other.nonSpaceChar),w=w>4?1:w,h=b.slice(w),w+=t[1].length),_&&this.rules.other.blankLine.test(m)&&(p+=m+`
1253
1397
  `,e=e.substring(m.length+1),d=!0),!d){let P=this.rules.other.nextBulletRegex(w),N=this.rules.other.hrRegex(w),re=this.rules.other.fencesBeginRegex(w),R=this.rules.other.headingBeginRegex(w),x=this.rules.other.htmlBeginRegex(w),S=this.rules.other.blockquoteBeginRegex(w);for(;e;){let C=e.split(`
1254
1398
  `,1)[0],M;if(m=C,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),M=m):M=m.replace(this.rules.other.tabCharGlobal," "),re.test(m)||R.test(m)||x.test(m)||S.test(m)||P.test(m)||N.test(m))break;if(M.search(this.rules.other.nonSpaceChar)>=w||!m.trim())h+=`
1255
- `+M.slice(w);else{if(_||k.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||re.test(k)||R.test(k)||N.test(k))break;h+=`
1399
+ `+M.slice(w);else{if(_||b.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||re.test(b)||R.test(b)||N.test(b))break;h+=`
1256
1400
  `+m}_=!m.trim(),p+=C+`
1257
- `,e=e.substring(C.length+1),k=M.slice(w)}}o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(c=!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 u=o.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let d of o.items){this.lexer.state.top=!1,d.tokens=this.lexer.blockTokens(d.text,[]);let p=d.tokens[0];if(d.task&&((p==null?void 0:p.type)==="text"||(p==null?void 0:p.type)==="paragraph")){d.text=d.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 k=this.lexer.inlineQueue.length-1;k>=0;k--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[k].src)){this.lexer.inlineQueue[k].src=this.lexer.inlineQueue[k].src.replace(this.rules.other.listReplaceTask,"");break}let h=this.rules.other.listTaskCheckbox.exec(d.raw);if(h){let k={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};d.checked=k.checked,o.loose?d.tokens[0]&&["paragraph","text"].includes(d.tokens[0].type)&&"tokens"in d.tokens[0]&&d.tokens[0].tokens?(d.tokens[0].raw=k.raw+d.tokens[0].raw,d.tokens[0].text=k.raw+d.tokens[0].text,d.tokens[0].tokens.unshift(k)):d.tokens.unshift({type:"paragraph",raw:k.raw,text:k.raw,tokens:[k]}):d.tokens.unshift(k)}}else d.task&&(d.task=!1);if(!o.loose){let h=d.tokens.filter(m=>m.type==="space"),k=h.length>0&&h.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=k}}if(o.loose)for(let d of o.items){d.loose=!0;for(let p of d.tokens)p.type==="text"&&(p.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=Pa(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:qt(t[0],`
1258
- `),href:r,title:o}}}table(e){var c;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Ca(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(c=t[3])!=null&&c.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
1259
- `):[],s={type:"table",raw:qt(t[0],`
1260
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let u of r)this.rules.other.tableAlignRight.test(u)?s.align.push("right"):this.rules.other.tableAlignCenter.test(u)?s.align.push("center"):this.rules.other.tableAlignLeft.test(u)?s.align.push("left"):s.align.push(null);for(let u=0;u<n.length;u++)s.header.push({text:n[u],tokens:this.lexer.inline(n[u]),header:!0,align:s.align[u]});for(let u of o)s.rows.push(Ca(u,s.header.length).map((d,p)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:s.align[p]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:qt(t[0],`
1401
+ `,e=e.substring(C.length+1),b=M.slice(w)}}o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(c=!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 u=o.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let d of o.items){this.lexer.state.top=!1,d.tokens=this.lexer.blockTokens(d.text,[]);let p=d.tokens[0];if(d.task&&((p==null?void 0:p.type)==="text"||(p==null?void 0:p.type)==="paragraph")){d.text=d.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 b=this.lexer.inlineQueue.length-1;b>=0;b--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[b].src)){this.lexer.inlineQueue[b].src=this.lexer.inlineQueue[b].src.replace(this.rules.other.listReplaceTask,"");break}let h=this.rules.other.listTaskCheckbox.exec(d.raw);if(h){let b={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};d.checked=b.checked,o.loose?d.tokens[0]&&["paragraph","text"].includes(d.tokens[0].type)&&"tokens"in d.tokens[0]&&d.tokens[0].tokens?(d.tokens[0].raw=b.raw+d.tokens[0].raw,d.tokens[0].text=b.raw+d.tokens[0].text,d.tokens[0].tokens.unshift(b)):d.tokens.unshift({type:"paragraph",raw:b.raw,text:b.raw,tokens:[b]}):d.tokens.unshift(b)}}else d.task&&(d.task=!1);if(!o.loose){let h=d.tokens.filter(m=>m.type==="space"),b=h.length>0&&h.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=b}}if(o.loose)for(let d of o.items){d.loose=!0;for(let p of d.tokens)p.type==="text"&&(p.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=Ka(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:Xt(t[0],`
1402
+ `),href:r,title:o}}}table(e){var c;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Ya(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(c=t[3])!=null&&c.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
1403
+ `):[],s={type:"table",raw:Xt(t[0],`
1404
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let u of r)this.rules.other.tableAlignRight.test(u)?s.align.push("right"):this.rules.other.tableAlignCenter.test(u)?s.align.push("center"):this.rules.other.tableAlignLeft.test(u)?s.align.push("left"):s.align.push(null);for(let u=0;u<n.length;u++)s.header.push({text:n[u],tokens:this.lexer.inline(n[u]),header:!0,align:s.align[u]});for(let u of o)s.rows.push(Ya(u,s.header.length).map((d,p)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:s.align[p]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:Xt(t[0],`
1261
1405
  `),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)===`
1262
- `?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 s=qt(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=gg(t[2],"()");if(s===-2)return;if(s>-1){let c=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,c).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],o=s[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)),Ra(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 s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return Ra(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,s,c,u=o,d=0,p=r[0][0],h=n===p,k=p==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(k.lastIndex=0,t=t.slice(-1*e.length+o);(r=k.exec(t))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(c=[...s].length,r[3]||r[4]){u+=c;continue}else if(r[5]||r[6]){if(o%3&&!((o+c)%3)){d+=c;continue}if(h)break}if(u-=c,u>0)continue;c=Math.min(c,c+u+d);let m=[...r[0]][0].length,_=e.slice(0,o+r.index+m+c);if(Math.min(o,c)%2){let P=_.slice(1,-1);return{type:"em",raw:_,text:P,tokens:this.lexer.inlineTokens(P)}}let w=_.slice(2,-2);return{type:"strong",raw:_,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,s,c,u=o,d=this.rules.inline.delRDelim;for(d.lastIndex=0,t=t.slice(-1*e.length+o);(r=d.exec(t))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(c=[...s].length,c!==o))continue;if(r[3]||r[4]){u+=c;continue}if(u-=c,u>0)continue;c=Math.min(c,c+u);let p=[...r[0]][0].length,h=e.slice(0,o+r.index+p+c),k=h.slice(o,-o);return{type:"del",raw:h,text:k,tokens:this.lexer.inlineTokens(k)}}}}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;let t;if(t=this.rules.inline.url.exec(e)){let r,o;if(t[2]==="@")r=t[0],o="mailto:"+r;else{let s;do s=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(s!==t[0]);r=t[0],t[1]==="www."?o="http://"+t[0]:o=t[0]}return{type:"link",raw:t[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}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}}}},ut=class Hi{constructor(t){ie(this,"tokens");ie(this,"options");ie(this,"state");ie(this,"inlineQueue");ie(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||nn,this.options.tokenizer=this.options.tokenizer||new Kr,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:Ne,block:Yr.normal,inline:tr.normal};this.options.pedantic?(n.block=Yr.pedantic,n.inline=tr.pedantic):this.options.gfm&&(n.block=Yr.gfm,this.options.breaks?n.inline=tr.breaks:n.inline=tr.gfm),this.tokenizer.rules=n}static get rules(){return{block:Yr,inline:tr}}static lex(t,n){return new Hi(n).lex(t)}static lexInline(t,n){return new Hi(n).inlineTokens(t)}lex(t){t=t.replace(Ne.carriageReturn,`
1263
- `),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 s,c,u;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(Ne.tabCharGlobal," ").replace(Ne.spaceLine,""));let o=1/0;for(;t;){if(t.length<o)o=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let d;if((c=(s=this.options.extensions)==null?void 0:s.block)!=null&&c.some(h=>(d=h.call({lexer:this},t,n))?(t=t.substring(d.raw.length),n.push(d),!0):!1))continue;if(d=this.tokenizer.space(t)){t=t.substring(d.raw.length);let h=n.at(-1);d.raw.length===1&&h!==void 0?h.raw+=`
1406
+ `?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 s=Xt(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=jg(t[2],"()");if(s===-2)return;if(s>-1){let c=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,c).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],o=s[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)),Qa(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 s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return Qa(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,s,c,u=o,d=0,p=r[0][0],h=n===p,b=p==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(b.lastIndex=0,t=t.slice(-1*e.length+o);(r=b.exec(t))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(c=[...s].length,r[3]||r[4]){u+=c;continue}else if(r[5]||r[6]){if(o%3&&!((o+c)%3)){d+=c;continue}if(h)break}if(u-=c,u>0)continue;c=Math.min(c,c+u+d);let m=[...r[0]][0].length,_=e.slice(0,o+r.index+m+c);if(Math.min(o,c)%2){let P=_.slice(1,-1);return{type:"em",raw:_,text:P,tokens:this.lexer.inlineTokens(P)}}let w=_.slice(2,-2);return{type:"strong",raw:_,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,s,c,u=o,d=this.rules.inline.delRDelim;for(d.lastIndex=0,t=t.slice(-1*e.length+o);(r=d.exec(t))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(c=[...s].length,c!==o))continue;if(r[3]||r[4]){u+=c;continue}if(u-=c,u>0)continue;c=Math.min(c,c+u);let p=[...r[0]][0].length,h=e.slice(0,o+r.index+p+c),b=h.slice(o,-o);return{type:"del",raw:h,text:b,tokens:this.lexer.inlineTokens(b)}}}}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;let t;if(t=this.rules.inline.url.exec(e)){let r,o;if(t[2]==="@")r=t[0],o="mailto:"+r;else{let s;do s=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(s!==t[0]);r=t[0],t[1]==="www."?o="http://"+t[0]:o=t[0]}return{type:"link",raw:t[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}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}}}},pt=class ds{constructor(t){ie(this,"tokens");ie(this,"options");ie(this,"state");ie(this,"inlineQueue");ie(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||un,this.options.tokenizer=this.options.tokenizer||new fo,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:Me,block:ho.normal,inline:mr.normal};this.options.pedantic?(n.block=ho.pedantic,n.inline=mr.pedantic):this.options.gfm&&(n.block=ho.gfm,this.options.breaks?n.inline=mr.breaks:n.inline=mr.gfm),this.tokenizer.rules=n}static get rules(){return{block:ho,inline:mr}}static lex(t,n){return new ds(n).lex(t)}static lexInline(t,n){return new ds(n).inlineTokens(t)}lex(t){t=t.replace(Me.carriageReturn,`
1407
+ `),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 s,c,u;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(Me.tabCharGlobal," ").replace(Me.spaceLine,""));let o=1/0;for(;t;){if(t.length<o)o=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let d;if((c=(s=this.options.extensions)==null?void 0:s.block)!=null&&c.some(h=>(d=h.call({lexer:this},t,n))?(t=t.substring(d.raw.length),n.push(d),!0):!1))continue;if(d=this.tokenizer.space(t)){t=t.substring(d.raw.length);let h=n.at(-1);d.raw.length===1&&h!==void 0?h.raw+=`
1264
1408
  `:n.push(d);continue}if(d=this.tokenizer.code(t)){t=t.substring(d.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(`
1265
1409
  `)?"":`
1266
1410
  `)+d.raw,h.text+=`
1267
1411
  `+d.text,this.inlineQueue.at(-1).src=h.text):n.push(d);continue}if(d=this.tokenizer.fences(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.heading(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.hr(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.blockquote(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.list(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.html(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.def(t)){t=t.substring(d.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(`
1268
1412
  `)?"":`
1269
1413
  `)+d.raw,h.text+=`
1270
- `+d.raw,this.inlineQueue.at(-1).src=h.text):this.tokens.links[d.tag]||(this.tokens.links[d.tag]={href:d.href,title:d.title},n.push(d));continue}if(d=this.tokenizer.table(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.lheading(t)){t=t.substring(d.raw.length),n.push(d);continue}let p=t;if((u=this.options.extensions)!=null&&u.startBlock){let h=1/0,k=t.slice(1),m;this.options.extensions.startBlock.forEach(_=>{m=_.call({lexer:this},k),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&&(d=this.tokenizer.paragraph(p))){let h=n.at(-1);r&&(h==null?void 0:h.type)==="paragraph"?(h.raw+=(h.raw.endsWith(`
1414
+ `+d.raw,this.inlineQueue.at(-1).src=h.text):this.tokens.links[d.tag]||(this.tokens.links[d.tag]={href:d.href,title:d.title},n.push(d));continue}if(d=this.tokenizer.table(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.lheading(t)){t=t.substring(d.raw.length),n.push(d);continue}let p=t;if((u=this.options.extensions)!=null&&u.startBlock){let h=1/0,b=t.slice(1),m;this.options.extensions.startBlock.forEach(_=>{m=_.call({lexer:this},b),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&&(d=this.tokenizer.paragraph(p))){let h=n.at(-1);r&&(h==null?void 0:h.type)==="paragraph"?(h.raw+=(h.raw.endsWith(`
1271
1415
  `)?"":`
1272
1416
  `)+d.raw,h.text+=`
1273
1417
  `+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(d),r=p.length!==t.length,t=t.substring(d.raw.length);continue}if(d=this.tokenizer.text(t)){t=t.substring(d.raw.length);let h=n.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
1274
1418
  `)?"":`
1275
1419
  `)+d.raw,h.text+=`
1276
- `+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(d);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 u,d,p,h,k;this.tokenizer.lexer=this;let r=t;if(this.tokens.links){let m=Object.keys(this.tokens.links);m.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,_=>m.includes(_.slice(_.lastIndexOf("[")+1,-1))?"["+"a".repeat(_.length-2)+"]":_))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(m,_,w)=>{let P=w?w.length:0;return m.slice(0,P)+"["+"a".repeat(m.length-P-2)+"]"}),r=((d=(u=this.options.hooks)==null?void 0:u.emStrongMask)==null?void 0:d.call({lexer:this},r))??r;let o=!1,s="",c=1/0;for(;t;){if(t.length<c)c=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}o||(s=""),o=!1;let m;if((h=(p=this.options.extensions)==null?void 0:p.inline)!=null&&h.some(w=>(m=w.call({lexer:this},t,n))?(t=t.substring(m.raw.length),n.push(m),!0):!1))continue;if(m=this.tokenizer.escape(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.tag(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.link(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(m.raw.length);let w=n.at(-1);m.type==="text"&&(w==null?void 0:w.type)==="text"?(w.raw+=m.raw,w.text+=m.text):n.push(m);continue}if(m=this.tokenizer.emStrong(t,r,s)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.codespan(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.br(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.del(t,r,s)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.autolink(t)){t=t.substring(m.raw.length),n.push(m);continue}if(!this.state.inLink&&(m=this.tokenizer.url(t))){t=t.substring(m.raw.length),n.push(m);continue}let _=t;if((k=this.options.extensions)!=null&&k.startInline){let w=1/0,P=t.slice(1),N;this.options.extensions.startInline.forEach(re=>{N=re.call({lexer:this},P),typeof N=="number"&&N>=0&&(w=Math.min(w,N))}),w<1/0&&w>=0&&(_=t.substring(0,w+1))}if(m=this.tokenizer.inlineText(_)){t=t.substring(m.raw.length),m.raw.slice(-1)!=="_"&&(s=m.raw.slice(-1)),o=!0;let w=n.at(-1);(w==null?void 0:w.type)==="text"?(w.raw+=m.raw,w.text+=m.text):n.push(m);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)}},Qr=class{constructor(e){ie(this,"options");ie(this,"parser");this.options=e||nn}space(e){return""}code({text:e,lang:t,escaped:n}){var s;let r=(s=(t||"").match(Ne.notSpaceStart))==null?void 0:s[0],o=e.replace(Ne.endingNewline,"")+`
1277
- `;return r?'<pre><code class="language-'+yt(r)+'">'+(n?o:yt(o,!0))+`</code></pre>
1278
- `:"<pre><code>"+(n?o:yt(o,!0))+`</code></pre>
1420
+ `+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(d);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 u,d,p,h,b;this.tokenizer.lexer=this;let r=t;if(this.tokens.links){let m=Object.keys(this.tokens.links);m.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,_=>m.includes(_.slice(_.lastIndexOf("[")+1,-1))?"["+"a".repeat(_.length-2)+"]":_))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(m,_,w)=>{let P=w?w.length:0;return m.slice(0,P)+"["+"a".repeat(m.length-P-2)+"]"}),r=((d=(u=this.options.hooks)==null?void 0:u.emStrongMask)==null?void 0:d.call({lexer:this},r))??r;let o=!1,s="",c=1/0;for(;t;){if(t.length<c)c=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}o||(s=""),o=!1;let m;if((h=(p=this.options.extensions)==null?void 0:p.inline)!=null&&h.some(w=>(m=w.call({lexer:this},t,n))?(t=t.substring(m.raw.length),n.push(m),!0):!1))continue;if(m=this.tokenizer.escape(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.tag(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.link(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(m.raw.length);let w=n.at(-1);m.type==="text"&&(w==null?void 0:w.type)==="text"?(w.raw+=m.raw,w.text+=m.text):n.push(m);continue}if(m=this.tokenizer.emStrong(t,r,s)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.codespan(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.br(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.del(t,r,s)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.autolink(t)){t=t.substring(m.raw.length),n.push(m);continue}if(!this.state.inLink&&(m=this.tokenizer.url(t))){t=t.substring(m.raw.length),n.push(m);continue}let _=t;if((b=this.options.extensions)!=null&&b.startInline){let w=1/0,P=t.slice(1),N;this.options.extensions.startInline.forEach(re=>{N=re.call({lexer:this},P),typeof N=="number"&&N>=0&&(w=Math.min(w,N))}),w<1/0&&w>=0&&(_=t.substring(0,w+1))}if(m=this.tokenizer.inlineText(_)){t=t.substring(m.raw.length),m.raw.slice(-1)!=="_"&&(s=m.raw.slice(-1)),o=!0;let w=n.at(-1);(w==null?void 0:w.type)==="text"?(w.raw+=m.raw,w.text+=m.text):n.push(m);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)}},go=class{constructor(e){ie(this,"options");ie(this,"parser");this.options=e||un}space(e){return""}code({text:e,lang:t,escaped:n}){var s;let r=(s=(t||"").match(Me.notSpaceStart))==null?void 0:s[0],o=e.replace(Me.endingNewline,"")+`
1421
+ `;return r?'<pre><code class="language-'+xt(r)+'">'+(n?o:xt(o,!0))+`</code></pre>
1422
+ `:"<pre><code>"+(n?o:xt(o,!0))+`</code></pre>
1279
1423
  `}blockquote({tokens:e}){return`<blockquote>
1280
1424
  ${this.parser.parse(e)}</blockquote>
1281
1425
  `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
@@ -1291,9 +1435,9 @@ ${this.parser.parse(e)}</blockquote>
1291
1435
  `}tablerow({text:e}){return`<tr>
1292
1436
  ${e}</tr>
1293
1437
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
1294
- `}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>${yt(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=Aa(e);if(o===null)return r;e=o;let s='<a href="'+e+'"';return t&&(s+=' title="'+yt(t)+'"'),s+=">"+r+"</a>",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let o=Aa(e);if(o===null)return yt(n);e=o;let s=`<img src="${e}" alt="${yt(n)}"`;return t&&(s+=` title="${yt(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:yt(e.text)}},ui=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}},dt=class Bi{constructor(t){ie(this,"options");ie(this,"renderer");ie(this,"textRenderer");this.options=t||nn,this.options.renderer=this.options.renderer||new Qr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ui}static parse(t,n){return new Bi(n).parse(t)}static parseInline(t,n){return new Bi(n).parseInline(t)}parse(t){var r,o;this.renderer.parser=this;let n="";for(let s=0;s<t.length;s++){let c=t[s];if((o=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&o[c.type]){let d=c,p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(d.type)){n+=p||"";continue}}let u=c;switch(u.type){case"space":{n+=this.renderer.space(u);break}case"hr":{n+=this.renderer.hr(u);break}case"heading":{n+=this.renderer.heading(u);break}case"code":{n+=this.renderer.code(u);break}case"table":{n+=this.renderer.table(u);break}case"blockquote":{n+=this.renderer.blockquote(u);break}case"list":{n+=this.renderer.list(u);break}case"checkbox":{n+=this.renderer.checkbox(u);break}case"html":{n+=this.renderer.html(u);break}case"def":{n+=this.renderer.def(u);break}case"paragraph":{n+=this.renderer.paragraph(u);break}case"text":{n+=this.renderer.text(u);break}default:{let d='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return n}parseInline(t,n=this.renderer){var o,s;this.renderer.parser=this;let r="";for(let c=0;c<t.length;c++){let u=t[c];if((s=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&s[u.type]){let p=this.options.extensions.renderers[u.type].call({parser:this},u);if(p!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(u.type)){r+=p||"";continue}}let d=u;switch(d.type){case"escape":{r+=n.text(d);break}case"html":{r+=n.html(d);break}case"link":{r+=n.link(d);break}case"image":{r+=n.image(d);break}case"checkbox":{r+=n.checkbox(d);break}case"strong":{r+=n.strong(d);break}case"em":{r+=n.em(d);break}case"codespan":{r+=n.codespan(d);break}case"br":{r+=n.br(d);break}case"del":{r+=n.del(d);break}case"text":{r+=n.text(d);break}default:{let p='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return r}},nr=(_o=class{constructor(e){ie(this,"options");ie(this,"block");this.options=e||nn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?ut.lex:ut.lexInline}provideParser(e=this.block){return e?dt.parse:dt.parseInline}},ie(_o,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ie(_o,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),_o),kg=class{constructor(...e){ie(this,"defaults",ni());ie(this,"options",this.setOptions);ie(this,"parse",this.parseMarkdown(!0));ie(this,"parseInline",this.parseMarkdown(!1));ie(this,"Parser",dt);ie(this,"Renderer",Qr);ie(this,"TextRenderer",ui);ie(this,"Lexer",ut);ie(this,"Tokenizer",Kr);ie(this,"Hooks",nr);this.use(...e)}walkTokens(e,t){var r,o;let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let c=s;for(let u of c.header)n=n.concat(this.walkTokens(u.tokens,t));for(let u of c.rows)for(let d of u)n=n.concat(this.walkTokens(d.tokens,t));break}case"list":{let c=s;n=n.concat(this.walkTokens(c.items,t));break}default:{let c=s;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[c.type]?this.defaults.extensions.childTokens[c.type].forEach(u=>{let d=c[u].flat(1/0);n=n.concat(this.walkTokens(d,t))}):c.tokens&&(n=n.concat(this.walkTokens(c.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...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 s=t.renderers[o.name];s?t.renderers[o.name]=function(...c){let u=o.renderer.apply(this,c);return u===!1&&(u=s.apply(this,c)),u}: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 s=t[o.level];s?s.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 Qr(this.defaults);for(let s in n.renderer){if(!(s in o))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let c=s,u=n.renderer[c],d=o[c];o[c]=(...p)=>{let h=u.apply(o,p);return h===!1&&(h=d.apply(o,p)),h||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new Kr(this.defaults);for(let s in n.tokenizer){if(!(s in o))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let c=s,u=n.tokenizer[c],d=o[c];o[c]=(...p)=>{let h=u.apply(o,p);return h===!1&&(h=d.apply(o,p)),h}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new nr;for(let s in n.hooks){if(!(s in o))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let c=s,u=n.hooks[c],d=o[c];nr.passThroughHooks.has(s)?o[c]=p=>{if(this.defaults.async&&nr.passThroughHooksRespectAsync.has(s))return(async()=>{let k=await u.call(o,p);return d.call(o,k)})();let h=u.call(o,p);return d.call(o,h)}:o[c]=(...p)=>{if(this.defaults.async)return(async()=>{let k=await u.apply(o,p);return k===!1&&(k=await d.apply(o,p)),k})();let h=u.apply(o,p);return h===!1&&(h=d.apply(o,p)),h}}r.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(c){let u=[];return u.push(s.call(this,c)),o&&(u=u.concat(o.call(this,c))),u}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ut.lex(e,t??this.defaults)}parser(e,t){return dt.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},o={...this.defaults,...r},s=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return s(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 s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(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(async()=>{let c=o.hooks?await o.hooks.preprocess(t):t,u=await(o.hooks?await o.hooks.provideLexer(e):e?ut.lex:ut.lexInline)(c,o),d=o.hooks?await o.hooks.processAllTokens(u):u;o.walkTokens&&await Promise.all(this.walkTokens(d,o.walkTokens));let p=await(o.hooks?await o.hooks.provideParser(e):e?dt.parse:dt.parseInline)(d,o);return o.hooks?await o.hooks.postprocess(p):p})().catch(s);try{o.hooks&&(t=o.hooks.preprocess(t));let c=(o.hooks?o.hooks.provideLexer(e):e?ut.lex:ut.lexInline)(t,o);o.hooks&&(c=o.hooks.processAllTokens(c)),o.walkTokens&&this.walkTokens(c,o.walkTokens);let u=(o.hooks?o.hooks.provideParser(e):e?dt.parse:dt.parseInline)(c,o);return o.hooks&&(u=o.hooks.postprocess(u)),u}catch(c){return s(c)}}}onError(e,t){return n=>{if(n.message+=`
1295
- Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+yt(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},on=new kg;function te(e,t){return on.parse(e,t)}te.options=te.setOptions=function(e){return on.setOptions(e),te.defaults=on.defaults,fa(te.defaults),te},te.getDefaults=ni,te.defaults=nn;function _g(...e){return on.use(...e),te.defaults=on.defaults,fa(te.defaults),te}te.use=_g,te.walkTokens=function(e,t){return on.walkTokens(e,t)},te.parseInline=on.parseInline,te.Parser=dt,te.parser=dt.parse,te.Renderer=Qr,te.TextRenderer=ui,te.Lexer=ut,te.lexer=ut.lex,te.Tokenizer=Kr,te.Hooks=nr,te.parse=te,te.options,te.setOptions,te.walkTokens,te.parseInline,dt.parse,ut.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:za,setPrototypeOf:La,isFrozen:vg,getPrototypeOf:yg,getOwnPropertyDescriptor:wg}=Object;let{freeze:je,seal:rt,create:di}=Object,{apply:pi,construct:hi}=typeof Reflect<"u"&&Reflect;je||(je=function(t){return t}),rt||(rt=function(t){return t}),pi||(pi=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];return t.apply(n,o)}),hi||(hi=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 eo=qe(Array.prototype.forEach),xg=qe(Array.prototype.lastIndexOf),Ia=qe(Array.prototype.pop),rr=qe(Array.prototype.push),Sg=qe(Array.prototype.splice),to=qe(String.prototype.toLowerCase),fi=qe(String.prototype.toString),gi=qe(String.prototype.match),or=qe(String.prototype.replace),Tg=qe(String.prototype.indexOf),Eg=qe(String.prototype.trim),pt=qe(Object.prototype.hasOwnProperty),Ze=qe(RegExp.prototype.test),ir=Ag(TypeError);function qe(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 pi(e,t,r)}}function Ag(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return hi(e,n)}}function B(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:to;La&&La(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const s=n(o);s!==o&&(vg(t)||(t[r]=s),o=s)}e[o]=!0}return e}function Cg(e){for(let t=0;t<e.length;t++)pt(e,t)||(e[t]=null);return e}function wt(e){const t=di(null);for(const[n,r]of za(e))pt(e,n)&&(Array.isArray(r)?t[n]=Cg(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=wt(r):t[n]=r);return t}function sr(e,t){for(;e!==null;){const r=wg(e,t);if(r){if(r.get)return qe(r.get);if(typeof r.value=="function")return qe(r.value)}e=yg(e)}function n(){return null}return n}const $a=je(["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"]),mi=je(["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"]),bi=je(["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"]),Pg=je(["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"]),ki=je(["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"]),Rg=je(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Na=je(["#text"]),Oa=je(["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"]),_i=je(["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"]),Da=je(["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"]),no=je(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),zg=rt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Lg=rt(/<%[\w\W]*|[\w\W]*%>/gm),Ig=rt(/\$\{[\w\W]*/gm),$g=rt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ng=rt(/^aria-[\-\w]+$/),Ma=rt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Og=rt(/^(?:\w+script|data):/i),Dg=rt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ua=rt(/^html$/i),Mg=rt(/^[a-z][.\w]*(-[.\w]+)+$/i);var ja=Object.freeze({__proto__:null,ARIA_ATTR:Ng,ATTR_WHITESPACE:Dg,CUSTOM_ELEMENT:Mg,DATA_ATTR:$g,DOCTYPE_NAME:Ua,ERB_EXPR:Lg,IS_ALLOWED_URI:Ma,IS_SCRIPT_OR_DATA:Og,MUSTACHE_EXPR:zg,TMPLIT_EXPR:Ig});const ar={element:1,text:3,progressingInstruction:7,comment:8,document:9},Ug=function(){return typeof window>"u"?null:window},jg=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 s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Za=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function qa(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ug();const t=D=>qa(D);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==ar.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:c,Node:u,Element:d,NodeFilter:p,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:k,DOMParser:m,trustedTypes:_}=e,w=d.prototype,P=sr(w,"cloneNode"),N=sr(w,"remove"),re=sr(w,"nextSibling"),R=sr(w,"childNodes"),x=sr(w,"parentNode");if(typeof c=="function"){const D=n.createElement("template");D.content&&D.content.ownerDocument&&(n=D.content.ownerDocument)}let S,C="";const{implementation:M,createNodeIterator:se,createDocumentFragment:ke,getElementsByTagName:ze}=n,{importNode:Ye}=r;let K=Za();t.isSupported=typeof za=="function"&&typeof x=="function"&&M&&M.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:me,ERB_EXPR:Ke,TMPLIT_EXPR:Wt,DATA_ATTR:j,ARIA_ATTR:Q,IS_SCRIPT_OR_DATA:Le,ATTR_WHITESPACE:Oe,CUSTOM_ELEMENT:St}=ja;let{IS_ALLOWED_URI:ht}=ja,be=null;const Te=B({},[...$a,...mi,...bi,...ki,...Na]);let G=null;const He=B({},[...Oa,..._i,...Da,...no]);let J=Object.seal(di(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}})),Be=null,Qe=null;const We=Object.seal(di(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let _e=!0,Ce=!0,vo=!1,_r=!0,De=!1,pn=!0,Lt=!1,It=!1,qn=!1,Gt=!1,hn=!1,fn=!1,yo=!0,vr=!1;const Ii="user-content-";let yr=!0,gn=!1,Jt={},Ge=null;const wr=B({},["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 ae=null;const wo=B({},["audio","video","img","source","image","track"]);let xr=null;const xo=B({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Fn="http://www.w3.org/1998/Math/MathML",Hn="http://www.w3.org/2000/svg",ft="http://www.w3.org/1999/xhtml";let Xt=ft,mn=!1,bn=null;const $i=B({},[Fn,Hn,ft],fi);let Bn=B({},["mi","mo","mn","ms","mtext"]),Wn=B({},["annotation-xml"]);const Ni=B({},["title","style","font","a","script"]);let $t=null;const gt=["application/xhtml+xml","text/html"],Oi="text/html";let ce=null,Vt=null;const So=n.createElement("form"),Sr=function(b){return b instanceof RegExp||b instanceof Function},Gn=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Vt&&Vt===b)){if((!b||typeof b!="object")&&(b={}),b=wt(b),$t=gt.indexOf(b.PARSER_MEDIA_TYPE)===-1?Oi:b.PARSER_MEDIA_TYPE,ce=$t==="application/xhtml+xml"?fi:to,be=pt(b,"ALLOWED_TAGS")?B({},b.ALLOWED_TAGS,ce):Te,G=pt(b,"ALLOWED_ATTR")?B({},b.ALLOWED_ATTR,ce):He,bn=pt(b,"ALLOWED_NAMESPACES")?B({},b.ALLOWED_NAMESPACES,fi):$i,xr=pt(b,"ADD_URI_SAFE_ATTR")?B(wt(xo),b.ADD_URI_SAFE_ATTR,ce):xo,ae=pt(b,"ADD_DATA_URI_TAGS")?B(wt(wo),b.ADD_DATA_URI_TAGS,ce):wo,Ge=pt(b,"FORBID_CONTENTS")?B({},b.FORBID_CONTENTS,ce):wr,Be=pt(b,"FORBID_TAGS")?B({},b.FORBID_TAGS,ce):wt({}),Qe=pt(b,"FORBID_ATTR")?B({},b.FORBID_ATTR,ce):wt({}),Jt=pt(b,"USE_PROFILES")?b.USE_PROFILES:!1,_e=b.ALLOW_ARIA_ATTR!==!1,Ce=b.ALLOW_DATA_ATTR!==!1,vo=b.ALLOW_UNKNOWN_PROTOCOLS||!1,_r=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,De=b.SAFE_FOR_TEMPLATES||!1,pn=b.SAFE_FOR_XML!==!1,Lt=b.WHOLE_DOCUMENT||!1,Gt=b.RETURN_DOM||!1,hn=b.RETURN_DOM_FRAGMENT||!1,fn=b.RETURN_TRUSTED_TYPE||!1,qn=b.FORCE_BODY||!1,yo=b.SANITIZE_DOM!==!1,vr=b.SANITIZE_NAMED_PROPS||!1,yr=b.KEEP_CONTENT!==!1,gn=b.IN_PLACE||!1,ht=b.ALLOWED_URI_REGEXP||Ma,Xt=b.NAMESPACE||ft,Bn=b.MATHML_TEXT_INTEGRATION_POINTS||Bn,Wn=b.HTML_INTEGRATION_POINTS||Wn,J=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&Sr(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(J.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&Sr(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(J.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(J.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),De&&(Ce=!1),hn&&(Gt=!0),Jt&&(be=B({},Na),G=[],Jt.html===!0&&(B(be,$a),B(G,Oa)),Jt.svg===!0&&(B(be,mi),B(G,_i),B(G,no)),Jt.svgFilters===!0&&(B(be,bi),B(G,_i),B(G,no)),Jt.mathMl===!0&&(B(be,ki),B(G,Da),B(G,no))),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?We.tagCheck=b.ADD_TAGS:(be===Te&&(be=wt(be)),B(be,b.ADD_TAGS,ce))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?We.attributeCheck=b.ADD_ATTR:(G===He&&(G=wt(G)),B(G,b.ADD_ATTR,ce))),b.ADD_URI_SAFE_ATTR&&B(xr,b.ADD_URI_SAFE_ATTR,ce),b.FORBID_CONTENTS&&(Ge===wr&&(Ge=wt(Ge)),B(Ge,b.FORBID_CONTENTS,ce)),b.ADD_FORBID_CONTENTS&&(Ge===wr&&(Ge=wt(Ge)),B(Ge,b.ADD_FORBID_CONTENTS,ce)),yr&&(be["#text"]=!0),Lt&&B(be,["html","head","body"]),be.table&&(B(be,["tbody"]),delete Be.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw ir('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ir('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=b.TRUSTED_TYPES_POLICY,C=S.createHTML("")}else S===void 0&&(S=jg(_,o)),S!==null&&typeof C=="string"&&(C=S.createHTML(""));je&&je(b),Vt=b}},Tr=B({},[...mi,...bi,...Pg]),To=B({},[...ki,...Rg]),Di=function(b){let T=x(b);(!T||!T.tagName)&&(T={namespaceURI:Xt,tagName:"template"});const z=to(b.tagName),oe=to(T.tagName);return bn[b.namespaceURI]?b.namespaceURI===Hn?T.namespaceURI===ft?z==="svg":T.namespaceURI===Fn?z==="svg"&&(oe==="annotation-xml"||Bn[oe]):!!Tr[z]:b.namespaceURI===Fn?T.namespaceURI===ft?z==="math":T.namespaceURI===Hn?z==="math"&&Wn[oe]:!!To[z]:b.namespaceURI===ft?T.namespaceURI===Hn&&!Wn[oe]||T.namespaceURI===Fn&&!Bn[oe]?!1:!To[z]&&(Ni[z]||!Tr[z]):!!($t==="application/xhtml+xml"&&bn[b.namespaceURI]):!1},at=function(b){rr(t.removed,{element:b});try{x(b).removeChild(b)}catch{N(b)}},ct=function(b,T){try{rr(t.removed,{attribute:T.getAttributeNode(b),from:T})}catch{rr(t.removed,{attribute:null,from:T})}if(T.removeAttribute(b),b==="is")if(Gt||hn)try{at(T)}catch{}else try{T.setAttribute(b,"")}catch{}},Eo=function(b){let T=null,z=null;if(qn)b="<remove></remove>"+b;else{const ve=gi(b,/^[\r\n\t ]+/);z=ve&&ve[0]}$t==="application/xhtml+xml"&&Xt===ft&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const oe=S?S.createHTML(b):b;if(Xt===ft)try{T=new m().parseFromString(oe,$t)}catch{}if(!T||!T.documentElement){T=M.createDocument(Xt,"template",null);try{T.documentElement.innerHTML=mn?C:oe}catch{}}const Pe=T.body||T.documentElement;return b&&z&&Pe.insertBefore(n.createTextNode(z),Pe.childNodes[0]||null),Xt===ft?ze.call(T,Lt?"html":"body")[0]:Lt?T.documentElement:Pe},Er=function(b){return se.call(b.ownerDocument||b,b,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Ar=function(b){return b instanceof k&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof h)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},Ao=function(b){return typeof u=="function"&&b instanceof u};function mt(D,b,T){eo(D,z=>{z.call(t,b,T,Vt)})}const Co=function(b){let T=null;if(mt(K.beforeSanitizeElements,b,null),Ar(b))return at(b),!0;const z=ce(b.nodeName);if(mt(K.uponSanitizeElement,b,{tagName:z,allowedTags:be}),pn&&b.hasChildNodes()&&!Ao(b.firstElementChild)&&Ze(/<[/\w!]/g,b.innerHTML)&&Ze(/<[/\w!]/g,b.textContent)||b.nodeType===ar.progressingInstruction||pn&&b.nodeType===ar.comment&&Ze(/<[/\w]/g,b.data))return at(b),!0;if(!(We.tagCheck instanceof Function&&We.tagCheck(z))&&(!be[z]||Be[z])){if(!Be[z]&&Ro(z)&&(J.tagNameCheck instanceof RegExp&&Ze(J.tagNameCheck,z)||J.tagNameCheck instanceof Function&&J.tagNameCheck(z)))return!1;if(yr&&!Ge[z]){const oe=x(b)||b.parentNode,Pe=R(b)||b.childNodes;if(Pe&&oe){const ve=Pe.length;for(let Me=ve-1;Me>=0;--Me){const bt=P(Pe[Me],!0);bt.__removalCount=(b.__removalCount||0)+1,oe.insertBefore(bt,re(b))}}}return at(b),!0}return b instanceof d&&!Di(b)||(z==="noscript"||z==="noembed"||z==="noframes")&&Ze(/<\/no(script|embed|frames)/i,b.innerHTML)?(at(b),!0):(De&&b.nodeType===ar.text&&(T=b.textContent,eo([me,Ke,Wt],oe=>{T=or(T,oe," ")}),b.textContent!==T&&(rr(t.removed,{element:b.cloneNode()}),b.textContent=T)),mt(K.afterSanitizeElements,b,null),!1)},Po=function(b,T,z){if(yo&&(T==="id"||T==="name")&&(z in n||z in So))return!1;if(!(Ce&&!Qe[T]&&Ze(j,T))){if(!(_e&&Ze(Q,T))){if(!(We.attributeCheck instanceof Function&&We.attributeCheck(T,b))){if(!G[T]||Qe[T]){if(!(Ro(b)&&(J.tagNameCheck instanceof RegExp&&Ze(J.tagNameCheck,b)||J.tagNameCheck instanceof Function&&J.tagNameCheck(b))&&(J.attributeNameCheck instanceof RegExp&&Ze(J.attributeNameCheck,T)||J.attributeNameCheck instanceof Function&&J.attributeNameCheck(T,b))||T==="is"&&J.allowCustomizedBuiltInElements&&(J.tagNameCheck instanceof RegExp&&Ze(J.tagNameCheck,z)||J.tagNameCheck instanceof Function&&J.tagNameCheck(z))))return!1}else if(!xr[T]){if(!Ze(ht,or(z,Oe,""))){if(!((T==="src"||T==="xlink:href"||T==="href")&&b!=="script"&&Tg(z,"data:")===0&&ae[b])){if(!(vo&&!Ze(Le,or(z,Oe,"")))){if(z)return!1}}}}}}}return!0},Ro=function(b){return b!=="annotation-xml"&&gi(b,St)},Cr=function(b){mt(K.beforeSanitizeAttributes,b,null);const{attributes:T}=b;if(!T||Ar(b))return;const z={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:G,forceKeepAttr:void 0};let oe=T.length;for(;oe--;){const Pe=T[oe],{name:ve,namespaceURI:Me,value:bt}=Pe,Tt=ce(ve),Pr=bt;let Ee=ve==="value"?Pr:Eg(Pr);if(z.attrName=Tt,z.attrValue=Ee,z.keepAttr=!0,z.forceKeepAttr=void 0,mt(K.uponSanitizeAttribute,b,z),Ee=z.attrValue,vr&&(Tt==="id"||Tt==="name")&&(ct(ve,b),Ee=Ii+Ee),pn&&Ze(/((--!?|])>)|<\/(style|title|textarea)/i,Ee)){ct(ve,b);continue}if(Tt==="attributename"&&gi(Ee,"href")){ct(ve,b);continue}if(z.forceKeepAttr)continue;if(!z.keepAttr){ct(ve,b);continue}if(!_r&&Ze(/\/>/i,Ee)){ct(ve,b);continue}De&&eo([me,Ke,Wt],Lo=>{Ee=or(Ee,Lo," ")});const zo=ce(b.nodeName);if(!Po(zo,Tt,Ee)){ct(ve,b);continue}if(S&&typeof _=="object"&&typeof _.getAttributeType=="function"&&!Me)switch(_.getAttributeType(zo,Tt)){case"TrustedHTML":{Ee=S.createHTML(Ee);break}case"TrustedScriptURL":{Ee=S.createScriptURL(Ee);break}}if(Ee!==Pr)try{Me?b.setAttributeNS(Me,ve,Ee):b.setAttribute(ve,Ee),Ar(b)?at(b):Ia(t.removed)}catch{ct(ve,b)}}mt(K.afterSanitizeAttributes,b,null)},Nt=function D(b){let T=null;const z=Er(b);for(mt(K.beforeSanitizeShadowDOM,b,null);T=z.nextNode();)mt(K.uponSanitizeShadowNode,T,null),Co(T),Cr(T),T.content instanceof s&&D(T.content);mt(K.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(D){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},T=null,z=null,oe=null,Pe=null;if(mn=!D,mn&&(D="<!-->"),typeof D!="string"&&!Ao(D))if(typeof D.toString=="function"){if(D=D.toString(),typeof D!="string")throw ir("dirty is not a string, aborting")}else throw ir("toString is not a function");if(!t.isSupported)return D;if(It||Gn(b),t.removed=[],typeof D=="string"&&(gn=!1),gn){if(D.nodeName){const bt=ce(D.nodeName);if(!be[bt]||Be[bt])throw ir("root node is forbidden and cannot be sanitized in-place")}}else if(D instanceof u)T=Eo("<!---->"),z=T.ownerDocument.importNode(D,!0),z.nodeType===ar.element&&z.nodeName==="BODY"||z.nodeName==="HTML"?T=z:T.appendChild(z);else{if(!Gt&&!De&&!Lt&&D.indexOf("<")===-1)return S&&fn?S.createHTML(D):D;if(T=Eo(D),!T)return Gt?null:fn?C:""}T&&qn&&at(T.firstChild);const ve=Er(gn?D:T);for(;oe=ve.nextNode();)Co(oe),Cr(oe),oe.content instanceof s&&Nt(oe.content);if(gn)return D;if(Gt){if(hn)for(Pe=ke.call(T.ownerDocument);T.firstChild;)Pe.appendChild(T.firstChild);else Pe=T;return(G.shadowroot||G.shadowrootmode)&&(Pe=Ye.call(r,Pe,!0)),Pe}let Me=Lt?T.outerHTML:T.innerHTML;return Lt&&be["!doctype"]&&T.ownerDocument&&T.ownerDocument.doctype&&T.ownerDocument.doctype.name&&Ze(Ua,T.ownerDocument.doctype.name)&&(Me="<!DOCTYPE "+T.ownerDocument.doctype.name+`>
1296
- `+Me),De&&eo([me,Ke,Wt],bt=>{Me=or(Me,bt," ")}),S&&fn?S.createHTML(Me):Me},t.setConfig=function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Gn(D),It=!0},t.clearConfig=function(){Vt=null,It=!1},t.isValidAttribute=function(D,b,T){Vt||Gn({});const z=ce(D),oe=ce(b);return Po(z,oe,T)},t.addHook=function(D,b){typeof b=="function"&&rr(K[D],b)},t.removeHook=function(D,b){if(b!==void 0){const T=xg(K[D],b);return T===-1?void 0:Sg(K[D],T,1)[0]}return Ia(K[D])},t.removeHooks=function(D){K[D]=[]},t.removeAllHooks=function(){K=Za()},t}var Zg=qa();function Fa(e){const t=te.parse(e,{gfm:!0,breaks:!0,async:!1});return Zg.sanitize(t)}const Ha=1e3,Ba=32,Wa=15e3,qg=new Set(["completed","failed","cancelled"]),Fg=4e3;let L=null,xt=null,Re=null,vi=null,cr=null,ro=null,yi=!1,oo=null,lr=null,U={kind:"connecting"},Ln=[],In=null,fe=null,$n=null,Ct=null,ur=-1,Fe=null,Pt=!1,Rt=null,sn=new Set;function io(){so(),ca(),xt&&clearInterval(xt),xt=null,Rt==null||Rt(),Rt=null,Re==null||Re.destroy(),Re=null,cr==null||cr(),cr=null,L&&Qt(L),L==null||L.remove(),L=null,vi=null,U={kind:"connecting"},Ln=[],In=null,fe=null,$n=null,Ct=null,ro=null,ur=-1,Fe=null,Pt=!1,sn=new Set}function wi(e,t,n,r,o){L&&io(),vi=o??null,U={kind:"connecting"},Ln=[],In=null,ur=-1,Fe=null,Pt=!1,sn=new Set,fe=e,$n=n,Ct=t,ro=r,aa({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 s=r.length>55?`${r.slice(0,52)}…`:r;L.innerHTML=`
1438
+ `}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>${xt(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=Va(e);if(o===null)return r;e=o;let s='<a href="'+e+'"';return t&&(s+=' title="'+xt(t)+'"'),s+=">"+r+"</a>",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let o=Va(e);if(o===null)return xt(n);e=o;let s=`<img src="${e}" alt="${xt(n)}"`;return t&&(s+=` title="${xt(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:xt(e.text)}},Pi=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}},ht=class ps{constructor(t){ie(this,"options");ie(this,"renderer");ie(this,"textRenderer");this.options=t||un,this.options.renderer=this.options.renderer||new go,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Pi}static parse(t,n){return new ps(n).parse(t)}static parseInline(t,n){return new ps(n).parseInline(t)}parse(t){var r,o;this.renderer.parser=this;let n="";for(let s=0;s<t.length;s++){let c=t[s];if((o=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&o[c.type]){let d=c,p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(d.type)){n+=p||"";continue}}let u=c;switch(u.type){case"space":{n+=this.renderer.space(u);break}case"hr":{n+=this.renderer.hr(u);break}case"heading":{n+=this.renderer.heading(u);break}case"code":{n+=this.renderer.code(u);break}case"table":{n+=this.renderer.table(u);break}case"blockquote":{n+=this.renderer.blockquote(u);break}case"list":{n+=this.renderer.list(u);break}case"checkbox":{n+=this.renderer.checkbox(u);break}case"html":{n+=this.renderer.html(u);break}case"def":{n+=this.renderer.def(u);break}case"paragraph":{n+=this.renderer.paragraph(u);break}case"text":{n+=this.renderer.text(u);break}default:{let d='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return n}parseInline(t,n=this.renderer){var o,s;this.renderer.parser=this;let r="";for(let c=0;c<t.length;c++){let u=t[c];if((s=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&s[u.type]){let p=this.options.extensions.renderers[u.type].call({parser:this},u);if(p!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(u.type)){r+=p||"";continue}}let d=u;switch(d.type){case"escape":{r+=n.text(d);break}case"html":{r+=n.html(d);break}case"link":{r+=n.link(d);break}case"image":{r+=n.image(d);break}case"checkbox":{r+=n.checkbox(d);break}case"strong":{r+=n.strong(d);break}case"em":{r+=n.em(d);break}case"codespan":{r+=n.codespan(d);break}case"br":{r+=n.br(d);break}case"del":{r+=n.del(d);break}case"text":{r+=n.text(d);break}default:{let p='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return r}},br=(Uo=class{constructor(e){ie(this,"options");ie(this,"block");this.options=e||un}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?pt.lex:pt.lexInline}provideParser(e=this.block){return e?ht.parse:ht.parseInline}},ie(Uo,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ie(Uo,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Uo),Hg=class{constructor(...e){ie(this,"defaults",yi());ie(this,"options",this.setOptions);ie(this,"parse",this.parseMarkdown(!0));ie(this,"parseInline",this.parseMarkdown(!1));ie(this,"Parser",ht);ie(this,"Renderer",go);ie(this,"TextRenderer",Pi);ie(this,"Lexer",pt);ie(this,"Tokenizer",fo);ie(this,"Hooks",br);this.use(...e)}walkTokens(e,t){var r,o;let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let c=s;for(let u of c.header)n=n.concat(this.walkTokens(u.tokens,t));for(let u of c.rows)for(let d of u)n=n.concat(this.walkTokens(d.tokens,t));break}case"list":{let c=s;n=n.concat(this.walkTokens(c.items,t));break}default:{let c=s;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[c.type]?this.defaults.extensions.childTokens[c.type].forEach(u=>{let d=c[u].flat(1/0);n=n.concat(this.walkTokens(d,t))}):c.tokens&&(n=n.concat(this.walkTokens(c.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r={...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 s=t.renderers[o.name];s?t.renderers[o.name]=function(...c){let u=o.renderer.apply(this,c);return u===!1&&(u=s.apply(this,c)),u}: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 s=t[o.level];s?s.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 go(this.defaults);for(let s in n.renderer){if(!(s in o))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let c=s,u=n.renderer[c],d=o[c];o[c]=(...p)=>{let h=u.apply(o,p);return h===!1&&(h=d.apply(o,p)),h||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new fo(this.defaults);for(let s in n.tokenizer){if(!(s in o))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let c=s,u=n.tokenizer[c],d=o[c];o[c]=(...p)=>{let h=u.apply(o,p);return h===!1&&(h=d.apply(o,p)),h}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new br;for(let s in n.hooks){if(!(s in o))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let c=s,u=n.hooks[c],d=o[c];br.passThroughHooks.has(s)?o[c]=p=>{if(this.defaults.async&&br.passThroughHooksRespectAsync.has(s))return(async()=>{let b=await u.call(o,p);return d.call(o,b)})();let h=u.call(o,p);return d.call(o,h)}:o[c]=(...p)=>{if(this.defaults.async)return(async()=>{let b=await u.apply(o,p);return b===!1&&(b=await d.apply(o,p)),b})();let h=u.apply(o,p);return h===!1&&(h=d.apply(o,p)),h}}r.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(c){let u=[];return u.push(s.call(this,c)),o&&(u=u.concat(o.call(this,c))),u}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return pt.lex(e,t??this.defaults)}parser(e,t){return ht.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},o={...this.defaults,...r},s=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return s(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 s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(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(async()=>{let c=o.hooks?await o.hooks.preprocess(t):t,u=await(o.hooks?await o.hooks.provideLexer(e):e?pt.lex:pt.lexInline)(c,o),d=o.hooks?await o.hooks.processAllTokens(u):u;o.walkTokens&&await Promise.all(this.walkTokens(d,o.walkTokens));let p=await(o.hooks?await o.hooks.provideParser(e):e?ht.parse:ht.parseInline)(d,o);return o.hooks?await o.hooks.postprocess(p):p})().catch(s);try{o.hooks&&(t=o.hooks.preprocess(t));let c=(o.hooks?o.hooks.provideLexer(e):e?pt.lex:pt.lexInline)(t,o);o.hooks&&(c=o.hooks.processAllTokens(c)),o.walkTokens&&this.walkTokens(c,o.walkTokens);let u=(o.hooks?o.hooks.provideParser(e):e?ht.parse:ht.parseInline)(c,o);return o.hooks&&(u=o.hooks.postprocess(u)),u}catch(c){return s(c)}}}onError(e,t){return n=>{if(n.message+=`
1439
+ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+xt(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},pn=new Hg;function te(e,t){return pn.parse(e,t)}te.options=te.setOptions=function(e){return pn.setOptions(e),te.defaults=pn.defaults,Da(te.defaults),te},te.getDefaults=yi,te.defaults=un;function Fg(...e){return pn.use(...e),te.defaults=pn.defaults,Da(te.defaults),te}te.use=Fg,te.walkTokens=function(e,t){return pn.walkTokens(e,t)},te.parseInline=pn.parseInline,te.Parser=ht,te.parser=ht.parse,te.Renderer=go,te.TextRenderer=Pi,te.Lexer=pt,te.lexer=pt.lex,te.Tokenizer=fo,te.Hooks=br,te.parse=te,te.options,te.setOptions,te.walkTokens,te.parseInline,ht.parse,pt.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:ec,setPrototypeOf:tc,isFrozen:Bg,getPrototypeOf:Gg,getOwnPropertyDescriptor:Wg}=Object;let{freeze:He,seal:st,create:Ri}=Object,{apply:Li,construct:zi}=typeof Reflect<"u"&&Reflect;He||(He=function(t){return t}),st||(st=function(t){return t}),Li||(Li=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];return t.apply(n,o)}),zi||(zi=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=Be(Array.prototype.forEach),Jg=Be(Array.prototype.lastIndexOf),nc=Be(Array.prototype.pop),kr=Be(Array.prototype.push),Xg=Be(Array.prototype.splice),bo=Be(String.prototype.toLowerCase),Ii=Be(String.prototype.toString),$i=Be(String.prototype.match),_r=Be(String.prototype.replace),Vg=Be(String.prototype.indexOf),Yg=Be(String.prototype.trim),ft=Be(Object.prototype.hasOwnProperty),Fe=Be(RegExp.prototype.test),vr=Kg(TypeError);function Be(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 Li(e,t,r)}}function Kg(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return zi(e,n)}}function B(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:bo;tc&&tc(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const s=n(o);s!==o&&(Bg(t)||(t[r]=s),o=s)}e[o]=!0}return e}function Qg(e){for(let t=0;t<e.length;t++)ft(e,t)||(e[t]=null);return e}function St(e){const t=Ri(null);for(const[n,r]of ec(e))ft(e,n)&&(Array.isArray(r)?t[n]=Qg(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=St(r):t[n]=r);return t}function yr(e,t){for(;e!==null;){const r=Wg(e,t);if(r){if(r.get)return Be(r.get);if(typeof r.value=="function")return Be(r.value)}e=Gg(e)}function n(){return null}return n}const rc=He(["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"]),Ni=He(["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"]),Oi=He(["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"]),em=He(["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=He(["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"]),tm=He(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),oc=He(["#text"]),ic=He(["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"]),Mi=He(["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"]),sc=He(["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"]),ko=He(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),nm=st(/\{\{[\w\W]*|[\w\W]*\}\}/gm),rm=st(/<%[\w\W]*|[\w\W]*%>/gm),om=st(/\$\{[\w\W]*/gm),im=st(/^data-[\-\w.\u00B7-\uFFFF]+$/),sm=st(/^aria-[\-\w]+$/),ac=st(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),am=st(/^(?:\w+script|data):/i),cm=st(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),cc=st(/^html$/i),lm=st(/^[a-z][.\w]*(-[.\w]+)+$/i);var lc=Object.freeze({__proto__:null,ARIA_ATTR:sm,ATTR_WHITESPACE:cm,CUSTOM_ELEMENT:lm,DATA_ATTR:im,DOCTYPE_NAME:cc,ERB_EXPR:rm,IS_ALLOWED_URI:ac,IS_SCRIPT_OR_DATA:am,MUSTACHE_EXPR:nm,TMPLIT_EXPR:om});const wr={element:1,text:3,progressingInstruction:7,comment:8,document:9},um=function(){return typeof window>"u"?null:window},dm=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 s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},uc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function dc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:um();const t=D=>dc(D);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==wr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:c,Node:u,Element:d,NodeFilter:p,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:b,DOMParser:m,trustedTypes:_}=e,w=d.prototype,P=yr(w,"cloneNode"),N=yr(w,"remove"),re=yr(w,"nextSibling"),R=yr(w,"childNodes"),x=yr(w,"parentNode");if(typeof c=="function"){const D=n.createElement("template");D.content&&D.content.ownerDocument&&(n=D.content.ownerDocument)}let S,C="";const{implementation:M,createNodeIterator:se,createDocumentFragment:ve,getElementsByTagName:$e}=n,{importNode:et}=r;let Q=uc();t.isSupported=typeof ec=="function"&&typeof x=="function"&&M&&M.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:be,ERB_EXPR:tt,TMPLIT_EXPR:tn,DATA_ATTR:Z,ARIA_ATTR:X,IS_SCRIPT_OR_DATA:Ne,ATTR_WHITESPACE:Ue,CUSTOM_ELEMENT:Ct}=lc;let{IS_ALLOWED_URI:ct}=lc,ke=null;const vn=B({},[...rc,...Ni,...Oi,...Di,...oc]);let W=null;const Re=B({},[...ic,...Mi,...sc,...ko]);let J=Object.seal(Ri(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}})),_e=null,yn=null;const Le=Object.seal(Ri(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ae=!0,xe=!0,Mt=!1,Ir=!0,je=!1,wn=!0,Ut=!1,jt=!1,nr=!1,nn=!1,xn=!1,Sn=!1,jo=!0,$r=!1;const es="user-content-";let Nr=!0,Tn=!1,rn={},Xe=null;const Or=B({},["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 ce=null;const Zo=B({},["audio","video","img","source","image","track"]);let Dr=null;const qo=B({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),rr="http://www.w3.org/1998/Math/MathML",or="http://www.w3.org/2000/svg",mt="http://www.w3.org/1999/xhtml";let on=mt,En=!1,An=null;const ts=B({},[rr,or,mt],Ii);let ir=B({},["mi","mo","mn","ms","mtext"]),sr=B({},["annotation-xml"]);const ns=B({},["title","style","font","a","script"]);let Zt=null;const bt=["application/xhtml+xml","text/html"],rs="text/html";let le=null,sn=null;const Ho=n.createElement("form"),Mr=function(k){return k instanceof RegExp||k instanceof Function},ar=function(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(sn&&sn===k)){if((!k||typeof k!="object")&&(k={}),k=St(k),Zt=bt.indexOf(k.PARSER_MEDIA_TYPE)===-1?rs:k.PARSER_MEDIA_TYPE,le=Zt==="application/xhtml+xml"?Ii:bo,ke=ft(k,"ALLOWED_TAGS")?B({},k.ALLOWED_TAGS,le):vn,W=ft(k,"ALLOWED_ATTR")?B({},k.ALLOWED_ATTR,le):Re,An=ft(k,"ALLOWED_NAMESPACES")?B({},k.ALLOWED_NAMESPACES,Ii):ts,Dr=ft(k,"ADD_URI_SAFE_ATTR")?B(St(qo),k.ADD_URI_SAFE_ATTR,le):qo,ce=ft(k,"ADD_DATA_URI_TAGS")?B(St(Zo),k.ADD_DATA_URI_TAGS,le):Zo,Xe=ft(k,"FORBID_CONTENTS")?B({},k.FORBID_CONTENTS,le):Or,_e=ft(k,"FORBID_TAGS")?B({},k.FORBID_TAGS,le):St({}),yn=ft(k,"FORBID_ATTR")?B({},k.FORBID_ATTR,le):St({}),rn=ft(k,"USE_PROFILES")?k.USE_PROFILES:!1,ae=k.ALLOW_ARIA_ATTR!==!1,xe=k.ALLOW_DATA_ATTR!==!1,Mt=k.ALLOW_UNKNOWN_PROTOCOLS||!1,Ir=k.ALLOW_SELF_CLOSE_IN_ATTR!==!1,je=k.SAFE_FOR_TEMPLATES||!1,wn=k.SAFE_FOR_XML!==!1,Ut=k.WHOLE_DOCUMENT||!1,nn=k.RETURN_DOM||!1,xn=k.RETURN_DOM_FRAGMENT||!1,Sn=k.RETURN_TRUSTED_TYPE||!1,nr=k.FORCE_BODY||!1,jo=k.SANITIZE_DOM!==!1,$r=k.SANITIZE_NAMED_PROPS||!1,Nr=k.KEEP_CONTENT!==!1,Tn=k.IN_PLACE||!1,ct=k.ALLOWED_URI_REGEXP||ac,on=k.NAMESPACE||mt,ir=k.MATHML_TEXT_INTEGRATION_POINTS||ir,sr=k.HTML_INTEGRATION_POINTS||sr,J=k.CUSTOM_ELEMENT_HANDLING||{},k.CUSTOM_ELEMENT_HANDLING&&Mr(k.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(J.tagNameCheck=k.CUSTOM_ELEMENT_HANDLING.tagNameCheck),k.CUSTOM_ELEMENT_HANDLING&&Mr(k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(J.attributeNameCheck=k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),k.CUSTOM_ELEMENT_HANDLING&&typeof k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(J.allowCustomizedBuiltInElements=k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),je&&(xe=!1),xn&&(nn=!0),rn&&(ke=B({},oc),W=[],rn.html===!0&&(B(ke,rc),B(W,ic)),rn.svg===!0&&(B(ke,Ni),B(W,Mi),B(W,ko)),rn.svgFilters===!0&&(B(ke,Oi),B(W,Mi),B(W,ko)),rn.mathMl===!0&&(B(ke,Di),B(W,sc),B(W,ko))),k.ADD_TAGS&&(typeof k.ADD_TAGS=="function"?Le.tagCheck=k.ADD_TAGS:(ke===vn&&(ke=St(ke)),B(ke,k.ADD_TAGS,le))),k.ADD_ATTR&&(typeof k.ADD_ATTR=="function"?Le.attributeCheck=k.ADD_ATTR:(W===Re&&(W=St(W)),B(W,k.ADD_ATTR,le))),k.ADD_URI_SAFE_ATTR&&B(Dr,k.ADD_URI_SAFE_ATTR,le),k.FORBID_CONTENTS&&(Xe===Or&&(Xe=St(Xe)),B(Xe,k.FORBID_CONTENTS,le)),k.ADD_FORBID_CONTENTS&&(Xe===Or&&(Xe=St(Xe)),B(Xe,k.ADD_FORBID_CONTENTS,le)),Nr&&(ke["#text"]=!0),Ut&&B(ke,["html","head","body"]),ke.table&&(B(ke,["tbody"]),delete _e.tbody),k.TRUSTED_TYPES_POLICY){if(typeof k.TRUSTED_TYPES_POLICY.createHTML!="function")throw vr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof k.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw vr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=k.TRUSTED_TYPES_POLICY,C=S.createHTML("")}else S===void 0&&(S=dm(_,o)),S!==null&&typeof C=="string"&&(C=S.createHTML(""));He&&He(k),sn=k}},Ur=B({},[...Ni,...Oi,...em]),Fo=B({},[...Di,...tm]),os=function(k){let T=x(k);(!T||!T.tagName)&&(T={namespaceURI:on,tagName:"template"});const L=bo(k.tagName),oe=bo(T.tagName);return An[k.namespaceURI]?k.namespaceURI===or?T.namespaceURI===mt?L==="svg":T.namespaceURI===rr?L==="svg"&&(oe==="annotation-xml"||ir[oe]):!!Ur[L]:k.namespaceURI===rr?T.namespaceURI===mt?L==="math":T.namespaceURI===or?L==="math"&&sr[oe]:!!Fo[L]:k.namespaceURI===mt?T.namespaceURI===or&&!sr[oe]||T.namespaceURI===rr&&!ir[oe]?!1:!Fo[L]&&(ns[L]||!Ur[L]):!!(Zt==="application/xhtml+xml"&&An[k.namespaceURI]):!1},lt=function(k){kr(t.removed,{element:k});try{x(k).removeChild(k)}catch{N(k)}},ut=function(k,T){try{kr(t.removed,{attribute:T.getAttributeNode(k),from:T})}catch{kr(t.removed,{attribute:null,from:T})}if(T.removeAttribute(k),k==="is")if(nn||xn)try{lt(T)}catch{}else try{T.setAttribute(k,"")}catch{}},Bo=function(k){let T=null,L=null;if(nr)k="<remove></remove>"+k;else{const ye=$i(k,/^[\r\n\t ]+/);L=ye&&ye[0]}Zt==="application/xhtml+xml"&&on===mt&&(k='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+k+"</body></html>");const oe=S?S.createHTML(k):k;if(on===mt)try{T=new m().parseFromString(oe,Zt)}catch{}if(!T||!T.documentElement){T=M.createDocument(on,"template",null);try{T.documentElement.innerHTML=En?C:oe}catch{}}const ze=T.body||T.documentElement;return k&&L&&ze.insertBefore(n.createTextNode(L),ze.childNodes[0]||null),on===mt?$e.call(T,Ut?"html":"body")[0]:Ut?T.documentElement:ze},jr=function(k){return se.call(k.ownerDocument||k,k,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Zr=function(k){return k instanceof b&&(typeof k.nodeName!="string"||typeof k.textContent!="string"||typeof k.removeChild!="function"||!(k.attributes instanceof h)||typeof k.removeAttribute!="function"||typeof k.setAttribute!="function"||typeof k.namespaceURI!="string"||typeof k.insertBefore!="function"||typeof k.hasChildNodes!="function")},Go=function(k){return typeof u=="function"&&k instanceof u};function kt(D,k,T){mo(D,L=>{L.call(t,k,T,sn)})}const Wo=function(k){let T=null;if(kt(Q.beforeSanitizeElements,k,null),Zr(k))return lt(k),!0;const L=le(k.nodeName);if(kt(Q.uponSanitizeElement,k,{tagName:L,allowedTags:ke}),wn&&k.hasChildNodes()&&!Go(k.firstElementChild)&&Fe(/<[/\w!]/g,k.innerHTML)&&Fe(/<[/\w!]/g,k.textContent)||k.nodeType===wr.progressingInstruction||wn&&k.nodeType===wr.comment&&Fe(/<[/\w]/g,k.data))return lt(k),!0;if(!(Le.tagCheck instanceof Function&&Le.tagCheck(L))&&(!ke[L]||_e[L])){if(!_e[L]&&Xo(L)&&(J.tagNameCheck instanceof RegExp&&Fe(J.tagNameCheck,L)||J.tagNameCheck instanceof Function&&J.tagNameCheck(L)))return!1;if(Nr&&!Xe[L]){const oe=x(k)||k.parentNode,ze=R(k)||k.childNodes;if(ze&&oe){const ye=ze.length;for(let Ze=ye-1;Ze>=0;--Ze){const _t=P(ze[Ze],!0);_t.__removalCount=(k.__removalCount||0)+1,oe.insertBefore(_t,re(k))}}}return lt(k),!0}return k instanceof d&&!os(k)||(L==="noscript"||L==="noembed"||L==="noframes")&&Fe(/<\/no(script|embed|frames)/i,k.innerHTML)?(lt(k),!0):(je&&k.nodeType===wr.text&&(T=k.textContent,mo([be,tt,tn],oe=>{T=_r(T,oe," ")}),k.textContent!==T&&(kr(t.removed,{element:k.cloneNode()}),k.textContent=T)),kt(Q.afterSanitizeElements,k,null),!1)},Jo=function(k,T,L){if(jo&&(T==="id"||T==="name")&&(L in n||L in Ho))return!1;if(!(xe&&!yn[T]&&Fe(Z,T))){if(!(ae&&Fe(X,T))){if(!(Le.attributeCheck instanceof Function&&Le.attributeCheck(T,k))){if(!W[T]||yn[T]){if(!(Xo(k)&&(J.tagNameCheck instanceof RegExp&&Fe(J.tagNameCheck,k)||J.tagNameCheck instanceof Function&&J.tagNameCheck(k))&&(J.attributeNameCheck instanceof RegExp&&Fe(J.attributeNameCheck,T)||J.attributeNameCheck instanceof Function&&J.attributeNameCheck(T,k))||T==="is"&&J.allowCustomizedBuiltInElements&&(J.tagNameCheck instanceof RegExp&&Fe(J.tagNameCheck,L)||J.tagNameCheck instanceof Function&&J.tagNameCheck(L))))return!1}else if(!Dr[T]){if(!Fe(ct,_r(L,Ue,""))){if(!((T==="src"||T==="xlink:href"||T==="href")&&k!=="script"&&Vg(L,"data:")===0&&ce[k])){if(!(Mt&&!Fe(Ne,_r(L,Ue,"")))){if(L)return!1}}}}}}}return!0},Xo=function(k){return k!=="annotation-xml"&&$i(k,Ct)},qr=function(k){kt(Q.beforeSanitizeAttributes,k,null);const{attributes:T}=k;if(!T||Zr(k))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:W,forceKeepAttr:void 0};let oe=T.length;for(;oe--;){const ze=T[oe],{name:ye,namespaceURI:Ze,value:_t}=ze,Pt=le(ye),Hr=_t;let Ce=ye==="value"?Hr:Yg(Hr);if(L.attrName=Pt,L.attrValue=Ce,L.keepAttr=!0,L.forceKeepAttr=void 0,kt(Q.uponSanitizeAttribute,k,L),Ce=L.attrValue,$r&&(Pt==="id"||Pt==="name")&&(ut(ye,k),Ce=es+Ce),wn&&Fe(/((--!?|])>)|<\/(style|title|textarea)/i,Ce)){ut(ye,k);continue}if(Pt==="attributename"&&$i(Ce,"href")){ut(ye,k);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){ut(ye,k);continue}if(!Ir&&Fe(/\/>/i,Ce)){ut(ye,k);continue}je&&mo([be,tt,tn],Yo=>{Ce=_r(Ce,Yo," ")});const Vo=le(k.nodeName);if(!Jo(Vo,Pt,Ce)){ut(ye,k);continue}if(S&&typeof _=="object"&&typeof _.getAttributeType=="function"&&!Ze)switch(_.getAttributeType(Vo,Pt)){case"TrustedHTML":{Ce=S.createHTML(Ce);break}case"TrustedScriptURL":{Ce=S.createScriptURL(Ce);break}}if(Ce!==Hr)try{Ze?k.setAttributeNS(Ze,ye,Ce):k.setAttribute(ye,Ce),Zr(k)?lt(k):nc(t.removed)}catch{ut(ye,k)}}kt(Q.afterSanitizeAttributes,k,null)},qt=function D(k){let T=null;const L=jr(k);for(kt(Q.beforeSanitizeShadowDOM,k,null);T=L.nextNode();)kt(Q.uponSanitizeShadowNode,T,null),Wo(T),qr(T),T.content instanceof s&&D(T.content);kt(Q.afterSanitizeShadowDOM,k,null)};return t.sanitize=function(D){let k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},T=null,L=null,oe=null,ze=null;if(En=!D,En&&(D="<!-->"),typeof D!="string"&&!Go(D))if(typeof D.toString=="function"){if(D=D.toString(),typeof D!="string")throw vr("dirty is not a string, aborting")}else throw vr("toString is not a function");if(!t.isSupported)return D;if(jt||ar(k),t.removed=[],typeof D=="string"&&(Tn=!1),Tn){if(D.nodeName){const _t=le(D.nodeName);if(!ke[_t]||_e[_t])throw vr("root node is forbidden and cannot be sanitized in-place")}}else if(D instanceof u)T=Bo("<!---->"),L=T.ownerDocument.importNode(D,!0),L.nodeType===wr.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?T=L:T.appendChild(L);else{if(!nn&&!je&&!Ut&&D.indexOf("<")===-1)return S&&Sn?S.createHTML(D):D;if(T=Bo(D),!T)return nn?null:Sn?C:""}T&&nr&&lt(T.firstChild);const ye=jr(Tn?D:T);for(;oe=ye.nextNode();)Wo(oe),qr(oe),oe.content instanceof s&&qt(oe.content);if(Tn)return D;if(nn){if(xn)for(ze=ve.call(T.ownerDocument);T.firstChild;)ze.appendChild(T.firstChild);else ze=T;return(W.shadowroot||W.shadowrootmode)&&(ze=et.call(r,ze,!0)),ze}let Ze=Ut?T.outerHTML:T.innerHTML;return Ut&&ke["!doctype"]&&T.ownerDocument&&T.ownerDocument.doctype&&T.ownerDocument.doctype.name&&Fe(cc,T.ownerDocument.doctype.name)&&(Ze="<!DOCTYPE "+T.ownerDocument.doctype.name+`>
1440
+ `+Ze),je&&mo([be,tt,tn],_t=>{Ze=_r(Ze,_t," ")}),S&&Sn?S.createHTML(Ze):Ze},t.setConfig=function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ar(D),jt=!0},t.clearConfig=function(){sn=null,jt=!1},t.isValidAttribute=function(D,k,T){sn||ar({});const L=le(D),oe=le(k);return Jo(L,oe,T)},t.addHook=function(D,k){typeof k=="function"&&kr(Q[D],k)},t.removeHook=function(D,k){if(k!==void 0){const T=Jg(Q[D],k);return T===-1?void 0:Xg(Q[D],T,1)[0]}return nc(Q[D])},t.removeHooks=function(D){Q[D]=[]},t.removeAllHooks=function(){Q=uc()},t}var pm=dc();function pc(e){const t=te.parse(e,{gfm:!0,breaks:!0,async:!1});return pm.sanitize(t)}const hc=1e3,fc=32,gc=15e3,hm=new Set(["completed","failed","cancelled"]),fm=4e3;let z=null,Tt=null,Ie=null,Ui=null,xr=null,_o=null,ji=!1,vo=null,Sr=null,U={kind:"connecting"},Hn=[],Fn=null,ge=null,Bn=null,$t=null,Tr=-1,Ge=null,Nt=!1,Ot=null,hn=new Set;function yo(){wo(),La(),Tt&&clearInterval(Tt),Tt=null,Ot==null||Ot(),Ot=null,Ie==null||Ie.destroy(),Ie=null,xr==null||xr(),xr=null,z&&zt(z),z==null||z.remove(),z=null,Ui=null,U={kind:"connecting"},Hn=[],Fn=null,ge=null,Bn=null,$t=null,_o=null,Tr=-1,Ge=null,Nt=!1,hn=new Set}function Zi(e,t,n,r,o){z&&yo(),Ui=o??null,U={kind:"connecting"},Hn=[],Fn=null,Tr=-1,Ge=null,Nt=!1,hn=new Set,ge=e,Bn=n,$t=t,_o=r,Ra({taskId:e,backendUrl:n,title:r}),z=document.createElement("div"),z.className="ap-sdk-panel",z.setAttribute("data-ap-sdk","1"),z.setAttribute("role","dialog"),z.setAttribute("aria-modal","true"),z.setAttribute("aria-label","Automation in progress");const s=r.length>55?`${r.slice(0,52)}…`:r;z.innerHTML=`
1297
1441
  <div class="ap-sdk-panel__header">
1298
1442
  <span class="ap-sdk-panel__title">
1299
1443
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1306,7 +1450,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
1306
1450
  <div class="ap-sdk-runner__meta">
1307
1451
  <div class="ap-sdk-runner__meta-row">
1308
1452
  <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--automate">Automate</span>
1309
- <span class="ap-sdk-runner__title" title="${tm(r)}">${Si(s)}</span>
1453
+ <span class="ap-sdk-runner__title" title="${Em(r)}">${Hi(s)}</span>
1310
1454
  </div>
1311
1455
  <div class="ap-sdk-runner__meta-row ap-sdk-runner__meta-row--controls">
1312
1456
  <span class="ap-sdk-runner__counter" data-ap-runner-counter>0 actions</span>
@@ -1332,17 +1476,17 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
1332
1476
  </div>
1333
1477
  <div class="ap-sdk-runner__hint" data-ap-runner-hint>Closing keeps the task running — resume anytime from My Captures.</div>
1334
1478
  <div class="ap-sdk-panel__status" data-ap-runner-summary style="display:none"></div>
1335
- `,L.addEventListener("wheel",u=>{u.stopPropagation()},{passive:!0}),L.addEventListener("touchmove",u=>{u.stopPropagation()},{passive:!0}),document.body.appendChild(L),Re=Mo(),Kt(L),ti(L,ei),L.querySelector("[data-ap-close]").addEventListener("click",()=>{io(),o==null||o()}),L.querySelector("[data-ap-runner-chat-form]").addEventListener("submit",u=>{u.preventDefault(),Wg(t,e)}),L.querySelector("[data-ap-runner-cancel]").addEventListener("click",u=>{u.stopPropagation();const d=u.currentTarget;if(!yi){yi=!0,d.textContent="Cancel",oo=setTimeout(so,Fg),lr=p=>{p.target!==d&&so()},document.addEventListener("click",lr,!0);return}so(),Hg(t,e)});const c=u=>{u.key==="Escape"&&(io(),o==null||o())};document.addEventListener("keydown",c),cr=()=>document.removeEventListener("keydown",c),xi(),Ga(e,t)}function Ga(e,t){const n=async u=>{if(fe!==e||!L||U.kind!=="idle"&&U.kind!=="connecting"||sn.has(u.commandId))return;sn.add(u.commandId);const d={id:u.commandId,taskId:u.taskId,action:u.action,selector:u.selector,value:u.value,description:u.description,status:"pending",createdAt:new Date().toISOString()};an({kind:"executing",command:d,actionsRun:U.kind==="idle"?U.actionsRun:0}),await Xa(d,t,e)},r=u=>{if(!(fe!==e||!L)&&qg.has(u)){if(U.kind==="executing")an({kind:"finishing",status:u,actionsRun:U.actionsRun});else if(U.kind==="connecting"||U.kind==="idle"){const d=U.kind==="idle"?U.actionsRun:0;an({kind:"finished",status:u,actionsRun:d})}}},o=u=>{fe!==e||!L||(u.outputChunk&&Va([u.outputChunk]),r(u.status))},s=async()=>{if(!(fe!==e||!L))try{const u=await Wr(t,e);fe===e&&L&&(Fe=u[0]??null,cn())}catch{}},c=async()=>{try{const[u,d,p,h]=await Promise.all([oa(t,e),rf(t,e),Wr(t,e),tf(t,e)]);if(fe!==e||!L)return;Va(d),Fe=p[0]??null,cn(),r(u.status),h&&h.status==="pending"&&(U.kind==="idle"||U.kind==="connecting")&&!sn.has(h.id)?(sn.add(h.id),an({kind:"executing",command:h,actionsRun:U.kind==="idle"?U.actionsRun:0}),await Xa(h,t,e)):U.kind==="connecting"&&an({kind:"idle",actionsRun:0})}catch{}};c(),bf(t,e,{onStatusUpdate:o,onInteractionCreated:s,onInteractionAnswered:s,onBrowserCommandCreated:n,onReconnect:()=>{c()}}).then(u=>{if(fe!==e||U.kind==="finished"){u();return}Rt=u})}function an(e){U=e,U.kind==="idle"&&In===null&&(In=Date.now(),ao(),xt=setInterval(ao,Ha)),U.kind==="finished"&&(xt&&(clearInterval(xt),xt=null),Rt==null||Rt(),Rt=null,Re==null||Re.hide(),ca()),xi()}function so(){yi=!1,oo&&(clearTimeout(oo),oo=null),lr&&(document.removeEventListener("click",lr,!0),lr=null);const e=L==null?void 0:L.querySelector("[data-ap-runner-cancel]");e&&(e.textContent="Cancel task")}async function Hg(e,t){if(fe!==t||!L)return;const n=L.querySelector("[data-ap-runner-cancel]");n&&(n.disabled=!0);try{await sf(e,t)}catch{n&&(n.disabled=!1)}}function Ja(){if(!fe||!Ct||!$n||!ro)return;const e=fe,t=Ct;aa({taskId:e,backendUrl:$n,title:ro}),xt&&clearInterval(xt),ao(),xt=setInterval(ao,Ha);const n=U.kind==="finished"?U.actionsRun:0;sn=new Set,U={kind:"idle",actionsRun:n},xi(),Ga(e,t)}function xi(){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 U?U.actionsRun:0;t.textContent=`${o} action${o===1?"":"s"}`,U.kind==="finished"?(e.textContent=U.status.replace(/_/g," "),e.className=`ap-sdk-status-badge ap-sdk-status-badge--${U.status.replace(/_/g,"-")}`,r.style.display="none",Qg(U.status)):(e.textContent="running",e.className="ap-sdk-status-badge ap-sdk-status-badge--in-progress",r.style.display="block");const s=n.querySelector("[data-ap-runner-placeholder]");if(Ln.length===0&&(U.kind==="connecting"||U.kind==="idle")){if(!s){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 s==null||s.remove();cn();const c=L.querySelector("[data-ap-runner-chat-input]"),u=L.querySelector("[data-ap-runner-chat-send]");if(c&&u){const h=U.kind==="finished"&&U.status==="failed";c.disabled=h,u.disabled=h||Pt,h&&(c.placeholder="This task failed — start a new automation to continue.")}const d=L.querySelector("[data-ap-runner-cancel]");d&&(d.style.display=U.kind==="finished"?"none":"");const p=L.querySelector("[data-ap-runner-summary]");p&&U.kind!=="finished"&&(p.style.display="none",p.innerHTML="")}function cn(){if(!L)return;const e=L.querySelector("[data-ap-runner-question]"),t=L.querySelector("[data-ap-runner-chat-input]");if(!e||!t)return;if(!Fe){e.style.display="none",e.innerHTML="",t.placeholder="Send a message to the agent…";return}const n=Fe.questionMetadata,r=(n==null?void 0:n.options)??[];if(t.placeholder="Type your answer…",e.style.display="block",e.innerHTML=`
1336
- <div class="ap-sdk-runner__question-label">${Si((n==null?void 0:n.header)||"The agent has a question")}</div>
1337
- <div class="ap-sdk-runner__question-text ap-sdk-markdown">${Fa((n==null?void 0:n.question)||Fe.question)}</div>
1479
+ `,z.addEventListener("wheel",u=>{u.stopPropagation()},{passive:!0}),z.addEventListener("touchmove",u=>{u.stopPropagation()},{passive:!0}),document.body.appendChild(z),Ie=ri(),Lt(z),vi(z,_i),z.querySelector("[data-ap-close]").addEventListener("click",()=>{yo(),o==null||o()}),z.querySelector("[data-ap-runner-chat-form]").addEventListener("submit",u=>{u.preventDefault(),bm(t,e)}),z.querySelector("[data-ap-runner-cancel]").addEventListener("click",u=>{u.stopPropagation();const d=u.currentTarget;if(!ji){ji=!0,d.textContent="Cancel",vo=setTimeout(wo,fm),Sr=p=>{p.target!==d&&wo()},document.addEventListener("click",Sr,!0);return}wo(),gm(t,e)});const c=u=>{u.key==="Escape"&&(yo(),o==null||o())};document.addEventListener("keydown",c),xr=()=>document.removeEventListener("keydown",c),qi(),mc(e,t)}function mc(e,t){const n=async u=>{if(ge!==e||!z||U.kind!=="idle"&&U.kind!=="connecting"||hn.has(u.commandId))return;hn.add(u.commandId);const d={id:u.commandId,taskId:u.taskId,action:u.action,selector:u.selector,value:u.value,description:u.description,status:"pending",createdAt:new Date().toISOString()};fn({kind:"executing",command:d,actionsRun:U.kind==="idle"?U.actionsRun:0}),await kc(d,t,e)},r=u=>{if(!(ge!==e||!z)&&hm.has(u)){if(U.kind==="executing")fn({kind:"finishing",status:u,actionsRun:U.actionsRun});else if(U.kind==="connecting"||U.kind==="idle"){const d=U.kind==="idle"?U.actionsRun:0;fn({kind:"finished",status:u,actionsRun:d})}}},o=u=>{ge!==e||!z||(u.outputChunk&&_c([u.outputChunk]),r(u.status))},s=async()=>{if(!(ge!==e||!z))try{const u=await ao(t,e);ge===e&&z&&(Ge=u[0]??null,gn())}catch{}},c=async()=>{try{const[u,d,p,h]=await Promise.all([Ea(t,e),Pf(t,e),ao(t,e),Af(t,e)]);if(ge!==e||!z)return;_c(d),Ge=p[0]??null,gn(),r(u.status),h&&h.status==="pending"&&(U.kind==="idle"||U.kind==="connecting")&&!hn.has(h.id)?(hn.add(h.id),fn({kind:"executing",command:h,actionsRun:U.kind==="idle"?U.actionsRun:0}),await kc(h,t,e)):U.kind==="connecting"&&fn({kind:"idle",actionsRun:0})}catch{}};c(),qf(t,e,{onStatusUpdate:o,onInteractionCreated:s,onInteractionAnswered:s,onBrowserCommandCreated:n,onReconnect:()=>{c()}}).then(u=>{if(ge!==e||U.kind==="finished"){u();return}Ot=u})}function fn(e){U=e,U.kind==="idle"&&Fn===null&&(Fn=Date.now(),xo(),Tt=setInterval(xo,hc)),U.kind==="finished"&&(Tt&&(clearInterval(Tt),Tt=null),Ot==null||Ot(),Ot=null,Ie==null||Ie.hide(),La()),qi()}function wo(){ji=!1,vo&&(clearTimeout(vo),vo=null),Sr&&(document.removeEventListener("click",Sr,!0),Sr=null);const e=z==null?void 0:z.querySelector("[data-ap-runner-cancel]");e&&(e.textContent="Cancel task")}async function gm(e,t){if(ge!==t||!z)return;const n=z.querySelector("[data-ap-runner-cancel]");n&&(n.disabled=!0);try{await Lf(e,t)}catch{n&&(n.disabled=!1)}}function bc(){if(!ge||!$t||!Bn||!_o)return;const e=ge,t=$t;Ra({taskId:e,backendUrl:Bn,title:_o}),Tt&&clearInterval(Tt),xo(),Tt=setInterval(xo,hc);const n=U.kind==="finished"?U.actionsRun:0;hn=new Set,U={kind:"idle",actionsRun:n},qi(),mc(e,t)}function qi(){if(!z)return;const e=z.querySelector("[data-ap-runner-status]"),t=z.querySelector("[data-ap-runner-counter]"),n=z.querySelector("[data-ap-runner-log]"),r=z.querySelector("[data-ap-runner-hint]");if(!e||!t||!n||!r)return;const o="actionsRun"in U?U.actionsRun:0;t.textContent=`${o} action${o===1?"":"s"}`,U.kind==="finished"?(e.textContent=U.status.replace(/_/g," "),e.className=`ap-sdk-status-badge ap-sdk-status-badge--${U.status.replace(/_/g,"-")}`,r.style.display="none",Sm(U.status)):(e.textContent="running",e.className="ap-sdk-status-badge ap-sdk-status-badge--in-progress",r.style.display="block");const s=n.querySelector("[data-ap-runner-placeholder]");if(Hn.length===0&&(U.kind==="connecting"||U.kind==="idle")){if(!s){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 s==null||s.remove();gn();const c=z.querySelector("[data-ap-runner-chat-input]"),u=z.querySelector("[data-ap-runner-chat-send]");if(c&&u){const h=U.kind==="finished"&&U.status==="failed";c.disabled=h,u.disabled=h||Nt,h&&(c.placeholder="This task failed — start a new automation to continue.")}const d=z.querySelector("[data-ap-runner-cancel]");d&&(d.style.display=U.kind==="finished"?"none":"");const p=z.querySelector("[data-ap-runner-summary]");p&&U.kind!=="finished"&&(p.style.display="none",p.innerHTML="")}function gn(){if(!z)return;const e=z.querySelector("[data-ap-runner-question]"),t=z.querySelector("[data-ap-runner-chat-input]");if(!e||!t)return;if(!Ge){e.style.display="none",e.innerHTML="",t.placeholder="Send a message to the agent…";return}const n=Ge.questionMetadata,r=(n==null?void 0:n.options)??[];if(t.placeholder="Type your answer…",e.style.display="block",e.innerHTML=`
1480
+ <div class="ap-sdk-runner__question-label">${Hi((n==null?void 0:n.header)||"The agent has a question")}</div>
1481
+ <div class="ap-sdk-runner__question-text ap-sdk-markdown">${pc((n==null?void 0:n.question)||Ge.question)}</div>
1338
1482
  ${r.length>0?'<div class="ap-sdk-runner__question-options" data-ap-runner-question-options></div>':""}
1339
- `,r.length>0){const o=e.querySelector("[data-ap-runner-question-options]");for(const s of r){const c=document.createElement("button");c.type="button",c.className="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-runner__question-option",c.textContent=s.label,c.addEventListener("click",()=>void Bg(s.label)),o.appendChild(c)}}}async function Bg(e){if(!L||!Fe||!fe||Pt)return;const t=fe,n=Ct;if(n){Pt=!0;try{const r={selectedOption:e};await ia(n,t,Fe.id,r),Fe=null,cn();const o=await Wr(n,t);fe===t&&L&&(Fe=o[0]??null,cn())}catch{const r=L.querySelector("[data-ap-runner-chat-error]");r&&(r.textContent="Failed to send your answer — try again.",r.style.display="block")}finally{Pt=!1}}}function ao(){if(!L||In===null)return;const e=L.querySelector("[data-ap-runner-timer]");if(!e)return;const t=Math.max(0,Math.floor((Date.now()-In)/1e3)),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");e.textContent=`${n}:${r}`}async function Xa(e,t,n){let r="done",o;try{if(e.action==="getContext"){const c=e.selector?document.querySelector(e.selector):document.body;if(!c)throw new Error(`element not found (${e.selector})`);Re==null||Re.update(c),o=Jg(c)}else{if(!e.selector)throw new Error(`${e.action} command is missing a selector`);const c=document.querySelector(e.selector);if(!c)throw new Error(`element not found (${e.selector})`);if(Re==null||Re.update(c),e.action==="click")await _f(c),o="Clicked";else{if(e.value===void 0)throw new Error("inputText command is missing a value");Xg(c,e.value),o="Entered text"}}}catch(c){r="error",o=c instanceof Error?c.message:"Unknown error executing command"}if(fe===n&&L&&Vg(r,e,o),await Gg(t,n,e.id,r,o),fe!==n||!L)return;Re==null||Re.hide();const s=(U.kind==="executing"||U.kind==="finishing"?U.actionsRun:0)+1;U.kind==="finishing"?an({kind:"finished",status:U.status,actionsRun:s}):U.kind==="executing"&&an({kind:"idle",actionsRun:s})}async function Wg(e,t){if(!L||Pt||U.kind==="finished"&&U.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 s=n.value.trim();if(s){Pt=!0,o.disabled=!0,r.style.display="none";try{if(Fe){await ia(e,t,Fe.id,s),Fe=null,cn();try{const c=await Wr(e,t);fe===t&&L&&(Fe=c[0]??null,cn())}catch{}}else await of(e,t,s),U.kind==="finished"&&Ja();n.value=""}catch(c){r.textContent=c instanceof Error?c.message:"Failed to send — try again.",r.style.display="block"}finally{Pt=!1,o.disabled=!1}}}async function Gg(e,t,n,r,o){try{await nf(e,t,n,r,o)}catch{}}function Jg(e){const t=e.cloneNode(!0);t.querySelectorAll("script, style, noscript").forEach(o=>o.remove()),df(t);let n=t.outerHTML,r=!1;return n.length>Wa&&(n=n.slice(0,Wa),r=!0),`URL: ${location.href}
1483
+ `,r.length>0){const o=e.querySelector("[data-ap-runner-question-options]");for(const s of r){const c=document.createElement("button");c.type="button",c.className="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-runner__question-option",c.textContent=s.label,c.addEventListener("click",()=>void mm(s.label)),o.appendChild(c)}}}async function mm(e){if(!z||!Ge||!ge||Nt)return;const t=ge,n=$t;if(n){Nt=!0;try{const r={selectedOption:e};await Aa(n,t,Ge.id,r),Ge=null,gn();const o=await ao(n,t);ge===t&&z&&(Ge=o[0]??null,gn())}catch{const r=z.querySelector("[data-ap-runner-chat-error]");r&&(r.textContent="Failed to send your answer — try again.",r.style.display="block")}finally{Nt=!1}}}function xo(){if(!z||Fn===null)return;const e=z.querySelector("[data-ap-runner-timer]");if(!e)return;const t=Math.max(0,Math.floor((Date.now()-Fn)/1e3)),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");e.textContent=`${n}:${r}`}async function kc(e,t,n){let r="done",o;try{if(e.action==="getContext"){const c=e.selector?document.querySelector(e.selector):document.body;if(!c)throw new Error(`element not found (${e.selector})`);Ie==null||Ie.update(c),o=_m(c)}else{if(!e.selector)throw new Error(`${e.action} command is missing a selector`);const c=document.querySelector(e.selector);if(!c)throw new Error(`element not found (${e.selector})`);if(Ie==null||Ie.update(c),e.action==="click")await Ff(c),o="Clicked";else{if(e.value===void 0)throw new Error("inputText command is missing a value");vm(c,e.value),o="Entered text"}}}catch(c){r="error",o=c instanceof Error?c.message:"Unknown error executing command"}if(ge===n&&z&&ym(r,e,o),await km(t,n,e.id,r,o),ge!==n||!z)return;Ie==null||Ie.hide();const s=(U.kind==="executing"||U.kind==="finishing"?U.actionsRun:0)+1;U.kind==="finishing"?fn({kind:"finished",status:U.status,actionsRun:s}):U.kind==="executing"&&fn({kind:"idle",actionsRun:s})}async function bm(e,t){if(!z||Nt||U.kind==="finished"&&U.status==="failed")return;const n=z.querySelector("[data-ap-runner-chat-input]"),r=z.querySelector("[data-ap-runner-chat-error]"),o=z.querySelector("[data-ap-runner-chat-send]");if(!n||!r||!o)return;const s=n.value.trim();if(s){Nt=!0,o.disabled=!0,r.style.display="none";try{if(Ge){await Aa(e,t,Ge.id,s),Ge=null,gn();try{const c=await ao(e,t);ge===t&&z&&(Ge=c[0]??null,gn())}catch{}}else await Rf(e,t,s),U.kind==="finished"&&bc();n.value=""}catch(c){r.textContent=c instanceof Error?c.message:"Failed to send — try again.",r.style.display="block"}finally{Nt=!1,o.disabled=!1}}}async function km(e,t,n,r,o){try{await Cf(e,t,n,r,o)}catch{}}function _m(e){const t=e.cloneNode(!0);t.querySelectorAll("script, style, noscript").forEach(o=>o.remove()),Of(t);let n=t.outerHTML,r=!1;return n.length>gc&&(n=n.slice(0,gc),r=!0),`URL: ${location.href}
1340
1484
  Title: ${document.title}
1341
1485
 
1342
1486
  ${n}${r?`
1343
- … (truncated)`:""}`}function Xg(e,t){var s;const r=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,o=(s=Object.getOwnPropertyDescriptor(r,"value"))==null?void 0:s.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 Vg(e,t,n){var k;const r=e==="done"?"✓":"✗",o=t.selector?` \`${t.selector}\``:"",s=t.description||`${t.action}${o}`,c=e==="done"&&t.action==="getContext"?`read context (${(n==null?void 0:n.length)??0} chars)`:n,u=c?` — ${c}`:"";if(Ln.push({status:e,text:`${r} ${s}${u}`}),!L)return;const d=L.querySelector("[data-ap-runner-log]");if(!d)return;(k=d.querySelector("[data-ap-runner-placeholder]"))==null||k.remove();const p=d.scrollHeight-d.scrollTop-d.clientHeight<=Ba,h=document.createElement("div");h.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--${e}`,h.textContent=Ln[Ln.length-1].text,d.appendChild(h),p&&(d.scrollTop=d.scrollHeight)}function Yg(e){var t;return((t=e.display)==null?void 0:t.variant)??e.sdkEventType}function Kg(e){const t=Yg(e);return(e.stream==="stdout"||e.stream==="stderr"||e.stream==="sdk_event"&&(t==="text"||t==="thinking"))&&e.data.trim()||null}function Va(e){var r;const t=e.filter(o=>o.sequence>ur).sort((o,s)=>o.sequence-s.sequence);if(t.length===0||(ur=Math.max(ur,...t.map(o=>o.sequence)),!L))return;const n=L.querySelector("[data-ap-runner-log]");if(n)for(const o of t){const s=Kg(o);if(!s)continue;(r=n.querySelector("[data-ap-runner-placeholder]"))==null||r.remove();const c=n.scrollHeight-n.scrollTop-n.clientHeight<=Ba,u=document.createElement("div");u.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--output ap-sdk-runner__log-entry--${o.stream}`,o.stream==="sdk_event"?(u.classList.add("ap-sdk-markdown"),u.innerHTML=Fa(s)):u.textContent=s,n.appendChild(u),c&&(n.scrollTop=n.scrollHeight)}}function Qg(e){if(!L||!fe||!$n)return;const t=L.querySelector("[data-ap-runner-summary]");if(!t)return;const n=`${$n.replace(/\/+$/,"")}/tasks/${fe}`,r=e==="completed"?"Automation complete!":"Automation ended",o=e==="completed";t.style.display="block",t.innerHTML=`
1487
+ … (truncated)`:""}`}function vm(e,t){var s;const r=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,o=(s=Object.getOwnPropertyDescriptor(r,"value"))==null?void 0:s.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 ym(e,t,n){var b;const r=e==="done"?"✓":"✗",o=t.selector?` \`${t.selector}\``:"",s=t.description||`${t.action}${o}`,c=e==="done"&&t.action==="getContext"?`read context (${(n==null?void 0:n.length)??0} chars)`:n,u=c?` — ${c}`:"";if(Hn.push({status:e,text:`${r} ${s}${u}`}),!z)return;const d=z.querySelector("[data-ap-runner-log]");if(!d)return;(b=d.querySelector("[data-ap-runner-placeholder]"))==null||b.remove();const p=d.scrollHeight-d.scrollTop-d.clientHeight<=fc,h=document.createElement("div");h.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--${e}`,h.textContent=Hn[Hn.length-1].text,d.appendChild(h),p&&(d.scrollTop=d.scrollHeight)}function wm(e){var t;return((t=e.display)==null?void 0:t.variant)??e.sdkEventType}function xm(e){const t=wm(e);return(e.stream==="stdout"||e.stream==="stderr"||e.stream==="sdk_event"&&(t==="text"||t==="thinking"))&&e.data.trim()||null}function _c(e){var r;const t=e.filter(o=>o.sequence>Tr).sort((o,s)=>o.sequence-s.sequence);if(t.length===0||(Tr=Math.max(Tr,...t.map(o=>o.sequence)),!z))return;const n=z.querySelector("[data-ap-runner-log]");if(n)for(const o of t){const s=xm(o);if(!s)continue;(r=n.querySelector("[data-ap-runner-placeholder]"))==null||r.remove();const c=n.scrollHeight-n.scrollTop-n.clientHeight<=fc,u=document.createElement("div");u.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--output ap-sdk-runner__log-entry--${o.stream}`,o.stream==="sdk_event"?(u.classList.add("ap-sdk-markdown"),u.innerHTML=pc(s)):u.textContent=s,n.appendChild(u),c&&(n.scrollTop=n.scrollHeight)}}function Sm(e){if(!z||!ge||!Bn)return;const t=z.querySelector("[data-ap-runner-summary]");if(!t)return;const n=`${Bn.replace(/\/+$/,"")}/tasks/${ge}`,r=e==="completed"?"Automation complete!":"Automation ended",o=e==="completed";t.style.display="block",t.innerHTML=`
1344
1488
  <div class="ap-sdk-success-card">
1345
- <p class="ap-sdk-success-headline">${Si(r)}</p>
1489
+ <p class="ap-sdk-success-headline">${Hi(r)}</p>
1346
1490
  ${o?`
1347
1491
  <div class="ap-sdk-runner__approval" data-ap-runner-approval>
1348
1492
  <div class="ap-sdk-runner__approval-actions">
@@ -1360,7 +1504,7 @@ ${n}${r?`
1360
1504
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-runner-close>Close</button>
1361
1505
  </div>
1362
1506
  </div>
1363
- `,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const s=vi;io(),s==null||s()}),o&&em(t)}function em(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]"),s=e.querySelector("[data-ap-runner-reject-submit]"),c=e.querySelector("[data-ap-runner-approval-error]"),u=e.querySelector(".ap-sdk-runner__approval-actions"),d=h=>{c.textContent=h,c.style.display="block"};t.addEventListener("click",async()=>{if(!fe||!Ct)return;const h=fe,k=Ct;t.disabled=!0,n.disabled=!0,c.style.display="none";try{await af(k,h),u.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,d(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=()=>{s.textContent=o.value.trim()?"Reject & Continue":"Reject Permanently"};o.addEventListener("input",p),s.addEventListener("click",async()=>{if(!fe||!Ct)return;const h=fe,k=Ct,m=o.value.trim();s.disabled=!0,t.disabled=!0,c.style.display="none",s.textContent="Rejecting…";try{await cf(k,h,m),m?Ja():(u.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--rejected">Rejected</span>',r.style.display="none")}catch(_){s.disabled=!1,t.disabled=!1,p(),d(_ instanceof Error?_.message:"Failed to reject — try again.")}})}function tm(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Si(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function nm(e,t,n){const r=!!(t.backendUrl&&t.token),o=document.createElement("div");o.className="ap-sdk-advanced",o.innerHTML=`
1507
+ `,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const s=Ui;yo(),s==null||s()}),o&&Tm(t)}function Tm(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]"),s=e.querySelector("[data-ap-runner-reject-submit]"),c=e.querySelector("[data-ap-runner-approval-error]"),u=e.querySelector(".ap-sdk-runner__approval-actions"),d=h=>{c.textContent=h,c.style.display="block"};t.addEventListener("click",async()=>{if(!ge||!$t)return;const h=ge,b=$t;t.disabled=!0,n.disabled=!0,c.style.display="none";try{await zf(b,h),u.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,d(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=()=>{s.textContent=o.value.trim()?"Reject & Continue":"Reject Permanently"};o.addEventListener("input",p),s.addEventListener("click",async()=>{if(!ge||!$t)return;const h=ge,b=$t,m=o.value.trim();s.disabled=!0,t.disabled=!0,c.style.display="none",s.textContent="Rejecting…";try{await If(b,h,m),m?bc():(u.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--rejected">Rejected</span>',r.style.display="none")}catch(_){s.disabled=!1,t.disabled=!1,p(),d(_ instanceof Error?_.message:"Failed to reject — try again.")}})}function Em(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Hi(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Am(e,t,n){const r=!!(t.backendUrl&&t.token),o=document.createElement("div");o.className="ap-sdk-advanced",o.innerHTML=`
1364
1508
  <details class="ap-sdk-advanced__details">
1365
1509
  <summary class="ap-sdk-advanced__summary">Advanced options</summary>
1366
1510
  <div class="ap-sdk-advanced__body">
@@ -1379,7 +1523,12 @@ ${n}${r?`
1379
1523
  </div>
1380
1524
  </div>
1381
1525
  </details>
1382
- `,e.appendChild(o);const s=o.querySelector("[data-ap-adv-template-field]"),c=o.querySelector("[data-ap-template]"),u=o.querySelector("[data-ap-quickmode]");let d=[];if(r){const p={backendUrl:t.backendUrl,token:t.token};Kh(p,n??void 0).then(h=>{if(d=h,h.length===0){s.style.display="none";return}const k=h.find(m=>m.isDefault&&m.scope==="project")??h.find(m=>m.isDefault&&m.scope==="global");c.innerHTML='<option value="">None (use default)</option>'+h.map(m=>`<option value="${rm(m.id)}">${om(m.name)}${m.isDefault?" (Default)":""}</option>`).join(""),c.value=(k==null?void 0:k.id)??""}).catch(()=>{s.style.display="none"})}else{c.innerHTML='<option value="">None</option>',c.disabled=!0;const p=document.createElement("span");p.className="ap-sdk-advanced__hint",p.textContent="Connect credentials to enable template selection",s.appendChild(p)}return{getOptions(){var k,m,_,w,P,N,re;const p=c.value||null,h=p?((k=d.find(R=>R.id===p))==null?void 0:k.templateData)??{}:{};return{claudeTemplateId:p,quickMode:u.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}:{},...(m=h.selectedPluginIds)!=null&&m.length?{selectedPluginIds:h.selectedPluginIds}:{},...(_=h.selectedSkillIds)!=null&&_.length?{selectedSkillIds:h.selectedSkillIds}:{},...(w=h.selectedPluginSkillIds)!=null&&w.length?{selectedPluginSkillIds:h.selectedPluginSkillIds}:{},...(P=h.selectedMcpServerIds)!=null&&P.length?{selectedMcpServerIds:h.selectedMcpServerIds}:{},...(N=h.selectedSlashCommandIds)!=null&&N.length?{selectedSlashCommandIds:h.selectedSlashCommandIds}:{},...(re=h.selectedRemoteContextProviderIds)!=null&&re.length?{selectedRemoteContextProviderIds:h.selectedRemoteContextProviderIds}:{}}}}}function rm(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function om(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const Ti="ap-sdk-captures",im=50;function Nn(){try{const e=localStorage.getItem(Ti);return e?JSON.parse(e):[]}catch{return[]}}function sm(e){const t=Nn(),n=[e,...t].slice(0,im);try{localStorage.setItem(Ti,JSON.stringify(n))}catch{}}function am(){try{localStorage.removeItem(Ti)}catch{}}const cm="data-ap-sdk",lm="ap-sdk-fab",Ya="ap-sdk-fab--dragging",Ei="ap-sdk-fab--open",Ka="ap-sdk-fab-pos",co="ap-sdk-fab--left-edge",um='<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>',dm='<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>',pm='<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 I=null,Ve=null,Ft=null,Ht=null,On=null,Dn=null,lo=null,dr=null,Mn=null,uo=null,po=null,Qa=0,ec=0,tc=0,nc=0,Un=!1,zt=!1,pr=null,ln=null;function hm(){pr=e=>{if(!I){ho();return}if(!Un){if(Math.hypot(e.clientX-tc,e.clientY-nc)<5)return;Un=!0,zt=!0,I.classList.add(Ya)}fm(e.clientX-Qa,e.clientY-ec)},ln=()=>{if(!I){ho();return}Un?(Un=!1,I.classList.remove(Ya),I.style.transition="",gm(I.getBoundingClientRect())):I.style.transition="",ho()},window.addEventListener("pointermove",pr),window.addEventListener("pointerup",ln),window.addEventListener("pointercancel",ln)}function ho(){pr&&(window.removeEventListener("pointermove",pr),pr=null),ln&&(window.removeEventListener("pointerup",ln),window.removeEventListener("pointercancel",ln),ln=null)}function fm(e,t){if(!I)return;const n=I.offsetWidth||52,r=I.offsetHeight||52;I.style.top=`${Math.max(0,Math.min(t,window.innerHeight-r))}px`,I.style.left=`${Math.max(0,Math.min(e,window.innerWidth-n))}px`,I.style.bottom="auto",I.style.right="auto"}function gm(e){if(!I)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";I.style.top="auto",I.style.bottom=`${n}px`,r==="left"?(I.style.right="auto",I.style.left="16px",I.classList.add(co)):(I.style.left="auto",I.style.right="16px",I.classList.remove(co));try{localStorage.setItem(Ka,JSON.stringify({edge:r,bottom:n}))}catch{}}function mm(){if(I)try{const e=localStorage.getItem(Ka);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));I.style.top="auto",I.style.bottom=`${r}px`,t.edge==="left"?(I.style.right="auto",I.style.left="16px",I.classList.add(co)):(I.style.left="auto",I.style.right="16px",I.classList.remove(co))}catch{}}function hr(){I==null||I.classList.remove(Ei),Mn&&(window.removeEventListener("pointerdown",Mn,{capture:!0}),Mn=null)}function bm(){I&&(I.classList.add(Ei),Mn=e=>{!I||I.contains(e.target)||hr()},requestAnimationFrame(()=>{Mn&&window.addEventListener("pointerdown",Mn,{capture:!0})}))}function Ai(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function rc(e,t){if(uo=e,po=t,I)return;I=document.createElement("div"),I.className=lm,I.setAttribute(cm,"1"),On=document.createElement("div"),On.className="ap-sdk-fab__row";const n=document.createElement("span");n.className="ap-sdk-fab__label",n.textContent="View captures",Ht=document.createElement("button"),Ht.className="ap-sdk-fab__list ap-sdk-fab__sub",Ht.setAttribute("aria-label","My captures"),Ht.setAttribute("title","View my captures"),Ht.appendChild(Ai(pm)),On.appendChild(n),On.appendChild(Ht),Dn=document.createElement("div"),Dn.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="Capture element",Ft=document.createElement("button"),Ft.className="ap-sdk-fab__capture ap-sdk-fab__sub",Ft.setAttribute("aria-label","Capture element"),Ft.setAttribute("title","Capture element to Agent Platform"),Ft.appendChild(Ai(dm)),Dn.appendChild(r),Dn.appendChild(Ft),Ve=document.createElement("button"),Ve.className="ap-sdk-fab__main",Ve.setAttribute("aria-label","Agent Platform"),Ve.setAttribute("title","Agent Platform"),Ve.appendChild(Ai(um));const o=document.createElement("span");o.className="ap-sdk-fab__badge",o.setAttribute("data-ap-badge",""),o.style.display="none",Ve.appendChild(o),I.appendChild(On),I.appendChild(Dn),I.appendChild(Ve),Ve.addEventListener("click",s=>{if(zt){zt=!1;return}s.preventDefault(),s.stopPropagation(),I!=null&&I.classList.contains(Ei)?hr():bm()}),Ft.addEventListener("click",s=>{if(zt){zt=!1;return}s.preventDefault(),s.stopPropagation(),hr(),!Xn()&&uo&&uo()}),Ht.addEventListener("click",s=>{if(zt){zt=!1;return}s.preventDefault(),s.stopPropagation(),hr(),po&&po()}),dr=s=>{if(!I||!(I===s.target||I.contains(s.target)))return;const c=I.getBoundingClientRect();Qa=s.clientX-c.left,ec=s.clientY-c.top,tc=s.clientX,nc=s.clientY,Un=!1,zt=!1,I.style.transition="none",s.stopPropagation(),hm()},window.addEventListener("pointerdown",dr,{capture:!0}),(document.body??document.documentElement).appendChild(I),Kt(I),mm(),lo=setInterval(()=>{Ve&&Ve.classList.toggle("ap-sdk-fab__main--active",Xn())},200)}function un(e){const t=Ve==null?void 0:Ve.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function oc(){Un=!1,zt=!1,ho(),hr(),lo&&(clearInterval(lo),lo=null),dr&&(window.removeEventListener("pointerdown",dr,{capture:!0}),dr=null),I&&Qt(I),I==null||I.remove(),I=null,Ve=null,Ft=null,Ht=null,On=null,Dn=null,uo=null,po=null}async function ic(e,t){try{if(e.type==="planning"){const r=await Qh(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=await oa(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch{return{capture:e,status:"unavailable",approved:!1}}}function sc(e){return e.filter(t=>!t.approved).length}async function ac(e){const t=Nn();if(!e||t.length===0){un(t.length);return}const n=await Promise.all(t.map(r=>ic(r,e)));un(sc(n))}let F=null,fr=null,ot=null,gr=null;function Ci(){return F!==null}function mr(){F&&Qt(F),F==null||F.remove(),F=null,fr==null||fr(),fr=null,gr==null||gr(),gr=null,ot==null||ot.destroy(),ot=null}function km(e,t,n,r,o,s,c,u,d){F&&mr();const p={captureType:"task",submitting:!1,completedPicks:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1},h=!n.backendUrl||!n.token;F=document.createElement("div"),F.className="ap-sdk-panel",F.setAttribute("data-ap-sdk","1"),F.setAttribute("role","dialog"),F.setAttribute("aria-modal","true"),F.setAttribute("aria-label","Capture to Agent Platform"),F.innerHTML=`
1526
+ `,e.appendChild(o);const s=o.querySelector("[data-ap-adv-template-field]"),c=o.querySelector("[data-ap-template]"),u=o.querySelector("[data-ap-quickmode]");let d=[];if(r){const p={backendUrl:t.backendUrl,token:t.token};Sf(p,n??void 0).then(h=>{if(d=h,h.length===0){s.style.display="none";return}const b=h.find(m=>m.isDefault&&m.scope==="project")??h.find(m=>m.isDefault&&m.scope==="global");c.innerHTML='<option value="">None (use default)</option>'+h.map(m=>`<option value="${Cm(m.id)}">${Pm(m.name)}${m.isDefault?" (Default)":""}</option>`).join(""),c.value=(b==null?void 0:b.id)??""}).catch(()=>{s.style.display="none"})}else{c.innerHTML='<option value="">None</option>',c.disabled=!0;const p=document.createElement("span");p.className="ap-sdk-advanced__hint",p.textContent="Connect credentials to enable template selection",s.appendChild(p)}return{getOptions(){var b,m,_,w,P,N,re;const p=c.value||null,h=p?((b=d.find(R=>R.id===p))==null?void 0:b.templateData)??{}:{};return{claudeTemplateId:p,quickMode:u.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}:{},...(m=h.selectedPluginIds)!=null&&m.length?{selectedPluginIds:h.selectedPluginIds}:{},...(_=h.selectedSkillIds)!=null&&_.length?{selectedSkillIds:h.selectedSkillIds}:{},...(w=h.selectedPluginSkillIds)!=null&&w.length?{selectedPluginSkillIds:h.selectedPluginSkillIds}:{},...(P=h.selectedMcpServerIds)!=null&&P.length?{selectedMcpServerIds:h.selectedMcpServerIds}:{},...(N=h.selectedSlashCommandIds)!=null&&N.length?{selectedSlashCommandIds:h.selectedSlashCommandIds}:{},...(re=h.selectedRemoteContextProviderIds)!=null&&re.length?{selectedRemoteContextProviderIds:h.selectedRemoteContextProviderIds}:{}}}}}function Cm(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Pm(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const Fi="ap-sdk-captures",Rm=50;function Gn(){try{const e=localStorage.getItem(Fi);return e?JSON.parse(e):[]}catch{return[]}}function Lm(e){const t=Gn(),n=[e,...t].slice(0,Rm);try{localStorage.setItem(Fi,JSON.stringify(n))}catch{}}function zm(){try{localStorage.removeItem(Fi)}catch{}}function vc(e){var c,u,d,p,h;if(e.id){const b=document.querySelector(`label[for="${CSS.escape(e.id)}"]`),m=(c=b==null?void 0:b.textContent)==null?void 0:c.trim();if(m)return m}const t=e.closest("label"),n=(u=t==null?void 0:t.textContent)==null?void 0:u.trim();if(n)return n;const r=(d=e.getAttribute("aria-label"))==null?void 0:d.trim();if(r)return r;const o=(p=e.placeholder)==null?void 0:p.trim();if(o)return o;const s=(h=e.getAttribute("name"))==null?void 0:h.trim();return s||e.tagName.toLowerCase()}function Im(e,t){return`Click "${e}" ${t.toLowerCase()}`}function yc(e,t,n){return n?`Typed [redacted] into ${e}`:`Typed "${t}" into ${e}`}function wc(e,t){return`Scrolled to (${e}, ${t})`}function $m(e,t){return t?`Pressed "${e}" in ${t}`:`Pressed "${e}"`}function xc(e){return e.map((t,n)=>`${n+1}. ${t.description}`).join(`
1527
+ `)}const Nm=400,Om=new Set(["Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),Dm=new Set(["Control","Meta","Alt","Shift"]);function Mm(e){if(Dm.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("+")):Om.has(e.key)?e.key:null}function Um(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?vc(e):Wr(e)||e.tagName.toLowerCase()}let Wn=[],We=null,So=null,Ke=null,Et=null,At=null;function Sc(){So&&(So.textContent=`● Recording — ${Wn.length} step${Wn.length===1?"":"s"}`)}function Bi(){At&&(clearTimeout(At),At=null),Et&&(Wn.push(Et),Et=null,Sc())}function Gi(e){Bi(),Wn.push(e),Sc()}function jm(e){var t,n;return e instanceof HTMLSelectElement?((n=(t=e.selectedOptions[0])==null?void 0:t.textContent)==null?void 0:n.trim())??e.value:e.value}function Zm(e,t){Ke&&Ke(),Wn=[],Et=null,We=document.createElement("div"),We.className="ap-sdk-recorder-bar",We.setAttribute("data-ap-sdk","1"),We.innerHTML=`
1528
+ <span class="ap-sdk-recorder-bar__counter" data-ap-recorder-counter>● Recording — 0 steps</span>
1529
+ <button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--stop" data-ap-recorder-stop type="button">Stop</button>
1530
+ <button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--discard" data-ap-recorder-discard type="button">Discard</button>
1531
+ `,document.body.appendChild(We),Lt(We),So=We.querySelector("[data-ap-recorder-counter]");const n=()=>{Bi();const d=Wn;Ke==null||Ke(),e(d)},r=()=>{Ke==null||Ke()};We.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),We.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=d=>{if(ur(d.target))return;const p=d.target;Gi({action:"click",cssSelector:Gr(p),elementText:Wr(p),description:Im(Wr(p),p.tagName),capturedAt:new Date().toISOString()})},s=d=>{if(ur(d.target))return;const p=d.target;if(!(p instanceof HTMLInputElement)&&!(p instanceof HTMLTextAreaElement)&&!(p instanceof HTMLSelectElement))return;const h=vc(p),b=Nf(p),m=b?"[redacted]":jm(p);Gi({action:"inputText",cssSelector:Gr(p),elementText:h,value:m,...b?{redacted:!0}:{},description:yc(h,m,b),capturedAt:new Date().toISOString()})},c=()=>{const d=Math.round(window.scrollX),p=Math.round(window.scrollY);Et?(Et.scrollX=d,Et.scrollY=p,Et.description=wc(d,p)):Et={action:"scroll",scrollX:d,scrollY:p,description:wc(d,p),capturedAt:new Date().toISOString()},At&&clearTimeout(At),At=setTimeout(()=>{At=null,Bi()},Nm)},u=d=>{if(d.key==="Escape"){r();return}if(ur(d.target))return;const p=Mm(d);if(!p)return;const h=d.target instanceof Element?d.target:document.body,b=Um(h);Gi({action:"keypress",cssSelector:Gr(h),elementText:b,key:p,description:$m(p,b),capturedAt:new Date().toISOString()})};document.addEventListener("click",o,{capture:!0}),document.addEventListener("change",s,{capture:!0}),window.addEventListener("scroll",c,{capture:!0,passive:!0}),document.addEventListener("keydown",u,{capture:!0}),Ke=()=>{document.removeEventListener("click",o,{capture:!0}),document.removeEventListener("change",s,{capture:!0}),window.removeEventListener("scroll",c,{capture:!0}),document.removeEventListener("keydown",u,{capture:!0}),At&&(clearTimeout(At),At=null),Et=null,We&&zt(We),We==null||We.remove(),We=null,So=null,Ke=null}}function qm(){Ke==null||Ke()}function To(){return Ke!==null}const Hm="data-ap-sdk",Fm="ap-sdk-fab",Tc="ap-sdk-fab--dragging",Wi="ap-sdk-fab--open",Ec="ap-sdk-fab-pos",Eo="ap-sdk-fab--left-edge",Bm='<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>',Gm='<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>',Wm='<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>',Jm='<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 I=null,Qe=null,Vt=null,Yt=null,Kt=null,Jn=null,Xn=null,Vn=null,Ao=null,Er=null,Yn=null,Co=null,Po=null,Ro=null,Ac=0,Cc=0,Pc=0,Rc=0,Kn=!1,gt=!1,Ar=null,mn=null;function Xm(){Ar=e=>{if(!I){Lo();return}if(!Kn){if(Math.hypot(e.clientX-Pc,e.clientY-Rc)<5)return;Kn=!0,gt=!0,I.classList.add(Tc)}Vm(e.clientX-Ac,e.clientY-Cc)},mn=()=>{if(!I){Lo();return}Kn?(Kn=!1,I.classList.remove(Tc),I.style.transition="",Ym(I.getBoundingClientRect())):I.style.transition="",Lo()},window.addEventListener("pointermove",Ar),window.addEventListener("pointerup",mn),window.addEventListener("pointercancel",mn)}function Lo(){Ar&&(window.removeEventListener("pointermove",Ar),Ar=null),mn&&(window.removeEventListener("pointerup",mn),window.removeEventListener("pointercancel",mn),mn=null)}function Vm(e,t){if(!I)return;const n=I.offsetWidth||52,r=I.offsetHeight||52;I.style.top=`${Math.max(0,Math.min(t,window.innerHeight-r))}px`,I.style.left=`${Math.max(0,Math.min(e,window.innerWidth-n))}px`,I.style.bottom="auto",I.style.right="auto"}function Ym(e){if(!I)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";I.style.top="auto",I.style.bottom=`${n}px`,r==="left"?(I.style.right="auto",I.style.left="16px",I.classList.add(Eo)):(I.style.left="auto",I.style.right="16px",I.classList.remove(Eo));try{localStorage.setItem(Ec,JSON.stringify({edge:r,bottom:n}))}catch{}}function Km(){if(I)try{const e=localStorage.getItem(Ec);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));I.style.top="auto",I.style.bottom=`${r}px`,t.edge==="left"?(I.style.right="auto",I.style.left="16px",I.classList.add(Eo)):(I.style.left="auto",I.style.right="16px",I.classList.remove(Eo))}catch{}}function Qn(){I==null||I.classList.remove(Wi),Yn&&(window.removeEventListener("pointerdown",Yn,{capture:!0}),Yn=null)}function Qm(){I&&(I.classList.add(Wi),Yn=e=>{!I||I.contains(e.target)||Qn()},requestAnimationFrame(()=>{Yn&&window.addEventListener("pointerdown",Yn,{capture:!0})}))}function zo(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function Lc(e,t,n){if(Co=e,Po=t,Ro=n,I)return;I=document.createElement("div"),I.className=Fm,I.setAttribute(Hm,"1"),Jn=document.createElement("div"),Jn.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(zo(Jm)),Jn.appendChild(r),Jn.appendChild(Kt),Xn=document.createElement("div"),Xn.className="ap-sdk-fab__row";const o=document.createElement("span");o.className="ap-sdk-fab__label",o.textContent="Capture element",Vt=document.createElement("button"),Vt.className="ap-sdk-fab__capture ap-sdk-fab__sub",Vt.setAttribute("aria-label","Capture element"),Vt.setAttribute("title","Capture element to Agent Platform"),Vt.appendChild(zo(Gm)),Xn.appendChild(o),Xn.appendChild(Vt),Vn=document.createElement("div"),Vn.className="ap-sdk-fab__row";const s=document.createElement("span");s.className="ap-sdk-fab__label",s.textContent="Record interaction",Yt=document.createElement("button"),Yt.className="ap-sdk-fab__record ap-sdk-fab__sub",Yt.setAttribute("aria-label","Record interaction"),Yt.setAttribute("title","Record a sequence of interactions"),Yt.appendChild(zo(Wm)),Vn.appendChild(s),Vn.appendChild(Yt),Qe=document.createElement("button"),Qe.className="ap-sdk-fab__main",Qe.setAttribute("aria-label","Agent Platform"),Qe.setAttribute("title","Agent Platform"),Qe.appendChild(zo(Bm));const c=document.createElement("span");c.className="ap-sdk-fab__badge",c.setAttribute("data-ap-badge",""),c.style.display="none",Qe.appendChild(c),I.appendChild(Jn),I.appendChild(Xn),I.appendChild(Vn),I.appendChild(Qe),Qe.addEventListener("click",u=>{if(gt){gt=!1;return}u.preventDefault(),u.stopPropagation(),I!=null&&I.classList.contains(Wi)?Qn():Qm()}),Vt.addEventListener("click",u=>{if(gt){gt=!1;return}u.preventDefault(),u.stopPropagation(),Qn(),!In()&&!To()&&Co&&Co()}),Yt.addEventListener("click",u=>{if(gt){gt=!1;return}u.preventDefault(),u.stopPropagation(),Qn(),!In()&&!To()&&Po&&Po()}),Kt.addEventListener("click",u=>{if(gt){gt=!1;return}u.preventDefault(),u.stopPropagation(),Qn(),Ro&&Ro()}),Er=u=>{if(!I||!(I===u.target||I.contains(u.target)))return;const d=I.getBoundingClientRect();Ac=u.clientX-d.left,Cc=u.clientY-d.top,Pc=u.clientX,Rc=u.clientY,Kn=!1,gt=!1,I.style.transition="none",u.stopPropagation(),Xm()},window.addEventListener("pointerdown",Er,{capture:!0}),(document.body??document.documentElement).appendChild(I),Lt(I),Km(),Ao=setInterval(()=>{Qe&&Qe.classList.toggle("ap-sdk-fab__main--active",In()||To())},200)}function bn(e){const t=Qe==null?void 0:Qe.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function zc(){Kn=!1,gt=!1,Lo(),Qn(),Ao&&(clearInterval(Ao),Ao=null),Er&&(window.removeEventListener("pointerdown",Er,{capture:!0}),Er=null),I&&zt(I),I==null||I.remove(),I=null,Qe=null,Vt=null,Yt=null,Kt=null,Jn=null,Xn=null,Vn=null,Co=null,Po=null,Ro=null}async function Ic(e,t){try{if(e.type==="planning"){const r=await Tf(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=await Ea(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch{return{capture:e,status:"unavailable",approved:!1}}}function $c(e){return e.filter(t=>!t.approved).length}async function Nc(e){const t=Gn();if(!e||t.length===0){bn(t.length);return}const n=await Promise.all(t.map(r=>Ic(r,e)));bn($c(n))}let F=null,Cr=null,Je=null,Dt=null;function Ji(){return F!==null}function Pr(){F&&zt(F),F==null||F.remove(),F=null,Cr==null||Cr(),Cr=null,Dt==null||Dt(),Dt=null,Je==null||Je.destroy(),Je=null}function Oc(e,t,n,r,o,s,c,u,d){F&&Pr();const p={captureType:"task",submitting:!1,completedPicks:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1},h=!n.backendUrl||!n.token;F=document.createElement("div"),F.className="ap-sdk-panel",F.setAttribute("data-ap-sdk","1"),F.setAttribute("role","dialog"),F.setAttribute("aria-modal","true"),F.setAttribute("aria-label","Capture to Agent Platform"),F.innerHTML=`
1383
1532
  <div class="ap-sdk-panel__header">
1384
1533
  <span class="ap-sdk-panel__title">
1385
1534
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1392,7 +1541,7 @@ ${n}${r?`
1392
1541
  </div>
1393
1542
  <div class="ap-sdk-pick-list" data-ap-pick-list style="display:none"></div>
1394
1543
  <div class="ap-sdk-panel__context" data-ap-context>
1395
- ${cc(e)}
1544
+ ${Dc(e)}
1396
1545
  </div>
1397
1546
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-panel__btn--select-parent" data-ap-select-parent type="button">
1398
1547
  ⬆ Select parent
@@ -1437,26 +1586,41 @@ ${n}${r?`
1437
1586
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-submit>Submit</button>
1438
1587
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-cancel>Cancel</button>
1439
1588
  </div>
1440
- `,F.addEventListener("wheel",j=>{j.stopPropagation()},{passive:!0}),F.addEventListener("touchmove",j=>{j.stopPropagation()},{passive:!0});const k=F.querySelector(".ap-sdk-panel__body"),m=nm(k,n,(r==null?void 0:r.id)??null);document.body.appendChild(F),ot=Mo(),ot.update(p.currentPickedEl),Kt(F),ti(F,ei);const _=F.querySelector("[data-ap-close]"),w=F.querySelector("[data-ap-cancel]"),P=F.querySelector("[data-ap-submit]"),N=F.querySelector("[data-ap-note]"),re=F.querySelector("[data-ap-status]"),R=F.querySelectorAll("[data-ap-type]"),x=F.querySelector("[data-ap-pick-list]"),S=F.querySelector("[data-ap-context]"),C=F.querySelector("[data-ap-add-another]"),M=F.querySelector("[data-ap-select-parent]"),se=()=>{ot==null||ot.update(p.currentPickedEl)};window.addEventListener("scroll",se,{capture:!0,passive:!0}),window.addEventListener("resize",se),gr=()=>{window.removeEventListener("scroll",se,!0),window.removeEventListener("resize",se)};const ke=j=>{j?(S.innerHTML=cc(j),N.disabled=!1,N.placeholder="Describe the task or planning session…",setTimeout(()=>N.focus(),50)):(S.innerHTML=`
1589
+ `,F.addEventListener("wheel",Z=>{Z.stopPropagation()},{passive:!0}),F.addEventListener("touchmove",Z=>{Z.stopPropagation()},{passive:!0});const b=F.querySelector(".ap-sdk-panel__body"),m=Am(b,n,(r==null?void 0:r.id)??null);document.body.appendChild(F),Je=ri(),p.currentPickedEl&&Je.update(p.currentPickedEl),Lt(F),vi(F,_i);const _=F.querySelector("[data-ap-close]"),w=F.querySelector("[data-ap-cancel]"),P=F.querySelector("[data-ap-submit]"),N=F.querySelector("[data-ap-note]"),re=F.querySelector("[data-ap-status]"),R=F.querySelectorAll("[data-ap-type]"),x=F.querySelector("[data-ap-pick-list]"),S=F.querySelector("[data-ap-context]"),C=F.querySelector("[data-ap-add-another]"),M=F.querySelector("[data-ap-select-parent]"),se=()=>{p.currentPickedEl&&(Je==null||Je.update(p.currentPickedEl))};window.addEventListener("scroll",se,{capture:!0,passive:!0}),window.addEventListener("resize",se),Dt=()=>{window.removeEventListener("scroll",se,!0),window.removeEventListener("resize",se)};const ve=Z=>{Z?(S.innerHTML=Dc(Z),N.disabled=!1,N.placeholder="Describe the task or planning session…",setTimeout(()=>N.focus(),50)):(S.innerHTML=`
1441
1590
  <div class="ap-sdk-panel__context-label">Next element</div>
1442
1591
  <div class="ap-sdk-panel__context-text ap-sdk-awaiting-pick">👆 Hover and click any element on the page</div>
1443
- `,N.disabled=!0,N.placeholder="Pick an element to continue…")},ze=()=>{if(p.completedPicks.length===0){x.style.display="none",x.innerHTML="";return}x.style.display="block",x.innerHTML=p.completedPicks.map((j,Q)=>`
1444
- <div class="ap-sdk-pick-entry" data-pick-index="${Q}">
1592
+ `,N.disabled=!0,N.placeholder="Pick an element to continue…")},$e=()=>{if(p.completedPicks.length===0){x.style.display="none",x.innerHTML="";return}x.style.display="block",x.innerHTML=p.completedPicks.map((Z,X)=>`
1593
+ <div class="ap-sdk-pick-entry" data-pick-index="${X}">
1445
1594
  <div class="ap-sdk-pick-entry__header">
1446
- <span class="ap-sdk-pick-entry__number">${Q+1}</span>
1447
- <span class="ap-sdk-pick-entry__element" title="${it(j.ctx.elementText??"")}">${it(j.ctx.elementText||"(no text)")}</span>
1448
- <button class="ap-sdk-pick-entry__remove" data-ap-remove="${Q}" aria-label="Remove pick ${Q+1}">×</button>
1595
+ <span class="ap-sdk-pick-entry__number">${X+1}</span>
1596
+ <span class="ap-sdk-pick-entry__element" title="${nt(Z.ctx.elementText??"")}">${nt(Z.ctx.elementText||"(no text)")}</span>
1597
+ <button class="ap-sdk-pick-entry__remove" data-ap-remove="${X}" aria-label="Remove pick ${X+1}">×</button>
1449
1598
  </div>
1450
- <div class="ap-sdk-pick-entry__instruction">${it(j.instruction)}</div>
1599
+ <div class="ap-sdk-pick-entry__instruction">${nt(Z.instruction)}</div>
1451
1600
  </div>
1452
- `).join(""),x.querySelectorAll("[data-ap-remove]").forEach(j=>{j.addEventListener("click",()=>{const Q=parseInt(j.dataset.apRemove,10);p.completedPicks.splice(Q,1),ze()})})},Ye=()=>{M.disabled=!p.currentPickedEl.parentElement||p.awaitingPick},K=(j,Q)=>{p.currentCtx=j,p.currentPickedEl=Q,ke(j),ot==null||ot.update(Q),Ye()};Ye(),M.addEventListener("click",()=>{const j=p.currentPickedEl.parentElement;j&&K(Yi(j),j)});const me=()=>{mr(),d==null||d()};_.addEventListener("click",me),w.addEventListener("click",me),R.forEach(j=>{j.addEventListener("click",()=>{p.captureType=j.dataset.apType,R.forEach(Q=>Q.classList.toggle("ap-sdk-active",Q===j))})});const Ke=j=>{j.key==="Escape"&&me()};document.addEventListener("keydown",Ke),fr=()=>document.removeEventListener("keydown",Ke);const Wt=F.querySelector("[data-ap-reconfigure]");if(c?Wt.addEventListener("click",()=>{me(),c()}):Wt.style.display="none",C&&u){const j=()=>{C.disabled=!N.value.trim()||p.submitting||p.awaitingPick};N.addEventListener("input",j),C.addEventListener("click",()=>{const Q=N.value.trim();!Q||p.awaitingPick||(p.completedPicks.push({ctx:p.currentCtx,instruction:Q}),ze(),N.value="",p.awaitingPick=!0,C.disabled=!0,Ye(),ke(null),u((Le,Oe)=>{p.awaitingPick=!1,K(Le,Oe),j()}))})}P.addEventListener("click",async()=>{var be;if(p.submitting)return;let j=n.backendUrl??"",Q=n.token??"";if(h){const Te=F==null?void 0:F.querySelector("[data-ap-backend-url]"),G=F==null?void 0:F.querySelector("[data-ap-token]");if(Te&&(j=Te.value.trim()),G&&(Q=G.value.trim()),!j){br(re,"error","Backend URL is required.");return}if(!Q){br(re,"error","API Token is required.");return}}const Le=N.value.trim();if(!Le){br(re,"error","Please enter an instruction.");return}p.submitting=!0,lc(F,!0),br(re,null,""),P.textContent="Submitting…";const Oe={backendUrl:j,token:Q},St=m.getOptions(),ht=[...p.completedPicks,{ctx:p.currentCtx,instruction:Le}];try{let Te=r;Te||(Te=await ta(Oe,o),s({backendUrl:j,token:Q}));let G,He,J;if(ht.length===1)if(p.captureType==="task")G=(await Yo(Oe,Te.id,Le,p.currentCtx,St)).id,He="task",J=Le.slice(0,120)||p.currentCtx.pageTitle||"Browser capture";else if(p.captureType==="planning"){let Qe=tl(Le,{...p.currentCtx,ancestry:p.currentCtx.outerTree||p.currentCtx.ancestry});(be=p.currentCtx.innerTree)!=null&&be.trim()&&(Qe+=`
1601
+ `).join(""),x.querySelectorAll("[data-ap-remove]").forEach(Z=>{Z.addEventListener("click",()=>{const X=parseInt(Z.dataset.apRemove,10);p.completedPicks.splice(X,1),$e()})})},et=()=>{if(!p.currentPickedEl){M.style.display="none";return}M.style.display="",M.disabled=!p.currentPickedEl.parentElement||p.awaitingPick},Q=(Z,X)=>{p.currentCtx=Z,p.currentPickedEl=X,ve(Z),Je==null||Je.update(X),et()};et(),M.addEventListener("click",()=>{var X;const Z=(X=p.currentPickedEl)==null?void 0:X.parentElement;Z&&Q(ks(Z),Z)});const be=()=>{Pr(),d==null||d()};_.addEventListener("click",be),w.addEventListener("click",be),R.forEach(Z=>{Z.addEventListener("click",()=>{p.captureType=Z.dataset.apType,R.forEach(X=>X.classList.toggle("ap-sdk-active",X===Z))})});const tt=Z=>{Z.key==="Escape"&&be()};document.addEventListener("keydown",tt),Cr=()=>document.removeEventListener("keydown",tt);const tn=F.querySelector("[data-ap-reconfigure]");if(c?tn.addEventListener("click",()=>{be(),c()}):tn.style.display="none",C&&u){const Z=()=>{C.disabled=!N.value.trim()||p.submitting||p.awaitingPick};N.addEventListener("input",Z),C.addEventListener("click",()=>{const X=N.value.trim();!X||p.awaitingPick||(p.completedPicks.push({ctx:p.currentCtx,instruction:X}),$e(),N.value="",p.awaitingPick=!0,C.disabled=!0,et(),ve(null),u((Ne,Ue)=>{p.awaitingPick=!1,Q(Ne,Ue),Z()}))})}P.addEventListener("click",async()=>{var ke,vn;if(p.submitting)return;let Z=n.backendUrl??"",X=n.token??"";if(h){const W=F==null?void 0:F.querySelector("[data-ap-backend-url]"),Re=F==null?void 0:F.querySelector("[data-ap-token]");if(W&&(Z=W.value.trim()),Re&&(X=Re.value.trim()),!Z){Rr(re,"error","Backend URL is required.");return}if(!X){Rr(re,"error","API Token is required.");return}}const Ne=N.value.trim();if(!Ne){Rr(re,"error","Please enter an instruction.");return}p.submitting=!0,Mc(F,!0),Rr(re,null,""),P.textContent="Submitting…";const Ue={backendUrl:Z,token:X},Ct=m.getOptions(),ct=[...p.completedPicks,{ctx:p.currentCtx,instruction:Ne}];try{let W=r;W||(W=await xa(Ue,o),s({backendUrl:Z,token:X}));let Re,J,_e;if(ct.length===1)if(p.captureType==="task")Re=(await mi(Ue,W.id,Ne,p.currentCtx,Ct)).id,J="task",_e=Ne.slice(0,120)||p.currentCtx.pageTitle||"Browser capture";else if(p.captureType==="planning"){let Le=Al(Ne,{...p.currentCtx,ancestry:p.currentCtx.outerTree||p.currentCtx.ancestry});(ke=p.currentCtx.innerTree)!=null&&ke.trim()&&(Le+=`
1453
1602
 
1454
1603
  Element tree:
1455
- ${p.currentCtx.innerTree}`),G=(await ra(Oe,Te.id,Qe,St)).id,He="planning",J=Le.slice(0,120)||p.currentCtx.pageTitle||"Planning session"}else G=(await na(Oe,Te.id,Le,p.currentCtx,St)).id,He="automate",J=Le.slice(0,120)||p.currentCtx.pageTitle||"Browser automation";else{const Qe=_m(ht),We=ht[0].instruction.slice(0,120)||ht[0].ctx.pageTitle||"Multi-element capture";p.captureType==="task"?(G=(await Yo(Oe,Te.id,Qe,ht[0].ctx,St,We)).id,He="task",J=We):p.captureType==="planning"?(G=(await ra(Oe,Te.id,Qe,St)).id,He="planning",J=We):(G=(await na(Oe,Te.id,Qe,ht[0].ctx,St,We)).id,He="automate",J=We)}if(sm({id:G,type:He,title:J,backendUrl:j,createdAt:new Date().toISOString()}),ac(Oe).catch(()=>{}),h&&s({backendUrl:j,token:Q}),He==="automate"){me(),wi(G,Oe,j,J,d);return}const Be=He==="task"?`${j.replace(/\/+$/,"")}/tasks/${G}`:`${j.replace(/\/+$/,"")}/planning/${G}`;vm(re,He,J,Be,me),F.classList.add("ap-sdk-panel--success"),p.submitting=!1}catch(Te){br(re,"error",Te instanceof Error?Te.message:"An unexpected error occurred."),p.submitting=!1,lc(F,!1),P.textContent="Submit"}}),setTimeout(()=>N.focus(),50)}function cc(e){return`
1604
+ ${p.currentCtx.innerTree}`),(vn=p.currentCtx.interactionSteps)!=null&&vn.length&&(Le+=`
1605
+
1606
+ Recorded steps:
1607
+ ${xc(p.currentCtx.interactionSteps)}`),Re=(await Ta(Ue,W.id,Le,Ct)).id,J="planning",_e=Ne.slice(0,120)||p.currentCtx.pageTitle||"Planning session"}else Re=(await Sa(Ue,W.id,Ne,p.currentCtx,Ct)).id,J="automate",_e=Ne.slice(0,120)||p.currentCtx.pageTitle||"Browser automation";else{const Le=tb(ct),ae=ct[0].instruction.slice(0,120)||ct[0].ctx.pageTitle||"Multi-element capture",xe=ct.map(Mt=>Mt.instruction).filter(Boolean).join(`
1608
+
1609
+ `);p.captureType==="task"?(Re=(await mi(Ue,W.id,Le,ct[0].ctx,Ct,ae,wa,xe)).id,J="task",_e=ae):p.captureType==="planning"?(Re=(await Ta(Ue,W.id,Le,Ct)).id,J="planning",_e=ae):(Re=(await Sa(Ue,W.id,Le,ct[0].ctx,Ct,ae,xe)).id,J="automate",_e=ae)}if(Lm({id:Re,type:J,title:_e,backendUrl:Z,createdAt:new Date().toISOString()}),Nc(Ue).catch(()=>{}),h&&s({backendUrl:Z,token:X}),J==="automate"){be(),Zi(Re,Ue,Z,_e,d);return}const yn=J==="task"?`${Z.replace(/\/+$/,"")}/tasks/${Re}`:`${Z.replace(/\/+$/,"")}/planning/${Re}`;nb(re,J,_e,yn,be),F.classList.add("ap-sdk-panel--success"),Dt==null||Dt(),Dt=null,Je==null||Je.hide(),p.submitting=!1}catch(W){Rr(re,"error",W instanceof Error?W.message:"An unexpected error occurred."),p.submitting=!1,Mc(F,!1),P.textContent="Submit"}}),setTimeout(()=>N.focus(),50)}const eb={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};function Dc(e){var t;return(t=e.interactionSteps)!=null&&t.length?`
1610
+ <div class="ap-sdk-panel__context-label">Recorded steps (${e.interactionSteps.length})</div>
1611
+ <div class="ap-sdk-panel__context-steps">
1612
+ ${e.interactionSteps.map(n=>`
1613
+ <div class="ap-sdk-panel__context-step">
1614
+ <span class="ap-sdk-panel__context-step-icon">${eb[n.action]}</span>
1615
+ <span class="ap-sdk-panel__context-step-text">${nt(n.description)}</span>
1616
+ </div>
1617
+ `).join("")}
1618
+ </div>
1619
+ `:`
1456
1620
  <div class="ap-sdk-panel__context-label">Captured element</div>
1457
- <div class="ap-sdk-panel__context-text" title="${it(e.elementText??"")}">${it(e.elementText||"(no text)")}</div>
1458
- ${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${it(e.cssSelector)}">${it(e.cssSelector)}</div>`:""}
1459
- `}function _m(e){return e.map((t,n)=>{var o;const r=[`## Pick ${n+1}`,""];return 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})`),(o=t.ctx.innerTree)!=null&&o.trim()&&r.push(`
1621
+ <div class="ap-sdk-panel__context-text" title="${nt(e.elementText??"")}">${nt(e.elementText||"(no text)")}</div>
1622
+ ${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${nt(e.cssSelector)}">${nt(e.cssSelector)}</div>`:""}
1623
+ `}function tb(e){return e.map((t,n)=>{var o,s;const r=[`## Pick ${n+1}`,""];return(o=t.ctx.interactionSteps)!=null&&o.length?r.push("Recorded steps:",xc(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})`),(s=t.ctx.innerTree)!=null&&s.trim()&&r.push(`
1460
1624
  Element tree:
1461
1625
  ${t.ctx.innerTree}`),r.push("",`Instruction:
1462
1626
  ${t.instruction}`),r.join(`
@@ -1464,23 +1628,23 @@ ${t.instruction}`),r.join(`
1464
1628
 
1465
1629
  ---
1466
1630
 
1467
- `)}function br(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 vm(e,t,n,r,o){const s=t==="task"?"Task":"Planning",c=t==="task"?"Task created successfully!":"Planning session created!",u=t==="task"?"View task →":"View planning session →",d=n.length>55?`${n.slice(0,52)}…`:n;e.style.display="block",e.className="ap-sdk-panel__status",e.innerHTML=`
1631
+ `)}function Rr(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 nb(e,t,n,r,o){const s=t==="task"?"Task":"Planning",c=t==="task"?"Task created successfully!":"Planning session created!",u=t==="task"?"View task →":"View planning session →",d=n.length>55?`${n.slice(0,52)}…`:n;e.style.display="block",e.className="ap-sdk-panel__status",e.innerHTML=`
1468
1632
  <div class="ap-sdk-success-card">
1469
1633
  <svg class="ap-sdk-success-check" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
1470
1634
  <circle class="ap-sdk-success-check__circle" cx="24" cy="24" r="22"/>
1471
1635
  <path class="ap-sdk-success-check__tick" d="M14 24l7 7 13-14"/>
1472
1636
  </svg>
1473
- <p class="ap-sdk-success-headline">${it(c)}</p>
1637
+ <p class="ap-sdk-success-headline">${nt(c)}</p>
1474
1638
  <div class="ap-sdk-success-meta">
1475
- <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${it(s)}</span>
1476
- <span class="ap-sdk-success-title" title="${it(n)}">${it(d)}</span>
1639
+ <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${nt(s)}</span>
1640
+ <span class="ap-sdk-success-title" title="${nt(n)}">${nt(d)}</span>
1477
1641
  </div>
1478
1642
  <div class="ap-sdk-success-actions">
1479
- <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${it(u)}</button>
1643
+ <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${nt(u)}</button>
1480
1644
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-success-close>Close</button>
1481
1645
  </div>
1482
1646
  </div>
1483
- `,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function lc(e,t){e.querySelectorAll("button, input, textarea, select").forEach(n=>{n.disabled=t})}function it(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}let ne=null,kr=null;function uc(){return ne!==null}function Bt(){kr&&(document.removeEventListener("keydown",kr),kr=null),ne&&Qt(ne),ne==null||ne.remove(),ne=null}function ym(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function wm(e){if(ne){Bt();return}ne=document.createElement("div"),ne.className="ap-sdk-panel",ne.setAttribute("data-ap-sdk","1"),ne.setAttribute("role","dialog"),ne.setAttribute("aria-modal","true"),ne.setAttribute("aria-label","My captures"),ne.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),ne.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),ne.innerHTML=`
1647
+ `,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function Mc(e,t){e.querySelectorAll("button, input, textarea, select").forEach(n=>{n.disabled=t})}function nt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}let ne=null,Lr=null;function Uc(){return ne!==null}function Qt(){Lr&&(document.removeEventListener("keydown",Lr),Lr=null),ne&&zt(ne),ne==null||ne.remove(),ne=null}function rb(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function ob(e){if(ne){Qt();return}ne=document.createElement("div"),ne.className="ap-sdk-panel",ne.setAttribute("data-ap-sdk","1"),ne.setAttribute("role","dialog"),ne.setAttribute("aria-modal","true"),ne.setAttribute("aria-label","My captures"),ne.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),ne.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),ne.innerHTML=`
1484
1648
  <div class="ap-sdk-panel__header">
1485
1649
  <span class="ap-sdk-panel__title">
1486
1650
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1493,18 +1657,18 @@ ${t.instruction}`),r.join(`
1493
1657
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-clear-history>Clear history</button>
1494
1658
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-close-list>Close</button>
1495
1659
  </div>
1496
- `,document.body.appendChild(ne),Kt(ne),ti(ne,ei),kr=t=>{t.key==="Escape"&&Bt()},document.addEventListener("keydown",kr),ne.querySelector("[data-ap-close]").addEventListener("click",()=>{Bt()}),ne.querySelector("[data-ap-close-list]").addEventListener("click",()=>{Bt()}),ne.querySelector("[data-ap-clear-history]").addEventListener("click",()=>{am(),un(0),dc(e)}),dc(e)}function dc(e){if(!ne)return;const t=ne.querySelector("[data-ap-list-body]"),n=Nn();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=>`
1660
+ `,document.body.appendChild(ne),Lt(ne),vi(ne,_i),Lr=t=>{t.key==="Escape"&&Qt()},document.addEventListener("keydown",Lr),ne.querySelector("[data-ap-close]").addEventListener("click",()=>{Qt()}),ne.querySelector("[data-ap-close-list]").addEventListener("click",()=>{Qt()}),ne.querySelector("[data-ap-clear-history]").addEventListener("click",()=>{zm(),bn(0),jc(e)}),jc(e)}function jc(e){if(!ne)return;const t=ne.querySelector("[data-ap-list-body]"),n=Gn();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=>`
1497
1661
  <div class="ap-sdk-list-item">
1498
1662
  <div class="ap-sdk-list-item__row">
1499
- <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${ym(r.type)}</span>
1500
- <span class="ap-sdk-list-item__title" title="${fo(r.title)}">${Tm(r.title)}</span>
1663
+ <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${rb(r.type)}</span>
1664
+ <span class="ap-sdk-list-item__title" title="${Io(r.title)}">${ab(r.title)}</span>
1501
1665
  </div>
1502
1666
  <div class="ap-sdk-list-item__row">
1503
- <span class="ap-sdk-status-badge" data-ap-status="${fo(r.id)}">${e?"…":"—"}</span>
1504
- ${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${fo(r.id)}">Resume →</button>`:`<a class="ap-sdk-list-item__link" href="${fo(Sm(r))}" target="_blank" rel="noopener noreferrer">View →</a>`}
1667
+ <span class="ap-sdk-status-badge" data-ap-status="${Io(r.id)}">${e?"…":"—"}</span>
1668
+ ${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${Io(r.id)}">Resume →</button>`:`<a class="ap-sdk-list-item__link" href="${Io(sb(r))}" target="_blank" rel="noopener noreferrer">View →</a>`}
1505
1669
  </div>
1506
1670
  </div>
1507
- `).join(""),e){const r=e;Promise.all(n.map(o=>xm(o,r))).then(o=>{un(sc(o))}),t.querySelectorAll("[data-ap-resume]").forEach(o=>{o.addEventListener("click",()=>{const s=o.dataset.apResume,c=n.find(u=>u.id===s);c&&(Bt(),wi(c.id,r,c.backendUrl,c.title,()=>{}))})})}}async function xm(e,t){const n=await ic(e,t),r=ne==null?void 0:ne.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 Sm(e){const t=e.backendUrl.replace(/\/+$/,"");return e.type==="planning"?`${t}/planning/${e.id}`:`${t}/tasks/${e.id}`}function fo(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Tm(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const Pi="ap-sdk-config";function Em(){try{const e=localStorage.getItem(Pi);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.backendUrl&&(t!=null&&t.token)&&(t!=null&&t.projectCode)?t:null}catch{return null}}function Am(e){localStorage.setItem(Pi,JSON.stringify(e))}function Cm(){localStorage.removeItem(Pi)}let Y=null;function jn(){Y&&Qt(Y),Y==null||Y.remove(),Y=null}function Pm(e){Y&&jn(),Y=document.createElement("div"),Y.className="ap-sdk-panel",Y.setAttribute("data-ap-sdk","1"),Y.setAttribute("role","dialog"),Y.setAttribute("aria-modal","true"),Y.setAttribute("aria-label","Connect to Agent Platform");const t=o=>{o.key==="Escape"&&(document.removeEventListener("keydown",t),jn())};document.addEventListener("keydown",t),n("",""),document.body.appendChild(Y),Kt(Y);function n(o,s){if(!Y)return;Y.innerHTML=`
1671
+ `).join(""),e){const r=e;Promise.all(n.map(o=>ib(o,r))).then(o=>{bn($c(o))}),t.querySelectorAll("[data-ap-resume]").forEach(o=>{o.addEventListener("click",()=>{const s=o.dataset.apResume,c=n.find(u=>u.id===s);c&&(Qt(),Zi(c.id,r,c.backendUrl,c.title,()=>{}))})})}}async function ib(e,t){const n=await Ic(e,t),r=ne==null?void 0:ne.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 sb(e){const t=e.backendUrl.replace(/\/+$/,"");return e.type==="planning"?`${t}/planning/${e.id}`:`${t}/tasks/${e.id}`}function Io(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ab(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const Xi="ap-sdk-config";function cb(){try{const e=localStorage.getItem(Xi);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.backendUrl&&(t!=null&&t.token)&&(t!=null&&t.projectCode)?t:null}catch{return null}}function lb(e){localStorage.setItem(Xi,JSON.stringify(e))}function ub(){localStorage.removeItem(Xi)}let K=null;function er(){K&&zt(K),K==null||K.remove(),K=null}function db(e){K&&er(),K=document.createElement("div"),K.className="ap-sdk-panel",K.setAttribute("data-ap-sdk","1"),K.setAttribute("role","dialog"),K.setAttribute("aria-modal","true"),K.setAttribute("aria-label","Connect to Agent Platform");const t=o=>{o.key==="Escape"&&(document.removeEventListener("keydown",t),er())};document.addEventListener("keydown",t),n("",""),document.body.appendChild(K),Lt(K);function n(o,s){if(!K)return;K.innerHTML=`
1508
1672
  <div class="ap-sdk-panel__header">
1509
1673
  <span class="ap-sdk-panel__title">
1510
1674
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1517,13 +1681,13 @@ ${t.instruction}`),r.join(`
1517
1681
  <label class="ap-sdk-panel__label" for="ap-sdk-cfg-url">Backend URL</label>
1518
1682
  <input id="ap-sdk-cfg-url" class="ap-sdk-panel__input" type="url"
1519
1683
  placeholder="https://your-platform.example.com"
1520
- value="${Ri(o)}" autocomplete="off" data-ap-cfg-url />
1684
+ value="${Vi(o)}" autocomplete="off" data-ap-cfg-url />
1521
1685
  </div>
1522
1686
  <div class="ap-sdk-panel__field">
1523
1687
  <label class="ap-sdk-panel__label" for="ap-sdk-cfg-token">API Token</label>
1524
1688
  <input id="ap-sdk-cfg-token" class="ap-sdk-panel__input" type="password"
1525
1689
  placeholder="Paste your personal API token"
1526
- value="${Ri(s)}" autocomplete="off" data-ap-cfg-token />
1690
+ value="${Vi(s)}" autocomplete="off" data-ap-cfg-token />
1527
1691
  </div>
1528
1692
  <p class="ap-sdk-config-hint">
1529
1693
  Create a token at <strong>Settings &rsaquo; API Tokens</strong> in Agent Platform.
@@ -1534,7 +1698,7 @@ ${t.instruction}`),r.join(`
1534
1698
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-connect>Connect</button>
1535
1699
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-cancel>Cancel</button>
1536
1700
  </div>
1537
- `;const c=Y.querySelector("[data-ap-cfg-url]"),u=Y.querySelector("[data-ap-cfg-token]"),d=Y.querySelector("[data-ap-cfg-status]"),p=Y.querySelector("[data-ap-connect]");Y.querySelector("[data-ap-close]").addEventListener("click",()=>{document.removeEventListener("keydown",t),jn()}),Y.querySelector("[data-ap-cancel]").addEventListener("click",()=>{document.removeEventListener("keydown",t),jn()}),p.addEventListener("click",async()=>{const h=c.value.trim(),k=u.value.trim();if(!h){Zn(d,"error","Backend URL is required.");return}if(!k){Zn(d,"error","API Token is required.");return}p.disabled=!0,p.textContent="Connecting…",Zn(d,null,"");try{const _=await ef({backendUrl:h,token:k});if(_.length===0){Zn(d,"error","No projects found — check your token permissions."),p.disabled=!1,p.textContent="Connect";return}r(h,k,_)}catch(m){Zn(d,"error",`Could not connect — ${m instanceof Error?m.message:"check URL and token"}`),p.disabled=!1,p.textContent="Connect"}}),setTimeout(()=>c.focus(),50)}function r(o,s,c){if(!Y)return;const u=c.map(h=>`<option value="${Ri(h.key)}">${pc(h.name)} (${pc(h.key)})</option>`).join("");Y.innerHTML=`
1701
+ `;const c=K.querySelector("[data-ap-cfg-url]"),u=K.querySelector("[data-ap-cfg-token]"),d=K.querySelector("[data-ap-cfg-status]"),p=K.querySelector("[data-ap-connect]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{document.removeEventListener("keydown",t),er()}),K.querySelector("[data-ap-cancel]").addEventListener("click",()=>{document.removeEventListener("keydown",t),er()}),p.addEventListener("click",async()=>{const h=c.value.trim(),b=u.value.trim();if(!h){tr(d,"error","Backend URL is required.");return}if(!b){tr(d,"error","API Token is required.");return}p.disabled=!0,p.textContent="Connecting…",tr(d,null,"");try{const _=await Ef({backendUrl:h,token:b});if(_.length===0){tr(d,"error","No projects found — check your token permissions."),p.disabled=!1,p.textContent="Connect";return}r(h,b,_)}catch(m){tr(d,"error",`Could not connect — ${m instanceof Error?m.message:"check URL and token"}`),p.disabled=!1,p.textContent="Connect"}}),setTimeout(()=>c.focus(),50)}function r(o,s,c){if(!K)return;const u=c.map(h=>`<option value="${Vi(h.key)}">${Zc(h.name)} (${Zc(h.key)})</option>`).join("");K.innerHTML=`
1538
1702
  <div class="ap-sdk-panel__header">
1539
1703
  <span class="ap-sdk-panel__title">
1540
1704
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1556,5 +1720,26 @@ ${t.instruction}`),r.join(`
1556
1720
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-save>Save</button>
1557
1721
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-back>Back</button>
1558
1722
  </div>
1559
- `;const d=Y.querySelector("[data-ap-cfg-project]"),p=Y.querySelector("[data-ap-cfg-status]");Y.querySelector("[data-ap-close]").addEventListener("click",()=>{document.removeEventListener("keydown",t),jn()}),Y.querySelector("[data-ap-back]").addEventListener("click",()=>n(o,s)),Y.querySelector("[data-ap-save]").addEventListener("click",()=>{const h=d.value;if(!h){Zn(p,"error","Please select a project.");return}document.removeEventListener("keydown",t),jn(),e({backendUrl:o,token:s,projectCode:h})})}}function Zn(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 Ri(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function pc(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let st=null,go=!1;function Rm(){st==null||st.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),st&&st.observe(document.body,{childList:!0}),go=!1}function hc(){st||(st=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||go||(go=!0,queueMicrotask(Rm))}),st.observe(document.body,{childList:!0}))}function zm(){st==null||st.disconnect(),st=null,go=!1}let H=null,mo=null,bo=null;function zi(e,t){mo=e,bo=t,rc(e,t)}const fc="#agent-platform-web-sdk",gc="ap-sdk-fab-unlocked";let dn=null;function mc(){try{if(localStorage.getItem(gc)==="1")return!0}catch{}return window.location.hash===fc}function bc(){try{localStorage.setItem(gc,"1")}catch{}}async function kc(e){if(Lr(),!(H&&H.projectCode===e.projectCode&&H.backendUrl===(e.backendUrl??null)&&H.token===(e.token??null))){if(H={projectCode:e.projectCode,backendUrl:e.backendUrl??null,token:e.token??null,project:null,resolvingProject:!1},zi(()=>vc(),()=>Li()),un(Nn().length),H.backendUrl&&H.token){const t=H.backendUrl,n=H.token;await Tc(),ac({backendUrl:t,token:n}).catch(()=>{});const r=kf();r&&wi(r.taskId,{backendUrl:t,token:n},r.backendUrl,r.title,()=>{})}hc()}}async function _c(e,t){if(!H)throw new Error("AgentPlatformSDK: call init() first.");H.backendUrl=e,H.token=t,H.project=null,await Tc()}function vc(){if(!H)throw new Error("AgentPlatformSDK: call init() first.");Xn()||(Lr(),Ki(async(e,t)=>{uc()&&Bt(),km(e,t,{backendUrl:H.backendUrl,token:H.token},H.project,H.projectCode,async n=>{await _c(n.backendUrl,n.token)},ko,n=>{Ki((r,o)=>{Ci()&&n(r,o)},()=>{yc()})},()=>{Xn()&&Uo()})},()=>{}))}function Lm(){Uo()}function yc(){Ci()&&mr()}function Im(){return Xn()}function wc(){zm(),dn&&(window.removeEventListener("hashchange",dn),dn=null),Uo(),mr(),Bt(),oc(),mo=null,bo=null,H=null}function xc(){if(typeof window>"u"||typeof document>"u")return;Lr();const e=Em(),t=()=>{e?Sc(e).catch(console.error):(zi(()=>ko(),()=>Li()),un(Nn().length),hc())};if(mc()){bc(),t();return}dn=()=>{window.location.hash===fc&&(bc(),window.removeEventListener("hashchange",dn),dn=null,t())},window.addEventListener("hashchange",dn)}function $m(){mo&&bo&&rc(mo,bo)}function Nm(){oc()}function ko(){Pm(e=>{Am(e),Sc(e).catch(console.error)})}function Om(){Cm(),wc(),Lr(),mc()&&(zi(()=>ko(),()=>Li()),un(Nn().length))}async function Sc(e){await kc({projectCode:e.projectCode,backendUrl:e.backendUrl,token:e.token})}function Li(){if(uc()){Bt();return}Ci()&&mr();const e=H!=null&&H.backendUrl&&(H!=null&&H.token)?{backendUrl:H.backendUrl,token:H.token}:null;wm(e)}async function Tc(){if(!(!H||!H.backendUrl||!H.token||H.project||H.resolvingProject)){H.resolvingProject=!0;try{H.project=await ta({backendUrl:H.backendUrl,token:H.token},H.projectCode)}catch{}finally{H&&(H.resolvingProject=!1)}}}return xc(),we.activateElementPicker=vc,we.autoInit=xc,we.clearConfig=Om,we.closePanelIfOpen=yc,we.configure=ko,we.deactivateElementPicker=Lm,we.destroy=wc,we.hideFab=Nm,we.init=kc,we.isPickerRunning=Im,we.showFab=$m,we.updateCredentials=_c,Object.defineProperty(we,Symbol.toStringTag,{value:"Module"}),we}({});
1723
+ `;const d=K.querySelector("[data-ap-cfg-project]"),p=K.querySelector("[data-ap-cfg-status]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{document.removeEventListener("keydown",t),er()}),K.querySelector("[data-ap-back]").addEventListener("click",()=>n(o,s)),K.querySelector("[data-ap-save]").addEventListener("click",()=>{const h=d.value;if(!h){tr(p,"error","Please select a project.");return}document.removeEventListener("keydown",t),er(),e({backendUrl:o,token:s,projectCode:h})})}}function tr(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 Vi(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Zc(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let at=null,$o=!1;function pb(){at==null||at.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),at&&at.observe(document.body,{childList:!0}),$o=!1}function qc(){at||(at=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||$o||($o=!0,queueMicrotask(pb))}),at.observe(document.body,{childList:!0}))}function hb(){at==null||at.disconnect(),at=null,$o=!1}const fb={click:"🖱",inputText:"⌨",scroll:"",keypress:""};let Ee=null,zr=null,en=[];function No(){Ee&&zt(Ee),Ee==null||Ee.remove(),Ee=null,zr==null||zr(),zr=null,en=[]}function gb(e,t,n){Ee&&No(),en=[...e],Ee=document.createElement("div"),Ee.className="ap-sdk-panel ap-sdk-record-review",Ee.setAttribute("data-ap-sdk","1"),Ee.setAttribute("role","dialog"),Ee.setAttribute("aria-modal","true"),Ee.setAttribute("aria-label","Review recorded steps"),Ee.innerHTML=`
1724
+ <div class="ap-sdk-panel__header">
1725
+ <span class="ap-sdk-panel__title">
1726
+ <span class="ap-sdk-panel__logo">AP</span>
1727
+ Review recorded steps
1728
+ </span>
1729
+ <div class="ap-sdk-panel__header-actions">
1730
+ <button class="ap-sdk-panel__close" aria-label="Close" data-ap-review-close>×</button>
1731
+ </div>
1732
+ </div>
1733
+ <div class="ap-sdk-record-review__list" data-ap-review-list></div>
1734
+ <div class="ap-sdk-panel__footer">
1735
+ <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-review-continue>Continue</button>
1736
+ <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-review-cancel>Cancel</button>
1737
+ </div>
1738
+ `,document.body.appendChild(Ee),Lt(Ee);const r=Ee.querySelector("[data-ap-review-list]"),o=Ee.querySelector("[data-ap-review-continue]"),s=()=>{if(en.length===0){r.innerHTML='<p class="ap-sdk-list-empty">No steps recorded.</p>',o.disabled=!0;return}o.disabled=!1,r.innerHTML=en.map((d,p)=>`
1739
+ <div class="ap-sdk-record-step" data-step-index="${p}">
1740
+ <span class="ap-sdk-record-step__icon">${fb[d.action]}</span>
1741
+ ${d.action==="inputText"&&!d.redacted?`<input class="ap-sdk-record-step__input" type="text" value="${mb(d.value??"")}" data-ap-step-value />`:`<span class="ap-sdk-record-step__description">${Hc(d.description)}</span>`}
1742
+ <button class="ap-sdk-record-step__remove" data-ap-step-remove="${p}" aria-label="Remove step ${p+1}">✕</button>
1743
+ </div>
1744
+ `).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(d=>{d.addEventListener("click",()=>{const p=parseInt(d.dataset.apStepRemove,10);en.splice(p,1),s()})}),r.querySelectorAll("[data-ap-step-value]").forEach(d=>{const p=d.closest("[data-step-index]"),h=parseInt(p.dataset.stepIndex,10);d.addEventListener("input",()=>{const b=en[h];b.value=d.value,b.description=yc(b.elementText??"",d.value,!1)})})};s();const c=()=>{No()};Ee.querySelector("[data-ap-review-close]").addEventListener("click",c),Ee.querySelector("[data-ap-review-cancel]").addEventListener("click",c),o.addEventListener("click",()=>{if(en.length===0)return;const d=en,p={...fs(),pageUrl:window.location.href,pageTitle:document.title,interactionSteps:d};No(),t(p)});const u=d=>{d.key==="Escape"&&c()};document.addEventListener("keydown",u),zr=()=>document.removeEventListener("keydown",u)}function Hc(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function mb(e){return Hc(e)}let j=null,Oo=null,Do=null,Mo=null;function Yi(e,t,n){Oo=e,Do=t,Mo=n,Lc(e,t,n)}const Fc="#agent-platform-web-sdk",Bc="ap-sdk-fab-unlocked";let kn=null;function Gc(){try{if(localStorage.getItem(Bc)==="1")return!0}catch{}return window.location.hash===Fc}function Wc(){try{localStorage.setItem(Bc,"1")}catch{}}async function Jc(e){if(cr(),!(j&&j.projectCode===e.projectCode&&j.backendUrl===(e.backendUrl??null)&&j.token===(e.token??null))){if(j={projectCode:e.projectCode,backendUrl:e.backendUrl??null,token:e.token??null,project:null,resolvingProject:!1},Yi(()=>Xc(),()=>kb(),()=>Qi()),bn(Gn().length),j.backendUrl&&j.token){const t=j.backendUrl,n=j.token;await el(),Nc({backendUrl:t,token:n}).catch(()=>{});const r=Hf();r&&Zi(r.taskId,{backendUrl:t,token:n},r.backendUrl,r.title,()=>{})}qc()}}async function Ki(e,t){if(!j)throw new Error("AgentPlatformSDK: call init() first.");j.backendUrl=e,j.token=t,j.project=null,await el()}function Xc(){if(!j)throw new Error("AgentPlatformSDK: call init() first.");In()||(cr(),_s(async(e,t)=>{Uc()&&Qt(),Oc(e,t,{backendUrl:j.backendUrl,token:j.token},j.project,j.projectCode,async n=>{await Ki(n.backendUrl,n.token)},_n,n=>{_s((r,o)=>{Ji()&&n(r,o)},()=>{Vc()})},()=>{In()&&oi()})},()=>{}))}function bb(){oi()}function kb(){if(!j)throw new Error("AgentPlatformSDK: call init() first.");To()||(cr(),Zm(e=>{gb(e,t=>{Oc(t,null,{backendUrl:j.backendUrl,token:j.token},j.project,j.projectCode,async n=>{await Ki(n.backendUrl,n.token)},_n,void 0,()=>{})})}))}function Vc(){Ji()&&Pr()}function _b(){return In()}function Yc(){hb(),kn&&(window.removeEventListener("hashchange",kn),kn=null),oi(),qm(),No(),Pr(),Qt(),zc(),Oo=null,Do=null,Mo=null,j=null}function Kc(){if(typeof window>"u"||typeof document>"u")return;cr();const e=cb(),t=()=>{e?Qc(e).catch(console.error):(Yi(()=>_n(),()=>_n(),()=>Qi()),bn(Gn().length),qc())};if(Gc()){Wc(),t();return}kn=()=>{window.location.hash===Fc&&(Wc(),window.removeEventListener("hashchange",kn),kn=null,t())},window.addEventListener("hashchange",kn)}function vb(){Oo&&Do&&Mo&&Lc(Oo,Do,Mo)}function yb(){zc()}function _n(){db(e=>{lb(e),Qc(e).catch(console.error)})}function wb(){ub(),Yc(),cr(),Gc()&&(Yi(()=>_n(),()=>_n(),()=>Qi()),bn(Gn().length))}async function Qc(e){await Jc({projectCode:e.projectCode,backendUrl:e.backendUrl,token:e.token})}function Qi(){if(Uc()){Qt();return}Ji()&&Pr();const e=j!=null&&j.backendUrl&&(j!=null&&j.token)?{backendUrl:j.backendUrl,token:j.token}:null;ob(e)}async function el(){if(!(!j||!j.backendUrl||!j.token||j.project||j.resolvingProject)){j.resolvingProject=!0;try{j.project=await xa({backendUrl:j.backendUrl,token:j.token},j.projectCode)}catch{}finally{j&&(j.resolvingProject=!1)}}}return Kc(),Se.activateElementPicker=Xc,Se.autoInit=Kc,Se.clearConfig=wb,Se.closePanelIfOpen=Vc,Se.configure=_n,Se.deactivateElementPicker=bb,Se.destroy=Yc,Se.hideFab=yb,Se.init=Jc,Se.isPickerRunning=_b,Se.showFab=vb,Se.updateCredentials=Ki,Object.defineProperty(Se,Symbol.toStringTag,{value:"Module"}),Se}({});
1560
1745
  //# sourceMappingURL=web-sdk.min.js.map