@tung-engineering/agent-platform-web-sdk 0.0.70 → 0.0.72

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.
package/dist/web-sdk.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var ju=Object.defineProperty,Zu=Object.defineProperties;var qu=Object.getOwnPropertyDescriptors;var Ri=Object.getOwnPropertySymbols;var Hu=Object.prototype.hasOwnProperty,Fu=Object.prototype.propertyIsEnumerable;var Li=Math.pow,ds=(e,t,n)=>t in e?ju(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,v=(e,t)=>{for(var n in t||(t={}))Hu.call(t,n)&&ds(e,n,t[n]);if(Ri)for(var n of Ri(t))Fu.call(t,n)&&ds(e,n,t[n]);return e},U=(e,t)=>Zu(e,qu(t));var ae=(e,t,n)=>ds(e,typeof t!="symbol"?t+"":t,n);var L=(e,t,n)=>new Promise((r,o)=>{var i=l=>{try{d(n.next(l))}catch(p){o(p)}},a=l=>{try{d(n.throw(l))}catch(p){o(p)}},d=l=>l.done?r(l.value):Promise.resolve(l.value).then(i,a);d((n=n.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Bu=`
1
+ "use strict";var ju=Object.defineProperty,Zu=Object.defineProperties;var qu=Object.getOwnPropertyDescriptors;var Ri=Object.getOwnPropertySymbols;var Hu=Object.prototype.hasOwnProperty,Fu=Object.prototype.propertyIsEnumerable;var Li=Math.pow,ds=(e,t,n)=>t in e?ju(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,v=(e,t)=>{for(var n in t||(t={}))Hu.call(t,n)&&ds(e,n,t[n]);if(Ri)for(var n of Ri(t))Fu.call(t,n)&&ds(e,n,t[n]);return e},M=(e,t)=>Zu(e,qu(t));var ie=(e,t,n)=>ds(e,typeof t!="symbol"?t+"":t,n);var L=(e,t,n)=>new Promise((r,o)=>{var i=l=>{try{d(n.next(l))}catch(p){o(p)}},a=l=>{try{d(n.throw(l))}catch(p){o(p)}},d=l=>l.done?r(l.value):Promise.resolve(l.value).then(i,a);d((n=n.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Bu=`
2
2
  :where([data-ap-sdk][popover]) {
3
3
  position: fixed;
4
4
  margin: 0;
@@ -1317,59 +1317,59 @@ button.ap-sdk-list-item__link {
1317
1317
  `,od=[Bu,Gu,Wu,Ju,Yu,Xu,Vu,Ku,Qu,ed,td,nd,rd].join(`
1318
1318
  `);let Ii=!1;function jr(){if(Ii)return;const e=document.createElement("style");e.setAttribute("data-ap-sdk","1"),e.textContent=od,document.head.appendChild(e),Ii=!0}function _o(e){if(e===document.body)return"body";const t=[];let n=e;for(;n&&n!==document.body;){if(n.id){t.unshift(`#${CSS.escape(n.id)}`);break}let r=n.tagName.toLowerCase();const o=n.parentElement;if(o){const i=Array.from(o.children).filter(a=>a.tagName===n.tagName);if(i.length>1){const a=i.indexOf(n)+1;r+=`:nth-of-type(${a})`}}t.unshift(r),n=n.parentElement}return t.join(" > ")||e.tagName.toLowerCase()}function Lo(e,t=200){var r;const n=((r=e.textContent)!=null?r:"").replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}const sd=["role","type","name","href","src","alt","title","for","placeholder","data-testid"];function vo(e){const t=e.tagName.toLowerCase(),n=e.id?`#${e.id}`:"",r=e.classList.length?"."+Array.from(e.classList).join("."):"",o=[],i=new Set,a=d=>{if(i.has(d)||o.length>=8)return;const l=e.getAttribute(d);if(!l)return;i.add(d);const p=l.length>80?l.slice(0,80)+"…":l;o.push(`[${d}="${p}"]`)};for(const d of Array.from(e.attributes))d.name.startsWith("aria-")&&a(d.name);for(const d of sd)a(d);return`${t}${n}${r}${o.join("")}`}function id(e,t=80){const n=Array.from(e.childNodes).filter(r=>r.nodeType===Node.TEXT_NODE).map(r=>{var o;return((o=r.textContent)!=null?o:"").trim()}).filter(Boolean).join(" ");return n.length>t?n.slice(0,t)+"…":n}function ad(e,t=5,n=10){function r(o,i){const a=vo(o),d=" ".repeat(i),l=Array.from(o.children).slice(0,n);if(i>=t||l.length===0){const p=id(o);return p?`${d}${a} "${p}"`:`${d}${a}`}return[`${d}${a}`,...l.map(p=>r(p,i+1))].join(`
1319
1319
  `)}return r(e,0)}const cd='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"]',ld={fieldset:"legend",table:"caption",figure:"figcaption",details:"summary"};function so(e,t){const n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}function ud(e){var n;const t=e.querySelectorAll('h1, h2, h3, h4, h5, h6, [role="heading"]');for(const r of Array.from(t)){let o=r.parentElement;for(;o&&o!==e&&!o.matches(cd);)o=o.parentElement;if(o===e){const i=((n=r.textContent)!=null?n:"").trim();if(i)return i}}return""}function dd(e,t=80){var a,d,l;const n=ld[e.tagName.toLowerCase()];if(n){const p=(d=(a=e.querySelector(n))==null?void 0:a.textContent)==null?void 0:d.trim();if(p)return so(p,t)}const r=ud(e);if(r)return so(r,t);const o=(l=e.getAttribute("aria-label"))==null?void 0:l.trim();if(o)return so(o,t);const i=e.getAttribute("aria-labelledby");if(i){const p=i.split(/\s+/).map(h=>{var g,m,k;return(k=(m=(g=document.getElementById(h))==null?void 0:g.textContent)==null?void 0:m.trim())!=null?k:""}).filter(Boolean).join(" ");if(p)return so(p,t)}return""}function pd(e,t=6){const n=[],r=new Set;let o=e;for(;o&&o!==document.body&&n.length<t;){const i=o===e?"":dd(o),a=i&&!r.has(i)?`${vo(o)} ["${i}"]`:vo(o);i&&r.add(i),n.unshift(a),o=o.parentElement}return n.join(" > ")||vo(e)}function Za(e,t){return e.length>t?e.slice(0,t)+"… (truncated)":e}function wr(e){var r;const t=document.querySelector(e);return((r=t==null?void 0:t.content)==null?void 0:r.trim())||void 0}function qa(){const e=t=>{try{return t()}catch(n){return}};return{description:e(()=>wr('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(()=>wr('meta[property="og:title"]')),ogDescription:e(()=>wr('meta[property="og:description"]')),ogType:e(()=>wr('meta[property="og:type"]')),ogSiteName:e(()=>wr('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?Za(t,1e3):void 0}),capturedAt:new Date().toISOString()}}function hd(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 fd(e){const t=e.getAttribute("role")||void 0,n=e.getAttribute("aria-label")||void 0;let r;const o=e.closest("section, article, main, nav, aside, header, footer, [role]");if(o){const i=o.querySelector("h1, h2, h3, h4, h5, h6"),a=o.getAttribute("aria-label")||((i==null?void 0:i.textContent)||"").trim(),d=o.tagName.toLowerCase();r=a?`${d}: ${Za(a,120)}`:d}return{elementRole:t,elementAriaLabel:n,enclosingSection:r}}function gd(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(`
1320
- `)}const tr=new Set;let Yn=null,Io=!1,Ts=!1;function md(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function bd(){const e=document.querySelectorAll("dialog[open]");for(let n=0;n<e.length;n++)try{if(e[n].matches(":modal"))return!0}catch(r){}const t=document.querySelectorAll('[role="dialog"], [role="alertdialog"]');for(let n=0;n<t.length;n++){const r=t[n];if(!(tr.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&md(r))return!0}return!1}function Ha(){const e=bd(),t=e&&!Ts;Ts=e;for(const n of tr){n.hasAttribute("inert")&&n.removeAttribute("inert"),n.getAttribute("aria-hidden")==="true"&&n.removeAttribute("aria-hidden");const r=n.contains(document.activeElement);if(n.matches(":popover-open")){if(t&&!r){try{n.hidePopover()}catch(o){}try{n.showPopover()}catch(o){}}}else try{n.showPopover()}catch(o){}}}function zi(e){if(!(e instanceof Node))return!1;for(const t of tr)if(t===e||t.contains(e))return!0;return!1}function Xn(e){(zi(e.target)||"relatedTarget"in e&&zi(e.relatedTarget))&&e.stopPropagation()}function kd(){Io||(window.addEventListener("focusin",Xn,!0),window.addEventListener("focusout",Xn,!0),window.addEventListener("pointerdown",Xn,!0),Io=!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")&&Ha()}),Yn.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function Wt(e){"showPopover"in e&&(e.setAttribute("popover","manual"),tr.add(e),kd(),Ha())}function Jt(e){if(tr.delete(e),tr.size===0&&(Yn&&(Yn.disconnect(),Yn=null),Io&&(window.removeEventListener("focusin",Xn,!0),window.removeEventListener("focusout",Xn,!0),window.removeEventListener("pointerdown",Xn,!0),Io=!1),Ts=!1),"hidePopover"in e)try{e.hidePopover()}catch(t){}}function Us(e="ap-sdk-highlight"){const t=document.createElement("div");return t.className=e,t.setAttribute("data-ap-sdk","1"),t.style.display="none",document.body.appendChild(t),Wt(t),{el:t,update:i=>{const a=i.getBoundingClientRect();t.style.top=`${a.top}px`,t.style.left=`${a.left}px`,t.style.width=`${a.width}px`,t.style.height=`${a.height}px`,t.style.display="block"},hide:()=>{t.style.display="none"},destroy:()=>{Jt(t),t.remove()}}}const Fa=/^cc-|current-password|new-password/i,_d=/token|secret|password|apikey|auth/i,ps="[redacted]";function vd(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&Fa.test(t)}function Ba(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",ps);const r=n.getAttribute("autocomplete");r&&Fa.test(r)&&n.setAttribute("value",ps);for(const o of Array.from(n.attributes))_d.test(o.name)&&n.setAttribute(o.name,ps)}}const yd="🎯 Click any element to capture";let cn=null,ze=null,De=null;function Lr(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 wd(){var e,t;return((t=(e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)!=null?t:!1)||"ontouchstart"in window}function $i(e){cn==null||cn.update(e)}function Ga(e){const t=qa(),n=hd(e),r=fd(e);let o;try{const i=e.cloneNode(!0);Ba(i),o=i.outerHTML.slice(0,4e3)}catch(i){}return v(v({pageUrl:window.location.href,pageTitle:document.title,elementText:Lo(e),cssSelector:_o(e),innerTree:ad(e),outerTree:pd(e),elementOuterHtml:o,ancestry:n},r),t)}function hs(e,t){De&&De();const n=wd();cn=Us(),ze=document.createElement("div"),ze.className="ap-sdk-picker-cursor",ze.setAttribute("data-ap-sdk","1"),ze.textContent=n?"Tap any element to preview":yd,document.body.appendChild(ze),Wt(ze);let r=null,o=null;const i=h=>{De==null||De(),e(Ga(h),h)},a=h=>{if(o=h,$i(h),!ze)return;ze.classList.add("ap-sdk-picker-cursor--confirm"),ze.innerHTML="";const g=document.createElement("span");g.className="ap-sdk-picker-cursor__label",g.textContent=`<${h.tagName.toLowerCase()}>`;const m=document.createElement("button");m.type="button",m.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--cancel",m.textContent="✕ Cancel",m.setAttribute("data-ap-sdk","1"),m.setAttribute("aria-label","Cancel picking"),m.addEventListener("click",E=>{E.preventDefault(),E.stopPropagation(),De==null||De(),t()});const k=document.createElement("button");k.type="button",k.className="ap-sdk-picker-cursor__btn",k.textContent="⬆ Parent",k.setAttribute("data-ap-sdk","1"),k.addEventListener("click",E=>{E.preventDefault(),E.stopPropagation(),o!=null&&o.parentElement&&a(o.parentElement)});const y=document.createElement("button");y.type="button",y.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",y.textContent="✓ Select",y.setAttribute("data-ap-sdk","1"),y.addEventListener("click",E=>{E.preventDefault(),E.stopPropagation(),o&&i(o)}),ze.appendChild(g),ze.appendChild(m),ze.appendChild(k),ze.appendChild(y)},d=h=>{Lr(h.target)||(r=h.target,$i(r))},l=h=>{var m;if(Lr(h.target))return;h.preventDefault(),h.stopImmediatePropagation();const g=(m=h.target)!=null?m:r;if(g){if(n){a(g);return}i(g)}},p=h=>{h.key==="Escape"&&(De==null||De(),t())};n||document.addEventListener("mouseover",d,{capture:!0}),document.addEventListener("click",l,{capture:!0}),document.addEventListener("keydown",p,{capture:!0}),De=()=>{n||document.removeEventListener("mouseover",d,{capture:!0}),document.removeEventListener("click",l,{capture:!0}),document.removeEventListener("keydown",p,{capture:!0}),ze&&Jt(ze),ze==null||ze.remove(),cn==null||cn.destroy(),cn=null,ze=null,o=null,De=null}}function js(){De==null||De()}function Vn(){return De!==null}const io={TASK_STATUS_UPDATED:"task:status:updated",TASK_INTERACTION_CREATED:"task:interaction:created",TASK_INTERACTION_ANSWERED:"task:interaction:answered",TASK_BROWSER_COMMAND_CREATED:"task:browser-command:created"};function w(e,t,n){var d;function r(l,p){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:p,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,p);const h=a.prototype,g=Object.keys(h);for(let m=0;m<g.length;m++){const k=g[m];k in l||(l[k]=h[k].bind(l))}}const o=(d=n==null?void 0:n.Parent)!=null?d:Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(l){var g;var p;const h=n!=null&&n.Parent?new i:this;r(h,l),(g=(p=h._zod).deferred)!=null||(p.deferred=[]);for(const m of h._zod.deferred)m();return h}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>{var p,h;return n!=null&&n.Parent&&l instanceof n.Parent?!0:(h=(p=l==null?void 0:l._zod)==null?void 0:p.traits)==null?void 0:h.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class Kn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Wa extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Ja={};function ln(e){return Ja}function Ya(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 Es(e,t){return typeof t=="bigint"?t.toString():t}function Yo(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Zs(e){return e==null}function qs(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function xd(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const l=r.match(/\d?e-(\d?)/);l!=null&&l[1]&&(o=Number.parseInt(l[1]))}const i=n>o?n:o,a=Number.parseInt(e.toFixed(i).replace(".","")),d=Number.parseInt(t.toFixed(i).replace(".",""));return a%d/Li(10,i)}const Oi=Symbol("evaluating");function oe(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Oi)return r===void 0&&(r=Oi,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function In(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function dn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Ni(e){return JSON.stringify(e)}function Sd(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Xa="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Dr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Td=Yo(()=>{var e;if(typeof navigator!="undefined"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch(t){return!1}});function nr(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 Va(e){return nr(e)?v({},e):Array.isArray(e)?[...e]:e}const Ed=new Set(["string","number","symbol"]);function rr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pn(e,t,n){const r=new e._zod.constr(t!=null?t:e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function j(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"?U(v({},t),{error:()=>t.error}):t}function Ad(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Cd={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 Pd(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=dn(e._zod.def,{get shape(){const a={};for(const d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&(a[d]=n.shape[d])}return In(this,"shape",a),a},checks:[]});return pn(e,i)}function Rd(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=dn(e._zod.def,{get shape(){const a=v({},e._zod.def.shape);for(const d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&delete a[d]}return In(this,"shape",a),a},checks:[]});return pn(e,i)}function Ld(e,t){if(!nr(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=dn(e._zod.def,{get shape(){const i=v(v({},e._zod.def.shape),t);return In(this,"shape",i),i}});return pn(e,o)}function Id(e,t){if(!nr(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=dn(e._zod.def,{get shape(){const r=v(v({},e._zod.def.shape),t);return In(this,"shape",r),r}});return pn(e,n)}function zd(e,t){const n=dn(e._zod.def,{get shape(){const r=v(v({},e._zod.def.shape),t._zod.def.shape);return In(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return pn(e,n)}function $d(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=dn(t._zod.def,{get shape(){const d=t._zod.def.shape,l=v({},d);if(n)for(const p in n){if(!(p in d))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(l[p]=e?new e({type:"optional",innerType:d[p]}):d[p])}else for(const p in d)l[p]=e?new e({type:"optional",innerType:d[p]}):d[p];return In(this,"shape",l),l},checks:[]});return pn(t,a)}function Od(e,t,n){const r=dn(t._zod.def,{get shape(){const o=t._zod.def.shape,i=v({},o);if(n)for(const a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return In(this,"shape",i),i}});return pn(t,r)}function Bn(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 Gn(e,t){return t.map(n=>{var o;var r;return(o=(r=n).path)!=null||(r.path=[]),n.path.unshift(e),n})}function ao(e){return typeof e=="string"?e:e==null?void 0:e.message}function un(e,t,n){var o,i,a,d,l,p,h,g,m,k,y;const r=U(v({},e),{path:(o=e.path)!=null?o:[]});if(!e.message){const E=(y=(k=(g=(p=ao((d=(a=(i=e.inst)==null?void 0:i._zod.def)==null?void 0:a.error)==null?void 0:d.call(a,e)))!=null?p:ao((l=t==null?void 0:t.error)==null?void 0:l.call(t,e)))!=null?g:ao((h=n.customError)==null?void 0:h.call(n,e)))!=null?k:ao((m=n.localeError)==null?void 0:m.call(n,e)))!=null?y:"Invalid input";r.message=E}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Hs(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Mr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:v({},t)}const Ka=(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,Es,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Qa=w("$ZodError",Ka),ec=w("$ZodError",Ka,{Parent:Error});function Nd(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 Dd(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let a=n,d=0;for(;d<i.path.length;){const l=i.path[d];d===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(t(i))):a[l]=a[l]||{_errors:[]},a=a[l],d++}}};return r(e),n}const Fs=e=>(t,n,r,o)=>{var d;const i=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Kn;if(a.issues.length){const l=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>un(p,i,ln())));throw Xa(l,o==null?void 0:o.callee),l}return a.value},Bs=e=>(t,n,r,o)=>L(null,null,function*(){var d;const i=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=yield a),a.issues.length){const l=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>un(p,i,ln())));throw Xa(l,o==null?void 0:o.callee),l}return a.value}),Xo=e=>(t,n,r)=>{const o=r?U(v({},r),{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Kn;return i.issues.length?{success:!1,error:new(e!=null?e:Qa)(i.issues.map(a=>un(a,o,ln())))}:{success:!0,data:i.value}},Md=Xo(ec),Vo=e=>(t,n,r)=>L(null,null,function*(){const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=yield i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>un(a,o,ln())))}:{success:!0,data:i.value}}),Ud=Vo(ec),jd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Fs(e)(t,n,o)},Zd=e=>(t,n,r)=>Fs(e)(t,n,r),qd=e=>(t,n,r)=>L(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Bs(e)(t,n,o)}),Hd=e=>(t,n,r)=>L(null,null,function*(){return Bs(e)(t,n,r)}),Fd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Xo(e)(t,n,o)},Bd=e=>(t,n,r)=>Xo(e)(t,n,r),Gd=e=>(t,n,r)=>L(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Vo(e)(t,n,o)}),Wd=e=>(t,n,r)=>L(null,null,function*(){return Vo(e)(t,n,r)}),Jd=/^[cC][^\s-]{8,}$/,Yd=/^[0-9a-z]+$/,Xd=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Vd=/^[0-9a-vA-V]{20}$/,Kd=/^[A-Za-z0-9]{27}$/,Qd=/^[a-zA-Z0-9_-]{21}$/,ep=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tp=/^([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})$/,Di=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)$/,np=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,rp="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function op(){return new RegExp(rp,"u")}const sp=/^(?:(?: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])$/,ip=/^(([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}|:))$/,ap=/^((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])$/,cp=/^(([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])$/,lp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tc=/^[A-Za-z0-9_-]*$/,up=/^\+[1-9]\d{6,14}$/,nc="(?:(?:\\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])))",dp=new RegExp(`^${nc}$`);function rc(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 pp(e){return new RegExp(`^${rc(e)}$`)}function hp(e){const t=rc({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(`^${nc}T(?:${r})$`)}const fp=e=>{var n,r;const t=e?`[\\s\\S]{${(n=e==null?void 0:e.minimum)!=null?n:0},${(r=e==null?void 0:e.maximum)!=null?r:""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},gp=/^-?\d+$/,oc=/^-?\d+(?:\.\d+)?$/,mp=/^(?:true|false)$/i,bp=/^[^A-Z]*$/,kp=/^[^a-z]*$/,tt=w("$ZodCheck",(e,t)=>{var r,o;var n;(r=e._zod)!=null||(e._zod={}),e._zod.def=t,(o=(n=e._zod).onattach)!=null||(n.onattach=[])}),sc={number:"number",bigint:"bigint",object:"date"},ic=w("$ZodCheckLessThan",(e,t)=>{tt.init(e,t);const n=sc[typeof t.value];e._zod.onattach.push(r=>{var a;const o=r._zod.bag,i=(a=t.inclusive?o.maximum:o.exclusiveMaximum)!=null?a:Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ac=w("$ZodCheckGreaterThan",(e,t)=>{tt.init(e,t);const n=sc[typeof t.value];e._zod.onattach.push(r=>{var a;const o=r._zod.bag,i=(a=t.inclusive?o.minimum:o.exclusiveMinimum)!=null?a:Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_p=w("$ZodCheckMultipleOf",(e,t)=>{tt.init(e,t),e._zod.onattach.push(n=>{var o;var r;(o=(r=n._zod.bag).multipleOf)!=null||(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):xd(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})}}),vp=w("$ZodCheckNumberFormat",(e,t)=>{var a;tt.init(e,t),t.format=t.format||"float64";const n=(a=t.format)==null?void 0:a.includes("int"),r=n?"int":"number",[o,i]=Cd[t.format];e._zod.onattach.push(d=>{const l=d._zod.bag;l.format=t.format,l.minimum=o,l.maximum=i,n&&(l.pattern=gp)}),e._zod.check=d=>{const l=d.value;if(n){if(!Number.isInteger(l)){d.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?d.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):d.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}l<o&&d.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>i&&d.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),yp=w("$ZodCheckMaxLength",(e,t)=>{var r;var n;tt.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!Zs(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{var a;const i=(a=o._zod.bag.maximum)!=null?a:Number.POSITIVE_INFINITY;t.maximum<i&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{const i=o.value;if(i.length<=t.maximum)return;const d=Hs(i);o.issues.push({origin:d,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),wp=w("$ZodCheckMinLength",(e,t)=>{var r;var n;tt.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!Zs(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{var a;const i=(a=o._zod.bag.minimum)!=null?a:Number.NEGATIVE_INFINITY;t.minimum>i&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const i=o.value;if(i.length>=t.minimum)return;const d=Hs(i);o.issues.push({origin:d,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),xp=w("$ZodCheckLengthEquals",(e,t)=>{var r;var n;tt.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!Zs(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{const i=o._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=o=>{const i=o.value,a=i.length;if(a===t.length)return;const d=Hs(i),l=a>t.length;o.issues.push(U(v({origin:d},l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length}),{inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort}))}}),Ko=w("$ZodCheckStringFormat",(e,t)=>{var o,i;var n,r;tt.init(e,t),e._zod.onattach.push(a=>{var l;const d=a._zod.bag;d.format=t.format,t.pattern&&((l=d.patterns)!=null||(d.patterns=new Set),d.patterns.add(t.pattern))}),t.pattern?(o=(n=e._zod).check)!=null||(n.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push(U(v({origin:"string",code:"invalid_format",format:t.format,input:a.value},t.pattern?{pattern:t.pattern.toString()}:{}),{inst:e,continue:!t.abort}))}):(i=(r=e._zod).check)!=null||(r.check=()=>{})}),Sp=w("$ZodCheckRegex",(e,t)=>{Ko.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})}}),Tp=w("$ZodCheckLowerCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=bp),Ko.init(e,t)}),Ep=w("$ZodCheckUpperCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=kp),Ko.init(e,t)}),Ap=w("$ZodCheckIncludes",(e,t)=>{tt.init(e,t);const n=rr(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Cp=w("$ZodCheckStartsWith",(e,t)=>{var r;tt.init(e,t);const n=new RegExp(`^${rr(t.prefix)}.*`);(r=t.pattern)!=null||(t.pattern=n),e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Pp=w("$ZodCheckEndsWith",(e,t)=>{var r;tt.init(e,t);const n=new RegExp(`.*${rr(t.suffix)}$`);(r=t.pattern)!=null||(t.pattern=n),e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}}),Rp=w("$ZodCheckOverwrite",(e,t)=>{tt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Lp{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(`
1320
+ `)}const tr=new Set;let Yn=null,Io=!1,Ts=!1;function md(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function bd(){const e=document.querySelectorAll("dialog[open]");for(let n=0;n<e.length;n++)try{if(e[n].matches(":modal"))return!0}catch(r){}const t=document.querySelectorAll('[role="dialog"], [role="alertdialog"]');for(let n=0;n<t.length;n++){const r=t[n];if(!(tr.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&md(r))return!0}return!1}function Ha(){const e=bd(),t=e&&!Ts;Ts=e;for(const n of tr){n.hasAttribute("inert")&&n.removeAttribute("inert"),n.getAttribute("aria-hidden")==="true"&&n.removeAttribute("aria-hidden");const r=n.contains(document.activeElement);if(n.matches(":popover-open")){if(t&&!r){try{n.hidePopover()}catch(o){}try{n.showPopover()}catch(o){}}}else try{n.showPopover()}catch(o){}}}function zi(e){if(!(e instanceof Node))return!1;for(const t of tr)if(t===e||t.contains(e))return!0;return!1}function Xn(e){(zi(e.target)||"relatedTarget"in e&&zi(e.relatedTarget))&&e.stopPropagation()}function kd(){Io||(window.addEventListener("focusin",Xn,!0),window.addEventListener("focusout",Xn,!0),window.addEventListener("pointerdown",Xn,!0),Io=!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")&&Ha()}),Yn.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function Yt(e){"showPopover"in e&&(e.setAttribute("popover","manual"),tr.add(e),kd(),Ha())}function Xt(e){if(tr.delete(e),tr.size===0&&(Yn&&(Yn.disconnect(),Yn=null),Io&&(window.removeEventListener("focusin",Xn,!0),window.removeEventListener("focusout",Xn,!0),window.removeEventListener("pointerdown",Xn,!0),Io=!1),Ts=!1),"hidePopover"in e)try{e.hidePopover()}catch(t){}}function Us(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),Yt(t),{el:t,update:i=>{const a=i.getBoundingClientRect();t.style.top=`${a.top}px`,t.style.left=`${a.left}px`,t.style.width=`${a.width}px`,t.style.height=`${a.height}px`,t.style.display="block"},hide:()=>{t.style.display="none"},destroy:()=>{Xt(t),t.remove()}}}const Fa=/^cc-|current-password|new-password/i,_d=/token|secret|password|apikey|auth/i,ps="[redacted]";function vd(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&Fa.test(t)}function Ba(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",ps);const r=n.getAttribute("autocomplete");r&&Fa.test(r)&&n.setAttribute("value",ps);for(const o of Array.from(n.attributes))_d.test(o.name)&&n.setAttribute(o.name,ps)}}const yd="🎯 Click any element to capture";let ln=null,Ie=null,Ue=null;function Lr(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 wd(){var e,t;return((t=(e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)!=null?t:!1)||"ontouchstart"in window}function $i(e){ln==null||ln.update(e)}function Ga(e){const t=qa(),n=hd(e),r=fd(e);let o;try{const i=e.cloneNode(!0);Ba(i),o=i.outerHTML.slice(0,4e3)}catch(i){}return v(v({pageUrl:window.location.href,pageTitle:document.title,elementText:Lo(e),cssSelector:_o(e),innerTree:ad(e),outerTree:pd(e),elementOuterHtml:o,ancestry:n},r),t)}function hs(e,t){Ue&&Ue();const n=wd();ln=Us(),Ie=document.createElement("div"),Ie.className="ap-sdk-picker-cursor",Ie.setAttribute("data-ap-sdk","1"),Ie.textContent=n?"Tap any element to preview":yd,document.body.appendChild(Ie),Yt(Ie);let r=null,o=null;const i=h=>{Ue==null||Ue(),e(Ga(h),h)},a=h=>{if(o=h,$i(h),!Ie)return;Ie.classList.add("ap-sdk-picker-cursor--confirm"),Ie.innerHTML="";const g=document.createElement("span");g.className="ap-sdk-picker-cursor__label",g.textContent=`<${h.tagName.toLowerCase()}>`;const m=document.createElement("button");m.type="button",m.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--cancel",m.textContent="✕ Cancel",m.setAttribute("data-ap-sdk","1"),m.setAttribute("aria-label","Cancel picking"),m.addEventListener("click",E=>{E.preventDefault(),E.stopPropagation(),Ue==null||Ue(),t()});const k=document.createElement("button");k.type="button",k.className="ap-sdk-picker-cursor__btn",k.textContent="⬆ Parent",k.setAttribute("data-ap-sdk","1"),k.addEventListener("click",E=>{E.preventDefault(),E.stopPropagation(),o!=null&&o.parentElement&&a(o.parentElement)});const y=document.createElement("button");y.type="button",y.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",y.textContent="✓ Select",y.setAttribute("data-ap-sdk","1"),y.addEventListener("click",E=>{E.preventDefault(),E.stopPropagation(),o&&i(o)}),Ie.appendChild(g),Ie.appendChild(m),Ie.appendChild(k),Ie.appendChild(y)},d=h=>{Lr(h.target)||(r=h.target,$i(r))},l=h=>{var m;if(Lr(h.target))return;h.preventDefault(),h.stopImmediatePropagation();const g=(m=h.target)!=null?m:r;if(g){if(n){a(g);return}i(g)}},p=h=>{h.key==="Escape"&&(Ue==null||Ue(),t())};n||document.addEventListener("mouseover",d,{capture:!0}),document.addEventListener("click",l,{capture:!0}),document.addEventListener("keydown",p,{capture:!0}),Ue=()=>{n||document.removeEventListener("mouseover",d,{capture:!0}),document.removeEventListener("click",l,{capture:!0}),document.removeEventListener("keydown",p,{capture:!0}),Ie&&Xt(Ie),Ie==null||Ie.remove(),ln==null||ln.destroy(),ln=null,Ie=null,o=null,Ue=null}}function js(){Ue==null||Ue()}function Vn(){return Ue!==null}const io={TASK_STATUS_UPDATED:"task:status:updated",TASK_INTERACTION_CREATED:"task:interaction:created",TASK_INTERACTION_ANSWERED:"task:interaction:answered",TASK_BROWSER_COMMAND_CREATED:"task:browser-command:created"};function w(e,t,n){var d;function r(l,p){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:p,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,p);const h=a.prototype,g=Object.keys(h);for(let m=0;m<g.length;m++){const k=g[m];k in l||(l[k]=h[k].bind(l))}}const o=(d=n==null?void 0:n.Parent)!=null?d:Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(l){var g;var p;const h=n!=null&&n.Parent?new i:this;r(h,l),(g=(p=h._zod).deferred)!=null||(p.deferred=[]);for(const m of h._zod.deferred)m();return h}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>{var p,h;return n!=null&&n.Parent&&l instanceof n.Parent?!0:(h=(p=l==null?void 0:l._zod)==null?void 0:p.traits)==null?void 0:h.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class Kn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Wa extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Ja={};function un(e){return Ja}function Ya(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 Es(e,t){return typeof t=="bigint"?t.toString():t}function Yo(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Zs(e){return e==null}function qs(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function xd(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const l=r.match(/\d?e-(\d?)/);l!=null&&l[1]&&(o=Number.parseInt(l[1]))}const i=n>o?n:o,a=Number.parseInt(e.toFixed(i).replace(".","")),d=Number.parseInt(t.toFixed(i).replace(".",""));return a%d/Li(10,i)}const Oi=Symbol("evaluating");function ne(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Oi)return r===void 0&&(r=Oi,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function zn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function pn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Ni(e){return JSON.stringify(e)}function Sd(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Xa="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Dr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Td=Yo(()=>{var e;if(typeof navigator!="undefined"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch(t){return!1}});function nr(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 Va(e){return nr(e)?v({},e):Array.isArray(e)?[...e]:e}const Ed=new Set(["string","number","symbol"]);function rr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function hn(e,t,n){const r=new e._zod.constr(t!=null?t:e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function U(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?M(v({},t),{error:()=>t.error}):t}function Ad(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Cd={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 Pd(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=pn(e._zod.def,{get shape(){const a={};for(const d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&(a[d]=n.shape[d])}return zn(this,"shape",a),a},checks:[]});return hn(e,i)}function Rd(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=pn(e._zod.def,{get shape(){const a=v({},e._zod.def.shape);for(const d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&delete a[d]}return zn(this,"shape",a),a},checks:[]});return hn(e,i)}function Ld(e,t){if(!nr(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=pn(e._zod.def,{get shape(){const i=v(v({},e._zod.def.shape),t);return zn(this,"shape",i),i}});return hn(e,o)}function Id(e,t){if(!nr(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=pn(e._zod.def,{get shape(){const r=v(v({},e._zod.def.shape),t);return zn(this,"shape",r),r}});return hn(e,n)}function zd(e,t){const n=pn(e._zod.def,{get shape(){const r=v(v({},e._zod.def.shape),t._zod.def.shape);return zn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return hn(e,n)}function $d(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=pn(t._zod.def,{get shape(){const d=t._zod.def.shape,l=v({},d);if(n)for(const p in n){if(!(p in d))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(l[p]=e?new e({type:"optional",innerType:d[p]}):d[p])}else for(const p in d)l[p]=e?new e({type:"optional",innerType:d[p]}):d[p];return zn(this,"shape",l),l},checks:[]});return hn(t,a)}function Od(e,t,n){const r=pn(t._zod.def,{get shape(){const o=t._zod.def.shape,i=v({},o);if(n)for(const a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return zn(this,"shape",i),i}});return hn(t,r)}function Bn(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 Gn(e,t){return t.map(n=>{var o;var r;return(o=(r=n).path)!=null||(r.path=[]),n.path.unshift(e),n})}function ao(e){return typeof e=="string"?e:e==null?void 0:e.message}function dn(e,t,n){var o,i,a,d,l,p,h,g,m,k,y;const r=M(v({},e),{path:(o=e.path)!=null?o:[]});if(!e.message){const E=(y=(k=(g=(p=ao((d=(a=(i=e.inst)==null?void 0:i._zod.def)==null?void 0:a.error)==null?void 0:d.call(a,e)))!=null?p:ao((l=t==null?void 0:t.error)==null?void 0:l.call(t,e)))!=null?g:ao((h=n.customError)==null?void 0:h.call(n,e)))!=null?k:ao((m=n.localeError)==null?void 0:m.call(n,e)))!=null?y:"Invalid input";r.message=E}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Hs(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Mr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:v({},t)}const Ka=(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,Es,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Qa=w("$ZodError",Ka),ec=w("$ZodError",Ka,{Parent:Error});function Nd(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 Dd(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let a=n,d=0;for(;d<i.path.length;){const l=i.path[d];d===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(t(i))):a[l]=a[l]||{_errors:[]},a=a[l],d++}}};return r(e),n}const Fs=e=>(t,n,r,o)=>{var d;const i=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Kn;if(a.issues.length){const l=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>dn(p,i,un())));throw Xa(l,o==null?void 0:o.callee),l}return a.value},Bs=e=>(t,n,r,o)=>L(null,null,function*(){var d;const i=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=yield a),a.issues.length){const l=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>dn(p,i,un())));throw Xa(l,o==null?void 0:o.callee),l}return a.value}),Xo=e=>(t,n,r)=>{const o=r?M(v({},r),{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Kn;return i.issues.length?{success:!1,error:new(e!=null?e:Qa)(i.issues.map(a=>dn(a,o,un())))}:{success:!0,data:i.value}},Md=Xo(ec),Vo=e=>(t,n,r)=>L(null,null,function*(){const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=yield i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>dn(a,o,un())))}:{success:!0,data:i.value}}),Ud=Vo(ec),jd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Fs(e)(t,n,o)},Zd=e=>(t,n,r)=>Fs(e)(t,n,r),qd=e=>(t,n,r)=>L(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Bs(e)(t,n,o)}),Hd=e=>(t,n,r)=>L(null,null,function*(){return Bs(e)(t,n,r)}),Fd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Xo(e)(t,n,o)},Bd=e=>(t,n,r)=>Xo(e)(t,n,r),Gd=e=>(t,n,r)=>L(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Vo(e)(t,n,o)}),Wd=e=>(t,n,r)=>L(null,null,function*(){return Vo(e)(t,n,r)}),Jd=/^[cC][^\s-]{8,}$/,Yd=/^[0-9a-z]+$/,Xd=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Vd=/^[0-9a-vA-V]{20}$/,Kd=/^[A-Za-z0-9]{27}$/,Qd=/^[a-zA-Z0-9_-]{21}$/,ep=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tp=/^([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})$/,Di=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)$/,np=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,rp="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function op(){return new RegExp(rp,"u")}const sp=/^(?:(?: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])$/,ip=/^(([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}|:))$/,ap=/^((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])$/,cp=/^(([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])$/,lp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,tc=/^[A-Za-z0-9_-]*$/,up=/^\+[1-9]\d{6,14}$/,nc="(?:(?:\\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])))",dp=new RegExp(`^${nc}$`);function rc(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 pp(e){return new RegExp(`^${rc(e)}$`)}function hp(e){const t=rc({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(`^${nc}T(?:${r})$`)}const fp=e=>{var n,r;const t=e?`[\\s\\S]{${(n=e==null?void 0:e.minimum)!=null?n:0},${(r=e==null?void 0:e.maximum)!=null?r:""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},gp=/^-?\d+$/,oc=/^-?\d+(?:\.\d+)?$/,mp=/^(?:true|false)$/i,bp=/^[^A-Z]*$/,kp=/^[^a-z]*$/,ot=w("$ZodCheck",(e,t)=>{var r,o;var n;(r=e._zod)!=null||(e._zod={}),e._zod.def=t,(o=(n=e._zod).onattach)!=null||(n.onattach=[])}),sc={number:"number",bigint:"bigint",object:"date"},ic=w("$ZodCheckLessThan",(e,t)=>{ot.init(e,t);const n=sc[typeof t.value];e._zod.onattach.push(r=>{var a;const o=r._zod.bag,i=(a=t.inclusive?o.maximum:o.exclusiveMaximum)!=null?a:Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ac=w("$ZodCheckGreaterThan",(e,t)=>{ot.init(e,t);const n=sc[typeof t.value];e._zod.onattach.push(r=>{var a;const o=r._zod.bag,i=(a=t.inclusive?o.minimum:o.exclusiveMinimum)!=null?a:Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_p=w("$ZodCheckMultipleOf",(e,t)=>{ot.init(e,t),e._zod.onattach.push(n=>{var o;var r;(o=(r=n._zod.bag).multipleOf)!=null||(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):xd(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})}}),vp=w("$ZodCheckNumberFormat",(e,t)=>{var a;ot.init(e,t),t.format=t.format||"float64";const n=(a=t.format)==null?void 0:a.includes("int"),r=n?"int":"number",[o,i]=Cd[t.format];e._zod.onattach.push(d=>{const l=d._zod.bag;l.format=t.format,l.minimum=o,l.maximum=i,n&&(l.pattern=gp)}),e._zod.check=d=>{const l=d.value;if(n){if(!Number.isInteger(l)){d.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?d.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):d.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}l<o&&d.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>i&&d.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),yp=w("$ZodCheckMaxLength",(e,t)=>{var r;var n;ot.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!Zs(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{var a;const i=(a=o._zod.bag.maximum)!=null?a:Number.POSITIVE_INFINITY;t.maximum<i&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{const i=o.value;if(i.length<=t.maximum)return;const d=Hs(i);o.issues.push({origin:d,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),wp=w("$ZodCheckMinLength",(e,t)=>{var r;var n;ot.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!Zs(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{var a;const i=(a=o._zod.bag.minimum)!=null?a:Number.NEGATIVE_INFINITY;t.minimum>i&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const i=o.value;if(i.length>=t.minimum)return;const d=Hs(i);o.issues.push({origin:d,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),xp=w("$ZodCheckLengthEquals",(e,t)=>{var r;var n;ot.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!Zs(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{const i=o._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=o=>{const i=o.value,a=i.length;if(a===t.length)return;const d=Hs(i),l=a>t.length;o.issues.push(M(v({origin:d},l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length}),{inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort}))}}),Ko=w("$ZodCheckStringFormat",(e,t)=>{var o,i;var n,r;ot.init(e,t),e._zod.onattach.push(a=>{var l;const d=a._zod.bag;d.format=t.format,t.pattern&&((l=d.patterns)!=null||(d.patterns=new Set),d.patterns.add(t.pattern))}),t.pattern?(o=(n=e._zod).check)!=null||(n.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push(M(v({origin:"string",code:"invalid_format",format:t.format,input:a.value},t.pattern?{pattern:t.pattern.toString()}:{}),{inst:e,continue:!t.abort}))}):(i=(r=e._zod).check)!=null||(r.check=()=>{})}),Sp=w("$ZodCheckRegex",(e,t)=>{Ko.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})}}),Tp=w("$ZodCheckLowerCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=bp),Ko.init(e,t)}),Ep=w("$ZodCheckUpperCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=kp),Ko.init(e,t)}),Ap=w("$ZodCheckIncludes",(e,t)=>{ot.init(e,t);const n=rr(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Cp=w("$ZodCheckStartsWith",(e,t)=>{var r;ot.init(e,t);const n=new RegExp(`^${rr(t.prefix)}.*`);(r=t.pattern)!=null||(t.pattern=n),e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Pp=w("$ZodCheckEndsWith",(e,t)=>{var r;ot.init(e,t);const n=new RegExp(`.*${rr(t.suffix)}$`);(r=t.pattern)!=null||(t.pattern=n),e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}}),Rp=w("$ZodCheckOverwrite",(e,t)=>{ot.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Lp{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(`
1321
1321
  `).filter(a=>a),o=Math.min(...r.map(a=>a.length-a.trimStart().length)),i=r.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of i)this.content.push(a)}compile(){var i;const t=Function,n=this==null?void 0:this.args,o=[...((i=this==null?void 0:this.content)!=null?i:[""]).map(a=>` ${a}`)];return new t(...n,o.join(`
1322
- `))}}const Ip={major:4,minor:3,patch:5},be=w("$ZodType",(e,t)=>{var o,i,a;var n;e!=null||(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ip;const r=[...(o=e._zod.def.checks)!=null?o:[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const d of r)for(const l of d._zod.onattach)l(e);if(r.length===0)(i=(n=e._zod).deferred)!=null||(n.deferred=[]),(a=e._zod.deferred)==null||a.push(()=>{e._zod.run=e._zod.parse});else{const d=(p,h,g)=>{let m=Bn(p),k;for(const y of h){if(y._zod.def.when){if(!y._zod.def.when(p))continue}else if(m)continue;const E=p.issues.length,Z=y._zod.check(p);if(Z instanceof Promise&&(g==null?void 0:g.async)===!1)throw new Kn;if(k||Z instanceof Promise)k=(k!=null?k:Promise.resolve()).then(()=>L(null,null,function*(){yield Z,p.issues.length!==E&&(m||(m=Bn(p,E)))}));else{if(p.issues.length===E)continue;m||(m=Bn(p,E))}}return k?k.then(()=>p):p},l=(p,h,g)=>{if(Bn(p))return p.aborted=!0,p;const m=d(h,r,g);if(m instanceof Promise){if(g.async===!1)throw new Kn;return m.then(k=>e._zod.parse(k,g))}return e._zod.parse(m,g)};e._zod.run=(p,h)=>{if(h.skipChecks)return e._zod.parse(p,h);if(h.direction==="backward"){const m=e._zod.parse({value:p.value,issues:[]},U(v({},h),{skipChecks:!0}));return m instanceof Promise?m.then(k=>l(k,p,h)):l(m,p,h)}const g=e._zod.parse(p,h);if(g instanceof Promise){if(h.async===!1)throw new Kn;return g.then(m=>d(m,r,h))}return d(g,r,h)}}oe(e,"~standard",()=>({validate:d=>{var l;try{const p=Md(e,d);return p.success?{value:p.data}:{issues:(l=p.error)==null?void 0:l.issues}}catch(p){return Ud(e,d).then(h=>{var g;return h.success?{value:h.data}:{issues:(g=h.error)==null?void 0:g.issues}})}},vendor:"zod",version:1}))}),Gs=w("$ZodString",(e,t)=>{var n,r,o;be.init(e,t),e._zod.pattern=(o=[...(r=(n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)!=null?r:[]].pop())!=null?o:fp(e._zod.bag),e._zod.parse=(i,a)=>{if(t.coerce)try{i.value=String(i.value)}catch(d){}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),ke=w("$ZodStringFormat",(e,t)=>{Ko.init(e,t),Gs.init(e,t)}),zp=w("$ZodGUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=tp),ke.init(e,t)}),$p=w("$ZodUUID",(e,t)=>{var n,r;if(t.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);(n=t.pattern)!=null||(t.pattern=Di(i))}else(r=t.pattern)!=null||(t.pattern=Di());ke.init(e,t)}),Op=w("$ZodEmail",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=np),ke.init(e,t)}),Np=w("$ZodURL",(e,t)=>{ke.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Dp=w("$ZodEmoji",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=op()),ke.init(e,t)}),Mp=w("$ZodNanoID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Qd),ke.init(e,t)}),Up=w("$ZodCUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Jd),ke.init(e,t)}),jp=w("$ZodCUID2",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Yd),ke.init(e,t)}),Zp=w("$ZodULID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Xd),ke.init(e,t)}),qp=w("$ZodXID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Vd),ke.init(e,t)}),Hp=w("$ZodKSUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Kd),ke.init(e,t)}),Fp=w("$ZodISODateTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=hp(t)),ke.init(e,t)}),Bp=w("$ZodISODate",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=dp),ke.init(e,t)}),Gp=w("$ZodISOTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=pp(t)),ke.init(e,t)}),Wp=w("$ZodISODuration",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ep),ke.init(e,t)}),Jp=w("$ZodIPv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=sp),ke.init(e,t),e._zod.bag.format="ipv4"}),Yp=w("$ZodIPv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ip),ke.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch(o){r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Xp=w("$ZodCIDRv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ap),ke.init(e,t)}),Vp=w("$ZodCIDRv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=cp),ke.init(e,t),e._zod.check=r=>{const o=r.value.split("/");try{if(o.length!==2)throw new Error;const[i,a]=o;if(!a)throw new Error;const d=Number(a);if(`${d}`!==a)throw new Error;if(d<0||d>128)throw new Error;new URL(`http://[${i}]`)}catch(i){r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function cc(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch(t){return!1}}const Kp=w("$ZodBase64",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=lp),ke.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{cc(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Qp(e){if(!tc.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return cc(n)}const eh=w("$ZodBase64URL",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=tc),ke.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Qp(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),th=w("$ZodE164",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=up),ke.init(e,t)});function nh(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch(n){return!1}}const rh=w("$ZodJWT",(e,t)=>{ke.init(e,t),e._zod.check=n=>{nh(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),lc=w("$ZodNumber",(e,t)=>{var n;be.init(e,t),e._zod.pattern=(n=e._zod.bag.pattern)!=null?n:oc,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(d){}const i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;const a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push(v({expected:"number",code:"invalid_type",input:i,inst:e},a?{received:a}:{})),r}}),oh=w("$ZodNumberFormat",(e,t)=>{vp.init(e,t),lc.init(e,t)}),sh=w("$ZodBoolean",(e,t)=>{be.init(e,t),e._zod.pattern=mp,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch(i){}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),ih=w("$ZodAny",(e,t)=>{be.init(e,t),e._zod.parse=n=>n}),ah=w("$ZodUnknown",(e,t)=>{be.init(e,t),e._zod.parse=n=>n}),ch=w("$ZodNever",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Mi(e,t,n){e.issues.length&&t.issues.push(...Gn(n,e.issues)),t.value[n]=e.value}const lh=w("$ZodArray",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const d=o[a],l=t.element._zod.run({value:d,issues:[]},r);l instanceof Promise?i.push(l.then(p=>Mi(p,n,a))):Mi(l,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function zo(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Gn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function uc(e){var r,o,i,a;const t=Object.keys(e.shape);for(const d of t)if(!((a=(i=(o=(r=e.shape)==null?void 0:r[d])==null?void 0:o._zod)==null?void 0:i.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${d}": expected a Zod schema`);const n=Ad(e.shape);return U(v({},e),{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)})}function dc(e,t,n,r,o,i){const a=[],d=o.keySet,l=o.catchall._zod,p=l.def.type,h=l.optout==="optional";for(const g in t){if(d.has(g))continue;if(p==="never"){a.push(g);continue}const m=l.run({value:t[g],issues:[]},r);m instanceof Promise?e.push(m.then(k=>zo(k,n,g,t,h))):zo(m,n,g,t,h)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const uh=w("$ZodObject",(e,t)=>{be.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const d=t.shape;Object.defineProperty(t,"shape",{get:()=>{const l=v({},d);return Object.defineProperty(t,"shape",{value:l}),l}})}const r=Yo(()=>uc(t));oe(e._zod,"propValues",()=>{var p;const d=t.shape,l={};for(const h in d){const g=d[h]._zod;if(g.values){(p=l[h])!=null||(l[h]=new Set);for(const m of g.values)l[h].add(m)}}return l});const o=Dr,i=t.catchall;let a;e._zod.parse=(d,l)=>{a!=null||(a=r.value);const p=d.value;if(!o(p))return d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d;d.value={};const h=[],g=a.shape;for(const m of a.keys){const k=g[m],y=k._zod.optout==="optional",E=k._zod.run({value:p[m],issues:[]},l);E instanceof Promise?h.push(E.then(Z=>zo(Z,d,m,p,y))):zo(E,d,m,p,y)}return i?dc(h,p,d,l,r.value,e):h.length?Promise.all(h).then(()=>d):d}}),dh=w("$ZodObjectJIT",(e,t)=>{uh.init(e,t);const n=e._zod.parse,r=Yo(()=>uc(t)),o=m=>{var T;const k=new Lp(["shape","payload","ctx"]),y=r.value,E=S=>{const P=Ni(S);return`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`};k.write("const input = payload.value;");const Z=Object.create(null);let ee=0;for(const S of y.keys)Z[S]=`key_${ee++}`;k.write("const newResult = {};");for(const S of y.keys){const P=Z[S],D=Ni(S),J=m[S],he=((T=J==null?void 0:J._zod)==null?void 0:T.optout)==="optional";k.write(`const ${P} = ${E(S)};`),he?k.write(`
1322
+ `))}}const Ip={major:4,minor:3,patch:5},be=w("$ZodType",(e,t)=>{var o,i,a;var n;e!=null||(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ip;const r=[...(o=e._zod.def.checks)!=null?o:[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const d of r)for(const l of d._zod.onattach)l(e);if(r.length===0)(i=(n=e._zod).deferred)!=null||(n.deferred=[]),(a=e._zod.deferred)==null||a.push(()=>{e._zod.run=e._zod.parse});else{const d=(p,h,g)=>{let m=Bn(p),k;for(const y of h){if(y._zod.def.when){if(!y._zod.def.when(p))continue}else if(m)continue;const E=p.issues.length,j=y._zod.check(p);if(j instanceof Promise&&(g==null?void 0:g.async)===!1)throw new Kn;if(k||j instanceof Promise)k=(k!=null?k:Promise.resolve()).then(()=>L(null,null,function*(){yield j,p.issues.length!==E&&(m||(m=Bn(p,E)))}));else{if(p.issues.length===E)continue;m||(m=Bn(p,E))}}return k?k.then(()=>p):p},l=(p,h,g)=>{if(Bn(p))return p.aborted=!0,p;const m=d(h,r,g);if(m instanceof Promise){if(g.async===!1)throw new Kn;return m.then(k=>e._zod.parse(k,g))}return e._zod.parse(m,g)};e._zod.run=(p,h)=>{if(h.skipChecks)return e._zod.parse(p,h);if(h.direction==="backward"){const m=e._zod.parse({value:p.value,issues:[]},M(v({},h),{skipChecks:!0}));return m instanceof Promise?m.then(k=>l(k,p,h)):l(m,p,h)}const g=e._zod.parse(p,h);if(g instanceof Promise){if(h.async===!1)throw new Kn;return g.then(m=>d(m,r,h))}return d(g,r,h)}}ne(e,"~standard",()=>({validate:d=>{var l;try{const p=Md(e,d);return p.success?{value:p.data}:{issues:(l=p.error)==null?void 0:l.issues}}catch(p){return Ud(e,d).then(h=>{var g;return h.success?{value:h.data}:{issues:(g=h.error)==null?void 0:g.issues}})}},vendor:"zod",version:1}))}),Gs=w("$ZodString",(e,t)=>{var n,r,o;be.init(e,t),e._zod.pattern=(o=[...(r=(n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)!=null?r:[]].pop())!=null?o:fp(e._zod.bag),e._zod.parse=(i,a)=>{if(t.coerce)try{i.value=String(i.value)}catch(d){}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),ke=w("$ZodStringFormat",(e,t)=>{Ko.init(e,t),Gs.init(e,t)}),zp=w("$ZodGUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=tp),ke.init(e,t)}),$p=w("$ZodUUID",(e,t)=>{var n,r;if(t.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);(n=t.pattern)!=null||(t.pattern=Di(i))}else(r=t.pattern)!=null||(t.pattern=Di());ke.init(e,t)}),Op=w("$ZodEmail",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=np),ke.init(e,t)}),Np=w("$ZodURL",(e,t)=>{ke.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Dp=w("$ZodEmoji",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=op()),ke.init(e,t)}),Mp=w("$ZodNanoID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Qd),ke.init(e,t)}),Up=w("$ZodCUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Jd),ke.init(e,t)}),jp=w("$ZodCUID2",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Yd),ke.init(e,t)}),Zp=w("$ZodULID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Xd),ke.init(e,t)}),qp=w("$ZodXID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Vd),ke.init(e,t)}),Hp=w("$ZodKSUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Kd),ke.init(e,t)}),Fp=w("$ZodISODateTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=hp(t)),ke.init(e,t)}),Bp=w("$ZodISODate",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=dp),ke.init(e,t)}),Gp=w("$ZodISOTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=pp(t)),ke.init(e,t)}),Wp=w("$ZodISODuration",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ep),ke.init(e,t)}),Jp=w("$ZodIPv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=sp),ke.init(e,t),e._zod.bag.format="ipv4"}),Yp=w("$ZodIPv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ip),ke.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch(o){r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Xp=w("$ZodCIDRv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ap),ke.init(e,t)}),Vp=w("$ZodCIDRv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=cp),ke.init(e,t),e._zod.check=r=>{const o=r.value.split("/");try{if(o.length!==2)throw new Error;const[i,a]=o;if(!a)throw new Error;const d=Number(a);if(`${d}`!==a)throw new Error;if(d<0||d>128)throw new Error;new URL(`http://[${i}]`)}catch(i){r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function cc(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch(t){return!1}}const Kp=w("$ZodBase64",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=lp),ke.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{cc(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Qp(e){if(!tc.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return cc(n)}const eh=w("$ZodBase64URL",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=tc),ke.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Qp(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),th=w("$ZodE164",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=up),ke.init(e,t)});function nh(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch(n){return!1}}const rh=w("$ZodJWT",(e,t)=>{ke.init(e,t),e._zod.check=n=>{nh(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),lc=w("$ZodNumber",(e,t)=>{var n;be.init(e,t),e._zod.pattern=(n=e._zod.bag.pattern)!=null?n:oc,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(d){}const i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;const a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push(v({expected:"number",code:"invalid_type",input:i,inst:e},a?{received:a}:{})),r}}),oh=w("$ZodNumberFormat",(e,t)=>{vp.init(e,t),lc.init(e,t)}),sh=w("$ZodBoolean",(e,t)=>{be.init(e,t),e._zod.pattern=mp,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch(i){}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),ih=w("$ZodAny",(e,t)=>{be.init(e,t),e._zod.parse=n=>n}),ah=w("$ZodUnknown",(e,t)=>{be.init(e,t),e._zod.parse=n=>n}),ch=w("$ZodNever",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Mi(e,t,n){e.issues.length&&t.issues.push(...Gn(n,e.issues)),t.value[n]=e.value}const lh=w("$ZodArray",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const d=o[a],l=t.element._zod.run({value:d,issues:[]},r);l instanceof Promise?i.push(l.then(p=>Mi(p,n,a))):Mi(l,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function zo(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Gn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function uc(e){var r,o,i,a;const t=Object.keys(e.shape);for(const d of t)if(!((a=(i=(o=(r=e.shape)==null?void 0:r[d])==null?void 0:o._zod)==null?void 0:i.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${d}": expected a Zod schema`);const n=Ad(e.shape);return M(v({},e),{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)})}function dc(e,t,n,r,o,i){const a=[],d=o.keySet,l=o.catchall._zod,p=l.def.type,h=l.optout==="optional";for(const g in t){if(d.has(g))continue;if(p==="never"){a.push(g);continue}const m=l.run({value:t[g],issues:[]},r);m instanceof Promise?e.push(m.then(k=>zo(k,n,g,t,h))):zo(m,n,g,t,h)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const uh=w("$ZodObject",(e,t)=>{be.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const d=t.shape;Object.defineProperty(t,"shape",{get:()=>{const l=v({},d);return Object.defineProperty(t,"shape",{value:l}),l}})}const r=Yo(()=>uc(t));ne(e._zod,"propValues",()=>{var p;const d=t.shape,l={};for(const h in d){const g=d[h]._zod;if(g.values){(p=l[h])!=null||(l[h]=new Set);for(const m of g.values)l[h].add(m)}}return l});const o=Dr,i=t.catchall;let a;e._zod.parse=(d,l)=>{a!=null||(a=r.value);const p=d.value;if(!o(p))return d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d;d.value={};const h=[],g=a.shape;for(const m of a.keys){const k=g[m],y=k._zod.optout==="optional",E=k._zod.run({value:p[m],issues:[]},l);E instanceof Promise?h.push(E.then(j=>zo(j,d,m,p,y))):zo(E,d,m,p,y)}return i?dc(h,p,d,l,r.value,e):h.length?Promise.all(h).then(()=>d):d}}),dh=w("$ZodObjectJIT",(e,t)=>{uh.init(e,t);const n=e._zod.parse,r=Yo(()=>uc(t)),o=m=>{var T;const k=new Lp(["shape","payload","ctx"]),y=r.value,E=S=>{const P=Ni(S);return`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`};k.write("const input = payload.value;");const j=Object.create(null);let Q=0;for(const S of y.keys)j[S]=`key_${Q++}`;k.write("const newResult = {};");for(const S of y.keys){const P=j[S],Z=Ni(S),Y=m[S],he=((T=Y==null?void 0:Y._zod)==null?void 0:T.optout)==="optional";k.write(`const ${P} = ${E(S)};`),he?k.write(`
1323
1323
  if (${P}.issues.length) {
1324
- if (${D} in input) {
1324
+ if (${Z} in input) {
1325
1325
  payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
1326
1326
  ...iss,
1327
- path: iss.path ? [${D}, ...iss.path] : [${D}]
1327
+ path: iss.path ? [${Z}, ...iss.path] : [${Z}]
1328
1328
  })));
1329
1329
  }
1330
1330
  }
1331
1331
 
1332
1332
  if (${P}.value === undefined) {
1333
- if (${D} in input) {
1334
- newResult[${D}] = undefined;
1333
+ if (${Z} in input) {
1334
+ newResult[${Z}] = undefined;
1335
1335
  }
1336
1336
  } else {
1337
- newResult[${D}] = ${P}.value;
1337
+ newResult[${Z}] = ${P}.value;
1338
1338
  }
1339
1339
 
1340
1340
  `):k.write(`
1341
1341
  if (${P}.issues.length) {
1342
1342
  payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
1343
1343
  ...iss,
1344
- path: iss.path ? [${D}, ...iss.path] : [${D}]
1344
+ path: iss.path ? [${Z}, ...iss.path] : [${Z}]
1345
1345
  })));
1346
1346
  }
1347
1347
 
1348
1348
  if (${P}.value === undefined) {
1349
- if (${D} in input) {
1350
- newResult[${D}] = undefined;
1349
+ if (${Z} in input) {
1350
+ newResult[${Z}] = undefined;
1351
1351
  }
1352
1352
  } else {
1353
- newResult[${D}] = ${P}.value;
1353
+ newResult[${Z}] = ${P}.value;
1354
1354
  }
1355
1355
 
1356
- `)}k.write("payload.value = newResult;"),k.write("return payload;");const N=k.compile();return(S,P)=>N(m,S,P)};let i;const a=Dr,d=!Ja.jitless,p=d&&Td.value,h=t.catchall;let g;e._zod.parse=(m,k)=>{g!=null||(g=r.value);const y=m.value;return a(y)?d&&p&&(k==null?void 0:k.async)===!1&&k.jitless!==!0?(i||(i=o(t.shape)),m=i(m,k),h?dc([],y,m,k,g,e):m):n(m,k):(m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m)}});function Ui(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!Bn(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(a=>un(a,r,ln())))}),t)}const pc=w("$ZodUnion",(e,t)=>{be.init(e,t),oe(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),oe(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),oe(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),oe(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>qs(i.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let a=!1;const d=[];for(const l of t.options){const p=l._zod.run({value:o.value,issues:[]},i);if(p instanceof Promise)d.push(p),a=!0;else{if(p.issues.length===0)return p;d.push(p)}}return a?Promise.all(d).then(l=>Ui(l,o,e,i)):Ui(d,o,e,i)}}),ph=w("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,pc.init(e,t);const n=e._zod.parse;oe(e._zod,"propValues",()=>{const o={};for(const i of t.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[d,l]of Object.entries(a)){o[d]||(o[d]=new Set);for(const p of l)o[d].add(p)}}return o});const r=Yo(()=>{var a;const o=t.options,i=new Map;for(const d of o){const l=(a=d._zod.propValues)==null?void 0:a[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(d)}"`);for(const p of l){if(i.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);i.set(p,d)}}return i});e._zod.parse=(o,i)=>{const a=o.value;if(!Dr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const d=r.value.get(a==null?void 0:a[t.discriminator]);return d?d._zod.run(o,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),hh=w("$ZodIntersection",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([l,p])=>ji(n,l,p)):ji(n,i,a)}});function As(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(nr(e)&&nr(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o=v(v({},e),t);for(const i of r){const a=As(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],a=As(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ji(e,t,n){const r=new Map;let o;for(const d of t.issues)if(d.code==="unrecognized_keys"){o!=null||(o=d);for(const l of d.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else e.issues.push(d);for(const d of n.issues)if(d.code==="unrecognized_keys")for(const l of d.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else e.issues.push(d);const i=[...r].filter(([,d])=>d.l&&d.r).map(([d])=>d);if(i.length&&o&&e.issues.push(U(v({},o),{keys:i})),Bn(e))return e;const a=As(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const fh=w("$ZodRecord",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!nr(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],a=t.keyType._zod.values;if(a){n.value={};const d=new Set;for(const p of a)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){d.add(typeof p=="number"?p.toString():p);const h=t.valueType._zod.run({value:o[p],issues:[]},r);h instanceof Promise?i.push(h.then(g=>{g.issues.length&&n.issues.push(...Gn(p,g.issues)),n.value[p]=g.value})):(h.issues.length&&n.issues.push(...Gn(p,h.issues)),n.value[p]=h.value)}let l;for(const p in o)d.has(p)||(l=l!=null?l:[],l.push(p));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l})}else{n.value={};for(const d of Reflect.ownKeys(o)){if(d==="__proto__")continue;let l=t.keyType._zod.run({value:d,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof d=="string"&&oc.test(d)&&l.issues.length&&l.issues.some(g=>g.code==="invalid_type"&&g.expected==="number")){const g=t.keyType._zod.run({value:Number(d),issues:[]},r);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(l=g)}if(l.issues.length){t.mode==="loose"?n.value[d]=o[d]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>un(g,r,ln())),input:d,path:[d],inst:e});continue}const h=t.valueType._zod.run({value:o[d],issues:[]},r);h instanceof Promise?i.push(h.then(g=>{g.issues.length&&n.issues.push(...Gn(d,g.issues)),n.value[l.value]=g.value})):(h.issues.length&&n.issues.push(...Gn(d,h.issues)),n.value[l.value]=h.value)}}return i.length?Promise.all(i).then(()=>n):n}}),gh=w("$ZodEnum",(e,t)=>{be.init(e,t);const n=Ya(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Ed.has(typeof o)).map(o=>typeof o=="string"?rr(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),mh=w("$ZodLiteral",(e,t)=>{if(be.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"?rr(r):r?rr(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),bh=w("$ZodTransform",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Wa(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new Kn;return n.value=o,n}});function Zi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const hc=w("$ZodOptional",(e,t)=>{be.init(e,t),e._zod.optin="optional",e._zod.optout="optional",oe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),oe(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${qs(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Zi(i,n.value)):Zi(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),kh=w("$ZodExactOptional",(e,t)=>{hc.init(e,t),oe(e._zod,"values",()=>t.innerType._zod.values),oe(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),_h=w("$ZodNullable",(e,t)=>{be.init(e,t),oe(e._zod,"optin",()=>t.innerType._zod.optin),oe(e._zod,"optout",()=>t.innerType._zod.optout),oe(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${qs(n.source)}|null)$`):void 0}),oe(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)}),vh=w("$ZodDefault",(e,t)=>{be.init(e,t),e._zod.optin="optional",oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>qi(i,t)):qi(o,t)}});function qi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const yh=w("$ZodPrefault",(e,t)=>{be.init(e,t),e._zod.optin="optional",oe(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))}),wh=w("$ZodNonOptional",(e,t)=>{be.init(e,t),oe(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Hi(i,e)):Hi(o,e)}});function Hi(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 xh=w("$ZodCatch",(e,t)=>{be.init(e,t),oe(e._zod,"optin",()=>t.innerType._zod.optin),oe(e._zod,"optout",()=>t.innerType._zod.optout),oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue(U(v({},n),{error:{issues:i.issues.map(a=>un(a,r,ln()))},input:n.value})),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue(U(v({},n),{error:{issues:o.issues.map(i=>un(i,r,ln()))},input:n.value})),n.issues=[]),n)}}),Sh=w("$ZodPipe",(e,t)=>{be.init(e,t),oe(e._zod,"values",()=>t.in._zod.values),oe(e._zod,"optin",()=>t.in._zod.optin),oe(e._zod,"optout",()=>t.out._zod.optout),oe(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(a=>co(a,t.in,r)):co(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>co(i,t.out,r)):co(o,t.out,r)}});function co(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Th=w("$ZodReadonly",(e,t)=>{be.init(e,t),oe(e._zod,"propValues",()=>t.innerType._zod.propValues),oe(e._zod,"values",()=>t.innerType._zod.values),oe(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),oe(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(Fi):Fi(o)}});function Fi(e){return e.value=Object.freeze(e.value),e}const Eh=w("$ZodCustom",(e,t)=>{tt.init(e,t),be.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>Bi(i,n,r,e));Bi(o,n,r,e)}});function Bi(e,t,n,r){var o;if(!e){const i={code:"custom",input:n,inst:r,path:[...(o=r._zod.def.path)!=null?o:[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(Mr(i))}}var Gi;class Ah{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){var r;const n=t._zod.parent;if(n){const o=v({},(r=this.get(n))!=null?r:{});delete o.id;const i=v(v({},o),this._map.get(t));return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Ch(){return new Ah}var ja;(ja=(Gi=globalThis).__zod_globalRegistry)!=null||(Gi.__zod_globalRegistry=Ch());const Pr=globalThis.__zod_globalRegistry;function Ph(e,t){return new e(v({type:"string"},j(t)))}function Rh(e,t){return new e(v({type:"string",format:"email",check:"string_format",abort:!1},j(t)))}function Wi(e,t){return new e(v({type:"string",format:"guid",check:"string_format",abort:!1},j(t)))}function Lh(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1},j(t)))}function Ih(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4"},j(t)))}function zh(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6"},j(t)))}function $h(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7"},j(t)))}function Oh(e,t){return new e(v({type:"string",format:"url",check:"string_format",abort:!1},j(t)))}function Nh(e,t){return new e(v({type:"string",format:"emoji",check:"string_format",abort:!1},j(t)))}function Dh(e,t){return new e(v({type:"string",format:"nanoid",check:"string_format",abort:!1},j(t)))}function Mh(e,t){return new e(v({type:"string",format:"cuid",check:"string_format",abort:!1},j(t)))}function Uh(e,t){return new e(v({type:"string",format:"cuid2",check:"string_format",abort:!1},j(t)))}function jh(e,t){return new e(v({type:"string",format:"ulid",check:"string_format",abort:!1},j(t)))}function Zh(e,t){return new e(v({type:"string",format:"xid",check:"string_format",abort:!1},j(t)))}function qh(e,t){return new e(v({type:"string",format:"ksuid",check:"string_format",abort:!1},j(t)))}function Hh(e,t){return new e(v({type:"string",format:"ipv4",check:"string_format",abort:!1},j(t)))}function Fh(e,t){return new e(v({type:"string",format:"ipv6",check:"string_format",abort:!1},j(t)))}function Bh(e,t){return new e(v({type:"string",format:"cidrv4",check:"string_format",abort:!1},j(t)))}function Gh(e,t){return new e(v({type:"string",format:"cidrv6",check:"string_format",abort:!1},j(t)))}function Wh(e,t){return new e(v({type:"string",format:"base64",check:"string_format",abort:!1},j(t)))}function Jh(e,t){return new e(v({type:"string",format:"base64url",check:"string_format",abort:!1},j(t)))}function Yh(e,t){return new e(v({type:"string",format:"e164",check:"string_format",abort:!1},j(t)))}function Xh(e,t){return new e(v({type:"string",format:"jwt",check:"string_format",abort:!1},j(t)))}function Vh(e,t){return new e(v({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null},j(t)))}function Kh(e,t){return new e(v({type:"string",format:"date",check:"string_format"},j(t)))}function Qh(e,t){return new e(v({type:"string",format:"time",check:"string_format",precision:null},j(t)))}function ef(e,t){return new e(v({type:"string",format:"duration",check:"string_format"},j(t)))}function tf(e,t){return new e(v({type:"number",checks:[]},j(t)))}function nf(e,t){return new e(v({type:"number",check:"number_format",abort:!1,format:"safeint"},j(t)))}function rf(e,t){return new e(v({type:"boolean"},j(t)))}function of(e){return new e({type:"any"})}function sf(e){return new e({type:"unknown"})}function af(e,t){return new e(v({type:"never"},j(t)))}function Ji(e,t){return new ic(U(v({check:"less_than"},j(t)),{value:e,inclusive:!1}))}function fs(e,t){return new ic(U(v({check:"less_than"},j(t)),{value:e,inclusive:!0}))}function Yi(e,t){return new ac(U(v({check:"greater_than"},j(t)),{value:e,inclusive:!1}))}function gs(e,t){return new ac(U(v({check:"greater_than"},j(t)),{value:e,inclusive:!0}))}function Xi(e,t){return new _p(U(v({check:"multiple_of"},j(t)),{value:e}))}function fc(e,t){return new yp(U(v({check:"max_length"},j(t)),{maximum:e}))}function $o(e,t){return new wp(U(v({check:"min_length"},j(t)),{minimum:e}))}function gc(e,t){return new xp(U(v({check:"length_equals"},j(t)),{length:e}))}function cf(e,t){return new Sp(U(v({check:"string_format",format:"regex"},j(t)),{pattern:e}))}function lf(e){return new Tp(v({check:"string_format",format:"lowercase"},j(e)))}function uf(e){return new Ep(v({check:"string_format",format:"uppercase"},j(e)))}function df(e,t){return new Ap(U(v({check:"string_format",format:"includes"},j(t)),{includes:e}))}function pf(e,t){return new Cp(U(v({check:"string_format",format:"starts_with"},j(t)),{prefix:e}))}function hf(e,t){return new Pp(U(v({check:"string_format",format:"ends_with"},j(t)),{suffix:e}))}function ar(e){return new Rp({check:"overwrite",tx:e})}function ff(e){return ar(t=>t.normalize(e))}function gf(){return ar(e=>e.trim())}function mf(){return ar(e=>e.toLowerCase())}function bf(){return ar(e=>e.toUpperCase())}function kf(){return ar(e=>Sd(e))}function _f(e,t,n){return new e(v({type:"array",element:t},j(n)))}function vf(e,t,n){return new e(v({type:"custom",check:"custom",fn:t},j(n)))}function yf(e){const t=wf(n=>(n.addIssue=r=>{var o,i,a,d;if(typeof r=="string")n.issues.push(Mr(r,n.value,t._zod.def));else{const l=r;l.fatal&&(l.continue=!1),(o=l.code)!=null||(l.code="custom"),(i=l.input)!=null||(l.input=n.value),(a=l.inst)!=null||(l.inst=t),(d=l.continue)!=null||(l.continue=!t._zod.def.abort),n.issues.push(Mr(l))}},e(n.value,n)));return t}function wf(e,t){const n=new tt(v({check:"custom"},j(t)));return n._zod.check=e,n}function mc(e){var n,r,o,i,a,d,l,p,h;let t=(n=e==null?void 0:e.target)!=null?n:"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:(r=e.processors)!=null?r:{},metadataRegistry:(o=e==null?void 0:e.metadata)!=null?o:Pr,target:t,unrepresentable:(i=e==null?void 0:e.unrepresentable)!=null?i:"throw",override:(a=e==null?void 0:e.override)!=null?a:(()=>{}),io:(d=e==null?void 0:e.io)!=null?d:"output",counter:0,seen:new Map,cycles:(l=e==null?void 0:e.cycles)!=null?l:"ref",reused:(p=e==null?void 0:e.reused)!=null?p:"inline",external:(h=e==null?void 0:e.external)!=null?h:void 0}}function Re(e,t,n={path:[],schemaPath:[]}){var h,g,m;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const d=(g=(h=e._zod).toJSONSchema)==null?void 0:g.call(h);if(d)a.schema=d;else{const k=U(v({},n),{schemaPath:[...n.schemaPath,e],path:n.path});if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,k);else{const E=a.schema,Z=t.processors[o.type];if(!Z)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);Z(e,t,E,k)}const y=e._zod.parent;y&&(a.ref||(a.ref=y),Re(y,t,k),t.seen.get(y).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),t.io==="input"&&Ye(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((m=(r=a.schema).default)!=null||(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function bc(e,t){var a,d,l,p;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const h of e.seen.entries()){const g=(a=e.metadataRegistry.get(h[0]))==null?void 0:a.id;if(g){const m=r.get(g);if(m&&m!==h[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(g,h[0])}}const o=h=>{var E,Z,ee,N,T;const g=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const S=(E=e.external.registry.get(h[0]))==null?void 0:E.id,P=(Z=e.external.uri)!=null?Z:(J=>J);if(S)return{ref:P(S)};const D=(N=(ee=h[1].defId)!=null?ee:h[1].schema.id)!=null?N:`schema${e.counter++}`;return h[1].defId=D,{defId:D,ref:`${P("__shared")}#/${g}/${D}`}}if(h[1]===n)return{ref:"#"};const k=`#/${g}/`,y=(T=h[1].schema.id)!=null?T:`__schema${e.counter++}`;return{defId:y,ref:k+y}},i=h=>{if(h[1].schema.$ref)return;const g=h[1],{ref:m,defId:k}=o(h);g.def=v({},g.schema),k&&(g.defId=k);const y=g.schema;for(const E in y)delete y[E];y.$ref=m};if(e.cycles==="throw")for(const h of e.seen.entries()){const g=h[1];if(g.cycle)throw new Error(`Cycle detected: #/${(d=g.cycle)==null?void 0:d.join("/")}/<root>
1356
+ `)}k.write("payload.value = newResult;"),k.write("return payload;");const N=k.compile();return(S,P)=>N(m,S,P)};let i;const a=Dr,d=!Ja.jitless,p=d&&Td.value,h=t.catchall;let g;e._zod.parse=(m,k)=>{g!=null||(g=r.value);const y=m.value;return a(y)?d&&p&&(k==null?void 0:k.async)===!1&&k.jitless!==!0?(i||(i=o(t.shape)),m=i(m,k),h?dc([],y,m,k,g,e):m):n(m,k):(m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m)}});function Ui(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!Bn(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(a=>dn(a,r,un())))}),t)}const pc=w("$ZodUnion",(e,t)=>{be.init(e,t),ne(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),ne(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),ne(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),ne(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>qs(i.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let a=!1;const d=[];for(const l of t.options){const p=l._zod.run({value:o.value,issues:[]},i);if(p instanceof Promise)d.push(p),a=!0;else{if(p.issues.length===0)return p;d.push(p)}}return a?Promise.all(d).then(l=>Ui(l,o,e,i)):Ui(d,o,e,i)}}),ph=w("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,pc.init(e,t);const n=e._zod.parse;ne(e._zod,"propValues",()=>{const o={};for(const i of t.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[d,l]of Object.entries(a)){o[d]||(o[d]=new Set);for(const p of l)o[d].add(p)}}return o});const r=Yo(()=>{var a;const o=t.options,i=new Map;for(const d of o){const l=(a=d._zod.propValues)==null?void 0:a[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(d)}"`);for(const p of l){if(i.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);i.set(p,d)}}return i});e._zod.parse=(o,i)=>{const a=o.value;if(!Dr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const d=r.value.get(a==null?void 0:a[t.discriminator]);return d?d._zod.run(o,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),hh=w("$ZodIntersection",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([l,p])=>ji(n,l,p)):ji(n,i,a)}});function As(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(nr(e)&&nr(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o=v(v({},e),t);for(const i of r){const a=As(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],a=As(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ji(e,t,n){const r=new Map;let o;for(const d of t.issues)if(d.code==="unrecognized_keys"){o!=null||(o=d);for(const l of d.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else e.issues.push(d);for(const d of n.issues)if(d.code==="unrecognized_keys")for(const l of d.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else e.issues.push(d);const i=[...r].filter(([,d])=>d.l&&d.r).map(([d])=>d);if(i.length&&o&&e.issues.push(M(v({},o),{keys:i})),Bn(e))return e;const a=As(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const fh=w("$ZodRecord",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!nr(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],a=t.keyType._zod.values;if(a){n.value={};const d=new Set;for(const p of a)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){d.add(typeof p=="number"?p.toString():p);const h=t.valueType._zod.run({value:o[p],issues:[]},r);h instanceof Promise?i.push(h.then(g=>{g.issues.length&&n.issues.push(...Gn(p,g.issues)),n.value[p]=g.value})):(h.issues.length&&n.issues.push(...Gn(p,h.issues)),n.value[p]=h.value)}let l;for(const p in o)d.has(p)||(l=l!=null?l:[],l.push(p));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l})}else{n.value={};for(const d of Reflect.ownKeys(o)){if(d==="__proto__")continue;let l=t.keyType._zod.run({value:d,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof d=="string"&&oc.test(d)&&l.issues.length&&l.issues.some(g=>g.code==="invalid_type"&&g.expected==="number")){const g=t.keyType._zod.run({value:Number(d),issues:[]},r);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(l=g)}if(l.issues.length){t.mode==="loose"?n.value[d]=o[d]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>dn(g,r,un())),input:d,path:[d],inst:e});continue}const h=t.valueType._zod.run({value:o[d],issues:[]},r);h instanceof Promise?i.push(h.then(g=>{g.issues.length&&n.issues.push(...Gn(d,g.issues)),n.value[l.value]=g.value})):(h.issues.length&&n.issues.push(...Gn(d,h.issues)),n.value[l.value]=h.value)}}return i.length?Promise.all(i).then(()=>n):n}}),gh=w("$ZodEnum",(e,t)=>{be.init(e,t);const n=Ya(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Ed.has(typeof o)).map(o=>typeof o=="string"?rr(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),mh=w("$ZodLiteral",(e,t)=>{if(be.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"?rr(r):r?rr(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),bh=w("$ZodTransform",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Wa(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new Kn;return n.value=o,n}});function Zi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const hc=w("$ZodOptional",(e,t)=>{be.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ne(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ne(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${qs(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Zi(i,n.value)):Zi(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),kh=w("$ZodExactOptional",(e,t)=>{hc.init(e,t),ne(e._zod,"values",()=>t.innerType._zod.values),ne(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),_h=w("$ZodNullable",(e,t)=>{be.init(e,t),ne(e._zod,"optin",()=>t.innerType._zod.optin),ne(e._zod,"optout",()=>t.innerType._zod.optout),ne(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${qs(n.source)}|null)$`):void 0}),ne(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),vh=w("$ZodDefault",(e,t)=>{be.init(e,t),e._zod.optin="optional",ne(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>qi(i,t)):qi(o,t)}});function qi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const yh=w("$ZodPrefault",(e,t)=>{be.init(e,t),e._zod.optin="optional",ne(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),wh=w("$ZodNonOptional",(e,t)=>{be.init(e,t),ne(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Hi(i,e)):Hi(o,e)}});function Hi(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 xh=w("$ZodCatch",(e,t)=>{be.init(e,t),ne(e._zod,"optin",()=>t.innerType._zod.optin),ne(e._zod,"optout",()=>t.innerType._zod.optout),ne(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue(M(v({},n),{error:{issues:i.issues.map(a=>dn(a,r,un()))},input:n.value})),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue(M(v({},n),{error:{issues:o.issues.map(i=>dn(i,r,un()))},input:n.value})),n.issues=[]),n)}}),Sh=w("$ZodPipe",(e,t)=>{be.init(e,t),ne(e._zod,"values",()=>t.in._zod.values),ne(e._zod,"optin",()=>t.in._zod.optin),ne(e._zod,"optout",()=>t.out._zod.optout),ne(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(a=>co(a,t.in,r)):co(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>co(i,t.out,r)):co(o,t.out,r)}});function co(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Th=w("$ZodReadonly",(e,t)=>{be.init(e,t),ne(e._zod,"propValues",()=>t.innerType._zod.propValues),ne(e._zod,"values",()=>t.innerType._zod.values),ne(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),ne(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Fi):Fi(o)}});function Fi(e){return e.value=Object.freeze(e.value),e}const Eh=w("$ZodCustom",(e,t)=>{ot.init(e,t),be.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>Bi(i,n,r,e));Bi(o,n,r,e)}});function Bi(e,t,n,r){var o;if(!e){const i={code:"custom",input:n,inst:r,path:[...(o=r._zod.def.path)!=null?o:[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(Mr(i))}}var Gi;class Ah{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){var r;const n=t._zod.parent;if(n){const o=v({},(r=this.get(n))!=null?r:{});delete o.id;const i=v(v({},o),this._map.get(t));return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Ch(){return new Ah}var ja;(ja=(Gi=globalThis).__zod_globalRegistry)!=null||(Gi.__zod_globalRegistry=Ch());const Pr=globalThis.__zod_globalRegistry;function Ph(e,t){return new e(v({type:"string"},U(t)))}function Rh(e,t){return new e(v({type:"string",format:"email",check:"string_format",abort:!1},U(t)))}function Wi(e,t){return new e(v({type:"string",format:"guid",check:"string_format",abort:!1},U(t)))}function Lh(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1},U(t)))}function Ih(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4"},U(t)))}function zh(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6"},U(t)))}function $h(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7"},U(t)))}function Oh(e,t){return new e(v({type:"string",format:"url",check:"string_format",abort:!1},U(t)))}function Nh(e,t){return new e(v({type:"string",format:"emoji",check:"string_format",abort:!1},U(t)))}function Dh(e,t){return new e(v({type:"string",format:"nanoid",check:"string_format",abort:!1},U(t)))}function Mh(e,t){return new e(v({type:"string",format:"cuid",check:"string_format",abort:!1},U(t)))}function Uh(e,t){return new e(v({type:"string",format:"cuid2",check:"string_format",abort:!1},U(t)))}function jh(e,t){return new e(v({type:"string",format:"ulid",check:"string_format",abort:!1},U(t)))}function Zh(e,t){return new e(v({type:"string",format:"xid",check:"string_format",abort:!1},U(t)))}function qh(e,t){return new e(v({type:"string",format:"ksuid",check:"string_format",abort:!1},U(t)))}function Hh(e,t){return new e(v({type:"string",format:"ipv4",check:"string_format",abort:!1},U(t)))}function Fh(e,t){return new e(v({type:"string",format:"ipv6",check:"string_format",abort:!1},U(t)))}function Bh(e,t){return new e(v({type:"string",format:"cidrv4",check:"string_format",abort:!1},U(t)))}function Gh(e,t){return new e(v({type:"string",format:"cidrv6",check:"string_format",abort:!1},U(t)))}function Wh(e,t){return new e(v({type:"string",format:"base64",check:"string_format",abort:!1},U(t)))}function Jh(e,t){return new e(v({type:"string",format:"base64url",check:"string_format",abort:!1},U(t)))}function Yh(e,t){return new e(v({type:"string",format:"e164",check:"string_format",abort:!1},U(t)))}function Xh(e,t){return new e(v({type:"string",format:"jwt",check:"string_format",abort:!1},U(t)))}function Vh(e,t){return new e(v({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null},U(t)))}function Kh(e,t){return new e(v({type:"string",format:"date",check:"string_format"},U(t)))}function Qh(e,t){return new e(v({type:"string",format:"time",check:"string_format",precision:null},U(t)))}function ef(e,t){return new e(v({type:"string",format:"duration",check:"string_format"},U(t)))}function tf(e,t){return new e(v({type:"number",checks:[]},U(t)))}function nf(e,t){return new e(v({type:"number",check:"number_format",abort:!1,format:"safeint"},U(t)))}function rf(e,t){return new e(v({type:"boolean"},U(t)))}function of(e){return new e({type:"any"})}function sf(e){return new e({type:"unknown"})}function af(e,t){return new e(v({type:"never"},U(t)))}function Ji(e,t){return new ic(M(v({check:"less_than"},U(t)),{value:e,inclusive:!1}))}function fs(e,t){return new ic(M(v({check:"less_than"},U(t)),{value:e,inclusive:!0}))}function Yi(e,t){return new ac(M(v({check:"greater_than"},U(t)),{value:e,inclusive:!1}))}function gs(e,t){return new ac(M(v({check:"greater_than"},U(t)),{value:e,inclusive:!0}))}function Xi(e,t){return new _p(M(v({check:"multiple_of"},U(t)),{value:e}))}function fc(e,t){return new yp(M(v({check:"max_length"},U(t)),{maximum:e}))}function $o(e,t){return new wp(M(v({check:"min_length"},U(t)),{minimum:e}))}function gc(e,t){return new xp(M(v({check:"length_equals"},U(t)),{length:e}))}function cf(e,t){return new Sp(M(v({check:"string_format",format:"regex"},U(t)),{pattern:e}))}function lf(e){return new Tp(v({check:"string_format",format:"lowercase"},U(e)))}function uf(e){return new Ep(v({check:"string_format",format:"uppercase"},U(e)))}function df(e,t){return new Ap(M(v({check:"string_format",format:"includes"},U(t)),{includes:e}))}function pf(e,t){return new Cp(M(v({check:"string_format",format:"starts_with"},U(t)),{prefix:e}))}function hf(e,t){return new Pp(M(v({check:"string_format",format:"ends_with"},U(t)),{suffix:e}))}function ar(e){return new Rp({check:"overwrite",tx:e})}function ff(e){return ar(t=>t.normalize(e))}function gf(){return ar(e=>e.trim())}function mf(){return ar(e=>e.toLowerCase())}function bf(){return ar(e=>e.toUpperCase())}function kf(){return ar(e=>Sd(e))}function _f(e,t,n){return new e(v({type:"array",element:t},U(n)))}function vf(e,t,n){return new e(v({type:"custom",check:"custom",fn:t},U(n)))}function yf(e){const t=wf(n=>(n.addIssue=r=>{var o,i,a,d;if(typeof r=="string")n.issues.push(Mr(r,n.value,t._zod.def));else{const l=r;l.fatal&&(l.continue=!1),(o=l.code)!=null||(l.code="custom"),(i=l.input)!=null||(l.input=n.value),(a=l.inst)!=null||(l.inst=t),(d=l.continue)!=null||(l.continue=!t._zod.def.abort),n.issues.push(Mr(l))}},e(n.value,n)));return t}function wf(e,t){const n=new ot(v({check:"custom"},U(t)));return n._zod.check=e,n}function mc(e){var n,r,o,i,a,d,l,p,h;let t=(n=e==null?void 0:e.target)!=null?n:"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:(r=e.processors)!=null?r:{},metadataRegistry:(o=e==null?void 0:e.metadata)!=null?o:Pr,target:t,unrepresentable:(i=e==null?void 0:e.unrepresentable)!=null?i:"throw",override:(a=e==null?void 0:e.override)!=null?a:(()=>{}),io:(d=e==null?void 0:e.io)!=null?d:"output",counter:0,seen:new Map,cycles:(l=e==null?void 0:e.cycles)!=null?l:"ref",reused:(p=e==null?void 0:e.reused)!=null?p:"inline",external:(h=e==null?void 0:e.external)!=null?h:void 0}}function Ce(e,t,n={path:[],schemaPath:[]}){var h,g,m;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const d=(g=(h=e._zod).toJSONSchema)==null?void 0:g.call(h);if(d)a.schema=d;else{const k=M(v({},n),{schemaPath:[...n.schemaPath,e],path:n.path});if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,k);else{const E=a.schema,j=t.processors[o.type];if(!j)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);j(e,t,E,k)}const y=e._zod.parent;y&&(a.ref||(a.ref=y),Ce(y,t,k),t.seen.get(y).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),t.io==="input"&&Ke(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((m=(r=a.schema).default)!=null||(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function bc(e,t){var a,d,l,p;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const h of e.seen.entries()){const g=(a=e.metadataRegistry.get(h[0]))==null?void 0:a.id;if(g){const m=r.get(g);if(m&&m!==h[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(g,h[0])}}const o=h=>{var E,j,Q,N,T;const g=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const S=(E=e.external.registry.get(h[0]))==null?void 0:E.id,P=(j=e.external.uri)!=null?j:(Y=>Y);if(S)return{ref:P(S)};const Z=(N=(Q=h[1].defId)!=null?Q:h[1].schema.id)!=null?N:`schema${e.counter++}`;return h[1].defId=Z,{defId:Z,ref:`${P("__shared")}#/${g}/${Z}`}}if(h[1]===n)return{ref:"#"};const k=`#/${g}/`,y=(T=h[1].schema.id)!=null?T:`__schema${e.counter++}`;return{defId:y,ref:k+y}},i=h=>{if(h[1].schema.$ref)return;const g=h[1],{ref:m,defId:k}=o(h);g.def=v({},g.schema),k&&(g.defId=k);const y=g.schema;for(const E in y)delete y[E];y.$ref=m};if(e.cycles==="throw")for(const h of e.seen.entries()){const g=h[1];if(g.cycle)throw new Error(`Cycle detected: #/${(d=g.cycle)==null?void 0:d.join("/")}/<root>
1357
1357
 
1358
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const g=h[1];if(t===h[0]){i(h);continue}if(e.external){const k=(l=e.external.registry.get(h[0]))==null?void 0:l.id;if(t!==h[0]&&k){i(h);continue}}if((p=e.metadataRegistry.get(h[0]))==null?void 0:p.id){i(h);continue}if(g.cycle){i(h);continue}if(g.count>1&&e.reused==="ref"){i(h);continue}}}function kc(e,t){var a,d,l,p,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=g=>{var ee,N,T;const m=e.seen.get(g);if(m.ref===null)return;const k=(ee=m.def)!=null?ee:m.schema,y=v({},k),E=m.ref;if(m.ref=null,E){r(E);const S=e.seen.get(E),P=S.schema;if(P.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=(N=k.allOf)!=null?N:[],k.allOf.push(P)):Object.assign(k,P),Object.assign(k,y),g._zod.parent===E)for(const J in k)J==="$ref"||J==="allOf"||J in y||delete k[J];if(P.$ref)for(const J in k)J==="$ref"||J==="allOf"||J in S.def&&JSON.stringify(k[J])===JSON.stringify(S.def[J])&&delete k[J]}const Z=g._zod.parent;if(Z&&Z!==E){r(Z);const S=e.seen.get(Z);if(S!=null&&S.schema.$ref&&(k.$ref=S.schema.$ref,S.def))for(const P in k)P==="$ref"||P==="allOf"||P in S.def&&JSON.stringify(k[P])===JSON.stringify(S.def[P])&&delete k[P]}e.override({zodSchema:g,jsonSchema:k,path:(T=m.path)!=null?T:[]})};for(const g of[...e.seen.entries()].reverse())r(g[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const g=(d=e.external.registry.get(t))==null?void 0:d.id;if(!g)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(g)}Object.assign(o,(l=n.def)!=null?l:n.schema);const i=(h=(p=e.external)==null?void 0:p.defs)!=null?h:{};for(const g of e.seen.entries()){const m=g[1];m.def&&m.defId&&(i[m.defId]=m.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const g=JSON.parse(JSON.stringify(o));return Object.defineProperty(g,"~standard",{value:U(v({},t["~standard"]),{jsonSchema:{input:Oo(t,"input",e.processors),output:Oo(t,"output",e.processors)}}),enumerable:!1,writable:!1}),g}catch(g){throw new Error("Error converting schema to JSON.")}}function Ye(e,t){const n=t!=null?t:{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Ye(r.element,n);if(r.type==="set")return Ye(r.valueType,n);if(r.type==="lazy")return Ye(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Ye(r.innerType,n);if(r.type==="intersection")return Ye(r.left,n)||Ye(r.right,n);if(r.type==="record"||r.type==="map")return Ye(r.keyType,n)||Ye(r.valueType,n);if(r.type==="pipe")return Ye(r.in,n)||Ye(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Ye(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Ye(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Ye(o,n))return!0;return!!(r.rest&&Ye(r.rest,n))}return!1}const xf=(e,t={})=>n=>{const r=mc(U(v({},n),{processors:t}));return Re(e,r),bc(r,e),kc(r,e)},Oo=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=mc(U(v({},o!=null?o:{}),{target:i,io:t,processors:n}));return Re(e,a),bc(a,e),kc(a,e)},Sf={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Tf=(e,t,n,r)=>{var h;const o=n;o.type="string";const{minimum:i,maximum:a,format:d,patterns:l,contentEncoding:p}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),d&&(o.format=(h=Sf[d])!=null?h:d,o.format===""&&delete o.format,d==="time"&&delete o.format),p&&(o.contentEncoding=p),l&&l.size>0){const g=[...l];g.length===1?o.pattern=g[0].source:g.length>1&&(o.allOf=[...g.map(m=>U(v({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:m.source}))])}},Ef=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:d,multipleOf:l,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof d=="string"&&d.includes("int")?o.type="integer":o.type="number",typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=h,o.exclusiveMinimum=!0):o.exclusiveMinimum=h),typeof i=="number"&&(o.minimum=i,typeof h=="number"&&t.target!=="draft-04"&&(h>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p),typeof a=="number"&&(o.maximum=a,typeof p=="number"&&t.target!=="draft-04"&&(p<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof l=="number"&&(o.multipleOf=l)},Af=(e,t,n,r)=>{n.type="boolean"},Cf=(e,t,n,r)=>{n.not={}},Pf=(e,t,n,r)=>{},Rf=(e,t,n,r)=>{},Lf=(e,t,n,r)=>{const o=e._zod.def,i=Ya(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},If=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i},zf=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},$f=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Of=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:a,maximum:d}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof d=="number"&&(o.maxItems=d),o.type="array",o.items=Re(i.element,t,U(v({},r),{path:[...r.path,"items"]}))},Nf=(e,t,n,r)=>{var p;const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const h in a)o.properties[h]=Re(a[h],t,U(v({},r),{path:[...r.path,"properties",h]}));const d=new Set(Object.keys(a)),l=new Set([...d].filter(h=>{const g=i.shape[h]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));l.size>0&&(o.required=Array.from(l)),((p=i.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Re(i.catchall,t,U(v({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},Df=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((d,l)=>Re(d,t,U(v({},r),{path:[...r.path,i?"oneOf":"anyOf",l]})));i?n.oneOf=a:n.anyOf=a},Mf=(e,t,n,r)=>{const o=e._zod.def,i=Re(o.left,t,U(v({},r),{path:[...r.path,"allOf",0]})),a=Re(o.right,t,U(v({},r),{path:[...r.path,"allOf",1]})),d=p=>"allOf"in p&&Object.keys(p).length===1,l=[...d(i)?i.allOf:[i],...d(a)?a.allOf:[a]];n.allOf=l},Uf=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,d=a._zod.bag,l=d==null?void 0:d.patterns;if(i.mode==="loose"&&l&&l.size>0){const h=Re(i.valueType,t,U(v({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const g of l)o.patternProperties[g.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Re(i.keyType,t,U(v({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=Re(i.valueType,t,U(v({},r),{path:[...r.path,"additionalProperties"]}));const p=a._zod.values;if(p){const h=[...p].filter(g=>typeof g=="string"||typeof g=="number");h.length>0&&(o.required=h)}},jf=(e,t,n,r)=>{const o=e._zod.def,i=Re(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},Zf=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},qf=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Hf=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Ff=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch(d){throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},Bf=(e,t,n,r)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Re(i,t,r);const a=t.seen.get(e);a.ref=i},Gf=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},_c=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Wf=w("ZodISODateTime",(e,t)=>{Fp.init(e,t),ye.init(e,t)});function Jf(e){return Vh(Wf,e)}const Yf=w("ZodISODate",(e,t)=>{Bp.init(e,t),ye.init(e,t)});function Xf(e){return Kh(Yf,e)}const Vf=w("ZodISOTime",(e,t)=>{Gp.init(e,t),ye.init(e,t)});function Kf(e){return Qh(Vf,e)}const Qf=w("ZodISODuration",(e,t)=>{Wp.init(e,t),ye.init(e,t)});function eg(e){return ef(Qf,e)}const tg=(e,t)=>{Qa.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Dd(e,n)},flatten:{value:n=>Nd(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Es,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Es,2)}},isEmpty:{get(){return e.issues.length===0}}})},ft=w("ZodError",tg,{Parent:Error}),ng=Fs(ft),rg=Bs(ft),og=Xo(ft),sg=Vo(ft),ig=jd(ft),ag=Zd(ft),cg=qd(ft),lg=Hd(ft),ug=Fd(ft),dg=Bd(ft),pg=Gd(ft),hg=Wd(ft),_e=w("ZodType",(e,t)=>(be.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Oo(e,"input"),output:Oo(e,"output")}}),e.toJSONSchema=xf(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(dn(t,{checks:[...(r=t.checks)!=null?r:[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},e.with=e.check,e.clone=(n,r)=>pn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>ng(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>og(e,n,r),e.parseAsync=(n,r)=>L(null,null,function*(){return rg(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>L(null,null,function*(){return sg(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>ig(e,n,r),e.decode=(n,r)=>ag(e,n,r),e.encodeAsync=(n,r)=>L(null,null,function*(){return cg(e,n,r)}),e.decodeAsync=(n,r)=>L(null,null,function*(){return lg(e,n,r)}),e.safeEncode=(n,r)=>ug(e,n,r),e.safeDecode=(n,r)=>dg(e,n,r),e.safeEncodeAsync=(n,r)=>L(null,null,function*(){return pg(e,n,r)}),e.safeDecodeAsync=(n,r)=>L(null,null,function*(){return hg(e,n,r)}),e.refine=(n,r)=>e.check(cm(n,r)),e.superRefine=n=>e.check(lm(n)),e.overwrite=n=>e.check(ar(n)),e.optional=()=>ea(e),e.exactOptional=()=>Yg(e),e.nullable=()=>ta(e),e.nullish=()=>ea(ta(e)),e.nonoptional=n=>tm(e,n),e.array=()=>St(e),e.or=n=>jg([e,n]),e.and=n=>Hg(e,n),e.transform=n=>na(e,Wg(n)),e.default=n=>Kg(e,n),e.prefault=n=>em(e,n),e.catch=n=>rm(e,n),e.pipe=n=>na(e,n),e.readonly=()=>im(e),e.describe=n=>{const r=e.clone();return Pr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Pr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Pr.get(e);const r=e.clone();return Pr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),vc=w("_ZodString",(e,t)=>{var r,o,i;Gs.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(a,d,l)=>Tf(e,a,d);const n=e._zod.bag;e.format=(r=n.format)!=null?r:null,e.minLength=(o=n.minimum)!=null?o:null,e.maxLength=(i=n.maximum)!=null?i:null,e.regex=(...a)=>e.check(cf(...a)),e.includes=(...a)=>e.check(df(...a)),e.startsWith=(...a)=>e.check(pf(...a)),e.endsWith=(...a)=>e.check(hf(...a)),e.min=(...a)=>e.check($o(...a)),e.max=(...a)=>e.check(fc(...a)),e.length=(...a)=>e.check(gc(...a)),e.nonempty=(...a)=>e.check($o(1,...a)),e.lowercase=a=>e.check(lf(a)),e.uppercase=a=>e.check(uf(a)),e.trim=()=>e.check(gf()),e.normalize=(...a)=>e.check(ff(...a)),e.toLowerCase=()=>e.check(mf()),e.toUpperCase=()=>e.check(bf()),e.slugify=()=>e.check(kf())}),fg=w("ZodString",(e,t)=>{Gs.init(e,t),vc.init(e,t),e.email=n=>e.check(Rh(gg,n)),e.url=n=>e.check(Oh(mg,n)),e.jwt=n=>e.check(Xh(Lg,n)),e.emoji=n=>e.check(Nh(bg,n)),e.guid=n=>e.check(Wi(Vi,n)),e.uuid=n=>e.check(Lh(lo,n)),e.uuidv4=n=>e.check(Ih(lo,n)),e.uuidv6=n=>e.check(zh(lo,n)),e.uuidv7=n=>e.check($h(lo,n)),e.nanoid=n=>e.check(Dh(kg,n)),e.guid=n=>e.check(Wi(Vi,n)),e.cuid=n=>e.check(Mh(_g,n)),e.cuid2=n=>e.check(Uh(vg,n)),e.ulid=n=>e.check(jh(yg,n)),e.base64=n=>e.check(Wh(Cg,n)),e.base64url=n=>e.check(Jh(Pg,n)),e.xid=n=>e.check(Zh(wg,n)),e.ksuid=n=>e.check(qh(xg,n)),e.ipv4=n=>e.check(Hh(Sg,n)),e.ipv6=n=>e.check(Fh(Tg,n)),e.cidrv4=n=>e.check(Bh(Eg,n)),e.cidrv6=n=>e.check(Gh(Ag,n)),e.e164=n=>e.check(Yh(Rg,n)),e.datetime=n=>e.check(Jf(n)),e.date=n=>e.check(Xf(n)),e.time=n=>e.check(Kf(n)),e.duration=n=>e.check(eg(n))});function C(e){return Ph(fg,e)}const ye=w("ZodStringFormat",(e,t)=>{ke.init(e,t),vc.init(e,t)}),gg=w("ZodEmail",(e,t)=>{Op.init(e,t),ye.init(e,t)}),Vi=w("ZodGUID",(e,t)=>{zp.init(e,t),ye.init(e,t)}),lo=w("ZodUUID",(e,t)=>{$p.init(e,t),ye.init(e,t)}),mg=w("ZodURL",(e,t)=>{Np.init(e,t),ye.init(e,t)}),bg=w("ZodEmoji",(e,t)=>{Dp.init(e,t),ye.init(e,t)}),kg=w("ZodNanoID",(e,t)=>{Mp.init(e,t),ye.init(e,t)}),_g=w("ZodCUID",(e,t)=>{Up.init(e,t),ye.init(e,t)}),vg=w("ZodCUID2",(e,t)=>{jp.init(e,t),ye.init(e,t)}),yg=w("ZodULID",(e,t)=>{Zp.init(e,t),ye.init(e,t)}),wg=w("ZodXID",(e,t)=>{qp.init(e,t),ye.init(e,t)}),xg=w("ZodKSUID",(e,t)=>{Hp.init(e,t),ye.init(e,t)}),Sg=w("ZodIPv4",(e,t)=>{Jp.init(e,t),ye.init(e,t)}),Tg=w("ZodIPv6",(e,t)=>{Yp.init(e,t),ye.init(e,t)}),Eg=w("ZodCIDRv4",(e,t)=>{Xp.init(e,t),ye.init(e,t)}),Ag=w("ZodCIDRv6",(e,t)=>{Vp.init(e,t),ye.init(e,t)}),Cg=w("ZodBase64",(e,t)=>{Kp.init(e,t),ye.init(e,t)}),Pg=w("ZodBase64URL",(e,t)=>{eh.init(e,t),ye.init(e,t)}),Rg=w("ZodE164",(e,t)=>{th.init(e,t),ye.init(e,t)}),Lg=w("ZodJWT",(e,t)=>{rh.init(e,t),ye.init(e,t)}),yc=w("ZodNumber",(e,t)=>{var r,o,i,a,d,l,p,h,g;lc.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(m,k,y)=>Ef(e,m,k),e.gt=(m,k)=>e.check(Yi(m,k)),e.gte=(m,k)=>e.check(gs(m,k)),e.min=(m,k)=>e.check(gs(m,k)),e.lt=(m,k)=>e.check(Ji(m,k)),e.lte=(m,k)=>e.check(fs(m,k)),e.max=(m,k)=>e.check(fs(m,k)),e.int=m=>e.check(Ki(m)),e.safe=m=>e.check(Ki(m)),e.positive=m=>e.check(Yi(0,m)),e.nonnegative=m=>e.check(gs(0,m)),e.negative=m=>e.check(Ji(0,m)),e.nonpositive=m=>e.check(fs(0,m)),e.multipleOf=(m,k)=>e.check(Xi(m,k)),e.step=(m,k)=>e.check(Xi(m,k)),e.finite=()=>e;const n=e._zod.bag;e.minValue=(i=Math.max((r=n.minimum)!=null?r:Number.NEGATIVE_INFINITY,(o=n.exclusiveMinimum)!=null?o:Number.NEGATIVE_INFINITY))!=null?i:null,e.maxValue=(l=Math.min((a=n.maximum)!=null?a:Number.POSITIVE_INFINITY,(d=n.exclusiveMaximum)!=null?d:Number.POSITIVE_INFINITY))!=null?l:null,e.isInt=((p=n.format)!=null?p:"").includes("int")||Number.isSafeInteger((h=n.multipleOf)!=null?h:.5),e.isFinite=!0,e.format=(g=n.format)!=null?g:null});function Ot(e){return tf(yc,e)}const Ig=w("ZodNumberFormat",(e,t)=>{oh.init(e,t),yc.init(e,t)});function Ki(e){return nf(Ig,e)}const zg=w("ZodBoolean",(e,t)=>{sh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Af(e,n,r)});function ge(e){return rf(zg,e)}const $g=w("ZodAny",(e,t)=>{ih.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pf()});function wc(){return of($g)}const Og=w("ZodUnknown",(e,t)=>{ah.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rf()});function Qi(){return sf(Og)}const Ng=w("ZodNever",(e,t)=>{ch.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cf(e,n,r)});function Dg(e){return af(Ng,e)}const Mg=w("ZodArray",(e,t)=>{lh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Of(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check($o(n,r)),e.nonempty=n=>e.check($o(1,n)),e.max=(n,r)=>e.check(fc(n,r)),e.length=(n,r)=>e.check(gc(n,r)),e.unwrap=()=>e.element});function St(e,t){return _f(Mg,e,t)}const Ug=w("ZodObject",(e,t)=>{dh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nf(e,n,r,o),oe(e,"shape",()=>t.shape),e.keyof=()=>dt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone(U(v({},e._zod.def),{catchall:n})),e.passthrough=()=>e.clone(U(v({},e._zod.def),{catchall:Qi()})),e.loose=()=>e.clone(U(v({},e._zod.def),{catchall:Qi()})),e.strict=()=>e.clone(U(v({},e._zod.def),{catchall:Dg()})),e.strip=()=>e.clone(U(v({},e._zod.def),{catchall:void 0})),e.extend=n=>Ld(e,n),e.safeExtend=n=>Id(e,n),e.merge=n=>zd(e,n),e.pick=n=>Pd(e,n),e.omit=n=>Rd(e,n),e.partial=(...n)=>$d(Tc,e,n[0]),e.required=(...n)=>Od(Ec,e,n[0])});function fe(e,t){const n=v({type:"object",shape:e!=null?e:{}},j(t));return new Ug(n)}const xc=w("ZodUnion",(e,t)=>{pc.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Df(e,n,r,o),e.options=t.options});function jg(e,t){return new xc(v({type:"union",options:e},j(t)))}const Zg=w("ZodDiscriminatedUnion",(e,t)=>{xc.init(e,t),ph.init(e,t)});function Sc(e,t,n){return new Zg(v({type:"union",options:t,discriminator:e},j(n)))}const qg=w("ZodIntersection",(e,t)=>{hh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mf(e,n,r,o)});function Hg(e,t){return new qg({type:"intersection",left:e,right:t})}const Fg=w("ZodRecord",(e,t)=>{fh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uf(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function It(e,t,n){return new Fg(v({type:"record",keyType:e,valueType:t},j(n)))}const Cs=w("ZodEnum",(e,t)=>{gh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Lf(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const a of r)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Cs(U(v(U(v({},t),{checks:[]}),j(o)),{entries:i}))},e.exclude=(r,o)=>{const i=v({},t.entries);for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new Cs(U(v(U(v({},t),{checks:[]}),j(o)),{entries:i}))}});function dt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Cs(v({type:"enum",entries:n},j(t)))}const Bg=w("ZodLiteral",(e,t)=>{mh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>If(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 ut(e,t){return new Bg(v({type:"literal",values:Array.isArray(e)?e:[e]},j(t)))}const Gg=w("ZodTransform",(e,t)=>{bh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$f(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Wa(e.constructor.name);n.addIssue=i=>{var a,d,l;if(typeof i=="string")n.issues.push(Mr(i,n.value,t));else{const p=i;p.fatal&&(p.continue=!1),(a=p.code)!=null||(p.code="custom"),(d=p.input)!=null||(p.input=n.value),(l=p.inst)!=null||(p.inst=e),n.issues.push(Mr(p))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Wg(e){return new Gg({type:"transform",transform:e})}const Tc=w("ZodOptional",(e,t)=>{hc.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_c(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ea(e){return new Tc({type:"optional",innerType:e})}const Jg=w("ZodExactOptional",(e,t)=>{kh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_c(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Yg(e){return new Jg({type:"optional",innerType:e})}const Xg=w("ZodNullable",(e,t)=>{_h.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ta(e){return new Xg({type:"nullable",innerType:e})}const Vg=w("ZodDefault",(e,t)=>{vh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Kg(e,t){return new Vg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Va(t)}})}const Qg=w("ZodPrefault",(e,t)=>{yh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function em(e,t){return new Qg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Va(t)}})}const Ec=w("ZodNonOptional",(e,t)=>{wh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function tm(e,t){return new Ec(v({type:"nonoptional",innerType:e},j(t)))}const nm=w("ZodCatch",(e,t)=>{xh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ff(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function rm(e,t){return new nm({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const om=w("ZodPipe",(e,t)=>{Sh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bf(e,n,r,o),e.in=t.in,e.out=t.out});function na(e,t){return new om({type:"pipe",in:e,out:t})}const sm=w("ZodReadonly",(e,t)=>{Th.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function im(e){return new sm({type:"readonly",innerType:e})}const am=w("ZodCustom",(e,t)=>{Eh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zf(e,n)});function cm(e,t={}){return vf(am,e,t)}function lm(e){return yf(e)}const um=fe({name:C().min(1).max(100).optional(),command:C().min(1).max(500),args:St(C()).optional(),failOnError:ge().default(!0).optional(),timeout:Ot().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:C().optional(),env:It(C(),C()).optional(),runOnBackground:ge().optional()});fe({name:C(),command:C(),success:ge(),exitCode:Ot().optional(),stdout:C().optional(),stderr:C().optional(),error:C().optional(),duration:Ot(),failOnError:ge()});const yn=fe({path:C(),extraCommands:St(um).optional(),id:C().uuid().optional(),rotationKey:C().optional(),usageStatus:dt(["free","in_use"]).optional()}),dm=Sc("operation",[yn.extend({operation:ut("create"),content:C().optional(),contentPath:C().optional(),encoding:dt(["utf-8","base64"]).optional()}),yn.extend({operation:ut("merge"),data:It(C(),wc()),mergeStrategy:dt(["deep","shallow"]).optional(),arrayMergeStrategy:dt(["concat","replace"]).optional()}),yn.extend({operation:ut("modify"),content:C().optional(),contentPath:C().optional(),createIfMissing:ge().optional()}),yn.extend({operation:ut("delete"),ignoreIfMissing:ge().optional()}),yn.extend({operation:ut("createDirectory"),contentPath:C().optional(),mode:Ot().optional(),ignoreIfExists:ge().optional()}),yn.extend({operation:ut("download"),url:C().url(),headers:It(C(),C()).optional(),timeout:Ot().min(1e3).max(3e5).optional()}),yn.extend({operation:ut("gitClone"),gitUrl:C(),gitSecretKey:C().optional(),sourceBranch:C().optional(),targetBranch:C().optional(),originalBranch:C().optional(),defaultBranch:C().optional()})]);var Te=(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))(Te||{});const pm=fe({type:dt(["json","file","regex"]).describe("Extraction method"),source:C().describe("Source to extract from (file path or stdout/stderr)"),schema:fe({}).passthrough().optional().describe("JSON schema for validation"),pattern:C().optional().describe("Regex pattern for extraction")}),hm=fe({type:dt(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:wc().describe("Hook-specific configuration")});fe({command:C().optional().describe("Legacy — unused in SDK mode"),args:St(C()).optional().describe("Legacy — unused in SDK mode"),env:It(C(),C()).optional().describe("Environment variables"),workingDirectory:C().optional().describe("Working directory for command execution"),fileOperations:St(dm).optional().describe("File operations to perform during setup"),gitUrl:C().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:C().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:C().optional().describe("Commit message for git operations"),resultExtraction:pm.optional().describe("Schema for extracting result data"),postExecutionHooks:St(hm).optional().describe("Hooks to run after task completion"),executionMode:dt(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:Sc("executionMode",[fe({executionMode:ut("claudeAgentSdk"),promptText:C(),sdkOptions:fe({model:C(),permissionMode:dt(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:St(C()),allowDangerouslySkipPermissions:ge(),persistSession:ge(),streamSdkEvents:ge().optional(),allowedTools:St(C()).optional(),settings:fe({enabledPlugins:It(C(),ge())}),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:ge()}).optional()}),fe({executionMode:ut("opencodeSdk"),promptText:C(),sdkOptions:fe({provider:C(),model:C(),allowedTools:St(C()).optional(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:ge()}).optional()}),fe({executionMode:ut("openaiAgentSdk"),promptText:C(),sdkOptions:fe({model:C(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:ge()}).optional()}),fe({executionMode:ut("codexSdk"),promptText:C(),sdkOptions:fe({model:C().optional(),sandboxMode:dt(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:dt(["never","on-request","on-failure","untrusted"]).optional(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:ge()}).optional()}),fe({executionMode:ut("cursorSdk"),promptText:C(),sdkOptions:fe({model:C(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:ge()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:ge().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:C().optional().describe("Final approved plan content"),planApproved:ge().optional().describe("Plan approval status"),planApprovedAt:C().optional().describe("ISO timestamp of approval"),planRejected:ge().optional().describe("Plan rejection flag"),planRejectionFeedback:C().optional().describe("User rejection feedback"),rejectedPlanContent:C().optional().describe("Previously rejected plan content"),planCompletedAt:C().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:C().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:C().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:C().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:St(fe({feedback:C(),rejectedAt:C()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:Ot().optional(),notificationChannelPlanMessageSentAt:C().optional(),notificationChannelCompletedMessageId:Ot().optional(),notificationChannelFailedMessageId:Ot().optional(),streamSdkEvents:ge().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:C().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:ge().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:St(fe({id:C(),selectedText:C(),startOffset:Ot(),endOffset:Ot(),commentText:C(),createdAt:C()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:ge().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:ge().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:dt(["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:ge().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")});Te.PENDING+"",Te.CANCELLED,Te.ASSIGNED+"",Te.CANCELLED,Te.IN_PROGRESS+"",Te.CANCELLED,Te.FAILED,Te.WAITING_FOR_INPUT+"",Te.CANCELLED,Te.WAITING_FOR_PLAN_APPROVAL+"",Te.CANCELLED,Te.PLAN_APPROVED+"",Te.CANCELLED,Te.PLAN_REJECTED+"",Te.CANCELLED,Te.COMPLETED+"",Te.RESULT_REJECTED+"",Te.CANCELLED,Te.FAILED+"",Te.CANCELLED+"";const Ac="browser_capture",fm="browser_automate";function ra(e){let t=(e||"").trim().toLowerCase();const n=t.indexOf("@");return n>=0&&(t=t.slice(n+1)),t=t.split("/")[0].split(":")[0],t.startsWith("www.")&&(t=t.slice(4)),t}function gm(e,t){const n=ra(e),r=(t||"").trim().toLowerCase();if(!n||!r)return!1;if(r.startsWith("*.")){const o=r.slice(2);return n===o||n.endsWith("."+o)}return n===ra(r)}function oa(e,t){var i;let n;try{const a=new URL(e);if(a.protocol!=="http:"&&a.protocol!=="https:")return null;n=a.hostname}catch(a){return null}let r=null,o=-1;for(const a of t)for(const d of(i=a.domains)!=null?i:[])gm(n,d)&&d.length>o&&(o=d.length,r=a.id);return r}function Cc(e){return L(this,null,function*(){if(!e.ok){const t=yield e.json().catch(()=>({message:`HTTP ${e.status}`}));throw new Error(t.message||t.error||`HTTP ${e.status}`)}return e.json()})}const mm=3e4;function No(r){return L(this,arguments,function*(e,t={},n=mm){const o=new AbortController,i=setTimeout(()=>o.abort(),n);try{return yield fetch(e,U(v({},t),{signal:o.signal}))}catch(a){throw a instanceof DOMException&&a.name==="AbortError"?new Error(`Request timed out after ${Math.round(n/1e3)}s. Please check your connection and try again.`):a}finally{clearTimeout(i)}})}function Ue(e,t,n,r){return L(this,null,function*(){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=yield No(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return Cc(a)})}function Pc(e,t){return L(this,null,function*(){return Ue(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)})}const bm=["projectId","note","ctx"];function km(e){const t=bm.filter(n=>e[n]===void 0||e[n]===null);if(t.length>0)throw new Error(`createTask: missing required field(s): ${t.join(", ")}`)}function Ps(e,t){return L(this,null,function*(){var p,h,g,m,k,y;km(t);const{projectId:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:d,type:l=Ac}=t;return Ue(e,"POST","/tasks",U(v(v(v(v(v(v(v(v(v(v(v(v({type:l,title:a||r.slice(0,120)||o.pageTitle||"Browser capture",titleInstruction:d!=null?d:r,projectId:n,autoAssign:!0},i!=null&&i.claudeTemplateId?{claudeTemplateId:i.claudeTemplateId}:{}),(i==null?void 0:i.quickMode)!==void 0?{quickMode:i.quickMode}:{}),(i==null?void 0:i.modelOverride)!=null?{modelOverride:i.modelOverride}:{}),(i==null?void 0:i.claudeProfileId)!=null?{claudeProfileId:i.claudeProfileId}:{}),(i==null?void 0:i.effort)!=null?{effort:i.effort}:{}),(i==null?void 0:i.executionMode)!=null?{executionMode:i.executionMode}:{}),(p=i==null?void 0:i.selectedPluginIds)!=null&&p.length?{selectedPluginIds:i.selectedPluginIds}:{}),(h=i==null?void 0:i.selectedSkillIds)!=null&&h.length?{selectedSkillIds:i.selectedSkillIds}:{}),(g=i==null?void 0:i.selectedPluginSkillIds)!=null&&g.length?{selectedPluginSkillIds:i.selectedPluginSkillIds}:{}),(m=i==null?void 0:i.selectedMcpServerIds)!=null&&m.length?{selectedMcpServerIds:i.selectedMcpServerIds}:{}),(k=i==null?void 0:i.selectedSlashCommandIds)!=null&&k.length?{selectedSlashCommandIds:i.selectedSlashCommandIds}:{}),(y=i==null?void 0:i.selectedRemoteContextProviderIds)!=null&&y.length?{selectedRemoteContextProviderIds:i.selectedRemoteContextProviderIds}:{}),{metadata:{type:l,note:r,source:"web-sdk",pageUrl:o.pageUrl,pageTitle:o.pageTitle,elementText:o.elementText,cssSelector:o.cssSelector,elementOuterHtml:o.elementOuterHtml,ancestry:o.ancestry,elementRole:o.elementRole,elementAriaLabel:o.elementAriaLabel,enclosingSection:o.enclosingSection,description:o.description,canonicalUrl:o.canonicalUrl,lang:o.lang,ogTitle:o.ogTitle,ogDescription:o.ogDescription,ogType:o.ogType,ogSiteName:o.ogSiteName,viewportWidth:o.viewportWidth,viewportHeight:o.viewportHeight,scrollX:o.scrollX,scrollY:o.scrollY,selectionText:o.selectionText,capturedAt:o.capturedAt,interactionSteps:o.interactionSteps}}))})}function sa(e,t){return L(this,null,function*(){return Ps(e,U(v({},t),{type:fm}))})}function ia(e,t,n,r){return L(this,null,function*(){var o;return Ue(e,"POST","/planning-sessions",v({projectId:t,instruction:n,quickMode:(o=r==null?void 0:r.quickMode)!=null?o:!1},r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}))})}function _m(e,t){return L(this,null,function*(){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Ue(e,"GET",`/claude-templates${n}`)})}function Rc(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}`)})}function vm(e,t){return L(this,null,function*(){return Ue(e,"GET",`/planning-sessions/${t}`)})}function aa(e){return L(this,null,function*(){return Ue(e,"GET","/projects")})}function ym(e){return L(this,null,function*(){return(yield Ue(e,"GET","/tenants/current")).membership})}function wm(e,t){if(!e||e.includes("tenant:*")||e.includes(t))return!0;const n=t.split(":")[0];return e.includes(`${n}:*`)}function ca(e,t,n){return L(this,null,function*(){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=yield No(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return Cc(i)})}function xm(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/browser-commands/pending`)})}function Sm(e,t,n,r,o){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})})}function Tm(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/chunks`)})}function Em(e,t,n){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/instructions`,{content:n})})}function Am(e,t){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/cancel`)})}function Cm(e,t){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/approve-result`)})}function Pm(e,t,n){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})})}function Do(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)})}function Lc(e,t,n,r){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})})}function Rm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ms={exports:{}};/*!
1358
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const g=h[1];if(t===h[0]){i(h);continue}if(e.external){const k=(l=e.external.registry.get(h[0]))==null?void 0:l.id;if(t!==h[0]&&k){i(h);continue}}if((p=e.metadataRegistry.get(h[0]))==null?void 0:p.id){i(h);continue}if(g.cycle){i(h);continue}if(g.count>1&&e.reused==="ref"){i(h);continue}}}function kc(e,t){var a,d,l,p,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=g=>{var Q,N,T;const m=e.seen.get(g);if(m.ref===null)return;const k=(Q=m.def)!=null?Q:m.schema,y=v({},k),E=m.ref;if(m.ref=null,E){r(E);const S=e.seen.get(E),P=S.schema;if(P.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=(N=k.allOf)!=null?N:[],k.allOf.push(P)):Object.assign(k,P),Object.assign(k,y),g._zod.parent===E)for(const Y in k)Y==="$ref"||Y==="allOf"||Y in y||delete k[Y];if(P.$ref)for(const Y in k)Y==="$ref"||Y==="allOf"||Y in S.def&&JSON.stringify(k[Y])===JSON.stringify(S.def[Y])&&delete k[Y]}const j=g._zod.parent;if(j&&j!==E){r(j);const S=e.seen.get(j);if(S!=null&&S.schema.$ref&&(k.$ref=S.schema.$ref,S.def))for(const P in k)P==="$ref"||P==="allOf"||P in S.def&&JSON.stringify(k[P])===JSON.stringify(S.def[P])&&delete k[P]}e.override({zodSchema:g,jsonSchema:k,path:(T=m.path)!=null?T:[]})};for(const g of[...e.seen.entries()].reverse())r(g[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const g=(d=e.external.registry.get(t))==null?void 0:d.id;if(!g)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(g)}Object.assign(o,(l=n.def)!=null?l:n.schema);const i=(h=(p=e.external)==null?void 0:p.defs)!=null?h:{};for(const g of e.seen.entries()){const m=g[1];m.def&&m.defId&&(i[m.defId]=m.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const g=JSON.parse(JSON.stringify(o));return Object.defineProperty(g,"~standard",{value:M(v({},t["~standard"]),{jsonSchema:{input:Oo(t,"input",e.processors),output:Oo(t,"output",e.processors)}}),enumerable:!1,writable:!1}),g}catch(g){throw new Error("Error converting schema to JSON.")}}function Ke(e,t){const n=t!=null?t:{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Ke(r.element,n);if(r.type==="set")return Ke(r.valueType,n);if(r.type==="lazy")return Ke(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 Ke(r.innerType,n);if(r.type==="intersection")return Ke(r.left,n)||Ke(r.right,n);if(r.type==="record"||r.type==="map")return Ke(r.keyType,n)||Ke(r.valueType,n);if(r.type==="pipe")return Ke(r.in,n)||Ke(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Ke(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Ke(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Ke(o,n))return!0;return!!(r.rest&&Ke(r.rest,n))}return!1}const xf=(e,t={})=>n=>{const r=mc(M(v({},n),{processors:t}));return Ce(e,r),bc(r,e),kc(r,e)},Oo=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=mc(M(v({},o!=null?o:{}),{target:i,io:t,processors:n}));return Ce(e,a),bc(a,e),kc(a,e)},Sf={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Tf=(e,t,n,r)=>{var h;const o=n;o.type="string";const{minimum:i,maximum:a,format:d,patterns:l,contentEncoding:p}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),d&&(o.format=(h=Sf[d])!=null?h:d,o.format===""&&delete o.format,d==="time"&&delete o.format),p&&(o.contentEncoding=p),l&&l.size>0){const g=[...l];g.length===1?o.pattern=g[0].source:g.length>1&&(o.allOf=[...g.map(m=>M(v({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:m.source}))])}},Ef=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:d,multipleOf:l,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof d=="string"&&d.includes("int")?o.type="integer":o.type="number",typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=h,o.exclusiveMinimum=!0):o.exclusiveMinimum=h),typeof i=="number"&&(o.minimum=i,typeof h=="number"&&t.target!=="draft-04"&&(h>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p),typeof a=="number"&&(o.maximum=a,typeof p=="number"&&t.target!=="draft-04"&&(p<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof l=="number"&&(o.multipleOf=l)},Af=(e,t,n,r)=>{n.type="boolean"},Cf=(e,t,n,r)=>{n.not={}},Pf=(e,t,n,r)=>{},Rf=(e,t,n,r)=>{},Lf=(e,t,n,r)=>{const o=e._zod.def,i=Ya(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},If=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i},zf=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},$f=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Of=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:a,maximum:d}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof d=="number"&&(o.maxItems=d),o.type="array",o.items=Ce(i.element,t,M(v({},r),{path:[...r.path,"items"]}))},Nf=(e,t,n,r)=>{var p;const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const h in a)o.properties[h]=Ce(a[h],t,M(v({},r),{path:[...r.path,"properties",h]}));const d=new Set(Object.keys(a)),l=new Set([...d].filter(h=>{const g=i.shape[h]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));l.size>0&&(o.required=Array.from(l)),((p=i.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Ce(i.catchall,t,M(v({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},Df=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((d,l)=>Ce(d,t,M(v({},r),{path:[...r.path,i?"oneOf":"anyOf",l]})));i?n.oneOf=a:n.anyOf=a},Mf=(e,t,n,r)=>{const o=e._zod.def,i=Ce(o.left,t,M(v({},r),{path:[...r.path,"allOf",0]})),a=Ce(o.right,t,M(v({},r),{path:[...r.path,"allOf",1]})),d=p=>"allOf"in p&&Object.keys(p).length===1,l=[...d(i)?i.allOf:[i],...d(a)?a.allOf:[a]];n.allOf=l},Uf=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,d=a._zod.bag,l=d==null?void 0:d.patterns;if(i.mode==="loose"&&l&&l.size>0){const h=Ce(i.valueType,t,M(v({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const g of l)o.patternProperties[g.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Ce(i.keyType,t,M(v({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=Ce(i.valueType,t,M(v({},r),{path:[...r.path,"additionalProperties"]}));const p=a._zod.values;if(p){const h=[...p].filter(g=>typeof g=="string"||typeof g=="number");h.length>0&&(o.required=h)}},jf=(e,t,n,r)=>{const o=e._zod.def,i=Ce(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},Zf=(e,t,n,r)=>{const o=e._zod.def;Ce(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},qf=(e,t,n,r)=>{const o=e._zod.def;Ce(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Hf=(e,t,n,r)=>{const o=e._zod.def;Ce(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Ff=(e,t,n,r)=>{const o=e._zod.def;Ce(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch(d){throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},Bf=(e,t,n,r)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Ce(i,t,r);const a=t.seen.get(e);a.ref=i},Gf=(e,t,n,r)=>{const o=e._zod.def;Ce(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},_c=(e,t,n,r)=>{const o=e._zod.def;Ce(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Wf=w("ZodISODateTime",(e,t)=>{Fp.init(e,t),we.init(e,t)});function Jf(e){return Vh(Wf,e)}const Yf=w("ZodISODate",(e,t)=>{Bp.init(e,t),we.init(e,t)});function Xf(e){return Kh(Yf,e)}const Vf=w("ZodISOTime",(e,t)=>{Gp.init(e,t),we.init(e,t)});function Kf(e){return Qh(Vf,e)}const Qf=w("ZodISODuration",(e,t)=>{Wp.init(e,t),we.init(e,t)});function eg(e){return ef(Qf,e)}const tg=(e,t)=>{Qa.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Dd(e,n)},flatten:{value:n=>Nd(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Es,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Es,2)}},isEmpty:{get(){return e.issues.length===0}}})},gt=w("ZodError",tg,{Parent:Error}),ng=Fs(gt),rg=Bs(gt),og=Xo(gt),sg=Vo(gt),ig=jd(gt),ag=Zd(gt),cg=qd(gt),lg=Hd(gt),ug=Fd(gt),dg=Bd(gt),pg=Gd(gt),hg=Wd(gt),_e=w("ZodType",(e,t)=>(be.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Oo(e,"input"),output:Oo(e,"output")}}),e.toJSONSchema=xf(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(pn(t,{checks:[...(r=t.checks)!=null?r:[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},e.with=e.check,e.clone=(n,r)=>hn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>ng(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>og(e,n,r),e.parseAsync=(n,r)=>L(null,null,function*(){return rg(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>L(null,null,function*(){return sg(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>ig(e,n,r),e.decode=(n,r)=>ag(e,n,r),e.encodeAsync=(n,r)=>L(null,null,function*(){return cg(e,n,r)}),e.decodeAsync=(n,r)=>L(null,null,function*(){return lg(e,n,r)}),e.safeEncode=(n,r)=>ug(e,n,r),e.safeDecode=(n,r)=>dg(e,n,r),e.safeEncodeAsync=(n,r)=>L(null,null,function*(){return pg(e,n,r)}),e.safeDecodeAsync=(n,r)=>L(null,null,function*(){return hg(e,n,r)}),e.refine=(n,r)=>e.check(cm(n,r)),e.superRefine=n=>e.check(lm(n)),e.overwrite=n=>e.check(ar(n)),e.optional=()=>ea(e),e.exactOptional=()=>Yg(e),e.nullable=()=>ta(e),e.nullish=()=>ea(ta(e)),e.nonoptional=n=>tm(e,n),e.array=()=>st(e),e.or=n=>jg([e,n]),e.and=n=>Hg(e,n),e.transform=n=>na(e,Wg(n)),e.default=n=>Kg(e,n),e.prefault=n=>em(e,n),e.catch=n=>rm(e,n),e.pipe=n=>na(e,n),e.readonly=()=>im(e),e.describe=n=>{const r=e.clone();return Pr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Pr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Pr.get(e);const r=e.clone();return Pr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),vc=w("_ZodString",(e,t)=>{var r,o,i;Gs.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(a,d,l)=>Tf(e,a,d);const n=e._zod.bag;e.format=(r=n.format)!=null?r:null,e.minLength=(o=n.minimum)!=null?o:null,e.maxLength=(i=n.maximum)!=null?i:null,e.regex=(...a)=>e.check(cf(...a)),e.includes=(...a)=>e.check(df(...a)),e.startsWith=(...a)=>e.check(pf(...a)),e.endsWith=(...a)=>e.check(hf(...a)),e.min=(...a)=>e.check($o(...a)),e.max=(...a)=>e.check(fc(...a)),e.length=(...a)=>e.check(gc(...a)),e.nonempty=(...a)=>e.check($o(1,...a)),e.lowercase=a=>e.check(lf(a)),e.uppercase=a=>e.check(uf(a)),e.trim=()=>e.check(gf()),e.normalize=(...a)=>e.check(ff(...a)),e.toLowerCase=()=>e.check(mf()),e.toUpperCase=()=>e.check(bf()),e.slugify=()=>e.check(kf())}),fg=w("ZodString",(e,t)=>{Gs.init(e,t),vc.init(e,t),e.email=n=>e.check(Rh(gg,n)),e.url=n=>e.check(Oh(mg,n)),e.jwt=n=>e.check(Xh(Lg,n)),e.emoji=n=>e.check(Nh(bg,n)),e.guid=n=>e.check(Wi(Vi,n)),e.uuid=n=>e.check(Lh(lo,n)),e.uuidv4=n=>e.check(Ih(lo,n)),e.uuidv6=n=>e.check(zh(lo,n)),e.uuidv7=n=>e.check($h(lo,n)),e.nanoid=n=>e.check(Dh(kg,n)),e.guid=n=>e.check(Wi(Vi,n)),e.cuid=n=>e.check(Mh(_g,n)),e.cuid2=n=>e.check(Uh(vg,n)),e.ulid=n=>e.check(jh(yg,n)),e.base64=n=>e.check(Wh(Cg,n)),e.base64url=n=>e.check(Jh(Pg,n)),e.xid=n=>e.check(Zh(wg,n)),e.ksuid=n=>e.check(qh(xg,n)),e.ipv4=n=>e.check(Hh(Sg,n)),e.ipv6=n=>e.check(Fh(Tg,n)),e.cidrv4=n=>e.check(Bh(Eg,n)),e.cidrv6=n=>e.check(Gh(Ag,n)),e.e164=n=>e.check(Yh(Rg,n)),e.datetime=n=>e.check(Jf(n)),e.date=n=>e.check(Xf(n)),e.time=n=>e.check(Kf(n)),e.duration=n=>e.check(eg(n))});function C(e){return Ph(fg,e)}const we=w("ZodStringFormat",(e,t)=>{ke.init(e,t),vc.init(e,t)}),gg=w("ZodEmail",(e,t)=>{Op.init(e,t),we.init(e,t)}),Vi=w("ZodGUID",(e,t)=>{zp.init(e,t),we.init(e,t)}),lo=w("ZodUUID",(e,t)=>{$p.init(e,t),we.init(e,t)}),mg=w("ZodURL",(e,t)=>{Np.init(e,t),we.init(e,t)}),bg=w("ZodEmoji",(e,t)=>{Dp.init(e,t),we.init(e,t)}),kg=w("ZodNanoID",(e,t)=>{Mp.init(e,t),we.init(e,t)}),_g=w("ZodCUID",(e,t)=>{Up.init(e,t),we.init(e,t)}),vg=w("ZodCUID2",(e,t)=>{jp.init(e,t),we.init(e,t)}),yg=w("ZodULID",(e,t)=>{Zp.init(e,t),we.init(e,t)}),wg=w("ZodXID",(e,t)=>{qp.init(e,t),we.init(e,t)}),xg=w("ZodKSUID",(e,t)=>{Hp.init(e,t),we.init(e,t)}),Sg=w("ZodIPv4",(e,t)=>{Jp.init(e,t),we.init(e,t)}),Tg=w("ZodIPv6",(e,t)=>{Yp.init(e,t),we.init(e,t)}),Eg=w("ZodCIDRv4",(e,t)=>{Xp.init(e,t),we.init(e,t)}),Ag=w("ZodCIDRv6",(e,t)=>{Vp.init(e,t),we.init(e,t)}),Cg=w("ZodBase64",(e,t)=>{Kp.init(e,t),we.init(e,t)}),Pg=w("ZodBase64URL",(e,t)=>{eh.init(e,t),we.init(e,t)}),Rg=w("ZodE164",(e,t)=>{th.init(e,t),we.init(e,t)}),Lg=w("ZodJWT",(e,t)=>{rh.init(e,t),we.init(e,t)}),yc=w("ZodNumber",(e,t)=>{var r,o,i,a,d,l,p,h,g;lc.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(m,k,y)=>Ef(e,m,k),e.gt=(m,k)=>e.check(Yi(m,k)),e.gte=(m,k)=>e.check(gs(m,k)),e.min=(m,k)=>e.check(gs(m,k)),e.lt=(m,k)=>e.check(Ji(m,k)),e.lte=(m,k)=>e.check(fs(m,k)),e.max=(m,k)=>e.check(fs(m,k)),e.int=m=>e.check(Ki(m)),e.safe=m=>e.check(Ki(m)),e.positive=m=>e.check(Yi(0,m)),e.nonnegative=m=>e.check(gs(0,m)),e.negative=m=>e.check(Ji(0,m)),e.nonpositive=m=>e.check(fs(0,m)),e.multipleOf=(m,k)=>e.check(Xi(m,k)),e.step=(m,k)=>e.check(Xi(m,k)),e.finite=()=>e;const n=e._zod.bag;e.minValue=(i=Math.max((r=n.minimum)!=null?r:Number.NEGATIVE_INFINITY,(o=n.exclusiveMinimum)!=null?o:Number.NEGATIVE_INFINITY))!=null?i:null,e.maxValue=(l=Math.min((a=n.maximum)!=null?a:Number.POSITIVE_INFINITY,(d=n.exclusiveMaximum)!=null?d:Number.POSITIVE_INFINITY))!=null?l:null,e.isInt=((p=n.format)!=null?p:"").includes("int")||Number.isSafeInteger((h=n.multipleOf)!=null?h:.5),e.isFinite=!0,e.format=(g=n.format)!=null?g:null});function Ut(e){return tf(yc,e)}const Ig=w("ZodNumberFormat",(e,t)=>{oh.init(e,t),yc.init(e,t)});function Ki(e){return nf(Ig,e)}const zg=w("ZodBoolean",(e,t)=>{sh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Af(e,n,r)});function ge(e){return rf(zg,e)}const $g=w("ZodAny",(e,t)=>{ih.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pf()});function wc(){return of($g)}const Og=w("ZodUnknown",(e,t)=>{ah.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rf()});function Qi(){return sf(Og)}const Ng=w("ZodNever",(e,t)=>{ch.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cf(e,n,r)});function Dg(e){return af(Ng,e)}const Mg=w("ZodArray",(e,t)=>{lh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Of(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check($o(n,r)),e.nonempty=n=>e.check($o(1,n)),e.max=(n,r)=>e.check(fc(n,r)),e.length=(n,r)=>e.check(gc(n,r)),e.unwrap=()=>e.element});function st(e,t){return _f(Mg,e,t)}const Ug=w("ZodObject",(e,t)=>{dh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nf(e,n,r,o),ne(e,"shape",()=>t.shape),e.keyof=()=>pt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone(M(v({},e._zod.def),{catchall:n})),e.passthrough=()=>e.clone(M(v({},e._zod.def),{catchall:Qi()})),e.loose=()=>e.clone(M(v({},e._zod.def),{catchall:Qi()})),e.strict=()=>e.clone(M(v({},e._zod.def),{catchall:Dg()})),e.strip=()=>e.clone(M(v({},e._zod.def),{catchall:void 0})),e.extend=n=>Ld(e,n),e.safeExtend=n=>Id(e,n),e.merge=n=>zd(e,n),e.pick=n=>Pd(e,n),e.omit=n=>Rd(e,n),e.partial=(...n)=>$d(Tc,e,n[0]),e.required=(...n)=>Od(Ec,e,n[0])});function fe(e,t){const n=v({type:"object",shape:e!=null?e:{}},U(t));return new Ug(n)}const xc=w("ZodUnion",(e,t)=>{pc.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Df(e,n,r,o),e.options=t.options});function jg(e,t){return new xc(v({type:"union",options:e},U(t)))}const Zg=w("ZodDiscriminatedUnion",(e,t)=>{xc.init(e,t),ph.init(e,t)});function Sc(e,t,n){return new Zg(v({type:"union",options:t,discriminator:e},U(n)))}const qg=w("ZodIntersection",(e,t)=>{hh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mf(e,n,r,o)});function Hg(e,t){return new qg({type:"intersection",left:e,right:t})}const Fg=w("ZodRecord",(e,t)=>{fh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uf(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Nt(e,t,n){return new Fg(v({type:"record",keyType:e,valueType:t},U(n)))}const Cs=w("ZodEnum",(e,t)=>{gh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Lf(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const a of r)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Cs(M(v(M(v({},t),{checks:[]}),U(o)),{entries:i}))},e.exclude=(r,o)=>{const i=v({},t.entries);for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new Cs(M(v(M(v({},t),{checks:[]}),U(o)),{entries:i}))}});function pt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Cs(v({type:"enum",entries:n},U(t)))}const Bg=w("ZodLiteral",(e,t)=>{mh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>If(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 dt(e,t){return new Bg(v({type:"literal",values:Array.isArray(e)?e:[e]},U(t)))}const Gg=w("ZodTransform",(e,t)=>{bh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$f(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Wa(e.constructor.name);n.addIssue=i=>{var a,d,l;if(typeof i=="string")n.issues.push(Mr(i,n.value,t));else{const p=i;p.fatal&&(p.continue=!1),(a=p.code)!=null||(p.code="custom"),(d=p.input)!=null||(p.input=n.value),(l=p.inst)!=null||(p.inst=e),n.issues.push(Mr(p))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Wg(e){return new Gg({type:"transform",transform:e})}const Tc=w("ZodOptional",(e,t)=>{hc.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_c(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ea(e){return new Tc({type:"optional",innerType:e})}const Jg=w("ZodExactOptional",(e,t)=>{kh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_c(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Yg(e){return new Jg({type:"optional",innerType:e})}const Xg=w("ZodNullable",(e,t)=>{_h.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ta(e){return new Xg({type:"nullable",innerType:e})}const Vg=w("ZodDefault",(e,t)=>{vh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Kg(e,t){return new Vg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Va(t)}})}const Qg=w("ZodPrefault",(e,t)=>{yh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function em(e,t){return new Qg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Va(t)}})}const Ec=w("ZodNonOptional",(e,t)=>{wh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function tm(e,t){return new Ec(v({type:"nonoptional",innerType:e},U(t)))}const nm=w("ZodCatch",(e,t)=>{xh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ff(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function rm(e,t){return new nm({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const om=w("ZodPipe",(e,t)=>{Sh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bf(e,n,r,o),e.in=t.in,e.out=t.out});function na(e,t){return new om({type:"pipe",in:e,out:t})}const sm=w("ZodReadonly",(e,t)=>{Th.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function im(e){return new sm({type:"readonly",innerType:e})}const am=w("ZodCustom",(e,t)=>{Eh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zf(e,n)});function cm(e,t={}){return vf(am,e,t)}function lm(e){return yf(e)}const um=fe({name:C().min(1).max(100).optional(),command:C().min(1).max(500),args:st(C()).optional(),failOnError:ge().default(!0).optional(),timeout:Ut().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:C().optional(),env:Nt(C(),C()).optional(),runOnBackground:ge().optional(),agentTags:st(C()).optional()});fe({name:C(),command:C(),success:ge(),exitCode:Ut().optional(),stdout:C().optional(),stderr:C().optional(),error:C().optional(),duration:Ut(),failOnError:ge()});const wn=fe({path:C(),extraCommands:st(um).optional(),id:C().uuid().optional(),rotationKey:C().optional(),usageStatus:pt(["free","in_use"]).optional(),agentTags:st(C()).optional()}),dm=Sc("operation",[wn.extend({operation:dt("create"),content:C().optional(),contentPath:C().optional(),encoding:pt(["utf-8","base64"]).optional()}),wn.extend({operation:dt("merge"),data:Nt(C(),wc()),mergeStrategy:pt(["deep","shallow"]).optional(),arrayMergeStrategy:pt(["concat","replace"]).optional()}),wn.extend({operation:dt("modify"),content:C().optional(),contentPath:C().optional(),createIfMissing:ge().optional()}),wn.extend({operation:dt("delete"),ignoreIfMissing:ge().optional()}),wn.extend({operation:dt("createDirectory"),contentPath:C().optional(),mode:Ut().optional(),ignoreIfExists:ge().optional()}),wn.extend({operation:dt("download"),url:C().url(),headers:Nt(C(),C()).optional(),timeout:Ut().min(1e3).max(3e5).optional()}),wn.extend({operation:dt("gitClone"),gitUrl:C(),gitSecretKey:C().optional(),sourceBranch:C().optional(),targetBranch:C().optional(),originalBranch:C().optional(),defaultBranch:C().optional()})]);var Te=(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))(Te||{});const pm=fe({type:pt(["json","file","regex"]).describe("Extraction method"),source:C().describe("Source to extract from (file path or stdout/stderr)"),schema:fe({}).passthrough().optional().describe("JSON schema for validation"),pattern:C().optional().describe("Regex pattern for extraction")}),hm=fe({type:pt(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:wc().describe("Hook-specific configuration")});fe({command:C().optional().describe("Legacy — unused in SDK mode"),args:st(C()).optional().describe("Legacy — unused in SDK mode"),env:Nt(C(),C()).optional().describe("Environment variables"),workingDirectory:C().optional().describe("Working directory for command execution"),fileOperations:st(dm).optional().describe("File operations to perform during setup"),gitUrl:C().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:C().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:C().optional().describe("Commit message for git operations"),resultExtraction:pm.optional().describe("Schema for extracting result data"),postExecutionHooks:st(hm).optional().describe("Hooks to run after task completion"),executionMode:pt(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:Sc("executionMode",[fe({executionMode:dt("claudeAgentSdk"),promptText:C(),sdkOptions:fe({model:C(),permissionMode:pt(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:st(C()),allowDangerouslySkipPermissions:ge(),persistSession:ge(),streamSdkEvents:ge().optional(),allowedTools:st(C()).optional(),settings:fe({enabledPlugins:Nt(C(),ge())}),env:Nt(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:ge()}).optional()}),fe({executionMode:dt("opencodeSdk"),promptText:C(),sdkOptions:fe({provider:C(),model:C(),allowedTools:st(C()).optional(),env:Nt(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:ge()}).optional()}),fe({executionMode:dt("openaiAgentSdk"),promptText:C(),sdkOptions:fe({model:C(),env:Nt(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:ge()}).optional()}),fe({executionMode:dt("codexSdk"),promptText:C(),sdkOptions:fe({model:C().optional(),sandboxMode:pt(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:pt(["never","on-request","on-failure","untrusted"]).optional(),env:Nt(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:ge()}).optional()}),fe({executionMode:dt("cursorSdk"),promptText:C(),sdkOptions:fe({model:C(),env:Nt(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:ge()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:ge().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:C().optional().describe("Final approved plan content"),planApproved:ge().optional().describe("Plan approval status"),planApprovedAt:C().optional().describe("ISO timestamp of approval"),planRejected:ge().optional().describe("Plan rejection flag"),planRejectionFeedback:C().optional().describe("User rejection feedback"),rejectedPlanContent:C().optional().describe("Previously rejected plan content"),planCompletedAt:C().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:C().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:C().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:C().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:st(fe({feedback:C(),rejectedAt:C()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:Ut().optional(),notificationChannelPlanMessageSentAt:C().optional(),notificationChannelCompletedMessageId:Ut().optional(),notificationChannelFailedMessageId:Ut().optional(),streamSdkEvents:ge().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:C().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:ge().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:st(fe({id:C(),selectedText:C(),startOffset:Ut(),endOffset:Ut(),commentText:C(),createdAt:C()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:ge().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:ge().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:pt(["all","ignoreExistingMcpServers"]).optional().describe("MCP server strategy for this run; 'ignoreExistingMcpServers' overrides the existing .mcp.json with only the template's configured servers plus the agent-platform server"),enableBrowserTools:ge().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")});Te.PENDING+"",Te.CANCELLED,Te.ASSIGNED+"",Te.CANCELLED,Te.IN_PROGRESS+"",Te.CANCELLED,Te.FAILED,Te.WAITING_FOR_INPUT+"",Te.CANCELLED,Te.WAITING_FOR_PLAN_APPROVAL+"",Te.CANCELLED,Te.PLAN_APPROVED+"",Te.CANCELLED,Te.PLAN_REJECTED+"",Te.CANCELLED,Te.COMPLETED+"",Te.RESULT_REJECTED+"",Te.CANCELLED,Te.FAILED+"",Te.CANCELLED+"";const Ac="browser_capture",fm="browser_automate";function ra(e){let t=(e||"").trim().toLowerCase();const n=t.indexOf("@");return n>=0&&(t=t.slice(n+1)),t=t.split("/")[0].split(":")[0],t.startsWith("www.")&&(t=t.slice(4)),t}function gm(e,t){const n=ra(e),r=(t||"").trim().toLowerCase();if(!n||!r)return!1;if(r.startsWith("*.")){const o=r.slice(2);return n===o||n.endsWith("."+o)}return n===ra(r)}function oa(e,t){var i;let n;try{const a=new URL(e);if(a.protocol!=="http:"&&a.protocol!=="https:")return null;n=a.hostname}catch(a){return null}let r=null,o=-1;for(const a of t)for(const d of(i=a.domains)!=null?i:[])gm(n,d)&&d.length>o&&(o=d.length,r=a.id);return r}function Cc(e){return L(this,null,function*(){if(!e.ok){const t=yield e.json().catch(()=>({message:`HTTP ${e.status}`}));throw new Error(t.message||t.error||`HTTP ${e.status}`)}return e.json()})}const mm=3e4;function No(r){return L(this,arguments,function*(e,t={},n=mm){const o=new AbortController,i=setTimeout(()=>o.abort(),n);try{return yield fetch(e,M(v({},t),{signal:o.signal}))}catch(a){throw a instanceof DOMException&&a.name==="AbortError"?new Error(`Request timed out after ${Math.round(n/1e3)}s. Please check your connection and try again.`):a}finally{clearTimeout(i)}})}function Ze(e,t,n,r){return L(this,null,function*(){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=yield No(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return Cc(a)})}function Pc(e,t){return L(this,null,function*(){return Ze(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)})}const bm=["projectId","note","ctx"];function km(e){const t=bm.filter(n=>e[n]===void 0||e[n]===null);if(t.length>0)throw new Error(`createTask: missing required field(s): ${t.join(", ")}`)}function Ps(e,t){return L(this,null,function*(){var h,g,m,k,y,E;km(t);const{projectId:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:d,allowSubmit:l,type:p=Ac}=t;return Ze(e,"POST","/tasks",M(v(v(v(v(v(v(v(v(v(v(v(v({type:p,title:a||r.slice(0,120)||o.pageTitle||"Browser capture",titleInstruction:d!=null?d:r,projectId:n,autoAssign:!0},i!=null&&i.claudeTemplateId?{claudeTemplateId:i.claudeTemplateId}:{}),(i==null?void 0:i.quickMode)!==void 0?{quickMode:i.quickMode}:{}),(i==null?void 0:i.modelOverride)!=null?{modelOverride:i.modelOverride}:{}),(i==null?void 0:i.claudeProfileId)!=null?{claudeProfileId:i.claudeProfileId}:{}),(i==null?void 0:i.effort)!=null?{effort:i.effort}:{}),(i==null?void 0:i.executionMode)!=null?{executionMode:i.executionMode}:{}),(h=i==null?void 0:i.selectedPluginIds)!=null&&h.length?{selectedPluginIds:i.selectedPluginIds}:{}),(g=i==null?void 0:i.selectedSkillIds)!=null&&g.length?{selectedSkillIds:i.selectedSkillIds}:{}),(m=i==null?void 0:i.selectedPluginSkillIds)!=null&&m.length?{selectedPluginSkillIds:i.selectedPluginSkillIds}:{}),(k=i==null?void 0:i.selectedMcpServerIds)!=null&&k.length?{selectedMcpServerIds:i.selectedMcpServerIds}:{}),(y=i==null?void 0:i.selectedSlashCommandIds)!=null&&y.length?{selectedSlashCommandIds:i.selectedSlashCommandIds}:{}),(E=i==null?void 0:i.selectedRemoteContextProviderIds)!=null&&E.length?{selectedRemoteContextProviderIds:i.selectedRemoteContextProviderIds}:{}),{metadata:v({type:p,note:r,source:"web-sdk",pageUrl:o.pageUrl,pageTitle:o.pageTitle,elementText:o.elementText,cssSelector:o.cssSelector,elementOuterHtml:o.elementOuterHtml,ancestry:o.ancestry,elementRole:o.elementRole,elementAriaLabel:o.elementAriaLabel,enclosingSection:o.enclosingSection,description:o.description,canonicalUrl:o.canonicalUrl,lang:o.lang,ogTitle:o.ogTitle,ogDescription:o.ogDescription,ogType:o.ogType,ogSiteName:o.ogSiteName,viewportWidth:o.viewportWidth,viewportHeight:o.viewportHeight,scrollX:o.scrollX,scrollY:o.scrollY,selectionText:o.selectionText,capturedAt:o.capturedAt,interactionSteps:o.interactionSteps},l!==void 0?{allowSubmit:l}:{})}))})}function sa(e,t){return L(this,null,function*(){return Ps(e,M(v({},t),{type:fm}))})}function ia(e,t,n,r){return L(this,null,function*(){var o;return Ze(e,"POST","/planning-sessions",v({projectId:t,instruction:n,quickMode:(o=r==null?void 0:r.quickMode)!=null?o:!1},r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}))})}function _m(e,t){return L(this,null,function*(){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Ze(e,"GET",`/claude-templates${n}`)})}function Rc(e,t){return L(this,null,function*(){return Ze(e,"GET",`/tasks/${t}`)})}function vm(e,t){return L(this,null,function*(){return Ze(e,"GET",`/planning-sessions/${t}`)})}function aa(e){return L(this,null,function*(){return Ze(e,"GET","/projects")})}function ym(e){return L(this,null,function*(){return(yield Ze(e,"GET","/tenants/current")).membership})}function wm(e,t){if(!e||e.includes("tenant:*")||e.includes(t))return!0;const n=t.split(":")[0];return e.includes(`${n}:*`)}function ca(e,t,n){return L(this,null,function*(){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=yield No(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return Cc(i)})}function xm(e,t){return L(this,null,function*(){return Ze(e,"GET",`/tasks/${t}/browser-commands/pending`)})}function Sm(e,t,n,r,o){return L(this,null,function*(){return Ze(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})})}function Tm(e,t){return L(this,null,function*(){return Ze(e,"GET",`/tasks/${t}/chunks`)})}function Em(e,t,n){return L(this,null,function*(){return Ze(e,"POST",`/tasks/${t}/instructions`,{content:n})})}function Am(e,t){return L(this,null,function*(){return Ze(e,"POST",`/tasks/${t}/cancel`)})}function Cm(e,t){return L(this,null,function*(){return Ze(e,"POST",`/tasks/${t}/approve-result`)})}function Pm(e,t,n){return L(this,null,function*(){return Ze(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})})}function Do(e,t){return L(this,null,function*(){return Ze(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)})}function Lc(e,t,n,r){return L(this,null,function*(){return Ze(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})})}function Rm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ms={exports:{}};/*!
1359
1359
  * Pusher JavaScript Library v8.5.0
1360
1360
  * https://pusher.com/
1361
1361
  *
1362
1362
  * Copyright 2020, Pusher
1363
1363
  * Released under the MIT licence.
1364
- */var la;function Lm(){return la||(la=1,(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(a,d){var l=this&&this.__extends||(function(){var N=function(T,S){return N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(P,D){P.__proto__=D}||function(P,D){for(var J in D)D.hasOwnProperty(J)&&(P[J]=D[J])},N(T,S)};return function(T,S){N(T,S);function P(){this.constructor=T}T.prototype=S===null?Object.create(S):(P.prototype=S.prototype,new P)}})();Object.defineProperty(d,"__esModule",{value:!0});var p=256,h=(function(){function N(T){T===void 0&&(T="="),this._paddingCharacter=T}return N.prototype.encodedLength=function(T){return this._paddingCharacter?(T+2)/3*4|0:(T*8+5)/6|0},N.prototype.encode=function(T){for(var S="",P=0;P<T.length-2;P+=3){var D=T[P]<<16|T[P+1]<<8|T[P+2];S+=this._encodeByte(D>>>18&63),S+=this._encodeByte(D>>>12&63),S+=this._encodeByte(D>>>6&63),S+=this._encodeByte(D>>>0&63)}var J=T.length-P;if(J>0){var D=T[P]<<16|(J===2?T[P+1]<<8:0);S+=this._encodeByte(D>>>18&63),S+=this._encodeByte(D>>>12&63),J===2?S+=this._encodeByte(D>>>6&63):S+=this._paddingCharacter||"",S+=this._paddingCharacter||""}return S},N.prototype.maxDecodedLength=function(T){return this._paddingCharacter?T/4*3|0:(T*6+7)/8|0},N.prototype.decodedLength=function(T){return this.maxDecodedLength(T.length-this._getPaddingLength(T))},N.prototype.decode=function(T){if(T.length===0)return new Uint8Array(0);for(var S=this._getPaddingLength(T),P=T.length-S,D=new Uint8Array(this.maxDecodedLength(P)),J=0,he=0,Oe=0,nt=0,te=0,Se=0,Fe=0;he<P-4;he+=4)nt=this._decodeChar(T.charCodeAt(he+0)),te=this._decodeChar(T.charCodeAt(he+1)),Se=this._decodeChar(T.charCodeAt(he+2)),Fe=this._decodeChar(T.charCodeAt(he+3)),D[J++]=nt<<2|te>>>4,D[J++]=te<<4|Se>>>2,D[J++]=Se<<6|Fe,Oe|=nt&p,Oe|=te&p,Oe|=Se&p,Oe|=Fe&p;if(he<P-1&&(nt=this._decodeChar(T.charCodeAt(he)),te=this._decodeChar(T.charCodeAt(he+1)),D[J++]=nt<<2|te>>>4,Oe|=nt&p,Oe|=te&p),he<P-2&&(Se=this._decodeChar(T.charCodeAt(he+2)),D[J++]=te<<4|Se>>>2,Oe|=Se&p),he<P-3&&(Fe=this._decodeChar(T.charCodeAt(he+3)),D[J++]=Se<<6|Fe,Oe|=Fe&p),Oe!==0)throw new Error("Base64Coder: incorrect characters for decoding");return D},N.prototype._encodeByte=function(T){var S=T;return S+=65,S+=25-T>>>8&6,S+=51-T>>>8&-75,S+=61-T>>>8&-15,S+=62-T>>>8&3,String.fromCharCode(S)},N.prototype._decodeChar=function(T){var S=p;return S+=(42-T&T-44)>>>8&-p+T-43+62,S+=(46-T&T-48)>>>8&-p+T-47+63,S+=(47-T&T-58)>>>8&-p+T-48+52,S+=(64-T&T-91)>>>8&-p+T-65+0,S+=(96-T&T-123)>>>8&-p+T-97+26,S},N.prototype._getPaddingLength=function(T){var S=0;if(this._paddingCharacter){for(var P=T.length-1;P>=0&&T[P]===this._paddingCharacter;P--)S++;if(T.length<4||S>2)throw new Error("Base64Coder: incorrect padding")}return S},N})();d.Coder=h;var g=new h;function m(N){return g.encode(N)}d.encode=m;function k(N){return g.decode(N)}d.decode=k;var y=(function(N){l(T,N);function T(){return N!==null&&N.apply(this,arguments)||this}return T.prototype._encodeByte=function(S){var P=S;return P+=65,P+=25-S>>>8&6,P+=51-S>>>8&-75,P+=61-S>>>8&-13,P+=62-S>>>8&49,String.fromCharCode(P)},T.prototype._decodeChar=function(S){var P=p;return P+=(44-S&S-46)>>>8&-p+S-45+62,P+=(94-S&S-96)>>>8&-p+S-95+63,P+=(47-S&S-58)>>>8&-p+S-48+52,P+=(64-S&S-91)>>>8&-p+S-65+0,P+=(96-S&S-123)>>>8&-p+S-97+26,P},T})(h);d.URLSafeCoder=y;var E=new y;function Z(N){return E.encode(N)}d.encodeURLSafe=Z;function ee(N){return E.decode(N)}d.decodeURLSafe=ee,d.encodedLength=function(N){return g.encodedLength(N)},d.maxDecodedLength=function(N){return g.maxDecodedLength(N)},d.decodedLength=function(N){return g.decodedLength(N)}},978(a,d){var l="utf8: invalid source encoding";function p(h){for(var g=[],m=0;m<h.length;m++){var k=h[m];if(k&128){var y=void 0;if(k<224){if(m>=h.length)throw new Error(l);var E=h[++m];if((E&192)!==128)throw new Error(l);k=(k&31)<<6|E&63,y=128}else if(k<240){if(m>=h.length-1)throw new Error(l);var E=h[++m],Z=h[++m];if((E&192)!==128||(Z&192)!==128)throw new Error(l);k=(k&15)<<12|(E&63)<<6|Z&63,y=2048}else if(k<248){if(m>=h.length-2)throw new Error(l);var E=h[++m],Z=h[++m],ee=h[++m];if((E&192)!==128||(Z&192)!==128||(ee&192)!==128)throw new Error(l);k=(k&15)<<18|(E&63)<<12|(Z&63)<<6|ee&63,y=65536}else throw new Error(l);if(k<y||k>=55296&&k<=57343)throw new Error(l);if(k>=65536){if(k>1114111)throw new Error(l);k-=65536,g.push(String.fromCharCode(55296|k>>10)),k=56320|k&1023}}g.push(String.fromCharCode(k))}return g.join("")}d.D4=p},721(a,d,l){a.exports=l(207).default},207(a,d,l){l.d(d,{default:()=>ro});class p{constructor(s,c){this.lastId=0,this.prefix=s,this.name=c}create(s){this.lastId++;var c=this.lastId,f=this.prefix+c,b=this.name+"["+c+"]",x=!1,R=function(){x||(s.apply(null,arguments),x=!0)};return this[c]=R,{number:c,id:f,name:b,callback:R}}remove(s){delete this[s.number]}}var h=new p("_pusher_script_","Pusher.ScriptReceivers"),g={VERSION:"8.5.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""};const m=g;class k{constructor(s){this.options=s,this.receivers=s.receivers||h,this.loading={}}load(s,c,f){var b=this;if(b.loading[s]&&b.loading[s].length>0)b.loading[s].push(f);else{b.loading[s]=[f];var x=G.createScriptRequest(b.getPath(s,c)),R=b.receivers.create(function(O){if(b.receivers.remove(R),b.loading[s]){var B=b.loading[s];delete b.loading[s];for(var ne=function(Ce){Ce||x.cleanup()},se=0;se<B.length;se++)B[se](O,ne)}});x.send(R)}}getRoot(s){var c,f=G.getDocument().location.protocol;return s&&s.useTLS||f==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(s,c){return this.getRoot(c)+"/"+s+this.options.suffix+".js"}}var y=new p("_pusher_dependencies","Pusher.DependenciesReceivers"),E=new k({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:y});const Z={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}},N={buildLogSuffix:function(u){const s="See:",c=Z.urls[u];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=Z.baseUrl+c.path),f?`${s} ${f}`:""}};var T;(function(u){u.UserAuthentication="user-authentication",u.ChannelAuthorization="channel-authorization"})(T||(T={}));class S extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class P extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class D extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class J extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class he extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Oe extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class nt extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class te extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Se extends Error{constructor(s,c){super(c),this.status=s,Object.setPrototypeOf(this,new.target.prototype)}}const Xt=function(u,s,c,f,b){const x=G.createXHR();x.open("POST",c.endpoint,!0),x.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var R in c.headers)x.setRequestHeader(R,c.headers[R]);if(c.headersProvider!=null){let O=c.headersProvider();for(var R in O)x.setRequestHeader(R,O[R])}return x.onreadystatechange=function(){if(x.readyState===4)if(x.status===200){let O,B=!1;try{O=JSON.parse(x.responseText),B=!0}catch(ne){b(new Se(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${x.responseText}`),null)}B&&b(null,O)}else{let O="";switch(f){case T.UserAuthentication:O=N.buildLogSuffix("authenticationEndpoint");break;case T.ChannelAuthorization:O=`Clients must be authorized to join private or presence channels. ${N.buildLogSuffix("authorizationEndpoint")}`;break}b(new Se(x.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${x.status} from ${c.endpoint}. ${O}`),null)}},x.send(s),x};function Vt(u){return ve($n(u))}var rt=String.fromCharCode,gt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mt=function(u){var s=u.charCodeAt(0);return s<128?u:s<2048?rt(192|s>>>6)+rt(128|s&63):rt(224|s>>>12&15)+rt(128|s>>>6&63)+rt(128|s&63)},$n=function(u){return u.replace(/[^\x00-\x7F]/g,mt)},hn=function(u){var s=[0,2,1][u.length%3],c=u.charCodeAt(0)<<16|(u.length>1?u.charCodeAt(1):0)<<8|(u.length>2?u.charCodeAt(2):0),f=[gt.charAt(c>>>18),gt.charAt(c>>>12&63),s>=2?"=":gt.charAt(c>>>6&63),s>=1?"=":gt.charAt(c&63)];return f.join("")},ve=window.btoa||function(u){return u.replace(/[\s\S]{1,3}/g,hn)};class W{constructor(s,c,f,b){this.clear=c,this.timer=s(()=>{this.timer&&(this.timer=b(this.timer))},f)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const F=W;function Ee(u){window.clearTimeout(u)}function K(u){window.clearInterval(u)}class Ae extends F{constructor(s,c){super(setTimeout,Ee,s,function(f){return c(),null})}}class ot extends F{constructor(s,c){super(setInterval,K,s,function(f){return c(),f})}}var bt={now(){return Date.now?Date.now():new Date().valueOf()},defer(u){return new Ae(0,u)},method(u,...s){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[u].apply(f,c.concat(arguments))}}};const we=bt;function re(u,...s){for(var c=0;c<s.length;c++){var f=s[c];for(var b in f)f[b]&&f[b].constructor&&f[b].constructor===Object?u[b]=re(u[b]||{},f[b]):u[b]=f[b]}return u}function Be(){for(var u=["Pusher"],s=0;s<arguments.length;s++)typeof arguments[s]=="string"?u.push(arguments[s]):u.push(Ge(arguments[s]));return u.join(" : ")}function je(u,s){var c=Array.prototype.indexOf;if(u===null)return-1;if(c&&u.indexOf===c)return u.indexOf(s);for(var f=0,b=u.length;f<b;f++)if(u[f]===s)return f;return-1}function ue(u,s){for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&s(u[c],c,u)}function Dt(u){var s=[];return ue(u,function(c,f){s.push(f)}),s}function Le(u){var s=[];return ue(u,function(c){s.push(c)}),s}function Ze(u,s,c){for(var f=0;f<u.length;f++)s.call(c||window,u[f],f,u)}function Mt(u,s){for(var c=[],f=0;f<u.length;f++)c.push(s(u[f],f,u,c));return c}function st(u,s){var c={};return ue(u,function(f,b){c[b]=s(f)}),c}function fn(u,s){s=s||function(b){return!!b};for(var c=[],f=0;f<u.length;f++)s(u[f],f,u,c)&&c.push(u[f]);return c}function gn(u,s){var c={};return ue(u,function(f,b){(s&&s(f,b,u,c)||f)&&(c[b]=f)}),c}function Hr(u){var s=[];return ue(u,function(c,f){s.push([f,c])}),s}function ur(u,s){for(var c=0;c<u.length;c++)if(s(u[c],c,u))return!0;return!1}function es(u,s){for(var c=0;c<u.length;c++)if(!s(u[c],c,u))return!1;return!0}function dr(u){return st(u,function(s){return typeof s=="object"&&(s=Ge(s)),encodeURIComponent(Vt(s.toString()))})}function mn(u){var s=gn(u,function(f){return f!==void 0}),c=Mt(Hr(dr(s)),we.method("join","=")).join("&");return c}function Kt(u){var s=[],c=[];return(function f(b,x){var R,O,B;switch(typeof b){case"object":if(!b)return null;for(R=0;R<s.length;R+=1)if(s[R]===b)return{$ref:c[R]};if(s.push(b),c.push(x),Object.prototype.toString.apply(b)==="[object Array]")for(B=[],R=0;R<b.length;R+=1)B[R]=f(b[R],x+"["+R+"]");else{B={};for(O in b)Object.prototype.hasOwnProperty.call(b,O)&&(B[O]=f(b[O],x+"["+JSON.stringify(O)+"]"))}return B;case"number":case"string":case"boolean":return b}})(u,"$")}function Ge(u){try{return JSON.stringify(u)}catch(s){return JSON.stringify(Kt(u))}}class pr{constructor(){this.globalLog=s=>{window.console&&window.console.log&&window.console.log(s)}}debug(...s){this.log(this.globalLog,s)}warn(...s){this.log(this.globalLogWarn,s)}error(...s){this.log(this.globalLogError,s)}globalLogWarn(s){window.console&&window.console.warn?window.console.warn(s):this.globalLog(s)}globalLogError(s){window.console&&window.console.error?window.console.error(s):this.globalLogWarn(s)}log(s,...c){var f=Be.apply(this,arguments);ro.log?ro.log(f):ro.logToConsole&&s.bind(this)(f)}}const de=new pr;var Fr=function(u,s,c,f,b){(c.headers!==void 0||c.headersProvider!=null)&&de.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var x=u.nextAuthCallbackID.toString();u.nextAuthCallbackID++;var R=u.getDocument(),O=R.createElement("script");u.auth_callbacks[x]=function(se){b(null,se)};var B="Pusher.auth_callbacks['"+x+"']";O.src=c.endpoint+"?callback="+encodeURIComponent(B)+"&"+s;var ne=R.getElementsByTagName("head")[0]||R.documentElement;ne.insertBefore(O,ne.firstChild)};const hr=Fr;class Br{constructor(s){this.src=s}send(s){var c=this,f="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=s.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){s.callback(f)},c.script.onload=function(){s.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&s.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=s.id+"_error",c.errorScript.text=s.name+"('"+f+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var b=document.getElementsByTagName("head")[0];b.insertBefore(c.script,b.firstChild),c.errorScript&&b.insertBefore(c.errorScript,c.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class On{constructor(s,c){this.url=s,this.data=c}send(s){if(!this.request){var c=mn(this.data),f=this.url+"/"+s.number+"?"+c;this.request=G.createScriptRequest(f),this.request.send(s)}}cleanup(){this.request&&this.request.cleanup()}}var Nn=function(u,s){return function(c,f){var b="http"+(s?"s":"")+"://",x=b+(u.host||u.options.host)+u.options.path,R=G.createJSONPRequest(x,c),O=G.ScriptReceivers.create(function(B,ne){h.remove(O),R.cleanup(),ne&&ne.host&&(u.host=ne.host),f&&f(B,ne)});R.send(O)}},kt={name:"jsonp",getAgent:Nn};const Qt=kt;function bn(u,s,c){var f=u+(s.useTLS?"s":""),b=s.useTLS?s.hostTLS:s.hostNonTLS;return f+"://"+b+c}function kn(u,s){var c="/app/"+u,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(s?"&"+s:"");return c+f}var ts={getInitial:function(u,s){var c=(s.httpPath||"")+kn(u,"flash=false");return bn("ws",s,c)}},Dn={getInitial:function(u,s){var c=(s.httpPath||"/pusher")+kn(u);return bn("http",s,c)}},Mn={getInitial:function(u,s){return bn("http",s,s.httpPath||"/pusher")},getPath:function(u,s){return kn(u)}};class ns{constructor(){this._callbacks={}}get(s){return this._callbacks[Ut(s)]}add(s,c,f){var b=Ut(s);this._callbacks[b]=this._callbacks[b]||[],this._callbacks[b].push({fn:c,context:f})}remove(s,c,f){if(!s&&!c&&!f){this._callbacks={};return}var b=s?[Ut(s)]:Dt(this._callbacks);c||f?this.removeCallback(b,c,f):this.removeAllCallbacks(b)}removeCallback(s,c,f){Ze(s,function(b){this._callbacks[b]=fn(this._callbacks[b]||[],function(x){return c&&c!==x.fn||f&&f!==x.context}),this._callbacks[b].length===0&&delete this._callbacks[b]},this)}removeAllCallbacks(s){Ze(s,function(c){delete this._callbacks[c]},this)}}function Ut(u){return"_"+u}class _t{constructor(s){this.callbacks=new ns,this.global_callbacks=[],this.failThrough=s}bind(s,c,f){return this.callbacks.add(s,c,f),this}bind_global(s){return this.global_callbacks.push(s),this}unbind(s,c,f){return this.callbacks.remove(s,c,f),this}unbind_global(s){return s?(this.global_callbacks=fn(this.global_callbacks||[],c=>c!==s),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(s,c,f){for(var b=0;b<this.global_callbacks.length;b++)this.global_callbacks[b](s,c);var x=this.callbacks.get(s),R=[];if(f?R.push(c,f):c&&R.push(c),x&&x.length>0)for(var b=0;b<x.length;b++)x[b].fn.apply(x[b].context||window,R);else this.failThrough&&this.failThrough(s,c);return this}}class rs extends _t{constructor(s,c,f,b,x){super(),this.initialize=G.transportConnectionInitializer,this.hooks=s,this.name=c,this.priority=f,this.key=b,this.options=x,this.state="new",this.timeline=x.timeline,this.activityTimeout=x.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var s=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(s,this.options)}catch(c){return we.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),de.debug("Connecting",{transport:this.name,url:s}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(s){return this.state==="open"?(we.defer(()=>{this.socket&&this.socket.send(s)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(s){this.emit("error",{type:"WebSocketError",error:s}),this.timeline.error(this.buildTimelineMessage({error:s.toString()}))}onClose(s){s?this.changeState("closed",{code:s.code,reason:s.reason,wasClean:s.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(s){this.emit("message",s)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=s=>{this.onError(s)},this.socket.onclose=s=>{this.onClose(s)},this.socket.onmessage=s=>{this.onMessage(s)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(s,c){this.state=s,this.timeline.info(this.buildTimelineMessage({state:s,params:c})),this.emit(s,c)}buildTimelineMessage(s){return re({cid:this.id},s)}}class pe{constructor(s){this.hooks=s}isSupported(s){return this.hooks.isSupported(s)}createConnection(s,c,f,b){return new rs(this.hooks,s,c,f,b)}}var en=new pe({urls:ts,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!G.getWebSocketAPI()},isSupported:function(){return!!G.getWebSocketAPI()},getSocket:function(u){return G.createWebSocket(u)}}),Gr={urls:Dn,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},fr=re({getSocket:function(u){return G.HTTPFactory.createStreamingSocket(u)}},Gr),Un=re({getSocket:function(u){return G.HTTPFactory.createPollingSocket(u)}},Gr),gr={isSupported:function(){return G.isXHRSupported()}},Wr=new pe(re({},fr,gr)),os=new pe(re({},Un,gr)),at={ws:en,xhr_streaming:Wr,xhr_polling:os};const ct=at;var Jr=new pe({file:"sockjs",urls:Mn,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(u,s){return new window.SockJS(u,null,{js_path:E.getPath("sockjs",{useTLS:s.useTLS}),ignore_null_origin:s.ignoreNullOrigin})},beforeOpen:function(u,s){u.send(JSON.stringify({path:s}))}}),mr={isSupported:function(u){var s=G.isXDRSupported(u.useTLS);return s}},br=new pe(re({},fr,mr)),Yr=new pe(re({},Un,mr));ct.xdr_streaming=br,ct.xdr_polling=Yr,ct.sockjs=Jr;const vt=ct;class Xr extends _t{constructor(){super();var s=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){s.emit("online")},!1),window.addEventListener("offline",function(){s.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Vr=new Xr;class Kr{constructor(s,c,f){this.manager=s,this.transport=c,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(s,c,f,b){b=re({},b,{activityTimeout:this.pingDelay});var x=this.transport.createConnection(s,c,f,b),R=null,O=function(){x.unbind("open",O),x.bind("closed",B),R=we.now()},B=ne=>{if(x.unbind("closed",B),ne.code===1002||ne.code===1003)this.manager.reportDeath();else if(!ne.wasClean&&R){var se=we.now()-R;se<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(se/2,this.minPingDelay))}};return x.bind("open",O),x}isSupported(s){return this.manager.isAlive()&&this.transport.isSupported(s)}}const kr={decodeMessage:function(u){try{var s=JSON.parse(u.data),c=s.data;if(typeof c=="string")try{c=JSON.parse(s.data)}catch(b){}var f={event:s.event,channel:s.channel,data:c};return s.user_id&&(f.user_id=s.user_id),f}catch(b){throw{type:"MessageParseError",error:b,data:u.data}}},encodeMessage:function(u){return JSON.stringify(u)},processHandshake:function(u){var s=kr.decodeMessage(u);if(s.event==="pusher:connection_established"){if(!s.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:s.data.socket_id,activityTimeout:s.data.activity_timeout*1e3}}else{if(s.event==="pusher:error")return{action:this.getCloseAction(s.data),error:this.getCloseError(s.data)};throw"Invalid handshake"}},getCloseAction:function(u){return u.code<4e3?u.code>=1002&&u.code<=1004?"backoff":null:u.code===4e3?"tls_only":u.code<4100?"refused":u.code<4200?"backoff":u.code<4300?"retry":"refused"},getCloseError:function(u){return u.code!==1e3&&u.code!==1001?{type:"PusherError",data:{code:u.code,message:u.reason||u.message}}:null}},jt=kr;class M extends _t{constructor(s,c){super(),this.id=s,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(s){return this.transport.send(s)}send_event(s,c,f){var b={event:s,data:c};return f&&(b.channel=f),de.debug("Event sent",b),this.send(jt.encodeMessage(b))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var s={message:f=>{var b;try{b=jt.decodeMessage(f)}catch(x){this.emit("error",{type:"MessageParseError",error:x,data:f.data})}if(b!==void 0){switch(de.debug("Event recd",b),b.event){case"pusher:error":this.emit("error",{type:"PusherError",data:b.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",b)}},activity:()=>{this.emit("activity")},error:f=>{this.emit("error",f)},closed:f=>{c(),f&&f.code&&this.handleCloseEvent(f),this.transport=null,this.emit("closed")}},c=()=>{ue(s,(f,b)=>{this.transport.unbind(b,f)})};ue(s,(f,b)=>{this.transport.bind(b,f)})}handleCloseEvent(s){var c=jt.getCloseAction(s),f=jt.getCloseError(s);f&&this.emit("error",f),c&&this.emit(c,{action:c,error:f})}}class _{constructor(s,c){this.transport=s,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=s=>{this.unbindListeners();var c;try{c=jt.processHandshake(s)}catch(f){this.finish("error",{error:f}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new M(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=s=>{this.unbindListeners();var c=jt.getCloseAction(s)||"backoff",f=jt.getCloseError(s);this.finish(c,{error:f})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(s,c){this.callback(re({transport:this.transport,action:s},c))}}class A{constructor(s,c){this.timeline=s,this.options=c||{}}send(s,c){this.timeline.isEmpty()||this.timeline.send(G.TimelineTransport.getAgent(this,s),c)}}class I extends _t{constructor(s,c){super(function(f,b){de.debug("No callbacks on "+s+" for "+f)}),this.name=s,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(s,c){return c(null,{auth:""})}trigger(s,c){if(s.indexOf("client-")!==0)throw new S("Event '"+s+"' does not start with 'client-'");if(!this.subscribed){var f=N.buildLogSuffix("triggeringClientEvents");de.warn(`Client event triggered before channel 'subscription_succeeded' event . ${f}`)}return this.pusher.send_event(s,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(s){var c=s.event,f=s.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(s);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(s);else if(c.indexOf("pusher_internal:")!==0){var b={};this.emit(c,f,b)}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",s.data)}handleSubscriptionCountEvent(s){s.data.subscription_count&&(this.subscriptionCount=s.data.subscription_count),this.emit("pusher:subscription_count",s.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(s,c)=>{s?(this.subscriptionPending=!1,de.error(s.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:s.message},s instanceof Se?{status:s.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:c.auth,channel_data:c.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class ie extends I{authorize(s,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:s},c)}}class $e{constructor(){this.reset()}get(s){return Object.prototype.hasOwnProperty.call(this.members,s)?{id:s,info:this.members[s]}:null}each(s){ue(this.members,(c,f)=>{s(this.get(f))})}setMyID(s){this.myID=s}onSubscription(s){this.members=s.presence.hash,this.count=s.presence.count,this.me=this.get(this.myID)}addMember(s){return this.get(s.user_id)===null&&this.count++,this.members[s.user_id]=s.user_info,this.get(s.user_id)}removeMember(s){var c=this.get(s.user_id);return c&&(delete this.members[s.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var xe=function(u,s,c,f){function b(x){return x instanceof c?x:new c(function(R){R(x)})}return new(c||(c=Promise))(function(x,R){function O(se){try{ne(f.next(se))}catch(Ce){R(Ce)}}function B(se){try{ne(f.throw(se))}catch(Ce){R(Ce)}}function ne(se){se.done?x(se.value):b(se.value).then(O,B)}ne((f=f.apply(u,s||[])).next())})};class qe extends ie{constructor(s,c){super(s,c),this.members=new $e}authorize(s,c){super.authorize(s,(f,b)=>xe(this,void 0,void 0,function*(){if(!f)if(b=b,b.channel_data!=null){var x=JSON.parse(b.channel_data);this.members.setMyID(x.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let R=N.buildLogSuffix("authorizationEndpoint");de.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${R}, or the user should be signed in.`),c("Invalid auth response");return}c(f,b)}))}handleEvent(s){var c=s.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(s);else{var f=s.data,b={};s.user_id&&(b.user_id=s.user_id),this.emit(c,f,b)}}handleInternalEvent(s){var c=s.event,f=s.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(s);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(s);break;case"pusher_internal:member_added":var b=this.members.addMember(f);this.emit("pusher:member_added",b);break;case"pusher_internal:member_removed":var x=this.members.removeMember(f);x&&this.emit("pusher:member_removed",x);break}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(s.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var yt=l(978),Ct=l(594);class _r extends ie{constructor(s,c,f){super(s,c),this.key=null,this.nacl=f}authorize(s,c){super.authorize(s,(f,b)=>{if(f){c(f,b);return}let x=b.shared_secret;if(!x){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,Ct.decode)(x),delete b.shared_secret,c(null,b)})}trigger(s,c){throw new Oe("Client events are not currently supported for encrypted channels")}handleEvent(s){var c=s.event,f=s.data;if(c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0){super.handleEvent(s);return}this.handleEncryptedEvent(c,f)}handleEncryptedEvent(s,c){if(!this.key){de.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){de.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let f=(0,Ct.decode)(c.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){de.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let b=(0,Ct.decode)(c.nonce);if(b.length<this.nacl.secretbox.nonceLength){de.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${b.length}`);return}let x=this.nacl.secretbox.open(f,b,this.key);if(x===null){de.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(R,O)=>{if(R){de.error(`Failed to make a request to the authEndpoint: ${O}. Unable to fetch new key, so dropping encrypted event`);return}if(x=this.nacl.secretbox.open(f,b,this.key),x===null){de.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(s,this.getDataToEmit(x))});return}this.emit(s,this.getDataToEmit(x))}getDataToEmit(s){let c=(0,yt.D4)(s);try{return JSON.parse(c)}catch(f){return c}}}class Ie extends _t{constructor(s,c){super(),this.state="initialized",this.connection=null,this.key=s,this.options=c,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var f=G.getNetwork();f.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),f.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(s){this.key=s,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(s){return this.connection?this.connection.send(s):!1}send_event(s,c,f){return this.connection?this.connection.send_event(s,c,f):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var s=(c,f)=>{c?this.runner=this.strategy.connect(0,s):f.action==="error"?(this.emit("error",{type:"HandshakeError",error:f.error}),this.timeline.error({handshakeError:f.error})):(this.abortConnecting(),this.handshakeCallbacks[f.action](f))};this.runner=this.strategy.connect(0,s)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var s=this.abandonConnection();s.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(s){this.timeline.info({action:"retry",delay:s}),s>0&&this.emit("connecting_in",Math.round(s/1e3)),this.retryTimer=new Ae(s||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new Ae(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new Ae(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 Ae(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(s){return re({},s,{message:c=>{this.resetActivityCheck(),this.emit("message",c)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:c=>{this.emit("error",c)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(s){return re({},s,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let s=c=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),c(f)};return{tls_only:s(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:s(()=>{this.disconnect()}),backoff:s(()=>{this.retryIn(1e3)}),retry:s(()=>{this.retryIn(0)})}}setConnection(s){this.connection=s;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var s in this.connectionCallbacks)this.connection.unbind(s,this.connectionCallbacks[s]);var c=this.connection;return this.connection=null,c}}updateState(s,c){var f=this.state;if(this.state=s,f!==s){var b=s;b==="connected"&&(b+=" with new socket ID "+c.socket_id),de.debug("State changed",f+" -> "+b),this.timeline.info({state:s,params:c}),this.emit("state_change",{previous:f,current:s}),this.emit(s,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class Qr{constructor(){this.channels={}}add(s,c){return this.channels[s]||(this.channels[s]=eo(s,c)),this.channels[s]}all(){return Le(this.channels)}find(s){return this.channels[s]}remove(s){var c=this.channels[s];return delete this.channels[s],c}disconnect(){ue(this.channels,function(s){s.disconnect()})}}function eo(u,s){if(u.indexOf("private-encrypted-")===0){if(s.config.nacl)return Zt.createEncryptedChannel(u,s,s.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=N.buildLogSuffix("encryptedChannelSupport");throw new Oe(`${c}. ${f}`)}else{if(u.indexOf("private-")===0)return Zt.createPrivateChannel(u,s);if(u.indexOf("presence-")===0)return Zt.createPresenceChannel(u,s);if(u.indexOf("#")===0)throw new P('Cannot create a channel with name "'+u+'".');return Zt.createChannel(u,s)}}var Ll={createChannels(){return new Qr},createConnectionManager(u,s){return new Ie(u,s)},createChannel(u,s){return new I(u,s)},createPrivateChannel(u,s){return new ie(u,s)},createPresenceChannel(u,s){return new qe(u,s)},createEncryptedChannel(u,s,c){return new _r(u,s,c)},createTimelineSender(u,s){return new A(u,s)},createHandshake(u,s){return new _(u,s)},createAssistantToTheTransportManager(u,s,c){return new Kr(u,s,c)}};const Zt=Ll;class fi{constructor(s){this.options=s||{},this.livesLeft=this.options.lives||1/0}getAssistant(s){return Zt.createAssistantToTheTransportManager(this,s,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class _n{constructor(s,c){this.strategies=s,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return ur(this.strategies,we.method("isSupported"))}connect(s,c){var f=this.strategies,b=0,x=this.timeout,R=null,O=(B,ne)=>{ne?c(null,ne):(b=b+1,this.loop&&(b=b%f.length),b<f.length?(x&&(x=x*2,this.timeoutLimit&&(x=Math.min(x,this.timeoutLimit))),R=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},O)):c(!0))};return R=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},O),{abort:function(){R.abort()},forceMinPriority:function(B){s=B,R&&R.forceMinPriority(B)}}}tryStrategy(s,c,f,b){var x=null,R=null;return f.timeout>0&&(x=new Ae(f.timeout,function(){R.abort(),b(!0)})),R=s.connect(c,function(O,B){O&&x&&x.isRunning()&&!f.failFast||(x&&x.ensureAborted(),b(O,B))}),{abort:function(){x&&x.ensureAborted(),R.abort()},forceMinPriority:function(O){R.forceMinPriority(O)}}}}class ss{constructor(s){this.strategies=s}isSupported(){return ur(this.strategies,we.method("isSupported"))}connect(s,c){return Il(this.strategies,s,function(f,b){return function(x,R){if(b[f].error=x,x){zl(b)&&c(!0);return}Ze(b,function(O){O.forceMinPriority(R.transport.priority)}),c(null,R)}})}}function Il(u,s,c){var f=Mt(u,function(b,x,R,O){return b.connect(s,c(x,O))});return{abort:function(){Ze(f,$l)},forceMinPriority:function(b){Ze(f,function(x){x.forceMinPriority(b)})}}}function zl(u){return es(u,function(s){return!!s.error})}function $l(u){!u.error&&!u.aborted&&(u.abort(),u.aborted=!0)}class Ol{constructor(s,c,f){this.strategy=s,this.transports=c,this.ttl=f.ttl||18e5,this.usingTLS=f.useTLS,this.timeline=f.timeline}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.usingTLS,b=Nl(f),x=b&&b.cacheSkipCount?b.cacheSkipCount:0,R=[this.strategy];if(b&&b.timestamp+this.ttl>=we.now()){var O=this.transports[b.transport];O&&(["ws","wss"].includes(b.transport)||x>3?(this.timeline.info({cached:!0,transport:b.transport,latency:b.latency}),R.push(new _n([O],{timeout:b.latency*2+1e3,failFast:!0}))):x++)}var B=we.now(),ne=R.pop().connect(s,function se(Ce,oo){Ce?(gi(f),R.length>0?(B=we.now(),ne=R.pop().connect(s,se)):c(Ce)):(Dl(f,oo.transport.name,we.now()-B,x),c(null,oo))});return{abort:function(){ne.abort()},forceMinPriority:function(se){s=se,ne&&ne.forceMinPriority(se)}}}}function is(u){return"pusherTransport"+(u?"TLS":"NonTLS")}function Nl(u){var s=G.getLocalStorage();if(s)try{var c=s[is(u)];if(c)return JSON.parse(c)}catch(f){gi(u)}return null}function Dl(u,s,c,f){var b=G.getLocalStorage();if(b)try{b[is(u)]=Ge({timestamp:we.now(),transport:s,latency:c,cacheSkipCount:f})}catch(x){}}function gi(u){var s=G.getLocalStorage();if(s)try{delete s[is(u)]}catch(c){}}class to{constructor(s,{delay:c}){this.strategy=s,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy,b,x=new Ae(this.options.delay,function(){b=f.connect(s,c)});return{abort:function(){x.ensureAborted(),b&&b.abort()},forceMinPriority:function(R){s=R,b&&b.forceMinPriority(R)}}}}class vr{constructor(s,c,f){this.test=s,this.trueBranch=c,this.falseBranch=f}isSupported(){var s=this.test()?this.trueBranch:this.falseBranch;return s.isSupported()}connect(s,c){var f=this.test()?this.trueBranch:this.falseBranch;return f.connect(s,c)}}class Ml{constructor(s){this.strategy=s}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy.connect(s,function(b,x){x&&f.abort(),c(b,x)});return f}}function yr(u){return function(){return u.isSupported()}}var Ul=function(u,s,c){var f={};function b(Ci,Nu,Du,Mu,Uu){var Pi=c(u,Ci,Nu,Du,Mu,Uu);return f[Ci]=Pi,Pi}var x=Object.assign({},s,{hostNonTLS:u.wsHost+":"+u.wsPort,hostTLS:u.wsHost+":"+u.wssPort,httpPath:u.wsPath}),R=Object.assign({},x,{useTLS:!0}),O=Object.assign({},s,{hostNonTLS:u.httpHost+":"+u.httpPort,hostTLS:u.httpHost+":"+u.httpsPort,httpPath:u.httpPath}),B={loop:!0,timeout:15e3,timeoutLimit:6e4},ne=new fi({minPingDelay:1e4,maxPingDelay:u.activityTimeout}),se=new fi({lives:2,minPingDelay:1e4,maxPingDelay:u.activityTimeout}),Ce=b("ws","ws",3,x,ne),oo=b("wss","ws",3,R,ne),Lu=b("sockjs","sockjs",1,O),wi=b("xhr_streaming","xhr_streaming",1,O,se),Iu=b("xdr_streaming","xdr_streaming",1,O,se),xi=b("xhr_polling","xhr_polling",1,O),zu=b("xdr_polling","xdr_polling",1,O),Si=new _n([Ce],B),$u=new _n([oo],B),Ou=new _n([Lu],B),Ti=new _n([new vr(yr(wi),wi,Iu)],B),Ei=new _n([new vr(yr(xi),xi,zu)],B),Ai=new _n([new vr(yr(Ti),new ss([Ti,new to(Ei,{delay:4e3})]),Ei)],B),ls=new vr(yr(Ai),Ai,Ou),us;return s.useTLS?us=new ss([Si,new to(ls,{delay:2e3})]):us=new ss([Si,new to($u,{delay:2e3}),new to(ls,{delay:5e3})]),new Ol(new Ml(new vr(yr(Ce),us,ls)),f,{ttl:18e5,timeline:s.timeline,useTLS:s.useTLS})};const jl=Ul;function Zl(){var u=this;u.timeline.info(u.buildTimelineMessage({transport:u.name+(u.options.useTLS?"s":"")})),u.hooks.isInitialized()?u.changeState("initialized"):u.hooks.file?(u.changeState("initializing"),E.load(u.hooks.file,{useTLS:u.options.useTLS},function(s,c){u.hooks.isInitialized()?(u.changeState("initialized"),c(!0)):(s&&u.onError(s),u.onClose(),c(!1))})):u.onClose()}var ql={getRequest:function(u){var s=new window.XDomainRequest;return s.ontimeout=function(){u.emit("error",new D),u.close()},s.onerror=function(c){u.emit("error",c),u.close()},s.onprogress=function(){s.responseText&&s.responseText.length>0&&u.onChunk(200,s.responseText)},s.onload=function(){s.responseText&&s.responseText.length>0&&u.onChunk(200,s.responseText),u.emit("finished",200),u.close()},s},abortRequest:function(u){u.ontimeout=u.onerror=u.onprogress=u.onload=null,u.abort()}};const Hl=ql,Fl=256*1024;class Bl extends _t{constructor(s,c,f){super(),this.hooks=s,this.method=c,this.url=f}start(s){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},G.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(s)}close(){this.unloader&&(G.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(s,c){for(;;){var f=this.advanceBuffer(c);if(f)this.emit("chunk",{status:s,data:f});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(s){var c=s.slice(this.position),f=c.indexOf(`
1365
- `);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(s){return this.position===s.length&&s.length>Fl}}var as;(function(u){u[u.CONNECTING=0]="CONNECTING",u[u.OPEN=1]="OPEN",u[u.CLOSED=3]="CLOSED"})(as||(as={}));const vn=as;var Gl=1;class Wl{constructor(s,c){this.hooks=s,this.session=bi(1e3)+"/"+Vl(8),this.location=Jl(c),this.readyState=vn.CONNECTING,this.openStream()}send(s){return this.sendRaw(JSON.stringify([s]))}ping(){this.hooks.sendHeartbeat(this)}close(s,c){this.onClose(s,c,!0)}sendRaw(s){if(this.readyState===vn.OPEN)try{return G.createSocketRequest("POST",mi(Yl(this.location,this.session))).start(s),!0}catch(c){return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(s,c,f){this.closeStream(),this.readyState=vn.CLOSED,this.onclose&&this.onclose({code:s,reason:c,wasClean:f})}onChunk(s){if(s.status===200){this.readyState===vn.OPEN&&this.onActivity();var c,f=s.data.slice(0,1);switch(f){case"o":c=JSON.parse(s.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(s.data.slice(1)||"[]");for(var b=0;b<c.length;b++)this.onEvent(c[b]);break;case"m":c=JSON.parse(s.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(s.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(s){this.readyState===vn.CONNECTING?(s&&s.hostname&&(this.location.base=Xl(this.location.base,s.hostname)),this.readyState=vn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(s){this.readyState===vn.OPEN&&this.onmessage&&this.onmessage({data:s})}onActivity(){this.onactivity&&this.onactivity()}onError(s){this.onerror&&this.onerror(s)}openStream(){this.stream=G.createSocketRequest("POST",mi(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",s=>{this.onChunk(s)}),this.stream.bind("finished",s=>{this.hooks.onFinished(this,s)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(s){we.defer(()=>{this.onError(s),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function Jl(u){var s=/([^\?]*)\/*(\??.*)/.exec(u);return{base:s[1],queryString:s[2]}}function Yl(u,s){return u.base+"/"+s+"/xhr_send"}function mi(u){var s=u.indexOf("?")===-1?"?":"&";return u+s+"t="+ +new Date+"&n="+Gl++}function Xl(u,s){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(u);return c[1]+s+c[3]}function bi(u){return G.randomInt(u)}function Vl(u){for(var s=[],c=0;c<u;c++)s.push(bi(32).toString(32));return s.join("")}const Kl=Wl;var Ql={getReceiveURL:function(u,s){return u.base+"/"+s+"/xhr_streaming"+u.queryString},onHeartbeat:function(u){u.sendRaw("[]")},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,s){u.onClose(1006,"Connection interrupted ("+s+")",!1)}};const eu=Ql;var tu={getReceiveURL:function(u,s){return u.base+"/"+s+"/xhr"+u.queryString},onHeartbeat:function(){},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,s){s===200?u.reconnect():u.onClose(1006,"Connection interrupted ("+s+")",!1)}};const nu=tu;var ru={getRequest:function(u){var s=G.getXHRAPI(),c=new s;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&u.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&u.onChunk(c.status,c.responseText),u.emit("finished",c.status),u.close();break}},c},abortRequest:function(u){u.onreadystatechange=null,u.abort()}};const ou=ru;var su={createStreamingSocket(u){return this.createSocket(eu,u)},createPollingSocket(u){return this.createSocket(nu,u)},createSocket(u,s){return new Kl(u,s)},createXHR(u,s){return this.createRequest(ou,u,s)},createRequest(u,s,c){return new Bl(u,s,c)}};const ki=su;ki.createXDR=function(u,s){return this.createRequest(Hl,u,s)};var iu={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:y,getDefaultStrategy:jl,Transports:vt,transportConnectionInitializer:Zl,HTTPFactory:ki,TimelineTransport:Qt,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(u){window.Pusher=u;var s=()=>{this.onDocumentBody(u.ready)};window.JSON?s():E.load("json2",{},s)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:Xt,jsonp:hr}},onDocumentBody(u){document.body?u():setTimeout(()=>{this.onDocumentBody(u)},0)},createJSONPRequest(u,s){return new On(u,s)},createScriptRequest(u){return new Br(u)},getLocalStorage(){try{return window.localStorage}catch(u){return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var u=this.getXHRAPI();return new u},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Vr},createWebSocket(u){var s=this.getWebSocketAPI();return new s(u)},createSocketRequest(u,s){if(this.isXHRSupported())return this.HTTPFactory.createXHR(u,s);if(this.isXDRSupported(s.indexOf("https:")===0))return this.HTTPFactory.createXDR(u,s);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var u=this.getXHRAPI();return!!u&&new u().withCredentials!==void 0},isXDRSupported(u){var s=u?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===s},addUnloadListener(u){window.addEventListener!==void 0?window.addEventListener("unload",u,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",u)},removeUnloadListener(u){window.addEventListener!==void 0?window.removeEventListener("unload",u,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",u)},randomInt(u){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*u)}};const G=iu;var cs;(function(u){u[u.ERROR=3]="ERROR",u[u.INFO=6]="INFO",u[u.DEBUG=7]="DEBUG"})(cs||(cs={}));const no=cs;class au{constructor(s,c,f){this.key=s,this.session=c,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(s,c){s<=this.options.level&&(this.events.push(re({},c,{timestamp:we.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(s){this.log(no.ERROR,s)}info(s){this.log(no.INFO,s)}debug(s){this.log(no.DEBUG,s)}isEmpty(){return this.events.length===0}send(s,c){var f=re({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],s(f,(b,x)=>{b||this.sent++,c&&c(b,x)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class cu{constructor(s,c,f,b){this.name=s,this.priority=c,this.transport=f,this.options=b||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(s,c){if(this.isSupported()){if(this.priority<s)return _i(new J,c)}else return _i(new te,c);var f=!1,b=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),x=null,R=function(){b.unbind("initialized",R),b.connect()},O=function(){x=Zt.createHandshake(b,function(Ce){f=!0,se(),c(null,Ce)})},B=function(Ce){se(),c(Ce)},ne=function(){se();var Ce;Ce=Ge(b),c(new he(Ce))},se=function(){b.unbind("initialized",R),b.unbind("open",O),b.unbind("error",B),b.unbind("closed",ne)};return b.bind("initialized",R),b.bind("open",O),b.bind("error",B),b.bind("closed",ne),b.initialize(),{abort:()=>{f||(se(),x?x.close():b.close())},forceMinPriority:Ce=>{f||this.priority<Ce&&(x?x.close():b.close())}}}}function _i(u,s){return we.defer(function(){s(u)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:lu}=G;var uu=function(u,s,c,f,b,x){var R=lu[c];if(!R)throw new nt(c);var O=(!u.enabledTransports||je(u.enabledTransports,s)!==-1)&&(!u.disabledTransports||je(u.disabledTransports,s)===-1),B;return O?(b=Object.assign({ignoreNullOrigin:u.ignoreNullOrigin},b),B=new cu(s,f,x?x.getAssistant(R):R,b)):B=du,B},du={isSupported:function(){return!1},connect:function(u,s){var c=we.defer(function(){s(new te)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function pu(u){if(u==null)throw"You must pass an options object";if(u.cluster==null)throw"Options object must provide a cluster";"disableStats"in u&&de.warn("The disableStats option is deprecated in favor of enableStats")}const hu=(u,s)=>{var c="socket_id="+encodeURIComponent(u.socketId);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},fu=u=>{if(typeof G.getAuthorizers()[u.transport]=="undefined")throw`'${u.transport}' is not a recognized auth transport`;return(s,c)=>{const f=hu(s,u);G.getAuthorizers()[u.transport](G,f,u,T.UserAuthentication,c)}},gu=(u,s)=>{var c="socket_id="+encodeURIComponent(u.socketId);c+="&channel_name="+encodeURIComponent(u.channelName);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},mu=u=>{if(typeof G.getAuthorizers()[u.transport]=="undefined")throw`'${u.transport}' is not a recognized auth transport`;return(s,c)=>{const f=gu(s,u);G.getAuthorizers()[u.transport](G,f,u,T.ChannelAuthorization,c)}},bu=(u,s,c)=>{const f={authTransport:s.transport,authEndpoint:s.endpoint,auth:{params:s.params,headers:s.headers}};return(b,x)=>{const R=u.channel(b.channelName);c(R,f).authorize(b.socketId,x)}};function vi(u,s){let c={activityTimeout:u.activityTimeout||m.activityTimeout,cluster:u.cluster,httpPath:u.httpPath||m.httpPath,httpPort:u.httpPort||m.httpPort,httpsPort:u.httpsPort||m.httpsPort,pongTimeout:u.pongTimeout||m.pongTimeout,statsHost:u.statsHost||m.stats_host,unavailableTimeout:u.unavailableTimeout||m.unavailableTimeout,wsPath:u.wsPath||m.wsPath,wsPort:u.wsPort||m.wsPort,wssPort:u.wssPort||m.wssPort,enableStats:wu(u),httpHost:ku(u),useTLS:yu(u),wsHost:_u(u),userAuthenticator:xu(u),channelAuthorizer:Tu(u,s)};return"disabledTransports"in u&&(c.disabledTransports=u.disabledTransports),"enabledTransports"in u&&(c.enabledTransports=u.enabledTransports),"ignoreNullOrigin"in u&&(c.ignoreNullOrigin=u.ignoreNullOrigin),"timelineParams"in u&&(c.timelineParams=u.timelineParams),"nacl"in u&&(c.nacl=u.nacl),c}function ku(u){return u.httpHost?u.httpHost:u.cluster?`sockjs-${u.cluster}.pusher.com`:m.httpHost}function _u(u){return u.wsHost?u.wsHost:vu(u.cluster)}function vu(u){return`ws-${u}.pusher.com`}function yu(u){return G.getProtocol()==="https:"?!0:u.forceTLS!==!1}function wu(u){return"enableStats"in u?u.enableStats:"disableStats"in u?!u.disableStats:!1}const yi=u=>"customHandler"in u&&u.customHandler!=null;function xu(u){const s=Object.assign(Object.assign({},m.userAuthentication),u.userAuthentication);return yi(s)?s.customHandler:fu(s)}function Su(u,s){let c;if("channelAuthorization"in u)c=Object.assign(Object.assign({},m.channelAuthorization),u.channelAuthorization);else if(c={transport:u.authTransport||m.authTransport,endpoint:u.authEndpoint||m.authEndpoint},"auth"in u&&("params"in u.auth&&(c.params=u.auth.params),"headers"in u.auth&&(c.headers=u.auth.headers)),"authorizer"in u)return{customHandler:bu(s,c,u.authorizer)};return c}function Tu(u,s){const c=Su(u,s);return yi(c)?c.customHandler:mu(c)}class Eu extends _t{constructor(s){super(function(c,f){de.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=s,this.bindWatchlistInternalEvent()}handleEvent(s){s.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",s=>{var c=s.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(s)})}}function Au(){let u,s;return{promise:new Promise((f,b)=>{u=f,s=b}),resolve:u,reject:s}}const Cu=Au;class Pu extends _t{constructor(s){super(function(c,f){de.debug("No callbacks on user for "+c)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(c,f)=>{if(c){de.warn(`Error during signin: ${c}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:f.auth,user_data:f.user_data})},this.pusher=s,this.pusher.connection.bind("state_change",({previous:c,current:f})=>{c!=="connected"&&f==="connected"&&this._signin(),c==="connected"&&f!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new Eu(s),this.pusher.connection.bind("message",c=>{var f=c.event;f==="pusher:signin_success"&&this._onSigninSuccess(c.data),this.serverToUserChannel&&this.serverToUserChannel.name===c.channel&&this.serverToUserChannel.handleEvent(c)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(s){try{this.user_data=JSON.parse(s.user_data)}catch(c){de.error(`Failed parsing user data after signin: ${s.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){de.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const s=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new I(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((c,f)=>{c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0||this.emit(c,f)}),s(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:s,resolve:c}=Cu();s.done=!1;const f=()=>{s.done=!0};s.then(f).catch(f),this.signinDonePromise=s,this._signinDoneResolve=c}}class Ne{static ready(){Ne.isReady=!0;for(var s=0,c=Ne.instances.length;s<c;s++)Ne.instances[s].connect()}static getClientFeatures(){return Dt(gn({ws:G.Transports.ws},function(s){return s.isSupported({})}))}constructor(s,c){Ru(s),pu(c),this.key=s,this.options=c,this.config=vi(this.options,this),this.channels=Zt.createChannels(),this.global_emitter=new _t,this.sessionID=G.randomInt(1e9),this.timeline=new au(this.key,this.sessionID,{cluster:this.config.cluster,features:Ne.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:no.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=Zt.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+G.TimelineTransport.name}));var f=b=>G.getDefaultStrategy(this.config,b,uu);this.connection=Zt.createConnectionManager(this.key,{getStrategy:f,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",b=>{var x=b.event,R=x.indexOf("pusher_internal:")===0;if(b.channel){var O=this.channel(b.channel);O&&O.handleEvent(b)}R||this.global_emitter.emit(b.event,b.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",b=>{de.warn(b)}),Ne.instances.push(this),this.timeline.info({instances:Ne.instances.length}),this.user=new Pu(this),Ne.isReady&&this.connect()}switchCluster(s){const{appKey:c,cluster:f}=s;this.key=c,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=vi(this.options,this),this.connection.switchCluster(this.key)}channel(s){return this.channels.find(s)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var s=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new ot(6e4,function(){c.send(s)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(s,c,f){return this.global_emitter.bind(s,c,f),this}unbind(s,c,f){return this.global_emitter.unbind(s,c,f),this}bind_global(s){return this.global_emitter.bind_global(s),this}unbind_global(s){return this.global_emitter.unbind_global(s),this}unbind_all(s){return this.global_emitter.unbind_all(),this}subscribeAll(){var s;for(s in this.channels.channels)this.channels.channels.hasOwnProperty(s)&&this.subscribe(s)}subscribe(s){var c=this.channels.add(s,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(s){var c=this.channels.find(s);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(s),c&&c.subscribed&&c.unsubscribe())}send_event(s,c,f){return this.connection.send_event(s,c,f)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}Ne.instances=[],Ne.isReady=!1,Ne.logToConsole=!1,Ne.Runtime=G,Ne.ScriptReceivers=G.ScriptReceivers,Ne.DependenciesReceivers=G.DependenciesReceivers,Ne.auth_callbacks=G.auth_callbacks;const ro=Ne;function Ru(u){if(u==null)throw"You must pass your app key when you instantiate Pusher."}G.setup(Ne)}},r={};function o(a){var d=r[a];if(d!==void 0)return d.exports;var l=r[a]={exports:{}};return n[a].call(l.exports,l,l.exports,o),l.exports}o.d=(a,d)=>{for(var l in d)o.o(d,l)&&!o.o(a,l)&&Object.defineProperty(a,l,{enumerable:!0,get:d[l]})},o.o=(a,d)=>Object.prototype.hasOwnProperty.call(a,d);var i=o(721);return i})())})(ms)),ms.exports}var Im=Lm();const zm=Rm(Im);let At=null,jn=null;function $m(e){return L(this,null,function*(){return jn||(jn=L(null,null,function*(){const t=e.backendUrl.replace(/\/+$/,""),n=yield No(`${t}/api/settings`,{headers:{Authorization:`Bearer ${e.token}`}});if(!n.ok)throw new Error(`Failed to fetch settings: HTTP ${n.status}`);const r=yield n.json();At=new zm(r.pusher.key,{cluster:r.pusher.cluster||"local",forceTLS:!0,wsHost:r.pusher.wsHost||void 0,wsPort:r.pusher.wssPort,wssPort:r.pusher.wssPort,enabledTransports:r.pusher.wsHost?["ws"]:void 0,channelAuthorization:{customHandler:({socketId:o,channelName:i},a)=>{No(`${t}/api/pusher/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({socket_id:o,channel_name:i})}).then(d=>d.json()).then(d=>a(null,d)).catch(d=>a(d instanceof Error?d:new Error(String(d)),null))}}})}),jn.catch(()=>{jn=null}),jn)})}function Om(e){if(!e||!At)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return At.connection.bind("state_change",n),()=>At==null?void 0:At.connection.unbind("state_change",n)}function Nm(e,t,n){return L(this,null,function*(){if(yield $m(e),!At)return()=>{};const r=At.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(io.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(io.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(io.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(io.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=Om(n.onReconnect);return()=>{r.unbind_all(),At==null||At.unsubscribe(`private-task-${t}`),o==null||o()}})}const Ws="ap-sdk-active-automation";function Dm(){try{const e=sessionStorage.getItem(Ws);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.taskId&&(t!=null&&t.backendUrl)&&(t!=null&&t.title)?t:null}catch(e){return null}}function Ic(e){try{sessionStorage.setItem(Ws,JSON.stringify(e))}catch(t){}}function zc(){try{sessionStorage.removeItem(Ws)}catch(e){}}function Mm(e){return L(this,null,function*(){var i;try{(i=e.focus)==null||i.call(e)}catch(a){}e.scrollIntoView({block:"center",inline:"center",behavior:"instant"});let t=e.getBoundingClientRect();t.width===0&&t.height===0&&(yield Um(),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 Um(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const Js="shared",$c="ap-sdk-panel-size:",ua=280,da=200;function jm(e){try{const t=sessionStorage.getItem($c+e);if(!t)return null;const n=JSON.parse(t);return typeof(n==null?void 0:n.width)=="number"&&typeof(n==null?void 0:n.height)=="number"?n:null}catch(t){return null}}function Zm(e,t){try{sessionStorage.setItem($c+e,JSON.stringify(t))}catch(n){}}function uo(e,t,n){return Math.min(Math.max(e,t),n)}function pa(){return window.innerWidth-32}function ha(){return window.innerHeight-64}function Ys(e,t){const n=jm(t);n&&(e.style.width=`${uo(n.width,ua,pa())}px`,e.style.height=`${uo(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,i=0,a=0,d=0,l=0,p=0,h=0;const g=k=>{o&&(p=uo(d+(k.clientX-i),ua,pa()),h=uo(l+(k.clientY-a),da,ha()),e.style.width=`${p}px`,e.style.height=`${h}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",m),Zm(t,{width:p,height:h}))};r.addEventListener("pointerdown",k=>{k.preventDefault(),k.stopPropagation(),o=!0,i=k.clientX,a=k.clientY;const y=e.getBoundingClientRect();d=y.width,l=y.height,p=d,h=l,document.addEventListener("pointermove",g),document.addEventListener("pointerup",m)})}function Xs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var zn=Xs();function Oc(e){zn=e}var wn={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 V(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(o,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(He.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var qm=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch(t){return!1}})(),He={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}}>`))},Hm=/^(?:[ \t]*(?:\n|$))+/,Fm=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Bm=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Zr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Gm=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Vs=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Nc=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Dc=V(Nc).replace(/bull/g,Vs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Wm=V(Nc).replace(/bull/g,Vs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ks=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Jm=/^[^\n]+/,Qs=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ym=V(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Qs).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Xm=V(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Vs).getRegex(),Qo="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",ei=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Vm=V("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ei).replace("tag",Qo).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Mc=e=>V(Ks).replace("hr",Zr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list",e).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Qo).getRegex(),Km=Mc(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Qm=Mc(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),eb=V(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Qm).getRegex(),ti={blockquote:eb,code:Fm,def:Ym,fences:Bm,heading:Gm,hr:Zr,html:Vm,lheading:Dc,list:Xm,newline:Hm,paragraph:Km,table:wn,text:Jm},fa=V("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Zr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Qo).getRegex(),tb=U(v({},ti),{lheading:Wm,table:fa,paragraph:V(Ks).replace("hr",Zr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",fa).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",Qo).getRegex()}),nb=U(v({},ti),{html:V(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ei).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:wn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:V(Ks).replace("hr",Zr).replace("heading",` *#{1,6} *[^
1366
- ]`).replace("lheading",Dc).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),rb=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ob=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Uc=/^( {2,}|\\)\n(?!\s*$)/,sb=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Yt=/[\p{P}\p{S}]/u,cr=/[\s\p{P}\p{S}]/u,qr=/[^\s\p{P}\p{S}]/u,ib=V(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,cr).getRegex(),ab=/[\p{Pi}\p{Ps}"']/u,jc=/(?!~)[\p{P}\p{S}]/u,cb=/(?!~)[\s\p{P}\p{S}]/u,lb=/(?:[^\s\p{P}\p{S}]|~)/u,ub=V(/link|precode-code|html/,"g").replace("link",new RegExp("\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)")).replace("precode-",qm?"(?<!`)()":"(^^|[^`])").replace("code",new RegExp("(?<b>`+)[^`]+\\k<b>(?!`)")).replace("html",/<(?! )[^<>]*?>/).getRegex(),Zc=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,db=V(Zc,"u").replace(/punct/g,Yt).getRegex(),pb=V(Zc,"u").replace(/punct/g,jc).getRegex(),hb=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,fb=V(hb,"u").replace(/openQuote/g,ab).replace(/punct/g,Yt).getRegex(),qc="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",gb=V(qc,"gu").replace(/notPunctSpace/g,qr).replace(/punctSpace/g,cr).replace(/punct/g,Yt).getRegex(),mb=V(qc,"gu").replace(/notPunctSpace/g,lb).replace(/punctSpace/g,cb).replace(/punct/g,jc).getRegex(),bb="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",kb=V(bb,"gu").replace(/notPunctSpace/g,qr).replace(/punctSpace/g,cr).replace(/punct/g,Yt).getRegex(),_b=V("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,qr).replace(/punctSpace/g,cr).replace(/punct/g,Yt).getRegex(),vb="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",yb=V(vb,"gu").replace(/notPunctSpace/g,qr).replace(/punctSpace/g,cr).replace(/punct/g,Yt).getRegex(),wb=V(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Yt).getRegex(),xb="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Sb=V(xb,"gu").replace(/notPunctSpace/g,qr).replace(/punctSpace/g,cr).replace(/punct/g,Yt).getRegex(),Tb=V(/\\(punct)/,"gu").replace(/punct/g,Yt).getRegex(),Eb=V(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Ab=V(ei).replace("(?:-->|$)","-->").getRegex(),Cb=V("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Ab).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Mo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Pb=V(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Mo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Hc=V(/^!?\[(label)\]\[(ref)\]/).replace("label",Mo).replace("ref",Qs).getRegex(),Fc=V(/^!?\[(ref)\](?:\[\])?/).replace("ref",Qs).getRegex(),Rb=V("reflink|nolink(?!\\()","g").replace("reflink",Hc).replace("nolink",Fc).getRegex(),ga=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ni={_backpedal:wn,anyPunctuation:Tb,autolink:Eb,blockSkip:ub,br:Uc,code:ob,del:wn,delLDelim:wn,delRDelim:wn,emStrongLDelim:db,emStrongRDelimAst:gb,emStrongRDelimUnd:_b,escape:rb,link:Pb,nolink:Fc,punctuation:ib,reflink:Hc,reflinkSearch:Rb,tag:Cb,text:sb,url:wn},Lb=U(v({},ni),{emStrongLDelim:fb,emStrongRDelimAst:kb,emStrongRDelimUnd:yb,link:V(/^!?\[(label)\]\((.*?)\)/).replace("label",Mo).getRegex(),reflink:V(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Mo).getRegex()}),Rs=U(v({},ni),{emStrongRDelimAst:mb,emStrongLDelim:pb,delLDelim:wb,delRDelim:Sb,url:V(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ga).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:V(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ga).getRegex()}),Ib=U(v({},Rs),{br:V(Uc).replace("{2,}","*").getRegex(),text:V(Rs.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),po={normal:ti,gfm:tb,pedantic:nb},xr={normal:ni,gfm:Rs,breaks:Ib,pedantic:Lb},zb={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ma=e=>zb[e];function Pt(e,t){if(t){if(He.escapeTest.test(e))return e.replace(He.escapeReplace,ma)}else if(He.escapeTestNoEncode.test(e))return e.replace(He.escapeReplaceNoEncode,ma);return e}function ba(e){try{e=encodeURI(e).replace(He.percentDecode,"%")}catch(t){return null}return e}function ka(e,t){var i;let n=e.replace(He.findPipe,(a,d,l)=>{let p=!1,h=d;for(;--h>=0&&l[h]==="\\";)p=!p;return p?"|":" |"}),r=n.split(He.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(He.slashPipe,"|");return r}function tn(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 _a(e){let t=e.split(`
1367
- `),n=t.length-1;for(;n>=0&&He.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
1364
+ */var la;function Lm(){return la||(la=1,(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(a,d){var l=this&&this.__extends||(function(){var N=function(T,S){return N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(P,Z){P.__proto__=Z}||function(P,Z){for(var Y in Z)Z.hasOwnProperty(Y)&&(P[Y]=Z[Y])},N(T,S)};return function(T,S){N(T,S);function P(){this.constructor=T}T.prototype=S===null?Object.create(S):(P.prototype=S.prototype,new P)}})();Object.defineProperty(d,"__esModule",{value:!0});var p=256,h=(function(){function N(T){T===void 0&&(T="="),this._paddingCharacter=T}return N.prototype.encodedLength=function(T){return this._paddingCharacter?(T+2)/3*4|0:(T*8+5)/6|0},N.prototype.encode=function(T){for(var S="",P=0;P<T.length-2;P+=3){var Z=T[P]<<16|T[P+1]<<8|T[P+2];S+=this._encodeByte(Z>>>18&63),S+=this._encodeByte(Z>>>12&63),S+=this._encodeByte(Z>>>6&63),S+=this._encodeByte(Z>>>0&63)}var Y=T.length-P;if(Y>0){var Z=T[P]<<16|(Y===2?T[P+1]<<8:0);S+=this._encodeByte(Z>>>18&63),S+=this._encodeByte(Z>>>12&63),Y===2?S+=this._encodeByte(Z>>>6&63):S+=this._paddingCharacter||"",S+=this._paddingCharacter||""}return S},N.prototype.maxDecodedLength=function(T){return this._paddingCharacter?T/4*3|0:(T*6+7)/8|0},N.prototype.decodedLength=function(T){return this.maxDecodedLength(T.length-this._getPaddingLength(T))},N.prototype.decode=function(T){if(T.length===0)return new Uint8Array(0);for(var S=this._getPaddingLength(T),P=T.length-S,Z=new Uint8Array(this.maxDecodedLength(P)),Y=0,he=0,Oe=0,qe=0,te=0,Pe=0,He=0;he<P-4;he+=4)qe=this._decodeChar(T.charCodeAt(he+0)),te=this._decodeChar(T.charCodeAt(he+1)),Pe=this._decodeChar(T.charCodeAt(he+2)),He=this._decodeChar(T.charCodeAt(he+3)),Z[Y++]=qe<<2|te>>>4,Z[Y++]=te<<4|Pe>>>2,Z[Y++]=Pe<<6|He,Oe|=qe&p,Oe|=te&p,Oe|=Pe&p,Oe|=He&p;if(he<P-1&&(qe=this._decodeChar(T.charCodeAt(he)),te=this._decodeChar(T.charCodeAt(he+1)),Z[Y++]=qe<<2|te>>>4,Oe|=qe&p,Oe|=te&p),he<P-2&&(Pe=this._decodeChar(T.charCodeAt(he+2)),Z[Y++]=te<<4|Pe>>>2,Oe|=Pe&p),he<P-3&&(He=this._decodeChar(T.charCodeAt(he+3)),Z[Y++]=Pe<<6|He,Oe|=He&p),Oe!==0)throw new Error("Base64Coder: incorrect characters for decoding");return Z},N.prototype._encodeByte=function(T){var S=T;return S+=65,S+=25-T>>>8&6,S+=51-T>>>8&-75,S+=61-T>>>8&-15,S+=62-T>>>8&3,String.fromCharCode(S)},N.prototype._decodeChar=function(T){var S=p;return S+=(42-T&T-44)>>>8&-p+T-43+62,S+=(46-T&T-48)>>>8&-p+T-47+63,S+=(47-T&T-58)>>>8&-p+T-48+52,S+=(64-T&T-91)>>>8&-p+T-65+0,S+=(96-T&T-123)>>>8&-p+T-97+26,S},N.prototype._getPaddingLength=function(T){var S=0;if(this._paddingCharacter){for(var P=T.length-1;P>=0&&T[P]===this._paddingCharacter;P--)S++;if(T.length<4||S>2)throw new Error("Base64Coder: incorrect padding")}return S},N})();d.Coder=h;var g=new h;function m(N){return g.encode(N)}d.encode=m;function k(N){return g.decode(N)}d.decode=k;var y=(function(N){l(T,N);function T(){return N!==null&&N.apply(this,arguments)||this}return T.prototype._encodeByte=function(S){var P=S;return P+=65,P+=25-S>>>8&6,P+=51-S>>>8&-75,P+=61-S>>>8&-13,P+=62-S>>>8&49,String.fromCharCode(P)},T.prototype._decodeChar=function(S){var P=p;return P+=(44-S&S-46)>>>8&-p+S-45+62,P+=(94-S&S-96)>>>8&-p+S-95+63,P+=(47-S&S-58)>>>8&-p+S-48+52,P+=(64-S&S-91)>>>8&-p+S-65+0,P+=(96-S&S-123)>>>8&-p+S-97+26,P},T})(h);d.URLSafeCoder=y;var E=new y;function j(N){return E.encode(N)}d.encodeURLSafe=j;function Q(N){return E.decode(N)}d.decodeURLSafe=Q,d.encodedLength=function(N){return g.encodedLength(N)},d.maxDecodedLength=function(N){return g.maxDecodedLength(N)},d.decodedLength=function(N){return g.decodedLength(N)}},978(a,d){var l="utf8: invalid source encoding";function p(h){for(var g=[],m=0;m<h.length;m++){var k=h[m];if(k&128){var y=void 0;if(k<224){if(m>=h.length)throw new Error(l);var E=h[++m];if((E&192)!==128)throw new Error(l);k=(k&31)<<6|E&63,y=128}else if(k<240){if(m>=h.length-1)throw new Error(l);var E=h[++m],j=h[++m];if((E&192)!==128||(j&192)!==128)throw new Error(l);k=(k&15)<<12|(E&63)<<6|j&63,y=2048}else if(k<248){if(m>=h.length-2)throw new Error(l);var E=h[++m],j=h[++m],Q=h[++m];if((E&192)!==128||(j&192)!==128||(Q&192)!==128)throw new Error(l);k=(k&15)<<18|(E&63)<<12|(j&63)<<6|Q&63,y=65536}else throw new Error(l);if(k<y||k>=55296&&k<=57343)throw new Error(l);if(k>=65536){if(k>1114111)throw new Error(l);k-=65536,g.push(String.fromCharCode(55296|k>>10)),k=56320|k&1023}}g.push(String.fromCharCode(k))}return g.join("")}d.D4=p},721(a,d,l){a.exports=l(207).default},207(a,d,l){l.d(d,{default:()=>ro});class p{constructor(s,c){this.lastId=0,this.prefix=s,this.name=c}create(s){this.lastId++;var c=this.lastId,f=this.prefix+c,b=this.name+"["+c+"]",x=!1,R=function(){x||(s.apply(null,arguments),x=!0)};return this[c]=R,{number:c,id:f,name:b,callback:R}}remove(s){delete this[s.number]}}var h=new p("_pusher_script_","Pusher.ScriptReceivers"),g={VERSION:"8.5.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""};const m=g;class k{constructor(s){this.options=s,this.receivers=s.receivers||h,this.loading={}}load(s,c,f){var b=this;if(b.loading[s]&&b.loading[s].length>0)b.loading[s].push(f);else{b.loading[s]=[f];var x=G.createScriptRequest(b.getPath(s,c)),R=b.receivers.create(function(O){if(b.receivers.remove(R),b.loading[s]){var B=b.loading[s];delete b.loading[s];for(var ee=function(Ee){Ee||x.cleanup()},oe=0;oe<B.length;oe++)B[oe](O,ee)}});x.send(R)}}getRoot(s){var c,f=G.getDocument().location.protocol;return s&&s.useTLS||f==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(s,c){return this.getRoot(c)+"/"+s+this.options.suffix+".js"}}var y=new p("_pusher_dependencies","Pusher.DependenciesReceivers"),E=new k({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:y});const j={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"}}},N={buildLogSuffix:function(u){const s="See:",c=j.urls[u];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=j.baseUrl+c.path),f?`${s} ${f}`:""}};var T;(function(u){u.UserAuthentication="user-authentication",u.ChannelAuthorization="channel-authorization"})(T||(T={}));class S extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class P extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Z extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Y extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class he extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Oe extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class qe extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class te extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Pe extends Error{constructor(s,c){super(c),this.status=s,Object.setPrototypeOf(this,new.target.prototype)}}const Ct=function(u,s,c,f,b){const x=G.createXHR();x.open("POST",c.endpoint,!0),x.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var R in c.headers)x.setRequestHeader(R,c.headers[R]);if(c.headersProvider!=null){let O=c.headersProvider();for(var R in O)x.setRequestHeader(R,O[R])}return x.onreadystatechange=function(){if(x.readyState===4)if(x.status===200){let O,B=!1;try{O=JSON.parse(x.responseText),B=!0}catch(ee){b(new Pe(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${x.responseText}`),null)}B&&b(null,O)}else{let O="";switch(f){case T.UserAuthentication:O=N.buildLogSuffix("authenticationEndpoint");break;case T.ChannelAuthorization:O=`Clients must be authorized to join private or presence channels. ${N.buildLogSuffix("authorizationEndpoint")}`;break}b(new Pe(x.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${x.status} from ${c.endpoint}. ${O}`),null)}},x.send(s),x};function fn(u){return ve(Kt(u))}var Pt=String.fromCharCode,mt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Rt=function(u){var s=u.charCodeAt(0);return s<128?u:s<2048?Pt(192|s>>>6)+Pt(128|s&63):Pt(224|s>>>12&15)+Pt(128|s>>>6&63)+Pt(128|s&63)},Kt=function(u){return u.replace(/[^\x00-\x7F]/g,Rt)},bt=function(u){var s=[0,2,1][u.length%3],c=u.charCodeAt(0)<<16|(u.length>1?u.charCodeAt(1):0)<<8|(u.length>2?u.charCodeAt(2):0),f=[mt.charAt(c>>>18),mt.charAt(c>>>12&63),s>=2?"=":mt.charAt(c>>>6&63),s>=1?"=":mt.charAt(c&63)];return f.join("")},ve=window.btoa||function(u){return u.replace(/[\s\S]{1,3}/g,bt)};class gn{constructor(s,c,f,b){this.clear=c,this.timer=s(()=>{this.timer&&(this.timer=b(this.timer))},f)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const ye=gn;function W(u){window.clearTimeout(u)}function H(u){window.clearInterval(u)}class re extends ye{constructor(s,c){super(setTimeout,W,s,function(f){return c(),null})}}class Ne extends ye{constructor(s,c){super(setInterval,H,s,function(f){return c(),f})}}var We={now(){return Date.now?Date.now():new Date().valueOf()},defer(u){return new re(0,u)},method(u,...s){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[u].apply(f,c.concat(arguments))}}};const le=We;function Se(u,...s){for(var c=0;c<s.length;c++){var f=s[c];for(var b in f)f[b]&&f[b].constructor&&f[b].constructor===Object?u[b]=Se(u[b]||{},f[b]):u[b]=f[b]}return u}function mn(){for(var u=["Pusher"],s=0;s<arguments.length;s++)typeof arguments[s]=="string"?u.push(arguments[s]):u.push(Ye(arguments[s]));return u.join(" : ")}function De(u,s){var c=Array.prototype.indexOf;if(u===null)return-1;if(c&&u.indexOf===c)return u.indexOf(s);for(var f=0,b=u.length;f<b;f++)if(u[f]===s)return f;return-1}function ue(u,s){for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&s(u[c],c,u)}function ze(u){var s=[];return ue(u,function(c,f){s.push(f)}),s}function Re(u){var s=[];return ue(u,function(c){s.push(c)}),s}function kt(u,s,c){for(var f=0;f<u.length;f++)s.call(c||window,u[f],f,u)}function Fe(u,s){for(var c=[],f=0;f<u.length;f++)c.push(s(u[f],f,u,c));return c}function Je(u,s){var c={};return ue(u,function(f,b){c[b]=s(f)}),c}function Lt(u,s){s=s||function(b){return!!b};for(var c=[],f=0;f<u.length;f++)s(u[f],f,u,c)&&c.push(u[f]);return c}function at(u,s){var c={};return ue(u,function(f,b){(s&&s(f,b,u,c)||f)&&(c[b]=f)}),c}function Hr(u){var s=[];return ue(u,function(c,f){s.push([f,c])}),s}function ur(u,s){for(var c=0;c<u.length;c++)if(s(u[c],c,u))return!0;return!1}function es(u,s){for(var c=0;c<u.length;c++)if(!s(u[c],c,u))return!1;return!0}function dr(u){return Je(u,function(s){return typeof s=="object"&&(s=Ye(s)),encodeURIComponent(fn(s.toString()))})}function bn(u){var s=at(u,function(f){return f!==void 0}),c=Fe(Hr(dr(s)),le.method("join","=")).join("&");return c}function Qt(u){var s=[],c=[];return(function f(b,x){var R,O,B;switch(typeof b){case"object":if(!b)return null;for(R=0;R<s.length;R+=1)if(s[R]===b)return{$ref:c[R]};if(s.push(b),c.push(x),Object.prototype.toString.apply(b)==="[object Array]")for(B=[],R=0;R<b.length;R+=1)B[R]=f(b[R],x+"["+R+"]");else{B={};for(O in b)Object.prototype.hasOwnProperty.call(b,O)&&(B[O]=f(b[O],x+"["+JSON.stringify(O)+"]"))}return B;case"number":case"string":case"boolean":return b}})(u,"$")}function Ye(u){try{return JSON.stringify(u)}catch(s){return JSON.stringify(Qt(u))}}class pr{constructor(){this.globalLog=s=>{window.console&&window.console.log&&window.console.log(s)}}debug(...s){this.log(this.globalLog,s)}warn(...s){this.log(this.globalLogWarn,s)}error(...s){this.log(this.globalLogError,s)}globalLogWarn(s){window.console&&window.console.warn?window.console.warn(s):this.globalLog(s)}globalLogError(s){window.console&&window.console.error?window.console.error(s):this.globalLogWarn(s)}log(s,...c){var f=mn.apply(this,arguments);ro.log?ro.log(f):ro.logToConsole&&s.bind(this)(f)}}const de=new pr;var Fr=function(u,s,c,f,b){(c.headers!==void 0||c.headersProvider!=null)&&de.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var x=u.nextAuthCallbackID.toString();u.nextAuthCallbackID++;var R=u.getDocument(),O=R.createElement("script");u.auth_callbacks[x]=function(oe){b(null,oe)};var B="Pusher.auth_callbacks['"+x+"']";O.src=c.endpoint+"?callback="+encodeURIComponent(B)+"&"+s;var ee=R.getElementsByTagName("head")[0]||R.documentElement;ee.insertBefore(O,ee.firstChild)};const hr=Fr;class Br{constructor(s){this.src=s}send(s){var c=this,f="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=s.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){s.callback(f)},c.script.onload=function(){s.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&s.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=s.id+"_error",c.errorScript.text=s.name+"('"+f+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var b=document.getElementsByTagName("head")[0];b.insertBefore(c.script,b.firstChild),c.errorScript&&b.insertBefore(c.errorScript,c.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class On{constructor(s,c){this.url=s,this.data=c}send(s){if(!this.request){var c=bn(this.data),f=this.url+"/"+s.number+"?"+c;this.request=G.createScriptRequest(f),this.request.send(s)}}cleanup(){this.request&&this.request.cleanup()}}var Nn=function(u,s){return function(c,f){var b="http"+(s?"s":"")+"://",x=b+(u.host||u.options.host)+u.options.path,R=G.createJSONPRequest(x,c),O=G.ScriptReceivers.create(function(B,ee){h.remove(O),R.cleanup(),ee&&ee.host&&(u.host=ee.host),f&&f(B,ee)});R.send(O)}},_t={name:"jsonp",getAgent:Nn};const en=_t;function kn(u,s,c){var f=u+(s.useTLS?"s":""),b=s.useTLS?s.hostTLS:s.hostNonTLS;return f+"://"+b+c}function _n(u,s){var c="/app/"+u,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(s?"&"+s:"");return c+f}var ts={getInitial:function(u,s){var c=(s.httpPath||"")+_n(u,"flash=false");return kn("ws",s,c)}},Dn={getInitial:function(u,s){var c=(s.httpPath||"/pusher")+_n(u);return kn("http",s,c)}},Mn={getInitial:function(u,s){return kn("http",s,s.httpPath||"/pusher")},getPath:function(u,s){return _n(u)}};class ns{constructor(){this._callbacks={}}get(s){return this._callbacks[Zt(s)]}add(s,c,f){var b=Zt(s);this._callbacks[b]=this._callbacks[b]||[],this._callbacks[b].push({fn:c,context:f})}remove(s,c,f){if(!s&&!c&&!f){this._callbacks={};return}var b=s?[Zt(s)]:ze(this._callbacks);c||f?this.removeCallback(b,c,f):this.removeAllCallbacks(b)}removeCallback(s,c,f){kt(s,function(b){this._callbacks[b]=Lt(this._callbacks[b]||[],function(x){return c&&c!==x.fn||f&&f!==x.context}),this._callbacks[b].length===0&&delete this._callbacks[b]},this)}removeAllCallbacks(s){kt(s,function(c){delete this._callbacks[c]},this)}}function Zt(u){return"_"+u}class vt{constructor(s){this.callbacks=new ns,this.global_callbacks=[],this.failThrough=s}bind(s,c,f){return this.callbacks.add(s,c,f),this}bind_global(s){return this.global_callbacks.push(s),this}unbind(s,c,f){return this.callbacks.remove(s,c,f),this}unbind_global(s){return s?(this.global_callbacks=Lt(this.global_callbacks||[],c=>c!==s),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(s,c,f){for(var b=0;b<this.global_callbacks.length;b++)this.global_callbacks[b](s,c);var x=this.callbacks.get(s),R=[];if(f?R.push(c,f):c&&R.push(c),x&&x.length>0)for(var b=0;b<x.length;b++)x[b].fn.apply(x[b].context||window,R);else this.failThrough&&this.failThrough(s,c);return this}}class rs extends vt{constructor(s,c,f,b,x){super(),this.initialize=G.transportConnectionInitializer,this.hooks=s,this.name=c,this.priority=f,this.key=b,this.options=x,this.state="new",this.timeline=x.timeline,this.activityTimeout=x.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var s=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(s,this.options)}catch(c){return le.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),de.debug("Connecting",{transport:this.name,url:s}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(s){return this.state==="open"?(le.defer(()=>{this.socket&&this.socket.send(s)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(s){this.emit("error",{type:"WebSocketError",error:s}),this.timeline.error(this.buildTimelineMessage({error:s.toString()}))}onClose(s){s?this.changeState("closed",{code:s.code,reason:s.reason,wasClean:s.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(s){this.emit("message",s)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=s=>{this.onError(s)},this.socket.onclose=s=>{this.onClose(s)},this.socket.onmessage=s=>{this.onMessage(s)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(s,c){this.state=s,this.timeline.info(this.buildTimelineMessage({state:s,params:c})),this.emit(s,c)}buildTimelineMessage(s){return Se({cid:this.id},s)}}class pe{constructor(s){this.hooks=s}isSupported(s){return this.hooks.isSupported(s)}createConnection(s,c,f,b){return new rs(this.hooks,s,c,f,b)}}var tn=new pe({urls:ts,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!G.getWebSocketAPI()},isSupported:function(){return!!G.getWebSocketAPI()},getSocket:function(u){return G.createWebSocket(u)}}),Gr={urls:Dn,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},fr=Se({getSocket:function(u){return G.HTTPFactory.createStreamingSocket(u)}},Gr),Un=Se({getSocket:function(u){return G.HTTPFactory.createPollingSocket(u)}},Gr),gr={isSupported:function(){return G.isXHRSupported()}},Wr=new pe(Se({},fr,gr)),os=new pe(Se({},Un,gr)),ct={ws:tn,xhr_streaming:Wr,xhr_polling:os};const lt=ct;var Jr=new pe({file:"sockjs",urls:Mn,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(u,s){return new window.SockJS(u,null,{js_path:E.getPath("sockjs",{useTLS:s.useTLS}),ignore_null_origin:s.ignoreNullOrigin})},beforeOpen:function(u,s){u.send(JSON.stringify({path:s}))}}),mr={isSupported:function(u){var s=G.isXDRSupported(u.useTLS);return s}},br=new pe(Se({},fr,mr)),Yr=new pe(Se({},Un,mr));lt.xdr_streaming=br,lt.xdr_polling=Yr,lt.sockjs=Jr;const yt=lt;class Xr extends vt{constructor(){super();var s=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){s.emit("online")},!1),window.addEventListener("offline",function(){s.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Vr=new Xr;class Kr{constructor(s,c,f){this.manager=s,this.transport=c,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(s,c,f,b){b=Se({},b,{activityTimeout:this.pingDelay});var x=this.transport.createConnection(s,c,f,b),R=null,O=function(){x.unbind("open",O),x.bind("closed",B),R=le.now()},B=ee=>{if(x.unbind("closed",B),ee.code===1002||ee.code===1003)this.manager.reportDeath();else if(!ee.wasClean&&R){var oe=le.now()-R;oe<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(oe/2,this.minPingDelay))}};return x.bind("open",O),x}isSupported(s){return this.manager.isAlive()&&this.transport.isSupported(s)}}const kr={decodeMessage:function(u){try{var s=JSON.parse(u.data),c=s.data;if(typeof c=="string")try{c=JSON.parse(s.data)}catch(b){}var f={event:s.event,channel:s.channel,data:c};return s.user_id&&(f.user_id=s.user_id),f}catch(b){throw{type:"MessageParseError",error:b,data:u.data}}},encodeMessage:function(u){return JSON.stringify(u)},processHandshake:function(u){var s=kr.decodeMessage(u);if(s.event==="pusher:connection_established"){if(!s.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:s.data.socket_id,activityTimeout:s.data.activity_timeout*1e3}}else{if(s.event==="pusher:error")return{action:this.getCloseAction(s.data),error:this.getCloseError(s.data)};throw"Invalid handshake"}},getCloseAction:function(u){return u.code<4e3?u.code>=1002&&u.code<=1004?"backoff":null:u.code===4e3?"tls_only":u.code<4100?"refused":u.code<4200?"backoff":u.code<4300?"retry":"refused"},getCloseError:function(u){return u.code!==1e3&&u.code!==1001?{type:"PusherError",data:{code:u.code,message:u.reason||u.message}}:null}},qt=kr;class D extends vt{constructor(s,c){super(),this.id=s,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(s){return this.transport.send(s)}send_event(s,c,f){var b={event:s,data:c};return f&&(b.channel=f),de.debug("Event sent",b),this.send(qt.encodeMessage(b))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var s={message:f=>{var b;try{b=qt.decodeMessage(f)}catch(x){this.emit("error",{type:"MessageParseError",error:x,data:f.data})}if(b!==void 0){switch(de.debug("Event recd",b),b.event){case"pusher:error":this.emit("error",{type:"PusherError",data:b.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",b)}},activity:()=>{this.emit("activity")},error:f=>{this.emit("error",f)},closed:f=>{c(),f&&f.code&&this.handleCloseEvent(f),this.transport=null,this.emit("closed")}},c=()=>{ue(s,(f,b)=>{this.transport.unbind(b,f)})};ue(s,(f,b)=>{this.transport.bind(b,f)})}handleCloseEvent(s){var c=qt.getCloseAction(s),f=qt.getCloseError(s);f&&this.emit("error",f),c&&this.emit(c,{action:c,error:f})}}class _{constructor(s,c){this.transport=s,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=s=>{this.unbindListeners();var c;try{c=qt.processHandshake(s)}catch(f){this.finish("error",{error:f}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new D(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=s=>{this.unbindListeners();var c=qt.getCloseAction(s)||"backoff",f=qt.getCloseError(s);this.finish(c,{error:f})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(s,c){this.callback(Se({transport:this.transport,action:s},c))}}class A{constructor(s,c){this.timeline=s,this.options=c||{}}send(s,c){this.timeline.isEmpty()||this.timeline.send(G.TimelineTransport.getAgent(this,s),c)}}class I extends vt{constructor(s,c){super(function(f,b){de.debug("No callbacks on "+s+" for "+f)}),this.name=s,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(s,c){return c(null,{auth:""})}trigger(s,c){if(s.indexOf("client-")!==0)throw new S("Event '"+s+"' does not start with 'client-'");if(!this.subscribed){var f=N.buildLogSuffix("triggeringClientEvents");de.warn(`Client event triggered before channel 'subscription_succeeded' event . ${f}`)}return this.pusher.send_event(s,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(s){var c=s.event,f=s.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(s);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(s);else if(c.indexOf("pusher_internal:")!==0){var b={};this.emit(c,f,b)}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",s.data)}handleSubscriptionCountEvent(s){s.data.subscription_count&&(this.subscriptionCount=s.data.subscription_count),this.emit("pusher:subscription_count",s.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(s,c)=>{s?(this.subscriptionPending=!1,de.error(s.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:s.message},s instanceof Pe?{status:s.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:c.auth,channel_data:c.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class se extends I{authorize(s,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:s},c)}}class $e{constructor(){this.reset()}get(s){return Object.prototype.hasOwnProperty.call(this.members,s)?{id:s,info:this.members[s]}:null}each(s){ue(this.members,(c,f)=>{s(this.get(f))})}setMyID(s){this.myID=s}onSubscription(s){this.members=s.presence.hash,this.count=s.presence.count,this.me=this.get(this.myID)}addMember(s){return this.get(s.user_id)===null&&this.count++,this.members[s.user_id]=s.user_info,this.get(s.user_id)}removeMember(s){var c=this.get(s.user_id);return c&&(delete this.members[s.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var xe=function(u,s,c,f){function b(x){return x instanceof c?x:new c(function(R){R(x)})}return new(c||(c=Promise))(function(x,R){function O(oe){try{ee(f.next(oe))}catch(Ee){R(Ee)}}function B(oe){try{ee(f.throw(oe))}catch(Ee){R(Ee)}}function ee(oe){oe.done?x(oe.value):b(oe.value).then(O,B)}ee((f=f.apply(u,s||[])).next())})};class Be extends se{constructor(s,c){super(s,c),this.members=new $e}authorize(s,c){super.authorize(s,(f,b)=>xe(this,void 0,void 0,function*(){if(!f)if(b=b,b.channel_data!=null){var x=JSON.parse(b.channel_data);this.members.setMyID(x.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let R=N.buildLogSuffix("authorizationEndpoint");de.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${R}, or the user should be signed in.`),c("Invalid auth response");return}c(f,b)}))}handleEvent(s){var c=s.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(s);else{var f=s.data,b={};s.user_id&&(b.user_id=s.user_id),this.emit(c,f,b)}}handleInternalEvent(s){var c=s.event,f=s.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(s);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(s);break;case"pusher_internal:member_added":var b=this.members.addMember(f);this.emit("pusher:member_added",b);break;case"pusher_internal:member_removed":var x=this.members.removeMember(f);x&&this.emit("pusher:member_removed",x);break}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(s.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var wt=l(978),It=l(594);class _r extends se{constructor(s,c,f){super(s,c),this.key=null,this.nacl=f}authorize(s,c){super.authorize(s,(f,b)=>{if(f){c(f,b);return}let x=b.shared_secret;if(!x){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,It.decode)(x),delete b.shared_secret,c(null,b)})}trigger(s,c){throw new Oe("Client events are not currently supported for encrypted channels")}handleEvent(s){var c=s.event,f=s.data;if(c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0){super.handleEvent(s);return}this.handleEncryptedEvent(c,f)}handleEncryptedEvent(s,c){if(!this.key){de.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){de.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let f=(0,It.decode)(c.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){de.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let b=(0,It.decode)(c.nonce);if(b.length<this.nacl.secretbox.nonceLength){de.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${b.length}`);return}let x=this.nacl.secretbox.open(f,b,this.key);if(x===null){de.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(R,O)=>{if(R){de.error(`Failed to make a request to the authEndpoint: ${O}. Unable to fetch new key, so dropping encrypted event`);return}if(x=this.nacl.secretbox.open(f,b,this.key),x===null){de.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(s,this.getDataToEmit(x))});return}this.emit(s,this.getDataToEmit(x))}getDataToEmit(s){let c=(0,wt.D4)(s);try{return JSON.parse(c)}catch(f){return c}}}class Le extends vt{constructor(s,c){super(),this.state="initialized",this.connection=null,this.key=s,this.options=c,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var f=G.getNetwork();f.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),f.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(s){this.key=s,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(s){return this.connection?this.connection.send(s):!1}send_event(s,c,f){return this.connection?this.connection.send_event(s,c,f):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var s=(c,f)=>{c?this.runner=this.strategy.connect(0,s):f.action==="error"?(this.emit("error",{type:"HandshakeError",error:f.error}),this.timeline.error({handshakeError:f.error})):(this.abortConnecting(),this.handshakeCallbacks[f.action](f))};this.runner=this.strategy.connect(0,s)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var s=this.abandonConnection();s.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(s){this.timeline.info({action:"retry",delay:s}),s>0&&this.emit("connecting_in",Math.round(s/1e3)),this.retryTimer=new re(s||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new re(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new re(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 re(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(s){return Se({},s,{message:c=>{this.resetActivityCheck(),this.emit("message",c)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:c=>{this.emit("error",c)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(s){return Se({},s,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let s=c=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),c(f)};return{tls_only:s(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:s(()=>{this.disconnect()}),backoff:s(()=>{this.retryIn(1e3)}),retry:s(()=>{this.retryIn(0)})}}setConnection(s){this.connection=s;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var s in this.connectionCallbacks)this.connection.unbind(s,this.connectionCallbacks[s]);var c=this.connection;return this.connection=null,c}}updateState(s,c){var f=this.state;if(this.state=s,f!==s){var b=s;b==="connected"&&(b+=" with new socket ID "+c.socket_id),de.debug("State changed",f+" -> "+b),this.timeline.info({state:s,params:c}),this.emit("state_change",{previous:f,current:s}),this.emit(s,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class Qr{constructor(){this.channels={}}add(s,c){return this.channels[s]||(this.channels[s]=eo(s,c)),this.channels[s]}all(){return Re(this.channels)}find(s){return this.channels[s]}remove(s){var c=this.channels[s];return delete this.channels[s],c}disconnect(){ue(this.channels,function(s){s.disconnect()})}}function eo(u,s){if(u.indexOf("private-encrypted-")===0){if(s.config.nacl)return Ht.createEncryptedChannel(u,s,s.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=N.buildLogSuffix("encryptedChannelSupport");throw new Oe(`${c}. ${f}`)}else{if(u.indexOf("private-")===0)return Ht.createPrivateChannel(u,s);if(u.indexOf("presence-")===0)return Ht.createPresenceChannel(u,s);if(u.indexOf("#")===0)throw new P('Cannot create a channel with name "'+u+'".');return Ht.createChannel(u,s)}}var Ll={createChannels(){return new Qr},createConnectionManager(u,s){return new Le(u,s)},createChannel(u,s){return new I(u,s)},createPrivateChannel(u,s){return new se(u,s)},createPresenceChannel(u,s){return new Be(u,s)},createEncryptedChannel(u,s,c){return new _r(u,s,c)},createTimelineSender(u,s){return new A(u,s)},createHandshake(u,s){return new _(u,s)},createAssistantToTheTransportManager(u,s,c){return new Kr(u,s,c)}};const Ht=Ll;class fi{constructor(s){this.options=s||{},this.livesLeft=this.options.lives||1/0}getAssistant(s){return Ht.createAssistantToTheTransportManager(this,s,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class vn{constructor(s,c){this.strategies=s,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return ur(this.strategies,le.method("isSupported"))}connect(s,c){var f=this.strategies,b=0,x=this.timeout,R=null,O=(B,ee)=>{ee?c(null,ee):(b=b+1,this.loop&&(b=b%f.length),b<f.length?(x&&(x=x*2,this.timeoutLimit&&(x=Math.min(x,this.timeoutLimit))),R=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},O)):c(!0))};return R=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},O),{abort:function(){R.abort()},forceMinPriority:function(B){s=B,R&&R.forceMinPriority(B)}}}tryStrategy(s,c,f,b){var x=null,R=null;return f.timeout>0&&(x=new re(f.timeout,function(){R.abort(),b(!0)})),R=s.connect(c,function(O,B){O&&x&&x.isRunning()&&!f.failFast||(x&&x.ensureAborted(),b(O,B))}),{abort:function(){x&&x.ensureAborted(),R.abort()},forceMinPriority:function(O){R.forceMinPriority(O)}}}}class ss{constructor(s){this.strategies=s}isSupported(){return ur(this.strategies,le.method("isSupported"))}connect(s,c){return Il(this.strategies,s,function(f,b){return function(x,R){if(b[f].error=x,x){zl(b)&&c(!0);return}kt(b,function(O){O.forceMinPriority(R.transport.priority)}),c(null,R)}})}}function Il(u,s,c){var f=Fe(u,function(b,x,R,O){return b.connect(s,c(x,O))});return{abort:function(){kt(f,$l)},forceMinPriority:function(b){kt(f,function(x){x.forceMinPriority(b)})}}}function zl(u){return es(u,function(s){return!!s.error})}function $l(u){!u.error&&!u.aborted&&(u.abort(),u.aborted=!0)}class Ol{constructor(s,c,f){this.strategy=s,this.transports=c,this.ttl=f.ttl||18e5,this.usingTLS=f.useTLS,this.timeline=f.timeline}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.usingTLS,b=Nl(f),x=b&&b.cacheSkipCount?b.cacheSkipCount:0,R=[this.strategy];if(b&&b.timestamp+this.ttl>=le.now()){var O=this.transports[b.transport];O&&(["ws","wss"].includes(b.transport)||x>3?(this.timeline.info({cached:!0,transport:b.transport,latency:b.latency}),R.push(new vn([O],{timeout:b.latency*2+1e3,failFast:!0}))):x++)}var B=le.now(),ee=R.pop().connect(s,function oe(Ee,oo){Ee?(gi(f),R.length>0?(B=le.now(),ee=R.pop().connect(s,oe)):c(Ee)):(Dl(f,oo.transport.name,le.now()-B,x),c(null,oo))});return{abort:function(){ee.abort()},forceMinPriority:function(oe){s=oe,ee&&ee.forceMinPriority(oe)}}}}function is(u){return"pusherTransport"+(u?"TLS":"NonTLS")}function Nl(u){var s=G.getLocalStorage();if(s)try{var c=s[is(u)];if(c)return JSON.parse(c)}catch(f){gi(u)}return null}function Dl(u,s,c,f){var b=G.getLocalStorage();if(b)try{b[is(u)]=Ye({timestamp:le.now(),transport:s,latency:c,cacheSkipCount:f})}catch(x){}}function gi(u){var s=G.getLocalStorage();if(s)try{delete s[is(u)]}catch(c){}}class to{constructor(s,{delay:c}){this.strategy=s,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy,b,x=new re(this.options.delay,function(){b=f.connect(s,c)});return{abort:function(){x.ensureAborted(),b&&b.abort()},forceMinPriority:function(R){s=R,b&&b.forceMinPriority(R)}}}}class vr{constructor(s,c,f){this.test=s,this.trueBranch=c,this.falseBranch=f}isSupported(){var s=this.test()?this.trueBranch:this.falseBranch;return s.isSupported()}connect(s,c){var f=this.test()?this.trueBranch:this.falseBranch;return f.connect(s,c)}}class Ml{constructor(s){this.strategy=s}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy.connect(s,function(b,x){x&&f.abort(),c(b,x)});return f}}function yr(u){return function(){return u.isSupported()}}var Ul=function(u,s,c){var f={};function b(Ci,Nu,Du,Mu,Uu){var Pi=c(u,Ci,Nu,Du,Mu,Uu);return f[Ci]=Pi,Pi}var x=Object.assign({},s,{hostNonTLS:u.wsHost+":"+u.wsPort,hostTLS:u.wsHost+":"+u.wssPort,httpPath:u.wsPath}),R=Object.assign({},x,{useTLS:!0}),O=Object.assign({},s,{hostNonTLS:u.httpHost+":"+u.httpPort,hostTLS:u.httpHost+":"+u.httpsPort,httpPath:u.httpPath}),B={loop:!0,timeout:15e3,timeoutLimit:6e4},ee=new fi({minPingDelay:1e4,maxPingDelay:u.activityTimeout}),oe=new fi({lives:2,minPingDelay:1e4,maxPingDelay:u.activityTimeout}),Ee=b("ws","ws",3,x,ee),oo=b("wss","ws",3,R,ee),Lu=b("sockjs","sockjs",1,O),wi=b("xhr_streaming","xhr_streaming",1,O,oe),Iu=b("xdr_streaming","xdr_streaming",1,O,oe),xi=b("xhr_polling","xhr_polling",1,O),zu=b("xdr_polling","xdr_polling",1,O),Si=new vn([Ee],B),$u=new vn([oo],B),Ou=new vn([Lu],B),Ti=new vn([new vr(yr(wi),wi,Iu)],B),Ei=new vn([new vr(yr(xi),xi,zu)],B),Ai=new vn([new vr(yr(Ti),new ss([Ti,new to(Ei,{delay:4e3})]),Ei)],B),ls=new vr(yr(Ai),Ai,Ou),us;return s.useTLS?us=new ss([Si,new to(ls,{delay:2e3})]):us=new ss([Si,new to($u,{delay:2e3}),new to(ls,{delay:5e3})]),new Ol(new Ml(new vr(yr(Ee),us,ls)),f,{ttl:18e5,timeline:s.timeline,useTLS:s.useTLS})};const jl=Ul;function Zl(){var u=this;u.timeline.info(u.buildTimelineMessage({transport:u.name+(u.options.useTLS?"s":"")})),u.hooks.isInitialized()?u.changeState("initialized"):u.hooks.file?(u.changeState("initializing"),E.load(u.hooks.file,{useTLS:u.options.useTLS},function(s,c){u.hooks.isInitialized()?(u.changeState("initialized"),c(!0)):(s&&u.onError(s),u.onClose(),c(!1))})):u.onClose()}var ql={getRequest:function(u){var s=new window.XDomainRequest;return s.ontimeout=function(){u.emit("error",new Z),u.close()},s.onerror=function(c){u.emit("error",c),u.close()},s.onprogress=function(){s.responseText&&s.responseText.length>0&&u.onChunk(200,s.responseText)},s.onload=function(){s.responseText&&s.responseText.length>0&&u.onChunk(200,s.responseText),u.emit("finished",200),u.close()},s},abortRequest:function(u){u.ontimeout=u.onerror=u.onprogress=u.onload=null,u.abort()}};const Hl=ql,Fl=256*1024;class Bl extends vt{constructor(s,c,f){super(),this.hooks=s,this.method=c,this.url=f}start(s){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},G.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(s)}close(){this.unloader&&(G.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(s,c){for(;;){var f=this.advanceBuffer(c);if(f)this.emit("chunk",{status:s,data:f});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(s){var c=s.slice(this.position),f=c.indexOf(`
1365
+ `);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(s){return this.position===s.length&&s.length>Fl}}var as;(function(u){u[u.CONNECTING=0]="CONNECTING",u[u.OPEN=1]="OPEN",u[u.CLOSED=3]="CLOSED"})(as||(as={}));const yn=as;var Gl=1;class Wl{constructor(s,c){this.hooks=s,this.session=bi(1e3)+"/"+Vl(8),this.location=Jl(c),this.readyState=yn.CONNECTING,this.openStream()}send(s){return this.sendRaw(JSON.stringify([s]))}ping(){this.hooks.sendHeartbeat(this)}close(s,c){this.onClose(s,c,!0)}sendRaw(s){if(this.readyState===yn.OPEN)try{return G.createSocketRequest("POST",mi(Yl(this.location,this.session))).start(s),!0}catch(c){return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(s,c,f){this.closeStream(),this.readyState=yn.CLOSED,this.onclose&&this.onclose({code:s,reason:c,wasClean:f})}onChunk(s){if(s.status===200){this.readyState===yn.OPEN&&this.onActivity();var c,f=s.data.slice(0,1);switch(f){case"o":c=JSON.parse(s.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(s.data.slice(1)||"[]");for(var b=0;b<c.length;b++)this.onEvent(c[b]);break;case"m":c=JSON.parse(s.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(s.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(s){this.readyState===yn.CONNECTING?(s&&s.hostname&&(this.location.base=Xl(this.location.base,s.hostname)),this.readyState=yn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(s){this.readyState===yn.OPEN&&this.onmessage&&this.onmessage({data:s})}onActivity(){this.onactivity&&this.onactivity()}onError(s){this.onerror&&this.onerror(s)}openStream(){this.stream=G.createSocketRequest("POST",mi(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",s=>{this.onChunk(s)}),this.stream.bind("finished",s=>{this.hooks.onFinished(this,s)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(s){le.defer(()=>{this.onError(s),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function Jl(u){var s=/([^\?]*)\/*(\??.*)/.exec(u);return{base:s[1],queryString:s[2]}}function Yl(u,s){return u.base+"/"+s+"/xhr_send"}function mi(u){var s=u.indexOf("?")===-1?"?":"&";return u+s+"t="+ +new Date+"&n="+Gl++}function Xl(u,s){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(u);return c[1]+s+c[3]}function bi(u){return G.randomInt(u)}function Vl(u){for(var s=[],c=0;c<u;c++)s.push(bi(32).toString(32));return s.join("")}const Kl=Wl;var Ql={getReceiveURL:function(u,s){return u.base+"/"+s+"/xhr_streaming"+u.queryString},onHeartbeat:function(u){u.sendRaw("[]")},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,s){u.onClose(1006,"Connection interrupted ("+s+")",!1)}};const eu=Ql;var tu={getReceiveURL:function(u,s){return u.base+"/"+s+"/xhr"+u.queryString},onHeartbeat:function(){},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,s){s===200?u.reconnect():u.onClose(1006,"Connection interrupted ("+s+")",!1)}};const nu=tu;var ru={getRequest:function(u){var s=G.getXHRAPI(),c=new s;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&u.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&u.onChunk(c.status,c.responseText),u.emit("finished",c.status),u.close();break}},c},abortRequest:function(u){u.onreadystatechange=null,u.abort()}};const ou=ru;var su={createStreamingSocket(u){return this.createSocket(eu,u)},createPollingSocket(u){return this.createSocket(nu,u)},createSocket(u,s){return new Kl(u,s)},createXHR(u,s){return this.createRequest(ou,u,s)},createRequest(u,s,c){return new Bl(u,s,c)}};const ki=su;ki.createXDR=function(u,s){return this.createRequest(Hl,u,s)};var iu={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:y,getDefaultStrategy:jl,Transports:yt,transportConnectionInitializer:Zl,HTTPFactory:ki,TimelineTransport:en,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(u){window.Pusher=u;var s=()=>{this.onDocumentBody(u.ready)};window.JSON?s():E.load("json2",{},s)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:Ct,jsonp:hr}},onDocumentBody(u){document.body?u():setTimeout(()=>{this.onDocumentBody(u)},0)},createJSONPRequest(u,s){return new On(u,s)},createScriptRequest(u){return new Br(u)},getLocalStorage(){try{return window.localStorage}catch(u){return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var u=this.getXHRAPI();return new u},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Vr},createWebSocket(u){var s=this.getWebSocketAPI();return new s(u)},createSocketRequest(u,s){if(this.isXHRSupported())return this.HTTPFactory.createXHR(u,s);if(this.isXDRSupported(s.indexOf("https:")===0))return this.HTTPFactory.createXDR(u,s);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var u=this.getXHRAPI();return!!u&&new u().withCredentials!==void 0},isXDRSupported(u){var s=u?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===s},addUnloadListener(u){window.addEventListener!==void 0?window.addEventListener("unload",u,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",u)},removeUnloadListener(u){window.addEventListener!==void 0?window.removeEventListener("unload",u,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",u)},randomInt(u){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*u)}};const G=iu;var cs;(function(u){u[u.ERROR=3]="ERROR",u[u.INFO=6]="INFO",u[u.DEBUG=7]="DEBUG"})(cs||(cs={}));const no=cs;class au{constructor(s,c,f){this.key=s,this.session=c,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(s,c){s<=this.options.level&&(this.events.push(Se({},c,{timestamp:le.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(s){this.log(no.ERROR,s)}info(s){this.log(no.INFO,s)}debug(s){this.log(no.DEBUG,s)}isEmpty(){return this.events.length===0}send(s,c){var f=Se({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],s(f,(b,x)=>{b||this.sent++,c&&c(b,x)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class cu{constructor(s,c,f,b){this.name=s,this.priority=c,this.transport=f,this.options=b||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(s,c){if(this.isSupported()){if(this.priority<s)return _i(new Y,c)}else return _i(new te,c);var f=!1,b=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),x=null,R=function(){b.unbind("initialized",R),b.connect()},O=function(){x=Ht.createHandshake(b,function(Ee){f=!0,oe(),c(null,Ee)})},B=function(Ee){oe(),c(Ee)},ee=function(){oe();var Ee;Ee=Ye(b),c(new he(Ee))},oe=function(){b.unbind("initialized",R),b.unbind("open",O),b.unbind("error",B),b.unbind("closed",ee)};return b.bind("initialized",R),b.bind("open",O),b.bind("error",B),b.bind("closed",ee),b.initialize(),{abort:()=>{f||(oe(),x?x.close():b.close())},forceMinPriority:Ee=>{f||this.priority<Ee&&(x?x.close():b.close())}}}}function _i(u,s){return le.defer(function(){s(u)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:lu}=G;var uu=function(u,s,c,f,b,x){var R=lu[c];if(!R)throw new qe(c);var O=(!u.enabledTransports||De(u.enabledTransports,s)!==-1)&&(!u.disabledTransports||De(u.disabledTransports,s)===-1),B;return O?(b=Object.assign({ignoreNullOrigin:u.ignoreNullOrigin},b),B=new cu(s,f,x?x.getAssistant(R):R,b)):B=du,B},du={isSupported:function(){return!1},connect:function(u,s){var c=le.defer(function(){s(new te)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function pu(u){if(u==null)throw"You must pass an options object";if(u.cluster==null)throw"Options object must provide a cluster";"disableStats"in u&&de.warn("The disableStats option is deprecated in favor of enableStats")}const hu=(u,s)=>{var c="socket_id="+encodeURIComponent(u.socketId);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},fu=u=>{if(typeof G.getAuthorizers()[u.transport]=="undefined")throw`'${u.transport}' is not a recognized auth transport`;return(s,c)=>{const f=hu(s,u);G.getAuthorizers()[u.transport](G,f,u,T.UserAuthentication,c)}},gu=(u,s)=>{var c="socket_id="+encodeURIComponent(u.socketId);c+="&channel_name="+encodeURIComponent(u.channelName);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},mu=u=>{if(typeof G.getAuthorizers()[u.transport]=="undefined")throw`'${u.transport}' is not a recognized auth transport`;return(s,c)=>{const f=gu(s,u);G.getAuthorizers()[u.transport](G,f,u,T.ChannelAuthorization,c)}},bu=(u,s,c)=>{const f={authTransport:s.transport,authEndpoint:s.endpoint,auth:{params:s.params,headers:s.headers}};return(b,x)=>{const R=u.channel(b.channelName);c(R,f).authorize(b.socketId,x)}};function vi(u,s){let c={activityTimeout:u.activityTimeout||m.activityTimeout,cluster:u.cluster,httpPath:u.httpPath||m.httpPath,httpPort:u.httpPort||m.httpPort,httpsPort:u.httpsPort||m.httpsPort,pongTimeout:u.pongTimeout||m.pongTimeout,statsHost:u.statsHost||m.stats_host,unavailableTimeout:u.unavailableTimeout||m.unavailableTimeout,wsPath:u.wsPath||m.wsPath,wsPort:u.wsPort||m.wsPort,wssPort:u.wssPort||m.wssPort,enableStats:wu(u),httpHost:ku(u),useTLS:yu(u),wsHost:_u(u),userAuthenticator:xu(u),channelAuthorizer:Tu(u,s)};return"disabledTransports"in u&&(c.disabledTransports=u.disabledTransports),"enabledTransports"in u&&(c.enabledTransports=u.enabledTransports),"ignoreNullOrigin"in u&&(c.ignoreNullOrigin=u.ignoreNullOrigin),"timelineParams"in u&&(c.timelineParams=u.timelineParams),"nacl"in u&&(c.nacl=u.nacl),c}function ku(u){return u.httpHost?u.httpHost:u.cluster?`sockjs-${u.cluster}.pusher.com`:m.httpHost}function _u(u){return u.wsHost?u.wsHost:vu(u.cluster)}function vu(u){return`ws-${u}.pusher.com`}function yu(u){return G.getProtocol()==="https:"?!0:u.forceTLS!==!1}function wu(u){return"enableStats"in u?u.enableStats:"disableStats"in u?!u.disableStats:!1}const yi=u=>"customHandler"in u&&u.customHandler!=null;function xu(u){const s=Object.assign(Object.assign({},m.userAuthentication),u.userAuthentication);return yi(s)?s.customHandler:fu(s)}function Su(u,s){let c;if("channelAuthorization"in u)c=Object.assign(Object.assign({},m.channelAuthorization),u.channelAuthorization);else if(c={transport:u.authTransport||m.authTransport,endpoint:u.authEndpoint||m.authEndpoint},"auth"in u&&("params"in u.auth&&(c.params=u.auth.params),"headers"in u.auth&&(c.headers=u.auth.headers)),"authorizer"in u)return{customHandler:bu(s,c,u.authorizer)};return c}function Tu(u,s){const c=Su(u,s);return yi(c)?c.customHandler:mu(c)}class Eu extends vt{constructor(s){super(function(c,f){de.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=s,this.bindWatchlistInternalEvent()}handleEvent(s){s.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",s=>{var c=s.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(s)})}}function Au(){let u,s;return{promise:new Promise((f,b)=>{u=f,s=b}),resolve:u,reject:s}}const Cu=Au;class Pu extends vt{constructor(s){super(function(c,f){de.debug("No callbacks on user for "+c)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(c,f)=>{if(c){de.warn(`Error during signin: ${c}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:f.auth,user_data:f.user_data})},this.pusher=s,this.pusher.connection.bind("state_change",({previous:c,current:f})=>{c!=="connected"&&f==="connected"&&this._signin(),c==="connected"&&f!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new Eu(s),this.pusher.connection.bind("message",c=>{var f=c.event;f==="pusher:signin_success"&&this._onSigninSuccess(c.data),this.serverToUserChannel&&this.serverToUserChannel.name===c.channel&&this.serverToUserChannel.handleEvent(c)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(s){try{this.user_data=JSON.parse(s.user_data)}catch(c){de.error(`Failed parsing user data after signin: ${s.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){de.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const s=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new I(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((c,f)=>{c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0||this.emit(c,f)}),s(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:s,resolve:c}=Cu();s.done=!1;const f=()=>{s.done=!0};s.then(f).catch(f),this.signinDonePromise=s,this._signinDoneResolve=c}}class Me{static ready(){Me.isReady=!0;for(var s=0,c=Me.instances.length;s<c;s++)Me.instances[s].connect()}static getClientFeatures(){return ze(at({ws:G.Transports.ws},function(s){return s.isSupported({})}))}constructor(s,c){Ru(s),pu(c),this.key=s,this.options=c,this.config=vi(this.options,this),this.channels=Ht.createChannels(),this.global_emitter=new vt,this.sessionID=G.randomInt(1e9),this.timeline=new au(this.key,this.sessionID,{cluster:this.config.cluster,features:Me.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:no.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=Ht.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+G.TimelineTransport.name}));var f=b=>G.getDefaultStrategy(this.config,b,uu);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",b=>{var x=b.event,R=x.indexOf("pusher_internal:")===0;if(b.channel){var O=this.channel(b.channel);O&&O.handleEvent(b)}R||this.global_emitter.emit(b.event,b.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",b=>{de.warn(b)}),Me.instances.push(this),this.timeline.info({instances:Me.instances.length}),this.user=new Pu(this),Me.isReady&&this.connect()}switchCluster(s){const{appKey:c,cluster:f}=s;this.key=c,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=vi(this.options,this),this.connection.switchCluster(this.key)}channel(s){return this.channels.find(s)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var s=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new Ne(6e4,function(){c.send(s)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(s,c,f){return this.global_emitter.bind(s,c,f),this}unbind(s,c,f){return this.global_emitter.unbind(s,c,f),this}bind_global(s){return this.global_emitter.bind_global(s),this}unbind_global(s){return this.global_emitter.unbind_global(s),this}unbind_all(s){return this.global_emitter.unbind_all(),this}subscribeAll(){var s;for(s in this.channels.channels)this.channels.channels.hasOwnProperty(s)&&this.subscribe(s)}subscribe(s){var c=this.channels.add(s,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(s){var c=this.channels.find(s);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(s),c&&c.subscribed&&c.unsubscribe())}send_event(s,c,f){return this.connection.send_event(s,c,f)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}Me.instances=[],Me.isReady=!1,Me.logToConsole=!1,Me.Runtime=G,Me.ScriptReceivers=G.ScriptReceivers,Me.DependenciesReceivers=G.DependenciesReceivers,Me.auth_callbacks=G.auth_callbacks;const ro=Me;function Ru(u){if(u==null)throw"You must pass your app key when you instantiate Pusher."}G.setup(Me)}},r={};function o(a){var d=r[a];if(d!==void 0)return d.exports;var l=r[a]={exports:{}};return n[a].call(l.exports,l,l.exports,o),l.exports}o.d=(a,d)=>{for(var l in d)o.o(d,l)&&!o.o(a,l)&&Object.defineProperty(a,l,{enumerable:!0,get:d[l]})},o.o=(a,d)=>Object.prototype.hasOwnProperty.call(a,d);var i=o(721);return i})())})(ms)),ms.exports}var Im=Lm();const zm=Rm(Im);let At=null,jn=null;function $m(e){return L(this,null,function*(){return jn||(jn=L(null,null,function*(){const t=e.backendUrl.replace(/\/+$/,""),n=yield No(`${t}/api/settings`,{headers:{Authorization:`Bearer ${e.token}`}});if(!n.ok)throw new Error(`Failed to fetch settings: HTTP ${n.status}`);const r=yield n.json();At=new zm(r.pusher.key,{cluster:r.pusher.cluster||"local",forceTLS:!0,wsHost:r.pusher.wsHost||void 0,wsPort:r.pusher.wssPort,wssPort:r.pusher.wssPort,enabledTransports:r.pusher.wsHost?["ws"]:void 0,channelAuthorization:{customHandler:({socketId:o,channelName:i},a)=>{No(`${t}/api/pusher/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({socket_id:o,channel_name:i})}).then(d=>d.json()).then(d=>a(null,d)).catch(d=>a(d instanceof Error?d:new Error(String(d)),null))}}})}),jn.catch(()=>{jn=null}),jn)})}function Om(e){if(!e||!At)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return At.connection.bind("state_change",n),()=>At==null?void 0:At.connection.unbind("state_change",n)}function Nm(e,t,n){return L(this,null,function*(){if(yield $m(e),!At)return()=>{};const r=At.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(io.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(io.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(io.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(io.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=Om(n.onReconnect);return()=>{r.unbind_all(),At==null||At.unsubscribe(`private-task-${t}`),o==null||o()}})}const Ws="ap-sdk-active-automation";function Dm(){try{const e=sessionStorage.getItem(Ws);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.taskId&&(t!=null&&t.backendUrl)&&(t!=null&&t.title)?t:null}catch(e){return null}}function Ic(e){try{sessionStorage.setItem(Ws,JSON.stringify(e))}catch(t){}}function zc(){try{sessionStorage.removeItem(Ws)}catch(e){}}function Mm(e){return L(this,null,function*(){var i;try{(i=e.focus)==null||i.call(e)}catch(a){}e.scrollIntoView({block:"center",inline:"center",behavior:"instant"});let t=e.getBoundingClientRect();t.width===0&&t.height===0&&(yield Um(),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 Um(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const Js="shared",$c="ap-sdk-panel-size:",ua=280,da=200;function jm(e){try{const t=sessionStorage.getItem($c+e);if(!t)return null;const n=JSON.parse(t);return typeof(n==null?void 0:n.width)=="number"&&typeof(n==null?void 0:n.height)=="number"?n:null}catch(t){return null}}function Zm(e,t){try{sessionStorage.setItem($c+e,JSON.stringify(t))}catch(n){}}function uo(e,t,n){return Math.min(Math.max(e,t),n)}function pa(){return window.innerWidth-32}function ha(){return window.innerHeight-64}function Ys(e,t){const n=jm(t);n&&(e.style.width=`${uo(n.width,ua,pa())}px`,e.style.height=`${uo(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,i=0,a=0,d=0,l=0,p=0,h=0;const g=k=>{o&&(p=uo(d+(k.clientX-i),ua,pa()),h=uo(l+(k.clientY-a),da,ha()),e.style.width=`${p}px`,e.style.height=`${h}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",m),Zm(t,{width:p,height:h}))};r.addEventListener("pointerdown",k=>{k.preventDefault(),k.stopPropagation(),o=!0,i=k.clientX,a=k.clientY;const y=e.getBoundingClientRect();d=y.width,l=y.height,p=d,h=l,document.addEventListener("pointermove",g),document.addEventListener("pointerup",m)})}function Xs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var $n=Xs();function Oc(e){$n=e}var xn={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 V(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(o,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(Ge.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var qm=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch(t){return!1}})(),Ge={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex: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}}>`))},Hm=/^(?:[ \t]*(?:\n|$))+/,Fm=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Bm=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Zr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Gm=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Vs=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Nc=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Dc=V(Nc).replace(/bull/g,Vs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Wm=V(Nc).replace(/bull/g,Vs).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ks=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Jm=/^[^\n]+/,Qs=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Ym=V(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Qs).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Xm=V(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Vs).getRegex(),Qo="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",ei=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Vm=V("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ei).replace("tag",Qo).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Mc=e=>V(Ks).replace("hr",Zr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list",e).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Qo).getRegex(),Km=Mc(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Qm=Mc(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),eb=V(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Qm).getRegex(),ti={blockquote:eb,code:Fm,def:Ym,fences:Bm,heading:Gm,hr:Zr,html:Vm,lheading:Dc,list:Xm,newline:Hm,paragraph:Km,table:xn,text:Jm},fa=V("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Zr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Qo).getRegex(),tb=M(v({},ti),{lheading:Wm,table:fa,paragraph:V(Ks).replace("hr",Zr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",fa).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",Qo).getRegex()}),nb=M(v({},ti),{html:V(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ei).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:xn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:V(Ks).replace("hr",Zr).replace("heading",` *#{1,6} *[^
1366
+ ]`).replace("lheading",Dc).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),rb=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ob=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Uc=/^( {2,}|\\)\n(?!\s*$)/,sb=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Vt=/[\p{P}\p{S}]/u,cr=/[\s\p{P}\p{S}]/u,qr=/[^\s\p{P}\p{S}]/u,ib=V(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,cr).getRegex(),ab=/[\p{Pi}\p{Ps}"']/u,jc=/(?!~)[\p{P}\p{S}]/u,cb=/(?!~)[\s\p{P}\p{S}]/u,lb=/(?:[^\s\p{P}\p{S}]|~)/u,ub=V(/link|precode-code|html/,"g").replace("link",new RegExp("\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)")).replace("precode-",qm?"(?<!`)()":"(^^|[^`])").replace("code",new RegExp("(?<b>`+)[^`]+\\k<b>(?!`)")).replace("html",/<(?! )[^<>]*?>/).getRegex(),Zc=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,db=V(Zc,"u").replace(/punct/g,Vt).getRegex(),pb=V(Zc,"u").replace(/punct/g,jc).getRegex(),hb=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,fb=V(hb,"u").replace(/openQuote/g,ab).replace(/punct/g,Vt).getRegex(),qc="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",gb=V(qc,"gu").replace(/notPunctSpace/g,qr).replace(/punctSpace/g,cr).replace(/punct/g,Vt).getRegex(),mb=V(qc,"gu").replace(/notPunctSpace/g,lb).replace(/punctSpace/g,cb).replace(/punct/g,jc).getRegex(),bb="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",kb=V(bb,"gu").replace(/notPunctSpace/g,qr).replace(/punctSpace/g,cr).replace(/punct/g,Vt).getRegex(),_b=V("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,qr).replace(/punctSpace/g,cr).replace(/punct/g,Vt).getRegex(),vb="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",yb=V(vb,"gu").replace(/notPunctSpace/g,qr).replace(/punctSpace/g,cr).replace(/punct/g,Vt).getRegex(),wb=V(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Vt).getRegex(),xb="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Sb=V(xb,"gu").replace(/notPunctSpace/g,qr).replace(/punctSpace/g,cr).replace(/punct/g,Vt).getRegex(),Tb=V(/\\(punct)/,"gu").replace(/punct/g,Vt).getRegex(),Eb=V(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Ab=V(ei).replace("(?:-->|$)","-->").getRegex(),Cb=V("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Ab).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Mo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Pb=V(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Mo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Hc=V(/^!?\[(label)\]\[(ref)\]/).replace("label",Mo).replace("ref",Qs).getRegex(),Fc=V(/^!?\[(ref)\](?:\[\])?/).replace("ref",Qs).getRegex(),Rb=V("reflink|nolink(?!\\()","g").replace("reflink",Hc).replace("nolink",Fc).getRegex(),ga=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ni={_backpedal:xn,anyPunctuation:Tb,autolink:Eb,blockSkip:ub,br:Uc,code:ob,del:xn,delLDelim:xn,delRDelim:xn,emStrongLDelim:db,emStrongRDelimAst:gb,emStrongRDelimUnd:_b,escape:rb,link:Pb,nolink:Fc,punctuation:ib,reflink:Hc,reflinkSearch:Rb,tag:Cb,text:sb,url:xn},Lb=M(v({},ni),{emStrongLDelim:fb,emStrongRDelimAst:kb,emStrongRDelimUnd:yb,link:V(/^!?\[(label)\]\((.*?)\)/).replace("label",Mo).getRegex(),reflink:V(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Mo).getRegex()}),Rs=M(v({},ni),{emStrongRDelimAst:mb,emStrongLDelim:pb,delLDelim:wb,delRDelim:Sb,url:V(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ga).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:V(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ga).getRegex()}),Ib=M(v({},Rs),{br:V(Uc).replace("{2,}","*").getRegex(),text:V(Rs.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),po={normal:ti,gfm:tb,pedantic:nb},xr={normal:ni,gfm:Rs,breaks:Ib,pedantic:Lb},zb={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ma=e=>zb[e];function zt(e,t){if(t){if(Ge.escapeTest.test(e))return e.replace(Ge.escapeReplace,ma)}else if(Ge.escapeTestNoEncode.test(e))return e.replace(Ge.escapeReplaceNoEncode,ma);return e}function ba(e){try{e=encodeURI(e).replace(Ge.percentDecode,"%")}catch(t){return null}return e}function ka(e,t){var i;let n=e.replace(Ge.findPipe,(a,d,l)=>{let p=!1,h=d;for(;--h>=0&&l[h]==="\\";)p=!p;return p?"|":" |"}),r=n.split(Ge.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(Ge.slashPipe,"|");return r}function nn(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 _a(e){let t=e.split(`
1367
+ `),n=t.length-1;for(;n>=0&&Ge.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
1368
1368
  `)}function $b(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 Ob(e,t=0){let n=t,r="";for(let o of e)if(o===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=o,n++;return r}function va(e,t,n,r,o){let i=t.href,a=t.title||null,d=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:d,tokens:r.inlineTokens(d)};return r.state.inLink=!1,l}function Nb(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
1369
1369
  `).map(i=>{let a=i.match(n.other.beginningSpace);if(a===null)return i;let[d]=a;return d.length>=o.length?i.slice(o.length):i}).join(`
1370
- `)}var Uo=class{constructor(e){ae(this,"options");ae(this,"rules");ae(this,"lexer");this.options=e||zn}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]:_a(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=Nb(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=tn(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:tn(t[0],`
1371
- `),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:tn(t[0],`
1372
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=tn(t[0],`
1370
+ `)}var Uo=class{constructor(e){ie(this,"options");ie(this,"rules");ie(this,"lexer");this.options=e||$n}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=this.options.pedantic?t[0]:_a(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=Nb(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=nn(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:nn(t[0],`
1371
+ `),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:nn(t[0],`
1372
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=nn(t[0],`
1373
1373
  `).split(`
1374
1374
  `),r="",o="",i=[];for(;n.length>0;){let a=!1,d=[],l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))d.push(n[l]),a=!0;else if(!a)d.push(n[l]);else break;n=n.slice(l);let p=d.join(`
1375
1375
  `),h=p.replace(this.rules.other.blockquoteSetextReplace,`
@@ -1377,24 +1377,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
1377
1377
  ${p}`:p,o=o?`${o}
1378
1378
  ${h}`:h;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,i,!0),this.lexer.state.top=g,n.length===0)break;let m=i.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){let k=m,y=n.join(`
1379
1379
  `),E=k.raw+`
1380
- `+y.replace(this.rules.other.blockquoteSetextReplace2,""),Z=this.blockquote(E);i[i.length-1]=Z,r=`${r}
1381
- ${y}`,o=o.substring(0,o.length-k.text.length)+Z.text;break}else if((m==null?void 0:m.type)==="list"){let k=m,y=k.raw+`
1380
+ `+y.replace(this.rules.other.blockquoteSetextReplace2,""),j=this.blockquote(E);i[i.length-1]=j,r=`${r}
1381
+ ${y}`,o=o.substring(0,o.length-k.text.length)+j.text;break}else if((m==null?void 0:m.type)==="list"){let k=m,y=k.raw+`
1382
1382
  `+n.join(`
1383
1383
  `),E=this.list(y);i[i.length-1]=E,r=r.substring(0,r.length-m.raw.length)+E.raw,o=o.substring(0,o.length-k.raw.length)+E.raw,n=y.substring(i.at(-1).raw.length).split(`
1384
1384
  `);continue}}return{type:"blockquote",raw:r,tokens:i,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,o={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let i=this.rules.other.listItemRegex(n),a=!1;for(;e;){let l=!1,p="",h="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let g=Ob(t[2].split(`
1385
1385
  `,1)[0],t[1].length),m=e.split(`
1386
1386
  `,1)[0],k=!g.trim(),y=0;if(this.options.pedantic?(y=2,h=g.trimStart()):k?y=t[1].length+1:(y=g.search(this.rules.other.nonSpaceChar),y=y>4?1:y,h=g.slice(y),y+=t[1].length),k&&this.rules.other.blankLine.test(m)&&(p+=m+`
1387
- `,e=e.substring(m.length+1),l=!0),!l){let E=this.rules.other.nextBulletRegex(y),Z=this.rules.other.hrRegex(y),ee=this.rules.other.fencesBeginRegex(y),N=this.rules.other.headingBeginRegex(y),T=this.rules.other.htmlBeginRegex(y),S=this.rules.other.blockquoteBeginRegex(y);for(;e;){let P=e.split(`
1388
- `,1)[0],D;if(m=P,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),D=m):D=m.replace(this.rules.other.tabCharGlobal," "),ee.test(m)||N.test(m)||T.test(m)||S.test(m)||E.test(m)||Z.test(m))break;if(D.search(this.rules.other.nonSpaceChar)>=y||!m.trim())h+=`
1389
- `+D.slice(y);else{if(k||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||ee.test(g)||N.test(g)||Z.test(g))break;h+=`
1387
+ `,e=e.substring(m.length+1),l=!0),!l){let E=this.rules.other.nextBulletRegex(y),j=this.rules.other.hrRegex(y),Q=this.rules.other.fencesBeginRegex(y),N=this.rules.other.headingBeginRegex(y),T=this.rules.other.htmlBeginRegex(y),S=this.rules.other.blockquoteBeginRegex(y);for(;e;){let P=e.split(`
1388
+ `,1)[0],Z;if(m=P,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),Z=m):Z=m.replace(this.rules.other.tabCharGlobal," "),Q.test(m)||N.test(m)||T.test(m)||S.test(m)||E.test(m)||j.test(m))break;if(Z.search(this.rules.other.nonSpaceChar)>=y||!m.trim())h+=`
1389
+ `+Z.slice(y);else{if(k||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Q.test(g)||N.test(g)||j.test(g))break;h+=`
1390
1390
  `+m}k=!m.trim(),p+=P+`
1391
- `,e=e.substring(P.length+1),g=D.slice(y)}}o.loose||(a?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(a=!0)),o.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),o.raw+=p}let d=o.items.at(-1);if(d)d.raw=d.raw.trimEnd(),d.text=d.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let l of o.items){this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]);let p=l.tokens[0];if(l.task&&((p==null?void 0:p.type)==="text"||(p==null?void 0:p.type)==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),p.raw=p.raw.replace(this.rules.other.listReplaceTask,""),p.text=p.text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}let h=this.rules.other.listTaskCheckbox.exec(l.raw);if(h){let g={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};l.checked=g.checked,o.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=g.raw+l.tokens[0].raw,l.tokens[0].text=g.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(g)):l.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):l.tokens.unshift(g)}}else l.task&&(l.task=!1);if(!o.loose){let h=l.tokens.filter(m=>m.type==="space"),g=h.length>0&&h.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=g}}if(o.loose)for(let l of o.items){l.loose=!0;for(let p of l.tokens)p.type==="text"&&(p.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=_a(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:tn(t[0],`
1391
+ `,e=e.substring(P.length+1),g=Z.slice(y)}}o.loose||(a?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(a=!0)),o.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),o.raw+=p}let d=o.items.at(-1);if(d)d.raw=d.raw.trimEnd(),d.text=d.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let l of o.items){this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]);let p=l.tokens[0];if(l.task&&((p==null?void 0:p.type)==="text"||(p==null?void 0:p.type)==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),p.raw=p.raw.replace(this.rules.other.listReplaceTask,""),p.text=p.text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}let h=this.rules.other.listTaskCheckbox.exec(l.raw);if(h){let g={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};l.checked=g.checked,o.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=g.raw+l.tokens[0].raw,l.tokens[0].text=g.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(g)):l.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):l.tokens.unshift(g)}}else l.task&&(l.task=!1);if(!o.loose){let h=l.tokens.filter(m=>m.type==="space"),g=h.length>0&&h.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=g}}if(o.loose)for(let l of o.items){l.loose=!0;for(let p of l.tokens)p.type==="text"&&(p.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=_a(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:nn(t[0],`
1392
1392
  `),href:r,title:o}}}table(e){var a;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=ka(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
1393
- `):[],i={type:"table",raw:tn(t[0],`
1394
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let d of r)this.rules.other.tableAlignRight.test(d)?i.align.push("right"):this.rules.other.tableAlignCenter.test(d)?i.align.push("center"):this.rules.other.tableAlignLeft.test(d)?i.align.push("left"):i.align.push(null);for(let d=0;d<n.length;d++)i.header.push({text:n[d],tokens:this.lexer.inline(n[d]),header:!0,align:i.align[d]});for(let d of o)i.rows.push(ka(d,i.header.length).map((l,p)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[p]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:tn(t[0],`
1393
+ `):[],i={type:"table",raw:nn(t[0],`
1394
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let d of r)this.rules.other.tableAlignRight.test(d)?i.align.push("right"):this.rules.other.tableAlignCenter.test(d)?i.align.push("center"):this.rules.other.tableAlignLeft.test(d)?i.align.push("left"):i.align.push(null);for(let d=0;d<n.length;d++)i.header.push({text:n[d],tokens:this.lexer.inline(n[d]),header:!0,align:i.align[d]});for(let d of o)i.rows.push(ka(d,i.header.length).map((l,p)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[p]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:nn(t[0],`
1395
1395
  `),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)===`
1396
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=tn(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=$b(t[2],"()");if(i===-2)return;if(i>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],o=i[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),va(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[r.toLowerCase()];if(!o){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return va(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,d=o,l=0,p=r[0][0],h=n===p,g=p==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(g.lastIndex=0,t=t.slice(-1*e.length+o);(r=g.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){d+=a;continue}else if(r[5]||r[6]){if(o%3&&!((o+a)%3)){l+=a;continue}if(h)break}if(d-=a,d>0)continue;a=Math.min(a,a+d+l);let m=[...r[0]][0].length,k=e.slice(0,o+r.index+m+a);if(Math.min(o,a)%2){let E=k.slice(1,-1);return{type:"em",raw:k,text:E,tokens:this.lexer.inlineTokens(E)}}let y=k.slice(2,-2);return{type:"strong",raw:k,text:y,tokens:this.lexer.inlineTokens(y)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,d=o,l=this.rules.inline.delRDelim;for(l.lastIndex=0,t=t.slice(-1*e.length+o);(r=l.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==o))continue;if(r[3]||r[4]){d+=a;continue}if(d-=a,d>0)continue;a=Math.min(a,a+d);let p=[...r[0]][0].length,h=e.slice(0,o+r.index+p+a),g=h.slice(o,-o);return{type:"del",raw:h,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,r;let t;if(t=this.rules.inline.url.exec(e)){let o,i;if(t[2]==="@")o=t[0],i="mailto:"+o;else{let a;do a=t[0],t[0]=(r=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?r:"";while(a!==t[0]);o=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:o,href:i,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},Tt=class Ls{constructor(t){ae(this,"tokens");ae(this,"options");ae(this,"state");ae(this,"inlineQueue");ae(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||zn,this.options.tokenizer=this.options.tokenizer||new Uo,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:He,block:po.normal,inline:xr.normal};this.options.pedantic?(n.block=po.pedantic,n.inline=xr.pedantic):this.options.gfm&&(n.block=po.gfm,this.options.breaks?n.inline=xr.breaks:n.inline=xr.gfm),this.tokenizer.rules=n}static get rules(){return{block:po,inline:xr}}static lex(t,n){return new Ls(n).lex(t)}static lexInline(t,n){return new Ls(n).inlineTokens(t)}lex(t){t=t.replace(He.carriageReturn,`
1397
- `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var i,a,d;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(He.tabCharGlobal," ").replace(He.spaceLine,""));let o=1/0;for(;t;){if(t.length<o)o=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let l;if((a=(i=this.options.extensions)==null?void 0:i.block)!=null&&a.some(h=>(l=h.call({lexer:this},t,n))?(t=t.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);let h=n.at(-1);l.raw.length===1&&h!==void 0?h.raw+=`
1396
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=nn(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=$b(t[2],"()");if(i===-2)return;if(i>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],o=i[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),va(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[r.toLowerCase()];if(!o){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return va(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,d=o,l=0,p=r[0][0],h=n===p,g=p==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(g.lastIndex=0,t=t.slice(-1*e.length+o);(r=g.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){d+=a;continue}else if(r[5]||r[6]){if(o%3&&!((o+a)%3)){l+=a;continue}if(h)break}if(d-=a,d>0)continue;a=Math.min(a,a+d+l);let m=[...r[0]][0].length,k=e.slice(0,o+r.index+m+a);if(Math.min(o,a)%2){let E=k.slice(1,-1);return{type:"em",raw:k,text:E,tokens:this.lexer.inlineTokens(E)}}let y=k.slice(2,-2);return{type:"strong",raw:k,text:y,tokens:this.lexer.inlineTokens(y)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,d=o,l=this.rules.inline.delRDelim;for(l.lastIndex=0,t=t.slice(-1*e.length+o);(r=l.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==o))continue;if(r[3]||r[4]){d+=a;continue}if(d-=a,d>0)continue;a=Math.min(a,a+d);let p=[...r[0]][0].length,h=e.slice(0,o+r.index+p+a),g=h.slice(o,-o);return{type:"del",raw:h,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,r;let t;if(t=this.rules.inline.url.exec(e)){let o,i;if(t[2]==="@")o=t[0],i="mailto:"+o;else{let a;do a=t[0],t[0]=(r=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?r:"";while(a!==t[0]);o=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:o,href:i,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},Tt=class Ls{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||$n,this.options.tokenizer=this.options.tokenizer||new Uo,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Ge,block:po.normal,inline:xr.normal};this.options.pedantic?(n.block=po.pedantic,n.inline=xr.pedantic):this.options.gfm&&(n.block=po.gfm,this.options.breaks?n.inline=xr.breaks:n.inline=xr.gfm),this.tokenizer.rules=n}static get rules(){return{block:po,inline:xr}}static lex(t,n){return new Ls(n).lex(t)}static lexInline(t,n){return new Ls(n).inlineTokens(t)}lex(t){t=t.replace(Ge.carriageReturn,`
1397
+ `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var i,a,d;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(Ge.tabCharGlobal," ").replace(Ge.spaceLine,""));let o=1/0;for(;t;){if(t.length<o)o=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let l;if((a=(i=this.options.extensions)==null?void 0:i.block)!=null&&a.some(h=>(l=h.call({lexer:this},t,n))?(t=t.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);let h=n.at(-1);l.raw.length===1&&h!==void 0?h.raw+=`
1398
1398
  `:n.push(l);continue}if(l=this.tokenizer.code(t)){t=t.substring(l.raw.length);let h=n.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
1399
1399
  `)?"":`
1400
1400
  `)+l.raw,h.text+=`
@@ -1407,9 +1407,9 @@ ${y}`,o=o.substring(0,o.length-k.text.length)+Z.text;break}else if((m==null?void
1407
1407
  `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(l),r=p.length!==t.length,t=t.substring(l.raw.length);continue}if(l=this.tokenizer.text(t)){t=t.substring(l.raw.length);let h=n.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
1408
1408
  `)?"":`
1409
1409
  `)+l.raw,h.text+=`
1410
- `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(l);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var d,l,p,h,g,m;this.tokenizer.lexer=this;let r=t;if(this.tokens.links){let k=Object.keys(this.tokens.links);k.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,y=>k.includes(y.slice(y.lastIndexOf("[")+1,-1))?"["+"a".repeat(y.length-2)+"]":y))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(k,y,E)=>{let Z=E?E.length:0;return k.slice(0,Z)+"["+"a".repeat(k.length-Z-2)+"]"}),r=(p=(l=(d=this.options.hooks)==null?void 0:d.emStrongMask)==null?void 0:l.call({lexer:this},r))!=null?p:r;let o=!1,i="",a=1/0;for(;t;){if(t.length<a)a=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}o||(i=""),o=!1;let k;if((g=(h=this.options.extensions)==null?void 0:h.inline)!=null&&g.some(E=>(k=E.call({lexer:this},t,n))?(t=t.substring(k.raw.length),n.push(k),!0):!1))continue;if(k=this.tokenizer.escape(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.tag(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.link(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(k.raw.length);let E=n.at(-1);k.type==="text"&&(E==null?void 0:E.type)==="text"?(E.raw+=k.raw,E.text+=k.text):n.push(k);continue}if(k=this.tokenizer.emStrong(t,r,i)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.codespan(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.br(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.del(t,r,i)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.autolink(t)){t=t.substring(k.raw.length),n.push(k);continue}if(!this.state.inLink&&(k=this.tokenizer.url(t))){t=t.substring(k.raw.length),n.push(k);continue}let y=t;if((m=this.options.extensions)!=null&&m.startInline){let E=1/0,Z=t.slice(1),ee;this.options.extensions.startInline.forEach(N=>{ee=N.call({lexer:this},Z),typeof ee=="number"&&ee>=0&&(E=Math.min(E,ee))}),E<1/0&&E>=0&&(y=t.substring(0,E+1))}if(k=this.tokenizer.inlineText(y)){t=t.substring(k.raw.length),k.raw.slice(-1)!=="_"&&(i=k.raw.slice(-1)),o=!0;let E=n.at(-1);(E==null?void 0:E.type)==="text"?(E.raw+=k.raw,E.text+=k.text):n.push(k);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return n}infiniteLoopError(t){let n="Infinite loop on byte: "+t;if(this.options.silent)console.error(n);else throw new Error(n)}},jo=class{constructor(e){ae(this,"options");ae(this,"parser");this.options=e||zn}space(e){return""}code({text:e,lang:t,escaped:n}){var i;let r=(i=(t||"").match(He.notSpaceStart))==null?void 0:i[0],o=e.replace(He.endingNewline,"")+`
1411
- `;return r?'<pre><code class="language-'+Pt(r)+'">'+(n?o:Pt(o,!0))+`</code></pre>
1412
- `:"<pre><code>"+(n?o:Pt(o,!0))+`</code></pre>
1410
+ `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(l);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var d,l,p,h,g,m;this.tokenizer.lexer=this;let r=t;if(this.tokens.links){let k=Object.keys(this.tokens.links);k.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,y=>k.includes(y.slice(y.lastIndexOf("[")+1,-1))?"["+"a".repeat(y.length-2)+"]":y))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(k,y,E)=>{let j=E?E.length:0;return k.slice(0,j)+"["+"a".repeat(k.length-j-2)+"]"}),r=(p=(l=(d=this.options.hooks)==null?void 0:d.emStrongMask)==null?void 0:l.call({lexer:this},r))!=null?p:r;let o=!1,i="",a=1/0;for(;t;){if(t.length<a)a=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}o||(i=""),o=!1;let k;if((g=(h=this.options.extensions)==null?void 0:h.inline)!=null&&g.some(E=>(k=E.call({lexer:this},t,n))?(t=t.substring(k.raw.length),n.push(k),!0):!1))continue;if(k=this.tokenizer.escape(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.tag(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.link(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(k.raw.length);let E=n.at(-1);k.type==="text"&&(E==null?void 0:E.type)==="text"?(E.raw+=k.raw,E.text+=k.text):n.push(k);continue}if(k=this.tokenizer.emStrong(t,r,i)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.codespan(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.br(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.del(t,r,i)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.autolink(t)){t=t.substring(k.raw.length),n.push(k);continue}if(!this.state.inLink&&(k=this.tokenizer.url(t))){t=t.substring(k.raw.length),n.push(k);continue}let y=t;if((m=this.options.extensions)!=null&&m.startInline){let E=1/0,j=t.slice(1),Q;this.options.extensions.startInline.forEach(N=>{Q=N.call({lexer:this},j),typeof Q=="number"&&Q>=0&&(E=Math.min(E,Q))}),E<1/0&&E>=0&&(y=t.substring(0,E+1))}if(k=this.tokenizer.inlineText(y)){t=t.substring(k.raw.length),k.raw.slice(-1)!=="_"&&(i=k.raw.slice(-1)),o=!0;let E=n.at(-1);(E==null?void 0:E.type)==="text"?(E.raw+=k.raw,E.text+=k.text):n.push(k);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return n}infiniteLoopError(t){let n="Infinite loop on byte: "+t;if(this.options.silent)console.error(n);else throw new Error(n)}},jo=class{constructor(e){ie(this,"options");ie(this,"parser");this.options=e||$n}space(e){return""}code({text:e,lang:t,escaped:n}){var i;let r=(i=(t||"").match(Ge.notSpaceStart))==null?void 0:i[0],o=e.replace(Ge.endingNewline,"")+`
1411
+ `;return r?'<pre><code class="language-'+zt(r)+'">'+(n?o:zt(o,!0))+`</code></pre>
1412
+ `:"<pre><code>"+(n?o:zt(o,!0))+`</code></pre>
1413
1413
  `}blockquote({tokens:e}){return`<blockquote>
1414
1414
  ${this.parser.parse(e)}</blockquote>
1415
1415
  `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
@@ -1425,9 +1425,9 @@ ${this.parser.parse(e)}</blockquote>
1425
1425
  `}tablerow({text:e}){return`<tr>
1426
1426
  ${e}</tr>
1427
1427
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
1428
- `}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>${Pt(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=ba(e);if(o===null)return r;e=o;let i='<a href="'+e+'"';return t&&(i+=' title="'+Pt(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let o=ba(e);if(o===null)return Pt(n);e=o;let i=`<img src="${e}" alt="${Pt(n)}"`;return t&&(i+=` title="${Pt(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Pt(e.text)}},ri=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Et=class Is{constructor(t){ae(this,"options");ae(this,"renderer");ae(this,"textRenderer");this.options=t||zn,this.options.renderer=this.options.renderer||new jo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ri}static parse(t,n){return new Is(n).parse(t)}static parseInline(t,n){return new Is(n).parseInline(t)}parse(t){var r,o;this.renderer.parser=this;let n="";for(let i=0;i<t.length;i++){let a=t[i];if((o=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&o[a.type]){let l=a,p=this.options.extensions.renderers[l.type].call({parser:this},l);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(l.type)){n+=p||"";continue}}let d=a;switch(d.type){case"space":{n+=this.renderer.space(d);break}case"hr":{n+=this.renderer.hr(d);break}case"heading":{n+=this.renderer.heading(d);break}case"code":{n+=this.renderer.code(d);break}case"table":{n+=this.renderer.table(d);break}case"blockquote":{n+=this.renderer.blockquote(d);break}case"list":{n+=this.renderer.list(d);break}case"checkbox":{n+=this.renderer.checkbox(d);break}case"html":{n+=this.renderer.html(d);break}case"def":{n+=this.renderer.def(d);break}case"paragraph":{n+=this.renderer.paragraph(d);break}case"text":{n+=this.renderer.text(d);break}default:{let l='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(t,n=this.renderer){var o,i;this.renderer.parser=this;let r="";for(let a=0;a<t.length;a++){let d=t[a];if((i=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&i[d.type]){let p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(d.type)){r+=p||"";continue}}let l=d;switch(l.type){case"escape":{r+=n.text(l);break}case"html":{r+=n.html(l);break}case"link":{r+=n.link(l);break}case"image":{r+=n.image(l);break}case"checkbox":{r+=n.checkbox(l);break}case"strong":{r+=n.strong(l);break}case"em":{r+=n.em(l);break}case"codespan":{r+=n.codespan(l);break}case"br":{r+=n.br(l);break}case"del":{r+=n.del(l);break}case"text":{r+=n.text(l);break}default:{let p='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return r}},ko,Rr=(ko=class{constructor(e){ae(this,"options");ae(this,"block");this.options=e||zn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Tt.lex:Tt.lexInline}provideParser(e=this.block){return e?Et.parse:Et.parseInline}},ae(ko,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ae(ko,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),ko),Db=class{constructor(...e){ae(this,"defaults",Xs());ae(this,"options",this.setOptions);ae(this,"parse",this.parseMarkdown(!0));ae(this,"parseInline",this.parseMarkdown(!1));ae(this,"Parser",Et);ae(this,"Renderer",jo);ae(this,"TextRenderer",ri);ae(this,"Lexer",Tt);ae(this,"Tokenizer",Uo);ae(this,"Hooks",Rr);this.use(...e)}walkTokens(e,t){var r,o;let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let a=i;for(let d of a.header)n=n.concat(this.walkTokens(d.tokens,t));for(let d of a.rows)for(let l of d)n=n.concat(this.walkTokens(l.tokens,t));break}case"list":{let a=i;n=n.concat(this.walkTokens(a.items,t));break}default:{let a=i;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(d=>{let l=a[d].flat(1/0);n=n.concat(this.walkTokens(l,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r=v({},n);if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let i=t.renderers[o.name];i?t.renderers[o.name]=function(...a){let d=o.renderer.apply(this,a);return d===!1&&(d=i.apply(this,a)),d}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[o.level];i?i.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),r.extensions=t),n.renderer){let o=this.defaults.renderer||new jo(this.defaults);for(let i in n.renderer){if(!(i in o))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let a=i,d=n.renderer[a],l=o[a];o[a]=(...p)=>{let h=d.apply(o,p);return h===!1&&(h=l.apply(o,p)),h||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new Uo(this.defaults);for(let i in n.tokenizer){if(!(i in o))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,d=n.tokenizer[a],l=o[a];o[a]=(...p)=>{let h=d.apply(o,p);return h===!1&&(h=l.apply(o,p)),h}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new Rr;for(let i in n.hooks){if(!(i in o))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,d=n.hooks[a],l=o[a];Rr.passThroughHooks.has(i)?o[a]=p=>{if(this.defaults.async&&Rr.passThroughHooksRespectAsync.has(i))return L(this,null,function*(){let g=yield d.call(o,p);return l.call(o,g)});let h=d.call(o,p);return l.call(o,h)}:o[a]=(...p)=>{if(this.defaults.async)return L(this,null,function*(){let g=yield d.apply(o,p);return g===!1&&(g=yield l.apply(o,p)),g});let h=d.apply(o,p);return h===!1&&(h=l.apply(o,p)),h}}r.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(a){let d=[];return d.push(i.call(this,a)),o&&(d=d.concat(o.call(this,a))),d}}this.defaults=v(v({},this.defaults),r)}),this}setOptions(e){return this.defaults=v(v({},this.defaults),e),this}lexer(e,t){return Tt.lex(e,t!=null?t:this.defaults)}parser(e,t){return Et.parse(e,t!=null?t:this.defaults)}parseMarkdown(e){return(t,n)=>{let r=v({},n),o=v(v({},this.defaults),r),i=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return L(this,null,function*(){let a=o.hooks?yield o.hooks.preprocess(t):t,d=yield(o.hooks?yield o.hooks.provideLexer(e):e?Tt.lex:Tt.lexInline)(a,o),l=o.hooks?yield o.hooks.processAllTokens(d):d;o.walkTokens&&(yield Promise.all(this.walkTokens(l,o.walkTokens)));let p=yield(o.hooks?yield o.hooks.provideParser(e):e?Et.parse:Et.parseInline)(l,o);return o.hooks?yield o.hooks.postprocess(p):p}).catch(i);try{o.hooks&&(t=o.hooks.preprocess(t));let a=(o.hooks?o.hooks.provideLexer(e):e?Tt.lex:Tt.lexInline)(t,o);o.hooks&&(a=o.hooks.processAllTokens(a)),o.walkTokens&&this.walkTokens(a,o.walkTokens);let d=(o.hooks?o.hooks.provideParser(e):e?Et.parse:Et.parseInline)(a,o);return o.hooks&&(d=o.hooks.postprocess(d)),d}catch(a){return i(a)}}}onError(e,t){return n=>{if(n.message+=`
1429
- Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+Pt(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},Cn=new Db;function le(e,t){return Cn.parse(e,t)}le.options=le.setOptions=function(e){return Cn.setOptions(e),le.defaults=Cn.defaults,Oc(le.defaults),le};le.getDefaults=Xs;le.defaults=zn;function Mb(...e){return Cn.use(...e),le.defaults=Cn.defaults,Oc(le.defaults),le}le.use=Mb;le.walkTokens=function(e,t){return Cn.walkTokens(e,t)};le.parseInline=Cn.parseInline;le.Parser=Et;le.parser=Et.parse;le.Renderer=jo;le.TextRenderer=ri;le.Lexer=Tt;le.lexer=Tt.lex;le.Tokenizer=Uo;le.Hooks=Rr;le.parse=le;le.options;le.setOptions;le.walkTokens;le.parseInline;Et.parse;Tt.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:Bc,setPrototypeOf:ya,isFrozen:Ub,getPrototypeOf:jb,getOwnPropertyDescriptor:Zb}=Object;let{freeze:Ke,seal:ht,create:zs}=Object,{apply:$s,construct:Os}=typeof Reflect!="undefined"&&Reflect;Ke||(Ke=function(t){return t});ht||(ht=function(t){return t});$s||($s=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return t.apply(n,o)});Os||(Os=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 ho=Qe(Array.prototype.forEach),qb=Qe(Array.prototype.lastIndexOf),wa=Qe(Array.prototype.pop),Sr=Qe(Array.prototype.push),Hb=Qe(Array.prototype.splice),yo=Qe(String.prototype.toLowerCase),bs=Qe(String.prototype.toString),ks=Qe(String.prototype.match),Tr=Qe(String.prototype.replace),Fb=Qe(String.prototype.indexOf),Bb=Qe(String.prototype.trim),wt=Qe(Object.prototype.hasOwnProperty),We=Qe(RegExp.prototype.test),Er=Gb(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 $s(e,t,r)}}function Gb(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Os(e,n)}}function Y(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yo;ya&&ya(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(Ub(t)||(t[r]=i),o=i)}e[o]=!0}return e}function Wb(e){for(let t=0;t<e.length;t++)wt(e,t)||(e[t]=null);return e}function Rt(e){const t=zs(null);for(const[n,r]of Bc(e))wt(e,n)&&(Array.isArray(r)?t[n]=Wb(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=Rt(r):t[n]=r);return t}function Ar(e,t){for(;e!==null;){const r=Zb(e,t);if(r){if(r.get)return Qe(r.get);if(typeof r.value=="function")return Qe(r.value)}e=jb(e)}function n(){return null}return n}const xa=Ke(["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"]),_s=Ke(["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"]),vs=Ke(["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"]),Jb=Ke(["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"]),ys=Ke(["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"]),Yb=Ke(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Sa=Ke(["#text"]),Ta=Ke(["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"]),ws=Ke(["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"]),Ea=Ke(["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"]),fo=Ke(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Xb=ht(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Vb=ht(/<%[\w\W]*|[\w\W]*%>/gm),Kb=ht(/\$\{[\w\W]*/gm),Qb=ht(/^data-[\-\w.\u00B7-\uFFFF]+$/),ek=ht(/^aria-[\-\w]+$/),Gc=ht(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),tk=ht(/^(?:\w+script|data):/i),nk=ht(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Wc=ht(/^html$/i),rk=ht(/^[a-z][.\w]*(-[.\w]+)+$/i);var Aa=Object.freeze({__proto__:null,ARIA_ATTR:ek,ATTR_WHITESPACE:nk,CUSTOM_ELEMENT:rk,DATA_ATTR:Qb,DOCTYPE_NAME:Wc,ERB_EXPR:Vb,IS_ALLOWED_URI:Gc,IS_SCRIPT_OR_DATA:tk,MUSTACHE_EXPR:Xb,TMPLIT_EXPR:Kb});const Cr={element:1,text:3,progressingInstruction:7,comment:8,document:9},ok=function(){return typeof window=="undefined"?null:window},sk=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch(a){return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Ca=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Jc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ok();const t=M=>Jc(M);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Cr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:d,Element:l,NodeFilter:p,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:m,trustedTypes:k}=e,y=l.prototype,E=Ar(y,"cloneNode"),Z=Ar(y,"remove"),ee=Ar(y,"nextSibling"),N=Ar(y,"childNodes"),T=Ar(y,"parentNode");if(typeof a=="function"){const M=n.createElement("template");M.content&&M.content.ownerDocument&&(n=M.content.ownerDocument)}let S,P="";const{implementation:D,createNodeIterator:J,createDocumentFragment:he,getElementsByTagName:Oe}=n,{importNode:nt}=r;let te=Ca();t.isSupported=typeof Bc=="function"&&typeof T=="function"&&D&&D.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Se,ERB_EXPR:Fe,TMPLIT_EXPR:Xt,DATA_ATTR:Vt,ARIA_ATTR:rt,IS_SCRIPT_OR_DATA:gt,ATTR_WHITESPACE:mt,CUSTOM_ELEMENT:$n}=Aa;let{IS_ALLOWED_URI:hn}=Aa,ve=null;const W=Y({},[...xa,..._s,...vs,...ys,...Sa]);let F=null;const Ee=Y({},[...Ta,...ws,...Ea,...fo]);let K=Object.seal(zs(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}})),Ae=null,ot=null;const bt=Object.seal(zs(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let we=!0,re=!0,Be=!1,je=!0,ue=!1,Dt=!0,Le=!1,Ze=!1,Mt=!1,st=!1,fn=!1,gn=!1,Hr=!0,ur=!1;const es="user-content-";let dr=!0,mn=!1,Kt={},Ge=null;const pr=Y({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let de=null;const Fr=Y({},["audio","video","img","source","image","track"]);let hr=null;const Br=Y({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),On="http://www.w3.org/1998/Math/MathML",Nn="http://www.w3.org/2000/svg",kt="http://www.w3.org/1999/xhtml";let Qt=kt,bn=!1,kn=null;const ts=Y({},[On,Nn,kt],bs);let Dn=Y({},["mi","mo","mn","ms","mtext"]),Mn=Y({},["annotation-xml"]);const ns=Y({},["title","style","font","a","script"]);let Ut=null;const _t=["application/xhtml+xml","text/html"],rs="text/html";let pe=null,en=null;const Gr=n.createElement("form"),fr=function(_){return _ instanceof RegExp||_ instanceof Function},Un=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(en&&en===_)){if((!_||typeof _!="object")&&(_={}),_=Rt(_),Ut=_t.indexOf(_.PARSER_MEDIA_TYPE)===-1?rs:_.PARSER_MEDIA_TYPE,pe=Ut==="application/xhtml+xml"?bs:yo,ve=wt(_,"ALLOWED_TAGS")?Y({},_.ALLOWED_TAGS,pe):W,F=wt(_,"ALLOWED_ATTR")?Y({},_.ALLOWED_ATTR,pe):Ee,kn=wt(_,"ALLOWED_NAMESPACES")?Y({},_.ALLOWED_NAMESPACES,bs):ts,hr=wt(_,"ADD_URI_SAFE_ATTR")?Y(Rt(Br),_.ADD_URI_SAFE_ATTR,pe):Br,de=wt(_,"ADD_DATA_URI_TAGS")?Y(Rt(Fr),_.ADD_DATA_URI_TAGS,pe):Fr,Ge=wt(_,"FORBID_CONTENTS")?Y({},_.FORBID_CONTENTS,pe):pr,Ae=wt(_,"FORBID_TAGS")?Y({},_.FORBID_TAGS,pe):Rt({}),ot=wt(_,"FORBID_ATTR")?Y({},_.FORBID_ATTR,pe):Rt({}),Kt=wt(_,"USE_PROFILES")?_.USE_PROFILES:!1,we=_.ALLOW_ARIA_ATTR!==!1,re=_.ALLOW_DATA_ATTR!==!1,Be=_.ALLOW_UNKNOWN_PROTOCOLS||!1,je=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ue=_.SAFE_FOR_TEMPLATES||!1,Dt=_.SAFE_FOR_XML!==!1,Le=_.WHOLE_DOCUMENT||!1,st=_.RETURN_DOM||!1,fn=_.RETURN_DOM_FRAGMENT||!1,gn=_.RETURN_TRUSTED_TYPE||!1,Mt=_.FORCE_BODY||!1,Hr=_.SANITIZE_DOM!==!1,ur=_.SANITIZE_NAMED_PROPS||!1,dr=_.KEEP_CONTENT!==!1,mn=_.IN_PLACE||!1,hn=_.ALLOWED_URI_REGEXP||Gc,Qt=_.NAMESPACE||kt,Dn=_.MATHML_TEXT_INTEGRATION_POINTS||Dn,Mn=_.HTML_INTEGRATION_POINTS||Mn,K=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&fr(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(K.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&fr(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(K.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(K.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ue&&(re=!1),fn&&(st=!0),Kt&&(ve=Y({},Sa),F=[],Kt.html===!0&&(Y(ve,xa),Y(F,Ta)),Kt.svg===!0&&(Y(ve,_s),Y(F,ws),Y(F,fo)),Kt.svgFilters===!0&&(Y(ve,vs),Y(F,ws),Y(F,fo)),Kt.mathMl===!0&&(Y(ve,ys),Y(F,Ea),Y(F,fo))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?bt.tagCheck=_.ADD_TAGS:(ve===W&&(ve=Rt(ve)),Y(ve,_.ADD_TAGS,pe))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?bt.attributeCheck=_.ADD_ATTR:(F===Ee&&(F=Rt(F)),Y(F,_.ADD_ATTR,pe))),_.ADD_URI_SAFE_ATTR&&Y(hr,_.ADD_URI_SAFE_ATTR,pe),_.FORBID_CONTENTS&&(Ge===pr&&(Ge=Rt(Ge)),Y(Ge,_.FORBID_CONTENTS,pe)),_.ADD_FORBID_CONTENTS&&(Ge===pr&&(Ge=Rt(Ge)),Y(Ge,_.ADD_FORBID_CONTENTS,pe)),dr&&(ve["#text"]=!0),Le&&Y(ve,["html","head","body"]),ve.table&&(Y(ve,["tbody"]),delete Ae.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=_.TRUSTED_TYPES_POLICY,P=S.createHTML("")}else S===void 0&&(S=sk(k,o)),S!==null&&typeof P=="string"&&(P=S.createHTML(""));Ke&&Ke(_),en=_}},gr=Y({},[..._s,...vs,...Jb]),Wr=Y({},[...ys,...Yb]),os=function(_){let A=T(_);(!A||!A.tagName)&&(A={namespaceURI:Qt,tagName:"template"});const I=yo(_.tagName),ie=yo(A.tagName);return kn[_.namespaceURI]?_.namespaceURI===Nn?A.namespaceURI===kt?I==="svg":A.namespaceURI===On?I==="svg"&&(ie==="annotation-xml"||Dn[ie]):!!gr[I]:_.namespaceURI===On?A.namespaceURI===kt?I==="math":A.namespaceURI===Nn?I==="math"&&Mn[ie]:!!Wr[I]:_.namespaceURI===kt?A.namespaceURI===Nn&&!Mn[ie]||A.namespaceURI===On&&!Dn[ie]?!1:!Wr[I]&&(ns[I]||!gr[I]):!!(Ut==="application/xhtml+xml"&&kn[_.namespaceURI]):!1},at=function(_){Sr(t.removed,{element:_});try{T(_).removeChild(_)}catch(A){Z(_)}},ct=function(_,A){try{Sr(t.removed,{attribute:A.getAttributeNode(_),from:A})}catch(I){Sr(t.removed,{attribute:null,from:A})}if(A.removeAttribute(_),_==="is")if(st||fn)try{at(A)}catch(I){}else try{A.setAttribute(_,"")}catch(I){}},Jr=function(_){let A=null,I=null;if(Mt)_="<remove></remove>"+_;else{const xe=ks(_,/^[\r\n\t ]+/);I=xe&&xe[0]}Ut==="application/xhtml+xml"&&Qt===kt&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const ie=S?S.createHTML(_):_;if(Qt===kt)try{A=new m().parseFromString(ie,Ut)}catch(xe){}if(!A||!A.documentElement){A=D.createDocument(Qt,"template",null);try{A.documentElement.innerHTML=bn?P:ie}catch(xe){}}const $e=A.body||A.documentElement;return _&&I&&$e.insertBefore(n.createTextNode(I),$e.childNodes[0]||null),Qt===kt?Oe.call(A,Le?"html":"body")[0]:Le?A.documentElement:$e},mr=function(_){return J.call(_.ownerDocument||_,_,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},br=function(_){return _ instanceof g&&(typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||!(_.attributes instanceof h)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function")},Yr=function(_){return typeof d=="function"&&_ instanceof d};function vt(M,_,A){ho(M,I=>{I.call(t,_,A,en)})}const Xr=function(_){let A=null;if(vt(te.beforeSanitizeElements,_,null),br(_))return at(_),!0;const I=pe(_.nodeName);if(vt(te.uponSanitizeElement,_,{tagName:I,allowedTags:ve}),Dt&&_.hasChildNodes()&&!Yr(_.firstElementChild)&&We(/<[/\w!]/g,_.innerHTML)&&We(/<[/\w!]/g,_.textContent)||_.nodeType===Cr.progressingInstruction||Dt&&_.nodeType===Cr.comment&&We(/<[/\w]/g,_.data))return at(_),!0;if(!(bt.tagCheck instanceof Function&&bt.tagCheck(I))&&(!ve[I]||Ae[I])){if(!Ae[I]&&Kr(I)&&(K.tagNameCheck instanceof RegExp&&We(K.tagNameCheck,I)||K.tagNameCheck instanceof Function&&K.tagNameCheck(I)))return!1;if(dr&&!Ge[I]){const ie=T(_)||_.parentNode,$e=N(_)||_.childNodes;if($e&&ie){const xe=$e.length;for(let qe=xe-1;qe>=0;--qe){const yt=E($e[qe],!0);yt.__removalCount=(_.__removalCount||0)+1,ie.insertBefore(yt,ee(_))}}}return at(_),!0}return _ instanceof l&&!os(_)||(I==="noscript"||I==="noembed"||I==="noframes")&&We(/<\/no(script|embed|frames)/i,_.innerHTML)?(at(_),!0):(ue&&_.nodeType===Cr.text&&(A=_.textContent,ho([Se,Fe,Xt],ie=>{A=Tr(A,ie," ")}),_.textContent!==A&&(Sr(t.removed,{element:_.cloneNode()}),_.textContent=A)),vt(te.afterSanitizeElements,_,null),!1)},Vr=function(_,A,I){if(Hr&&(A==="id"||A==="name")&&(I in n||I in Gr))return!1;if(!(re&&!ot[A]&&We(Vt,A))){if(!(we&&We(rt,A))){if(!(bt.attributeCheck instanceof Function&&bt.attributeCheck(A,_))){if(!F[A]||ot[A]){if(!(Kr(_)&&(K.tagNameCheck instanceof RegExp&&We(K.tagNameCheck,_)||K.tagNameCheck instanceof Function&&K.tagNameCheck(_))&&(K.attributeNameCheck instanceof RegExp&&We(K.attributeNameCheck,A)||K.attributeNameCheck instanceof Function&&K.attributeNameCheck(A,_))||A==="is"&&K.allowCustomizedBuiltInElements&&(K.tagNameCheck instanceof RegExp&&We(K.tagNameCheck,I)||K.tagNameCheck instanceof Function&&K.tagNameCheck(I))))return!1}else if(!hr[A]){if(!We(hn,Tr(I,mt,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&_!=="script"&&Fb(I,"data:")===0&&de[_])){if(!(Be&&!We(gt,Tr(I,mt,"")))){if(I)return!1}}}}}}}return!0},Kr=function(_){return _!=="annotation-xml"&&ks(_,$n)},kr=function(_){vt(te.beforeSanitizeAttributes,_,null);const{attributes:A}=_;if(!A||br(_))return;const I={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:F,forceKeepAttr:void 0};let ie=A.length;for(;ie--;){const $e=A[ie],{name:xe,namespaceURI:qe,value:yt}=$e,Ct=pe(xe),_r=yt;let Ie=xe==="value"?_r:Bb(_r);if(I.attrName=Ct,I.attrValue=Ie,I.keepAttr=!0,I.forceKeepAttr=void 0,vt(te.uponSanitizeAttribute,_,I),Ie=I.attrValue,ur&&(Ct==="id"||Ct==="name")&&(ct(xe,_),Ie=es+Ie),Dt&&We(/((--!?|])>)|<\/(style|title|textarea)/i,Ie)){ct(xe,_);continue}if(Ct==="attributename"&&ks(Ie,"href")){ct(xe,_);continue}if(I.forceKeepAttr)continue;if(!I.keepAttr){ct(xe,_);continue}if(!je&&We(/\/>/i,Ie)){ct(xe,_);continue}ue&&ho([Se,Fe,Xt],eo=>{Ie=Tr(Ie,eo," ")});const Qr=pe(_.nodeName);if(!Vr(Qr,Ct,Ie)){ct(xe,_);continue}if(S&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!qe)switch(k.getAttributeType(Qr,Ct)){case"TrustedHTML":{Ie=S.createHTML(Ie);break}case"TrustedScriptURL":{Ie=S.createScriptURL(Ie);break}}if(Ie!==_r)try{qe?_.setAttributeNS(qe,xe,Ie):_.setAttribute(xe,Ie),br(_)?at(_):wa(t.removed)}catch(eo){ct(xe,_)}}vt(te.afterSanitizeAttributes,_,null)},jt=function M(_){let A=null;const I=mr(_);for(vt(te.beforeSanitizeShadowDOM,_,null);A=I.nextNode();)vt(te.uponSanitizeShadowNode,A,null),Xr(A),kr(A),A.content instanceof i&&M(A.content);vt(te.afterSanitizeShadowDOM,_,null)};return t.sanitize=function(M){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,I=null,ie=null,$e=null;if(bn=!M,bn&&(M="<!-->"),typeof M!="string"&&!Yr(M))if(typeof M.toString=="function"){if(M=M.toString(),typeof M!="string")throw Er("dirty is not a string, aborting")}else throw Er("toString is not a function");if(!t.isSupported)return M;if(Ze||Un(_),t.removed=[],typeof M=="string"&&(mn=!1),mn){if(M.nodeName){const yt=pe(M.nodeName);if(!ve[yt]||Ae[yt])throw Er("root node is forbidden and cannot be sanitized in-place")}}else if(M instanceof d)A=Jr("<!---->"),I=A.ownerDocument.importNode(M,!0),I.nodeType===Cr.element&&I.nodeName==="BODY"||I.nodeName==="HTML"?A=I:A.appendChild(I);else{if(!st&&!ue&&!Le&&M.indexOf("<")===-1)return S&&gn?S.createHTML(M):M;if(A=Jr(M),!A)return st?null:gn?P:""}A&&Mt&&at(A.firstChild);const xe=mr(mn?M:A);for(;ie=xe.nextNode();)Xr(ie),kr(ie),ie.content instanceof i&&jt(ie.content);if(mn)return M;if(st){if(fn)for($e=he.call(A.ownerDocument);A.firstChild;)$e.appendChild(A.firstChild);else $e=A;return(F.shadowroot||F.shadowrootmode)&&($e=nt.call(r,$e,!0)),$e}let qe=Le?A.outerHTML:A.innerHTML;return Le&&ve["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&We(Wc,A.ownerDocument.doctype.name)&&(qe="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
1430
- `+qe),ue&&ho([Se,Fe,Xt],yt=>{qe=Tr(qe,yt," ")}),S&&gn?S.createHTML(qe):qe},t.setConfig=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Un(M),Ze=!0},t.clearConfig=function(){en=null,Ze=!1},t.isValidAttribute=function(M,_,A){en||Un({});const I=pe(M),ie=pe(_);return Vr(I,ie,A)},t.addHook=function(M,_){typeof _=="function"&&Sr(te[M],_)},t.removeHook=function(M,_){if(_!==void 0){const A=qb(te[M],_);return A===-1?void 0:Hb(te[M],A,1)[0]}return wa(te[M])},t.removeHooks=function(M){te[M]=[]},t.removeAllHooks=function(){te=Ca()},t}var ik=Jc();function Yc(e){const t=le.parse(e,{gfm:!0,breaks:!0,async:!1});return ik.sanitize(t)}const Xc=1e3,Vc=32,Pa=15e3,ak=new Set(["completed","failed","cancelled"]),ck=4e3;let $=null,Nt=null,Me=null,oi=null,Zo=null,Ns=!1,wo=null,Ir=null,H={kind:"connecting"},Qn=[],or=null,me=null,sr=null,Ft=null,zr=-1,Ve=null,Gt=!1,Bt=null,Sn=new Set;function Ds(){xo(),zc(),Nt&&clearInterval(Nt),Nt=null,Bt==null||Bt(),Bt=null,Me==null||Me.destroy(),Me=null,$&&Jt($),$==null||$.remove(),$=null,oi=null,H={kind:"connecting"},Qn=[],or=null,me=null,sr=null,Ft=null,Zo=null,zr=-1,Ve=null,Gt=!1,Sn=new Set}function si(e,t,n,r,o){$&&Ds(),oi=o!=null?o:null,H={kind:"connecting"},Qn=[],or=null,zr=-1,Ve=null,Gt=!1,Sn=new Set,me=e,sr=n,Ft=t,Zo=r,Ic({taskId:e,backendUrl:n,title:r}),$=document.createElement("div"),$.className="ap-sdk-panel",$.setAttribute("data-ap-sdk","1"),$.setAttribute("role","dialog"),$.setAttribute("aria-modal","true"),$.setAttribute("aria-label","Automation in progress");const i=r.length>55?`${r.slice(0,52)}…`:r;$.innerHTML=`
1428
+ `}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>${zt(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=ba(e);if(o===null)return r;e=o;let i='<a href="'+e+'"';return t&&(i+=' title="'+zt(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let o=ba(e);if(o===null)return zt(n);e=o;let i=`<img src="${e}" alt="${zt(n)}"`;return t&&(i+=` title="${zt(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:zt(e.text)}},ri=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Et=class Is{constructor(t){ie(this,"options");ie(this,"renderer");ie(this,"textRenderer");this.options=t||$n,this.options.renderer=this.options.renderer||new jo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ri}static parse(t,n){return new Is(n).parse(t)}static parseInline(t,n){return new Is(n).parseInline(t)}parse(t){var r,o;this.renderer.parser=this;let n="";for(let i=0;i<t.length;i++){let a=t[i];if((o=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&o[a.type]){let l=a,p=this.options.extensions.renderers[l.type].call({parser:this},l);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(l.type)){n+=p||"";continue}}let d=a;switch(d.type){case"space":{n+=this.renderer.space(d);break}case"hr":{n+=this.renderer.hr(d);break}case"heading":{n+=this.renderer.heading(d);break}case"code":{n+=this.renderer.code(d);break}case"table":{n+=this.renderer.table(d);break}case"blockquote":{n+=this.renderer.blockquote(d);break}case"list":{n+=this.renderer.list(d);break}case"checkbox":{n+=this.renderer.checkbox(d);break}case"html":{n+=this.renderer.html(d);break}case"def":{n+=this.renderer.def(d);break}case"paragraph":{n+=this.renderer.paragraph(d);break}case"text":{n+=this.renderer.text(d);break}default:{let l='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return n}parseInline(t,n=this.renderer){var o,i;this.renderer.parser=this;let r="";for(let a=0;a<t.length;a++){let d=t[a];if((i=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&i[d.type]){let p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(d.type)){r+=p||"";continue}}let l=d;switch(l.type){case"escape":{r+=n.text(l);break}case"html":{r+=n.html(l);break}case"link":{r+=n.link(l);break}case"image":{r+=n.image(l);break}case"checkbox":{r+=n.checkbox(l);break}case"strong":{r+=n.strong(l);break}case"em":{r+=n.em(l);break}case"codespan":{r+=n.codespan(l);break}case"br":{r+=n.br(l);break}case"del":{r+=n.del(l);break}case"text":{r+=n.text(l);break}default:{let p='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return r}},ko,Rr=(ko=class{constructor(e){ie(this,"options");ie(this,"block");this.options=e||$n}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Tt.lex:Tt.lexInline}provideParser(e=this.block){return e?Et.parse:Et.parseInline}},ie(ko,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ie(ko,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),ko),Db=class{constructor(...e){ie(this,"defaults",Xs());ie(this,"options",this.setOptions);ie(this,"parse",this.parseMarkdown(!0));ie(this,"parseInline",this.parseMarkdown(!1));ie(this,"Parser",Et);ie(this,"Renderer",jo);ie(this,"TextRenderer",ri);ie(this,"Lexer",Tt);ie(this,"Tokenizer",Uo);ie(this,"Hooks",Rr);this.use(...e)}walkTokens(e,t){var r,o;let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let a=i;for(let d of a.header)n=n.concat(this.walkTokens(d.tokens,t));for(let d of a.rows)for(let l of d)n=n.concat(this.walkTokens(l.tokens,t));break}case"list":{let a=i;n=n.concat(this.walkTokens(a.items,t));break}default:{let a=i;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(d=>{let l=a[d].flat(1/0);n=n.concat(this.walkTokens(l,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r=v({},n);if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let i=t.renderers[o.name];i?t.renderers[o.name]=function(...a){let d=o.renderer.apply(this,a);return d===!1&&(d=i.apply(this,a)),d}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[o.level];i?i.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),r.extensions=t),n.renderer){let o=this.defaults.renderer||new jo(this.defaults);for(let i in n.renderer){if(!(i in o))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let a=i,d=n.renderer[a],l=o[a];o[a]=(...p)=>{let h=d.apply(o,p);return h===!1&&(h=l.apply(o,p)),h||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new Uo(this.defaults);for(let i in n.tokenizer){if(!(i in o))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,d=n.tokenizer[a],l=o[a];o[a]=(...p)=>{let h=d.apply(o,p);return h===!1&&(h=l.apply(o,p)),h}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new Rr;for(let i in n.hooks){if(!(i in o))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,d=n.hooks[a],l=o[a];Rr.passThroughHooks.has(i)?o[a]=p=>{if(this.defaults.async&&Rr.passThroughHooksRespectAsync.has(i))return L(this,null,function*(){let g=yield d.call(o,p);return l.call(o,g)});let h=d.call(o,p);return l.call(o,h)}:o[a]=(...p)=>{if(this.defaults.async)return L(this,null,function*(){let g=yield d.apply(o,p);return g===!1&&(g=yield l.apply(o,p)),g});let h=d.apply(o,p);return h===!1&&(h=l.apply(o,p)),h}}r.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(a){let d=[];return d.push(i.call(this,a)),o&&(d=d.concat(o.call(this,a))),d}}this.defaults=v(v({},this.defaults),r)}),this}setOptions(e){return this.defaults=v(v({},this.defaults),e),this}lexer(e,t){return Tt.lex(e,t!=null?t:this.defaults)}parser(e,t){return Et.parse(e,t!=null?t:this.defaults)}parseMarkdown(e){return(t,n)=>{let r=v({},n),o=v(v({},this.defaults),r),i=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return L(this,null,function*(){let a=o.hooks?yield o.hooks.preprocess(t):t,d=yield(o.hooks?yield o.hooks.provideLexer(e):e?Tt.lex:Tt.lexInline)(a,o),l=o.hooks?yield o.hooks.processAllTokens(d):d;o.walkTokens&&(yield Promise.all(this.walkTokens(l,o.walkTokens)));let p=yield(o.hooks?yield o.hooks.provideParser(e):e?Et.parse:Et.parseInline)(l,o);return o.hooks?yield o.hooks.postprocess(p):p}).catch(i);try{o.hooks&&(t=o.hooks.preprocess(t));let a=(o.hooks?o.hooks.provideLexer(e):e?Tt.lex:Tt.lexInline)(t,o);o.hooks&&(a=o.hooks.processAllTokens(a)),o.walkTokens&&this.walkTokens(a,o.walkTokens);let d=(o.hooks?o.hooks.provideParser(e):e?Et.parse:Et.parseInline)(a,o);return o.hooks&&(d=o.hooks.postprocess(d)),d}catch(a){return i(a)}}}onError(e,t){return n=>{if(n.message+=`
1429
+ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+zt(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},Pn=new Db;function ce(e,t){return Pn.parse(e,t)}ce.options=ce.setOptions=function(e){return Pn.setOptions(e),ce.defaults=Pn.defaults,Oc(ce.defaults),ce};ce.getDefaults=Xs;ce.defaults=$n;function Mb(...e){return Pn.use(...e),ce.defaults=Pn.defaults,Oc(ce.defaults),ce}ce.use=Mb;ce.walkTokens=function(e,t){return Pn.walkTokens(e,t)};ce.parseInline=Pn.parseInline;ce.Parser=Et;ce.parser=Et.parse;ce.Renderer=jo;ce.TextRenderer=ri;ce.Lexer=Tt;ce.lexer=Tt.lex;ce.Tokenizer=Uo;ce.Hooks=Rr;ce.parse=ce;ce.options;ce.setOptions;ce.walkTokens;ce.parseInline;Et.parse;Tt.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:Bc,setPrototypeOf:ya,isFrozen:Ub,getPrototypeOf:jb,getOwnPropertyDescriptor:Zb}=Object;let{freeze:tt,seal:ft,create:zs}=Object,{apply:$s,construct:Os}=typeof Reflect!="undefined"&&Reflect;tt||(tt=function(t){return t});ft||(ft=function(t){return t});$s||($s=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return t.apply(n,o)});Os||(Os=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 ho=nt(Array.prototype.forEach),qb=nt(Array.prototype.lastIndexOf),wa=nt(Array.prototype.pop),Sr=nt(Array.prototype.push),Hb=nt(Array.prototype.splice),yo=nt(String.prototype.toLowerCase),bs=nt(String.prototype.toString),ks=nt(String.prototype.match),Tr=nt(String.prototype.replace),Fb=nt(String.prototype.indexOf),Bb=nt(String.prototype.trim),xt=nt(Object.prototype.hasOwnProperty),Xe=nt(RegExp.prototype.test),Er=Gb(TypeError);function nt(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return $s(e,t,r)}}function Gb(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Os(e,n)}}function X(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yo;ya&&ya(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(Ub(t)||(t[r]=i),o=i)}e[o]=!0}return e}function Wb(e){for(let t=0;t<e.length;t++)xt(e,t)||(e[t]=null);return e}function $t(e){const t=zs(null);for(const[n,r]of Bc(e))xt(e,n)&&(Array.isArray(r)?t[n]=Wb(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=$t(r):t[n]=r);return t}function Ar(e,t){for(;e!==null;){const r=Zb(e,t);if(r){if(r.get)return nt(r.get);if(typeof r.value=="function")return nt(r.value)}e=jb(e)}function n(){return null}return n}const xa=tt(["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"]),_s=tt(["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"]),vs=tt(["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"]),Jb=tt(["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"]),ys=tt(["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"]),Yb=tt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Sa=tt(["#text"]),Ta=tt(["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"]),ws=tt(["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"]),Ea=tt(["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"]),fo=tt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Xb=ft(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Vb=ft(/<%[\w\W]*|[\w\W]*%>/gm),Kb=ft(/\$\{[\w\W]*/gm),Qb=ft(/^data-[\-\w.\u00B7-\uFFFF]+$/),ek=ft(/^aria-[\-\w]+$/),Gc=ft(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),tk=ft(/^(?:\w+script|data):/i),nk=ft(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Wc=ft(/^html$/i),rk=ft(/^[a-z][.\w]*(-[.\w]+)+$/i);var Aa=Object.freeze({__proto__:null,ARIA_ATTR:ek,ATTR_WHITESPACE:nk,CUSTOM_ELEMENT:rk,DATA_ATTR:Qb,DOCTYPE_NAME:Wc,ERB_EXPR:Vb,IS_ALLOWED_URI:Gc,IS_SCRIPT_OR_DATA:tk,MUSTACHE_EXPR:Xb,TMPLIT_EXPR:Kb});const Cr={element:1,text:3,progressingInstruction:7,comment:8,document:9},ok=function(){return typeof window=="undefined"?null:window},sk=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch(a){return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Ca=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Jc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ok();const t=D=>Jc(D);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Cr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:d,Element:l,NodeFilter:p,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:m,trustedTypes:k}=e,y=l.prototype,E=Ar(y,"cloneNode"),j=Ar(y,"remove"),Q=Ar(y,"nextSibling"),N=Ar(y,"childNodes"),T=Ar(y,"parentNode");if(typeof a=="function"){const D=n.createElement("template");D.content&&D.content.ownerDocument&&(n=D.content.ownerDocument)}let S,P="";const{implementation:Z,createNodeIterator:Y,createDocumentFragment:he,getElementsByTagName:Oe}=n,{importNode:qe}=r;let te=Ca();t.isSupported=typeof Bc=="function"&&typeof T=="function"&&Z&&Z.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Pe,ERB_EXPR:He,TMPLIT_EXPR:Ct,DATA_ATTR:fn,ARIA_ATTR:Pt,IS_SCRIPT_OR_DATA:mt,ATTR_WHITESPACE:Rt,CUSTOM_ELEMENT:Kt}=Aa;let{IS_ALLOWED_URI:bt}=Aa,ve=null;const gn=X({},[...xa,..._s,...vs,...ys,...Sa]);let ye=null;const W=X({},[...Ta,...ws,...Ea,...fo]);let H=Object.seal(zs(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}})),re=null,Ne=null;const We=Object.seal(zs(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let le=!0,Se=!0,mn=!1,De=!0,ue=!1,ze=!0,Re=!1,kt=!1,Fe=!1,Je=!1,Lt=!1,at=!1,Hr=!0,ur=!1;const es="user-content-";let dr=!0,bn=!1,Qt={},Ye=null;const pr=X({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let de=null;const Fr=X({},["audio","video","img","source","image","track"]);let hr=null;const Br=X({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),On="http://www.w3.org/1998/Math/MathML",Nn="http://www.w3.org/2000/svg",_t="http://www.w3.org/1999/xhtml";let en=_t,kn=!1,_n=null;const ts=X({},[On,Nn,_t],bs);let Dn=X({},["mi","mo","mn","ms","mtext"]),Mn=X({},["annotation-xml"]);const ns=X({},["title","style","font","a","script"]);let Zt=null;const vt=["application/xhtml+xml","text/html"],rs="text/html";let pe=null,tn=null;const Gr=n.createElement("form"),fr=function(_){return _ instanceof RegExp||_ instanceof Function},Un=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(tn&&tn===_)){if((!_||typeof _!="object")&&(_={}),_=$t(_),Zt=vt.indexOf(_.PARSER_MEDIA_TYPE)===-1?rs:_.PARSER_MEDIA_TYPE,pe=Zt==="application/xhtml+xml"?bs:yo,ve=xt(_,"ALLOWED_TAGS")?X({},_.ALLOWED_TAGS,pe):gn,ye=xt(_,"ALLOWED_ATTR")?X({},_.ALLOWED_ATTR,pe):W,_n=xt(_,"ALLOWED_NAMESPACES")?X({},_.ALLOWED_NAMESPACES,bs):ts,hr=xt(_,"ADD_URI_SAFE_ATTR")?X($t(Br),_.ADD_URI_SAFE_ATTR,pe):Br,de=xt(_,"ADD_DATA_URI_TAGS")?X($t(Fr),_.ADD_DATA_URI_TAGS,pe):Fr,Ye=xt(_,"FORBID_CONTENTS")?X({},_.FORBID_CONTENTS,pe):pr,re=xt(_,"FORBID_TAGS")?X({},_.FORBID_TAGS,pe):$t({}),Ne=xt(_,"FORBID_ATTR")?X({},_.FORBID_ATTR,pe):$t({}),Qt=xt(_,"USE_PROFILES")?_.USE_PROFILES:!1,le=_.ALLOW_ARIA_ATTR!==!1,Se=_.ALLOW_DATA_ATTR!==!1,mn=_.ALLOW_UNKNOWN_PROTOCOLS||!1,De=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ue=_.SAFE_FOR_TEMPLATES||!1,ze=_.SAFE_FOR_XML!==!1,Re=_.WHOLE_DOCUMENT||!1,Je=_.RETURN_DOM||!1,Lt=_.RETURN_DOM_FRAGMENT||!1,at=_.RETURN_TRUSTED_TYPE||!1,Fe=_.FORCE_BODY||!1,Hr=_.SANITIZE_DOM!==!1,ur=_.SANITIZE_NAMED_PROPS||!1,dr=_.KEEP_CONTENT!==!1,bn=_.IN_PLACE||!1,bt=_.ALLOWED_URI_REGEXP||Gc,en=_.NAMESPACE||_t,Dn=_.MATHML_TEXT_INTEGRATION_POINTS||Dn,Mn=_.HTML_INTEGRATION_POINTS||Mn,H=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&fr(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&fr(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ue&&(Se=!1),Lt&&(Je=!0),Qt&&(ve=X({},Sa),ye=[],Qt.html===!0&&(X(ve,xa),X(ye,Ta)),Qt.svg===!0&&(X(ve,_s),X(ye,ws),X(ye,fo)),Qt.svgFilters===!0&&(X(ve,vs),X(ye,ws),X(ye,fo)),Qt.mathMl===!0&&(X(ve,ys),X(ye,Ea),X(ye,fo))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?We.tagCheck=_.ADD_TAGS:(ve===gn&&(ve=$t(ve)),X(ve,_.ADD_TAGS,pe))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?We.attributeCheck=_.ADD_ATTR:(ye===W&&(ye=$t(ye)),X(ye,_.ADD_ATTR,pe))),_.ADD_URI_SAFE_ATTR&&X(hr,_.ADD_URI_SAFE_ATTR,pe),_.FORBID_CONTENTS&&(Ye===pr&&(Ye=$t(Ye)),X(Ye,_.FORBID_CONTENTS,pe)),_.ADD_FORBID_CONTENTS&&(Ye===pr&&(Ye=$t(Ye)),X(Ye,_.ADD_FORBID_CONTENTS,pe)),dr&&(ve["#text"]=!0),Re&&X(ve,["html","head","body"]),ve.table&&(X(ve,["tbody"]),delete re.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=_.TRUSTED_TYPES_POLICY,P=S.createHTML("")}else S===void 0&&(S=sk(k,o)),S!==null&&typeof P=="string"&&(P=S.createHTML(""));tt&&tt(_),tn=_}},gr=X({},[..._s,...vs,...Jb]),Wr=X({},[...ys,...Yb]),os=function(_){let A=T(_);(!A||!A.tagName)&&(A={namespaceURI:en,tagName:"template"});const I=yo(_.tagName),se=yo(A.tagName);return _n[_.namespaceURI]?_.namespaceURI===Nn?A.namespaceURI===_t?I==="svg":A.namespaceURI===On?I==="svg"&&(se==="annotation-xml"||Dn[se]):!!gr[I]:_.namespaceURI===On?A.namespaceURI===_t?I==="math":A.namespaceURI===Nn?I==="math"&&Mn[se]:!!Wr[I]:_.namespaceURI===_t?A.namespaceURI===Nn&&!Mn[se]||A.namespaceURI===On&&!Dn[se]?!1:!Wr[I]&&(ns[I]||!gr[I]):!!(Zt==="application/xhtml+xml"&&_n[_.namespaceURI]):!1},ct=function(_){Sr(t.removed,{element:_});try{T(_).removeChild(_)}catch(A){j(_)}},lt=function(_,A){try{Sr(t.removed,{attribute:A.getAttributeNode(_),from:A})}catch(I){Sr(t.removed,{attribute:null,from:A})}if(A.removeAttribute(_),_==="is")if(Je||Lt)try{ct(A)}catch(I){}else try{A.setAttribute(_,"")}catch(I){}},Jr=function(_){let A=null,I=null;if(Fe)_="<remove></remove>"+_;else{const xe=ks(_,/^[\r\n\t ]+/);I=xe&&xe[0]}Zt==="application/xhtml+xml"&&en===_t&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const se=S?S.createHTML(_):_;if(en===_t)try{A=new m().parseFromString(se,Zt)}catch(xe){}if(!A||!A.documentElement){A=Z.createDocument(en,"template",null);try{A.documentElement.innerHTML=kn?P:se}catch(xe){}}const $e=A.body||A.documentElement;return _&&I&&$e.insertBefore(n.createTextNode(I),$e.childNodes[0]||null),en===_t?Oe.call(A,Re?"html":"body")[0]:Re?A.documentElement:$e},mr=function(_){return Y.call(_.ownerDocument||_,_,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},br=function(_){return _ instanceof g&&(typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||!(_.attributes instanceof h)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function")},Yr=function(_){return typeof d=="function"&&_ instanceof d};function yt(D,_,A){ho(D,I=>{I.call(t,_,A,tn)})}const Xr=function(_){let A=null;if(yt(te.beforeSanitizeElements,_,null),br(_))return ct(_),!0;const I=pe(_.nodeName);if(yt(te.uponSanitizeElement,_,{tagName:I,allowedTags:ve}),ze&&_.hasChildNodes()&&!Yr(_.firstElementChild)&&Xe(/<[/\w!]/g,_.innerHTML)&&Xe(/<[/\w!]/g,_.textContent)||_.nodeType===Cr.progressingInstruction||ze&&_.nodeType===Cr.comment&&Xe(/<[/\w]/g,_.data))return ct(_),!0;if(!(We.tagCheck instanceof Function&&We.tagCheck(I))&&(!ve[I]||re[I])){if(!re[I]&&Kr(I)&&(H.tagNameCheck instanceof RegExp&&Xe(H.tagNameCheck,I)||H.tagNameCheck instanceof Function&&H.tagNameCheck(I)))return!1;if(dr&&!Ye[I]){const se=T(_)||_.parentNode,$e=N(_)||_.childNodes;if($e&&se){const xe=$e.length;for(let Be=xe-1;Be>=0;--Be){const wt=E($e[Be],!0);wt.__removalCount=(_.__removalCount||0)+1,se.insertBefore(wt,Q(_))}}}return ct(_),!0}return _ instanceof l&&!os(_)||(I==="noscript"||I==="noembed"||I==="noframes")&&Xe(/<\/no(script|embed|frames)/i,_.innerHTML)?(ct(_),!0):(ue&&_.nodeType===Cr.text&&(A=_.textContent,ho([Pe,He,Ct],se=>{A=Tr(A,se," ")}),_.textContent!==A&&(Sr(t.removed,{element:_.cloneNode()}),_.textContent=A)),yt(te.afterSanitizeElements,_,null),!1)},Vr=function(_,A,I){if(Hr&&(A==="id"||A==="name")&&(I in n||I in Gr))return!1;if(!(Se&&!Ne[A]&&Xe(fn,A))){if(!(le&&Xe(Pt,A))){if(!(We.attributeCheck instanceof Function&&We.attributeCheck(A,_))){if(!ye[A]||Ne[A]){if(!(Kr(_)&&(H.tagNameCheck instanceof RegExp&&Xe(H.tagNameCheck,_)||H.tagNameCheck instanceof Function&&H.tagNameCheck(_))&&(H.attributeNameCheck instanceof RegExp&&Xe(H.attributeNameCheck,A)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(A,_))||A==="is"&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&Xe(H.tagNameCheck,I)||H.tagNameCheck instanceof Function&&H.tagNameCheck(I))))return!1}else if(!hr[A]){if(!Xe(bt,Tr(I,Rt,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&_!=="script"&&Fb(I,"data:")===0&&de[_])){if(!(mn&&!Xe(mt,Tr(I,Rt,"")))){if(I)return!1}}}}}}}return!0},Kr=function(_){return _!=="annotation-xml"&&ks(_,Kt)},kr=function(_){yt(te.beforeSanitizeAttributes,_,null);const{attributes:A}=_;if(!A||br(_))return;const I={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ye,forceKeepAttr:void 0};let se=A.length;for(;se--;){const $e=A[se],{name:xe,namespaceURI:Be,value:wt}=$e,It=pe(xe),_r=wt;let Le=xe==="value"?_r:Bb(_r);if(I.attrName=It,I.attrValue=Le,I.keepAttr=!0,I.forceKeepAttr=void 0,yt(te.uponSanitizeAttribute,_,I),Le=I.attrValue,ur&&(It==="id"||It==="name")&&(lt(xe,_),Le=es+Le),ze&&Xe(/((--!?|])>)|<\/(style|title|textarea)/i,Le)){lt(xe,_);continue}if(It==="attributename"&&ks(Le,"href")){lt(xe,_);continue}if(I.forceKeepAttr)continue;if(!I.keepAttr){lt(xe,_);continue}if(!De&&Xe(/\/>/i,Le)){lt(xe,_);continue}ue&&ho([Pe,He,Ct],eo=>{Le=Tr(Le,eo," ")});const Qr=pe(_.nodeName);if(!Vr(Qr,It,Le)){lt(xe,_);continue}if(S&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!Be)switch(k.getAttributeType(Qr,It)){case"TrustedHTML":{Le=S.createHTML(Le);break}case"TrustedScriptURL":{Le=S.createScriptURL(Le);break}}if(Le!==_r)try{Be?_.setAttributeNS(Be,xe,Le):_.setAttribute(xe,Le),br(_)?ct(_):wa(t.removed)}catch(eo){lt(xe,_)}}yt(te.afterSanitizeAttributes,_,null)},qt=function D(_){let A=null;const I=mr(_);for(yt(te.beforeSanitizeShadowDOM,_,null);A=I.nextNode();)yt(te.uponSanitizeShadowNode,A,null),Xr(A),kr(A),A.content instanceof i&&D(A.content);yt(te.afterSanitizeShadowDOM,_,null)};return t.sanitize=function(D){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,I=null,se=null,$e=null;if(kn=!D,kn&&(D="<!-->"),typeof D!="string"&&!Yr(D))if(typeof D.toString=="function"){if(D=D.toString(),typeof D!="string")throw Er("dirty is not a string, aborting")}else throw Er("toString is not a function");if(!t.isSupported)return D;if(kt||Un(_),t.removed=[],typeof D=="string"&&(bn=!1),bn){if(D.nodeName){const wt=pe(D.nodeName);if(!ve[wt]||re[wt])throw Er("root node is forbidden and cannot be sanitized in-place")}}else if(D instanceof d)A=Jr("<!---->"),I=A.ownerDocument.importNode(D,!0),I.nodeType===Cr.element&&I.nodeName==="BODY"||I.nodeName==="HTML"?A=I:A.appendChild(I);else{if(!Je&&!ue&&!Re&&D.indexOf("<")===-1)return S&&at?S.createHTML(D):D;if(A=Jr(D),!A)return Je?null:at?P:""}A&&Fe&&ct(A.firstChild);const xe=mr(bn?D:A);for(;se=xe.nextNode();)Xr(se),kr(se),se.content instanceof i&&qt(se.content);if(bn)return D;if(Je){if(Lt)for($e=he.call(A.ownerDocument);A.firstChild;)$e.appendChild(A.firstChild);else $e=A;return(ye.shadowroot||ye.shadowrootmode)&&($e=qe.call(r,$e,!0)),$e}let Be=Re?A.outerHTML:A.innerHTML;return Re&&ve["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&Xe(Wc,A.ownerDocument.doctype.name)&&(Be="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
1430
+ `+Be),ue&&ho([Pe,He,Ct],wt=>{Be=Tr(Be,wt," ")}),S&&at?S.createHTML(Be):Be},t.setConfig=function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Un(D),kt=!0},t.clearConfig=function(){tn=null,kt=!1},t.isValidAttribute=function(D,_,A){tn||Un({});const I=pe(D),se=pe(_);return Vr(I,se,A)},t.addHook=function(D,_){typeof _=="function"&&Sr(te[D],_)},t.removeHook=function(D,_){if(_!==void 0){const A=qb(te[D],_);return A===-1?void 0:Hb(te[D],A,1)[0]}return wa(te[D])},t.removeHooks=function(D){te[D]=[]},t.removeAllHooks=function(){te=Ca()},t}var ik=Jc();function Yc(e){const t=ce.parse(e,{gfm:!0,breaks:!0,async:!1});return ik.sanitize(t)}const Xc=1e3,Vc=32,Pa=15e3,ak=new Set(["completed","failed","cancelled"]),ck=4e3;let $=null,jt=null,je=null,oi=null,Zo=null,Ns=!1,wo=null,Ir=null,F={kind:"connecting"},Qn=[],or=null,me=null,sr=null,Gt=null,zr=-1,et=null,Jt=!1,Wt=null,Tn=new Set;function Ds(){xo(),zc(),jt&&clearInterval(jt),jt=null,Wt==null||Wt(),Wt=null,je==null||je.destroy(),je=null,$&&Xt($),$==null||$.remove(),$=null,oi=null,F={kind:"connecting"},Qn=[],or=null,me=null,sr=null,Gt=null,Zo=null,zr=-1,et=null,Jt=!1,Tn=new Set}function si(e,t,n,r,o){$&&Ds(),oi=o!=null?o:null,F={kind:"connecting"},Qn=[],or=null,zr=-1,et=null,Jt=!1,Tn=new Set,me=e,sr=n,Gt=t,Zo=r,Ic({taskId:e,backendUrl:n,title:r}),$=document.createElement("div"),$.className="ap-sdk-panel",$.setAttribute("data-ap-sdk","1"),$.setAttribute("role","dialog"),$.setAttribute("aria-modal","true"),$.setAttribute("aria-label","Automation in progress");const i=r.length>55?`${r.slice(0,52)}…`:r;$.innerHTML=`
1431
1431
  <div class="ap-sdk-panel__header">
1432
1432
  <span class="ap-sdk-panel__title">
1433
1433
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1466,11 +1466,11 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
1466
1466
  </div>
1467
1467
  <div class="ap-sdk-runner__hint" data-ap-runner-hint>Closing keeps the task running — resume anytime from My Captures.</div>
1468
1468
  <div class="ap-sdk-panel__status" data-ap-runner-summary style="display:none"></div>
1469
- `,$.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),$.addEventListener("touchmove",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild($),Me=Us(),Wt($),Ys($,Js),$.querySelector("[data-ap-close]").addEventListener("click",()=>{Ds(),o==null||o()}),$.querySelector("[data-ap-runner-chat-form]").addEventListener("submit",a=>{a.preventDefault(),dk(t,e)}),$.querySelector("[data-ap-runner-cancel]").addEventListener("click",a=>{a.stopPropagation();const d=a.currentTarget;if(!Ns){Ns=!0,d.textContent="Confirm",wo=setTimeout(xo,ck),Ir=l=>{l.target!==d&&xo()},document.addEventListener("click",Ir,!0);return}xo(),lk(t,e)}),ii(),Kc(e,t)}function Kc(e,t){const n=d=>L(null,null,function*(){if(me!==e||!$||H.kind!=="idle"&&H.kind!=="connecting"||Sn.has(d.commandId))return;Sn.add(d.commandId);const l={id:d.commandId,taskId:d.taskId,action:d.action,selector:d.selector,value:d.value,description:d.description,status:"pending",createdAt:new Date().toISOString()};xn({kind:"executing",command:l,actionsRun:H.kind==="idle"?H.actionsRun:0}),yield Ra(l,t,e)}),r=d=>{if(!(me!==e||!$)&&ak.has(d)){if(H.kind==="executing")xn({kind:"finishing",status:d,actionsRun:H.actionsRun});else if(H.kind==="connecting"||H.kind==="idle"){const l=H.kind==="idle"?H.actionsRun:0;xn({kind:"finished",status:d,actionsRun:l})}}},o=d=>{me!==e||!$||(d.outputChunk&&La([d.outputChunk]),r(d.status))},i=()=>L(null,null,function*(){var d;if(!(me!==e||!$))try{const l=yield Do(t,e);me===e&&$&&(Ve=(d=l[0])!=null?d:null,Pn())}catch(l){}}),a=()=>L(null,null,function*(){var d;try{const[l,p,h,g]=yield Promise.all([Rc(t,e),Tm(t,e),Do(t,e),xm(t,e)]);if(me!==e||!$)return;La(p),Ve=(d=h[0])!=null?d:null,Pn(),r(l.status),g&&g.status==="pending"&&(H.kind==="idle"||H.kind==="connecting")&&!Sn.has(g.id)?(Sn.add(g.id),xn({kind:"executing",command:g,actionsRun:H.kind==="idle"?H.actionsRun:0}),yield Ra(g,t,e)):H.kind==="connecting"&&xn({kind:"idle",actionsRun:0})}catch(l){}});a(),Nm(t,e,{onStatusUpdate:o,onInteractionCreated:i,onInteractionAnswered:i,onBrowserCommandCreated:n,onReconnect:()=>{a()}}).then(d=>{if(me!==e||H.kind==="finished"){d();return}Bt=d})}function xn(e){H=e,H.kind==="idle"&&or===null&&(or=Date.now(),qo(),Nt=setInterval(qo,Xc)),H.kind==="finished"&&(Nt&&(clearInterval(Nt),Nt=null),Bt==null||Bt(),Bt=null,Me==null||Me.hide(),zc()),ii()}function xo(){Ns=!1,wo&&(clearTimeout(wo),wo=null),Ir&&(document.removeEventListener("click",Ir,!0),Ir=null);const e=$==null?void 0:$.querySelector("[data-ap-runner-cancel]");e&&(e.textContent="Cancel task")}function lk(e,t){return L(this,null,function*(){if(me!==t||!$)return;const n=$.querySelector("[data-ap-runner-cancel]");n&&(n.disabled=!0);try{yield Am(e,t)}catch(r){n&&(n.disabled=!1)}})}function Qc(){if(!me||!Ft||!sr||!Zo)return;const e=me,t=Ft;Ic({taskId:e,backendUrl:sr,title:Zo}),Nt&&clearInterval(Nt),qo(),Nt=setInterval(qo,Xc);const n=H.kind==="finished"?H.actionsRun:0;Sn=new Set,H={kind:"idle",actionsRun:n},ii(),Kc(e,t)}function ii(){if(!$)return;const e=$.querySelector("[data-ap-runner-status]"),t=$.querySelector("[data-ap-runner-counter]"),n=$.querySelector("[data-ap-runner-log]"),r=$.querySelector("[data-ap-runner-hint]");if(!e||!t||!n||!r)return;const o="actionsRun"in H?H.actionsRun:0;t.textContent=`${o} action${o===1?"":"s"}`,H.kind==="finished"?(e.textContent=H.status.replace(/_/g," "),e.className=`ap-sdk-status-badge ap-sdk-status-badge--${H.status.replace(/_/g,"-")}`,r.style.display="none",kk(H.status)):(e.textContent="running",e.className="ap-sdk-status-badge ap-sdk-status-badge--in-progress",r.style.display="block");const i=n.querySelector("[data-ap-runner-placeholder]");if(Qn.length===0&&(H.kind==="connecting"||H.kind==="idle")){if(!i){const h=document.createElement("div");h.className="ap-sdk-runner__placeholder",h.setAttribute("data-ap-runner-placeholder","1"),h.textContent="Waiting for the agent's first action…",n.appendChild(h)}}else i==null||i.remove();Pn();const a=$.querySelector("[data-ap-runner-chat-input]"),d=$.querySelector("[data-ap-runner-chat-send]");if(a&&d){const h=H.kind==="finished"&&H.status==="failed";a.disabled=h,d.disabled=h||Gt,h&&(a.placeholder="This task failed — start a new automation to continue.")}const l=$.querySelector("[data-ap-runner-cancel]");l&&(l.style.display=H.kind==="finished"?"none":"");const p=$.querySelector("[data-ap-runner-summary]");p&&H.kind!=="finished"&&(p.style.display="none",p.innerHTML="")}function Pn(){var o;if(!$)return;const e=$.querySelector("[data-ap-runner-question]"),t=$.querySelector("[data-ap-runner-chat-input]");if(!e||!t)return;if(!Ve){e.style.display="none",e.innerHTML="",t.placeholder="Send a message to the agent…";return}const n=Ve.questionMetadata,r=(o=n==null?void 0:n.options)!=null?o:[];if(t.placeholder="Type your answer…",e.style.display="block",e.innerHTML=`
1469
+ `,$.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),$.addEventListener("touchmove",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild($),je=Us(),Yt($),Ys($,Js),$.querySelector("[data-ap-close]").addEventListener("click",()=>{Ds(),o==null||o()}),$.querySelector("[data-ap-runner-chat-form]").addEventListener("submit",a=>{a.preventDefault(),dk(t,e)}),$.querySelector("[data-ap-runner-cancel]").addEventListener("click",a=>{a.stopPropagation();const d=a.currentTarget;if(!Ns){Ns=!0,d.textContent="Confirm",wo=setTimeout(xo,ck),Ir=l=>{l.target!==d&&xo()},document.addEventListener("click",Ir,!0);return}xo(),lk(t,e)}),ii(),Kc(e,t)}function Kc(e,t){const n=d=>L(null,null,function*(){if(me!==e||!$||F.kind!=="idle"&&F.kind!=="connecting"||Tn.has(d.commandId))return;Tn.add(d.commandId);const l={id:d.commandId,taskId:d.taskId,action:d.action,selector:d.selector,value:d.value,description:d.description,status:"pending",createdAt:new Date().toISOString()};Sn({kind:"executing",command:l,actionsRun:F.kind==="idle"?F.actionsRun:0}),yield Ra(l,t,e)}),r=d=>{if(!(me!==e||!$)&&ak.has(d)){if(F.kind==="executing")Sn({kind:"finishing",status:d,actionsRun:F.actionsRun});else if(F.kind==="connecting"||F.kind==="idle"){const l=F.kind==="idle"?F.actionsRun:0;Sn({kind:"finished",status:d,actionsRun:l})}}},o=d=>{me!==e||!$||(d.outputChunk&&La([d.outputChunk]),r(d.status))},i=()=>L(null,null,function*(){var d;if(!(me!==e||!$))try{const l=yield Do(t,e);me===e&&$&&(et=(d=l[0])!=null?d:null,Rn())}catch(l){}}),a=()=>L(null,null,function*(){var d;try{const[l,p,h,g]=yield Promise.all([Rc(t,e),Tm(t,e),Do(t,e),xm(t,e)]);if(me!==e||!$)return;La(p),et=(d=h[0])!=null?d:null,Rn(),r(l.status),g&&g.status==="pending"&&(F.kind==="idle"||F.kind==="connecting")&&!Tn.has(g.id)?(Tn.add(g.id),Sn({kind:"executing",command:g,actionsRun:F.kind==="idle"?F.actionsRun:0}),yield Ra(g,t,e)):F.kind==="connecting"&&Sn({kind:"idle",actionsRun:0})}catch(l){}});a(),Nm(t,e,{onStatusUpdate:o,onInteractionCreated:i,onInteractionAnswered:i,onBrowserCommandCreated:n,onReconnect:()=>{a()}}).then(d=>{if(me!==e||F.kind==="finished"){d();return}Wt=d})}function Sn(e){F=e,F.kind==="idle"&&or===null&&(or=Date.now(),qo(),jt=setInterval(qo,Xc)),F.kind==="finished"&&(jt&&(clearInterval(jt),jt=null),Wt==null||Wt(),Wt=null,je==null||je.hide(),zc()),ii()}function xo(){Ns=!1,wo&&(clearTimeout(wo),wo=null),Ir&&(document.removeEventListener("click",Ir,!0),Ir=null);const e=$==null?void 0:$.querySelector("[data-ap-runner-cancel]");e&&(e.textContent="Cancel task")}function lk(e,t){return L(this,null,function*(){if(me!==t||!$)return;const n=$.querySelector("[data-ap-runner-cancel]");n&&(n.disabled=!0);try{yield Am(e,t)}catch(r){n&&(n.disabled=!1)}})}function Qc(){if(!me||!Gt||!sr||!Zo)return;const e=me,t=Gt;Ic({taskId:e,backendUrl:sr,title:Zo}),jt&&clearInterval(jt),qo(),jt=setInterval(qo,Xc);const n=F.kind==="finished"?F.actionsRun:0;Tn=new Set,F={kind:"idle",actionsRun:n},ii(),Kc(e,t)}function ii(){if(!$)return;const e=$.querySelector("[data-ap-runner-status]"),t=$.querySelector("[data-ap-runner-counter]"),n=$.querySelector("[data-ap-runner-log]"),r=$.querySelector("[data-ap-runner-hint]");if(!e||!t||!n||!r)return;const o="actionsRun"in F?F.actionsRun:0;t.textContent=`${o} action${o===1?"":"s"}`,F.kind==="finished"?(e.textContent=F.status.replace(/_/g," "),e.className=`ap-sdk-status-badge ap-sdk-status-badge--${F.status.replace(/_/g,"-")}`,r.style.display="none",kk(F.status)):(e.textContent="running",e.className="ap-sdk-status-badge ap-sdk-status-badge--in-progress",r.style.display="block");const i=n.querySelector("[data-ap-runner-placeholder]");if(Qn.length===0&&(F.kind==="connecting"||F.kind==="idle")){if(!i){const h=document.createElement("div");h.className="ap-sdk-runner__placeholder",h.setAttribute("data-ap-runner-placeholder","1"),h.textContent="Waiting for the agent's first action…",n.appendChild(h)}}else i==null||i.remove();Rn();const a=$.querySelector("[data-ap-runner-chat-input]"),d=$.querySelector("[data-ap-runner-chat-send]");if(a&&d){const h=F.kind==="finished"&&F.status==="failed";a.disabled=h,d.disabled=h||Jt,h&&(a.placeholder="This task failed — start a new automation to continue.")}const l=$.querySelector("[data-ap-runner-cancel]");l&&(l.style.display=F.kind==="finished"?"none":"");const p=$.querySelector("[data-ap-runner-summary]");p&&F.kind!=="finished"&&(p.style.display="none",p.innerHTML="")}function Rn(){var o;if(!$)return;const e=$.querySelector("[data-ap-runner-question]"),t=$.querySelector("[data-ap-runner-chat-input]");if(!e||!t)return;if(!et){e.style.display="none",e.innerHTML="",t.placeholder="Send a message to the agent…";return}const n=et.questionMetadata,r=(o=n==null?void 0:n.options)!=null?o:[];if(t.placeholder="Type your answer…",e.style.display="block",e.innerHTML=`
1470
1470
  <div class="ap-sdk-runner__question-label">${ai((n==null?void 0:n.header)||"The agent has a question")}</div>
1471
- <div class="ap-sdk-runner__question-text ap-sdk-markdown">${Yc((n==null?void 0:n.question)||Ve.question)}</div>
1471
+ <div class="ap-sdk-runner__question-text ap-sdk-markdown">${Yc((n==null?void 0:n.question)||et.question)}</div>
1472
1472
  ${r.length>0?'<div class="ap-sdk-runner__question-options" data-ap-runner-question-options></div>':""}
1473
- `,r.length>0){const i=e.querySelector("[data-ap-runner-question-options]");for(const a of r){const d=document.createElement("button");d.type="button",d.className="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-runner__question-option",d.textContent=a.label,d.addEventListener("click",()=>void uk(a.label)),i.appendChild(d)}}}function uk(e){return L(this,null,function*(){var r;if(!$||!Ve||!me||Gt)return;const t=me,n=Ft;if(n){Gt=!0;try{const o={selectedOption:e};yield Lc(n,t,Ve.id,o),Ve=null,Pn();const i=yield Do(n,t);me===t&&$&&(Ve=(r=i[0])!=null?r:null,Pn())}catch(o){const i=$.querySelector("[data-ap-runner-chat-error]");i&&(i.textContent="Failed to send your answer — try again.",i.style.display="block")}finally{Gt=!1}}})}function qo(){if(!$||or===null)return;const e=$.querySelector("[data-ap-runner-timer]");if(!e)return;const t=Math.max(0,Math.floor((Date.now()-or)/1e3)),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");e.textContent=`${n}:${r}`}function Ra(e,t,n){return L(this,null,function*(){let r="done",o;try{if(e.action==="getContext"){const a=e.selector?document.querySelector(e.selector):document.body;if(!a)throw new Error(`element not found (${e.selector})`);Me==null||Me.update(a),o=hk(a)}else{if(!e.selector)throw new Error(`${e.action} command is missing a selector`);const a=document.querySelector(e.selector);if(!a)throw new Error(`element not found (${e.selector})`);if(Me==null||Me.update(a),e.action==="click")yield Mm(a),o="Clicked";else{if(e.value===void 0)throw new Error("inputText command is missing a value");fk(a,e.value),o="Entered text"}}}catch(a){r="error",o=a instanceof Error?a.message:"Unknown error executing command"}if(me===n&&$&&gk(r,e,o),yield pk(t,n,e.id,r,o),me!==n||!$)return;Me==null||Me.hide();const i=(H.kind==="executing"||H.kind==="finishing"?H.actionsRun:0)+1;H.kind==="finishing"?xn({kind:"finished",status:H.status,actionsRun:i}):H.kind==="executing"&&xn({kind:"idle",actionsRun:i})})}function dk(e,t){return L(this,null,function*(){var a;if(!$||Gt||H.kind==="finished"&&H.status==="failed")return;const n=$.querySelector("[data-ap-runner-chat-input]"),r=$.querySelector("[data-ap-runner-chat-error]"),o=$.querySelector("[data-ap-runner-chat-send]");if(!n||!r||!o)return;const i=n.value.trim();if(i){Gt=!0,o.disabled=!0,r.style.display="none";try{if(Ve){yield Lc(e,t,Ve.id,i),Ve=null,Pn();try{const d=yield Do(e,t);me===t&&$&&(Ve=(a=d[0])!=null?a:null,Pn())}catch(d){}}else yield Em(e,t,i),H.kind==="finished"&&Qc();n.value=""}catch(d){r.textContent=d instanceof Error?d.message:"Failed to send — try again.",r.style.display="block"}finally{Gt=!1,o.disabled=!1}}})}function pk(e,t,n,r,o){return L(this,null,function*(){try{yield Sm(e,t,n,r,o)}catch(i){}})}function hk(e){const t=e.cloneNode(!0);t.querySelectorAll("script, style, noscript").forEach(o=>o.remove()),Ba(t);let n=t.outerHTML,r=!1;return n.length>Pa&&(n=n.slice(0,Pa),r=!0),`URL: ${location.href}
1473
+ `,r.length>0){const i=e.querySelector("[data-ap-runner-question-options]");for(const a of r){const d=document.createElement("button");d.type="button",d.className="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-runner__question-option",d.textContent=a.label,d.addEventListener("click",()=>void uk(a.label)),i.appendChild(d)}}}function uk(e){return L(this,null,function*(){var r;if(!$||!et||!me||Jt)return;const t=me,n=Gt;if(n){Jt=!0;try{const o={selectedOption:e};yield Lc(n,t,et.id,o),et=null,Rn();const i=yield Do(n,t);me===t&&$&&(et=(r=i[0])!=null?r:null,Rn())}catch(o){const i=$.querySelector("[data-ap-runner-chat-error]");i&&(i.textContent="Failed to send your answer — try again.",i.style.display="block")}finally{Jt=!1}}})}function qo(){if(!$||or===null)return;const e=$.querySelector("[data-ap-runner-timer]");if(!e)return;const t=Math.max(0,Math.floor((Date.now()-or)/1e3)),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");e.textContent=`${n}:${r}`}function Ra(e,t,n){return L(this,null,function*(){let r="done",o;try{if(e.action==="getContext"){const a=e.selector?document.querySelector(e.selector):document.body;if(!a)throw new Error(`element not found (${e.selector})`);je==null||je.update(a),o=hk(a)}else{if(!e.selector)throw new Error(`${e.action} command is missing a selector`);const a=document.querySelector(e.selector);if(!a)throw new Error(`element not found (${e.selector})`);if(je==null||je.update(a),e.action==="click")yield Mm(a),o="Clicked";else{if(e.value===void 0)throw new Error("inputText command is missing a value");fk(a,e.value),o="Entered text"}}}catch(a){r="error",o=a instanceof Error?a.message:"Unknown error executing command"}if(me===n&&$&&gk(r,e,o),yield pk(t,n,e.id,r,o),me!==n||!$)return;je==null||je.hide();const i=(F.kind==="executing"||F.kind==="finishing"?F.actionsRun:0)+1;F.kind==="finishing"?Sn({kind:"finished",status:F.status,actionsRun:i}):F.kind==="executing"&&Sn({kind:"idle",actionsRun:i})})}function dk(e,t){return L(this,null,function*(){var a;if(!$||Jt||F.kind==="finished"&&F.status==="failed")return;const n=$.querySelector("[data-ap-runner-chat-input]"),r=$.querySelector("[data-ap-runner-chat-error]"),o=$.querySelector("[data-ap-runner-chat-send]");if(!n||!r||!o)return;const i=n.value.trim();if(i){Jt=!0,o.disabled=!0,r.style.display="none";try{if(et){yield Lc(e,t,et.id,i),et=null,Rn();try{const d=yield Do(e,t);me===t&&$&&(et=(a=d[0])!=null?a:null,Rn())}catch(d){}}else yield Em(e,t,i),F.kind==="finished"&&Qc();n.value=""}catch(d){r.textContent=d instanceof Error?d.message:"Failed to send — try again.",r.style.display="block"}finally{Jt=!1,o.disabled=!1}}})}function pk(e,t,n,r,o){return L(this,null,function*(){try{yield Sm(e,t,n,r,o)}catch(i){}})}function hk(e){const t=e.cloneNode(!0);t.querySelectorAll("script, style, noscript").forEach(o=>o.remove()),Ba(t);let n=t.outerHTML,r=!1;return n.length>Pa&&(n=n.slice(0,Pa),r=!0),`URL: ${location.href}
1474
1474
  Title: ${document.title}
1475
1475
 
1476
1476
  ${n}${r?`
@@ -1494,7 +1494,7 @@ ${n}${r?`
1494
1494
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-runner-close>Close</button>
1495
1495
  </div>
1496
1496
  </div>
1497
- `,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const i=oi;Ds(),i==null||i()}),o&&_k(t)}function _k(e){const t=e.querySelector("[data-ap-runner-approve]"),n=e.querySelector("[data-ap-runner-reject]"),r=e.querySelector("[data-ap-runner-reject-form]"),o=e.querySelector("[data-ap-runner-reject-feedback]"),i=e.querySelector("[data-ap-runner-reject-submit]"),a=e.querySelector("[data-ap-runner-approval-error]"),d=e.querySelector(".ap-sdk-runner__approval-actions"),l=h=>{a.textContent=h,a.style.display="block"};t.addEventListener("click",()=>L(null,null,function*(){if(!me||!Ft)return;const h=me,g=Ft;t.disabled=!0,n.disabled=!0,a.style.display="none";try{yield Cm(g,h),d.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--approved">Approved</span>',r.style.display="none"}catch(m){t.disabled=!1,n.disabled=!1,l(m instanceof Error?m.message:"Failed to approve — try again.")}})),n.addEventListener("click",()=>{r.style.display=r.style.display==="none"?"block":"none",r.style.display==="block"&&o.focus()});const p=()=>{i.textContent=o.value.trim()?"Reject & Continue":"Reject Permanently"};o.addEventListener("input",p),i.addEventListener("click",()=>L(null,null,function*(){if(!me||!Ft)return;const h=me,g=Ft,m=o.value.trim();i.disabled=!0,t.disabled=!0,a.style.display="none",i.textContent="Rejecting…";try{yield Pm(g,h,m),m?Qc():(d.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--rejected">Rejected</span>',r.style.display="none")}catch(k){i.disabled=!1,t.disabled=!1,p(),l(k instanceof Error?k.message:"Failed to reject — try again.")}}))}function vk(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ai(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function yk(e,t,n){const r=!!(t.backendUrl&&t.token),o=document.createElement("div");o.className="ap-sdk-advanced",o.innerHTML=`
1497
+ `,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const i=oi;Ds(),i==null||i()}),o&&_k(t)}function _k(e){const t=e.querySelector("[data-ap-runner-approve]"),n=e.querySelector("[data-ap-runner-reject]"),r=e.querySelector("[data-ap-runner-reject-form]"),o=e.querySelector("[data-ap-runner-reject-feedback]"),i=e.querySelector("[data-ap-runner-reject-submit]"),a=e.querySelector("[data-ap-runner-approval-error]"),d=e.querySelector(".ap-sdk-runner__approval-actions"),l=h=>{a.textContent=h,a.style.display="block"};t.addEventListener("click",()=>L(null,null,function*(){if(!me||!Gt)return;const h=me,g=Gt;t.disabled=!0,n.disabled=!0,a.style.display="none";try{yield Cm(g,h),d.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--approved">Approved</span>',r.style.display="none"}catch(m){t.disabled=!1,n.disabled=!1,l(m instanceof Error?m.message:"Failed to approve — try again.")}})),n.addEventListener("click",()=>{r.style.display=r.style.display==="none"?"block":"none",r.style.display==="block"&&o.focus()});const p=()=>{i.textContent=o.value.trim()?"Reject & Continue":"Reject Permanently"};o.addEventListener("input",p),i.addEventListener("click",()=>L(null,null,function*(){if(!me||!Gt)return;const h=me,g=Gt,m=o.value.trim();i.disabled=!0,t.disabled=!0,a.style.display="none",i.textContent="Rejecting…";try{yield Pm(g,h,m),m?Qc():(d.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--rejected">Rejected</span>',r.style.display="none")}catch(k){i.disabled=!1,t.disabled=!1,p(),l(k instanceof Error?k.message:"Failed to reject — try again.")}}))}function vk(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ai(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function yk(e,t,n){const r=!!(t.backendUrl&&t.token),o=document.createElement("div");o.className="ap-sdk-advanced",o.innerHTML=`
1498
1498
  <details class="ap-sdk-advanced__details">
1499
1499
  <summary class="ap-sdk-advanced__summary">Advanced options</summary>
1500
1500
  <div class="ap-sdk-advanced__body">
@@ -1513,12 +1513,12 @@ ${n}${r?`
1513
1513
  </div>
1514
1514
  </div>
1515
1515
  </details>
1516
- `,e.appendChild(o);const i=o.querySelector("[data-ap-adv-template-field]"),a=o.querySelector("[data-ap-template]"),d=o.querySelector("[data-ap-quickmode]");let l=[];if(r){const p={backendUrl:t.backendUrl,token:t.token};_m(p,n!=null?n:void 0).then(h=>{var m,k;if(l=h,h.length===0){i.style.display="none";return}const g=(m=h.find(y=>y.isDefault&&y.scope==="project"))!=null?m:h.find(y=>y.isDefault&&y.scope==="global");a.innerHTML='<option value="">None (use default)</option>'+h.map(y=>`<option value="${wk(y.id)}">${xk(y.name)}${y.isDefault?" (Default)":""}</option>`).join(""),a.value=(k=g==null?void 0:g.id)!=null?k:""}).catch(()=>{i.style.display="none"})}else{a.innerHTML='<option value="">None</option>',a.disabled=!0;const p=document.createElement("span");p.className="ap-sdk-advanced__hint",p.textContent="Connect credentials to enable template selection",i.appendChild(p)}return{getOptions(){var g,m,k,y,E,Z,ee,N;const p=a.value||null,h=p?(m=(g=l.find(T=>T.id===p))==null?void 0:g.templateData)!=null?m:{}:{};return v(v(v(v(v(v(v(v(v(v({claudeTemplateId:p,quickMode:d.checked},h.modelOverride!=null?{modelOverride:h.modelOverride}:{}),h.claudeProfileId!=null?{claudeProfileId:h.claudeProfileId}:{}),h.effort!=null?{effort:h.effort}:{}),h.executionMode!=null?{executionMode:h.executionMode}:{}),(k=h.selectedPluginIds)!=null&&k.length?{selectedPluginIds:h.selectedPluginIds}:{}),(y=h.selectedSkillIds)!=null&&y.length?{selectedSkillIds:h.selectedSkillIds}:{}),(E=h.selectedPluginSkillIds)!=null&&E.length?{selectedPluginSkillIds:h.selectedPluginSkillIds}:{}),(Z=h.selectedMcpServerIds)!=null&&Z.length?{selectedMcpServerIds:h.selectedMcpServerIds}:{}),(ee=h.selectedSlashCommandIds)!=null&&ee.length?{selectedSlashCommandIds:h.selectedSlashCommandIds}:{}),(N=h.selectedRemoteContextProviderIds)!=null&&N.length?{selectedRemoteContextProviderIds:h.selectedRemoteContextProviderIds}:{})}}}function wk(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function xk(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const ci="ap-sdk-captures",Sk=50;function lr(){try{const e=localStorage.getItem(ci);return e?JSON.parse(e):[]}catch(e){return[]}}function Tk(e){const t=lr(),n=[e,...t].slice(0,Sk);try{localStorage.setItem(ci,JSON.stringify(n))}catch(r){}}function Ek(){try{localStorage.removeItem(ci)}catch(e){}}function el(e){var a,d,l,p,h;if(e.id){const g=document.querySelector(`label[for="${CSS.escape(e.id)}"]`),m=(a=g==null?void 0:g.textContent)==null?void 0:a.trim();if(m)return m}const t=e.closest("label"),n=(d=t==null?void 0:t.textContent)==null?void 0:d.trim();if(n)return n;const r=(l=e.getAttribute("aria-label"))==null?void 0:l.trim();if(r)return r;const o=(p=e.placeholder)==null?void 0:p.trim();if(o)return o;const i=(h=e.getAttribute("name"))==null?void 0:h.trim();return i||e.tagName.toLowerCase()}function Ak(e,t){return`Click "${e}" ${t.toLowerCase()}`}function tl(e,t,n){return n?`Typed [redacted] into ${e}`:`Typed "${t}" into ${e}`}function Ia(e,t){return`Scrolled to (${e}, ${t})`}function Ck(e,t){return t?`Pressed "${e}" in ${t}`:`Pressed "${e}"`}function nl(e){return e.map((t,n)=>`${n+1}. ${t.description}`).join(`
1517
- `)}const Pk=400,Rk=new Set(["Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),Lk=new Set(["Control","Meta","Alt","Shift"]);function Ik(e){if(Lk.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("+")):Rk.has(e.key)?e.key:null}function zk(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?el(e):Lo(e)||e.tagName.toLowerCase()}let ir=[],Je=null,Ho=null,et=null,zt=null,$t=null;function rl(){Ho&&(Ho.textContent=`● Recording — ${ir.length} step${ir.length===1?"":"s"}`)}function Ms(){$t&&(clearTimeout($t),$t=null),zt&&(ir.push(zt),zt=null,rl())}function xs(e){Ms(),ir.push(e),rl()}function $k(e){var t,n,r;return e instanceof HTMLSelectElement&&(r=(n=(t=e.selectedOptions[0])==null?void 0:t.textContent)==null?void 0:n.trim())!=null?r:e.value}function Ok(e,t){et&&et(),ir=[],zt=null,Je=document.createElement("div"),Je.className="ap-sdk-recorder-bar",Je.setAttribute("data-ap-sdk","1"),Je.innerHTML=`
1516
+ `,e.appendChild(o);const i=o.querySelector("[data-ap-adv-template-field]"),a=o.querySelector("[data-ap-template]"),d=o.querySelector("[data-ap-quickmode]");let l=[];if(r){const p={backendUrl:t.backendUrl,token:t.token};_m(p,n!=null?n:void 0).then(h=>{var m,k;if(l=h,h.length===0){i.style.display="none";return}const g=(m=h.find(y=>y.isDefault&&y.scope==="project"))!=null?m:h.find(y=>y.isDefault&&y.scope==="global");a.innerHTML='<option value="">None (use default)</option>'+h.map(y=>`<option value="${wk(y.id)}">${xk(y.name)}${y.isDefault?" (Default)":""}</option>`).join(""),a.value=(k=g==null?void 0:g.id)!=null?k:""}).catch(()=>{i.style.display="none"})}else{a.innerHTML='<option value="">None</option>',a.disabled=!0;const p=document.createElement("span");p.className="ap-sdk-advanced__hint",p.textContent="Connect credentials to enable template selection",i.appendChild(p)}return{getOptions(){var g,m,k,y,E,j,Q,N;const p=a.value||null,h=p?(m=(g=l.find(T=>T.id===p))==null?void 0:g.templateData)!=null?m:{}:{};return v(v(v(v(v(v(v(v(v(v({claudeTemplateId:p,quickMode:d.checked},h.modelOverride!=null?{modelOverride:h.modelOverride}:{}),h.claudeProfileId!=null?{claudeProfileId:h.claudeProfileId}:{}),h.effort!=null?{effort:h.effort}:{}),h.executionMode!=null?{executionMode:h.executionMode}:{}),(k=h.selectedPluginIds)!=null&&k.length?{selectedPluginIds:h.selectedPluginIds}:{}),(y=h.selectedSkillIds)!=null&&y.length?{selectedSkillIds:h.selectedSkillIds}:{}),(E=h.selectedPluginSkillIds)!=null&&E.length?{selectedPluginSkillIds:h.selectedPluginSkillIds}:{}),(j=h.selectedMcpServerIds)!=null&&j.length?{selectedMcpServerIds:h.selectedMcpServerIds}:{}),(Q=h.selectedSlashCommandIds)!=null&&Q.length?{selectedSlashCommandIds:h.selectedSlashCommandIds}:{}),(N=h.selectedRemoteContextProviderIds)!=null&&N.length?{selectedRemoteContextProviderIds:h.selectedRemoteContextProviderIds}:{})}}}function wk(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function xk(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const ci="ap-sdk-captures",Sk=50;function lr(){try{const e=localStorage.getItem(ci);return e?JSON.parse(e):[]}catch(e){return[]}}function Tk(e){const t=lr(),n=[e,...t].slice(0,Sk);try{localStorage.setItem(ci,JSON.stringify(n))}catch(r){}}function Ek(){try{localStorage.removeItem(ci)}catch(e){}}function el(e){var a,d,l,p,h;if(e.id){const g=document.querySelector(`label[for="${CSS.escape(e.id)}"]`),m=(a=g==null?void 0:g.textContent)==null?void 0:a.trim();if(m)return m}const t=e.closest("label"),n=(d=t==null?void 0:t.textContent)==null?void 0:d.trim();if(n)return n;const r=(l=e.getAttribute("aria-label"))==null?void 0:l.trim();if(r)return r;const o=(p=e.placeholder)==null?void 0:p.trim();if(o)return o;const i=(h=e.getAttribute("name"))==null?void 0:h.trim();return i||e.tagName.toLowerCase()}function Ak(e,t){return`Click "${e}" ${t.toLowerCase()}`}function tl(e,t,n){return n?`Typed [redacted] into ${e}`:`Typed "${t}" into ${e}`}function Ia(e,t){return`Scrolled to (${e}, ${t})`}function Ck(e,t){return t?`Pressed "${e}" in ${t}`:`Pressed "${e}"`}function nl(e){return e.map((t,n)=>`${n+1}. ${t.description}`).join(`
1517
+ `)}const Pk=400,Rk=new Set(["Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),Lk=new Set(["Control","Meta","Alt","Shift"]);function Ik(e){if(Lk.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("+")):Rk.has(e.key)?e.key:null}function zk(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?el(e):Lo(e)||e.tagName.toLowerCase()}let ir=[],Ve=null,Ho=null,rt=null,Dt=null,Mt=null;function rl(){Ho&&(Ho.textContent=`● Recording — ${ir.length} step${ir.length===1?"":"s"}`)}function Ms(){Mt&&(clearTimeout(Mt),Mt=null),Dt&&(ir.push(Dt),Dt=null,rl())}function xs(e){Ms(),ir.push(e),rl()}function $k(e){var t,n,r;return e instanceof HTMLSelectElement&&(r=(n=(t=e.selectedOptions[0])==null?void 0:t.textContent)==null?void 0:n.trim())!=null?r:e.value}function Ok(e,t){rt&&rt(),ir=[],Dt=null,Ve=document.createElement("div"),Ve.className="ap-sdk-recorder-bar",Ve.setAttribute("data-ap-sdk","1"),Ve.innerHTML=`
1518
1518
  <span class="ap-sdk-recorder-bar__counter" data-ap-recorder-counter>● Recording — 0 steps</span>
1519
1519
  <button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--stop" data-ap-recorder-stop type="button">Stop</button>
1520
1520
  <button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--discard" data-ap-recorder-discard type="button">Discard</button>
1521
- `,document.body.appendChild(Je),Wt(Je),Ho=Je.querySelector("[data-ap-recorder-counter]");const n=()=>{Ms();const l=ir;et==null||et(),e(l)},r=()=>{et==null||et()};Je.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),Je.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=l=>{if(Lr(l.target))return;const p=l.target;xs({action:"click",cssSelector:_o(p),elementText:Lo(p),description:Ak(Lo(p),p.tagName),capturedAt:new Date().toISOString()})},i=l=>{if(Lr(l.target))return;const p=l.target;if(!(p instanceof HTMLInputElement)&&!(p instanceof HTMLTextAreaElement)&&!(p instanceof HTMLSelectElement))return;const h=el(p),g=vd(p),m=g?"[redacted]":$k(p);xs(U(v({action:"inputText",cssSelector:_o(p),elementText:h,value:m},g?{redacted:!0}:{}),{description:tl(h,m,g),capturedAt:new Date().toISOString()}))},a=()=>{const l=Math.round(window.scrollX),p=Math.round(window.scrollY);zt?(zt.scrollX=l,zt.scrollY=p,zt.description=Ia(l,p)):zt={action:"scroll",scrollX:l,scrollY:p,description:Ia(l,p),capturedAt:new Date().toISOString()},$t&&clearTimeout($t),$t=setTimeout(()=>{$t=null,Ms()},Pk)},d=l=>{if(l.key==="Escape"){r();return}if(Lr(l.target))return;const p=Ik(l);if(!p)return;const h=l.target instanceof Element?l.target:document.body,g=zk(h);xs({action:"keypress",cssSelector:_o(h),elementText:g,key:p,description:Ck(p,g),capturedAt:new Date().toISOString()})};document.addEventListener("click",o,{capture:!0}),document.addEventListener("change",i,{capture:!0}),window.addEventListener("scroll",a,{capture:!0,passive:!0}),document.addEventListener("keydown",d,{capture:!0}),et=()=>{document.removeEventListener("click",o,{capture:!0}),document.removeEventListener("change",i,{capture:!0}),window.removeEventListener("scroll",a,{capture:!0}),document.removeEventListener("keydown",d,{capture:!0}),$t&&(clearTimeout($t),$t=null),zt=null,Je&&Jt(Je),Je==null||Je.remove(),Je=null,Ho=null,et=null}}function Nk(){et==null||et()}function So(){return et!==null}const Dk="data-ap-sdk",Mk="ap-sdk-fab",za="ap-sdk-fab--dragging",li="ap-sdk-fab--open",ol="ap-sdk-fab-pos",Fo="ap-sdk-fab--left-edge",Uk='<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>',jk='<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>',Zk='<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>',qk='<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 z=null,Lt=null,on=null,sn=null,lt=null,qn=null,Hn=null,Fn=null,To=null,$r=null,er=null,Eo=null,Ao=null,Co=null,sl=0,il=0,al=0,cl=0,Wn=!1,xt=!1,Or=null,Tn=null;function Hk(){Or=e=>{if(!z){Po();return}if(!Wn){if(Math.hypot(e.clientX-al,e.clientY-cl)<5)return;Wn=!0,xt=!0,z.classList.add(za)}Fk(e.clientX-sl,e.clientY-il)},Tn=()=>{if(!z){Po();return}Wn?(Wn=!1,z.classList.remove(za),z.style.transition="",Bk(z.getBoundingClientRect())):z.style.transition="",Po()},window.addEventListener("pointermove",Or),window.addEventListener("pointerup",Tn),window.addEventListener("pointercancel",Tn)}function Po(){Or&&(window.removeEventListener("pointermove",Or),Or=null),Tn&&(window.removeEventListener("pointerup",Tn),window.removeEventListener("pointercancel",Tn),Tn=null)}function Fk(e,t){if(!z)return;const n=z.offsetWidth||52,r=z.offsetHeight||52;z.style.top=`${Math.max(0,Math.min(t,window.innerHeight-r))}px`,z.style.left=`${Math.max(0,Math.min(e,window.innerWidth-n))}px`,z.style.bottom="auto",z.style.right="auto"}function Bk(e){if(!z)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";z.style.top="auto",z.style.bottom=`${n}px`,r==="left"?(z.style.right="auto",z.style.left="16px",z.classList.add(Fo)):(z.style.left="auto",z.style.right="16px",z.classList.remove(Fo));try{localStorage.setItem(ol,JSON.stringify({edge:r,bottom:n}))}catch(o){}}function Gk(){if(z)try{const e=localStorage.getItem(ol);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));z.style.top="auto",z.style.bottom=`${r}px`,t.edge==="left"?(z.style.right="auto",z.style.left="16px",z.classList.add(Fo)):(z.style.left="auto",z.style.right="16px",z.classList.remove(Fo))}catch(e){}}function Jn(){z==null||z.classList.remove(li),er&&(window.removeEventListener("pointerdown",er,{capture:!0}),er=null)}function Wk(){z&&(z.classList.add(li),er=e=>{!z||z.contains(e.target)||Jn()},requestAnimationFrame(()=>{er&&window.addEventListener("pointerdown",er,{capture:!0})}))}function go(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function ll(e,t,n){var d;if(Eo=e,Ao=t,Co=n,z)return;z=document.createElement("div"),z.className=Mk,z.setAttribute(Dk,"1"),qn=document.createElement("div"),qn.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="View captures",lt=document.createElement("button"),lt.className="ap-sdk-fab__list ap-sdk-fab__sub",lt.setAttribute("aria-label","My captures"),lt.setAttribute("title","View my captures"),lt.appendChild(go(qk));const o=document.createElement("span");o.className="ap-sdk-fab__badge",o.setAttribute("data-ap-badge",""),o.style.display="none",lt.appendChild(o),qn.appendChild(r),qn.appendChild(lt),Hn=document.createElement("div"),Hn.className="ap-sdk-fab__row";const i=document.createElement("span");i.className="ap-sdk-fab__label",i.textContent="Capture element",on=document.createElement("button"),on.className="ap-sdk-fab__capture ap-sdk-fab__sub",on.setAttribute("aria-label","Capture element"),on.setAttribute("title","Capture element to Agent Platform"),on.appendChild(go(jk)),Hn.appendChild(i),Hn.appendChild(on),Fn=document.createElement("div"),Fn.className="ap-sdk-fab__row";const a=document.createElement("span");a.className="ap-sdk-fab__label",a.textContent="Record interaction",sn=document.createElement("button"),sn.className="ap-sdk-fab__record ap-sdk-fab__sub",sn.setAttribute("aria-label","Record interaction"),sn.setAttribute("title","Record a sequence of interactions"),sn.appendChild(go(Zk)),Fn.appendChild(a),Fn.appendChild(sn),Lt=document.createElement("button"),Lt.className="ap-sdk-fab__main",Lt.setAttribute("aria-label","Agent Platform"),Lt.setAttribute("title","Agent Platform"),Lt.appendChild(go(Uk)),z.appendChild(qn),z.appendChild(Hn),z.appendChild(Fn),z.appendChild(Lt),Lt.addEventListener("click",l=>{if(xt){xt=!1;return}l.preventDefault(),l.stopPropagation(),z!=null&&z.classList.contains(li)?Jn():Wk()}),on.addEventListener("click",l=>{if(xt){xt=!1;return}l.preventDefault(),l.stopPropagation(),Jn(),!Vn()&&!So()&&Eo&&Eo()}),sn.addEventListener("click",l=>{if(xt){xt=!1;return}l.preventDefault(),l.stopPropagation(),Jn(),!Vn()&&!So()&&Ao&&Ao()}),lt.addEventListener("click",l=>{if(xt){xt=!1;return}l.preventDefault(),l.stopPropagation(),Jn(),Co&&Co()}),$r=l=>{if(!z||!(z===l.target||z.contains(l.target)))return;const p=z.getBoundingClientRect();sl=l.clientX-p.left,il=l.clientY-p.top,al=l.clientX,cl=l.clientY,Wn=!1,xt=!1,z.style.transition="none",l.stopPropagation(),Hk()},window.addEventListener("pointerdown",$r,{capture:!0}),((d=document.body)!=null?d:document.documentElement).appendChild(z),Wt(z),Gk(),To=setInterval(()=>{Lt&&Lt.classList.toggle("ap-sdk-fab__main--active",Vn()||So())},200)}function Rn(e){const t=lt==null?void 0:lt.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function ul(){Wn=!1,xt=!1,Po(),Jn(),To&&(clearInterval(To),To=null),$r&&(window.removeEventListener("pointerdown",$r,{capture:!0}),$r=null),z&&Jt(z),z==null||z.remove(),z=null,Lt=null,on=null,sn=null,lt=null,qn=null,Hn=null,Fn=null,Eo=null,Ao=null,Co=null}function dl(e,t){return L(this,null,function*(){try{if(e.type==="planning"){const r=yield vm(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=yield Rc(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch(n){return{capture:e,status:"unavailable",approved:!1}}})}function pl(e){return e.filter(t=>!t.approved).length}function hl(e){return L(this,null,function*(){const t=lr();if(!e||t.length===0){Rn(t.length);return}const n=yield Promise.all(t.map(r=>dl(r,e)));Rn(pl(n))})}let X=null,Xe=null,Ht=null;function Nr(){return X!==null}function Ur(){X&&Jt(X),X==null||X.remove(),X=null,Ht==null||Ht(),Ht=null,Xe==null||Xe.destroy(),Xe=null}function fl(e,t,n,r,o,i,a,d,l,p,h=null){var ve;X&&Ur();const g={captureType:"task",submitting:!1,completedPicks:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1},m=!n.backendUrl||!n.token,k=wm(h,"planning-sessions:write");X=document.createElement("div"),X.className="ap-sdk-panel",X.setAttribute("data-ap-sdk","1"),X.setAttribute("role","dialog"),X.setAttribute("aria-modal","true"),X.setAttribute("aria-label","Capture to Agent Platform"),X.innerHTML=`
1521
+ `,document.body.appendChild(Ve),Yt(Ve),Ho=Ve.querySelector("[data-ap-recorder-counter]");const n=()=>{Ms();const l=ir;rt==null||rt(),e(l)},r=()=>{rt==null||rt()};Ve.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),Ve.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=l=>{if(Lr(l.target))return;const p=l.target;xs({action:"click",cssSelector:_o(p),elementText:Lo(p),description:Ak(Lo(p),p.tagName),capturedAt:new Date().toISOString()})},i=l=>{if(Lr(l.target))return;const p=l.target;if(!(p instanceof HTMLInputElement)&&!(p instanceof HTMLTextAreaElement)&&!(p instanceof HTMLSelectElement))return;const h=el(p),g=vd(p),m=g?"[redacted]":$k(p);xs(M(v({action:"inputText",cssSelector:_o(p),elementText:h,value:m},g?{redacted:!0}:{}),{description:tl(h,m,g),capturedAt:new Date().toISOString()}))},a=()=>{const l=Math.round(window.scrollX),p=Math.round(window.scrollY);Dt?(Dt.scrollX=l,Dt.scrollY=p,Dt.description=Ia(l,p)):Dt={action:"scroll",scrollX:l,scrollY:p,description:Ia(l,p),capturedAt:new Date().toISOString()},Mt&&clearTimeout(Mt),Mt=setTimeout(()=>{Mt=null,Ms()},Pk)},d=l=>{if(l.key==="Escape"){r();return}if(Lr(l.target))return;const p=Ik(l);if(!p)return;const h=l.target instanceof Element?l.target:document.body,g=zk(h);xs({action:"keypress",cssSelector:_o(h),elementText:g,key:p,description:Ck(p,g),capturedAt:new Date().toISOString()})};document.addEventListener("click",o,{capture:!0}),document.addEventListener("change",i,{capture:!0}),window.addEventListener("scroll",a,{capture:!0,passive:!0}),document.addEventListener("keydown",d,{capture:!0}),rt=()=>{document.removeEventListener("click",o,{capture:!0}),document.removeEventListener("change",i,{capture:!0}),window.removeEventListener("scroll",a,{capture:!0}),document.removeEventListener("keydown",d,{capture:!0}),Mt&&(clearTimeout(Mt),Mt=null),Dt=null,Ve&&Xt(Ve),Ve==null||Ve.remove(),Ve=null,Ho=null,rt=null}}function Nk(){rt==null||rt()}function So(){return rt!==null}const Dk="data-ap-sdk",Mk="ap-sdk-fab",za="ap-sdk-fab--dragging",li="ap-sdk-fab--open",ol="ap-sdk-fab-pos",Fo="ap-sdk-fab--left-edge",Uk='<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>',jk='<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>',Zk='<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>',qk='<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 z=null,Ot=null,sn=null,an=null,ut=null,qn=null,Hn=null,Fn=null,To=null,$r=null,er=null,Eo=null,Ao=null,Co=null,sl=0,il=0,al=0,cl=0,Wn=!1,St=!1,Or=null,En=null;function Hk(){Or=e=>{if(!z){Po();return}if(!Wn){if(Math.hypot(e.clientX-al,e.clientY-cl)<5)return;Wn=!0,St=!0,z.classList.add(za)}Fk(e.clientX-sl,e.clientY-il)},En=()=>{if(!z){Po();return}Wn?(Wn=!1,z.classList.remove(za),z.style.transition="",Bk(z.getBoundingClientRect())):z.style.transition="",Po()},window.addEventListener("pointermove",Or),window.addEventListener("pointerup",En),window.addEventListener("pointercancel",En)}function Po(){Or&&(window.removeEventListener("pointermove",Or),Or=null),En&&(window.removeEventListener("pointerup",En),window.removeEventListener("pointercancel",En),En=null)}function Fk(e,t){if(!z)return;const n=z.offsetWidth||52,r=z.offsetHeight||52;z.style.top=`${Math.max(0,Math.min(t,window.innerHeight-r))}px`,z.style.left=`${Math.max(0,Math.min(e,window.innerWidth-n))}px`,z.style.bottom="auto",z.style.right="auto"}function Bk(e){if(!z)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";z.style.top="auto",z.style.bottom=`${n}px`,r==="left"?(z.style.right="auto",z.style.left="16px",z.classList.add(Fo)):(z.style.left="auto",z.style.right="16px",z.classList.remove(Fo));try{localStorage.setItem(ol,JSON.stringify({edge:r,bottom:n}))}catch(o){}}function Gk(){if(z)try{const e=localStorage.getItem(ol);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));z.style.top="auto",z.style.bottom=`${r}px`,t.edge==="left"?(z.style.right="auto",z.style.left="16px",z.classList.add(Fo)):(z.style.left="auto",z.style.right="16px",z.classList.remove(Fo))}catch(e){}}function Jn(){z==null||z.classList.remove(li),er&&(window.removeEventListener("pointerdown",er,{capture:!0}),er=null)}function Wk(){z&&(z.classList.add(li),er=e=>{!z||z.contains(e.target)||Jn()},requestAnimationFrame(()=>{er&&window.addEventListener("pointerdown",er,{capture:!0})}))}function go(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function ll(e,t,n){var d;if(Eo=e,Ao=t,Co=n,z)return;z=document.createElement("div"),z.className=Mk,z.setAttribute(Dk,"1"),qn=document.createElement("div"),qn.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="View captures",ut=document.createElement("button"),ut.className="ap-sdk-fab__list ap-sdk-fab__sub",ut.setAttribute("aria-label","My captures"),ut.setAttribute("title","View my captures"),ut.appendChild(go(qk));const o=document.createElement("span");o.className="ap-sdk-fab__badge",o.setAttribute("data-ap-badge",""),o.style.display="none",ut.appendChild(o),qn.appendChild(r),qn.appendChild(ut),Hn=document.createElement("div"),Hn.className="ap-sdk-fab__row";const i=document.createElement("span");i.className="ap-sdk-fab__label",i.textContent="Capture element",sn=document.createElement("button"),sn.className="ap-sdk-fab__capture ap-sdk-fab__sub",sn.setAttribute("aria-label","Capture element"),sn.setAttribute("title","Capture element to Agent Platform"),sn.appendChild(go(jk)),Hn.appendChild(i),Hn.appendChild(sn),Fn=document.createElement("div"),Fn.className="ap-sdk-fab__row";const a=document.createElement("span");a.className="ap-sdk-fab__label",a.textContent="Record interaction",an=document.createElement("button"),an.className="ap-sdk-fab__record ap-sdk-fab__sub",an.setAttribute("aria-label","Record interaction"),an.setAttribute("title","Record a sequence of interactions"),an.appendChild(go(Zk)),Fn.appendChild(a),Fn.appendChild(an),Ot=document.createElement("button"),Ot.className="ap-sdk-fab__main",Ot.setAttribute("aria-label","Agent Platform"),Ot.setAttribute("title","Agent Platform"),Ot.appendChild(go(Uk)),z.appendChild(qn),z.appendChild(Hn),z.appendChild(Fn),z.appendChild(Ot),Ot.addEventListener("click",l=>{if(St){St=!1;return}l.preventDefault(),l.stopPropagation(),z!=null&&z.classList.contains(li)?Jn():Wk()}),sn.addEventListener("click",l=>{if(St){St=!1;return}l.preventDefault(),l.stopPropagation(),Jn(),!Vn()&&!So()&&Eo&&Eo()}),an.addEventListener("click",l=>{if(St){St=!1;return}l.preventDefault(),l.stopPropagation(),Jn(),!Vn()&&!So()&&Ao&&Ao()}),ut.addEventListener("click",l=>{if(St){St=!1;return}l.preventDefault(),l.stopPropagation(),Jn(),Co&&Co()}),$r=l=>{if(!z||!(z===l.target||z.contains(l.target)))return;const p=z.getBoundingClientRect();sl=l.clientX-p.left,il=l.clientY-p.top,al=l.clientX,cl=l.clientY,Wn=!1,St=!1,z.style.transition="none",l.stopPropagation(),Hk()},window.addEventListener("pointerdown",$r,{capture:!0}),((d=document.body)!=null?d:document.documentElement).appendChild(z),Yt(z),Gk(),To=setInterval(()=>{Ot&&Ot.classList.toggle("ap-sdk-fab__main--active",Vn()||So())},200)}function Ln(e){const t=ut==null?void 0:ut.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function ul(){Wn=!1,St=!1,Po(),Jn(),To&&(clearInterval(To),To=null),$r&&(window.removeEventListener("pointerdown",$r,{capture:!0}),$r=null),z&&Xt(z),z==null||z.remove(),z=null,Ot=null,sn=null,an=null,ut=null,qn=null,Hn=null,Fn=null,Eo=null,Ao=null,Co=null}function dl(e,t){return L(this,null,function*(){try{if(e.type==="planning"){const r=yield vm(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=yield Rc(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch(n){return{capture:e,status:"unavailable",approved:!1}}})}function pl(e){return e.filter(t=>!t.approved).length}function hl(e){return L(this,null,function*(){const t=lr();if(!e||t.length===0){Ln(t.length);return}const n=yield Promise.all(t.map(r=>dl(r,e)));Ln(pl(n))})}let J=null,Qe=null,Bt=null;function Nr(){return J!==null}function Ur(){J&&Xt(J),J==null||J.remove(),J=null,Bt==null||Bt(),Bt=null,Qe==null||Qe.destroy(),Qe=null}function fl(e,t,n,r,o,i,a,d,l,p,h=null){var ye;J&&Ur();const g={captureType:"task",submitting:!1,completedPicks:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1,allowSubmit:!1},m=!n.backendUrl||!n.token,k=wm(h,"planning-sessions:write");J=document.createElement("div"),J.className="ap-sdk-panel",J.setAttribute("data-ap-sdk","1"),J.setAttribute("role","dialog"),J.setAttribute("aria-modal","true"),J.setAttribute("aria-label","Capture to Agent Platform"),J.innerHTML=`
1522
1522
  <div class="ap-sdk-panel__header">
1523
1523
  <span class="ap-sdk-panel__title">
1524
1524
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1566,33 +1566,40 @@ ${n}${r?`
1566
1566
  <button class="ap-sdk-panel__toggle-btn" data-ap-type="automate">Automate</button>
1567
1567
  </div>
1568
1568
  </div>
1569
+ <div class="ap-sdk-panel__field" data-ap-automate-options style="display:none">
1570
+ <label class="ap-sdk-advanced__checkbox-label">
1571
+ <input type="checkbox" data-ap-allow-submit />
1572
+ Allow submit / confirm actions
1573
+ </label>
1574
+ <span class="ap-sdk-advanced__hint">Lets the agent click Submit, Confirm, Send, or Publish buttons to finish the task. It will still avoid payments and deletions unless you ask for them.</span>
1575
+ </div>
1569
1576
  </div>
1570
1577
  <div class="ap-sdk-panel__status" data-ap-status style="display:none"></div>
1571
1578
  <div class="ap-sdk-panel__footer">
1572
1579
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-submit>Submit</button>
1573
1580
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-cancel>Cancel</button>
1574
1581
  </div>
1575
- `,X.addEventListener("wheel",W=>{W.stopPropagation()},{passive:!0}),X.addEventListener("touchmove",W=>{W.stopPropagation()},{passive:!0});const y=X.querySelector(".ap-sdk-panel__body"),E=yk(y,n,(ve=r==null?void 0:r.id)!=null?ve:null);document.body.appendChild(X),Xe=Us(),g.currentPickedEl&&Xe.update(g.currentPickedEl),Wt(X),Ys(X,Js);const Z=X.querySelector("[data-ap-close]"),ee=X.querySelector("[data-ap-cancel]"),N=X.querySelector("[data-ap-submit]"),T=X.querySelector("[data-ap-note]"),S=X.querySelector("[data-ap-status]"),P=X.querySelectorAll("[data-ap-type]"),D=X.querySelector("[data-ap-pick-list]"),J=X.querySelector("[data-ap-context]"),he=X.querySelector("[data-ap-add-another]"),Oe=X.querySelector("[data-ap-pick-actions]"),nt=X.querySelector("[data-ap-select-parent]"),te=X.querySelector("[data-ap-reselect]"),Se=()=>{g.currentPickedEl&&(Xe==null||Xe.update(g.currentPickedEl))};window.addEventListener("scroll",Se,{capture:!0,passive:!0}),window.addEventListener("resize",Se),Ht=()=>{window.removeEventListener("scroll",Se,!0),window.removeEventListener("resize",Se)};const Fe=W=>{W?(J.innerHTML=$a(W),T.disabled=!1,T.placeholder="Describe the task or planning session…",setTimeout(()=>T.focus(),50)):(J.innerHTML=`
1582
+ `,J.addEventListener("wheel",W=>{W.stopPropagation()},{passive:!0}),J.addEventListener("touchmove",W=>{W.stopPropagation()},{passive:!0});const y=J.querySelector(".ap-sdk-panel__body"),E=yk(y,n,(ye=r==null?void 0:r.id)!=null?ye:null);document.body.appendChild(J),Qe=Us(),g.currentPickedEl&&Qe.update(g.currentPickedEl),Yt(J),Ys(J,Js);const j=J.querySelector("[data-ap-close]"),Q=J.querySelector("[data-ap-cancel]"),N=J.querySelector("[data-ap-submit]"),T=J.querySelector("[data-ap-note]"),S=J.querySelector("[data-ap-status]"),P=J.querySelectorAll("[data-ap-type]"),Z=J.querySelector("[data-ap-automate-options]"),Y=J.querySelector("[data-ap-allow-submit]"),he=J.querySelector("[data-ap-pick-list]"),Oe=J.querySelector("[data-ap-context]"),qe=J.querySelector("[data-ap-add-another]"),te=J.querySelector("[data-ap-pick-actions]"),Pe=J.querySelector("[data-ap-select-parent]"),He=J.querySelector("[data-ap-reselect]"),Ct=()=>{g.currentPickedEl&&(Qe==null||Qe.update(g.currentPickedEl))};window.addEventListener("scroll",Ct,{capture:!0,passive:!0}),window.addEventListener("resize",Ct),Bt=()=>{window.removeEventListener("scroll",Ct,!0),window.removeEventListener("resize",Ct)};const fn=W=>{W?(Oe.innerHTML=$a(W),T.disabled=!1,T.placeholder="Describe the task or planning session…",setTimeout(()=>T.focus(),50)):(Oe.innerHTML=`
1576
1583
  <div class="ap-sdk-panel__context-label">Next element</div>
1577
1584
  <div class="ap-sdk-panel__context-text ap-sdk-awaiting-pick">👆 Hover and click any element on the page</div>
1578
- `,T.disabled=!0,T.placeholder="Pick an element to continue…")},Xt=()=>{if(g.completedPicks.length===0){D.style.display="none",D.innerHTML="";return}D.style.display="block",D.innerHTML=g.completedPicks.map((W,F)=>{var Ee;return`
1579
- <div class="ap-sdk-pick-entry" data-pick-index="${F}">
1585
+ `,T.disabled=!0,T.placeholder="Pick an element to continue…")},Pt=()=>{if(g.completedPicks.length===0){he.style.display="none",he.innerHTML="";return}he.style.display="block",he.innerHTML=g.completedPicks.map((W,H)=>{var re;return`
1586
+ <div class="ap-sdk-pick-entry" data-pick-index="${H}">
1580
1587
  <div class="ap-sdk-pick-entry__header">
1581
- <span class="ap-sdk-pick-entry__number">${F+1}</span>
1582
- <span class="ap-sdk-pick-entry__element" title="${it((Ee=W.ctx.elementText)!=null?Ee:"")}">${it(W.ctx.elementText||"(no text)")}</span>
1583
- <button class="ap-sdk-pick-entry__remove" data-ap-remove="${F}" aria-label="Remove pick ${F+1}">×</button>
1588
+ <span class="ap-sdk-pick-entry__number">${H+1}</span>
1589
+ <span class="ap-sdk-pick-entry__element" title="${it((re=W.ctx.elementText)!=null?re:"")}">${it(W.ctx.elementText||"(no text)")}</span>
1590
+ <button class="ap-sdk-pick-entry__remove" data-ap-remove="${H}" aria-label="Remove pick ${H+1}">×</button>
1584
1591
  </div>
1585
1592
  <div class="ap-sdk-pick-entry__instruction">${it(W.instruction)}</div>
1586
1593
  </div>
1587
- `}).join(""),D.querySelectorAll("[data-ap-remove]").forEach(W=>{W.addEventListener("click",()=>{const F=parseInt(W.dataset.apRemove,10);g.completedPicks.splice(F,1),Xt()})})},Vt=()=>{if(!g.currentPickedEl){Oe.style.display="none";return}Oe.style.display="",nt.disabled=!g.currentPickedEl.parentElement||g.awaitingPick,te&&(te.disabled=g.awaitingPick)},rt=()=>{he&&(he.disabled=!T.value.trim()||g.submitting||g.awaitingPick)},gt=(W,F)=>{g.currentCtx=W,g.currentPickedEl=F,Fe(W),Xe==null||Xe.update(F),Vt()};Vt(),nt.addEventListener("click",()=>{var F;const W=(F=g.currentPickedEl)==null?void 0:F.parentElement;W&&gt(Ga(W),W)}),te&&l&&te.addEventListener("click",()=>{if(g.awaitingPick)return;const W=g.currentCtx,F=g.currentPickedEl;g.awaitingPick=!0,Vt(),rt(),Fe(null),l((Ee,K)=>{g.awaitingPick=!1,gt(Ee,K),rt()},()=>{g.awaitingPick=!1,F&&gt(W,F),rt()})});const mt=()=>{Ur(),p==null||p()};Z.addEventListener("click",mt),ee.addEventListener("click",mt);const $n=X.querySelector("[data-ap-connect-required]");$n&&a&&$n.addEventListener("click",()=>{mt(),a()}),P.forEach(W=>{W.addEventListener("click",()=>{g.captureType=W.dataset.apType,P.forEach(F=>F.classList.toggle("ap-sdk-active",F===W))})});const hn=X.querySelector("[data-ap-reconfigure]");a?hn.addEventListener("click",()=>{mt(),a()}):hn.style.display="none",he&&d&&(T.addEventListener("input",rt),he.addEventListener("click",()=>{const W=T.value.trim();!W||g.awaitingPick||(g.completedPicks.push({ctx:g.currentCtx,instruction:W}),Xt(),T.value="",g.awaitingPick=!0,he.disabled=!0,Vt(),Fe(null),d((F,Ee)=>{g.awaitingPick=!1,gt(F,Ee),rt()}))})),N.addEventListener("click",()=>L(null,null,function*(){var bt,we;if(g.submitting)return;if(m){mo(S,"error","Connect to Agent Platform first.");return}const W=n.backendUrl,F=n.token,Ee=T.value.trim();if(!Ee){mo(S,"error","Please enter an instruction.");return}g.submitting=!0,Oa(X,!0),mo(S,null,""),N.textContent="Submitting…";const K={backendUrl:W,token:F},Ae=E.getOptions(),ot=[...g.completedPicks,{ctx:g.currentCtx,instruction:Ee}];try{let re=r;re||(re=yield Pc(K,o),i({backendUrl:W,token:F}));let Be,je,ue;if(ot.length===1)if(g.captureType==="task")Be=(yield Ps(K,{projectId:re.id,note:Ee,ctx:g.currentCtx,advancedOpts:Ae})).id,je="task",ue=Ee.slice(0,120)||g.currentCtx.pageTitle||"Browser capture";else if(g.captureType==="planning"){let Le=gd(Ee,U(v({},g.currentCtx),{ancestry:g.currentCtx.outerTree||g.currentCtx.ancestry}));(bt=g.currentCtx.innerTree)!=null&&bt.trim()&&(Le+=`
1594
+ `}).join(""),he.querySelectorAll("[data-ap-remove]").forEach(W=>{W.addEventListener("click",()=>{const H=parseInt(W.dataset.apRemove,10);g.completedPicks.splice(H,1),Pt()})})},mt=()=>{if(!g.currentPickedEl){te.style.display="none";return}te.style.display="",Pe.disabled=!g.currentPickedEl.parentElement||g.awaitingPick,He&&(He.disabled=g.awaitingPick)},Rt=()=>{qe&&(qe.disabled=!T.value.trim()||g.submitting||g.awaitingPick)},Kt=(W,H)=>{g.currentCtx=W,g.currentPickedEl=H,fn(W),Qe==null||Qe.update(H),mt()};mt(),Pe.addEventListener("click",()=>{var H;const W=(H=g.currentPickedEl)==null?void 0:H.parentElement;W&&Kt(Ga(W),W)}),He&&l&&He.addEventListener("click",()=>{if(g.awaitingPick)return;const W=g.currentCtx,H=g.currentPickedEl;g.awaitingPick=!0,mt(),Rt(),fn(null),l((re,Ne)=>{g.awaitingPick=!1,Kt(re,Ne),Rt()},()=>{g.awaitingPick=!1,H&&Kt(W,H),Rt()})});const bt=()=>{Ur(),p==null||p()};j.addEventListener("click",bt),Q.addEventListener("click",bt);const ve=J.querySelector("[data-ap-connect-required]");ve&&a&&ve.addEventListener("click",()=>{bt(),a()}),P.forEach(W=>{W.addEventListener("click",()=>{g.captureType=W.dataset.apType,P.forEach(H=>H.classList.toggle("ap-sdk-active",H===W)),Z.style.display=g.captureType==="automate"?"":"none"})}),Y.addEventListener("change",()=>{g.allowSubmit=Y.checked});const gn=J.querySelector("[data-ap-reconfigure]");a?gn.addEventListener("click",()=>{bt(),a()}):gn.style.display="none",qe&&d&&(T.addEventListener("input",Rt),qe.addEventListener("click",()=>{const W=T.value.trim();!W||g.awaitingPick||(g.completedPicks.push({ctx:g.currentCtx,instruction:W}),Pt(),T.value="",g.awaitingPick=!0,qe.disabled=!0,mt(),fn(null),d((H,re)=>{g.awaitingPick=!1,Kt(H,re),Rt()}))})),N.addEventListener("click",()=>L(null,null,function*(){var Se,mn;if(g.submitting)return;if(m){mo(S,"error","Connect to Agent Platform first.");return}const W=n.backendUrl,H=n.token,re=T.value.trim();if(!re){mo(S,"error","Please enter an instruction.");return}g.submitting=!0,Oa(J,!0),mo(S,null,""),N.textContent="Submitting…";const Ne={backendUrl:W,token:H},We=E.getOptions(),le=[...g.completedPicks,{ctx:g.currentCtx,instruction:re}];try{let De=r;De||(De=yield Pc(Ne,o),i({backendUrl:W,token:H}));let ue,ze,Re;if(le.length===1)if(g.captureType==="task")ue=(yield Ps(Ne,{projectId:De.id,note:re,ctx:g.currentCtx,advancedOpts:We})).id,ze="task",Re=re.slice(0,120)||g.currentCtx.pageTitle||"Browser capture";else if(g.captureType==="planning"){let Fe=gd(re,M(v({},g.currentCtx),{ancestry:g.currentCtx.outerTree||g.currentCtx.ancestry}));(Se=g.currentCtx.innerTree)!=null&&Se.trim()&&(Fe+=`
1588
1595
 
1589
1596
  Element tree:
1590
- ${g.currentCtx.innerTree}`),(we=g.currentCtx.interactionSteps)!=null&&we.length&&(Le+=`
1597
+ ${g.currentCtx.innerTree}`),(mn=g.currentCtx.interactionSteps)!=null&&mn.length&&(Fe+=`
1591
1598
 
1592
1599
  Recorded steps:
1593
- ${nl(g.currentCtx.interactionSteps)}`),Be=(yield ia(K,re.id,Le,Ae)).id,je="planning",ue=Ee.slice(0,120)||g.currentCtx.pageTitle||"Planning session"}else Be=(yield sa(K,{projectId:re.id,note:Ee,ctx:g.currentCtx,advancedOpts:Ae})).id,je="automate",ue=Ee.slice(0,120)||g.currentCtx.pageTitle||"Browser automation";else{const Le=Yk(ot),Ze=ot[0].instruction.slice(0,120)||ot[0].ctx.pageTitle||"Multi-element capture",Mt=ot.map(st=>st.instruction).filter(Boolean).join(`
1600
+ ${nl(g.currentCtx.interactionSteps)}`),ue=(yield ia(Ne,De.id,Fe,We)).id,ze="planning",Re=re.slice(0,120)||g.currentCtx.pageTitle||"Planning session"}else ue=(yield sa(Ne,{projectId:De.id,note:re,ctx:g.currentCtx,advancedOpts:We,allowSubmit:g.allowSubmit})).id,ze="automate",Re=re.slice(0,120)||g.currentCtx.pageTitle||"Browser automation";else{const Fe=Yk(le),Je=le[0].instruction.slice(0,120)||le[0].ctx.pageTitle||"Multi-element capture",Lt=le.map(at=>at.instruction).filter(Boolean).join(`
1594
1601
 
1595
- `);g.captureType==="task"?(Be=(yield Ps(K,{projectId:re.id,note:Le,ctx:ot[0].ctx,advancedOpts:Ae,titleOverride:Ze,type:Ac,titleInstruction:Mt})).id,je="task",ue=Ze):g.captureType==="planning"?(Be=(yield ia(K,re.id,Le,Ae)).id,je="planning",ue=Ze):(Be=(yield sa(K,{projectId:re.id,note:Le,ctx:ot[0].ctx,advancedOpts:Ae,titleOverride:Ze,titleInstruction:Mt})).id,je="automate",ue=Ze)}if(Tk({id:Be,type:je,title:ue,backendUrl:W,createdAt:new Date().toISOString()}),hl(K).catch(()=>{}),je==="automate"){mt(),si(Be,K,W,ue,p);return}const Dt=je==="task"?`${W.replace(/\/+$/,"")}/tasks/${Be}`:`${W.replace(/\/+$/,"")}/planning/${Be}`;Xk(S,je,ue,Dt,mt),X.classList.add("ap-sdk-panel--success"),Ht==null||Ht(),Ht=null,Xe==null||Xe.hide(),g.submitting=!1}catch(re){mo(S,"error",re instanceof Error?re.message:"An unexpected error occurred."),g.submitting=!1,Oa(X,!1),N.textContent="Submit"}})),setTimeout(()=>T.focus(),50)}const Jk={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};function $a(e){var t,n;return(t=e.interactionSteps)!=null&&t.length?`
1602
+ `);g.captureType==="task"?(ue=(yield Ps(Ne,{projectId:De.id,note:Fe,ctx:le[0].ctx,advancedOpts:We,titleOverride:Je,type:Ac,titleInstruction:Lt})).id,ze="task",Re=Je):g.captureType==="planning"?(ue=(yield ia(Ne,De.id,Fe,We)).id,ze="planning",Re=Je):(ue=(yield sa(Ne,{projectId:De.id,note:Fe,ctx:le[0].ctx,advancedOpts:We,titleOverride:Je,titleInstruction:Lt,allowSubmit:g.allowSubmit})).id,ze="automate",Re=Je)}if(Tk({id:ue,type:ze,title:Re,backendUrl:W,createdAt:new Date().toISOString()}),hl(Ne).catch(()=>{}),ze==="automate"){bt(),si(ue,Ne,W,Re,p);return}const kt=ze==="task"?`${W.replace(/\/+$/,"")}/tasks/${ue}`:`${W.replace(/\/+$/,"")}/planning/${ue}`;Xk(S,ze,Re,kt,bt),J.classList.add("ap-sdk-panel--success"),Bt==null||Bt(),Bt=null,Qe==null||Qe.hide(),g.submitting=!1}catch(De){mo(S,"error",De instanceof Error?De.message:"An unexpected error occurred."),g.submitting=!1,Oa(J,!1),N.textContent="Submit"}})),setTimeout(()=>T.focus(),50)}const Jk={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};function $a(e){var t,n;return(t=e.interactionSteps)!=null&&t.length?`
1596
1603
  <div class="ap-sdk-panel__context-label">Recorded steps (${e.interactionSteps.length})</div>
1597
1604
  <div class="ap-sdk-panel__context-steps">
1598
1605
  ${e.interactionSteps.map(r=>`
@@ -1630,7 +1637,7 @@ ${t.instruction}`),r.join(`
1630
1637
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-success-close>Close</button>
1631
1638
  </div>
1632
1639
  </div>
1633
- `,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function Oa(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 ce=null;function gl(){return ce!==null}function An(){ce&&Jt(ce),ce==null||ce.remove(),ce=null}function Vk(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function Kk(e){if(ce){An();return}ce=document.createElement("div"),ce.className="ap-sdk-panel",ce.setAttribute("data-ap-sdk","1"),ce.setAttribute("role","dialog"),ce.setAttribute("aria-modal","true"),ce.setAttribute("aria-label","My captures"),ce.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),ce.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),ce.innerHTML=`
1640
+ `,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function Oa(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 ae=null;function gl(){return ae!==null}function Cn(){ae&&Xt(ae),ae==null||ae.remove(),ae=null}function Vk(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function Kk(e){if(ae){Cn();return}ae=document.createElement("div"),ae.className="ap-sdk-panel",ae.setAttribute("data-ap-sdk","1"),ae.setAttribute("role","dialog"),ae.setAttribute("aria-modal","true"),ae.setAttribute("aria-label","My captures"),ae.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),ae.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),ae.innerHTML=`
1634
1641
  <div class="ap-sdk-panel__header">
1635
1642
  <span class="ap-sdk-panel__title">
1636
1643
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1643,7 +1650,7 @@ ${t.instruction}`),r.join(`
1643
1650
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-clear-history>Clear history</button>
1644
1651
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-close-list>Close</button>
1645
1652
  </div>
1646
- `,document.body.appendChild(ce),Wt(ce),Ys(ce,Js),ce.querySelector("[data-ap-close]").addEventListener("click",()=>{An()}),ce.querySelector("[data-ap-close-list]").addEventListener("click",()=>{An()}),ce.querySelector("[data-ap-clear-history]").addEventListener("click",()=>{Ek(),Rn(0),Na(e)}),Na(e)}function Na(e){if(!ce)return;const t=ce.querySelector("[data-ap-list-body]"),n=lr();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=>`
1653
+ `,document.body.appendChild(ae),Yt(ae),Ys(ae,Js),ae.querySelector("[data-ap-close]").addEventListener("click",()=>{Cn()}),ae.querySelector("[data-ap-close-list]").addEventListener("click",()=>{Cn()}),ae.querySelector("[data-ap-clear-history]").addEventListener("click",()=>{Ek(),Ln(0),Na(e)}),Na(e)}function Na(e){if(!ae)return;const t=ae.querySelector("[data-ap-list-body]"),n=lr();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=>`
1647
1654
  <div class="ap-sdk-list-item">
1648
1655
  <div class="ap-sdk-list-item__row">
1649
1656
  <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${Vk(r.type)}</span>
@@ -1654,7 +1661,7 @@ ${t.instruction}`),r.join(`
1654
1661
  ${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${bo(r.id)}">Resume →</button>`:`<a class="ap-sdk-list-item__link" href="${bo(e_(r))}" target="_blank" rel="noopener noreferrer">View →</a>`}
1655
1662
  </div>
1656
1663
  </div>
1657
- `).join(""),e){const r=e;Promise.all(n.map(o=>Qk(o,r))).then(o=>{Rn(pl(o))}),t.querySelectorAll("[data-ap-resume]").forEach(o=>{o.addEventListener("click",()=>{const i=o.dataset.apResume,a=n.find(d=>d.id===i);a&&(An(),si(a.id,r,a.backendUrl,a.title,()=>{}))})})}}function Qk(e,t){return L(this,null,function*(){const n=yield dl(e,t),r=ce==null?void 0:ce.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 e_(e){const t=e.backendUrl.replace(/\/+$/,"");return e.type==="planning"?`${t}/planning/${e.id}`:`${t}/tasks/${e.id}`}function bo(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function t_(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let nn=null;function n_(){const e=new Uint32Array(4);return crypto.getRandomValues(e),Array.from(e,t=>t.toString(16)).join("")}function Da(e){if(nn){const d=nn;d.cleanup(),d.popup.closed||d.popup.close(),nn=null}const t=e.replace(/\/+$/,""),n=new URL(t).origin,r=n_(),o=window.location.origin,i=`${t}/oauth/authorize?origin=${encodeURIComponent(o)}&state=${encodeURIComponent(r)}`,a=window.open(i,"ap-sdk-oauth","width=480,height=640");return a?new Promise((d,l)=>{let p=!1;function h(){window.removeEventListener("message",g),clearInterval(m),(nn==null?void 0:nn.popup)===a&&(nn=null)}function g(k){if(k.origin!==n)return;const y=k.data;!y||y.type!=="ap-sdk-oauth"||y.state!==r||!y.code||(p=!0,h(),d({code:y.code}))}window.addEventListener("message",g);const m=window.setInterval(()=>{a.closed&&(h(),p||l(new Error("Connection cancelled.")))},500);nn={popup:a,cleanup:h}}):Promise.reject(new Error("Popup blocked — please allow popups for this site and try again."))}const r_="https://agent-platform.tung.engineering",ui="ap-sdk-config";function o_(){try{const e=sessionStorage.getItem(ui);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.token)||!(t!=null&&t.projectCode)||!(t!=null&&t.expiresAt)?null:new Date(t.expiresAt).getTime()<=Date.now()?(ml(),null):t}catch(e){return null}}function s_(e){sessionStorage.setItem(ui,JSON.stringify(e)),a_({backendUrl:e.backendUrl,projectCode:e.projectCode})}function ml(){sessionStorage.removeItem(ui)}const bl="ap-sdk-last-connection";function i_(){try{const e=localStorage.getItem(bl);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.projectCode)?null:t}catch(e){return null}}function a_(e){try{localStorage.setItem(bl,JSON.stringify(e))}catch(t){}}let Q=null;function qt(){Q&&Jt(Q),Q==null||Q.remove(),Q=null}function c_(e){Q&&qt(),Q=document.createElement("div"),Q.className="ap-sdk-panel",Q.setAttribute("data-ap-sdk","1"),Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label","Connect to Agent Platform");const t=i_();t?n(t):r(r_),document.body.appendChild(Q),Wt(Q);function n(i){if(!Q)return;Q.innerHTML=`
1664
+ `).join(""),e){const r=e;Promise.all(n.map(o=>Qk(o,r))).then(o=>{Ln(pl(o))}),t.querySelectorAll("[data-ap-resume]").forEach(o=>{o.addEventListener("click",()=>{const i=o.dataset.apResume,a=n.find(d=>d.id===i);a&&(Cn(),si(a.id,r,a.backendUrl,a.title,()=>{}))})})}}function Qk(e,t){return L(this,null,function*(){const n=yield dl(e,t),r=ae==null?void 0:ae.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 e_(e){const t=e.backendUrl.replace(/\/+$/,"");return e.type==="planning"?`${t}/planning/${e.id}`:`${t}/tasks/${e.id}`}function bo(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function t_(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let rn=null;function n_(){const e=new Uint32Array(4);return crypto.getRandomValues(e),Array.from(e,t=>t.toString(16)).join("")}function Da(e){if(rn){const d=rn;d.cleanup(),d.popup.closed||d.popup.close(),rn=null}const t=e.replace(/\/+$/,""),n=new URL(t).origin,r=n_(),o=window.location.origin,i=`${t}/oauth/authorize?origin=${encodeURIComponent(o)}&state=${encodeURIComponent(r)}`,a=window.open(i,"ap-sdk-oauth","width=480,height=640");return a?new Promise((d,l)=>{let p=!1;function h(){window.removeEventListener("message",g),clearInterval(m),(rn==null?void 0:rn.popup)===a&&(rn=null)}function g(k){if(k.origin!==n)return;const y=k.data;!y||y.type!=="ap-sdk-oauth"||y.state!==r||!y.code||(p=!0,h(),d({code:y.code}))}window.addEventListener("message",g);const m=window.setInterval(()=>{a.closed&&(h(),p||l(new Error("Connection cancelled.")))},500);rn={popup:a,cleanup:h}}):Promise.reject(new Error("Popup blocked — please allow popups for this site and try again."))}const r_="https://agent-platform.tung.engineering",ui="ap-sdk-config";function o_(){try{const e=sessionStorage.getItem(ui);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.token)||!(t!=null&&t.projectCode)||!(t!=null&&t.expiresAt)?null:new Date(t.expiresAt).getTime()<=Date.now()?(ml(),null):t}catch(e){return null}}function s_(e){sessionStorage.setItem(ui,JSON.stringify(e)),a_({backendUrl:e.backendUrl,projectCode:e.projectCode})}function ml(){sessionStorage.removeItem(ui)}const bl="ap-sdk-last-connection";function i_(){try{const e=localStorage.getItem(bl);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.projectCode)?null:t}catch(e){return null}}function a_(e){try{localStorage.setItem(bl,JSON.stringify(e))}catch(t){}}let K=null;function Ft(){K&&Xt(K),K==null||K.remove(),K=null}function c_(e){K&&Ft(),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=i_();t?n(t):r(r_),document.body.appendChild(K),Yt(K);function n(i){if(!K)return;K.innerHTML=`
1658
1665
  <div class="ap-sdk-panel__header">
1659
1666
  <span class="ap-sdk-panel__title">
1660
1667
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1673,7 +1680,7 @@ ${t.instruction}`),r.join(`
1673
1680
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-reconnect>Reconnect</button>
1674
1681
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-use-different>Use a different connection</button>
1675
1682
  </div>
1676
- `;const a=Q.querySelector("[data-ap-cfg-status]"),d=Q.querySelector("[data-ap-reconnect]");Q.querySelector("[data-ap-close]").addEventListener("click",()=>{qt()}),Q.querySelector("[data-ap-use-different]").addEventListener("click",()=>r(i.backendUrl)),d.addEventListener("click",()=>L(null,null,function*(){d.disabled=!0,d.textContent="Connecting…",rn(a,null,"");try{const{code:l}=yield Da(i.backendUrl),{token:p,expiresAt:h}=yield ca({backendUrl:i.backendUrl},l,window.location.origin),g={backendUrl:i.backendUrl,token:p},m=yield aa(g);if(m.length===0){rn(a,"error","No projects found — check your account permissions."),d.disabled=!1,d.textContent="Reconnect";return}const k=m.find(Z=>Z.key===i.projectCode);if(k){qt(),e({backendUrl:i.backendUrl,token:p,projectCode:k.key,expiresAt:h});return}const y=oa(window.location.href,m),E=y?m.find(Z=>Z.id===y):void 0;E?(qt(),e({backendUrl:i.backendUrl,token:p,projectCode:E.key,expiresAt:h})):o(i.backendUrl,p,h,m)}catch(l){rn(a,"error",`Could not connect — ${l instanceof Error?l.message:"please try again"}`),d.disabled=!1,d.textContent="Reconnect"}}))}function r(i){if(!Q)return;Q.innerHTML=`
1683
+ `;const a=K.querySelector("[data-ap-cfg-status]"),d=K.querySelector("[data-ap-reconnect]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Ft()}),K.querySelector("[data-ap-use-different]").addEventListener("click",()=>r(i.backendUrl)),d.addEventListener("click",()=>L(null,null,function*(){d.disabled=!0,d.textContent="Connecting…",on(a,null,"");try{const{code:l}=yield Da(i.backendUrl),{token:p,expiresAt:h}=yield ca({backendUrl:i.backendUrl},l,window.location.origin),g={backendUrl:i.backendUrl,token:p},m=yield aa(g);if(m.length===0){on(a,"error","No projects found — check your account permissions."),d.disabled=!1,d.textContent="Reconnect";return}const k=m.find(j=>j.key===i.projectCode);if(k){Ft(),e({backendUrl:i.backendUrl,token:p,projectCode:k.key,expiresAt:h});return}const y=oa(window.location.href,m),E=y?m.find(j=>j.id===y):void 0;E?(Ft(),e({backendUrl:i.backendUrl,token:p,projectCode:E.key,expiresAt:h})):o(i.backendUrl,p,h,m)}catch(l){on(a,"error",`Could not connect — ${l instanceof Error?l.message:"please try again"}`),d.disabled=!1,d.textContent="Reconnect"}}))}function r(i){if(!K)return;K.innerHTML=`
1677
1684
  <div class="ap-sdk-panel__header">
1678
1685
  <span class="ap-sdk-panel__title">
1679
1686
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1697,7 +1704,7 @@ ${t.instruction}`),r.join(`
1697
1704
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-connect>Connect via Agent Platform</button>
1698
1705
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-cancel>Cancel</button>
1699
1706
  </div>
1700
- `;const a=Q.querySelector("[data-ap-cfg-url]"),d=Q.querySelector("[data-ap-cfg-status]"),l=Q.querySelector("[data-ap-connect]");Q.querySelector("[data-ap-close]").addEventListener("click",()=>{qt()}),Q.querySelector("[data-ap-cancel]").addEventListener("click",()=>{qt()}),l.addEventListener("click",()=>L(null,null,function*(){const p=a.value.trim();if(!p){rn(d,"error","Backend URL is required.");return}l.disabled=!0,l.textContent="Connecting…",rn(d,null,"");try{const{code:h}=yield Da(p),{token:g,expiresAt:m}=yield ca({backendUrl:p},h,window.location.origin),y=yield aa({backendUrl:p,token:g});if(y.length===0){rn(d,"error","No projects found — check your account permissions."),l.disabled=!1,l.textContent="Connect via Agent Platform";return}const E=oa(window.location.href,y),Z=E?y.find(ee=>ee.id===E):void 0;if(Z){qt(),e({backendUrl:p,token:g,projectCode:Z.key,expiresAt:m});return}o(p,g,m,y)}catch(h){rn(d,"error",`Could not connect — ${h instanceof Error?h.message:"please try again"}`),l.disabled=!1,l.textContent="Connect via Agent Platform"}})),setTimeout(()=>a.focus(),50)}function o(i,a,d,l){if(!Q)return;const p=l.map(m=>`<option value="${Ma(m.key)}"${m.key===(t==null?void 0:t.projectCode)?" selected":""}>${Ss(m.name)} (${Ss(m.key)})</option>`).join("");Q.innerHTML=`
1707
+ `;const a=K.querySelector("[data-ap-cfg-url]"),d=K.querySelector("[data-ap-cfg-status]"),l=K.querySelector("[data-ap-connect]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Ft()}),K.querySelector("[data-ap-cancel]").addEventListener("click",()=>{Ft()}),l.addEventListener("click",()=>L(null,null,function*(){const p=a.value.trim();if(!p){on(d,"error","Backend URL is required.");return}l.disabled=!0,l.textContent="Connecting…",on(d,null,"");try{const{code:h}=yield Da(p),{token:g,expiresAt:m}=yield ca({backendUrl:p},h,window.location.origin),y=yield aa({backendUrl:p,token:g});if(y.length===0){on(d,"error","No projects found — check your account permissions."),l.disabled=!1,l.textContent="Connect via Agent Platform";return}const E=oa(window.location.href,y),j=E?y.find(Q=>Q.id===E):void 0;if(j){Ft(),e({backendUrl:p,token:g,projectCode:j.key,expiresAt:m});return}o(p,g,m,y)}catch(h){on(d,"error",`Could not connect — ${h instanceof Error?h.message:"please try again"}`),l.disabled=!1,l.textContent="Connect via Agent Platform"}})),setTimeout(()=>a.focus(),50)}function o(i,a,d,l){if(!K)return;const p=l.map(m=>`<option value="${Ma(m.key)}"${m.key===(t==null?void 0:t.projectCode)?" selected":""}>${Ss(m.name)} (${Ss(m.key)})</option>`).join("");K.innerHTML=`
1701
1708
  <div class="ap-sdk-panel__header">
1702
1709
  <span class="ap-sdk-panel__title">
1703
1710
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1719,7 +1726,7 @@ ${t.instruction}`),r.join(`
1719
1726
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-save>Save</button>
1720
1727
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-back>Back</button>
1721
1728
  </div>
1722
- `;const h=Q.querySelector("[data-ap-cfg-project]"),g=Q.querySelector("[data-ap-cfg-status]");Q.querySelector("[data-ap-close]").addEventListener("click",()=>{qt()}),Q.querySelector("[data-ap-back]").addEventListener("click",()=>r(i)),Q.querySelector("[data-ap-save]").addEventListener("click",()=>{const m=h.value;if(!m){rn(g,"error","Please select a project.");return}qt(),e({backendUrl:i,token:a,projectCode:m,expiresAt:d})})}}function rn(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 Ma(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ss(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let pt=null,Bo=!1;function l_(){pt==null||pt.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),pt&&pt.observe(document.body,{childList:!0}),Bo=!1}function kl(){pt||(pt=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||Bo||(Bo=!0,queueMicrotask(l_))}),pt.observe(document.body,{childList:!0}))}function u_(){pt==null||pt.disconnect(),pt=null,Bo=!1}const d_={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};let Pe=null,an=[];function Ro(){Pe&&Jt(Pe),Pe==null||Pe.remove(),Pe=null,an=[]}function p_(e,t,n){Pe&&Ro(),an=[...e],Pe=document.createElement("div"),Pe.className="ap-sdk-panel ap-sdk-record-review",Pe.setAttribute("data-ap-sdk","1"),Pe.setAttribute("role","dialog"),Pe.setAttribute("aria-modal","true"),Pe.setAttribute("aria-label","Review recorded steps"),Pe.innerHTML=`
1729
+ `;const h=K.querySelector("[data-ap-cfg-project]"),g=K.querySelector("[data-ap-cfg-status]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Ft()}),K.querySelector("[data-ap-back]").addEventListener("click",()=>r(i)),K.querySelector("[data-ap-save]").addEventListener("click",()=>{const m=h.value;if(!m){on(g,"error","Please select a project.");return}Ft(),e({backendUrl:i,token:a,projectCode:m,expiresAt:d})})}}function on(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 Ma(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ss(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let ht=null,Bo=!1;function l_(){ht==null||ht.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),ht&&ht.observe(document.body,{childList:!0}),Bo=!1}function kl(){ht||(ht=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||Bo||(Bo=!0,queueMicrotask(l_))}),ht.observe(document.body,{childList:!0}))}function u_(){ht==null||ht.disconnect(),ht=null,Bo=!1}const d_={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};let Ae=null,cn=[];function Ro(){Ae&&Xt(Ae),Ae==null||Ae.remove(),Ae=null,cn=[]}function p_(e,t,n){Ae&&Ro(),cn=[...e],Ae=document.createElement("div"),Ae.className="ap-sdk-panel ap-sdk-record-review",Ae.setAttribute("data-ap-sdk","1"),Ae.setAttribute("role","dialog"),Ae.setAttribute("aria-modal","true"),Ae.setAttribute("aria-label","Review recorded steps"),Ae.innerHTML=`
1723
1730
  <div class="ap-sdk-panel__header">
1724
1731
  <span class="ap-sdk-panel__title">
1725
1732
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1734,11 +1741,11 @@ ${t.instruction}`),r.join(`
1734
1741
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-review-continue>Continue</button>
1735
1742
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-review-cancel>Cancel</button>
1736
1743
  </div>
1737
- `,document.body.appendChild(Pe),Wt(Pe);const r=Pe.querySelector("[data-ap-review-list]"),o=Pe.querySelector("[data-ap-review-continue]"),i=()=>{if(an.length===0){r.innerHTML='<p class="ap-sdk-list-empty">No steps recorded.</p>',o.disabled=!0;return}o.disabled=!1,r.innerHTML=an.map((d,l)=>{var p;return`
1744
+ `,document.body.appendChild(Ae),Yt(Ae);const r=Ae.querySelector("[data-ap-review-list]"),o=Ae.querySelector("[data-ap-review-continue]"),i=()=>{if(cn.length===0){r.innerHTML='<p class="ap-sdk-list-empty">No steps recorded.</p>',o.disabled=!0;return}o.disabled=!1,r.innerHTML=cn.map((d,l)=>{var p;return`
1738
1745
  <div class="ap-sdk-record-step" data-step-index="${l}">
1739
1746
  <span class="ap-sdk-record-step__icon">${d_[d.action]}</span>
1740
1747
  ${d.action==="inputText"&&!d.redacted?`<input class="ap-sdk-record-step__input" type="text" value="${h_((p=d.value)!=null?p:"")}" data-ap-step-value />`:`<span class="ap-sdk-record-step__description">${_l(d.description)}</span>`}
1741
1748
  <button class="ap-sdk-record-step__remove" data-ap-step-remove="${l}" aria-label="Remove step ${l+1}">✕</button>
1742
1749
  </div>
1743
- `}).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(d=>{d.addEventListener("click",()=>{const l=parseInt(d.dataset.apStepRemove,10);an.splice(l,1),i()})}),r.querySelectorAll("[data-ap-step-value]").forEach(d=>{const l=d.closest("[data-step-index]"),p=parseInt(l.dataset.stepIndex,10);d.addEventListener("input",()=>{var g;const h=an[p];h.value=d.value,h.description=tl((g=h.elementText)!=null?g:"",d.value,!1)})})};i();const a=()=>{Ro()};Pe.querySelector("[data-ap-review-close]").addEventListener("click",a),Pe.querySelector("[data-ap-review-cancel]").addEventListener("click",a),o.addEventListener("click",()=>{if(an.length===0)return;const d=an,l=U(v({},qa()),{pageUrl:window.location.href,pageTitle:document.title,interactionSteps:d});Ro(),t(l)})}function _l(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function h_(e){return _l(e)}let q=null,Go=null,Wo=null,Jo=null;function di(e,t,n){Go=e,Wo=t,Jo=n,ll(e,t,n)}const vl="#agent-platform-web-sdk",yl="ap-sdk-fab-unlocked";let En=null;function wl(){try{if(localStorage.getItem(yl)==="1")return!0}catch(e){}return window.location.hash===vl}function Ua(){try{localStorage.setItem(yl,"1")}catch(e){}}function xl(e){return L(this,null,function*(){var t,n,r,o;if(jr(),!(q&&q.projectCode===e.projectCode&&q.backendUrl===((t=e.backendUrl)!=null?t:null)&&q.token===((n=e.token)!=null?n:null))){if(q={projectCode:e.projectCode,backendUrl:(r=e.backendUrl)!=null?r:null,token:(o=e.token)!=null?o:null,project:null,resolvingProject:!1,permissions:null},di(()=>Sl(),()=>g_(),()=>hi()),Rn(lr().length),q.backendUrl&&q.token){const i=q.backendUrl,a=q.token;yield Rl(),hl({backendUrl:i,token:a}).catch(()=>{}),Pl({backendUrl:i,token:a}).catch(()=>{});const d=Dm();d&&si(d.taskId,{backendUrl:i,token:a},d.backendUrl,d.title,()=>{})}kl()}})}function pi(e,t){return L(this,null,function*(){if(!q)throw new Error("AgentPlatformSDK: call init() first.");q.backendUrl=e,q.token=t,q.project=null,q.permissions=null,yield Rl(),Pl({backendUrl:e,token:t}).catch(()=>{})})}function Sl(){if(!q)throw new Error("AgentPlatformSDK: call init() first.");Vn()||(jr(),hs((e,t)=>L(null,null,function*(){gl()&&An(),fl(e,t,{backendUrl:q.backendUrl,token:q.token},q.project,q.projectCode,n=>L(null,null,function*(){yield pi(n.backendUrl,n.token)}),Ln,n=>{hs((r,o)=>{Nr()&&n(r,o)},()=>{Tl()})},(n,r)=>{hs((o,i)=>{Nr()&&n(o,i)},()=>{Nr()&&r()})},()=>{Vn()&&js()},q.permissions)}),()=>{}))}function f_(){js()}function g_(){if(!q)throw new Error("AgentPlatformSDK: call init() first.");So()||(jr(),Ok(e=>{p_(e,t=>{fl(t,null,{backendUrl:q.backendUrl,token:q.token},q.project,q.projectCode,n=>L(null,null,function*(){yield pi(n.backendUrl,n.token)}),Ln,void 0,void 0,()=>{},q.permissions)})}))}function Tl(){Nr()&&Ur()}function m_(){return Vn()}function El(){u_(),En&&(window.removeEventListener("hashchange",En),En=null),js(),Nk(),Ro(),Ur(),An(),ul(),Go=null,Wo=null,Jo=null,q=null}function Al(){if(typeof window=="undefined"||typeof document=="undefined")return;jr();const e=o_(),t=()=>{e?Cl(e).catch(console.error):(di(()=>Ln(),()=>Ln(),()=>hi()),Rn(lr().length),kl())};if(wl()){Ua(),t();return}En=()=>{window.location.hash===vl&&(Ua(),window.removeEventListener("hashchange",En),En=null,t())},window.addEventListener("hashchange",En)}function b_(){Go&&Wo&&Jo&&ll(Go,Wo,Jo)}function k_(){ul()}function Ln(){c_(e=>{s_(e),Cl(e).catch(console.error)})}function __(){ml(),El(),jr(),wl()&&(di(()=>Ln(),()=>Ln(),()=>hi()),Rn(lr().length))}function Cl(e){return L(this,null,function*(){yield xl({projectCode:e.projectCode,backendUrl:e.backendUrl,token:e.token})})}function hi(){if(gl()){An();return}Nr()&&Ur();const e=q!=null&&q.backendUrl&&(q!=null&&q.token)?{backendUrl:q.backendUrl,token:q.token}:null;Kk(e)}function Pl(e){return L(this,null,function*(){const t=yield ym(e);q&&(q.permissions=t.permissions)})}function Rl(){return L(this,null,function*(){if(!(!q||!q.backendUrl||!q.token||q.project||q.resolvingProject)){q.resolvingProject=!0;try{q.project=yield Pc({backendUrl:q.backendUrl,token:q.token},q.projectCode)}catch(e){}finally{q&&(q.resolvingProject=!1)}}})}Al();exports.activateElementPicker=Sl;exports.autoInit=Al;exports.clearConfig=__;exports.closePanelIfOpen=Tl;exports.configure=Ln;exports.deactivateElementPicker=f_;exports.destroy=El;exports.hideFab=k_;exports.init=xl;exports.isPickerRunning=m_;exports.showFab=b_;exports.updateCredentials=pi;
1750
+ `}).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(d=>{d.addEventListener("click",()=>{const l=parseInt(d.dataset.apStepRemove,10);cn.splice(l,1),i()})}),r.querySelectorAll("[data-ap-step-value]").forEach(d=>{const l=d.closest("[data-step-index]"),p=parseInt(l.dataset.stepIndex,10);d.addEventListener("input",()=>{var g;const h=cn[p];h.value=d.value,h.description=tl((g=h.elementText)!=null?g:"",d.value,!1)})})};i();const a=()=>{Ro()};Ae.querySelector("[data-ap-review-close]").addEventListener("click",a),Ae.querySelector("[data-ap-review-cancel]").addEventListener("click",a),o.addEventListener("click",()=>{if(cn.length===0)return;const d=cn,l=M(v({},qa()),{pageUrl:window.location.href,pageTitle:document.title,interactionSteps:d});Ro(),t(l)})}function _l(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function h_(e){return _l(e)}let q=null,Go=null,Wo=null,Jo=null;function di(e,t,n){Go=e,Wo=t,Jo=n,ll(e,t,n)}const vl="#agent-platform-web-sdk",yl="ap-sdk-fab-unlocked";let An=null;function wl(){try{if(localStorage.getItem(yl)==="1")return!0}catch(e){}return window.location.hash===vl}function Ua(){try{localStorage.setItem(yl,"1")}catch(e){}}function xl(e){return L(this,null,function*(){var t,n,r,o;if(jr(),!(q&&q.projectCode===e.projectCode&&q.backendUrl===((t=e.backendUrl)!=null?t:null)&&q.token===((n=e.token)!=null?n:null))){if(q={projectCode:e.projectCode,backendUrl:(r=e.backendUrl)!=null?r:null,token:(o=e.token)!=null?o:null,project:null,resolvingProject:!1,permissions:null},di(()=>Sl(),()=>g_(),()=>hi()),Ln(lr().length),q.backendUrl&&q.token){const i=q.backendUrl,a=q.token;yield Rl(),hl({backendUrl:i,token:a}).catch(()=>{}),Pl({backendUrl:i,token:a}).catch(()=>{});const d=Dm();d&&si(d.taskId,{backendUrl:i,token:a},d.backendUrl,d.title,()=>{})}kl()}})}function pi(e,t){return L(this,null,function*(){if(!q)throw new Error("AgentPlatformSDK: call init() first.");q.backendUrl=e,q.token=t,q.project=null,q.permissions=null,yield Rl(),Pl({backendUrl:e,token:t}).catch(()=>{})})}function Sl(){if(!q)throw new Error("AgentPlatformSDK: call init() first.");Vn()||(jr(),hs((e,t)=>L(null,null,function*(){gl()&&Cn(),fl(e,t,{backendUrl:q.backendUrl,token:q.token},q.project,q.projectCode,n=>L(null,null,function*(){yield pi(n.backendUrl,n.token)}),In,n=>{hs((r,o)=>{Nr()&&n(r,o)},()=>{Tl()})},(n,r)=>{hs((o,i)=>{Nr()&&n(o,i)},()=>{Nr()&&r()})},()=>{Vn()&&js()},q.permissions)}),()=>{}))}function f_(){js()}function g_(){if(!q)throw new Error("AgentPlatformSDK: call init() first.");So()||(jr(),Ok(e=>{p_(e,t=>{fl(t,null,{backendUrl:q.backendUrl,token:q.token},q.project,q.projectCode,n=>L(null,null,function*(){yield pi(n.backendUrl,n.token)}),In,void 0,void 0,()=>{},q.permissions)})}))}function Tl(){Nr()&&Ur()}function m_(){return Vn()}function El(){u_(),An&&(window.removeEventListener("hashchange",An),An=null),js(),Nk(),Ro(),Ur(),Cn(),ul(),Go=null,Wo=null,Jo=null,q=null}function Al(){if(typeof window=="undefined"||typeof document=="undefined")return;jr();const e=o_(),t=()=>{e?Cl(e).catch(console.error):(di(()=>In(),()=>In(),()=>hi()),Ln(lr().length),kl())};if(wl()){Ua(),t();return}An=()=>{window.location.hash===vl&&(Ua(),window.removeEventListener("hashchange",An),An=null,t())},window.addEventListener("hashchange",An)}function b_(){Go&&Wo&&Jo&&ll(Go,Wo,Jo)}function k_(){ul()}function In(){c_(e=>{s_(e),Cl(e).catch(console.error)})}function __(){ml(),El(),jr(),wl()&&(di(()=>In(),()=>In(),()=>hi()),Ln(lr().length))}function Cl(e){return L(this,null,function*(){yield xl({projectCode:e.projectCode,backendUrl:e.backendUrl,token:e.token})})}function hi(){if(gl()){Cn();return}Nr()&&Ur();const e=q!=null&&q.backendUrl&&(q!=null&&q.token)?{backendUrl:q.backendUrl,token:q.token}:null;Kk(e)}function Pl(e){return L(this,null,function*(){const t=yield ym(e);q&&(q.permissions=t.permissions)})}function Rl(){return L(this,null,function*(){if(!(!q||!q.backendUrl||!q.token||q.project||q.resolvingProject)){q.resolvingProject=!0;try{q.project=yield Pc({backendUrl:q.backendUrl,token:q.token},q.projectCode)}catch(e){}finally{q&&(q.resolvingProject=!1)}}})}Al();exports.activateElementPicker=Sl;exports.autoInit=Al;exports.clearConfig=__;exports.closePanelIfOpen=Tl;exports.configure=In;exports.deactivateElementPicker=f_;exports.destroy=El;exports.hideFab=k_;exports.init=xl;exports.isPickerRunning=m_;exports.showFab=b_;exports.updateCredentials=pi;
1744
1751
  //# sourceMappingURL=web-sdk.cjs.map