@tung-engineering/agent-platform-web-sdk 0.0.57 → 0.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web-sdk.cjs +139 -116
- package/dist/web-sdk.cjs.map +1 -1
- package/dist/web-sdk.min.js +134 -111
- package/dist/web-sdk.min.js.map +1 -1
- package/dist/web-sdk.mjs +2331 -2283
- 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 AgentPlatformWebSdk=function(
|
|
1
|
+
var AgentPlatformWebSdk=function(we){"use strict";var Ck=Object.defineProperty;var Pk=(we,It,ln)=>It in we?Ck(we,It,{enumerable:!0,configurable:!0,writable:!0,value:ln}):we[It]=ln;var ae=(we,It,ln)=>Pk(we,typeof It!="symbol"?It+"":It,ln);var No;const It=`
|
|
2
2
|
/* ── Agent Platform SDK — namespaced styles ────────────────────────────── */
|
|
3
3
|
|
|
4
4
|
/* Reset Popover API UA defaults so top-layer-promoted elements keep our own
|
|
@@ -96,6 +96,17 @@ var AgentPlatformWebSdk=function(xe){"use strict";var Ck=Object.defineProperty;v
|
|
|
96
96
|
background: oklch(95% 0.035 50);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
.ap-sdk-picker-cursor__btn--cancel {
|
|
100
|
+
background: transparent;
|
|
101
|
+
border-color: rgba(255, 255, 255, 0.28);
|
|
102
|
+
opacity: 0.85;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.ap-sdk-picker-cursor__btn--cancel:hover {
|
|
106
|
+
background: rgba(255, 255, 255, 0.12);
|
|
107
|
+
opacity: 1;
|
|
108
|
+
}
|
|
109
|
+
|
|
99
110
|
/* Floating bar shown while recorder.ts is capturing a workflow */
|
|
100
111
|
.ap-sdk-recorder-bar {
|
|
101
112
|
position: fixed;
|
|
@@ -259,10 +270,16 @@ var AgentPlatformWebSdk=function(xe){"use strict";var Ck=Object.defineProperty;v
|
|
|
259
270
|
color: oklch(47% 0.13 40);
|
|
260
271
|
}
|
|
261
272
|
|
|
262
|
-
.ap-sdk-
|
|
273
|
+
.ap-sdk-panel__pick-actions {
|
|
274
|
+
display: flex;
|
|
275
|
+
gap: 8px;
|
|
263
276
|
margin: 0 16px 10px;
|
|
264
|
-
|
|
265
|
-
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.ap-sdk-panel__btn--select-parent,
|
|
280
|
+
.ap-sdk-panel__btn--reselect {
|
|
281
|
+
flex: 1 1 0;
|
|
282
|
+
width: auto;
|
|
266
283
|
font-size: 12px;
|
|
267
284
|
padding: 6px 10px;
|
|
268
285
|
}
|
|
@@ -1325,101 +1342,101 @@ button.ap-sdk-list-item__link {
|
|
|
1325
1342
|
border-right: 2px solid #d1d5db;
|
|
1326
1343
|
border-bottom: 2px solid #d1d5db;
|
|
1327
1344
|
}
|
|
1328
|
-
`;let
|
|
1329
|
-
`)}return r(e,0)}const ml='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"]',bl={fieldset:"legend",table:"caption",figure:"figcaption",details:"summary"};function
|
|
1330
|
-
`)}const Pn=new Set;let Rn=null,Br=!1,Yo=!1;function Sl(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function Tl(){const e=document.querySelectorAll("dialog[open]");for(let n=0;n<e.length;n++)try{if(e[n].matches(":modal"))return!0}catch{}const t=document.querySelectorAll('[role="dialog"], [role="alertdialog"]');for(let n=0;n<t.length;n++){const r=t[n];if(!(Pn.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&Sl(r))return!0}return!1}function ds(){const e=Tl(),t=e&&!Yo;Yo=e;for(const n of Pn){n.hasAttribute("inert")&&n.removeAttribute("inert"),n.getAttribute("aria-hidden")==="true"&&n.removeAttribute("aria-hidden");const r=n.contains(document.activeElement);if(n.matches(":popover-open")){if(t&&!r){try{n.hidePopover()}catch{}try{n.showPopover()}catch{}}}else try{n.showPopover()}catch{}}}function ps(e){if(!(e instanceof Node))return!1;for(const t of Pn)if(t===e||t.contains(e))return!0;return!1}function Ln(e){(ps(e.target)||"relatedTarget"in e&&ps(e.relatedTarget))&&e.stopPropagation()}function El(){Br||(window.addEventListener("focusin",Ln,!0),window.addEventListener("focusout",Ln,!0),window.addEventListener("pointerdown",Ln,!0),Br=!0),!Rn&&(Rn=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")&&ds()}),Rn.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function It(e){"showPopover"in e&&(e.setAttribute("popover","manual"),Pn.add(e),El(),ds())}function $t(e){if(Pn.delete(e),Pn.size===0&&(Rn&&(Rn.disconnect(),Rn=null),Br&&(window.removeEventListener("focusin",Ln,!0),window.removeEventListener("focusout",Ln,!0),window.removeEventListener("pointerdown",Ln,!0),Br=!1),Yo=!1),"hidePopover"in e)try{e.hidePopover()}catch{}}function Ko(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),It(t),{el:t,update:s=>{const a=s.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:()=>{$t(t),t.remove()}}}const Al="🎯 Click any element to capture";let Bt=null,Pe=null,Ke=null;function cr(e){return e instanceof Element?e.closest("[data-ap-sdk]")!==null||e.closest(".ap-sdk-panel")!==null||e.closest(".ap-sdk-highlight")!==null||e.closest(".ap-sdk-picker-cursor")!==null:!1}function Cl(){var e;return(((e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)??!1)||"ontouchstart"in window}function hs(e){Bt==null||Bt.update(e)}function fs(e){const t=us(),n=yl(e),r=wl(e);let o;try{o=e.outerHTML.slice(0,4e3)}catch{}return{pageUrl:window.location.href,pageTitle:document.title,elementText:qr(e),cssSelector:Zr(e),innerTree:gl(e),outerTree:vl(e),elementOuterHtml:o,ancestry:n,...r,...t}}function gs(e,t){Ke&&Ke();const n=Cl();Bt=Ko(),Pe=document.createElement("div"),Pe.className="ap-sdk-picker-cursor",Pe.setAttribute("data-ap-sdk","1"),Pe.textContent=n?"Tap any element to preview":Al,document.body.appendChild(Pe),It(Pe);let r=null,o=null;const s=h=>{Ke==null||Ke(),e(fs(h),h)},a=h=>{if(o=h,hs(h),!Pe)return;Pe.classList.add("ap-sdk-picker-cursor--confirm"),Pe.innerHTML="";const k=document.createElement("span");k.className="ap-sdk-picker-cursor__label",k.textContent=`<${h.tagName.toLowerCase()}>`;const m=document.createElement("button");m.type="button",m.className="ap-sdk-picker-cursor__btn",m.textContent="⬆ Parent",m.setAttribute("data-ap-sdk","1"),m.addEventListener("click",w=>{w.preventDefault(),w.stopPropagation(),o!=null&&o.parentElement&&a(o.parentElement)});const _=document.createElement("button");_.type="button",_.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",_.textContent="✓ Select",_.setAttribute("data-ap-sdk","1"),_.addEventListener("click",w=>{w.preventDefault(),w.stopPropagation(),o&&s(o)}),Pe.appendChild(k),Pe.appendChild(m),Pe.appendChild(_)},u=h=>{cr(h.target)||(r=h.target,hs(r))},d=h=>{if(cr(h.target))return;h.preventDefault(),h.stopImmediatePropagation();const k=h.target??r;if(k){if(n){a(k);return}s(k)}},p=h=>{h.key==="Escape"&&(Ke==null||Ke(),t())};n||document.addEventListener("mouseover",u,{capture:!0}),document.addEventListener("click",d,{capture:!0}),document.addEventListener("keydown",p,{capture:!0}),Ke=()=>{n||document.removeEventListener("mouseover",u,{capture:!0}),document.removeEventListener("click",d,{capture:!0}),document.removeEventListener("keydown",p,{capture:!0}),Pe&&$t(Pe),Pe==null||Pe.remove(),Bt==null||Bt.destroy(),Bt=null,Pe=null,o=null,Ke=null}}function Qo(){Ke==null||Ke()}function zn(){return Ke!==null}function v(e,t,n){function r(u,d){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:d,constr:a,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,d);const p=a.prototype,h=Object.keys(p);for(let k=0;k<h.length;k++){const m=h[k];m in u||(u[m]=p[m].bind(u))}}const o=(n==null?void 0:n.Parent)??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function a(u){var d;const p=n!=null&&n.Parent?new s:this;r(p,u),(d=p._zod).deferred??(d.deferred=[]);for(const h of p._zod.deferred)h();return p}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:u=>{var d,p;return n!=null&&n.Parent&&u instanceof n.Parent?!0:(p=(d=u==null?void 0:u._zod)==null?void 0:d.traits)==null?void 0:p.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class In extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ms extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const bs={};function Gt(e){return bs}function ks(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 ei(e,t){return typeof t=="bigint"?t.toString():t}function Gr(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ti(e){return e==null}function ni(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Pl(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const d=r.match(/\d?e-(\d?)/);d!=null&&d[1]&&(o=Number.parseInt(d[1]))}const s=n>o?n:o,a=Number.parseInt(e.toFixed(s).replace(".","")),u=Number.parseInt(t.toFixed(s).replace(".",""));return a%u/10**s}const _s=Symbol("evaluating");function V(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==_s)return r===void 0&&(r=_s,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function an(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Wt(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function vs(e){return JSON.stringify(e)}function Rl(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const ys="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function lr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ll=Gr(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function $n(e){if(lr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(lr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ws(e){return $n(e)?{...e}:Array.isArray(e)?[...e]:e}const zl=new Set(["string","number","symbol"]);function Nn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Jt(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function O(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Il(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const $l={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 Nl(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=Wt(e._zod.def,{get shape(){const a={};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(a[u]=n.shape[u])}return an(this,"shape",a),a},checks:[]});return Jt(e,s)}function Ol(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=Wt(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&delete a[u]}return an(this,"shape",a),a},checks:[]});return Jt(e,s)}function Dl(e,t){if(!$n(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Wt(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return an(this,"shape",s),s}});return Jt(e,o)}function Ml(e,t){if(!$n(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Wt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return an(this,"shape",r),r}});return Jt(e,n)}function Ul(e,t){const n=Wt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return an(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Jt(e,n)}function jl(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=Wt(t._zod.def,{get shape(){const u=t._zod.def.shape,d={...u};if(n)for(const p in n){if(!(p in u))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(d[p]=e?new e({type:"optional",innerType:u[p]}):u[p])}else for(const p in u)d[p]=e?new e({type:"optional",innerType:u[p]}):u[p];return an(this,"shape",d),d},checks:[]});return Jt(t,a)}function Zl(e,t,n){const r=Wt(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const a in n){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(s[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)s[a]=new e({type:"nonoptional",innerType:o[a]});return an(this,"shape",s),s}});return Jt(t,r)}function On(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 Dn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Wr(e){return typeof e=="string"?e:e==null?void 0:e.message}function Xt(e,t,n){var o,s,a,u,d,p;const r={...e,path:e.path??[]};if(!e.message){const h=Wr((a=(s=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:s.error)==null?void 0:a.call(s,e))??Wr((u=t==null?void 0:t.error)==null?void 0:u.call(t,e))??Wr((d=n.customError)==null?void 0:d.call(n,e))??Wr((p=n.localeError)==null?void 0:p.call(n,e))??"Invalid input";r.message=h}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function ri(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ur(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const xs=(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,ei,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ss=v("$ZodError",xs),Ts=v("$ZodError",xs,{Parent:Error});function ql(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 Hl(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let a=n,u=0;for(;u<s.path.length;){const d=s.path[u];u===s.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(t(s))):a[d]=a[d]||{_errors:[]},a=a[d],u++}}};return r(e),n}const oi=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new In;if(a.issues.length){const u=new((o==null?void 0:o.Err)??e)(a.issues.map(d=>Xt(d,s,Gt())));throw ys(u,o==null?void 0:o.callee),u}return a.value},ii=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const u=new((o==null?void 0:o.Err)??e)(a.issues.map(d=>Xt(d,s,Gt())));throw ys(u,o==null?void 0:o.callee),u}return a.value},Jr=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new In;return s.issues.length?{success:!1,error:new(e??Ss)(s.issues.map(a=>Xt(a,o,Gt())))}:{success:!0,data:s.value}},Fl=Jr(Ts),Xr=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(a=>Xt(a,o,Gt())))}:{success:!0,data:s.value}},Bl=Xr(Ts),Gl=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return oi(e)(t,n,o)},Wl=e=>(t,n,r)=>oi(e)(t,n,r),Jl=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ii(e)(t,n,o)},Xl=e=>async(t,n,r)=>ii(e)(t,n,r),Vl=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Jr(e)(t,n,o)},Yl=e=>(t,n,r)=>Jr(e)(t,n,r),Kl=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Xr(e)(t,n,o)},Ql=e=>async(t,n,r)=>Xr(e)(t,n,r),eu=/^[cC][^\s-]{8,}$/,tu=/^[0-9a-z]+$/,nu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ru=/^[0-9a-vA-V]{20}$/,ou=/^[A-Za-z0-9]{27}$/,iu=/^[a-zA-Z0-9_-]{21}$/,su=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,au=/^([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})$/,Es=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)$/,cu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,lu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function uu(){return new RegExp(lu,"u")}const du=/^(?:(?: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])$/,pu=/^(([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}|:))$/,hu=/^((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])$/,fu=/^(([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}=))?$/,As=/^[A-Za-z0-9_-]*$/,mu=/^\+[1-9]\d{6,14}$/,Cs="(?:(?:\\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])))",bu=new RegExp(`^${Cs}$`);function Ps(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ku(e){return new RegExp(`^${Ps(e)}$`)}function _u(e){const t=Ps({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Cs}T(?:${r})$`)}const vu=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},yu=/^-?\d+$/,Rs=/^-?\d+(?:\.\d+)?$/,wu=/^(?:true|false)$/i,xu=/^[^A-Z]*$/,Su=/^[^a-z]*$/,Qe=v("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ls={number:"number",bigint:"bigint",object:"date"},zs=v("$ZodCheckLessThan",(e,t)=>{Qe.init(e,t);const n=Ls[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Is=v("$ZodCheckGreaterThan",(e,t)=>{Qe.init(e,t);const n=Ls[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Tu=v("$ZodCheckMultipleOf",(e,t)=>{Qe.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Pl(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})}}),Eu=v("$ZodCheckNumberFormat",(e,t)=>{var a;Qe.init(e,t),t.format=t.format||"float64";const n=(a=t.format)==null?void 0:a.includes("int"),r=n?"int":"number",[o,s]=$l[t.format];e._zod.onattach.push(u=>{const d=u._zod.bag;d.format=t.format,d.minimum=o,d.maximum=s,n&&(d.pattern=yu)}),e._zod.check=u=>{const d=u.value;if(n){if(!Number.isInteger(d)){u.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:d,inst:e});return}if(!Number.isSafeInteger(d)){d>0?u.issues.push({input:d,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):u.issues.push({input:d,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}d<o&&u.issues.push({origin:"number",input:d,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),d>s&&u.issues.push({origin:"number",input:d,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Au=v("$ZodCheckMaxLength",(e,t)=>{var n;Qe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ti(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const a=ri(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Cu=v("$ZodCheckMinLength",(e,t)=>{var n;Qe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ti(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const a=ri(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Pu=v("$ZodCheckLengthEquals",(e,t)=>{var n;Qe.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ti(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const a=ri(o),u=s>t.length;r.issues.push({origin:a,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Vr=v("$ZodCheckStringFormat",(e,t)=>{var n,r;Qe.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ru=v("$ZodCheckRegex",(e,t)=>{Vr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Lu=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=xu),Vr.init(e,t)}),zu=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Su),Vr.init(e,t)}),Iu=v("$ZodCheckIncludes",(e,t)=>{Qe.init(e,t);const n=Nn(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),$u=v("$ZodCheckStartsWith",(e,t)=>{Qe.init(e,t);const n=new RegExp(`^${Nn(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Nu=v("$ZodCheckEndsWith",(e,t)=>{Qe.init(e,t);const n=new RegExp(`.*${Nn(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Ou=v("$ZodCheckOverwrite",(e,t)=>{Qe.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Du{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(`
|
|
1345
|
+
`;let ln=!1;function cr(){if(ln)return;const e=document.createElement("style");e.setAttribute("data-ap-sdk","1"),e.textContent=It,document.head.appendChild(e),ln=!0}function Hr(e){if(e===document.body)return"body";const t=[];let n=e;for(;n&&n!==document.body;){if(n.id){t.unshift(`#${CSS.escape(n.id)}`);break}let r=n.tagName.toLowerCase();const o=n.parentElement;if(o){const s=Array.from(o.children).filter(a=>a.tagName===n.tagName);if(s.length>1){const a=s.indexOf(n)+1;r+=`:nth-of-type(${a})`}}t.unshift(r),n=n.parentElement}return t.join(" > ")||e.tagName.toLowerCase()}function Fr(e,t=200){const n=(e.textContent??"").replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}const hl=["role","type","name","href","src","alt","title","for","placeholder","data-testid"];function Br(e){const t=e.tagName.toLowerCase(),n=e.id?`#${e.id}`:"",r=e.classList.length?"."+Array.from(e.classList).join("."):"",o=[],s=new Set,a=u=>{if(s.has(u)||o.length>=8)return;const d=e.getAttribute(u);if(!d)return;s.add(u);const h=d.length>80?d.slice(0,80)+"…":d;o.push(`[${u}="${h}"]`)};for(const u of Array.from(e.attributes))u.name.startsWith("aria-")&&a(u.name);for(const u of hl)a(u);return`${t}${n}${r}${o.join("")}`}function fl(e,t=80){const n=Array.from(e.childNodes).filter(r=>r.nodeType===Node.TEXT_NODE).map(r=>(r.textContent??"").trim()).filter(Boolean).join(" ");return n.length>t?n.slice(0,t)+"…":n}function gl(e,t=5,n=10){function r(o,s){const a=Br(o),u=" ".repeat(s),d=Array.from(o.children).slice(0,n);if(s>=t||d.length===0){const h=fl(o);return h?`${u}${a} "${h}"`:`${u}${a}`}return[`${u}${a}`,...d.map(h=>r(h,s+1))].join(`
|
|
1346
|
+
`)}return r(e,0)}const ml='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"]',bl={fieldset:"legend",table:"caption",figure:"figcaption",details:"summary"};function Gr(e,t){const n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}function kl(e){const t=e.querySelectorAll('h1, h2, h3, h4, h5, h6, [role="heading"]');for(const n of Array.from(t)){let r=n.parentElement;for(;r&&r!==e&&!r.matches(ml);)r=r.parentElement;if(r===e){const o=(n.textContent??"").trim();if(o)return o}}return""}function _l(e,t=80){var a,u,d;const n=bl[e.tagName.toLowerCase()];if(n){const h=(u=(a=e.querySelector(n))==null?void 0:a.textContent)==null?void 0:u.trim();if(h)return Gr(h,t)}const r=kl(e);if(r)return Gr(r,t);const o=(d=e.getAttribute("aria-label"))==null?void 0:d.trim();if(o)return Gr(o,t);const s=e.getAttribute("aria-labelledby");if(s){const h=s.split(/\s+/).map(p=>{var b,m;return((m=(b=document.getElementById(p))==null?void 0:b.textContent)==null?void 0:m.trim())??""}).filter(Boolean).join(" ");if(h)return Gr(h,t)}return""}function vl(e,t=6){const n=[],r=new Set;let o=e;for(;o&&o!==document.body&&n.length<t;){const s=o===e?"":_l(o),a=s&&!r.has(s)?`${Br(o)} ["${s}"]`:Br(o);s&&r.add(s),n.unshift(a),o=o.parentElement}return n.join(" > ")||Br(e)}function us(e,t){return e.length>t?e.slice(0,t)+"… (truncated)":e}function lr(e){var r;const t=document.querySelector(e);return((r=t==null?void 0:t.content)==null?void 0:r.trim())||void 0}function ds(){const e=t=>{try{return t()}catch{return}};return{description:e(()=>lr('meta[name="description"]')),canonicalUrl:e(()=>{var t;return((t=document.querySelector('link[rel="canonical"]'))==null?void 0:t.href)||void 0}),lang:e(()=>document.documentElement.lang||void 0),ogTitle:e(()=>lr('meta[property="og:title"]')),ogDescription:e(()=>lr('meta[property="og:description"]')),ogType:e(()=>lr('meta[property="og:type"]')),ogSiteName:e(()=>lr('meta[property="og:site_name"]')),viewportWidth:e(()=>window.innerWidth),viewportHeight:e(()=>window.innerHeight),scrollX:e(()=>Math.round(window.scrollX)),scrollY:e(()=>Math.round(window.scrollY)),selectionText:e(()=>{var n;const t=(n=window.getSelection())==null?void 0:n.toString().trim();return t?us(t,1e3):void 0}),capturedAt:new Date().toISOString()}}function yl(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 wl(e){const t=e.getAttribute("role")||void 0,n=e.getAttribute("aria-label")||void 0;let r;const o=e.closest("section, article, main, nav, aside, header, footer, [role]");if(o){const s=o.querySelector("h1, h2, h3, h4, h5, h6"),a=o.getAttribute("aria-label")||((s==null?void 0:s.textContent)||"").trim(),u=o.tagName.toLowerCase();r=a?`${u}: ${us(a,120)}`:u}return{elementRole:t,elementAriaLabel:n,enclosingSection:r}}function xl(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(`
|
|
1347
|
+
`)}const Ln=new Set;let zn=null,Wr=!1,Ko=!1;function Sl(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function Tl(){const e=document.querySelectorAll("dialog[open]");for(let n=0;n<e.length;n++)try{if(e[n].matches(":modal"))return!0}catch{}const t=document.querySelectorAll('[role="dialog"], [role="alertdialog"]');for(let n=0;n<t.length;n++){const r=t[n];if(!(Ln.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&Sl(r))return!0}return!1}function ps(){const e=Tl(),t=e&&!Ko;Ko=e;for(const n of Ln){n.hasAttribute("inert")&&n.removeAttribute("inert"),n.getAttribute("aria-hidden")==="true"&&n.removeAttribute("aria-hidden");const r=n.contains(document.activeElement);if(n.matches(":popover-open")){if(t&&!r){try{n.hidePopover()}catch{}try{n.showPopover()}catch{}}}else try{n.showPopover()}catch{}}}function hs(e){if(!(e instanceof Node))return!1;for(const t of Ln)if(t===e||t.contains(e))return!0;return!1}function In(e){(hs(e.target)||"relatedTarget"in e&&hs(e.relatedTarget))&&e.stopPropagation()}function El(){Wr||(window.addEventListener("focusin",In,!0),window.addEventListener("focusout",In,!0),window.addEventListener("pointerdown",In,!0),Wr=!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")&&ps()}),zn.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function $t(e){"showPopover"in e&&(e.setAttribute("popover","manual"),Ln.add(e),El(),ps())}function Nt(e){if(Ln.delete(e),Ln.size===0&&(zn&&(zn.disconnect(),zn=null),Wr&&(window.removeEventListener("focusin",In,!0),window.removeEventListener("focusout",In,!0),window.removeEventListener("pointerdown",In,!0),Wr=!1),Ko=!1),"hidePopover"in e)try{e.hidePopover()}catch{}}function Qo(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),$t(t),{el:t,update:s=>{const a=s.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:()=>{Nt(t),t.remove()}}}const Al="🎯 Click any element to capture";let Wt=null,Ae=null,Ne=null;function ur(e){return e instanceof Element?e.closest("[data-ap-sdk]")!==null||e.closest(".ap-sdk-panel")!==null||e.closest(".ap-sdk-highlight")!==null||e.closest(".ap-sdk-picker-cursor")!==null:!1}function Cl(){var e;return(((e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)??!1)||"ontouchstart"in window}function fs(e){Wt==null||Wt.update(e)}function gs(e){const t=ds(),n=yl(e),r=wl(e);let o;try{o=e.outerHTML.slice(0,4e3)}catch{}return{pageUrl:window.location.href,pageTitle:document.title,elementText:Fr(e),cssSelector:Hr(e),innerTree:gl(e),outerTree:vl(e),elementOuterHtml:o,ancestry:n,...r,...t}}function ei(e,t){Ne&&Ne();const n=Cl();Wt=Qo(),Ae=document.createElement("div"),Ae.className="ap-sdk-picker-cursor",Ae.setAttribute("data-ap-sdk","1"),Ae.textContent=n?"Tap any element to preview":Al,document.body.appendChild(Ae),$t(Ae);let r=null,o=null;const s=p=>{Ne==null||Ne(),e(gs(p),p)},a=p=>{if(o=p,fs(p),!Ae)return;Ae.classList.add("ap-sdk-picker-cursor--confirm"),Ae.innerHTML="";const b=document.createElement("span");b.className="ap-sdk-picker-cursor__label",b.textContent=`<${p.tagName.toLowerCase()}>`;const m=document.createElement("button");m.type="button",m.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--cancel",m.textContent="✕ Cancel",m.setAttribute("data-ap-sdk","1"),m.setAttribute("aria-label","Cancel picking"),m.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),Ne==null||Ne(),t()});const _=document.createElement("button");_.type="button",_.className="ap-sdk-picker-cursor__btn",_.textContent="⬆ Parent",_.setAttribute("data-ap-sdk","1"),_.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),o!=null&&o.parentElement&&a(o.parentElement)});const w=document.createElement("button");w.type="button",w.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",w.textContent="✓ Select",w.setAttribute("data-ap-sdk","1"),w.addEventListener("click",C=>{C.preventDefault(),C.stopPropagation(),o&&s(o)}),Ae.appendChild(b),Ae.appendChild(m),Ae.appendChild(_),Ae.appendChild(w)},u=p=>{ur(p.target)||(r=p.target,fs(r))},d=p=>{if(ur(p.target))return;p.preventDefault(),p.stopImmediatePropagation();const b=p.target??r;if(b){if(n){a(b);return}s(b)}},h=p=>{p.key==="Escape"&&(Ne==null||Ne(),t())};n||document.addEventListener("mouseover",u,{capture:!0}),document.addEventListener("click",d,{capture:!0}),document.addEventListener("keydown",h,{capture:!0}),Ne=()=>{n||document.removeEventListener("mouseover",u,{capture:!0}),document.removeEventListener("click",d,{capture:!0}),document.removeEventListener("keydown",h,{capture:!0}),Ae&&Nt(Ae),Ae==null||Ae.remove(),Wt==null||Wt.destroy(),Wt=null,Ae=null,o=null,Ne=null}}function ti(){Ne==null||Ne()}function $n(){return Ne!==null}function v(e,t,n){function r(u,d){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:d,constr:a,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,d);const h=a.prototype,p=Object.keys(h);for(let b=0;b<p.length;b++){const m=p[b];m in u||(u[m]=h[m].bind(u))}}const o=(n==null?void 0:n.Parent)??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function a(u){var d;const h=n!=null&&n.Parent?new s:this;r(h,u),(d=h._zod).deferred??(d.deferred=[]);for(const p of h._zod.deferred)p();return h}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:u=>{var d,h;return n!=null&&n.Parent&&u instanceof n.Parent?!0:(h=(d=u==null?void 0:u._zod)==null?void 0:d.traits)==null?void 0:h.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class Nn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ms extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const bs={};function Jt(e){return bs}function ks(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 ni(e,t){return typeof t=="bigint"?t.toString():t}function Jr(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ri(e){return e==null}function oi(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Pl(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const d=r.match(/\d?e-(\d?)/);d!=null&&d[1]&&(o=Number.parseInt(d[1]))}const s=n>o?n:o,a=Number.parseInt(e.toFixed(s).replace(".","")),u=Number.parseInt(t.toFixed(s).replace(".",""));return a%u/10**s}const _s=Symbol("evaluating");function Y(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==_s)return r===void 0&&(r=_s,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function un(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Xt(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function vs(e){return JSON.stringify(e)}function Rl(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const ys="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function dr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ll=Jr(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function On(e){if(dr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(dr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ws(e){return On(e)?{...e}:Array.isArray(e)?[...e]:e}const zl=new Set(["string","number","symbol"]);function Dn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Vt(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function N(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Il(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const $l={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 Nl(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=Xt(e._zod.def,{get shape(){const a={};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(a[u]=n.shape[u])}return un(this,"shape",a),a},checks:[]});return Vt(e,s)}function Ol(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=Xt(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&delete a[u]}return un(this,"shape",a),a},checks:[]});return Vt(e,s)}function Dl(e,t){if(!On(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Xt(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return un(this,"shape",s),s}});return Vt(e,o)}function Ml(e,t){if(!On(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Xt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return un(this,"shape",r),r}});return Vt(e,n)}function Ul(e,t){const n=Xt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return un(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Vt(e,n)}function jl(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=Xt(t._zod.def,{get shape(){const u=t._zod.def.shape,d={...u};if(n)for(const h in n){if(!(h in u))throw new Error(`Unrecognized key: "${h}"`);n[h]&&(d[h]=e?new e({type:"optional",innerType:u[h]}):u[h])}else for(const h in u)d[h]=e?new e({type:"optional",innerType:u[h]}):u[h];return un(this,"shape",d),d},checks:[]});return Vt(t,a)}function Zl(e,t,n){const r=Xt(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const a in n){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(s[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)s[a]=new e({type:"nonoptional",innerType:o[a]});return un(this,"shape",s),s}});return Vt(t,r)}function Mn(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 Un(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Xr(e){return typeof e=="string"?e:e==null?void 0:e.message}function Yt(e,t,n){var o,s,a,u,d,h;const r={...e,path:e.path??[]};if(!e.message){const p=Xr((a=(s=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:s.error)==null?void 0:a.call(s,e))??Xr((u=t==null?void 0:t.error)==null?void 0:u.call(t,e))??Xr((d=n.customError)==null?void 0:d.call(n,e))??Xr((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";r.message=p}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function ii(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function pr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const xs=(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,ni,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ss=v("$ZodError",xs),Ts=v("$ZodError",xs,{Parent:Error});function ql(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 Hl(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let a=n,u=0;for(;u<s.path.length;){const d=s.path[u];u===s.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(t(s))):a[d]=a[d]||{_errors:[]},a=a[d],u++}}};return r(e),n}const si=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new Nn;if(a.issues.length){const u=new((o==null?void 0:o.Err)??e)(a.issues.map(d=>Yt(d,s,Jt())));throw ys(u,o==null?void 0:o.callee),u}return a.value},ai=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const u=new((o==null?void 0:o.Err)??e)(a.issues.map(d=>Yt(d,s,Jt())));throw ys(u,o==null?void 0:o.callee),u}return a.value},Vr=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Nn;return s.issues.length?{success:!1,error:new(e??Ss)(s.issues.map(a=>Yt(a,o,Jt())))}:{success:!0,data:s.value}},Fl=Vr(Ts),Yr=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(a=>Yt(a,o,Jt())))}:{success:!0,data:s.value}},Bl=Yr(Ts),Gl=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return si(e)(t,n,o)},Wl=e=>(t,n,r)=>si(e)(t,n,r),Jl=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ai(e)(t,n,o)},Xl=e=>async(t,n,r)=>ai(e)(t,n,r),Vl=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Vr(e)(t,n,o)},Yl=e=>(t,n,r)=>Vr(e)(t,n,r),Kl=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Yr(e)(t,n,o)},Ql=e=>async(t,n,r)=>Yr(e)(t,n,r),eu=/^[cC][^\s-]{8,}$/,tu=/^[0-9a-z]+$/,nu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ru=/^[0-9a-vA-V]{20}$/,ou=/^[A-Za-z0-9]{27}$/,iu=/^[a-zA-Z0-9_-]{21}$/,su=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,au=/^([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})$/,Es=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)$/,cu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,lu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function uu(){return new RegExp(lu,"u")}const du=/^(?:(?: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])$/,pu=/^(([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}|:))$/,hu=/^((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])$/,fu=/^(([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}=))?$/,As=/^[A-Za-z0-9_-]*$/,mu=/^\+[1-9]\d{6,14}$/,Cs="(?:(?:\\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])))",bu=new RegExp(`^${Cs}$`);function Ps(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ku(e){return new RegExp(`^${Ps(e)}$`)}function _u(e){const t=Ps({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Cs}T(?:${r})$`)}const vu=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},yu=/^-?\d+$/,Rs=/^-?\d+(?:\.\d+)?$/,wu=/^(?:true|false)$/i,xu=/^[^A-Z]*$/,Su=/^[^a-z]*$/,Ke=v("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ls={number:"number",bigint:"bigint",object:"date"},zs=v("$ZodCheckLessThan",(e,t)=>{Ke.init(e,t);const n=Ls[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Is=v("$ZodCheckGreaterThan",(e,t)=>{Ke.init(e,t);const n=Ls[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Tu=v("$ZodCheckMultipleOf",(e,t)=>{Ke.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Pl(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})}}),Eu=v("$ZodCheckNumberFormat",(e,t)=>{var a;Ke.init(e,t),t.format=t.format||"float64";const n=(a=t.format)==null?void 0:a.includes("int"),r=n?"int":"number",[o,s]=$l[t.format];e._zod.onattach.push(u=>{const d=u._zod.bag;d.format=t.format,d.minimum=o,d.maximum=s,n&&(d.pattern=yu)}),e._zod.check=u=>{const d=u.value;if(n){if(!Number.isInteger(d)){u.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:d,inst:e});return}if(!Number.isSafeInteger(d)){d>0?u.issues.push({input:d,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):u.issues.push({input:d,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}d<o&&u.issues.push({origin:"number",input:d,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),d>s&&u.issues.push({origin:"number",input:d,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Au=v("$ZodCheckMaxLength",(e,t)=>{var n;Ke.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ri(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const a=ii(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Cu=v("$ZodCheckMinLength",(e,t)=>{var n;Ke.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ri(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const a=ii(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Pu=v("$ZodCheckLengthEquals",(e,t)=>{var n;Ke.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ri(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const a=ii(o),u=s>t.length;r.issues.push({origin:a,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Kr=v("$ZodCheckStringFormat",(e,t)=>{var n,r;Ke.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ru=v("$ZodCheckRegex",(e,t)=>{Kr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Lu=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=xu),Kr.init(e,t)}),zu=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Su),Kr.init(e,t)}),Iu=v("$ZodCheckIncludes",(e,t)=>{Ke.init(e,t);const n=Dn(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),$u=v("$ZodCheckStartsWith",(e,t)=>{Ke.init(e,t);const n=new RegExp(`^${Dn(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Nu=v("$ZodCheckEndsWith",(e,t)=>{Ke.init(e,t);const n=new RegExp(`.*${Dn(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Ou=v("$ZodCheckOverwrite",(e,t)=>{Ke.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Du{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(`
|
|
1331
1348
|
`).filter(a=>a),o=Math.min(...r.map(a=>a.length-a.trimStart().length)),s=r.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of s)this.content.push(a)}compile(){const t=Function,n=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new t(...n,o.join(`
|
|
1332
|
-
`))}}const Mu={major:4,minor:3,patch:5},
|
|
1333
|
-
if (${
|
|
1334
|
-
if (${
|
|
1335
|
-
payload.issues = payload.issues.concat(${
|
|
1349
|
+
`))}}const Mu={major:4,minor:3,patch:5},he=v("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Mu;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const s of r)for(const a of s._zod.onattach)a(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const s=(u,d,h)=>{let p=Mn(u),b;for(const m of d){if(m._zod.def.when){if(!m._zod.def.when(u))continue}else if(p)continue;const _=u.issues.length,w=m._zod.check(u);if(w instanceof Promise&&(h==null?void 0:h.async)===!1)throw new Nn;if(b||w instanceof Promise)b=(b??Promise.resolve()).then(async()=>{await w,u.issues.length!==_&&(p||(p=Mn(u,_)))});else{if(u.issues.length===_)continue;p||(p=Mn(u,_))}}return b?b.then(()=>u):u},a=(u,d,h)=>{if(Mn(u))return u.aborted=!0,u;const p=s(d,r,h);if(p instanceof Promise){if(h.async===!1)throw new Nn;return p.then(b=>e._zod.parse(b,h))}return e._zod.parse(p,h)};e._zod.run=(u,d)=>{if(d.skipChecks)return e._zod.parse(u,d);if(d.direction==="backward"){const p=e._zod.parse({value:u.value,issues:[]},{...d,skipChecks:!0});return p instanceof Promise?p.then(b=>a(b,u,d)):a(p,u,d)}const h=e._zod.parse(u,d);if(h instanceof Promise){if(d.async===!1)throw new Nn;return h.then(p=>s(p,r,d))}return s(h,r,d)}}Y(e,"~standard",()=>({validate:s=>{var a;try{const u=Fl(e,s);return u.success?{value:u.data}:{issues:(a=u.error)==null?void 0:a.issues}}catch{return Bl(e,s).then(d=>{var h;return d.success?{value:d.data}:{issues:(h=d.error)==null?void 0:h.issues}})}},vendor:"zod",version:1}))}),ci=v("$ZodString",(e,t)=>{var n;he.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??vu(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),fe=v("$ZodStringFormat",(e,t)=>{Kr.init(e,t),ci.init(e,t)}),Uu=v("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=au),fe.init(e,t)}),ju=v("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Es(r))}else t.pattern??(t.pattern=Es());fe.init(e,t)}),Zu=v("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=cu),fe.init(e,t)}),qu=v("$ZodURL",(e,t)=>{fe.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Hu=v("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=uu()),fe.init(e,t)}),Fu=v("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=iu),fe.init(e,t)}),Bu=v("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=eu),fe.init(e,t)}),Gu=v("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=tu),fe.init(e,t)}),Wu=v("$ZodULID",(e,t)=>{t.pattern??(t.pattern=nu),fe.init(e,t)}),Ju=v("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ru),fe.init(e,t)}),Xu=v("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ou),fe.init(e,t)}),Vu=v("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=_u(t)),fe.init(e,t)}),Yu=v("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=bu),fe.init(e,t)}),Ku=v("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ku(t)),fe.init(e,t)}),Qu=v("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=su),fe.init(e,t)}),ed=v("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=du),fe.init(e,t),e._zod.bag.format="ipv4"}),td=v("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=pu),fe.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),nd=v("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=hu),fe.init(e,t)}),rd=v("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=fu),fe.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,s]=r;if(!s)throw new Error;const a=Number(s);if(`${a}`!==s)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function $s(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const od=v("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=gu),fe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{$s(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function id(e){if(!As.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return $s(n)}const sd=v("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=As),fe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{id(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),ad=v("$ZodE164",(e,t)=>{t.pattern??(t.pattern=mu),fe.init(e,t)});function cd(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const ld=v("$ZodJWT",(e,t)=>{fe.init(e,t),e._zod.check=n=>{cd(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Ns=v("$ZodNumber",(e,t)=>{he.init(e,t),e._zod.pattern=e._zod.bag.pattern??Rs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),ud=v("$ZodNumberFormat",(e,t)=>{Eu.init(e,t),Ns.init(e,t)}),dd=v("$ZodBoolean",(e,t)=>{he.init(e,t),e._zod.pattern=wu,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),pd=v("$ZodAny",(e,t)=>{he.init(e,t),e._zod.parse=n=>n}),hd=v("$ZodUnknown",(e,t)=>{he.init(e,t),e._zod.parse=n=>n}),fd=v("$ZodNever",(e,t)=>{he.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Os(e,t,n){e.issues.length&&t.issues.push(...Un(n,e.issues)),t.value[n]=e.value}const gd=v("$ZodArray",(e,t)=>{he.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const s=[];for(let a=0;a<o.length;a++){const u=o[a],d=t.element._zod.run({value:u,issues:[]},r);d instanceof Promise?s.push(d.then(h=>Os(h,n,a))):Os(d,n,a)}return s.length?Promise.all(s).then(()=>n):n}});function Qr(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Un(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Ds(e){var r,o,s,a;const t=Object.keys(e.shape);for(const u of t)if(!((a=(s=(o=(r=e.shape)==null?void 0:r[u])==null?void 0:o._zod)==null?void 0:s.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${u}": expected a Zod schema`);const n=Il(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Ms(e,t,n,r,o,s){const a=[],u=o.keySet,d=o.catchall._zod,h=d.def.type,p=d.optout==="optional";for(const b in t){if(u.has(b))continue;if(h==="never"){a.push(b);continue}const m=d.run({value:t[b],issues:[]},r);m instanceof Promise?e.push(m.then(_=>Qr(_,n,b,t,p))):Qr(m,n,b,t,p)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const md=v("$ZodObject",(e,t)=>{he.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const u=t.shape;Object.defineProperty(t,"shape",{get:()=>{const d={...u};return Object.defineProperty(t,"shape",{value:d}),d}})}const r=Jr(()=>Ds(t));Y(e._zod,"propValues",()=>{const u=t.shape,d={};for(const h in u){const p=u[h]._zod;if(p.values){d[h]??(d[h]=new Set);for(const b of p.values)d[h].add(b)}}return d});const o=dr,s=t.catchall;let a;e._zod.parse=(u,d)=>{a??(a=r.value);const h=u.value;if(!o(h))return u.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),u;u.value={};const p=[],b=a.shape;for(const m of a.keys){const _=b[m],w=_._zod.optout==="optional",C=_._zod.run({value:h[m],issues:[]},d);C instanceof Promise?p.push(C.then(M=>Qr(M,u,m,h,w))):Qr(C,u,m,h,w)}return s?Ms(p,h,u,d,r.value,e):p.length?Promise.all(p).then(()=>u):u}}),bd=v("$ZodObjectJIT",(e,t)=>{md.init(e,t);const n=e._zod.parse,r=Jr(()=>Ds(t)),o=m=>{var T;const _=new Du(["shape","payload","ctx"]),w=r.value,C=x=>{const R=vs(x);return`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`};_.write("const input = payload.value;");const M=Object.create(null);let W=0;for(const x of w.keys)M[x]=`key_${W++}`;_.write("const newResult = {};");for(const x of w.keys){const R=M[x],D=vs(x),pe=m[x],_e=((T=pe==null?void 0:pe._zod)==null?void 0:T.optout)==="optional";_.write(`const ${R} = ${C(x)};`),_e?_.write(`
|
|
1350
|
+
if (${R}.issues.length) {
|
|
1351
|
+
if (${D} in input) {
|
|
1352
|
+
payload.issues = payload.issues.concat(${R}.issues.map(iss => ({
|
|
1336
1353
|
...iss,
|
|
1337
|
-
path: iss.path ? [${
|
|
1354
|
+
path: iss.path ? [${D}, ...iss.path] : [${D}]
|
|
1338
1355
|
})));
|
|
1339
1356
|
}
|
|
1340
1357
|
}
|
|
1341
1358
|
|
|
1342
|
-
if (${
|
|
1343
|
-
if (${
|
|
1344
|
-
newResult[${
|
|
1359
|
+
if (${R}.value === undefined) {
|
|
1360
|
+
if (${D} in input) {
|
|
1361
|
+
newResult[${D}] = undefined;
|
|
1345
1362
|
}
|
|
1346
1363
|
} else {
|
|
1347
|
-
newResult[${
|
|
1364
|
+
newResult[${D}] = ${R}.value;
|
|
1348
1365
|
}
|
|
1349
1366
|
|
|
1350
1367
|
`):_.write(`
|
|
1351
|
-
if (${
|
|
1352
|
-
payload.issues = payload.issues.concat(${
|
|
1368
|
+
if (${R}.issues.length) {
|
|
1369
|
+
payload.issues = payload.issues.concat(${R}.issues.map(iss => ({
|
|
1353
1370
|
...iss,
|
|
1354
|
-
path: iss.path ? [${
|
|
1371
|
+
path: iss.path ? [${D}, ...iss.path] : [${D}]
|
|
1355
1372
|
})));
|
|
1356
1373
|
}
|
|
1357
1374
|
|
|
1358
|
-
if (${
|
|
1359
|
-
if (${
|
|
1360
|
-
newResult[${
|
|
1375
|
+
if (${R}.value === undefined) {
|
|
1376
|
+
if (${D} in input) {
|
|
1377
|
+
newResult[${D}] = undefined;
|
|
1361
1378
|
}
|
|
1362
1379
|
} else {
|
|
1363
|
-
newResult[${
|
|
1380
|
+
newResult[${D}] = ${R}.value;
|
|
1364
1381
|
}
|
|
1365
1382
|
|
|
1366
|
-
`)}_.write("payload.value = newResult;"),_.write("return payload;");const R=_.compile();return(S,C)=>R(m,S,C)};let s;const a=lr,u=!bs.jitless,p=u&&Ll.value,h=t.catchall;let k;e._zod.parse=(m,_)=>{k??(k=r.value);const w=m.value;return a(w)?u&&p&&(_==null?void 0:_.async)===!1&&_.jitless!==!0?(s||(s=o(t.shape)),m=s(m,_),h?Ms([],w,m,_,k,e):m):n(m,_):(m.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),m)}});function Us(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!On(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(a=>Xt(a,r,Gt())))}),t)}const js=v("$ZodUnion",(e,t)=>{ue.init(e,t),V(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),V(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),V(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),V(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>ni(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(n)return r(o,s);let a=!1;const u=[];for(const d of t.options){const p=d._zod.run({value:o.value,issues:[]},s);if(p instanceof Promise)u.push(p),a=!0;else{if(p.issues.length===0)return p;u.push(p)}}return a?Promise.all(u).then(d=>Us(d,o,e,s)):Us(u,o,e,s)}}),kd=v("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,js.init(e,t);const n=e._zod.parse;V(e._zod,"propValues",()=>{const o={};for(const s of t.options){const a=s._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[u,d]of Object.entries(a)){o[u]||(o[u]=new Set);for(const p of d)o[u].add(p)}}return o});const r=Gr(()=>{var a;const o=t.options,s=new Map;for(const u of o){const d=(a=u._zod.propValues)==null?void 0:a[t.discriminator];if(!d||d.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(u)}"`);for(const p of d){if(s.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);s.set(p,u)}}return s});e._zod.parse=(o,s)=>{const a=o.value;if(!lr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const u=r.value.get(a==null?void 0:a[t.discriminator]);return u?u._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),_d=v("$ZodIntersection",(e,t)=>{ue.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([d,p])=>Zs(n,d,p)):Zs(n,s,a)}});function ai(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($n(e)&&$n(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const a=ai(e[s],t[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};o[s]=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],s=t[r],a=ai(o,s);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Zs(e,t,n){const r=new Map;let o;for(const u of t.issues)if(u.code==="unrecognized_keys"){o??(o=u);for(const d of u.keys)r.has(d)||r.set(d,{}),r.get(d).l=!0}else e.issues.push(u);for(const u of n.issues)if(u.code==="unrecognized_keys")for(const d of u.keys)r.has(d)||r.set(d,{}),r.get(d).r=!0;else e.issues.push(u);const s=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(s.length&&o&&e.issues.push({...o,keys:s}),On(e))return e;const a=ai(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 vd=v("$ZodRecord",(e,t)=>{ue.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!$n(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[],a=t.keyType._zod.values;if(a){n.value={};const u=new Set;for(const p of a)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){u.add(typeof p=="number"?p.toString():p);const h=t.valueType._zod.run({value:o[p],issues:[]},r);h instanceof Promise?s.push(h.then(k=>{k.issues.length&&n.issues.push(...Dn(p,k.issues)),n.value[p]=k.value})):(h.issues.length&&n.issues.push(...Dn(p,h.issues)),n.value[p]=h.value)}let d;for(const p in o)u.has(p)||(d=d??[],d.push(p));d&&d.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:d})}else{n.value={};for(const u of Reflect.ownKeys(o)){if(u==="__proto__")continue;let d=t.keyType._zod.run({value:u,issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Rs.test(u)&&d.issues.length&&d.issues.some(k=>k.code==="invalid_type"&&k.expected==="number")){const k=t.keyType._zod.run({value:Number(u),issues:[]},r);if(k instanceof Promise)throw new Error("Async schemas not supported in object keys currently");k.issues.length===0&&(d=k)}if(d.issues.length){t.mode==="loose"?n.value[u]=o[u]:n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(k=>Xt(k,r,Gt())),input:u,path:[u],inst:e});continue}const h=t.valueType._zod.run({value:o[u],issues:[]},r);h instanceof Promise?s.push(h.then(k=>{k.issues.length&&n.issues.push(...Dn(u,k.issues)),n.value[d.value]=k.value})):(h.issues.length&&n.issues.push(...Dn(u,h.issues)),n.value[d.value]=h.value)}}return s.length?Promise.all(s).then(()=>n):n}}),yd=v("$ZodEnum",(e,t)=>{ue.init(e,t);const n=ks(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>zl.has(typeof o)).map(o=>typeof o=="string"?Nn(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),wd=v("$ZodLiteral",(e,t)=>{if(ue.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Nn(r):r?Nn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),xd=v("$ZodTransform",(e,t)=>{ue.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ms(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 In;return n.value=o,n}});function qs(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Hs=v("$ZodOptional",(e,t)=>{ue.init(e,t),e._zod.optin="optional",e._zod.optout="optional",V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),V(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ni(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>qs(s,n.value)):qs(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Sd=v("$ZodExactOptional",(e,t)=>{Hs.init(e,t),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Td=v("$ZodNullable",(e,t)=>{ue.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ni(n.source)}|null)$`):void 0}),V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Ed=v("$ZodDefault",(e,t)=>{ue.init(e,t),e._zod.optin="optional",V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Fs(s,t)):Fs(o,t)}});function Fs(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Ad=v("$ZodPrefault",(e,t)=>{ue.init(e,t),e._zod.optin="optional",V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Cd=v("$ZodNonOptional",(e,t)=>{ue.init(e,t),V(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Bs(s,e)):Bs(o,e)}});function Bs(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 Pd=v("$ZodCatch",(e,t)=>{ue.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(a=>Xt(a,r,Gt()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>Xt(s,r,Gt()))},input:n.value}),n.issues=[]),n)}}),Rd=v("$ZodPipe",(e,t)=>{ue.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(a=>Kr(a,t.in,r)):Kr(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>Kr(s,t.out,r)):Kr(o,t.out,r)}});function Kr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Ld=v("$ZodReadonly",(e,t)=>{ue.init(e,t),V(e._zod,"propValues",()=>t.innerType._zod.propValues),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),V(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Gs):Gs(o)}});function Gs(e){return e.value=Object.freeze(e.value),e}const zd=v("$ZodCustom",(e,t)=>{Qe.init(e,t),ue.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>Ws(s,n,r,e));Ws(o,n,r,e)}});function Ws(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(ur(o))}}var Js;class Id{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function $d(){return new Id}(Js=globalThis).__zod_globalRegistry??(Js.__zod_globalRegistry=$d());const dr=globalThis.__zod_globalRegistry;function Nd(e,t){return new e({type:"string",...O(t)})}function Od(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function Xs(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function Dd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function Md(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function Ud(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function jd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function Zd(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function qd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function Hd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function Fd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function Bd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function Gd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function Wd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function Jd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function Xd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function Vd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function Yd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function Kd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function Qd(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function ep(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function tp(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function np(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}function rp(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function op(e,t){return new e({type:"string",format:"date",check:"string_format",...O(t)})}function ip(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function sp(e,t){return new e({type:"string",format:"duration",check:"string_format",...O(t)})}function ap(e,t){return new e({type:"number",checks:[],...O(t)})}function cp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function lp(e,t){return new e({type:"boolean",...O(t)})}function up(e){return new e({type:"any"})}function dp(e){return new e({type:"unknown"})}function pp(e,t){return new e({type:"never",...O(t)})}function Vs(e,t){return new zs({check:"less_than",...O(t),value:e,inclusive:!1})}function ci(e,t){return new zs({check:"less_than",...O(t),value:e,inclusive:!0})}function Ys(e,t){return new Is({check:"greater_than",...O(t),value:e,inclusive:!1})}function li(e,t){return new Is({check:"greater_than",...O(t),value:e,inclusive:!0})}function Ks(e,t){return new Tu({check:"multiple_of",...O(t),value:e})}function Qs(e,t){return new Au({check:"max_length",...O(t),maximum:e})}function Qr(e,t){return new Cu({check:"min_length",...O(t),minimum:e})}function ea(e,t){return new Pu({check:"length_equals",...O(t),length:e})}function hp(e,t){return new Ru({check:"string_format",format:"regex",...O(t),pattern:e})}function fp(e){return new Lu({check:"string_format",format:"lowercase",...O(e)})}function gp(e){return new zu({check:"string_format",format:"uppercase",...O(e)})}function mp(e,t){return new Iu({check:"string_format",format:"includes",...O(t),includes:e})}function bp(e,t){return new $u({check:"string_format",format:"starts_with",...O(t),prefix:e})}function kp(e,t){return new Nu({check:"string_format",format:"ends_with",...O(t),suffix:e})}function Mn(e){return new Ou({check:"overwrite",tx:e})}function _p(e){return Mn(t=>t.normalize(e))}function vp(){return Mn(e=>e.trim())}function yp(){return Mn(e=>e.toLowerCase())}function wp(){return Mn(e=>e.toUpperCase())}function xp(){return Mn(e=>Rl(e))}function Sp(e,t,n){return new e({type:"array",element:t,...O(n)})}function Tp(e,t,n){return new e({type:"custom",check:"custom",fn:t,...O(n)})}function Ep(e){const t=Ap(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(ur(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(ur(o))}},e(n.value,n)));return t}function Ap(e,t){const n=new Qe({check:"custom",...O(t)});return n._zod.check=e,n}function ta(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??dr,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function Se(e,t,n={path:[],schemaPath:[]}){var h,k;var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const u=(k=(h=e._zod).toJSONSchema)==null?void 0:k.call(h);if(u)a.schema=u;else{const m={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,m);else{const w=a.schema,P=t.processors[o.type];if(!P)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);P(e,t,w,m)}const _=e._zod.parent;_&&(a.ref||(a.ref=_),Se(_,t,m),t.seen.get(_).isParent=!0)}const d=t.metadataRegistry.get(e);return d&&Object.assign(a.schema,d),t.io==="input"&&je(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function na(e,t){var a,u,d,p;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const h of e.seen.entries()){const k=(a=e.metadataRegistry.get(h[0]))==null?void 0:a.id;if(k){const m=r.get(k);if(m&&m!==h[0])throw new Error(`Duplicate schema id "${k}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(k,h[0])}}const o=h=>{var P;const k=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const N=(P=e.external.registry.get(h[0]))==null?void 0:P.id,ne=e.external.uri??(x=>x);if(N)return{ref:ne(N)};const R=h[1].defId??h[1].schema.id??`schema${e.counter++}`;return h[1].defId=R,{defId:R,ref:`${ne("__shared")}#/${k}/${R}`}}if(h[1]===n)return{ref:"#"};const _=`#/${k}/`,w=h[1].schema.id??`__schema${e.counter++}`;return{defId:w,ref:_+w}},s=h=>{if(h[1].schema.$ref)return;const k=h[1],{ref:m,defId:_}=o(h);k.def={...k.schema},_&&(k.defId=_);const w=k.schema;for(const P in w)delete w[P];w.$ref=m};if(e.cycles==="throw")for(const h of e.seen.entries()){const k=h[1];if(k.cycle)throw new Error(`Cycle detected: #/${(u=k.cycle)==null?void 0:u.join("/")}/<root>
|
|
1383
|
+
`)}_.write("payload.value = newResult;"),_.write("return payload;");const P=_.compile();return(x,R)=>P(m,x,R)};let s;const a=dr,u=!bs.jitless,h=u&&Ll.value,p=t.catchall;let b;e._zod.parse=(m,_)=>{b??(b=r.value);const w=m.value;return a(w)?u&&h&&(_==null?void 0:_.async)===!1&&_.jitless!==!0?(s||(s=o(t.shape)),m=s(m,_),p?Ms([],w,m,_,b,e):m):n(m,_):(m.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),m)}});function Us(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Mn(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(a=>Yt(a,r,Jt())))}),t)}const js=v("$ZodUnion",(e,t)=>{he.init(e,t),Y(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Y(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Y(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Y(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>oi(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(n)return r(o,s);let a=!1;const u=[];for(const d of t.options){const h=d._zod.run({value:o.value,issues:[]},s);if(h instanceof Promise)u.push(h),a=!0;else{if(h.issues.length===0)return h;u.push(h)}}return a?Promise.all(u).then(d=>Us(d,o,e,s)):Us(u,o,e,s)}}),kd=v("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,js.init(e,t);const n=e._zod.parse;Y(e._zod,"propValues",()=>{const o={};for(const s of t.options){const a=s._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[u,d]of Object.entries(a)){o[u]||(o[u]=new Set);for(const h of d)o[u].add(h)}}return o});const r=Jr(()=>{var a;const o=t.options,s=new Map;for(const u of o){const d=(a=u._zod.propValues)==null?void 0:a[t.discriminator];if(!d||d.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(u)}"`);for(const h of d){if(s.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);s.set(h,u)}}return s});e._zod.parse=(o,s)=>{const a=o.value;if(!dr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const u=r.value.get(a==null?void 0:a[t.discriminator]);return u?u._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),_d=v("$ZodIntersection",(e,t)=>{he.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([d,h])=>Zs(n,d,h)):Zs(n,s,a)}});function li(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(On(e)&&On(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const a=li(e[s],t[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};o[s]=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],s=t[r],a=li(o,s);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Zs(e,t,n){const r=new Map;let o;for(const u of t.issues)if(u.code==="unrecognized_keys"){o??(o=u);for(const d of u.keys)r.has(d)||r.set(d,{}),r.get(d).l=!0}else e.issues.push(u);for(const u of n.issues)if(u.code==="unrecognized_keys")for(const d of u.keys)r.has(d)||r.set(d,{}),r.get(d).r=!0;else e.issues.push(u);const s=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(s.length&&o&&e.issues.push({...o,keys:s}),Mn(e))return e;const a=li(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 vd=v("$ZodRecord",(e,t)=>{he.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!On(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[],a=t.keyType._zod.values;if(a){n.value={};const u=new Set;for(const h of a)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){u.add(typeof h=="number"?h.toString():h);const p=t.valueType._zod.run({value:o[h],issues:[]},r);p instanceof Promise?s.push(p.then(b=>{b.issues.length&&n.issues.push(...Un(h,b.issues)),n.value[h]=b.value})):(p.issues.length&&n.issues.push(...Un(h,p.issues)),n.value[h]=p.value)}let d;for(const h in o)u.has(h)||(d=d??[],d.push(h));d&&d.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:d})}else{n.value={};for(const u of Reflect.ownKeys(o)){if(u==="__proto__")continue;let d=t.keyType._zod.run({value:u,issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Rs.test(u)&&d.issues.length&&d.issues.some(b=>b.code==="invalid_type"&&b.expected==="number")){const b=t.keyType._zod.run({value:Number(u),issues:[]},r);if(b instanceof Promise)throw new Error("Async schemas not supported in object keys currently");b.issues.length===0&&(d=b)}if(d.issues.length){t.mode==="loose"?n.value[u]=o[u]:n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(b=>Yt(b,r,Jt())),input:u,path:[u],inst:e});continue}const p=t.valueType._zod.run({value:o[u],issues:[]},r);p instanceof Promise?s.push(p.then(b=>{b.issues.length&&n.issues.push(...Un(u,b.issues)),n.value[d.value]=b.value})):(p.issues.length&&n.issues.push(...Un(u,p.issues)),n.value[d.value]=p.value)}}return s.length?Promise.all(s).then(()=>n):n}}),yd=v("$ZodEnum",(e,t)=>{he.init(e,t);const n=ks(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>zl.has(typeof o)).map(o=>typeof o=="string"?Dn(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),wd=v("$ZodLiteral",(e,t)=>{if(he.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"?Dn(r):r?Dn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),xd=v("$ZodTransform",(e,t)=>{he.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ms(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 Nn;return n.value=o,n}});function qs(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Hs=v("$ZodOptional",(e,t)=>{he.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Y(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Y(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${oi(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>qs(s,n.value)):qs(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Sd=v("$ZodExactOptional",(e,t)=>{Hs.init(e,t),Y(e._zod,"values",()=>t.innerType._zod.values),Y(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Td=v("$ZodNullable",(e,t)=>{he.init(e,t),Y(e._zod,"optin",()=>t.innerType._zod.optin),Y(e._zod,"optout",()=>t.innerType._zod.optout),Y(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${oi(n.source)}|null)$`):void 0}),Y(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Ed=v("$ZodDefault",(e,t)=>{he.init(e,t),e._zod.optin="optional",Y(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Fs(s,t)):Fs(o,t)}});function Fs(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Ad=v("$ZodPrefault",(e,t)=>{he.init(e,t),e._zod.optin="optional",Y(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Cd=v("$ZodNonOptional",(e,t)=>{he.init(e,t),Y(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Bs(s,e)):Bs(o,e)}});function Bs(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 Pd=v("$ZodCatch",(e,t)=>{he.init(e,t),Y(e._zod,"optin",()=>t.innerType._zod.optin),Y(e._zod,"optout",()=>t.innerType._zod.optout),Y(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(a=>Yt(a,r,Jt()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>Yt(s,r,Jt()))},input:n.value}),n.issues=[]),n)}}),Rd=v("$ZodPipe",(e,t)=>{he.init(e,t),Y(e._zod,"values",()=>t.in._zod.values),Y(e._zod,"optin",()=>t.in._zod.optin),Y(e._zod,"optout",()=>t.out._zod.optout),Y(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(a=>eo(a,t.in,r)):eo(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>eo(s,t.out,r)):eo(o,t.out,r)}});function eo(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Ld=v("$ZodReadonly",(e,t)=>{he.init(e,t),Y(e._zod,"propValues",()=>t.innerType._zod.propValues),Y(e._zod,"values",()=>t.innerType._zod.values),Y(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),Y(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Gs):Gs(o)}});function Gs(e){return e.value=Object.freeze(e.value),e}const zd=v("$ZodCustom",(e,t)=>{Ke.init(e,t),he.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>Ws(s,n,r,e));Ws(o,n,r,e)}});function Ws(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(pr(o))}}var Js;class Id{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function $d(){return new Id}(Js=globalThis).__zod_globalRegistry??(Js.__zod_globalRegistry=$d());const hr=globalThis.__zod_globalRegistry;function Nd(e,t){return new e({type:"string",...N(t)})}function Od(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...N(t)})}function Xs(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...N(t)})}function Dd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...N(t)})}function Md(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...N(t)})}function Ud(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...N(t)})}function jd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...N(t)})}function Zd(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...N(t)})}function qd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...N(t)})}function Hd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...N(t)})}function Fd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...N(t)})}function Bd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...N(t)})}function Gd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...N(t)})}function Wd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...N(t)})}function Jd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...N(t)})}function Xd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...N(t)})}function Vd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...N(t)})}function Yd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...N(t)})}function Kd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...N(t)})}function Qd(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...N(t)})}function ep(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...N(t)})}function tp(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...N(t)})}function np(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...N(t)})}function rp(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...N(t)})}function op(e,t){return new e({type:"string",format:"date",check:"string_format",...N(t)})}function ip(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...N(t)})}function sp(e,t){return new e({type:"string",format:"duration",check:"string_format",...N(t)})}function ap(e,t){return new e({type:"number",checks:[],...N(t)})}function cp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...N(t)})}function lp(e,t){return new e({type:"boolean",...N(t)})}function up(e){return new e({type:"any"})}function dp(e){return new e({type:"unknown"})}function pp(e,t){return new e({type:"never",...N(t)})}function Vs(e,t){return new zs({check:"less_than",...N(t),value:e,inclusive:!1})}function ui(e,t){return new zs({check:"less_than",...N(t),value:e,inclusive:!0})}function Ys(e,t){return new Is({check:"greater_than",...N(t),value:e,inclusive:!1})}function di(e,t){return new Is({check:"greater_than",...N(t),value:e,inclusive:!0})}function Ks(e,t){return new Tu({check:"multiple_of",...N(t),value:e})}function Qs(e,t){return new Au({check:"max_length",...N(t),maximum:e})}function to(e,t){return new Cu({check:"min_length",...N(t),minimum:e})}function ea(e,t){return new Pu({check:"length_equals",...N(t),length:e})}function hp(e,t){return new Ru({check:"string_format",format:"regex",...N(t),pattern:e})}function fp(e){return new Lu({check:"string_format",format:"lowercase",...N(e)})}function gp(e){return new zu({check:"string_format",format:"uppercase",...N(e)})}function mp(e,t){return new Iu({check:"string_format",format:"includes",...N(t),includes:e})}function bp(e,t){return new $u({check:"string_format",format:"starts_with",...N(t),prefix:e})}function kp(e,t){return new Nu({check:"string_format",format:"ends_with",...N(t),suffix:e})}function jn(e){return new Ou({check:"overwrite",tx:e})}function _p(e){return jn(t=>t.normalize(e))}function vp(){return jn(e=>e.trim())}function yp(){return jn(e=>e.toLowerCase())}function wp(){return jn(e=>e.toUpperCase())}function xp(){return jn(e=>Rl(e))}function Sp(e,t,n){return new e({type:"array",element:t,...N(n)})}function Tp(e,t,n){return new e({type:"custom",check:"custom",fn:t,...N(n)})}function Ep(e){const t=Ap(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(pr(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(pr(o))}},e(n.value,n)));return t}function Ap(e,t){const n=new Ke({check:"custom",...N(t)});return n._zod.check=e,n}function ta(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??hr,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function xe(e,t,n={path:[],schemaPath:[]}){var p,b;var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const u=(b=(p=e._zod).toJSONSchema)==null?void 0:b.call(p);if(u)a.schema=u;else{const m={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,m);else{const w=a.schema,C=t.processors[o.type];if(!C)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);C(e,t,w,m)}const _=e._zod.parent;_&&(a.ref||(a.ref=_),xe(_,t,m),t.seen.get(_).isParent=!0)}const d=t.metadataRegistry.get(e);return d&&Object.assign(a.schema,d),t.io==="input"&&He(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function na(e,t){var a,u,d,h;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 p of e.seen.entries()){const b=(a=e.metadataRegistry.get(p[0]))==null?void 0:a.id;if(b){const m=r.get(b);if(m&&m!==p[0])throw new Error(`Duplicate schema id "${b}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(b,p[0])}}const o=p=>{var C;const b=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const M=(C=e.external.registry.get(p[0]))==null?void 0:C.id,W=e.external.uri??(T=>T);if(M)return{ref:W(M)};const P=p[1].defId??p[1].schema.id??`schema${e.counter++}`;return p[1].defId=P,{defId:P,ref:`${W("__shared")}#/${b}/${P}`}}if(p[1]===n)return{ref:"#"};const _=`#/${b}/`,w=p[1].schema.id??`__schema${e.counter++}`;return{defId:w,ref:_+w}},s=p=>{if(p[1].schema.$ref)return;const b=p[1],{ref:m,defId:_}=o(p);b.def={...b.schema},_&&(b.defId=_);const w=b.schema;for(const C in w)delete w[C];w.$ref=m};if(e.cycles==="throw")for(const p of e.seen.entries()){const b=p[1];if(b.cycle)throw new Error(`Cycle detected: #/${(u=b.cycle)==null?void 0:u.join("/")}/<root>
|
|
1367
1384
|
|
|
1368
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const k=h[1];if(t===h[0]){s(h);continue}if(e.external){const _=(d=e.external.registry.get(h[0]))==null?void 0:d.id;if(t!==h[0]&&_){s(h);continue}}if((p=e.metadataRegistry.get(h[0]))==null?void 0:p.id){s(h);continue}if(k.cycle){s(h);continue}if(k.count>1&&e.reused==="ref"){s(h);continue}}}function ra(e,t){var a,u,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=p=>{const h=e.seen.get(p);if(h.ref===null)return;const k=h.def??h.schema,m={...k},_=h.ref;if(h.ref=null,_){r(_);const P=e.seen.get(_),N=P.schema;if(N.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=k.allOf??[],k.allOf.push(N)):Object.assign(k,N),Object.assign(k,m),p._zod.parent===_)for(const R in k)R==="$ref"||R==="allOf"||R in m||delete k[R];if(N.$ref)for(const R in k)R==="$ref"||R==="allOf"||R in P.def&&JSON.stringify(k[R])===JSON.stringify(P.def[R])&&delete k[R]}const w=p._zod.parent;if(w&&w!==_){r(w);const P=e.seen.get(w);if(P!=null&&P.schema.$ref&&(k.$ref=P.schema.$ref,P.def))for(const N in k)N==="$ref"||N==="allOf"||N in P.def&&JSON.stringify(k[N])===JSON.stringify(P.def[N])&&delete k[N]}e.override({zodSchema:p,jsonSchema:k,path:h.path??[]})};for(const p of[...e.seen.entries()].reverse())r(p[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const p=(u=e.external.registry.get(t))==null?void 0:u.id;if(!p)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(p)}Object.assign(o,n.def??n.schema);const s=((d=e.external)==null?void 0:d.defs)??{};for(const p of e.seen.entries()){const h=p[1];h.def&&h.defId&&(s[h.defId]=h.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const p=JSON.parse(JSON.stringify(o));return Object.defineProperty(p,"~standard",{value:{...t["~standard"],jsonSchema:{input:eo(t,"input",e.processors),output:eo(t,"output",e.processors)}},enumerable:!1,writable:!1}),p}catch{throw new Error("Error converting schema to JSON.")}}function je(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return 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 Cp=(e,t={})=>n=>{const r=ta({...n,processors:t});return Se(e,r),na(r,e),ra(r,e)},eo=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},a=ta({...o??{},target:s,io:t,processors:n});return Se(e,a),na(a,e),ra(a,e)},Pp={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Rp=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:a,format:u,patterns:d,contentEncoding:p}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof a=="number"&&(o.maxLength=a),u&&(o.format=Pp[u]??u,o.format===""&&delete o.format,u==="time"&&delete o.format),p&&(o.contentEncoding=p),d&&d.size>0){const h=[...d];h.length===1?o.pattern=h[0].source:h.length>1&&(o.allOf=[...h.map(k=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:k.source}))])}},Lp=(e,t,n,r)=>{const o=n,{minimum:s,maximum:a,format:u,multipleOf:d,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof u=="string"&&u.includes("int")?o.type="integer":o.type="number",typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=h,o.exclusiveMinimum=!0):o.exclusiveMinimum=h),typeof s=="number"&&(o.minimum=s,typeof h=="number"&&t.target!=="draft-04"&&(h>=s?delete o.minimum:delete o.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p),typeof a=="number"&&(o.maximum=a,typeof p=="number"&&t.target!=="draft-04"&&(p<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof d=="number"&&(o.multipleOf=d)},zp=(e,t,n,r)=>{n.type="boolean"},Ip=(e,t,n,r)=>{n.not={}},$p=(e,t,n,r)=>{},Np=(e,t,n,r)=>{},Op=(e,t,n,r)=>{const o=e._zod.def,s=ks(o.entries);s.every(a=>typeof a=="number")&&(n.type="number"),s.every(a=>typeof a=="string")&&(n.type="string"),n.enum=s},Dp=(e,t,n,r)=>{const o=e._zod.def,s=[];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");s.push(Number(a))}else s.push(a);if(s.length!==0)if(s.length===1){const a=s[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else s.every(a=>typeof a=="number")&&(n.type="number"),s.every(a=>typeof a=="string")&&(n.type="string"),s.every(a=>typeof a=="boolean")&&(n.type="boolean"),s.every(a=>a===null)&&(n.type="null"),n.enum=s},Mp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Up=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},jp=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:a,maximum:u}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof u=="number"&&(o.maxItems=u),o.type="array",o.items=Se(s.element,t,{...r,path:[...r.path,"items"]})},Zp=(e,t,n,r)=>{var p;const o=n,s=e._zod.def;o.type="object",o.properties={};const a=s.shape;for(const h in a)o.properties[h]=Se(a[h],t,{...r,path:[...r.path,"properties",h]});const u=new Set(Object.keys(a)),d=new Set([...u].filter(h=>{const k=s.shape[h]._zod;return t.io==="input"?k.optin===void 0:k.optout===void 0}));d.size>0&&(o.required=Array.from(d)),((p=s.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=Se(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},qp=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,a=o.options.map((u,d)=>Se(u,t,{...r,path:[...r.path,s?"oneOf":"anyOf",d]}));s?n.oneOf=a:n.anyOf=a},Hp=(e,t,n,r)=>{const o=e._zod.def,s=Se(o.left,t,{...r,path:[...r.path,"allOf",0]}),a=Se(o.right,t,{...r,path:[...r.path,"allOf",1]}),u=p=>"allOf"in p&&Object.keys(p).length===1,d=[...u(s)?s.allOf:[s],...u(a)?a.allOf:[a]];n.allOf=d},Fp=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const a=s.keyType,u=a._zod.bag,d=u==null?void 0:u.patterns;if(s.mode==="loose"&&d&&d.size>0){const h=Se(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const k of d)o.patternProperties[k.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Se(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Se(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const p=a._zod.values;if(p){const h=[...p].filter(k=>typeof k=="string"||typeof k=="number");h.length>0&&(o.required=h)}},Bp=(e,t,n,r)=>{const o=e._zod.def,s=Se(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},Gp=(e,t,n,r)=>{const o=e._zod.def;Se(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Wp=(e,t,n,r)=>{const o=e._zod.def;Se(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Jp=(e,t,n,r)=>{const o=e._zod.def;Se(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Xp=(e,t,n,r)=>{const o=e._zod.def;Se(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},Vp=(e,t,n,r)=>{const o=e._zod.def,s=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Se(s,t,r);const a=t.seen.get(e);a.ref=s},Yp=(e,t,n,r)=>{const o=e._zod.def;Se(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},oa=(e,t,n,r)=>{const o=e._zod.def;Se(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Kp=v("ZodISODateTime",(e,t)=>{Vu.init(e,t),ge.init(e,t)});function Qp(e){return rp(Kp,e)}const eh=v("ZodISODate",(e,t)=>{Yu.init(e,t),ge.init(e,t)});function th(e){return op(eh,e)}const nh=v("ZodISOTime",(e,t)=>{Ku.init(e,t),ge.init(e,t)});function rh(e){return ip(nh,e)}const oh=v("ZodISODuration",(e,t)=>{Qu.init(e,t),ge.init(e,t)});function ih(e){return sp(oh,e)}const it=v("ZodError",(e,t)=>{Ss.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Hl(e,n)},flatten:{value:n=>ql(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ei,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ei,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),sh=oi(it),ah=ii(it),ch=Jr(it),lh=Xr(it),uh=Gl(it),dh=Wl(it),ph=Jl(it),hh=Xl(it),fh=Vl(it),gh=Yl(it),mh=Kl(it),bh=Ql(it),pe=v("ZodType",(e,t)=>(ue.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:eo(e,"input"),output:eo(e,"output")}}),e.toJSONSchema=Cp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Wt(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>Jt(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>sh(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>ch(e,n,r),e.parseAsync=async(n,r)=>ah(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>lh(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>uh(e,n,r),e.decode=(n,r)=>dh(e,n,r),e.encodeAsync=async(n,r)=>ph(e,n,r),e.decodeAsync=async(n,r)=>hh(e,n,r),e.safeEncode=(n,r)=>fh(e,n,r),e.safeDecode=(n,r)=>gh(e,n,r),e.safeEncodeAsync=async(n,r)=>mh(e,n,r),e.safeDecodeAsync=async(n,r)=>bh(e,n,r),e.refine=(n,r)=>e.check(hf(n,r)),e.superRefine=n=>e.check(ff(n)),e.overwrite=n=>e.check(Mn(n)),e.optional=()=>fa(e),e.exactOptional=()=>Qh(e),e.nullable=()=>ga(e),e.nullish=()=>fa(ga(e)),e.nonoptional=n=>sf(e,n),e.array=()=>St(e),e.or=n=>Fh([e,n]),e.and=n=>Wh(e,n),e.transform=n=>ba(e,Yh(n)),e.default=n=>nf(e,n),e.prefault=n=>of(e,n),e.catch=n=>cf(e,n),e.pipe=n=>ba(e,n),e.readonly=()=>df(e),e.describe=n=>{const r=e.clone();return dr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=dr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return dr.get(e);const r=e.clone();return dr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),ia=v("_ZodString",(e,t)=>{si.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Rp(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(hp(...r)),e.includes=(...r)=>e.check(mp(...r)),e.startsWith=(...r)=>e.check(bp(...r)),e.endsWith=(...r)=>e.check(kp(...r)),e.min=(...r)=>e.check(Qr(...r)),e.max=(...r)=>e.check(Qs(...r)),e.length=(...r)=>e.check(ea(...r)),e.nonempty=(...r)=>e.check(Qr(1,...r)),e.lowercase=r=>e.check(fp(r)),e.uppercase=r=>e.check(gp(r)),e.trim=()=>e.check(vp()),e.normalize=(...r)=>e.check(_p(...r)),e.toLowerCase=()=>e.check(yp()),e.toUpperCase=()=>e.check(wp()),e.slugify=()=>e.check(xp())}),kh=v("ZodString",(e,t)=>{si.init(e,t),ia.init(e,t),e.email=n=>e.check(Od(_h,n)),e.url=n=>e.check(Zd(vh,n)),e.jwt=n=>e.check(np(Nh,n)),e.emoji=n=>e.check(qd(yh,n)),e.guid=n=>e.check(Xs(sa,n)),e.uuid=n=>e.check(Dd(to,n)),e.uuidv4=n=>e.check(Md(to,n)),e.uuidv6=n=>e.check(Ud(to,n)),e.uuidv7=n=>e.check(jd(to,n)),e.nanoid=n=>e.check(Hd(wh,n)),e.guid=n=>e.check(Xs(sa,n)),e.cuid=n=>e.check(Fd(xh,n)),e.cuid2=n=>e.check(Bd(Sh,n)),e.ulid=n=>e.check(Gd(Th,n)),e.base64=n=>e.check(Qd(zh,n)),e.base64url=n=>e.check(ep(Ih,n)),e.xid=n=>e.check(Wd(Eh,n)),e.ksuid=n=>e.check(Jd(Ah,n)),e.ipv4=n=>e.check(Xd(Ch,n)),e.ipv6=n=>e.check(Vd(Ph,n)),e.cidrv4=n=>e.check(Yd(Rh,n)),e.cidrv6=n=>e.check(Kd(Lh,n)),e.e164=n=>e.check(tp($h,n)),e.datetime=n=>e.check(Qp(n)),e.date=n=>e.check(th(n)),e.time=n=>e.check(rh(n)),e.duration=n=>e.check(ih(n))});function A(e){return Nd(kh,e)}const ge=v("ZodStringFormat",(e,t)=>{de.init(e,t),ia.init(e,t)}),_h=v("ZodEmail",(e,t)=>{Zu.init(e,t),ge.init(e,t)}),sa=v("ZodGUID",(e,t)=>{Uu.init(e,t),ge.init(e,t)}),to=v("ZodUUID",(e,t)=>{ju.init(e,t),ge.init(e,t)}),vh=v("ZodURL",(e,t)=>{qu.init(e,t),ge.init(e,t)}),yh=v("ZodEmoji",(e,t)=>{Hu.init(e,t),ge.init(e,t)}),wh=v("ZodNanoID",(e,t)=>{Fu.init(e,t),ge.init(e,t)}),xh=v("ZodCUID",(e,t)=>{Bu.init(e,t),ge.init(e,t)}),Sh=v("ZodCUID2",(e,t)=>{Gu.init(e,t),ge.init(e,t)}),Th=v("ZodULID",(e,t)=>{Wu.init(e,t),ge.init(e,t)}),Eh=v("ZodXID",(e,t)=>{Ju.init(e,t),ge.init(e,t)}),Ah=v("ZodKSUID",(e,t)=>{Xu.init(e,t),ge.init(e,t)}),Ch=v("ZodIPv4",(e,t)=>{ed.init(e,t),ge.init(e,t)}),Ph=v("ZodIPv6",(e,t)=>{td.init(e,t),ge.init(e,t)}),Rh=v("ZodCIDRv4",(e,t)=>{nd.init(e,t),ge.init(e,t)}),Lh=v("ZodCIDRv6",(e,t)=>{rd.init(e,t),ge.init(e,t)}),zh=v("ZodBase64",(e,t)=>{od.init(e,t),ge.init(e,t)}),Ih=v("ZodBase64URL",(e,t)=>{sd.init(e,t),ge.init(e,t)}),$h=v("ZodE164",(e,t)=>{ad.init(e,t),ge.init(e,t)}),Nh=v("ZodJWT",(e,t)=>{ld.init(e,t),ge.init(e,t)}),aa=v("ZodNumber",(e,t)=>{Ns.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Lp(e,r,o),e.gt=(r,o)=>e.check(Ys(r,o)),e.gte=(r,o)=>e.check(li(r,o)),e.min=(r,o)=>e.check(li(r,o)),e.lt=(r,o)=>e.check(Vs(r,o)),e.lte=(r,o)=>e.check(ci(r,o)),e.max=(r,o)=>e.check(ci(r,o)),e.int=r=>e.check(ca(r)),e.safe=r=>e.check(ca(r)),e.positive=r=>e.check(Ys(0,r)),e.nonnegative=r=>e.check(li(0,r)),e.negative=r=>e.check(Vs(0,r)),e.nonpositive=r=>e.check(ci(0,r)),e.multipleOf=(r,o)=>e.check(Ks(r,o)),e.step=(r,o)=>e.check(Ks(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function xt(e){return ap(aa,e)}const Oh=v("ZodNumberFormat",(e,t)=>{ud.init(e,t),aa.init(e,t)});function ca(e){return cp(Oh,e)}const Dh=v("ZodBoolean",(e,t)=>{dd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zp(e,n,r)});function he(e){return lp(Dh,e)}const Mh=v("ZodAny",(e,t)=>{pd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$p()});function la(){return up(Mh)}const Uh=v("ZodUnknown",(e,t)=>{hd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Np()});function ua(){return dp(Uh)}const jh=v("ZodNever",(e,t)=>{fd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ip(e,n,r)});function Zh(e){return pp(jh,e)}const qh=v("ZodArray",(e,t)=>{gd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jp(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(Qr(n,r)),e.nonempty=n=>e.check(Qr(1,n)),e.max=(n,r)=>e.check(Qs(n,r)),e.length=(n,r)=>e.check(ea(n,r)),e.unwrap=()=>e.element});function St(e,t){return Sp(qh,e,t)}const Hh=v("ZodObject",(e,t)=>{bd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zp(e,n,r,o),V(e,"shape",()=>t.shape),e.keyof=()=>st(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ua()}),e.loose=()=>e.clone({...e._zod.def,catchall:ua()}),e.strict=()=>e.clone({...e._zod.def,catchall:Zh()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Dl(e,n),e.safeExtend=n=>Ml(e,n),e.merge=n=>Ul(e,n),e.pick=n=>Nl(e,n),e.omit=n=>Ol(e,n),e.partial=(...n)=>jl(ha,e,n[0]),e.required=(...n)=>Zl(ma,e,n[0])});function le(e,t){const n={type:"object",shape:e??{},...O(t)};return new Hh(n)}const da=v("ZodUnion",(e,t)=>{js.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qp(e,n,r,o),e.options=t.options});function Fh(e,t){return new da({type:"union",options:e,...O(t)})}const Bh=v("ZodDiscriminatedUnion",(e,t)=>{da.init(e,t),kd.init(e,t)});function pa(e,t,n){return new Bh({type:"union",options:t,discriminator:e,...O(n)})}const Gh=v("ZodIntersection",(e,t)=>{_d.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hp(e,n,r,o)});function Wh(e,t){return new Gh({type:"intersection",left:e,right:t})}const Jh=v("ZodRecord",(e,t)=>{vd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fp(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Tt(e,t,n){return new Jh({type:"record",keyType:e,valueType:t,...O(n)})}const ui=v("ZodEnum",(e,t)=>{yd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Op(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const a of r)if(n.has(a))s[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ui({...t,checks:[],...O(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const a of r)if(n.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new ui({...t,checks:[],...O(o),entries:s})}});function st(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ui({type:"enum",entries:n,...O(t)})}const Xh=v("ZodLiteral",(e,t)=>{wd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Dp(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 at(e,t){return new Xh({type:"literal",values:Array.isArray(e)?e:[e],...O(t)})}const Vh=v("ZodTransform",(e,t)=>{xd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Up(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ms(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(ur(s,n.value,t));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),n.issues.push(ur(a))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function Yh(e){return new Vh({type:"transform",transform:e})}const ha=v("ZodOptional",(e,t)=>{Hs.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>oa(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function fa(e){return new ha({type:"optional",innerType:e})}const Kh=v("ZodExactOptional",(e,t)=>{Sd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>oa(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Qh(e){return new Kh({type:"optional",innerType:e})}const ef=v("ZodNullable",(e,t)=>{Td.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ga(e){return new ef({type:"nullable",innerType:e})}const tf=v("ZodDefault",(e,t)=>{Ed.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function nf(e,t){return new tf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ws(t)}})}const rf=v("ZodPrefault",(e,t)=>{Ad.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function of(e,t){return new rf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ws(t)}})}const ma=v("ZodNonOptional",(e,t)=>{Cd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function sf(e,t){return new ma({type:"nonoptional",innerType:e,...O(t)})}const af=v("ZodCatch",(e,t)=>{Pd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function cf(e,t){return new af({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const lf=v("ZodPipe",(e,t)=>{Rd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vp(e,n,r,o),e.in=t.in,e.out=t.out});function ba(e,t){return new lf({type:"pipe",in:e,out:t})}const uf=v("ZodReadonly",(e,t)=>{Ld.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function df(e){return new uf({type:"readonly",innerType:e})}const pf=v("ZodCustom",(e,t)=>{zd.init(e,t),pe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mp(e,n)});function hf(e,t={}){return Tp(pf,e,t)}function ff(e){return Ep(e)}const gf=le({name:A().min(1).max(100).optional(),command:A().min(1).max(500),args:St(A()).optional(),failOnError:he().default(!0).optional(),timeout:xt().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:A().optional(),env:Tt(A(),A()).optional(),runOnBackground:he().optional()});le({name:A(),command:A(),success:he(),exitCode:xt().optional(),stdout:A().optional(),stderr:A().optional(),error:A().optional(),duration:xt(),failOnError:he()});const cn=le({path:A(),extraCommands:St(gf).optional(),id:A().uuid().optional(),rotationKey:A().optional(),usageStatus:st(["free","in_use"]).optional()}),mf=pa("operation",[cn.extend({operation:at("create"),content:A().optional(),contentPath:A().optional(),encoding:st(["utf-8","base64"]).optional()}),cn.extend({operation:at("merge"),data:Tt(A(),la()),mergeStrategy:st(["deep","shallow"]).optional(),arrayMergeStrategy:st(["concat","replace"]).optional()}),cn.extend({operation:at("modify"),content:A().optional(),contentPath:A().optional(),createIfMissing:he().optional()}),cn.extend({operation:at("delete"),ignoreIfMissing:he().optional()}),cn.extend({operation:at("createDirectory"),contentPath:A().optional(),mode:xt().optional(),ignoreIfExists:he().optional()}),cn.extend({operation:at("download"),url:A().url(),headers:Tt(A(),A()).optional(),timeout:xt().min(1e3).max(3e5).optional()}),cn.extend({operation:at("gitClone"),gitUrl:A(),gitSecretKey:A().optional(),sourceBranch:A().optional(),targetBranch:A().optional()})]);var we=(e=>(e.PENDING="pending",e.ASSIGNED="assigned",e.IN_PROGRESS="in_progress",e.WAITING_FOR_INPUT="waiting_for_input",e.WAITING_FOR_PLAN_APPROVAL="waiting_for_plan_approval",e.PLAN_APPROVED="plan_approved",e.PLAN_REJECTED="plan_rejected",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.RESULT_REJECTED="result_rejected",e))(we||{});const bf=le({type:st(["json","file","regex"]).describe("Extraction method"),source:A().describe("Source to extract from (file path or stdout/stderr)"),schema:le({}).passthrough().optional().describe("JSON schema for validation"),pattern:A().optional().describe("Regex pattern for extraction")}),kf=le({type:st(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:la().describe("Hook-specific configuration")});le({command:A().optional().describe("Legacy — unused in SDK mode"),args:St(A()).optional().describe("Legacy — unused in SDK mode"),env:Tt(A(),A()).optional().describe("Environment variables"),workingDirectory:A().optional().describe("Working directory for command execution"),fileOperations:St(mf).optional().describe("File operations to perform during setup"),gitUrl:A().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:A().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:A().optional().describe("Commit message for git operations"),resultExtraction:bf.optional().describe("Schema for extracting result data"),postExecutionHooks:St(kf).optional().describe("Hooks to run after task completion"),executionMode:st(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:pa("executionMode",[le({executionMode:at("claudeAgentSdk"),promptText:A(),sdkOptions:le({model:A(),permissionMode:st(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:St(A()),allowDangerouslySkipPermissions:he(),persistSession:he(),streamSdkEvents:he().optional(),allowedTools:St(A()).optional(),settings:le({enabledPlugins:Tt(A(),he())}),env:Tt(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:he()}).optional()}),le({executionMode:at("opencodeSdk"),promptText:A(),sdkOptions:le({provider:A(),model:A(),env:Tt(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:he()}).optional()}),le({executionMode:at("openaiAgentSdk"),promptText:A(),sdkOptions:le({model:A(),env:Tt(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:he()}).optional()}),le({executionMode:at("codexSdk"),promptText:A(),sdkOptions:le({model:A().optional(),sandboxMode:st(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:st(["never","on-request","on-failure","untrusted"]).optional(),env:Tt(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:he()}).optional()}),le({executionMode:at("cursorSdk"),promptText:A(),sdkOptions:le({model:A(),env:Tt(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:he()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:he().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:A().optional().describe("Final approved plan content"),planApproved:he().optional().describe("Plan approval status"),planApprovedAt:A().optional().describe("ISO timestamp of approval"),planRejected:he().optional().describe("Plan rejection flag"),planRejectionFeedback:A().optional().describe("User rejection feedback"),rejectedPlanContent:A().optional().describe("Previously rejected plan content"),planCompletedAt:A().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:A().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:A().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:A().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:St(le({feedback:A(),rejectedAt:A()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:xt().optional(),notificationChannelPlanMessageSentAt:A().optional(),notificationChannelCompletedMessageId:xt().optional(),notificationChannelFailedMessageId:xt().optional(),streamSdkEvents:he().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:A().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:he().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:St(le({id:A(),selectedText:A(),startOffset:xt(),endOffset:xt(),commentText:A(),createdAt:A()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:he().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:he().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:st(["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:he().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")}),we.PENDING+"",we.CANCELLED,we.ASSIGNED+"",we.CANCELLED,we.IN_PROGRESS+"",we.CANCELLED,we.FAILED,we.WAITING_FOR_INPUT+"",we.CANCELLED,we.WAITING_FOR_PLAN_APPROVAL+"",we.CANCELLED,we.PLAN_APPROVED+"",we.CANCELLED,we.PLAN_REJECTED+"",we.CANCELLED,we.COMPLETED+"",we.RESULT_REJECTED+"",we.CANCELLED,we.FAILED+"",we.CANCELLED+"";const ka="browser_capture",_f="browser_automate";async function Oe(e,t,n,r){const s=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=await fetch(s,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});if(!a.ok){const u=await a.json().catch(()=>({message:`HTTP ${a.status}`}));throw new Error(u.message||u.error||`HTTP ${a.status}`)}return a.json()}async function _a(e,t){return Oe(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)}async function di(e,t,n,r,o,s,a=ka,u){var d,p,h,k,m,_;return Oe(e,"POST","/tasks",{type:a,title:s||n.slice(0,120)||r.pageTitle||"Browser capture",titleInstruction:u??n,projectId:t,autoAssign:!0,...o!=null&&o.claudeTemplateId?{claudeTemplateId:o.claudeTemplateId}:{},...(o==null?void 0:o.quickMode)!==void 0?{quickMode:o.quickMode}:{},...(o==null?void 0:o.modelOverride)!=null?{modelOverride:o.modelOverride}:{},...(o==null?void 0:o.claudeProfileId)!=null?{claudeProfileId:o.claudeProfileId}:{},...(o==null?void 0:o.effort)!=null?{effort:o.effort}:{},...(o==null?void 0:o.executionMode)!=null?{executionMode:o.executionMode}:{},...(d=o==null?void 0:o.selectedPluginIds)!=null&&d.length?{selectedPluginIds:o.selectedPluginIds}:{},...(p=o==null?void 0:o.selectedSkillIds)!=null&&p.length?{selectedSkillIds:o.selectedSkillIds}:{},...(h=o==null?void 0:o.selectedPluginSkillIds)!=null&&h.length?{selectedPluginSkillIds:o.selectedPluginSkillIds}:{},...(k=o==null?void 0:o.selectedMcpServerIds)!=null&&k.length?{selectedMcpServerIds:o.selectedMcpServerIds}:{},...(m=o==null?void 0:o.selectedSlashCommandIds)!=null&&m.length?{selectedSlashCommandIds:o.selectedSlashCommandIds}:{},...(_=o==null?void 0:o.selectedRemoteContextProviderIds)!=null&&_.length?{selectedRemoteContextProviderIds:o.selectedRemoteContextProviderIds}:{},metadata:{type:a,note:n,source:"web-sdk",pageUrl:r.pageUrl,pageTitle:r.pageTitle,elementText:r.elementText,cssSelector:r.cssSelector,elementOuterHtml:r.elementOuterHtml,ancestry:r.ancestry,elementRole:r.elementRole,elementAriaLabel:r.elementAriaLabel,enclosingSection:r.enclosingSection,description:r.description,canonicalUrl:r.canonicalUrl,lang:r.lang,ogTitle:r.ogTitle,ogDescription:r.ogDescription,ogType:r.ogType,ogSiteName:r.ogSiteName,viewportWidth:r.viewportWidth,viewportHeight:r.viewportHeight,scrollX:r.scrollX,scrollY:r.scrollY,selectionText:r.selectionText,capturedAt:r.capturedAt,interactionSteps:r.interactionSteps}})}async function va(e,t,n,r,o,s,a){return di(e,t,n,r,o,s,_f,a)}async function ya(e,t,n,r){return Oe(e,"POST","/planning-sessions",{projectId:t,instruction:n,quickMode:(r==null?void 0:r.quickMode)??!1,...r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}})}async function vf(e,t){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Oe(e,"GET",`/claude-templates${n}`)}async function wa(e,t){return Oe(e,"GET",`/tasks/${t}`)}async function yf(e,t){return Oe(e,"GET",`/planning-sessions/${t}`)}async function wf(e){return Oe(e,"GET","/projects")}async function xf(e,t){return Oe(e,"GET",`/tasks/${t}/browser-commands/pending`)}async function Sf(e,t,n,r,o){return Oe(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})}async function Tf(e,t){return Oe(e,"GET",`/tasks/${t}/chunks`)}async function Ef(e,t,n){return Oe(e,"POST",`/tasks/${t}/instructions`,{content:n})}async function Af(e,t){return Oe(e,"POST",`/tasks/${t}/cancel`)}async function Cf(e,t){return Oe(e,"POST",`/tasks/${t}/approve-result`)}async function Pf(e,t,n){return Oe(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})}async function no(e,t){return Oe(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)}async function xa(e,t,n,r){return Oe(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})}const Sa=/^cc-|current-password|new-password/i,Rf=/token|secret|password|apikey|auth/i,pi="[redacted]";function Lf(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&Sa.test(t)}function zf(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",pi);const r=n.getAttribute("autocomplete");r&&Sa.test(r)&&n.setAttribute("value",pi);for(const o of Array.from(n.attributes))Rf.test(o.name)&&n.setAttribute(o.name,pi)}}function If(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ta={exports:{}};/*!
|
|
1385
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const p of e.seen.entries()){const b=p[1];if(t===p[0]){s(p);continue}if(e.external){const _=(d=e.external.registry.get(p[0]))==null?void 0:d.id;if(t!==p[0]&&_){s(p);continue}}if((h=e.metadataRegistry.get(p[0]))==null?void 0:h.id){s(p);continue}if(b.cycle){s(p);continue}if(b.count>1&&e.reused==="ref"){s(p);continue}}}function ra(e,t){var a,u,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=h=>{const p=e.seen.get(h);if(p.ref===null)return;const b=p.def??p.schema,m={...b},_=p.ref;if(p.ref=null,_){r(_);const C=e.seen.get(_),M=C.schema;if(M.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(b.allOf=b.allOf??[],b.allOf.push(M)):Object.assign(b,M),Object.assign(b,m),h._zod.parent===_)for(const P in b)P==="$ref"||P==="allOf"||P in m||delete b[P];if(M.$ref)for(const P in b)P==="$ref"||P==="allOf"||P in C.def&&JSON.stringify(b[P])===JSON.stringify(C.def[P])&&delete b[P]}const w=h._zod.parent;if(w&&w!==_){r(w);const C=e.seen.get(w);if(C!=null&&C.schema.$ref&&(b.$ref=C.schema.$ref,C.def))for(const M in b)M==="$ref"||M==="allOf"||M in C.def&&JSON.stringify(b[M])===JSON.stringify(C.def[M])&&delete b[M]}e.override({zodSchema:h,jsonSchema:b,path:p.path??[]})};for(const h of[...e.seen.entries()].reverse())r(h[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 h=(u=e.external.registry.get(t))==null?void 0:u.id;if(!h)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(h)}Object.assign(o,n.def??n.schema);const s=((d=e.external)==null?void 0:d.defs)??{};for(const h of e.seen.entries()){const p=h[1];p.def&&p.defId&&(s[p.defId]=p.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const h=JSON.parse(JSON.stringify(o));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input:no(t,"input",e.processors),output:no(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function He(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return He(r.element,n);if(r.type==="set")return He(r.valueType,n);if(r.type==="lazy")return He(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 He(r.innerType,n);if(r.type==="intersection")return He(r.left,n)||He(r.right,n);if(r.type==="record"||r.type==="map")return He(r.keyType,n)||He(r.valueType,n);if(r.type==="pipe")return He(r.in,n)||He(r.out,n);if(r.type==="object"){for(const o in r.shape)if(He(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(He(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(He(o,n))return!0;return!!(r.rest&&He(r.rest,n))}return!1}const Cp=(e,t={})=>n=>{const r=ta({...n,processors:t});return xe(e,r),na(r,e),ra(r,e)},no=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},a=ta({...o??{},target:s,io:t,processors:n});return xe(e,a),na(a,e),ra(a,e)},Pp={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Rp=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:a,format:u,patterns:d,contentEncoding:h}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof a=="number"&&(o.maxLength=a),u&&(o.format=Pp[u]??u,o.format===""&&delete o.format,u==="time"&&delete o.format),h&&(o.contentEncoding=h),d&&d.size>0){const p=[...d];p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(b=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:b.source}))])}},Lp=(e,t,n,r)=>{const o=n,{minimum:s,maximum:a,format:u,multipleOf:d,exclusiveMaximum:h,exclusiveMinimum:p}=e._zod.bag;typeof u=="string"&&u.includes("int")?o.type="integer":o.type="number",typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=p,o.exclusiveMinimum=!0):o.exclusiveMinimum=p),typeof s=="number"&&(o.minimum=s,typeof p=="number"&&t.target!=="draft-04"&&(p>=s?delete o.minimum:delete o.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=h,o.exclusiveMaximum=!0):o.exclusiveMaximum=h),typeof a=="number"&&(o.maximum=a,typeof h=="number"&&t.target!=="draft-04"&&(h<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof d=="number"&&(o.multipleOf=d)},zp=(e,t,n,r)=>{n.type="boolean"},Ip=(e,t,n,r)=>{n.not={}},$p=(e,t,n,r)=>{},Np=(e,t,n,r)=>{},Op=(e,t,n,r)=>{const o=e._zod.def,s=ks(o.entries);s.every(a=>typeof a=="number")&&(n.type="number"),s.every(a=>typeof a=="string")&&(n.type="string"),n.enum=s},Dp=(e,t,n,r)=>{const o=e._zod.def,s=[];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");s.push(Number(a))}else s.push(a);if(s.length!==0)if(s.length===1){const a=s[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else s.every(a=>typeof a=="number")&&(n.type="number"),s.every(a=>typeof a=="string")&&(n.type="string"),s.every(a=>typeof a=="boolean")&&(n.type="boolean"),s.every(a=>a===null)&&(n.type="null"),n.enum=s},Mp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Up=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},jp=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:a,maximum:u}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof u=="number"&&(o.maxItems=u),o.type="array",o.items=xe(s.element,t,{...r,path:[...r.path,"items"]})},Zp=(e,t,n,r)=>{var h;const o=n,s=e._zod.def;o.type="object",o.properties={};const a=s.shape;for(const p in a)o.properties[p]=xe(a[p],t,{...r,path:[...r.path,"properties",p]});const u=new Set(Object.keys(a)),d=new Set([...u].filter(p=>{const b=s.shape[p]._zod;return t.io==="input"?b.optin===void 0:b.optout===void 0}));d.size>0&&(o.required=Array.from(d)),((h=s.catchall)==null?void 0:h._zod.def.type)==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=xe(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},qp=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,a=o.options.map((u,d)=>xe(u,t,{...r,path:[...r.path,s?"oneOf":"anyOf",d]}));s?n.oneOf=a:n.anyOf=a},Hp=(e,t,n,r)=>{const o=e._zod.def,s=xe(o.left,t,{...r,path:[...r.path,"allOf",0]}),a=xe(o.right,t,{...r,path:[...r.path,"allOf",1]}),u=h=>"allOf"in h&&Object.keys(h).length===1,d=[...u(s)?s.allOf:[s],...u(a)?a.allOf:[a]];n.allOf=d},Fp=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const a=s.keyType,u=a._zod.bag,d=u==null?void 0:u.patterns;if(s.mode==="loose"&&d&&d.size>0){const p=xe(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const b of d)o.patternProperties[b.source]=p}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=xe(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=xe(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const h=a._zod.values;if(h){const p=[...h].filter(b=>typeof b=="string"||typeof b=="number");p.length>0&&(o.required=p)}},Bp=(e,t,n,r)=>{const o=e._zod.def,s=xe(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},Gp=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Wp=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Jp=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Xp=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},Vp=(e,t,n,r)=>{const o=e._zod.def,s=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;xe(s,t,r);const a=t.seen.get(e);a.ref=s},Yp=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},oa=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Kp=v("ZodISODateTime",(e,t)=>{Vu.init(e,t),ke.init(e,t)});function Qp(e){return rp(Kp,e)}const eh=v("ZodISODate",(e,t)=>{Yu.init(e,t),ke.init(e,t)});function th(e){return op(eh,e)}const nh=v("ZodISOTime",(e,t)=>{Ku.init(e,t),ke.init(e,t)});function rh(e){return ip(nh,e)}const oh=v("ZodISODuration",(e,t)=>{Qu.init(e,t),ke.init(e,t)});function ih(e){return sp(oh,e)}const ot=v("ZodError",(e,t)=>{Ss.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Hl(e,n)},flatten:{value:n=>ql(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ni,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ni,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),sh=si(ot),ah=ai(ot),ch=Vr(ot),lh=Yr(ot),uh=Gl(ot),dh=Wl(ot),ph=Jl(ot),hh=Xl(ot),fh=Vl(ot),gh=Yl(ot),mh=Kl(ot),bh=Ql(ot),ge=v("ZodType",(e,t)=>(he.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:no(e,"input"),output:no(e,"output")}}),e.toJSONSchema=Cp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Xt(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>Vt(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>sh(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>ch(e,n,r),e.parseAsync=async(n,r)=>ah(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>lh(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>uh(e,n,r),e.decode=(n,r)=>dh(e,n,r),e.encodeAsync=async(n,r)=>ph(e,n,r),e.decodeAsync=async(n,r)=>hh(e,n,r),e.safeEncode=(n,r)=>fh(e,n,r),e.safeDecode=(n,r)=>gh(e,n,r),e.safeEncodeAsync=async(n,r)=>mh(e,n,r),e.safeDecodeAsync=async(n,r)=>bh(e,n,r),e.refine=(n,r)=>e.check(hf(n,r)),e.superRefine=n=>e.check(ff(n)),e.overwrite=n=>e.check(jn(n)),e.optional=()=>fa(e),e.exactOptional=()=>Qh(e),e.nullable=()=>ga(e),e.nullish=()=>fa(ga(e)),e.nonoptional=n=>sf(e,n),e.array=()=>Tt(e),e.or=n=>Fh([e,n]),e.and=n=>Wh(e,n),e.transform=n=>ba(e,Yh(n)),e.default=n=>nf(e,n),e.prefault=n=>of(e,n),e.catch=n=>cf(e,n),e.pipe=n=>ba(e,n),e.readonly=()=>df(e),e.describe=n=>{const r=e.clone();return hr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=hr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return hr.get(e);const r=e.clone();return hr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),ia=v("_ZodString",(e,t)=>{ci.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Rp(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(hp(...r)),e.includes=(...r)=>e.check(mp(...r)),e.startsWith=(...r)=>e.check(bp(...r)),e.endsWith=(...r)=>e.check(kp(...r)),e.min=(...r)=>e.check(to(...r)),e.max=(...r)=>e.check(Qs(...r)),e.length=(...r)=>e.check(ea(...r)),e.nonempty=(...r)=>e.check(to(1,...r)),e.lowercase=r=>e.check(fp(r)),e.uppercase=r=>e.check(gp(r)),e.trim=()=>e.check(vp()),e.normalize=(...r)=>e.check(_p(...r)),e.toLowerCase=()=>e.check(yp()),e.toUpperCase=()=>e.check(wp()),e.slugify=()=>e.check(xp())}),kh=v("ZodString",(e,t)=>{ci.init(e,t),ia.init(e,t),e.email=n=>e.check(Od(_h,n)),e.url=n=>e.check(Zd(vh,n)),e.jwt=n=>e.check(np(Nh,n)),e.emoji=n=>e.check(qd(yh,n)),e.guid=n=>e.check(Xs(sa,n)),e.uuid=n=>e.check(Dd(ro,n)),e.uuidv4=n=>e.check(Md(ro,n)),e.uuidv6=n=>e.check(Ud(ro,n)),e.uuidv7=n=>e.check(jd(ro,n)),e.nanoid=n=>e.check(Hd(wh,n)),e.guid=n=>e.check(Xs(sa,n)),e.cuid=n=>e.check(Fd(xh,n)),e.cuid2=n=>e.check(Bd(Sh,n)),e.ulid=n=>e.check(Gd(Th,n)),e.base64=n=>e.check(Qd(zh,n)),e.base64url=n=>e.check(ep(Ih,n)),e.xid=n=>e.check(Wd(Eh,n)),e.ksuid=n=>e.check(Jd(Ah,n)),e.ipv4=n=>e.check(Xd(Ch,n)),e.ipv6=n=>e.check(Vd(Ph,n)),e.cidrv4=n=>e.check(Yd(Rh,n)),e.cidrv6=n=>e.check(Kd(Lh,n)),e.e164=n=>e.check(tp($h,n)),e.datetime=n=>e.check(Qp(n)),e.date=n=>e.check(th(n)),e.time=n=>e.check(rh(n)),e.duration=n=>e.check(ih(n))});function A(e){return Nd(kh,e)}const ke=v("ZodStringFormat",(e,t)=>{fe.init(e,t),ia.init(e,t)}),_h=v("ZodEmail",(e,t)=>{Zu.init(e,t),ke.init(e,t)}),sa=v("ZodGUID",(e,t)=>{Uu.init(e,t),ke.init(e,t)}),ro=v("ZodUUID",(e,t)=>{ju.init(e,t),ke.init(e,t)}),vh=v("ZodURL",(e,t)=>{qu.init(e,t),ke.init(e,t)}),yh=v("ZodEmoji",(e,t)=>{Hu.init(e,t),ke.init(e,t)}),wh=v("ZodNanoID",(e,t)=>{Fu.init(e,t),ke.init(e,t)}),xh=v("ZodCUID",(e,t)=>{Bu.init(e,t),ke.init(e,t)}),Sh=v("ZodCUID2",(e,t)=>{Gu.init(e,t),ke.init(e,t)}),Th=v("ZodULID",(e,t)=>{Wu.init(e,t),ke.init(e,t)}),Eh=v("ZodXID",(e,t)=>{Ju.init(e,t),ke.init(e,t)}),Ah=v("ZodKSUID",(e,t)=>{Xu.init(e,t),ke.init(e,t)}),Ch=v("ZodIPv4",(e,t)=>{ed.init(e,t),ke.init(e,t)}),Ph=v("ZodIPv6",(e,t)=>{td.init(e,t),ke.init(e,t)}),Rh=v("ZodCIDRv4",(e,t)=>{nd.init(e,t),ke.init(e,t)}),Lh=v("ZodCIDRv6",(e,t)=>{rd.init(e,t),ke.init(e,t)}),zh=v("ZodBase64",(e,t)=>{od.init(e,t),ke.init(e,t)}),Ih=v("ZodBase64URL",(e,t)=>{sd.init(e,t),ke.init(e,t)}),$h=v("ZodE164",(e,t)=>{ad.init(e,t),ke.init(e,t)}),Nh=v("ZodJWT",(e,t)=>{ld.init(e,t),ke.init(e,t)}),aa=v("ZodNumber",(e,t)=>{Ns.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Lp(e,r,o),e.gt=(r,o)=>e.check(Ys(r,o)),e.gte=(r,o)=>e.check(di(r,o)),e.min=(r,o)=>e.check(di(r,o)),e.lt=(r,o)=>e.check(Vs(r,o)),e.lte=(r,o)=>e.check(ui(r,o)),e.max=(r,o)=>e.check(ui(r,o)),e.int=r=>e.check(ca(r)),e.safe=r=>e.check(ca(r)),e.positive=r=>e.check(Ys(0,r)),e.nonnegative=r=>e.check(di(0,r)),e.negative=r=>e.check(Vs(0,r)),e.nonpositive=r=>e.check(ui(0,r)),e.multipleOf=(r,o)=>e.check(Ks(r,o)),e.step=(r,o)=>e.check(Ks(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function St(e){return ap(aa,e)}const Oh=v("ZodNumberFormat",(e,t)=>{ud.init(e,t),aa.init(e,t)});function ca(e){return cp(Oh,e)}const Dh=v("ZodBoolean",(e,t)=>{dd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zp(e,n,r)});function me(e){return lp(Dh,e)}const Mh=v("ZodAny",(e,t)=>{pd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$p()});function la(){return up(Mh)}const Uh=v("ZodUnknown",(e,t)=>{hd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Np()});function ua(){return dp(Uh)}const jh=v("ZodNever",(e,t)=>{fd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ip(e,n,r)});function Zh(e){return pp(jh,e)}const qh=v("ZodArray",(e,t)=>{gd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jp(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(to(n,r)),e.nonempty=n=>e.check(to(1,n)),e.max=(n,r)=>e.check(Qs(n,r)),e.length=(n,r)=>e.check(ea(n,r)),e.unwrap=()=>e.element});function Tt(e,t){return Sp(qh,e,t)}const Hh=v("ZodObject",(e,t)=>{bd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zp(e,n,r,o),Y(e,"shape",()=>t.shape),e.keyof=()=>it(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ua()}),e.loose=()=>e.clone({...e._zod.def,catchall:ua()}),e.strict=()=>e.clone({...e._zod.def,catchall:Zh()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Dl(e,n),e.safeExtend=n=>Ml(e,n),e.merge=n=>Ul(e,n),e.pick=n=>Nl(e,n),e.omit=n=>Ol(e,n),e.partial=(...n)=>jl(ha,e,n[0]),e.required=(...n)=>Zl(ma,e,n[0])});function de(e,t){const n={type:"object",shape:e??{},...N(t)};return new Hh(n)}const da=v("ZodUnion",(e,t)=>{js.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qp(e,n,r,o),e.options=t.options});function Fh(e,t){return new da({type:"union",options:e,...N(t)})}const Bh=v("ZodDiscriminatedUnion",(e,t)=>{da.init(e,t),kd.init(e,t)});function pa(e,t,n){return new Bh({type:"union",options:t,discriminator:e,...N(n)})}const Gh=v("ZodIntersection",(e,t)=>{_d.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hp(e,n,r,o)});function Wh(e,t){return new Gh({type:"intersection",left:e,right:t})}const Jh=v("ZodRecord",(e,t)=>{vd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fp(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Et(e,t,n){return new Jh({type:"record",keyType:e,valueType:t,...N(n)})}const pi=v("ZodEnum",(e,t)=>{yd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Op(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const a of r)if(n.has(a))s[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new pi({...t,checks:[],...N(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const a of r)if(n.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new pi({...t,checks:[],...N(o),entries:s})}});function it(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new pi({type:"enum",entries:n,...N(t)})}const Xh=v("ZodLiteral",(e,t)=>{wd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Dp(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 st(e,t){return new Xh({type:"literal",values:Array.isArray(e)?e:[e],...N(t)})}const Vh=v("ZodTransform",(e,t)=>{xd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Up(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ms(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(pr(s,n.value,t));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),n.issues.push(pr(a))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function Yh(e){return new Vh({type:"transform",transform:e})}const ha=v("ZodOptional",(e,t)=>{Hs.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>oa(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function fa(e){return new ha({type:"optional",innerType:e})}const Kh=v("ZodExactOptional",(e,t)=>{Sd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>oa(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Qh(e){return new Kh({type:"optional",innerType:e})}const ef=v("ZodNullable",(e,t)=>{Td.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ga(e){return new ef({type:"nullable",innerType:e})}const tf=v("ZodDefault",(e,t)=>{Ed.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function nf(e,t){return new tf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ws(t)}})}const rf=v("ZodPrefault",(e,t)=>{Ad.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function of(e,t){return new rf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ws(t)}})}const ma=v("ZodNonOptional",(e,t)=>{Cd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function sf(e,t){return new ma({type:"nonoptional",innerType:e,...N(t)})}const af=v("ZodCatch",(e,t)=>{Pd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function cf(e,t){return new af({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const lf=v("ZodPipe",(e,t)=>{Rd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vp(e,n,r,o),e.in=t.in,e.out=t.out});function ba(e,t){return new lf({type:"pipe",in:e,out:t})}const uf=v("ZodReadonly",(e,t)=>{Ld.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function df(e){return new uf({type:"readonly",innerType:e})}const pf=v("ZodCustom",(e,t)=>{zd.init(e,t),ge.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mp(e,n)});function hf(e,t={}){return Tp(pf,e,t)}function ff(e){return Ep(e)}const gf=de({name:A().min(1).max(100).optional(),command:A().min(1).max(500),args:Tt(A()).optional(),failOnError:me().default(!0).optional(),timeout:St().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:A().optional(),env:Et(A(),A()).optional(),runOnBackground:me().optional()});de({name:A(),command:A(),success:me(),exitCode:St().optional(),stdout:A().optional(),stderr:A().optional(),error:A().optional(),duration:St(),failOnError:me()});const dn=de({path:A(),extraCommands:Tt(gf).optional(),id:A().uuid().optional(),rotationKey:A().optional(),usageStatus:it(["free","in_use"]).optional()}),mf=pa("operation",[dn.extend({operation:st("create"),content:A().optional(),contentPath:A().optional(),encoding:it(["utf-8","base64"]).optional()}),dn.extend({operation:st("merge"),data:Et(A(),la()),mergeStrategy:it(["deep","shallow"]).optional(),arrayMergeStrategy:it(["concat","replace"]).optional()}),dn.extend({operation:st("modify"),content:A().optional(),contentPath:A().optional(),createIfMissing:me().optional()}),dn.extend({operation:st("delete"),ignoreIfMissing:me().optional()}),dn.extend({operation:st("createDirectory"),contentPath:A().optional(),mode:St().optional(),ignoreIfExists:me().optional()}),dn.extend({operation:st("download"),url:A().url(),headers:Et(A(),A()).optional(),timeout:St().min(1e3).max(3e5).optional()}),dn.extend({operation:st("gitClone"),gitUrl:A(),gitSecretKey:A().optional(),sourceBranch:A().optional(),targetBranch:A().optional()})]);var ye=(e=>(e.PENDING="pending",e.ASSIGNED="assigned",e.IN_PROGRESS="in_progress",e.WAITING_FOR_INPUT="waiting_for_input",e.WAITING_FOR_PLAN_APPROVAL="waiting_for_plan_approval",e.PLAN_APPROVED="plan_approved",e.PLAN_REJECTED="plan_rejected",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.RESULT_REJECTED="result_rejected",e))(ye||{});const bf=de({type:it(["json","file","regex"]).describe("Extraction method"),source:A().describe("Source to extract from (file path or stdout/stderr)"),schema:de({}).passthrough().optional().describe("JSON schema for validation"),pattern:A().optional().describe("Regex pattern for extraction")}),kf=de({type:it(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:la().describe("Hook-specific configuration")});de({command:A().optional().describe("Legacy — unused in SDK mode"),args:Tt(A()).optional().describe("Legacy — unused in SDK mode"),env:Et(A(),A()).optional().describe("Environment variables"),workingDirectory:A().optional().describe("Working directory for command execution"),fileOperations:Tt(mf).optional().describe("File operations to perform during setup"),gitUrl:A().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:A().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:A().optional().describe("Commit message for git operations"),resultExtraction:bf.optional().describe("Schema for extracting result data"),postExecutionHooks:Tt(kf).optional().describe("Hooks to run after task completion"),executionMode:it(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:pa("executionMode",[de({executionMode:st("claudeAgentSdk"),promptText:A(),sdkOptions:de({model:A(),permissionMode:it(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:Tt(A()),allowDangerouslySkipPermissions:me(),persistSession:me(),streamSdkEvents:me().optional(),allowedTools:Tt(A()).optional(),settings:de({enabledPlugins:Et(A(),me())}),env:Et(A(),A()).optional()}),resume:de({sessionId:A().optional(),continue:me()}).optional()}),de({executionMode:st("opencodeSdk"),promptText:A(),sdkOptions:de({provider:A(),model:A(),env:Et(A(),A()).optional()}),resume:de({sessionId:A().optional(),continue:me()}).optional()}),de({executionMode:st("openaiAgentSdk"),promptText:A(),sdkOptions:de({model:A(),env:Et(A(),A()).optional()}),resume:de({sessionId:A().optional(),continue:me()}).optional()}),de({executionMode:st("codexSdk"),promptText:A(),sdkOptions:de({model:A().optional(),sandboxMode:it(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:it(["never","on-request","on-failure","untrusted"]).optional(),env:Et(A(),A()).optional()}),resume:de({sessionId:A().optional(),continue:me()}).optional()}),de({executionMode:st("cursorSdk"),promptText:A(),sdkOptions:de({model:A(),env:Et(A(),A()).optional()}),resume:de({sessionId:A().optional(),continue:me()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:me().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:A().optional().describe("Final approved plan content"),planApproved:me().optional().describe("Plan approval status"),planApprovedAt:A().optional().describe("ISO timestamp of approval"),planRejected:me().optional().describe("Plan rejection flag"),planRejectionFeedback:A().optional().describe("User rejection feedback"),rejectedPlanContent:A().optional().describe("Previously rejected plan content"),planCompletedAt:A().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:A().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:A().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:A().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:Tt(de({feedback:A(),rejectedAt:A()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:St().optional(),notificationChannelPlanMessageSentAt:A().optional(),notificationChannelCompletedMessageId:St().optional(),notificationChannelFailedMessageId:St().optional(),streamSdkEvents:me().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:A().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:me().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:Tt(de({id:A(),selectedText:A(),startOffset:St(),endOffset:St(),commentText:A(),createdAt:A()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:me().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:me().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:it(["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:me().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")}),ye.PENDING+"",ye.CANCELLED,ye.ASSIGNED+"",ye.CANCELLED,ye.IN_PROGRESS+"",ye.CANCELLED,ye.FAILED,ye.WAITING_FOR_INPUT+"",ye.CANCELLED,ye.WAITING_FOR_PLAN_APPROVAL+"",ye.CANCELLED,ye.PLAN_APPROVED+"",ye.CANCELLED,ye.PLAN_REJECTED+"",ye.CANCELLED,ye.COMPLETED+"",ye.RESULT_REJECTED+"",ye.CANCELLED,ye.FAILED+"",ye.CANCELLED+"";const ka="browser_capture",_f="browser_automate";async function Ue(e,t,n,r){const s=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=await fetch(s,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});if(!a.ok){const u=await a.json().catch(()=>({message:`HTTP ${a.status}`}));throw new Error(u.message||u.error||`HTTP ${a.status}`)}return a.json()}async function _a(e,t){return Ue(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)}async function hi(e,t,n,r,o,s,a=ka,u){var d,h,p,b,m,_;return Ue(e,"POST","/tasks",{type:a,title:s||n.slice(0,120)||r.pageTitle||"Browser capture",titleInstruction:u??n,projectId:t,autoAssign:!0,...o!=null&&o.claudeTemplateId?{claudeTemplateId:o.claudeTemplateId}:{},...(o==null?void 0:o.quickMode)!==void 0?{quickMode:o.quickMode}:{},...(o==null?void 0:o.modelOverride)!=null?{modelOverride:o.modelOverride}:{},...(o==null?void 0:o.claudeProfileId)!=null?{claudeProfileId:o.claudeProfileId}:{},...(o==null?void 0:o.effort)!=null?{effort:o.effort}:{},...(o==null?void 0:o.executionMode)!=null?{executionMode:o.executionMode}:{},...(d=o==null?void 0:o.selectedPluginIds)!=null&&d.length?{selectedPluginIds:o.selectedPluginIds}:{},...(h=o==null?void 0:o.selectedSkillIds)!=null&&h.length?{selectedSkillIds:o.selectedSkillIds}:{},...(p=o==null?void 0:o.selectedPluginSkillIds)!=null&&p.length?{selectedPluginSkillIds:o.selectedPluginSkillIds}:{},...(b=o==null?void 0:o.selectedMcpServerIds)!=null&&b.length?{selectedMcpServerIds:o.selectedMcpServerIds}:{},...(m=o==null?void 0:o.selectedSlashCommandIds)!=null&&m.length?{selectedSlashCommandIds:o.selectedSlashCommandIds}:{},...(_=o==null?void 0:o.selectedRemoteContextProviderIds)!=null&&_.length?{selectedRemoteContextProviderIds:o.selectedRemoteContextProviderIds}:{},metadata:{type:a,note:n,source:"web-sdk",pageUrl:r.pageUrl,pageTitle:r.pageTitle,elementText:r.elementText,cssSelector:r.cssSelector,elementOuterHtml:r.elementOuterHtml,ancestry:r.ancestry,elementRole:r.elementRole,elementAriaLabel:r.elementAriaLabel,enclosingSection:r.enclosingSection,description:r.description,canonicalUrl:r.canonicalUrl,lang:r.lang,ogTitle:r.ogTitle,ogDescription:r.ogDescription,ogType:r.ogType,ogSiteName:r.ogSiteName,viewportWidth:r.viewportWidth,viewportHeight:r.viewportHeight,scrollX:r.scrollX,scrollY:r.scrollY,selectionText:r.selectionText,capturedAt:r.capturedAt,interactionSteps:r.interactionSteps}})}async function va(e,t,n,r,o,s,a){return hi(e,t,n,r,o,s,_f,a)}async function ya(e,t,n,r){return Ue(e,"POST","/planning-sessions",{projectId:t,instruction:n,quickMode:(r==null?void 0:r.quickMode)??!1,...r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}})}async function vf(e,t){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Ue(e,"GET",`/claude-templates${n}`)}async function wa(e,t){return Ue(e,"GET",`/tasks/${t}`)}async function yf(e,t){return Ue(e,"GET",`/planning-sessions/${t}`)}async function wf(e){return Ue(e,"GET","/projects")}async function xf(e,t){return Ue(e,"GET",`/tasks/${t}/browser-commands/pending`)}async function Sf(e,t,n,r,o){return Ue(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})}async function Tf(e,t){return Ue(e,"GET",`/tasks/${t}/chunks`)}async function Ef(e,t,n){return Ue(e,"POST",`/tasks/${t}/instructions`,{content:n})}async function Af(e,t){return Ue(e,"POST",`/tasks/${t}/cancel`)}async function Cf(e,t){return Ue(e,"POST",`/tasks/${t}/approve-result`)}async function Pf(e,t,n){return Ue(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})}async function oo(e,t){return Ue(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)}async function xa(e,t,n,r){return Ue(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})}const Sa=/^cc-|current-password|new-password/i,Rf=/token|secret|password|apikey|auth/i,fi="[redacted]";function Lf(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&Sa.test(t)}function zf(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",fi);const r=n.getAttribute("autocomplete");r&&Sa.test(r)&&n.setAttribute("value",fi);for(const o of Array.from(n.attributes))Rf.test(o.name)&&n.setAttribute(o.name,fi)}}function If(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ta={exports:{}};/*!
|
|
1369
1386
|
* Pusher JavaScript Library v8.5.0
|
|
1370
1387
|
* https://pusher.com/
|
|
1371
1388
|
*
|
|
1372
1389
|
* Copyright 2020, Pusher
|
|
1373
1390
|
* Released under the MIT licence.
|
|
1374
|
-
*/(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(a,u){var d=this&&this.__extends||function(){var R=function(x,S){return R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,M){C.__proto__=M}||function(C,M){for(var se in M)M.hasOwnProperty(se)&&(C[se]=M[se])},R(x,S)};return function(x,S){R(x,S);function C(){this.constructor=x}x.prototype=S===null?Object.create(S):(C.prototype=S.prototype,new C)}}();Object.defineProperty(u,"__esModule",{value:!0});var p=256,h=function(){function R(x){x===void 0&&(x="="),this._paddingCharacter=x}return R.prototype.encodedLength=function(x){return this._paddingCharacter?(x+2)/3*4|0:(x*8+5)/6|0},R.prototype.encode=function(x){for(var S="",C=0;C<x.length-2;C+=3){var M=x[C]<<16|x[C+1]<<8|x[C+2];S+=this._encodeByte(M>>>3*6&63),S+=this._encodeByte(M>>>2*6&63),S+=this._encodeByte(M>>>1*6&63),S+=this._encodeByte(M>>>0*6&63)}var se=x.length-C;if(se>0){var M=x[C]<<16|(se===2?x[C+1]<<8:0);S+=this._encodeByte(M>>>3*6&63),S+=this._encodeByte(M>>>2*6&63),se===2?S+=this._encodeByte(M>>>1*6&63):S+=this._paddingCharacter||"",S+=this._paddingCharacter||""}return S},R.prototype.maxDecodedLength=function(x){return this._paddingCharacter?x/4*3|0:(x*6+7)/8|0},R.prototype.decodedLength=function(x){return this.maxDecodedLength(x.length-this._getPaddingLength(x))},R.prototype.decode=function(x){if(x.length===0)return new Uint8Array(0);for(var S=this._getPaddingLength(x),C=x.length-S,M=new Uint8Array(this.maxDecodedLength(C)),se=0,ke=0,$e=0,nt=0,K=0,_e=0,rt=0;ke<C-4;ke+=4)nt=this._decodeChar(x.charCodeAt(ke+0)),K=this._decodeChar(x.charCodeAt(ke+1)),_e=this._decodeChar(x.charCodeAt(ke+2)),rt=this._decodeChar(x.charCodeAt(ke+3)),M[se++]=nt<<2|K>>>4,M[se++]=K<<4|_e>>>2,M[se++]=_e<<6|rt,$e|=nt&p,$e|=K&p,$e|=_e&p,$e|=rt&p;if(ke<C-1&&(nt=this._decodeChar(x.charCodeAt(ke)),K=this._decodeChar(x.charCodeAt(ke+1)),M[se++]=nt<<2|K>>>4,$e|=nt&p,$e|=K&p),ke<C-2&&(_e=this._decodeChar(x.charCodeAt(ke+2)),M[se++]=K<<4|_e>>>2,$e|=_e&p),ke<C-3&&(rt=this._decodeChar(x.charCodeAt(ke+3)),M[se++]=_e<<6|rt,$e|=rt&p),$e!==0)throw new Error("Base64Coder: incorrect characters for decoding");return M},R.prototype._encodeByte=function(x){var S=x;return S+=65,S+=25-x>>>8&6,S+=51-x>>>8&-75,S+=61-x>>>8&-15,S+=62-x>>>8&3,String.fromCharCode(S)},R.prototype._decodeChar=function(x){var S=p;return S+=(42-x&x-44)>>>8&-p+x-43+62,S+=(46-x&x-48)>>>8&-p+x-47+63,S+=(47-x&x-58)>>>8&-p+x-48+52,S+=(64-x&x-91)>>>8&-p+x-65+0,S+=(96-x&x-123)>>>8&-p+x-97+26,S},R.prototype._getPaddingLength=function(x){var S=0;if(this._paddingCharacter){for(var C=x.length-1;C>=0&&x[C]===this._paddingCharacter;C--)S++;if(x.length<4||S>2)throw new Error("Base64Coder: incorrect padding")}return S},R}();u.Coder=h;var k=new h;function m(R){return k.encode(R)}u.encode=m;function _(R){return k.decode(R)}u.decode=_;var w=function(R){d(x,R);function x(){return R!==null&&R.apply(this,arguments)||this}return x.prototype._encodeByte=function(S){var C=S;return C+=65,C+=25-S>>>8&6,C+=51-S>>>8&-75,C+=61-S>>>8&-13,C+=62-S>>>8&49,String.fromCharCode(C)},x.prototype._decodeChar=function(S){var C=p;return C+=(44-S&S-46)>>>8&-p+S-45+62,C+=(94-S&S-96)>>>8&-p+S-95+63,C+=(47-S&S-58)>>>8&-p+S-48+52,C+=(64-S&S-91)>>>8&-p+S-65+0,C+=(96-S&S-123)>>>8&-p+S-97+26,C},x}(h);u.URLSafeCoder=w;var P=new w;function N(R){return P.encode(R)}u.encodeURLSafe=N;function ne(R){return P.decode(R)}u.decodeURLSafe=ne,u.encodedLength=function(R){return k.encodedLength(R)},u.maxDecodedLength=function(R){return k.maxDecodedLength(R)},u.decodedLength=function(R){return k.decodedLength(R)}},978(a,u){var d="utf8: invalid source encoding";function p(h){for(var k=[],m=0;m<h.length;m++){var _=h[m];if(_&128){var w=void 0;if(_<224){if(m>=h.length)throw new Error(d);var P=h[++m];if((P&192)!==128)throw new Error(d);_=(_&31)<<6|P&63,w=128}else if(_<240){if(m>=h.length-1)throw new Error(d);var P=h[++m],N=h[++m];if((P&192)!==128||(N&192)!==128)throw new Error(d);_=(_&15)<<12|(P&63)<<6|N&63,w=2048}else if(_<248){if(m>=h.length-2)throw new Error(d);var P=h[++m],N=h[++m],ne=h[++m];if((P&192)!==128||(N&192)!==128||(ne&192)!==128)throw new Error(d);_=(_&15)<<18|(P&63)<<12|(N&63)<<6|ne&63,w=65536}else throw new Error(d);if(_<w||_>=55296&&_<=57343)throw new Error(d);if(_>=65536){if(_>1114111)throw new Error(d);_-=65536,k.push(String.fromCharCode(55296|_>>10)),_=56320|_&1023}}k.push(String.fromCharCode(_))}return k.join("")}u.D4=p},721(a,u,d){a.exports=d(207).default},207(a,u,d){d.d(u,{default:()=>Xo});class p{constructor(i,c){this.lastId=0,this.prefix=i,this.name=c}create(i){this.lastId++;var c=this.lastId,f=this.prefix+c,g=this.name+"["+c+"]",y=!1,E=function(){y||(i.apply(null,arguments),y=!0)};return this[c]=E,{number:c,id:f,name:g,callback:E}}remove(i){delete this[i.number]}}var h=new p("_pusher_script_","Pusher.ScriptReceivers"),k={VERSION:"8.5.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""};const m=k;class _{constructor(i){this.options=i,this.receivers=i.receivers||h,this.loading={}}load(i,c,f){var g=this;if(g.loading[i]&&g.loading[i].length>0)g.loading[i].push(f);else{g.loading[i]=[f];var y=H.createScriptRequest(g.getPath(i,c)),E=g.receivers.create(function($){if(g.receivers.remove(E),g.loading[i]){var q=g.loading[i];delete g.loading[i];for(var X=function(Ee){Ee||y.cleanup()},Q=0;Q<q.length;Q++)q[Q]($,X)}});y.send(E)}}getRoot(i){var c,f=H.getDocument().location.protocol;return i&&i.useTLS||f==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(i,c){return this.getRoot(c)+"/"+i+this.options.suffix+".js"}}var w=new p("_pusher_dependencies","Pusher.DependenciesReceivers"),P=new _({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:w});const N={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}},R={buildLogSuffix:function(l){const i="See:",c=N.urls[l];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=N.baseUrl+c.path),f?`${i} ${f}`:""}};var x;(function(l){l.UserAuthentication="user-authentication",l.ChannelAuthorization="channel-authorization"})(x||(x={}));class S extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class C extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class se extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class ke extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class $e extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class nt extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class K extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class _e extends Error{constructor(i,c){super(c),this.status=i,Object.setPrototypeOf(this,new.target.prototype)}}const Z=function(l,i,c,f,g){const y=H.createXHR();y.open("POST",c.endpoint,!0),y.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var E in c.headers)y.setRequestHeader(E,c.headers[E]);if(c.headersProvider!=null){let $=c.headersProvider();for(var E in $)y.setRequestHeader(E,$[E])}return y.onreadystatechange=function(){if(y.readyState===4)if(y.status===200){let $,q=!1;try{$=JSON.parse(y.responseText),q=!0}catch{g(new _e(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${y.responseText}`),null)}q&&g(null,$)}else{let $="";switch(f){case x.UserAuthentication:$=R.buildLogSuffix("authenticationEndpoint");break;case x.ChannelAuthorization:$=`Clients must be authorized to join private or presence channels. ${R.buildLogSuffix("authorizationEndpoint")}`;break}g(new _e(y.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${y.status} from ${c.endpoint}. ${$}`),null)}},y.send(i),y};function re(l){return me(kt(l))}var Re=String.fromCharCode,Le="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bt=function(l){var i=l.charCodeAt(0);return i<128?l:i<2048?Re(192|i>>>6)+Re(128|i&63):Re(224|i>>>12&15)+Re(128|i>>>6&63)+Re(128|i&63)},kt=function(l){return l.replace(/[^\x00-\x7F]/g,bt)},vn=function(l){var i=[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=[Le.charAt(c>>>18),Le.charAt(c>>>12&63),i>=2?"=":Le.charAt(c>>>6&63),i>=1?"=":Le.charAt(c&63)];return f.join("")},me=window.btoa||function(l){return l.replace(/[\s\S]{1,3}/g,vn)};class Ae{constructor(i,c,f,g){this.clear=c,this.timer=i(()=>{this.timer&&(this.timer=g(this.timer))},f)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const W=Ae;function We(l){window.clearTimeout(l)}function J(l){window.clearInterval(l)}class Je extends W{constructor(i,c){super(setTimeout,We,i,function(f){return c(),null})}}class Xe extends W{constructor(i,c){super(setInterval,J,i,function(f){return c(),f})}}var Ve={now(){return Date.now?Date.now():new Date().valueOf()},defer(l){return new Je(0,l)},method(l,...i){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[l].apply(f,c.concat(arguments))}}};const ve=Ve;function be(l,...i){for(var c=0;c<i.length;c++){var f=i[c];for(var g in f)f[g]&&f[g].constructor&&f[g].constructor===Object?l[g]=be(l[g]||{},f[g]):l[g]=f[g]}return l}function $o(){for(var l=["Pusher"],i=0;i<arguments.length;i++)typeof arguments[i]=="string"?l.push(arguments[i]):l.push(Ye(arguments[i]));return l.join(" : ")}function Cr(l,i){var c=Array.prototype.indexOf;if(l===null)return-1;if(c&&l.indexOf===c)return l.indexOf(i);for(var f=0,g=l.length;f<g;f++)if(l[f]===i)return f;return-1}function Me(l,i){for(var c in l)Object.prototype.hasOwnProperty.call(l,c)&&i(l[c],c,l)}function yn(l){var i=[];return Me(l,function(c,f){i.push(f)}),i}function jt(l){var i=[];return Me(l,function(c){i.push(c)}),i}function Zt(l,i,c){for(var f=0;f<l.length;f++)i.call(c||window,l[f],f,l)}function er(l,i){for(var c=[],f=0;f<l.length;f++)c.push(i(l[f],f,l,c));return c}function tn(l,i){var c={};return Me(l,function(f,g){c[g]=i(f)}),c}function wn(l,i){i=i||function(g){return!!g};for(var c=[],f=0;f<l.length;f++)i(l[f],f,l,c)&&c.push(l[f]);return c}function xn(l,i){var c={};return Me(l,function(f,g){(i&&i(f,g,l,c)||f)&&(c[g]=f)}),c}function No(l){var i=[];return Me(l,function(c,f){i.push([f,c])}),i}function Pr(l,i){for(var c=0;c<l.length;c++)if(i(l[c],c,l))return!0;return!1}function Vi(l,i){for(var c=0;c<l.length;c++)if(!i(l[c],c,l))return!1;return!0}function Rr(l){return tn(l,function(i){return typeof i=="object"&&(i=Ye(i)),encodeURIComponent(re(i.toString()))})}function Sn(l){var i=xn(l,function(f){return f!==void 0}),c=er(No(Rr(i)),ve.method("join","=")).join("&");return c}function nn(l){var i=[],c=[];return function f(g,y){var E,$,q;switch(typeof g){case"object":if(!g)return null;for(E=0;E<i.length;E+=1)if(i[E]===g)return{$ref:c[E]};if(i.push(g),c.push(y),Object.prototype.toString.apply(g)==="[object Array]")for(q=[],E=0;E<g.length;E+=1)q[E]=f(g[E],y+"["+E+"]");else{q={};for($ in g)Object.prototype.hasOwnProperty.call(g,$)&&(q[$]=f(g[$],y+"["+JSON.stringify($)+"]"))}return q;case"number":case"string":case"boolean":return g}}(l,"$")}function Ye(l){try{return JSON.stringify(l)}catch{return JSON.stringify(nn(l))}}class Lr{constructor(){this.globalLog=i=>{window.console&&window.console.log&&window.console.log(i)}}debug(...i){this.log(this.globalLog,i)}warn(...i){this.log(this.globalLogWarn,i)}error(...i){this.log(this.globalLogError,i)}globalLogWarn(i){window.console&&window.console.warn?window.console.warn(i):this.globalLog(i)}globalLogError(i){window.console&&window.console.error?window.console.error(i):this.globalLogWarn(i)}log(i,...c){var f=$o.apply(this,arguments);Xo.log?Xo.log(f):Xo.logToConsole&&i.bind(this)(f)}}const ae=new Lr;var Oo=function(l,i,c,f,g){(c.headers!==void 0||c.headersProvider!=null)&&ae.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var y=l.nextAuthCallbackID.toString();l.nextAuthCallbackID++;var E=l.getDocument(),$=E.createElement("script");l.auth_callbacks[y]=function(Q){g(null,Q)};var q="Pusher.auth_callbacks['"+y+"']";$.src=c.endpoint+"?callback="+encodeURIComponent(q)+"&"+i;var X=E.getElementsByTagName("head")[0]||E.documentElement;X.insertBefore($,X.firstChild)};const zr=Oo;class Do{constructor(i){this.src=i}send(i){var c=this,f="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=i.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){i.callback(f)},c.script.onload=function(){i.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&i.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=i.id+"_error",c.errorScript.text=i.name+"('"+f+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var g=document.getElementsByTagName("head")[0];g.insertBefore(c.script,g.firstChild),c.errorScript&&g.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 tr{constructor(i,c){this.url=i,this.data=c}send(i){if(!this.request){var c=Sn(this.data),f=this.url+"/"+i.number+"?"+c;this.request=H.createScriptRequest(f),this.request.send(i)}}cleanup(){this.request&&this.request.cleanup()}}var nr=function(l,i){return function(c,f){var g="http"+(i?"s":"")+"://",y=g+(l.host||l.options.host)+l.options.path,E=H.createJSONPRequest(y,c),$=H.ScriptReceivers.create(function(q,X){h.remove($),E.cleanup(),X&&X.host&&(l.host=X.host),f&&f(q,X)});E.send($)}},_t={name:"jsonp",getAgent:nr};const rn=_t;function Tn(l,i,c){var f=l+(i.useTLS?"s":""),g=i.useTLS?i.hostTLS:i.hostNonTLS;return f+"://"+g+c}function En(l,i){var c="/app/"+l,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(i?"&"+i:"");return c+f}var Yi={getInitial:function(l,i){var c=(i.httpPath||"")+En(l,"flash=false");return Tn("ws",i,c)}},rr={getInitial:function(l,i){var c=(i.httpPath||"/pusher")+En(l);return Tn("http",i,c)}},or={getInitial:function(l,i){return Tn("http",i,i.httpPath||"/pusher")},getPath:function(l,i){return En(l)}};class Ki{constructor(){this._callbacks={}}get(i){return this._callbacks[qt(i)]}add(i,c,f){var g=qt(i);this._callbacks[g]=this._callbacks[g]||[],this._callbacks[g].push({fn:c,context:f})}remove(i,c,f){if(!i&&!c&&!f){this._callbacks={};return}var g=i?[qt(i)]:yn(this._callbacks);c||f?this.removeCallback(g,c,f):this.removeAllCallbacks(g)}removeCallback(i,c,f){Zt(i,function(g){this._callbacks[g]=wn(this._callbacks[g]||[],function(y){return c&&c!==y.fn||f&&f!==y.context}),this._callbacks[g].length===0&&delete this._callbacks[g]},this)}removeAllCallbacks(i){Zt(i,function(c){delete this._callbacks[c]},this)}}function qt(l){return"_"+l}class vt{constructor(i){this.callbacks=new Ki,this.global_callbacks=[],this.failThrough=i}bind(i,c,f){return this.callbacks.add(i,c,f),this}bind_global(i){return this.global_callbacks.push(i),this}unbind(i,c,f){return this.callbacks.remove(i,c,f),this}unbind_global(i){return i?(this.global_callbacks=wn(this.global_callbacks||[],c=>c!==i),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(i,c,f){for(var g=0;g<this.global_callbacks.length;g++)this.global_callbacks[g](i,c);var y=this.callbacks.get(i),E=[];if(f?E.push(c,f):c&&E.push(c),y&&y.length>0)for(var g=0;g<y.length;g++)y[g].fn.apply(y[g].context||window,E);else this.failThrough&&this.failThrough(i,c);return this}}class Qi extends vt{constructor(i,c,f,g,y){super(),this.initialize=H.transportConnectionInitializer,this.hooks=i,this.name=c,this.priority=f,this.key=g,this.options=y,this.state="new",this.timeline=y.timeline,this.activityTimeout=y.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var i=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(i,this.options)}catch(c){return ve.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),ae.debug("Connecting",{transport:this.name,url:i}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(i){return this.state==="open"?(ve.defer(()=>{this.socket&&this.socket.send(i)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(i){this.emit("error",{type:"WebSocketError",error:i}),this.timeline.error(this.buildTimelineMessage({error:i.toString()}))}onClose(i){i?this.changeState("closed",{code:i.code,reason:i.reason,wasClean:i.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(i){this.emit("message",i)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=i=>{this.onError(i)},this.socket.onclose=i=>{this.onClose(i)},this.socket.onmessage=i=>{this.onMessage(i)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(i,c){this.state=i,this.timeline.info(this.buildTimelineMessage({state:i,params:c})),this.emit(i,c)}buildTimelineMessage(i){return be({cid:this.id},i)}}class ce{constructor(i){this.hooks=i}isSupported(i){return this.hooks.isSupported(i)}createConnection(i,c,f,g){return new Qi(this.hooks,i,c,f,g)}}var on=new ce({urls:Yi,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!H.getWebSocketAPI()},isSupported:function(){return!!H.getWebSocketAPI()},getSocket:function(l){return H.createWebSocket(l)}}),Mo={urls:rr,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Ir=be({getSocket:function(l){return H.HTTPFactory.createStreamingSocket(l)}},Mo),ir=be({getSocket:function(l){return H.HTTPFactory.createPollingSocket(l)}},Mo),$r={isSupported:function(){return H.isXHRSupported()}},Uo=new ce(be({},Ir,$r)),es=new ce(be({},ir,$r)),ut={ws:on,xhr_streaming:Uo,xhr_polling:es};const dt=ut;var jo=new ce({file:"sockjs",urls:or,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(l,i){return new window.SockJS(l,null,{js_path:P.getPath("sockjs",{useTLS:i.useTLS}),ignore_null_origin:i.ignoreNullOrigin})},beforeOpen:function(l,i){l.send(JSON.stringify({path:i}))}}),Nr={isSupported:function(l){var i=H.isXDRSupported(l.useTLS);return i}},Or=new ce(be({},Ir,Nr)),Zo=new ce(be({},ir,Nr));dt.xdr_streaming=Or,dt.xdr_polling=Zo,dt.sockjs=jo;const yt=dt;class qo extends vt{constructor(){super();var i=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){i.emit("online")},!1),window.addEventListener("offline",function(){i.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Ho=new qo;class Fo{constructor(i,c,f){this.manager=i,this.transport=c,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(i,c,f,g){g=be({},g,{activityTimeout:this.pingDelay});var y=this.transport.createConnection(i,c,f,g),E=null,$=function(){y.unbind("open",$),y.bind("closed",q),E=ve.now()},q=X=>{if(y.unbind("closed",q),X.code===1002||X.code===1003)this.manager.reportDeath();else if(!X.wasClean&&E){var Q=ve.now()-E;Q<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(Q/2,this.minPingDelay))}};return y.bind("open",$),y}isSupported(i){return this.manager.isAlive()&&this.transport.isSupported(i)}}const Dr={decodeMessage:function(l){try{var i=JSON.parse(l.data),c=i.data;if(typeof c=="string")try{c=JSON.parse(i.data)}catch{}var f={event:i.event,channel:i.channel,data:c};return i.user_id&&(f.user_id=i.user_id),f}catch(g){throw{type:"MessageParseError",error:g,data:l.data}}},encodeMessage:function(l){return JSON.stringify(l)},processHandshake:function(l){var i=Dr.decodeMessage(l);if(i.event==="pusher:connection_established"){if(!i.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:i.data.socket_id,activityTimeout:i.data.activity_timeout*1e3}}else{if(i.event==="pusher:error")return{action:this.getCloseAction(i.data),error:this.getCloseError(i.data)};throw"Invalid handshake"}},getCloseAction:function(l){return l.code<4e3?l.code>=1002&&l.code<=1004?"backoff":null:l.code===4e3?"tls_only":l.code<4100?"refused":l.code<4200?"backoff":l.code<4300?"retry":"refused"},getCloseError:function(l){return l.code!==1e3&&l.code!==1001?{type:"PusherError",data:{code:l.code,message:l.reason||l.message}}:null}},Ht=Dr;class D extends vt{constructor(i,c){super(),this.id=i,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(i){return this.transport.send(i)}send_event(i,c,f){var g={event:i,data:c};return f&&(g.channel=f),ae.debug("Event sent",g),this.send(Ht.encodeMessage(g))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var i={message:f=>{var g;try{g=Ht.decodeMessage(f)}catch(y){this.emit("error",{type:"MessageParseError",error:y,data:f.data})}if(g!==void 0){switch(ae.debug("Event recd",g),g.event){case"pusher:error":this.emit("error",{type:"PusherError",data:g.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",g)}},activity:()=>{this.emit("activity")},error:f=>{this.emit("error",f)},closed:f=>{c(),f&&f.code&&this.handleCloseEvent(f),this.transport=null,this.emit("closed")}},c=()=>{Me(i,(f,g)=>{this.transport.unbind(g,f)})};Me(i,(f,g)=>{this.transport.bind(g,f)})}handleCloseEvent(i){var c=Ht.getCloseAction(i),f=Ht.getCloseError(i);f&&this.emit("error",f),c&&this.emit(c,{action:c,error:f})}}class b{constructor(i,c){this.transport=i,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=i=>{this.unbindListeners();var c;try{c=Ht.processHandshake(i)}catch(f){this.finish("error",{error:f}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new D(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=i=>{this.unbindListeners();var c=Ht.getCloseAction(i)||"backoff",f=Ht.getCloseError(i);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(i,c){this.callback(be({transport:this.transport,action:i},c))}}class T{constructor(i,c){this.timeline=i,this.options=c||{}}send(i,c){this.timeline.isEmpty()||this.timeline.send(H.TimelineTransport.getAgent(this,i),c)}}class L extends vt{constructor(i,c){super(function(f,g){ae.debug("No callbacks on "+i+" for "+f)}),this.name=i,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(i,c){return c(null,{auth:""})}trigger(i,c){if(i.indexOf("client-")!==0)throw new S("Event '"+i+"' does not start with 'client-'");if(!this.subscribed){var f=R.buildLogSuffix("triggeringClientEvents");ae.warn(`Client event triggered before channel 'subscription_succeeded' event . ${f}`)}return this.pusher.send_event(i,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(i){var c=i.event,f=i.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(i);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(i);else if(c.indexOf("pusher_internal:")!==0){var g={};this.emit(c,f,g)}}handleSubscriptionSucceededEvent(i){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",i.data)}handleSubscriptionCountEvent(i){i.data.subscription_count&&(this.subscriptionCount=i.data.subscription_count),this.emit("pusher:subscription_count",i.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(i,c)=>{i?(this.subscriptionPending=!1,ae.error(i.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:i.message},i instanceof _e?{status:i.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 oe extends L{authorize(i,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:i},c)}}class ze{constructor(){this.reset()}get(i){return Object.prototype.hasOwnProperty.call(this.members,i)?{id:i,info:this.members[i]}:null}each(i){Me(this.members,(c,f)=>{i(this.get(f))})}setMyID(i){this.myID=i}onSubscription(i){this.members=i.presence.hash,this.count=i.presence.count,this.me=this.get(this.myID)}addMember(i){return this.get(i.user_id)===null&&this.count++,this.members[i.user_id]=i.user_info,this.get(i.user_id)}removeMember(i){var c=this.get(i.user_id);return c&&(delete this.members[i.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var ye=function(l,i,c,f){function g(y){return y instanceof c?y:new c(function(E){E(y)})}return new(c||(c=Promise))(function(y,E){function $(Q){try{X(f.next(Q))}catch(Ee){E(Ee)}}function q(Q){try{X(f.throw(Q))}catch(Ee){E(Ee)}}function X(Q){Q.done?y(Q.value):g(Q.value).then($,q)}X((f=f.apply(l,i||[])).next())})};class Ue extends oe{constructor(i,c){super(i,c),this.members=new ze}authorize(i,c){super.authorize(i,(f,g)=>ye(this,void 0,void 0,function*(){if(!f)if(g=g,g.channel_data!=null){var y=JSON.parse(g.channel_data);this.members.setMyID(y.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let E=R.buildLogSuffix("authorizationEndpoint");ae.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${E}, or the user should be signed in.`),c("Invalid auth response");return}c(f,g)}))}handleEvent(i){var c=i.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(i);else{var f=i.data,g={};i.user_id&&(g.user_id=i.user_id),this.emit(c,f,g)}}handleInternalEvent(i){var c=i.event,f=i.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(i);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(i);break;case"pusher_internal:member_added":var g=this.members.addMember(f);this.emit("pusher:member_added",g);break;case"pusher_internal:member_removed":var y=this.members.removeMember(f);y&&this.emit("pusher:member_removed",y);break}}handleSubscriptionSucceededEvent(i){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(i.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var wt=d(978),Lt=d(594);class Mr extends oe{constructor(i,c,f){super(i,c),this.key=null,this.nacl=f}authorize(i,c){super.authorize(i,(f,g)=>{if(f){c(f,g);return}let y=g.shared_secret;if(!y){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,Lt.decode)(y),delete g.shared_secret,c(null,g)})}trigger(i,c){throw new $e("Client events are not currently supported for encrypted channels")}handleEvent(i){var c=i.event,f=i.data;if(c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0){super.handleEvent(i);return}this.handleEncryptedEvent(c,f)}handleEncryptedEvent(i,c){if(!this.key){ae.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){ae.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let f=(0,Lt.decode)(c.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){ae.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let g=(0,Lt.decode)(c.nonce);if(g.length<this.nacl.secretbox.nonceLength){ae.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${g.length}`);return}let y=this.nacl.secretbox.open(f,g,this.key);if(y===null){ae.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(E,$)=>{if(E){ae.error(`Failed to make a request to the authEndpoint: ${$}. Unable to fetch new key, so dropping encrypted event`);return}if(y=this.nacl.secretbox.open(f,g,this.key),y===null){ae.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(i,this.getDataToEmit(y))});return}this.emit(i,this.getDataToEmit(y))}getDataToEmit(i){let c=(0,wt.D4)(i);try{return JSON.parse(c)}catch{return c}}}class Ce extends vt{constructor(i,c){super(),this.state="initialized",this.connection=null,this.key=i,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=H.getNetwork();f.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),f.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(i){this.key=i,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(i){return this.connection?this.connection.send(i):!1}send_event(i,c,f){return this.connection?this.connection.send_event(i,c,f):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var i=(c,f)=>{c?this.runner=this.strategy.connect(0,i):f.action==="error"?(this.emit("error",{type:"HandshakeError",error:f.error}),this.timeline.error({handshakeError:f.error})):(this.abortConnecting(),this.handshakeCallbacks[f.action](f))};this.runner=this.strategy.connect(0,i)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var i=this.abandonConnection();i.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(i){this.timeline.info({action:"retry",delay:i}),i>0&&this.emit("connecting_in",Math.round(i/1e3)),this.retryTimer=new Je(i||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new Je(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new Je(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 Je(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(i){return be({},i,{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(i){return be({},i,{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 i=c=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),c(f)};return{tls_only:i(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:i(()=>{this.disconnect()}),backoff:i(()=>{this.retryIn(1e3)}),retry:i(()=>{this.retryIn(0)})}}setConnection(i){this.connection=i;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var i in this.connectionCallbacks)this.connection.unbind(i,this.connectionCallbacks[i]);var c=this.connection;return this.connection=null,c}}updateState(i,c){var f=this.state;if(this.state=i,f!==i){var g=i;g==="connected"&&(g+=" with new socket ID "+c.socket_id),ae.debug("State changed",f+" -> "+g),this.timeline.info({state:i,params:c}),this.emit("state_change",{previous:f,current:i}),this.emit(i,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class Bo{constructor(){this.channels={}}add(i,c){return this.channels[i]||(this.channels[i]=Go(i,c)),this.channels[i]}all(){return jt(this.channels)}find(i){return this.channels[i]}remove(i){var c=this.channels[i];return delete this.channels[i],c}disconnect(){Me(this.channels,function(i){i.disconnect()})}}function Go(l,i){if(l.indexOf("private-encrypted-")===0){if(i.config.nacl)return Ft.createEncryptedChannel(l,i,i.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=R.buildLogSuffix("encryptedChannelSupport");throw new $e(`${c}. ${f}`)}else{if(l.indexOf("private-")===0)return Ft.createPrivateChannel(l,i);if(l.indexOf("presence-")===0)return Ft.createPresenceChannel(l,i);if(l.indexOf("#")===0)throw new C('Cannot create a channel with name "'+l+'".');return Ft.createChannel(l,i)}}var _b={createChannels(){return new Bo},createConnectionManager(l,i){return new Ce(l,i)},createChannel(l,i){return new L(l,i)},createPrivateChannel(l,i){return new oe(l,i)},createPresenceChannel(l,i){return new Ue(l,i)},createEncryptedChannel(l,i,c){return new Mr(l,i,c)},createTimelineSender(l,i){return new T(l,i)},createHandshake(l,i){return new b(l,i)},createAssistantToTheTransportManager(l,i,c){return new Fo(l,i,c)}};const Ft=_b;class Yc{constructor(i){this.options=i||{},this.livesLeft=this.options.lives||1/0}getAssistant(i){return Ft.createAssistantToTheTransportManager(this,i,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class An{constructor(i,c){this.strategies=i,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return Pr(this.strategies,ve.method("isSupported"))}connect(i,c){var f=this.strategies,g=0,y=this.timeout,E=null,$=(q,X)=>{X?c(null,X):(g=g+1,this.loop&&(g=g%f.length),g<f.length?(y&&(y=y*2,this.timeoutLimit&&(y=Math.min(y,this.timeoutLimit))),E=this.tryStrategy(f[g],i,{timeout:y,failFast:this.failFast},$)):c(!0))};return E=this.tryStrategy(f[g],i,{timeout:y,failFast:this.failFast},$),{abort:function(){E.abort()},forceMinPriority:function(q){i=q,E&&E.forceMinPriority(q)}}}tryStrategy(i,c,f,g){var y=null,E=null;return f.timeout>0&&(y=new Je(f.timeout,function(){E.abort(),g(!0)})),E=i.connect(c,function($,q){$&&y&&y.isRunning()&&!f.failFast||(y&&y.ensureAborted(),g($,q))}),{abort:function(){y&&y.ensureAborted(),E.abort()},forceMinPriority:function($){E.forceMinPriority($)}}}}class ts{constructor(i){this.strategies=i}isSupported(){return Pr(this.strategies,ve.method("isSupported"))}connect(i,c){return vb(this.strategies,i,function(f,g){return function(y,E){if(g[f].error=y,y){yb(g)&&c(!0);return}Zt(g,function($){$.forceMinPriority(E.transport.priority)}),c(null,E)}})}}function vb(l,i,c){var f=er(l,function(g,y,E,$){return g.connect(i,c(y,$))});return{abort:function(){Zt(f,wb)},forceMinPriority:function(g){Zt(f,function(y){y.forceMinPriority(g)})}}}function yb(l){return Vi(l,function(i){return!!i.error})}function wb(l){!l.error&&!l.aborted&&(l.abort(),l.aborted=!0)}class xb{constructor(i,c,f){this.strategy=i,this.transports=c,this.ttl=f.ttl||18e5,this.usingTLS=f.useTLS,this.timeline=f.timeline}isSupported(){return this.strategy.isSupported()}connect(i,c){var f=this.usingTLS,g=Sb(f),y=g&&g.cacheSkipCount?g.cacheSkipCount:0,E=[this.strategy];if(g&&g.timestamp+this.ttl>=ve.now()){var $=this.transports[g.transport];$&&(["ws","wss"].includes(g.transport)||y>3?(this.timeline.info({cached:!0,transport:g.transport,latency:g.latency}),E.push(new An([$],{timeout:g.latency*2+1e3,failFast:!0}))):y++)}var q=ve.now(),X=E.pop().connect(i,function Q(Ee,Vo){Ee?(Kc(f),E.length>0?(q=ve.now(),X=E.pop().connect(i,Q)):c(Ee)):(Tb(f,Vo.transport.name,ve.now()-q,y),c(null,Vo))});return{abort:function(){X.abort()},forceMinPriority:function(Q){i=Q,X&&X.forceMinPriority(Q)}}}}function ns(l){return"pusherTransport"+(l?"TLS":"NonTLS")}function Sb(l){var i=H.getLocalStorage();if(i)try{var c=i[ns(l)];if(c)return JSON.parse(c)}catch{Kc(l)}return null}function Tb(l,i,c,f){var g=H.getLocalStorage();if(g)try{g[ns(l)]=Ye({timestamp:ve.now(),transport:i,latency:c,cacheSkipCount:f})}catch{}}function Kc(l){var i=H.getLocalStorage();if(i)try{delete i[ns(l)]}catch{}}class Wo{constructor(i,{delay:c}){this.strategy=i,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(i,c){var f=this.strategy,g,y=new Je(this.options.delay,function(){g=f.connect(i,c)});return{abort:function(){y.ensureAborted(),g&&g.abort()},forceMinPriority:function(E){i=E,g&&g.forceMinPriority(E)}}}}class Ur{constructor(i,c,f){this.test=i,this.trueBranch=c,this.falseBranch=f}isSupported(){var i=this.test()?this.trueBranch:this.falseBranch;return i.isSupported()}connect(i,c){var f=this.test()?this.trueBranch:this.falseBranch;return f.connect(i,c)}}class Eb{constructor(i){this.strategy=i}isSupported(){return this.strategy.isSupported()}connect(i,c){var f=this.strategy.connect(i,function(g,y){y&&f.abort(),c(g,y)});return f}}function jr(l){return function(){return l.isSupported()}}var Ab=function(l,i,c){var f={};function g(dl,Sk,Tk,Ek,Ak){var pl=c(l,dl,Sk,Tk,Ek,Ak);return f[dl]=pl,pl}var y=Object.assign({},i,{hostNonTLS:l.wsHost+":"+l.wsPort,hostTLS:l.wsHost+":"+l.wssPort,httpPath:l.wsPath}),E=Object.assign({},y,{useTLS:!0}),$=Object.assign({},i,{hostNonTLS:l.httpHost+":"+l.httpPort,hostTLS:l.httpHost+":"+l.httpsPort,httpPath:l.httpPath}),q={loop:!0,timeout:15e3,timeoutLimit:6e4},X=new Yc({minPingDelay:1e4,maxPingDelay:l.activityTimeout}),Q=new Yc({lives:2,minPingDelay:1e4,maxPingDelay:l.activityTimeout}),Ee=g("ws","ws",3,y,X),Vo=g("wss","ws",3,E,X),_k=g("sockjs","sockjs",1,$),il=g("xhr_streaming","xhr_streaming",1,$,Q),vk=g("xdr_streaming","xdr_streaming",1,$,Q),sl=g("xhr_polling","xhr_polling",1,$),yk=g("xdr_polling","xdr_polling",1,$),al=new An([Ee],q),wk=new An([Vo],q),xk=new An([_k],q),cl=new An([new Ur(jr(il),il,vk)],q),ll=new An([new Ur(jr(sl),sl,yk)],q),ul=new An([new Ur(jr(cl),new ts([cl,new Wo(ll,{delay:4e3})]),ll)],q),is=new Ur(jr(ul),ul,xk),ss;return i.useTLS?ss=new ts([al,new Wo(is,{delay:2e3})]):ss=new ts([al,new Wo(wk,{delay:2e3}),new Wo(is,{delay:5e3})]),new xb(new Eb(new Ur(jr(Ee),ss,is)),f,{ttl:18e5,timeline:i.timeline,useTLS:i.useTLS})};const Cb=Ab;function Pb(){var l=this;l.timeline.info(l.buildTimelineMessage({transport:l.name+(l.options.useTLS?"s":"")})),l.hooks.isInitialized()?l.changeState("initialized"):l.hooks.file?(l.changeState("initializing"),P.load(l.hooks.file,{useTLS:l.options.useTLS},function(i,c){l.hooks.isInitialized()?(l.changeState("initialized"),c(!0)):(i&&l.onError(i),l.onClose(),c(!1))})):l.onClose()}var Rb={getRequest:function(l){var i=new window.XDomainRequest;return i.ontimeout=function(){l.emit("error",new M),l.close()},i.onerror=function(c){l.emit("error",c),l.close()},i.onprogress=function(){i.responseText&&i.responseText.length>0&&l.onChunk(200,i.responseText)},i.onload=function(){i.responseText&&i.responseText.length>0&&l.onChunk(200,i.responseText),l.emit("finished",200),l.close()},i},abortRequest:function(l){l.ontimeout=l.onerror=l.onprogress=l.onload=null,l.abort()}};const Lb=Rb,zb=256*1024;class Ib extends vt{constructor(i,c,f){super(),this.hooks=i,this.method=c,this.url=f}start(i){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},H.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(i)}close(){this.unloader&&(H.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(i,c){for(;;){var f=this.advanceBuffer(c);if(f)this.emit("chunk",{status:i,data:f});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(i){var c=i.slice(this.position),f=c.indexOf(`
|
|
1375
|
-
`);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(i){return this.position===i.length&&i.length>zb}}var rs;(function(l){l[l.CONNECTING=0]="CONNECTING",l[l.OPEN=1]="OPEN",l[l.CLOSED=3]="CLOSED"})(rs||(rs={}));const Cn=rs;var $b=1;class Nb{constructor(i,c){this.hooks=i,this.session=el(1e3)+"/"+Ub(8),this.location=Ob(c),this.readyState=Cn.CONNECTING,this.openStream()}send(i){return this.sendRaw(JSON.stringify([i]))}ping(){this.hooks.sendHeartbeat(this)}close(i,c){this.onClose(i,c,!0)}sendRaw(i){if(this.readyState===Cn.OPEN)try{return H.createSocketRequest("POST",Qc(Db(this.location,this.session))).start(i),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(i,c,f){this.closeStream(),this.readyState=Cn.CLOSED,this.onclose&&this.onclose({code:i,reason:c,wasClean:f})}onChunk(i){if(i.status===200){this.readyState===Cn.OPEN&&this.onActivity();var c,f=i.data.slice(0,1);switch(f){case"o":c=JSON.parse(i.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(i.data.slice(1)||"[]");for(var g=0;g<c.length;g++)this.onEvent(c[g]);break;case"m":c=JSON.parse(i.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(i.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(i){this.readyState===Cn.CONNECTING?(i&&i.hostname&&(this.location.base=Mb(this.location.base,i.hostname)),this.readyState=Cn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(i){this.readyState===Cn.OPEN&&this.onmessage&&this.onmessage({data:i})}onActivity(){this.onactivity&&this.onactivity()}onError(i){this.onerror&&this.onerror(i)}openStream(){this.stream=H.createSocketRequest("POST",Qc(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",i=>{this.onChunk(i)}),this.stream.bind("finished",i=>{this.hooks.onFinished(this,i)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(i){ve.defer(()=>{this.onError(i),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function Ob(l){var i=/([^\?]*)\/*(\??.*)/.exec(l);return{base:i[1],queryString:i[2]}}function Db(l,i){return l.base+"/"+i+"/xhr_send"}function Qc(l){var i=l.indexOf("?")===-1?"?":"&";return l+i+"t="+ +new Date+"&n="+$b++}function Mb(l,i){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(l);return c[1]+i+c[3]}function el(l){return H.randomInt(l)}function Ub(l){for(var i=[],c=0;c<l;c++)i.push(el(32).toString(32));return i.join("")}const jb=Nb;var Zb={getReceiveURL:function(l,i){return l.base+"/"+i+"/xhr_streaming"+l.queryString},onHeartbeat:function(l){l.sendRaw("[]")},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,i){l.onClose(1006,"Connection interrupted ("+i+")",!1)}};const qb=Zb;var Hb={getReceiveURL:function(l,i){return l.base+"/"+i+"/xhr"+l.queryString},onHeartbeat:function(){},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,i){i===200?l.reconnect():l.onClose(1006,"Connection interrupted ("+i+")",!1)}};const Fb=Hb;var Bb={getRequest:function(l){var i=H.getXHRAPI(),c=new i;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 Gb=Bb;var Wb={createStreamingSocket(l){return this.createSocket(qb,l)},createPollingSocket(l){return this.createSocket(Fb,l)},createSocket(l,i){return new jb(l,i)},createXHR(l,i){return this.createRequest(Gb,l,i)},createRequest(l,i,c){return new Ib(l,i,c)}};const tl=Wb;tl.createXDR=function(l,i){return this.createRequest(Lb,l,i)};var Jb={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:w,getDefaultStrategy:Cb,Transports:yt,transportConnectionInitializer:Pb,HTTPFactory:tl,TimelineTransport:rn,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(l){window.Pusher=l;var i=()=>{this.onDocumentBody(l.ready)};window.JSON?i():P.load("json2",{},i)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:Z,jsonp:zr}},onDocumentBody(l){document.body?l():setTimeout(()=>{this.onDocumentBody(l)},0)},createJSONPRequest(l,i){return new tr(l,i)},createScriptRequest(l){return new Do(l)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var l=this.getXHRAPI();return new l},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Ho},createWebSocket(l){var i=this.getWebSocketAPI();return new i(l)},createSocketRequest(l,i){if(this.isXHRSupported())return this.HTTPFactory.createXHR(l,i);if(this.isXDRSupported(i.indexOf("https:")===0))return this.HTTPFactory.createXDR(l,i);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var l=this.getXHRAPI();return!!l&&new l().withCredentials!==void 0},isXDRSupported(l){var i=l?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===i},addUnloadListener(l){window.addEventListener!==void 0?window.addEventListener("unload",l,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",l)},removeUnloadListener(l){window.addEventListener!==void 0?window.removeEventListener("unload",l,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",l)},randomInt(l){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*l)}};const H=Jb;var os;(function(l){l[l.ERROR=3]="ERROR",l[l.INFO=6]="INFO",l[l.DEBUG=7]="DEBUG"})(os||(os={}));const Jo=os;class Xb{constructor(i,c,f){this.key=i,this.session=c,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(i,c){i<=this.options.level&&(this.events.push(be({},c,{timestamp:ve.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(i){this.log(Jo.ERROR,i)}info(i){this.log(Jo.INFO,i)}debug(i){this.log(Jo.DEBUG,i)}isEmpty(){return this.events.length===0}send(i,c){var f=be({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],i(f,(g,y)=>{g||this.sent++,c&&c(g,y)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class Vb{constructor(i,c,f,g){this.name=i,this.priority=c,this.transport=f,this.options=g||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(i,c){if(this.isSupported()){if(this.priority<i)return nl(new se,c)}else return nl(new K,c);var f=!1,g=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),y=null,E=function(){g.unbind("initialized",E),g.connect()},$=function(){y=Ft.createHandshake(g,function(Ee){f=!0,Q(),c(null,Ee)})},q=function(Ee){Q(),c(Ee)},X=function(){Q();var Ee;Ee=Ye(g),c(new ke(Ee))},Q=function(){g.unbind("initialized",E),g.unbind("open",$),g.unbind("error",q),g.unbind("closed",X)};return g.bind("initialized",E),g.bind("open",$),g.bind("error",q),g.bind("closed",X),g.initialize(),{abort:()=>{f||(Q(),y?y.close():g.close())},forceMinPriority:Ee=>{f||this.priority<Ee&&(y?y.close():g.close())}}}}function nl(l,i){return ve.defer(function(){i(l)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Yb}=H;var Kb=function(l,i,c,f,g,y){var E=Yb[c];if(!E)throw new nt(c);var $=(!l.enabledTransports||Cr(l.enabledTransports,i)!==-1)&&(!l.disabledTransports||Cr(l.disabledTransports,i)===-1),q;return $?(g=Object.assign({ignoreNullOrigin:l.ignoreNullOrigin},g),q=new Vb(i,f,y?y.getAssistant(E):E,g)):q=Qb,q},Qb={isSupported:function(){return!1},connect:function(l,i){var c=ve.defer(function(){i(new K)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function ek(l){if(l==null)throw"You must pass an options object";if(l.cluster==null)throw"Options object must provide a cluster";"disableStats"in l&&ae.warn("The disableStats option is deprecated in favor of enableStats")}const tk=(l,i)=>{var c="socket_id="+encodeURIComponent(l.socketId);for(var f in i.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(i.params[f]);if(i.paramsProvider!=null){let g=i.paramsProvider();for(var f in g)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return c},nk=l=>{if(typeof H.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(i,c)=>{const f=tk(i,l);H.getAuthorizers()[l.transport](H,f,l,x.UserAuthentication,c)}},rk=(l,i)=>{var c="socket_id="+encodeURIComponent(l.socketId);c+="&channel_name="+encodeURIComponent(l.channelName);for(var f in i.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(i.params[f]);if(i.paramsProvider!=null){let g=i.paramsProvider();for(var f in g)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return c},ok=l=>{if(typeof H.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(i,c)=>{const f=rk(i,l);H.getAuthorizers()[l.transport](H,f,l,x.ChannelAuthorization,c)}},ik=(l,i,c)=>{const f={authTransport:i.transport,authEndpoint:i.endpoint,auth:{params:i.params,headers:i.headers}};return(g,y)=>{const E=l.channel(g.channelName);c(E,f).authorize(g.socketId,y)}};function rl(l,i){let c={activityTimeout:l.activityTimeout||m.activityTimeout,cluster:l.cluster,httpPath:l.httpPath||m.httpPath,httpPort:l.httpPort||m.httpPort,httpsPort:l.httpsPort||m.httpsPort,pongTimeout:l.pongTimeout||m.pongTimeout,statsHost:l.statsHost||m.stats_host,unavailableTimeout:l.unavailableTimeout||m.unavailableTimeout,wsPath:l.wsPath||m.wsPath,wsPort:l.wsPort||m.wsPort,wssPort:l.wssPort||m.wssPort,enableStats:uk(l),httpHost:sk(l),useTLS:lk(l),wsHost:ak(l),userAuthenticator:dk(l),channelAuthorizer:hk(l,i)};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 sk(l){return l.httpHost?l.httpHost:l.cluster?`sockjs-${l.cluster}.pusher.com`:m.httpHost}function ak(l){return l.wsHost?l.wsHost:ck(l.cluster)}function ck(l){return`ws-${l}.pusher.com`}function lk(l){return H.getProtocol()==="https:"?!0:l.forceTLS!==!1}function uk(l){return"enableStats"in l?l.enableStats:"disableStats"in l?!l.disableStats:!1}const ol=l=>"customHandler"in l&&l.customHandler!=null;function dk(l){const i=Object.assign(Object.assign({},m.userAuthentication),l.userAuthentication);return ol(i)?i.customHandler:nk(i)}function pk(l,i){let c;if("channelAuthorization"in l)c=Object.assign(Object.assign({},m.channelAuthorization),l.channelAuthorization);else if(c={transport:l.authTransport||m.authTransport,endpoint:l.authEndpoint||m.authEndpoint},"auth"in l&&("params"in l.auth&&(c.params=l.auth.params),"headers"in l.auth&&(c.headers=l.auth.headers)),"authorizer"in l)return{customHandler:ik(i,c,l.authorizer)};return c}function hk(l,i){const c=pk(l,i);return ol(c)?c.customHandler:ok(c)}class fk extends vt{constructor(i){super(function(c,f){ae.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=i,this.bindWatchlistInternalEvent()}handleEvent(i){i.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",i=>{var c=i.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(i)})}}function gk(){let l,i;return{promise:new Promise((f,g)=>{l=f,i=g}),resolve:l,reject:i}}const mk=gk;class bk extends vt{constructor(i){super(function(c,f){ae.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){ae.warn(`Error during signin: ${c}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:f.auth,user_data:f.user_data})},this.pusher=i,this.pusher.connection.bind("state_change",({previous:c,current:f})=>{c!=="connected"&&f==="connected"&&this._signin(),c==="connected"&&f!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new fk(i),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(i){try{this.user_data=JSON.parse(i.user_data)}catch{ae.error(`Failed parsing user data after signin: ${i.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){ae.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const i=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new L(`#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)}),i(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:i,resolve:c}=mk();i.done=!1;const f=()=>{i.done=!0};i.then(f).catch(f),this.signinDonePromise=i,this._signinDoneResolve=c}}class Ne{static ready(){Ne.isReady=!0;for(var i=0,c=Ne.instances.length;i<c;i++)Ne.instances[i].connect()}static getClientFeatures(){return yn(xn({ws:H.Transports.ws},function(i){return i.isSupported({})}))}constructor(i,c){kk(i),ek(c),this.key=i,this.options=c,this.config=rl(this.options,this),this.channels=Ft.createChannels(),this.global_emitter=new vt,this.sessionID=H.randomInt(1e9),this.timeline=new Xb(this.key,this.sessionID,{cluster:this.config.cluster,features:Ne.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:Jo.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=Ft.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+H.TimelineTransport.name}));var f=g=>H.getDefaultStrategy(this.config,g,Kb);this.connection=Ft.createConnectionManager(this.key,{getStrategy:f,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",g=>{var y=g.event,E=y.indexOf("pusher_internal:")===0;if(g.channel){var $=this.channel(g.channel);$&&$.handleEvent(g)}E||this.global_emitter.emit(g.event,g.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",g=>{ae.warn(g)}),Ne.instances.push(this),this.timeline.info({instances:Ne.instances.length}),this.user=new bk(this),Ne.isReady&&this.connect()}switchCluster(i){const{appKey:c,cluster:f}=i;this.key=c,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=rl(this.options,this),this.connection.switchCluster(this.key)}channel(i){return this.channels.find(i)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var i=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new Xe(6e4,function(){c.send(i)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(i,c,f){return this.global_emitter.bind(i,c,f),this}unbind(i,c,f){return this.global_emitter.unbind(i,c,f),this}bind_global(i){return this.global_emitter.bind_global(i),this}unbind_global(i){return this.global_emitter.unbind_global(i),this}unbind_all(i){return this.global_emitter.unbind_all(),this}subscribeAll(){var i;for(i in this.channels.channels)this.channels.channels.hasOwnProperty(i)&&this.subscribe(i)}subscribe(i){var c=this.channels.add(i,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(i){var c=this.channels.find(i);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(i),c&&c.subscribed&&c.unsubscribe())}send_event(i,c,f){return this.connection.send_event(i,c,f)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}Ne.instances=[],Ne.isReady=!1,Ne.logToConsole=!1,Ne.Runtime=H,Ne.ScriptReceivers=H.ScriptReceivers,Ne.DependenciesReceivers=H.DependenciesReceivers,Ne.auth_callbacks=H.auth_callbacks;const Xo=Ne;function kk(l){if(l==null)throw"You must pass your app key when you instantiate Pusher."}H.setup(Ne)}},r={};function o(a){var u=r[a];if(u!==void 0)return u.exports;var d=r[a]={exports:{}};return n[a].call(d.exports,d,d.exports,o),d.exports}o.d=(a,u)=>{for(var d in u)o.o(u,d)&&!o.o(a,d)&&Object.defineProperty(a,d,{enumerable:!0,get:u[d]})},o.o=(a,u)=>Object.prototype.hasOwnProperty.call(a,u);var s=o(721);return s})())})(Ta);var $f=Ta.exports;const Nf=If($f),ro={TASK_STATUS_UPDATED:"task:status:updated",TASK_INTERACTION_CREATED:"task:interaction:created",TASK_INTERACTION_ANSWERED:"task:interaction:answered",TASK_BROWSER_COMMAND_CREATED:"task:browser-command:created"};let pt=null,Un=null;async function Of(e){return Un||(Un=(async()=>{const t=e.backendUrl.replace(/\/+$/,""),n=await fetch(`${t}/api/settings`,{headers:{Authorization:`Bearer ${e.token}`}});if(!n.ok)throw new Error(`Failed to fetch settings: HTTP ${n.status}`);const r=await n.json();pt=new Nf(r.pusher.key,{cluster:r.pusher.cluster||"local",forceTLS:!0,wsHost:r.pusher.wsHost||void 0,wsPort:r.pusher.wssPort,wssPort:r.pusher.wssPort,enabledTransports:r.pusher.wsHost?["ws"]:void 0,channelAuthorization:{customHandler:({socketId:o,channelName:s},a)=>{fetch(`${t}/api/pusher/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({socket_id:o,channel_name:s})}).then(u=>u.json()).then(u=>a(null,u)).catch(u=>a(u instanceof Error?u:new Error(String(u)),null))}}})})(),Un.catch(()=>{Un=null}),Un)}function Df(e){if(!e||!pt)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return pt.connection.bind("state_change",n),()=>pt==null?void 0:pt.connection.unbind("state_change",n)}async function Mf(e,t,n){if(await Of(e),!pt)return()=>{};const r=pt.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(ro.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(ro.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(ro.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(ro.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=Df(n.onReconnect);return()=>{r.unbind_all(),pt==null||pt.unsubscribe(`private-task-${t}`),o==null||o()}}const hi="ap-sdk-active-automation";function Uf(){try{const e=sessionStorage.getItem(hi);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.taskId&&(t!=null&&t.backendUrl)&&(t!=null&&t.title)?t:null}catch{return null}}function Ea(e){try{sessionStorage.setItem(hi,JSON.stringify(e))}catch{}}function Aa(){try{sessionStorage.removeItem(hi)}catch{}}async function jf(e){var s;try{(s=e.focus)==null||s.call(e)}catch{}e.scrollIntoView({block:"center",inline:"center",behavior:"instant"});let t=e.getBoundingClientRect();t.width===0&&t.height===0&&(await Zf(),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 Zf(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const fi="shared",Ca="ap-sdk-panel-size:",Pa=280,Ra=200;function qf(e){try{const t=sessionStorage.getItem(Ca+e);if(!t)return null;const n=JSON.parse(t);return typeof(n==null?void 0:n.width)=="number"&&typeof(n==null?void 0:n.height)=="number"?n:null}catch{return null}}function Hf(e,t){try{sessionStorage.setItem(Ca+e,JSON.stringify(t))}catch{}}function oo(e,t,n){return Math.min(Math.max(e,t),n)}function La(){return window.innerWidth-32}function za(){return window.innerHeight-64}function gi(e,t){const n=qf(t);n&&(e.style.width=`${oo(n.width,Pa,La())}px`,e.style.height=`${oo(n.height,Ra,za())}px`);const r=document.createElement("div");r.className="ap-sdk-resize-handle",r.setAttribute("data-ap-sdk","1"),e.appendChild(r);let o=!1,s=0,a=0,u=0,d=0,p=0,h=0;const k=_=>{o&&(p=oo(u+(_.clientX-s),Pa,La()),h=oo(d+(_.clientY-a),Ra,za()),e.style.width=`${p}px`,e.style.height=`${h}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",m),Hf(t,{width:p,height:h}))};r.addEventListener("pointerdown",_=>{_.preventDefault(),_.stopPropagation(),o=!0,s=_.clientX,a=_.clientY;const w=e.getBoundingClientRect();u=w.width,d=w.height,p=u,h=d,document.addEventListener("pointermove",k),document.addEventListener("pointerup",m)})}function mi(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ln=mi();function Ia(e){ln=e}var un={exec:()=>null};function jn(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),o=t[r];return o||(o=e(r),t[r]=o),o}}function G(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(o,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(De.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var Ff=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),De={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:jn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:jn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:jn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:jn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:jn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:jn(e=>new RegExp(`^ {0,${e}}>`))},Bf=/^(?:[ \t]*(?:\n|$))+/,Gf=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Wf=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,pr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Jf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,bi=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,$a=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Na=G($a).replace(/bull/g,bi).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(),Xf=G($a).replace(/bull/g,bi).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(),ki=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Vf=/^[^\n]+/,_i=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Yf=G(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",_i).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Kf=G(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,bi).getRegex(),io="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",vi=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Qf=G("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",vi).replace("tag",io).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Oa=e=>G(ki).replace("hr",pr).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",io).getRegex(),eg=Oa(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),tg=Oa(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),ng=G(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",tg).getRegex(),yi={blockquote:ng,code:Gf,def:Yf,fences:Wf,heading:Jf,hr:pr,html:Qf,lheading:Na,list:Kf,newline:Bf,paragraph:eg,table:un,text:Vf},Da=G("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",pr).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",io).getRegex(),rg={...yi,lheading:Xf,table:Da,paragraph:G(ki).replace("hr",pr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Da).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",io).getRegex()},og={...yi,html:G(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",vi).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:un,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:G(ki).replace("hr",pr).replace("heading",` *#{1,6} *[^
|
|
1376
|
-
]`).replace("lheading",Na).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ig=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,sg=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ma=/^( {2,}|\\)\n(?!\s*$)/,ag=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
|
1377
|
-
`),n=t.length-1;for(;n>=0&&
|
|
1391
|
+
*/(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(a,u){var d=this&&this.__extends||function(){var P=function(T,x){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(R,D){R.__proto__=D}||function(R,D){for(var pe in D)D.hasOwnProperty(pe)&&(R[pe]=D[pe])},P(T,x)};return function(T,x){P(T,x);function R(){this.constructor=T}T.prototype=x===null?Object.create(x):(R.prototype=x.prototype,new R)}}();Object.defineProperty(u,"__esModule",{value:!0});var h=256,p=function(){function P(T){T===void 0&&(T="="),this._paddingCharacter=T}return P.prototype.encodedLength=function(T){return this._paddingCharacter?(T+2)/3*4|0:(T*8+5)/6|0},P.prototype.encode=function(T){for(var x="",R=0;R<T.length-2;R+=3){var D=T[R]<<16|T[R+1]<<8|T[R+2];x+=this._encodeByte(D>>>3*6&63),x+=this._encodeByte(D>>>2*6&63),x+=this._encodeByte(D>>>1*6&63),x+=this._encodeByte(D>>>0*6&63)}var pe=T.length-R;if(pe>0){var D=T[R]<<16|(pe===2?T[R+1]<<8:0);x+=this._encodeByte(D>>>3*6&63),x+=this._encodeByte(D>>>2*6&63),pe===2?x+=this._encodeByte(D>>>1*6&63):x+=this._paddingCharacter||"",x+=this._paddingCharacter||""}return x},P.prototype.maxDecodedLength=function(T){return this._paddingCharacter?T/4*3|0:(T*6+7)/8|0},P.prototype.decodedLength=function(T){return this.maxDecodedLength(T.length-this._getPaddingLength(T))},P.prototype.decode=function(T){if(T.length===0)return new Uint8Array(0);for(var x=this._getPaddingLength(T),R=T.length-x,D=new Uint8Array(this.maxDecodedLength(R)),pe=0,_e=0,Ce=0,Ve=0,V=0,Pe=0,Ze=0;_e<R-4;_e+=4)Ve=this._decodeChar(T.charCodeAt(_e+0)),V=this._decodeChar(T.charCodeAt(_e+1)),Pe=this._decodeChar(T.charCodeAt(_e+2)),Ze=this._decodeChar(T.charCodeAt(_e+3)),D[pe++]=Ve<<2|V>>>4,D[pe++]=V<<4|Pe>>>2,D[pe++]=Pe<<6|Ze,Ce|=Ve&h,Ce|=V&h,Ce|=Pe&h,Ce|=Ze&h;if(_e<R-1&&(Ve=this._decodeChar(T.charCodeAt(_e)),V=this._decodeChar(T.charCodeAt(_e+1)),D[pe++]=Ve<<2|V>>>4,Ce|=Ve&h,Ce|=V&h),_e<R-2&&(Pe=this._decodeChar(T.charCodeAt(_e+2)),D[pe++]=V<<4|Pe>>>2,Ce|=Pe&h),_e<R-3&&(Ze=this._decodeChar(T.charCodeAt(_e+3)),D[pe++]=Pe<<6|Ze,Ce|=Ze&h),Ce!==0)throw new Error("Base64Coder: incorrect characters for decoding");return D},P.prototype._encodeByte=function(T){var x=T;return x+=65,x+=25-T>>>8&6,x+=51-T>>>8&-75,x+=61-T>>>8&-15,x+=62-T>>>8&3,String.fromCharCode(x)},P.prototype._decodeChar=function(T){var x=h;return x+=(42-T&T-44)>>>8&-h+T-43+62,x+=(46-T&T-48)>>>8&-h+T-47+63,x+=(47-T&T-58)>>>8&-h+T-48+52,x+=(64-T&T-91)>>>8&-h+T-65+0,x+=(96-T&T-123)>>>8&-h+T-97+26,x},P.prototype._getPaddingLength=function(T){var x=0;if(this._paddingCharacter){for(var R=T.length-1;R>=0&&T[R]===this._paddingCharacter;R--)x++;if(T.length<4||x>2)throw new Error("Base64Coder: incorrect padding")}return x},P}();u.Coder=p;var b=new p;function m(P){return b.encode(P)}u.encode=m;function _(P){return b.decode(P)}u.decode=_;var w=function(P){d(T,P);function T(){return P!==null&&P.apply(this,arguments)||this}return T.prototype._encodeByte=function(x){var R=x;return R+=65,R+=25-x>>>8&6,R+=51-x>>>8&-75,R+=61-x>>>8&-13,R+=62-x>>>8&49,String.fromCharCode(R)},T.prototype._decodeChar=function(x){var R=h;return R+=(44-x&x-46)>>>8&-h+x-45+62,R+=(94-x&x-96)>>>8&-h+x-95+63,R+=(47-x&x-58)>>>8&-h+x-48+52,R+=(64-x&x-91)>>>8&-h+x-65+0,R+=(96-x&x-123)>>>8&-h+x-97+26,R},T}(p);u.URLSafeCoder=w;var C=new w;function M(P){return C.encode(P)}u.encodeURLSafe=M;function W(P){return C.decode(P)}u.decodeURLSafe=W,u.encodedLength=function(P){return b.encodedLength(P)},u.maxDecodedLength=function(P){return b.maxDecodedLength(P)},u.decodedLength=function(P){return b.decodedLength(P)}},978(a,u){var d="utf8: invalid source encoding";function h(p){for(var b=[],m=0;m<p.length;m++){var _=p[m];if(_&128){var w=void 0;if(_<224){if(m>=p.length)throw new Error(d);var C=p[++m];if((C&192)!==128)throw new Error(d);_=(_&31)<<6|C&63,w=128}else if(_<240){if(m>=p.length-1)throw new Error(d);var C=p[++m],M=p[++m];if((C&192)!==128||(M&192)!==128)throw new Error(d);_=(_&15)<<12|(C&63)<<6|M&63,w=2048}else if(_<248){if(m>=p.length-2)throw new Error(d);var C=p[++m],M=p[++m],W=p[++m];if((C&192)!==128||(M&192)!==128||(W&192)!==128)throw new Error(d);_=(_&15)<<18|(C&63)<<12|(M&63)<<6|W&63,w=65536}else throw new Error(d);if(_<w||_>=55296&&_<=57343)throw new Error(d);if(_>=65536){if(_>1114111)throw new Error(d);_-=65536,b.push(String.fromCharCode(55296|_>>10)),_=56320|_&1023}}b.push(String.fromCharCode(_))}return b.join("")}u.D4=h},721(a,u,d){a.exports=d(207).default},207(a,u,d){d.d(u,{default:()=>Vo});class h{constructor(i,c){this.lastId=0,this.prefix=i,this.name=c}create(i){this.lastId++;var c=this.lastId,f=this.prefix+c,g=this.name+"["+c+"]",y=!1,E=function(){y||(i.apply(null,arguments),y=!0)};return this[c]=E,{number:c,id:f,name:g,callback:E}}remove(i){delete this[i.number]}}var p=new h("_pusher_script_","Pusher.ScriptReceivers"),b={VERSION:"8.5.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""};const m=b;class _{constructor(i){this.options=i,this.receivers=i.receivers||p,this.loading={}}load(i,c,f){var g=this;if(g.loading[i]&&g.loading[i].length>0)g.loading[i].push(f);else{g.loading[i]=[f];var y=F.createScriptRequest(g.getPath(i,c)),E=g.receivers.create(function($){if(g.receivers.remove(E),g.loading[i]){var H=g.loading[i];delete g.loading[i];for(var X=function(Ee){Ee||y.cleanup()},te=0;te<H.length;te++)H[te]($,X)}});y.send(E)}}getRoot(i){var c,f=F.getDocument().location.protocol;return i&&i.useTLS||f==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(i,c){return this.getRoot(c)+"/"+i+this.options.suffix+".js"}}var w=new h("_pusher_dependencies","Pusher.DependenciesReceivers"),C=new _({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:w});const M={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"}}},P={buildLogSuffix:function(l){const i="See:",c=M.urls[l];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=M.baseUrl+c.path),f?`${i} ${f}`:""}};var T;(function(l){l.UserAuthentication="user-authentication",l.ChannelAuthorization="channel-authorization"})(T||(T={}));class x extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class R extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class D extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class pe extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class _e extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class Ce extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class Ve extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class V extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class Pe extends Error{constructor(i,c){super(c),this.status=i,Object.setPrototypeOf(this,new.target.prototype)}}const kt=function(l,i,c,f,g){const y=F.createXHR();y.open("POST",c.endpoint,!0),y.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var E in c.headers)y.setRequestHeader(E,c.headers[E]);if(c.headersProvider!=null){let $=c.headersProvider();for(var E in $)y.setRequestHeader(E,$[E])}return y.onreadystatechange=function(){if(y.readyState===4)if(y.status===200){let $,H=!1;try{$=JSON.parse(y.responseText),H=!0}catch{g(new Pe(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${y.responseText}`),null)}H&&g(null,$)}else{let $="";switch(f){case T.UserAuthentication:$=P.buildLogSuffix("authenticationEndpoint");break;case T.ChannelAuthorization:$=`Clients must be authorized to join private or presence channels. ${P.buildLogSuffix("authorizationEndpoint")}`;break}g(new Pe(y.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${y.status} from ${c.endpoint}. ${$}`),null)}},y.send(i),y};function rn(l){return J(Q(l))}var rt=String.fromCharCode,Zt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Z=function(l){var i=l.charCodeAt(0);return i<128?l:i<2048?rt(192|i>>>6)+rt(128|i&63):rt(224|i>>>12&15)+rt(128|i>>>6&63)+rt(128|i&63)},Q=function(l){return l.replace(/[^\x00-\x7F]/g,Z)},De=function(l){var i=[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=[Zt.charAt(c>>>18),Zt.charAt(c>>>12&63),i>=2?"=":Zt.charAt(c>>>6&63),i>=1?"=":Zt.charAt(c&63)];return f.join("")},J=window.btoa||function(l){return l.replace(/[\s\S]{1,3}/g,De)};class _t{constructor(i,c,f,g){this.clear=c,this.timer=i(()=>{this.timer&&(this.timer=g(this.timer))},f)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const oe=_t;function xn(l){window.clearTimeout(l)}function ce(l){window.clearInterval(l)}class ie extends oe{constructor(i,c){super(setTimeout,xn,i,function(f){return c(),null})}}class Re extends oe{constructor(i,c){super(setInterval,ce,i,function(f){return c(),f})}}var Le={now(){return Date.now?Date.now():new Date().valueOf()},defer(l){return new ie(0,l)},method(l,...i){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[l].apply(f,c.concat(arguments))}}};const ee=Le;function Te(l,...i){for(var c=0;c<i.length;c++){var f=i[c];for(var g in f)f[g]&&f[g].constructor&&f[g].constructor===Object?l[g]=Te(l[g]||{},f[g]):l[g]=f[g]}return l}function tt(){for(var l=["Pusher"],i=0;i<arguments.length;i++)typeof arguments[i]=="string"?l.push(arguments[i]):l.push(Ye(arguments[i]));return l.join(" : ")}function lt(l,i){var c=Array.prototype.indexOf;if(l===null)return-1;if(c&&l.indexOf===c)return l.indexOf(i);for(var f=0,g=l.length;f<g;f++)if(l[f]===i)return f;return-1}function ze(l,i){for(var c in l)Object.prototype.hasOwnProperty.call(l,c)&&i(l[c],c,l)}function ut(l){var i=[];return ze(l,function(c,f){i.push(f)}),i}function qt(l){var i=[];return ze(l,function(c){i.push(c)}),i}function Ht(l,i,c){for(var f=0;f<l.length;f++)i.call(c||window,l[f],f,l)}function nr(l,i){for(var c=[],f=0;f<l.length;f++)c.push(i(l[f],f,l,c));return c}function on(l,i){var c={};return ze(l,function(f,g){c[g]=i(f)}),c}function Sn(l,i){i=i||function(g){return!!g};for(var c=[],f=0;f<l.length;f++)i(l[f],f,l,c)&&c.push(l[f]);return c}function Tn(l,i){var c={};return ze(l,function(f,g){(i&&i(f,g,l,c)||f)&&(c[g]=f)}),c}function Oo(l){var i=[];return ze(l,function(c,f){i.push([f,c])}),i}function Lr(l,i){for(var c=0;c<l.length;c++)if(i(l[c],c,l))return!0;return!1}function Yi(l,i){for(var c=0;c<l.length;c++)if(!i(l[c],c,l))return!1;return!0}function zr(l){return on(l,function(i){return typeof i=="object"&&(i=Ye(i)),encodeURIComponent(rn(i.toString()))})}function En(l){var i=Tn(l,function(f){return f!==void 0}),c=nr(Oo(zr(i)),ee.method("join","=")).join("&");return c}function sn(l){var i=[],c=[];return function f(g,y){var E,$,H;switch(typeof g){case"object":if(!g)return null;for(E=0;E<i.length;E+=1)if(i[E]===g)return{$ref:c[E]};if(i.push(g),c.push(y),Object.prototype.toString.apply(g)==="[object Array]")for(H=[],E=0;E<g.length;E+=1)H[E]=f(g[E],y+"["+E+"]");else{H={};for($ in g)Object.prototype.hasOwnProperty.call(g,$)&&(H[$]=f(g[$],y+"["+JSON.stringify($)+"]"))}return H;case"number":case"string":case"boolean":return g}}(l,"$")}function Ye(l){try{return JSON.stringify(l)}catch{return JSON.stringify(sn(l))}}class Ir{constructor(){this.globalLog=i=>{window.console&&window.console.log&&window.console.log(i)}}debug(...i){this.log(this.globalLog,i)}warn(...i){this.log(this.globalLogWarn,i)}error(...i){this.log(this.globalLogError,i)}globalLogWarn(i){window.console&&window.console.warn?window.console.warn(i):this.globalLog(i)}globalLogError(i){window.console&&window.console.error?window.console.error(i):this.globalLogWarn(i)}log(i,...c){var f=tt.apply(this,arguments);Vo.log?Vo.log(f):Vo.logToConsole&&i.bind(this)(f)}}const le=new Ir;var Do=function(l,i,c,f,g){(c.headers!==void 0||c.headersProvider!=null)&&le.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var y=l.nextAuthCallbackID.toString();l.nextAuthCallbackID++;var E=l.getDocument(),$=E.createElement("script");l.auth_callbacks[y]=function(te){g(null,te)};var H="Pusher.auth_callbacks['"+y+"']";$.src=c.endpoint+"?callback="+encodeURIComponent(H)+"&"+i;var X=E.getElementsByTagName("head")[0]||E.documentElement;X.insertBefore($,X.firstChild)};const $r=Do;class Mo{constructor(i){this.src=i}send(i){var c=this,f="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=i.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){i.callback(f)},c.script.onload=function(){i.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&i.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=i.id+"_error",c.errorScript.text=i.name+"('"+f+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var g=document.getElementsByTagName("head")[0];g.insertBefore(c.script,g.firstChild),c.errorScript&&g.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 rr{constructor(i,c){this.url=i,this.data=c}send(i){if(!this.request){var c=En(this.data),f=this.url+"/"+i.number+"?"+c;this.request=F.createScriptRequest(f),this.request.send(i)}}cleanup(){this.request&&this.request.cleanup()}}var or=function(l,i){return function(c,f){var g="http"+(i?"s":"")+"://",y=g+(l.host||l.options.host)+l.options.path,E=F.createJSONPRequest(y,c),$=F.ScriptReceivers.create(function(H,X){p.remove($),E.cleanup(),X&&X.host&&(l.host=X.host),f&&f(H,X)});E.send($)}},vt={name:"jsonp",getAgent:or};const an=vt;function An(l,i,c){var f=l+(i.useTLS?"s":""),g=i.useTLS?i.hostTLS:i.hostNonTLS;return f+"://"+g+c}function Cn(l,i){var c="/app/"+l,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(i?"&"+i:"");return c+f}var Ki={getInitial:function(l,i){var c=(i.httpPath||"")+Cn(l,"flash=false");return An("ws",i,c)}},ir={getInitial:function(l,i){var c=(i.httpPath||"/pusher")+Cn(l);return An("http",i,c)}},sr={getInitial:function(l,i){return An("http",i,i.httpPath||"/pusher")},getPath:function(l,i){return Cn(l)}};class Qi{constructor(){this._callbacks={}}get(i){return this._callbacks[Ft(i)]}add(i,c,f){var g=Ft(i);this._callbacks[g]=this._callbacks[g]||[],this._callbacks[g].push({fn:c,context:f})}remove(i,c,f){if(!i&&!c&&!f){this._callbacks={};return}var g=i?[Ft(i)]:ut(this._callbacks);c||f?this.removeCallback(g,c,f):this.removeAllCallbacks(g)}removeCallback(i,c,f){Ht(i,function(g){this._callbacks[g]=Sn(this._callbacks[g]||[],function(y){return c&&c!==y.fn||f&&f!==y.context}),this._callbacks[g].length===0&&delete this._callbacks[g]},this)}removeAllCallbacks(i){Ht(i,function(c){delete this._callbacks[c]},this)}}function Ft(l){return"_"+l}class yt{constructor(i){this.callbacks=new Qi,this.global_callbacks=[],this.failThrough=i}bind(i,c,f){return this.callbacks.add(i,c,f),this}bind_global(i){return this.global_callbacks.push(i),this}unbind(i,c,f){return this.callbacks.remove(i,c,f),this}unbind_global(i){return i?(this.global_callbacks=Sn(this.global_callbacks||[],c=>c!==i),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(i,c,f){for(var g=0;g<this.global_callbacks.length;g++)this.global_callbacks[g](i,c);var y=this.callbacks.get(i),E=[];if(f?E.push(c,f):c&&E.push(c),y&&y.length>0)for(var g=0;g<y.length;g++)y[g].fn.apply(y[g].context||window,E);else this.failThrough&&this.failThrough(i,c);return this}}class es extends yt{constructor(i,c,f,g,y){super(),this.initialize=F.transportConnectionInitializer,this.hooks=i,this.name=c,this.priority=f,this.key=g,this.options=y,this.state="new",this.timeline=y.timeline,this.activityTimeout=y.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var i=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(i,this.options)}catch(c){return ee.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),le.debug("Connecting",{transport:this.name,url:i}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(i){return this.state==="open"?(ee.defer(()=>{this.socket&&this.socket.send(i)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(i){this.emit("error",{type:"WebSocketError",error:i}),this.timeline.error(this.buildTimelineMessage({error:i.toString()}))}onClose(i){i?this.changeState("closed",{code:i.code,reason:i.reason,wasClean:i.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(i){this.emit("message",i)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=i=>{this.onError(i)},this.socket.onclose=i=>{this.onClose(i)},this.socket.onmessage=i=>{this.onMessage(i)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(i,c){this.state=i,this.timeline.info(this.buildTimelineMessage({state:i,params:c})),this.emit(i,c)}buildTimelineMessage(i){return Te({cid:this.id},i)}}class ue{constructor(i){this.hooks=i}isSupported(i){return this.hooks.isSupported(i)}createConnection(i,c,f,g){return new es(this.hooks,i,c,f,g)}}var cn=new ue({urls:Ki,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!F.getWebSocketAPI()},isSupported:function(){return!!F.getWebSocketAPI()},getSocket:function(l){return F.createWebSocket(l)}}),Uo={urls:ir,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Nr=Te({getSocket:function(l){return F.HTTPFactory.createStreamingSocket(l)}},Uo),ar=Te({getSocket:function(l){return F.HTTPFactory.createPollingSocket(l)}},Uo),Or={isSupported:function(){return F.isXHRSupported()}},jo=new ue(Te({},Nr,Or)),ts=new ue(Te({},ar,Or)),dt={ws:cn,xhr_streaming:jo,xhr_polling:ts};const pt=dt;var Zo=new ue({file:"sockjs",urls:sr,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(l,i){return new window.SockJS(l,null,{js_path:C.getPath("sockjs",{useTLS:i.useTLS}),ignore_null_origin:i.ignoreNullOrigin})},beforeOpen:function(l,i){l.send(JSON.stringify({path:i}))}}),Dr={isSupported:function(l){var i=F.isXDRSupported(l.useTLS);return i}},Mr=new ue(Te({},Nr,Dr)),qo=new ue(Te({},ar,Dr));pt.xdr_streaming=Mr,pt.xdr_polling=qo,pt.sockjs=Zo;const wt=pt;class Ho extends yt{constructor(){super();var i=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){i.emit("online")},!1),window.addEventListener("offline",function(){i.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Fo=new Ho;class Bo{constructor(i,c,f){this.manager=i,this.transport=c,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(i,c,f,g){g=Te({},g,{activityTimeout:this.pingDelay});var y=this.transport.createConnection(i,c,f,g),E=null,$=function(){y.unbind("open",$),y.bind("closed",H),E=ee.now()},H=X=>{if(y.unbind("closed",H),X.code===1002||X.code===1003)this.manager.reportDeath();else if(!X.wasClean&&E){var te=ee.now()-E;te<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(te/2,this.minPingDelay))}};return y.bind("open",$),y}isSupported(i){return this.manager.isAlive()&&this.transport.isSupported(i)}}const Ur={decodeMessage:function(l){try{var i=JSON.parse(l.data),c=i.data;if(typeof c=="string")try{c=JSON.parse(i.data)}catch{}var f={event:i.event,channel:i.channel,data:c};return i.user_id&&(f.user_id=i.user_id),f}catch(g){throw{type:"MessageParseError",error:g,data:l.data}}},encodeMessage:function(l){return JSON.stringify(l)},processHandshake:function(l){var i=Ur.decodeMessage(l);if(i.event==="pusher:connection_established"){if(!i.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:i.data.socket_id,activityTimeout:i.data.activity_timeout*1e3}}else{if(i.event==="pusher:error")return{action:this.getCloseAction(i.data),error:this.getCloseError(i.data)};throw"Invalid handshake"}},getCloseAction:function(l){return l.code<4e3?l.code>=1002&&l.code<=1004?"backoff":null:l.code===4e3?"tls_only":l.code<4100?"refused":l.code<4200?"backoff":l.code<4300?"retry":"refused"},getCloseError:function(l){return l.code!==1e3&&l.code!==1001?{type:"PusherError",data:{code:l.code,message:l.reason||l.message}}:null}},Bt=Ur;class O extends yt{constructor(i,c){super(),this.id=i,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(i){return this.transport.send(i)}send_event(i,c,f){var g={event:i,data:c};return f&&(g.channel=f),le.debug("Event sent",g),this.send(Bt.encodeMessage(g))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var i={message:f=>{var g;try{g=Bt.decodeMessage(f)}catch(y){this.emit("error",{type:"MessageParseError",error:y,data:f.data})}if(g!==void 0){switch(le.debug("Event recd",g),g.event){case"pusher:error":this.emit("error",{type:"PusherError",data:g.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",g)}},activity:()=>{this.emit("activity")},error:f=>{this.emit("error",f)},closed:f=>{c(),f&&f.code&&this.handleCloseEvent(f),this.transport=null,this.emit("closed")}},c=()=>{ze(i,(f,g)=>{this.transport.unbind(g,f)})};ze(i,(f,g)=>{this.transport.bind(g,f)})}handleCloseEvent(i){var c=Bt.getCloseAction(i),f=Bt.getCloseError(i);f&&this.emit("error",f),c&&this.emit(c,{action:c,error:f})}}class k{constructor(i,c){this.transport=i,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=i=>{this.unbindListeners();var c;try{c=Bt.processHandshake(i)}catch(f){this.finish("error",{error:f}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new O(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=i=>{this.unbindListeners();var c=Bt.getCloseAction(i)||"backoff",f=Bt.getCloseError(i);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(i,c){this.callback(Te({transport:this.transport,action:i},c))}}class S{constructor(i,c){this.timeline=i,this.options=c||{}}send(i,c){this.timeline.isEmpty()||this.timeline.send(F.TimelineTransport.getAgent(this,i),c)}}class L extends yt{constructor(i,c){super(function(f,g){le.debug("No callbacks on "+i+" for "+f)}),this.name=i,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(i,c){return c(null,{auth:""})}trigger(i,c){if(i.indexOf("client-")!==0)throw new x("Event '"+i+"' does not start with 'client-'");if(!this.subscribed){var f=P.buildLogSuffix("triggeringClientEvents");le.warn(`Client event triggered before channel 'subscription_succeeded' event . ${f}`)}return this.pusher.send_event(i,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(i){var c=i.event,f=i.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(i);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(i);else if(c.indexOf("pusher_internal:")!==0){var g={};this.emit(c,f,g)}}handleSubscriptionSucceededEvent(i){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",i.data)}handleSubscriptionCountEvent(i){i.data.subscription_count&&(this.subscriptionCount=i.data.subscription_count),this.emit("pusher:subscription_count",i.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(i,c)=>{i?(this.subscriptionPending=!1,le.error(i.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:i.message},i instanceof Pe?{status:i.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:c.auth,channel_data:c.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class se extends L{authorize(i,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:i},c)}}class $e{constructor(){this.reset()}get(i){return Object.prototype.hasOwnProperty.call(this.members,i)?{id:i,info:this.members[i]}:null}each(i){ze(this.members,(c,f)=>{i(this.get(f))})}setMyID(i){this.myID=i}onSubscription(i){this.members=i.presence.hash,this.count=i.presence.count,this.me=this.get(this.myID)}addMember(i){return this.get(i.user_id)===null&&this.count++,this.members[i.user_id]=i.user_info,this.get(i.user_id)}removeMember(i){var c=this.get(i.user_id);return c&&(delete this.members[i.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var ve=function(l,i,c,f){function g(y){return y instanceof c?y:new c(function(E){E(y)})}return new(c||(c=Promise))(function(y,E){function $(te){try{X(f.next(te))}catch(Ee){E(Ee)}}function H(te){try{X(f.throw(te))}catch(Ee){E(Ee)}}function X(te){te.done?y(te.value):g(te.value).then($,H)}X((f=f.apply(l,i||[])).next())})};class qe extends se{constructor(i,c){super(i,c),this.members=new $e}authorize(i,c){super.authorize(i,(f,g)=>ve(this,void 0,void 0,function*(){if(!f)if(g=g,g.channel_data!=null){var y=JSON.parse(g.channel_data);this.members.setMyID(y.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let E=P.buildLogSuffix("authorizationEndpoint");le.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${E}, or the user should be signed in.`),c("Invalid auth response");return}c(f,g)}))}handleEvent(i){var c=i.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(i);else{var f=i.data,g={};i.user_id&&(g.user_id=i.user_id),this.emit(c,f,g)}}handleInternalEvent(i){var c=i.event,f=i.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(i);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(i);break;case"pusher_internal:member_added":var g=this.members.addMember(f);this.emit("pusher:member_added",g);break;case"pusher_internal:member_removed":var y=this.members.removeMember(f);y&&this.emit("pusher:member_removed",y);break}}handleSubscriptionSucceededEvent(i){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(i.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var xt=d(978),zt=d(594);class jr extends se{constructor(i,c,f){super(i,c),this.key=null,this.nacl=f}authorize(i,c){super.authorize(i,(f,g)=>{if(f){c(f,g);return}let y=g.shared_secret;if(!y){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,zt.decode)(y),delete g.shared_secret,c(null,g)})}trigger(i,c){throw new Ce("Client events are not currently supported for encrypted channels")}handleEvent(i){var c=i.event,f=i.data;if(c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0){super.handleEvent(i);return}this.handleEncryptedEvent(c,f)}handleEncryptedEvent(i,c){if(!this.key){le.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){le.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let f=(0,zt.decode)(c.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){le.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let g=(0,zt.decode)(c.nonce);if(g.length<this.nacl.secretbox.nonceLength){le.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${g.length}`);return}let y=this.nacl.secretbox.open(f,g,this.key);if(y===null){le.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(E,$)=>{if(E){le.error(`Failed to make a request to the authEndpoint: ${$}. Unable to fetch new key, so dropping encrypted event`);return}if(y=this.nacl.secretbox.open(f,g,this.key),y===null){le.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(i,this.getDataToEmit(y))});return}this.emit(i,this.getDataToEmit(y))}getDataToEmit(i){let c=(0,xt.D4)(i);try{return JSON.parse(c)}catch{return c}}}class Ie extends yt{constructor(i,c){super(),this.state="initialized",this.connection=null,this.key=i,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=F.getNetwork();f.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),f.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(i){this.key=i,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(i){return this.connection?this.connection.send(i):!1}send_event(i,c,f){return this.connection?this.connection.send_event(i,c,f):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var i=(c,f)=>{c?this.runner=this.strategy.connect(0,i):f.action==="error"?(this.emit("error",{type:"HandshakeError",error:f.error}),this.timeline.error({handshakeError:f.error})):(this.abortConnecting(),this.handshakeCallbacks[f.action](f))};this.runner=this.strategy.connect(0,i)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var i=this.abandonConnection();i.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(i){this.timeline.info({action:"retry",delay:i}),i>0&&this.emit("connecting_in",Math.round(i/1e3)),this.retryTimer=new ie(i||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new ie(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new ie(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 ie(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(i){return Te({},i,{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(i){return Te({},i,{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 i=c=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),c(f)};return{tls_only:i(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:i(()=>{this.disconnect()}),backoff:i(()=>{this.retryIn(1e3)}),retry:i(()=>{this.retryIn(0)})}}setConnection(i){this.connection=i;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var i in this.connectionCallbacks)this.connection.unbind(i,this.connectionCallbacks[i]);var c=this.connection;return this.connection=null,c}}updateState(i,c){var f=this.state;if(this.state=i,f!==i){var g=i;g==="connected"&&(g+=" with new socket ID "+c.socket_id),le.debug("State changed",f+" -> "+g),this.timeline.info({state:i,params:c}),this.emit("state_change",{previous:f,current:i}),this.emit(i,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class Go{constructor(){this.channels={}}add(i,c){return this.channels[i]||(this.channels[i]=Wo(i,c)),this.channels[i]}all(){return qt(this.channels)}find(i){return this.channels[i]}remove(i){var c=this.channels[i];return delete this.channels[i],c}disconnect(){ze(this.channels,function(i){i.disconnect()})}}function Wo(l,i){if(l.indexOf("private-encrypted-")===0){if(i.config.nacl)return Gt.createEncryptedChannel(l,i,i.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=P.buildLogSuffix("encryptedChannelSupport");throw new Ce(`${c}. ${f}`)}else{if(l.indexOf("private-")===0)return Gt.createPrivateChannel(l,i);if(l.indexOf("presence-")===0)return Gt.createPresenceChannel(l,i);if(l.indexOf("#")===0)throw new R('Cannot create a channel with name "'+l+'".');return Gt.createChannel(l,i)}}var _b={createChannels(){return new Go},createConnectionManager(l,i){return new Ie(l,i)},createChannel(l,i){return new L(l,i)},createPrivateChannel(l,i){return new se(l,i)},createPresenceChannel(l,i){return new qe(l,i)},createEncryptedChannel(l,i,c){return new jr(l,i,c)},createTimelineSender(l,i){return new S(l,i)},createHandshake(l,i){return new k(l,i)},createAssistantToTheTransportManager(l,i,c){return new Bo(l,i,c)}};const Gt=_b;class Yc{constructor(i){this.options=i||{},this.livesLeft=this.options.lives||1/0}getAssistant(i){return Gt.createAssistantToTheTransportManager(this,i,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Pn{constructor(i,c){this.strategies=i,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return Lr(this.strategies,ee.method("isSupported"))}connect(i,c){var f=this.strategies,g=0,y=this.timeout,E=null,$=(H,X)=>{X?c(null,X):(g=g+1,this.loop&&(g=g%f.length),g<f.length?(y&&(y=y*2,this.timeoutLimit&&(y=Math.min(y,this.timeoutLimit))),E=this.tryStrategy(f[g],i,{timeout:y,failFast:this.failFast},$)):c(!0))};return E=this.tryStrategy(f[g],i,{timeout:y,failFast:this.failFast},$),{abort:function(){E.abort()},forceMinPriority:function(H){i=H,E&&E.forceMinPriority(H)}}}tryStrategy(i,c,f,g){var y=null,E=null;return f.timeout>0&&(y=new ie(f.timeout,function(){E.abort(),g(!0)})),E=i.connect(c,function($,H){$&&y&&y.isRunning()&&!f.failFast||(y&&y.ensureAborted(),g($,H))}),{abort:function(){y&&y.ensureAborted(),E.abort()},forceMinPriority:function($){E.forceMinPriority($)}}}}class ns{constructor(i){this.strategies=i}isSupported(){return Lr(this.strategies,ee.method("isSupported"))}connect(i,c){return vb(this.strategies,i,function(f,g){return function(y,E){if(g[f].error=y,y){yb(g)&&c(!0);return}Ht(g,function($){$.forceMinPriority(E.transport.priority)}),c(null,E)}})}}function vb(l,i,c){var f=nr(l,function(g,y,E,$){return g.connect(i,c(y,$))});return{abort:function(){Ht(f,wb)},forceMinPriority:function(g){Ht(f,function(y){y.forceMinPriority(g)})}}}function yb(l){return Yi(l,function(i){return!!i.error})}function wb(l){!l.error&&!l.aborted&&(l.abort(),l.aborted=!0)}class xb{constructor(i,c,f){this.strategy=i,this.transports=c,this.ttl=f.ttl||18e5,this.usingTLS=f.useTLS,this.timeline=f.timeline}isSupported(){return this.strategy.isSupported()}connect(i,c){var f=this.usingTLS,g=Sb(f),y=g&&g.cacheSkipCount?g.cacheSkipCount:0,E=[this.strategy];if(g&&g.timestamp+this.ttl>=ee.now()){var $=this.transports[g.transport];$&&(["ws","wss"].includes(g.transport)||y>3?(this.timeline.info({cached:!0,transport:g.transport,latency:g.latency}),E.push(new Pn([$],{timeout:g.latency*2+1e3,failFast:!0}))):y++)}var H=ee.now(),X=E.pop().connect(i,function te(Ee,Yo){Ee?(Kc(f),E.length>0?(H=ee.now(),X=E.pop().connect(i,te)):c(Ee)):(Tb(f,Yo.transport.name,ee.now()-H,y),c(null,Yo))});return{abort:function(){X.abort()},forceMinPriority:function(te){i=te,X&&X.forceMinPriority(te)}}}}function rs(l){return"pusherTransport"+(l?"TLS":"NonTLS")}function Sb(l){var i=F.getLocalStorage();if(i)try{var c=i[rs(l)];if(c)return JSON.parse(c)}catch{Kc(l)}return null}function Tb(l,i,c,f){var g=F.getLocalStorage();if(g)try{g[rs(l)]=Ye({timestamp:ee.now(),transport:i,latency:c,cacheSkipCount:f})}catch{}}function Kc(l){var i=F.getLocalStorage();if(i)try{delete i[rs(l)]}catch{}}class Jo{constructor(i,{delay:c}){this.strategy=i,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(i,c){var f=this.strategy,g,y=new ie(this.options.delay,function(){g=f.connect(i,c)});return{abort:function(){y.ensureAborted(),g&&g.abort()},forceMinPriority:function(E){i=E,g&&g.forceMinPriority(E)}}}}class Zr{constructor(i,c,f){this.test=i,this.trueBranch=c,this.falseBranch=f}isSupported(){var i=this.test()?this.trueBranch:this.falseBranch;return i.isSupported()}connect(i,c){var f=this.test()?this.trueBranch:this.falseBranch;return f.connect(i,c)}}class Eb{constructor(i){this.strategy=i}isSupported(){return this.strategy.isSupported()}connect(i,c){var f=this.strategy.connect(i,function(g,y){y&&f.abort(),c(g,y)});return f}}function qr(l){return function(){return l.isSupported()}}var Ab=function(l,i,c){var f={};function g(dl,Sk,Tk,Ek,Ak){var pl=c(l,dl,Sk,Tk,Ek,Ak);return f[dl]=pl,pl}var y=Object.assign({},i,{hostNonTLS:l.wsHost+":"+l.wsPort,hostTLS:l.wsHost+":"+l.wssPort,httpPath:l.wsPath}),E=Object.assign({},y,{useTLS:!0}),$=Object.assign({},i,{hostNonTLS:l.httpHost+":"+l.httpPort,hostTLS:l.httpHost+":"+l.httpsPort,httpPath:l.httpPath}),H={loop:!0,timeout:15e3,timeoutLimit:6e4},X=new Yc({minPingDelay:1e4,maxPingDelay:l.activityTimeout}),te=new Yc({lives:2,minPingDelay:1e4,maxPingDelay:l.activityTimeout}),Ee=g("ws","ws",3,y,X),Yo=g("wss","ws",3,E,X),_k=g("sockjs","sockjs",1,$),il=g("xhr_streaming","xhr_streaming",1,$,te),vk=g("xdr_streaming","xdr_streaming",1,$,te),sl=g("xhr_polling","xhr_polling",1,$),yk=g("xdr_polling","xdr_polling",1,$),al=new Pn([Ee],H),wk=new Pn([Yo],H),xk=new Pn([_k],H),cl=new Pn([new Zr(qr(il),il,vk)],H),ll=new Pn([new Zr(qr(sl),sl,yk)],H),ul=new Pn([new Zr(qr(cl),new ns([cl,new Jo(ll,{delay:4e3})]),ll)],H),ss=new Zr(qr(ul),ul,xk),as;return i.useTLS?as=new ns([al,new Jo(ss,{delay:2e3})]):as=new ns([al,new Jo(wk,{delay:2e3}),new Jo(ss,{delay:5e3})]),new xb(new Eb(new Zr(qr(Ee),as,ss)),f,{ttl:18e5,timeline:i.timeline,useTLS:i.useTLS})};const Cb=Ab;function Pb(){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"),C.load(l.hooks.file,{useTLS:l.options.useTLS},function(i,c){l.hooks.isInitialized()?(l.changeState("initialized"),c(!0)):(i&&l.onError(i),l.onClose(),c(!1))})):l.onClose()}var Rb={getRequest:function(l){var i=new window.XDomainRequest;return i.ontimeout=function(){l.emit("error",new D),l.close()},i.onerror=function(c){l.emit("error",c),l.close()},i.onprogress=function(){i.responseText&&i.responseText.length>0&&l.onChunk(200,i.responseText)},i.onload=function(){i.responseText&&i.responseText.length>0&&l.onChunk(200,i.responseText),l.emit("finished",200),l.close()},i},abortRequest:function(l){l.ontimeout=l.onerror=l.onprogress=l.onload=null,l.abort()}};const Lb=Rb,zb=256*1024;class Ib extends yt{constructor(i,c,f){super(),this.hooks=i,this.method=c,this.url=f}start(i){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},F.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(i)}close(){this.unloader&&(F.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(i,c){for(;;){var f=this.advanceBuffer(c);if(f)this.emit("chunk",{status:i,data:f});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(i){var c=i.slice(this.position),f=c.indexOf(`
|
|
1392
|
+
`);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(i){return this.position===i.length&&i.length>zb}}var os;(function(l){l[l.CONNECTING=0]="CONNECTING",l[l.OPEN=1]="OPEN",l[l.CLOSED=3]="CLOSED"})(os||(os={}));const Rn=os;var $b=1;class Nb{constructor(i,c){this.hooks=i,this.session=el(1e3)+"/"+Ub(8),this.location=Ob(c),this.readyState=Rn.CONNECTING,this.openStream()}send(i){return this.sendRaw(JSON.stringify([i]))}ping(){this.hooks.sendHeartbeat(this)}close(i,c){this.onClose(i,c,!0)}sendRaw(i){if(this.readyState===Rn.OPEN)try{return F.createSocketRequest("POST",Qc(Db(this.location,this.session))).start(i),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(i,c,f){this.closeStream(),this.readyState=Rn.CLOSED,this.onclose&&this.onclose({code:i,reason:c,wasClean:f})}onChunk(i){if(i.status===200){this.readyState===Rn.OPEN&&this.onActivity();var c,f=i.data.slice(0,1);switch(f){case"o":c=JSON.parse(i.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(i.data.slice(1)||"[]");for(var g=0;g<c.length;g++)this.onEvent(c[g]);break;case"m":c=JSON.parse(i.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(i.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(i){this.readyState===Rn.CONNECTING?(i&&i.hostname&&(this.location.base=Mb(this.location.base,i.hostname)),this.readyState=Rn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(i){this.readyState===Rn.OPEN&&this.onmessage&&this.onmessage({data:i})}onActivity(){this.onactivity&&this.onactivity()}onError(i){this.onerror&&this.onerror(i)}openStream(){this.stream=F.createSocketRequest("POST",Qc(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",i=>{this.onChunk(i)}),this.stream.bind("finished",i=>{this.hooks.onFinished(this,i)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(i){ee.defer(()=>{this.onError(i),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function Ob(l){var i=/([^\?]*)\/*(\??.*)/.exec(l);return{base:i[1],queryString:i[2]}}function Db(l,i){return l.base+"/"+i+"/xhr_send"}function Qc(l){var i=l.indexOf("?")===-1?"?":"&";return l+i+"t="+ +new Date+"&n="+$b++}function Mb(l,i){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(l);return c[1]+i+c[3]}function el(l){return F.randomInt(l)}function Ub(l){for(var i=[],c=0;c<l;c++)i.push(el(32).toString(32));return i.join("")}const jb=Nb;var Zb={getReceiveURL:function(l,i){return l.base+"/"+i+"/xhr_streaming"+l.queryString},onHeartbeat:function(l){l.sendRaw("[]")},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,i){l.onClose(1006,"Connection interrupted ("+i+")",!1)}};const qb=Zb;var Hb={getReceiveURL:function(l,i){return l.base+"/"+i+"/xhr"+l.queryString},onHeartbeat:function(){},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,i){i===200?l.reconnect():l.onClose(1006,"Connection interrupted ("+i+")",!1)}};const Fb=Hb;var Bb={getRequest:function(l){var i=F.getXHRAPI(),c=new i;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 Gb=Bb;var Wb={createStreamingSocket(l){return this.createSocket(qb,l)},createPollingSocket(l){return this.createSocket(Fb,l)},createSocket(l,i){return new jb(l,i)},createXHR(l,i){return this.createRequest(Gb,l,i)},createRequest(l,i,c){return new Ib(l,i,c)}};const tl=Wb;tl.createXDR=function(l,i){return this.createRequest(Lb,l,i)};var Jb={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:p,DependenciesReceivers:w,getDefaultStrategy:Cb,Transports:wt,transportConnectionInitializer:Pb,HTTPFactory:tl,TimelineTransport:an,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(l){window.Pusher=l;var i=()=>{this.onDocumentBody(l.ready)};window.JSON?i():C.load("json2",{},i)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:kt,jsonp:$r}},onDocumentBody(l){document.body?l():setTimeout(()=>{this.onDocumentBody(l)},0)},createJSONPRequest(l,i){return new rr(l,i)},createScriptRequest(l){return new Mo(l)},getLocalStorage(){try{return window.localStorage}catch{return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var l=this.getXHRAPI();return new l},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Fo},createWebSocket(l){var i=this.getWebSocketAPI();return new i(l)},createSocketRequest(l,i){if(this.isXHRSupported())return this.HTTPFactory.createXHR(l,i);if(this.isXDRSupported(i.indexOf("https:")===0))return this.HTTPFactory.createXDR(l,i);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var l=this.getXHRAPI();return!!l&&new l().withCredentials!==void 0},isXDRSupported(l){var i=l?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===i},addUnloadListener(l){window.addEventListener!==void 0?window.addEventListener("unload",l,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",l)},removeUnloadListener(l){window.addEventListener!==void 0?window.removeEventListener("unload",l,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",l)},randomInt(l){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*l)}};const F=Jb;var is;(function(l){l[l.ERROR=3]="ERROR",l[l.INFO=6]="INFO",l[l.DEBUG=7]="DEBUG"})(is||(is={}));const Xo=is;class Xb{constructor(i,c,f){this.key=i,this.session=c,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(i,c){i<=this.options.level&&(this.events.push(Te({},c,{timestamp:ee.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(i){this.log(Xo.ERROR,i)}info(i){this.log(Xo.INFO,i)}debug(i){this.log(Xo.DEBUG,i)}isEmpty(){return this.events.length===0}send(i,c){var f=Te({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],i(f,(g,y)=>{g||this.sent++,c&&c(g,y)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class Vb{constructor(i,c,f,g){this.name=i,this.priority=c,this.transport=f,this.options=g||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(i,c){if(this.isSupported()){if(this.priority<i)return nl(new pe,c)}else return nl(new V,c);var f=!1,g=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),y=null,E=function(){g.unbind("initialized",E),g.connect()},$=function(){y=Gt.createHandshake(g,function(Ee){f=!0,te(),c(null,Ee)})},H=function(Ee){te(),c(Ee)},X=function(){te();var Ee;Ee=Ye(g),c(new _e(Ee))},te=function(){g.unbind("initialized",E),g.unbind("open",$),g.unbind("error",H),g.unbind("closed",X)};return g.bind("initialized",E),g.bind("open",$),g.bind("error",H),g.bind("closed",X),g.initialize(),{abort:()=>{f||(te(),y?y.close():g.close())},forceMinPriority:Ee=>{f||this.priority<Ee&&(y?y.close():g.close())}}}}function nl(l,i){return ee.defer(function(){i(l)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Yb}=F;var Kb=function(l,i,c,f,g,y){var E=Yb[c];if(!E)throw new Ve(c);var $=(!l.enabledTransports||lt(l.enabledTransports,i)!==-1)&&(!l.disabledTransports||lt(l.disabledTransports,i)===-1),H;return $?(g=Object.assign({ignoreNullOrigin:l.ignoreNullOrigin},g),H=new Vb(i,f,y?y.getAssistant(E):E,g)):H=Qb,H},Qb={isSupported:function(){return!1},connect:function(l,i){var c=ee.defer(function(){i(new V)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function ek(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&&le.warn("The disableStats option is deprecated in favor of enableStats")}const tk=(l,i)=>{var c="socket_id="+encodeURIComponent(l.socketId);for(var f in i.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(i.params[f]);if(i.paramsProvider!=null){let g=i.paramsProvider();for(var f in g)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return c},nk=l=>{if(typeof F.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(i,c)=>{const f=tk(i,l);F.getAuthorizers()[l.transport](F,f,l,T.UserAuthentication,c)}},rk=(l,i)=>{var c="socket_id="+encodeURIComponent(l.socketId);c+="&channel_name="+encodeURIComponent(l.channelName);for(var f in i.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(i.params[f]);if(i.paramsProvider!=null){let g=i.paramsProvider();for(var f in g)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return c},ok=l=>{if(typeof F.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(i,c)=>{const f=rk(i,l);F.getAuthorizers()[l.transport](F,f,l,T.ChannelAuthorization,c)}},ik=(l,i,c)=>{const f={authTransport:i.transport,authEndpoint:i.endpoint,auth:{params:i.params,headers:i.headers}};return(g,y)=>{const E=l.channel(g.channelName);c(E,f).authorize(g.socketId,y)}};function rl(l,i){let c={activityTimeout:l.activityTimeout||m.activityTimeout,cluster:l.cluster,httpPath:l.httpPath||m.httpPath,httpPort:l.httpPort||m.httpPort,httpsPort:l.httpsPort||m.httpsPort,pongTimeout:l.pongTimeout||m.pongTimeout,statsHost:l.statsHost||m.stats_host,unavailableTimeout:l.unavailableTimeout||m.unavailableTimeout,wsPath:l.wsPath||m.wsPath,wsPort:l.wsPort||m.wsPort,wssPort:l.wssPort||m.wssPort,enableStats:uk(l),httpHost:sk(l),useTLS:lk(l),wsHost:ak(l),userAuthenticator:dk(l),channelAuthorizer:hk(l,i)};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 sk(l){return l.httpHost?l.httpHost:l.cluster?`sockjs-${l.cluster}.pusher.com`:m.httpHost}function ak(l){return l.wsHost?l.wsHost:ck(l.cluster)}function ck(l){return`ws-${l}.pusher.com`}function lk(l){return F.getProtocol()==="https:"?!0:l.forceTLS!==!1}function uk(l){return"enableStats"in l?l.enableStats:"disableStats"in l?!l.disableStats:!1}const ol=l=>"customHandler"in l&&l.customHandler!=null;function dk(l){const i=Object.assign(Object.assign({},m.userAuthentication),l.userAuthentication);return ol(i)?i.customHandler:nk(i)}function pk(l,i){let c;if("channelAuthorization"in l)c=Object.assign(Object.assign({},m.channelAuthorization),l.channelAuthorization);else if(c={transport:l.authTransport||m.authTransport,endpoint:l.authEndpoint||m.authEndpoint},"auth"in l&&("params"in l.auth&&(c.params=l.auth.params),"headers"in l.auth&&(c.headers=l.auth.headers)),"authorizer"in l)return{customHandler:ik(i,c,l.authorizer)};return c}function hk(l,i){const c=pk(l,i);return ol(c)?c.customHandler:ok(c)}class fk extends yt{constructor(i){super(function(c,f){le.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=i,this.bindWatchlistInternalEvent()}handleEvent(i){i.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",i=>{var c=i.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(i)})}}function gk(){let l,i;return{promise:new Promise((f,g)=>{l=f,i=g}),resolve:l,reject:i}}const mk=gk;class bk extends yt{constructor(i){super(function(c,f){le.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){le.warn(`Error during signin: ${c}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:f.auth,user_data:f.user_data})},this.pusher=i,this.pusher.connection.bind("state_change",({previous:c,current:f})=>{c!=="connected"&&f==="connected"&&this._signin(),c==="connected"&&f!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new fk(i),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(i){try{this.user_data=JSON.parse(i.user_data)}catch{le.error(`Failed parsing user data after signin: ${i.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){le.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const i=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new L(`#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)}),i(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:i,resolve:c}=mk();i.done=!1;const f=()=>{i.done=!0};i.then(f).catch(f),this.signinDonePromise=i,this._signinDoneResolve=c}}class Me{static ready(){Me.isReady=!0;for(var i=0,c=Me.instances.length;i<c;i++)Me.instances[i].connect()}static getClientFeatures(){return ut(Tn({ws:F.Transports.ws},function(i){return i.isSupported({})}))}constructor(i,c){kk(i),ek(c),this.key=i,this.options=c,this.config=rl(this.options,this),this.channels=Gt.createChannels(),this.global_emitter=new yt,this.sessionID=F.randomInt(1e9),this.timeline=new Xb(this.key,this.sessionID,{cluster:this.config.cluster,features:Me.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:Xo.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=Gt.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+F.TimelineTransport.name}));var f=g=>F.getDefaultStrategy(this.config,g,Kb);this.connection=Gt.createConnectionManager(this.key,{getStrategy:f,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",g=>{var y=g.event,E=y.indexOf("pusher_internal:")===0;if(g.channel){var $=this.channel(g.channel);$&&$.handleEvent(g)}E||this.global_emitter.emit(g.event,g.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",g=>{le.warn(g)}),Me.instances.push(this),this.timeline.info({instances:Me.instances.length}),this.user=new bk(this),Me.isReady&&this.connect()}switchCluster(i){const{appKey:c,cluster:f}=i;this.key=c,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=rl(this.options,this),this.connection.switchCluster(this.key)}channel(i){return this.channels.find(i)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var i=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new Re(6e4,function(){c.send(i)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(i,c,f){return this.global_emitter.bind(i,c,f),this}unbind(i,c,f){return this.global_emitter.unbind(i,c,f),this}bind_global(i){return this.global_emitter.bind_global(i),this}unbind_global(i){return this.global_emitter.unbind_global(i),this}unbind_all(i){return this.global_emitter.unbind_all(),this}subscribeAll(){var i;for(i in this.channels.channels)this.channels.channels.hasOwnProperty(i)&&this.subscribe(i)}subscribe(i){var c=this.channels.add(i,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(i){var c=this.channels.find(i);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(i),c&&c.subscribed&&c.unsubscribe())}send_event(i,c,f){return this.connection.send_event(i,c,f)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}Me.instances=[],Me.isReady=!1,Me.logToConsole=!1,Me.Runtime=F,Me.ScriptReceivers=F.ScriptReceivers,Me.DependenciesReceivers=F.DependenciesReceivers,Me.auth_callbacks=F.auth_callbacks;const Vo=Me;function kk(l){if(l==null)throw"You must pass your app key when you instantiate Pusher."}F.setup(Me)}},r={};function o(a){var u=r[a];if(u!==void 0)return u.exports;var d=r[a]={exports:{}};return n[a].call(d.exports,d,d.exports,o),d.exports}o.d=(a,u)=>{for(var d in u)o.o(u,d)&&!o.o(a,d)&&Object.defineProperty(a,d,{enumerable:!0,get:u[d]})},o.o=(a,u)=>Object.prototype.hasOwnProperty.call(a,u);var s=o(721);return s})())})(Ta);var $f=Ta.exports;const Nf=If($f),io={TASK_STATUS_UPDATED:"task:status:updated",TASK_INTERACTION_CREATED:"task:interaction:created",TASK_INTERACTION_ANSWERED:"task:interaction:answered",TASK_BROWSER_COMMAND_CREATED:"task:browser-command:created"};let ht=null,Zn=null;async function Of(e){return Zn||(Zn=(async()=>{const t=e.backendUrl.replace(/\/+$/,""),n=await fetch(`${t}/api/settings`,{headers:{Authorization:`Bearer ${e.token}`}});if(!n.ok)throw new Error(`Failed to fetch settings: HTTP ${n.status}`);const r=await n.json();ht=new Nf(r.pusher.key,{cluster:r.pusher.cluster||"local",forceTLS:!0,wsHost:r.pusher.wsHost||void 0,wsPort:r.pusher.wssPort,wssPort:r.pusher.wssPort,enabledTransports:r.pusher.wsHost?["ws"]:void 0,channelAuthorization:{customHandler:({socketId:o,channelName:s},a)=>{fetch(`${t}/api/pusher/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({socket_id:o,channel_name:s})}).then(u=>u.json()).then(u=>a(null,u)).catch(u=>a(u instanceof Error?u:new Error(String(u)),null))}}})})(),Zn.catch(()=>{Zn=null}),Zn)}function Df(e){if(!e||!ht)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return ht.connection.bind("state_change",n),()=>ht==null?void 0:ht.connection.unbind("state_change",n)}async function Mf(e,t,n){if(await Of(e),!ht)return()=>{};const r=ht.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(io.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(io.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(io.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(io.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=Df(n.onReconnect);return()=>{r.unbind_all(),ht==null||ht.unsubscribe(`private-task-${t}`),o==null||o()}}const gi="ap-sdk-active-automation";function Uf(){try{const e=sessionStorage.getItem(gi);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.taskId&&(t!=null&&t.backendUrl)&&(t!=null&&t.title)?t:null}catch{return null}}function Ea(e){try{sessionStorage.setItem(gi,JSON.stringify(e))}catch{}}function Aa(){try{sessionStorage.removeItem(gi)}catch{}}async function jf(e){var s;try{(s=e.focus)==null||s.call(e)}catch{}e.scrollIntoView({block:"center",inline:"center",behavior:"instant"});let t=e.getBoundingClientRect();t.width===0&&t.height===0&&(await Zf(),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 Zf(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const mi="shared",Ca="ap-sdk-panel-size:",Pa=280,Ra=200;function qf(e){try{const t=sessionStorage.getItem(Ca+e);if(!t)return null;const n=JSON.parse(t);return typeof(n==null?void 0:n.width)=="number"&&typeof(n==null?void 0:n.height)=="number"?n:null}catch{return null}}function Hf(e,t){try{sessionStorage.setItem(Ca+e,JSON.stringify(t))}catch{}}function so(e,t,n){return Math.min(Math.max(e,t),n)}function La(){return window.innerWidth-32}function za(){return window.innerHeight-64}function bi(e,t){const n=qf(t);n&&(e.style.width=`${so(n.width,Pa,La())}px`,e.style.height=`${so(n.height,Ra,za())}px`);const r=document.createElement("div");r.className="ap-sdk-resize-handle",r.setAttribute("data-ap-sdk","1"),e.appendChild(r);let o=!1,s=0,a=0,u=0,d=0,h=0,p=0;const b=_=>{o&&(h=so(u+(_.clientX-s),Pa,La()),p=so(d+(_.clientY-a),Ra,za()),e.style.width=`${h}px`,e.style.height=`${p}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",b),document.removeEventListener("pointerup",m),Hf(t,{width:h,height:p}))};r.addEventListener("pointerdown",_=>{_.preventDefault(),_.stopPropagation(),o=!0,s=_.clientX,a=_.clientY;const w=e.getBoundingClientRect();u=w.width,d=w.height,h=u,p=d,document.addEventListener("pointermove",b),document.addEventListener("pointerup",m)})}function ki(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var pn=ki();function Ia(e){pn=e}var hn={exec:()=>null};function qn(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),o=t[r];return o||(o=e(r),t[r]=o),o}}function G(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(o,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(je.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var Ff=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),je={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:qn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:qn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:qn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:qn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:qn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:qn(e=>new RegExp(`^ {0,${e}}>`))},Bf=/^(?:[ \t]*(?:\n|$))+/,Gf=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Wf=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,fr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Jf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_i=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,$a=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Na=G($a).replace(/bull/g,_i).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(),Xf=G($a).replace(/bull/g,_i).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(),vi=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Vf=/^[^\n]+/,yi=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Yf=G(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",yi).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Kf=G(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,_i).getRegex(),ao="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",wi=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Qf=G("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",wi).replace("tag",ao).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Oa=e=>G(vi).replace("hr",fr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list",e).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ao).getRegex(),eg=Oa(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),tg=Oa(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),ng=G(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",tg).getRegex(),xi={blockquote:ng,code:Gf,def:Yf,fences:Wf,heading:Jf,hr:fr,html:Qf,lheading:Na,list:Kf,newline:Bf,paragraph:eg,table:hn,text:Vf},Da=G("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",fr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ao).getRegex(),rg={...xi,lheading:Xf,table:Da,paragraph:G(vi).replace("hr",fr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Da).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",ao).getRegex()},og={...xi,html:G(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",wi).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:hn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:G(vi).replace("hr",fr).replace("heading",` *#{1,6} *[^
|
|
1393
|
+
]`).replace("lheading",Na).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ig=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,sg=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ma=/^( {2,}|\\)\n(?!\s*$)/,ag=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ot=/[\p{P}\p{S}]/u,Hn=/[\s\p{P}\p{S}]/u,gr=/[^\s\p{P}\p{S}]/u,cg=G(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Hn).getRegex(),lg=/[\p{Pi}\p{Ps}"']/u,Ua=/(?!~)[\p{P}\p{S}]/u,ug=/(?!~)[\s\p{P}\p{S}]/u,dg=/(?:[^\s\p{P}\p{S}]|~)/u,pg=G(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Ff?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),ja=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,hg=G(ja,"u").replace(/punct/g,Ot).getRegex(),fg=G(ja,"u").replace(/punct/g,Ua).getRegex(),gg=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,mg=G(gg,"u").replace(/openQuote/g,lg).replace(/punct/g,Ot).getRegex(),Za="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",bg=G(Za,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,Hn).replace(/punct/g,Ot).getRegex(),kg=G(Za,"gu").replace(/notPunctSpace/g,dg).replace(/punctSpace/g,ug).replace(/punct/g,Ua).getRegex(),_g="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",vg=G(_g,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,Hn).replace(/punct/g,Ot).getRegex(),yg=G("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,Hn).replace(/punct/g,Ot).getRegex(),wg="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",xg=G(wg,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,Hn).replace(/punct/g,Ot).getRegex(),Sg=G(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Ot).getRegex(),Tg="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Eg=G(Tg,"gu").replace(/notPunctSpace/g,gr).replace(/punctSpace/g,Hn).replace(/punct/g,Ot).getRegex(),Ag=G(/\\(punct)/,"gu").replace(/punct/g,Ot).getRegex(),Cg=G(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Pg=G(wi).replace("(?:-->|$)","-->").getRegex(),Rg=G("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Pg).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),co=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Lg=G(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",co).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),qa=G(/^!?\[(label)\]\[(ref)\]/).replace("label",co).replace("ref",yi).getRegex(),Ha=G(/^!?\[(ref)\](?:\[\])?/).replace("ref",yi).getRegex(),zg=G("reflink|nolink(?!\\()","g").replace("reflink",qa).replace("nolink",Ha).getRegex(),Fa=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Si={_backpedal:hn,anyPunctuation:Ag,autolink:Cg,blockSkip:pg,br:Ma,code:sg,del:hn,delLDelim:hn,delRDelim:hn,emStrongLDelim:hg,emStrongRDelimAst:bg,emStrongRDelimUnd:yg,escape:ig,link:Lg,nolink:Ha,punctuation:cg,reflink:qa,reflinkSearch:zg,tag:Rg,text:ag,url:hn},Ig={...Si,emStrongLDelim:mg,emStrongRDelimAst:vg,emStrongRDelimUnd:xg,link:G(/^!?\[(label)\]\((.*?)\)/).replace("label",co).getRegex(),reflink:G(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",co).getRegex()},Ti={...Si,emStrongRDelimAst:kg,emStrongLDelim:fg,delLDelim:Sg,delRDelim:Eg,url:G(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Fa).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:G(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Fa).getRegex()},$g={...Ti,br:G(Ma).replace("{2,}","*").getRegex(),text:G(Ti.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},lo={normal:xi,gfm:rg,pedantic:og},mr={normal:Si,gfm:Ti,breaks:$g,pedantic:Ig},Ng={"&":"&","<":"<",">":">",'"':""","'":"'"},Ba=e=>Ng[e];function At(e,t){if(t){if(je.escapeTest.test(e))return e.replace(je.escapeReplace,Ba)}else if(je.escapeTestNoEncode.test(e))return e.replace(je.escapeReplaceNoEncode,Ba);return e}function Ga(e){try{e=encodeURI(e).replace(je.percentDecode,"%")}catch{return null}return e}function Wa(e,t){var s;let n=e.replace(je.findPipe,(a,u,d)=>{let h=!1,p=u;for(;--p>=0&&d[p]==="\\";)h=!h;return h?"|":" |"}),r=n.split(je.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!((s=r.at(-1))!=null&&s.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(je.slashPipe,"|");return r}function Kt(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 Ja(e){let t=e.split(`
|
|
1394
|
+
`),n=t.length-1;for(;n>=0&&je.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
1378
1395
|
`)}function Og(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 Dg(e,t=0){let n=t,r="";for(let o of e)if(o===" "){let s=4-n%4;r+=" ".repeat(s),n+=s}else r+=o,n++;return r}function Xa(e,t,n,r,o){let s=t.href,a=t.title||null,u=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let d={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:a,text:u,tokens:r.inlineTokens(u)};return r.state.inLink=!1,d}function Mg(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
|
|
1379
1396
|
`).map(s=>{let a=s.match(n.other.beginningSpace);if(a===null)return s;let[u]=a;return u.length>=o.length?s.slice(o.length):s}).join(`
|
|
1380
|
-
`)}var
|
|
1381
|
-
`),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:
|
|
1382
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=
|
|
1397
|
+
`)}var uo=class{constructor(e){ae(this,"options");ae(this,"rules");ae(this,"lexer");this.options=e||pn}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]:Ja(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=Mg(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=Kt(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:Kt(t[0],`
|
|
1398
|
+
`),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:Kt(t[0],`
|
|
1399
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Kt(t[0],`
|
|
1383
1400
|
`).split(`
|
|
1384
|
-
`),r="",o="",s=[];for(;n.length>0;){let a=!1,u=[],d;for(d=0;d<n.length;d++)if(this.rules.other.blockquoteStart.test(n[d]))u.push(n[d]),a=!0;else if(!a)u.push(n[d]);else break;n=n.slice(d);let
|
|
1385
|
-
`),h
|
|
1401
|
+
`),r="",o="",s=[];for(;n.length>0;){let a=!1,u=[],d;for(d=0;d<n.length;d++)if(this.rules.other.blockquoteStart.test(n[d]))u.push(n[d]),a=!0;else if(!a)u.push(n[d]);else break;n=n.slice(d);let h=u.join(`
|
|
1402
|
+
`),p=h.replace(this.rules.other.blockquoteSetextReplace,`
|
|
1386
1403
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
1387
|
-
${
|
|
1388
|
-
${
|
|
1389
|
-
`),
|
|
1390
|
-
`+w.replace(this.rules.other.blockquoteSetextReplace2,""),
|
|
1391
|
-
${w}`,o=o.substring(0,o.length-_.text.length)+
|
|
1404
|
+
${h}`:h,o=o?`${o}
|
|
1405
|
+
${p}`:p;let b=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,s,!0),this.lexer.state.top=b,n.length===0)break;let m=s.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){let _=m,w=n.join(`
|
|
1406
|
+
`),C=_.raw+`
|
|
1407
|
+
`+w.replace(this.rules.other.blockquoteSetextReplace2,""),M=this.blockquote(C);s[s.length-1]=M,r=`${r}
|
|
1408
|
+
${w}`,o=o.substring(0,o.length-_.text.length)+M.text;break}else if((m==null?void 0:m.type)==="list"){let _=m,w=_.raw+`
|
|
1392
1409
|
`+n.join(`
|
|
1393
|
-
`),
|
|
1394
|
-
`);continue}}return{type:"blockquote",raw:r,tokens:s,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,o={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let s=this.rules.other.listItemRegex(n),a=!1;for(;e;){let d=!1,
|
|
1410
|
+
`),C=this.list(w);s[s.length-1]=C,r=r.substring(0,r.length-m.raw.length)+C.raw,o=o.substring(0,o.length-_.raw.length)+C.raw,n=w.substring(s.at(-1).raw.length).split(`
|
|
1411
|
+
`);continue}}return{type:"blockquote",raw:r,tokens:s,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,o={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let s=this.rules.other.listItemRegex(n),a=!1;for(;e;){let d=!1,h="",p="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;h=t[0],e=e.substring(h.length);let b=Dg(t[2].split(`
|
|
1395
1412
|
`,1)[0],t[1].length),m=e.split(`
|
|
1396
|
-
`,1)[0],_=!
|
|
1397
|
-
`,e=e.substring(m.length+1),d=!0),!d){let
|
|
1398
|
-
`,1)[0],
|
|
1399
|
-
`+
|
|
1400
|
-
`+m}_=!m.trim(),
|
|
1401
|
-
`,e=e.substring(
|
|
1413
|
+
`,1)[0],_=!b.trim(),w=0;if(this.options.pedantic?(w=2,p=b.trimStart()):_?w=t[1].length+1:(w=b.search(this.rules.other.nonSpaceChar),w=w>4?1:w,p=b.slice(w),w+=t[1].length),_&&this.rules.other.blankLine.test(m)&&(h+=m+`
|
|
1414
|
+
`,e=e.substring(m.length+1),d=!0),!d){let C=this.rules.other.nextBulletRegex(w),M=this.rules.other.hrRegex(w),W=this.rules.other.fencesBeginRegex(w),P=this.rules.other.headingBeginRegex(w),T=this.rules.other.htmlBeginRegex(w),x=this.rules.other.blockquoteBeginRegex(w);for(;e;){let R=e.split(`
|
|
1415
|
+
`,1)[0],D;if(m=R,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),D=m):D=m.replace(this.rules.other.tabCharGlobal," "),W.test(m)||P.test(m)||T.test(m)||x.test(m)||C.test(m)||M.test(m))break;if(D.search(this.rules.other.nonSpaceChar)>=w||!m.trim())p+=`
|
|
1416
|
+
`+D.slice(w);else{if(_||b.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||W.test(b)||P.test(b)||M.test(b))break;p+=`
|
|
1417
|
+
`+m}_=!m.trim(),h+=R+`
|
|
1418
|
+
`,e=e.substring(R.length+1),b=D.slice(w)}}o.loose||(a?o.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(a=!0)),o.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),o.raw+=h}let u=o.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let d of o.items){this.lexer.state.top=!1,d.tokens=this.lexer.blockTokens(d.text,[]);let h=d.tokens[0];if(d.task&&((h==null?void 0:h.type)==="text"||(h==null?void 0:h.type)==="paragraph")){d.text=d.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let b=this.lexer.inlineQueue.length-1;b>=0;b--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[b].src)){this.lexer.inlineQueue[b].src=this.lexer.inlineQueue[b].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(d.raw);if(p){let b={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};d.checked=b.checked,o.loose?d.tokens[0]&&["paragraph","text"].includes(d.tokens[0].type)&&"tokens"in d.tokens[0]&&d.tokens[0].tokens?(d.tokens[0].raw=b.raw+d.tokens[0].raw,d.tokens[0].text=b.raw+d.tokens[0].text,d.tokens[0].tokens.unshift(b)):d.tokens.unshift({type:"paragraph",raw:b.raw,text:b.raw,tokens:[b]}):d.tokens.unshift(b)}}else d.task&&(d.task=!1);if(!o.loose){let p=d.tokens.filter(m=>m.type==="space"),b=p.length>0&&p.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=b}}if(o.loose)for(let d of o.items){d.loose=!0;for(let h of d.tokens)h.type==="text"&&(h.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=Ja(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:Kt(t[0],`
|
|
1402
1419
|
`),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=Wa(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(`
|
|
1403
|
-
`):[],s={type:"table",raw:
|
|
1404
|
-
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let u of r)this.rules.other.tableAlignRight.test(u)?s.align.push("right"):this.rules.other.tableAlignCenter.test(u)?s.align.push("center"):this.rules.other.tableAlignLeft.test(u)?s.align.push("left"):s.align.push(null);for(let u=0;u<n.length;u++)s.header.push({text:n[u],tokens:this.lexer.inline(n[u]),header:!0,align:s.align[u]});for(let u of o)s.rows.push(Wa(u,s.header.length).map((d,
|
|
1420
|
+
`):[],s={type:"table",raw:Kt(t[0],`
|
|
1421
|
+
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let u of r)this.rules.other.tableAlignRight.test(u)?s.align.push("right"):this.rules.other.tableAlignCenter.test(u)?s.align.push("center"):this.rules.other.tableAlignLeft.test(u)?s.align.push("left"):s.align.push(null);for(let u=0;u<n.length;u++)s.header.push({text:n[u],tokens:this.lexer.inline(n[u]),header:!0,align:s.align[u]});for(let u of o)s.rows.push(Wa(u,s.header.length).map((d,h)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:s.align[h]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:Kt(t[0],`
|
|
1405
1422
|
`),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)===`
|
|
1406
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=
|
|
1407
|
-
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var s,a,u;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(
|
|
1408
|
-
`:n.push(d);continue}if(d=this.tokenizer.code(t)){t=t.substring(d.raw.length);let
|
|
1423
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let s=Kt(n.slice(0,-1),"\\");if((n.length-s.length)%2===0)return}else{let s=Og(t[2],"()");if(s===-2)return;if(s>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let s=this.rules.other.pedanticHrefTitle.exec(r);s&&(r=s[1],o=s[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),Xa(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[r.toLowerCase()];if(!o){let s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return Xa(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,s,a,u=o,d=0,h=r[0][0],p=n===h,b=h==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(b.lastIndex=0,t=t.slice(-1*e.length+o);(r=b.exec(t))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(a=[...s].length,r[3]||r[4]){u+=a;continue}else if(r[5]||r[6]){if(o%3&&!((o+a)%3)){d+=a;continue}if(p)break}if(u-=a,u>0)continue;a=Math.min(a,a+u+d);let m=[...r[0]][0].length,_=e.slice(0,o+r.index+m+a);if(Math.min(o,a)%2){let C=_.slice(1,-1);return{type:"em",raw:_,text:C,tokens:this.lexer.inlineTokens(C)}}let w=_.slice(2,-2);return{type:"strong",raw:_,text:w,tokens:this.lexer.inlineTokens(w)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,s,a,u=o,d=this.rules.inline.delRDelim;for(d.lastIndex=0,t=t.slice(-1*e.length+o);(r=d.exec(t))!==null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s||(a=[...s].length,a!==o))continue;if(r[3]||r[4]){u+=a;continue}if(u-=a,u>0)continue;a=Math.min(a,a+u);let h=[...r[0]][0].length,p=e.slice(0,o+r.index+h+a),b=p.slice(o,-o);return{type:"del",raw:p,text:b,tokens:this.lexer.inlineTokens(b)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let r,o;if(t[2]==="@")r=t[0],o="mailto:"+r;else{let s;do s=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(s!==t[0]);r=t[0],t[1]==="www."?o="http://"+t[0]:o=t[0]}return{type:"link",raw:t[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},ft=class cs{constructor(t){ae(this,"tokens");ae(this,"options");ae(this,"state");ae(this,"inlineQueue");ae(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||pn,this.options.tokenizer=this.options.tokenizer||new uo,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:je,block:lo.normal,inline:mr.normal};this.options.pedantic?(n.block=lo.pedantic,n.inline=mr.pedantic):this.options.gfm&&(n.block=lo.gfm,this.options.breaks?n.inline=mr.breaks:n.inline=mr.gfm),this.tokenizer.rules=n}static get rules(){return{block:lo,inline:mr}}static lex(t,n){return new cs(n).lex(t)}static lexInline(t,n){return new cs(n).inlineTokens(t)}lex(t){t=t.replace(je.carriageReturn,`
|
|
1424
|
+
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var s,a,u;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(je.tabCharGlobal," ").replace(je.spaceLine,""));let o=1/0;for(;t;){if(t.length<o)o=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let d;if((a=(s=this.options.extensions)==null?void 0:s.block)!=null&&a.some(p=>(d=p.call({lexer:this},t,n))?(t=t.substring(d.raw.length),n.push(d),!0):!1))continue;if(d=this.tokenizer.space(t)){t=t.substring(d.raw.length);let p=n.at(-1);d.raw.length===1&&p!==void 0?p.raw+=`
|
|
1425
|
+
`:n.push(d);continue}if(d=this.tokenizer.code(t)){t=t.substring(d.raw.length);let p=n.at(-1);(p==null?void 0:p.type)==="paragraph"||(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
|
|
1409
1426
|
`)?"":`
|
|
1410
|
-
`)+d.raw,
|
|
1411
|
-
`+d.text,this.inlineQueue.at(-1).src=
|
|
1427
|
+
`)+d.raw,p.text+=`
|
|
1428
|
+
`+d.text,this.inlineQueue.at(-1).src=p.text):n.push(d);continue}if(d=this.tokenizer.fences(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.heading(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.hr(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.blockquote(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.list(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.html(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.def(t)){t=t.substring(d.raw.length);let p=n.at(-1);(p==null?void 0:p.type)==="paragraph"||(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
|
|
1412
1429
|
`)?"":`
|
|
1413
|
-
`)+d.raw,
|
|
1414
|
-
`+d.raw,this.inlineQueue.at(-1).src=
|
|
1430
|
+
`)+d.raw,p.text+=`
|
|
1431
|
+
`+d.raw,this.inlineQueue.at(-1).src=p.text):this.tokens.links[d.tag]||(this.tokens.links[d.tag]={href:d.href,title:d.title},n.push(d));continue}if(d=this.tokenizer.table(t)){t=t.substring(d.raw.length),n.push(d);continue}if(d=this.tokenizer.lheading(t)){t=t.substring(d.raw.length),n.push(d);continue}let h=t;if((u=this.options.extensions)!=null&&u.startBlock){let p=1/0,b=t.slice(1),m;this.options.extensions.startBlock.forEach(_=>{m=_.call({lexer:this},b),typeof m=="number"&&m>=0&&(p=Math.min(p,m))}),p<1/0&&p>=0&&(h=t.substring(0,p+1))}if(this.state.top&&(d=this.tokenizer.paragraph(h))){let p=n.at(-1);r&&(p==null?void 0:p.type)==="paragraph"?(p.raw+=(p.raw.endsWith(`
|
|
1415
1432
|
`)?"":`
|
|
1416
|
-
`)+d.raw,
|
|
1417
|
-
`+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=
|
|
1433
|
+
`)+d.raw,p.text+=`
|
|
1434
|
+
`+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):n.push(d),r=h.length!==t.length,t=t.substring(d.raw.length);continue}if(d=this.tokenizer.text(t)){t=t.substring(d.raw.length);let p=n.at(-1);(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
|
|
1418
1435
|
`)?"":`
|
|
1419
|
-
`)+d.raw,
|
|
1420
|
-
`+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=
|
|
1421
|
-
`;return r?'<pre><code class="language-'+
|
|
1422
|
-
`:"<pre><code>"+(n?o:
|
|
1436
|
+
`)+d.raw,p.text+=`
|
|
1437
|
+
`+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):n.push(d);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var u,d,h,p,b;this.tokenizer.lexer=this;let r=t;if(this.tokens.links){let m=Object.keys(this.tokens.links);m.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,_=>m.includes(_.slice(_.lastIndexOf("[")+1,-1))?"["+"a".repeat(_.length-2)+"]":_))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(m,_,w)=>{let C=w?w.length:0;return m.slice(0,C)+"["+"a".repeat(m.length-C-2)+"]"}),r=((d=(u=this.options.hooks)==null?void 0:u.emStrongMask)==null?void 0:d.call({lexer:this},r))??r;let o=!1,s="",a=1/0;for(;t;){if(t.length<a)a=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}o||(s=""),o=!1;let m;if((p=(h=this.options.extensions)==null?void 0:h.inline)!=null&&p.some(w=>(m=w.call({lexer:this},t,n))?(t=t.substring(m.raw.length),n.push(m),!0):!1))continue;if(m=this.tokenizer.escape(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.tag(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.link(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(m.raw.length);let w=n.at(-1);m.type==="text"&&(w==null?void 0:w.type)==="text"?(w.raw+=m.raw,w.text+=m.text):n.push(m);continue}if(m=this.tokenizer.emStrong(t,r,s)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.codespan(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.br(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.del(t,r,s)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.autolink(t)){t=t.substring(m.raw.length),n.push(m);continue}if(!this.state.inLink&&(m=this.tokenizer.url(t))){t=t.substring(m.raw.length),n.push(m);continue}let _=t;if((b=this.options.extensions)!=null&&b.startInline){let w=1/0,C=t.slice(1),M;this.options.extensions.startInline.forEach(W=>{M=W.call({lexer:this},C),typeof M=="number"&&M>=0&&(w=Math.min(w,M))}),w<1/0&&w>=0&&(_=t.substring(0,w+1))}if(m=this.tokenizer.inlineText(_)){t=t.substring(m.raw.length),m.raw.slice(-1)!=="_"&&(s=m.raw.slice(-1)),o=!0;let w=n.at(-1);(w==null?void 0:w.type)==="text"?(w.raw+=m.raw,w.text+=m.text):n.push(m);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return n}infiniteLoopError(t){let n="Infinite loop on byte: "+t;if(this.options.silent)console.error(n);else throw new Error(n)}},po=class{constructor(e){ae(this,"options");ae(this,"parser");this.options=e||pn}space(e){return""}code({text:e,lang:t,escaped:n}){var s;let r=(s=(t||"").match(je.notSpaceStart))==null?void 0:s[0],o=e.replace(je.endingNewline,"")+`
|
|
1438
|
+
`;return r?'<pre><code class="language-'+At(r)+'">'+(n?o:At(o,!0))+`</code></pre>
|
|
1439
|
+
`:"<pre><code>"+(n?o:At(o,!0))+`</code></pre>
|
|
1423
1440
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
1424
1441
|
${this.parser.parse(e)}</blockquote>
|
|
1425
1442
|
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
@@ -1435,9 +1452,9 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
1435
1452
|
`}tablerow({text:e}){return`<tr>
|
|
1436
1453
|
${e}</tr>
|
|
1437
1454
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
1438
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${
|
|
1439
|
-
Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+Et(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},dn=new Ug;function ee(e,t){return dn.parse(e,t)}ee.options=ee.setOptions=function(e){return dn.setOptions(e),ee.defaults=dn.defaults,Ia(ee.defaults),ee},ee.getDefaults=mi,ee.defaults=ln;function jg(...e){return dn.use(...e),ee.defaults=dn.defaults,Ia(ee.defaults),ee}ee.use=jg,ee.walkTokens=function(e,t){return dn.walkTokens(e,t)},ee.parseInline=dn.parseInline,ee.Parser=ft,ee.parser=ft.parse,ee.Renderer=lo,ee.TextRenderer=Si,ee.Lexer=ht,ee.lexer=ht.lex,ee.Tokenizer=co,ee.Hooks=gr,ee.parse=ee,ee.options,ee.setOptions,ee.walkTokens,ee.parseInline,ft.parse,ht.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:Va,setPrototypeOf:Ya,isFrozen:Zg,getPrototypeOf:qg,getOwnPropertyDescriptor:Hg}=Object;let{freeze:Ze,seal:ct,create:Ti}=Object,{apply:Ei,construct:Ai}=typeof Reflect<"u"&&Reflect;Ze||(Ze=function(t){return t}),ct||(ct=function(t){return t}),Ei||(Ei=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];return t.apply(n,o)}),Ai||(Ai=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 uo=He(Array.prototype.forEach),Fg=He(Array.prototype.lastIndexOf),Ka=He(Array.prototype.pop),mr=He(Array.prototype.push),Bg=He(Array.prototype.splice),po=He(String.prototype.toLowerCase),Ci=He(String.prototype.toString),Pi=He(String.prototype.match),br=He(String.prototype.replace),Gg=He(String.prototype.indexOf),Wg=He(String.prototype.trim),gt=He(Object.prototype.hasOwnProperty),qe=He(RegExp.prototype.test),kr=Jg(TypeError);function He(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 Ei(e,t,r)}}function Jg(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Ai(e,n)}}function B(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:po;Ya&&Ya(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const s=n(o);s!==o&&(Zg(t)||(t[r]=s),o=s)}e[o]=!0}return e}function Xg(e){for(let t=0;t<e.length;t++)gt(e,t)||(e[t]=null);return e}function At(e){const t=Ti(null);for(const[n,r]of Va(e))gt(e,n)&&(Array.isArray(r)?t[n]=Xg(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=At(r):t[n]=r);return t}function _r(e,t){for(;e!==null;){const r=Hg(e,t);if(r){if(r.get)return He(r.get);if(typeof r.value=="function")return He(r.value)}e=qg(e)}function n(){return null}return n}const Qa=Ze(["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"]),Ri=Ze(["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"]),Li=Ze(["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"]),Vg=Ze(["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"]),zi=Ze(["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"]),Yg=Ze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ec=Ze(["#text"]),tc=Ze(["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"]),Ii=Ze(["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"]),nc=Ze(["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"]),ho=Ze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Kg=ct(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Qg=ct(/<%[\w\W]*|[\w\W]*%>/gm),em=ct(/\$\{[\w\W]*/gm),tm=ct(/^data-[\-\w.\u00B7-\uFFFF]+$/),nm=ct(/^aria-[\-\w]+$/),rc=ct(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),rm=ct(/^(?:\w+script|data):/i),om=ct(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),oc=ct(/^html$/i),im=ct(/^[a-z][.\w]*(-[.\w]+)+$/i);var ic=Object.freeze({__proto__:null,ARIA_ATTR:nm,ATTR_WHITESPACE:om,CUSTOM_ELEMENT:im,DATA_ATTR:tm,DOCTYPE_NAME:oc,ERB_EXPR:Qg,IS_ALLOWED_URI:rc,IS_SCRIPT_OR_DATA:rm,MUSTACHE_EXPR:Kg,TMPLIT_EXPR:em});const vr={element:1,text:3,progressingInstruction:7,comment:8,document:9},sm=function(){return typeof window>"u"?null:window},am=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},sc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ac(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:sm();const t=D=>ac(D);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==vr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:a,Node:u,Element:d,NodeFilter:p,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:k,DOMParser:m,trustedTypes:_}=e,w=d.prototype,P=_r(w,"cloneNode"),N=_r(w,"remove"),ne=_r(w,"nextSibling"),R=_r(w,"childNodes"),x=_r(w,"parentNode");if(typeof a=="function"){const D=n.createElement("template");D.content&&D.content.ownerDocument&&(n=D.content.ownerDocument)}let S,C="";const{implementation:M,createNodeIterator:se,createDocumentFragment:ke,getElementsByTagName:$e}=n,{importNode:nt}=r;let K=sc();t.isSupported=typeof Va=="function"&&typeof x=="function"&&M&&M.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:_e,ERB_EXPR:rt,TMPLIT_EXPR:Z,DATA_ATTR:re,ARIA_ATTR:Re,IS_SCRIPT_OR_DATA:Le,ATTR_WHITESPACE:bt,CUSTOM_ELEMENT:kt}=ic;let{IS_ALLOWED_URI:vn}=ic,me=null;const Ae=B({},[...Qa,...Ri,...Li,...zi,...ec]);let W=null;const We=B({},[...tc,...Ii,...nc,...ho]);let J=Object.seal(Ti(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}})),Je=null,Xe=null;const Ve=Object.seal(Ti(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ve=!0,be=!0,$o=!1,Cr=!0,Me=!1,yn=!0,jt=!1,Zt=!1,er=!1,tn=!1,wn=!1,xn=!1,No=!0,Pr=!1;const Vi="user-content-";let Rr=!0,Sn=!1,nn={},Ye=null;const Lr=B({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ae=null;const Oo=B({},["audio","video","img","source","image","track"]);let zr=null;const Do=B({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),tr="http://www.w3.org/1998/Math/MathML",nr="http://www.w3.org/2000/svg",_t="http://www.w3.org/1999/xhtml";let rn=_t,Tn=!1,En=null;const Yi=B({},[tr,nr,_t],Ci);let rr=B({},["mi","mo","mn","ms","mtext"]),or=B({},["annotation-xml"]);const Ki=B({},["title","style","font","a","script"]);let qt=null;const vt=["application/xhtml+xml","text/html"],Qi="text/html";let ce=null,on=null;const Mo=n.createElement("form"),Ir=function(b){return b instanceof RegExp||b instanceof Function},ir=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(on&&on===b)){if((!b||typeof b!="object")&&(b={}),b=At(b),qt=vt.indexOf(b.PARSER_MEDIA_TYPE)===-1?Qi:b.PARSER_MEDIA_TYPE,ce=qt==="application/xhtml+xml"?Ci:po,me=gt(b,"ALLOWED_TAGS")?B({},b.ALLOWED_TAGS,ce):Ae,W=gt(b,"ALLOWED_ATTR")?B({},b.ALLOWED_ATTR,ce):We,En=gt(b,"ALLOWED_NAMESPACES")?B({},b.ALLOWED_NAMESPACES,Ci):Yi,zr=gt(b,"ADD_URI_SAFE_ATTR")?B(At(Do),b.ADD_URI_SAFE_ATTR,ce):Do,ae=gt(b,"ADD_DATA_URI_TAGS")?B(At(Oo),b.ADD_DATA_URI_TAGS,ce):Oo,Ye=gt(b,"FORBID_CONTENTS")?B({},b.FORBID_CONTENTS,ce):Lr,Je=gt(b,"FORBID_TAGS")?B({},b.FORBID_TAGS,ce):At({}),Xe=gt(b,"FORBID_ATTR")?B({},b.FORBID_ATTR,ce):At({}),nn=gt(b,"USE_PROFILES")?b.USE_PROFILES:!1,ve=b.ALLOW_ARIA_ATTR!==!1,be=b.ALLOW_DATA_ATTR!==!1,$o=b.ALLOW_UNKNOWN_PROTOCOLS||!1,Cr=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Me=b.SAFE_FOR_TEMPLATES||!1,yn=b.SAFE_FOR_XML!==!1,jt=b.WHOLE_DOCUMENT||!1,tn=b.RETURN_DOM||!1,wn=b.RETURN_DOM_FRAGMENT||!1,xn=b.RETURN_TRUSTED_TYPE||!1,er=b.FORCE_BODY||!1,No=b.SANITIZE_DOM!==!1,Pr=b.SANITIZE_NAMED_PROPS||!1,Rr=b.KEEP_CONTENT!==!1,Sn=b.IN_PLACE||!1,vn=b.ALLOWED_URI_REGEXP||rc,rn=b.NAMESPACE||_t,rr=b.MATHML_TEXT_INTEGRATION_POINTS||rr,or=b.HTML_INTEGRATION_POINTS||or,J=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&Ir(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(J.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&Ir(b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(J.attributeNameCheck=b.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(J.allowCustomizedBuiltInElements=b.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Me&&(be=!1),wn&&(tn=!0),nn&&(me=B({},ec),W=[],nn.html===!0&&(B(me,Qa),B(W,tc)),nn.svg===!0&&(B(me,Ri),B(W,Ii),B(W,ho)),nn.svgFilters===!0&&(B(me,Li),B(W,Ii),B(W,ho)),nn.mathMl===!0&&(B(me,zi),B(W,nc),B(W,ho))),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?Ve.tagCheck=b.ADD_TAGS:(me===Ae&&(me=At(me)),B(me,b.ADD_TAGS,ce))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?Ve.attributeCheck=b.ADD_ATTR:(W===We&&(W=At(W)),B(W,b.ADD_ATTR,ce))),b.ADD_URI_SAFE_ATTR&&B(zr,b.ADD_URI_SAFE_ATTR,ce),b.FORBID_CONTENTS&&(Ye===Lr&&(Ye=At(Ye)),B(Ye,b.FORBID_CONTENTS,ce)),b.ADD_FORBID_CONTENTS&&(Ye===Lr&&(Ye=At(Ye)),B(Ye,b.ADD_FORBID_CONTENTS,ce)),Rr&&(me["#text"]=!0),jt&&B(me,["html","head","body"]),me.table&&(B(me,["tbody"]),delete Je.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw kr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw kr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=b.TRUSTED_TYPES_POLICY,C=S.createHTML("")}else S===void 0&&(S=am(_,o)),S!==null&&typeof C=="string"&&(C=S.createHTML(""));Ze&&Ze(b),on=b}},$r=B({},[...Ri,...Li,...Vg]),Uo=B({},[...zi,...Yg]),es=function(b){let T=x(b);(!T||!T.tagName)&&(T={namespaceURI:rn,tagName:"template"});const L=po(b.tagName),oe=po(T.tagName);return En[b.namespaceURI]?b.namespaceURI===nr?T.namespaceURI===_t?L==="svg":T.namespaceURI===tr?L==="svg"&&(oe==="annotation-xml"||rr[oe]):!!$r[L]:b.namespaceURI===tr?T.namespaceURI===_t?L==="math":T.namespaceURI===nr?L==="math"&&or[oe]:!!Uo[L]:b.namespaceURI===_t?T.namespaceURI===nr&&!or[oe]||T.namespaceURI===tr&&!rr[oe]?!1:!Uo[L]&&(Ki[L]||!$r[L]):!!(qt==="application/xhtml+xml"&&En[b.namespaceURI]):!1},ut=function(b){mr(t.removed,{element:b});try{x(b).removeChild(b)}catch{N(b)}},dt=function(b,T){try{mr(t.removed,{attribute:T.getAttributeNode(b),from:T})}catch{mr(t.removed,{attribute:null,from:T})}if(T.removeAttribute(b),b==="is")if(tn||wn)try{ut(T)}catch{}else try{T.setAttribute(b,"")}catch{}},jo=function(b){let T=null,L=null;if(er)b="<remove></remove>"+b;else{const ye=Pi(b,/^[\r\n\t ]+/);L=ye&&ye[0]}qt==="application/xhtml+xml"&&rn===_t&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const oe=S?S.createHTML(b):b;if(rn===_t)try{T=new m().parseFromString(oe,qt)}catch{}if(!T||!T.documentElement){T=M.createDocument(rn,"template",null);try{T.documentElement.innerHTML=Tn?C:oe}catch{}}const ze=T.body||T.documentElement;return b&&L&&ze.insertBefore(n.createTextNode(L),ze.childNodes[0]||null),rn===_t?$e.call(T,jt?"html":"body")[0]:jt?T.documentElement:ze},Nr=function(b){return se.call(b.ownerDocument||b,b,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Or=function(b){return b instanceof k&&(typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||!(b.attributes instanceof h)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function")},Zo=function(b){return typeof u=="function"&&b instanceof u};function yt(D,b,T){uo(D,L=>{L.call(t,b,T,on)})}const qo=function(b){let T=null;if(yt(K.beforeSanitizeElements,b,null),Or(b))return ut(b),!0;const L=ce(b.nodeName);if(yt(K.uponSanitizeElement,b,{tagName:L,allowedTags:me}),yn&&b.hasChildNodes()&&!Zo(b.firstElementChild)&&qe(/<[/\w!]/g,b.innerHTML)&&qe(/<[/\w!]/g,b.textContent)||b.nodeType===vr.progressingInstruction||yn&&b.nodeType===vr.comment&&qe(/<[/\w]/g,b.data))return ut(b),!0;if(!(Ve.tagCheck instanceof Function&&Ve.tagCheck(L))&&(!me[L]||Je[L])){if(!Je[L]&&Fo(L)&&(J.tagNameCheck instanceof RegExp&&qe(J.tagNameCheck,L)||J.tagNameCheck instanceof Function&&J.tagNameCheck(L)))return!1;if(Rr&&!Ye[L]){const oe=x(b)||b.parentNode,ze=R(b)||b.childNodes;if(ze&&oe){const ye=ze.length;for(let Ue=ye-1;Ue>=0;--Ue){const wt=P(ze[Ue],!0);wt.__removalCount=(b.__removalCount||0)+1,oe.insertBefore(wt,ne(b))}}}return ut(b),!0}return b instanceof d&&!es(b)||(L==="noscript"||L==="noembed"||L==="noframes")&&qe(/<\/no(script|embed|frames)/i,b.innerHTML)?(ut(b),!0):(Me&&b.nodeType===vr.text&&(T=b.textContent,uo([_e,rt,Z],oe=>{T=br(T,oe," ")}),b.textContent!==T&&(mr(t.removed,{element:b.cloneNode()}),b.textContent=T)),yt(K.afterSanitizeElements,b,null),!1)},Ho=function(b,T,L){if(No&&(T==="id"||T==="name")&&(L in n||L in Mo))return!1;if(!(be&&!Xe[T]&&qe(re,T))){if(!(ve&&qe(Re,T))){if(!(Ve.attributeCheck instanceof Function&&Ve.attributeCheck(T,b))){if(!W[T]||Xe[T]){if(!(Fo(b)&&(J.tagNameCheck instanceof RegExp&&qe(J.tagNameCheck,b)||J.tagNameCheck instanceof Function&&J.tagNameCheck(b))&&(J.attributeNameCheck instanceof RegExp&&qe(J.attributeNameCheck,T)||J.attributeNameCheck instanceof Function&&J.attributeNameCheck(T,b))||T==="is"&&J.allowCustomizedBuiltInElements&&(J.tagNameCheck instanceof RegExp&&qe(J.tagNameCheck,L)||J.tagNameCheck instanceof Function&&J.tagNameCheck(L))))return!1}else if(!zr[T]){if(!qe(vn,br(L,bt,""))){if(!((T==="src"||T==="xlink:href"||T==="href")&&b!=="script"&&Gg(L,"data:")===0&&ae[b])){if(!($o&&!qe(Le,br(L,bt,"")))){if(L)return!1}}}}}}}return!0},Fo=function(b){return b!=="annotation-xml"&&Pi(b,kt)},Dr=function(b){yt(K.beforeSanitizeAttributes,b,null);const{attributes:T}=b;if(!T||Or(b))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:W,forceKeepAttr:void 0};let oe=T.length;for(;oe--;){const ze=T[oe],{name:ye,namespaceURI:Ue,value:wt}=ze,Lt=ce(ye),Mr=wt;let Ce=ye==="value"?Mr:Wg(Mr);if(L.attrName=Lt,L.attrValue=Ce,L.keepAttr=!0,L.forceKeepAttr=void 0,yt(K.uponSanitizeAttribute,b,L),Ce=L.attrValue,Pr&&(Lt==="id"||Lt==="name")&&(dt(ye,b),Ce=Vi+Ce),yn&&qe(/((--!?|])>)|<\/(style|title|textarea)/i,Ce)){dt(ye,b);continue}if(Lt==="attributename"&&Pi(Ce,"href")){dt(ye,b);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){dt(ye,b);continue}if(!Cr&&qe(/\/>/i,Ce)){dt(ye,b);continue}Me&&uo([_e,rt,Z],Go=>{Ce=br(Ce,Go," ")});const Bo=ce(b.nodeName);if(!Ho(Bo,Lt,Ce)){dt(ye,b);continue}if(S&&typeof _=="object"&&typeof _.getAttributeType=="function"&&!Ue)switch(_.getAttributeType(Bo,Lt)){case"TrustedHTML":{Ce=S.createHTML(Ce);break}case"TrustedScriptURL":{Ce=S.createScriptURL(Ce);break}}if(Ce!==Mr)try{Ue?b.setAttributeNS(Ue,ye,Ce):b.setAttribute(ye,Ce),Or(b)?ut(b):Ka(t.removed)}catch{dt(ye,b)}}yt(K.afterSanitizeAttributes,b,null)},Ht=function D(b){let T=null;const L=Nr(b);for(yt(K.beforeSanitizeShadowDOM,b,null);T=L.nextNode();)yt(K.uponSanitizeShadowNode,T,null),qo(T),Dr(T),T.content instanceof s&&D(T.content);yt(K.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(D){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},T=null,L=null,oe=null,ze=null;if(Tn=!D,Tn&&(D="<!-->"),typeof D!="string"&&!Zo(D))if(typeof D.toString=="function"){if(D=D.toString(),typeof D!="string")throw kr("dirty is not a string, aborting")}else throw kr("toString is not a function");if(!t.isSupported)return D;if(Zt||ir(b),t.removed=[],typeof D=="string"&&(Sn=!1),Sn){if(D.nodeName){const wt=ce(D.nodeName);if(!me[wt]||Je[wt])throw kr("root node is forbidden and cannot be sanitized in-place")}}else if(D instanceof u)T=jo("<!---->"),L=T.ownerDocument.importNode(D,!0),L.nodeType===vr.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?T=L:T.appendChild(L);else{if(!tn&&!Me&&!jt&&D.indexOf("<")===-1)return S&&xn?S.createHTML(D):D;if(T=jo(D),!T)return tn?null:xn?C:""}T&&er&&ut(T.firstChild);const ye=Nr(Sn?D:T);for(;oe=ye.nextNode();)qo(oe),Dr(oe),oe.content instanceof s&&Ht(oe.content);if(Sn)return D;if(tn){if(wn)for(ze=ke.call(T.ownerDocument);T.firstChild;)ze.appendChild(T.firstChild);else ze=T;return(W.shadowroot||W.shadowrootmode)&&(ze=nt.call(r,ze,!0)),ze}let Ue=jt?T.outerHTML:T.innerHTML;return jt&&me["!doctype"]&&T.ownerDocument&&T.ownerDocument.doctype&&T.ownerDocument.doctype.name&&qe(oc,T.ownerDocument.doctype.name)&&(Ue="<!DOCTYPE "+T.ownerDocument.doctype.name+`>
|
|
1440
|
-
`+
|
|
1455
|
+
`}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>${At(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=Ga(e);if(o===null)return r;e=o;let s='<a href="'+e+'"';return t&&(s+=' title="'+At(t)+'"'),s+=">"+r+"</a>",s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let o=Ga(e);if(o===null)return At(n);e=o;let s=`<img src="${e}" alt="${At(n)}"`;return t&&(s+=` title="${At(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:At(e.text)}},Ei=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}},gt=class ls{constructor(t){ae(this,"options");ae(this,"renderer");ae(this,"textRenderer");this.options=t||pn,this.options.renderer=this.options.renderer||new po,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ei}static parse(t,n){return new ls(n).parse(t)}static parseInline(t,n){return new ls(n).parseInline(t)}parse(t){var r,o;this.renderer.parser=this;let n="";for(let s=0;s<t.length;s++){let a=t[s];if((o=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&o[a.type]){let d=a,h=this.options.extensions.renderers[d.type].call({parser:this},d);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(d.type)){n+=h||"";continue}}let u=a;switch(u.type){case"space":{n+=this.renderer.space(u);break}case"hr":{n+=this.renderer.hr(u);break}case"heading":{n+=this.renderer.heading(u);break}case"code":{n+=this.renderer.code(u);break}case"table":{n+=this.renderer.table(u);break}case"blockquote":{n+=this.renderer.blockquote(u);break}case"list":{n+=this.renderer.list(u);break}case"checkbox":{n+=this.renderer.checkbox(u);break}case"html":{n+=this.renderer.html(u);break}case"def":{n+=this.renderer.def(u);break}case"paragraph":{n+=this.renderer.paragraph(u);break}case"text":{n+=this.renderer.text(u);break}default:{let d='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return n}parseInline(t,n=this.renderer){var o,s;this.renderer.parser=this;let r="";for(let a=0;a<t.length;a++){let u=t[a];if((s=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&s[u.type]){let h=this.options.extensions.renderers[u.type].call({parser:this},u);if(h!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(u.type)){r+=h||"";continue}}let d=u;switch(d.type){case"escape":{r+=n.text(d);break}case"html":{r+=n.html(d);break}case"link":{r+=n.link(d);break}case"image":{r+=n.image(d);break}case"checkbox":{r+=n.checkbox(d);break}case"strong":{r+=n.strong(d);break}case"em":{r+=n.em(d);break}case"codespan":{r+=n.codespan(d);break}case"br":{r+=n.br(d);break}case"del":{r+=n.del(d);break}case"text":{r+=n.text(d);break}default:{let h='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return r}},br=(No=class{constructor(e){ae(this,"options");ae(this,"block");this.options=e||pn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?ft.lex:ft.lexInline}provideParser(e=this.block){return e?gt.parse:gt.parseInline}},ae(No,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ae(No,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),No),Ug=class{constructor(...e){ae(this,"defaults",ki());ae(this,"options",this.setOptions);ae(this,"parse",this.parseMarkdown(!0));ae(this,"parseInline",this.parseMarkdown(!1));ae(this,"Parser",gt);ae(this,"Renderer",po);ae(this,"TextRenderer",Ei);ae(this,"Lexer",ft);ae(this,"Tokenizer",uo);ae(this,"Hooks",br);this.use(...e)}walkTokens(e,t){var r,o;let n=[];for(let s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{let a=s;for(let u of a.header)n=n.concat(this.walkTokens(u.tokens,t));for(let u of a.rows)for(let d of u)n=n.concat(this.walkTokens(d.tokens,t));break}case"list":{let a=s;n=n.concat(this.walkTokens(a.items,t));break}default:{let a=s;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(u=>{let d=a[u].flat(1/0);n=n.concat(this.walkTokens(d,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={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let s=t.renderers[o.name];s?t.renderers[o.name]=function(...a){let u=o.renderer.apply(this,a);return u===!1&&(u=s.apply(this,a)),u}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=t[o.level];s?s.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),r.extensions=t),n.renderer){let o=this.defaults.renderer||new po(this.defaults);for(let s in n.renderer){if(!(s in o))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,u=n.renderer[a],d=o[a];o[a]=(...h)=>{let p=u.apply(o,h);return p===!1&&(p=d.apply(o,h)),p||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new uo(this.defaults);for(let s in n.tokenizer){if(!(s in o))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,u=n.tokenizer[a],d=o[a];o[a]=(...h)=>{let p=u.apply(o,h);return p===!1&&(p=d.apply(o,h)),p}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new br;for(let s in n.hooks){if(!(s in o))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let a=s,u=n.hooks[a],d=o[a];br.passThroughHooks.has(s)?o[a]=h=>{if(this.defaults.async&&br.passThroughHooksRespectAsync.has(s))return(async()=>{let b=await u.call(o,h);return d.call(o,b)})();let p=u.call(o,h);return d.call(o,p)}:o[a]=(...h)=>{if(this.defaults.async)return(async()=>{let b=await u.apply(o,h);return b===!1&&(b=await d.apply(o,h)),b})();let p=u.apply(o,h);return p===!1&&(p=d.apply(o,h)),p}}r.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,s=n.walkTokens;r.walkTokens=function(a){let u=[];return u.push(s.call(this,a)),o&&(u=u.concat(o.call(this,a))),u}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ft.lex(e,t??this.defaults)}parser(e,t){return gt.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},o={...this.defaults,...r},s=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let a=o.hooks?await o.hooks.preprocess(t):t,u=await(o.hooks?await o.hooks.provideLexer(e):e?ft.lex:ft.lexInline)(a,o),d=o.hooks?await o.hooks.processAllTokens(u):u;o.walkTokens&&await Promise.all(this.walkTokens(d,o.walkTokens));let h=await(o.hooks?await o.hooks.provideParser(e):e?gt.parse:gt.parseInline)(d,o);return o.hooks?await o.hooks.postprocess(h):h})().catch(s);try{o.hooks&&(t=o.hooks.preprocess(t));let a=(o.hooks?o.hooks.provideLexer(e):e?ft.lex:ft.lexInline)(t,o);o.hooks&&(a=o.hooks.processAllTokens(a)),o.walkTokens&&this.walkTokens(a,o.walkTokens);let u=(o.hooks?o.hooks.provideParser(e):e?gt.parse:gt.parseInline)(a,o);return o.hooks&&(u=o.hooks.postprocess(u)),u}catch(a){return s(a)}}}onError(e,t){return n=>{if(n.message+=`
|
|
1456
|
+
Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+At(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},fn=new Ug;function ne(e,t){return fn.parse(e,t)}ne.options=ne.setOptions=function(e){return fn.setOptions(e),ne.defaults=fn.defaults,Ia(ne.defaults),ne},ne.getDefaults=ki,ne.defaults=pn;function jg(...e){return fn.use(...e),ne.defaults=fn.defaults,Ia(ne.defaults),ne}ne.use=jg,ne.walkTokens=function(e,t){return fn.walkTokens(e,t)},ne.parseInline=fn.parseInline,ne.Parser=gt,ne.parser=gt.parse,ne.Renderer=po,ne.TextRenderer=Ei,ne.Lexer=ft,ne.lexer=ft.lex,ne.Tokenizer=uo,ne.Hooks=br,ne.parse=ne,ne.options,ne.setOptions,ne.walkTokens,ne.parseInline,gt.parse,ft.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:Va,setPrototypeOf:Ya,isFrozen:Zg,getPrototypeOf:qg,getOwnPropertyDescriptor:Hg}=Object;let{freeze:Fe,seal:at,create:Ai}=Object,{apply:Ci,construct:Pi}=typeof Reflect<"u"&&Reflect;Fe||(Fe=function(t){return t}),at||(at=function(t){return t}),Ci||(Ci=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];return t.apply(n,o)}),Pi||(Pi=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new t(...r)});const ho=Ge(Array.prototype.forEach),Fg=Ge(Array.prototype.lastIndexOf),Ka=Ge(Array.prototype.pop),kr=Ge(Array.prototype.push),Bg=Ge(Array.prototype.splice),fo=Ge(String.prototype.toLowerCase),Ri=Ge(String.prototype.toString),Li=Ge(String.prototype.match),_r=Ge(String.prototype.replace),Gg=Ge(String.prototype.indexOf),Wg=Ge(String.prototype.trim),mt=Ge(Object.prototype.hasOwnProperty),Be=Ge(RegExp.prototype.test),vr=Jg(TypeError);function Ge(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 Ci(e,t,r)}}function Jg(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Pi(e,n)}}function B(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:fo;Ya&&Ya(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const s=n(o);s!==o&&(Zg(t)||(t[r]=s),o=s)}e[o]=!0}return e}function Xg(e){for(let t=0;t<e.length;t++)mt(e,t)||(e[t]=null);return e}function Ct(e){const t=Ai(null);for(const[n,r]of Va(e))mt(e,n)&&(Array.isArray(r)?t[n]=Xg(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=Ct(r):t[n]=r);return t}function yr(e,t){for(;e!==null;){const r=Hg(e,t);if(r){if(r.get)return Ge(r.get);if(typeof r.value=="function")return Ge(r.value)}e=qg(e)}function n(){return null}return n}const Qa=Fe(["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"]),zi=Fe(["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"]),Ii=Fe(["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"]),Vg=Fe(["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"]),$i=Fe(["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"]),Yg=Fe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ec=Fe(["#text"]),tc=Fe(["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"]),Ni=Fe(["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"]),nc=Fe(["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"]),go=Fe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Kg=at(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Qg=at(/<%[\w\W]*|[\w\W]*%>/gm),em=at(/\$\{[\w\W]*/gm),tm=at(/^data-[\-\w.\u00B7-\uFFFF]+$/),nm=at(/^aria-[\-\w]+$/),rc=at(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),rm=at(/^(?:\w+script|data):/i),om=at(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),oc=at(/^html$/i),im=at(/^[a-z][.\w]*(-[.\w]+)+$/i);var ic=Object.freeze({__proto__:null,ARIA_ATTR:nm,ATTR_WHITESPACE:om,CUSTOM_ELEMENT:im,DATA_ATTR:tm,DOCTYPE_NAME:oc,ERB_EXPR:Qg,IS_ALLOWED_URI:rc,IS_SCRIPT_OR_DATA:rm,MUSTACHE_EXPR:Kg,TMPLIT_EXPR:em});const wr={element:1,text:3,progressingInstruction:7,comment:8,document:9},sm=function(){return typeof window>"u"?null:window},am=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},sc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ac(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:sm();const t=O=>ac(O);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==wr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:a,Node:u,Element:d,NodeFilter:h,NamedNodeMap:p=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:b,DOMParser:m,trustedTypes:_}=e,w=d.prototype,C=yr(w,"cloneNode"),M=yr(w,"remove"),W=yr(w,"nextSibling"),P=yr(w,"childNodes"),T=yr(w,"parentNode");if(typeof a=="function"){const O=n.createElement("template");O.content&&O.content.ownerDocument&&(n=O.content.ownerDocument)}let x,R="";const{implementation:D,createNodeIterator:pe,createDocumentFragment:_e,getElementsByTagName:Ce}=n,{importNode:Ve}=r;let V=sc();t.isSupported=typeof Va=="function"&&typeof T=="function"&&D&&D.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Pe,ERB_EXPR:Ze,TMPLIT_EXPR:kt,DATA_ATTR:rn,ARIA_ATTR:rt,IS_SCRIPT_OR_DATA:Zt,ATTR_WHITESPACE:Z,CUSTOM_ELEMENT:Q}=ic;let{IS_ALLOWED_URI:De}=ic,J=null;const _t=B({},[...Qa,...zi,...Ii,...$i,...ec]);let oe=null;const xn=B({},[...tc,...Ni,...nc,...go]);let ce=Object.seal(Ai(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}})),ie=null,Re=null;const Le=Object.seal(Ai(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ee=!0,Te=!0,tt=!1,lt=!0,ze=!1,ut=!0,qt=!1,Ht=!1,nr=!1,on=!1,Sn=!1,Tn=!1,Oo=!0,Lr=!1;const Yi="user-content-";let zr=!0,En=!1,sn={},Ye=null;const Ir=B({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let le=null;const Do=B({},["audio","video","img","source","image","track"]);let $r=null;const Mo=B({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),rr="http://www.w3.org/1998/Math/MathML",or="http://www.w3.org/2000/svg",vt="http://www.w3.org/1999/xhtml";let an=vt,An=!1,Cn=null;const Ki=B({},[rr,or,vt],Ri);let ir=B({},["mi","mo","mn","ms","mtext"]),sr=B({},["annotation-xml"]);const Qi=B({},["title","style","font","a","script"]);let Ft=null;const yt=["application/xhtml+xml","text/html"],es="text/html";let ue=null,cn=null;const Uo=n.createElement("form"),Nr=function(k){return k instanceof RegExp||k instanceof Function},ar=function(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(cn&&cn===k)){if((!k||typeof k!="object")&&(k={}),k=Ct(k),Ft=yt.indexOf(k.PARSER_MEDIA_TYPE)===-1?es:k.PARSER_MEDIA_TYPE,ue=Ft==="application/xhtml+xml"?Ri:fo,J=mt(k,"ALLOWED_TAGS")?B({},k.ALLOWED_TAGS,ue):_t,oe=mt(k,"ALLOWED_ATTR")?B({},k.ALLOWED_ATTR,ue):xn,Cn=mt(k,"ALLOWED_NAMESPACES")?B({},k.ALLOWED_NAMESPACES,Ri):Ki,$r=mt(k,"ADD_URI_SAFE_ATTR")?B(Ct(Mo),k.ADD_URI_SAFE_ATTR,ue):Mo,le=mt(k,"ADD_DATA_URI_TAGS")?B(Ct(Do),k.ADD_DATA_URI_TAGS,ue):Do,Ye=mt(k,"FORBID_CONTENTS")?B({},k.FORBID_CONTENTS,ue):Ir,ie=mt(k,"FORBID_TAGS")?B({},k.FORBID_TAGS,ue):Ct({}),Re=mt(k,"FORBID_ATTR")?B({},k.FORBID_ATTR,ue):Ct({}),sn=mt(k,"USE_PROFILES")?k.USE_PROFILES:!1,ee=k.ALLOW_ARIA_ATTR!==!1,Te=k.ALLOW_DATA_ATTR!==!1,tt=k.ALLOW_UNKNOWN_PROTOCOLS||!1,lt=k.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ze=k.SAFE_FOR_TEMPLATES||!1,ut=k.SAFE_FOR_XML!==!1,qt=k.WHOLE_DOCUMENT||!1,on=k.RETURN_DOM||!1,Sn=k.RETURN_DOM_FRAGMENT||!1,Tn=k.RETURN_TRUSTED_TYPE||!1,nr=k.FORCE_BODY||!1,Oo=k.SANITIZE_DOM!==!1,Lr=k.SANITIZE_NAMED_PROPS||!1,zr=k.KEEP_CONTENT!==!1,En=k.IN_PLACE||!1,De=k.ALLOWED_URI_REGEXP||rc,an=k.NAMESPACE||vt,ir=k.MATHML_TEXT_INTEGRATION_POINTS||ir,sr=k.HTML_INTEGRATION_POINTS||sr,ce=k.CUSTOM_ELEMENT_HANDLING||{},k.CUSTOM_ELEMENT_HANDLING&&Nr(k.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ce.tagNameCheck=k.CUSTOM_ELEMENT_HANDLING.tagNameCheck),k.CUSTOM_ELEMENT_HANDLING&&Nr(k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ce.attributeNameCheck=k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),k.CUSTOM_ELEMENT_HANDLING&&typeof k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ce.allowCustomizedBuiltInElements=k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ze&&(Te=!1),Sn&&(on=!0),sn&&(J=B({},ec),oe=[],sn.html===!0&&(B(J,Qa),B(oe,tc)),sn.svg===!0&&(B(J,zi),B(oe,Ni),B(oe,go)),sn.svgFilters===!0&&(B(J,Ii),B(oe,Ni),B(oe,go)),sn.mathMl===!0&&(B(J,$i),B(oe,nc),B(oe,go))),k.ADD_TAGS&&(typeof k.ADD_TAGS=="function"?Le.tagCheck=k.ADD_TAGS:(J===_t&&(J=Ct(J)),B(J,k.ADD_TAGS,ue))),k.ADD_ATTR&&(typeof k.ADD_ATTR=="function"?Le.attributeCheck=k.ADD_ATTR:(oe===xn&&(oe=Ct(oe)),B(oe,k.ADD_ATTR,ue))),k.ADD_URI_SAFE_ATTR&&B($r,k.ADD_URI_SAFE_ATTR,ue),k.FORBID_CONTENTS&&(Ye===Ir&&(Ye=Ct(Ye)),B(Ye,k.FORBID_CONTENTS,ue)),k.ADD_FORBID_CONTENTS&&(Ye===Ir&&(Ye=Ct(Ye)),B(Ye,k.ADD_FORBID_CONTENTS,ue)),zr&&(J["#text"]=!0),qt&&B(J,["html","head","body"]),J.table&&(B(J,["tbody"]),delete ie.tbody),k.TRUSTED_TYPES_POLICY){if(typeof k.TRUSTED_TYPES_POLICY.createHTML!="function")throw vr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof k.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw vr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');x=k.TRUSTED_TYPES_POLICY,R=x.createHTML("")}else x===void 0&&(x=am(_,o)),x!==null&&typeof R=="string"&&(R=x.createHTML(""));Fe&&Fe(k),cn=k}},Or=B({},[...zi,...Ii,...Vg]),jo=B({},[...$i,...Yg]),ts=function(k){let S=T(k);(!S||!S.tagName)&&(S={namespaceURI:an,tagName:"template"});const L=fo(k.tagName),se=fo(S.tagName);return Cn[k.namespaceURI]?k.namespaceURI===or?S.namespaceURI===vt?L==="svg":S.namespaceURI===rr?L==="svg"&&(se==="annotation-xml"||ir[se]):!!Or[L]:k.namespaceURI===rr?S.namespaceURI===vt?L==="math":S.namespaceURI===or?L==="math"&&sr[se]:!!jo[L]:k.namespaceURI===vt?S.namespaceURI===or&&!sr[se]||S.namespaceURI===rr&&!ir[se]?!1:!jo[L]&&(Qi[L]||!Or[L]):!!(Ft==="application/xhtml+xml"&&Cn[k.namespaceURI]):!1},dt=function(k){kr(t.removed,{element:k});try{T(k).removeChild(k)}catch{M(k)}},pt=function(k,S){try{kr(t.removed,{attribute:S.getAttributeNode(k),from:S})}catch{kr(t.removed,{attribute:null,from:S})}if(S.removeAttribute(k),k==="is")if(on||Sn)try{dt(S)}catch{}else try{S.setAttribute(k,"")}catch{}},Zo=function(k){let S=null,L=null;if(nr)k="<remove></remove>"+k;else{const ve=Li(k,/^[\r\n\t ]+/);L=ve&&ve[0]}Ft==="application/xhtml+xml"&&an===vt&&(k='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+k+"</body></html>");const se=x?x.createHTML(k):k;if(an===vt)try{S=new m().parseFromString(se,Ft)}catch{}if(!S||!S.documentElement){S=D.createDocument(an,"template",null);try{S.documentElement.innerHTML=An?R:se}catch{}}const $e=S.body||S.documentElement;return k&&L&&$e.insertBefore(n.createTextNode(L),$e.childNodes[0]||null),an===vt?Ce.call(S,qt?"html":"body")[0]:qt?S.documentElement:$e},Dr=function(k){return pe.call(k.ownerDocument||k,k,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Mr=function(k){return k instanceof b&&(typeof k.nodeName!="string"||typeof k.textContent!="string"||typeof k.removeChild!="function"||!(k.attributes instanceof p)||typeof k.removeAttribute!="function"||typeof k.setAttribute!="function"||typeof k.namespaceURI!="string"||typeof k.insertBefore!="function"||typeof k.hasChildNodes!="function")},qo=function(k){return typeof u=="function"&&k instanceof u};function wt(O,k,S){ho(O,L=>{L.call(t,k,S,cn)})}const Ho=function(k){let S=null;if(wt(V.beforeSanitizeElements,k,null),Mr(k))return dt(k),!0;const L=ue(k.nodeName);if(wt(V.uponSanitizeElement,k,{tagName:L,allowedTags:J}),ut&&k.hasChildNodes()&&!qo(k.firstElementChild)&&Be(/<[/\w!]/g,k.innerHTML)&&Be(/<[/\w!]/g,k.textContent)||k.nodeType===wr.progressingInstruction||ut&&k.nodeType===wr.comment&&Be(/<[/\w]/g,k.data))return dt(k),!0;if(!(Le.tagCheck instanceof Function&&Le.tagCheck(L))&&(!J[L]||ie[L])){if(!ie[L]&&Bo(L)&&(ce.tagNameCheck instanceof RegExp&&Be(ce.tagNameCheck,L)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(L)))return!1;if(zr&&!Ye[L]){const se=T(k)||k.parentNode,$e=P(k)||k.childNodes;if($e&&se){const ve=$e.length;for(let qe=ve-1;qe>=0;--qe){const xt=C($e[qe],!0);xt.__removalCount=(k.__removalCount||0)+1,se.insertBefore(xt,W(k))}}}return dt(k),!0}return k instanceof d&&!ts(k)||(L==="noscript"||L==="noembed"||L==="noframes")&&Be(/<\/no(script|embed|frames)/i,k.innerHTML)?(dt(k),!0):(ze&&k.nodeType===wr.text&&(S=k.textContent,ho([Pe,Ze,kt],se=>{S=_r(S,se," ")}),k.textContent!==S&&(kr(t.removed,{element:k.cloneNode()}),k.textContent=S)),wt(V.afterSanitizeElements,k,null),!1)},Fo=function(k,S,L){if(Oo&&(S==="id"||S==="name")&&(L in n||L in Uo))return!1;if(!(Te&&!Re[S]&&Be(rn,S))){if(!(ee&&Be(rt,S))){if(!(Le.attributeCheck instanceof Function&&Le.attributeCheck(S,k))){if(!oe[S]||Re[S]){if(!(Bo(k)&&(ce.tagNameCheck instanceof RegExp&&Be(ce.tagNameCheck,k)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(k))&&(ce.attributeNameCheck instanceof RegExp&&Be(ce.attributeNameCheck,S)||ce.attributeNameCheck instanceof Function&&ce.attributeNameCheck(S,k))||S==="is"&&ce.allowCustomizedBuiltInElements&&(ce.tagNameCheck instanceof RegExp&&Be(ce.tagNameCheck,L)||ce.tagNameCheck instanceof Function&&ce.tagNameCheck(L))))return!1}else if(!$r[S]){if(!Be(De,_r(L,Z,""))){if(!((S==="src"||S==="xlink:href"||S==="href")&&k!=="script"&&Gg(L,"data:")===0&&le[k])){if(!(tt&&!Be(Zt,_r(L,Z,"")))){if(L)return!1}}}}}}}return!0},Bo=function(k){return k!=="annotation-xml"&&Li(k,Q)},Ur=function(k){wt(V.beforeSanitizeAttributes,k,null);const{attributes:S}=k;if(!S||Mr(k))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:oe,forceKeepAttr:void 0};let se=S.length;for(;se--;){const $e=S[se],{name:ve,namespaceURI:qe,value:xt}=$e,zt=ue(ve),jr=xt;let Ie=ve==="value"?jr:Wg(jr);if(L.attrName=zt,L.attrValue=Ie,L.keepAttr=!0,L.forceKeepAttr=void 0,wt(V.uponSanitizeAttribute,k,L),Ie=L.attrValue,Lr&&(zt==="id"||zt==="name")&&(pt(ve,k),Ie=Yi+Ie),ut&&Be(/((--!?|])>)|<\/(style|title|textarea)/i,Ie)){pt(ve,k);continue}if(zt==="attributename"&&Li(Ie,"href")){pt(ve,k);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){pt(ve,k);continue}if(!lt&&Be(/\/>/i,Ie)){pt(ve,k);continue}ze&&ho([Pe,Ze,kt],Wo=>{Ie=_r(Ie,Wo," ")});const Go=ue(k.nodeName);if(!Fo(Go,zt,Ie)){pt(ve,k);continue}if(x&&typeof _=="object"&&typeof _.getAttributeType=="function"&&!qe)switch(_.getAttributeType(Go,zt)){case"TrustedHTML":{Ie=x.createHTML(Ie);break}case"TrustedScriptURL":{Ie=x.createScriptURL(Ie);break}}if(Ie!==jr)try{qe?k.setAttributeNS(qe,ve,Ie):k.setAttribute(ve,Ie),Mr(k)?dt(k):Ka(t.removed)}catch{pt(ve,k)}}wt(V.afterSanitizeAttributes,k,null)},Bt=function O(k){let S=null;const L=Dr(k);for(wt(V.beforeSanitizeShadowDOM,k,null);S=L.nextNode();)wt(V.uponSanitizeShadowNode,S,null),Ho(S),Ur(S),S.content instanceof s&&O(S.content);wt(V.afterSanitizeShadowDOM,k,null)};return t.sanitize=function(O){let k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=null,L=null,se=null,$e=null;if(An=!O,An&&(O="<!-->"),typeof O!="string"&&!qo(O))if(typeof O.toString=="function"){if(O=O.toString(),typeof O!="string")throw vr("dirty is not a string, aborting")}else throw vr("toString is not a function");if(!t.isSupported)return O;if(Ht||ar(k),t.removed=[],typeof O=="string"&&(En=!1),En){if(O.nodeName){const xt=ue(O.nodeName);if(!J[xt]||ie[xt])throw vr("root node is forbidden and cannot be sanitized in-place")}}else if(O instanceof u)S=Zo("<!---->"),L=S.ownerDocument.importNode(O,!0),L.nodeType===wr.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?S=L:S.appendChild(L);else{if(!on&&!ze&&!qt&&O.indexOf("<")===-1)return x&&Tn?x.createHTML(O):O;if(S=Zo(O),!S)return on?null:Tn?R:""}S&&nr&&dt(S.firstChild);const ve=Dr(En?O:S);for(;se=ve.nextNode();)Ho(se),Ur(se),se.content instanceof s&&Bt(se.content);if(En)return O;if(on){if(Sn)for($e=_e.call(S.ownerDocument);S.firstChild;)$e.appendChild(S.firstChild);else $e=S;return(oe.shadowroot||oe.shadowrootmode)&&($e=Ve.call(r,$e,!0)),$e}let qe=qt?S.outerHTML:S.innerHTML;return qt&&J["!doctype"]&&S.ownerDocument&&S.ownerDocument.doctype&&S.ownerDocument.doctype.name&&Be(oc,S.ownerDocument.doctype.name)&&(qe="<!DOCTYPE "+S.ownerDocument.doctype.name+`>
|
|
1457
|
+
`+qe),ze&&ho([Pe,Ze,kt],xt=>{qe=_r(qe,xt," ")}),x&&Tn?x.createHTML(qe):qe},t.setConfig=function(){let O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ar(O),Ht=!0},t.clearConfig=function(){cn=null,Ht=!1},t.isValidAttribute=function(O,k,S){cn||ar({});const L=ue(O),se=ue(k);return Fo(L,se,S)},t.addHook=function(O,k){typeof k=="function"&&kr(V[O],k)},t.removeHook=function(O,k){if(k!==void 0){const S=Fg(V[O],k);return S===-1?void 0:Bg(V[O],S,1)[0]}return Ka(V[O])},t.removeHooks=function(O){V[O]=[]},t.removeAllHooks=function(){V=sc()},t}var cm=ac();function cc(e){const t=ne.parse(e,{gfm:!0,breaks:!0,async:!1});return cm.sanitize(t)}const lc=1e3,uc=32,dc=15e3,lm=new Set(["completed","failed","cancelled"]),um=4e3;let z=null,Pt=null,Oe=null,Oi=null,mo=null,Di=!1,bo=null,xr=null,U={kind:"connecting"},Fn=[],Bn=null,be=null,Gn=null,Dt=null,Sr=-1,We=null,Mt=!1,Ut=null,gn=new Set;function Mi(){ko(),Aa(),Pt&&clearInterval(Pt),Pt=null,Ut==null||Ut(),Ut=null,Oe==null||Oe.destroy(),Oe=null,z&&Nt(z),z==null||z.remove(),z=null,Oi=null,U={kind:"connecting"},Fn=[],Bn=null,be=null,Gn=null,Dt=null,mo=null,Sr=-1,We=null,Mt=!1,gn=new Set}function Ui(e,t,n,r,o){z&&Mi(),Oi=o??null,U={kind:"connecting"},Fn=[],Bn=null,Sr=-1,We=null,Mt=!1,gn=new Set,be=e,Gn=n,Dt=t,mo=r,Ea({taskId:e,backendUrl:n,title:r}),z=document.createElement("div"),z.className="ap-sdk-panel",z.setAttribute("data-ap-sdk","1"),z.setAttribute("role","dialog"),z.setAttribute("aria-modal","true"),z.setAttribute("aria-label","Automation in progress");const s=r.length>55?`${r.slice(0,52)}…`:r;z.innerHTML=`
|
|
1441
1458
|
<div class="ap-sdk-panel__header">
|
|
1442
1459
|
<span class="ap-sdk-panel__title">
|
|
1443
1460
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1450,7 +1467,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
|
|
|
1450
1467
|
<div class="ap-sdk-runner__meta">
|
|
1451
1468
|
<div class="ap-sdk-runner__meta-row">
|
|
1452
1469
|
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--automate">Automate</span>
|
|
1453
|
-
<span class="ap-sdk-runner__title" title="${wm(r)}">${
|
|
1470
|
+
<span class="ap-sdk-runner__title" title="${wm(r)}">${Zi(s)}</span>
|
|
1454
1471
|
</div>
|
|
1455
1472
|
<div class="ap-sdk-runner__meta-row ap-sdk-runner__meta-row--controls">
|
|
1456
1473
|
<span class="ap-sdk-runner__counter" data-ap-runner-counter>0 actions</span>
|
|
@@ -1476,17 +1493,17 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
|
|
|
1476
1493
|
</div>
|
|
1477
1494
|
<div class="ap-sdk-runner__hint" data-ap-runner-hint>Closing keeps the task running — resume anytime from My Captures.</div>
|
|
1478
1495
|
<div class="ap-sdk-panel__status" data-ap-runner-summary style="display:none"></div>
|
|
1479
|
-
`,z.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),z.addEventListener("touchmove",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild(z),
|
|
1480
|
-
<div class="ap-sdk-runner__question-label">${
|
|
1481
|
-
<div class="ap-sdk-runner__question-text ap-sdk-markdown">${cc((n==null?void 0:n.question)||
|
|
1496
|
+
`,z.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),z.addEventListener("touchmove",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild(z),Oe=Qo(),$t(z),bi(z,mi),z.querySelector("[data-ap-close]").addEventListener("click",()=>{Mi(),o==null||o()}),z.querySelector("[data-ap-runner-chat-form]").addEventListener("submit",a=>{a.preventDefault(),hm(t,e)}),z.querySelector("[data-ap-runner-cancel]").addEventListener("click",a=>{a.stopPropagation();const u=a.currentTarget;if(!Di){Di=!0,u.textContent="Confirm",bo=setTimeout(ko,um),xr=d=>{d.target!==u&&ko()},document.addEventListener("click",xr,!0);return}ko(),dm(t,e)}),ji(),pc(e,t)}function pc(e,t){const n=async u=>{if(be!==e||!z||U.kind!=="idle"&&U.kind!=="connecting"||gn.has(u.commandId))return;gn.add(u.commandId);const d={id:u.commandId,taskId:u.taskId,action:u.action,selector:u.selector,value:u.value,description:u.description,status:"pending",createdAt:new Date().toISOString()};mn({kind:"executing",command:d,actionsRun:U.kind==="idle"?U.actionsRun:0}),await fc(d,t,e)},r=u=>{if(!(be!==e||!z)&&lm.has(u)){if(U.kind==="executing")mn({kind:"finishing",status:u,actionsRun:U.actionsRun});else if(U.kind==="connecting"||U.kind==="idle"){const d=U.kind==="idle"?U.actionsRun:0;mn({kind:"finished",status:u,actionsRun:d})}}},o=u=>{be!==e||!z||(u.outputChunk&&gc([u.outputChunk]),r(u.status))},s=async()=>{if(!(be!==e||!z))try{const u=await oo(t,e);be===e&&z&&(We=u[0]??null,bn())}catch{}},a=async()=>{try{const[u,d,h,p]=await Promise.all([wa(t,e),Tf(t,e),oo(t,e),xf(t,e)]);if(be!==e||!z)return;gc(d),We=h[0]??null,bn(),r(u.status),p&&p.status==="pending"&&(U.kind==="idle"||U.kind==="connecting")&&!gn.has(p.id)?(gn.add(p.id),mn({kind:"executing",command:p,actionsRun:U.kind==="idle"?U.actionsRun:0}),await fc(p,t,e)):U.kind==="connecting"&&mn({kind:"idle",actionsRun:0})}catch{}};a(),Mf(t,e,{onStatusUpdate:o,onInteractionCreated:s,onInteractionAnswered:s,onBrowserCommandCreated:n,onReconnect:()=>{a()}}).then(u=>{if(be!==e||U.kind==="finished"){u();return}Ut=u})}function mn(e){U=e,U.kind==="idle"&&Bn===null&&(Bn=Date.now(),_o(),Pt=setInterval(_o,lc)),U.kind==="finished"&&(Pt&&(clearInterval(Pt),Pt=null),Ut==null||Ut(),Ut=null,Oe==null||Oe.hide(),Aa()),ji()}function ko(){Di=!1,bo&&(clearTimeout(bo),bo=null),xr&&(document.removeEventListener("click",xr,!0),xr=null);const e=z==null?void 0:z.querySelector("[data-ap-runner-cancel]");e&&(e.textContent="Cancel task")}async function dm(e,t){if(be!==t||!z)return;const n=z.querySelector("[data-ap-runner-cancel]");n&&(n.disabled=!0);try{await Af(e,t)}catch{n&&(n.disabled=!1)}}function hc(){if(!be||!Dt||!Gn||!mo)return;const e=be,t=Dt;Ea({taskId:e,backendUrl:Gn,title:mo}),Pt&&clearInterval(Pt),_o(),Pt=setInterval(_o,lc);const n=U.kind==="finished"?U.actionsRun:0;gn=new Set,U={kind:"idle",actionsRun:n},ji(),pc(e,t)}function ji(){if(!z)return;const e=z.querySelector("[data-ap-runner-status]"),t=z.querySelector("[data-ap-runner-counter]"),n=z.querySelector("[data-ap-runner-log]"),r=z.querySelector("[data-ap-runner-hint]");if(!e||!t||!n||!r)return;const o="actionsRun"in U?U.actionsRun:0;t.textContent=`${o} action${o===1?"":"s"}`,U.kind==="finished"?(e.textContent=U.status.replace(/_/g," "),e.className=`ap-sdk-status-badge ap-sdk-status-badge--${U.status.replace(/_/g,"-")}`,r.style.display="none",vm(U.status)):(e.textContent="running",e.className="ap-sdk-status-badge ap-sdk-status-badge--in-progress",r.style.display="block");const s=n.querySelector("[data-ap-runner-placeholder]");if(Fn.length===0&&(U.kind==="connecting"||U.kind==="idle")){if(!s){const p=document.createElement("div");p.className="ap-sdk-runner__placeholder",p.setAttribute("data-ap-runner-placeholder","1"),p.textContent="Waiting for the agent's first action…",n.appendChild(p)}}else s==null||s.remove();bn();const a=z.querySelector("[data-ap-runner-chat-input]"),u=z.querySelector("[data-ap-runner-chat-send]");if(a&&u){const p=U.kind==="finished"&&U.status==="failed";a.disabled=p,u.disabled=p||Mt,p&&(a.placeholder="This task failed — start a new automation to continue.")}const d=z.querySelector("[data-ap-runner-cancel]");d&&(d.style.display=U.kind==="finished"?"none":"");const h=z.querySelector("[data-ap-runner-summary]");h&&U.kind!=="finished"&&(h.style.display="none",h.innerHTML="")}function bn(){if(!z)return;const e=z.querySelector("[data-ap-runner-question]"),t=z.querySelector("[data-ap-runner-chat-input]");if(!e||!t)return;if(!We){e.style.display="none",e.innerHTML="",t.placeholder="Send a message to the agent…";return}const n=We.questionMetadata,r=(n==null?void 0:n.options)??[];if(t.placeholder="Type your answer…",e.style.display="block",e.innerHTML=`
|
|
1497
|
+
<div class="ap-sdk-runner__question-label">${Zi((n==null?void 0:n.header)||"The agent has a question")}</div>
|
|
1498
|
+
<div class="ap-sdk-runner__question-text ap-sdk-markdown">${cc((n==null?void 0:n.question)||We.question)}</div>
|
|
1482
1499
|
${r.length>0?'<div class="ap-sdk-runner__question-options" data-ap-runner-question-options></div>':""}
|
|
1483
|
-
`,r.length>0){const o=e.querySelector("[data-ap-runner-question-options]");for(const s of r){const a=document.createElement("button");a.type="button",a.className="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-runner__question-option",a.textContent=s.label,a.addEventListener("click",()=>void pm(s.label)),o.appendChild(a)}}}async function pm(e){if(!z||!
|
|
1500
|
+
`,r.length>0){const o=e.querySelector("[data-ap-runner-question-options]");for(const s of r){const a=document.createElement("button");a.type="button",a.className="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-runner__question-option",a.textContent=s.label,a.addEventListener("click",()=>void pm(s.label)),o.appendChild(a)}}}async function pm(e){if(!z||!We||!be||Mt)return;const t=be,n=Dt;if(n){Mt=!0;try{const r={selectedOption:e};await xa(n,t,We.id,r),We=null,bn();const o=await oo(n,t);be===t&&z&&(We=o[0]??null,bn())}catch{const r=z.querySelector("[data-ap-runner-chat-error]");r&&(r.textContent="Failed to send your answer — try again.",r.style.display="block")}finally{Mt=!1}}}function _o(){if(!z||Bn===null)return;const e=z.querySelector("[data-ap-runner-timer]");if(!e)return;const t=Math.max(0,Math.floor((Date.now()-Bn)/1e3)),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");e.textContent=`${n}:${r}`}async function fc(e,t,n){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})`);Oe==null||Oe.update(a),o=gm(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(Oe==null||Oe.update(a),e.action==="click")await jf(a),o="Clicked";else{if(e.value===void 0)throw new Error("inputText command is missing a value");mm(a,e.value),o="Entered text"}}}catch(a){r="error",o=a instanceof Error?a.message:"Unknown error executing command"}if(be===n&&z&&bm(r,e,o),await fm(t,n,e.id,r,o),be!==n||!z)return;Oe==null||Oe.hide();const s=(U.kind==="executing"||U.kind==="finishing"?U.actionsRun:0)+1;U.kind==="finishing"?mn({kind:"finished",status:U.status,actionsRun:s}):U.kind==="executing"&&mn({kind:"idle",actionsRun:s})}async function hm(e,t){if(!z||Mt||U.kind==="finished"&&U.status==="failed")return;const n=z.querySelector("[data-ap-runner-chat-input]"),r=z.querySelector("[data-ap-runner-chat-error]"),o=z.querySelector("[data-ap-runner-chat-send]");if(!n||!r||!o)return;const s=n.value.trim();if(s){Mt=!0,o.disabled=!0,r.style.display="none";try{if(We){await xa(e,t,We.id,s),We=null,bn();try{const a=await oo(e,t);be===t&&z&&(We=a[0]??null,bn())}catch{}}else await Ef(e,t,s),U.kind==="finished"&&hc();n.value=""}catch(a){r.textContent=a instanceof Error?a.message:"Failed to send — try again.",r.style.display="block"}finally{Mt=!1,o.disabled=!1}}}async function fm(e,t,n,r,o){try{await Sf(e,t,n,r,o)}catch{}}function gm(e){const t=e.cloneNode(!0);t.querySelectorAll("script, style, noscript").forEach(o=>o.remove()),zf(t);let n=t.outerHTML,r=!1;return n.length>dc&&(n=n.slice(0,dc),r=!0),`URL: ${location.href}
|
|
1484
1501
|
Title: ${document.title}
|
|
1485
1502
|
|
|
1486
1503
|
${n}${r?`
|
|
1487
|
-
… (truncated)`:""}`}function mm(e,t){var s;const r=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,o=(s=Object.getOwnPropertyDescriptor(r,"value"))==null?void 0:s.set;if(!o)throw new Error("target element does not accept text input");o.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function bm(e,t,n){var
|
|
1504
|
+
… (truncated)`:""}`}function mm(e,t){var s;const r=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,o=(s=Object.getOwnPropertyDescriptor(r,"value"))==null?void 0:s.set;if(!o)throw new Error("target element does not accept text input");o.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function bm(e,t,n){var b;const r=e==="done"?"✓":"✗",o=t.selector?` \`${t.selector}\``:"",s=t.description||`${t.action}${o}`,a=e==="done"&&t.action==="getContext"?`read context (${(n==null?void 0:n.length)??0} chars)`:n,u=a?` — ${a}`:"";if(Fn.push({status:e,text:`${r} ${s}${u}`}),!z)return;const d=z.querySelector("[data-ap-runner-log]");if(!d)return;(b=d.querySelector("[data-ap-runner-placeholder]"))==null||b.remove();const h=d.scrollHeight-d.scrollTop-d.clientHeight<=uc,p=document.createElement("div");p.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--${e}`,p.textContent=Fn[Fn.length-1].text,d.appendChild(p),h&&(d.scrollTop=d.scrollHeight)}function km(e){var t;return((t=e.display)==null?void 0:t.variant)??e.sdkEventType}function _m(e){const t=km(e);return(e.stream==="stdout"||e.stream==="stderr"||e.stream==="sdk_event"&&(t==="text"||t==="thinking"))&&e.data.trim()||null}function gc(e){var r;const t=e.filter(o=>o.sequence>Sr).sort((o,s)=>o.sequence-s.sequence);if(t.length===0||(Sr=Math.max(Sr,...t.map(o=>o.sequence)),!z))return;const n=z.querySelector("[data-ap-runner-log]");if(n)for(const o of t){const s=_m(o);if(!s)continue;(r=n.querySelector("[data-ap-runner-placeholder]"))==null||r.remove();const a=n.scrollHeight-n.scrollTop-n.clientHeight<=uc,u=document.createElement("div");u.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--output ap-sdk-runner__log-entry--${o.stream}`,o.stream==="sdk_event"?(u.classList.add("ap-sdk-markdown"),u.innerHTML=cc(s)):u.textContent=s,n.appendChild(u),a&&(n.scrollTop=n.scrollHeight)}}function vm(e){if(!z||!be||!Gn)return;const t=z.querySelector("[data-ap-runner-summary]");if(!t)return;const n=`${Gn.replace(/\/+$/,"")}/tasks/${be}`,r=e==="completed"?"Automation complete!":"Automation ended",o=e==="completed";t.style.display="block",t.innerHTML=`
|
|
1488
1505
|
<div class="ap-sdk-success-card">
|
|
1489
|
-
<p class="ap-sdk-success-headline">${
|
|
1506
|
+
<p class="ap-sdk-success-headline">${Zi(r)}</p>
|
|
1490
1507
|
${o?`
|
|
1491
1508
|
<div class="ap-sdk-runner__approval" data-ap-runner-approval>
|
|
1492
1509
|
<div class="ap-sdk-runner__approval-actions">
|
|
@@ -1504,7 +1521,7 @@ ${n}${r?`
|
|
|
1504
1521
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-runner-close>Close</button>
|
|
1505
1522
|
</div>
|
|
1506
1523
|
</div>
|
|
1507
|
-
`,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const s
|
|
1524
|
+
`,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const s=Oi;Mi(),s==null||s()}),o&&ym(t)}function ym(e){const t=e.querySelector("[data-ap-runner-approve]"),n=e.querySelector("[data-ap-runner-reject]"),r=e.querySelector("[data-ap-runner-reject-form]"),o=e.querySelector("[data-ap-runner-reject-feedback]"),s=e.querySelector("[data-ap-runner-reject-submit]"),a=e.querySelector("[data-ap-runner-approval-error]"),u=e.querySelector(".ap-sdk-runner__approval-actions"),d=p=>{a.textContent=p,a.style.display="block"};t.addEventListener("click",async()=>{if(!be||!Dt)return;const p=be,b=Dt;t.disabled=!0,n.disabled=!0,a.style.display="none";try{await Cf(b,p),u.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--approved">Approved</span>',r.style.display="none"}catch(m){t.disabled=!1,n.disabled=!1,d(m instanceof Error?m.message:"Failed to approve — try again.")}}),n.addEventListener("click",()=>{r.style.display=r.style.display==="none"?"block":"none",r.style.display==="block"&&o.focus()});const h=()=>{s.textContent=o.value.trim()?"Reject & Continue":"Reject Permanently"};o.addEventListener("input",h),s.addEventListener("click",async()=>{if(!be||!Dt)return;const p=be,b=Dt,m=o.value.trim();s.disabled=!0,t.disabled=!0,a.style.display="none",s.textContent="Rejecting…";try{await Pf(b,p,m),m?hc():(u.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--rejected">Rejected</span>',r.style.display="none")}catch(_){s.disabled=!1,t.disabled=!1,h(),d(_ instanceof Error?_.message:"Failed to reject — try again.")}})}function wm(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Zi(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function xm(e,t,n){const r=!!(t.backendUrl&&t.token),o=document.createElement("div");o.className="ap-sdk-advanced",o.innerHTML=`
|
|
1508
1525
|
<details class="ap-sdk-advanced__details">
|
|
1509
1526
|
<summary class="ap-sdk-advanced__summary">Advanced options</summary>
|
|
1510
1527
|
<div class="ap-sdk-advanced__body">
|
|
@@ -1523,12 +1540,12 @@ ${n}${r?`
|
|
|
1523
1540
|
</div>
|
|
1524
1541
|
</div>
|
|
1525
1542
|
</details>
|
|
1526
|
-
`,e.appendChild(o);const s=o.querySelector("[data-ap-adv-template-field]"),a=o.querySelector("[data-ap-template]"),u=o.querySelector("[data-ap-quickmode]");let d=[];if(r){const
|
|
1527
|
-
`)}const Lm=400,zm=new Set(["Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),Im=new Set(["Control","Meta","Alt","Shift"]);function $m(e){if(Im.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("+")):zm.has(e.key)?e.key:null}function Nm(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?mc(e):
|
|
1543
|
+
`,e.appendChild(o);const s=o.querySelector("[data-ap-adv-template-field]"),a=o.querySelector("[data-ap-template]"),u=o.querySelector("[data-ap-quickmode]");let d=[];if(r){const h={backendUrl:t.backendUrl,token:t.token};vf(h,n??void 0).then(p=>{if(d=p,p.length===0){s.style.display="none";return}const b=p.find(m=>m.isDefault&&m.scope==="project")??p.find(m=>m.isDefault&&m.scope==="global");a.innerHTML='<option value="">None (use default)</option>'+p.map(m=>`<option value="${Sm(m.id)}">${Tm(m.name)}${m.isDefault?" (Default)":""}</option>`).join(""),a.value=(b==null?void 0:b.id)??""}).catch(()=>{s.style.display="none"})}else{a.innerHTML='<option value="">None</option>',a.disabled=!0;const h=document.createElement("span");h.className="ap-sdk-advanced__hint",h.textContent="Connect credentials to enable template selection",s.appendChild(h)}return{getOptions(){var b,m,_,w,C,M,W;const h=a.value||null,p=h?((b=d.find(P=>P.id===h))==null?void 0:b.templateData)??{}:{};return{claudeTemplateId:h,quickMode:u.checked,...p.modelOverride!=null?{modelOverride:p.modelOverride}:{},...p.claudeProfileId!=null?{claudeProfileId:p.claudeProfileId}:{},...p.effort!=null?{effort:p.effort}:{},...p.executionMode!=null?{executionMode:p.executionMode}:{},...(m=p.selectedPluginIds)!=null&&m.length?{selectedPluginIds:p.selectedPluginIds}:{},...(_=p.selectedSkillIds)!=null&&_.length?{selectedSkillIds:p.selectedSkillIds}:{},...(w=p.selectedPluginSkillIds)!=null&&w.length?{selectedPluginSkillIds:p.selectedPluginSkillIds}:{},...(C=p.selectedMcpServerIds)!=null&&C.length?{selectedMcpServerIds:p.selectedMcpServerIds}:{},...(M=p.selectedSlashCommandIds)!=null&&M.length?{selectedSlashCommandIds:p.selectedSlashCommandIds}:{},...(W=p.selectedRemoteContextProviderIds)!=null&&W.length?{selectedRemoteContextProviderIds:p.selectedRemoteContextProviderIds}:{}}}}}function Sm(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Tm(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const qi="ap-sdk-captures",Em=50;function Wn(){try{const e=localStorage.getItem(qi);return e?JSON.parse(e):[]}catch{return[]}}function Am(e){const t=Wn(),n=[e,...t].slice(0,Em);try{localStorage.setItem(qi,JSON.stringify(n))}catch{}}function Cm(){try{localStorage.removeItem(qi)}catch{}}function mc(e){var a,u,d,h,p;if(e.id){const b=document.querySelector(`label[for="${CSS.escape(e.id)}"]`),m=(a=b==null?void 0:b.textContent)==null?void 0:a.trim();if(m)return m}const t=e.closest("label"),n=(u=t==null?void 0:t.textContent)==null?void 0:u.trim();if(n)return n;const r=(d=e.getAttribute("aria-label"))==null?void 0:d.trim();if(r)return r;const o=(h=e.placeholder)==null?void 0:h.trim();if(o)return o;const s=(p=e.getAttribute("name"))==null?void 0:p.trim();return s||e.tagName.toLowerCase()}function Pm(e,t){return`Click "${e}" ${t.toLowerCase()}`}function bc(e,t,n){return n?`Typed [redacted] into ${e}`:`Typed "${t}" into ${e}`}function kc(e,t){return`Scrolled to (${e}, ${t})`}function Rm(e,t){return t?`Pressed "${e}" in ${t}`:`Pressed "${e}"`}function _c(e){return e.map((t,n)=>`${n+1}. ${t.description}`).join(`
|
|
1544
|
+
`)}const Lm=400,zm=new Set(["Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),Im=new Set(["Control","Meta","Alt","Shift"]);function $m(e){if(Im.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("+")):zm.has(e.key)?e.key:null}function Nm(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?mc(e):Fr(e)||e.tagName.toLowerCase()}let Jn=[],Je=null,vo=null,Qe=null,Rt=null,Lt=null;function vc(){vo&&(vo.textContent=`● Recording — ${Jn.length} step${Jn.length===1?"":"s"}`)}function Hi(){Lt&&(clearTimeout(Lt),Lt=null),Rt&&(Jn.push(Rt),Rt=null,vc())}function Fi(e){Hi(),Jn.push(e),vc()}function Om(e){var t,n;return e instanceof HTMLSelectElement?((n=(t=e.selectedOptions[0])==null?void 0:t.textContent)==null?void 0:n.trim())??e.value:e.value}function Dm(e,t){Qe&&Qe(),Jn=[],Rt=null,Je=document.createElement("div"),Je.className="ap-sdk-recorder-bar",Je.setAttribute("data-ap-sdk","1"),Je.innerHTML=`
|
|
1528
1545
|
<span class="ap-sdk-recorder-bar__counter" data-ap-recorder-counter>● Recording — 0 steps</span>
|
|
1529
1546
|
<button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--stop" data-ap-recorder-stop type="button">Stop</button>
|
|
1530
1547
|
<button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--discard" data-ap-recorder-discard type="button">Discard</button>
|
|
1531
|
-
`,document.body.appendChild(
|
|
1548
|
+
`,document.body.appendChild(Je),$t(Je),vo=Je.querySelector("[data-ap-recorder-counter]");const n=()=>{Hi();const d=Jn;Qe==null||Qe(),e(d)},r=()=>{Qe==null||Qe()};Je.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),Je.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=d=>{if(ur(d.target))return;const h=d.target;Fi({action:"click",cssSelector:Hr(h),elementText:Fr(h),description:Pm(Fr(h),h.tagName),capturedAt:new Date().toISOString()})},s=d=>{if(ur(d.target))return;const h=d.target;if(!(h instanceof HTMLInputElement)&&!(h instanceof HTMLTextAreaElement)&&!(h instanceof HTMLSelectElement))return;const p=mc(h),b=Lf(h),m=b?"[redacted]":Om(h);Fi({action:"inputText",cssSelector:Hr(h),elementText:p,value:m,...b?{redacted:!0}:{},description:bc(p,m,b),capturedAt:new Date().toISOString()})},a=()=>{const d=Math.round(window.scrollX),h=Math.round(window.scrollY);Rt?(Rt.scrollX=d,Rt.scrollY=h,Rt.description=kc(d,h)):Rt={action:"scroll",scrollX:d,scrollY:h,description:kc(d,h),capturedAt:new Date().toISOString()},Lt&&clearTimeout(Lt),Lt=setTimeout(()=>{Lt=null,Hi()},Lm)},u=d=>{if(d.key==="Escape"){r();return}if(ur(d.target))return;const h=$m(d);if(!h)return;const p=d.target instanceof Element?d.target:document.body,b=Nm(p);Fi({action:"keypress",cssSelector:Hr(p),elementText:b,key:h,description:Rm(h,b),capturedAt:new Date().toISOString()})};document.addEventListener("click",o,{capture:!0}),document.addEventListener("change",s,{capture:!0}),window.addEventListener("scroll",a,{capture:!0,passive:!0}),document.addEventListener("keydown",u,{capture:!0}),Qe=()=>{document.removeEventListener("click",o,{capture:!0}),document.removeEventListener("change",s,{capture:!0}),window.removeEventListener("scroll",a,{capture:!0}),document.removeEventListener("keydown",u,{capture:!0}),Lt&&(clearTimeout(Lt),Lt=null),Rt=null,Je&&Nt(Je),Je==null||Je.remove(),Je=null,vo=null,Qe=null}}function Mm(){Qe==null||Qe()}function yo(){return Qe!==null}const Um="data-ap-sdk",jm="ap-sdk-fab",yc="ap-sdk-fab--dragging",Bi="ap-sdk-fab--open",wc="ap-sdk-fab-pos",wo="ap-sdk-fab--left-edge",Zm='<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>',qm='<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>',Hm='<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>',Fm='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>';let I=null,et=null,Qt=null,en=null,tn=null,Xn=null,Vn=null,Yn=null,xo=null,Tr=null,Kn=null,So=null,To=null,Eo=null,xc=0,Sc=0,Tc=0,Ec=0,Qn=!1,bt=!1,Er=null,kn=null;function Bm(){Er=e=>{if(!I){Ao();return}if(!Qn){if(Math.hypot(e.clientX-Tc,e.clientY-Ec)<5)return;Qn=!0,bt=!0,I.classList.add(yc)}Gm(e.clientX-xc,e.clientY-Sc)},kn=()=>{if(!I){Ao();return}Qn?(Qn=!1,I.classList.remove(yc),I.style.transition="",Wm(I.getBoundingClientRect())):I.style.transition="",Ao()},window.addEventListener("pointermove",Er),window.addEventListener("pointerup",kn),window.addEventListener("pointercancel",kn)}function Ao(){Er&&(window.removeEventListener("pointermove",Er),Er=null),kn&&(window.removeEventListener("pointerup",kn),window.removeEventListener("pointercancel",kn),kn=null)}function Gm(e,t){if(!I)return;const n=I.offsetWidth||52,r=I.offsetHeight||52;I.style.top=`${Math.max(0,Math.min(t,window.innerHeight-r))}px`,I.style.left=`${Math.max(0,Math.min(e,window.innerWidth-n))}px`,I.style.bottom="auto",I.style.right="auto"}function Wm(e){if(!I)return;const n=Math.max(16,Math.min(window.innerHeight-e.bottom,window.innerHeight-52-16)),r=e.left+e.width/2<window.innerWidth/2?"left":"right";I.style.top="auto",I.style.bottom=`${n}px`,r==="left"?(I.style.right="auto",I.style.left="16px",I.classList.add(wo)):(I.style.left="auto",I.style.right="16px",I.classList.remove(wo));try{localStorage.setItem(wc,JSON.stringify({edge:r,bottom:n}))}catch{}}function Jm(){if(I)try{const e=localStorage.getItem(wc);if(!e)return;const t=JSON.parse(e);if(typeof t.bottom!="number"||t.edge!=="left"&&t.edge!=="right")return;const r=Math.max(16,Math.min(t.bottom,window.innerHeight-52-16));I.style.top="auto",I.style.bottom=`${r}px`,t.edge==="left"?(I.style.right="auto",I.style.left="16px",I.classList.add(wo)):(I.style.left="auto",I.style.right="16px",I.classList.remove(wo))}catch{}}function er(){I==null||I.classList.remove(Bi),Kn&&(window.removeEventListener("pointerdown",Kn,{capture:!0}),Kn=null)}function Xm(){I&&(I.classList.add(Bi),Kn=e=>{!I||I.contains(e.target)||er()},requestAnimationFrame(()=>{Kn&&window.addEventListener("pointerdown",Kn,{capture:!0})}))}function Co(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function Ac(e,t,n){if(So=e,To=t,Eo=n,I)return;I=document.createElement("div"),I.className=jm,I.setAttribute(Um,"1"),Xn=document.createElement("div"),Xn.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="View captures",tn=document.createElement("button"),tn.className="ap-sdk-fab__list ap-sdk-fab__sub",tn.setAttribute("aria-label","My captures"),tn.setAttribute("title","View my captures"),tn.appendChild(Co(Fm)),Xn.appendChild(r),Xn.appendChild(tn),Vn=document.createElement("div"),Vn.className="ap-sdk-fab__row";const o=document.createElement("span");o.className="ap-sdk-fab__label",o.textContent="Capture element",Qt=document.createElement("button"),Qt.className="ap-sdk-fab__capture ap-sdk-fab__sub",Qt.setAttribute("aria-label","Capture element"),Qt.setAttribute("title","Capture element to Agent Platform"),Qt.appendChild(Co(qm)),Vn.appendChild(o),Vn.appendChild(Qt),Yn=document.createElement("div"),Yn.className="ap-sdk-fab__row";const s=document.createElement("span");s.className="ap-sdk-fab__label",s.textContent="Record interaction",en=document.createElement("button"),en.className="ap-sdk-fab__record ap-sdk-fab__sub",en.setAttribute("aria-label","Record interaction"),en.setAttribute("title","Record a sequence of interactions"),en.appendChild(Co(Hm)),Yn.appendChild(s),Yn.appendChild(en),et=document.createElement("button"),et.className="ap-sdk-fab__main",et.setAttribute("aria-label","Agent Platform"),et.setAttribute("title","Agent Platform"),et.appendChild(Co(Zm));const a=document.createElement("span");a.className="ap-sdk-fab__badge",a.setAttribute("data-ap-badge",""),a.style.display="none",et.appendChild(a),I.appendChild(Xn),I.appendChild(Vn),I.appendChild(Yn),I.appendChild(et),et.addEventListener("click",u=>{if(bt){bt=!1;return}u.preventDefault(),u.stopPropagation(),I!=null&&I.classList.contains(Bi)?er():Xm()}),Qt.addEventListener("click",u=>{if(bt){bt=!1;return}u.preventDefault(),u.stopPropagation(),er(),!$n()&&!yo()&&So&&So()}),en.addEventListener("click",u=>{if(bt){bt=!1;return}u.preventDefault(),u.stopPropagation(),er(),!$n()&&!yo()&&To&&To()}),tn.addEventListener("click",u=>{if(bt){bt=!1;return}u.preventDefault(),u.stopPropagation(),er(),Eo&&Eo()}),Tr=u=>{if(!I||!(I===u.target||I.contains(u.target)))return;const d=I.getBoundingClientRect();xc=u.clientX-d.left,Sc=u.clientY-d.top,Tc=u.clientX,Ec=u.clientY,Qn=!1,bt=!1,I.style.transition="none",u.stopPropagation(),Bm()},window.addEventListener("pointerdown",Tr,{capture:!0}),(document.body??document.documentElement).appendChild(I),$t(I),Jm(),xo=setInterval(()=>{et&&et.classList.toggle("ap-sdk-fab__main--active",$n()||yo())},200)}function _n(e){const t=et==null?void 0:et.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function Cc(){Qn=!1,bt=!1,Ao(),er(),xo&&(clearInterval(xo),xo=null),Tr&&(window.removeEventListener("pointerdown",Tr,{capture:!0}),Tr=null),I&&Nt(I),I==null||I.remove(),I=null,et=null,Qt=null,en=null,tn=null,Xn=null,Vn=null,Yn=null,So=null,To=null,Eo=null}async function Pc(e,t){try{if(e.type==="planning"){const r=await yf(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=await wa(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch{return{capture:e,status:"unavailable",approved:!1}}}function Rc(e){return e.filter(t=>!t.approved).length}async function Lc(e){const t=Wn();if(!e||t.length===0){_n(t.length);return}const n=await Promise.all(t.map(r=>Pc(r,e)));_n(Rc(n))}let q=null,Xe=null,jt=null;function Ar(){return q!==null}function Cr(){q&&Nt(q),q==null||q.remove(),q=null,jt==null||jt(),jt=null,Xe==null||Xe.destroy(),Xe=null}function zc(e,t,n,r,o,s,a,u,d,h){q&&Cr();const p={captureType:"task",submitting:!1,completedPicks:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1},b=!n.backendUrl||!n.token;q=document.createElement("div"),q.className="ap-sdk-panel",q.setAttribute("data-ap-sdk","1"),q.setAttribute("role","dialog"),q.setAttribute("aria-modal","true"),q.setAttribute("aria-label","Capture to Agent Platform"),q.innerHTML=`
|
|
1532
1549
|
<div class="ap-sdk-panel__header">
|
|
1533
1550
|
<span class="ap-sdk-panel__title">
|
|
1534
1551
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1543,10 +1560,16 @@ ${n}${r?`
|
|
|
1543
1560
|
<div class="ap-sdk-panel__context" data-ap-context>
|
|
1544
1561
|
${Ic(e)}
|
|
1545
1562
|
</div>
|
|
1546
|
-
<
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1563
|
+
<div class="ap-sdk-panel__pick-actions" data-ap-pick-actions>
|
|
1564
|
+
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-panel__btn--select-parent" data-ap-select-parent type="button">
|
|
1565
|
+
⬆ Select parent
|
|
1566
|
+
</button>
|
|
1567
|
+
${d?`
|
|
1568
|
+
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-panel__btn--reselect" data-ap-reselect type="button">
|
|
1569
|
+
↻ Re-select
|
|
1570
|
+
</button>`:""}
|
|
1571
|
+
</div>
|
|
1572
|
+
${b?`
|
|
1550
1573
|
<div class="ap-sdk-credentials-section" data-ap-credentials>
|
|
1551
1574
|
<p class="ap-sdk-credentials-heading">Credentials required</p>
|
|
1552
1575
|
${n.backendUrl?"":`
|
|
@@ -1586,40 +1609,40 @@ ${n}${r?`
|
|
|
1586
1609
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-submit>Submit</button>
|
|
1587
1610
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-cancel>Cancel</button>
|
|
1588
1611
|
</div>
|
|
1589
|
-
`,
|
|
1612
|
+
`,q.addEventListener("wheel",Z=>{Z.stopPropagation()},{passive:!0}),q.addEventListener("touchmove",Z=>{Z.stopPropagation()},{passive:!0});const m=q.querySelector(".ap-sdk-panel__body"),_=xm(m,n,(r==null?void 0:r.id)??null);document.body.appendChild(q),Xe=Qo(),p.currentPickedEl&&Xe.update(p.currentPickedEl),$t(q),bi(q,mi);const w=q.querySelector("[data-ap-close]"),C=q.querySelector("[data-ap-cancel]"),M=q.querySelector("[data-ap-submit]"),W=q.querySelector("[data-ap-note]"),P=q.querySelector("[data-ap-status]"),T=q.querySelectorAll("[data-ap-type]"),x=q.querySelector("[data-ap-pick-list]"),R=q.querySelector("[data-ap-context]"),D=q.querySelector("[data-ap-add-another]"),pe=q.querySelector("[data-ap-pick-actions]"),_e=q.querySelector("[data-ap-select-parent]"),Ce=q.querySelector("[data-ap-reselect]"),Ve=()=>{p.currentPickedEl&&(Xe==null||Xe.update(p.currentPickedEl))};window.addEventListener("scroll",Ve,{capture:!0,passive:!0}),window.addEventListener("resize",Ve),jt=()=>{window.removeEventListener("scroll",Ve,!0),window.removeEventListener("resize",Ve)};const V=Z=>{Z?(R.innerHTML=Ic(Z),W.disabled=!1,W.placeholder="Describe the task or planning session…",setTimeout(()=>W.focus(),50)):(R.innerHTML=`
|
|
1590
1613
|
<div class="ap-sdk-panel__context-label">Next element</div>
|
|
1591
1614
|
<div class="ap-sdk-panel__context-text ap-sdk-awaiting-pick">👆 Hover and click any element on the page</div>
|
|
1592
|
-
`,
|
|
1593
|
-
<div class="ap-sdk-pick-entry" data-pick-index="${
|
|
1615
|
+
`,W.disabled=!0,W.placeholder="Pick an element to continue…")},Pe=()=>{if(p.completedPicks.length===0){x.style.display="none",x.innerHTML="";return}x.style.display="block",x.innerHTML=p.completedPicks.map((Z,Q)=>`
|
|
1616
|
+
<div class="ap-sdk-pick-entry" data-pick-index="${Q}">
|
|
1594
1617
|
<div class="ap-sdk-pick-entry__header">
|
|
1595
|
-
<span class="ap-sdk-pick-entry__number">${
|
|
1596
|
-
<span class="ap-sdk-pick-entry__element" title="${
|
|
1597
|
-
<button class="ap-sdk-pick-entry__remove" data-ap-remove="${
|
|
1618
|
+
<span class="ap-sdk-pick-entry__number">${Q+1}</span>
|
|
1619
|
+
<span class="ap-sdk-pick-entry__element" title="${nt(Z.ctx.elementText??"")}">${nt(Z.ctx.elementText||"(no text)")}</span>
|
|
1620
|
+
<button class="ap-sdk-pick-entry__remove" data-ap-remove="${Q}" aria-label="Remove pick ${Q+1}">×</button>
|
|
1598
1621
|
</div>
|
|
1599
|
-
<div class="ap-sdk-pick-entry__instruction">${
|
|
1622
|
+
<div class="ap-sdk-pick-entry__instruction">${nt(Z.instruction)}</div>
|
|
1600
1623
|
</div>
|
|
1601
|
-
`).join(""),x.querySelectorAll("[data-ap-remove]").forEach(Z=>{Z.addEventListener("click",()=>{const
|
|
1624
|
+
`).join(""),x.querySelectorAll("[data-ap-remove]").forEach(Z=>{Z.addEventListener("click",()=>{const Q=parseInt(Z.dataset.apRemove,10);p.completedPicks.splice(Q,1),Pe()})})},Ze=()=>{if(!p.currentPickedEl){pe.style.display="none";return}pe.style.display="",_e.disabled=!p.currentPickedEl.parentElement||p.awaitingPick,Ce&&(Ce.disabled=p.awaitingPick)},kt=()=>{D&&(D.disabled=!W.value.trim()||p.submitting||p.awaitingPick)},rn=(Z,Q)=>{p.currentCtx=Z,p.currentPickedEl=Q,V(Z),Xe==null||Xe.update(Q),Ze()};Ze(),_e.addEventListener("click",()=>{var Q;const Z=(Q=p.currentPickedEl)==null?void 0:Q.parentElement;Z&&rn(gs(Z),Z)}),Ce&&d&&Ce.addEventListener("click",()=>{if(p.awaitingPick)return;const Z=p.currentCtx,Q=p.currentPickedEl;p.awaitingPick=!0,Ze(),kt(),V(null),d((De,J)=>{p.awaitingPick=!1,rn(De,J),kt()},()=>{p.awaitingPick=!1,Q&&rn(Z,Q),kt()})});const rt=()=>{Cr(),h==null||h()};w.addEventListener("click",rt),C.addEventListener("click",rt),T.forEach(Z=>{Z.addEventListener("click",()=>{p.captureType=Z.dataset.apType,T.forEach(Q=>Q.classList.toggle("ap-sdk-active",Q===Z))})});const Zt=q.querySelector("[data-ap-reconfigure]");a?Zt.addEventListener("click",()=>{rt(),a()}):Zt.style.display="none",D&&u&&(W.addEventListener("input",kt),D.addEventListener("click",()=>{const Z=W.value.trim();!Z||p.awaitingPick||(p.completedPicks.push({ctx:p.currentCtx,instruction:Z}),Pe(),W.value="",p.awaitingPick=!0,D.disabled=!0,Ze(),V(null),u((Q,De)=>{p.awaitingPick=!1,rn(Q,De),kt()}))})),M.addEventListener("click",async()=>{var xn,ce;if(p.submitting)return;let Z=n.backendUrl??"",Q=n.token??"";if(b){const ie=q==null?void 0:q.querySelector("[data-ap-backend-url]"),Re=q==null?void 0:q.querySelector("[data-ap-token]");if(ie&&(Z=ie.value.trim()),Re&&(Q=Re.value.trim()),!Z){Pr(P,"error","Backend URL is required.");return}if(!Q){Pr(P,"error","API Token is required.");return}}const De=W.value.trim();if(!De){Pr(P,"error","Please enter an instruction.");return}p.submitting=!0,$c(q,!0),Pr(P,null,""),M.textContent="Submitting…";const J={backendUrl:Z,token:Q},_t=_.getOptions(),oe=[...p.completedPicks,{ctx:p.currentCtx,instruction:De}];try{let ie=r;ie||(ie=await _a(J,o),s({backendUrl:Z,token:Q}));let Re,Le,ee;if(oe.length===1)if(p.captureType==="task")Re=(await hi(J,ie.id,De,p.currentCtx,_t)).id,Le="task",ee=De.slice(0,120)||p.currentCtx.pageTitle||"Browser capture";else if(p.captureType==="planning"){let tt=xl(De,{...p.currentCtx,ancestry:p.currentCtx.outerTree||p.currentCtx.ancestry});(xn=p.currentCtx.innerTree)!=null&&xn.trim()&&(tt+=`
|
|
1602
1625
|
|
|
1603
1626
|
Element tree:
|
|
1604
|
-
${p.currentCtx.innerTree}`),(
|
|
1627
|
+
${p.currentCtx.innerTree}`),(ce=p.currentCtx.interactionSteps)!=null&&ce.length&&(tt+=`
|
|
1605
1628
|
|
|
1606
1629
|
Recorded steps:
|
|
1607
|
-
${_c(p.currentCtx.interactionSteps)}`),
|
|
1630
|
+
${_c(p.currentCtx.interactionSteps)}`),Re=(await ya(J,ie.id,tt,_t)).id,Le="planning",ee=De.slice(0,120)||p.currentCtx.pageTitle||"Planning session"}else Re=(await va(J,ie.id,De,p.currentCtx,_t)).id,Le="automate",ee=De.slice(0,120)||p.currentCtx.pageTitle||"Browser automation";else{const tt=Ym(oe),lt=oe[0].instruction.slice(0,120)||oe[0].ctx.pageTitle||"Multi-element capture",ze=oe.map(ut=>ut.instruction).filter(Boolean).join(`
|
|
1608
1631
|
|
|
1609
|
-
`);p.captureType==="task"?(
|
|
1632
|
+
`);p.captureType==="task"?(Re=(await hi(J,ie.id,tt,oe[0].ctx,_t,lt,ka,ze)).id,Le="task",ee=lt):p.captureType==="planning"?(Re=(await ya(J,ie.id,tt,_t)).id,Le="planning",ee=lt):(Re=(await va(J,ie.id,tt,oe[0].ctx,_t,lt,ze)).id,Le="automate",ee=lt)}if(Am({id:Re,type:Le,title:ee,backendUrl:Z,createdAt:new Date().toISOString()}),Lc(J).catch(()=>{}),b&&s({backendUrl:Z,token:Q}),Le==="automate"){rt(),Ui(Re,J,Z,ee,h);return}const Te=Le==="task"?`${Z.replace(/\/+$/,"")}/tasks/${Re}`:`${Z.replace(/\/+$/,"")}/planning/${Re}`;Km(P,Le,ee,Te,rt),q.classList.add("ap-sdk-panel--success"),jt==null||jt(),jt=null,Xe==null||Xe.hide(),p.submitting=!1}catch(ie){Pr(P,"error",ie instanceof Error?ie.message:"An unexpected error occurred."),p.submitting=!1,$c(q,!1),M.textContent="Submit"}}),setTimeout(()=>W.focus(),50)}const Vm={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};function Ic(e){var t;return(t=e.interactionSteps)!=null&&t.length?`
|
|
1610
1633
|
<div class="ap-sdk-panel__context-label">Recorded steps (${e.interactionSteps.length})</div>
|
|
1611
1634
|
<div class="ap-sdk-panel__context-steps">
|
|
1612
1635
|
${e.interactionSteps.map(n=>`
|
|
1613
1636
|
<div class="ap-sdk-panel__context-step">
|
|
1614
1637
|
<span class="ap-sdk-panel__context-step-icon">${Vm[n.action]}</span>
|
|
1615
|
-
<span class="ap-sdk-panel__context-step-text">${
|
|
1638
|
+
<span class="ap-sdk-panel__context-step-text">${nt(n.description)}</span>
|
|
1616
1639
|
</div>
|
|
1617
1640
|
`).join("")}
|
|
1618
1641
|
</div>
|
|
1619
1642
|
`:`
|
|
1620
1643
|
<div class="ap-sdk-panel__context-label">Captured element</div>
|
|
1621
|
-
<div class="ap-sdk-panel__context-text" title="${
|
|
1622
|
-
${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${
|
|
1644
|
+
<div class="ap-sdk-panel__context-text" title="${nt(e.elementText??"")}">${nt(e.elementText||"(no text)")}</div>
|
|
1645
|
+
${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${nt(e.cssSelector)}">${nt(e.cssSelector)}</div>`:""}
|
|
1623
1646
|
`}function Ym(e){return e.map((t,n)=>{var o,s;const r=[`## Pick ${n+1}`,""];return(o=t.ctx.interactionSteps)!=null&&o.length?r.push("Recorded steps:",_c(t.ctx.interactionSteps)):(r.push(`Element: ${t.ctx.elementText||"(no text)"}`),t.ctx.cssSelector&&r.push(`Selector: ${t.ctx.cssSelector}`),t.ctx.ancestry&&r.push(`Ancestry: ${t.ctx.ancestry}`)),r.push(`Page: ${t.ctx.pageTitle} (${t.ctx.pageUrl})`),(s=t.ctx.innerTree)!=null&&s.trim()&&r.push(`
|
|
1624
1647
|
Element tree:
|
|
1625
1648
|
${t.ctx.innerTree}`),r.push("",`Instruction:
|
|
@@ -1628,23 +1651,23 @@ ${t.instruction}`),r.join(`
|
|
|
1628
1651
|
|
|
1629
1652
|
---
|
|
1630
1653
|
|
|
1631
|
-
`)}function
|
|
1654
|
+
`)}function Pr(e,t,n){if(!t){e.style.display="none",e.textContent="",e.innerHTML="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function Km(e,t,n,r,o){const s=t==="task"?"Task":"Planning",a=t==="task"?"Task created successfully!":"Planning session created!",u=t==="task"?"View task →":"View planning session →",d=n.length>55?`${n.slice(0,52)}…`:n;e.style.display="block",e.className="ap-sdk-panel__status",e.innerHTML=`
|
|
1632
1655
|
<div class="ap-sdk-success-card">
|
|
1633
1656
|
<svg class="ap-sdk-success-check" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
|
|
1634
1657
|
<circle class="ap-sdk-success-check__circle" cx="24" cy="24" r="22"/>
|
|
1635
1658
|
<path class="ap-sdk-success-check__tick" d="M14 24l7 7 13-14"/>
|
|
1636
1659
|
</svg>
|
|
1637
|
-
<p class="ap-sdk-success-headline">${
|
|
1660
|
+
<p class="ap-sdk-success-headline">${nt(a)}</p>
|
|
1638
1661
|
<div class="ap-sdk-success-meta">
|
|
1639
|
-
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${
|
|
1640
|
-
<span class="ap-sdk-success-title" title="${
|
|
1662
|
+
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${nt(s)}</span>
|
|
1663
|
+
<span class="ap-sdk-success-title" title="${nt(n)}">${nt(d)}</span>
|
|
1641
1664
|
</div>
|
|
1642
1665
|
<div class="ap-sdk-success-actions">
|
|
1643
|
-
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${
|
|
1666
|
+
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${nt(u)}</button>
|
|
1644
1667
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-success-close>Close</button>
|
|
1645
1668
|
</div>
|
|
1646
1669
|
</div>
|
|
1647
|
-
`,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function $c(e,t){e.querySelectorAll("button, input, textarea, select").forEach(n=>{n.disabled=t})}function
|
|
1670
|
+
`,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function $c(e,t){e.querySelectorAll("button, input, textarea, select").forEach(n=>{n.disabled=t})}function nt(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}let re=null;function Nc(){return re!==null}function vn(){re&&Nt(re),re==null||re.remove(),re=null}function Qm(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function eb(e){if(re){vn();return}re=document.createElement("div"),re.className="ap-sdk-panel",re.setAttribute("data-ap-sdk","1"),re.setAttribute("role","dialog"),re.setAttribute("aria-modal","true"),re.setAttribute("aria-label","My captures"),re.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),re.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),re.innerHTML=`
|
|
1648
1671
|
<div class="ap-sdk-panel__header">
|
|
1649
1672
|
<span class="ap-sdk-panel__title">
|
|
1650
1673
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1657,18 +1680,18 @@ ${t.instruction}`),r.join(`
|
|
|
1657
1680
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-clear-history>Clear history</button>
|
|
1658
1681
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-close-list>Close</button>
|
|
1659
1682
|
</div>
|
|
1660
|
-
`,document.body.appendChild(
|
|
1683
|
+
`,document.body.appendChild(re),$t(re),bi(re,mi),re.querySelector("[data-ap-close]").addEventListener("click",()=>{vn()}),re.querySelector("[data-ap-close-list]").addEventListener("click",()=>{vn()}),re.querySelector("[data-ap-clear-history]").addEventListener("click",()=>{Cm(),_n(0),Oc(e)}),Oc(e)}function Oc(e){if(!re)return;const t=re.querySelector("[data-ap-list-body]"),n=Wn();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=>`
|
|
1661
1684
|
<div class="ap-sdk-list-item">
|
|
1662
1685
|
<div class="ap-sdk-list-item__row">
|
|
1663
1686
|
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${Qm(r.type)}</span>
|
|
1664
|
-
<span class="ap-sdk-list-item__title" title="${
|
|
1687
|
+
<span class="ap-sdk-list-item__title" title="${Po(r.title)}">${rb(r.title)}</span>
|
|
1665
1688
|
</div>
|
|
1666
1689
|
<div class="ap-sdk-list-item__row">
|
|
1667
|
-
<span class="ap-sdk-status-badge" data-ap-status="${
|
|
1668
|
-
${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${
|
|
1690
|
+
<span class="ap-sdk-status-badge" data-ap-status="${Po(r.id)}">${e?"…":"—"}</span>
|
|
1691
|
+
${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${Po(r.id)}">Resume →</button>`:`<a class="ap-sdk-list-item__link" href="${Po(nb(r))}" target="_blank" rel="noopener noreferrer">View →</a>`}
|
|
1669
1692
|
</div>
|
|
1670
1693
|
</div>
|
|
1671
|
-
`).join(""),e){const r=e;Promise.all(n.map(o=>tb(o,r))).then(o=>{
|
|
1694
|
+
`).join(""),e){const r=e;Promise.all(n.map(o=>tb(o,r))).then(o=>{_n(Rc(o))}),t.querySelectorAll("[data-ap-resume]").forEach(o=>{o.addEventListener("click",()=>{const s=o.dataset.apResume,a=n.find(u=>u.id===s);a&&(vn(),Ui(a.id,r,a.backendUrl,a.title,()=>{}))})})}}async function tb(e,t){const n=await Pc(e,t),r=re==null?void 0:re.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 nb(e){const t=e.backendUrl.replace(/\/+$/,"");return e.type==="planning"?`${t}/planning/${e.id}`:`${t}/tasks/${e.id}`}function Po(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function rb(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const Gi="ap-sdk-config";function ob(){try{const e=localStorage.getItem(Gi);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.backendUrl&&(t!=null&&t.token)&&(t!=null&&t.projectCode)?t:null}catch{return null}}function ib(e){localStorage.setItem(Gi,JSON.stringify(e))}function sb(){localStorage.removeItem(Gi)}let K=null;function Rr(){K&&Nt(K),K==null||K.remove(),K=null}function ab(e){K&&Rr(),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"),t("",""),document.body.appendChild(K),$t(K);function t(r,o){if(!K)return;K.innerHTML=`
|
|
1672
1695
|
<div class="ap-sdk-panel__header">
|
|
1673
1696
|
<span class="ap-sdk-panel__title">
|
|
1674
1697
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1681,13 +1704,13 @@ ${t.instruction}`),r.join(`
|
|
|
1681
1704
|
<label class="ap-sdk-panel__label" for="ap-sdk-cfg-url">Backend URL</label>
|
|
1682
1705
|
<input id="ap-sdk-cfg-url" class="ap-sdk-panel__input" type="url"
|
|
1683
1706
|
placeholder="https://your-platform.example.com"
|
|
1684
|
-
value="${
|
|
1707
|
+
value="${Wi(r)}" autocomplete="off" data-ap-cfg-url />
|
|
1685
1708
|
</div>
|
|
1686
1709
|
<div class="ap-sdk-panel__field">
|
|
1687
1710
|
<label class="ap-sdk-panel__label" for="ap-sdk-cfg-token">API Token</label>
|
|
1688
1711
|
<input id="ap-sdk-cfg-token" class="ap-sdk-panel__input" type="password"
|
|
1689
1712
|
placeholder="Paste your personal API token"
|
|
1690
|
-
value="${
|
|
1713
|
+
value="${Wi(o)}" autocomplete="off" data-ap-cfg-token />
|
|
1691
1714
|
</div>
|
|
1692
1715
|
<p class="ap-sdk-config-hint">
|
|
1693
1716
|
Create a token at <strong>Settings › API Tokens</strong> in Agent Platform.
|
|
@@ -1698,7 +1721,7 @@ ${t.instruction}`),r.join(`
|
|
|
1698
1721
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-connect>Connect</button>
|
|
1699
1722
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-cancel>Cancel</button>
|
|
1700
1723
|
</div>
|
|
1701
|
-
`;const s=
|
|
1724
|
+
`;const s=K.querySelector("[data-ap-cfg-url]"),a=K.querySelector("[data-ap-cfg-token]"),u=K.querySelector("[data-ap-cfg-status]"),d=K.querySelector("[data-ap-connect]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Rr()}),K.querySelector("[data-ap-cancel]").addEventListener("click",()=>{Rr()}),d.addEventListener("click",async()=>{const h=s.value.trim(),p=a.value.trim();if(!h){tr(u,"error","Backend URL is required.");return}if(!p){tr(u,"error","API Token is required.");return}d.disabled=!0,d.textContent="Connecting…",tr(u,null,"");try{const m=await wf({backendUrl:h,token:p});if(m.length===0){tr(u,"error","No projects found — check your token permissions."),d.disabled=!1,d.textContent="Connect";return}n(h,p,m)}catch(b){tr(u,"error",`Could not connect — ${b instanceof Error?b.message:"check URL and token"}`),d.disabled=!1,d.textContent="Connect"}}),setTimeout(()=>s.focus(),50)}function n(r,o,s){if(!K)return;const a=s.map(h=>`<option value="${Wi(h.key)}">${Dc(h.name)} (${Dc(h.key)})</option>`).join("");K.innerHTML=`
|
|
1702
1725
|
<div class="ap-sdk-panel__header">
|
|
1703
1726
|
<span class="ap-sdk-panel__title">
|
|
1704
1727
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1720,7 +1743,7 @@ ${t.instruction}`),r.join(`
|
|
|
1720
1743
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-save>Save</button>
|
|
1721
1744
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-back>Back</button>
|
|
1722
1745
|
</div>
|
|
1723
|
-
`;const u=
|
|
1746
|
+
`;const u=K.querySelector("[data-ap-cfg-project]"),d=K.querySelector("[data-ap-cfg-status]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Rr()}),K.querySelector("[data-ap-back]").addEventListener("click",()=>t(r,o)),K.querySelector("[data-ap-save]").addEventListener("click",()=>{const h=u.value;if(!h){tr(d,"error","Please select a project.");return}Rr(),e({backendUrl:r,token:o,projectCode:h})})}}function tr(e,t,n){if(!t){e.style.display="none",e.textContent="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function Wi(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Dc(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}let ct=null,Ro=!1;function cb(){ct==null||ct.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),ct&&ct.observe(document.body,{childList:!0}),Ro=!1}function Mc(){ct||(ct=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||Ro||(Ro=!0,queueMicrotask(cb))}),ct.observe(document.body,{childList:!0}))}function lb(){ct==null||ct.disconnect(),ct=null,Ro=!1}const ub={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};let Se=null,nn=[];function Lo(){Se&&Nt(Se),Se==null||Se.remove(),Se=null,nn=[]}function db(e,t,n){Se&&Lo(),nn=[...e],Se=document.createElement("div"),Se.className="ap-sdk-panel ap-sdk-record-review",Se.setAttribute("data-ap-sdk","1"),Se.setAttribute("role","dialog"),Se.setAttribute("aria-modal","true"),Se.setAttribute("aria-label","Review recorded steps"),Se.innerHTML=`
|
|
1724
1747
|
<div class="ap-sdk-panel__header">
|
|
1725
1748
|
<span class="ap-sdk-panel__title">
|
|
1726
1749
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1735,11 +1758,11 @@ ${t.instruction}`),r.join(`
|
|
|
1735
1758
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-review-continue>Continue</button>
|
|
1736
1759
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-review-cancel>Cancel</button>
|
|
1737
1760
|
</div>
|
|
1738
|
-
`,document.body.appendChild(
|
|
1761
|
+
`,document.body.appendChild(Se),$t(Se);const r=Se.querySelector("[data-ap-review-list]"),o=Se.querySelector("[data-ap-review-continue]"),s=()=>{if(nn.length===0){r.innerHTML='<p class="ap-sdk-list-empty">No steps recorded.</p>',o.disabled=!0;return}o.disabled=!1,r.innerHTML=nn.map((u,d)=>`
|
|
1739
1762
|
<div class="ap-sdk-record-step" data-step-index="${d}">
|
|
1740
1763
|
<span class="ap-sdk-record-step__icon">${ub[u.action]}</span>
|
|
1741
1764
|
${u.action==="inputText"&&!u.redacted?`<input class="ap-sdk-record-step__input" type="text" value="${pb(u.value??"")}" data-ap-step-value />`:`<span class="ap-sdk-record-step__description">${Uc(u.description)}</span>`}
|
|
1742
1765
|
<button class="ap-sdk-record-step__remove" data-ap-step-remove="${d}" aria-label="Remove step ${d+1}">✕</button>
|
|
1743
1766
|
</div>
|
|
1744
|
-
`).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(u=>{u.addEventListener("click",()=>{const d=parseInt(u.dataset.apStepRemove,10);
|
|
1767
|
+
`).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(u=>{u.addEventListener("click",()=>{const d=parseInt(u.dataset.apStepRemove,10);nn.splice(d,1),s()})}),r.querySelectorAll("[data-ap-step-value]").forEach(u=>{const d=u.closest("[data-step-index]"),h=parseInt(d.dataset.stepIndex,10);u.addEventListener("input",()=>{const p=nn[h];p.value=u.value,p.description=bc(p.elementText??"",u.value,!1)})})};s();const a=()=>{Lo()};Se.querySelector("[data-ap-review-close]").addEventListener("click",a),Se.querySelector("[data-ap-review-cancel]").addEventListener("click",a),o.addEventListener("click",()=>{if(nn.length===0)return;const u=nn,d={...ds(),pageUrl:window.location.href,pageTitle:document.title,interactionSteps:u};Lo(),t(d)})}function Uc(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function pb(e){return Uc(e)}let j=null,zo=null,Io=null,$o=null;function Ji(e,t,n){zo=e,Io=t,$o=n,Ac(e,t,n)}const jc="#agent-platform-web-sdk",Zc="ap-sdk-fab-unlocked";let yn=null;function qc(){try{if(localStorage.getItem(Zc)==="1")return!0}catch{}return window.location.hash===jc}function Hc(){try{localStorage.setItem(Zc,"1")}catch{}}async function Fc(e){if(cr(),!(j&&j.projectCode===e.projectCode&&j.backendUrl===(e.backendUrl??null)&&j.token===(e.token??null))){if(j={projectCode:e.projectCode,backendUrl:e.backendUrl??null,token:e.token??null,project:null,resolvingProject:!1},Ji(()=>Bc(),()=>fb(),()=>Vi()),_n(Wn().length),j.backendUrl&&j.token){const t=j.backendUrl,n=j.token;await Vc(),Lc({backendUrl:t,token:n}).catch(()=>{});const r=Uf();r&&Ui(r.taskId,{backendUrl:t,token:n},r.backendUrl,r.title,()=>{})}Mc()}}async function Xi(e,t){if(!j)throw new Error("AgentPlatformSDK: call init() first.");j.backendUrl=e,j.token=t,j.project=null,await Vc()}function Bc(){if(!j)throw new Error("AgentPlatformSDK: call init() first.");$n()||(cr(),ei(async(e,t)=>{Nc()&&vn(),zc(e,t,{backendUrl:j.backendUrl,token:j.token},j.project,j.projectCode,async n=>{await Xi(n.backendUrl,n.token)},wn,n=>{ei((r,o)=>{Ar()&&n(r,o)},()=>{Gc()})},(n,r)=>{ei((o,s)=>{Ar()&&n(o,s)},()=>{Ar()&&r()})},()=>{$n()&&ti()})},()=>{}))}function hb(){ti()}function fb(){if(!j)throw new Error("AgentPlatformSDK: call init() first.");yo()||(cr(),Dm(e=>{db(e,t=>{zc(t,null,{backendUrl:j.backendUrl,token:j.token},j.project,j.projectCode,async n=>{await Xi(n.backendUrl,n.token)},wn,void 0,void 0,()=>{})})}))}function Gc(){Ar()&&Cr()}function gb(){return $n()}function Wc(){lb(),yn&&(window.removeEventListener("hashchange",yn),yn=null),ti(),Mm(),Lo(),Cr(),vn(),Cc(),zo=null,Io=null,$o=null,j=null}function Jc(){if(typeof window>"u"||typeof document>"u")return;cr();const e=ob(),t=()=>{e?Xc(e).catch(console.error):(Ji(()=>wn(),()=>wn(),()=>Vi()),_n(Wn().length),Mc())};if(qc()){Hc(),t();return}yn=()=>{window.location.hash===jc&&(Hc(),window.removeEventListener("hashchange",yn),yn=null,t())},window.addEventListener("hashchange",yn)}function mb(){zo&&Io&&$o&&Ac(zo,Io,$o)}function bb(){Cc()}function wn(){ab(e=>{ib(e),Xc(e).catch(console.error)})}function kb(){sb(),Wc(),cr(),qc()&&(Ji(()=>wn(),()=>wn(),()=>Vi()),_n(Wn().length))}async function Xc(e){await Fc({projectCode:e.projectCode,backendUrl:e.backendUrl,token:e.token})}function Vi(){if(Nc()){vn();return}Ar()&&Cr();const e=j!=null&&j.backendUrl&&(j!=null&&j.token)?{backendUrl:j.backendUrl,token:j.token}:null;eb(e)}async function Vc(){if(!(!j||!j.backendUrl||!j.token||j.project||j.resolvingProject)){j.resolvingProject=!0;try{j.project=await _a({backendUrl:j.backendUrl,token:j.token},j.projectCode)}catch{}finally{j&&(j.resolvingProject=!1)}}}return Jc(),we.activateElementPicker=Bc,we.autoInit=Jc,we.clearConfig=kb,we.closePanelIfOpen=Gc,we.configure=wn,we.deactivateElementPicker=hb,we.destroy=Wc,we.hideFab=bb,we.init=Fc,we.isPickerRunning=gb,we.showFab=mb,we.updateCredentials=Xi,Object.defineProperty(we,Symbol.toStringTag,{value:"Module"}),we}({});
|
|
1745
1768
|
//# sourceMappingURL=web-sdk.min.js.map
|