@tung-engineering/agent-platform-web-sdk 0.0.78 → 0.0.81
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/README.md +132 -0
- package/dist/web-sdk.cjs +124 -85
- package/dist/web-sdk.cjs.map +1 -1
- package/dist/web-sdk.min.js +114 -75
- package/dist/web-sdk.min.js.map +1 -1
- package/dist/web-sdk.mjs +2253 -2197
- package/dist/web-sdk.mjs.map +1 -1
- package/package.json +1 -1
package/dist/web-sdk.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var f_=Object.defineProperty,g_=Object.defineProperties;var m_=Object.getOwnPropertyDescriptors;var Zl=Object.getOwnPropertySymbols;var b_=Object.prototype.hasOwnProperty,k_=Object.prototype.propertyIsEnumerable;var ql=Math.pow,yi=(oe,Ie,Me)=>Ie in oe?f_(oe,Ie,{enumerable:!0,configurable:!0,writable:!0,value:Me}):oe[Ie]=Me,y=(oe,Ie)=>{for(var Me in Ie||(Ie={}))b_.call(Ie,Me)&&yi(oe,Me,Ie[Me]);if(Zl)for(var Me of Zl(Ie))k_.call(Ie,Me)&&yi(oe,Me,Ie[Me]);return oe},D=(oe,Ie)=>g_(oe,m_(Ie));var ce=(oe,Ie,Me)=>yi(oe,typeof Ie!="symbol"?Ie+"":Ie,Me);var I=(oe,Ie,Me)=>new Promise((Si,cs)=>{var Ti=tn=>{try{Yr(Me.next(tn))}catch(Vr){cs(Vr)}},Ei=tn=>{try{Yr(Me.throw(tn))}catch(Vr){cs(Vr)}},Yr=tn=>tn.done?Si(tn.value):Promise.resolve(tn.value).then(Ti,Ei);Yr((Me=Me.apply(oe,Ie)).next())});var AgentPlatformWebSdk=(function(oe){"use strict";var Sl,Go;const Hl=[`
|
|
2
2
|
:where([data-ap-sdk][popover]) {
|
|
3
3
|
position: fixed;
|
|
4
4
|
margin: 0;
|
|
@@ -1259,6 +1259,41 @@ button.ap-sdk-list-item__link {
|
|
|
1259
1259
|
white-space: nowrap;
|
|
1260
1260
|
}
|
|
1261
1261
|
|
|
1262
|
+
.ap-sdk-runner__log-toolbar {
|
|
1263
|
+
display: flex;
|
|
1264
|
+
justify-content: flex-end;
|
|
1265
|
+
gap: 6px;
|
|
1266
|
+
padding: 6px 16px 0;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
.ap-sdk-runner__scroll-toggle,
|
|
1270
|
+
.ap-sdk-runner__scroll-jump {
|
|
1271
|
+
font-family: inherit;
|
|
1272
|
+
font-size: 10.5px;
|
|
1273
|
+
font-weight: 600;
|
|
1274
|
+
line-height: 1.4;
|
|
1275
|
+
padding: 2px 8px;
|
|
1276
|
+
border-radius: 999px;
|
|
1277
|
+
border: 1px solid #e5e7eb;
|
|
1278
|
+
background: #fff;
|
|
1279
|
+
color: #6b7280;
|
|
1280
|
+
cursor: pointer;
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
.ap-sdk-runner__scroll-toggle:hover,
|
|
1284
|
+
.ap-sdk-runner__scroll-jump:hover {
|
|
1285
|
+
color: #374151;
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
/* Signals "currently sticking to the bottom" — same accent used for
|
|
1289
|
+
successful log-entry status text below, so it reads as an active/on state
|
|
1290
|
+
rather than a plain neutral button. */
|
|
1291
|
+
.ap-sdk-runner__scroll-toggle--active {
|
|
1292
|
+
background: oklch(96% 0.03 42);
|
|
1293
|
+
border-color: oklch(80% 0.08 42);
|
|
1294
|
+
color: oklch(38% 0.13 40);
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1262
1297
|
.ap-sdk-runner__log {
|
|
1263
1298
|
padding: 10px 16px;
|
|
1264
1299
|
max-height: 240px;
|
|
@@ -1433,11 +1468,11 @@ button.ap-sdk-list-item__link {
|
|
|
1433
1468
|
border-bottom: 2px solid #d1d5db;
|
|
1434
1469
|
}
|
|
1435
1470
|
`].join(`
|
|
1436
|
-
`);let
|
|
1437
|
-
`)}return r(e,0)}const
|
|
1438
|
-
`)}const jn=new Set;let Zn=null,eo=!1,as=!1;function Ql(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function eu(){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(!(jn.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&Ql(r))return!0}return!1}function Ci(){const e=eu(),t=e&&!as;as=e;for(const n of jn){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 Pi(e){if(!(e instanceof Node))return!1;for(const t of jn)if(t===e||t.contains(e))return!0;return!1}function qn(e){(Pi(e.target)||"relatedTarget"in e&&Pi(e.relatedTarget))&&e.stopPropagation()}function tu(){eo||(window.addEventListener("focusin",qn,!0),window.addEventListener("focusout",qn,!0),window.addEventListener("pointerdown",qn,!0),eo=!0),!Zn&&(Zn=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")&&Ci()}),Zn.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function Mt(e){"showPopover"in e&&(e.setAttribute("popover","manual"),jn.add(e),tu(),Ci())}function Ut(e){if(jn.delete(e),jn.size===0&&(Zn&&(Zn.disconnect(),Zn=null),eo&&(window.removeEventListener("focusin",qn,!0),window.removeEventListener("focusout",qn,!0),window.removeEventListener("pointerdown",qn,!0),eo=!1),as=!1),"hidePopover"in e)try{e.hidePopover()}catch(t){}}function cs(e="ap-sdk-highlight"){const t=document.createElement("div");return t.className=e,t.setAttribute("data-ap-sdk","1"),t.style.display="none",document.body.appendChild(t),Mt(t),{el:t,update:i=>{const a=i.getBoundingClientRect();t.style.top=`${a.top}px`,t.style.left=`${a.left}px`,t.style.width=`${a.width}px`,t.style.height=`${a.height}px`,t.style.display="block"},hide:()=>{t.style.display="none"},destroy:()=>{Ut(t),t.remove()}}}const Ri=/^cc-|current-password|new-password/i,nu=/token|secret|password|apikey|auth/i,ls="[redacted]";function ru(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&Ri.test(t)}function Li(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",ls);const r=n.getAttribute("autocomplete");r&&Ri.test(r)&&n.setAttribute("value",ls);for(const o of Array.from(n.attributes))nu.test(o.name)&&n.setAttribute(o.name,ls)}}const ou="🎯 Click any element to capture";let tn=null,ze=null,qe=null;function br(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 su(){var e,t;return((t=(e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)!=null?t:!1)||"ontouchstart"in window}function Ii(e){tn==null||tn.update(e)}function zi(e){const t=Ai(),n=Vl(e),r=Xl(e);let o;try{const i=e.cloneNode(!0);Li(i),o=i.outerHTML.slice(0,4e3)}catch(i){}return y(y({pageUrl:window.location.href,pageTitle:document.title,elementText:Xr(e),cssSelector:Vr(e),innerTree:Fl(e),outerTree:Yl(e),elementOuterHtml:o,ancestry:n},r),t)}function us(e,t){qe&&qe();const n=su();tn=cs(),ze=document.createElement("div"),ze.className="ap-sdk-picker-cursor",ze.setAttribute("data-ap-sdk","1"),ze.textContent=n?"Tap any element to preview":ou,document.body.appendChild(ze),Mt(ze);let r=null,o=null;const i=h=>{qe==null||qe(),e(zi(h),h)},a=h=>{if(o=h,Ii(h),!ze)return;ze.classList.add("ap-sdk-picker-cursor--confirm"),ze.innerHTML="";const m=document.createElement("span");m.className="ap-sdk-picker-cursor__label",m.textContent=`<${h.tagName.toLowerCase()}>`;const g=document.createElement("button");g.type="button",g.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--cancel",g.textContent="✕ Cancel",g.setAttribute("data-ap-sdk","1"),g.setAttribute("aria-label","Cancel picking"),g.addEventListener("click",T=>{T.preventDefault(),T.stopPropagation(),qe==null||qe(),t()});const k=document.createElement("button");k.type="button",k.className="ap-sdk-picker-cursor__btn",k.textContent="⬆ Parent",k.setAttribute("data-ap-sdk","1"),k.addEventListener("click",T=>{T.preventDefault(),T.stopPropagation(),o!=null&&o.parentElement&&a(o.parentElement)});const v=document.createElement("button");v.type="button",v.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",v.textContent="✓ Select",v.setAttribute("data-ap-sdk","1"),v.addEventListener("click",T=>{T.preventDefault(),T.stopPropagation(),o&&i(o)}),ze.appendChild(m),ze.appendChild(g),ze.appendChild(k),ze.appendChild(v)},d=h=>{br(h.target)||(r=h.target,Ii(r))},u=h=>{var g;if(br(h.target))return;h.preventDefault(),h.stopImmediatePropagation();const m=(g=h.target)!=null?g:r;if(m){if(n){a(m);return}i(m)}},p=h=>{h.key==="Escape"&&(qe==null||qe(),t())};n||document.addEventListener("mouseover",d,{capture:!0}),document.addEventListener("click",u,{capture:!0}),document.addEventListener("keydown",p,{capture:!0}),qe=()=>{n||document.removeEventListener("mouseover",d,{capture:!0}),document.removeEventListener("click",u,{capture:!0}),document.removeEventListener("keydown",p,{capture:!0}),ze&&Ut(ze),ze==null||ze.remove(),tn==null||tn.destroy(),tn=null,ze=null,o=null,qe=null}}function ds(){qe==null||qe()}function Hn(){return qe!==null}const to={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(u,p){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:p,constr:a,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,p);const h=a.prototype,m=Object.keys(h);for(let g=0;g<m.length;g++){const k=m[g];k in u||(u[k]=h[k].bind(u))}}const o=(d=n==null?void 0:n.Parent)!=null?d:Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(u){var m;var p;const h=n!=null&&n.Parent?new i:this;r(h,u),(m=(p=h._zod).deferred)!=null||(p.deferred=[]);for(const g of h._zod.deferred)g();return h}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:u=>{var p,h;return n!=null&&n.Parent&&u instanceof n.Parent?!0:(h=(p=u==null?void 0:u._zod)==null?void 0:p.traits)==null?void 0:h.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class Fn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class $i extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Oi={};function nn(e){return Oi}function Ni(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 ps(e,t){return typeof t=="bigint"?t.toString():t}function no(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function hs(e){return e==null}function fs(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function iu(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const u=r.match(/\d?e-(\d?)/);u!=null&&u[1]&&(o=Number.parseInt(u[1]))}const i=n>o?n:o,a=Number.parseInt(e.toFixed(i).replace(".","")),d=Number.parseInt(t.toFixed(i).replace(".",""));return a%d/jl(10,i)}const Di=Symbol("evaluating");function ne(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Di)return r===void 0&&(r=Di,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function _n(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function rn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Mi(e){return JSON.stringify(e)}function au(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Ui="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function kr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const cu=no(()=>{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 Bn(e){if(kr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(kr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ji(e){return Bn(e)?y({},e):Array.isArray(e)?[...e]:e}const lu=new Set(["string","number","symbol"]);function Gn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function on(e,t,n){const r=new e._zod.constr(t!=null?t:e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function M(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?D(y({},t),{error:()=>t.error}):t}function uu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const du={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 pu(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=rn(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 _n(this,"shape",a),a},checks:[]});return on(e,i)}function hu(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=rn(e._zod.def,{get shape(){const a=y({},e._zod.def.shape);for(const d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&delete a[d]}return _n(this,"shape",a),a},checks:[]});return on(e,i)}function fu(e,t){if(!Bn(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=rn(e._zod.def,{get shape(){const i=y(y({},e._zod.def.shape),t);return _n(this,"shape",i),i}});return on(e,o)}function gu(e,t){if(!Bn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=rn(e._zod.def,{get shape(){const r=y(y({},e._zod.def.shape),t);return _n(this,"shape",r),r}});return on(e,n)}function mu(e,t){const n=rn(e._zod.def,{get shape(){const r=y(y({},e._zod.def.shape),t._zod.def.shape);return _n(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return on(e,n)}function bu(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=rn(t._zod.def,{get shape(){const d=t._zod.def.shape,u=y({},d);if(n)for(const p in n){if(!(p in d))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(u[p]=e?new e({type:"optional",innerType:d[p]}):d[p])}else for(const p in d)u[p]=e?new e({type:"optional",innerType:d[p]}):d[p];return _n(this,"shape",u),u},checks:[]});return on(t,a)}function ku(e,t,n){const r=rn(t._zod.def,{get shape(){const o=t._zod.def.shape,i=y({},o);if(n)for(const a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return _n(this,"shape",i),i}});return on(t,r)}function Wn(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 Jn(e,t){return t.map(n=>{var o;var r;return(o=(r=n).path)!=null||(r.path=[]),n.path.unshift(e),n})}function ro(e){return typeof e=="string"?e:e==null?void 0:e.message}function sn(e,t,n){var o,i,a,d,u,p,h,m,g,k,v;const r=D(y({},e),{path:(o=e.path)!=null?o:[]});if(!e.message){const T=(v=(k=(m=(p=ro((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:ro((u=t==null?void 0:t.error)==null?void 0:u.call(t,e)))!=null?m:ro((h=n.customError)==null?void 0:h.call(n,e)))!=null?k:ro((g=n.localeError)==null?void 0:g.call(n,e)))!=null?v:"Invalid input";r.message=T}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function gs(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function _r(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:y({},t)}const Zi=(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,ps,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},qi=w("$ZodError",Zi),Hi=w("$ZodError",Zi,{Parent:Error});function _u(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 vu(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let a=n,d=0;for(;d<i.path.length;){const u=i.path[d];d===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(t(i))):a[u]=a[u]||{_errors:[]},a=a[u],d++}}};return r(e),n}const ms=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 Fn;if(a.issues.length){const u=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>sn(p,i,nn())));throw Ui(u,o==null?void 0:o.callee),u}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 u=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>sn(p,i,nn())));throw Ui(u,o==null?void 0:o.callee),u}return a.value}),oo=e=>(t,n,r)=>{const o=r?D(y({},r),{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Fn;return i.issues.length?{success:!1,error:new(e!=null?e:qi)(i.issues.map(a=>sn(a,o,nn())))}:{success:!0,data:i.value}},yu=oo(Hi),so=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=>sn(a,o,nn())))}:{success:!0,data:i.value}}),wu=so(Hi),xu=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ms(e)(t,n,o)},Su=e=>(t,n,r)=>ms(e)(t,n,r),Tu=e=>(t,n,r)=>L(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return bs(e)(t,n,o)}),Eu=e=>(t,n,r)=>L(null,null,function*(){return bs(e)(t,n,r)}),Au=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return oo(e)(t,n,o)},Cu=e=>(t,n,r)=>oo(e)(t,n,r),Pu=e=>(t,n,r)=>L(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return so(e)(t,n,o)}),Ru=e=>(t,n,r)=>L(null,null,function*(){return so(e)(t,n,r)}),Lu=/^[cC][^\s-]{8,}$/,Iu=/^[0-9a-z]+$/,zu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,$u=/^[0-9a-vA-V]{20}$/,Ou=/^[A-Za-z0-9]{27}$/,Nu=/^[a-zA-Z0-9_-]{21}$/,Du=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Mu=/^([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})$/,Fi=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)$/,Uu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ju="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Zu(){return new RegExp(ju,"u")}const qu=/^(?:(?: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])$/,Hu=/^(([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}|:))$/,Fu=/^((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])$/,Bu=/^(([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])$/,Gu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Bi=/^[A-Za-z0-9_-]*$/,Wu=/^\+[1-9]\d{6,14}$/,Gi="(?:(?:\\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])))",Ju=new RegExp(`^${Gi}$`);function Wi(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 Yu(e){return new RegExp(`^${Wi(e)}$`)}function Vu(e){const t=Wi({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(`^${Gi}T(?:${r})$`)}const Xu=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}$`)},Ku=/^-?\d+$/,Ji=/^-?\d+(?:\.\d+)?$/,Qu=/^(?:true|false)$/i,ed=/^[^A-Z]*$/,td=/^[^a-z]*$/,nt=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=[])}),Yi={number:"number",bigint:"bigint",object:"date"},Vi=w("$ZodCheckLessThan",(e,t)=>{nt.init(e,t);const n=Yi[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})}}),Xi=w("$ZodCheckGreaterThan",(e,t)=>{nt.init(e,t);const n=Yi[typeof t.value];e._zod.onattach.push(r=>{var a;const o=r._zod.bag,i=(a=t.inclusive?o.minimum:o.exclusiveMinimum)!=null?a:Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),nd=w("$ZodCheckMultipleOf",(e,t)=>{nt.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):iu(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})}}),rd=w("$ZodCheckNumberFormat",(e,t)=>{var a;nt.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]=du[t.format];e._zod.onattach.push(d=>{const u=d._zod.bag;u.format=t.format,u.minimum=o,u.maximum=i,n&&(u.pattern=Ku)}),e._zod.check=d=>{const u=d.value;if(n){if(!Number.isInteger(u)){d.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?d.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):d.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}u<o&&d.issues.push({origin:"number",input:u,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),u>i&&d.issues.push({origin:"number",input:u,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),od=w("$ZodCheckMaxLength",(e,t)=>{var r;var n;nt.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!hs(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=gs(i);o.issues.push({origin:d,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),sd=w("$ZodCheckMinLength",(e,t)=>{var r;var n;nt.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!hs(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=gs(i);o.issues.push({origin:d,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),id=w("$ZodCheckLengthEquals",(e,t)=>{var r;var n;nt.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!hs(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=gs(i),u=a>t.length;o.issues.push(D(y({origin:d},u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length}),{inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort}))}}),io=w("$ZodCheckStringFormat",(e,t)=>{var o,i;var n,r;nt.init(e,t),e._zod.onattach.push(a=>{var u;const d=a._zod.bag;d.format=t.format,t.pattern&&((u=d.patterns)!=null||(d.patterns=new Set),d.patterns.add(t.pattern))}),t.pattern?(o=(n=e._zod).check)!=null||(n.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push(D(y({origin:"string",code:"invalid_format",format:t.format,input:a.value},t.pattern?{pattern:t.pattern.toString()}:{}),{inst:e,continue:!t.abort}))}):(i=(r=e._zod).check)!=null||(r.check=()=>{})}),ad=w("$ZodCheckRegex",(e,t)=>{io.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})}}),cd=w("$ZodCheckLowerCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ed),io.init(e,t)}),ld=w("$ZodCheckUpperCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=td),io.init(e,t)}),ud=w("$ZodCheckIncludes",(e,t)=>{nt.init(e,t);const n=Gn(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})}}),dd=w("$ZodCheckStartsWith",(e,t)=>{var r;nt.init(e,t);const n=new RegExp(`^${Gn(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})}}),pd=w("$ZodCheckEndsWith",(e,t)=>{var r;nt.init(e,t);const n=new RegExp(`.*${Gn(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})}}),hd=w("$ZodCheckOverwrite",(e,t)=>{nt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class fd{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(`
|
|
1471
|
+
`);let Ai=!1;function mr(){if(Ai)return;const e=document.createElement("style");e.setAttribute("data-ap-sdk","1"),e.textContent=Hl,document.head.appendChild(e),Ai=!0}function Xr(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 Kr(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 Fl=["role","type","name","href","src","alt","title","for","placeholder","data-testid"];function Qr(e){const t=e.tagName.toLowerCase(),n=e.id?`#${e.id}`:"",r=e.classList.length?"."+Array.from(e.classList).join("."):"",o=[],i=new Set,a=d=>{if(i.has(d)||o.length>=8)return;const u=e.getAttribute(d);if(!u)return;i.add(d);const p=u.length>80?u.slice(0,80)+"…":u;o.push(`[${d}="${p}"]`)};for(const d of Array.from(e.attributes))d.name.startsWith("aria-")&&a(d.name);for(const d of Fl)a(d);return`${t}${n}${r}${o.join("")}`}function Bl(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 Gl(e,t=5,n=10){function r(o,i){const a=Qr(o),d=" ".repeat(i),u=Array.from(o.children).slice(0,n);if(i>=t||u.length===0){const p=Bl(o);return p?`${d}${a} "${p}"`:`${d}${a}`}return[`${d}${a}`,...u.map(p=>r(p,i+1))].join(`
|
|
1472
|
+
`)}return r(e,0)}const Wl='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"]',Jl={fieldset:"legend",table:"caption",figure:"figcaption",details:"summary"};function eo(e,t){const n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}function Yl(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(Wl);)o=o.parentElement;if(o===e){const i=((n=r.textContent)!=null?n:"").trim();if(i)return i}}return""}function Vl(e,t=80){var a,d,u;const n=Jl[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 eo(p,t)}const r=Yl(e);if(r)return eo(r,t);const o=(u=e.getAttribute("aria-label"))==null?void 0:u.trim();if(o)return eo(o,t);const i=e.getAttribute("aria-labelledby");if(i){const p=i.split(/\s+/).map(h=>{var m,g,k;return(k=(g=(m=document.getElementById(h))==null?void 0:m.textContent)==null?void 0:g.trim())!=null?k:""}).filter(Boolean).join(" ");if(p)return eo(p,t)}return""}function Xl(e,t=6){const n=[],r=new Set;let o=e;for(;o&&o!==document.body&&n.length<t;){const i=o===e?"":Vl(o),a=i&&!r.has(i)?`${Qr(o)} ["${i}"]`:Qr(o);i&&r.add(i),n.unshift(a),o=o.parentElement}return n.join(" > ")||Qr(e)}function Ci(e,t){return e.length>t?e.slice(0,t)+"… (truncated)":e}function br(e){var r;const t=document.querySelector(e);return((r=t==null?void 0:t.content)==null?void 0:r.trim())||void 0}function Pi(){const e=t=>{try{return t()}catch(n){return}};return{description:e(()=>br('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(()=>br('meta[property="og:title"]')),ogDescription:e(()=>br('meta[property="og:description"]')),ogType:e(()=>br('meta[property="og:type"]')),ogSiteName:e(()=>br('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?Ci(t,1e3):void 0}),capturedAt:new Date().toISOString()}}function Kl(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 Ql(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}: ${Ci(a,120)}`:d}return{elementRole:t,elementAriaLabel:n,enclosingSection:r}}function eu(e,t){const n=[e.trim(),"",`Page: ${t.pageTitle} (${t.pageUrl})`];return t.description&&n.push(`Description: ${t.description}`),t.selectionText&&n.push(`Selection: ${t.selectionText}`),t.elementText&&n.push(`Selected element: ${t.elementText}`),t.elementRole&&n.push(` Role: ${t.elementRole}`),t.elementAriaLabel&&n.push(` ARIA label: ${t.elementAriaLabel}`),t.enclosingSection&&n.push(`Section: ${t.enclosingSection}`),t.ancestry&&n.push(`Ancestry: ${t.ancestry}`),t.cssSelector&&n.push(`Selector: ${t.cssSelector}`),n.join(`
|
|
1473
|
+
`)}const Zn=new Set;let qn=null,to=!1,ls=!1;function tu(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function nu(){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(!(Zn.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&tu(r))return!0}return!1}function Ri(){const e=nu(),t=e&&!ls;ls=e;for(const n of Zn){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 Li(e){if(!(e instanceof Node))return!1;for(const t of Zn)if(t===e||t.contains(e))return!0;return!1}function Hn(e){(Li(e.target)||"relatedTarget"in e&&Li(e.relatedTarget))&&e.stopPropagation()}function ru(){to||(window.addEventListener("focusin",Hn,!0),window.addEventListener("focusout",Hn,!0),window.addEventListener("pointerdown",Hn,!0),to=!0),!qn&&(qn=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")&&Ri()}),qn.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function jt(e){"showPopover"in e&&(e.setAttribute("popover","manual"),Zn.add(e),ru(),Ri())}function Ut(e){if(Zn.delete(e),Zn.size===0&&(qn&&(qn.disconnect(),qn=null),to&&(window.removeEventListener("focusin",Hn,!0),window.removeEventListener("focusout",Hn,!0),window.removeEventListener("pointerdown",Hn,!0),to=!1),ls=!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),jt(t),{el:t,update:i=>{const a=i.getBoundingClientRect();t.style.top=`${a.top}px`,t.style.left=`${a.left}px`,t.style.width=`${a.width}px`,t.style.height=`${a.height}px`,t.style.display="block"},hide:()=>{t.style.display="none"},destroy:()=>{Ut(t),t.remove()}}}const Ii=/^cc-|current-password|new-password/i,ou=/token|secret|password|apikey|auth/i,ds="[redacted]";function su(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&Ii.test(t)}function zi(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",ds);const r=n.getAttribute("autocomplete");r&&Ii.test(r)&&n.setAttribute("value",ds);for(const o of Array.from(n.attributes))ou.test(o.name)&&n.setAttribute(o.name,ds)}}const iu="🎯 Click any element to capture";let nn=null,ze=null,qe=null;function kr(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 au(){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){nn==null||nn.update(e)}function Oi(e){const t=Pi(),n=Kl(e),r=Ql(e);let o;try{const i=e.cloneNode(!0);zi(i),o=i.outerHTML.slice(0,4e3)}catch(i){}return y(y({pageUrl:window.location.href,pageTitle:document.title,elementText:Kr(e),cssSelector:Xr(e),innerTree:Gl(e),outerTree:Xl(e),elementOuterHtml:o,ancestry:n},r),t)}function ps(e,t){qe&&qe();const n=au();nn=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":iu,document.body.appendChild(ze),jt(ze);let r=null,o=null;const i=h=>{qe==null||qe(),e(Oi(h),h)},a=h=>{if(o=h,$i(h),!ze)return;ze.classList.add("ap-sdk-picker-cursor--confirm"),ze.innerHTML="";const m=document.createElement("span");m.className="ap-sdk-picker-cursor__label",m.textContent=`<${h.tagName.toLowerCase()}>`;const g=document.createElement("button");g.type="button",g.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--cancel",g.textContent="✕ Cancel",g.setAttribute("data-ap-sdk","1"),g.setAttribute("aria-label","Cancel picking"),g.addEventListener("click",T=>{T.preventDefault(),T.stopPropagation(),qe==null||qe(),t()});const k=document.createElement("button");k.type="button",k.className="ap-sdk-picker-cursor__btn",k.textContent="⬆ Parent",k.setAttribute("data-ap-sdk","1"),k.addEventListener("click",T=>{T.preventDefault(),T.stopPropagation(),o!=null&&o.parentElement&&a(o.parentElement)});const v=document.createElement("button");v.type="button",v.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",v.textContent="✓ Select",v.setAttribute("data-ap-sdk","1"),v.addEventListener("click",T=>{T.preventDefault(),T.stopPropagation(),o&&i(o)}),ze.appendChild(m),ze.appendChild(g),ze.appendChild(k),ze.appendChild(v)},d=h=>{kr(h.target)||(r=h.target,$i(r))},u=h=>{var g;if(kr(h.target))return;h.preventDefault(),h.stopImmediatePropagation();const m=(g=h.target)!=null?g:r;if(m){if(n){a(m);return}i(m)}},p=h=>{h.key==="Escape"&&(qe==null||qe(),t())};n||document.addEventListener("mouseover",d,{capture:!0}),document.addEventListener("click",u,{capture:!0}),document.addEventListener("keydown",p,{capture:!0}),qe=()=>{n||document.removeEventListener("mouseover",d,{capture:!0}),document.removeEventListener("click",u,{capture:!0}),document.removeEventListener("keydown",p,{capture:!0}),ze&&Ut(ze),ze==null||ze.remove(),nn==null||nn.destroy(),nn=null,ze=null,o=null,qe=null}}function hs(){qe==null||qe()}function Fn(){return qe!==null}const no={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(u,p){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:p,constr:a,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,p);const h=a.prototype,m=Object.keys(h);for(let g=0;g<m.length;g++){const k=m[g];k in u||(u[k]=h[k].bind(u))}}const o=(d=n==null?void 0:n.Parent)!=null?d:Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(u){var m;var p;const h=n!=null&&n.Parent?new i:this;r(h,u),(m=(p=h._zod).deferred)!=null||(p.deferred=[]);for(const g of h._zod.deferred)g();return h}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:u=>{var p,h;return n!=null&&n.Parent&&u instanceof n.Parent?!0:(h=(p=u==null?void 0:u._zod)==null?void 0:p.traits)==null?void 0:h.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class Bn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ni extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Di={};function rn(e){return Di}function Mi(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 fs(e,t){return typeof t=="bigint"?t.toString():t}function ro(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function gs(e){return e==null}function ms(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function cu(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const u=r.match(/\d?e-(\d?)/);u!=null&&u[1]&&(o=Number.parseInt(u[1]))}const i=n>o?n:o,a=Number.parseInt(e.toFixed(i).replace(".","")),d=Number.parseInt(t.toFixed(i).replace(".",""));return a%d/ql(10,i)}const ji=Symbol("evaluating");function ne(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ji)return r===void 0&&(r=ji,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function vn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function on(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Ui(e){return JSON.stringify(e)}function lu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Zi="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function _r(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const uu=ro(()=>{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 Gn(e){if(_r(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(_r(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function qi(e){return Gn(e)?y({},e):Array.isArray(e)?[...e]:e}const du=new Set(["string","number","symbol"]);function Wn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function sn(e,t,n){const r=new e._zod.constr(t!=null?t:e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function M(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?D(y({},t),{error:()=>t.error}):t}function pu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const hu={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 fu(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=on(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 vn(this,"shape",a),a},checks:[]});return sn(e,i)}function gu(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=on(e._zod.def,{get shape(){const a=y({},e._zod.def.shape);for(const d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&delete a[d]}return vn(this,"shape",a),a},checks:[]});return sn(e,i)}function mu(e,t){if(!Gn(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=on(e._zod.def,{get shape(){const i=y(y({},e._zod.def.shape),t);return vn(this,"shape",i),i}});return sn(e,o)}function bu(e,t){if(!Gn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=on(e._zod.def,{get shape(){const r=y(y({},e._zod.def.shape),t);return vn(this,"shape",r),r}});return sn(e,n)}function ku(e,t){const n=on(e._zod.def,{get shape(){const r=y(y({},e._zod.def.shape),t._zod.def.shape);return vn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return sn(e,n)}function _u(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=on(t._zod.def,{get shape(){const d=t._zod.def.shape,u=y({},d);if(n)for(const p in n){if(!(p in d))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(u[p]=e?new e({type:"optional",innerType:d[p]}):d[p])}else for(const p in d)u[p]=e?new e({type:"optional",innerType:d[p]}):d[p];return vn(this,"shape",u),u},checks:[]});return sn(t,a)}function vu(e,t,n){const r=on(t._zod.def,{get shape(){const o=t._zod.def.shape,i=y({},o);if(n)for(const a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return vn(this,"shape",i),i}});return sn(t,r)}function Jn(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 Yn(e,t){return t.map(n=>{var o;var r;return(o=(r=n).path)!=null||(r.path=[]),n.path.unshift(e),n})}function oo(e){return typeof e=="string"?e:e==null?void 0:e.message}function an(e,t,n){var o,i,a,d,u,p,h,m,g,k,v;const r=D(y({},e),{path:(o=e.path)!=null?o:[]});if(!e.message){const T=(v=(k=(m=(p=oo((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:oo((u=t==null?void 0:t.error)==null?void 0:u.call(t,e)))!=null?m:oo((h=n.customError)==null?void 0:h.call(n,e)))!=null?k:oo((g=n.localeError)==null?void 0:g.call(n,e)))!=null?v:"Invalid input";r.message=T}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function bs(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function vr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:y({},t)}const Hi=(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,fs,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Fi=w("$ZodError",Hi),Bi=w("$ZodError",Hi,{Parent:Error});function yu(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 wu(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let a=n,d=0;for(;d<i.path.length;){const u=i.path[d];d===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(t(i))):a[u]=a[u]||{_errors:[]},a=a[u],d++}}};return r(e),n}const ks=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 Bn;if(a.issues.length){const u=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>an(p,i,rn())));throw Zi(u,o==null?void 0:o.callee),u}return a.value},_s=e=>(t,n,r,o)=>I(null,null,function*(){var d;const i=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=yield a),a.issues.length){const u=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>an(p,i,rn())));throw Zi(u,o==null?void 0:o.callee),u}return a.value}),so=e=>(t,n,r)=>{const o=r?D(y({},r),{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Bn;return i.issues.length?{success:!1,error:new(e!=null?e:Fi)(i.issues.map(a=>an(a,o,rn())))}:{success:!0,data:i.value}},xu=so(Bi),io=e=>(t,n,r)=>I(null,null,function*(){const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=yield i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>an(a,o,rn())))}:{success:!0,data:i.value}}),Su=io(Bi),Tu=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ks(e)(t,n,o)},Eu=e=>(t,n,r)=>ks(e)(t,n,r),Au=e=>(t,n,r)=>I(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return _s(e)(t,n,o)}),Cu=e=>(t,n,r)=>I(null,null,function*(){return _s(e)(t,n,r)}),Pu=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return so(e)(t,n,o)},Ru=e=>(t,n,r)=>so(e)(t,n,r),Lu=e=>(t,n,r)=>I(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return io(e)(t,n,o)}),Iu=e=>(t,n,r)=>I(null,null,function*(){return io(e)(t,n,r)}),zu=/^[cC][^\s-]{8,}$/,$u=/^[0-9a-z]+$/,Ou=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Nu=/^[0-9a-vA-V]{20}$/,Du=/^[A-Za-z0-9]{27}$/,Mu=/^[a-zA-Z0-9_-]{21}$/,ju=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Uu=/^([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})$/,Gi=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)$/,Zu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,qu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Hu(){return new RegExp(qu,"u")}const Fu=/^(?:(?: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])$/,Bu=/^(([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}|:))$/,Gu=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Wu=/^(([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])$/,Ju=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Wi=/^[A-Za-z0-9_-]*$/,Yu=/^\+[1-9]\d{6,14}$/,Ji="(?:(?:\\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])))",Vu=new RegExp(`^${Ji}$`);function Yi(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 Xu(e){return new RegExp(`^${Yi(e)}$`)}function Ku(e){const t=Yi({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(`^${Ji}T(?:${r})$`)}const Qu=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}$`)},ed=/^-?\d+$/,Vi=/^-?\d+(?:\.\d+)?$/,td=/^(?:true|false)$/i,nd=/^[^A-Z]*$/,rd=/^[^a-z]*$/,nt=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=[])}),Xi={number:"number",bigint:"bigint",object:"date"},Ki=w("$ZodCheckLessThan",(e,t)=>{nt.init(e,t);const n=Xi[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})}}),Qi=w("$ZodCheckGreaterThan",(e,t)=>{nt.init(e,t);const n=Xi[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})}}),od=w("$ZodCheckMultipleOf",(e,t)=>{nt.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):cu(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})}}),sd=w("$ZodCheckNumberFormat",(e,t)=>{var a;nt.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]=hu[t.format];e._zod.onattach.push(d=>{const u=d._zod.bag;u.format=t.format,u.minimum=o,u.maximum=i,n&&(u.pattern=ed)}),e._zod.check=d=>{const u=d.value;if(n){if(!Number.isInteger(u)){d.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?d.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):d.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}u<o&&d.issues.push({origin:"number",input:u,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),u>i&&d.issues.push({origin:"number",input:u,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),id=w("$ZodCheckMaxLength",(e,t)=>{var r;var n;nt.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!gs(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=bs(i);o.issues.push({origin:d,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),ad=w("$ZodCheckMinLength",(e,t)=>{var r;var n;nt.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!gs(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=bs(i);o.issues.push({origin:d,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),cd=w("$ZodCheckLengthEquals",(e,t)=>{var r;var n;nt.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!gs(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=bs(i),u=a>t.length;o.issues.push(D(y({origin:d},u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length}),{inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort}))}}),ao=w("$ZodCheckStringFormat",(e,t)=>{var o,i;var n,r;nt.init(e,t),e._zod.onattach.push(a=>{var u;const d=a._zod.bag;d.format=t.format,t.pattern&&((u=d.patterns)!=null||(d.patterns=new Set),d.patterns.add(t.pattern))}),t.pattern?(o=(n=e._zod).check)!=null||(n.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push(D(y({origin:"string",code:"invalid_format",format:t.format,input:a.value},t.pattern?{pattern:t.pattern.toString()}:{}),{inst:e,continue:!t.abort}))}):(i=(r=e._zod).check)!=null||(r.check=()=>{})}),ld=w("$ZodCheckRegex",(e,t)=>{ao.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})}}),ud=w("$ZodCheckLowerCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=nd),ao.init(e,t)}),dd=w("$ZodCheckUpperCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=rd),ao.init(e,t)}),pd=w("$ZodCheckIncludes",(e,t)=>{nt.init(e,t);const n=Wn(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})}}),hd=w("$ZodCheckStartsWith",(e,t)=>{var r;nt.init(e,t);const n=new RegExp(`^${Wn(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})}}),fd=w("$ZodCheckEndsWith",(e,t)=>{var r;nt.init(e,t);const n=new RegExp(`.*${Wn(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})}}),gd=w("$ZodCheckOverwrite",(e,t)=>{nt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class md{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(`
|
|
1439
1474
|
`).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(`
|
|
1440
|
-
`))}}const gd={major:4,minor:3,patch:5},me=w("$ZodType",(e,t)=>{var o,i,a;var n;e!=null||(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=gd;const r=[...(o=e._zod.def.checks)!=null?o:[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const d of r)for(const u of d._zod.onattach)u(e);if(r.length===0)(i=(n=e._zod).deferred)!=null||(n.deferred=[]),(a=e._zod.deferred)==null||a.push(()=>{e._zod.run=e._zod.parse});else{const d=(p,h,m)=>{let g=Wn(p),k;for(const v of h){if(v._zod.def.when){if(!v._zod.def.when(p))continue}else if(g)continue;const T=p.issues.length,Z=v._zod.check(p);if(Z instanceof Promise&&(m==null?void 0:m.async)===!1)throw new Fn;if(k||Z instanceof Promise)k=(k!=null?k:Promise.resolve()).then(()=>L(null,null,function*(){yield Z,p.issues.length!==T&&(g||(g=Wn(p,T)))}));else{if(p.issues.length===T)continue;g||(g=Wn(p,T))}}return k?k.then(()=>p):p},u=(p,h,m)=>{if(Wn(p))return p.aborted=!0,p;const g=d(h,r,m);if(g instanceof Promise){if(m.async===!1)throw new Fn;return g.then(k=>e._zod.parse(k,m))}return e._zod.parse(g,m)};e._zod.run=(p,h)=>{if(h.skipChecks)return e._zod.parse(p,h);if(h.direction==="backward"){const g=e._zod.parse({value:p.value,issues:[]},D(y({},h),{skipChecks:!0}));return g instanceof Promise?g.then(k=>u(k,p,h)):u(g,p,h)}const m=e._zod.parse(p,h);if(m instanceof Promise){if(h.async===!1)throw new Fn;return m.then(g=>d(g,r,h))}return d(m,r,h)}}ne(e,"~standard",()=>({validate:d=>{var u;try{const p=yu(e,d);return p.success?{value:p.data}:{issues:(u=p.error)==null?void 0:u.issues}}catch(p){return wu(e,d).then(h=>{var m;return h.success?{value:h.data}:{issues:(m=h.error)==null?void 0:m.issues}})}},vendor:"zod",version:1}))}),ks=w("$ZodString",(e,t)=>{var n,r,o;me.init(e,t),e._zod.pattern=(o=[...(r=(n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)!=null?r:[]].pop())!=null?o:Xu(e._zod.bag),e._zod.parse=(i,a)=>{if(t.coerce)try{i.value=String(i.value)}catch(d){}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),be=w("$ZodStringFormat",(e,t)=>{io.init(e,t),ks.init(e,t)}),md=w("$ZodGUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Mu),be.init(e,t)}),bd=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=Fi(i))}else(r=t.pattern)!=null||(t.pattern=Fi());be.init(e,t)}),kd=w("$ZodEmail",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Uu),be.init(e,t)}),_d=w("$ZodURL",(e,t)=>{be.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),vd=w("$ZodEmoji",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Zu()),be.init(e,t)}),yd=w("$ZodNanoID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Nu),be.init(e,t)}),wd=w("$ZodCUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Lu),be.init(e,t)}),xd=w("$ZodCUID2",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Iu),be.init(e,t)}),Sd=w("$ZodULID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=zu),be.init(e,t)}),Td=w("$ZodXID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=$u),be.init(e,t)}),Ed=w("$ZodKSUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ou),be.init(e,t)}),Ad=w("$ZodISODateTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Vu(t)),be.init(e,t)}),Cd=w("$ZodISODate",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ju),be.init(e,t)}),Pd=w("$ZodISOTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Yu(t)),be.init(e,t)}),Rd=w("$ZodISODuration",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Du),be.init(e,t)}),Ld=w("$ZodIPv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=qu),be.init(e,t),e._zod.bag.format="ipv4"}),Id=w("$ZodIPv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Hu),be.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch(o){r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),zd=w("$ZodCIDRv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Fu),be.init(e,t)}),$d=w("$ZodCIDRv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Bu),be.init(e,t),e._zod.check=r=>{const o=r.value.split("/");try{if(o.length!==2)throw new Error;const[i,a]=o;if(!a)throw new Error;const d=Number(a);if(`${d}`!==a)throw new Error;if(d<0||d>128)throw new Error;new URL(`http://[${i}]`)}catch(i){r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Ki(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch(t){return!1}}const Od=w("$ZodBase64",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Gu),be.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Ki(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Nd(e){if(!Bi.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ki(n)}const Dd=w("$ZodBase64URL",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Bi),be.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Nd(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Md=w("$ZodE164",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Wu),be.init(e,t)});function Ud(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 jd=w("$ZodJWT",(e,t)=>{be.init(e,t),e._zod.check=n=>{Ud(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Qi=w("$ZodNumber",(e,t)=>{var n;me.init(e,t),e._zod.pattern=(n=e._zod.bag.pattern)!=null?n:Ji,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(d){}const i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;const a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push(y({expected:"number",code:"invalid_type",input:i,inst:e},a?{received:a}:{})),r}}),Zd=w("$ZodNumberFormat",(e,t)=>{rd.init(e,t),Qi.init(e,t)}),qd=w("$ZodBoolean",(e,t)=>{me.init(e,t),e._zod.pattern=Qu,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}}),Hd=w("$ZodAny",(e,t)=>{me.init(e,t),e._zod.parse=n=>n}),Fd=w("$ZodUnknown",(e,t)=>{me.init(e,t),e._zod.parse=n=>n}),Bd=w("$ZodNever",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function ea(e,t,n){e.issues.length&&t.issues.push(...Jn(n,e.issues)),t.value[n]=e.value}const Gd=w("$ZodArray",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const d=o[a],u=t.element._zod.run({value:d,issues:[]},r);u instanceof Promise?i.push(u.then(p=>ea(p,n,a))):ea(u,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function ao(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Jn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function ta(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=uu(e.shape);return D(y({},e),{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)})}function na(e,t,n,r,o,i){const a=[],d=o.keySet,u=o.catchall._zod,p=u.def.type,h=u.optout==="optional";for(const m in t){if(d.has(m))continue;if(p==="never"){a.push(m);continue}const g=u.run({value:t[m],issues:[]},r);g instanceof Promise?e.push(g.then(k=>ao(k,n,m,t,h))):ao(g,n,m,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 Wd=w("$ZodObject",(e,t)=>{me.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const d=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u=y({},d);return Object.defineProperty(t,"shape",{value:u}),u}})}const r=no(()=>ta(t));ne(e._zod,"propValues",()=>{var p;const d=t.shape,u={};for(const h in d){const m=d[h]._zod;if(m.values){(p=u[h])!=null||(u[h]=new Set);for(const g of m.values)u[h].add(g)}}return u});const o=kr,i=t.catchall;let a;e._zod.parse=(d,u)=>{a!=null||(a=r.value);const p=d.value;if(!o(p))return d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d;d.value={};const h=[],m=a.shape;for(const g of a.keys){const k=m[g],v=k._zod.optout==="optional",T=k._zod.run({value:p[g],issues:[]},u);T instanceof Promise?h.push(T.then(Z=>ao(Z,d,g,p,v))):ao(T,d,g,p,v)}return i?na(h,p,d,u,r.value,e):h.length?Promise.all(h).then(()=>d):d}}),Jd=w("$ZodObjectJIT",(e,t)=>{Wd.init(e,t);const n=e._zod.parse,r=no(()=>ta(t)),o=g=>{var E;const k=new fd(["shape","payload","ctx"]),v=r.value,T=S=>{const P=Mi(S);return`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`};k.write("const input = payload.value;");const Z=Object.create(null);let Q=0;for(const S of v.keys)Z[S]=`key_${Q++}`;k.write("const newResult = {};");for(const S of v.keys){const P=Z[S],q=Mi(S),Y=g[S],xe=((E=Y==null?void 0:Y._zod)==null?void 0:E.optout)==="optional";k.write(`const ${P} = ${T(S)};`),xe?k.write(`
|
|
1475
|
+
`))}}const bd={major:4,minor:3,patch:5},me=w("$ZodType",(e,t)=>{var o,i,a;var n;e!=null||(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=bd;const r=[...(o=e._zod.def.checks)!=null?o:[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const d of r)for(const u of d._zod.onattach)u(e);if(r.length===0)(i=(n=e._zod).deferred)!=null||(n.deferred=[]),(a=e._zod.deferred)==null||a.push(()=>{e._zod.run=e._zod.parse});else{const d=(p,h,m)=>{let g=Jn(p),k;for(const v of h){if(v._zod.def.when){if(!v._zod.def.when(p))continue}else if(g)continue;const T=p.issues.length,Z=v._zod.check(p);if(Z instanceof Promise&&(m==null?void 0:m.async)===!1)throw new Bn;if(k||Z instanceof Promise)k=(k!=null?k:Promise.resolve()).then(()=>I(null,null,function*(){yield Z,p.issues.length!==T&&(g||(g=Jn(p,T)))}));else{if(p.issues.length===T)continue;g||(g=Jn(p,T))}}return k?k.then(()=>p):p},u=(p,h,m)=>{if(Jn(p))return p.aborted=!0,p;const g=d(h,r,m);if(g instanceof Promise){if(m.async===!1)throw new Bn;return g.then(k=>e._zod.parse(k,m))}return e._zod.parse(g,m)};e._zod.run=(p,h)=>{if(h.skipChecks)return e._zod.parse(p,h);if(h.direction==="backward"){const g=e._zod.parse({value:p.value,issues:[]},D(y({},h),{skipChecks:!0}));return g instanceof Promise?g.then(k=>u(k,p,h)):u(g,p,h)}const m=e._zod.parse(p,h);if(m instanceof Promise){if(h.async===!1)throw new Bn;return m.then(g=>d(g,r,h))}return d(m,r,h)}}ne(e,"~standard",()=>({validate:d=>{var u;try{const p=xu(e,d);return p.success?{value:p.data}:{issues:(u=p.error)==null?void 0:u.issues}}catch(p){return Su(e,d).then(h=>{var m;return h.success?{value:h.data}:{issues:(m=h.error)==null?void 0:m.issues}})}},vendor:"zod",version:1}))}),vs=w("$ZodString",(e,t)=>{var n,r,o;me.init(e,t),e._zod.pattern=(o=[...(r=(n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)!=null?r:[]].pop())!=null?o:Qu(e._zod.bag),e._zod.parse=(i,a)=>{if(t.coerce)try{i.value=String(i.value)}catch(d){}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),be=w("$ZodStringFormat",(e,t)=>{ao.init(e,t),vs.init(e,t)}),kd=w("$ZodGUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Uu),be.init(e,t)}),_d=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=Gi(i))}else(r=t.pattern)!=null||(t.pattern=Gi());be.init(e,t)}),vd=w("$ZodEmail",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Zu),be.init(e,t)}),yd=w("$ZodURL",(e,t)=>{be.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),wd=w("$ZodEmoji",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Hu()),be.init(e,t)}),xd=w("$ZodNanoID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Mu),be.init(e,t)}),Sd=w("$ZodCUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=zu),be.init(e,t)}),Td=w("$ZodCUID2",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=$u),be.init(e,t)}),Ed=w("$ZodULID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ou),be.init(e,t)}),Ad=w("$ZodXID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Nu),be.init(e,t)}),Cd=w("$ZodKSUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Du),be.init(e,t)}),Pd=w("$ZodISODateTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ku(t)),be.init(e,t)}),Rd=w("$ZodISODate",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Vu),be.init(e,t)}),Ld=w("$ZodISOTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Xu(t)),be.init(e,t)}),Id=w("$ZodISODuration",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ju),be.init(e,t)}),zd=w("$ZodIPv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Fu),be.init(e,t),e._zod.bag.format="ipv4"}),$d=w("$ZodIPv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Bu),be.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch(o){r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Od=w("$ZodCIDRv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Gu),be.init(e,t)}),Nd=w("$ZodCIDRv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Wu),be.init(e,t),e._zod.check=r=>{const o=r.value.split("/");try{if(o.length!==2)throw new Error;const[i,a]=o;if(!a)throw new Error;const d=Number(a);if(`${d}`!==a)throw new Error;if(d<0||d>128)throw new Error;new URL(`http://[${i}]`)}catch(i){r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function ea(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch(t){return!1}}const Dd=w("$ZodBase64",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ju),be.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{ea(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Md(e){if(!Wi.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return ea(n)}const jd=w("$ZodBase64URL",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Wi),be.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Md(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Ud=w("$ZodE164",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Yu),be.init(e,t)});function Zd(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 qd=w("$ZodJWT",(e,t)=>{be.init(e,t),e._zod.check=n=>{Zd(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),ta=w("$ZodNumber",(e,t)=>{var n;me.init(e,t),e._zod.pattern=(n=e._zod.bag.pattern)!=null?n:Vi,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(d){}const i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;const a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push(y({expected:"number",code:"invalid_type",input:i,inst:e},a?{received:a}:{})),r}}),Hd=w("$ZodNumberFormat",(e,t)=>{sd.init(e,t),ta.init(e,t)}),Fd=w("$ZodBoolean",(e,t)=>{me.init(e,t),e._zod.pattern=td,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}}),Bd=w("$ZodAny",(e,t)=>{me.init(e,t),e._zod.parse=n=>n}),Gd=w("$ZodUnknown",(e,t)=>{me.init(e,t),e._zod.parse=n=>n}),Wd=w("$ZodNever",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function na(e,t,n){e.issues.length&&t.issues.push(...Yn(n,e.issues)),t.value[n]=e.value}const Jd=w("$ZodArray",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const d=o[a],u=t.element._zod.run({value:d,issues:[]},r);u instanceof Promise?i.push(u.then(p=>na(p,n,a))):na(u,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function co(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Yn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function ra(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=pu(e.shape);return D(y({},e),{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)})}function oa(e,t,n,r,o,i){const a=[],d=o.keySet,u=o.catchall._zod,p=u.def.type,h=u.optout==="optional";for(const m in t){if(d.has(m))continue;if(p==="never"){a.push(m);continue}const g=u.run({value:t[m],issues:[]},r);g instanceof Promise?e.push(g.then(k=>co(k,n,m,t,h))):co(g,n,m,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 Yd=w("$ZodObject",(e,t)=>{me.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const d=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u=y({},d);return Object.defineProperty(t,"shape",{value:u}),u}})}const r=ro(()=>ra(t));ne(e._zod,"propValues",()=>{var p;const d=t.shape,u={};for(const h in d){const m=d[h]._zod;if(m.values){(p=u[h])!=null||(u[h]=new Set);for(const g of m.values)u[h].add(g)}}return u});const o=_r,i=t.catchall;let a;e._zod.parse=(d,u)=>{a!=null||(a=r.value);const p=d.value;if(!o(p))return d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d;d.value={};const h=[],m=a.shape;for(const g of a.keys){const k=m[g],v=k._zod.optout==="optional",T=k._zod.run({value:p[g],issues:[]},u);T instanceof Promise?h.push(T.then(Z=>co(Z,d,g,p,v))):co(T,d,g,p,v)}return i?oa(h,p,d,u,r.value,e):h.length?Promise.all(h).then(()=>d):d}}),Vd=w("$ZodObjectJIT",(e,t)=>{Yd.init(e,t);const n=e._zod.parse,r=ro(()=>ra(t)),o=g=>{var E;const k=new md(["shape","payload","ctx"]),v=r.value,T=S=>{const P=Ui(S);return`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`};k.write("const input = payload.value;");const Z=Object.create(null);let Q=0;for(const S of v.keys)Z[S]=`key_${Q++}`;k.write("const newResult = {};");for(const S of v.keys){const P=Z[S],q=Ui(S),Y=g[S],xe=((E=Y==null?void 0:Y._zod)==null?void 0:E.optout)==="optional";k.write(`const ${P} = ${T(S)};`),xe?k.write(`
|
|
1441
1476
|
if (${P}.issues.length) {
|
|
1442
1477
|
if (${q} in input) {
|
|
1443
1478
|
payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
|
|
@@ -1471,23 +1506,23 @@ button.ap-sdk-list-item__link {
|
|
|
1471
1506
|
newResult[${q}] = ${P}.value;
|
|
1472
1507
|
}
|
|
1473
1508
|
|
|
1474
|
-
`)}k.write("payload.value = newResult;"),k.write("return payload;");const U=k.compile();return(S,P)=>U(g,S,P)};let i;const a=kr,d=!Oi.jitless,p=d&&cu.value,h=t.catchall;let m;e._zod.parse=(g,k)=>{m!=null||(m=r.value);const v=g.value;return a(v)?d&&p&&(k==null?void 0:k.async)===!1&&k.jitless!==!0?(i||(i=o(t.shape)),g=i(g,k),h?na([],v,g,k,m,e):g):n(g,k):(g.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),g)}});function ra(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=>!Wn(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=>sn(a,r,nn())))}),t)}const oa=w("$ZodUnion",(e,t)=>{me.init(e,t),ne(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),ne(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),ne(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),ne(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>fs(i.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let a=!1;const d=[];for(const u of t.options){const p=u._zod.run({value:o.value,issues:[]},i);if(p instanceof Promise)d.push(p),a=!0;else{if(p.issues.length===0)return p;d.push(p)}}return a?Promise.all(d).then(u=>ra(u,o,e,i)):ra(d,o,e,i)}}),Yd=w("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,oa.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,u]of Object.entries(a)){o[d]||(o[d]=new Set);for(const p of u)o[d].add(p)}}return o});const r=no(()=>{var a;const o=t.options,i=new Map;for(const d of o){const u=(a=d._zod.propValues)==null?void 0:a[t.discriminator];if(!u||u.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(d)}"`);for(const p of u){if(i.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);i.set(p,d)}}return i});e._zod.parse=(o,i)=>{const a=o.value;if(!kr(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)}}),Vd=w("$ZodIntersection",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([u,p])=>sa(n,u,p)):sa(n,i,a)}});function _s(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(Bn(e)&&Bn(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o=y(y({},e),t);for(const i of r){const a=_s(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=_s(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 sa(e,t,n){const r=new Map;let o;for(const d of t.issues)if(d.code==="unrecognized_keys"){o!=null||(o=d);for(const u of d.keys)r.has(u)||r.set(u,{}),r.get(u).l=!0}else e.issues.push(d);for(const d of n.issues)if(d.code==="unrecognized_keys")for(const u of d.keys)r.has(u)||r.set(u,{}),r.get(u).r=!0;else e.issues.push(d);const i=[...r].filter(([,d])=>d.l&&d.r).map(([d])=>d);if(i.length&&o&&e.issues.push(D(y({},o),{keys:i})),Wn(e))return e;const a=_s(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 Xd=w("$ZodRecord",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Bn(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(m=>{m.issues.length&&n.issues.push(...Jn(p,m.issues)),n.value[p]=m.value})):(h.issues.length&&n.issues.push(...Jn(p,h.issues)),n.value[p]=h.value)}let u;for(const p in o)d.has(p)||(u=u!=null?u:[],u.push(p));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:u})}else{n.value={};for(const d of Reflect.ownKeys(o)){if(d==="__proto__")continue;let u=t.keyType._zod.run({value:d,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof d=="string"&&Ji.test(d)&&u.issues.length&&u.issues.some(m=>m.code==="invalid_type"&&m.expected==="number")){const m=t.keyType._zod.run({value:Number(d),issues:[]},r);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(u=m)}if(u.issues.length){t.mode==="loose"?n.value[d]=o[d]:n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(m=>sn(m,r,nn())),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(m=>{m.issues.length&&n.issues.push(...Jn(d,m.issues)),n.value[u.value]=m.value})):(h.issues.length&&n.issues.push(...Jn(d,h.issues)),n.value[u.value]=h.value)}}return i.length?Promise.all(i).then(()=>n):n}}),Kd=w("$ZodEnum",(e,t)=>{me.init(e,t);const n=Ni(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>lu.has(typeof o)).map(o=>typeof o=="string"?Gn(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}}),Qd=w("$ZodLiteral",(e,t)=>{if(me.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Gn(r):r?Gn(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}}),ep=w("$ZodTransform",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new $i(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 Fn;return n.value=o,n}});function ia(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const aa=w("$ZodOptional",(e,t)=>{me.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ne(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ne(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${fs(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>ia(i,n.value)):ia(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),tp=w("$ZodExactOptional",(e,t)=>{aa.init(e,t),ne(e._zod,"values",()=>t.innerType._zod.values),ne(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),np=w("$ZodNullable",(e,t)=>{me.init(e,t),ne(e._zod,"optin",()=>t.innerType._zod.optin),ne(e._zod,"optout",()=>t.innerType._zod.optout),ne(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${fs(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)}),rp=w("$ZodDefault",(e,t)=>{me.init(e,t),e._zod.optin="optional",ne(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>ca(i,t)):ca(o,t)}});function ca(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const op=w("$ZodPrefault",(e,t)=>{me.init(e,t),e._zod.optin="optional",ne(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),sp=w("$ZodNonOptional",(e,t)=>{me.init(e,t),ne(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>la(i,e)):la(o,e)}});function la(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 ip=w("$ZodCatch",(e,t)=>{me.init(e,t),ne(e._zod,"optin",()=>t.innerType._zod.optin),ne(e._zod,"optout",()=>t.innerType._zod.optout),ne(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue(D(y({},n),{error:{issues:i.issues.map(a=>sn(a,r,nn()))},input:n.value})),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue(D(y({},n),{error:{issues:o.issues.map(i=>sn(i,r,nn()))},input:n.value})),n.issues=[]),n)}}),ap=w("$ZodPipe",(e,t)=>{me.init(e,t),ne(e._zod,"values",()=>t.in._zod.values),ne(e._zod,"optin",()=>t.in._zod.optin),ne(e._zod,"optout",()=>t.out._zod.optout),ne(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(a=>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 cp=w("$ZodReadonly",(e,t)=>{me.init(e,t),ne(e._zod,"propValues",()=>t.innerType._zod.propValues),ne(e._zod,"values",()=>t.innerType._zod.values),ne(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),ne(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(ua):ua(o)}});function ua(e){return e.value=Object.freeze(e.value),e}const lp=w("$ZodCustom",(e,t)=>{nt.init(e,t),me.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>da(i,n,r,e));da(o,n,r,e)}});function da(e,t,n,r){var o;if(!e){const i={code:"custom",input:n,inst:r,path:[...(o=r._zod.def.path)!=null?o:[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(_r(i))}}var pa;class up{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){var r;const n=t._zod.parent;if(n){const o=y({},(r=this.get(n))!=null?r:{});delete o.id;const i=y(y({},o),this._map.get(t));return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function dp(){return new up}(wl=(pa=globalThis).__zod_globalRegistry)!=null||(pa.__zod_globalRegistry=dp());const vr=globalThis.__zod_globalRegistry;function pp(e,t){return new e(y({type:"string"},M(t)))}function hp(e,t){return new e(y({type:"string",format:"email",check:"string_format",abort:!1},M(t)))}function ha(e,t){return new e(y({type:"string",format:"guid",check:"string_format",abort:!1},M(t)))}function fp(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1},M(t)))}function gp(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4"},M(t)))}function mp(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6"},M(t)))}function bp(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7"},M(t)))}function kp(e,t){return new e(y({type:"string",format:"url",check:"string_format",abort:!1},M(t)))}function _p(e,t){return new e(y({type:"string",format:"emoji",check:"string_format",abort:!1},M(t)))}function vp(e,t){return new e(y({type:"string",format:"nanoid",check:"string_format",abort:!1},M(t)))}function yp(e,t){return new e(y({type:"string",format:"cuid",check:"string_format",abort:!1},M(t)))}function wp(e,t){return new e(y({type:"string",format:"cuid2",check:"string_format",abort:!1},M(t)))}function xp(e,t){return new e(y({type:"string",format:"ulid",check:"string_format",abort:!1},M(t)))}function Sp(e,t){return new e(y({type:"string",format:"xid",check:"string_format",abort:!1},M(t)))}function Tp(e,t){return new e(y({type:"string",format:"ksuid",check:"string_format",abort:!1},M(t)))}function Ep(e,t){return new e(y({type:"string",format:"ipv4",check:"string_format",abort:!1},M(t)))}function Ap(e,t){return new e(y({type:"string",format:"ipv6",check:"string_format",abort:!1},M(t)))}function Cp(e,t){return new e(y({type:"string",format:"cidrv4",check:"string_format",abort:!1},M(t)))}function Pp(e,t){return new e(y({type:"string",format:"cidrv6",check:"string_format",abort:!1},M(t)))}function Rp(e,t){return new e(y({type:"string",format:"base64",check:"string_format",abort:!1},M(t)))}function Lp(e,t){return new e(y({type:"string",format:"base64url",check:"string_format",abort:!1},M(t)))}function Ip(e,t){return new e(y({type:"string",format:"e164",check:"string_format",abort:!1},M(t)))}function zp(e,t){return new e(y({type:"string",format:"jwt",check:"string_format",abort:!1},M(t)))}function $p(e,t){return new e(y({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null},M(t)))}function Op(e,t){return new e(y({type:"string",format:"date",check:"string_format"},M(t)))}function Np(e,t){return new e(y({type:"string",format:"time",check:"string_format",precision:null},M(t)))}function Dp(e,t){return new e(y({type:"string",format:"duration",check:"string_format"},M(t)))}function Mp(e,t){return new e(y({type:"number",checks:[]},M(t)))}function Up(e,t){return new e(y({type:"number",check:"number_format",abort:!1,format:"safeint"},M(t)))}function jp(e,t){return new e(y({type:"boolean"},M(t)))}function Zp(e){return new e({type:"any"})}function qp(e){return new e({type:"unknown"})}function Hp(e,t){return new e(y({type:"never"},M(t)))}function fa(e,t){return new Vi(D(y({check:"less_than"},M(t)),{value:e,inclusive:!1}))}function vs(e,t){return new Vi(D(y({check:"less_than"},M(t)),{value:e,inclusive:!0}))}function ga(e,t){return new Xi(D(y({check:"greater_than"},M(t)),{value:e,inclusive:!1}))}function ys(e,t){return new Xi(D(y({check:"greater_than"},M(t)),{value:e,inclusive:!0}))}function ma(e,t){return new nd(D(y({check:"multiple_of"},M(t)),{value:e}))}function ba(e,t){return new od(D(y({check:"max_length"},M(t)),{maximum:e}))}function lo(e,t){return new sd(D(y({check:"min_length"},M(t)),{minimum:e}))}function ka(e,t){return new id(D(y({check:"length_equals"},M(t)),{length:e}))}function Fp(e,t){return new ad(D(y({check:"string_format",format:"regex"},M(t)),{pattern:e}))}function Bp(e){return new cd(y({check:"string_format",format:"lowercase"},M(e)))}function Gp(e){return new ld(y({check:"string_format",format:"uppercase"},M(e)))}function Wp(e,t){return new ud(D(y({check:"string_format",format:"includes"},M(t)),{includes:e}))}function Jp(e,t){return new dd(D(y({check:"string_format",format:"starts_with"},M(t)),{prefix:e}))}function Yp(e,t){return new pd(D(y({check:"string_format",format:"ends_with"},M(t)),{suffix:e}))}function Yn(e){return new hd({check:"overwrite",tx:e})}function Vp(e){return Yn(t=>t.normalize(e))}function Xp(){return Yn(e=>e.trim())}function Kp(){return Yn(e=>e.toLowerCase())}function Qp(){return Yn(e=>e.toUpperCase())}function eh(){return Yn(e=>au(e))}function th(e,t,n){return new e(y({type:"array",element:t},M(n)))}function nh(e,t,n){return new e(y({type:"custom",check:"custom",fn:t},M(n)))}function rh(e){const t=oh(n=>(n.addIssue=r=>{var o,i,a,d;if(typeof r=="string")n.issues.push(_r(r,n.value,t._zod.def));else{const u=r;u.fatal&&(u.continue=!1),(o=u.code)!=null||(u.code="custom"),(i=u.input)!=null||(u.input=n.value),(a=u.inst)!=null||(u.inst=t),(d=u.continue)!=null||(u.continue=!t._zod.def.abort),n.issues.push(_r(u))}},e(n.value,n)));return t}function oh(e,t){const n=new nt(y({check:"custom"},M(t)));return n._zod.check=e,n}function _a(e){var n,r,o,i,a,d,u,p,h;let t=(n=e==null?void 0:e.target)!=null?n:"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:(r=e.processors)!=null?r:{},metadataRegistry:(o=e==null?void 0:e.metadata)!=null?o:vr,target:t,unrepresentable:(i=e==null?void 0:e.unrepresentable)!=null?i:"throw",override:(a=e==null?void 0:e.override)!=null?a:(()=>{}),io:(d=e==null?void 0:e.io)!=null?d:"output",counter:0,seen:new Map,cycles:(u=e==null?void 0:e.cycles)!=null?u:"ref",reused:(p=e==null?void 0:e.reused)!=null?p:"inline",external:(h=e==null?void 0:e.external)!=null?h:void 0}}function Ae(e,t,n={path:[],schemaPath:[]}){var h,m,g;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=(m=(h=e._zod).toJSONSchema)==null?void 0:m.call(h);if(d)a.schema=d;else{const k=D(y({},n),{schemaPath:[...n.schemaPath,e],path:n.path});if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,k);else{const T=a.schema,Z=t.processors[o.type];if(!Z)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);Z(e,t,T,k)}const v=e._zod.parent;v&&(a.ref||(a.ref=v),Ae(v,t,k),t.seen.get(v).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),t.io==="input"&&Je(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((g=(r=a.schema).default)!=null||(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function va(e,t){var a,d,u,p;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const h of e.seen.entries()){const m=(a=e.metadataRegistry.get(h[0]))==null?void 0:a.id;if(m){const g=r.get(m);if(g&&g!==h[0])throw new Error(`Duplicate schema id "${m}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(m,h[0])}}const o=h=>{var T,Z,Q,U,E;const m=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const S=(T=e.external.registry.get(h[0]))==null?void 0:T.id,P=(Z=e.external.uri)!=null?Z:(Y=>Y);if(S)return{ref:P(S)};const q=(U=(Q=h[1].defId)!=null?Q:h[1].schema.id)!=null?U:`schema${e.counter++}`;return h[1].defId=q,{defId:q,ref:`${P("__shared")}#/${m}/${q}`}}if(h[1]===n)return{ref:"#"};const k=`#/${m}/`,v=(E=h[1].schema.id)!=null?E:`__schema${e.counter++}`;return{defId:v,ref:k+v}},i=h=>{if(h[1].schema.$ref)return;const m=h[1],{ref:g,defId:k}=o(h);m.def=y({},m.schema),k&&(m.defId=k);const v=m.schema;for(const T in v)delete v[T];v.$ref=g};if(e.cycles==="throw")for(const h of e.seen.entries()){const m=h[1];if(m.cycle)throw new Error(`Cycle detected: #/${(d=m.cycle)==null?void 0:d.join("/")}/<root>
|
|
1509
|
+
`)}k.write("payload.value = newResult;"),k.write("return payload;");const j=k.compile();return(S,P)=>j(g,S,P)};let i;const a=_r,d=!Di.jitless,p=d&&uu.value,h=t.catchall;let m;e._zod.parse=(g,k)=>{m!=null||(m=r.value);const v=g.value;return a(v)?d&&p&&(k==null?void 0:k.async)===!1&&k.jitless!==!0?(i||(i=o(t.shape)),g=i(g,k),h?oa([],v,g,k,m,e):g):n(g,k):(g.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),g)}});function sa(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=>!Jn(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=>an(a,r,rn())))}),t)}const ia=w("$ZodUnion",(e,t)=>{me.init(e,t),ne(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),ne(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),ne(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),ne(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>ms(i.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let a=!1;const d=[];for(const u of t.options){const p=u._zod.run({value:o.value,issues:[]},i);if(p instanceof Promise)d.push(p),a=!0;else{if(p.issues.length===0)return p;d.push(p)}}return a?Promise.all(d).then(u=>sa(u,o,e,i)):sa(d,o,e,i)}}),Xd=w("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ia.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,u]of Object.entries(a)){o[d]||(o[d]=new Set);for(const p of u)o[d].add(p)}}return o});const r=ro(()=>{var a;const o=t.options,i=new Map;for(const d of o){const u=(a=d._zod.propValues)==null?void 0:a[t.discriminator];if(!u||u.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(d)}"`);for(const p of u){if(i.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);i.set(p,d)}}return i});e._zod.parse=(o,i)=>{const a=o.value;if(!_r(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)}}),Kd=w("$ZodIntersection",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([u,p])=>aa(n,u,p)):aa(n,i,a)}});function ys(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(Gn(e)&&Gn(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o=y(y({},e),t);for(const i of r){const a=ys(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=ys(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 aa(e,t,n){const r=new Map;let o;for(const d of t.issues)if(d.code==="unrecognized_keys"){o!=null||(o=d);for(const u of d.keys)r.has(u)||r.set(u,{}),r.get(u).l=!0}else e.issues.push(d);for(const d of n.issues)if(d.code==="unrecognized_keys")for(const u of d.keys)r.has(u)||r.set(u,{}),r.get(u).r=!0;else e.issues.push(d);const i=[...r].filter(([,d])=>d.l&&d.r).map(([d])=>d);if(i.length&&o&&e.issues.push(D(y({},o),{keys:i})),Jn(e))return e;const a=ys(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 Qd=w("$ZodRecord",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Gn(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(m=>{m.issues.length&&n.issues.push(...Yn(p,m.issues)),n.value[p]=m.value})):(h.issues.length&&n.issues.push(...Yn(p,h.issues)),n.value[p]=h.value)}let u;for(const p in o)d.has(p)||(u=u!=null?u:[],u.push(p));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:u})}else{n.value={};for(const d of Reflect.ownKeys(o)){if(d==="__proto__")continue;let u=t.keyType._zod.run({value:d,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof d=="string"&&Vi.test(d)&&u.issues.length&&u.issues.some(m=>m.code==="invalid_type"&&m.expected==="number")){const m=t.keyType._zod.run({value:Number(d),issues:[]},r);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(u=m)}if(u.issues.length){t.mode==="loose"?n.value[d]=o[d]:n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(m=>an(m,r,rn())),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(m=>{m.issues.length&&n.issues.push(...Yn(d,m.issues)),n.value[u.value]=m.value})):(h.issues.length&&n.issues.push(...Yn(d,h.issues)),n.value[u.value]=h.value)}}return i.length?Promise.all(i).then(()=>n):n}}),ep=w("$ZodEnum",(e,t)=>{me.init(e,t);const n=Mi(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>du.has(typeof o)).map(o=>typeof o=="string"?Wn(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}}),tp=w("$ZodLiteral",(e,t)=>{if(me.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Wn(r):r?Wn(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}}),np=w("$ZodTransform",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Ni(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 Bn;return n.value=o,n}});function ca(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const la=w("$ZodOptional",(e,t)=>{me.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ne(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ne(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ms(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=>ca(i,n.value)):ca(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),rp=w("$ZodExactOptional",(e,t)=>{la.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)}),op=w("$ZodNullable",(e,t)=>{me.init(e,t),ne(e._zod,"optin",()=>t.innerType._zod.optin),ne(e._zod,"optout",()=>t.innerType._zod.optout),ne(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ms(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)}),sp=w("$ZodDefault",(e,t)=>{me.init(e,t),e._zod.optin="optional",ne(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>ua(i,t)):ua(o,t)}});function ua(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ip=w("$ZodPrefault",(e,t)=>{me.init(e,t),e._zod.optin="optional",ne(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),ap=w("$ZodNonOptional",(e,t)=>{me.init(e,t),ne(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>da(i,e)):da(o,e)}});function da(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 cp=w("$ZodCatch",(e,t)=>{me.init(e,t),ne(e._zod,"optin",()=>t.innerType._zod.optin),ne(e._zod,"optout",()=>t.innerType._zod.optout),ne(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue(D(y({},n),{error:{issues:i.issues.map(a=>an(a,r,rn()))},input:n.value})),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue(D(y({},n),{error:{issues:o.issues.map(i=>an(i,r,rn()))},input:n.value})),n.issues=[]),n)}}),lp=w("$ZodPipe",(e,t)=>{me.init(e,t),ne(e._zod,"values",()=>t.in._zod.values),ne(e._zod,"optin",()=>t.in._zod.optin),ne(e._zod,"optout",()=>t.out._zod.optout),ne(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(a=>lo(a,t.in,r)):lo(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>lo(i,t.out,r)):lo(o,t.out,r)}});function lo(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const up=w("$ZodReadonly",(e,t)=>{me.init(e,t),ne(e._zod,"propValues",()=>t.innerType._zod.propValues),ne(e._zod,"values",()=>t.innerType._zod.values),ne(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),ne(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(pa):pa(o)}});function pa(e){return e.value=Object.freeze(e.value),e}const dp=w("$ZodCustom",(e,t)=>{nt.init(e,t),me.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>ha(i,n,r,e));ha(o,n,r,e)}});function ha(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(vr(i))}}var fa;class pp{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){var r;const n=t._zod.parent;if(n){const o=y({},(r=this.get(n))!=null?r:{});delete o.id;const i=y(y({},o),this._map.get(t));return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function hp(){return new pp}(Sl=(fa=globalThis).__zod_globalRegistry)!=null||(fa.__zod_globalRegistry=hp());const yr=globalThis.__zod_globalRegistry;function fp(e,t){return new e(y({type:"string"},M(t)))}function gp(e,t){return new e(y({type:"string",format:"email",check:"string_format",abort:!1},M(t)))}function ga(e,t){return new e(y({type:"string",format:"guid",check:"string_format",abort:!1},M(t)))}function mp(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1},M(t)))}function bp(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4"},M(t)))}function kp(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6"},M(t)))}function _p(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7"},M(t)))}function vp(e,t){return new e(y({type:"string",format:"url",check:"string_format",abort:!1},M(t)))}function yp(e,t){return new e(y({type:"string",format:"emoji",check:"string_format",abort:!1},M(t)))}function wp(e,t){return new e(y({type:"string",format:"nanoid",check:"string_format",abort:!1},M(t)))}function xp(e,t){return new e(y({type:"string",format:"cuid",check:"string_format",abort:!1},M(t)))}function Sp(e,t){return new e(y({type:"string",format:"cuid2",check:"string_format",abort:!1},M(t)))}function Tp(e,t){return new e(y({type:"string",format:"ulid",check:"string_format",abort:!1},M(t)))}function Ep(e,t){return new e(y({type:"string",format:"xid",check:"string_format",abort:!1},M(t)))}function Ap(e,t){return new e(y({type:"string",format:"ksuid",check:"string_format",abort:!1},M(t)))}function Cp(e,t){return new e(y({type:"string",format:"ipv4",check:"string_format",abort:!1},M(t)))}function Pp(e,t){return new e(y({type:"string",format:"ipv6",check:"string_format",abort:!1},M(t)))}function Rp(e,t){return new e(y({type:"string",format:"cidrv4",check:"string_format",abort:!1},M(t)))}function Lp(e,t){return new e(y({type:"string",format:"cidrv6",check:"string_format",abort:!1},M(t)))}function Ip(e,t){return new e(y({type:"string",format:"base64",check:"string_format",abort:!1},M(t)))}function zp(e,t){return new e(y({type:"string",format:"base64url",check:"string_format",abort:!1},M(t)))}function $p(e,t){return new e(y({type:"string",format:"e164",check:"string_format",abort:!1},M(t)))}function Op(e,t){return new e(y({type:"string",format:"jwt",check:"string_format",abort:!1},M(t)))}function Np(e,t){return new e(y({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null},M(t)))}function Dp(e,t){return new e(y({type:"string",format:"date",check:"string_format"},M(t)))}function Mp(e,t){return new e(y({type:"string",format:"time",check:"string_format",precision:null},M(t)))}function jp(e,t){return new e(y({type:"string",format:"duration",check:"string_format"},M(t)))}function Up(e,t){return new e(y({type:"number",checks:[]},M(t)))}function Zp(e,t){return new e(y({type:"number",check:"number_format",abort:!1,format:"safeint"},M(t)))}function qp(e,t){return new e(y({type:"boolean"},M(t)))}function Hp(e){return new e({type:"any"})}function Fp(e){return new e({type:"unknown"})}function Bp(e,t){return new e(y({type:"never"},M(t)))}function ma(e,t){return new Ki(D(y({check:"less_than"},M(t)),{value:e,inclusive:!1}))}function ws(e,t){return new Ki(D(y({check:"less_than"},M(t)),{value:e,inclusive:!0}))}function ba(e,t){return new Qi(D(y({check:"greater_than"},M(t)),{value:e,inclusive:!1}))}function xs(e,t){return new Qi(D(y({check:"greater_than"},M(t)),{value:e,inclusive:!0}))}function ka(e,t){return new od(D(y({check:"multiple_of"},M(t)),{value:e}))}function _a(e,t){return new id(D(y({check:"max_length"},M(t)),{maximum:e}))}function uo(e,t){return new ad(D(y({check:"min_length"},M(t)),{minimum:e}))}function va(e,t){return new cd(D(y({check:"length_equals"},M(t)),{length:e}))}function Gp(e,t){return new ld(D(y({check:"string_format",format:"regex"},M(t)),{pattern:e}))}function Wp(e){return new ud(y({check:"string_format",format:"lowercase"},M(e)))}function Jp(e){return new dd(y({check:"string_format",format:"uppercase"},M(e)))}function Yp(e,t){return new pd(D(y({check:"string_format",format:"includes"},M(t)),{includes:e}))}function Vp(e,t){return new hd(D(y({check:"string_format",format:"starts_with"},M(t)),{prefix:e}))}function Xp(e,t){return new fd(D(y({check:"string_format",format:"ends_with"},M(t)),{suffix:e}))}function Vn(e){return new gd({check:"overwrite",tx:e})}function Kp(e){return Vn(t=>t.normalize(e))}function Qp(){return Vn(e=>e.trim())}function eh(){return Vn(e=>e.toLowerCase())}function th(){return Vn(e=>e.toUpperCase())}function nh(){return Vn(e=>lu(e))}function rh(e,t,n){return new e(y({type:"array",element:t},M(n)))}function oh(e,t,n){return new e(y({type:"custom",check:"custom",fn:t},M(n)))}function sh(e){const t=ih(n=>(n.addIssue=r=>{var o,i,a,d;if(typeof r=="string")n.issues.push(vr(r,n.value,t._zod.def));else{const u=r;u.fatal&&(u.continue=!1),(o=u.code)!=null||(u.code="custom"),(i=u.input)!=null||(u.input=n.value),(a=u.inst)!=null||(u.inst=t),(d=u.continue)!=null||(u.continue=!t._zod.def.abort),n.issues.push(vr(u))}},e(n.value,n)));return t}function ih(e,t){const n=new nt(y({check:"custom"},M(t)));return n._zod.check=e,n}function ya(e){var n,r,o,i,a,d,u,p,h;let t=(n=e==null?void 0:e.target)!=null?n:"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:(r=e.processors)!=null?r:{},metadataRegistry:(o=e==null?void 0:e.metadata)!=null?o:yr,target:t,unrepresentable:(i=e==null?void 0:e.unrepresentable)!=null?i:"throw",override:(a=e==null?void 0:e.override)!=null?a:(()=>{}),io:(d=e==null?void 0:e.io)!=null?d:"output",counter:0,seen:new Map,cycles:(u=e==null?void 0:e.cycles)!=null?u:"ref",reused:(p=e==null?void 0:e.reused)!=null?p:"inline",external:(h=e==null?void 0:e.external)!=null?h:void 0}}function Ae(e,t,n={path:[],schemaPath:[]}){var h,m,g;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=(m=(h=e._zod).toJSONSchema)==null?void 0:m.call(h);if(d)a.schema=d;else{const k=D(y({},n),{schemaPath:[...n.schemaPath,e],path:n.path});if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,k);else{const T=a.schema,Z=t.processors[o.type];if(!Z)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);Z(e,t,T,k)}const v=e._zod.parent;v&&(a.ref||(a.ref=v),Ae(v,t,k),t.seen.get(v).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),t.io==="input"&&Je(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((g=(r=a.schema).default)!=null||(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function wa(e,t){var a,d,u,p;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const h of e.seen.entries()){const m=(a=e.metadataRegistry.get(h[0]))==null?void 0:a.id;if(m){const g=r.get(m);if(g&&g!==h[0])throw new Error(`Duplicate schema id "${m}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(m,h[0])}}const o=h=>{var T,Z,Q,j,E;const m=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const S=(T=e.external.registry.get(h[0]))==null?void 0:T.id,P=(Z=e.external.uri)!=null?Z:(Y=>Y);if(S)return{ref:P(S)};const q=(j=(Q=h[1].defId)!=null?Q:h[1].schema.id)!=null?j:`schema${e.counter++}`;return h[1].defId=q,{defId:q,ref:`${P("__shared")}#/${m}/${q}`}}if(h[1]===n)return{ref:"#"};const k=`#/${m}/`,v=(E=h[1].schema.id)!=null?E:`__schema${e.counter++}`;return{defId:v,ref:k+v}},i=h=>{if(h[1].schema.$ref)return;const m=h[1],{ref:g,defId:k}=o(h);m.def=y({},m.schema),k&&(m.defId=k);const v=m.schema;for(const T in v)delete v[T];v.$ref=g};if(e.cycles==="throw")for(const h of e.seen.entries()){const m=h[1];if(m.cycle)throw new Error(`Cycle detected: #/${(d=m.cycle)==null?void 0:d.join("/")}/<root>
|
|
1475
1510
|
|
|
1476
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const m=h[1];if(t===h[0]){i(h);continue}if(e.external){const k=(u=e.external.registry.get(h[0]))==null?void 0:u.id;if(t!==h[0]&&k){i(h);continue}}if((p=e.metadataRegistry.get(h[0]))==null?void 0:p.id){i(h);continue}if(m.cycle){i(h);continue}if(m.count>1&&e.reused==="ref"){i(h);continue}}}function ya(e,t){var a,d,u,p,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=m=>{var Q,U,E;const g=e.seen.get(m);if(g.ref===null)return;const k=(Q=g.def)!=null?Q:g.schema,v=y({},k),T=g.ref;if(g.ref=null,T){r(T);const S=e.seen.get(T),P=S.schema;if(P.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=(U=k.allOf)!=null?U:[],k.allOf.push(P)):Object.assign(k,P),Object.assign(k,v),m._zod.parent===T)for(const Y in k)Y==="$ref"||Y==="allOf"||Y in v||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 Z=m._zod.parent;if(Z&&Z!==T){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:m,jsonSchema:k,path:(E=g.path)!=null?E:[]})};for(const m of[...e.seen.entries()].reverse())r(m[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 m=(d=e.external.registry.get(t))==null?void 0:d.id;if(!m)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(m)}Object.assign(o,(u=n.def)!=null?u:n.schema);const i=(h=(p=e.external)==null?void 0:p.defs)!=null?h:{};for(const m of e.seen.entries()){const g=m[1];g.def&&g.defId&&(i[g.defId]=g.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const m=JSON.parse(JSON.stringify(o));return Object.defineProperty(m,"~standard",{value:D(y({},t["~standard"]),{jsonSchema:{input:uo(t,"input",e.processors),output:uo(t,"output",e.processors)}}),enumerable:!1,writable:!1}),m}catch(m){throw new Error("Error converting schema to JSON.")}}function Je(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 Je(r.element,n);if(r.type==="set")return Je(r.valueType,n);if(r.type==="lazy")return Je(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 Je(r.innerType,n);if(r.type==="intersection")return Je(r.left,n)||Je(r.right,n);if(r.type==="record"||r.type==="map")return Je(r.keyType,n)||Je(r.valueType,n);if(r.type==="pipe")return Je(r.in,n)||Je(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Je(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Je(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Je(o,n))return!0;return!!(r.rest&&Je(r.rest,n))}return!1}const sh=(e,t={})=>n=>{const r=_a(D(y({},n),{processors:t}));return Ae(e,r),va(r,e),ya(r,e)},uo=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=_a(D(y({},o!=null?o:{}),{target:i,io:t,processors:n}));return Ae(e,a),va(a,e),ya(a,e)},ih={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ah=(e,t,n,r)=>{var h;const o=n;o.type="string";const{minimum:i,maximum:a,format:d,patterns:u,contentEncoding:p}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),d&&(o.format=(h=ih[d])!=null?h:d,o.format===""&&delete o.format,d==="time"&&delete o.format),p&&(o.contentEncoding=p),u&&u.size>0){const m=[...u];m.length===1?o.pattern=m[0].source:m.length>1&&(o.allOf=[...m.map(g=>D(y({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:g.source}))])}},ch=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:d,multipleOf:u,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof d=="string"&&d.includes("int")?o.type="integer":o.type="number",typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=h,o.exclusiveMinimum=!0):o.exclusiveMinimum=h),typeof i=="number"&&(o.minimum=i,typeof h=="number"&&t.target!=="draft-04"&&(h>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p),typeof a=="number"&&(o.maximum=a,typeof p=="number"&&t.target!=="draft-04"&&(p<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof u=="number"&&(o.multipleOf=u)},lh=(e,t,n,r)=>{n.type="boolean"},uh=(e,t,n,r)=>{n.not={}},dh=(e,t,n,r)=>{},ph=(e,t,n,r)=>{},hh=(e,t,n,r)=>{const o=e._zod.def,i=Ni(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},fh=(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},gh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},mh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},bh=(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=Ae(i.element,t,D(y({},r),{path:[...r.path,"items"]}))},kh=(e,t,n,r)=>{var p;const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const h in a)o.properties[h]=Ae(a[h],t,D(y({},r),{path:[...r.path,"properties",h]}));const d=new Set(Object.keys(a)),u=new Set([...d].filter(h=>{const m=i.shape[h]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));u.size>0&&(o.required=Array.from(u)),((p=i.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Ae(i.catchall,t,D(y({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},_h=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((d,u)=>Ae(d,t,D(y({},r),{path:[...r.path,i?"oneOf":"anyOf",u]})));i?n.oneOf=a:n.anyOf=a},vh=(e,t,n,r)=>{const o=e._zod.def,i=Ae(o.left,t,D(y({},r),{path:[...r.path,"allOf",0]})),a=Ae(o.right,t,D(y({},r),{path:[...r.path,"allOf",1]})),d=p=>"allOf"in p&&Object.keys(p).length===1,u=[...d(i)?i.allOf:[i],...d(a)?a.allOf:[a]];n.allOf=u},yh=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,d=a._zod.bag,u=d==null?void 0:d.patterns;if(i.mode==="loose"&&u&&u.size>0){const h=Ae(i.valueType,t,D(y({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const m of u)o.patternProperties[m.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Ae(i.keyType,t,D(y({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=Ae(i.valueType,t,D(y({},r),{path:[...r.path,"additionalProperties"]}));const p=a._zod.values;if(p){const h=[...p].filter(m=>typeof m=="string"||typeof m=="number");h.length>0&&(o.required=h)}},wh=(e,t,n,r)=>{const o=e._zod.def,i=Ae(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"}]},xh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Sh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Th=(e,t,n,r)=>{const o=e._zod.def;Ae(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)))},Eh=(e,t,n,r)=>{const o=e._zod.def;Ae(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},Ah=(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;Ae(i,t,r);const a=t.seen.get(e);a.ref=i},Ch=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},wa=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Ph=w("ZodISODateTime",(e,t)=>{Ad.init(e,t),ye.init(e,t)});function Rh(e){return $p(Ph,e)}const Lh=w("ZodISODate",(e,t)=>{Cd.init(e,t),ye.init(e,t)});function Ih(e){return Op(Lh,e)}const zh=w("ZodISOTime",(e,t)=>{Pd.init(e,t),ye.init(e,t)});function $h(e){return Np(zh,e)}const Oh=w("ZodISODuration",(e,t)=>{Rd.init(e,t),ye.init(e,t)});function Nh(e){return Dp(Oh,e)}const lt=w("ZodError",(e,t)=>{qi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>vu(e,n)},flatten:{value:n=>_u(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ps,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ps,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Dh=ms(lt),Mh=bs(lt),Uh=oo(lt),jh=so(lt),Zh=xu(lt),qh=Su(lt),Hh=Tu(lt),Fh=Eu(lt),Bh=Au(lt),Gh=Cu(lt),Wh=Pu(lt),Jh=Ru(lt),ke=w("ZodType",(e,t)=>(me.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:uo(e,"input"),output:uo(e,"output")}}),e.toJSONSchema=sh(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(rn(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)=>on(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>Dh(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Uh(e,n,r),e.parseAsync=(n,r)=>L(null,null,function*(){return Mh(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>L(null,null,function*(){return jh(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>Zh(e,n,r),e.decode=(n,r)=>qh(e,n,r),e.encodeAsync=(n,r)=>L(null,null,function*(){return Hh(e,n,r)}),e.decodeAsync=(n,r)=>L(null,null,function*(){return Fh(e,n,r)}),e.safeEncode=(n,r)=>Bh(e,n,r),e.safeDecode=(n,r)=>Gh(e,n,r),e.safeEncodeAsync=(n,r)=>L(null,null,function*(){return Wh(e,n,r)}),e.safeDecodeAsync=(n,r)=>L(null,null,function*(){return Jh(e,n,r)}),e.refine=(n,r)=>e.check(Ff(n,r)),e.superRefine=n=>e.check(Bf(n)),e.overwrite=n=>e.check(Yn(n)),e.optional=()=>Ia(e),e.exactOptional=()=>Lf(e),e.nullable=()=>za(e),e.nullish=()=>Ia(za(e)),e.nonoptional=n=>Df(e,n),e.array=()=>it(e),e.or=n=>wf([e,n]),e.and=n=>Tf(e,n),e.transform=n=>Oa(e,Pf(n)),e.default=n=>$f(e,n),e.prefault=n=>Nf(e,n),e.catch=n=>Uf(e,n),e.pipe=n=>Oa(e,n),e.readonly=()=>qf(e),e.describe=n=>{const r=e.clone();return vr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=vr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return vr.get(e);const r=e.clone();return vr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),xa=w("_ZodString",(e,t)=>{var r,o,i;ks.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(a,d,u)=>ah(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(Fp(...a)),e.includes=(...a)=>e.check(Wp(...a)),e.startsWith=(...a)=>e.check(Jp(...a)),e.endsWith=(...a)=>e.check(Yp(...a)),e.min=(...a)=>e.check(lo(...a)),e.max=(...a)=>e.check(ba(...a)),e.length=(...a)=>e.check(ka(...a)),e.nonempty=(...a)=>e.check(lo(1,...a)),e.lowercase=a=>e.check(Bp(a)),e.uppercase=a=>e.check(Gp(a)),e.trim=()=>e.check(Xp()),e.normalize=(...a)=>e.check(Vp(...a)),e.toLowerCase=()=>e.check(Kp()),e.toUpperCase=()=>e.check(Qp()),e.slugify=()=>e.check(eh())}),Yh=w("ZodString",(e,t)=>{ks.init(e,t),xa.init(e,t),e.email=n=>e.check(hp(Vh,n)),e.url=n=>e.check(kp(Xh,n)),e.jwt=n=>e.check(zp(hf,n)),e.emoji=n=>e.check(_p(Kh,n)),e.guid=n=>e.check(ha(Sa,n)),e.uuid=n=>e.check(fp(po,n)),e.uuidv4=n=>e.check(gp(po,n)),e.uuidv6=n=>e.check(mp(po,n)),e.uuidv7=n=>e.check(bp(po,n)),e.nanoid=n=>e.check(vp(Qh,n)),e.guid=n=>e.check(ha(Sa,n)),e.cuid=n=>e.check(yp(ef,n)),e.cuid2=n=>e.check(wp(tf,n)),e.ulid=n=>e.check(xp(nf,n)),e.base64=n=>e.check(Rp(uf,n)),e.base64url=n=>e.check(Lp(df,n)),e.xid=n=>e.check(Sp(rf,n)),e.ksuid=n=>e.check(Tp(of,n)),e.ipv4=n=>e.check(Ep(sf,n)),e.ipv6=n=>e.check(Ap(af,n)),e.cidrv4=n=>e.check(Cp(cf,n)),e.cidrv6=n=>e.check(Pp(lf,n)),e.e164=n=>e.check(Ip(pf,n)),e.datetime=n=>e.check(Rh(n)),e.date=n=>e.check(Ih(n)),e.time=n=>e.check($h(n)),e.duration=n=>e.check(Nh(n))});function C(e){return pp(Yh,e)}const ye=w("ZodStringFormat",(e,t)=>{be.init(e,t),xa.init(e,t)}),Vh=w("ZodEmail",(e,t)=>{kd.init(e,t),ye.init(e,t)}),Sa=w("ZodGUID",(e,t)=>{md.init(e,t),ye.init(e,t)}),po=w("ZodUUID",(e,t)=>{bd.init(e,t),ye.init(e,t)}),Xh=w("ZodURL",(e,t)=>{_d.init(e,t),ye.init(e,t)}),Kh=w("ZodEmoji",(e,t)=>{vd.init(e,t),ye.init(e,t)}),Qh=w("ZodNanoID",(e,t)=>{yd.init(e,t),ye.init(e,t)}),ef=w("ZodCUID",(e,t)=>{wd.init(e,t),ye.init(e,t)}),tf=w("ZodCUID2",(e,t)=>{xd.init(e,t),ye.init(e,t)}),nf=w("ZodULID",(e,t)=>{Sd.init(e,t),ye.init(e,t)}),rf=w("ZodXID",(e,t)=>{Td.init(e,t),ye.init(e,t)}),of=w("ZodKSUID",(e,t)=>{Ed.init(e,t),ye.init(e,t)}),sf=w("ZodIPv4",(e,t)=>{Ld.init(e,t),ye.init(e,t)}),af=w("ZodIPv6",(e,t)=>{Id.init(e,t),ye.init(e,t)}),cf=w("ZodCIDRv4",(e,t)=>{zd.init(e,t),ye.init(e,t)}),lf=w("ZodCIDRv6",(e,t)=>{$d.init(e,t),ye.init(e,t)}),uf=w("ZodBase64",(e,t)=>{Od.init(e,t),ye.init(e,t)}),df=w("ZodBase64URL",(e,t)=>{Dd.init(e,t),ye.init(e,t)}),pf=w("ZodE164",(e,t)=>{Md.init(e,t),ye.init(e,t)}),hf=w("ZodJWT",(e,t)=>{jd.init(e,t),ye.init(e,t)}),Ta=w("ZodNumber",(e,t)=>{var r,o,i,a,d,u,p,h,m;Qi.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(g,k,v)=>ch(e,g,k),e.gt=(g,k)=>e.check(ga(g,k)),e.gte=(g,k)=>e.check(ys(g,k)),e.min=(g,k)=>e.check(ys(g,k)),e.lt=(g,k)=>e.check(fa(g,k)),e.lte=(g,k)=>e.check(vs(g,k)),e.max=(g,k)=>e.check(vs(g,k)),e.int=g=>e.check(Ea(g)),e.safe=g=>e.check(Ea(g)),e.positive=g=>e.check(ga(0,g)),e.nonnegative=g=>e.check(ys(0,g)),e.negative=g=>e.check(fa(0,g)),e.nonpositive=g=>e.check(vs(0,g)),e.multipleOf=(g,k)=>e.check(ma(g,k)),e.step=(g,k)=>e.check(ma(g,k)),e.finite=()=>e;const n=e._zod.bag;e.minValue=(i=Math.max((r=n.minimum)!=null?r:Number.NEGATIVE_INFINITY,(o=n.exclusiveMinimum)!=null?o:Number.NEGATIVE_INFINITY))!=null?i:null,e.maxValue=(u=Math.min((a=n.maximum)!=null?a:Number.POSITIVE_INFINITY,(d=n.exclusiveMaximum)!=null?d:Number.POSITIVE_INFINITY))!=null?u:null,e.isInt=((p=n.format)!=null?p:"").includes("int")||Number.isSafeInteger((h=n.multipleOf)!=null?h:.5),e.isFinite=!0,e.format=(m=n.format)!=null?m:null});function At(e){return Mp(Ta,e)}const ff=w("ZodNumberFormat",(e,t)=>{Zd.init(e,t),Ta.init(e,t)});function Ea(e){return Up(ff,e)}const gf=w("ZodBoolean",(e,t)=>{qd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lh(e,n,r)});function _e(e){return jp(gf,e)}const mf=w("ZodAny",(e,t)=>{Hd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dh()});function Aa(){return Zp(mf)}const bf=w("ZodUnknown",(e,t)=>{Fd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ph()});function Ca(){return qp(bf)}const kf=w("ZodNever",(e,t)=>{Bd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>uh(e,n,r)});function _f(e){return Hp(kf,e)}const vf=w("ZodArray",(e,t)=>{Gd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bh(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(lo(n,r)),e.nonempty=n=>e.check(lo(1,n)),e.max=(n,r)=>e.check(ba(n,r)),e.length=(n,r)=>e.check(ka(n,r)),e.unwrap=()=>e.element});function it(e,t){return th(vf,e,t)}const yf=w("ZodObject",(e,t)=>{Jd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kh(e,n,r,o),ne(e,"shape",()=>t.shape),e.keyof=()=>ut(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone(D(y({},e._zod.def),{catchall:n})),e.passthrough=()=>e.clone(D(y({},e._zod.def),{catchall:Ca()})),e.loose=()=>e.clone(D(y({},e._zod.def),{catchall:Ca()})),e.strict=()=>e.clone(D(y({},e._zod.def),{catchall:_f()})),e.strip=()=>e.clone(D(y({},e._zod.def),{catchall:void 0})),e.extend=n=>fu(e,n),e.safeExtend=n=>gu(e,n),e.merge=n=>mu(e,n),e.pick=n=>pu(e,n),e.omit=n=>hu(e,n),e.partial=(...n)=>bu(La,e,n[0]),e.required=(...n)=>ku($a,e,n[0])});function ge(e,t){const n=y({type:"object",shape:e!=null?e:{}},M(t));return new yf(n)}const Pa=w("ZodUnion",(e,t)=>{oa.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_h(e,n,r,o),e.options=t.options});function wf(e,t){return new Pa(y({type:"union",options:e},M(t)))}const xf=w("ZodDiscriminatedUnion",(e,t)=>{Pa.init(e,t),Yd.init(e,t)});function Ra(e,t,n){return new xf(y({type:"union",options:t,discriminator:e},M(n)))}const Sf=w("ZodIntersection",(e,t)=>{Vd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vh(e,n,r,o)});function Tf(e,t){return new Sf({type:"intersection",left:e,right:t})}const Ef=w("ZodRecord",(e,t)=>{Xd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yh(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Ct(e,t,n){return new Ef(y({type:"record",keyType:e,valueType:t},M(n)))}const ws=w("ZodEnum",(e,t)=>{Kd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,i)=>hh(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 ws(D(y(D(y({},t),{checks:[]}),M(o)),{entries:i}))},e.exclude=(r,o)=>{const i=y({},t.entries);for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new ws(D(y(D(y({},t),{checks:[]}),M(o)),{entries:i}))}});function ut(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ws(y({type:"enum",entries:n},M(t)))}const Af=w("ZodLiteral",(e,t)=>{Qd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fh(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 Af(y({type:"literal",values:Array.isArray(e)?e:[e]},M(t)))}const Cf=w("ZodTransform",(e,t)=>{ep.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mh(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new $i(e.constructor.name);n.addIssue=i=>{var a,d,u;if(typeof i=="string")n.issues.push(_r(i,n.value,t));else{const p=i;p.fatal&&(p.continue=!1),(a=p.code)!=null||(p.code="custom"),(d=p.input)!=null||(p.input=n.value),(u=p.inst)!=null||(p.inst=e),n.issues.push(_r(p))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Pf(e){return new Cf({type:"transform",transform:e})}const La=w("ZodOptional",(e,t)=>{aa.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wa(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ia(e){return new La({type:"optional",innerType:e})}const Rf=w("ZodExactOptional",(e,t)=>{tp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wa(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Lf(e){return new Rf({type:"optional",innerType:e})}const If=w("ZodNullable",(e,t)=>{np.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function za(e){return new If({type:"nullable",innerType:e})}const zf=w("ZodDefault",(e,t)=>{rp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $f(e,t){return new zf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ji(t)}})}const Of=w("ZodPrefault",(e,t)=>{op.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Th(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Nf(e,t){return new Of({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ji(t)}})}const $a=w("ZodNonOptional",(e,t)=>{sp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Df(e,t){return new $a(y({type:"nonoptional",innerType:e},M(t)))}const Mf=w("ZodCatch",(e,t)=>{ip.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Uf(e,t){return new Mf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const jf=w("ZodPipe",(e,t)=>{ap.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ah(e,n,r,o),e.in=t.in,e.out=t.out});function Oa(e,t){return new jf({type:"pipe",in:e,out:t})}const Zf=w("ZodReadonly",(e,t)=>{cp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ch(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function qf(e){return new Zf({type:"readonly",innerType:e})}const Hf=w("ZodCustom",(e,t)=>{lp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gh(e,n)});function Ff(e,t={}){return nh(Hf,e,t)}function Bf(e){return rh(e)}const Gf=ge({name:C().min(1).max(100).optional(),command:C().min(1).max(500),args:it(C()).optional(),failOnError:_e().default(!0).optional(),timeout:At().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:C().optional(),env:Ct(C(),C()).optional(),runOnBackground:_e().optional(),agentTags:it(C()).optional()});ge({name:C(),command:C(),success:_e(),exitCode:At().optional(),stdout:C().optional(),stderr:C().optional(),error:C().optional(),duration:At(),failOnError:_e()});const vn=ge({path:C(),extraCommands:it(Gf).optional(),id:C().uuid().optional(),rotationKey:C().optional(),usageStatus:ut(["free","in_use"]).optional(),agentTags:it(C()).optional()}),Wf=Ra("operation",[vn.extend({operation:dt("create"),content:C().optional(),contentPath:C().optional(),encoding:ut(["utf-8","base64"]).optional()}),vn.extend({operation:dt("merge"),data:Ct(C(),Aa()),mergeStrategy:ut(["deep","shallow"]).optional(),arrayMergeStrategy:ut(["concat","replace"]).optional()}),vn.extend({operation:dt("modify"),content:C().optional(),contentPath:C().optional(),createIfMissing:_e().optional()}),vn.extend({operation:dt("delete"),ignoreIfMissing:_e().optional()}),vn.extend({operation:dt("createDirectory"),contentPath:C().optional(),mode:At().optional(),ignoreIfExists:_e().optional()}),vn.extend({operation:dt("download"),url:C().url(),headers:Ct(C(),C()).optional(),timeout:At().min(1e3).max(3e5).optional()}),vn.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 Jf=ge({type:ut(["json","file","regex"]).describe("Extraction method"),source:C().describe("Source to extract from (file path or stdout/stderr)"),schema:ge({}).passthrough().optional().describe("JSON schema for validation"),pattern:C().optional().describe("Regex pattern for extraction")}),Yf=ge({type:ut(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:Aa().describe("Hook-specific configuration")});ge({command:C().optional().describe("Legacy — unused in SDK mode"),args:it(C()).optional().describe("Legacy — unused in SDK mode"),env:Ct(C(),C()).optional().describe("Environment variables"),workingDirectory:C().optional().describe("Working directory for command execution"),fileOperations:it(Wf).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:Jf.optional().describe("Schema for extracting result data"),postExecutionHooks:it(Yf).optional().describe("Hooks to run after task completion"),executionMode:ut(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:Ra("executionMode",[ge({executionMode:dt("claudeAgentSdk"),promptText:C(),sdkOptions:ge({model:C(),permissionMode:ut(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:it(C()),allowDangerouslySkipPermissions:_e(),persistSession:_e(),streamSdkEvents:_e().optional(),allowedTools:it(C()).optional(),settings:ge({enabledPlugins:Ct(C(),_e())}),env:Ct(C(),C()).optional()}),resume:ge({sessionId:C().optional(),continue:_e()}).optional()}),ge({executionMode:dt("opencodeSdk"),promptText:C(),sdkOptions:ge({provider:C(),model:C(),allowedTools:it(C()).optional(),env:Ct(C(),C()).optional()}),resume:ge({sessionId:C().optional(),continue:_e()}).optional()}),ge({executionMode:dt("openaiAgentSdk"),promptText:C(),sdkOptions:ge({model:C(),env:Ct(C(),C()).optional()}),resume:ge({sessionId:C().optional(),continue:_e()}).optional()}),ge({executionMode:dt("codexSdk"),promptText:C(),sdkOptions:ge({model:C().optional(),sandboxMode:ut(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:ut(["never","on-request","on-failure","untrusted"]).optional(),env:Ct(C(),C()).optional()}),resume:ge({sessionId:C().optional(),continue:_e()}).optional()}),ge({executionMode:dt("cursorSdk"),promptText:C(),sdkOptions:ge({model:C(),env:Ct(C(),C()).optional()}),resume:ge({sessionId:C().optional(),continue:_e()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:_e().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:C().optional().describe("Final approved plan content"),planApproved:_e().optional().describe("Plan approval status"),planApprovedAt:C().optional().describe("ISO timestamp of approval"),planRejected:_e().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:it(ge({feedback:C(),rejectedAt:C()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:At().optional(),notificationChannelPlanMessageSentAt:C().optional(),notificationChannelCompletedMessageId:At().optional(),notificationChannelFailedMessageId:At().optional(),streamSdkEvents:_e().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:_e().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:it(ge({id:C(),selectedText:C(),startOffset:At(),endOffset:At(),commentText:C(),createdAt:C()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:_e().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:_e().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:ut(["all","ignoreExistingMcpServers"]).optional().describe("MCP server strategy for this run; 'ignoreExistingMcpServers' overrides the existing .mcp.json with only the template's configured servers plus the agent-platform server"),enableBrowserTools:_e().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")}),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 Na="browser_capture",Vf="browser_automate";function Da(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 Xf(e,t){const n=Da(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===Da(r)}function Ma(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:[])Xf(n,d)&&d.length>o&&(o=d.length,r=a.id);return r}function Ua(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 Kf=3e4;function ho(r){return L(this,arguments,function*(e,t={},n=Kf){const o=new AbortController,i=setTimeout(()=>o.abort(),n);try{return yield fetch(e,D(y({},t),{signal:o.signal}))}catch(a){throw a instanceof DOMException&&a.name==="AbortError"?new Error(`Request timed out after ${Math.round(n/1e3)}s. Please check your connection and try again.`):a}finally{clearTimeout(i)}})}function He(e,t,n,r){return L(this,null,function*(){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=yield ho(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return Ua(a)})}function Qf(e,t){return L(this,null,function*(){return He(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)})}const eg=["project","note","ctx"];function tg(e){var n,r;const t=eg.filter(o=>e[o]===void 0||e[o]===null);if(t.length>0)throw new Error(`createTask: missing required field(s): ${t.join(", ")}`);if(!((n=e.project)!=null&&n.id)&&!((r=e.project)!=null&&r.key))throw new Error("createTask: project must have an id or key")}function xs(e,t){return L(this,null,function*(){var h,m,g,k,v,T;tg(t);const{project:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:d,allowSubmit:u,type:p=Na}=t;return He(e,"POST","/tasks",D(y(y(y(y(y(y(y(y(y(y(y(y(D(y({type:p,title:a||r.slice(0,120)||o.pageTitle||"Browser capture",titleInstruction:d!=null?d:r},n.id?{projectId:n.id}:{projectKey:n.key}),{autoAssign:!0}),i!=null&&i.claudeTemplateId?{claudeTemplateId:i.claudeTemplateId}:{}),(i==null?void 0:i.quickMode)!==void 0?{quickMode:i.quickMode}:{}),(i==null?void 0:i.modelOverride)!=null?{modelOverride:i.modelOverride}:{}),(i==null?void 0:i.claudeProfileId)!=null?{claudeProfileId:i.claudeProfileId}:{}),(i==null?void 0:i.effort)!=null?{effort:i.effort}:{}),(i==null?void 0:i.executionMode)!=null?{executionMode:i.executionMode}:{}),(h=i==null?void 0:i.selectedPluginIds)!=null&&h.length?{selectedPluginIds:i.selectedPluginIds}:{}),(m=i==null?void 0:i.selectedSkillIds)!=null&&m.length?{selectedSkillIds:i.selectedSkillIds}:{}),(g=i==null?void 0:i.selectedPluginSkillIds)!=null&&g.length?{selectedPluginSkillIds:i.selectedPluginSkillIds}:{}),(k=i==null?void 0:i.selectedMcpServerIds)!=null&&k.length?{selectedMcpServerIds:i.selectedMcpServerIds}:{}),(v=i==null?void 0:i.selectedSlashCommandIds)!=null&&v.length?{selectedSlashCommandIds:i.selectedSlashCommandIds}:{}),(T=i==null?void 0:i.selectedRemoteContextProviderIds)!=null&&T.length?{selectedRemoteContextProviderIds:i.selectedRemoteContextProviderIds}:{}),{metadata:y({type:p,note:r,source:"web-sdk",pageUrl:o.pageUrl,pageTitle:o.pageTitle,elementText:o.elementText,cssSelector:o.cssSelector,elementOuterHtml:o.elementOuterHtml,ancestry:o.ancestry,elementRole:o.elementRole,elementAriaLabel:o.elementAriaLabel,enclosingSection:o.enclosingSection,description:o.description,canonicalUrl:o.canonicalUrl,lang:o.lang,ogTitle:o.ogTitle,ogDescription:o.ogDescription,ogType:o.ogType,ogSiteName:o.ogSiteName,viewportWidth:o.viewportWidth,viewportHeight:o.viewportHeight,scrollX:o.scrollX,scrollY:o.scrollY,selectionText:o.selectionText,capturedAt:o.capturedAt,interactionSteps:o.interactionSteps},u!==void 0?{allowSubmit:u}:{})}))})}function ja(e,t){return L(this,null,function*(){return xs(e,D(y({},t),{type:Vf}))})}function Za(e,t,n,r){return L(this,null,function*(){var o;return He(e,"POST","/planning-sessions",y(D(y({},t.id?{projectId:t.id}:{projectKey:t.key}),{instruction:n,quickMode:(o=r==null?void 0:r.quickMode)!=null?o:!1}),r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}))})}function ng(e,t){return L(this,null,function*(){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return He(e,"GET",`/claude-templates${n}`)})}function qa(e,t){return L(this,null,function*(){return He(e,"GET",`/tasks/${t}`)})}function rg(e,t){return L(this,null,function*(){return He(e,"GET",`/planning-sessions/${t}`)})}function Ha(e){return L(this,null,function*(){return He(e,"GET","/projects")})}function og(e){return L(this,null,function*(){return(yield He(e,"GET","/tenants/current")).membership})}function Fa(e,t){if(!e||e.includes("tenant:*")||e.includes(t))return!0;const n=t.split(":")[0];return e.includes(`${n}:*`)}function Ba(e,t,n){return L(this,null,function*(){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=yield ho(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return Ua(i)})}function sg(e,t){return L(this,null,function*(){return He(e,"GET",`/tasks/${t}/browser-commands/pending`)})}function ig(e,t,n,r,o){return L(this,null,function*(){return He(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})})}function ag(e,t){return L(this,null,function*(){return He(e,"GET",`/tasks/${t}/chunks`)})}function cg(e,t,n){return L(this,null,function*(){return He(e,"POST",`/tasks/${t}/instructions`,{content:n})})}function lg(e,t){return L(this,null,function*(){return He(e,"POST",`/tasks/${t}/cancel`)})}function ug(e,t){return L(this,null,function*(){return He(e,"POST",`/tasks/${t}/approve-result`)})}function dg(e,t,n){return L(this,null,function*(){return He(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})})}function fo(e,t){return L(this,null,function*(){return He(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)})}function Ga(e,t,n,r){return L(this,null,function*(){return He(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})})}function pg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ss={exports:{}};/*!
|
|
1511
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const m=h[1];if(t===h[0]){i(h);continue}if(e.external){const k=(u=e.external.registry.get(h[0]))==null?void 0:u.id;if(t!==h[0]&&k){i(h);continue}}if((p=e.metadataRegistry.get(h[0]))==null?void 0:p.id){i(h);continue}if(m.cycle){i(h);continue}if(m.count>1&&e.reused==="ref"){i(h);continue}}}function xa(e,t){var a,d,u,p,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=m=>{var Q,j,E;const g=e.seen.get(m);if(g.ref===null)return;const k=(Q=g.def)!=null?Q:g.schema,v=y({},k),T=g.ref;if(g.ref=null,T){r(T);const S=e.seen.get(T),P=S.schema;if(P.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=(j=k.allOf)!=null?j:[],k.allOf.push(P)):Object.assign(k,P),Object.assign(k,v),m._zod.parent===T)for(const Y in k)Y==="$ref"||Y==="allOf"||Y in v||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 Z=m._zod.parent;if(Z&&Z!==T){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:m,jsonSchema:k,path:(E=g.path)!=null?E:[]})};for(const m of[...e.seen.entries()].reverse())r(m[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 m=(d=e.external.registry.get(t))==null?void 0:d.id;if(!m)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(m)}Object.assign(o,(u=n.def)!=null?u:n.schema);const i=(h=(p=e.external)==null?void 0:p.defs)!=null?h:{};for(const m of e.seen.entries()){const g=m[1];g.def&&g.defId&&(i[g.defId]=g.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const m=JSON.parse(JSON.stringify(o));return Object.defineProperty(m,"~standard",{value:D(y({},t["~standard"]),{jsonSchema:{input:po(t,"input",e.processors),output:po(t,"output",e.processors)}}),enumerable:!1,writable:!1}),m}catch(m){throw new Error("Error converting schema to JSON.")}}function Je(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 Je(r.element,n);if(r.type==="set")return Je(r.valueType,n);if(r.type==="lazy")return Je(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 Je(r.innerType,n);if(r.type==="intersection")return Je(r.left,n)||Je(r.right,n);if(r.type==="record"||r.type==="map")return Je(r.keyType,n)||Je(r.valueType,n);if(r.type==="pipe")return Je(r.in,n)||Je(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Je(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Je(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Je(o,n))return!0;return!!(r.rest&&Je(r.rest,n))}return!1}const ah=(e,t={})=>n=>{const r=ya(D(y({},n),{processors:t}));return Ae(e,r),wa(r,e),xa(r,e)},po=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=ya(D(y({},o!=null?o:{}),{target:i,io:t,processors:n}));return Ae(e,a),wa(a,e),xa(a,e)},ch={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},lh=(e,t,n,r)=>{var h;const o=n;o.type="string";const{minimum:i,maximum:a,format:d,patterns:u,contentEncoding:p}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),d&&(o.format=(h=ch[d])!=null?h:d,o.format===""&&delete o.format,d==="time"&&delete o.format),p&&(o.contentEncoding=p),u&&u.size>0){const m=[...u];m.length===1?o.pattern=m[0].source:m.length>1&&(o.allOf=[...m.map(g=>D(y({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:g.source}))])}},uh=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:d,multipleOf:u,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof d=="string"&&d.includes("int")?o.type="integer":o.type="number",typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=h,o.exclusiveMinimum=!0):o.exclusiveMinimum=h),typeof i=="number"&&(o.minimum=i,typeof h=="number"&&t.target!=="draft-04"&&(h>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p),typeof a=="number"&&(o.maximum=a,typeof p=="number"&&t.target!=="draft-04"&&(p<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof u=="number"&&(o.multipleOf=u)},dh=(e,t,n,r)=>{n.type="boolean"},ph=(e,t,n,r)=>{n.not={}},hh=(e,t,n,r)=>{},fh=(e,t,n,r)=>{},gh=(e,t,n,r)=>{const o=e._zod.def,i=Mi(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},mh=(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},bh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},kh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},_h=(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=Ae(i.element,t,D(y({},r),{path:[...r.path,"items"]}))},vh=(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]=Ae(a[h],t,D(y({},r),{path:[...r.path,"properties",h]}));const d=new Set(Object.keys(a)),u=new Set([...d].filter(h=>{const m=i.shape[h]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));u.size>0&&(o.required=Array.from(u)),((p=i.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Ae(i.catchall,t,D(y({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},yh=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((d,u)=>Ae(d,t,D(y({},r),{path:[...r.path,i?"oneOf":"anyOf",u]})));i?n.oneOf=a:n.anyOf=a},wh=(e,t,n,r)=>{const o=e._zod.def,i=Ae(o.left,t,D(y({},r),{path:[...r.path,"allOf",0]})),a=Ae(o.right,t,D(y({},r),{path:[...r.path,"allOf",1]})),d=p=>"allOf"in p&&Object.keys(p).length===1,u=[...d(i)?i.allOf:[i],...d(a)?a.allOf:[a]];n.allOf=u},xh=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,d=a._zod.bag,u=d==null?void 0:d.patterns;if(i.mode==="loose"&&u&&u.size>0){const h=Ae(i.valueType,t,D(y({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const m of u)o.patternProperties[m.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Ae(i.keyType,t,D(y({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=Ae(i.valueType,t,D(y({},r),{path:[...r.path,"additionalProperties"]}));const p=a._zod.values;if(p){const h=[...p].filter(m=>typeof m=="string"||typeof m=="number");h.length>0&&(o.required=h)}},Sh=(e,t,n,r)=>{const o=e._zod.def,i=Ae(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"}]},Th=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Eh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Ah=(e,t,n,r)=>{const o=e._zod.def;Ae(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)))},Ch=(e,t,n,r)=>{const o=e._zod.def;Ae(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},Ph=(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;Ae(i,t,r);const a=t.seen.get(e);a.ref=i},Rh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},Sa=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Lh=w("ZodISODateTime",(e,t)=>{Pd.init(e,t),ye.init(e,t)});function Ih(e){return Np(Lh,e)}const zh=w("ZodISODate",(e,t)=>{Rd.init(e,t),ye.init(e,t)});function $h(e){return Dp(zh,e)}const Oh=w("ZodISOTime",(e,t)=>{Ld.init(e,t),ye.init(e,t)});function Nh(e){return Mp(Oh,e)}const Dh=w("ZodISODuration",(e,t)=>{Id.init(e,t),ye.init(e,t)});function Mh(e){return jp(Dh,e)}const ut=w("ZodError",(e,t)=>{Fi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>wu(e,n)},flatten:{value:n=>yu(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,fs,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,fs,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),jh=ks(ut),Uh=_s(ut),Zh=so(ut),qh=io(ut),Hh=Tu(ut),Fh=Eu(ut),Bh=Au(ut),Gh=Cu(ut),Wh=Pu(ut),Jh=Ru(ut),Yh=Lu(ut),Vh=Iu(ut),ke=w("ZodType",(e,t)=>(me.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:po(e,"input"),output:po(e,"output")}}),e.toJSONSchema=ah(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(on(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)=>sn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>jh(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Zh(e,n,r),e.parseAsync=(n,r)=>I(null,null,function*(){return Uh(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>I(null,null,function*(){return qh(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>Hh(e,n,r),e.decode=(n,r)=>Fh(e,n,r),e.encodeAsync=(n,r)=>I(null,null,function*(){return Bh(e,n,r)}),e.decodeAsync=(n,r)=>I(null,null,function*(){return Gh(e,n,r)}),e.safeEncode=(n,r)=>Wh(e,n,r),e.safeDecode=(n,r)=>Jh(e,n,r),e.safeEncodeAsync=(n,r)=>I(null,null,function*(){return Yh(e,n,r)}),e.safeDecodeAsync=(n,r)=>I(null,null,function*(){return Vh(e,n,r)}),e.refine=(n,r)=>e.check(Gf(n,r)),e.superRefine=n=>e.check(Wf(n)),e.overwrite=n=>e.check(Vn(n)),e.optional=()=>$a(e),e.exactOptional=()=>zf(e),e.nullable=()=>Oa(e),e.nullish=()=>$a(Oa(e)),e.nonoptional=n=>jf(e,n),e.array=()=>it(e),e.or=n=>Sf([e,n]),e.and=n=>Af(e,n),e.transform=n=>Da(e,Lf(n)),e.default=n=>Nf(e,n),e.prefault=n=>Mf(e,n),e.catch=n=>Zf(e,n),e.pipe=n=>Da(e,n),e.readonly=()=>Ff(e),e.describe=n=>{const r=e.clone();return yr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=yr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return yr.get(e);const r=e.clone();return yr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Ta=w("_ZodString",(e,t)=>{var r,o,i;vs.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(a,d,u)=>lh(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(Gp(...a)),e.includes=(...a)=>e.check(Yp(...a)),e.startsWith=(...a)=>e.check(Vp(...a)),e.endsWith=(...a)=>e.check(Xp(...a)),e.min=(...a)=>e.check(uo(...a)),e.max=(...a)=>e.check(_a(...a)),e.length=(...a)=>e.check(va(...a)),e.nonempty=(...a)=>e.check(uo(1,...a)),e.lowercase=a=>e.check(Wp(a)),e.uppercase=a=>e.check(Jp(a)),e.trim=()=>e.check(Qp()),e.normalize=(...a)=>e.check(Kp(...a)),e.toLowerCase=()=>e.check(eh()),e.toUpperCase=()=>e.check(th()),e.slugify=()=>e.check(nh())}),Xh=w("ZodString",(e,t)=>{vs.init(e,t),Ta.init(e,t),e.email=n=>e.check(gp(Kh,n)),e.url=n=>e.check(vp(Qh,n)),e.jwt=n=>e.check(Op(gf,n)),e.emoji=n=>e.check(yp(ef,n)),e.guid=n=>e.check(ga(Ea,n)),e.uuid=n=>e.check(mp(ho,n)),e.uuidv4=n=>e.check(bp(ho,n)),e.uuidv6=n=>e.check(kp(ho,n)),e.uuidv7=n=>e.check(_p(ho,n)),e.nanoid=n=>e.check(wp(tf,n)),e.guid=n=>e.check(ga(Ea,n)),e.cuid=n=>e.check(xp(nf,n)),e.cuid2=n=>e.check(Sp(rf,n)),e.ulid=n=>e.check(Tp(of,n)),e.base64=n=>e.check(Ip(pf,n)),e.base64url=n=>e.check(zp(hf,n)),e.xid=n=>e.check(Ep(sf,n)),e.ksuid=n=>e.check(Ap(af,n)),e.ipv4=n=>e.check(Cp(cf,n)),e.ipv6=n=>e.check(Pp(lf,n)),e.cidrv4=n=>e.check(Rp(uf,n)),e.cidrv6=n=>e.check(Lp(df,n)),e.e164=n=>e.check($p(ff,n)),e.datetime=n=>e.check(Ih(n)),e.date=n=>e.check($h(n)),e.time=n=>e.check(Nh(n)),e.duration=n=>e.check(Mh(n))});function C(e){return fp(Xh,e)}const ye=w("ZodStringFormat",(e,t)=>{be.init(e,t),Ta.init(e,t)}),Kh=w("ZodEmail",(e,t)=>{vd.init(e,t),ye.init(e,t)}),Ea=w("ZodGUID",(e,t)=>{kd.init(e,t),ye.init(e,t)}),ho=w("ZodUUID",(e,t)=>{_d.init(e,t),ye.init(e,t)}),Qh=w("ZodURL",(e,t)=>{yd.init(e,t),ye.init(e,t)}),ef=w("ZodEmoji",(e,t)=>{wd.init(e,t),ye.init(e,t)}),tf=w("ZodNanoID",(e,t)=>{xd.init(e,t),ye.init(e,t)}),nf=w("ZodCUID",(e,t)=>{Sd.init(e,t),ye.init(e,t)}),rf=w("ZodCUID2",(e,t)=>{Td.init(e,t),ye.init(e,t)}),of=w("ZodULID",(e,t)=>{Ed.init(e,t),ye.init(e,t)}),sf=w("ZodXID",(e,t)=>{Ad.init(e,t),ye.init(e,t)}),af=w("ZodKSUID",(e,t)=>{Cd.init(e,t),ye.init(e,t)}),cf=w("ZodIPv4",(e,t)=>{zd.init(e,t),ye.init(e,t)}),lf=w("ZodIPv6",(e,t)=>{$d.init(e,t),ye.init(e,t)}),uf=w("ZodCIDRv4",(e,t)=>{Od.init(e,t),ye.init(e,t)}),df=w("ZodCIDRv6",(e,t)=>{Nd.init(e,t),ye.init(e,t)}),pf=w("ZodBase64",(e,t)=>{Dd.init(e,t),ye.init(e,t)}),hf=w("ZodBase64URL",(e,t)=>{jd.init(e,t),ye.init(e,t)}),ff=w("ZodE164",(e,t)=>{Ud.init(e,t),ye.init(e,t)}),gf=w("ZodJWT",(e,t)=>{qd.init(e,t),ye.init(e,t)}),Aa=w("ZodNumber",(e,t)=>{var r,o,i,a,d,u,p,h,m;ta.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(g,k,v)=>uh(e,g,k),e.gt=(g,k)=>e.check(ba(g,k)),e.gte=(g,k)=>e.check(xs(g,k)),e.min=(g,k)=>e.check(xs(g,k)),e.lt=(g,k)=>e.check(ma(g,k)),e.lte=(g,k)=>e.check(ws(g,k)),e.max=(g,k)=>e.check(ws(g,k)),e.int=g=>e.check(Ca(g)),e.safe=g=>e.check(Ca(g)),e.positive=g=>e.check(ba(0,g)),e.nonnegative=g=>e.check(xs(0,g)),e.negative=g=>e.check(ma(0,g)),e.nonpositive=g=>e.check(ws(0,g)),e.multipleOf=(g,k)=>e.check(ka(g,k)),e.step=(g,k)=>e.check(ka(g,k)),e.finite=()=>e;const n=e._zod.bag;e.minValue=(i=Math.max((r=n.minimum)!=null?r:Number.NEGATIVE_INFINITY,(o=n.exclusiveMinimum)!=null?o:Number.NEGATIVE_INFINITY))!=null?i:null,e.maxValue=(u=Math.min((a=n.maximum)!=null?a:Number.POSITIVE_INFINITY,(d=n.exclusiveMaximum)!=null?d:Number.POSITIVE_INFINITY))!=null?u:null,e.isInt=((p=n.format)!=null?p:"").includes("int")||Number.isSafeInteger((h=n.multipleOf)!=null?h:.5),e.isFinite=!0,e.format=(m=n.format)!=null?m:null});function Ct(e){return Up(Aa,e)}const mf=w("ZodNumberFormat",(e,t)=>{Hd.init(e,t),Aa.init(e,t)});function Ca(e){return Zp(mf,e)}const bf=w("ZodBoolean",(e,t)=>{Fd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dh(e,n,r)});function _e(e){return qp(bf,e)}const kf=w("ZodAny",(e,t)=>{Bd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hh()});function Pa(){return Hp(kf)}const _f=w("ZodUnknown",(e,t)=>{Gd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fh()});function Ra(){return Fp(_f)}const vf=w("ZodNever",(e,t)=>{Wd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ph(e,n,r)});function yf(e){return Bp(vf,e)}const wf=w("ZodArray",(e,t)=>{Jd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_h(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(uo(n,r)),e.nonempty=n=>e.check(uo(1,n)),e.max=(n,r)=>e.check(_a(n,r)),e.length=(n,r)=>e.check(va(n,r)),e.unwrap=()=>e.element});function it(e,t){return rh(wf,e,t)}const xf=w("ZodObject",(e,t)=>{Vd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vh(e,n,r,o),ne(e,"shape",()=>t.shape),e.keyof=()=>dt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone(D(y({},e._zod.def),{catchall:n})),e.passthrough=()=>e.clone(D(y({},e._zod.def),{catchall:Ra()})),e.loose=()=>e.clone(D(y({},e._zod.def),{catchall:Ra()})),e.strict=()=>e.clone(D(y({},e._zod.def),{catchall:yf()})),e.strip=()=>e.clone(D(y({},e._zod.def),{catchall:void 0})),e.extend=n=>mu(e,n),e.safeExtend=n=>bu(e,n),e.merge=n=>ku(e,n),e.pick=n=>fu(e,n),e.omit=n=>gu(e,n),e.partial=(...n)=>_u(za,e,n[0]),e.required=(...n)=>vu(Na,e,n[0])});function ge(e,t){const n=y({type:"object",shape:e!=null?e:{}},M(t));return new xf(n)}const La=w("ZodUnion",(e,t)=>{ia.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yh(e,n,r,o),e.options=t.options});function Sf(e,t){return new La(y({type:"union",options:e},M(t)))}const Tf=w("ZodDiscriminatedUnion",(e,t)=>{La.init(e,t),Xd.init(e,t)});function Ia(e,t,n){return new Tf(y({type:"union",options:t,discriminator:e},M(n)))}const Ef=w("ZodIntersection",(e,t)=>{Kd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wh(e,n,r,o)});function Af(e,t){return new Ef({type:"intersection",left:e,right:t})}const Cf=w("ZodRecord",(e,t)=>{Qd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xh(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Pt(e,t,n){return new Cf(y({type:"record",keyType:e,valueType:t},M(n)))}const Ss=w("ZodEnum",(e,t)=>{ep.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,i)=>gh(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 Ss(D(y(D(y({},t),{checks:[]}),M(o)),{entries:i}))},e.exclude=(r,o)=>{const i=y({},t.entries);for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new Ss(D(y(D(y({},t),{checks:[]}),M(o)),{entries:i}))}});function dt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Ss(y({type:"enum",entries:n},M(t)))}const Pf=w("ZodLiteral",(e,t)=>{tp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mh(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 pt(e,t){return new Pf(y({type:"literal",values:Array.isArray(e)?e:[e]},M(t)))}const Rf=w("ZodTransform",(e,t)=>{np.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kh(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Ni(e.constructor.name);n.addIssue=i=>{var a,d,u;if(typeof i=="string")n.issues.push(vr(i,n.value,t));else{const p=i;p.fatal&&(p.continue=!1),(a=p.code)!=null||(p.code="custom"),(d=p.input)!=null||(p.input=n.value),(u=p.inst)!=null||(p.inst=e),n.issues.push(vr(p))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Lf(e){return new Rf({type:"transform",transform:e})}const za=w("ZodOptional",(e,t)=>{la.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sa(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function $a(e){return new za({type:"optional",innerType:e})}const If=w("ZodExactOptional",(e,t)=>{rp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sa(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function zf(e){return new If({type:"optional",innerType:e})}const $f=w("ZodNullable",(e,t)=>{op.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Oa(e){return new $f({type:"nullable",innerType:e})}const Of=w("ZodDefault",(e,t)=>{sp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Nf(e,t){return new Of({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():qi(t)}})}const Df=w("ZodPrefault",(e,t)=>{ip.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ah(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Mf(e,t){return new Df({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():qi(t)}})}const Na=w("ZodNonOptional",(e,t)=>{ap.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Th(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function jf(e,t){return new Na(y({type:"nonoptional",innerType:e},M(t)))}const Uf=w("ZodCatch",(e,t)=>{cp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ch(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Zf(e,t){return new Uf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const qf=w("ZodPipe",(e,t)=>{lp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ph(e,n,r,o),e.in=t.in,e.out=t.out});function Da(e,t){return new qf({type:"pipe",in:e,out:t})}const Hf=w("ZodReadonly",(e,t)=>{up.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ff(e){return new Hf({type:"readonly",innerType:e})}const Bf=w("ZodCustom",(e,t)=>{dp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bh(e,n)});function Gf(e,t={}){return oh(Bf,e,t)}function Wf(e){return sh(e)}const Jf=ge({name:C().min(1).max(100).optional(),command:C().min(1).max(500),args:it(C()).optional(),failOnError:_e().default(!0).optional(),timeout:Ct().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:C().optional(),env:Pt(C(),C()).optional(),runOnBackground:_e().optional(),agentTags:it(C()).optional()});ge({name:C(),command:C(),success:_e(),exitCode:Ct().optional(),stdout:C().optional(),stderr:C().optional(),error:C().optional(),duration:Ct(),failOnError:_e()});const yn=ge({path:C(),extraCommands:it(Jf).optional(),id:C().uuid().optional(),rotationKey:C().optional(),usageStatus:dt(["free","in_use"]).optional(),agentTags:it(C()).optional()}),Yf=Ia("operation",[yn.extend({operation:pt("create"),content:C().optional(),contentPath:C().optional(),encoding:dt(["utf-8","base64"]).optional()}),yn.extend({operation:pt("merge"),data:Pt(C(),Pa()),mergeStrategy:dt(["deep","shallow"]).optional(),arrayMergeStrategy:dt(["concat","replace"]).optional()}),yn.extend({operation:pt("modify"),content:C().optional(),contentPath:C().optional(),createIfMissing:_e().optional()}),yn.extend({operation:pt("delete"),ignoreIfMissing:_e().optional()}),yn.extend({operation:pt("createDirectory"),contentPath:C().optional(),mode:Ct().optional(),ignoreIfExists:_e().optional()}),yn.extend({operation:pt("download"),url:C().url(),headers:Pt(C(),C()).optional(),timeout:Ct().min(1e3).max(3e5).optional()}),yn.extend({operation:pt("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 Vf=ge({type:dt(["json","file","regex"]).describe("Extraction method"),source:C().describe("Source to extract from (file path or stdout/stderr)"),schema:ge({}).passthrough().optional().describe("JSON schema for validation"),pattern:C().optional().describe("Regex pattern for extraction")}),Xf=ge({type:dt(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:Pa().describe("Hook-specific configuration")});ge({command:C().optional().describe("Legacy — unused in SDK mode"),args:it(C()).optional().describe("Legacy — unused in SDK mode"),env:Pt(C(),C()).optional().describe("Environment variables"),workingDirectory:C().optional().describe("Working directory for command execution"),fileOperations:it(Yf).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:Vf.optional().describe("Schema for extracting result data"),postExecutionHooks:it(Xf).optional().describe("Hooks to run after task completion"),executionMode:dt(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:Ia("executionMode",[ge({executionMode:pt("claudeAgentSdk"),promptText:C(),sdkOptions:ge({model:C(),permissionMode:dt(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:it(C()),allowDangerouslySkipPermissions:_e(),persistSession:_e(),streamSdkEvents:_e().optional(),allowedTools:it(C()).optional(),settings:ge({enabledPlugins:Pt(C(),_e())}),env:Pt(C(),C()).optional()}),resume:ge({sessionId:C().optional(),continue:_e()}).optional()}),ge({executionMode:pt("opencodeSdk"),promptText:C(),sdkOptions:ge({provider:C(),model:C(),allowedTools:it(C()).optional(),env:Pt(C(),C()).optional()}),resume:ge({sessionId:C().optional(),continue:_e()}).optional()}),ge({executionMode:pt("openaiAgentSdk"),promptText:C(),sdkOptions:ge({model:C(),env:Pt(C(),C()).optional()}),resume:ge({sessionId:C().optional(),continue:_e()}).optional()}),ge({executionMode:pt("codexSdk"),promptText:C(),sdkOptions:ge({model:C().optional(),sandboxMode:dt(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:dt(["never","on-request","on-failure","untrusted"]).optional(),env:Pt(C(),C()).optional()}),resume:ge({sessionId:C().optional(),continue:_e()}).optional()}),ge({executionMode:pt("cursorSdk"),promptText:C(),sdkOptions:ge({model:C(),env:Pt(C(),C()).optional()}),resume:ge({sessionId:C().optional(),continue:_e()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:_e().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:C().optional().describe("Final approved plan content"),planApproved:_e().optional().describe("Plan approval status"),planApprovedAt:C().optional().describe("ISO timestamp of approval"),planRejected:_e().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:it(ge({feedback:C(),rejectedAt:C()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:Ct().optional(),notificationChannelPlanMessageSentAt:C().optional(),notificationChannelCompletedMessageId:Ct().optional(),notificationChannelFailedMessageId:Ct().optional(),streamSdkEvents:_e().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:_e().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:it(ge({id:C(),selectedText:C(),startOffset:Ct(),endOffset:Ct(),commentText:C(),createdAt:C()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:_e().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:_e().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode: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:_e().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 Ma="browser_capture",Kf="browser_automate";function ja(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 Qf(e,t){const n=ja(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===ja(r)}function Ua(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:[])Qf(n,d)&&d.length>o&&(o=d.length,r=a.id);return r}function Za(e){return I(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 eg=3e4;function fo(r){return I(this,arguments,function*(e,t={},n=eg){const o=new AbortController,i=setTimeout(()=>o.abort(),n);try{return yield fetch(e,D(y({},t),{signal:o.signal}))}catch(a){throw a instanceof DOMException&&a.name==="AbortError"?new Error(`Request timed out after ${Math.round(n/1e3)}s. Please check your connection and try again.`):a}finally{clearTimeout(i)}})}function He(e,t,n,r){return I(this,null,function*(){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=yield fo(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return Za(a)})}function tg(e,t){return I(this,null,function*(){return He(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)})}const ng=["project","note","ctx"];function rg(e){var n,r;const t=ng.filter(o=>e[o]===void 0||e[o]===null);if(t.length>0)throw new Error(`createTask: missing required field(s): ${t.join(", ")}`);if(!((n=e.project)!=null&&n.id)&&!((r=e.project)!=null&&r.key))throw new Error("createTask: project must have an id or key")}function Ts(e,t){return I(this,null,function*(){var h,m,g,k,v,T;rg(t);const{project:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:d,allowSubmit:u,type:p=Ma}=t;return He(e,"POST","/tasks",D(y(y(y(y(y(y(y(y(y(y(y(y(D(y({type:p,title:a||r.slice(0,120)||o.pageTitle||"Browser capture",titleInstruction:d!=null?d:r},n.id?{projectId:n.id}:{projectKey:n.key}),{autoAssign:!0}),i!=null&&i.claudeTemplateId?{claudeTemplateId:i.claudeTemplateId}:{}),(i==null?void 0:i.quickMode)!==void 0?{quickMode:i.quickMode}:{}),(i==null?void 0:i.modelOverride)!=null?{modelOverride:i.modelOverride}:{}),(i==null?void 0:i.claudeProfileId)!=null?{claudeProfileId:i.claudeProfileId}:{}),(i==null?void 0:i.effort)!=null?{effort:i.effort}:{}),(i==null?void 0:i.executionMode)!=null?{executionMode:i.executionMode}:{}),(h=i==null?void 0:i.selectedPluginIds)!=null&&h.length?{selectedPluginIds:i.selectedPluginIds}:{}),(m=i==null?void 0:i.selectedSkillIds)!=null&&m.length?{selectedSkillIds:i.selectedSkillIds}:{}),(g=i==null?void 0:i.selectedPluginSkillIds)!=null&&g.length?{selectedPluginSkillIds:i.selectedPluginSkillIds}:{}),(k=i==null?void 0:i.selectedMcpServerIds)!=null&&k.length?{selectedMcpServerIds:i.selectedMcpServerIds}:{}),(v=i==null?void 0:i.selectedSlashCommandIds)!=null&&v.length?{selectedSlashCommandIds:i.selectedSlashCommandIds}:{}),(T=i==null?void 0:i.selectedRemoteContextProviderIds)!=null&&T.length?{selectedRemoteContextProviderIds:i.selectedRemoteContextProviderIds}:{}),{metadata:y({type:p,note:r,source:"web-sdk",pageUrl:o.pageUrl,pageTitle:o.pageTitle,elementText:o.elementText,cssSelector:o.cssSelector,elementOuterHtml:o.elementOuterHtml,ancestry:o.ancestry,elementRole:o.elementRole,elementAriaLabel:o.elementAriaLabel,enclosingSection:o.enclosingSection,description:o.description,canonicalUrl:o.canonicalUrl,lang:o.lang,ogTitle:o.ogTitle,ogDescription:o.ogDescription,ogType:o.ogType,ogSiteName:o.ogSiteName,viewportWidth:o.viewportWidth,viewportHeight:o.viewportHeight,scrollX:o.scrollX,scrollY:o.scrollY,selectionText:o.selectionText,capturedAt:o.capturedAt,interactionSteps:o.interactionSteps},u!==void 0?{allowSubmit:u}:{})}))})}function qa(e,t){return I(this,null,function*(){return Ts(e,D(y({},t),{type:Kf}))})}function Ha(e,t,n,r){return I(this,null,function*(){var o;return He(e,"POST","/planning-sessions",y(D(y({},t.id?{projectId:t.id}:{projectKey:t.key}),{instruction:n,quickMode:(o=r==null?void 0:r.quickMode)!=null?o:!1}),r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}))})}function og(e,t){return I(this,null,function*(){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return He(e,"GET",`/claude-templates${n}`)})}function Fa(e,t){return I(this,null,function*(){return He(e,"GET",`/tasks/${t}`)})}function sg(e,t){return I(this,null,function*(){return He(e,"GET",`/planning-sessions/${t}`)})}function Ba(e){return I(this,null,function*(){return He(e,"GET","/projects")})}function ig(e){return I(this,null,function*(){return(yield He(e,"GET","/tenants/current")).membership})}function Ga(e,t){if(!e||e.includes("tenant:*")||e.includes(t))return!0;const n=t.split(":")[0];return e.includes(`${n}:*`)}function Wa(e,t,n){return I(this,null,function*(){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=yield fo(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return Za(i)})}function ag(e,t){return I(this,null,function*(){return He(e,"GET",`/tasks/${t}/browser-commands/pending`)})}function cg(e,t,n,r,o){return I(this,null,function*(){return He(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})})}function lg(e,t){return I(this,null,function*(){return He(e,"GET",`/tasks/${t}/chunks`)})}function ug(e,t,n){return I(this,null,function*(){return He(e,"POST",`/tasks/${t}/instructions`,{content:n})})}function dg(e,t){return I(this,null,function*(){return He(e,"POST",`/tasks/${t}/cancel`)})}function pg(e,t){return I(this,null,function*(){return He(e,"POST",`/tasks/${t}/approve-result`)})}function hg(e,t,n){return I(this,null,function*(){return He(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})})}function go(e,t){return I(this,null,function*(){return He(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)})}function Ja(e,t,n,r){return I(this,null,function*(){return He(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})})}function fg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Es={exports:{}};/*!
|
|
1477
1512
|
* Pusher JavaScript Library v8.5.0
|
|
1478
1513
|
* https://pusher.com/
|
|
1479
1514
|
*
|
|
1480
1515
|
* Copyright 2020, Pusher
|
|
1481
1516
|
* Released under the MIT licence.
|
|
1482
|
-
*/var Wa;function hg(){return Wa||(Wa=1,(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(a,d){var u=this&&this.__extends||(function(){var U=function(E,S){return U=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(P,q){P.__proto__=q}||function(P,q){for(var Y in q)q.hasOwnProperty(Y)&&(P[Y]=q[Y])},U(E,S)};return function(E,S){U(E,S);function P(){this.constructor=E}E.prototype=S===null?Object.create(S):(P.prototype=S.prototype,new P)}})();Object.defineProperty(d,"__esModule",{value:!0});var p=256,h=(function(){function U(E){E===void 0&&(E="="),this._paddingCharacter=E}return U.prototype.encodedLength=function(E){return this._paddingCharacter?(E+2)/3*4|0:(E*8+5)/6|0},U.prototype.encode=function(E){for(var S="",P=0;P<E.length-2;P+=3){var q=E[P]<<16|E[P+1]<<8|E[P+2];S+=this._encodeByte(q>>>18&63),S+=this._encodeByte(q>>>12&63),S+=this._encodeByte(q>>>6&63),S+=this._encodeByte(q>>>0&63)}var Y=E.length-P;if(Y>0){var q=E[P]<<16|(Y===2?E[P+1]<<8:0);S+=this._encodeByte(q>>>18&63),S+=this._encodeByte(q>>>12&63),Y===2?S+=this._encodeByte(q>>>6&63):S+=this._paddingCharacter||"",S+=this._paddingCharacter||""}return S},U.prototype.maxDecodedLength=function(E){return this._paddingCharacter?E/4*3|0:(E*6+7)/8|0},U.prototype.decodedLength=function(E){return this.maxDecodedLength(E.length-this._getPaddingLength(E))},U.prototype.decode=function(E){if(E.length===0)return new Uint8Array(0);for(var S=this._getPaddingLength(E),P=E.length-S,q=new Uint8Array(this.maxDecodedLength(P)),Y=0,xe=0,Pe=0,ct=0,ee=0,$e=0,ot=0;xe<P-4;xe+=4)ct=this._decodeChar(E.charCodeAt(xe+0)),ee=this._decodeChar(E.charCodeAt(xe+1)),$e=this._decodeChar(E.charCodeAt(xe+2)),ot=this._decodeChar(E.charCodeAt(xe+3)),q[Y++]=ct<<2|ee>>>4,q[Y++]=ee<<4|$e>>>2,q[Y++]=$e<<6|ot,Pe|=ct&p,Pe|=ee&p,Pe|=$e&p,Pe|=ot&p;if(xe<P-1&&(ct=this._decodeChar(E.charCodeAt(xe)),ee=this._decodeChar(E.charCodeAt(xe+1)),q[Y++]=ct<<2|ee>>>4,Pe|=ct&p,Pe|=ee&p),xe<P-2&&($e=this._decodeChar(E.charCodeAt(xe+2)),q[Y++]=ee<<4|$e>>>2,Pe|=$e&p),xe<P-3&&(ot=this._decodeChar(E.charCodeAt(xe+3)),q[Y++]=$e<<6|ot,Pe|=ot&p),Pe!==0)throw new Error("Base64Coder: incorrect characters for decoding");return q},U.prototype._encodeByte=function(E){var S=E;return S+=65,S+=25-E>>>8&6,S+=51-E>>>8&-75,S+=61-E>>>8&-15,S+=62-E>>>8&3,String.fromCharCode(S)},U.prototype._decodeChar=function(E){var S=p;return S+=(42-E&E-44)>>>8&-p+E-43+62,S+=(46-E&E-48)>>>8&-p+E-47+63,S+=(47-E&E-58)>>>8&-p+E-48+52,S+=(64-E&E-91)>>>8&-p+E-65+0,S+=(96-E&E-123)>>>8&-p+E-97+26,S},U.prototype._getPaddingLength=function(E){var S=0;if(this._paddingCharacter){for(var P=E.length-1;P>=0&&E[P]===this._paddingCharacter;P--)S++;if(E.length<4||S>2)throw new Error("Base64Coder: incorrect padding")}return S},U})();d.Coder=h;var m=new h;function g(U){return m.encode(U)}d.encode=g;function k(U){return m.decode(U)}d.decode=k;var v=(function(U){u(E,U);function E(){return U!==null&&U.apply(this,arguments)||this}return E.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)},E.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},E})(h);d.URLSafeCoder=v;var T=new v;function Z(U){return T.encode(U)}d.encodeURLSafe=Z;function Q(U){return T.decode(U)}d.decodeURLSafe=Q,d.encodedLength=function(U){return m.encodedLength(U)},d.maxDecodedLength=function(U){return m.maxDecodedLength(U)},d.decodedLength=function(U){return m.decodedLength(U)}},978(a,d){var u="utf8: invalid source encoding";function p(h){for(var m=[],g=0;g<h.length;g++){var k=h[g];if(k&128){var v=void 0;if(k<224){if(g>=h.length)throw new Error(u);var T=h[++g];if((T&192)!==128)throw new Error(u);k=(k&31)<<6|T&63,v=128}else if(k<240){if(g>=h.length-1)throw new Error(u);var T=h[++g],Z=h[++g];if((T&192)!==128||(Z&192)!==128)throw new Error(u);k=(k&15)<<12|(T&63)<<6|Z&63,v=2048}else if(k<248){if(g>=h.length-2)throw new Error(u);var T=h[++g],Z=h[++g],Q=h[++g];if((T&192)!==128||(Z&192)!==128||(Q&192)!==128)throw new Error(u);k=(k&15)<<18|(T&63)<<12|(Z&63)<<6|Q&63,v=65536}else throw new Error(u);if(k<v||k>=55296&&k<=57343)throw new Error(u);if(k>=65536){if(k>1114111)throw new Error(u);k-=65536,m.push(String.fromCharCode(55296|k>>10)),k=56320|k&1023}}m.push(String.fromCharCode(k))}return m.join("")}d.D4=p},721(a,d,u){a.exports=u(207).default},207(a,d,u){u.d(d,{default:()=>os});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"),m={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 g=m;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 te=function(Le){Le||x.cleanup()},re=0;re<B.length;re++)B[re](O,te)}});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 v=new p("_pusher_dependencies","Pusher.DependenciesReceivers"),T=new k({cdn_http:g.cdn_http,cdn_https:g.cdn_https,version:g.VERSION,suffix:g.dependency_suffix,receivers:v});const Z={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}},U={buildLogSuffix:function(l){const s="See:",c=Z.urls[l];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=Z.baseUrl+c.path),f?`${s} ${f}`:""}};var E;(function(l){l.UserAuthentication="user-authentication",l.ChannelAuthorization="channel-authorization"})(E||(E={}));class 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 q 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 xe extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Pe extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class ct extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class ee extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class $e extends Error{constructor(s,c){super(c),this.status=s,Object.setPrototypeOf(this,new.target.prototype)}}const Ot=function(l,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(te){b(new $e(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 E.UserAuthentication:O=U.buildLogSuffix("authenticationEndpoint");break;case E.ChannelAuthorization:O=`Clients must be authorized to join private or presence channels. ${U.buildLogSuffix("authorizationEndpoint")}`;break}b(new $e(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 hn(l){return le(Jt(l))}var wt=String.fromCharCode,Gt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wt=function(l){var s=l.charCodeAt(0);return s<128?l:s<2048?wt(192|s>>>6)+wt(128|s&63):wt(224|s>>>12&15)+wt(128|s>>>6&63)+wt(128|s&63)},Jt=function(l){return l.replace(/[^\x00-\x7F]/g,Wt)},Yt=function(l){var s=[0,2,1][l.length%3],c=l.charCodeAt(0)<<16|(l.length>1?l.charCodeAt(1):0)<<8|(l.length>2?l.charCodeAt(2):0),f=[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("")},le=window.btoa||function(l){return l.replace(/[\s\S]{1,3}/g,Yt)};class In{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 we=In;function zn(l){window.clearTimeout(l)}function N(l){window.clearInterval(l)}class X extends we{constructor(s,c){super(setTimeout,zn,s,function(f){return c(),null})}}class Ee extends we{constructor(s,c){super(setInterval,N,s,function(f){return c(),f})}}var Oe={now(){return Date.now?Date.now():new Date().valueOf()},defer(l){return new X(0,l)},method(l,...s){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[l].apply(f,c.concat(arguments))}}};const ue=Oe;function de(l,...s){for(var c=0;c<s.length;c++){var f=s[c];for(var b in f)f[b]&&f[b].constructor&&f[b].constructor===Object?l[b]=de(l[b]||{},f[b]):l[b]=f[b]}return l}function $n(){for(var l=["Pusher"],s=0;s<arguments.length;s++)typeof arguments[s]=="string"?l.push(arguments[s]):l.push(tt(arguments[s]));return l.join(" : ")}function fn(l,s){var c=Array.prototype.indexOf;if(l===null)return-1;if(c&&l.indexOf===c)return l.indexOf(s);for(var f=0,b=l.length;f<b;f++)if(l[f]===s)return f;return-1}function pe(l,s){for(var c in l)Object.prototype.hasOwnProperty.call(l,c)&&s(l[c],c,l)}function Ue(l){var s=[];return pe(l,function(c,f){s.push(f)}),s}function Re(l){var s=[];return pe(l,function(c){s.push(c)}),s}function Ne(l,s,c){for(var f=0;f<l.length;f++)s.call(c||window,l[f],f,l)}function gn(l,s){for(var c=[],f=0;f<l.length;f++)c.push(s(l[f],f,l,c));return c}function je(l,s){var c={};return pe(l,function(f,b){c[b]=s(f)}),c}function st(l,s){s=s||function(b){return!!b};for(var c=[],f=0;f<l.length;f++)s(l[f],f,l,c)&&c.push(l[f]);return c}function Nt(l,s){var c={};return pe(l,function(f,b){(s&&s(f,b,l,c)||f)&&(c[b]=f)}),c}function Vt(l){var s=[];return pe(l,function(c,f){s.push([f,c])}),s}function Nr(l,s){for(var c=0;c<l.length;c++)if(s(l[c],c,l))return!0;return!1}function ci(l,s){for(var c=0;c<l.length;c++)if(!s(l[c],c,l))return!1;return!0}function Dr(l){return je(l,function(s){return typeof s=="object"&&(s=tt(s)),encodeURIComponent(hn(s.toString()))})}function On(l){var s=Nt(l,function(f){return f!==void 0}),c=gn(Vt(Dr(s)),ue.method("join","=")).join("&");return c}function mn(l){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}})(l,"$")}function tt(l){try{return JSON.stringify(l)}catch(s){return JSON.stringify(mn(l))}}class Mr{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=$n.apply(this,arguments);os.log?os.log(f):os.logToConsole&&s.bind(this)(f)}}const he=new Mr;var Bo=function(l,s,c,f,b){(c.headers!==void 0||c.headersProvider!=null)&&he.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var x=l.nextAuthCallbackID.toString();l.nextAuthCallbackID++;var R=l.getDocument(),O=R.createElement("script");l.auth_callbacks[x]=function(re){b(null,re)};var B="Pusher.auth_callbacks['"+x+"']";O.src=c.endpoint+"?callback="+encodeURIComponent(B)+"&"+s;var te=R.getElementsByTagName("head")[0]||R.documentElement;te.insertBefore(O,te.firstChild)};const Ur=Bo;class Go{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 ur{constructor(s,c){this.url=s,this.data=c}send(s){if(!this.request){var c=On(this.data),f=this.url+"/"+s.number+"?"+c;this.request=G.createScriptRequest(f),this.request.send(s)}}cleanup(){this.request&&this.request.cleanup()}}var dr=function(l,s){return function(c,f){var b="http"+(s?"s":"")+"://",x=b+(l.host||l.options.host)+l.options.path,R=G.createJSONPRequest(x,c),O=G.ScriptReceivers.create(function(B,te){h.remove(O),R.cleanup(),te&&te.host&&(l.host=te.host),f&&f(B,te)});R.send(O)}},xt={name:"jsonp",getAgent:dr};const bn=xt;function Nn(l,s,c){var f=l+(s.useTLS?"s":""),b=s.useTLS?s.hostTLS:s.hostNonTLS;return f+"://"+b+c}function Dn(l,s){var c="/app/"+l,f="?protocol="+g.PROTOCOL+"&client=js&version="+g.VERSION+(s?"&"+s:"");return c+f}var li={getInitial:function(l,s){var c=(s.httpPath||"")+Dn(l,"flash=false");return Nn("ws",s,c)}},pr={getInitial:function(l,s){var c=(s.httpPath||"/pusher")+Dn(l);return Nn("http",s,c)}},hr={getInitial:function(l,s){return Nn("http",s,s.httpPath||"/pusher")},getPath:function(l,s){return Dn(l)}};class ui{constructor(){this._callbacks={}}get(s){return this._callbacks[Xt(s)]}add(s,c,f){var b=Xt(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?[Xt(s)]:Ue(this._callbacks);c||f?this.removeCallback(b,c,f):this.removeAllCallbacks(b)}removeCallback(s,c,f){Ne(s,function(b){this._callbacks[b]=st(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){Ne(s,function(c){delete this._callbacks[c]},this)}}function Xt(l){return"_"+l}class St{constructor(s){this.callbacks=new ui,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=st(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 di extends St{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 ue.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),he.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"?(ue.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 de({cid:this.id},s)}}class fe{constructor(s){this.hooks=s}isSupported(s){return this.hooks.isSupported(s)}createConnection(s,c,f,b){return new di(this.hooks,s,c,f,b)}}var kn=new fe({urls:li,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!G.getWebSocketAPI()},isSupported:function(){return!!G.getWebSocketAPI()},getSocket:function(l){return G.createWebSocket(l)}}),Wo={urls:pr,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},jr=de({getSocket:function(l){return G.HTTPFactory.createStreamingSocket(l)}},Wo),fr=de({getSocket:function(l){return G.HTTPFactory.createPollingSocket(l)}},Wo),Zr={isSupported:function(){return G.isXHRSupported()}},Jo=new fe(de({},jr,Zr)),pi=new fe(de({},fr,Zr)),gt={ws:kn,xhr_streaming:Jo,xhr_polling:pi};const mt=gt;var Yo=new fe({file:"sockjs",urls:hr,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(l,s){return new window.SockJS(l,null,{js_path:T.getPath("sockjs",{useTLS:s.useTLS}),ignore_null_origin:s.ignoreNullOrigin})},beforeOpen:function(l,s){l.send(JSON.stringify({path:s}))}}),qr={isSupported:function(l){var s=G.isXDRSupported(l.useTLS);return s}},Hr=new fe(de({},jr,qr)),Vo=new fe(de({},fr,qr));mt.xdr_streaming=Hr,mt.xdr_polling=Vo,mt.sockjs=Yo;const Tt=mt;class Xo extends St{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 Ko=new Xo;class Qo{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=de({},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=ue.now()},B=te=>{if(x.unbind("closed",B),te.code===1002||te.code===1003)this.manager.reportDeath();else if(!te.wasClean&&R){var re=ue.now()-R;re<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(re/2,this.minPingDelay))}};return x.bind("open",O),x}isSupported(s){return this.manager.isAlive()&&this.transport.isSupported(s)}}const Fr={decodeMessage:function(l){try{var s=JSON.parse(l.data),c=s.data;if(typeof c=="string")try{c=JSON.parse(s.data)}catch(b){}var f={event:s.event,channel:s.channel,data:c};return s.user_id&&(f.user_id=s.user_id),f}catch(b){throw{type:"MessageParseError",error:b,data:l.data}}},encodeMessage:function(l){return JSON.stringify(l)},processHandshake:function(l){var s=Fr.decodeMessage(l);if(s.event==="pusher:connection_established"){if(!s.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:s.data.socket_id,activityTimeout:s.data.activity_timeout*1e3}}else{if(s.event==="pusher:error")return{action:this.getCloseAction(s.data),error:this.getCloseError(s.data)};throw"Invalid handshake"}},getCloseAction:function(l){return l.code<4e3?l.code>=1002&&l.code<=1004?"backoff":null:l.code===4e3?"tls_only":l.code<4100?"refused":l.code<4200?"backoff":l.code<4300?"retry":"refused"},getCloseError:function(l){return l.code!==1e3&&l.code!==1001?{type:"PusherError",data:{code:l.code,message:l.reason||l.message}}:null}},Kt=Fr;class j extends St{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),he.debug("Event sent",b),this.send(Kt.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=Kt.decodeMessage(f)}catch(x){this.emit("error",{type:"MessageParseError",error:x,data:f.data})}if(b!==void 0){switch(he.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=()=>{pe(s,(f,b)=>{this.transport.unbind(b,f)})};pe(s,(f,b)=>{this.transport.bind(b,f)})}handleCloseEvent(s){var c=Kt.getCloseAction(s),f=Kt.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=Kt.processHandshake(s)}catch(f){this.finish("error",{error:f}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new j(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=s=>{this.unbindListeners();var c=Kt.getCloseAction(s)||"backoff",f=Kt.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(de({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 St{constructor(s,c){super(function(f,b){he.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=U.buildLogSuffix("triggeringClientEvents");he.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,he.error(s.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:s.message},s instanceof $e?{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 ae extends I{authorize(s,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:s},c)}}class Ze{constructor(){this.reset()}get(s){return Object.prototype.hasOwnProperty.call(this.members,s)?{id:s,info:this.members[s]}:null}each(s){pe(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 Se=function(l,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(re){try{te(f.next(re))}catch(Le){R(Le)}}function B(re){try{te(f.throw(re))}catch(Le){R(Le)}}function te(re){re.done?x(re.value):b(re.value).then(O,B)}te((f=f.apply(l,s||[])).next())})};class We extends ae{constructor(s,c){super(s,c),this.members=new Ze}authorize(s,c){super.authorize(s,(f,b)=>Se(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=U.buildLogSuffix("authorizationEndpoint");he.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 Et=u(978),Dt=u(594);class Br extends ae{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,Dt.decode)(x),delete b.shared_secret,c(null,b)})}trigger(s,c){throw new Pe("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){he.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){he.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let f=(0,Dt.decode)(c.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){he.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let b=(0,Dt.decode)(c.nonce);if(b.length<this.nacl.secretbox.nonceLength){he.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){he.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){he.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){he.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,Et.D4)(s);try{return JSON.parse(c)}catch(f){return c}}}class De extends St{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 X(s||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new X(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new X(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 X(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(s){return de({},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 de({},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),he.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 es{constructor(){this.channels={}}add(s,c){return this.channels[s]||(this.channels[s]=ts(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(){pe(this.channels,function(s){s.disconnect()})}}function ts(l,s){if(l.indexOf("private-encrypted-")===0){if(s.config.nacl)return Qt.createEncryptedChannel(l,s,s.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=U.buildLogSuffix("encryptedChannelSupport");throw new Pe(`${c}. ${f}`)}else{if(l.indexOf("private-")===0)return Qt.createPrivateChannel(l,s);if(l.indexOf("presence-")===0)return Qt.createPresenceChannel(l,s);if(l.indexOf("#")===0)throw new P('Cannot create a channel with name "'+l+'".');return Qt.createChannel(l,s)}}var nk={createChannels(){return new es},createConnectionManager(l,s){return new De(l,s)},createChannel(l,s){return new I(l,s)},createPrivateChannel(l,s){return new ae(l,s)},createPresenceChannel(l,s){return new We(l,s)},createEncryptedChannel(l,s,c){return new Br(l,s,c)},createTimelineSender(l,s){return new A(l,s)},createHandshake(l,s){return new _(l,s)},createAssistantToTheTransportManager(l,s,c){return new Qo(l,s,c)}};const Qt=nk;class xl{constructor(s){this.options=s||{},this.livesLeft=this.options.lives||1/0}getAssistant(s){return Qt.createAssistantToTheTransportManager(this,s,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Mn{constructor(s,c){this.strategies=s,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return Nr(this.strategies,ue.method("isSupported"))}connect(s,c){var f=this.strategies,b=0,x=this.timeout,R=null,O=(B,te)=>{te?c(null,te):(b=b+1,this.loop&&(b=b%f.length),b<f.length?(x&&(x=x*2,this.timeoutLimit&&(x=Math.min(x,this.timeoutLimit))),R=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},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 X(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 hi{constructor(s){this.strategies=s}isSupported(){return Nr(this.strategies,ue.method("isSupported"))}connect(s,c){return rk(this.strategies,s,function(f,b){return function(x,R){if(b[f].error=x,x){ok(b)&&c(!0);return}Ne(b,function(O){O.forceMinPriority(R.transport.priority)}),c(null,R)}})}}function rk(l,s,c){var f=gn(l,function(b,x,R,O){return b.connect(s,c(x,O))});return{abort:function(){Ne(f,sk)},forceMinPriority:function(b){Ne(f,function(x){x.forceMinPriority(b)})}}}function ok(l){return ci(l,function(s){return!!s.error})}function sk(l){!l.error&&!l.aborted&&(l.abort(),l.aborted=!0)}class ik{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=ak(f),x=b&&b.cacheSkipCount?b.cacheSkipCount:0,R=[this.strategy];if(b&&b.timestamp+this.ttl>=ue.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 Mn([O],{timeout:b.latency*2+1e3,failFast:!0}))):x++)}var B=ue.now(),te=R.pop().connect(s,function re(Le,ss){Le?(Sl(f),R.length>0?(B=ue.now(),te=R.pop().connect(s,re)):c(Le)):(ck(f,ss.transport.name,ue.now()-B,x),c(null,ss))});return{abort:function(){te.abort()},forceMinPriority:function(re){s=re,te&&te.forceMinPriority(re)}}}}function fi(l){return"pusherTransport"+(l?"TLS":"NonTLS")}function ak(l){var s=G.getLocalStorage();if(s)try{var c=s[fi(l)];if(c)return JSON.parse(c)}catch(f){Sl(l)}return null}function ck(l,s,c,f){var b=G.getLocalStorage();if(b)try{b[fi(l)]=tt({timestamp:ue.now(),transport:s,latency:c,cacheSkipCount:f})}catch(x){}}function Sl(l){var s=G.getLocalStorage();if(s)try{delete s[fi(l)]}catch(c){}}class ns{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 X(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 Gr{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 lk{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 Wr(l){return function(){return l.isSupported()}}var uk=function(l,s,c){var f={};function b(Dl,a_,c_,l_,u_){var Ml=c(l,Dl,a_,c_,l_,u_);return f[Dl]=Ml,Ml}var x=Object.assign({},s,{hostNonTLS:l.wsHost+":"+l.wsPort,hostTLS:l.wsHost+":"+l.wssPort,httpPath:l.wsPath}),R=Object.assign({},x,{useTLS:!0}),O=Object.assign({},s,{hostNonTLS:l.httpHost+":"+l.httpPort,hostTLS:l.httpHost+":"+l.httpsPort,httpPath:l.httpPath}),B={loop:!0,timeout:15e3,timeoutLimit:6e4},te=new xl({minPingDelay:1e4,maxPingDelay:l.activityTimeout}),re=new xl({lives:2,minPingDelay:1e4,maxPingDelay:l.activityTimeout}),Le=b("ws","ws",3,x,te),ss=b("wss","ws",3,R,te),n_=b("sockjs","sockjs",1,O),Ll=b("xhr_streaming","xhr_streaming",1,O,re),r_=b("xdr_streaming","xdr_streaming",1,O,re),Il=b("xhr_polling","xhr_polling",1,O),o_=b("xdr_polling","xdr_polling",1,O),zl=new Mn([Le],B),s_=new Mn([ss],B),i_=new Mn([n_],B),$l=new Mn([new Gr(Wr(Ll),Ll,r_)],B),Ol=new Mn([new Gr(Wr(Il),Il,o_)],B),Nl=new Mn([new Gr(Wr($l),new hi([$l,new ns(Ol,{delay:4e3})]),Ol)],B),bi=new Gr(Wr(Nl),Nl,i_),ki;return s.useTLS?ki=new hi([zl,new ns(bi,{delay:2e3})]):ki=new hi([zl,new ns(s_,{delay:2e3}),new ns(bi,{delay:5e3})]),new ik(new lk(new Gr(Wr(Le),ki,bi)),f,{ttl:18e5,timeline:s.timeline,useTLS:s.useTLS})};const dk=uk;function pk(){var l=this;l.timeline.info(l.buildTimelineMessage({transport:l.name+(l.options.useTLS?"s":"")})),l.hooks.isInitialized()?l.changeState("initialized"):l.hooks.file?(l.changeState("initializing"),T.load(l.hooks.file,{useTLS:l.options.useTLS},function(s,c){l.hooks.isInitialized()?(l.changeState("initialized"),c(!0)):(s&&l.onError(s),l.onClose(),c(!1))})):l.onClose()}var hk={getRequest:function(l){var s=new window.XDomainRequest;return s.ontimeout=function(){l.emit("error",new q),l.close()},s.onerror=function(c){l.emit("error",c),l.close()},s.onprogress=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText)},s.onload=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText),l.emit("finished",200),l.close()},s},abortRequest:function(l){l.ontimeout=l.onerror=l.onprogress=l.onload=null,l.abort()}};const fk=hk,gk=256*1024;class mk extends St{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(`
|
|
1483
|
-
`);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(s){return this.position===s.length&&s.length>gk}}var gi;(function(l){l[l.CONNECTING=0]="CONNECTING",l[l.OPEN=1]="OPEN",l[l.CLOSED=3]="CLOSED"})(gi||(gi={}));const Un=gi;var bk=1;class kk{constructor(s,c){this.hooks=s,this.session=El(1e3)+"/"+wk(8),this.location=_k(c),this.readyState=Un.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===Un.OPEN)try{return G.createSocketRequest("POST",Tl(vk(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=Un.CLOSED,this.onclose&&this.onclose({code:s,reason:c,wasClean:f})}onChunk(s){if(s.status===200){this.readyState===Un.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===Un.CONNECTING?(s&&s.hostname&&(this.location.base=yk(this.location.base,s.hostname)),this.readyState=Un.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(s){this.readyState===Un.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",Tl(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){ue.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 _k(l){var s=/([^\?]*)\/*(\??.*)/.exec(l);return{base:s[1],queryString:s[2]}}function vk(l,s){return l.base+"/"+s+"/xhr_send"}function Tl(l){var s=l.indexOf("?")===-1?"?":"&";return l+s+"t="+ +new Date+"&n="+bk++}function yk(l,s){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(l);return c[1]+s+c[3]}function El(l){return G.randomInt(l)}function wk(l){for(var s=[],c=0;c<l;c++)s.push(El(32).toString(32));return s.join("")}const xk=kk;var Sk={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr_streaming"+l.queryString},onHeartbeat:function(l){l.sendRaw("[]")},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const Tk=Sk;var Ek={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr"+l.queryString},onHeartbeat:function(){},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){s===200?l.reconnect():l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const Ak=Ek;var Ck={getRequest:function(l){var s=G.getXHRAPI(),c=new s;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText),l.emit("finished",c.status),l.close();break}},c},abortRequest:function(l){l.onreadystatechange=null,l.abort()}};const Pk=Ck;var Rk={createStreamingSocket(l){return this.createSocket(Tk,l)},createPollingSocket(l){return this.createSocket(Ak,l)},createSocket(l,s){return new xk(l,s)},createXHR(l,s){return this.createRequest(Pk,l,s)},createRequest(l,s,c){return new mk(l,s,c)}};const Al=Rk;Al.createXDR=function(l,s){return this.createRequest(fk,l,s)};var Lk={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:v,getDefaultStrategy:dk,Transports:Tt,transportConnectionInitializer:pk,HTTPFactory:Al,TimelineTransport:bn,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(l){window.Pusher=l;var s=()=>{this.onDocumentBody(l.ready)};window.JSON?s():T.load("json2",{},s)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:Ot,jsonp:Ur}},onDocumentBody(l){document.body?l():setTimeout(()=>{this.onDocumentBody(l)},0)},createJSONPRequest(l,s){return new ur(l,s)},createScriptRequest(l){return new Go(l)},getLocalStorage(){try{return window.localStorage}catch(l){return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var l=this.getXHRAPI();return new l},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Ko},createWebSocket(l){var s=this.getWebSocketAPI();return new s(l)},createSocketRequest(l,s){if(this.isXHRSupported())return this.HTTPFactory.createXHR(l,s);if(this.isXDRSupported(s.indexOf("https:")===0))return this.HTTPFactory.createXDR(l,s);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var l=this.getXHRAPI();return!!l&&new l().withCredentials!==void 0},isXDRSupported(l){var s=l?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===s},addUnloadListener(l){window.addEventListener!==void 0?window.addEventListener("unload",l,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",l)},removeUnloadListener(l){window.addEventListener!==void 0?window.removeEventListener("unload",l,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",l)},randomInt(l){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*l)}};const G=Lk;var mi;(function(l){l[l.ERROR=3]="ERROR",l[l.INFO=6]="INFO",l[l.DEBUG=7]="DEBUG"})(mi||(mi={}));const rs=mi;class Ik{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(de({},c,{timestamp:ue.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(s){this.log(rs.ERROR,s)}info(s){this.log(rs.INFO,s)}debug(s){this.log(rs.DEBUG,s)}isEmpty(){return this.events.length===0}send(s,c){var f=de({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 zk{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 Cl(new Y,c)}else return Cl(new ee,c);var f=!1,b=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),x=null,R=function(){b.unbind("initialized",R),b.connect()},O=function(){x=Qt.createHandshake(b,function(Le){f=!0,re(),c(null,Le)})},B=function(Le){re(),c(Le)},te=function(){re();var Le;Le=tt(b),c(new xe(Le))},re=function(){b.unbind("initialized",R),b.unbind("open",O),b.unbind("error",B),b.unbind("closed",te)};return b.bind("initialized",R),b.bind("open",O),b.bind("error",B),b.bind("closed",te),b.initialize(),{abort:()=>{f||(re(),x?x.close():b.close())},forceMinPriority:Le=>{f||this.priority<Le&&(x?x.close():b.close())}}}}function Cl(l,s){return ue.defer(function(){s(l)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:$k}=G;var Ok=function(l,s,c,f,b,x){var R=$k[c];if(!R)throw new ct(c);var O=(!l.enabledTransports||fn(l.enabledTransports,s)!==-1)&&(!l.disabledTransports||fn(l.disabledTransports,s)===-1),B;return O?(b=Object.assign({ignoreNullOrigin:l.ignoreNullOrigin},b),B=new zk(s,f,x?x.getAssistant(R):R,b)):B=Nk,B},Nk={isSupported:function(){return!1},connect:function(l,s){var c=ue.defer(function(){s(new ee)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function Dk(l){if(l==null)throw"You must pass an options object";if(l.cluster==null)throw"Options object must provide a cluster";"disableStats"in l&&he.warn("The disableStats option is deprecated in favor of enableStats")}const Mk=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},Uk=l=>{if(typeof G.getAuthorizers()[l.transport]=="undefined")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=Mk(s,l);G.getAuthorizers()[l.transport](G,f,l,E.UserAuthentication,c)}},jk=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);c+="&channel_name="+encodeURIComponent(l.channelName);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},Zk=l=>{if(typeof G.getAuthorizers()[l.transport]=="undefined")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=jk(s,l);G.getAuthorizers()[l.transport](G,f,l,E.ChannelAuthorization,c)}},qk=(l,s,c)=>{const f={authTransport:s.transport,authEndpoint:s.endpoint,auth:{params:s.params,headers:s.headers}};return(b,x)=>{const R=l.channel(b.channelName);c(R,f).authorize(b.socketId,x)}};function Pl(l,s){let c={activityTimeout:l.activityTimeout||g.activityTimeout,cluster:l.cluster,httpPath:l.httpPath||g.httpPath,httpPort:l.httpPort||g.httpPort,httpsPort:l.httpsPort||g.httpsPort,pongTimeout:l.pongTimeout||g.pongTimeout,statsHost:l.statsHost||g.stats_host,unavailableTimeout:l.unavailableTimeout||g.unavailableTimeout,wsPath:l.wsPath||g.wsPath,wsPort:l.wsPort||g.wsPort,wssPort:l.wssPort||g.wssPort,enableStats:Wk(l),httpHost:Hk(l),useTLS:Gk(l),wsHost:Fk(l),userAuthenticator:Jk(l),channelAuthorizer:Vk(l,s)};return"disabledTransports"in l&&(c.disabledTransports=l.disabledTransports),"enabledTransports"in l&&(c.enabledTransports=l.enabledTransports),"ignoreNullOrigin"in l&&(c.ignoreNullOrigin=l.ignoreNullOrigin),"timelineParams"in l&&(c.timelineParams=l.timelineParams),"nacl"in l&&(c.nacl=l.nacl),c}function Hk(l){return l.httpHost?l.httpHost:l.cluster?`sockjs-${l.cluster}.pusher.com`:g.httpHost}function Fk(l){return l.wsHost?l.wsHost:Bk(l.cluster)}function Bk(l){return`ws-${l}.pusher.com`}function Gk(l){return G.getProtocol()==="https:"?!0:l.forceTLS!==!1}function Wk(l){return"enableStats"in l?l.enableStats:"disableStats"in l?!l.disableStats:!1}const Rl=l=>"customHandler"in l&&l.customHandler!=null;function Jk(l){const s=Object.assign(Object.assign({},g.userAuthentication),l.userAuthentication);return Rl(s)?s.customHandler:Uk(s)}function Yk(l,s){let c;if("channelAuthorization"in l)c=Object.assign(Object.assign({},g.channelAuthorization),l.channelAuthorization);else if(c={transport:l.authTransport||g.authTransport,endpoint:l.authEndpoint||g.authEndpoint},"auth"in l&&("params"in l.auth&&(c.params=l.auth.params),"headers"in l.auth&&(c.headers=l.auth.headers)),"authorizer"in l)return{customHandler:qk(s,c,l.authorizer)};return c}function Vk(l,s){const c=Yk(l,s);return Rl(c)?c.customHandler:Zk(c)}class Xk extends St{constructor(s){super(function(c,f){he.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 Kk(){let l,s;return{promise:new Promise((f,b)=>{l=f,s=b}),resolve:l,reject:s}}const Qk=Kk;class e_ extends St{constructor(s){super(function(c,f){he.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){he.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 Xk(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){he.error(`Failed parsing user data after signin: ${s.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){he.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}=Qk();s.done=!1;const f=()=>{s.done=!0};s.then(f).catch(f),this.signinDonePromise=s,this._signinDoneResolve=c}}class Be{static ready(){Be.isReady=!0;for(var s=0,c=Be.instances.length;s<c;s++)Be.instances[s].connect()}static getClientFeatures(){return Ue(Nt({ws:G.Transports.ws},function(s){return s.isSupported({})}))}constructor(s,c){t_(s),Dk(c),this.key=s,this.options=c,this.config=Pl(this.options,this),this.channels=Qt.createChannels(),this.global_emitter=new St,this.sessionID=G.randomInt(1e9),this.timeline=new Ik(this.key,this.sessionID,{cluster:this.config.cluster,features:Be.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:rs.INFO,version:g.VERSION}),this.config.enableStats&&(this.timelineSender=Qt.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+G.TimelineTransport.name}));var f=b=>G.getDefaultStrategy(this.config,b,Ok);this.connection=Qt.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=>{he.warn(b)}),Be.instances.push(this),this.timeline.info({instances:Be.instances.length}),this.user=new e_(this),Be.isReady&&this.connect()}switchCluster(s){const{appKey:c,cluster:f}=s;this.key=c,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=Pl(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 Ee(6e4,function(){c.send(s)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(s,c,f){return this.global_emitter.bind(s,c,f),this}unbind(s,c,f){return this.global_emitter.unbind(s,c,f),this}bind_global(s){return this.global_emitter.bind_global(s),this}unbind_global(s){return this.global_emitter.unbind_global(s),this}unbind_all(s){return this.global_emitter.unbind_all(),this}subscribeAll(){var s;for(s in this.channels.channels)this.channels.channels.hasOwnProperty(s)&&this.subscribe(s)}subscribe(s){var c=this.channels.add(s,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(s){var c=this.channels.find(s);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(s),c&&c.subscribed&&c.unsubscribe())}send_event(s,c,f){return this.connection.send_event(s,c,f)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}Be.instances=[],Be.isReady=!1,Be.logToConsole=!1,Be.Runtime=G,Be.ScriptReceivers=G.ScriptReceivers,Be.DependenciesReceivers=G.DependenciesReceivers,Be.auth_callbacks=G.auth_callbacks;const os=Be;function t_(l){if(l==null)throw"You must pass your app key when you instantiate Pusher."}G.setup(Be)}},r={};function o(a){var d=r[a];if(d!==void 0)return d.exports;var u=r[a]={exports:{}};return n[a].call(u.exports,u,u.exports,o),u.exports}o.d=(a,d)=>{for(var u in d)o.o(d,u)&&!o.o(a,u)&&Object.defineProperty(a,u,{enumerable:!0,get:d[u]})},o.o=(a,d)=>Object.prototype.hasOwnProperty.call(a,d);var i=o(721);return i})())})(Ss)),Ss.exports}var fg=hg();const gg=pg(fg);let bt=null,Vn=null;function mg(e){return L(this,null,function*(){return Vn||(Vn=L(null,null,function*(){const t=e.backendUrl.replace(/\/+$/,""),n=yield ho(`${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();bt=new gg(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)=>{ho(`${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))}}})}),Vn.catch(()=>{Vn=null}),Vn)})}function bg(e){if(!e||!bt)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return bt.connection.bind("state_change",n),()=>bt==null?void 0:bt.connection.unbind("state_change",n)}function kg(e,t,n){return L(this,null,function*(){if(yield mg(e),!bt)return()=>{};const r=bt.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(to.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(to.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(to.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(to.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=bg(n.onReconnect);return()=>{r.unbind_all(),bt==null||bt.unsubscribe(`private-task-${t}`),o==null||o()}})}const Ts="ap-sdk-active-automation";function _g(){try{const e=sessionStorage.getItem(Ts);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 Ja(e){try{sessionStorage.setItem(Ts,JSON.stringify(e))}catch(t){}}function Ya(){try{sessionStorage.removeItem(Ts)}catch(e){}}function vg(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 yg(),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 yg(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const Es="shared",Va="ap-sdk-panel-size:",Xa=280,Ka=200;function wg(e){try{const t=sessionStorage.getItem(Va+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 xg(e,t){try{sessionStorage.setItem(Va+e,JSON.stringify(t))}catch(n){}}function go(e,t,n){return Math.min(Math.max(e,t),n)}function Qa(){return window.innerWidth-32}function ec(){return window.innerHeight-64}function As(e,t){const n=wg(t);n&&(e.style.width=`${go(n.width,Xa,Qa())}px`,e.style.height=`${go(n.height,Ka,ec())}px`);const r=document.createElement("div");r.className="ap-sdk-resize-handle",r.setAttribute("data-ap-sdk","1"),e.appendChild(r);let o=!1,i=0,a=0,d=0,u=0,p=0,h=0;const m=k=>{o&&(p=go(d+(k.clientX-i),Xa,Qa()),h=go(u+(k.clientY-a),Ka,ec()),e.style.width=`${p}px`,e.style.height=`${h}px`)},g=()=>{o&&(o=!1,document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",g),xg(t,{width:p,height:h}))};r.addEventListener("pointerdown",k=>{k.preventDefault(),k.stopPropagation(),o=!0,i=k.clientX,a=k.clientY;const v=e.getBoundingClientRect();d=v.width,u=v.height,p=d,h=u,document.addEventListener("pointermove",m),document.addEventListener("pointerup",g)})}function Cs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var yn=Cs();function tc(e){yn=e}var wn={exec:()=>null};function Xn(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 Sg=((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:Xn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Xn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Xn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Xn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Xn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Xn(e=>new RegExp(`^ {0,${e}}>`))},Tg=/^(?:[ \t]*(?:\n|$))+/,Eg=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ag=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,yr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Cg=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ps=/ {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+|$)/,rc=V(nc).replace(/bull/g,Ps).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(),Pg=V(nc).replace(/bull/g,Ps).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(),Rs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Rg=/^[^\n]+/,Ls=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Lg=V(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ls).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ig=V(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ps).getRegex(),mo="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",Is=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,zg=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",Is).replace("tag",mo).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),oc=e=>V(Rs).replace("hr",yr).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",mo).getRegex(),$g=oc(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Og=oc(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Ng=V(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Og).getRegex(),zs={blockquote:Ng,code:Eg,def:Lg,fences:Ag,heading:Cg,hr:yr,html:zg,lheading:rc,list:Ig,newline:Tg,paragraph:$g,table:wn,text:Rg},sc=V("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",yr).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",mo).getRegex(),Dg=D(y({},zs),{lheading:Pg,table:sc,paragraph:V(Rs).replace("hr",yr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",sc).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",mo).getRegex()}),Mg=D(y({},zs),{html:V(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Is).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(Rs).replace("hr",yr).replace("heading",` *#{1,6} *[^
|
|
1484
|
-
]`).replace("lheading",
|
|
1517
|
+
*/var Ya;function gg(){return Ya||(Ya=1,(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(a,d){var u=this&&this.__extends||(function(){var j=function(E,S){return j=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(P,q){P.__proto__=q}||function(P,q){for(var Y in q)q.hasOwnProperty(Y)&&(P[Y]=q[Y])},j(E,S)};return function(E,S){j(E,S);function P(){this.constructor=E}E.prototype=S===null?Object.create(S):(P.prototype=S.prototype,new P)}})();Object.defineProperty(d,"__esModule",{value:!0});var p=256,h=(function(){function j(E){E===void 0&&(E="="),this._paddingCharacter=E}return j.prototype.encodedLength=function(E){return this._paddingCharacter?(E+2)/3*4|0:(E*8+5)/6|0},j.prototype.encode=function(E){for(var S="",P=0;P<E.length-2;P+=3){var q=E[P]<<16|E[P+1]<<8|E[P+2];S+=this._encodeByte(q>>>18&63),S+=this._encodeByte(q>>>12&63),S+=this._encodeByte(q>>>6&63),S+=this._encodeByte(q>>>0&63)}var Y=E.length-P;if(Y>0){var q=E[P]<<16|(Y===2?E[P+1]<<8:0);S+=this._encodeByte(q>>>18&63),S+=this._encodeByte(q>>>12&63),Y===2?S+=this._encodeByte(q>>>6&63):S+=this._paddingCharacter||"",S+=this._paddingCharacter||""}return S},j.prototype.maxDecodedLength=function(E){return this._paddingCharacter?E/4*3|0:(E*6+7)/8|0},j.prototype.decodedLength=function(E){return this.maxDecodedLength(E.length-this._getPaddingLength(E))},j.prototype.decode=function(E){if(E.length===0)return new Uint8Array(0);for(var S=this._getPaddingLength(E),P=E.length-S,q=new Uint8Array(this.maxDecodedLength(P)),Y=0,xe=0,Pe=0,lt=0,ee=0,$e=0,ot=0;xe<P-4;xe+=4)lt=this._decodeChar(E.charCodeAt(xe+0)),ee=this._decodeChar(E.charCodeAt(xe+1)),$e=this._decodeChar(E.charCodeAt(xe+2)),ot=this._decodeChar(E.charCodeAt(xe+3)),q[Y++]=lt<<2|ee>>>4,q[Y++]=ee<<4|$e>>>2,q[Y++]=$e<<6|ot,Pe|=lt&p,Pe|=ee&p,Pe|=$e&p,Pe|=ot&p;if(xe<P-1&&(lt=this._decodeChar(E.charCodeAt(xe)),ee=this._decodeChar(E.charCodeAt(xe+1)),q[Y++]=lt<<2|ee>>>4,Pe|=lt&p,Pe|=ee&p),xe<P-2&&($e=this._decodeChar(E.charCodeAt(xe+2)),q[Y++]=ee<<4|$e>>>2,Pe|=$e&p),xe<P-3&&(ot=this._decodeChar(E.charCodeAt(xe+3)),q[Y++]=$e<<6|ot,Pe|=ot&p),Pe!==0)throw new Error("Base64Coder: incorrect characters for decoding");return q},j.prototype._encodeByte=function(E){var S=E;return S+=65,S+=25-E>>>8&6,S+=51-E>>>8&-75,S+=61-E>>>8&-15,S+=62-E>>>8&3,String.fromCharCode(S)},j.prototype._decodeChar=function(E){var S=p;return S+=(42-E&E-44)>>>8&-p+E-43+62,S+=(46-E&E-48)>>>8&-p+E-47+63,S+=(47-E&E-58)>>>8&-p+E-48+52,S+=(64-E&E-91)>>>8&-p+E-65+0,S+=(96-E&E-123)>>>8&-p+E-97+26,S},j.prototype._getPaddingLength=function(E){var S=0;if(this._paddingCharacter){for(var P=E.length-1;P>=0&&E[P]===this._paddingCharacter;P--)S++;if(E.length<4||S>2)throw new Error("Base64Coder: incorrect padding")}return S},j})();d.Coder=h;var m=new h;function g(j){return m.encode(j)}d.encode=g;function k(j){return m.decode(j)}d.decode=k;var v=(function(j){u(E,j);function E(){return j!==null&&j.apply(this,arguments)||this}return E.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)},E.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},E})(h);d.URLSafeCoder=v;var T=new v;function Z(j){return T.encode(j)}d.encodeURLSafe=Z;function Q(j){return T.decode(j)}d.decodeURLSafe=Q,d.encodedLength=function(j){return m.encodedLength(j)},d.maxDecodedLength=function(j){return m.maxDecodedLength(j)},d.decodedLength=function(j){return m.decodedLength(j)}},978(a,d){var u="utf8: invalid source encoding";function p(h){for(var m=[],g=0;g<h.length;g++){var k=h[g];if(k&128){var v=void 0;if(k<224){if(g>=h.length)throw new Error(u);var T=h[++g];if((T&192)!==128)throw new Error(u);k=(k&31)<<6|T&63,v=128}else if(k<240){if(g>=h.length-1)throw new Error(u);var T=h[++g],Z=h[++g];if((T&192)!==128||(Z&192)!==128)throw new Error(u);k=(k&15)<<12|(T&63)<<6|Z&63,v=2048}else if(k<248){if(g>=h.length-2)throw new Error(u);var T=h[++g],Z=h[++g],Q=h[++g];if((T&192)!==128||(Z&192)!==128||(Q&192)!==128)throw new Error(u);k=(k&15)<<18|(T&63)<<12|(Z&63)<<6|Q&63,v=65536}else throw new Error(u);if(k<v||k>=55296&&k<=57343)throw new Error(u);if(k>=65536){if(k>1114111)throw new Error(u);k-=65536,m.push(String.fromCharCode(55296|k>>10)),k=56320|k&1023}}m.push(String.fromCharCode(k))}return m.join("")}d.D4=p},721(a,d,u){a.exports=u(207).default},207(a,d,u){u.d(d,{default:()=>is});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"),m={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 g=m;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 te=function(Le){Le||x.cleanup()},re=0;re<B.length;re++)B[re](O,te)}});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 v=new p("_pusher_dependencies","Pusher.DependenciesReceivers"),T=new k({cdn_http:g.cdn_http,cdn_https:g.cdn_https,version:g.VERSION,suffix:g.dependency_suffix,receivers:v});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"}}},j={buildLogSuffix:function(l){const s="See:",c=Z.urls[l];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=Z.baseUrl+c.path),f?`${s} ${f}`:""}};var E;(function(l){l.UserAuthentication="user-authentication",l.ChannelAuthorization="channel-authorization"})(E||(E={}));class 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 q 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 xe extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Pe extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class lt extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class ee extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class $e extends Error{constructor(s,c){super(c),this.status=s,Object.setPrototypeOf(this,new.target.prototype)}}const Nt=function(l,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(te){b(new $e(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 E.UserAuthentication:O=j.buildLogSuffix("authenticationEndpoint");break;case E.ChannelAuthorization:O=`Clients must be authorized to join private or presence channels. ${j.buildLogSuffix("authorizationEndpoint")}`;break}b(new $e(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(l){return le(Yt(l))}var xt=String.fromCharCode,Wt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Jt=function(l){var s=l.charCodeAt(0);return s<128?l:s<2048?xt(192|s>>>6)+xt(128|s&63):xt(224|s>>>12&15)+xt(128|s>>>6&63)+xt(128|s&63)},Yt=function(l){return l.replace(/[^\x00-\x7F]/g,Jt)},Vt=function(l){var s=[0,2,1][l.length%3],c=l.charCodeAt(0)<<16|(l.length>1?l.charCodeAt(1):0)<<8|(l.length>2?l.charCodeAt(2):0),f=[Wt.charAt(c>>>18),Wt.charAt(c>>>12&63),s>=2?"=":Wt.charAt(c>>>6&63),s>=1?"=":Wt.charAt(c&63)];return f.join("")},le=window.btoa||function(l){return l.replace(/[\s\S]{1,3}/g,Vt)};class zn{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 we=zn;function $n(l){window.clearTimeout(l)}function N(l){window.clearInterval(l)}class X extends we{constructor(s,c){super(setTimeout,$n,s,function(f){return c(),null})}}class Ee extends we{constructor(s,c){super(setInterval,N,s,function(f){return c(),f})}}var Oe={now(){return Date.now?Date.now():new Date().valueOf()},defer(l){return new X(0,l)},method(l,...s){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[l].apply(f,c.concat(arguments))}}};const ue=Oe;function de(l,...s){for(var c=0;c<s.length;c++){var f=s[c];for(var b in f)f[b]&&f[b].constructor&&f[b].constructor===Object?l[b]=de(l[b]||{},f[b]):l[b]=f[b]}return l}function On(){for(var l=["Pusher"],s=0;s<arguments.length;s++)typeof arguments[s]=="string"?l.push(arguments[s]):l.push(tt(arguments[s]));return l.join(" : ")}function gn(l,s){var c=Array.prototype.indexOf;if(l===null)return-1;if(c&&l.indexOf===c)return l.indexOf(s);for(var f=0,b=l.length;f<b;f++)if(l[f]===s)return f;return-1}function pe(l,s){for(var c in l)Object.prototype.hasOwnProperty.call(l,c)&&s(l[c],c,l)}function je(l){var s=[];return pe(l,function(c,f){s.push(f)}),s}function Re(l){var s=[];return pe(l,function(c){s.push(c)}),s}function Ne(l,s,c){for(var f=0;f<l.length;f++)s.call(c||window,l[f],f,l)}function mn(l,s){for(var c=[],f=0;f<l.length;f++)c.push(s(l[f],f,l,c));return c}function Ue(l,s){var c={};return pe(l,function(f,b){c[b]=s(f)}),c}function st(l,s){s=s||function(b){return!!b};for(var c=[],f=0;f<l.length;f++)s(l[f],f,l,c)&&c.push(l[f]);return c}function Dt(l,s){var c={};return pe(l,function(f,b){(s&&s(f,b,l,c)||f)&&(c[b]=f)}),c}function Xt(l){var s=[];return pe(l,function(c,f){s.push([f,c])}),s}function Dr(l,s){for(var c=0;c<l.length;c++)if(s(l[c],c,l))return!0;return!1}function ui(l,s){for(var c=0;c<l.length;c++)if(!s(l[c],c,l))return!1;return!0}function Mr(l){return Ue(l,function(s){return typeof s=="object"&&(s=tt(s)),encodeURIComponent(fn(s.toString()))})}function Nn(l){var s=Dt(l,function(f){return f!==void 0}),c=mn(Xt(Mr(s)),ue.method("join","=")).join("&");return c}function bn(l){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}})(l,"$")}function tt(l){try{return JSON.stringify(l)}catch(s){return JSON.stringify(bn(l))}}class jr{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=On.apply(this,arguments);is.log?is.log(f):is.logToConsole&&s.bind(this)(f)}}const he=new jr;var Wo=function(l,s,c,f,b){(c.headers!==void 0||c.headersProvider!=null)&&he.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var x=l.nextAuthCallbackID.toString();l.nextAuthCallbackID++;var R=l.getDocument(),O=R.createElement("script");l.auth_callbacks[x]=function(re){b(null,re)};var B="Pusher.auth_callbacks['"+x+"']";O.src=c.endpoint+"?callback="+encodeURIComponent(B)+"&"+s;var te=R.getElementsByTagName("head")[0]||R.documentElement;te.insertBefore(O,te.firstChild)};const Ur=Wo;class Jo{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 dr{constructor(s,c){this.url=s,this.data=c}send(s){if(!this.request){var c=Nn(this.data),f=this.url+"/"+s.number+"?"+c;this.request=G.createScriptRequest(f),this.request.send(s)}}cleanup(){this.request&&this.request.cleanup()}}var pr=function(l,s){return function(c,f){var b="http"+(s?"s":"")+"://",x=b+(l.host||l.options.host)+l.options.path,R=G.createJSONPRequest(x,c),O=G.ScriptReceivers.create(function(B,te){h.remove(O),R.cleanup(),te&&te.host&&(l.host=te.host),f&&f(B,te)});R.send(O)}},St={name:"jsonp",getAgent:pr};const kn=St;function Dn(l,s,c){var f=l+(s.useTLS?"s":""),b=s.useTLS?s.hostTLS:s.hostNonTLS;return f+"://"+b+c}function Mn(l,s){var c="/app/"+l,f="?protocol="+g.PROTOCOL+"&client=js&version="+g.VERSION+(s?"&"+s:"");return c+f}var di={getInitial:function(l,s){var c=(s.httpPath||"")+Mn(l,"flash=false");return Dn("ws",s,c)}},hr={getInitial:function(l,s){var c=(s.httpPath||"/pusher")+Mn(l);return Dn("http",s,c)}},fr={getInitial:function(l,s){return Dn("http",s,s.httpPath||"/pusher")},getPath:function(l,s){return Mn(l)}};class pi{constructor(){this._callbacks={}}get(s){return this._callbacks[Kt(s)]}add(s,c,f){var b=Kt(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?[Kt(s)]:je(this._callbacks);c||f?this.removeCallback(b,c,f):this.removeAllCallbacks(b)}removeCallback(s,c,f){Ne(s,function(b){this._callbacks[b]=st(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){Ne(s,function(c){delete this._callbacks[c]},this)}}function Kt(l){return"_"+l}class Tt{constructor(s){this.callbacks=new pi,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=st(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 hi extends Tt{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 ue.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),he.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"?(ue.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 de({cid:this.id},s)}}class fe{constructor(s){this.hooks=s}isSupported(s){return this.hooks.isSupported(s)}createConnection(s,c,f,b){return new hi(this.hooks,s,c,f,b)}}var _n=new fe({urls:di,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!G.getWebSocketAPI()},isSupported:function(){return!!G.getWebSocketAPI()},getSocket:function(l){return G.createWebSocket(l)}}),Yo={urls:hr,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Zr=de({getSocket:function(l){return G.HTTPFactory.createStreamingSocket(l)}},Yo),gr=de({getSocket:function(l){return G.HTTPFactory.createPollingSocket(l)}},Yo),qr={isSupported:function(){return G.isXHRSupported()}},Vo=new fe(de({},Zr,qr)),fi=new fe(de({},gr,qr)),mt={ws:_n,xhr_streaming:Vo,xhr_polling:fi};const bt=mt;var Xo=new fe({file:"sockjs",urls:fr,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(l,s){return new window.SockJS(l,null,{js_path:T.getPath("sockjs",{useTLS:s.useTLS}),ignore_null_origin:s.ignoreNullOrigin})},beforeOpen:function(l,s){l.send(JSON.stringify({path:s}))}}),Hr={isSupported:function(l){var s=G.isXDRSupported(l.useTLS);return s}},Fr=new fe(de({},Zr,Hr)),Ko=new fe(de({},gr,Hr));bt.xdr_streaming=Fr,bt.xdr_polling=Ko,bt.sockjs=Xo;const Et=bt;class Qo extends Tt{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 es=new Qo;class ts{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=de({},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=ue.now()},B=te=>{if(x.unbind("closed",B),te.code===1002||te.code===1003)this.manager.reportDeath();else if(!te.wasClean&&R){var re=ue.now()-R;re<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(re/2,this.minPingDelay))}};return x.bind("open",O),x}isSupported(s){return this.manager.isAlive()&&this.transport.isSupported(s)}}const Br={decodeMessage:function(l){try{var s=JSON.parse(l.data),c=s.data;if(typeof c=="string")try{c=JSON.parse(s.data)}catch(b){}var f={event:s.event,channel:s.channel,data:c};return s.user_id&&(f.user_id=s.user_id),f}catch(b){throw{type:"MessageParseError",error:b,data:l.data}}},encodeMessage:function(l){return JSON.stringify(l)},processHandshake:function(l){var s=Br.decodeMessage(l);if(s.event==="pusher:connection_established"){if(!s.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:s.data.socket_id,activityTimeout:s.data.activity_timeout*1e3}}else{if(s.event==="pusher:error")return{action:this.getCloseAction(s.data),error:this.getCloseError(s.data)};throw"Invalid handshake"}},getCloseAction:function(l){return l.code<4e3?l.code>=1002&&l.code<=1004?"backoff":null:l.code===4e3?"tls_only":l.code<4100?"refused":l.code<4200?"backoff":l.code<4300?"retry":"refused"},getCloseError:function(l){return l.code!==1e3&&l.code!==1001?{type:"PusherError",data:{code:l.code,message:l.reason||l.message}}:null}},Qt=Br;class U extends Tt{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),he.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(he.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=()=>{pe(s,(f,b)=>{this.transport.unbind(b,f)})};pe(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 U(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(de({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 z extends Tt{constructor(s,c){super(function(f,b){he.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=j.buildLogSuffix("triggeringClientEvents");he.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,he.error(s.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:s.message},s instanceof $e?{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 ae extends z{authorize(s,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:s},c)}}class Ze{constructor(){this.reset()}get(s){return Object.prototype.hasOwnProperty.call(this.members,s)?{id:s,info:this.members[s]}:null}each(s){pe(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 Se=function(l,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(re){try{te(f.next(re))}catch(Le){R(Le)}}function B(re){try{te(f.throw(re))}catch(Le){R(Le)}}function te(re){re.done?x(re.value):b(re.value).then(O,B)}te((f=f.apply(l,s||[])).next())})};class We extends ae{constructor(s,c){super(s,c),this.members=new Ze}authorize(s,c){super.authorize(s,(f,b)=>Se(this,void 0,void 0,function*(){if(!f)if(b=b,b.channel_data!=null){var x=JSON.parse(b.channel_data);this.members.setMyID(x.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let R=j.buildLogSuffix("authorizationEndpoint");he.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 At=u(978),Mt=u(594);class Gr extends ae{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,Mt.decode)(x),delete b.shared_secret,c(null,b)})}trigger(s,c){throw new Pe("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){he.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){he.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let f=(0,Mt.decode)(c.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){he.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let b=(0,Mt.decode)(c.nonce);if(b.length<this.nacl.secretbox.nonceLength){he.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){he.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){he.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){he.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,At.D4)(s);try{return JSON.parse(c)}catch(f){return c}}}class De extends Tt{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 X(s||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new X(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new X(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 X(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(s){return de({},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 de({},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),he.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 ns{constructor(){this.channels={}}add(s,c){return this.channels[s]||(this.channels[s]=rs(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(){pe(this.channels,function(s){s.disconnect()})}}function rs(l,s){if(l.indexOf("private-encrypted-")===0){if(s.config.nacl)return en.createEncryptedChannel(l,s,s.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=j.buildLogSuffix("encryptedChannelSupport");throw new Pe(`${c}. ${f}`)}else{if(l.indexOf("private-")===0)return en.createPrivateChannel(l,s);if(l.indexOf("presence-")===0)return en.createPresenceChannel(l,s);if(l.indexOf("#")===0)throw new P('Cannot create a channel with name "'+l+'".');return en.createChannel(l,s)}}var sk={createChannels(){return new ns},createConnectionManager(l,s){return new De(l,s)},createChannel(l,s){return new z(l,s)},createPrivateChannel(l,s){return new ae(l,s)},createPresenceChannel(l,s){return new We(l,s)},createEncryptedChannel(l,s,c){return new Gr(l,s,c)},createTimelineSender(l,s){return new A(l,s)},createHandshake(l,s){return new _(l,s)},createAssistantToTheTransportManager(l,s,c){return new ts(l,s,c)}};const en=sk;class Tl{constructor(s){this.options=s||{},this.livesLeft=this.options.lives||1/0}getAssistant(s){return en.createAssistantToTheTransportManager(this,s,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class jn{constructor(s,c){this.strategies=s,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return Dr(this.strategies,ue.method("isSupported"))}connect(s,c){var f=this.strategies,b=0,x=this.timeout,R=null,O=(B,te)=>{te?c(null,te):(b=b+1,this.loop&&(b=b%f.length),b<f.length?(x&&(x=x*2,this.timeoutLimit&&(x=Math.min(x,this.timeoutLimit))),R=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},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 X(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 gi{constructor(s){this.strategies=s}isSupported(){return Dr(this.strategies,ue.method("isSupported"))}connect(s,c){return ik(this.strategies,s,function(f,b){return function(x,R){if(b[f].error=x,x){ak(b)&&c(!0);return}Ne(b,function(O){O.forceMinPriority(R.transport.priority)}),c(null,R)}})}}function ik(l,s,c){var f=mn(l,function(b,x,R,O){return b.connect(s,c(x,O))});return{abort:function(){Ne(f,ck)},forceMinPriority:function(b){Ne(f,function(x){x.forceMinPriority(b)})}}}function ak(l){return ui(l,function(s){return!!s.error})}function ck(l){!l.error&&!l.aborted&&(l.abort(),l.aborted=!0)}class lk{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=uk(f),x=b&&b.cacheSkipCount?b.cacheSkipCount:0,R=[this.strategy];if(b&&b.timestamp+this.ttl>=ue.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 jn([O],{timeout:b.latency*2+1e3,failFast:!0}))):x++)}var B=ue.now(),te=R.pop().connect(s,function re(Le,as){Le?(El(f),R.length>0?(B=ue.now(),te=R.pop().connect(s,re)):c(Le)):(dk(f,as.transport.name,ue.now()-B,x),c(null,as))});return{abort:function(){te.abort()},forceMinPriority:function(re){s=re,te&&te.forceMinPriority(re)}}}}function mi(l){return"pusherTransport"+(l?"TLS":"NonTLS")}function uk(l){var s=G.getLocalStorage();if(s)try{var c=s[mi(l)];if(c)return JSON.parse(c)}catch(f){El(l)}return null}function dk(l,s,c,f){var b=G.getLocalStorage();if(b)try{b[mi(l)]=tt({timestamp:ue.now(),transport:s,latency:c,cacheSkipCount:f})}catch(x){}}function El(l){var s=G.getLocalStorage();if(s)try{delete s[mi(l)]}catch(c){}}class os{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 X(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 Wr{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 pk{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 Jr(l){return function(){return l.isSupported()}}var hk=function(l,s,c){var f={};function b(jl,u_,d_,p_,h_){var Ul=c(l,jl,u_,d_,p_,h_);return f[jl]=Ul,Ul}var x=Object.assign({},s,{hostNonTLS:l.wsHost+":"+l.wsPort,hostTLS:l.wsHost+":"+l.wssPort,httpPath:l.wsPath}),R=Object.assign({},x,{useTLS:!0}),O=Object.assign({},s,{hostNonTLS:l.httpHost+":"+l.httpPort,hostTLS:l.httpHost+":"+l.httpsPort,httpPath:l.httpPath}),B={loop:!0,timeout:15e3,timeoutLimit:6e4},te=new Tl({minPingDelay:1e4,maxPingDelay:l.activityTimeout}),re=new Tl({lives:2,minPingDelay:1e4,maxPingDelay:l.activityTimeout}),Le=b("ws","ws",3,x,te),as=b("wss","ws",3,R,te),s_=b("sockjs","sockjs",1,O),zl=b("xhr_streaming","xhr_streaming",1,O,re),i_=b("xdr_streaming","xdr_streaming",1,O,re),$l=b("xhr_polling","xhr_polling",1,O),a_=b("xdr_polling","xdr_polling",1,O),Ol=new jn([Le],B),c_=new jn([as],B),l_=new jn([s_],B),Nl=new jn([new Wr(Jr(zl),zl,i_)],B),Dl=new jn([new Wr(Jr($l),$l,a_)],B),Ml=new jn([new Wr(Jr(Nl),new gi([Nl,new os(Dl,{delay:4e3})]),Dl)],B),_i=new Wr(Jr(Ml),Ml,l_),vi;return s.useTLS?vi=new gi([Ol,new os(_i,{delay:2e3})]):vi=new gi([Ol,new os(c_,{delay:2e3}),new os(_i,{delay:5e3})]),new lk(new pk(new Wr(Jr(Le),vi,_i)),f,{ttl:18e5,timeline:s.timeline,useTLS:s.useTLS})};const fk=hk;function gk(){var l=this;l.timeline.info(l.buildTimelineMessage({transport:l.name+(l.options.useTLS?"s":"")})),l.hooks.isInitialized()?l.changeState("initialized"):l.hooks.file?(l.changeState("initializing"),T.load(l.hooks.file,{useTLS:l.options.useTLS},function(s,c){l.hooks.isInitialized()?(l.changeState("initialized"),c(!0)):(s&&l.onError(s),l.onClose(),c(!1))})):l.onClose()}var mk={getRequest:function(l){var s=new window.XDomainRequest;return s.ontimeout=function(){l.emit("error",new q),l.close()},s.onerror=function(c){l.emit("error",c),l.close()},s.onprogress=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText)},s.onload=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText),l.emit("finished",200),l.close()},s},abortRequest:function(l){l.ontimeout=l.onerror=l.onprogress=l.onload=null,l.abort()}};const bk=mk,kk=256*1024;class _k extends Tt{constructor(s,c,f){super(),this.hooks=s,this.method=c,this.url=f}start(s){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},G.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(s)}close(){this.unloader&&(G.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(s,c){for(;;){var f=this.advanceBuffer(c);if(f)this.emit("chunk",{status:s,data:f});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(s){var c=s.slice(this.position),f=c.indexOf(`
|
|
1518
|
+
`);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(s){return this.position===s.length&&s.length>kk}}var bi;(function(l){l[l.CONNECTING=0]="CONNECTING",l[l.OPEN=1]="OPEN",l[l.CLOSED=3]="CLOSED"})(bi||(bi={}));const Un=bi;var vk=1;class yk{constructor(s,c){this.hooks=s,this.session=Cl(1e3)+"/"+Tk(8),this.location=wk(c),this.readyState=Un.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===Un.OPEN)try{return G.createSocketRequest("POST",Al(xk(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=Un.CLOSED,this.onclose&&this.onclose({code:s,reason:c,wasClean:f})}onChunk(s){if(s.status===200){this.readyState===Un.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===Un.CONNECTING?(s&&s.hostname&&(this.location.base=Sk(this.location.base,s.hostname)),this.readyState=Un.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(s){this.readyState===Un.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",Al(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){ue.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 wk(l){var s=/([^\?]*)\/*(\??.*)/.exec(l);return{base:s[1],queryString:s[2]}}function xk(l,s){return l.base+"/"+s+"/xhr_send"}function Al(l){var s=l.indexOf("?")===-1?"?":"&";return l+s+"t="+ +new Date+"&n="+vk++}function Sk(l,s){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(l);return c[1]+s+c[3]}function Cl(l){return G.randomInt(l)}function Tk(l){for(var s=[],c=0;c<l;c++)s.push(Cl(32).toString(32));return s.join("")}const Ek=yk;var Ak={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr_streaming"+l.queryString},onHeartbeat:function(l){l.sendRaw("[]")},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const Ck=Ak;var Pk={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr"+l.queryString},onHeartbeat:function(){},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){s===200?l.reconnect():l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const Rk=Pk;var Lk={getRequest:function(l){var s=G.getXHRAPI(),c=new s;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText),l.emit("finished",c.status),l.close();break}},c},abortRequest:function(l){l.onreadystatechange=null,l.abort()}};const Ik=Lk;var zk={createStreamingSocket(l){return this.createSocket(Ck,l)},createPollingSocket(l){return this.createSocket(Rk,l)},createSocket(l,s){return new Ek(l,s)},createXHR(l,s){return this.createRequest(Ik,l,s)},createRequest(l,s,c){return new _k(l,s,c)}};const Pl=zk;Pl.createXDR=function(l,s){return this.createRequest(bk,l,s)};var $k={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:v,getDefaultStrategy:fk,Transports:Et,transportConnectionInitializer:gk,HTTPFactory:Pl,TimelineTransport:kn,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(l){window.Pusher=l;var s=()=>{this.onDocumentBody(l.ready)};window.JSON?s():T.load("json2",{},s)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:Nt,jsonp:Ur}},onDocumentBody(l){document.body?l():setTimeout(()=>{this.onDocumentBody(l)},0)},createJSONPRequest(l,s){return new dr(l,s)},createScriptRequest(l){return new Jo(l)},getLocalStorage(){try{return window.localStorage}catch(l){return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var l=this.getXHRAPI();return new l},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return es},createWebSocket(l){var s=this.getWebSocketAPI();return new s(l)},createSocketRequest(l,s){if(this.isXHRSupported())return this.HTTPFactory.createXHR(l,s);if(this.isXDRSupported(s.indexOf("https:")===0))return this.HTTPFactory.createXDR(l,s);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var l=this.getXHRAPI();return!!l&&new l().withCredentials!==void 0},isXDRSupported(l){var s=l?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===s},addUnloadListener(l){window.addEventListener!==void 0?window.addEventListener("unload",l,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",l)},removeUnloadListener(l){window.addEventListener!==void 0?window.removeEventListener("unload",l,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",l)},randomInt(l){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*l)}};const G=$k;var ki;(function(l){l[l.ERROR=3]="ERROR",l[l.INFO=6]="INFO",l[l.DEBUG=7]="DEBUG"})(ki||(ki={}));const ss=ki;class Ok{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(de({},c,{timestamp:ue.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(s){this.log(ss.ERROR,s)}info(s){this.log(ss.INFO,s)}debug(s){this.log(ss.DEBUG,s)}isEmpty(){return this.events.length===0}send(s,c){var f=de({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 Nk{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 Rl(new Y,c)}else return Rl(new ee,c);var f=!1,b=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),x=null,R=function(){b.unbind("initialized",R),b.connect()},O=function(){x=en.createHandshake(b,function(Le){f=!0,re(),c(null,Le)})},B=function(Le){re(),c(Le)},te=function(){re();var Le;Le=tt(b),c(new xe(Le))},re=function(){b.unbind("initialized",R),b.unbind("open",O),b.unbind("error",B),b.unbind("closed",te)};return b.bind("initialized",R),b.bind("open",O),b.bind("error",B),b.bind("closed",te),b.initialize(),{abort:()=>{f||(re(),x?x.close():b.close())},forceMinPriority:Le=>{f||this.priority<Le&&(x?x.close():b.close())}}}}function Rl(l,s){return ue.defer(function(){s(l)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Dk}=G;var Mk=function(l,s,c,f,b,x){var R=Dk[c];if(!R)throw new lt(c);var O=(!l.enabledTransports||gn(l.enabledTransports,s)!==-1)&&(!l.disabledTransports||gn(l.disabledTransports,s)===-1),B;return O?(b=Object.assign({ignoreNullOrigin:l.ignoreNullOrigin},b),B=new Nk(s,f,x?x.getAssistant(R):R,b)):B=jk,B},jk={isSupported:function(){return!1},connect:function(l,s){var c=ue.defer(function(){s(new ee)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function Uk(l){if(l==null)throw"You must pass an options object";if(l.cluster==null)throw"Options object must provide a cluster";"disableStats"in l&&he.warn("The disableStats option is deprecated in favor of enableStats")}const Zk=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},qk=l=>{if(typeof G.getAuthorizers()[l.transport]=="undefined")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=Zk(s,l);G.getAuthorizers()[l.transport](G,f,l,E.UserAuthentication,c)}},Hk=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);c+="&channel_name="+encodeURIComponent(l.channelName);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},Fk=l=>{if(typeof G.getAuthorizers()[l.transport]=="undefined")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=Hk(s,l);G.getAuthorizers()[l.transport](G,f,l,E.ChannelAuthorization,c)}},Bk=(l,s,c)=>{const f={authTransport:s.transport,authEndpoint:s.endpoint,auth:{params:s.params,headers:s.headers}};return(b,x)=>{const R=l.channel(b.channelName);c(R,f).authorize(b.socketId,x)}};function Ll(l,s){let c={activityTimeout:l.activityTimeout||g.activityTimeout,cluster:l.cluster,httpPath:l.httpPath||g.httpPath,httpPort:l.httpPort||g.httpPort,httpsPort:l.httpsPort||g.httpsPort,pongTimeout:l.pongTimeout||g.pongTimeout,statsHost:l.statsHost||g.stats_host,unavailableTimeout:l.unavailableTimeout||g.unavailableTimeout,wsPath:l.wsPath||g.wsPath,wsPort:l.wsPort||g.wsPort,wssPort:l.wssPort||g.wssPort,enableStats:Vk(l),httpHost:Gk(l),useTLS:Yk(l),wsHost:Wk(l),userAuthenticator:Xk(l),channelAuthorizer:Qk(l,s)};return"disabledTransports"in l&&(c.disabledTransports=l.disabledTransports),"enabledTransports"in l&&(c.enabledTransports=l.enabledTransports),"ignoreNullOrigin"in l&&(c.ignoreNullOrigin=l.ignoreNullOrigin),"timelineParams"in l&&(c.timelineParams=l.timelineParams),"nacl"in l&&(c.nacl=l.nacl),c}function Gk(l){return l.httpHost?l.httpHost:l.cluster?`sockjs-${l.cluster}.pusher.com`:g.httpHost}function Wk(l){return l.wsHost?l.wsHost:Jk(l.cluster)}function Jk(l){return`ws-${l}.pusher.com`}function Yk(l){return G.getProtocol()==="https:"?!0:l.forceTLS!==!1}function Vk(l){return"enableStats"in l?l.enableStats:"disableStats"in l?!l.disableStats:!1}const Il=l=>"customHandler"in l&&l.customHandler!=null;function Xk(l){const s=Object.assign(Object.assign({},g.userAuthentication),l.userAuthentication);return Il(s)?s.customHandler:qk(s)}function Kk(l,s){let c;if("channelAuthorization"in l)c=Object.assign(Object.assign({},g.channelAuthorization),l.channelAuthorization);else if(c={transport:l.authTransport||g.authTransport,endpoint:l.authEndpoint||g.authEndpoint},"auth"in l&&("params"in l.auth&&(c.params=l.auth.params),"headers"in l.auth&&(c.headers=l.auth.headers)),"authorizer"in l)return{customHandler:Bk(s,c,l.authorizer)};return c}function Qk(l,s){const c=Kk(l,s);return Il(c)?c.customHandler:Fk(c)}class e_ extends Tt{constructor(s){super(function(c,f){he.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 t_(){let l,s;return{promise:new Promise((f,b)=>{l=f,s=b}),resolve:l,reject:s}}const n_=t_;class r_ extends Tt{constructor(s){super(function(c,f){he.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){he.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 e_(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){he.error(`Failed parsing user data after signin: ${s.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){he.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const s=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new z(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((c,f)=>{c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0||this.emit(c,f)}),s(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:s,resolve:c}=n_();s.done=!1;const f=()=>{s.done=!0};s.then(f).catch(f),this.signinDonePromise=s,this._signinDoneResolve=c}}class Be{static ready(){Be.isReady=!0;for(var s=0,c=Be.instances.length;s<c;s++)Be.instances[s].connect()}static getClientFeatures(){return je(Dt({ws:G.Transports.ws},function(s){return s.isSupported({})}))}constructor(s,c){o_(s),Uk(c),this.key=s,this.options=c,this.config=Ll(this.options,this),this.channels=en.createChannels(),this.global_emitter=new Tt,this.sessionID=G.randomInt(1e9),this.timeline=new Ok(this.key,this.sessionID,{cluster:this.config.cluster,features:Be.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:ss.INFO,version:g.VERSION}),this.config.enableStats&&(this.timelineSender=en.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+G.TimelineTransport.name}));var f=b=>G.getDefaultStrategy(this.config,b,Mk);this.connection=en.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=>{he.warn(b)}),Be.instances.push(this),this.timeline.info({instances:Be.instances.length}),this.user=new r_(this),Be.isReady&&this.connect()}switchCluster(s){const{appKey:c,cluster:f}=s;this.key=c,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=Ll(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 Ee(6e4,function(){c.send(s)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(s,c,f){return this.global_emitter.bind(s,c,f),this}unbind(s,c,f){return this.global_emitter.unbind(s,c,f),this}bind_global(s){return this.global_emitter.bind_global(s),this}unbind_global(s){return this.global_emitter.unbind_global(s),this}unbind_all(s){return this.global_emitter.unbind_all(),this}subscribeAll(){var s;for(s in this.channels.channels)this.channels.channels.hasOwnProperty(s)&&this.subscribe(s)}subscribe(s){var c=this.channels.add(s,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(s){var c=this.channels.find(s);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(s),c&&c.subscribed&&c.unsubscribe())}send_event(s,c,f){return this.connection.send_event(s,c,f)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}Be.instances=[],Be.isReady=!1,Be.logToConsole=!1,Be.Runtime=G,Be.ScriptReceivers=G.ScriptReceivers,Be.DependenciesReceivers=G.DependenciesReceivers,Be.auth_callbacks=G.auth_callbacks;const is=Be;function o_(l){if(l==null)throw"You must pass your app key when you instantiate Pusher."}G.setup(Be)}},r={};function o(a){var d=r[a];if(d!==void 0)return d.exports;var u=r[a]={exports:{}};return n[a].call(u.exports,u,u.exports,o),u.exports}o.d=(a,d)=>{for(var u in d)o.o(d,u)&&!o.o(a,u)&&Object.defineProperty(a,u,{enumerable:!0,get:d[u]})},o.o=(a,d)=>Object.prototype.hasOwnProperty.call(a,d);var i=o(721);return i})())})(Es)),Es.exports}var mg=gg();const bg=fg(mg);let kt=null,Xn=null;function kg(e){return I(this,null,function*(){return Xn||(Xn=I(null,null,function*(){const t=e.backendUrl.replace(/\/+$/,""),n=yield fo(`${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();kt=new bg(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)=>{fo(`${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))}}})}),Xn.catch(()=>{Xn=null}),Xn)})}function _g(e){if(!e||!kt)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return kt.connection.bind("state_change",n),()=>kt==null?void 0:kt.connection.unbind("state_change",n)}function vg(e,t,n){return I(this,null,function*(){if(yield kg(e),!kt)return()=>{};const r=kt.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(no.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(no.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(no.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(no.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=_g(n.onReconnect);return()=>{r.unbind_all(),kt==null||kt.unsubscribe(`private-task-${t}`),o==null||o()}})}const As="ap-sdk-active-automation";function yg(){try{const e=sessionStorage.getItem(As);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 Va(e){try{sessionStorage.setItem(As,JSON.stringify(e))}catch(t){}}function Xa(){try{sessionStorage.removeItem(As)}catch(e){}}function wg(e){return I(this,null,function*(){var i;try{(i=e.focus)==null||i.call(e)}catch(a){}e.scrollIntoView({block:"center",inline:"center",behavior:"instant"});let t=e.getBoundingClientRect();t.width===0&&t.height===0&&(yield xg(),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 xg(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const Cs="shared",Ka="ap-sdk-panel-size:",Qa=280,ec=200;function Sg(e){try{const t=sessionStorage.getItem(Ka+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 Tg(e,t){try{sessionStorage.setItem(Ka+e,JSON.stringify(t))}catch(n){}}function mo(e,t,n){return Math.min(Math.max(e,t),n)}function tc(){return window.innerWidth-32}function nc(){return window.innerHeight-64}function Ps(e,t){const n=Sg(t);n&&(e.style.width=`${mo(n.width,Qa,tc())}px`,e.style.height=`${mo(n.height,ec,nc())}px`);const r=document.createElement("div");r.className="ap-sdk-resize-handle",r.setAttribute("data-ap-sdk","1"),e.appendChild(r);let o=!1,i=0,a=0,d=0,u=0,p=0,h=0;const m=k=>{o&&(p=mo(d+(k.clientX-i),Qa,tc()),h=mo(u+(k.clientY-a),ec,nc()),e.style.width=`${p}px`,e.style.height=`${h}px`)},g=()=>{o&&(o=!1,document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",g),Tg(t,{width:p,height:h}))};r.addEventListener("pointerdown",k=>{k.preventDefault(),k.stopPropagation(),o=!0,i=k.clientX,a=k.clientY;const v=e.getBoundingClientRect();d=v.width,u=v.height,p=d,h=u,document.addEventListener("pointermove",m),document.addEventListener("pointerup",g)})}function Rs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var wn=Rs();function rc(e){wn=e}var xn={exec:()=>null};function Kn(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 Eg=((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:Kn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Kn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Kn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Kn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Kn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Kn(e=>new RegExp(`^ {0,${e}}>`))},Ag=/^(?:[ \t]*(?:\n|$))+/,Cg=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Pg=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,wr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Rg=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ls=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,oc=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,sc=V(oc).replace(/bull/g,Ls).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(),Lg=V(oc).replace(/bull/g,Ls).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(),Is=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Ig=/^[^\n]+/,zs=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,zg=V(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",zs).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),$g=V(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ls).getRegex(),bo="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",$s=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Og=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",$s).replace("tag",bo).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ic=e=>V(Is).replace("hr",wr).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",bo).getRegex(),Ng=ic(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Dg=ic(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Mg=V(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Dg).getRegex(),Os={blockquote:Mg,code:Cg,def:zg,fences:Pg,heading:Rg,hr:wr,html:Og,lheading:sc,list:$g,newline:Ag,paragraph:Ng,table:xn,text:Ig},ac=V("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",wr).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",bo).getRegex(),jg=D(y({},Os),{lheading:Lg,table:ac,paragraph:V(Is).replace("hr",wr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ac).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",bo).getRegex()}),Ug=D(y({},Os),{html:V(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",$s).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(Is).replace("hr",wr).replace("heading",` *#{1,6} *[^
|
|
1519
|
+
]`).replace("lheading",sc).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),Zg=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,qg=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,cc=/^( {2,}|\\)\n(?!\s*$)/,Hg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Zt=/[\p{P}\p{S}]/u,Qn=/[\s\p{P}\p{S}]/u,xr=/[^\s\p{P}\p{S}]/u,Fg=V(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Qn).getRegex(),Bg=/[\p{Pi}\p{Ps}"']/u,lc=/(?!~)[\p{P}\p{S}]/u,Gg=/(?!~)[\s\p{P}\p{S}]/u,Wg=/(?:[^\s\p{P}\p{S}]|~)/u,Jg=V(/link|precode-code|html/,"g").replace("link",new RegExp("\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)")).replace("precode-",Eg?"(?<!`)()":"(^^|[^`])").replace("code",new RegExp("(?<b>`+)[^`]+\\k<b>(?!`)")).replace("html",/<(?! )[^<>]*?>/).getRegex(),uc=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Yg=V(uc,"u").replace(/punct/g,Zt).getRegex(),Vg=V(uc,"u").replace(/punct/g,lc).getRegex(),Xg=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Kg=V(Xg,"u").replace(/openQuote/g,Bg).replace(/punct/g,Zt).getRegex(),dc="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Qg=V(dc,"gu").replace(/notPunctSpace/g,xr).replace(/punctSpace/g,Qn).replace(/punct/g,Zt).getRegex(),em=V(dc,"gu").replace(/notPunctSpace/g,Wg).replace(/punctSpace/g,Gg).replace(/punct/g,lc).getRegex(),tm="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",nm=V(tm,"gu").replace(/notPunctSpace/g,xr).replace(/punctSpace/g,Qn).replace(/punct/g,Zt).getRegex(),rm=V("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,xr).replace(/punctSpace/g,Qn).replace(/punct/g,Zt).getRegex(),om="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",sm=V(om,"gu").replace(/notPunctSpace/g,xr).replace(/punctSpace/g,Qn).replace(/punct/g,Zt).getRegex(),im=V(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Zt).getRegex(),am="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",cm=V(am,"gu").replace(/notPunctSpace/g,xr).replace(/punctSpace/g,Qn).replace(/punct/g,Zt).getRegex(),lm=V(/\\(punct)/,"gu").replace(/punct/g,Zt).getRegex(),um=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(),dm=V($s).replace("(?:-->|$)","-->").getRegex(),pm=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",dm).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ko=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,hm=V(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",ko).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),pc=V(/^!?\[(label)\]\[(ref)\]/).replace("label",ko).replace("ref",zs).getRegex(),hc=V(/^!?\[(ref)\](?:\[\])?/).replace("ref",zs).getRegex(),fm=V("reflink|nolink(?!\\()","g").replace("reflink",pc).replace("nolink",hc).getRegex(),fc=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ns={_backpedal:xn,anyPunctuation:lm,autolink:um,blockSkip:Jg,br:cc,code:qg,del:xn,delLDelim:xn,delRDelim:xn,emStrongLDelim:Yg,emStrongRDelimAst:Qg,emStrongRDelimUnd:rm,escape:Zg,link:hm,nolink:hc,punctuation:Fg,reflink:pc,reflinkSearch:fm,tag:pm,text:Hg,url:xn},gm=D(y({},Ns),{emStrongLDelim:Kg,emStrongRDelimAst:nm,emStrongRDelimUnd:sm,link:V(/^!?\[(label)\]\((.*?)\)/).replace("label",ko).getRegex(),reflink:V(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ko).getRegex()}),Ds=D(y({},Ns),{emStrongRDelimAst:em,emStrongLDelim:Vg,delLDelim:im,delRDelim:cm,url:V(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",fc).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",fc).getRegex()}),mm=D(y({},Ds),{br:V(cc).replace("{2,}","*").getRegex(),text:V(Ds.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),_o={normal:Os,gfm:jg,pedantic:Ug},Sr={normal:Ns,gfm:Ds,breaks:mm,pedantic:gm},bm={"&":"&","<":"<",">":">",'"':""","'":"'"},gc=e=>bm[e];function Rt(e,t){if(t){if(Ge.escapeTest.test(e))return e.replace(Ge.escapeReplace,gc)}else if(Ge.escapeTestNoEncode.test(e))return e.replace(Ge.escapeReplaceNoEncode,gc);return e}function mc(e){try{e=encodeURI(e).replace(Ge.percentDecode,"%")}catch(t){return null}return e}function bc(e,t){var i;let n=e.replace(Ge.findPipe,(a,d,u)=>{let p=!1,h=d;for(;--h>=0&&u[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 cn(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 kc(e){let t=e.split(`
|
|
1485
1520
|
`),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(`
|
|
1486
|
-
`)}function
|
|
1521
|
+
`)}function km(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function _m(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 _c(e,t,n,r,o){let i=t.href,a=t.title||null,d=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let u={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:d,tokens:r.inlineTokens(d)};return r.state.inLink=!1,u}function vm(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
|
|
1487
1522
|
`).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(`
|
|
1488
|
-
`)}var
|
|
1489
|
-
`),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:
|
|
1490
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=
|
|
1523
|
+
`)}var vo=class{constructor(e){ce(this,"options");ce(this,"rules");ce(this,"lexer");this.options=e||wn}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]:kc(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=vm(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=cn(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:cn(t[0],`
|
|
1524
|
+
`),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:cn(t[0],`
|
|
1525
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=cn(t[0],`
|
|
1491
1526
|
`).split(`
|
|
1492
1527
|
`),r="",o="",i=[];for(;n.length>0;){let a=!1,d=[],u;for(u=0;u<n.length;u++)if(this.rules.other.blockquoteStart.test(n[u]))d.push(n[u]),a=!0;else if(!a)d.push(n[u]);else break;n=n.slice(u);let p=d.join(`
|
|
1493
1528
|
`),h=p.replace(this.rules.other.blockquoteSetextReplace,`
|
|
@@ -1499,19 +1534,19 @@ ${h}`:h;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
1499
1534
|
${v}`,o=o.substring(0,o.length-k.text.length)+Z.text;break}else if((g==null?void 0:g.type)==="list"){let k=g,v=k.raw+`
|
|
1500
1535
|
`+n.join(`
|
|
1501
1536
|
`),T=this.list(v);i[i.length-1]=T,r=r.substring(0,r.length-g.raw.length)+T.raw,o=o.substring(0,o.length-k.raw.length)+T.raw,n=v.substring(i.at(-1).raw.length).split(`
|
|
1502
|
-
`);continue}}return{type:"blockquote",raw:r,tokens:i,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,o={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let i=this.rules.other.listItemRegex(n),a=!1;for(;e;){let u=!1,p="",h="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let m=
|
|
1537
|
+
`);continue}}return{type:"blockquote",raw:r,tokens:i,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,o={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let i=this.rules.other.listItemRegex(n),a=!1;for(;e;){let u=!1,p="",h="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let m=_m(t[2].split(`
|
|
1503
1538
|
`,1)[0],t[1].length),g=e.split(`
|
|
1504
1539
|
`,1)[0],k=!m.trim(),v=0;if(this.options.pedantic?(v=2,h=m.trimStart()):k?v=t[1].length+1:(v=m.search(this.rules.other.nonSpaceChar),v=v>4?1:v,h=m.slice(v),v+=t[1].length),k&&this.rules.other.blankLine.test(g)&&(p+=g+`
|
|
1505
|
-
`,e=e.substring(g.length+1),u=!0),!u){let T=this.rules.other.nextBulletRegex(v),Z=this.rules.other.hrRegex(v),Q=this.rules.other.fencesBeginRegex(v),
|
|
1506
|
-
`,1)[0],q;if(g=P,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),q=g):q=g.replace(this.rules.other.tabCharGlobal," "),Q.test(g)||
|
|
1507
|
-
`+q.slice(v);else{if(k||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Q.test(m)||
|
|
1540
|
+
`,e=e.substring(g.length+1),u=!0),!u){let T=this.rules.other.nextBulletRegex(v),Z=this.rules.other.hrRegex(v),Q=this.rules.other.fencesBeginRegex(v),j=this.rules.other.headingBeginRegex(v),E=this.rules.other.htmlBeginRegex(v),S=this.rules.other.blockquoteBeginRegex(v);for(;e;){let P=e.split(`
|
|
1541
|
+
`,1)[0],q;if(g=P,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),q=g):q=g.replace(this.rules.other.tabCharGlobal," "),Q.test(g)||j.test(g)||E.test(g)||S.test(g)||T.test(g)||Z.test(g))break;if(q.search(this.rules.other.nonSpaceChar)>=v||!g.trim())h+=`
|
|
1542
|
+
`+q.slice(v);else{if(k||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Q.test(m)||j.test(m)||Z.test(m))break;h+=`
|
|
1508
1543
|
`+g}k=!g.trim(),p+=P+`
|
|
1509
|
-
`,e=e.substring(P.length+1),m=q.slice(v)}}o.loose||(a?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(a=!0)),o.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),o.raw+=p}let d=o.items.at(-1);if(d)d.raw=d.raw.trimEnd(),d.text=d.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let u of o.items){this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]);let p=u.tokens[0];if(u.task&&((p==null?void 0:p.type)==="text"||(p==null?void 0:p.type)==="paragraph")){u.text=u.text.replace(this.rules.other.listReplaceTask,""),p.raw=p.raw.replace(this.rules.other.listReplaceTask,""),p.text=p.text.replace(this.rules.other.listReplaceTask,"");for(let m=this.lexer.inlineQueue.length-1;m>=0;m--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[m].src)){this.lexer.inlineQueue[m].src=this.lexer.inlineQueue[m].src.replace(this.rules.other.listReplaceTask,"");break}let h=this.rules.other.listTaskCheckbox.exec(u.raw);if(h){let m={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};u.checked=m.checked,o.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=m.raw+u.tokens[0].raw,u.tokens[0].text=m.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(m)):u.tokens.unshift({type:"paragraph",raw:m.raw,text:m.raw,tokens:[m]}):u.tokens.unshift(m)}}else u.task&&(u.task=!1);if(!o.loose){let h=u.tokens.filter(g=>g.type==="space"),m=h.length>0&&h.some(g=>this.rules.other.anyLine.test(g.raw));o.loose=m}}if(o.loose)for(let u of o.items){u.loose=!0;for(let p of u.tokens)p.type==="text"&&(p.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=
|
|
1510
|
-
`),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=
|
|
1511
|
-
`):[],i={type:"table",raw:
|
|
1512
|
-
`),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(
|
|
1544
|
+
`,e=e.substring(P.length+1),m=q.slice(v)}}o.loose||(a?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(a=!0)),o.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),o.raw+=p}let d=o.items.at(-1);if(d)d.raw=d.raw.trimEnd(),d.text=d.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let u of o.items){this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]);let p=u.tokens[0];if(u.task&&((p==null?void 0:p.type)==="text"||(p==null?void 0:p.type)==="paragraph")){u.text=u.text.replace(this.rules.other.listReplaceTask,""),p.raw=p.raw.replace(this.rules.other.listReplaceTask,""),p.text=p.text.replace(this.rules.other.listReplaceTask,"");for(let m=this.lexer.inlineQueue.length-1;m>=0;m--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[m].src)){this.lexer.inlineQueue[m].src=this.lexer.inlineQueue[m].src.replace(this.rules.other.listReplaceTask,"");break}let h=this.rules.other.listTaskCheckbox.exec(u.raw);if(h){let m={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};u.checked=m.checked,o.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=m.raw+u.tokens[0].raw,u.tokens[0].text=m.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(m)):u.tokens.unshift({type:"paragraph",raw:m.raw,text:m.raw,tokens:[m]}):u.tokens.unshift(m)}}else u.task&&(u.task=!1);if(!o.loose){let h=u.tokens.filter(g=>g.type==="space"),m=h.length>0&&h.some(g=>this.rules.other.anyLine.test(g.raw));o.loose=m}}if(o.loose)for(let u of o.items){u.loose=!0;for(let p of u.tokens)p.type==="text"&&(p.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=kc(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:cn(t[0],`
|
|
1545
|
+
`),href:r,title:o}}}table(e){var a;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=bc(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
1546
|
+
`):[],i={type:"table",raw:cn(t[0],`
|
|
1547
|
+
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let d of r)this.rules.other.tableAlignRight.test(d)?i.align.push("right"):this.rules.other.tableAlignCenter.test(d)?i.align.push("center"):this.rules.other.tableAlignLeft.test(d)?i.align.push("left"):i.align.push(null);for(let d=0;d<n.length;d++)i.header.push({text:n[d],tokens:this.lexer.inline(n[d]),header:!0,align:i.align[d]});for(let d of o)i.rows.push(bc(d,i.header.length).map((u,p)=>({text:u,tokens:this.lexer.inline(u),header:!1,align:i.align[p]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:cn(t[0],`
|
|
1513
1548
|
`),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)===`
|
|
1514
|
-
`?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=
|
|
1549
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=cn(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=km(t[2],"()");if(i===-2)return;if(i>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],o=i[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),_c(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 _c(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,d=o,u=0,p=r[0][0],h=n===p,m=p==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(m.lastIndex=0,t=t.slice(-1*e.length+o);(r=m.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){d+=a;continue}else if(r[5]||r[6]){if(o%3&&!((o+a)%3)){u+=a;continue}if(h)break}if(d-=a,d>0)continue;a=Math.min(a,a+d+u);let g=[...r[0]][0].length,k=e.slice(0,o+r.index+g+a);if(Math.min(o,a)%2){let T=k.slice(1,-1);return{type:"em",raw:k,text:T,tokens:this.lexer.inlineTokens(T)}}let v=k.slice(2,-2);return{type:"strong",raw:k,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,d=o,u=this.rules.inline.delRDelim;for(u.lastIndex=0,t=t.slice(-1*e.length+o);(r=u.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==o))continue;if(r[3]||r[4]){d+=a;continue}if(d-=a,d>0)continue;a=Math.min(a,a+d);let p=[...r[0]][0].length,h=e.slice(0,o+r.index+p+a),m=h.slice(o,-o);return{type:"del",raw:h,text:m,tokens:this.lexer.inlineTokens(m)}}}}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}}}},_t=class wi{constructor(t){ce(this,"tokens");ce(this,"options");ce(this,"state");ce(this,"inlineQueue");ce(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||wn,this.options.tokenizer=this.options.tokenizer||new vo,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:_o.normal,inline:Sr.normal};this.options.pedantic?(n.block=_o.pedantic,n.inline=Sr.pedantic):this.options.gfm&&(n.block=_o.gfm,this.options.breaks?n.inline=Sr.breaks:n.inline=Sr.gfm),this.tokenizer.rules=n}static get rules(){return{block:_o,inline:Sr}}static lex(t,n){return new wi(n).lex(t)}static lexInline(t,n){return new wi(n).inlineTokens(t)}lex(t){t=t.replace(Ge.carriageReturn,`
|
|
1515
1550
|
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var i,a,d;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(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 u;if((a=(i=this.options.extensions)==null?void 0:i.block)!=null&&a.some(h=>(u=h.call({lexer:this},t,n))?(t=t.substring(u.raw.length),n.push(u),!0):!1))continue;if(u=this.tokenizer.space(t)){t=t.substring(u.raw.length);let h=n.at(-1);u.raw.length===1&&h!==void 0?h.raw+=`
|
|
1516
1551
|
`:n.push(u);continue}if(u=this.tokenizer.code(t)){t=t.substring(u.raw.length);let h=n.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
|
|
1517
1552
|
`)?"":`
|
|
@@ -1525,9 +1560,9 @@ ${v}`,o=o.substring(0,o.length-k.text.length)+Z.text;break}else if((g==null?void
|
|
|
1525
1560
|
`+u.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(u),r=p.length!==t.length,t=t.substring(u.raw.length);continue}if(u=this.tokenizer.text(t)){t=t.substring(u.raw.length);let h=n.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
|
|
1526
1561
|
`)?"":`
|
|
1527
1562
|
`)+u.raw,h.text+=`
|
|
1528
|
-
`+u.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(u);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var d,u,p,h,m,g;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,v=>k.includes(v.slice(v.lastIndexOf("[")+1,-1))?"["+"a".repeat(v.length-2)+"]":v))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(k,v,T)=>{let Z=T?T.length:0;return k.slice(0,Z)+"["+"a".repeat(k.length-Z-2)+"]"}),r=(p=(u=(d=this.options.hooks)==null?void 0:d.emStrongMask)==null?void 0:u.call({lexer:this},r))!=null?p:r;let o=!1,i="",a=1/0;for(;t;){if(t.length<a)a=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}o||(i=""),o=!1;let k;if((m=(h=this.options.extensions)==null?void 0:h.inline)!=null&&m.some(T=>(k=T.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 T=n.at(-1);k.type==="text"&&(T==null?void 0:T.type)==="text"?(T.raw+=k.raw,T.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 v=t;if((g=this.options.extensions)!=null&&g.startInline){let T=1/0,Z=t.slice(1),Q;this.options.extensions.startInline.forEach(
|
|
1529
|
-
`;return r?'<pre><code class="language-'+
|
|
1530
|
-
`:"<pre><code>"+(n?o:
|
|
1563
|
+
`+u.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(u);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var d,u,p,h,m,g;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,v=>k.includes(v.slice(v.lastIndexOf("[")+1,-1))?"["+"a".repeat(v.length-2)+"]":v))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(k,v,T)=>{let Z=T?T.length:0;return k.slice(0,Z)+"["+"a".repeat(k.length-Z-2)+"]"}),r=(p=(u=(d=this.options.hooks)==null?void 0:d.emStrongMask)==null?void 0:u.call({lexer:this},r))!=null?p:r;let o=!1,i="",a=1/0;for(;t;){if(t.length<a)a=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}o||(i=""),o=!1;let k;if((m=(h=this.options.extensions)==null?void 0:h.inline)!=null&&m.some(T=>(k=T.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 T=n.at(-1);k.type==="text"&&(T==null?void 0:T.type)==="text"?(T.raw+=k.raw,T.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 v=t;if((g=this.options.extensions)!=null&&g.startInline){let T=1/0,Z=t.slice(1),Q;this.options.extensions.startInline.forEach(j=>{Q=j.call({lexer:this},Z),typeof Q=="number"&&Q>=0&&(T=Math.min(T,Q))}),T<1/0&&T>=0&&(v=t.substring(0,T+1))}if(k=this.tokenizer.inlineText(v)){t=t.substring(k.raw.length),k.raw.slice(-1)!=="_"&&(i=k.raw.slice(-1)),o=!0;let T=n.at(-1);(T==null?void 0:T.type)==="text"?(T.raw+=k.raw,T.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)}},yo=class{constructor(e){ce(this,"options");ce(this,"parser");this.options=e||wn}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,"")+`
|
|
1564
|
+
`;return r?'<pre><code class="language-'+Rt(r)+'">'+(n?o:Rt(o,!0))+`</code></pre>
|
|
1565
|
+
`:"<pre><code>"+(n?o:Rt(o,!0))+`</code></pre>
|
|
1531
1566
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
1532
1567
|
${this.parser.parse(e)}</blockquote>
|
|
1533
1568
|
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
@@ -1543,9 +1578,9 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
1543
1578
|
`}tablerow({text:e}){return`<tr>
|
|
1544
1579
|
${e}</tr>
|
|
1545
1580
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
1546
|
-
`}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>${
|
|
1547
|
-
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}}},xn=new _m;function se(e,t){return xn.parse(e,t)}se.options=se.setOptions=function(e){return xn.setOptions(e),se.defaults=xn.defaults,tc(se.defaults),se},se.getDefaults=Cs,se.defaults=yn;function vm(...e){return xn.use(...e),se.defaults=xn.defaults,tc(se.defaults),se}se.use=vm,se.walkTokens=function(e,t){return xn.walkTokens(e,t)},se.parseInline=xn.parseInline,se.Parser=_t,se.parser=_t.parse,se.Renderer=vo,se.TextRenderer=Ns,se.Lexer=kt,se.lexer=kt.lex,se.Tokenizer=_o,se.Hooks=Sr,se.parse=se,se.options,se.setOptions,se.walkTokens,se.parseInline,_t.parse,kt.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:kc,setPrototypeOf:_c,isFrozen:ym,getPrototypeOf:wm,getOwnPropertyDescriptor:xm}=Object;let{freeze:Ye,seal:pt,create:Ds}=Object,{apply:Ms,construct:Us}=typeof Reflect!="undefined"&&Reflect;Ye||(Ye=function(t){return t}),pt||(pt=function(t){return t}),Ms||(Ms=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)}),Us||(Us=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 yo=Xe(Array.prototype.forEach),Sm=Xe(Array.prototype.lastIndexOf),vc=Xe(Array.prototype.pop),Tr=Xe(Array.prototype.push),Tm=Xe(Array.prototype.splice),wo=Xe(String.prototype.toLowerCase),js=Xe(String.prototype.toString),Zs=Xe(String.prototype.match),Er=Xe(String.prototype.replace),Em=Xe(String.prototype.indexOf),Am=Xe(String.prototype.trim),vt=Xe(Object.prototype.hasOwnProperty),Ve=Xe(RegExp.prototype.test),Ar=Cm(TypeError);function Xe(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 Ms(e,t,r)}}function Cm(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Us(e,n)}}function J(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:wo;_c&&_c(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(ym(t)||(t[r]=i),o=i)}e[o]=!0}return e}function Pm(e){for(let t=0;t<e.length;t++)vt(e,t)||(e[t]=null);return e}function Rt(e){const t=Ds(null);for(const[n,r]of kc(e))vt(e,n)&&(Array.isArray(r)?t[n]=Pm(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=Rt(r):t[n]=r);return t}function Cr(e,t){for(;e!==null;){const r=xm(e,t);if(r){if(r.get)return Xe(r.get);if(typeof r.value=="function")return Xe(r.value)}e=wm(e)}function n(){return null}return n}const yc=Ye(["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"]),qs=Ye(["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"]),Hs=Ye(["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"]),Rm=Ye(["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"]),Fs=Ye(["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"]),Lm=Ye(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),wc=Ye(["#text"]),xc=Ye(["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"]),Bs=Ye(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Sc=Ye(["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"]),xo=Ye(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Im=pt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),zm=pt(/<%[\w\W]*|[\w\W]*%>/gm),$m=pt(/\$\{[\w\W]*/gm),Om=pt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Nm=pt(/^aria-[\-\w]+$/),Tc=pt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Dm=pt(/^(?:\w+script|data):/i),Mm=pt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ec=pt(/^html$/i),Um=pt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ac=Object.freeze({__proto__:null,ARIA_ATTR:Nm,ATTR_WHITESPACE:Mm,CUSTOM_ELEMENT:Um,DATA_ATTR:Om,DOCTYPE_NAME:Ec,ERB_EXPR:zm,IS_ALLOWED_URI:Tc,IS_SCRIPT_OR_DATA:Dm,MUSTACHE_EXPR:Im,TMPLIT_EXPR:$m});const Pr={element:1,text:3,progressingInstruction:7,comment:8,document:9},jm=function(){return typeof window=="undefined"?null:window},Zm=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}},Cc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Pc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:jm();const t=j=>Pc(j);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Pr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:d,Element:u,NodeFilter:p,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:m,DOMParser:g,trustedTypes:k}=e,v=u.prototype,T=Cr(v,"cloneNode"),Z=Cr(v,"remove"),Q=Cr(v,"nextSibling"),U=Cr(v,"childNodes"),E=Cr(v,"parentNode");if(typeof a=="function"){const j=n.createElement("template");j.content&&j.content.ownerDocument&&(n=j.content.ownerDocument)}let S,P="";const{implementation:q,createNodeIterator:Y,createDocumentFragment:xe,getElementsByTagName:Pe}=n,{importNode:ct}=r;let ee=Cc();t.isSupported=typeof kc=="function"&&typeof E=="function"&&q&&q.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:$e,ERB_EXPR:ot,TMPLIT_EXPR:Ot,DATA_ATTR:hn,ARIA_ATTR:wt,IS_SCRIPT_OR_DATA:Gt,ATTR_WHITESPACE:Wt,CUSTOM_ELEMENT:Jt}=Ac;let{IS_ALLOWED_URI:Yt}=Ac,le=null;const In=J({},[...yc,...qs,...Hs,...Fs,...wc]);let we=null;const zn=J({},[...xc,...Bs,...Sc,...xo]);let N=Object.seal(Ds(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}})),X=null,Ee=null;const Oe=Object.seal(Ds(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ue=!0,de=!0,$n=!1,fn=!0,pe=!1,Ue=!0,Re=!1,Ne=!1,gn=!1,je=!1,st=!1,Nt=!1,Vt=!0,Nr=!1;const ci="user-content-";let Dr=!0,On=!1,mn={},tt=null;const Mr=J({},["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 he=null;const Bo=J({},["audio","video","img","source","image","track"]);let Ur=null;const Go=J({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ur="http://www.w3.org/1998/Math/MathML",dr="http://www.w3.org/2000/svg",xt="http://www.w3.org/1999/xhtml";let bn=xt,Nn=!1,Dn=null;const li=J({},[ur,dr,xt],js);let pr=J({},["mi","mo","mn","ms","mtext"]),hr=J({},["annotation-xml"]);const ui=J({},["title","style","font","a","script"]);let Xt=null;const St=["application/xhtml+xml","text/html"],di="text/html";let fe=null,kn=null;const Wo=n.createElement("form"),jr=function(_){return _ instanceof RegExp||_ instanceof Function},fr=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(kn&&kn===_)){if((!_||typeof _!="object")&&(_={}),_=Rt(_),Xt=St.indexOf(_.PARSER_MEDIA_TYPE)===-1?di:_.PARSER_MEDIA_TYPE,fe=Xt==="application/xhtml+xml"?js:wo,le=vt(_,"ALLOWED_TAGS")?J({},_.ALLOWED_TAGS,fe):In,we=vt(_,"ALLOWED_ATTR")?J({},_.ALLOWED_ATTR,fe):zn,Dn=vt(_,"ALLOWED_NAMESPACES")?J({},_.ALLOWED_NAMESPACES,js):li,Ur=vt(_,"ADD_URI_SAFE_ATTR")?J(Rt(Go),_.ADD_URI_SAFE_ATTR,fe):Go,he=vt(_,"ADD_DATA_URI_TAGS")?J(Rt(Bo),_.ADD_DATA_URI_TAGS,fe):Bo,tt=vt(_,"FORBID_CONTENTS")?J({},_.FORBID_CONTENTS,fe):Mr,X=vt(_,"FORBID_TAGS")?J({},_.FORBID_TAGS,fe):Rt({}),Ee=vt(_,"FORBID_ATTR")?J({},_.FORBID_ATTR,fe):Rt({}),mn=vt(_,"USE_PROFILES")?_.USE_PROFILES:!1,ue=_.ALLOW_ARIA_ATTR!==!1,de=_.ALLOW_DATA_ATTR!==!1,$n=_.ALLOW_UNKNOWN_PROTOCOLS||!1,fn=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,pe=_.SAFE_FOR_TEMPLATES||!1,Ue=_.SAFE_FOR_XML!==!1,Re=_.WHOLE_DOCUMENT||!1,je=_.RETURN_DOM||!1,st=_.RETURN_DOM_FRAGMENT||!1,Nt=_.RETURN_TRUSTED_TYPE||!1,gn=_.FORCE_BODY||!1,Vt=_.SANITIZE_DOM!==!1,Nr=_.SANITIZE_NAMED_PROPS||!1,Dr=_.KEEP_CONTENT!==!1,On=_.IN_PLACE||!1,Yt=_.ALLOWED_URI_REGEXP||Tc,bn=_.NAMESPACE||xt,pr=_.MATHML_TEXT_INTEGRATION_POINTS||pr,hr=_.HTML_INTEGRATION_POINTS||hr,N=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&jr(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(N.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&jr(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(N.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(N.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),pe&&(de=!1),st&&(je=!0),mn&&(le=J({},wc),we=[],mn.html===!0&&(J(le,yc),J(we,xc)),mn.svg===!0&&(J(le,qs),J(we,Bs),J(we,xo)),mn.svgFilters===!0&&(J(le,Hs),J(we,Bs),J(we,xo)),mn.mathMl===!0&&(J(le,Fs),J(we,Sc),J(we,xo))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?Oe.tagCheck=_.ADD_TAGS:(le===In&&(le=Rt(le)),J(le,_.ADD_TAGS,fe))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?Oe.attributeCheck=_.ADD_ATTR:(we===zn&&(we=Rt(we)),J(we,_.ADD_ATTR,fe))),_.ADD_URI_SAFE_ATTR&&J(Ur,_.ADD_URI_SAFE_ATTR,fe),_.FORBID_CONTENTS&&(tt===Mr&&(tt=Rt(tt)),J(tt,_.FORBID_CONTENTS,fe)),_.ADD_FORBID_CONTENTS&&(tt===Mr&&(tt=Rt(tt)),J(tt,_.ADD_FORBID_CONTENTS,fe)),Dr&&(le["#text"]=!0),Re&&J(le,["html","head","body"]),le.table&&(J(le,["tbody"]),delete X.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ar('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ar('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=_.TRUSTED_TYPES_POLICY,P=S.createHTML("")}else S===void 0&&(S=Zm(k,o)),S!==null&&typeof P=="string"&&(P=S.createHTML(""));Ye&&Ye(_),kn=_}},Zr=J({},[...qs,...Hs,...Rm]),Jo=J({},[...Fs,...Lm]),pi=function(_){let A=E(_);(!A||!A.tagName)&&(A={namespaceURI:bn,tagName:"template"});const I=wo(_.tagName),ae=wo(A.tagName);return Dn[_.namespaceURI]?_.namespaceURI===dr?A.namespaceURI===xt?I==="svg":A.namespaceURI===ur?I==="svg"&&(ae==="annotation-xml"||pr[ae]):!!Zr[I]:_.namespaceURI===ur?A.namespaceURI===xt?I==="math":A.namespaceURI===dr?I==="math"&&hr[ae]:!!Jo[I]:_.namespaceURI===xt?A.namespaceURI===dr&&!hr[ae]||A.namespaceURI===ur&&!pr[ae]?!1:!Jo[I]&&(ui[I]||!Zr[I]):!!(Xt==="application/xhtml+xml"&&Dn[_.namespaceURI]):!1},gt=function(_){Tr(t.removed,{element:_});try{E(_).removeChild(_)}catch(A){Z(_)}},mt=function(_,A){try{Tr(t.removed,{attribute:A.getAttributeNode(_),from:A})}catch(I){Tr(t.removed,{attribute:null,from:A})}if(A.removeAttribute(_),_==="is")if(je||st)try{gt(A)}catch(I){}else try{A.setAttribute(_,"")}catch(I){}},Yo=function(_){let A=null,I=null;if(gn)_="<remove></remove>"+_;else{const Se=Zs(_,/^[\r\n\t ]+/);I=Se&&Se[0]}Xt==="application/xhtml+xml"&&bn===xt&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const ae=S?S.createHTML(_):_;if(bn===xt)try{A=new g().parseFromString(ae,Xt)}catch(Se){}if(!A||!A.documentElement){A=q.createDocument(bn,"template",null);try{A.documentElement.innerHTML=Nn?P:ae}catch(Se){}}const Ze=A.body||A.documentElement;return _&&I&&Ze.insertBefore(n.createTextNode(I),Ze.childNodes[0]||null),bn===xt?Pe.call(A,Re?"html":"body")[0]:Re?A.documentElement:Ze},qr=function(_){return Y.call(_.ownerDocument||_,_,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Hr=function(_){return _ instanceof m&&(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")},Vo=function(_){return typeof d=="function"&&_ instanceof d};function Tt(j,_,A){yo(j,I=>{I.call(t,_,A,kn)})}const Xo=function(_){let A=null;if(Tt(ee.beforeSanitizeElements,_,null),Hr(_))return gt(_),!0;const I=fe(_.nodeName);if(Tt(ee.uponSanitizeElement,_,{tagName:I,allowedTags:le}),Ue&&_.hasChildNodes()&&!Vo(_.firstElementChild)&&Ve(/<[/\w!]/g,_.innerHTML)&&Ve(/<[/\w!]/g,_.textContent)||_.nodeType===Pr.progressingInstruction||Ue&&_.nodeType===Pr.comment&&Ve(/<[/\w]/g,_.data))return gt(_),!0;if(!(Oe.tagCheck instanceof Function&&Oe.tagCheck(I))&&(!le[I]||X[I])){if(!X[I]&&Qo(I)&&(N.tagNameCheck instanceof RegExp&&Ve(N.tagNameCheck,I)||N.tagNameCheck instanceof Function&&N.tagNameCheck(I)))return!1;if(Dr&&!tt[I]){const ae=E(_)||_.parentNode,Ze=U(_)||_.childNodes;if(Ze&&ae){const Se=Ze.length;for(let We=Se-1;We>=0;--We){const Et=T(Ze[We],!0);Et.__removalCount=(_.__removalCount||0)+1,ae.insertBefore(Et,Q(_))}}}return gt(_),!0}return _ instanceof u&&!pi(_)||(I==="noscript"||I==="noembed"||I==="noframes")&&Ve(/<\/no(script|embed|frames)/i,_.innerHTML)?(gt(_),!0):(pe&&_.nodeType===Pr.text&&(A=_.textContent,yo([$e,ot,Ot],ae=>{A=Er(A,ae," ")}),_.textContent!==A&&(Tr(t.removed,{element:_.cloneNode()}),_.textContent=A)),Tt(ee.afterSanitizeElements,_,null),!1)},Ko=function(_,A,I){if(Vt&&(A==="id"||A==="name")&&(I in n||I in Wo))return!1;if(!(de&&!Ee[A]&&Ve(hn,A))){if(!(ue&&Ve(wt,A))){if(!(Oe.attributeCheck instanceof Function&&Oe.attributeCheck(A,_))){if(!we[A]||Ee[A]){if(!(Qo(_)&&(N.tagNameCheck instanceof RegExp&&Ve(N.tagNameCheck,_)||N.tagNameCheck instanceof Function&&N.tagNameCheck(_))&&(N.attributeNameCheck instanceof RegExp&&Ve(N.attributeNameCheck,A)||N.attributeNameCheck instanceof Function&&N.attributeNameCheck(A,_))||A==="is"&&N.allowCustomizedBuiltInElements&&(N.tagNameCheck instanceof RegExp&&Ve(N.tagNameCheck,I)||N.tagNameCheck instanceof Function&&N.tagNameCheck(I))))return!1}else if(!Ur[A]){if(!Ve(Yt,Er(I,Wt,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&_!=="script"&&Em(I,"data:")===0&&he[_])){if(!($n&&!Ve(Gt,Er(I,Wt,"")))){if(I)return!1}}}}}}}return!0},Qo=function(_){return _!=="annotation-xml"&&Zs(_,Jt)},Fr=function(_){Tt(ee.beforeSanitizeAttributes,_,null);const{attributes:A}=_;if(!A||Hr(_))return;const I={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:we,forceKeepAttr:void 0};let ae=A.length;for(;ae--;){const Ze=A[ae],{name:Se,namespaceURI:We,value:Et}=Ze,Dt=fe(Se),Br=Et;let De=Se==="value"?Br:Am(Br);if(I.attrName=Dt,I.attrValue=De,I.keepAttr=!0,I.forceKeepAttr=void 0,Tt(ee.uponSanitizeAttribute,_,I),De=I.attrValue,Nr&&(Dt==="id"||Dt==="name")&&(mt(Se,_),De=ci+De),Ue&&Ve(/((--!?|])>)|<\/(style|title|textarea)/i,De)){mt(Se,_);continue}if(Dt==="attributename"&&Zs(De,"href")){mt(Se,_);continue}if(I.forceKeepAttr)continue;if(!I.keepAttr){mt(Se,_);continue}if(!fn&&Ve(/\/>/i,De)){mt(Se,_);continue}pe&&yo([$e,ot,Ot],ts=>{De=Er(De,ts," ")});const es=fe(_.nodeName);if(!Ko(es,Dt,De)){mt(Se,_);continue}if(S&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!We)switch(k.getAttributeType(es,Dt)){case"TrustedHTML":{De=S.createHTML(De);break}case"TrustedScriptURL":{De=S.createScriptURL(De);break}}if(De!==Br)try{We?_.setAttributeNS(We,Se,De):_.setAttribute(Se,De),Hr(_)?gt(_):vc(t.removed)}catch(ts){mt(Se,_)}}Tt(ee.afterSanitizeAttributes,_,null)},Kt=function j(_){let A=null;const I=qr(_);for(Tt(ee.beforeSanitizeShadowDOM,_,null);A=I.nextNode();)Tt(ee.uponSanitizeShadowNode,A,null),Xo(A),Fr(A),A.content instanceof i&&j(A.content);Tt(ee.afterSanitizeShadowDOM,_,null)};return t.sanitize=function(j){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,I=null,ae=null,Ze=null;if(Nn=!j,Nn&&(j="<!-->"),typeof j!="string"&&!Vo(j))if(typeof j.toString=="function"){if(j=j.toString(),typeof j!="string")throw Ar("dirty is not a string, aborting")}else throw Ar("toString is not a function");if(!t.isSupported)return j;if(Ne||fr(_),t.removed=[],typeof j=="string"&&(On=!1),On){if(j.nodeName){const Et=fe(j.nodeName);if(!le[Et]||X[Et])throw Ar("root node is forbidden and cannot be sanitized in-place")}}else if(j instanceof d)A=Yo("<!---->"),I=A.ownerDocument.importNode(j,!0),I.nodeType===Pr.element&&I.nodeName==="BODY"||I.nodeName==="HTML"?A=I:A.appendChild(I);else{if(!je&&!pe&&!Re&&j.indexOf("<")===-1)return S&&Nt?S.createHTML(j):j;if(A=Yo(j),!A)return je?null:Nt?P:""}A&&gn&>(A.firstChild);const Se=qr(On?j:A);for(;ae=Se.nextNode();)Xo(ae),Fr(ae),ae.content instanceof i&&Kt(ae.content);if(On)return j;if(je){if(st)for(Ze=xe.call(A.ownerDocument);A.firstChild;)Ze.appendChild(A.firstChild);else Ze=A;return(we.shadowroot||we.shadowrootmode)&&(Ze=ct.call(r,Ze,!0)),Ze}let We=Re?A.outerHTML:A.innerHTML;return Re&&le["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&Ve(Ec,A.ownerDocument.doctype.name)&&(We="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
|
|
1548
|
-
`+We),pe&&
|
|
1581
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Rt(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=mc(e);if(o===null)return r;e=o;let i='<a href="'+e+'"';return t&&(i+=' title="'+Rt(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=mc(e);if(o===null)return Rt(n);e=o;let i=`<img src="${e}" alt="${Rt(n)}"`;return t&&(i+=` title="${Rt(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Rt(e.text)}},Ms=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}},vt=class xi{constructor(t){ce(this,"options");ce(this,"renderer");ce(this,"textRenderer");this.options=t||wn,this.options.renderer=this.options.renderer||new yo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ms}static parse(t,n){return new xi(n).parse(t)}static parseInline(t,n){return new xi(n).parseInline(t)}parse(t){var r,o;this.renderer.parser=this;let n="";for(let i=0;i<t.length;i++){let a=t[i];if((o=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&o[a.type]){let u=a,p=this.options.extensions.renderers[u.type].call({parser:this},u);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(u.type)){n+=p||"";continue}}let d=a;switch(d.type){case"space":{n+=this.renderer.space(d);break}case"hr":{n+=this.renderer.hr(d);break}case"heading":{n+=this.renderer.heading(d);break}case"code":{n+=this.renderer.code(d);break}case"table":{n+=this.renderer.table(d);break}case"blockquote":{n+=this.renderer.blockquote(d);break}case"list":{n+=this.renderer.list(d);break}case"checkbox":{n+=this.renderer.checkbox(d);break}case"html":{n+=this.renderer.html(d);break}case"def":{n+=this.renderer.def(d);break}case"paragraph":{n+=this.renderer.paragraph(d);break}case"text":{n+=this.renderer.text(d);break}default:{let u='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return n}parseInline(t,n=this.renderer){var o,i;this.renderer.parser=this;let r="";for(let a=0;a<t.length;a++){let d=t[a];if((i=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&i[d.type]){let p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(d.type)){r+=p||"";continue}}let u=d;switch(u.type){case"escape":{r+=n.text(u);break}case"html":{r+=n.html(u);break}case"link":{r+=n.link(u);break}case"image":{r+=n.image(u);break}case"checkbox":{r+=n.checkbox(u);break}case"strong":{r+=n.strong(u);break}case"em":{r+=n.em(u);break}case"codespan":{r+=n.codespan(u);break}case"br":{r+=n.br(u);break}case"del":{r+=n.del(u);break}case"text":{r+=n.text(u);break}default:{let p='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return r}},Tr=(Go=class{constructor(e){ce(this,"options");ce(this,"block");this.options=e||wn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?_t.lex:_t.lexInline}provideParser(e=this.block){return e?vt.parse:vt.parseInline}},ce(Go,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ce(Go,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Go),ym=class{constructor(...e){ce(this,"defaults",Rs());ce(this,"options",this.setOptions);ce(this,"parse",this.parseMarkdown(!0));ce(this,"parseInline",this.parseMarkdown(!1));ce(this,"Parser",vt);ce(this,"Renderer",yo);ce(this,"TextRenderer",Ms);ce(this,"Lexer",_t);ce(this,"Tokenizer",vo);ce(this,"Hooks",Tr);this.use(...e)}walkTokens(e,t){var r,o;let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let a=i;for(let d of a.header)n=n.concat(this.walkTokens(d.tokens,t));for(let d of a.rows)for(let u of d)n=n.concat(this.walkTokens(u.tokens,t));break}case"list":{let a=i;n=n.concat(this.walkTokens(a.items,t));break}default:{let a=i;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(d=>{let u=a[d].flat(1/0);n=n.concat(this.walkTokens(u,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r=y({},n);if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let i=t.renderers[o.name];i?t.renderers[o.name]=function(...a){let d=o.renderer.apply(this,a);return d===!1&&(d=i.apply(this,a)),d}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[o.level];i?i.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),r.extensions=t),n.renderer){let o=this.defaults.renderer||new yo(this.defaults);for(let i in n.renderer){if(!(i in o))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let a=i,d=n.renderer[a],u=o[a];o[a]=(...p)=>{let h=d.apply(o,p);return h===!1&&(h=u.apply(o,p)),h||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new vo(this.defaults);for(let i in n.tokenizer){if(!(i in o))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,d=n.tokenizer[a],u=o[a];o[a]=(...p)=>{let h=d.apply(o,p);return h===!1&&(h=u.apply(o,p)),h}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new Tr;for(let i in n.hooks){if(!(i in o))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,d=n.hooks[a],u=o[a];Tr.passThroughHooks.has(i)?o[a]=p=>{if(this.defaults.async&&Tr.passThroughHooksRespectAsync.has(i))return I(this,null,function*(){let m=yield d.call(o,p);return u.call(o,m)});let h=d.call(o,p);return u.call(o,h)}:o[a]=(...p)=>{if(this.defaults.async)return I(this,null,function*(){let m=yield d.apply(o,p);return m===!1&&(m=yield u.apply(o,p)),m});let h=d.apply(o,p);return h===!1&&(h=u.apply(o,p)),h}}r.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(a){let d=[];return d.push(i.call(this,a)),o&&(d=d.concat(o.call(this,a))),d}}this.defaults=y(y({},this.defaults),r)}),this}setOptions(e){return this.defaults=y(y({},this.defaults),e),this}lexer(e,t){return _t.lex(e,t!=null?t:this.defaults)}parser(e,t){return vt.parse(e,t!=null?t:this.defaults)}parseMarkdown(e){return(t,n)=>{let r=y({},n),o=y(y({},this.defaults),r),i=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return I(this,null,function*(){let a=o.hooks?yield o.hooks.preprocess(t):t,d=yield(o.hooks?yield o.hooks.provideLexer(e):e?_t.lex:_t.lexInline)(a,o),u=o.hooks?yield o.hooks.processAllTokens(d):d;o.walkTokens&&(yield Promise.all(this.walkTokens(u,o.walkTokens)));let p=yield(o.hooks?yield o.hooks.provideParser(e):e?vt.parse:vt.parseInline)(u,o);return o.hooks?yield o.hooks.postprocess(p):p}).catch(i);try{o.hooks&&(t=o.hooks.preprocess(t));let a=(o.hooks?o.hooks.provideLexer(e):e?_t.lex:_t.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?vt.parse:vt.parseInline)(a,o);return o.hooks&&(d=o.hooks.postprocess(d)),d}catch(a){return i(a)}}}onError(e,t){return n=>{if(n.message+=`
|
|
1582
|
+
Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+Rt(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},Sn=new ym;function se(e,t){return Sn.parse(e,t)}se.options=se.setOptions=function(e){return Sn.setOptions(e),se.defaults=Sn.defaults,rc(se.defaults),se},se.getDefaults=Rs,se.defaults=wn;function wm(...e){return Sn.use(...e),se.defaults=Sn.defaults,rc(se.defaults),se}se.use=wm,se.walkTokens=function(e,t){return Sn.walkTokens(e,t)},se.parseInline=Sn.parseInline,se.Parser=vt,se.parser=vt.parse,se.Renderer=yo,se.TextRenderer=Ms,se.Lexer=_t,se.lexer=_t.lex,se.Tokenizer=vo,se.Hooks=Tr,se.parse=se,se.options,se.setOptions,se.walkTokens,se.parseInline,vt.parse,_t.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:vc,setPrototypeOf:yc,isFrozen:xm,getPrototypeOf:Sm,getOwnPropertyDescriptor:Tm}=Object;let{freeze:Ye,seal:ht,create:js}=Object,{apply:Us,construct:Zs}=typeof Reflect!="undefined"&&Reflect;Ye||(Ye=function(t){return t}),ht||(ht=function(t){return t}),Us||(Us=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)}),Zs||(Zs=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 wo=Xe(Array.prototype.forEach),Em=Xe(Array.prototype.lastIndexOf),wc=Xe(Array.prototype.pop),Er=Xe(Array.prototype.push),Am=Xe(Array.prototype.splice),xo=Xe(String.prototype.toLowerCase),qs=Xe(String.prototype.toString),Hs=Xe(String.prototype.match),Ar=Xe(String.prototype.replace),Cm=Xe(String.prototype.indexOf),Pm=Xe(String.prototype.trim),yt=Xe(Object.prototype.hasOwnProperty),Ve=Xe(RegExp.prototype.test),Cr=Rm(TypeError);function Xe(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 Us(e,t,r)}}function Rm(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Zs(e,n)}}function J(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xo;yc&&yc(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(xm(t)||(t[r]=i),o=i)}e[o]=!0}return e}function Lm(e){for(let t=0;t<e.length;t++)yt(e,t)||(e[t]=null);return e}function Lt(e){const t=js(null);for(const[n,r]of vc(e))yt(e,n)&&(Array.isArray(r)?t[n]=Lm(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=Lt(r):t[n]=r);return t}function Pr(e,t){for(;e!==null;){const r=Tm(e,t);if(r){if(r.get)return Xe(r.get);if(typeof r.value=="function")return Xe(r.value)}e=Sm(e)}function n(){return null}return n}const xc=Ye(["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"]),Fs=Ye(["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"]),Bs=Ye(["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"]),Im=Ye(["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"]),Gs=Ye(["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"]),zm=Ye(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Sc=Ye(["#text"]),Tc=Ye(["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=Ye(["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"]),Ec=Ye(["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"]),So=Ye(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),$m=ht(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Om=ht(/<%[\w\W]*|[\w\W]*%>/gm),Nm=ht(/\$\{[\w\W]*/gm),Dm=ht(/^data-[\-\w.\u00B7-\uFFFF]+$/),Mm=ht(/^aria-[\-\w]+$/),Ac=ht(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),jm=ht(/^(?:\w+script|data):/i),Um=ht(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Cc=ht(/^html$/i),Zm=ht(/^[a-z][.\w]*(-[.\w]+)+$/i);var Pc=Object.freeze({__proto__:null,ARIA_ATTR:Mm,ATTR_WHITESPACE:Um,CUSTOM_ELEMENT:Zm,DATA_ATTR:Dm,DOCTYPE_NAME:Cc,ERB_EXPR:Om,IS_ALLOWED_URI:Ac,IS_SCRIPT_OR_DATA:jm,MUSTACHE_EXPR:$m,TMPLIT_EXPR:Nm});const Rr={element:1,text:3,progressingInstruction:7,comment:8,document:9},qm=function(){return typeof window=="undefined"?null:window},Hm=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}},Rc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Lc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:qm();const t=U=>Lc(U);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Rr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:d,Element:u,NodeFilter:p,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:m,DOMParser:g,trustedTypes:k}=e,v=u.prototype,T=Pr(v,"cloneNode"),Z=Pr(v,"remove"),Q=Pr(v,"nextSibling"),j=Pr(v,"childNodes"),E=Pr(v,"parentNode");if(typeof a=="function"){const U=n.createElement("template");U.content&&U.content.ownerDocument&&(n=U.content.ownerDocument)}let S,P="";const{implementation:q,createNodeIterator:Y,createDocumentFragment:xe,getElementsByTagName:Pe}=n,{importNode:lt}=r;let ee=Rc();t.isSupported=typeof vc=="function"&&typeof E=="function"&&q&&q.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:$e,ERB_EXPR:ot,TMPLIT_EXPR:Nt,DATA_ATTR:fn,ARIA_ATTR:xt,IS_SCRIPT_OR_DATA:Wt,ATTR_WHITESPACE:Jt,CUSTOM_ELEMENT:Yt}=Pc;let{IS_ALLOWED_URI:Vt}=Pc,le=null;const zn=J({},[...xc,...Fs,...Bs,...Gs,...Sc]);let we=null;const $n=J({},[...Tc,...Ws,...Ec,...So]);let N=Object.seal(js(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}})),X=null,Ee=null;const Oe=Object.seal(js(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ue=!0,de=!0,On=!1,gn=!0,pe=!1,je=!0,Re=!1,Ne=!1,mn=!1,Ue=!1,st=!1,Dt=!1,Xt=!0,Dr=!1;const ui="user-content-";let Mr=!0,Nn=!1,bn={},tt=null;const jr=J({},["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 he=null;const Wo=J({},["audio","video","img","source","image","track"]);let Ur=null;const Jo=J({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),dr="http://www.w3.org/1998/Math/MathML",pr="http://www.w3.org/2000/svg",St="http://www.w3.org/1999/xhtml";let kn=St,Dn=!1,Mn=null;const di=J({},[dr,pr,St],qs);let hr=J({},["mi","mo","mn","ms","mtext"]),fr=J({},["annotation-xml"]);const pi=J({},["title","style","font","a","script"]);let Kt=null;const Tt=["application/xhtml+xml","text/html"],hi="text/html";let fe=null,_n=null;const Yo=n.createElement("form"),Zr=function(_){return _ instanceof RegExp||_ instanceof Function},gr=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(_n&&_n===_)){if((!_||typeof _!="object")&&(_={}),_=Lt(_),Kt=Tt.indexOf(_.PARSER_MEDIA_TYPE)===-1?hi:_.PARSER_MEDIA_TYPE,fe=Kt==="application/xhtml+xml"?qs:xo,le=yt(_,"ALLOWED_TAGS")?J({},_.ALLOWED_TAGS,fe):zn,we=yt(_,"ALLOWED_ATTR")?J({},_.ALLOWED_ATTR,fe):$n,Mn=yt(_,"ALLOWED_NAMESPACES")?J({},_.ALLOWED_NAMESPACES,qs):di,Ur=yt(_,"ADD_URI_SAFE_ATTR")?J(Lt(Jo),_.ADD_URI_SAFE_ATTR,fe):Jo,he=yt(_,"ADD_DATA_URI_TAGS")?J(Lt(Wo),_.ADD_DATA_URI_TAGS,fe):Wo,tt=yt(_,"FORBID_CONTENTS")?J({},_.FORBID_CONTENTS,fe):jr,X=yt(_,"FORBID_TAGS")?J({},_.FORBID_TAGS,fe):Lt({}),Ee=yt(_,"FORBID_ATTR")?J({},_.FORBID_ATTR,fe):Lt({}),bn=yt(_,"USE_PROFILES")?_.USE_PROFILES:!1,ue=_.ALLOW_ARIA_ATTR!==!1,de=_.ALLOW_DATA_ATTR!==!1,On=_.ALLOW_UNKNOWN_PROTOCOLS||!1,gn=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,pe=_.SAFE_FOR_TEMPLATES||!1,je=_.SAFE_FOR_XML!==!1,Re=_.WHOLE_DOCUMENT||!1,Ue=_.RETURN_DOM||!1,st=_.RETURN_DOM_FRAGMENT||!1,Dt=_.RETURN_TRUSTED_TYPE||!1,mn=_.FORCE_BODY||!1,Xt=_.SANITIZE_DOM!==!1,Dr=_.SANITIZE_NAMED_PROPS||!1,Mr=_.KEEP_CONTENT!==!1,Nn=_.IN_PLACE||!1,Vt=_.ALLOWED_URI_REGEXP||Ac,kn=_.NAMESPACE||St,hr=_.MATHML_TEXT_INTEGRATION_POINTS||hr,fr=_.HTML_INTEGRATION_POINTS||fr,N=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&Zr(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(N.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&Zr(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(N.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(N.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),pe&&(de=!1),st&&(Ue=!0),bn&&(le=J({},Sc),we=[],bn.html===!0&&(J(le,xc),J(we,Tc)),bn.svg===!0&&(J(le,Fs),J(we,Ws),J(we,So)),bn.svgFilters===!0&&(J(le,Bs),J(we,Ws),J(we,So)),bn.mathMl===!0&&(J(le,Gs),J(we,Ec),J(we,So))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?Oe.tagCheck=_.ADD_TAGS:(le===zn&&(le=Lt(le)),J(le,_.ADD_TAGS,fe))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?Oe.attributeCheck=_.ADD_ATTR:(we===$n&&(we=Lt(we)),J(we,_.ADD_ATTR,fe))),_.ADD_URI_SAFE_ATTR&&J(Ur,_.ADD_URI_SAFE_ATTR,fe),_.FORBID_CONTENTS&&(tt===jr&&(tt=Lt(tt)),J(tt,_.FORBID_CONTENTS,fe)),_.ADD_FORBID_CONTENTS&&(tt===jr&&(tt=Lt(tt)),J(tt,_.ADD_FORBID_CONTENTS,fe)),Mr&&(le["#text"]=!0),Re&&J(le,["html","head","body"]),le.table&&(J(le,["tbody"]),delete X.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw Cr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Cr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=_.TRUSTED_TYPES_POLICY,P=S.createHTML("")}else S===void 0&&(S=Hm(k,o)),S!==null&&typeof P=="string"&&(P=S.createHTML(""));Ye&&Ye(_),_n=_}},qr=J({},[...Fs,...Bs,...Im]),Vo=J({},[...Gs,...zm]),fi=function(_){let A=E(_);(!A||!A.tagName)&&(A={namespaceURI:kn,tagName:"template"});const z=xo(_.tagName),ae=xo(A.tagName);return Mn[_.namespaceURI]?_.namespaceURI===pr?A.namespaceURI===St?z==="svg":A.namespaceURI===dr?z==="svg"&&(ae==="annotation-xml"||hr[ae]):!!qr[z]:_.namespaceURI===dr?A.namespaceURI===St?z==="math":A.namespaceURI===pr?z==="math"&&fr[ae]:!!Vo[z]:_.namespaceURI===St?A.namespaceURI===pr&&!fr[ae]||A.namespaceURI===dr&&!hr[ae]?!1:!Vo[z]&&(pi[z]||!qr[z]):!!(Kt==="application/xhtml+xml"&&Mn[_.namespaceURI]):!1},mt=function(_){Er(t.removed,{element:_});try{E(_).removeChild(_)}catch(A){Z(_)}},bt=function(_,A){try{Er(t.removed,{attribute:A.getAttributeNode(_),from:A})}catch(z){Er(t.removed,{attribute:null,from:A})}if(A.removeAttribute(_),_==="is")if(Ue||st)try{mt(A)}catch(z){}else try{A.setAttribute(_,"")}catch(z){}},Xo=function(_){let A=null,z=null;if(mn)_="<remove></remove>"+_;else{const Se=Hs(_,/^[\r\n\t ]+/);z=Se&&Se[0]}Kt==="application/xhtml+xml"&&kn===St&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const ae=S?S.createHTML(_):_;if(kn===St)try{A=new g().parseFromString(ae,Kt)}catch(Se){}if(!A||!A.documentElement){A=q.createDocument(kn,"template",null);try{A.documentElement.innerHTML=Dn?P:ae}catch(Se){}}const Ze=A.body||A.documentElement;return _&&z&&Ze.insertBefore(n.createTextNode(z),Ze.childNodes[0]||null),kn===St?Pe.call(A,Re?"html":"body")[0]:Re?A.documentElement:Ze},Hr=function(_){return Y.call(_.ownerDocument||_,_,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Fr=function(_){return _ instanceof m&&(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")},Ko=function(_){return typeof d=="function"&&_ instanceof d};function Et(U,_,A){wo(U,z=>{z.call(t,_,A,_n)})}const Qo=function(_){let A=null;if(Et(ee.beforeSanitizeElements,_,null),Fr(_))return mt(_),!0;const z=fe(_.nodeName);if(Et(ee.uponSanitizeElement,_,{tagName:z,allowedTags:le}),je&&_.hasChildNodes()&&!Ko(_.firstElementChild)&&Ve(/<[/\w!]/g,_.innerHTML)&&Ve(/<[/\w!]/g,_.textContent)||_.nodeType===Rr.progressingInstruction||je&&_.nodeType===Rr.comment&&Ve(/<[/\w]/g,_.data))return mt(_),!0;if(!(Oe.tagCheck instanceof Function&&Oe.tagCheck(z))&&(!le[z]||X[z])){if(!X[z]&&ts(z)&&(N.tagNameCheck instanceof RegExp&&Ve(N.tagNameCheck,z)||N.tagNameCheck instanceof Function&&N.tagNameCheck(z)))return!1;if(Mr&&!tt[z]){const ae=E(_)||_.parentNode,Ze=j(_)||_.childNodes;if(Ze&&ae){const Se=Ze.length;for(let We=Se-1;We>=0;--We){const At=T(Ze[We],!0);At.__removalCount=(_.__removalCount||0)+1,ae.insertBefore(At,Q(_))}}}return mt(_),!0}return _ instanceof u&&!fi(_)||(z==="noscript"||z==="noembed"||z==="noframes")&&Ve(/<\/no(script|embed|frames)/i,_.innerHTML)?(mt(_),!0):(pe&&_.nodeType===Rr.text&&(A=_.textContent,wo([$e,ot,Nt],ae=>{A=Ar(A,ae," ")}),_.textContent!==A&&(Er(t.removed,{element:_.cloneNode()}),_.textContent=A)),Et(ee.afterSanitizeElements,_,null),!1)},es=function(_,A,z){if(Xt&&(A==="id"||A==="name")&&(z in n||z in Yo))return!1;if(!(de&&!Ee[A]&&Ve(fn,A))){if(!(ue&&Ve(xt,A))){if(!(Oe.attributeCheck instanceof Function&&Oe.attributeCheck(A,_))){if(!we[A]||Ee[A]){if(!(ts(_)&&(N.tagNameCheck instanceof RegExp&&Ve(N.tagNameCheck,_)||N.tagNameCheck instanceof Function&&N.tagNameCheck(_))&&(N.attributeNameCheck instanceof RegExp&&Ve(N.attributeNameCheck,A)||N.attributeNameCheck instanceof Function&&N.attributeNameCheck(A,_))||A==="is"&&N.allowCustomizedBuiltInElements&&(N.tagNameCheck instanceof RegExp&&Ve(N.tagNameCheck,z)||N.tagNameCheck instanceof Function&&N.tagNameCheck(z))))return!1}else if(!Ur[A]){if(!Ve(Vt,Ar(z,Jt,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&_!=="script"&&Cm(z,"data:")===0&&he[_])){if(!(On&&!Ve(Wt,Ar(z,Jt,"")))){if(z)return!1}}}}}}}return!0},ts=function(_){return _!=="annotation-xml"&&Hs(_,Yt)},Br=function(_){Et(ee.beforeSanitizeAttributes,_,null);const{attributes:A}=_;if(!A||Fr(_))return;const z={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:we,forceKeepAttr:void 0};let ae=A.length;for(;ae--;){const Ze=A[ae],{name:Se,namespaceURI:We,value:At}=Ze,Mt=fe(Se),Gr=At;let De=Se==="value"?Gr:Pm(Gr);if(z.attrName=Mt,z.attrValue=De,z.keepAttr=!0,z.forceKeepAttr=void 0,Et(ee.uponSanitizeAttribute,_,z),De=z.attrValue,Dr&&(Mt==="id"||Mt==="name")&&(bt(Se,_),De=ui+De),je&&Ve(/((--!?|])>)|<\/(style|title|textarea)/i,De)){bt(Se,_);continue}if(Mt==="attributename"&&Hs(De,"href")){bt(Se,_);continue}if(z.forceKeepAttr)continue;if(!z.keepAttr){bt(Se,_);continue}if(!gn&&Ve(/\/>/i,De)){bt(Se,_);continue}pe&&wo([$e,ot,Nt],rs=>{De=Ar(De,rs," ")});const ns=fe(_.nodeName);if(!es(ns,Mt,De)){bt(Se,_);continue}if(S&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!We)switch(k.getAttributeType(ns,Mt)){case"TrustedHTML":{De=S.createHTML(De);break}case"TrustedScriptURL":{De=S.createScriptURL(De);break}}if(De!==Gr)try{We?_.setAttributeNS(We,Se,De):_.setAttribute(Se,De),Fr(_)?mt(_):wc(t.removed)}catch(rs){bt(Se,_)}}Et(ee.afterSanitizeAttributes,_,null)},Qt=function U(_){let A=null;const z=Hr(_);for(Et(ee.beforeSanitizeShadowDOM,_,null);A=z.nextNode();)Et(ee.uponSanitizeShadowNode,A,null),Qo(A),Br(A),A.content instanceof i&&U(A.content);Et(ee.afterSanitizeShadowDOM,_,null)};return t.sanitize=function(U){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,z=null,ae=null,Ze=null;if(Dn=!U,Dn&&(U="<!-->"),typeof U!="string"&&!Ko(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw Cr("dirty is not a string, aborting")}else throw Cr("toString is not a function");if(!t.isSupported)return U;if(Ne||gr(_),t.removed=[],typeof U=="string"&&(Nn=!1),Nn){if(U.nodeName){const At=fe(U.nodeName);if(!le[At]||X[At])throw Cr("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof d)A=Xo("<!---->"),z=A.ownerDocument.importNode(U,!0),z.nodeType===Rr.element&&z.nodeName==="BODY"||z.nodeName==="HTML"?A=z:A.appendChild(z);else{if(!Ue&&!pe&&!Re&&U.indexOf("<")===-1)return S&&Dt?S.createHTML(U):U;if(A=Xo(U),!A)return Ue?null:Dt?P:""}A&&mn&&mt(A.firstChild);const Se=Hr(Nn?U:A);for(;ae=Se.nextNode();)Qo(ae),Br(ae),ae.content instanceof i&&Qt(ae.content);if(Nn)return U;if(Ue){if(st)for(Ze=xe.call(A.ownerDocument);A.firstChild;)Ze.appendChild(A.firstChild);else Ze=A;return(we.shadowroot||we.shadowrootmode)&&(Ze=lt.call(r,Ze,!0)),Ze}let We=Re?A.outerHTML:A.innerHTML;return Re&&le["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&Ve(Cc,A.ownerDocument.doctype.name)&&(We="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
|
|
1583
|
+
`+We),pe&&wo([$e,ot,Nt],At=>{We=Ar(We,At," ")}),S&&Dt?S.createHTML(We):We},t.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};gr(U),Ne=!0},t.clearConfig=function(){_n=null,Ne=!1},t.isValidAttribute=function(U,_,A){_n||gr({});const z=fe(U),ae=fe(_);return es(z,ae,A)},t.addHook=function(U,_){typeof _=="function"&&Er(ee[U],_)},t.removeHook=function(U,_){if(_!==void 0){const A=Em(ee[U],_);return A===-1?void 0:Am(ee[U],A,1)[0]}return wc(ee[U])},t.removeHooks=function(U){ee[U]=[]},t.removeAllHooks=function(){ee=Rc()},t}var Fm=Lc();function Ic(e){const t=se.parse(e,{gfm:!0,breaks:!0,async:!1});return Fm.sanitize(t)}const zc=1e3,Bm=32,$c=15e3,Gm=new Set(["completed","failed","cancelled"]),Wm=4e3;let L=null,It=null,Fe=null,Js=null,To=null,Ys=!1,Eo=null,Lr=null,F={kind:"connecting"},er=[],at=!0,tr=null,ve=null,nr=null,qt=null,Ir=-1,Ke=null,Ht=!1,Ft=null,Tn=new Set;function Vs(){Co(),Xa(),It&&clearInterval(It),It=null,Ft==null||Ft(),Ft=null,Fe==null||Fe.destroy(),Fe=null,L&&Ut(L),L==null||L.remove(),L=null,Js=null,F={kind:"connecting"},er=[],at=!0,tr=null,ve=null,nr=null,qt=null,To=null,Ir=-1,Ke=null,Ht=!1,Tn=new Set}function Xs(e,t,n,r,o){L&&Vs(),Js=o!=null?o:null,F={kind:"connecting"},er=[],at=!0,tr=null,Ir=-1,Ke=null,Ht=!1,Tn=new Set,ve=e,nr=n,qt=t,To=r,Va({taskId:e,backendUrl:n,title:r}),L=document.createElement("div"),L.className="ap-sdk-panel",L.setAttribute("data-ap-sdk","1"),L.setAttribute("role","dialog"),L.setAttribute("aria-modal","true"),L.setAttribute("aria-label","Automation in progress");const i=r.length>55?`${r.slice(0,52)}…`:r;L.innerHTML=`
|
|
1549
1584
|
<div class="ap-sdk-panel__header">
|
|
1550
1585
|
<span class="ap-sdk-panel__title">
|
|
1551
1586
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1558,7 +1593,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
|
|
|
1558
1593
|
<div class="ap-sdk-runner__meta">
|
|
1559
1594
|
<div class="ap-sdk-runner__meta-row">
|
|
1560
1595
|
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--automate">Automate</span>
|
|
1561
|
-
<span class="ap-sdk-runner__title" title="${
|
|
1596
|
+
<span class="ap-sdk-runner__title" title="${sb(r)}">${Qs(i)}</span>
|
|
1562
1597
|
</div>
|
|
1563
1598
|
<div class="ap-sdk-runner__meta-row ap-sdk-runner__meta-row--controls">
|
|
1564
1599
|
<span class="ap-sdk-runner__counter" data-ap-runner-counter>0 actions</span>
|
|
@@ -1567,6 +1602,10 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
|
|
|
1567
1602
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-runner__cancel-btn" data-ap-runner-cancel type="button">Cancel task</button>
|
|
1568
1603
|
</div>
|
|
1569
1604
|
</div>
|
|
1605
|
+
<div class="ap-sdk-runner__log-toolbar">
|
|
1606
|
+
<button type="button" class="ap-sdk-runner__scroll-toggle" data-ap-runner-scroll-toggle>Auto ↓</button>
|
|
1607
|
+
<button type="button" class="ap-sdk-runner__scroll-jump" data-ap-runner-scroll-jump title="Jump to latest output">Jump to latest</button>
|
|
1608
|
+
</div>
|
|
1570
1609
|
<div class="ap-sdk-runner__log" data-ap-runner-log></div>
|
|
1571
1610
|
<div class="ap-sdk-runner__chat" data-ap-runner-chat>
|
|
1572
1611
|
<div class="ap-sdk-runner__question" data-ap-runner-question style="display:none"></div>
|
|
@@ -1584,17 +1623,17 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
|
|
|
1584
1623
|
</div>
|
|
1585
1624
|
<div class="ap-sdk-runner__hint" data-ap-runner-hint>Closing keeps the task running — resume anytime from My Captures.</div>
|
|
1586
1625
|
<div class="ap-sdk-panel__status" data-ap-runner-summary style="display:none"></div>
|
|
1587
|
-
`,
|
|
1588
|
-
<div class="ap-sdk-runner__question-label">${
|
|
1589
|
-
<div class="ap-sdk-runner__question-text ap-sdk-markdown">${
|
|
1626
|
+
`,L.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),L.addEventListener("touchmove",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild(L),Fe=us(),jt(L),Ps(L,Cs),L.querySelector("[data-ap-close]").addEventListener("click",()=>{Vs(),o==null||o()}),L.querySelector("[data-ap-runner-chat-form]").addEventListener("submit",a=>{a.preventDefault(),Vm(t,e)}),L.querySelector("[data-ap-runner-cancel]").addEventListener("click",a=>{a.stopPropagation();const d=a.currentTarget;if(!Ys){Ys=!0,d.textContent="Confirm",Eo=setTimeout(Co,Wm),Lr=u=>{u.target!==d&&Co()},document.addEventListener("click",Lr,!0);return}Co(),Jm(t,e)}),L.querySelector("[data-ap-runner-scroll-toggle]").addEventListener("click",()=>{at=!at,at&&Oc(),Ao()}),L.querySelector("[data-ap-runner-scroll-jump]").addEventListener("click",()=>{at=!0,Oc(),Ao()}),L.querySelector("[data-ap-runner-log]").addEventListener("scroll",()=>{if(!at||!L)return;const a=L.querySelector("[data-ap-runner-log]");a.scrollHeight-a.scrollTop-a.clientHeight>Bm&&(at=!1,Ao())}),Ks(),Nc(e,t)}function Oc(){const e=L==null?void 0:L.querySelector("[data-ap-runner-log]");e&&(e.scrollTop=e.scrollHeight)}function Ao(){if(!L)return;const e=L.querySelector("[data-ap-runner-scroll-toggle]");e&&(e.textContent=at?"Auto ↓":"Manual",e.title=at?"Disable auto-scroll":"Enable auto-scroll",e.classList.toggle("ap-sdk-runner__scroll-toggle--active",at))}function Nc(e,t){const n=d=>I(null,null,function*(){if(ve!==e||!L||F.kind!=="idle"&&F.kind!=="connecting"||Tn.has(d.commandId))return;Tn.add(d.commandId);const u={id:d.commandId,taskId:d.taskId,action:d.action,selector:d.selector,value:d.value,description:d.description,status:"pending",createdAt:new Date().toISOString()};En({kind:"executing",command:u,actionsRun:F.kind==="idle"?F.actionsRun:0}),yield Mc(u,t,e)}),r=d=>{if(!(ve!==e||!L)&&Gm.has(d)){if(F.kind==="executing")En({kind:"finishing",status:d,actionsRun:F.actionsRun});else if(F.kind==="connecting"||F.kind==="idle"){const u=F.kind==="idle"?F.actionsRun:0;En({kind:"finished",status:d,actionsRun:u})}}},o=d=>{ve!==e||!L||(d.outputChunk&&jc([d.outputChunk]),r(d.status))},i=()=>I(null,null,function*(){var d;if(!(ve!==e||!L))try{const u=yield go(t,e);ve===e&&L&&(Ke=(d=u[0])!=null?d:null,An())}catch(u){}}),a=()=>I(null,null,function*(){var d;try{const[u,p,h,m]=yield Promise.all([Fa(t,e),lg(t,e),go(t,e),ag(t,e)]);if(ve!==e||!L)return;jc(p),Ke=(d=h[0])!=null?d:null,An(),r(u.status),m&&m.status==="pending"&&(F.kind==="idle"||F.kind==="connecting")&&!Tn.has(m.id)?(Tn.add(m.id),En({kind:"executing",command:m,actionsRun:F.kind==="idle"?F.actionsRun:0}),yield Mc(m,t,e)):F.kind==="connecting"&&En({kind:"idle",actionsRun:0})}catch(u){}});a(),vg(t,e,{onStatusUpdate:o,onInteractionCreated:i,onInteractionAnswered:i,onBrowserCommandCreated:n,onReconnect:()=>{a()}}).then(d=>{if(ve!==e||F.kind==="finished"){d();return}Ft=d})}function En(e){F=e,F.kind==="idle"&&tr===null&&(tr=Date.now(),Po(),It=setInterval(Po,zc)),F.kind==="finished"&&(It&&(clearInterval(It),It=null),Ft==null||Ft(),Ft=null,Fe==null||Fe.hide(),Xa()),Ks()}function Co(){Ys=!1,Eo&&(clearTimeout(Eo),Eo=null),Lr&&(document.removeEventListener("click",Lr,!0),Lr=null);const e=L==null?void 0:L.querySelector("[data-ap-runner-cancel]");e&&(e.textContent="Cancel task")}function Jm(e,t){return I(this,null,function*(){if(ve!==t||!L)return;const n=L.querySelector("[data-ap-runner-cancel]");n&&(n.disabled=!0);try{yield dg(e,t)}catch(r){n&&(n.disabled=!1)}})}function Dc(){if(!ve||!qt||!nr||!To)return;const e=ve,t=qt;Va({taskId:e,backendUrl:nr,title:To}),It&&clearInterval(It),Po(),It=setInterval(Po,zc);const n=F.kind==="finished"?F.actionsRun:0;Tn=new Set,F={kind:"idle",actionsRun:n},Ks(),Nc(e,t)}function Ks(){if(!L)return;const e=L.querySelector("[data-ap-runner-status]"),t=L.querySelector("[data-ap-runner-counter]"),n=L.querySelector("[data-ap-runner-log]"),r=L.querySelector("[data-ap-runner-hint]");if(!e||!t||!n||!r)return;const o="actionsRun"in F?F.actionsRun:0;t.textContent=`${o} action${o===1?"":"s"}`,Ao(),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",rb(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(er.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();An();const a=L.querySelector("[data-ap-runner-chat-input]"),d=L.querySelector("[data-ap-runner-chat-send]");if(a&&d){const h=F.kind==="finished"&&F.status==="failed";a.disabled=h,d.disabled=h||Ht,h&&(a.placeholder="This task failed — start a new automation to continue.")}const u=L.querySelector("[data-ap-runner-cancel]");u&&(u.style.display=F.kind==="finished"?"none":"");const p=L.querySelector("[data-ap-runner-summary]");p&&F.kind!=="finished"&&(p.style.display="none",p.innerHTML="")}function An(){var o;if(!L)return;const e=L.querySelector("[data-ap-runner-question]"),t=L.querySelector("[data-ap-runner-chat-input]");if(!e||!t)return;if(!Ke){e.style.display="none",e.innerHTML="",t.placeholder="Send a message to the agent…";return}const n=Ke.questionMetadata,r=(o=n==null?void 0:n.options)!=null?o:[];if(t.placeholder="Type your answer…",e.style.display="block",e.innerHTML=`
|
|
1627
|
+
<div class="ap-sdk-runner__question-label">${Qs((n==null?void 0:n.header)||"The agent has a question")}</div>
|
|
1628
|
+
<div class="ap-sdk-runner__question-text ap-sdk-markdown">${Ic((n==null?void 0:n.question)||Ke.question)}</div>
|
|
1590
1629
|
${r.length>0?'<div class="ap-sdk-runner__question-options" data-ap-runner-question-options></div>':""}
|
|
1591
|
-
`,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
|
|
1630
|
+
`,r.length>0){const i=e.querySelector("[data-ap-runner-question-options]");for(const a of r){const d=document.createElement("button");d.type="button",d.className="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-runner__question-option",d.textContent=a.label,d.addEventListener("click",()=>void Ym(a.label)),i.appendChild(d)}}}function Ym(e){return I(this,null,function*(){var r;if(!L||!Ke||!ve||Ht)return;const t=ve,n=qt;if(n){Ht=!0;try{const o={selectedOption:e};yield Ja(n,t,Ke.id,o),Ke=null,An();const i=yield go(n,t);ve===t&&L&&(Ke=(r=i[0])!=null?r:null,An())}catch(o){const i=L.querySelector("[data-ap-runner-chat-error]");i&&(i.textContent="Failed to send your answer — try again.",i.style.display="block")}finally{Ht=!1}}})}function Po(){if(!L||tr===null)return;const e=L.querySelector("[data-ap-runner-timer]");if(!e)return;const t=Math.max(0,Math.floor((Date.now()-tr)/1e3)),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");e.textContent=`${n}:${r}`}function Mc(e,t,n){return I(this,null,function*(){let r="done",o;try{if(e.action==="getContext"){const a=e.selector?document.querySelector(e.selector):document.body;if(!a)throw new Error(`element not found (${e.selector})`);Fe==null||Fe.update(a),o=Km(a)}else{if(!e.selector)throw new Error(`${e.action} command is missing a selector`);const a=document.querySelector(e.selector);if(!a)throw new Error(`element not found (${e.selector})`);if(Fe==null||Fe.update(a),e.action==="click")yield wg(a),o="Clicked";else{if(e.value===void 0)throw new Error("inputText command is missing a value");Qm(a,e.value),o="Entered text"}}}catch(a){r="error",o=a instanceof Error?a.message:"Unknown error executing command"}if(ve===n&&L&&eb(r,e,o),yield Xm(t,n,e.id,r,o),ve!==n||!L)return;Fe==null||Fe.hide();const i=(F.kind==="executing"||F.kind==="finishing"?F.actionsRun:0)+1;F.kind==="finishing"?En({kind:"finished",status:F.status,actionsRun:i}):F.kind==="executing"&&En({kind:"idle",actionsRun:i})})}function Vm(e,t){return I(this,null,function*(){var a;if(!L||Ht||F.kind==="finished"&&F.status==="failed")return;const n=L.querySelector("[data-ap-runner-chat-input]"),r=L.querySelector("[data-ap-runner-chat-error]"),o=L.querySelector("[data-ap-runner-chat-send]");if(!n||!r||!o)return;const i=n.value.trim();if(i){Ht=!0,o.disabled=!0,r.style.display="none";try{if(Ke){yield Ja(e,t,Ke.id,i),Ke=null,An();try{const d=yield go(e,t);ve===t&&L&&(Ke=(a=d[0])!=null?a:null,An())}catch(d){}}else yield ug(e,t,i),F.kind==="finished"&&Dc();n.value=""}catch(d){r.textContent=d instanceof Error?d.message:"Failed to send — try again.",r.style.display="block"}finally{Ht=!1,o.disabled=!1}}})}function Xm(e,t,n,r,o){return I(this,null,function*(){try{yield cg(e,t,n,r,o)}catch(i){}})}function Km(e){const t=e.cloneNode(!0);t.querySelectorAll("script, style, noscript").forEach(o=>o.remove()),zi(t);let n=t.outerHTML,r=!1;return n.length>$c&&(n=n.slice(0,$c),r=!0),`URL: ${location.href}
|
|
1592
1631
|
Title: ${document.title}
|
|
1593
1632
|
|
|
1594
1633
|
${n}${r?`
|
|
1595
|
-
… (truncated)`:""}`}function
|
|
1634
|
+
… (truncated)`:""}`}function Qm(e,t){var i;const r=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,o=(i=Object.getOwnPropertyDescriptor(r,"value"))==null?void 0:i.set;if(!o)throw new Error("target element does not accept text input");o.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function eb(e,t,n){var h,m;const r=e==="done"?"✓":"✗",o=t.selector?` \`${t.selector}\``:"",i=t.description||`${t.action}${o}`,a=e==="done"&&t.action==="getContext"?`read context (${(h=n==null?void 0:n.length)!=null?h:0} chars)`:n,d=a?` — ${a}`:"";if(er.push({status:e,text:`${r} ${i}${d}`}),!L)return;const u=L.querySelector("[data-ap-runner-log]");if(!u)return;(m=u.querySelector("[data-ap-runner-placeholder]"))==null||m.remove();const p=document.createElement("div");p.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--${e}`,p.textContent=er[er.length-1].text,u.appendChild(p),at&&(u.scrollTop=u.scrollHeight)}function tb(e){var t,n;return(n=(t=e.display)==null?void 0:t.variant)!=null?n:e.sdkEventType}function nb(e){const t=tb(e);return(e.stream==="stdout"||e.stream==="stderr"||e.stream==="sdk_event"&&(t==="text"||t==="thinking"))&&e.data.trim()||null}function jc(e){var r;const t=e.filter(o=>o.sequence>Ir).sort((o,i)=>o.sequence-i.sequence);if(t.length===0||(Ir=Math.max(Ir,...t.map(o=>o.sequence)),!L))return;const n=L.querySelector("[data-ap-runner-log]");if(n)for(const o of t){const i=nb(o);if(!i)continue;(r=n.querySelector("[data-ap-runner-placeholder]"))==null||r.remove();const a=document.createElement("div");a.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--output ap-sdk-runner__log-entry--${o.stream}`,o.stream==="sdk_event"?(a.classList.add("ap-sdk-markdown"),a.innerHTML=Ic(i)):a.textContent=i,n.appendChild(a),at&&(n.scrollTop=n.scrollHeight)}}function rb(e){if(!L||!ve||!nr)return;const t=L.querySelector("[data-ap-runner-summary]");if(!t)return;const n=`${nr.replace(/\/+$/,"")}/tasks/${ve}`,r=e==="completed"?"Automation complete!":"Automation ended",o=e==="completed",i=o?"ap-sdk-panel__btn--secondary":"ap-sdk-panel__btn--primary";t.style.display="block",t.innerHTML=`
|
|
1596
1635
|
<div class="ap-sdk-success-card">
|
|
1597
|
-
<p class="ap-sdk-success-headline">${
|
|
1636
|
+
<p class="ap-sdk-success-headline">${Qs(r)}</p>
|
|
1598
1637
|
${o?`
|
|
1599
1638
|
<div class="ap-sdk-runner__approval" data-ap-runner-approval>
|
|
1600
1639
|
<div class="ap-sdk-runner__approval-actions">
|
|
@@ -1614,7 +1653,7 @@ ${n}${r?`
|
|
|
1614
1653
|
<button class="ap-sdk-runner__text-btn" data-ap-runner-close>Close</button>
|
|
1615
1654
|
</div>
|
|
1616
1655
|
</div>
|
|
1617
|
-
`,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const a=
|
|
1656
|
+
`,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const a=Js;Vs(),a==null||a()}),o&&ob(t)}function ob(e){const t=e.querySelector("[data-ap-runner-approve]"),n=e.querySelector("[data-ap-runner-reject]"),r=e.querySelector("[data-ap-runner-reject-form]"),o=e.querySelector("[data-ap-runner-reject-feedback]"),i=e.querySelector("[data-ap-runner-reject-submit]"),a=e.querySelector("[data-ap-runner-approval-error]"),d=e.querySelector(".ap-sdk-runner__approval-actions"),u=h=>{a.textContent=h,a.style.display="block"};t.addEventListener("click",()=>I(null,null,function*(){if(!ve||!qt)return;const h=ve,m=qt;t.disabled=!0,n.disabled=!0,a.style.display="none";try{yield pg(m,h),d.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--approved">✓ Approved</span>',r.style.display="none"}catch(g){t.disabled=!1,n.disabled=!1,u(g instanceof Error?g.message:"Failed to approve — try again.")}})),n.addEventListener("click",()=>{r.style.display=r.style.display==="none"?"block":"none",r.style.display==="block"&&o.focus()});const p=()=>{i.textContent=o.value.trim()?"Reject & Continue":"Reject Permanently"};o.addEventListener("input",p),i.addEventListener("click",()=>I(null,null,function*(){if(!ve||!qt)return;const h=ve,m=qt,g=o.value.trim();i.disabled=!0,t.disabled=!0,a.style.display="none",i.textContent="Rejecting…";try{yield hg(m,h,g),g?Dc():(d.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--rejected">✕ Rejected</span>',r.style.display="none")}catch(k){i.disabled=!1,t.disabled=!1,p(),u(k instanceof Error?k.message:"Failed to reject — try again.")}}))}function sb(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Qs(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function ib(e,t,n){const r=!!(t.backendUrl&&t.token),o=document.createElement("div");o.className="ap-sdk-advanced",o.innerHTML=`
|
|
1618
1657
|
<details class="ap-sdk-advanced__details">
|
|
1619
1658
|
<summary class="ap-sdk-advanced__summary">Advanced options</summary>
|
|
1620
1659
|
<div class="ap-sdk-advanced__body">
|
|
@@ -1633,12 +1672,12 @@ ${n}${r?`
|
|
|
1633
1672
|
</div>
|
|
1634
1673
|
</div>
|
|
1635
1674
|
</details>
|
|
1636
|
-
`,e.appendChild(o);const i=o.querySelector("[data-ap-adv-template-field]"),a=o.querySelector("[data-ap-template]"),d=o.querySelector("[data-ap-quickmode]");let u=[];if(r){const p={backendUrl:t.backendUrl,token:t.token};
|
|
1637
|
-
`)}const
|
|
1675
|
+
`,e.appendChild(o);const i=o.querySelector("[data-ap-adv-template-field]"),a=o.querySelector("[data-ap-template]"),d=o.querySelector("[data-ap-quickmode]");let u=[];if(r){const p={backendUrl:t.backendUrl,token:t.token};og(p,n!=null?n:void 0).then(h=>{var g,k;if(u=h,h.length===0){i.style.display="none";return}const m=(g=h.find(v=>v.isDefault&&v.scope==="project"))!=null?g:h.find(v=>v.isDefault&&v.scope==="global");a.innerHTML='<option value="">None (use default)</option>'+h.map(v=>`<option value="${ab(v.id)}">${cb(v.name)}${v.isDefault?" (Default)":""}</option>`).join(""),a.value=(k=m==null?void 0:m.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 m,g,k,v,T,Z,Q,j;const p=a.value||null,h=p?(g=(m=u.find(E=>E.id===p))==null?void 0:m.templateData)!=null?g:{}:{};return y(y(y(y(y(y(y(y(y(y({claudeTemplateId:p,quickMode:d.checked},h.modelOverride!=null?{modelOverride:h.modelOverride}:{}),h.claudeProfileId!=null?{claudeProfileId:h.claudeProfileId}:{}),h.effort!=null?{effort:h.effort}:{}),h.executionMode!=null?{executionMode:h.executionMode}:{}),(k=h.selectedPluginIds)!=null&&k.length?{selectedPluginIds:h.selectedPluginIds}:{}),(v=h.selectedSkillIds)!=null&&v.length?{selectedSkillIds:h.selectedSkillIds}:{}),(T=h.selectedPluginSkillIds)!=null&&T.length?{selectedPluginSkillIds:h.selectedPluginSkillIds}:{}),(Z=h.selectedMcpServerIds)!=null&&Z.length?{selectedMcpServerIds:h.selectedMcpServerIds}:{}),(Q=h.selectedSlashCommandIds)!=null&&Q.length?{selectedSlashCommandIds:h.selectedSlashCommandIds}:{}),(j=h.selectedRemoteContextProviderIds)!=null&&j.length?{selectedRemoteContextProviderIds:h.selectedRemoteContextProviderIds}:{})}}}function ab(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function cb(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const ei="ap-sdk-captures",lb=50;function rr(){try{const e=localStorage.getItem(ei);return e?JSON.parse(e):[]}catch(e){return[]}}function ub(e){const t=rr(),n=[e,...t].slice(0,lb);try{localStorage.setItem(ei,JSON.stringify(n))}catch(r){}}function db(){try{localStorage.removeItem(ei)}catch(e){}}function Uc(e){var a,d,u,p,h;if(e.id){const m=document.querySelector(`label[for="${CSS.escape(e.id)}"]`),g=(a=m==null?void 0:m.textContent)==null?void 0:a.trim();if(g)return g}const t=e.closest("label"),n=(d=t==null?void 0:t.textContent)==null?void 0:d.trim();if(n)return n;const r=(u=e.getAttribute("aria-label"))==null?void 0:u.trim();if(r)return r;const o=(p=e.placeholder)==null?void 0:p.trim();if(o)return o;const i=(h=e.getAttribute("name"))==null?void 0:h.trim();return i||e.tagName.toLowerCase()}function pb(e,t){return`Click "${e}" ${t.toLowerCase()}`}function Zc(e,t,n){return n?`Typed [redacted] into ${e}`:`Typed "${t}" into ${e}`}function qc(e,t){return`Scrolled to (${e}, ${t})`}function hb(e,t){return t?`Pressed "${e}" in ${t}`:`Pressed "${e}"`}function Hc(e){return e.map((t,n)=>`${n+1}. ${t.description}`).join(`
|
|
1676
|
+
`)}const fb=400,gb=new Set(["Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),mb=new Set(["Control","Meta","Alt","Shift"]);function bb(e){if(mb.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("+")):gb.has(e.key)?e.key:null}function kb(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?Uc(e):Kr(e)||e.tagName.toLowerCase()}let or=[],Qe=null,Ro=null,rt=null,zt=null,$t=null;function Fc(){Ro&&(Ro.textContent=`● Recording — ${or.length} step${or.length===1?"":"s"}`)}function ti(){$t&&(clearTimeout($t),$t=null),zt&&(or.push(zt),zt=null,Fc())}function ni(e){ti(),or.push(e),Fc()}function _b(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 vb(e,t){rt&&rt(),or=[],zt=null,Qe=document.createElement("div"),Qe.className="ap-sdk-recorder-bar",Qe.setAttribute("data-ap-sdk","1"),Qe.innerHTML=`
|
|
1638
1677
|
<span class="ap-sdk-recorder-bar__counter" data-ap-recorder-counter>● Recording — 0 steps</span>
|
|
1639
1678
|
<button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--stop" data-ap-recorder-stop type="button">Stop</button>
|
|
1640
1679
|
<button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--discard" data-ap-recorder-discard type="button">Discard</button>
|
|
1641
|
-
`,document.body.appendChild(Qe),
|
|
1680
|
+
`,document.body.appendChild(Qe),jt(Qe),Ro=Qe.querySelector("[data-ap-recorder-counter]");const n=()=>{ti();const u=or;rt==null||rt(),e(u)},r=()=>{rt==null||rt()};Qe.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),Qe.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=u=>{if(kr(u.target))return;const p=u.target;ni({action:"click",cssSelector:Xr(p),elementText:Kr(p),description:pb(Kr(p),p.tagName),capturedAt:new Date().toISOString()})},i=u=>{if(kr(u.target))return;const p=u.target;if(!(p instanceof HTMLInputElement)&&!(p instanceof HTMLTextAreaElement)&&!(p instanceof HTMLSelectElement))return;const h=Uc(p),m=su(p),g=m?"[redacted]":_b(p);ni(D(y({action:"inputText",cssSelector:Xr(p),elementText:h,value:g},m?{redacted:!0}:{}),{description:Zc(h,g,m),capturedAt:new Date().toISOString()}))},a=()=>{const u=Math.round(window.scrollX),p=Math.round(window.scrollY);zt?(zt.scrollX=u,zt.scrollY=p,zt.description=qc(u,p)):zt={action:"scroll",scrollX:u,scrollY:p,description:qc(u,p),capturedAt:new Date().toISOString()},$t&&clearTimeout($t),$t=setTimeout(()=>{$t=null,ti()},fb)},d=u=>{if(u.key==="Escape"){r();return}if(kr(u.target))return;const p=bb(u);if(!p)return;const h=u.target instanceof Element?u.target:document.body,m=kb(h);ni({action:"keypress",cssSelector:Xr(h),elementText:m,key:p,description:hb(p,m),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}),$t&&(clearTimeout($t),$t=null),zt=null,Qe&&Ut(Qe),Qe==null||Qe.remove(),Qe=null,Ro=null,rt=null}}function yb(){rt==null||rt()}function Lo(){return rt!==null}const wb="data-ap-sdk",xb="ap-sdk-fab",Bc="ap-sdk-fab--dragging",ri="ap-sdk-fab--open",Gc="ap-sdk-fab-pos",Io="ap-sdk-fab--left-edge",Sb='<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>',Tb='<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>',Eb='<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>',Ab='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>';let $=null,Ot=null,ln=null,un=null,ft=null,sr=null,ir=null,ar=null,zo=null,zr=null,cr=null,$o=null,Oo=null,No=null,Wc=0,Jc=0,Yc=0,Vc=0,lr=!1,wt=!1,$r=null,Cn=null;function Cb(){$r=e=>{if(!$){Do();return}if(!lr){if(Math.hypot(e.clientX-Yc,e.clientY-Vc)<5)return;lr=!0,wt=!0,$.classList.add(Bc)}Pb(e.clientX-Wc,e.clientY-Jc)},Cn=()=>{if(!$){Do();return}lr?(lr=!1,$.classList.remove(Bc),$.style.transition="",Rb($.getBoundingClientRect())):$.style.transition="",Do()},window.addEventListener("pointermove",$r),window.addEventListener("pointerup",Cn),window.addEventListener("pointercancel",Cn)}function Do(){$r&&(window.removeEventListener("pointermove",$r),$r=null),Cn&&(window.removeEventListener("pointerup",Cn),window.removeEventListener("pointercancel",Cn),Cn=null)}function Pb(e,t){if(!$)return;const n=$.offsetWidth||52,r=$.offsetHeight||52;$.style.top=`${Math.max(0,Math.min(t,window.innerHeight-r))}px`,$.style.left=`${Math.max(0,Math.min(e,window.innerWidth-n))}px`,$.style.bottom="auto",$.style.right="auto"}function Rb(e){if(!$)return;const n=Math.max(16,Math.min(window.innerHeight-e.bottom,window.innerHeight-52-16)),r=e.left+e.width/2<window.innerWidth/2?"left":"right";$.style.top="auto",$.style.bottom=`${n}px`,r==="left"?($.style.right="auto",$.style.left="16px",$.classList.add(Io)):($.style.left="auto",$.style.right="16px",$.classList.remove(Io));try{localStorage.setItem(Gc,JSON.stringify({edge:r,bottom:n}))}catch(o){}}function Lb(){if($)try{const e=localStorage.getItem(Gc);if(!e)return;const t=JSON.parse(e);if(typeof t.bottom!="number"||t.edge!=="left"&&t.edge!=="right")return;const r=Math.max(16,Math.min(t.bottom,window.innerHeight-52-16));$.style.top="auto",$.style.bottom=`${r}px`,t.edge==="left"?($.style.right="auto",$.style.left="16px",$.classList.add(Io)):($.style.left="auto",$.style.right="16px",$.classList.remove(Io))}catch(e){}}function ur(){$==null||$.classList.remove(ri),cr&&(window.removeEventListener("pointerdown",cr,{capture:!0}),cr=null)}function Ib(){$&&($.classList.add(ri),cr=e=>{!$||$.contains(e.target)||ur()},requestAnimationFrame(()=>{cr&&window.addEventListener("pointerdown",cr,{capture:!0})}))}function Mo(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function Xc(e,t,n){var d;if($o=e,Oo=t,No=n,$)return;$=document.createElement("div"),$.className=xb,$.setAttribute(wb,"1"),sr=document.createElement("div"),sr.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="View captures",ft=document.createElement("button"),ft.className="ap-sdk-fab__list ap-sdk-fab__sub",ft.setAttribute("aria-label","My captures"),ft.setAttribute("title","View my captures"),ft.appendChild(Mo(Ab));const o=document.createElement("span");o.className="ap-sdk-fab__badge",o.setAttribute("data-ap-badge",""),o.style.display="none",ft.appendChild(o),sr.appendChild(r),sr.appendChild(ft),ir=document.createElement("div"),ir.className="ap-sdk-fab__row";const i=document.createElement("span");i.className="ap-sdk-fab__label",i.textContent="Capture element",ln=document.createElement("button"),ln.className="ap-sdk-fab__capture ap-sdk-fab__sub",ln.setAttribute("aria-label","Capture element"),ln.setAttribute("title","Capture element to Agent Platform"),ln.appendChild(Mo(Tb)),ir.appendChild(i),ir.appendChild(ln),ar=document.createElement("div"),ar.className="ap-sdk-fab__row";const a=document.createElement("span");a.className="ap-sdk-fab__label",a.textContent="Record interaction",un=document.createElement("button"),un.className="ap-sdk-fab__record ap-sdk-fab__sub",un.setAttribute("aria-label","Record interaction"),un.setAttribute("title","Record a sequence of interactions"),un.appendChild(Mo(Eb)),ar.appendChild(a),ar.appendChild(un),Ot=document.createElement("button"),Ot.className="ap-sdk-fab__main",Ot.setAttribute("aria-label","Agent Platform"),Ot.setAttribute("title","Agent Platform"),Ot.appendChild(Mo(Sb)),$.appendChild(sr),$.appendChild(ir),$.appendChild(ar),$.appendChild(Ot),Ot.addEventListener("click",u=>{if(wt){wt=!1;return}u.preventDefault(),u.stopPropagation(),$!=null&&$.classList.contains(ri)?ur():Ib()}),ln.addEventListener("click",u=>{if(wt){wt=!1;return}u.preventDefault(),u.stopPropagation(),ur(),!Fn()&&!Lo()&&$o&&$o()}),un.addEventListener("click",u=>{if(wt){wt=!1;return}u.preventDefault(),u.stopPropagation(),ur(),!Fn()&&!Lo()&&Oo&&Oo()}),ft.addEventListener("click",u=>{if(wt){wt=!1;return}u.preventDefault(),u.stopPropagation(),ur(),No&&No()}),zr=u=>{if(!$||!($===u.target||$.contains(u.target)))return;const p=$.getBoundingClientRect();Wc=u.clientX-p.left,Jc=u.clientY-p.top,Yc=u.clientX,Vc=u.clientY,lr=!1,wt=!1,$.style.transition="none",u.stopPropagation(),Cb()},window.addEventListener("pointerdown",zr,{capture:!0}),((d=document.body)!=null?d:document.documentElement).appendChild($),jt($),Lb(),zo=setInterval(()=>{Ot&&Ot.classList.toggle("ap-sdk-fab__main--active",Fn()||Lo())},200)}function Pn(e){const t=ft==null?void 0:ft.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function Kc(){lr=!1,wt=!1,Do(),ur(),zo&&(clearInterval(zo),zo=null),zr&&(window.removeEventListener("pointerdown",zr,{capture:!0}),zr=null),$&&Ut($),$==null||$.remove(),$=null,Ot=null,ln=null,un=null,ft=null,sr=null,ir=null,ar=null,$o=null,Oo=null,No=null}function Qc(e,t){return I(this,null,function*(){try{if(e.type==="planning"){const r=yield sg(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=yield Fa(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch(n){return{capture:e,status:"unavailable",approved:!1}}})}function el(e){return e.filter(t=>!t.approved).length}function tl(e){return I(this,null,function*(){const t=rr();if(!e||t.length===0){Pn(t.length);return}const n=yield Promise.all(t.map(r=>Qc(r,e)));Pn(el(n))})}let W=null,et=null,Bt=null;function Or(){return W!==null}function Nr(){W&&Ut(W),W==null||W.remove(),W=null,Bt==null||Bt(),Bt=null,et==null||et.destroy(),et=null}function nl(e,t,n,r,o,i,a,d,u,p,h=null){var $n;W&&Nr();const m=!n.backendUrl||!n.token,g=Ga(h,"tasks:write"),k=Ga(h,"planning-sessions:write"),v={captureType:!g&&k?"planning":"task",submitting:!1,completedPicks:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1,allowSubmit:!1};W=document.createElement("div"),W.className="ap-sdk-panel",W.setAttribute("data-ap-sdk","1"),W.setAttribute("role","dialog"),W.setAttribute("aria-modal","true"),W.setAttribute("aria-label","Capture to Agent Platform"),W.innerHTML=`
|
|
1642
1681
|
<div class="ap-sdk-panel__header">
|
|
1643
1682
|
<span class="ap-sdk-panel__title">
|
|
1644
1683
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1651,7 +1690,7 @@ ${n}${r?`
|
|
|
1651
1690
|
</div>
|
|
1652
1691
|
<div class="ap-sdk-pick-list" data-ap-pick-list style="display:none"></div>
|
|
1653
1692
|
<div class="ap-sdk-panel__context" data-ap-context>
|
|
1654
|
-
${
|
|
1693
|
+
${rl(e)}
|
|
1655
1694
|
</div>
|
|
1656
1695
|
<div class="ap-sdk-panel__pick-actions" data-ap-pick-actions>
|
|
1657
1696
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-panel__btn--select-parent" data-ap-select-parent type="button">
|
|
@@ -1699,41 +1738,41 @@ ${n}${r?`
|
|
|
1699
1738
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-submit>Submit</button>
|
|
1700
1739
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-cancel>Cancel</button>
|
|
1701
1740
|
</div>
|
|
1702
|
-
`,W.addEventListener("wheel",N=>{N.stopPropagation()},{passive:!0}),W.addEventListener("touchmove",N=>{N.stopPropagation()},{passive:!0});const T=W.querySelector(".ap-sdk-panel__body"),Z=
|
|
1741
|
+
`,W.addEventListener("wheel",N=>{N.stopPropagation()},{passive:!0}),W.addEventListener("touchmove",N=>{N.stopPropagation()},{passive:!0});const T=W.querySelector(".ap-sdk-panel__body"),Z=ib(T,n,($n=r==null?void 0:r.id)!=null?$n:null);document.body.appendChild(W),et=us(),v.currentPickedEl&&et.update(v.currentPickedEl),jt(W),Ps(W,Cs);const Q=W.querySelector("[data-ap-close]"),j=W.querySelector("[data-ap-cancel]"),E=W.querySelector("[data-ap-submit]"),S=W.querySelector("[data-ap-note]"),P=W.querySelector("[data-ap-status]"),q=W.querySelectorAll("[data-ap-type]"),Y=W.querySelector("[data-ap-automate-options]"),xe=W.querySelector("[data-ap-allow-submit]"),Pe=W.querySelector("[data-ap-pick-list]"),lt=W.querySelector("[data-ap-context]"),ee=W.querySelector("[data-ap-add-another]"),$e=W.querySelector("[data-ap-pick-actions]"),ot=W.querySelector("[data-ap-select-parent]"),Nt=W.querySelector("[data-ap-reselect]"),fn=()=>{v.currentPickedEl&&(et==null||et.update(v.currentPickedEl))};window.addEventListener("scroll",fn,{capture:!0,passive:!0}),window.addEventListener("resize",fn),Bt=()=>{window.removeEventListener("scroll",fn,!0),window.removeEventListener("resize",fn)};const xt=N=>{N?(lt.innerHTML=rl(N),S.disabled=!1,S.placeholder="Describe the task or planning session…",setTimeout(()=>S.focus(),50)):(lt.innerHTML=`
|
|
1703
1742
|
<div class="ap-sdk-panel__context-label">Next element</div>
|
|
1704
1743
|
<div class="ap-sdk-panel__context-text ap-sdk-awaiting-pick">👆 Hover and click any element on the page</div>
|
|
1705
|
-
`,S.disabled=!0,S.placeholder="Pick an element to continue…")},
|
|
1744
|
+
`,S.disabled=!0,S.placeholder="Pick an element to continue…")},Wt=()=>{if(v.completedPicks.length===0){Pe.style.display="none",Pe.innerHTML="";return}Pe.style.display="block",Pe.innerHTML=v.completedPicks.map((N,X)=>{var Ee;return`
|
|
1706
1745
|
<div class="ap-sdk-pick-entry" data-pick-index="${X}">
|
|
1707
1746
|
<div class="ap-sdk-pick-entry__header">
|
|
1708
1747
|
<span class="ap-sdk-pick-entry__number">${X+1}</span>
|
|
1709
|
-
<span class="ap-sdk-pick-entry__element" title="${
|
|
1748
|
+
<span class="ap-sdk-pick-entry__element" title="${ct((Ee=N.ctx.elementText)!=null?Ee:"")}">${ct(N.ctx.elementText||"(no text)")}</span>
|
|
1710
1749
|
<button class="ap-sdk-pick-entry__remove" data-ap-remove="${X}" aria-label="Remove pick ${X+1}">×</button>
|
|
1711
1750
|
</div>
|
|
1712
|
-
<div class="ap-sdk-pick-entry__instruction">${
|
|
1751
|
+
<div class="ap-sdk-pick-entry__instruction">${ct(N.instruction)}</div>
|
|
1713
1752
|
</div>
|
|
1714
|
-
`}).join(""),Pe.querySelectorAll("[data-ap-remove]").forEach(N=>{N.addEventListener("click",()=>{const X=parseInt(N.dataset.apRemove,10);v.completedPicks.splice(X,1),
|
|
1753
|
+
`}).join(""),Pe.querySelectorAll("[data-ap-remove]").forEach(N=>{N.addEventListener("click",()=>{const X=parseInt(N.dataset.apRemove,10);v.completedPicks.splice(X,1),Wt()})})},Jt=()=>{if(!v.currentPickedEl){$e.style.display="none";return}$e.style.display="",ot.disabled=!v.currentPickedEl.parentElement||v.awaitingPick,Nt&&(Nt.disabled=v.awaitingPick)},Yt=()=>{ee&&(ee.disabled=!S.value.trim()||v.submitting||v.awaitingPick)},Vt=(N,X)=>{v.currentCtx=N,v.currentPickedEl=X,xt(N),et==null||et.update(X),Jt()};Jt(),ot.addEventListener("click",()=>{var X;const N=(X=v.currentPickedEl)==null?void 0:X.parentElement;N&&Vt(Oi(N),N)}),Nt&&u&&Nt.addEventListener("click",()=>{if(v.awaitingPick)return;const N=v.currentCtx,X=v.currentPickedEl;v.awaitingPick=!0,Jt(),Yt(),xt(null),u((Ee,Oe)=>{v.awaitingPick=!1,Vt(Ee,Oe),Yt()},()=>{v.awaitingPick=!1,X&&Vt(N,X),Yt()})});const le=()=>{Nr(),p==null||p()};Q.addEventListener("click",le),j.addEventListener("click",le);const zn=W.querySelector("[data-ap-connect-required]");zn&&a&&zn.addEventListener("click",()=>{le(),a()}),q.forEach(N=>{N.addEventListener("click",()=>{v.captureType=N.dataset.apType,q.forEach(X=>X.classList.toggle("ap-sdk-active",X===N)),Y.style.display=v.captureType==="automate"?"":"none"})}),xe.addEventListener("change",()=>{v.allowSubmit=xe.checked});const we=W.querySelector("[data-ap-reconfigure]");a?we.addEventListener("click",()=>{le(),a()}):we.style.display="none",ee&&d&&(S.addEventListener("input",Yt),ee.addEventListener("click",()=>{const N=S.value.trim();!N||v.awaitingPick||(v.completedPicks.push({ctx:v.currentCtx,instruction:N}),Wt(),S.value="",v.awaitingPick=!0,ee.disabled=!0,Jt(),xt(null),d((X,Ee)=>{v.awaitingPick=!1,Vt(X,Ee),Yt()}))})),E.addEventListener("click",()=>I(null,null,function*(){var On,gn;if(v.submitting)return;if(m){jo(P,"error","Connect to Agent Platform first.");return}const N=n.backendUrl,X=n.token,Ee=S.value.trim();if(!Ee){jo(P,"error","Please enter an instruction.");return}v.submitting=!0,oi(W,!0),jo(P,null,""),E.textContent="Submitting…";const Oe={backendUrl:N,token:X},ue=Z.getOptions(),de=[...v.completedPicks,{ctx:v.currentCtx,instruction:Ee}];try{const pe={id:r==null?void 0:r.id,key:o};let je,Re,Ne;if(de.length===1)if(v.captureType==="task")je=(yield Ts(Oe,{project:pe,note:Ee,ctx:v.currentCtx,advancedOpts:ue})).id,Re="task",Ne=Ee.slice(0,120)||v.currentCtx.pageTitle||"Browser capture";else if(v.captureType==="planning"){let Ue=eu(Ee,D(y({},v.currentCtx),{ancestry:v.currentCtx.outerTree||v.currentCtx.ancestry}));(On=v.currentCtx.innerTree)!=null&&On.trim()&&(Ue+=`
|
|
1715
1754
|
|
|
1716
1755
|
Element tree:
|
|
1717
|
-
${v.currentCtx.innerTree}`),(
|
|
1756
|
+
${v.currentCtx.innerTree}`),(gn=v.currentCtx.interactionSteps)!=null&&gn.length&&(Ue+=`
|
|
1718
1757
|
|
|
1719
1758
|
Recorded steps:
|
|
1720
|
-
${
|
|
1759
|
+
${Hc(v.currentCtx.interactionSteps)}`),je=(yield Ha(Oe,pe,Ue,ue)).id,Re="planning",Ne=Ee.slice(0,120)||v.currentCtx.pageTitle||"Planning session"}else je=(yield qa(Oe,{project:pe,note:Ee,ctx:v.currentCtx,advancedOpts:ue,allowSubmit:v.allowSubmit})).id,Re="automate",Ne=Ee.slice(0,120)||v.currentCtx.pageTitle||"Browser automation";else{const Ue=$b(de),st=de[0].instruction.slice(0,120)||de[0].ctx.pageTitle||"Multi-element capture",Dt=de.map(Xt=>Xt.instruction).filter(Boolean).join(`
|
|
1721
1760
|
|
|
1722
|
-
`);v.captureType==="task"?(
|
|
1761
|
+
`);v.captureType==="task"?(je=(yield Ts(Oe,{project:pe,note:Ue,ctx:de[0].ctx,advancedOpts:ue,titleOverride:st,type:Ma,titleInstruction:Dt})).id,Re="task",Ne=st):v.captureType==="planning"?(je=(yield Ha(Oe,pe,Ue,ue)).id,Re="planning",Ne=st):(je=(yield qa(Oe,{project:pe,note:Ue,ctx:de[0].ctx,advancedOpts:ue,titleOverride:st,titleInstruction:Dt,allowSubmit:v.allowSubmit})).id,Re="automate",Ne=st)}if(ub({id:je,type:Re,title:Ne,backendUrl:N,createdAt:new Date().toISOString()}),tl(Oe).catch(()=>{}),Re==="automate"){le(),Xs(je,Oe,N,Ne,p);return}const mn=Re==="task"?`${N.replace(/\/+$/,"")}/tasks/${je}`:`${N.replace(/\/+$/,"")}/planning/${je}`;Ob(P,Re,Ne,mn,le),W.classList.add("ap-sdk-panel--success"),Bt==null||Bt(),Bt=null,et==null||et.hide(),v.submitting=!1,oi(W,!1)}catch(pe){jo(P,"error",pe instanceof Error?pe.message:"An unexpected error occurred."),v.submitting=!1,oi(W,!1),E.textContent="Submit"}})),setTimeout(()=>S.focus(),50)}const zb={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};function rl(e){var t,n;return(t=e.interactionSteps)!=null&&t.length?`
|
|
1723
1762
|
<div class="ap-sdk-panel__context-label">Recorded steps (${e.interactionSteps.length})</div>
|
|
1724
1763
|
<div class="ap-sdk-panel__context-steps">
|
|
1725
1764
|
${e.interactionSteps.map(r=>`
|
|
1726
1765
|
<div class="ap-sdk-panel__context-step">
|
|
1727
|
-
<span class="ap-sdk-panel__context-step-icon">${
|
|
1728
|
-
<span class="ap-sdk-panel__context-step-text">${
|
|
1766
|
+
<span class="ap-sdk-panel__context-step-icon">${zb[r.action]}</span>
|
|
1767
|
+
<span class="ap-sdk-panel__context-step-text">${ct(r.description)}</span>
|
|
1729
1768
|
</div>
|
|
1730
1769
|
`).join("")}
|
|
1731
1770
|
</div>
|
|
1732
1771
|
`:`
|
|
1733
1772
|
<div class="ap-sdk-panel__context-label">Captured element</div>
|
|
1734
|
-
<div class="ap-sdk-panel__context-text" title="${
|
|
1735
|
-
${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${
|
|
1736
|
-
`}function
|
|
1773
|
+
<div class="ap-sdk-panel__context-text" title="${ct((n=e.elementText)!=null?n:"")}">${ct(e.elementText||"(no text)")}</div>
|
|
1774
|
+
${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${ct(e.cssSelector)}">${ct(e.cssSelector)}</div>`:""}
|
|
1775
|
+
`}function $b(e){return e.map((t,n)=>{var o,i;const r=[`## Pick ${n+1}`,""];return(o=t.ctx.interactionSteps)!=null&&o.length?r.push("Recorded steps:",Hc(t.ctx.interactionSteps)):(r.push(`Element: ${t.ctx.elementText||"(no text)"}`),t.ctx.cssSelector&&r.push(`Selector: ${t.ctx.cssSelector}`),t.ctx.ancestry&&r.push(`Ancestry: ${t.ctx.ancestry}`)),r.push(`Page: ${t.ctx.pageTitle} (${t.ctx.pageUrl})`),(i=t.ctx.innerTree)!=null&&i.trim()&&r.push(`
|
|
1737
1776
|
Element tree:
|
|
1738
1777
|
${t.ctx.innerTree}`),r.push("",`Instruction:
|
|
1739
1778
|
${t.instruction}`),r.join(`
|
|
@@ -1741,23 +1780,23 @@ ${t.instruction}`),r.join(`
|
|
|
1741
1780
|
|
|
1742
1781
|
---
|
|
1743
1782
|
|
|
1744
|
-
`)}function
|
|
1783
|
+
`)}function jo(e,t,n){if(!t){e.style.display="none",e.textContent="",e.innerHTML="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function Ob(e,t,n,r,o){const i=t==="task"?"Task":"Planning",a=t==="task"?"Task created successfully!":"Planning session created!",d=t==="task"?"View task →":"View planning session →",u=n.length>55?`${n.slice(0,52)}…`:n;e.style.display="block",e.className="ap-sdk-panel__status",e.innerHTML=`
|
|
1745
1784
|
<div class="ap-sdk-success-card">
|
|
1746
1785
|
<svg class="ap-sdk-success-check" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
|
|
1747
1786
|
<circle class="ap-sdk-success-check__circle" cx="24" cy="24" r="22"/>
|
|
1748
1787
|
<path class="ap-sdk-success-check__tick" d="M14 24l7 7 13-14"/>
|
|
1749
1788
|
</svg>
|
|
1750
|
-
<p class="ap-sdk-success-headline">${
|
|
1789
|
+
<p class="ap-sdk-success-headline">${ct(a)}</p>
|
|
1751
1790
|
<div class="ap-sdk-success-meta">
|
|
1752
|
-
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${
|
|
1753
|
-
<span class="ap-sdk-success-title" title="${
|
|
1791
|
+
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${ct(i)}</span>
|
|
1792
|
+
<span class="ap-sdk-success-title" title="${ct(n)}">${ct(u)}</span>
|
|
1754
1793
|
</div>
|
|
1755
1794
|
<div class="ap-sdk-success-actions">
|
|
1756
|
-
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${
|
|
1795
|
+
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${ct(d)}</button>
|
|
1757
1796
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-success-close>Close</button>
|
|
1758
1797
|
</div>
|
|
1759
1798
|
</div>
|
|
1760
|
-
`,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function
|
|
1799
|
+
`,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function oi(e,t){e.querySelectorAll("button, input, textarea, select").forEach(n=>{n.disabled=t})}function ct(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}let ie=null;function ol(){return ie!==null}function Rn(){ie&&Ut(ie),ie==null||ie.remove(),ie=null}function Nb(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function Db(e){if(ie){Rn();return}ie=document.createElement("div"),ie.className="ap-sdk-panel",ie.setAttribute("data-ap-sdk","1"),ie.setAttribute("role","dialog"),ie.setAttribute("aria-modal","true"),ie.setAttribute("aria-label","My captures"),ie.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),ie.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),ie.innerHTML=`
|
|
1761
1800
|
<div class="ap-sdk-panel__header">
|
|
1762
1801
|
<span class="ap-sdk-panel__title">
|
|
1763
1802
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1770,18 +1809,18 @@ ${t.instruction}`),r.join(`
|
|
|
1770
1809
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-clear-history>Clear history</button>
|
|
1771
1810
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-close-list>Close</button>
|
|
1772
1811
|
</div>
|
|
1773
|
-
`,document.body.appendChild(ie),
|
|
1812
|
+
`,document.body.appendChild(ie),jt(ie),Ps(ie,Cs),ie.querySelector("[data-ap-close]").addEventListener("click",()=>{Rn()}),ie.querySelector("[data-ap-close-list]").addEventListener("click",()=>{Rn()}),ie.querySelector("[data-ap-clear-history]").addEventListener("click",()=>{db(),Pn(0),sl(e)}),sl(e)}function sl(e){if(!ie)return;const t=ie.querySelector("[data-ap-list-body]"),n=rr();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=>`
|
|
1774
1813
|
<div class="ap-sdk-list-item">
|
|
1775
1814
|
<div class="ap-sdk-list-item__row">
|
|
1776
|
-
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${
|
|
1777
|
-
<span class="ap-sdk-list-item__title" title="${
|
|
1815
|
+
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${Nb(r.type)}</span>
|
|
1816
|
+
<span class="ap-sdk-list-item__title" title="${Uo(r.title)}">${Ub(r.title)}</span>
|
|
1778
1817
|
</div>
|
|
1779
1818
|
<div class="ap-sdk-list-item__row">
|
|
1780
|
-
<span class="ap-sdk-status-badge" data-ap-status="${
|
|
1781
|
-
${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${
|
|
1819
|
+
<span class="ap-sdk-status-badge" data-ap-status="${Uo(r.id)}">${e?"…":"—"}</span>
|
|
1820
|
+
${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${Uo(r.id)}">Resume →</button>`:`<a class="ap-sdk-list-item__link" href="${Uo(jb(r))}" target="_blank" rel="noopener noreferrer">View →</a>`}
|
|
1782
1821
|
</div>
|
|
1783
1822
|
</div>
|
|
1784
|
-
`).join(""),e){const r=e;Promise.all(n.map(o=>
|
|
1823
|
+
`).join(""),e){const r=e;Promise.all(n.map(o=>Mb(o,r))).then(o=>{Pn(el(o))}),t.querySelectorAll("[data-ap-resume]").forEach(o=>{o.addEventListener("click",()=>{const i=o.dataset.apResume,a=n.find(d=>d.id===i);a&&(Rn(),Xs(a.id,r,a.backendUrl,a.title,()=>{}))})})}}function Mb(e,t){return I(this,null,function*(){const n=yield Qc(e,t),r=ie==null?void 0:ie.querySelector(`[data-ap-status="${CSS.escape(e.id)}"]`);return r&&(r.textContent=n.status.replace(/_/g," "),r.className=`ap-sdk-status-badge ap-sdk-status-badge--${n.status.replace(/_/g,"-")}`),n})}function jb(e){const t=e.backendUrl.replace(/\/+$/,"");return e.type==="planning"?`${t}/planning/${e.id}`:`${t}/tasks/${e.id}`}function Uo(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ub(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}let dn=null;function Zb(){const e=new Uint32Array(4);return crypto.getRandomValues(e),Array.from(e,t=>t.toString(16)).join("")}function il(e){if(dn){const d=dn;d.cleanup(),d.popup.closed||d.popup.close(),dn=null}const t=e.replace(/\/+$/,""),n=new URL(t).origin,r=Zb(),o=window.location.origin,i=`${t}/oauth/authorize?origin=${encodeURIComponent(o)}&state=${encodeURIComponent(r)}`,a=window.open(i,"ap-sdk-oauth","width=480,height=640");return a?new Promise((d,u)=>{let p=!1;function h(){window.removeEventListener("message",m),clearInterval(g),(dn==null?void 0:dn.popup)===a&&(dn=null)}function m(k){if(k.origin!==n)return;const v=k.data;!v||v.type!=="ap-sdk-oauth"||v.state!==r||!v.code||(p=!0,h(),d({code:v.code}))}window.addEventListener("message",m);const g=window.setInterval(()=>{a.closed&&(h(),p||u(new Error("Connection cancelled.")))},500);dn={popup:a,cleanup:h}}):Promise.reject(new Error("Popup blocked — please allow popups for this site and try again."))}const qb="https://agent-platform.tung.engineering",si="ap-sdk-config";function Hb(){try{const e=sessionStorage.getItem(si);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.token)||!(t!=null&&t.projectCode)||!(t!=null&&t.expiresAt)?null:new Date(t.expiresAt).getTime()<=Date.now()?(al(),null):t}catch(e){return null}}function Fb(e){sessionStorage.setItem(si,JSON.stringify(e)),Gb({backendUrl:e.backendUrl,projectCode:e.projectCode})}function al(){sessionStorage.removeItem(si)}const cl="ap-sdk-last-connection";function Bb(){try{const e=localStorage.getItem(cl);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.projectCode)?null:t}catch(e){return null}}function Gb(e){try{localStorage.setItem(cl,JSON.stringify(e))}catch(t){}}let K=null;function Gt(){K&&Ut(K),K==null||K.remove(),K=null}function Wb(e){K&&Gt(),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=Bb();t?n(t):r(qb),document.body.appendChild(K),jt(K);function n(i){if(!K)return;K.innerHTML=`
|
|
1785
1824
|
<div class="ap-sdk-panel__header">
|
|
1786
1825
|
<span class="ap-sdk-panel__title">
|
|
1787
1826
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1791,7 +1830,7 @@ ${t.instruction}`),r.join(`
|
|
|
1791
1830
|
</div>
|
|
1792
1831
|
<div class="ap-sdk-panel__body">
|
|
1793
1832
|
<p class="ap-sdk-config-hint">
|
|
1794
|
-
Reconnect to <strong>${
|
|
1833
|
+
Reconnect to <strong>${ii(i.backendUrl)}</strong>. You'll be asked to
|
|
1795
1834
|
approve this connection on Agent Platform's own sign-in page.
|
|
1796
1835
|
</p>
|
|
1797
1836
|
</div>
|
|
@@ -1800,7 +1839,7 @@ ${t.instruction}`),r.join(`
|
|
|
1800
1839
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-reconnect>Reconnect</button>
|
|
1801
1840
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-use-different>Use a different connection</button>
|
|
1802
1841
|
</div>
|
|
1803
|
-
`;const a=K.querySelector("[data-ap-cfg-status]"),d=K.querySelector("[data-ap-reconnect]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{
|
|
1842
|
+
`;const a=K.querySelector("[data-ap-cfg-status]"),d=K.querySelector("[data-ap-reconnect]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Gt()}),K.querySelector("[data-ap-use-different]").addEventListener("click",()=>r(i.backendUrl)),d.addEventListener("click",()=>I(null,null,function*(){d.disabled=!0,d.textContent="Connecting…",pn(a,null,"");try{const{code:u}=yield il(i.backendUrl),{token:p,expiresAt:h}=yield Wa({backendUrl:i.backendUrl},u,window.location.origin),m={backendUrl:i.backendUrl,token:p},g=yield Ba(m);if(g.length===0){pn(a,"error","No projects found — check your account permissions."),d.disabled=!1,d.textContent="Reconnect";return}const k=g.find(Z=>Z.key===i.projectCode);if(k){Gt(),e({backendUrl:i.backendUrl,token:p,projectCode:k.key,expiresAt:h});return}const v=Ua(window.location.href,g),T=v?g.find(Z=>Z.id===v):void 0;T?(Gt(),e({backendUrl:i.backendUrl,token:p,projectCode:T.key,expiresAt:h})):o(i.backendUrl,p,h,g)}catch(u){pn(a,"error",`Could not connect — ${u instanceof Error?u.message:"please try again"}`),d.disabled=!1,d.textContent="Reconnect"}}))}function r(i){if(!K)return;K.innerHTML=`
|
|
1804
1843
|
<div class="ap-sdk-panel__header">
|
|
1805
1844
|
<span class="ap-sdk-panel__title">
|
|
1806
1845
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1813,7 +1852,7 @@ ${t.instruction}`),r.join(`
|
|
|
1813
1852
|
<label class="ap-sdk-panel__label" for="ap-sdk-cfg-url">Backend URL</label>
|
|
1814
1853
|
<input id="ap-sdk-cfg-url" class="ap-sdk-panel__input" type="url"
|
|
1815
1854
|
placeholder="https://your-platform.example.com"
|
|
1816
|
-
value="${
|
|
1855
|
+
value="${ll(i)}" autocomplete="off" data-ap-cfg-url />
|
|
1817
1856
|
</div>
|
|
1818
1857
|
<p class="ap-sdk-config-hint">
|
|
1819
1858
|
You'll be asked to approve this connection on Agent Platform's own sign-in page.
|
|
@@ -1824,7 +1863,7 @@ ${t.instruction}`),r.join(`
|
|
|
1824
1863
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-connect>Connect via Agent Platform</button>
|
|
1825
1864
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-cancel>Cancel</button>
|
|
1826
1865
|
</div>
|
|
1827
|
-
`;const a=K.querySelector("[data-ap-cfg-url]"),d=K.querySelector("[data-ap-cfg-status]"),u=K.querySelector("[data-ap-connect]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{
|
|
1866
|
+
`;const a=K.querySelector("[data-ap-cfg-url]"),d=K.querySelector("[data-ap-cfg-status]"),u=K.querySelector("[data-ap-connect]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Gt()}),K.querySelector("[data-ap-cancel]").addEventListener("click",()=>{Gt()}),u.addEventListener("click",()=>I(null,null,function*(){const p=a.value.trim();if(!p){pn(d,"error","Backend URL is required.");return}u.disabled=!0,u.textContent="Connecting…",pn(d,null,"");try{const{code:h}=yield il(p),{token:m,expiresAt:g}=yield Wa({backendUrl:p},h,window.location.origin),v=yield Ba({backendUrl:p,token:m});if(v.length===0){pn(d,"error","No projects found — check your account permissions."),u.disabled=!1,u.textContent="Connect via Agent Platform";return}const T=Ua(window.location.href,v),Z=T?v.find(Q=>Q.id===T):void 0;if(Z){Gt(),e({backendUrl:p,token:m,projectCode:Z.key,expiresAt:g});return}o(p,m,g,v)}catch(h){pn(d,"error",`Could not connect — ${h instanceof Error?h.message:"please try again"}`),u.disabled=!1,u.textContent="Connect via Agent Platform"}})),setTimeout(()=>a.focus(),50)}function o(i,a,d,u){if(!K)return;const p=u.map(g=>`<option value="${ll(g.key)}"${g.key===(t==null?void 0:t.projectCode)?" selected":""}>${ii(g.name)} (${ii(g.key)})</option>`).join("");K.innerHTML=`
|
|
1828
1867
|
<div class="ap-sdk-panel__header">
|
|
1829
1868
|
<span class="ap-sdk-panel__title">
|
|
1830
1869
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1846,7 +1885,7 @@ ${t.instruction}`),r.join(`
|
|
|
1846
1885
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-save>Save</button>
|
|
1847
1886
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-back>Back</button>
|
|
1848
1887
|
</div>
|
|
1849
|
-
`;const h=K.querySelector("[data-ap-cfg-project]"),m=K.querySelector("[data-ap-cfg-status]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{
|
|
1888
|
+
`;const h=K.querySelector("[data-ap-cfg-project]"),m=K.querySelector("[data-ap-cfg-status]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Gt()}),K.querySelector("[data-ap-back]").addEventListener("click",()=>r(i)),K.querySelector("[data-ap-save]").addEventListener("click",()=>{const g=h.value;if(!g){pn(m,"error","Please select a project.");return}Gt(),e({backendUrl:i,token:a,projectCode:g,expiresAt:d})})}}function pn(e,t,n){if(!t){e.style.display="none",e.textContent="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function ll(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ii(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}let gt=null,Zo=!1;function Jb(){gt==null||gt.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),gt&>.observe(document.body,{childList:!0}),Zo=!1}function ul(){gt||(gt=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||Zo||(Zo=!0,queueMicrotask(Jb))}),gt.observe(document.body,{childList:!0}))}function Yb(){gt==null||gt.disconnect(),gt=null,Zo=!1}const Vb={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};let Ce=null,hn=[];function qo(){Ce&&Ut(Ce),Ce==null||Ce.remove(),Ce=null,hn=[]}function Xb(e,t,n){Ce&&qo(),hn=[...e],Ce=document.createElement("div"),Ce.className="ap-sdk-panel ap-sdk-record-review",Ce.setAttribute("data-ap-sdk","1"),Ce.setAttribute("role","dialog"),Ce.setAttribute("aria-modal","true"),Ce.setAttribute("aria-label","Review recorded steps"),Ce.innerHTML=`
|
|
1850
1889
|
<div class="ap-sdk-panel__header">
|
|
1851
1890
|
<span class="ap-sdk-panel__title">
|
|
1852
1891
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1861,11 +1900,11 @@ ${t.instruction}`),r.join(`
|
|
|
1861
1900
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-review-continue>Continue</button>
|
|
1862
1901
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-review-cancel>Cancel</button>
|
|
1863
1902
|
</div>
|
|
1864
|
-
`,document.body.appendChild(Ce),
|
|
1903
|
+
`,document.body.appendChild(Ce),jt(Ce);const r=Ce.querySelector("[data-ap-review-list]"),o=Ce.querySelector("[data-ap-review-continue]"),i=()=>{if(hn.length===0){r.innerHTML='<p class="ap-sdk-list-empty">No steps recorded.</p>',o.disabled=!0;return}o.disabled=!1,r.innerHTML=hn.map((d,u)=>{var p;return`
|
|
1865
1904
|
<div class="ap-sdk-record-step" data-step-index="${u}">
|
|
1866
|
-
<span class="ap-sdk-record-step__icon">${
|
|
1867
|
-
${d.action==="inputText"&&!d.redacted?`<input class="ap-sdk-record-step__input" type="text" value="${
|
|
1905
|
+
<span class="ap-sdk-record-step__icon">${Vb[d.action]}</span>
|
|
1906
|
+
${d.action==="inputText"&&!d.redacted?`<input class="ap-sdk-record-step__input" type="text" value="${Kb((p=d.value)!=null?p:"")}" data-ap-step-value />`:`<span class="ap-sdk-record-step__description">${dl(d.description)}</span>`}
|
|
1868
1907
|
<button class="ap-sdk-record-step__remove" data-ap-step-remove="${u}" aria-label="Remove step ${u+1}">✕</button>
|
|
1869
1908
|
</div>
|
|
1870
|
-
`}).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(d=>{d.addEventListener("click",()=>{const u=parseInt(d.dataset.apStepRemove,10);
|
|
1909
|
+
`}).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(d=>{d.addEventListener("click",()=>{const u=parseInt(d.dataset.apStepRemove,10);hn.splice(u,1),i()})}),r.querySelectorAll("[data-ap-step-value]").forEach(d=>{const u=d.closest("[data-step-index]"),p=parseInt(u.dataset.stepIndex,10);d.addEventListener("input",()=>{var m;const h=hn[p];h.value=d.value,h.description=Zc((m=h.elementText)!=null?m:"",d.value,!1)})})};i();const a=()=>{qo()};Ce.querySelector("[data-ap-review-close]").addEventListener("click",a),Ce.querySelector("[data-ap-review-cancel]").addEventListener("click",a),o.addEventListener("click",()=>{if(hn.length===0)return;const d=hn,u=D(y({},Pi()),{pageUrl:window.location.href,pageTitle:document.title,interactionSteps:d});qo(),t(u)})}function dl(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Kb(e){return dl(e)}let H=null,Ho=null,Fo=null,Bo=null;function ai(e,t,n){Ho=e,Fo=t,Bo=n,Xc(e,t,n)}const pl="#agent-platform-web-sdk",hl="ap-sdk-fab-unlocked";let Ln=null;function fl(){try{if(localStorage.getItem(hl)==="1")return!0}catch(e){}return window.location.hash===pl}function gl(){try{localStorage.setItem(hl,"1")}catch(e){}}function ml(e){return I(this,null,function*(){var t,n,r,o;if(mr(),!(H&&H.projectCode===e.projectCode&&H.backendUrl===((t=e.backendUrl)!=null?t:null)&&H.token===((n=e.token)!=null?n:null))){if(H={projectCode:e.projectCode,backendUrl:(r=e.backendUrl)!=null?r:null,token:(o=e.token)!=null?o:null,project:null,resolvingProject:!1,permissions:null},ai(()=>bl(),()=>ek(),()=>li()),Pn(rr().length),H.backendUrl&&H.token){const i=H.backendUrl,a=H.token;yield xl(),tl({backendUrl:i,token:a}).catch(()=>{}),wl({backendUrl:i,token:a}).catch(()=>{});const d=yg();d&&Xs(d.taskId,{backendUrl:i,token:a},d.backendUrl,d.title,()=>{})}ul()}})}function ci(e,t){return I(this,null,function*(){if(!H)throw new Error("AgentPlatformSDK: call init() first.");H.backendUrl=e,H.token=t,H.project=null,H.permissions=null,yield xl(),wl({backendUrl:e,token:t}).catch(()=>{})})}function bl(){if(!H)throw new Error("AgentPlatformSDK: call init() first.");Fn()||(mr(),ps((e,t)=>I(null,null,function*(){ol()&&Rn(),nl(e,t,{backendUrl:H.backendUrl,token:H.token},H.project,H.projectCode,n=>I(null,null,function*(){yield ci(n.backendUrl,n.token)}),In,n=>{ps((r,o)=>{Or()&&n(r,o)},()=>{kl()})},(n,r)=>{ps((o,i)=>{Or()&&n(o,i)},()=>{Or()&&r()})},()=>{Fn()&&hs()},H.permissions)}),()=>{}))}function Qb(){hs()}function ek(){if(!H)throw new Error("AgentPlatformSDK: call init() first.");Lo()||(mr(),vb(e=>{Xb(e,t=>{nl(t,null,{backendUrl:H.backendUrl,token:H.token},H.project,H.projectCode,n=>I(null,null,function*(){yield ci(n.backendUrl,n.token)}),In,void 0,void 0,()=>{},H.permissions)})}))}function kl(){Or()&&Nr()}function tk(){return Fn()}function _l(){Yb(),Ln&&(window.removeEventListener("hashchange",Ln),Ln=null),hs(),yb(),qo(),Nr(),Rn(),Kc(),Ho=null,Fo=null,Bo=null,H=null}function vl(){if(typeof window=="undefined"||typeof document=="undefined")return;mr();const e=Hb(),t=()=>{e?yl(e).catch(console.error):(ai(()=>In(),()=>In(),()=>li()),Pn(rr().length),ul())};if(fl()){gl(),t();return}Ln=()=>{window.location.hash===pl&&(gl(),window.removeEventListener("hashchange",Ln),Ln=null,t())},window.addEventListener("hashchange",Ln)}function nk(){Ho&&Fo&&Bo&&Xc(Ho,Fo,Bo)}function rk(){Kc()}function In(){Wb(e=>{Fb(e),yl(e).catch(console.error)})}function ok(){al(),_l(),mr(),fl()&&(ai(()=>In(),()=>In(),()=>li()),Pn(rr().length))}function yl(e){return I(this,null,function*(){yield ml({projectCode:e.projectCode,backendUrl:e.backendUrl,token:e.token})})}function li(){if(ol()){Rn();return}Or()&&Nr();const e=H!=null&&H.backendUrl&&(H!=null&&H.token)?{backendUrl:H.backendUrl,token:H.token}:null;Db(e)}function wl(e){return I(this,null,function*(){const t=yield ig(e);H&&(H.permissions=t.permissions)})}function xl(){return I(this,null,function*(){if(!(!H||!H.backendUrl||!H.token||H.project||H.resolvingProject)){H.resolvingProject=!0;try{H.project=yield tg({backendUrl:H.backendUrl,token:H.token},H.projectCode)}catch(e){}finally{H&&(H.resolvingProject=!1)}}})}return vl(),oe.activateElementPicker=bl,oe.autoInit=vl,oe.clearConfig=ok,oe.closePanelIfOpen=kl,oe.configure=In,oe.deactivateElementPicker=Qb,oe.destroy=_l,oe.hideFab=rk,oe.init=ml,oe.isPickerRunning=tk,oe.showFab=nk,oe.updateCredentials=ci,Object.defineProperty(oe,Symbol.toStringTag,{value:"Module"}),oe})({});
|
|
1871
1910
|
//# sourceMappingURL=web-sdk.min.js.map
|