@tung-engineering/agent-platform-web-sdk 0.0.55 → 0.0.57
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 +263 -78
- package/dist/web-sdk.cjs.map +1 -1
- package/dist/web-sdk.min.js +260 -75
- package/dist/web-sdk.min.js.map +1 -1
- package/dist/web-sdk.mjs +3835 -3417
- package/dist/web-sdk.mjs.map +1 -1
- package/package.json +2 -2
package/dist/web-sdk.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var vu=Object.defineProperty;var yu=(e,t,n)=>t in e?vu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var re=(e,t,n)=>yu(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const wu=`
|
|
2
2
|
/* ── Agent Platform SDK — namespaced styles ────────────────────────────── */
|
|
3
3
|
|
|
4
4
|
/* Reset Popover API UA defaults so top-layer-promoted elements keep our own
|
|
@@ -96,6 +96,61 @@
|
|
|
96
96
|
background: oklch(95% 0.035 50);
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
/* Floating bar shown while recorder.ts is capturing a workflow */
|
|
100
|
+
.ap-sdk-recorder-bar {
|
|
101
|
+
position: fixed;
|
|
102
|
+
bottom: 16px;
|
|
103
|
+
left: 50%;
|
|
104
|
+
transform: translateX(-50%);
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
gap: 8px;
|
|
108
|
+
background: oklch(58% 0.13 42);
|
|
109
|
+
color: #fff;
|
|
110
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
111
|
+
font-size: 13px;
|
|
112
|
+
font-weight: 500;
|
|
113
|
+
padding: 8px 10px 8px 14px;
|
|
114
|
+
border-radius: 999px;
|
|
115
|
+
z-index: 2147483646;
|
|
116
|
+
box-shadow: 0 4px 12px rgba(0,0,0,0.25);
|
|
117
|
+
white-space: nowrap;
|
|
118
|
+
pointer-events: all;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.ap-sdk-recorder-bar__counter {
|
|
122
|
+
white-space: nowrap;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.ap-sdk-recorder-bar__btn {
|
|
126
|
+
pointer-events: all;
|
|
127
|
+
background: rgba(255, 255, 255, 0.16);
|
|
128
|
+
color: #fff;
|
|
129
|
+
border: 1px solid rgba(255, 255, 255, 0.4);
|
|
130
|
+
border-radius: 999px;
|
|
131
|
+
padding: 5px 10px;
|
|
132
|
+
font-size: 12px;
|
|
133
|
+
font-weight: 500;
|
|
134
|
+
font-family: inherit;
|
|
135
|
+
cursor: pointer;
|
|
136
|
+
white-space: nowrap;
|
|
137
|
+
transition: background 0.15s;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.ap-sdk-recorder-bar__btn:hover {
|
|
141
|
+
background: rgba(255, 255, 255, 0.28);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.ap-sdk-recorder-bar__btn--stop {
|
|
145
|
+
background: #fff;
|
|
146
|
+
color: oklch(48% 0.13 40);
|
|
147
|
+
border-color: #fff;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.ap-sdk-recorder-bar__btn--stop:hover {
|
|
151
|
+
background: oklch(95% 0.035 50);
|
|
152
|
+
}
|
|
153
|
+
|
|
99
154
|
@keyframes ap-sdk-panel-in {
|
|
100
155
|
from { opacity: 0; transform: translateY(-50%) translateX(16px) scale(0.98); }
|
|
101
156
|
to { opacity: 1; transform: translateY(-50%) translateX(0) scale(1); }
|
|
@@ -242,6 +297,32 @@
|
|
|
242
297
|
white-space: nowrap;
|
|
243
298
|
}
|
|
244
299
|
|
|
300
|
+
.ap-sdk-panel__context-steps {
|
|
301
|
+
display: flex;
|
|
302
|
+
flex-direction: column;
|
|
303
|
+
gap: 4px;
|
|
304
|
+
max-height: 160px;
|
|
305
|
+
overflow-y: auto;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.ap-sdk-panel__context-step {
|
|
309
|
+
display: flex;
|
|
310
|
+
align-items: center;
|
|
311
|
+
gap: 6px;
|
|
312
|
+
font-size: 12px;
|
|
313
|
+
color: #111827;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.ap-sdk-panel__context-step-icon {
|
|
317
|
+
flex-shrink: 0;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.ap-sdk-panel__context-step-text {
|
|
321
|
+
overflow: hidden;
|
|
322
|
+
text-overflow: ellipsis;
|
|
323
|
+
white-space: nowrap;
|
|
324
|
+
}
|
|
325
|
+
|
|
245
326
|
.ap-sdk-panel__body {
|
|
246
327
|
padding: 14px 16px;
|
|
247
328
|
display: flex;
|
|
@@ -836,6 +917,69 @@ button.ap-sdk-list-item__link {
|
|
|
836
917
|
-webkit-box-orient: vertical;
|
|
837
918
|
}
|
|
838
919
|
|
|
920
|
+
/* ── Record review list ─────────────────────────────────────────────────── */
|
|
921
|
+
|
|
922
|
+
.ap-sdk-record-review__list {
|
|
923
|
+
max-height: 320px;
|
|
924
|
+
overflow-y: auto;
|
|
925
|
+
overscroll-behavior: contain;
|
|
926
|
+
border-bottom: 1px solid #f3f4f6;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
.ap-sdk-record-step {
|
|
930
|
+
display: flex;
|
|
931
|
+
align-items: center;
|
|
932
|
+
gap: 8px;
|
|
933
|
+
padding: 8px 16px;
|
|
934
|
+
border-bottom: 1px solid #f3f4f6;
|
|
935
|
+
font-size: 12px;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
.ap-sdk-record-step:last-child {
|
|
939
|
+
border-bottom: none;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
.ap-sdk-record-step__icon {
|
|
943
|
+
flex-shrink: 0;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
.ap-sdk-record-step__description {
|
|
947
|
+
flex: 1;
|
|
948
|
+
color: #374151;
|
|
949
|
+
overflow: hidden;
|
|
950
|
+
text-overflow: ellipsis;
|
|
951
|
+
white-space: nowrap;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
.ap-sdk-record-step__input {
|
|
955
|
+
flex: 1;
|
|
956
|
+
box-sizing: border-box;
|
|
957
|
+
border: 1px solid oklch(58% 0.13 42);
|
|
958
|
+
border-radius: 6px;
|
|
959
|
+
padding: 4px 8px;
|
|
960
|
+
font-size: 12px;
|
|
961
|
+
font-family: inherit;
|
|
962
|
+
color: #111827;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
.ap-sdk-record-step__remove {
|
|
966
|
+
background: none;
|
|
967
|
+
border: none;
|
|
968
|
+
cursor: pointer;
|
|
969
|
+
color: oklch(58% 0.13 42);
|
|
970
|
+
font-size: 13px;
|
|
971
|
+
line-height: 1;
|
|
972
|
+
padding: 0 2px;
|
|
973
|
+
border-radius: 3px;
|
|
974
|
+
flex-shrink: 0;
|
|
975
|
+
transition: color 0.1s, background 0.1s;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
.ap-sdk-record-step__remove:hover {
|
|
979
|
+
color: #ef4444;
|
|
980
|
+
background: #fee2e2;
|
|
981
|
+
}
|
|
982
|
+
|
|
839
983
|
/* "Add another" button */
|
|
840
984
|
.ap-sdk-panel__btn--add-another {
|
|
841
985
|
width: 100%;
|
|
@@ -1181,11 +1325,11 @@ button.ap-sdk-list-item__link {
|
|
|
1181
1325
|
border-right: 2px solid #d1d5db;
|
|
1182
1326
|
border-bottom: 2px solid #d1d5db;
|
|
1183
1327
|
}
|
|
1184
|
-
`;let
|
|
1185
|
-
`)}return r(e,0)}const
|
|
1186
|
-
`)}const Dn=new Set;let Ln=null,ho=!1,ni=!1;function pu(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function hu(){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(!(Dn.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&pu(r))return!0}return!1}function la(){const e=hu(),t=e&&!ni;ni=e;for(const n of Dn){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 ss(e){if(!(e instanceof Node))return!1;for(const t of Dn)if(t===e||t.contains(e))return!0;return!1}function In(e){(ss(e.target)||"relatedTarget"in e&&ss(e.relatedTarget))&&e.stopPropagation()}function fu(){ho||(window.addEventListener("focusin",In,!0),window.addEventListener("focusout",In,!0),window.addEventListener("pointerdown",In,!0),ho=!0),!Ln&&(Ln=new MutationObserver(e=>{e.some(n=>n.type==="childList"||n.attributeName==="open"&&n.target.tagName==="DIALOG"||n.attributeName==="inert"||n.attributeName==="aria-hidden"||n.attributeName==="role")&&la()}),Ln.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function hn(e){"showPopover"in e&&(e.setAttribute("popover","manual"),Dn.add(e),fu(),la())}function fn(e){if(Dn.delete(e),Dn.size===0&&(Ln&&(Ln.disconnect(),Ln=null),ho&&(window.removeEventListener("focusin",In,!0),window.removeEventListener("focusout",In,!0),window.removeEventListener("pointerdown",In,!0),ho=!1),ni=!1),"hidePopover"in e)try{e.hidePopover()}catch{}}function fi(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),hn(t),{el:t,update:s=>{const c=s.getBoundingClientRect();t.style.top=`${c.top}px`,t.style.left=`${c.left}px`,t.style.width=`${c.width}px`,t.style.height=`${c.height}px`,t.style.display="block"},hide:()=>{t.style.display="none"},destroy:()=>{fn(t),t.remove()}}}const gu="🎯 Click any element to capture";let Ft=null,Ce=null,Ve=null;function as(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 mu(){var e;return(((e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)??!1)||"ontouchstart"in window}function cs(e){Ft==null||Ft.update(e)}function ua(e){const t=cu(),n=lu(e),r=uu(e);let o;try{o=e.outerHTML.slice(0,4e3)}catch{}return{pageUrl:window.location.href,pageTitle:document.title,elementText:Ql(e),cssSelector:Kl(e),innerTree:nu(e),outerTree:au(e),elementOuterHtml:o,ancestry:n,...r,...t}}function ls(e,t){Ve&&Ve();const n=mu();Ft=fi(),Ce=document.createElement("div"),Ce.className="ap-sdk-picker-cursor",Ce.setAttribute("data-ap-sdk","1"),Ce.textContent=n?"Tap any element to preview":gu,document.body.appendChild(Ce),hn(Ce);let r=null,o=null;const s=h=>{Ve==null||Ve(),e(ua(h),h)},c=h=>{if(o=h,cs(h),!Ce)return;Ce.classList.add("ap-sdk-picker-cursor--confirm"),Ce.innerHTML="";const k=document.createElement("span");k.className="ap-sdk-picker-cursor__label",k.textContent=`<${h.tagName.toLowerCase()}>`;const m=document.createElement("button");m.type="button",m.className="ap-sdk-picker-cursor__btn",m.textContent="⬆ Parent",m.setAttribute("data-ap-sdk","1"),m.addEventListener("click",w=>{w.preventDefault(),w.stopPropagation(),o!=null&&o.parentElement&&c(o.parentElement)});const _=document.createElement("button");_.type="button",_.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",_.textContent="✓ Select",_.setAttribute("data-ap-sdk","1"),_.addEventListener("click",w=>{w.preventDefault(),w.stopPropagation(),o&&s(o)}),Ce.appendChild(k),Ce.appendChild(m),Ce.appendChild(_)},u=h=>{as(h.target)||(r=h.target,cs(r))},d=h=>{if(as(h.target))return;h.preventDefault(),h.stopImmediatePropagation();const k=h.target??r;if(k){if(n){c(k);return}s(k)}},p=h=>{h.key==="Escape"&&(Ve==null||Ve(),t())};n||document.addEventListener("mouseover",u,{capture:!0}),document.addEventListener("click",d,{capture:!0}),document.addEventListener("keydown",p,{capture:!0}),Ve=()=>{n||document.removeEventListener("mouseover",u,{capture:!0}),document.removeEventListener("click",d,{capture:!0}),document.removeEventListener("keydown",p,{capture:!0}),Ce&&fn(Ce),Ce==null||Ce.remove(),Ft==null||Ft.destroy(),Ft=null,Ce=null,o=null,Ve=null}}function gi(){Ve==null||Ve()}function xr(){return Ve!==null}function v(e,t,n){function r(u,d){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:d,constr:c,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,d);const p=c.prototype,h=Object.keys(p);for(let k=0;k<h.length;k++){const m=h[k];m in u||(u[m]=p[m].bind(u))}}const o=(n==null?void 0:n.Parent)??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function c(u){var d;const p=n!=null&&n.Parent?new s:this;r(p,u),(d=p._zod).deferred??(d.deferred=[]);for(const h of p._zod.deferred)h();return p}return Object.defineProperty(c,"init",{value:r}),Object.defineProperty(c,Symbol.hasInstance,{value:u=>{var d,p;return n!=null&&n.Parent&&u instanceof n.Parent?!0:(p=(d=u==null?void 0:u._zod)==null?void 0:d.traits)==null?void 0:p.has(e)}}),Object.defineProperty(c,"name",{value:e}),c}class $n extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class da extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const pa={};function Bt(e){return pa}function ha(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 ri(e,t){return typeof t=="bigint"?t.toString():t}function Co(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function mi(e){return e==null}function bi(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function bu(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const d=r.match(/\d?e-(\d?)/);d!=null&&d[1]&&(o=Number.parseInt(d[1]))}const s=n>o?n:o,c=Number.parseInt(e.toFixed(s).replace(".","")),u=Number.parseInt(t.toFixed(s).replace(".",""));return c%u/10**s}const us=Symbol("evaluating");function K(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==us)return r===void 0&&(r=us,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function gn(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 ds(e){return JSON.stringify(e)}function ku(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const fa="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Sr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const _u=Co(()=>{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 Mn(e){if(Sr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Sr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ga(e){return Mn(e)?{...e}:Array.isArray(e)?[...e]:e}const vu=new Set(["string","number","symbol"]);function Un(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 D(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 yu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const wu={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 xu(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 c={};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(c[u]=n.shape[u])}return gn(this,"shape",c),c},checks:[]});return Jt(e,s)}function Su(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 c={...e._zod.def.shape};for(const u in t){if(!(u in n.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&delete c[u]}return gn(this,"shape",c),c},checks:[]});return Jt(e,s)}function Tu(e,t){if(!Mn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const c in t)if(Object.getOwnPropertyDescriptor(s,c)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Wt(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return gn(this,"shape",s),s}});return Jt(e,o)}function Eu(e,t){if(!Mn(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 gn(this,"shape",r),r}});return Jt(e,n)}function Au(e,t){const n=Wt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return gn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Jt(e,n)}function Cu(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const c=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 gn(this,"shape",d),d},checks:[]});return Jt(t,c)}function Pu(e,t,n){const r=Wt(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const c in n){if(!(c in s))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(s[c]=new e({type:"nonoptional",innerType:o[c]}))}else for(const c in o)s[c]=new e({type:"nonoptional",innerType:o[c]});return gn(this,"shape",s),s}});return Jt(t,r)}function Pn(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 Rn(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 Gt(e,t,n){var o,s,c,u,d,p;const r={...e,path:e.path??[]};if(!e.message){const h=Wr((c=(s=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:s.error)==null?void 0:c.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 ki(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Tr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const ma=(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,ri,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ba=v("$ZodError",ma),ka=v("$ZodError",ma,{Parent:Error});function Ru(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 zu(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(c=>r({issues:c}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let c=n,u=0;for(;u<s.path.length;){const d=s.path[u];u===s.path.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(t(s))):c[d]=c[d]||{_errors:[]},c=c[d],u++}}};return r(e),n}const _i=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new $n;if(c.issues.length){const u=new((o==null?void 0:o.Err)??e)(c.issues.map(d=>Gt(d,s,Bt())));throw fa(u,o==null?void 0:o.callee),u}return c.value},vi=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise&&(c=await c),c.issues.length){const u=new((o==null?void 0:o.Err)??e)(c.issues.map(d=>Gt(d,s,Bt())));throw fa(u,o==null?void 0:o.callee),u}return c.value},Po=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new $n;return s.issues.length?{success:!1,error:new(e??ba)(s.issues.map(c=>Gt(c,o,Bt())))}:{success:!0,data:s.value}},Lu=Po(ka),Ro=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(c=>Gt(c,o,Bt())))}:{success:!0,data:s.value}},Iu=Ro(ka),$u=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return _i(e)(t,n,o)},Nu=e=>(t,n,r)=>_i(e)(t,n,r),Ou=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return vi(e)(t,n,o)},Du=e=>async(t,n,r)=>vi(e)(t,n,r),Mu=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Po(e)(t,n,o)},Uu=e=>(t,n,r)=>Po(e)(t,n,r),ju=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ro(e)(t,n,o)},Zu=e=>async(t,n,r)=>Ro(e)(t,n,r),qu=/^[cC][^\s-]{8,}$/,Fu=/^[0-9a-z]+$/,Hu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Bu=/^[0-9a-vA-V]{20}$/,Gu=/^[A-Za-z0-9]{27}$/,Wu=/^[a-zA-Z0-9_-]{21}$/,Ju=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Xu=/^([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})$/,ps=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)$/,Vu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Yu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Ku(){return new RegExp(Yu,"u")}const Qu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ed=/^(([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}|:))$/,td=/^((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])$/,nd=/^(([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])$/,rd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_a=/^[A-Za-z0-9_-]*$/,od=/^\+[1-9]\d{6,14}$/,va="(?:(?:\\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])))",id=new RegExp(`^${va}$`);function ya(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 sd(e){return new RegExp(`^${ya(e)}$`)}function ad(e){const t=ya({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(`^${va}T(?:${r})$`)}const cd=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}$`)},ld=/^-?\d+$/,wa=/^-?\d+(?:\.\d+)?$/,ud=/^(?:true|false)$/i,dd=/^[^A-Z]*$/,pd=/^[^a-z]*$/,Ke=v("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),xa={number:"number",bigint:"bigint",object:"date"},Sa=v("$ZodCheckLessThan",(e,t)=>{Ke.init(e,t);const n=xa[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})}}),Ta=v("$ZodCheckGreaterThan",(e,t)=>{Ke.init(e,t);const n=xa[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})}}),hd=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):bu(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})}}),fd=v("$ZodCheckNumberFormat",(e,t)=>{var c;Ke.init(e,t),t.format=t.format||"float64";const n=(c=t.format)==null?void 0:c.includes("int"),r=n?"int":"number",[o,s]=wu[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=ld)}),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})}}),gd=v("$ZodCheckMaxLength",(e,t)=>{var n;Ke.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!mi(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const c=ki(o);r.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),md=v("$ZodCheckMinLength",(e,t)=>{var n;Ke.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!mi(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const c=ki(o);r.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),bd=v("$ZodCheckLengthEquals",(e,t)=>{var n;Ke.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!mi(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const c=ki(o),u=s>t.length;r.issues.push({origin:c,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),zo=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=()=>{})}),kd=v("$ZodCheckRegex",(e,t)=>{zo.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})}}),_d=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=dd),zo.init(e,t)}),vd=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=pd),zo.init(e,t)}),yd=v("$ZodCheckIncludes",(e,t)=>{Ke.init(e,t);const n=Un(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})}}),wd=v("$ZodCheckStartsWith",(e,t)=>{Ke.init(e,t);const n=new RegExp(`^${Un(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})}}),xd=v("$ZodCheckEndsWith",(e,t)=>{Ke.init(e,t);const n=new RegExp(`.*${Un(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})}}),Sd=v("$ZodCheckOverwrite",(e,t)=>{Ke.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Td{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
1187
|
-
`).filter(
|
|
1188
|
-
`))}}const
|
|
1328
|
+
`;let wi=!1;function Nr(){if(wi)return;const e=document.createElement("style");e.setAttribute("data-ap-sdk","1"),e.textContent=wu,document.head.appendChild(e),wi=!0}function fo(e){if(e===document.body)return"body";const t=[];let n=e;for(;n&&n!==document.body;){if(n.id){t.unshift(`#${CSS.escape(n.id)}`);break}let r=n.tagName.toLowerCase();const o=n.parentElement;if(o){const i=Array.from(o.children).filter(a=>a.tagName===n.tagName);if(i.length>1){const a=i.indexOf(n)+1;r+=`:nth-of-type(${a})`}}t.unshift(r),n=n.parentElement}return t.join(" > ")||e.tagName.toLowerCase()}function Eo(e,t=200){const n=(e.textContent??"").replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}const xu=["role","type","name","href","src","alt","title","for","placeholder","data-testid"];function go(e){const t=e.tagName.toLowerCase(),n=e.id?`#${e.id}`:"",r=e.classList.length?"."+Array.from(e.classList).join("."):"",o=[],i=new Set,a=u=>{if(i.has(u)||o.length>=8)return;const d=e.getAttribute(u);if(!d)return;i.add(u);const p=d.length>80?d.slice(0,80)+"…":d;o.push(`[${u}="${p}"]`)};for(const u of Array.from(e.attributes))u.name.startsWith("aria-")&&a(u.name);for(const u of xu)a(u);return`${t}${n}${r}${o.join("")}`}function Su(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 Tu(e,t=5,n=10){function r(o,i){const a=go(o),u=" ".repeat(i),d=Array.from(o.children).slice(0,n);if(i>=t||d.length===0){const p=Su(o);return p?`${u}${a} "${p}"`:`${u}${a}`}return[`${u}${a}`,...d.map(p=>r(p,i+1))].join(`
|
|
1329
|
+
`)}return r(e,0)}const Eu='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"]',Au={fieldset:"legend",table:"caption",figure:"figcaption",details:"summary"};function to(e,t){const n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}function Cu(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(Eu);)r=r.parentElement;if(r===e){const o=(n.textContent??"").trim();if(o)return o}}return""}function Pu(e,t=80){var a,u,d;const n=Au[e.tagName.toLowerCase()];if(n){const p=(u=(a=e.querySelector(n))==null?void 0:a.textContent)==null?void 0:u.trim();if(p)return to(p,t)}const r=Cu(e);if(r)return to(r,t);const o=(d=e.getAttribute("aria-label"))==null?void 0:d.trim();if(o)return to(o,t);const i=e.getAttribute("aria-labelledby");if(i){const p=i.split(/\s+/).map(h=>{var k,m;return((m=(k=document.getElementById(h))==null?void 0:k.textContent)==null?void 0:m.trim())??""}).filter(Boolean).join(" ");if(p)return to(p,t)}return""}function Ru(e,t=6){const n=[],r=new Set;let o=e;for(;o&&o!==document.body&&n.length<t;){const i=o===e?"":Pu(o),a=i&&!r.has(i)?`${go(o)} ["${i}"]`:go(o);i&&r.add(i),n.unshift(a),o=o.parentElement}return n.join(" > ")||go(e)}function Ta(e,t){return e.length>t?e.slice(0,t)+"… (truncated)":e}function mr(e){var r;const t=document.querySelector(e);return((r=t==null?void 0:t.content)==null?void 0:r.trim())||void 0}function Ea(){const e=t=>{try{return t()}catch{return}};return{description:e(()=>mr('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(()=>mr('meta[property="og:title"]')),ogDescription:e(()=>mr('meta[property="og:description"]')),ogType:e(()=>mr('meta[property="og:type"]')),ogSiteName:e(()=>mr('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?Ta(t,1e3):void 0}),capturedAt:new Date().toISOString()}}function Lu(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 zu(e){const t=e.getAttribute("role")||void 0,n=e.getAttribute("aria-label")||void 0;let r;const o=e.closest("section, article, main, nav, aside, header, footer, [role]");if(o){const i=o.querySelector("h1, h2, h3, h4, h5, h6"),a=o.getAttribute("aria-label")||((i==null?void 0:i.textContent)||"").trim(),u=o.tagName.toLowerCase();r=a?`${u}: ${Ta(a,120)}`:u}return{elementRole:t,elementAriaLabel:n,enclosingSection:r}}function Iu(e,t){const n=[e.trim(),"",`Page: ${t.pageTitle} (${t.pageUrl})`];return t.description&&n.push(`Description: ${t.description}`),t.selectionText&&n.push(`Selection: ${t.selectionText}`),t.elementText&&n.push(`Selected element: ${t.elementText}`),t.elementRole&&n.push(` Role: ${t.elementRole}`),t.elementAriaLabel&&n.push(` ARIA label: ${t.elementAriaLabel}`),t.enclosingSection&&n.push(`Section: ${t.enclosingSection}`),t.ancestry&&n.push(`Ancestry: ${t.ancestry}`),t.cssSelector&&n.push(`Selector: ${t.cssSelector}`),n.join(`
|
|
1330
|
+
`)}const Jn=new Set;let qn=null,Ao=!1,ms=!1;function $u(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function Nu(){const e=document.querySelectorAll("dialog[open]");for(let n=0;n<e.length;n++)try{if(e[n].matches(":modal"))return!0}catch{}const t=document.querySelectorAll('[role="dialog"], [role="alertdialog"]');for(let n=0;n<t.length;n++){const r=t[n];if(!(Jn.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&$u(r))return!0}return!1}function Aa(){const e=Nu(),t=e&&!ms;ms=e;for(const n of Jn){n.hasAttribute("inert")&&n.removeAttribute("inert"),n.getAttribute("aria-hidden")==="true"&&n.removeAttribute("aria-hidden");const r=n.contains(document.activeElement);if(n.matches(":popover-open")){if(t&&!r){try{n.hidePopover()}catch{}try{n.showPopover()}catch{}}}else try{n.showPopover()}catch{}}}function xi(e){if(!(e instanceof Node))return!1;for(const t of Jn)if(t===e||t.contains(e))return!0;return!1}function Hn(e){(xi(e.target)||"relatedTarget"in e&&xi(e.relatedTarget))&&e.stopPropagation()}function Ou(){Ao||(window.addEventListener("focusin",Hn,!0),window.addEventListener("focusout",Hn,!0),window.addEventListener("pointerdown",Hn,!0),Ao=!0),!qn&&(qn=new MutationObserver(e=>{e.some(n=>n.type==="childList"||n.attributeName==="open"&&n.target.tagName==="DIALOG"||n.attributeName==="inert"||n.attributeName==="aria-hidden"||n.attributeName==="role")&&Aa()}),qn.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function jt(e){"showPopover"in e&&(e.setAttribute("popover","manual"),Jn.add(e),Ou(),Aa())}function Zt(e){if(Jn.delete(e),Jn.size===0&&(qn&&(qn.disconnect(),qn=null),Ao&&(window.removeEventListener("focusin",Hn,!0),window.removeEventListener("focusout",Hn,!0),window.removeEventListener("pointerdown",Hn,!0),Ao=!1),ms=!1),"hidePopover"in e)try{e.hidePopover()}catch{}}function Rs(e="ap-sdk-highlight"){const t=document.createElement("div");return t.className=e,t.setAttribute("data-ap-sdk","1"),t.style.display="none",document.body.appendChild(t),jt(t),{el:t,update:i=>{const a=i.getBoundingClientRect();t.style.top=`${a.top}px`,t.style.left=`${a.left}px`,t.style.width=`${a.width}px`,t.style.height=`${a.height}px`,t.style.display="block"},hide:()=>{t.style.display="none"},destroy:()=>{Zt(t),t.remove()}}}const Du="🎯 Click any element to capture";let Kt=null,Le=null,Qe=null;function Ar(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 Mu(){var e;return(((e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)??!1)||"ontouchstart"in window}function Si(e){Kt==null||Kt.update(e)}function Ca(e){const t=Ea(),n=Lu(e),r=zu(e);let o;try{o=e.outerHTML.slice(0,4e3)}catch{}return{pageUrl:window.location.href,pageTitle:document.title,elementText:Eo(e),cssSelector:fo(e),innerTree:Tu(e),outerTree:Ru(e),elementOuterHtml:o,ancestry:n,...r,...t}}function Ti(e,t){Qe&&Qe();const n=Mu();Kt=Rs(),Le=document.createElement("div"),Le.className="ap-sdk-picker-cursor",Le.setAttribute("data-ap-sdk","1"),Le.textContent=n?"Tap any element to preview":Du,document.body.appendChild(Le),jt(Le);let r=null,o=null;const i=h=>{Qe==null||Qe(),e(Ca(h),h)},a=h=>{if(o=h,Si(h),!Le)return;Le.classList.add("ap-sdk-picker-cursor--confirm"),Le.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&&i(o)}),Le.appendChild(k),Le.appendChild(m),Le.appendChild(_)},u=h=>{Ar(h.target)||(r=h.target,Si(r))},d=h=>{if(Ar(h.target))return;h.preventDefault(),h.stopImmediatePropagation();const k=h.target??r;if(k){if(n){a(k);return}i(k)}},p=h=>{h.key==="Escape"&&(Qe==null||Qe(),t())};n||document.addEventListener("mouseover",u,{capture:!0}),document.addEventListener("click",d,{capture:!0}),document.addEventListener("keydown",p,{capture:!0}),Qe=()=>{n||document.removeEventListener("mouseover",u,{capture:!0}),document.removeEventListener("click",d,{capture:!0}),document.removeEventListener("keydown",p,{capture:!0}),Le&&Zt(Le),Le==null||Le.remove(),Kt==null||Kt.destroy(),Kt=null,Le=null,o=null,Qe=null}}function Ls(){Qe==null||Qe()}function Fn(){return Qe!==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 i extends o{}Object.defineProperty(i,"name",{value:e});function a(u){var d;const p=n!=null&&n.Parent?new i: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 Bn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Pa extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Ra={};function Qt(e){return Ra}function La(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function bs(e,t){return typeof t=="bigint"?t.toString():t}function Ho(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function zs(e){return e==null}function Is(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Uu(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 i=n>o?n:o,a=Number.parseInt(e.toFixed(i).replace(".","")),u=Number.parseInt(t.toFixed(i).replace(".",""));return a%u/10**i}const Ei=Symbol("evaluating");function K(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ei)return r===void 0&&(r=Ei,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Sn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function tn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Ai(e){return JSON.stringify(e)}function ju(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const za="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function zr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Zu=Ho(()=>{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 Xn(e){if(zr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(zr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Ia(e){return Xn(e)?{...e}:Array.isArray(e)?[...e]:e}const qu=new Set(["string","number","symbol"]);function Vn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function nn(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 D(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 Hu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Fu={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Bu(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=tn(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 Sn(this,"shape",a),a},checks:[]});return nn(e,i)}function Gu(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=tn(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 Sn(this,"shape",a),a},checks:[]});return nn(e,i)}function Wu(e,t){if(!Xn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=tn(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Sn(this,"shape",i),i}});return nn(e,o)}function Ju(e,t){if(!Xn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=tn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Sn(this,"shape",r),r}});return nn(e,n)}function Xu(e,t){const n=tn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Sn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return nn(e,n)}function Vu(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=tn(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 Sn(this,"shape",d),d},checks:[]});return nn(t,a)}function Yu(e,t,n){const r=tn(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(n)for(const a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return Sn(this,"shape",i),i}});return nn(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 no(e){return typeof e=="string"?e:e==null?void 0:e.message}function en(e,t,n){var o,i,a,u,d,p;const r={...e,path:e.path??[]};if(!e.message){const h=no((a=(i=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:i.error)==null?void 0:a.call(i,e))??no((u=t==null?void 0:t.error)==null?void 0:u.call(t,e))??no((d=n.customError)==null?void 0:d.call(n,e))??no((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 $s(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ir(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const $a=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,bs,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Na=v("$ZodError",$a),Oa=v("$ZodError",$a,{Parent:Error});function Ku(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 Qu(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let a=n,u=0;for(;u<i.path.length;){const d=i.path[u];u===i.path.length-1?(a[d]=a[d]||{_errors:[]},a[d]._errors.push(t(i))):a[d]=a[d]||{_errors:[]},a=a[d],u++}}};return r(e),n}const Ns=e=>(t,n,r,o)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Bn;if(a.issues.length){const u=new((o==null?void 0:o.Err)??e)(a.issues.map(d=>en(d,i,Qt())));throw za(u,o==null?void 0:o.callee),u}return a.value},Os=e=>async(t,n,r,o)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const u=new((o==null?void 0:o.Err)??e)(a.issues.map(d=>en(d,i,Qt())));throw za(u,o==null?void 0:o.callee),u}return a.value},Fo=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Bn;return i.issues.length?{success:!1,error:new(e??Na)(i.issues.map(a=>en(a,o,Qt())))}:{success:!0,data:i.value}},ed=Fo(Oa),Bo=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>en(a,o,Qt())))}:{success:!0,data:i.value}},td=Bo(Oa),nd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ns(e)(t,n,o)},rd=e=>(t,n,r)=>Ns(e)(t,n,r),od=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Os(e)(t,n,o)},sd=e=>async(t,n,r)=>Os(e)(t,n,r),id=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Fo(e)(t,n,o)},ad=e=>(t,n,r)=>Fo(e)(t,n,r),cd=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Bo(e)(t,n,o)},ld=e=>async(t,n,r)=>Bo(e)(t,n,r),ud=/^[cC][^\s-]{8,}$/,dd=/^[0-9a-z]+$/,pd=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,hd=/^[0-9a-vA-V]{20}$/,fd=/^[A-Za-z0-9]{27}$/,gd=/^[a-zA-Z0-9_-]{21}$/,md=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,bd=/^([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})$/,Ci=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)$/,kd=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_d="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function vd(){return new RegExp(_d,"u")}const yd=/^(?:(?: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])$/,wd=/^(([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}|:))$/,xd=/^((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])$/,Sd=/^(([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])$/,Td=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Da=/^[A-Za-z0-9_-]*$/,Ed=/^\+[1-9]\d{6,14}$/,Ma="(?:(?:\\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])))",Ad=new RegExp(`^${Ma}$`);function Ua(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 Cd(e){return new RegExp(`^${Ua(e)}$`)}function Pd(e){const t=Ua({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(`^${Ma}T(?:${r})$`)}const Rd=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}$`)},Ld=/^-?\d+$/,ja=/^-?\d+(?:\.\d+)?$/,zd=/^(?:true|false)$/i,Id=/^[^A-Z]*$/,$d=/^[^a-z]*$/,nt=v("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Za={number:"number",bigint:"bigint",object:"date"},qa=v("$ZodCheckLessThan",(e,t)=>{nt.init(e,t);const n=Za[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ha=v("$ZodCheckGreaterThan",(e,t)=>{nt.init(e,t);const n=Za[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Nd=v("$ZodCheckMultipleOf",(e,t)=>{nt.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):Uu(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})}}),Od=v("$ZodCheckNumberFormat",(e,t)=>{var a;nt.init(e,t),t.format=t.format||"float64";const n=(a=t.format)==null?void 0:a.includes("int"),r=n?"int":"number",[o,i]=Fu[t.format];e._zod.onattach.push(u=>{const d=u._zod.bag;d.format=t.format,d.minimum=o,d.maximum=i,n&&(d.pattern=Ld)}),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>i&&u.issues.push({origin:"number",input:d,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Dd=v("$ZodCheckMaxLength",(e,t)=>{var n;nt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!zs(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=$s(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Md=v("$ZodCheckMinLength",(e,t)=>{var n;nt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!zs(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=$s(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ud=v("$ZodCheckLengthEquals",(e,t)=>{var n;nt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!zs(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,i=o.length;if(i===t.length)return;const a=$s(o),u=i>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})}}),Go=v("$ZodCheckStringFormat",(e,t)=>{var n,r;nt.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.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=()=>{})}),jd=v("$ZodCheckRegex",(e,t)=>{Go.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})}}),Zd=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Id),Go.init(e,t)}),qd=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=$d),Go.init(e,t)}),Hd=v("$ZodCheckIncludes",(e,t)=>{nt.init(e,t);const n=Vn(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Fd=v("$ZodCheckStartsWith",(e,t)=>{nt.init(e,t);const n=new RegExp(`^${Vn(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})}}),Bd=v("$ZodCheckEndsWith",(e,t)=>{nt.init(e,t);const n=new RegExp(`.*${Vn(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})}}),Gd=v("$ZodCheckOverwrite",(e,t)=>{nt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Wd{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
|
+
`).filter(a=>a),o=Math.min(...r.map(a=>a.length-a.trimStart().length)),i=r.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of i)this.content.push(a)}compile(){const t=Function,n=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(i=>` ${i}`)];return new t(...n,o.join(`
|
|
1332
|
+
`))}}const Jd={major:4,minor:3,patch:5},pe=v("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Jd;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const a of i._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 i=(u,d,p)=>{let h=Mn(u),k;for(const m of d){if(m._zod.def.when){if(!m._zod.def.when(u))continue}else if(h)continue;const _=u.issues.length,w=m._zod.check(u);if(w instanceof Promise&&(p==null?void 0:p.async)===!1)throw new Bn;if(k||w instanceof Promise)k=(k??Promise.resolve()).then(async()=>{await w,u.issues.length!==_&&(h||(h=Mn(u,_)))});else{if(u.issues.length===_)continue;h||(h=Mn(u,_))}}return k?k.then(()=>u):u},a=(u,d,p)=>{if(Mn(u))return u.aborted=!0,u;const h=i(d,r,p);if(h instanceof Promise){if(p.async===!1)throw new Bn;return h.then(k=>e._zod.parse(k,p))}return e._zod.parse(h,p)};e._zod.run=(u,d)=>{if(d.skipChecks)return e._zod.parse(u,d);if(d.direction==="backward"){const h=e._zod.parse({value:u.value,issues:[]},{...d,skipChecks:!0});return h instanceof Promise?h.then(k=>a(k,u,d)):a(h,u,d)}const p=e._zod.parse(u,d);if(p instanceof Promise){if(d.async===!1)throw new Bn;return p.then(h=>i(h,r,d))}return i(p,r,d)}}K(e,"~standard",()=>({validate:i=>{var a;try{const u=ed(e,i);return u.success?{value:u.data}:{issues:(a=u.error)==null?void 0:a.issues}}catch{return td(e,i).then(d=>{var p;return d.success?{value:d.data}:{issues:(p=d.error)==null?void 0:p.issues}})}},vendor:"zod",version:1}))}),Ds=v("$ZodString",(e,t)=>{var n;pe.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??Rd(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}}),he=v("$ZodStringFormat",(e,t)=>{Go.init(e,t),Ds.init(e,t)}),Xd=v("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=bd),he.init(e,t)}),Vd=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=Ci(r))}else t.pattern??(t.pattern=Ci());he.init(e,t)}),Yd=v("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=kd),he.init(e,t)}),Kd=v("$ZodURL",(e,t)=>{he.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})}}}),Qd=v("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=vd()),he.init(e,t)}),ep=v("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=gd),he.init(e,t)}),tp=v("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=ud),he.init(e,t)}),np=v("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=dd),he.init(e,t)}),rp=v("$ZodULID",(e,t)=>{t.pattern??(t.pattern=pd),he.init(e,t)}),op=v("$ZodXID",(e,t)=>{t.pattern??(t.pattern=hd),he.init(e,t)}),sp=v("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=fd),he.init(e,t)}),ip=v("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Pd(t)),he.init(e,t)}),ap=v("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Ad),he.init(e,t)}),cp=v("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Cd(t)),he.init(e,t)}),lp=v("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=md),he.init(e,t)}),up=v("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=yd),he.init(e,t),e._zod.bag.format="ipv4"}),dp=v("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=wd),he.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})}}}),pp=v("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=xd),he.init(e,t)}),hp=v("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Sd),he.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,i]=r;if(!i)throw new Error;const a=Number(i);if(`${a}`!==i)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 Fa(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const fp=v("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Td),he.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Fa(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function gp(e){if(!Da.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Fa(n)}const mp=v("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Da),he.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{gp(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),bp=v("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ed),he.init(e,t)});function kp(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 _p=v("$ZodJWT",(e,t)=>{he.init(e,t),e._zod.check=n=>{kp(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Ba=v("$ZodNumber",(e,t)=>{pe.init(e,t),e._zod.pattern=e._zod.bag.pattern??ja,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 i=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,...i?{received:i}:{}}),n}}),vp=v("$ZodNumberFormat",(e,t)=>{Od.init(e,t),Ba.init(e,t)}),yp=v("$ZodBoolean",(e,t)=>{pe.init(e,t),e._zod.pattern=zd,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}}),wp=v("$ZodAny",(e,t)=>{pe.init(e,t),e._zod.parse=n=>n}),xp=v("$ZodUnknown",(e,t)=>{pe.init(e,t),e._zod.parse=n=>n}),Sp=v("$ZodNever",(e,t)=>{pe.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Pi(e,t,n){e.issues.length&&t.issues.push(...Un(n,e.issues)),t.value[n]=e.value}const Tp=v("$ZodArray",(e,t)=>{pe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const u=o[a],d=t.element._zod.run({value:u,issues:[]},r);d instanceof Promise?i.push(d.then(p=>Pi(p,n,a))):Pi(d,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function Co(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Un(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Ga(e){var r,o,i,a;const t=Object.keys(e.shape);for(const u of t)if(!((a=(i=(o=(r=e.shape)==null?void 0:r[u])==null?void 0:o._zod)==null?void 0:i.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${u}": expected a Zod schema`);const n=Hu(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Wa(e,t,n,r,o,i){const a=[],u=o.keySet,d=o.catchall._zod,p=d.def.type,h=d.optout==="optional";for(const k in t){if(u.has(k))continue;if(p==="never"){a.push(k);continue}const m=d.run({value:t[k],issues:[]},r);m instanceof Promise?e.push(m.then(_=>Co(_,n,k,t,h))):Co(m,n,k,t,h)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const Ep=v("$ZodObject",(e,t)=>{pe.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=Ho(()=>Ga(t));K(e._zod,"propValues",()=>{const u=t.shape,d={};for(const p in u){const h=u[p]._zod;if(h.values){d[p]??(d[p]=new Set);for(const k of h.values)d[p].add(k)}}return d});const o=zr,i=t.catchall;let a;e._zod.parse=(u,d)=>{a??(a=r.value);const p=u.value;if(!o(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value={};const h=[],k=a.shape;for(const m of a.keys){const _=k[m],w=_._zod.optout==="optional",P=_._zod.run({value:p[m],issues:[]},d);P instanceof Promise?h.push(P.then(N=>Co(N,u,m,p,w))):Co(P,u,m,p,w)}return i?Wa(h,p,u,d,r.value,e):h.length?Promise.all(h).then(()=>u):u}}),Ap=v("$ZodObjectJIT",(e,t)=>{Ep.init(e,t);const n=e._zod.parse,r=Ho(()=>Ga(t)),o=m=>{var x;const _=new Wd(["shape","payload","ctx"]),w=r.value,P=S=>{const C=Ai(S);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};_.write("const input = payload.value;");const N=Object.create(null);let ee=0;for(const S of w.keys)N[S]=`key_${ee++}`;_.write("const newResult = {};");for(const S of w.keys){const C=N[S],M=Ai(S),ie=m[S],ke=((x=ie==null?void 0:ie._zod)==null?void 0:x.optout)==="optional";_.write(`const ${C} = ${P(S)};`),ke?_.write(`
|
|
1189
1333
|
if (${C}.issues.length) {
|
|
1190
1334
|
if (${M} in input) {
|
|
1191
1335
|
payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
|
|
@@ -1219,48 +1363,48 @@ button.ap-sdk-list-item__link {
|
|
|
1219
1363
|
newResult[${M}] = ${C}.value;
|
|
1220
1364
|
}
|
|
1221
1365
|
|
|
1222
|
-
`)}_.write("payload.value = newResult;"),_.write("return payload;");const R=_.compile();return(S,C)=>R(m,S,C)};let s;const c=Sr,u=!pa.jitless,p=u&&_u.value,h=t.catchall;let k;e._zod.parse=(m,_)=>{k??(k=r.value);const w=m.value;return c(w)?u&&p&&(_==null?void 0:_.async)===!1&&_.jitless!==!0?(s||(s=o(t.shape)),m=s(m,_),h?Pa([],w,m,_,k,e):m):n(m,_):(m.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),m)}});function fs(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=>!Pn(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(c=>Gt(c,r,Bt())))}),t)}const Ra=v("$ZodUnion",(e,t)=>{pe.init(e,t),K(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),K(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),K(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),K(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=>bi(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(n)return r(o,s);let c=!1;const u=[];for(const d of t.options){const p=d._zod.run({value:o.value,issues:[]},s);if(p instanceof Promise)u.push(p),c=!0;else{if(p.issues.length===0)return p;u.push(p)}}return c?Promise.all(u).then(d=>fs(d,o,e,s)):fs(u,o,e,s)}}),sp=v("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ra.init(e,t);const n=e._zod.parse;K(e._zod,"propValues",()=>{const o={};for(const s of t.options){const c=s._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[u,d]of Object.entries(c)){o[u]||(o[u]=new Set);for(const p of d)o[u].add(p)}}return o});const r=Co(()=>{var c;const o=t.options,s=new Map;for(const u of o){const d=(c=u._zod.propValues)==null?void 0:c[t.discriminator];if(!d||d.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(u)}"`);for(const p of d){if(s.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);s.set(p,u)}}return s});e._zod.parse=(o,s)=>{const c=o.value;if(!Sr(c))return o.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),o;const u=r.value.get(c==null?void 0:c[t.discriminator]);return u?u._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:c,path:[t.discriminator],inst:e}),o)}}),ap=v("$ZodIntersection",(e,t)=>{pe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),c=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||c instanceof Promise?Promise.all([s,c]).then(([d,p])=>gs(n,d,p)):gs(n,s,c)}});function oi(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(Mn(e)&&Mn(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const c=oi(e[s],t[s]);if(!c.valid)return{valid:!1,mergeErrorPath:[s,...c.mergeErrorPath]};o[s]=c.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],c=oi(o,s);if(!c.valid)return{valid:!1,mergeErrorPath:[r,...c.mergeErrorPath]};n.push(c.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function gs(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}),Pn(e))return e;const c=oi(t.value,n.value);if(!c.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`);return e.value=c.data,e}const cp=v("$ZodRecord",(e,t)=>{pe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Mn(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[],c=t.keyType._zod.values;if(c){n.value={};const u=new Set;for(const p of c)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){u.add(typeof p=="number"?p.toString():p);const h=t.valueType._zod.run({value:o[p],issues:[]},r);h instanceof Promise?s.push(h.then(k=>{k.issues.length&&n.issues.push(...Rn(p,k.issues)),n.value[p]=k.value})):(h.issues.length&&n.issues.push(...Rn(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"&&wa.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=>Gt(k,r,Bt())),input:u,path:[u],inst:e});continue}const h=t.valueType._zod.run({value:o[u],issues:[]},r);h instanceof Promise?s.push(h.then(k=>{k.issues.length&&n.issues.push(...Rn(u,k.issues)),n.value[d.value]=k.value})):(h.issues.length&&n.issues.push(...Rn(u,h.issues)),n.value[d.value]=h.value)}}return s.length?Promise.all(s).then(()=>n):n}}),lp=v("$ZodEnum",(e,t)=>{pe.init(e,t);const n=ha(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>vu.has(typeof o)).map(o=>typeof o=="string"?Un(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const c=o.value;return r.has(c)||o.issues.push({code:"invalid_value",values:n,input:c,inst:e}),o}}),up=v("$ZodLiteral",(e,t)=>{if(pe.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"?Un(r):r?Un(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}}),dp=v("$ZodTransform",(e,t)=>{pe.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new da(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(c=>(n.value=c,n));if(o instanceof Promise)throw new $n;return n.value=o,n}});function ms(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const za=v("$ZodOptional",(e,t)=>{pe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",K(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),K(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${bi(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=>ms(s,n.value)):ms(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),pp=v("$ZodExactOptional",(e,t)=>{za.init(e,t),K(e._zod,"values",()=>t.innerType._zod.values),K(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),hp=v("$ZodNullable",(e,t)=>{pe.init(e,t),K(e._zod,"optin",()=>t.innerType._zod.optin),K(e._zod,"optout",()=>t.innerType._zod.optout),K(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${bi(n.source)}|null)$`):void 0}),K(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)}),fp=v("$ZodDefault",(e,t)=>{pe.init(e,t),e._zod.optin="optional",K(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=>bs(s,t)):bs(o,t)}});function bs(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const gp=v("$ZodPrefault",(e,t)=>{pe.init(e,t),e._zod.optin="optional",K(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))}),mp=v("$ZodNonOptional",(e,t)=>{pe.init(e,t),K(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=>ks(s,e)):ks(o,e)}});function ks(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 bp=v("$ZodCatch",(e,t)=>{pe.init(e,t),K(e._zod,"optin",()=>t.innerType._zod.optin),K(e._zod,"optout",()=>t.innerType._zod.optout),K(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(c=>Gt(c,r,Bt()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>Gt(s,r,Bt()))},input:n.value}),n.issues=[]),n)}}),kp=v("$ZodPipe",(e,t)=>{pe.init(e,t),K(e._zod,"values",()=>t.in._zod.values),K(e._zod,"optin",()=>t.in._zod.optin),K(e._zod,"optout",()=>t.out._zod.optout),K(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(c=>Jr(c,t.in,r)):Jr(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>Jr(s,t.out,r)):Jr(o,t.out,r)}});function Jr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const _p=v("$ZodReadonly",(e,t)=>{pe.init(e,t),K(e._zod,"propValues",()=>t.innerType._zod.propValues),K(e._zod,"values",()=>t.innerType._zod.values),K(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),K(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(_s):_s(o)}});function _s(e){return e.value=Object.freeze(e.value),e}const vp=v("$ZodCustom",(e,t)=>{Ke.init(e,t),pe.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=>vs(s,n,r,e));vs(o,n,r,e)}});function vs(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(Tr(o))}}var ys;class yp{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 wp(){return new yp}(ys=globalThis).__zod_globalRegistry??(ys.__zod_globalRegistry=wp());const pr=globalThis.__zod_globalRegistry;function xp(e,t){return new e({type:"string",...D(t)})}function Sp(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...D(t)})}function ws(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...D(t)})}function Tp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...D(t)})}function Ep(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(t)})}function Ap(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(t)})}function Cp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(t)})}function Pp(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...D(t)})}function Rp(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...D(t)})}function zp(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(t)})}function Lp(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...D(t)})}function Ip(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(t)})}function $p(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...D(t)})}function Np(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...D(t)})}function Op(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(t)})}function Dp(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(t)})}function Mp(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(t)})}function Up(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(t)})}function jp(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(t)})}function Zp(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...D(t)})}function qp(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...D(t)})}function Fp(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...D(t)})}function Hp(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...D(t)})}function Bp(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(t)})}function Gp(e,t){return new e({type:"string",format:"date",check:"string_format",...D(t)})}function Wp(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...D(t)})}function Jp(e,t){return new e({type:"string",format:"duration",check:"string_format",...D(t)})}function Xp(e,t){return new e({type:"number",checks:[],...D(t)})}function Vp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...D(t)})}function Yp(e,t){return new e({type:"boolean",...D(t)})}function Kp(e){return new e({type:"any"})}function Qp(e){return new e({type:"unknown"})}function eh(e,t){return new e({type:"never",...D(t)})}function xs(e,t){return new Sa({check:"less_than",...D(t),value:e,inclusive:!1})}function Bo(e,t){return new Sa({check:"less_than",...D(t),value:e,inclusive:!0})}function Ss(e,t){return new Ta({check:"greater_than",...D(t),value:e,inclusive:!1})}function Go(e,t){return new Ta({check:"greater_than",...D(t),value:e,inclusive:!0})}function Ts(e,t){return new hd({check:"multiple_of",...D(t),value:e})}function La(e,t){return new gd({check:"max_length",...D(t),maximum:e})}function go(e,t){return new md({check:"min_length",...D(t),minimum:e})}function Ia(e,t){return new bd({check:"length_equals",...D(t),length:e})}function th(e,t){return new kd({check:"string_format",format:"regex",...D(t),pattern:e})}function nh(e){return new _d({check:"string_format",format:"lowercase",...D(e)})}function rh(e){return new vd({check:"string_format",format:"uppercase",...D(e)})}function oh(e,t){return new yd({check:"string_format",format:"includes",...D(t),includes:e})}function ih(e,t){return new wd({check:"string_format",format:"starts_with",...D(t),prefix:e})}function sh(e,t){return new xd({check:"string_format",format:"ends_with",...D(t),suffix:e})}function qn(e){return new Sd({check:"overwrite",tx:e})}function ah(e){return qn(t=>t.normalize(e))}function ch(){return qn(e=>e.trim())}function lh(){return qn(e=>e.toLowerCase())}function uh(){return qn(e=>e.toUpperCase())}function dh(){return qn(e=>ku(e))}function ph(e,t,n){return new e({type:"array",element:t,...D(n)})}function hh(e,t,n){return new e({type:"custom",check:"custom",fn:t,...D(n)})}function fh(e){const t=gh(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Tr(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(Tr(o))}},e(n.value,n)));return t}function gh(e,t){const n=new Ke({check:"custom",...D(t)});return n._zod.check=e,n}function $a(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)??pr,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function xe(e,t,n={path:[],schemaPath:[]}){var h,k;var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const c={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,c);const u=(k=(h=e._zod).toJSONSchema)==null?void 0:k.call(h);if(u)c.schema=u;else{const m={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,m);else{const w=c.schema,P=t.processors[o.type];if(!P)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);P(e,t,w,m)}const _=e._zod.parent;_&&(c.ref||(c.ref=_),xe(_,t,m),t.seen.get(_).isParent=!0)}const d=t.metadataRegistry.get(e);return d&&Object.assign(c.schema,d),t.io==="input"&&Fe(e)&&(delete c.schema.examples,delete c.schema.default),t.io==="input"&&c.schema._prefault&&((r=c.schema).default??(r.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}function Na(e,t){var c,u,d,p;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const h of e.seen.entries()){const k=(c=e.metadataRegistry.get(h[0]))==null?void 0:c.id;if(k){const m=r.get(k);if(m&&m!==h[0])throw new Error(`Duplicate schema id "${k}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(k,h[0])}}const o=h=>{var P;const k=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const N=(P=e.external.registry.get(h[0]))==null?void 0:P.id,te=e.external.uri??(x=>x);if(N)return{ref:te(N)};const R=h[1].defId??h[1].schema.id??`schema${e.counter++}`;return h[1].defId=R,{defId:R,ref:`${te("__shared")}#/${k}/${R}`}}if(h[1]===n)return{ref:"#"};const _=`#/${k}/`,w=h[1].schema.id??`__schema${e.counter++}`;return{defId:w,ref:_+w}},s=h=>{if(h[1].schema.$ref)return;const k=h[1],{ref:m,defId:_}=o(h);k.def={...k.schema},_&&(k.defId=_);const w=k.schema;for(const P in w)delete w[P];w.$ref=m};if(e.cycles==="throw")for(const h of e.seen.entries()){const k=h[1];if(k.cycle)throw new Error(`Cycle detected: #/${(u=k.cycle)==null?void 0:u.join("/")}/<root>
|
|
1366
|
+
`)}_.write("payload.value = newResult;"),_.write("return payload;");const R=_.compile();return(S,C)=>R(m,S,C)};let i;const a=zr,u=!Ra.jitless,p=u&&Zu.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?(i||(i=o(t.shape)),m=i(m,_),h?Wa([],w,m,_,k,e):m):n(m,_):(m.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),m)}});function Ri(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!Mn(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(a=>en(a,r,Qt())))}),t)}const Ja=v("$ZodUnion",(e,t)=>{pe.init(e,t),K(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),K(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),K(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),K(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Is(i.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let a=!1;const u=[];for(const d of t.options){const p=d._zod.run({value:o.value,issues:[]},i);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=>Ri(d,o,e,i)):Ri(u,o,e,i)}}),Cp=v("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ja.init(e,t);const n=e._zod.parse;K(e._zod,"propValues",()=>{const o={};for(const i of t.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[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=Ho(()=>{var a;const o=t.options,i=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(i.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);i.set(p,u)}}return i});e._zod.parse=(o,i)=>{const a=o.value;if(!zr(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,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),Pp=v("$ZodIntersection",(e,t)=>{pe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([d,p])=>Li(n,d,p)):Li(n,i,a)}});function ks(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(Xn(e)&&Xn(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};for(const i of r){const a=ks(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],a=ks(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Li(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 i=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(i.length&&o&&e.issues.push({...o,keys:i}),Mn(e))return e;const a=ks(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 Rp=v("$ZodRecord",(e,t)=>{pe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Xn(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],a=t.keyType._zod.values;if(a){n.value={};const 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?i.push(h.then(k=>{k.issues.length&&n.issues.push(...Un(p,k.issues)),n.value[p]=k.value})):(h.issues.length&&n.issues.push(...Un(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"&&ja.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=>en(k,r,Qt())),input:u,path:[u],inst:e});continue}const h=t.valueType._zod.run({value:o[u],issues:[]},r);h instanceof Promise?i.push(h.then(k=>{k.issues.length&&n.issues.push(...Un(u,k.issues)),n.value[d.value]=k.value})):(h.issues.length&&n.issues.push(...Un(u,h.issues)),n.value[d.value]=h.value)}}return i.length?Promise.all(i).then(()=>n):n}}),Lp=v("$ZodEnum",(e,t)=>{pe.init(e,t);const n=La(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>qu.has(typeof o)).map(o=>typeof o=="string"?Vn(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),zp=v("$ZodLiteral",(e,t)=>{if(pe.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"?Vn(r):r?Vn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),Ip=v("$ZodTransform",(e,t)=>{pe.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Pa(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new Bn;return n.value=o,n}});function zi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Xa=v("$ZodOptional",(e,t)=>{pe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",K(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),K(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Is(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>zi(i,n.value)):zi(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),$p=v("$ZodExactOptional",(e,t)=>{Xa.init(e,t),K(e._zod,"values",()=>t.innerType._zod.values),K(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Np=v("$ZodNullable",(e,t)=>{pe.init(e,t),K(e._zod,"optin",()=>t.innerType._zod.optin),K(e._zod,"optout",()=>t.innerType._zod.optout),K(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Is(n.source)}|null)$`):void 0}),K(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)}),Op=v("$ZodDefault",(e,t)=>{pe.init(e,t),e._zod.optin="optional",K(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Ii(i,t)):Ii(o,t)}});function Ii(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Dp=v("$ZodPrefault",(e,t)=>{pe.init(e,t),e._zod.optin="optional",K(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))}),Mp=v("$ZodNonOptional",(e,t)=>{pe.init(e,t),K(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>$i(i,e)):$i(o,e)}});function $i(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 Up=v("$ZodCatch",(e,t)=>{pe.init(e,t),K(e._zod,"optin",()=>t.innerType._zod.optin),K(e._zod,"optout",()=>t.innerType._zod.optout),K(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(a=>en(a,r,Qt()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>en(i,r,Qt()))},input:n.value}),n.issues=[]),n)}}),jp=v("$ZodPipe",(e,t)=>{pe.init(e,t),K(e._zod,"values",()=>t.in._zod.values),K(e._zod,"optin",()=>t.in._zod.optin),K(e._zod,"optout",()=>t.out._zod.optout),K(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(a=>ro(a,t.in,r)):ro(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>ro(i,t.out,r)):ro(o,t.out,r)}});function ro(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Zp=v("$ZodReadonly",(e,t)=>{pe.init(e,t),K(e._zod,"propValues",()=>t.innerType._zod.propValues),K(e._zod,"values",()=>t.innerType._zod.values),K(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),K(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(Ni):Ni(o)}});function Ni(e){return e.value=Object.freeze(e.value),e}const qp=v("$ZodCustom",(e,t)=>{nt.init(e,t),pe.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>Oi(i,n,r,e));Oi(o,n,r,e)}});function Oi(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(Ir(o))}}var Di;class Hp{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 Fp(){return new Hp}(Di=globalThis).__zod_globalRegistry??(Di.__zod_globalRegistry=Fp());const Tr=globalThis.__zod_globalRegistry;function Bp(e,t){return new e({type:"string",...D(t)})}function Gp(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...D(t)})}function Mi(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...D(t)})}function Wp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...D(t)})}function Jp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...D(t)})}function Xp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...D(t)})}function Vp(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...D(t)})}function Yp(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...D(t)})}function Kp(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...D(t)})}function Qp(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...D(t)})}function eh(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...D(t)})}function th(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...D(t)})}function nh(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...D(t)})}function rh(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...D(t)})}function oh(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...D(t)})}function sh(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...D(t)})}function ih(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...D(t)})}function ah(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...D(t)})}function ch(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...D(t)})}function lh(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...D(t)})}function uh(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...D(t)})}function dh(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...D(t)})}function ph(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...D(t)})}function hh(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...D(t)})}function fh(e,t){return new e({type:"string",format:"date",check:"string_format",...D(t)})}function gh(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...D(t)})}function mh(e,t){return new e({type:"string",format:"duration",check:"string_format",...D(t)})}function bh(e,t){return new e({type:"number",checks:[],...D(t)})}function kh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...D(t)})}function _h(e,t){return new e({type:"boolean",...D(t)})}function vh(e){return new e({type:"any"})}function yh(e){return new e({type:"unknown"})}function wh(e,t){return new e({type:"never",...D(t)})}function Ui(e,t){return new qa({check:"less_than",...D(t),value:e,inclusive:!1})}function ss(e,t){return new qa({check:"less_than",...D(t),value:e,inclusive:!0})}function ji(e,t){return new Ha({check:"greater_than",...D(t),value:e,inclusive:!1})}function is(e,t){return new Ha({check:"greater_than",...D(t),value:e,inclusive:!0})}function Zi(e,t){return new Nd({check:"multiple_of",...D(t),value:e})}function Va(e,t){return new Dd({check:"max_length",...D(t),maximum:e})}function Po(e,t){return new Md({check:"min_length",...D(t),minimum:e})}function Ya(e,t){return new Ud({check:"length_equals",...D(t),length:e})}function xh(e,t){return new jd({check:"string_format",format:"regex",...D(t),pattern:e})}function Sh(e){return new Zd({check:"string_format",format:"lowercase",...D(e)})}function Th(e){return new qd({check:"string_format",format:"uppercase",...D(e)})}function Eh(e,t){return new Hd({check:"string_format",format:"includes",...D(t),includes:e})}function Ah(e,t){return new Fd({check:"string_format",format:"starts_with",...D(t),prefix:e})}function Ch(e,t){return new Bd({check:"string_format",format:"ends_with",...D(t),suffix:e})}function er(e){return new Gd({check:"overwrite",tx:e})}function Ph(e){return er(t=>t.normalize(e))}function Rh(){return er(e=>e.trim())}function Lh(){return er(e=>e.toLowerCase())}function zh(){return er(e=>e.toUpperCase())}function Ih(){return er(e=>ju(e))}function $h(e,t,n){return new e({type:"array",element:t,...D(n)})}function Nh(e,t,n){return new e({type:"custom",check:"custom",fn:t,...D(n)})}function Oh(e){const t=Dh(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Ir(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(Ir(o))}},e(n.value,n)));return t}function Dh(e,t){const n=new nt({check:"custom",...D(t)});return n._zod.check=e,n}function Ka(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)??Tr,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function Te(e,t,n={path:[],schemaPath:[]}){var h,k;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const 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=_),Te(_,t,m),t.seen.get(_).isParent=!0)}const d=t.metadataRegistry.get(e);return d&&Object.assign(a.schema,d),t.io==="input"&&Ge(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 Qa(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,ee=e.external.uri??(x=>x);if(N)return{ref:ee(N)};const R=h[1].defId??h[1].schema.id??`schema${e.counter++}`;return h[1].defId=R,{defId:R,ref:`${ee("__shared")}#/${k}/${R}`}}if(h[1]===n)return{ref:"#"};const _=`#/${k}/`,w=h[1].schema.id??`__schema${e.counter++}`;return{defId:w,ref:_+w}},i=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>
|
|
1223
1367
|
|
|
1224
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const k=h[1];if(t===h[0]){s(h);continue}if(e.external){const _=(d=e.external.registry.get(h[0]))==null?void 0:d.id;if(t!==h[0]&&_){s(h);continue}}if((p=e.metadataRegistry.get(h[0]))==null?void 0:p.id){s(h);continue}if(k.cycle){s(h);continue}if(k.count>1&&e.reused==="ref"){s(h);continue}}}function Oa(e,t){var c,u,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=p=>{const h=e.seen.get(p);if(h.ref===null)return;const k=h.def??h.schema,m={...k},_=h.ref;if(h.ref=null,_){r(_);const P=e.seen.get(_),N=P.schema;if(N.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=k.allOf??[],k.allOf.push(N)):Object.assign(k,N),Object.assign(k,m),p._zod.parent===_)for(const R in k)R==="$ref"||R==="allOf"||R in m||delete k[R];if(N.$ref)for(const R in k)R==="$ref"||R==="allOf"||R in P.def&&JSON.stringify(k[R])===JSON.stringify(P.def[R])&&delete k[R]}const w=p._zod.parent;if(w&&w!==_){r(w);const P=e.seen.get(w);if(P!=null&&P.schema.$ref&&(k.$ref=P.schema.$ref,P.def))for(const N in k)N==="$ref"||N==="allOf"||N in P.def&&JSON.stringify(k[N])===JSON.stringify(P.def[N])&&delete k[N]}e.override({zodSchema:p,jsonSchema:k,path:h.path??[]})};for(const p of[...e.seen.entries()].reverse())r(p[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(c=e.external)!=null&&c.uri){const p=(u=e.external.registry.get(t))==null?void 0:u.id;if(!p)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(p)}Object.assign(o,n.def??n.schema);const s=((d=e.external)==null?void 0:d.defs)??{};for(const p of e.seen.entries()){const h=p[1];h.def&&h.defId&&(s[h.defId]=h.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const p=JSON.parse(JSON.stringify(o));return Object.defineProperty(p,"~standard",{value:{...t["~standard"],jsonSchema:{input:mo(t,"input",e.processors),output:mo(t,"output",e.processors)}},enumerable:!1,writable:!1}),p}catch{throw new Error("Error converting schema to JSON.")}}function Fe(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 Fe(r.element,n);if(r.type==="set")return Fe(r.valueType,n);if(r.type==="lazy")return Fe(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 Fe(r.innerType,n);if(r.type==="intersection")return Fe(r.left,n)||Fe(r.right,n);if(r.type==="record"||r.type==="map")return Fe(r.keyType,n)||Fe(r.valueType,n);if(r.type==="pipe")return Fe(r.in,n)||Fe(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Fe(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Fe(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Fe(o,n))return!0;return!!(r.rest&&Fe(r.rest,n))}return!1}const mh=(e,t={})=>n=>{const r=$a({...n,processors:t});return xe(e,r),Na(r,e),Oa(r,e)},mo=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},c=$a({...o??{},target:s,io:t,processors:n});return xe(e,c),Na(c,e),Oa(c,e)},bh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},kh=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:c,format:u,patterns:d,contentEncoding:p}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof c=="number"&&(o.maxLength=c),u&&(o.format=bh[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}))])}},_h=(e,t,n,r)=>{const o=n,{minimum:s,maximum:c,format:u,multipleOf:d,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof u=="string"&&u.includes("int")?o.type="integer":o.type="number",typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=h,o.exclusiveMinimum=!0):o.exclusiveMinimum=h),typeof s=="number"&&(o.minimum=s,typeof h=="number"&&t.target!=="draft-04"&&(h>=s?delete o.minimum:delete o.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p),typeof c=="number"&&(o.maximum=c,typeof p=="number"&&t.target!=="draft-04"&&(p<=c?delete o.maximum:delete o.exclusiveMaximum)),typeof d=="number"&&(o.multipleOf=d)},vh=(e,t,n,r)=>{n.type="boolean"},yh=(e,t,n,r)=>{n.not={}},wh=(e,t,n,r)=>{},xh=(e,t,n,r)=>{},Sh=(e,t,n,r)=>{const o=e._zod.def,s=ha(o.entries);s.every(c=>typeof c=="number")&&(n.type="number"),s.every(c=>typeof c=="string")&&(n.type="string"),n.enum=s},Th=(e,t,n,r)=>{const o=e._zod.def,s=[];for(const c of o.values)if(c===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof c=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(c))}else s.push(c);if(s.length!==0)if(s.length===1){const c=s[0];n.type=c===null?"null":typeof c,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[c]:n.const=c}else s.every(c=>typeof c=="number")&&(n.type="number"),s.every(c=>typeof c=="string")&&(n.type="string"),s.every(c=>typeof c=="boolean")&&(n.type="boolean"),s.every(c=>c===null)&&(n.type="null"),n.enum=s},Eh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Ah=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Ch=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:c,maximum:u}=e._zod.bag;typeof c=="number"&&(o.minItems=c),typeof u=="number"&&(o.maxItems=u),o.type="array",o.items=xe(s.element,t,{...r,path:[...r.path,"items"]})},Ph=(e,t,n,r)=>{var p;const o=n,s=e._zod.def;o.type="object",o.properties={};const c=s.shape;for(const h in c)o.properties[h]=xe(c[h],t,{...r,path:[...r.path,"properties",h]});const u=new Set(Object.keys(c)),d=new Set([...u].filter(h=>{const k=s.shape[h]._zod;return t.io==="input"?k.optin===void 0:k.optout===void 0}));d.size>0&&(o.required=Array.from(d)),((p=s.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=xe(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Rh=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,c=o.options.map((u,d)=>xe(u,t,{...r,path:[...r.path,s?"oneOf":"anyOf",d]}));s?n.oneOf=c:n.anyOf=c},zh=(e,t,n,r)=>{const o=e._zod.def,s=xe(o.left,t,{...r,path:[...r.path,"allOf",0]}),c=xe(o.right,t,{...r,path:[...r.path,"allOf",1]}),u=p=>"allOf"in p&&Object.keys(p).length===1,d=[...u(s)?s.allOf:[s],...u(c)?c.allOf:[c]];n.allOf=d},Lh=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const c=s.keyType,u=c._zod.bag,d=u==null?void 0:u.patterns;if(s.mode==="loose"&&d&&d.size>0){const h=xe(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const k of d)o.patternProperties[k.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=xe(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=xe(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const p=c._zod.values;if(p){const h=[...p].filter(k=>typeof k=="string"||typeof k=="number");h.length>0&&(o.required=h)}},Ih=(e,t,n,r)=>{const o=e._zod.def,s=xe(o.innerType,t,r),c=t.seen.get(e);t.target==="openapi-3.0"?(c.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},$h=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Nh=(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))},Oh=(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)))},Dh=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let c;try{c=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=c},Mh=(e,t,n,r)=>{const o=e._zod.def,s=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;xe(s,t,r);const c=t.seen.get(e);c.ref=s},Uh=(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},Da=(e,t,n,r)=>{const o=e._zod.def;xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},jh=v("ZodISODateTime",(e,t)=>{Md.init(e,t),be.init(e,t)});function Zh(e){return Bp(jh,e)}const qh=v("ZodISODate",(e,t)=>{Ud.init(e,t),be.init(e,t)});function Fh(e){return Gp(qh,e)}const Hh=v("ZodISOTime",(e,t)=>{jd.init(e,t),be.init(e,t)});function Bh(e){return Wp(Hh,e)}const Gh=v("ZodISODuration",(e,t)=>{Zd.init(e,t),be.init(e,t)});function Wh(e){return Jp(Gh,e)}const Jh=(e,t)=>{ba.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>zu(e,n)},flatten:{value:n=>Ru(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ri,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ri,2)}},isEmpty:{get(){return e.issues.length===0}}})},at=v("ZodError",Jh,{Parent:Error}),Xh=_i(at),Vh=vi(at),Yh=Po(at),Kh=Ro(at),Qh=$u(at),ef=Nu(at),tf=Ou(at),nf=Du(at),rf=Mu(at),of=Uu(at),sf=ju(at),af=Zu(at),fe=v("ZodType",(e,t)=>(pe.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:mo(e,"input"),output:mo(e,"output")}}),e.toJSONSchema=mh(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)=>Xh(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Yh(e,n,r),e.parseAsync=async(n,r)=>Vh(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Kh(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Qh(e,n,r),e.decode=(n,r)=>ef(e,n,r),e.encodeAsync=async(n,r)=>tf(e,n,r),e.decodeAsync=async(n,r)=>nf(e,n,r),e.safeEncode=(n,r)=>rf(e,n,r),e.safeDecode=(n,r)=>of(e,n,r),e.safeEncodeAsync=async(n,r)=>sf(e,n,r),e.safeDecodeAsync=async(n,r)=>af(e,n,r),e.refine=(n,r)=>e.check(ng(n,r)),e.superRefine=n=>e.check(rg(n)),e.overwrite=n=>e.check(qn(n)),e.optional=()=>Ps(e),e.exactOptional=()=>Ff(e),e.nullable=()=>Rs(e),e.nullish=()=>Ps(Rs(e)),e.nonoptional=n=>Xf(e,n),e.array=()=>yt(e),e.or=n=>$f([e,n]),e.and=n=>Df(e,n),e.transform=n=>zs(e,Zf(n)),e.default=n=>Gf(e,n),e.prefault=n=>Jf(e,n),e.catch=n=>Yf(e,n),e.pipe=n=>zs(e,n),e.readonly=()=>eg(e),e.describe=n=>{const r=e.clone();return pr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=pr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return pr.get(e);const r=e.clone();return pr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Ma=v("_ZodString",(e,t)=>{yi.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>kh(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(th(...r)),e.includes=(...r)=>e.check(oh(...r)),e.startsWith=(...r)=>e.check(ih(...r)),e.endsWith=(...r)=>e.check(sh(...r)),e.min=(...r)=>e.check(go(...r)),e.max=(...r)=>e.check(La(...r)),e.length=(...r)=>e.check(Ia(...r)),e.nonempty=(...r)=>e.check(go(1,...r)),e.lowercase=r=>e.check(nh(r)),e.uppercase=r=>e.check(rh(r)),e.trim=()=>e.check(ch()),e.normalize=(...r)=>e.check(ah(...r)),e.toLowerCase=()=>e.check(lh()),e.toUpperCase=()=>e.check(uh()),e.slugify=()=>e.check(dh())}),cf=v("ZodString",(e,t)=>{yi.init(e,t),Ma.init(e,t),e.email=n=>e.check(Sp(lf,n)),e.url=n=>e.check(Pp(uf,n)),e.jwt=n=>e.check(Hp(Tf,n)),e.emoji=n=>e.check(Rp(df,n)),e.guid=n=>e.check(ws(Es,n)),e.uuid=n=>e.check(Tp(Xr,n)),e.uuidv4=n=>e.check(Ep(Xr,n)),e.uuidv6=n=>e.check(Ap(Xr,n)),e.uuidv7=n=>e.check(Cp(Xr,n)),e.nanoid=n=>e.check(zp(pf,n)),e.guid=n=>e.check(ws(Es,n)),e.cuid=n=>e.check(Lp(hf,n)),e.cuid2=n=>e.check(Ip(ff,n)),e.ulid=n=>e.check($p(gf,n)),e.base64=n=>e.check(Zp(wf,n)),e.base64url=n=>e.check(qp(xf,n)),e.xid=n=>e.check(Np(mf,n)),e.ksuid=n=>e.check(Op(bf,n)),e.ipv4=n=>e.check(Dp(kf,n)),e.ipv6=n=>e.check(Mp(_f,n)),e.cidrv4=n=>e.check(Up(vf,n)),e.cidrv6=n=>e.check(jp(yf,n)),e.e164=n=>e.check(Fp(Sf,n)),e.datetime=n=>e.check(Zh(n)),e.date=n=>e.check(Fh(n)),e.time=n=>e.check(Bh(n)),e.duration=n=>e.check(Wh(n))});function A(e){return xp(cf,e)}const be=v("ZodStringFormat",(e,t)=>{he.init(e,t),Ma.init(e,t)}),lf=v("ZodEmail",(e,t)=>{Pd.init(e,t),be.init(e,t)}),Es=v("ZodGUID",(e,t)=>{Ad.init(e,t),be.init(e,t)}),Xr=v("ZodUUID",(e,t)=>{Cd.init(e,t),be.init(e,t)}),uf=v("ZodURL",(e,t)=>{Rd.init(e,t),be.init(e,t)}),df=v("ZodEmoji",(e,t)=>{zd.init(e,t),be.init(e,t)}),pf=v("ZodNanoID",(e,t)=>{Ld.init(e,t),be.init(e,t)}),hf=v("ZodCUID",(e,t)=>{Id.init(e,t),be.init(e,t)}),ff=v("ZodCUID2",(e,t)=>{$d.init(e,t),be.init(e,t)}),gf=v("ZodULID",(e,t)=>{Nd.init(e,t),be.init(e,t)}),mf=v("ZodXID",(e,t)=>{Od.init(e,t),be.init(e,t)}),bf=v("ZodKSUID",(e,t)=>{Dd.init(e,t),be.init(e,t)}),kf=v("ZodIPv4",(e,t)=>{qd.init(e,t),be.init(e,t)}),_f=v("ZodIPv6",(e,t)=>{Fd.init(e,t),be.init(e,t)}),vf=v("ZodCIDRv4",(e,t)=>{Hd.init(e,t),be.init(e,t)}),yf=v("ZodCIDRv6",(e,t)=>{Bd.init(e,t),be.init(e,t)}),wf=v("ZodBase64",(e,t)=>{Gd.init(e,t),be.init(e,t)}),xf=v("ZodBase64URL",(e,t)=>{Jd.init(e,t),be.init(e,t)}),Sf=v("ZodE164",(e,t)=>{Xd.init(e,t),be.init(e,t)}),Tf=v("ZodJWT",(e,t)=>{Yd.init(e,t),be.init(e,t)}),Ua=v("ZodNumber",(e,t)=>{Aa.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>_h(e,r,o),e.gt=(r,o)=>e.check(Ss(r,o)),e.gte=(r,o)=>e.check(Go(r,o)),e.min=(r,o)=>e.check(Go(r,o)),e.lt=(r,o)=>e.check(xs(r,o)),e.lte=(r,o)=>e.check(Bo(r,o)),e.max=(r,o)=>e.check(Bo(r,o)),e.int=r=>e.check(As(r)),e.safe=r=>e.check(As(r)),e.positive=r=>e.check(Ss(0,r)),e.nonnegative=r=>e.check(Go(0,r)),e.negative=r=>e.check(xs(0,r)),e.nonpositive=r=>e.check(Bo(0,r)),e.multipleOf=(r,o)=>e.check(Ts(r,o)),e.step=(r,o)=>e.check(Ts(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 Xp(Ua,e)}const Ef=v("ZodNumberFormat",(e,t)=>{Kd.init(e,t),Ua.init(e,t)});function As(e){return Vp(Ef,e)}const Af=v("ZodBoolean",(e,t)=>{Qd.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vh(e,n,r)});function ue(e){return Yp(Af,e)}const Cf=v("ZodAny",(e,t)=>{ep.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wh()});function ja(){return Kp(Cf)}const Pf=v("ZodUnknown",(e,t)=>{tp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xh()});function Cs(){return Qp(Pf)}const Rf=v("ZodNever",(e,t)=>{np.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yh(e,n,r)});function zf(e){return eh(Rf,e)}const Lf=v("ZodArray",(e,t)=>{rp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ch(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(go(n,r)),e.nonempty=n=>e.check(go(1,n)),e.max=(n,r)=>e.check(La(n,r)),e.length=(n,r)=>e.check(Ia(n,r)),e.unwrap=()=>e.element});function yt(e,t){return ph(Lf,e,t)}const If=v("ZodObject",(e,t)=>{ip.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ph(e,n,r,o),K(e,"shape",()=>t.shape),e.keyof=()=>rt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Cs()}),e.loose=()=>e.clone({...e._zod.def,catchall:Cs()}),e.strict=()=>e.clone({...e._zod.def,catchall:zf()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Tu(e,n),e.safeExtend=n=>Eu(e,n),e.merge=n=>Au(e,n),e.pick=n=>xu(e,n),e.omit=n=>Su(e,n),e.partial=(...n)=>Cu(Fa,e,n[0]),e.required=(...n)=>Pu(Ha,e,n[0])});function le(e,t){const n={type:"object",shape:e??{},...D(t)};return new If(n)}const Za=v("ZodUnion",(e,t)=>{Ra.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rh(e,n,r,o),e.options=t.options});function $f(e,t){return new Za({type:"union",options:e,...D(t)})}const Nf=v("ZodDiscriminatedUnion",(e,t)=>{Za.init(e,t),sp.init(e,t)});function qa(e,t,n){return new Nf({type:"union",options:t,discriminator:e,...D(n)})}const Of=v("ZodIntersection",(e,t)=>{ap.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zh(e,n,r,o)});function Df(e,t){return new Of({type:"intersection",left:e,right:t})}const Mf=v("ZodRecord",(e,t)=>{cp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lh(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function wt(e,t,n){return new Mf({type:"record",keyType:e,valueType:t,...D(n)})}const ii=v("ZodEnum",(e,t)=>{lp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Sh(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const c of r)if(n.has(c))s[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new ii({...t,checks:[],...D(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const c of r)if(n.has(c))delete s[c];else throw new Error(`Key ${c} not found in enum`);return new ii({...t,checks:[],...D(o),entries:s})}});function rt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ii({type:"enum",entries:n,...D(t)})}const Uf=v("ZodLiteral",(e,t)=>{up.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Th(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function nt(e,t){return new Uf({type:"literal",values:Array.isArray(e)?e:[e],...D(t)})}const jf=v("ZodTransform",(e,t)=>{dp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ah(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new da(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Tr(s,n.value,t));else{const c=s;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=n.value),c.inst??(c.inst=e),n.issues.push(Tr(c))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function Zf(e){return new jf({type:"transform",transform:e})}const Fa=v("ZodOptional",(e,t)=>{za.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Da(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ps(e){return new Fa({type:"optional",innerType:e})}const qf=v("ZodExactOptional",(e,t)=>{pp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Da(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ff(e){return new qf({type:"optional",innerType:e})}const Hf=v("ZodNullable",(e,t)=>{hp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ih(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Rs(e){return new Hf({type:"nullable",innerType:e})}const Bf=v("ZodDefault",(e,t)=>{fp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Gf(e,t){return new Bf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ga(t)}})}const Wf=v("ZodPrefault",(e,t)=>{gp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Oh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Jf(e,t){return new Wf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ga(t)}})}const Ha=v("ZodNonOptional",(e,t)=>{mp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$h(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Xf(e,t){return new Ha({type:"nonoptional",innerType:e,...D(t)})}const Vf=v("ZodCatch",(e,t)=>{bp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Dh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Yf(e,t){return new Vf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Kf=v("ZodPipe",(e,t)=>{kp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mh(e,n,r,o),e.in=t.in,e.out=t.out});function zs(e,t){return new Kf({type:"pipe",in:e,out:t})}const Qf=v("ZodReadonly",(e,t)=>{_p.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function eg(e){return new Qf({type:"readonly",innerType:e})}const tg=v("ZodCustom",(e,t)=>{vp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eh(e,n)});function ng(e,t={}){return hh(tg,e,t)}function rg(e){return fh(e)}const og=le({name:A().min(1).max(100).optional(),command:A().min(1).max(500),args:yt(A()).optional(),failOnError:ue().default(!0).optional(),timeout:xt().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:A().optional(),env:wt(A(),A()).optional(),runOnBackground:ue().optional()});le({name:A(),command:A(),success:ue(),exitCode:xt().optional(),stdout:A().optional(),stderr:A().optional(),error:A().optional(),duration:xt(),failOnError:ue()});const rn=le({path:A(),extraCommands:yt(og).optional(),id:A().uuid().optional(),rotationKey:A().optional(),usageStatus:rt(["free","in_use"]).optional()}),ig=qa("operation",[rn.extend({operation:nt("create"),content:A().optional(),contentPath:A().optional(),encoding:rt(["utf-8","base64"]).optional()}),rn.extend({operation:nt("merge"),data:wt(A(),ja()),mergeStrategy:rt(["deep","shallow"]).optional(),arrayMergeStrategy:rt(["concat","replace"]).optional()}),rn.extend({operation:nt("modify"),content:A().optional(),contentPath:A().optional(),createIfMissing:ue().optional()}),rn.extend({operation:nt("delete"),ignoreIfMissing:ue().optional()}),rn.extend({operation:nt("createDirectory"),contentPath:A().optional(),mode:xt().optional(),ignoreIfExists:ue().optional()}),rn.extend({operation:nt("download"),url:A().url(),headers:wt(A(),A()).optional(),timeout:xt().min(1e3).max(3e5).optional()}),rn.extend({operation:nt("gitClone"),gitUrl:A(),gitSecretKey:A().optional(),sourceBranch:A().optional(),targetBranch:A().optional()})]);var ye=(e=>(e.PENDING="pending",e.ASSIGNED="assigned",e.IN_PROGRESS="in_progress",e.WAITING_FOR_INPUT="waiting_for_input",e.WAITING_FOR_PLAN_APPROVAL="waiting_for_plan_approval",e.PLAN_APPROVED="plan_approved",e.PLAN_REJECTED="plan_rejected",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.RESULT_REJECTED="result_rejected",e))(ye||{});const sg=le({type:rt(["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")}),ag=le({type:rt(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:ja().describe("Hook-specific configuration")});le({command:A().optional().describe("Legacy — unused in SDK mode"),args:yt(A()).optional().describe("Legacy — unused in SDK mode"),env:wt(A(),A()).optional().describe("Environment variables"),workingDirectory:A().optional().describe("Working directory for command execution"),fileOperations:yt(ig).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:sg.optional().describe("Schema for extracting result data"),postExecutionHooks:yt(ag).optional().describe("Hooks to run after task completion"),executionMode:rt(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:qa("executionMode",[le({executionMode:nt("claudeAgentSdk"),promptText:A(),sdkOptions:le({model:A(),permissionMode:rt(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:yt(A()),allowDangerouslySkipPermissions:ue(),persistSession:ue(),streamSdkEvents:ue().optional(),allowedTools:yt(A()).optional(),settings:le({enabledPlugins:wt(A(),ue())}),env:wt(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:ue()}).optional()}),le({executionMode:nt("opencodeSdk"),promptText:A(),sdkOptions:le({provider:A(),model:A(),env:wt(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:ue()}).optional()}),le({executionMode:nt("openaiAgentSdk"),promptText:A(),sdkOptions:le({model:A(),env:wt(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:ue()}).optional()}),le({executionMode:nt("codexSdk"),promptText:A(),sdkOptions:le({model:A().optional(),sandboxMode:rt(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:rt(["never","on-request","on-failure","untrusted"]).optional(),env:wt(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:ue()}).optional()}),le({executionMode:nt("cursorSdk"),promptText:A(),sdkOptions:le({model:A(),env:wt(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:ue()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:ue().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:A().optional().describe("Final approved plan content"),planApproved:ue().optional().describe("Plan approval status"),planApprovedAt:A().optional().describe("ISO timestamp of approval"),planRejected:ue().optional().describe("Plan rejection flag"),planRejectionFeedback:A().optional().describe("User rejection feedback"),rejectedPlanContent:A().optional().describe("Previously rejected plan content"),planCompletedAt:A().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:A().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:A().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:A().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:yt(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:ue().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:ue().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:yt(le({id:A(),selectedText:A(),startOffset:xt(),endOffset:xt(),commentText:A(),createdAt:A()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:ue().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:ue().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:rt(["all","agentPlatformOnly"]).optional().describe("MCP server strategy for this run; 'agentPlatformOnly' strips every other MCP server and keeps only the agent-platform server"),enableBrowserTools:ue().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 cg="browser_capture",lg="browser_automate";async function De(e,t,n,r){const s=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,c=await fetch(s,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});if(!c.ok){const u=await c.json().catch(()=>({message:`HTTP ${c.status}`}));throw new Error(u.message||u.error||`HTTP ${c.status}`)}return c.json()}async function Ba(e,t){return De(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)}async function si(e,t,n,r,o,s,c=cg){var u,d,p,h,k,m;return De(e,"POST","/tasks",{type:c,title:s||n.slice(0,120)||r.pageTitle||"Browser capture",projectId:t,autoAssign:!0,...o!=null&&o.claudeTemplateId?{claudeTemplateId:o.claudeTemplateId}:{},...(o==null?void 0:o.quickMode)!==void 0?{quickMode:o.quickMode}:{},...(o==null?void 0:o.modelOverride)!=null?{modelOverride:o.modelOverride}:{},...(o==null?void 0:o.claudeProfileId)!=null?{claudeProfileId:o.claudeProfileId}:{},...(o==null?void 0:o.effort)!=null?{effort:o.effort}:{},...(o==null?void 0:o.executionMode)!=null?{executionMode:o.executionMode}:{},...(u=o==null?void 0:o.selectedPluginIds)!=null&&u.length?{selectedPluginIds:o.selectedPluginIds}:{},...(d=o==null?void 0:o.selectedSkillIds)!=null&&d.length?{selectedSkillIds:o.selectedSkillIds}:{},...(p=o==null?void 0:o.selectedPluginSkillIds)!=null&&p.length?{selectedPluginSkillIds:o.selectedPluginSkillIds}:{},...(h=o==null?void 0:o.selectedMcpServerIds)!=null&&h.length?{selectedMcpServerIds:o.selectedMcpServerIds}:{},...(k=o==null?void 0:o.selectedSlashCommandIds)!=null&&k.length?{selectedSlashCommandIds:o.selectedSlashCommandIds}:{},...(m=o==null?void 0:o.selectedRemoteContextProviderIds)!=null&&m.length?{selectedRemoteContextProviderIds:o.selectedRemoteContextProviderIds}:{},metadata:{type:c,note:n,source:"web-sdk",pageUrl:r.pageUrl,pageTitle:r.pageTitle,elementText:r.elementText,cssSelector:r.cssSelector,elementOuterHtml:r.elementOuterHtml,ancestry:r.ancestry,elementRole:r.elementRole,elementAriaLabel:r.elementAriaLabel,enclosingSection:r.enclosingSection,description:r.description,canonicalUrl:r.canonicalUrl,lang:r.lang,ogTitle:r.ogTitle,ogDescription:r.ogDescription,ogType:r.ogType,ogSiteName:r.ogSiteName,viewportWidth:r.viewportWidth,viewportHeight:r.viewportHeight,scrollX:r.scrollX,scrollY:r.scrollY,selectionText:r.selectionText,capturedAt:r.capturedAt}})}async function Ls(e,t,n,r,o,s){return si(e,t,n,r,o,s,lg)}async function Is(e,t,n,r){return De(e,"POST","/planning-sessions",{projectId:t,instruction:n,quickMode:(r==null?void 0:r.quickMode)??!1,...r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}})}async function ug(e,t){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return De(e,"GET",`/claude-templates${n}`)}async function Ga(e,t){return De(e,"GET",`/tasks/${t}`)}async function dg(e,t){return De(e,"GET",`/planning-sessions/${t}`)}async function pg(e){return De(e,"GET","/projects")}async function hg(e,t){return De(e,"GET",`/tasks/${t}/browser-commands/pending`)}async function fg(e,t,n,r,o){return De(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})}async function gg(e,t){return De(e,"GET",`/tasks/${t}/chunks`)}async function mg(e,t,n){return De(e,"POST",`/tasks/${t}/instructions`,{content:n})}async function bg(e,t){return De(e,"POST",`/tasks/${t}/cancel`)}async function kg(e,t){return De(e,"POST",`/tasks/${t}/approve-result`)}async function _g(e,t,n){return De(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})}async function bo(e,t){return De(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)}async function Wa(e,t,n,r){return De(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})}const vg=/^cc-|current-password|new-password/i,yg=/token|secret|password|apikey|auth/i,Wo="[redacted]";function wg(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",Wo);const r=n.getAttribute("autocomplete");r&&vg.test(r)&&n.setAttribute("value",Wo);for(const o of Array.from(n.attributes))yg.test(o.name)&&n.setAttribute(o.name,Wo)}}function xg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ja={exports:{}};/*!
|
|
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]){i(h);continue}if(e.external){const _=(d=e.external.registry.get(h[0]))==null?void 0:d.id;if(t!==h[0]&&_){i(h);continue}}if((p=e.metadataRegistry.get(h[0]))==null?void 0:p.id){i(h);continue}if(k.cycle){i(h);continue}if(k.count>1&&e.reused==="ref"){i(h);continue}}}function ec(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 i=((d=e.external)==null?void 0:d.defs)??{};for(const p of e.seen.entries()){const h=p[1];h.def&&h.defId&&(i[h.defId]=h.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const p=JSON.parse(JSON.stringify(o));return Object.defineProperty(p,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ro(t,"input",e.processors),output:Ro(t,"output",e.processors)}},enumerable:!1,writable:!1}),p}catch{throw new Error("Error converting schema to JSON.")}}function Ge(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 Ge(r.element,n);if(r.type==="set")return Ge(r.valueType,n);if(r.type==="lazy")return Ge(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 Ge(r.innerType,n);if(r.type==="intersection")return Ge(r.left,n)||Ge(r.right,n);if(r.type==="record"||r.type==="map")return Ge(r.keyType,n)||Ge(r.valueType,n);if(r.type==="pipe")return Ge(r.in,n)||Ge(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Ge(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Ge(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Ge(o,n))return!0;return!!(r.rest&&Ge(r.rest,n))}return!1}const Mh=(e,t={})=>n=>{const r=Ka({...n,processors:t});return Te(e,r),Qa(r,e),ec(r,e)},Ro=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r??{},a=Ka({...o??{},target:i,io:t,processors:n});return Te(e,a),Qa(a,e),ec(a,e)},Uh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},jh=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:i,maximum:a,format:u,patterns:d,contentEncoding:p}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),u&&(o.format=Uh[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}))])}},Zh=(e,t,n,r)=>{const o=n,{minimum:i,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 i=="number"&&(o.minimum=i,typeof h=="number"&&t.target!=="draft-04"&&(h>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p),typeof a=="number"&&(o.maximum=a,typeof p=="number"&&t.target!=="draft-04"&&(p<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof d=="number"&&(o.multipleOf=d)},qh=(e,t,n,r)=>{n.type="boolean"},Hh=(e,t,n,r)=>{n.not={}},Fh=(e,t,n,r)=>{},Bh=(e,t,n,r)=>{},Gh=(e,t,n,r)=>{const o=e._zod.def,i=La(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},Wh=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i},Jh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Xh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Vh=(e,t,n,r)=>{const o=n,i=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=Te(i.element,t,{...r,path:[...r.path,"items"]})},Yh=(e,t,n,r)=>{var p;const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const h in a)o.properties[h]=Te(a[h],t,{...r,path:[...r.path,"properties",h]});const u=new Set(Object.keys(a)),d=new Set([...u].filter(h=>{const k=i.shape[h]._zod;return t.io==="input"?k.optin===void 0:k.optout===void 0}));d.size>0&&(o.required=Array.from(d)),((p=i.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Te(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Kh=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((u,d)=>Te(u,t,{...r,path:[...r.path,i?"oneOf":"anyOf",d]}));i?n.oneOf=a:n.anyOf=a},Qh=(e,t,n,r)=>{const o=e._zod.def,i=Te(o.left,t,{...r,path:[...r.path,"allOf",0]}),a=Te(o.right,t,{...r,path:[...r.path,"allOf",1]}),u=p=>"allOf"in p&&Object.keys(p).length===1,d=[...u(i)?i.allOf:[i],...u(a)?a.allOf:[a]];n.allOf=d},ef=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,u=a._zod.bag,d=u==null?void 0:u.patterns;if(i.mode==="loose"&&d&&d.size>0){const h=Te(i.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=Te(i.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Te(i.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)}},tf=(e,t,n,r)=>{const o=e._zod.def,i=Te(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},nf=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},rf=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},of=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},sf=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const i=t.seen.get(e);i.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},af=(e,t,n,r)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Te(i,t,r);const a=t.seen.get(e);a.ref=i},cf=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},tc=(e,t,n,r)=>{const o=e._zod.def;Te(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},lf=v("ZodISODateTime",(e,t)=>{ip.init(e,t),be.init(e,t)});function uf(e){return hh(lf,e)}const df=v("ZodISODate",(e,t)=>{ap.init(e,t),be.init(e,t)});function pf(e){return fh(df,e)}const hf=v("ZodISOTime",(e,t)=>{cp.init(e,t),be.init(e,t)});function ff(e){return gh(hf,e)}const gf=v("ZodISODuration",(e,t)=>{lp.init(e,t),be.init(e,t)});function mf(e){return mh(gf,e)}const bf=(e,t)=>{Na.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Qu(e,n)},flatten:{value:n=>Ku(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,bs,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,bs,2)}},isEmpty:{get(){return e.issues.length===0}}})},ut=v("ZodError",bf,{Parent:Error}),kf=Ns(ut),_f=Os(ut),vf=Fo(ut),yf=Bo(ut),wf=nd(ut),xf=rd(ut),Sf=od(ut),Tf=sd(ut),Ef=id(ut),Af=ad(ut),Cf=cd(ut),Pf=ld(ut),fe=v("ZodType",(e,t)=>(pe.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ro(e,"input"),output:Ro(e,"output")}}),e.toJSONSchema=Mh(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(tn(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)=>nn(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>kf(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>vf(e,n,r),e.parseAsync=async(n,r)=>_f(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>yf(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>wf(e,n,r),e.decode=(n,r)=>xf(e,n,r),e.encodeAsync=async(n,r)=>Sf(e,n,r),e.decodeAsync=async(n,r)=>Tf(e,n,r),e.safeEncode=(n,r)=>Ef(e,n,r),e.safeDecode=(n,r)=>Af(e,n,r),e.safeEncodeAsync=async(n,r)=>Cf(e,n,r),e.safeDecodeAsync=async(n,r)=>Pf(e,n,r),e.refine=(n,r)=>e.check(Sg(n,r)),e.superRefine=n=>e.check(Tg(n)),e.overwrite=n=>e.check(er(n)),e.optional=()=>Bi(e),e.exactOptional=()=>dg(e),e.nullable=()=>Gi(e),e.nullish=()=>Bi(Gi(e)),e.nonoptional=n=>bg(e,n),e.array=()=>Tt(e),e.or=n=>ng([e,n]),e.and=n=>sg(e,n),e.transform=n=>Wi(e,lg(n)),e.default=n=>fg(e,n),e.prefault=n=>mg(e,n),e.catch=n=>_g(e,n),e.pipe=n=>Wi(e,n),e.readonly=()=>wg(e),e.describe=n=>{const r=e.clone();return Tr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Tr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Tr.get(e);const r=e.clone();return Tr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),nc=v("_ZodString",(e,t)=>{Ds.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(r,o,i)=>jh(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(xh(...r)),e.includes=(...r)=>e.check(Eh(...r)),e.startsWith=(...r)=>e.check(Ah(...r)),e.endsWith=(...r)=>e.check(Ch(...r)),e.min=(...r)=>e.check(Po(...r)),e.max=(...r)=>e.check(Va(...r)),e.length=(...r)=>e.check(Ya(...r)),e.nonempty=(...r)=>e.check(Po(1,...r)),e.lowercase=r=>e.check(Sh(r)),e.uppercase=r=>e.check(Th(r)),e.trim=()=>e.check(Rh()),e.normalize=(...r)=>e.check(Ph(...r)),e.toLowerCase=()=>e.check(Lh()),e.toUpperCase=()=>e.check(zh()),e.slugify=()=>e.check(Ih())}),Rf=v("ZodString",(e,t)=>{Ds.init(e,t),nc.init(e,t),e.email=n=>e.check(Gp(Lf,n)),e.url=n=>e.check(Yp(zf,n)),e.jwt=n=>e.check(ph(Wf,n)),e.emoji=n=>e.check(Kp(If,n)),e.guid=n=>e.check(Mi(qi,n)),e.uuid=n=>e.check(Wp(oo,n)),e.uuidv4=n=>e.check(Jp(oo,n)),e.uuidv6=n=>e.check(Xp(oo,n)),e.uuidv7=n=>e.check(Vp(oo,n)),e.nanoid=n=>e.check(Qp($f,n)),e.guid=n=>e.check(Mi(qi,n)),e.cuid=n=>e.check(eh(Nf,n)),e.cuid2=n=>e.check(th(Of,n)),e.ulid=n=>e.check(nh(Df,n)),e.base64=n=>e.check(lh(Ff,n)),e.base64url=n=>e.check(uh(Bf,n)),e.xid=n=>e.check(rh(Mf,n)),e.ksuid=n=>e.check(oh(Uf,n)),e.ipv4=n=>e.check(sh(jf,n)),e.ipv6=n=>e.check(ih(Zf,n)),e.cidrv4=n=>e.check(ah(qf,n)),e.cidrv6=n=>e.check(ch(Hf,n)),e.e164=n=>e.check(dh(Gf,n)),e.datetime=n=>e.check(uf(n)),e.date=n=>e.check(pf(n)),e.time=n=>e.check(ff(n)),e.duration=n=>e.check(mf(n))});function A(e){return Bp(Rf,e)}const be=v("ZodStringFormat",(e,t)=>{he.init(e,t),nc.init(e,t)}),Lf=v("ZodEmail",(e,t)=>{Yd.init(e,t),be.init(e,t)}),qi=v("ZodGUID",(e,t)=>{Xd.init(e,t),be.init(e,t)}),oo=v("ZodUUID",(e,t)=>{Vd.init(e,t),be.init(e,t)}),zf=v("ZodURL",(e,t)=>{Kd.init(e,t),be.init(e,t)}),If=v("ZodEmoji",(e,t)=>{Qd.init(e,t),be.init(e,t)}),$f=v("ZodNanoID",(e,t)=>{ep.init(e,t),be.init(e,t)}),Nf=v("ZodCUID",(e,t)=>{tp.init(e,t),be.init(e,t)}),Of=v("ZodCUID2",(e,t)=>{np.init(e,t),be.init(e,t)}),Df=v("ZodULID",(e,t)=>{rp.init(e,t),be.init(e,t)}),Mf=v("ZodXID",(e,t)=>{op.init(e,t),be.init(e,t)}),Uf=v("ZodKSUID",(e,t)=>{sp.init(e,t),be.init(e,t)}),jf=v("ZodIPv4",(e,t)=>{up.init(e,t),be.init(e,t)}),Zf=v("ZodIPv6",(e,t)=>{dp.init(e,t),be.init(e,t)}),qf=v("ZodCIDRv4",(e,t)=>{pp.init(e,t),be.init(e,t)}),Hf=v("ZodCIDRv6",(e,t)=>{hp.init(e,t),be.init(e,t)}),Ff=v("ZodBase64",(e,t)=>{fp.init(e,t),be.init(e,t)}),Bf=v("ZodBase64URL",(e,t)=>{mp.init(e,t),be.init(e,t)}),Gf=v("ZodE164",(e,t)=>{bp.init(e,t),be.init(e,t)}),Wf=v("ZodJWT",(e,t)=>{_p.init(e,t),be.init(e,t)}),rc=v("ZodNumber",(e,t)=>{Ba.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Zh(e,r,o),e.gt=(r,o)=>e.check(ji(r,o)),e.gte=(r,o)=>e.check(is(r,o)),e.min=(r,o)=>e.check(is(r,o)),e.lt=(r,o)=>e.check(Ui(r,o)),e.lte=(r,o)=>e.check(ss(r,o)),e.max=(r,o)=>e.check(ss(r,o)),e.int=r=>e.check(Hi(r)),e.safe=r=>e.check(Hi(r)),e.positive=r=>e.check(ji(0,r)),e.nonnegative=r=>e.check(is(0,r)),e.negative=r=>e.check(Ui(0,r)),e.nonpositive=r=>e.check(ss(0,r)),e.multipleOf=(r,o)=>e.check(Zi(r,o)),e.step=(r,o)=>e.check(Zi(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 Pt(e){return bh(rc,e)}const Jf=v("ZodNumberFormat",(e,t)=>{vp.init(e,t),rc.init(e,t)});function Hi(e){return kh(Jf,e)}const Xf=v("ZodBoolean",(e,t)=>{yp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qh(e,n,r)});function ue(e){return _h(Xf,e)}const Vf=v("ZodAny",(e,t)=>{wp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fh()});function oc(){return vh(Vf)}const Yf=v("ZodUnknown",(e,t)=>{xp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bh()});function Fi(){return yh(Yf)}const Kf=v("ZodNever",(e,t)=>{Sp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hh(e,n,r)});function Qf(e){return wh(Kf,e)}const eg=v("ZodArray",(e,t)=>{Tp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vh(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(Po(n,r)),e.nonempty=n=>e.check(Po(1,n)),e.max=(n,r)=>e.check(Va(n,r)),e.length=(n,r)=>e.check(Ya(n,r)),e.unwrap=()=>e.element});function Tt(e,t){return $h(eg,e,t)}const tg=v("ZodObject",(e,t)=>{Ap.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yh(e,n,r,o),K(e,"shape",()=>t.shape),e.keyof=()=>at(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Fi()}),e.loose=()=>e.clone({...e._zod.def,catchall:Fi()}),e.strict=()=>e.clone({...e._zod.def,catchall:Qf()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Wu(e,n),e.safeExtend=n=>Ju(e,n),e.merge=n=>Xu(e,n),e.pick=n=>Bu(e,n),e.omit=n=>Gu(e,n),e.partial=(...n)=>Vu(ac,e,n[0]),e.required=(...n)=>Yu(cc,e,n[0])});function le(e,t){const n={type:"object",shape:e??{},...D(t)};return new tg(n)}const sc=v("ZodUnion",(e,t)=>{Ja.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Kh(e,n,r,o),e.options=t.options});function ng(e,t){return new sc({type:"union",options:e,...D(t)})}const rg=v("ZodDiscriminatedUnion",(e,t)=>{sc.init(e,t),Cp.init(e,t)});function ic(e,t,n){return new rg({type:"union",options:t,discriminator:e,...D(n)})}const og=v("ZodIntersection",(e,t)=>{Pp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qh(e,n,r,o)});function sg(e,t){return new og({type:"intersection",left:e,right:t})}const ig=v("ZodRecord",(e,t)=>{Rp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ef(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Et(e,t,n){return new ig({type:"record",keyType:e,valueType:t,...D(n)})}const _s=v("ZodEnum",(e,t)=>{Lp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Gh(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const a of r)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new _s({...t,checks:[],...D(o),entries:i})},e.exclude=(r,o)=>{const i={...t.entries};for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new _s({...t,checks:[],...D(o),entries:i})}});function at(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new _s({type:"enum",entries:n,...D(t)})}const ag=v("ZodLiteral",(e,t)=>{zp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wh(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function it(e,t){return new ag({type:"literal",values:Array.isArray(e)?e:[e],...D(t)})}const cg=v("ZodTransform",(e,t)=>{Ip.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xh(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Pa(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Ir(i,n.value,t));else{const a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),n.issues.push(Ir(a))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function lg(e){return new cg({type:"transform",transform:e})}const ac=v("ZodOptional",(e,t)=>{Xa.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Bi(e){return new ac({type:"optional",innerType:e})}const ug=v("ZodExactOptional",(e,t)=>{$p.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function dg(e){return new ug({type:"optional",innerType:e})}const pg=v("ZodNullable",(e,t)=>{Np.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Gi(e){return new pg({type:"nullable",innerType:e})}const hg=v("ZodDefault",(e,t)=>{Op.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fg(e,t){return new hg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ia(t)}})}const gg=v("ZodPrefault",(e,t)=>{Dp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>of(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function mg(e,t){return new gg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ia(t)}})}const cc=v("ZodNonOptional",(e,t)=>{Mp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>nf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function bg(e,t){return new cc({type:"nonoptional",innerType:e,...D(t)})}const kg=v("ZodCatch",(e,t)=>{Up.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _g(e,t){return new kg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const vg=v("ZodPipe",(e,t)=>{jp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>af(e,n,r,o),e.in=t.in,e.out=t.out});function Wi(e,t){return new vg({type:"pipe",in:e,out:t})}const yg=v("ZodReadonly",(e,t)=>{Zp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function wg(e){return new yg({type:"readonly",innerType:e})}const xg=v("ZodCustom",(e,t)=>{qp.init(e,t),fe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jh(e,n)});function Sg(e,t={}){return Nh(xg,e,t)}function Tg(e){return Oh(e)}const Eg=le({name:A().min(1).max(100).optional(),command:A().min(1).max(500),args:Tt(A()).optional(),failOnError:ue().default(!0).optional(),timeout:Pt().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:A().optional(),env:Et(A(),A()).optional(),runOnBackground:ue().optional()});le({name:A(),command:A(),success:ue(),exitCode:Pt().optional(),stdout:A().optional(),stderr:A().optional(),error:A().optional(),duration:Pt(),failOnError:ue()});const hn=le({path:A(),extraCommands:Tt(Eg).optional(),id:A().uuid().optional(),rotationKey:A().optional(),usageStatus:at(["free","in_use"]).optional()}),Ag=ic("operation",[hn.extend({operation:it("create"),content:A().optional(),contentPath:A().optional(),encoding:at(["utf-8","base64"]).optional()}),hn.extend({operation:it("merge"),data:Et(A(),oc()),mergeStrategy:at(["deep","shallow"]).optional(),arrayMergeStrategy:at(["concat","replace"]).optional()}),hn.extend({operation:it("modify"),content:A().optional(),contentPath:A().optional(),createIfMissing:ue().optional()}),hn.extend({operation:it("delete"),ignoreIfMissing:ue().optional()}),hn.extend({operation:it("createDirectory"),contentPath:A().optional(),mode:Pt().optional(),ignoreIfExists:ue().optional()}),hn.extend({operation:it("download"),url:A().url(),headers:Et(A(),A()).optional(),timeout:Pt().min(1e3).max(3e5).optional()}),hn.extend({operation:it("gitClone"),gitUrl:A(),gitSecretKey:A().optional(),sourceBranch:A().optional(),targetBranch:A().optional()})]);var we=(e=>(e.PENDING="pending",e.ASSIGNED="assigned",e.IN_PROGRESS="in_progress",e.WAITING_FOR_INPUT="waiting_for_input",e.WAITING_FOR_PLAN_APPROVAL="waiting_for_plan_approval",e.PLAN_APPROVED="plan_approved",e.PLAN_REJECTED="plan_rejected",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.RESULT_REJECTED="result_rejected",e))(we||{});const Cg=le({type:at(["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")}),Pg=le({type:at(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:oc().describe("Hook-specific configuration")});le({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(Ag).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:Cg.optional().describe("Schema for extracting result data"),postExecutionHooks:Tt(Pg).optional().describe("Hooks to run after task completion"),executionMode:at(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:ic("executionMode",[le({executionMode:it("claudeAgentSdk"),promptText:A(),sdkOptions:le({model:A(),permissionMode:at(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:Tt(A()),allowDangerouslySkipPermissions:ue(),persistSession:ue(),streamSdkEvents:ue().optional(),allowedTools:Tt(A()).optional(),settings:le({enabledPlugins:Et(A(),ue())}),env:Et(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:ue()}).optional()}),le({executionMode:it("opencodeSdk"),promptText:A(),sdkOptions:le({provider:A(),model:A(),env:Et(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:ue()}).optional()}),le({executionMode:it("openaiAgentSdk"),promptText:A(),sdkOptions:le({model:A(),env:Et(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:ue()}).optional()}),le({executionMode:it("codexSdk"),promptText:A(),sdkOptions:le({model:A().optional(),sandboxMode:at(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:at(["never","on-request","on-failure","untrusted"]).optional(),env:Et(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:ue()}).optional()}),le({executionMode:it("cursorSdk"),promptText:A(),sdkOptions:le({model:A(),env:Et(A(),A()).optional()}),resume:le({sessionId:A().optional(),continue:ue()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:ue().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:A().optional().describe("Final approved plan content"),planApproved:ue().optional().describe("Plan approval status"),planApprovedAt:A().optional().describe("ISO timestamp of approval"),planRejected:ue().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(le({feedback:A(),rejectedAt:A()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:Pt().optional(),notificationChannelPlanMessageSentAt:A().optional(),notificationChannelCompletedMessageId:Pt().optional(),notificationChannelFailedMessageId:Pt().optional(),streamSdkEvents:ue().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:ue().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:Tt(le({id:A(),selectedText:A(),startOffset:Pt(),endOffset:Pt(),commentText:A(),createdAt:A()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:ue().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:ue().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:at(["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:ue().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 lc="browser_capture",Rg="browser_automate";async function Me(e,t,n,r){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=await fetch(i,{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 uc(e,t){return Me(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)}async function vs(e,t,n,r,o,i,a=lc,u){var d,p,h,k,m,_;return Me(e,"POST","/tasks",{type:a,title:i||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 Ji(e,t,n,r,o,i,a){return vs(e,t,n,r,o,i,Rg,a)}async function Xi(e,t,n,r){return Me(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 Lg(e,t){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Me(e,"GET",`/claude-templates${n}`)}async function dc(e,t){return Me(e,"GET",`/tasks/${t}`)}async function zg(e,t){return Me(e,"GET",`/planning-sessions/${t}`)}async function Ig(e){return Me(e,"GET","/projects")}async function $g(e,t){return Me(e,"GET",`/tasks/${t}/browser-commands/pending`)}async function Ng(e,t,n,r,o){return Me(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})}async function Og(e,t){return Me(e,"GET",`/tasks/${t}/chunks`)}async function Dg(e,t,n){return Me(e,"POST",`/tasks/${t}/instructions`,{content:n})}async function Mg(e,t){return Me(e,"POST",`/tasks/${t}/cancel`)}async function Ug(e,t){return Me(e,"POST",`/tasks/${t}/approve-result`)}async function jg(e,t,n){return Me(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})}async function Lo(e,t){return Me(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)}async function pc(e,t,n,r){return Me(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})}const hc=/^cc-|current-password|new-password/i,Zg=/token|secret|password|apikey|auth/i,as="[redacted]";function qg(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&hc.test(t)}function Hg(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",as);const r=n.getAttribute("autocomplete");r&&hc.test(r)&&n.setAttribute("value",as);for(const o of Array.from(n.attributes))Zg.test(o.name)&&n.setAttribute(o.name,as)}}function Fg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var fc={exports:{}};/*!
|
|
1225
1369
|
* Pusher JavaScript Library v8.5.0
|
|
1226
1370
|
* https://pusher.com/
|
|
1227
1371
|
*
|
|
1228
1372
|
* Copyright 2020, Pusher
|
|
1229
1373
|
* Released under the MIT licence.
|
|
1230
|
-
*/(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(c,u){var d=this&&this.__extends||function(){var R=function(x,S){return R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,M){C.__proto__=M}||function(C,M){for(var se in M)M.hasOwnProperty(se)&&(C[se]=M[se])},R(x,S)};return function(x,S){R(x,S);function C(){this.constructor=x}x.prototype=S===null?Object.create(S):(C.prototype=S.prototype,new C)}}();Object.defineProperty(u,"__esModule",{value:!0});var p=256,h=function(){function R(x){x===void 0&&(x="="),this._paddingCharacter=x}return R.prototype.encodedLength=function(x){return this._paddingCharacter?(x+2)/3*4|0:(x*8+5)/6|0},R.prototype.encode=function(x){for(var S="",C=0;C<x.length-2;C+=3){var M=x[C]<<16|x[C+1]<<8|x[C+2];S+=this._encodeByte(M>>>3*6&63),S+=this._encodeByte(M>>>2*6&63),S+=this._encodeByte(M>>>1*6&63),S+=this._encodeByte(M>>>0*6&63)}var se=x.length-C;if(se>0){var M=x[C]<<16|(se===2?x[C+1]<<8:0);S+=this._encodeByte(M>>>3*6&63),S+=this._encodeByte(M>>>2*6&63),se===2?S+=this._encodeByte(M>>>1*6&63):S+=this._paddingCharacter||"",S+=this._paddingCharacter||""}return S},R.prototype.maxDecodedLength=function(x){return this._paddingCharacter?x/4*3|0:(x*6+7)/8|0},R.prototype.decodedLength=function(x){return this.maxDecodedLength(x.length-this._getPaddingLength(x))},R.prototype.decode=function(x){if(x.length===0)return new Uint8Array(0);for(var S=this._getPaddingLength(x),C=x.length-S,M=new Uint8Array(this.maxDecodedLength(C)),se=0,ke=0,Pe=0,We=0,V=0,ge=0,Je=0;ke<C-4;ke+=4)We=this._decodeChar(x.charCodeAt(ke+0)),V=this._decodeChar(x.charCodeAt(ke+1)),ge=this._decodeChar(x.charCodeAt(ke+2)),Je=this._decodeChar(x.charCodeAt(ke+3)),M[se++]=We<<2|V>>>4,M[se++]=V<<4|ge>>>2,M[se++]=ge<<6|Je,Pe|=We&p,Pe|=V&p,Pe|=ge&p,Pe|=Je&p;if(ke<C-1&&(We=this._decodeChar(x.charCodeAt(ke)),V=this._decodeChar(x.charCodeAt(ke+1)),M[se++]=We<<2|V>>>4,Pe|=We&p,Pe|=V&p),ke<C-2&&(ge=this._decodeChar(x.charCodeAt(ke+2)),M[se++]=V<<4|ge>>>2,Pe|=ge&p),ke<C-3&&(Je=this._decodeChar(x.charCodeAt(ke+3)),M[se++]=ge<<6|Je,Pe|=Je&p),Pe!==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 te(R){return P.decode(R)}u.decodeURLSafe=te,u.encodedLength=function(R){return k.encodedLength(R)},u.maxDecodedLength=function(R){return k.maxDecodedLength(R)},u.decodedLength=function(R){return k.decodedLength(R)}},978(c,u){var d="utf8: invalid source encoding";function p(h){for(var k=[],m=0;m<h.length;m++){var _=h[m];if(_&128){var w=void 0;if(_<224){if(m>=h.length)throw new Error(d);var P=h[++m];if((P&192)!==128)throw new Error(d);_=(_&31)<<6|P&63,w=128}else if(_<240){if(m>=h.length-1)throw new Error(d);var P=h[++m],N=h[++m];if((P&192)!==128||(N&192)!==128)throw new Error(d);_=(_&15)<<12|(P&63)<<6|N&63,w=2048}else if(_<248){if(m>=h.length-2)throw new Error(d);var P=h[++m],N=h[++m],te=h[++m];if((P&192)!==128||(N&192)!==128||(te&192)!==128)throw new Error(d);_=(_&15)<<18|(P&63)<<12|(N&63)<<6|te&63,w=65536}else throw new Error(d);if(_<w||_>=55296&&_<=57343)throw new Error(d);if(_>=65536){if(_>1114111)throw new Error(d);_-=65536,k.push(String.fromCharCode(55296|_>>10)),_=56320|_&1023}}k.push(String.fromCharCode(_))}return k.join("")}u.D4=p},721(c,u,d){c.exports=d(207).default},207(c,u,d){d.d(u,{default:()=>Hr});class p{constructor(i,a){this.lastId=0,this.prefix=i,this.name=a}create(i){this.lastId++;var a=this.lastId,f=this.prefix+a,g=this.name+"["+a+"]",y=!1,E=function(){y||(i.apply(null,arguments),y=!0)};return this[a]=E,{number:a,id:f,name:g,callback:E}}remove(i){delete this[i.number]}}var h=new p("_pusher_script_","Pusher.ScriptReceivers"),k={VERSION:"8.5.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""};const m=k;class _{constructor(i){this.options=i,this.receivers=i.receivers||h,this.loading={}}load(i,a,f){var g=this;if(g.loading[i]&&g.loading[i].length>0)g.loading[i].push(f);else{g.loading[i]=[f];var y=q.createScriptRequest(g.getPath(i,a)),E=g.receivers.create(function($){if(g.receivers.remove(E),g.loading[i]){var Z=g.loading[i];delete g.loading[i];for(var X=function(we){we||y.cleanup()},ee=0;ee<Z.length;ee++)Z[ee]($,X)}});y.send(E)}}getRoot(i){var a,f=q.getDocument().location.protocol;return i&&i.useTLS||f==="https:"?a=this.options.cdn_https:a=this.options.cdn_http,a.replace(/\/*$/,"")+"/"+this.options.version}getPath(i,a){return this.getRoot(a)+"/"+i+this.options.suffix+".js"}}var w=new p("_pusher_dependencies","Pusher.DependenciesReceivers"),P=new _({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:w});const N={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}},R={buildLogSuffix:function(l){const i="See:",a=N.urls[l];if(!a)return"";let f;return a.fullUrl?f=a.fullUrl:a.path&&(f=N.baseUrl+a.path),f?`${i} ${f}`:""}};var x;(function(l){l.UserAuthentication="user-authentication",l.ChannelAuthorization="channel-authorization"})(x||(x={}));class S extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class C extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class se extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class ke extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class Pe extends Error{constructor(i){super(i),Object.setPrototypeOf(this,new.target.prototype)}}class We 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 ge extends Error{constructor(i,a){super(a),this.status=i,Object.setPrototypeOf(this,new.target.prototype)}}const Nt=function(l,i,a,f,g){const y=q.createXHR();y.open("POST",a.endpoint,!0),y.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var E in a.headers)y.setRequestHeader(E,a.headers[E]);if(a.headersProvider!=null){let $=a.headersProvider();for(var E in $)y.setRequestHeader(E,$[E])}return y.onreadystatechange=function(){if(y.readyState===4)if(y.status===200){let $,Z=!1;try{$=JSON.parse(y.responseText),Z=!0}catch{g(new ge(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${y.responseText}`),null)}Z&&g(null,$)}else{let $="";switch(f){case x.UserAuthentication:$=R.buildLogSuffix("authenticationEndpoint");break;case x.ChannelAuthorization:$=`Clients must be authorized to join private or presence channels. ${R.buildLogSuffix("authorizationEndpoint")}`;break}g(new ge(y.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${y.status} from ${a.endpoint}. ${$}`),null)}},y.send(i),y};function j(l){return me(bt(l))}var Q=String.fromCharCode,Re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ie=function(l){var i=l.charCodeAt(0);return i<128?l:i<2048?Q(192|i>>>6)+Q(128|i&63):Q(224|i>>>12&15)+Q(128|i>>>6&63)+Q(128|i&63)},bt=function(l){return l.replace(/[^\x00-\x7F]/g,Ie)},ct=function(l){var i=[0,2,1][l.length%3],a=l.charCodeAt(0)<<16|(l.length>1?l.charCodeAt(1):0)<<8|(l.length>2?l.charCodeAt(2):0),f=[Re.charAt(a>>>18),Re.charAt(a>>>12&63),i>=2?"=":Re.charAt(a>>>6&63),i>=1?"=":Re.charAt(a&63)];return f.join("")},me=window.btoa||function(l){return l.replace(/[\s\S]{1,3}/g,ct)};class Se{constructor(i,a,f,g){this.clear=a,this.timer=i(()=>{this.timer&&(this.timer=g(this.timer))},f)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const W=Se;function Me(l){window.clearTimeout(l)}function J(l){window.clearInterval(l)}class Ue extends W{constructor(i,a){super(setTimeout,Me,i,function(f){return a(),null})}}class Xe extends W{constructor(i,a){super(setInterval,J,i,function(f){return a(),f})}}var je={now(){return Date.now?Date.now():new Date().valueOf()},defer(l){return new Ue(0,l)},method(l,...i){var a=Array.prototype.slice.call(arguments,1);return function(f){return f[l].apply(f,a.concat(arguments))}}};const _e=je;function Ee(l,...i){for(var a=0;a<i.length;a++){var f=i[a];for(var g in f)f[g]&&f[g].constructor&&f[g].constructor===Object?l[g]=Ee(l[g]||{},f[g]):l[g]=f[g]}return l}function Pr(){for(var l=["Pusher"],i=0;i<arguments.length;i++)typeof arguments[i]=="string"?l.push(arguments[i]):l.push(Ze(arguments[i]));return l.join(" : ")}function Bn(l,i){var a=Array.prototype.indexOf;if(l===null)return-1;if(a&&l.indexOf===a)return l.indexOf(i);for(var f=0,g=l.length;f<g;f++)if(l[f]===i)return f;return-1}function $e(l,i){for(var a in l)Object.prototype.hasOwnProperty.call(l,a)&&i(l[a],a,l)}function Xt(l){var i=[];return $e(l,function(a,f){i.push(f)}),i}function Tt(l){var i=[];return $e(l,function(a){i.push(a)}),i}function Et(l,i,a){for(var f=0;f<l.length;f++)i.call(a||window,l[f],f,l)}function bn(l,i){for(var a=[],f=0;f<l.length;f++)a.push(i(l[f],f,l,a));return a}function Ot(l,i){var a={};return $e(l,function(f,g){a[g]=i(f)}),a}function Vt(l,i){i=i||function(g){return!!g};for(var a=[],f=0;f<l.length;f++)i(l[f],f,l,a)&&a.push(l[f]);return a}function Yt(l,i){var a={};return $e(l,function(f,g){(i&&i(f,g,l,a)||f)&&(a[g]=f)}),a}function Rr(l){var i=[];return $e(l,function(a,f){i.push([f,a])}),i}function Gn(l,i){for(var a=0;a<l.length;a++)if(i(l[a],a,l))return!0;return!1}function $o(l,i){for(var a=0;a<l.length;a++)if(!i(l[a],a,l))return!1;return!0}function Wn(l){return Ot(l,function(i){return typeof i=="object"&&(i=Ze(i)),encodeURIComponent(j(i.toString()))})}function Kt(l){var i=Yt(l,function(f){return f!==void 0}),a=bn(Rr(Wn(i)),_e.method("join","=")).join("&");return a}function Dt(l){var i=[],a=[];return function f(g,y){var E,$,Z;switch(typeof g){case"object":if(!g)return null;for(E=0;E<i.length;E+=1)if(i[E]===g)return{$ref:a[E]};if(i.push(g),a.push(y),Object.prototype.toString.apply(g)==="[object Array]")for(Z=[],E=0;E<g.length;E+=1)Z[E]=f(g[E],y+"["+E+"]");else{Z={};for($ in g)Object.prototype.hasOwnProperty.call(g,$)&&(Z[$]=f(g[$],y+"["+JSON.stringify($)+"]"))}return Z;case"number":case"string":case"boolean":return g}}(l,"$")}function Ze(l){try{return JSON.stringify(l)}catch{return JSON.stringify(Dt(l))}}class Jn{constructor(){this.globalLog=i=>{window.console&&window.console.log&&window.console.log(i)}}debug(...i){this.log(this.globalLog,i)}warn(...i){this.log(this.globalLogWarn,i)}error(...i){this.log(this.globalLogError,i)}globalLogWarn(i){window.console&&window.console.warn?window.console.warn(i):this.globalLog(i)}globalLogError(i){window.console&&window.console.error?window.console.error(i):this.globalLogWarn(i)}log(i,...a){var f=Pr.apply(this,arguments);Hr.log?Hr.log(f):Hr.logToConsole&&i.bind(this)(f)}}const ae=new Jn;var zr=function(l,i,a,f,g){(a.headers!==void 0||a.headersProvider!=null)&&ae.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var y=l.nextAuthCallbackID.toString();l.nextAuthCallbackID++;var E=l.getDocument(),$=E.createElement("script");l.auth_callbacks[y]=function(ee){g(null,ee)};var Z="Pusher.auth_callbacks['"+y+"']";$.src=a.endpoint+"?callback="+encodeURIComponent(Z)+"&"+i;var X=E.getElementsByTagName("head")[0]||E.documentElement;X.insertBefore($,X.firstChild)};const Xn=zr;class Lr{constructor(i){this.src=i}send(i){var a=this,f="Error loading "+a.src;a.script=document.createElement("script"),a.script.id=i.id,a.script.src=a.src,a.script.type="text/javascript",a.script.charset="UTF-8",a.script.addEventListener?(a.script.onerror=function(){i.callback(f)},a.script.onload=function(){i.callback(null)}):a.script.onreadystatechange=function(){(a.script.readyState==="loaded"||a.script.readyState==="complete")&&i.callback(null)},a.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(a.errorScript=document.createElement("script"),a.errorScript.id=i.id+"_error",a.errorScript.text=i.name+"('"+f+"');",a.script.async=a.errorScript.async=!1):a.script.async=!0;var g=document.getElementsByTagName("head")[0];g.insertBefore(a.script,g.firstChild),a.errorScript&&g.insertBefore(a.errorScript,a.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class kn{constructor(i,a){this.url=i,this.data=a}send(i){if(!this.request){var a=Kt(this.data),f=this.url+"/"+i.number+"?"+a;this.request=q.createScriptRequest(f),this.request.send(i)}}cleanup(){this.request&&this.request.cleanup()}}var _n=function(l,i){return function(a,f){var g="http"+(i?"s":"")+"://",y=g+(l.host||l.options.host)+l.options.path,E=q.createJSONPRequest(y,a),$=q.ScriptReceivers.create(function(Z,X){h.remove($),E.cleanup(),X&&X.host&&(l.host=X.host),f&&f(Z,X)});E.send($)}},lt={name:"jsonp",getAgent:_n};const Mt=lt;function Qt(l,i,a){var f=l+(i.useTLS?"s":""),g=i.useTLS?i.hostTLS:i.hostNonTLS;return f+"://"+g+a}function en(l,i){var a="/app/"+l,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(i?"&"+i:"");return a+f}var No={getInitial:function(l,i){var a=(i.httpPath||"")+en(l,"flash=false");return Qt("ws",i,a)}},vn={getInitial:function(l,i){var a=(i.httpPath||"/pusher")+en(l);return Qt("http",i,a)}},yn={getInitial:function(l,i){return Qt("http",i,i.httpPath||"/pusher")},getPath:function(l,i){return en(l)}};class Oo{constructor(){this._callbacks={}}get(i){return this._callbacks[At(i)]}add(i,a,f){var g=At(i);this._callbacks[g]=this._callbacks[g]||[],this._callbacks[g].push({fn:a,context:f})}remove(i,a,f){if(!i&&!a&&!f){this._callbacks={};return}var g=i?[At(i)]:Xt(this._callbacks);a||f?this.removeCallback(g,a,f):this.removeAllCallbacks(g)}removeCallback(i,a,f){Et(i,function(g){this._callbacks[g]=Vt(this._callbacks[g]||[],function(y){return a&&a!==y.fn||f&&f!==y.context}),this._callbacks[g].length===0&&delete this._callbacks[g]},this)}removeAllCallbacks(i){Et(i,function(a){delete this._callbacks[a]},this)}}function At(l){return"_"+l}class ut{constructor(i){this.callbacks=new Oo,this.global_callbacks=[],this.failThrough=i}bind(i,a,f){return this.callbacks.add(i,a,f),this}bind_global(i){return this.global_callbacks.push(i),this}unbind(i,a,f){return this.callbacks.remove(i,a,f),this}unbind_global(i){return i?(this.global_callbacks=Vt(this.global_callbacks||[],a=>a!==i),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(i,a,f){for(var g=0;g<this.global_callbacks.length;g++)this.global_callbacks[g](i,a);var y=this.callbacks.get(i),E=[];if(f?E.push(a,f):a&&E.push(a),y&&y.length>0)for(var g=0;g<y.length;g++)y[g].fn.apply(y[g].context||window,E);else this.failThrough&&this.failThrough(i,a);return this}}class Do extends ut{constructor(i,a,f,g,y){super(),this.initialize=q.transportConnectionInitializer,this.hooks=i,this.name=a,this.priority=f,this.key=g,this.options=y,this.state="new",this.timeline=y.timeline,this.activityTimeout=y.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var i=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(i,this.options)}catch(a){return _e.defer(()=>{this.onError(a),this.changeState("closed")}),!1}return this.bindListeners(),ae.debug("Connecting",{transport:this.name,url:i}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(i){return this.state==="open"?(_e.defer(()=>{this.socket&&this.socket.send(i)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(i){this.emit("error",{type:"WebSocketError",error:i}),this.timeline.error(this.buildTimelineMessage({error:i.toString()}))}onClose(i){i?this.changeState("closed",{code:i.code,reason:i.reason,wasClean:i.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(i){this.emit("message",i)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=i=>{this.onError(i)},this.socket.onclose=i=>{this.onClose(i)},this.socket.onmessage=i=>{this.onMessage(i)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(i,a){this.state=i,this.timeline.info(this.buildTimelineMessage({state:i,params:a})),this.emit(i,a)}buildTimelineMessage(i){return Ee({cid:this.id},i)}}class ce{constructor(i){this.hooks=i}isSupported(i){return this.hooks.isSupported(i)}createConnection(i,a,f,g){return new Do(this.hooks,i,a,f,g)}}var Ut=new ce({urls:No,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!q.getWebSocketAPI()},isSupported:function(){return!!q.getWebSocketAPI()},getSocket:function(l){return q.createWebSocket(l)}}),Ir={urls:vn,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Vn=Ee({getSocket:function(l){return q.HTTPFactory.createStreamingSocket(l)}},Ir),wn=Ee({getSocket:function(l){return q.HTTPFactory.createPollingSocket(l)}},Ir),Yn={isSupported:function(){return q.isXHRSupported()}},$r=new ce(Ee({},Vn,Yn)),Mo=new ce(Ee({},wn,Yn)),Qe={ws:Ut,xhr_streaming:$r,xhr_polling:Mo};const et=Qe;var Nr=new ce({file:"sockjs",urls:yn,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}))}}),Kn={isSupported:function(l){var i=q.isXDRSupported(l.useTLS);return i}},Qn=new ce(Ee({},Vn,Kn)),Or=new ce(Ee({},wn,Kn));et.xdr_streaming=Qn,et.xdr_polling=Or,et.sockjs=Nr;const dt=et;class Dr extends ut{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 Mr=new Dr;class Ur{constructor(i,a,f){this.manager=i,this.transport=a,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(i,a,f,g){g=Ee({},g,{activityTimeout:this.pingDelay});var y=this.transport.createConnection(i,a,f,g),E=null,$=function(){y.unbind("open",$),y.bind("closed",Z),E=_e.now()},Z=X=>{if(y.unbind("closed",Z),X.code===1002||X.code===1003)this.manager.reportDeath();else if(!X.wasClean&&E){var ee=_e.now()-E;ee<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(ee/2,this.minPingDelay))}};return y.bind("open",$),y}isSupported(i){return this.manager.isAlive()&&this.transport.isSupported(i)}}const er={decodeMessage:function(l){try{var i=JSON.parse(l.data),a=i.data;if(typeof a=="string")try{a=JSON.parse(i.data)}catch{}var f={event:i.event,channel:i.channel,data:a};return i.user_id&&(f.user_id=i.user_id),f}catch(g){throw{type:"MessageParseError",error:g,data:l.data}}},encodeMessage:function(l){return JSON.stringify(l)},processHandshake:function(l){var i=er.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}},Ct=er;class O extends ut{constructor(i,a){super(),this.id=i,this.transport=a,this.activityTimeout=a.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(i){return this.transport.send(i)}send_event(i,a,f){var g={event:i,data:a};return f&&(g.channel=f),ae.debug("Event sent",g),this.send(Ct.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=Ct.decodeMessage(f)}catch(y){this.emit("error",{type:"MessageParseError",error:y,data:f.data})}if(g!==void 0){switch(ae.debug("Event recd",g),g.event){case"pusher:error":this.emit("error",{type:"PusherError",data:g.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",g)}},activity:()=>{this.emit("activity")},error:f=>{this.emit("error",f)},closed:f=>{a(),f&&f.code&&this.handleCloseEvent(f),this.transport=null,this.emit("closed")}},a=()=>{$e(i,(f,g)=>{this.transport.unbind(g,f)})};$e(i,(f,g)=>{this.transport.bind(g,f)})}handleCloseEvent(i){var a=Ct.getCloseAction(i),f=Ct.getCloseError(i);f&&this.emit("error",f),a&&this.emit(a,{action:a,error:f})}}class b{constructor(i,a){this.transport=i,this.callback=a,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=i=>{this.unbindListeners();var a;try{a=Ct.processHandshake(i)}catch(f){this.finish("error",{error:f}),this.transport.close();return}a.action==="connected"?this.finish("connected",{connection:new O(a.id,this.transport),activityTimeout:a.activityTimeout}):(this.finish(a.action,{error:a.error}),this.transport.close())},this.onClosed=i=>{this.unbindListeners();var a=Ct.getCloseAction(i)||"backoff",f=Ct.getCloseError(i);this.finish(a,{error:f})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(i,a){this.callback(Ee({transport:this.transport,action:i},a))}}class T{constructor(i,a){this.timeline=i,this.options=a||{}}send(i,a){this.timeline.isEmpty()||this.timeline.send(q.TimelineTransport.getAgent(this,i),a)}}class z extends ut{constructor(i,a){super(function(f,g){ae.debug("No callbacks on "+i+" for "+f)}),this.name=i,this.pusher=a,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(i,a){return a(null,{auth:""})}trigger(i,a){if(i.indexOf("client-")!==0)throw new S("Event '"+i+"' does not start with 'client-'");if(!this.subscribed){var f=R.buildLogSuffix("triggeringClientEvents");ae.warn(`Client event triggered before channel 'subscription_succeeded' event . ${f}`)}return this.pusher.send_event(i,a,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(i){var a=i.event,f=i.data;if(a==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(i);else if(a==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(i);else if(a.indexOf("pusher_internal:")!==0){var g={};this.emit(a,f,g)}}handleSubscriptionSucceededEvent(i){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",i.data)}handleSubscriptionCountEvent(i){i.data.subscription_count&&(this.subscriptionCount=i.data.subscription_count),this.emit("pusher:subscription_count",i.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(i,a)=>{i?(this.subscriptionPending=!1,ae.error(i.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:i.message},i instanceof ge?{status:i.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:a.auth,channel_data:a.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class ne extends z{authorize(i,a){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:i},a)}}class Ae{constructor(){this.reset()}get(i){return Object.prototype.hasOwnProperty.call(this.members,i)?{id:i,info:this.members[i]}:null}each(i){$e(this.members,(a,f)=>{i(this.get(f))})}setMyID(i){this.myID=i}onSubscription(i){this.members=i.presence.hash,this.count=i.presence.count,this.me=this.get(this.myID)}addMember(i){return this.get(i.user_id)===null&&this.count++,this.members[i.user_id]=i.user_info,this.get(i.user_id)}removeMember(i){var a=this.get(i.user_id);return a&&(delete this.members[i.user_id],this.count--),a}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var ve=function(l,i,a,f){function g(y){return y instanceof a?y:new a(function(E){E(y)})}return new(a||(a=Promise))(function(y,E){function $(ee){try{X(f.next(ee))}catch(we){E(we)}}function Z(ee){try{X(f.throw(ee))}catch(we){E(we)}}function X(ee){ee.done?y(ee.value):g(ee.value).then($,Z)}X((f=f.apply(l,i||[])).next())})};class Ne extends ne{constructor(i,a){super(i,a),this.members=new Ae}authorize(i,a){super.authorize(i,(f,g)=>ve(this,void 0,void 0,function*(){if(!f)if(g=g,g.channel_data!=null){var y=JSON.parse(g.channel_data);this.members.setMyID(y.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let E=R.buildLogSuffix("authorizationEndpoint");ae.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${E}, or the user should be signed in.`),a("Invalid auth response");return}a(f,g)}))}handleEvent(i){var a=i.event;if(a.indexOf("pusher_internal:")===0)this.handleInternalEvent(i);else{var f=i.data,g={};i.user_id&&(g.user_id=i.user_id),this.emit(a,f,g)}}handleInternalEvent(i){var a=i.event,f=i.data;switch(a){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(i);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(i);break;case"pusher_internal:member_added":var g=this.members.addMember(f);this.emit("pusher:member_added",g);break;case"pusher_internal:member_removed":var y=this.members.removeMember(f);y&&this.emit("pusher:member_removed",y);break}}handleSubscriptionSucceededEvent(i){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(i.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var pt=d(978),kt=d(594);class tr extends ne{constructor(i,a,f){super(i,a),this.key=null,this.nacl=f}authorize(i,a){super.authorize(i,(f,g)=>{if(f){a(f,g);return}let y=g.shared_secret;if(!y){a(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,kt.decode)(y),delete g.shared_secret,a(null,g)})}trigger(i,a){throw new Pe("Client events are not currently supported for encrypted channels")}handleEvent(i){var a=i.event,f=i.data;if(a.indexOf("pusher_internal:")===0||a.indexOf("pusher:")===0){super.handleEvent(i);return}this.handleEncryptedEvent(a,f)}handleEncryptedEvent(i,a){if(!this.key){ae.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!a.ciphertext||!a.nonce){ae.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+a);return}let f=(0,kt.decode)(a.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){ae.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let g=(0,kt.decode)(a.nonce);if(g.length<this.nacl.secretbox.nonceLength){ae.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${g.length}`);return}let y=this.nacl.secretbox.open(f,g,this.key);if(y===null){ae.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(E,$)=>{if(E){ae.error(`Failed to make a request to the authEndpoint: ${$}. Unable to fetch new key, so dropping encrypted event`);return}if(y=this.nacl.secretbox.open(f,g,this.key),y===null){ae.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(i,this.getDataToEmit(y))});return}this.emit(i,this.getDataToEmit(y))}getDataToEmit(i){let a=(0,pt.D4)(i);try{return JSON.parse(a)}catch{return a}}}class Te extends ut{constructor(i,a){super(),this.state="initialized",this.connection=null,this.key=i,this.options=a,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var f=q.getNetwork();f.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),f.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(i){this.key=i,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(i){return this.connection?this.connection.send(i):!1}send_event(i,a,f){return this.connection?this.connection.send_event(i,a,f):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var i=(a,f)=>{a?this.runner=this.strategy.connect(0,i):f.action==="error"?(this.emit("error",{type:"HandshakeError",error:f.error}),this.timeline.error({handshakeError:f.error})):(this.abortConnecting(),this.handshakeCallbacks[f.action](f))};this.runner=this.strategy.connect(0,i)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var i=this.abandonConnection();i.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(i){this.timeline.info({action:"retry",delay:i}),i>0&&this.emit("connecting_in",Math.round(i/1e3)),this.retryTimer=new Ue(i||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new Ue(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new Ue(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 Ue(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(i){return Ee({},i,{message:a=>{this.resetActivityCheck(),this.emit("message",a)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:a=>{this.emit("error",a)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(i){return Ee({},i,{connected:a=>{this.activityTimeout=Math.min(this.options.activityTimeout,a.activityTimeout,a.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(a.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let i=a=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),a(f)};return{tls_only:i(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:i(()=>{this.disconnect()}),backoff:i(()=>{this.retryIn(1e3)}),retry:i(()=>{this.retryIn(0)})}}setConnection(i){this.connection=i;for(var a in this.connectionCallbacks)this.connection.bind(a,this.connectionCallbacks[a]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var i in this.connectionCallbacks)this.connection.unbind(i,this.connectionCallbacks[i]);var a=this.connection;return this.connection=null,a}}updateState(i,a){var f=this.state;if(this.state=i,f!==i){var g=i;g==="connected"&&(g+=" with new socket ID "+a.socket_id),ae.debug("State changed",f+" -> "+g),this.timeline.info({state:i,params:a}),this.emit("state_change",{previous:f,current:i}),this.emit(i,a)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class jr{constructor(){this.channels={}}add(i,a){return this.channels[i]||(this.channels[i]=Zr(i,a)),this.channels[i]}all(){return Tt(this.channels)}find(i){return this.channels[i]}remove(i){var a=this.channels[i];return delete this.channels[i],a}disconnect(){$e(this.channels,function(i){i.disconnect()})}}function Zr(l,i){if(l.indexOf("private-encrypted-")===0){if(i.config.nacl)return Pt.createEncryptedChannel(l,i,i.config.nacl);let a="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=R.buildLogSuffix("encryptedChannelSupport");throw new Pe(`${a}. ${f}`)}else{if(l.indexOf("private-")===0)return Pt.createPrivateChannel(l,i);if(l.indexOf("presence-")===0)return Pt.createPresenceChannel(l,i);if(l.indexOf("#")===0)throw new C('Cannot create a channel with name "'+l+'".');return Pt.createChannel(l,i)}}var jc={createChannels(){return new jr},createConnectionManager(l,i){return new Te(l,i)},createChannel(l,i){return new z(l,i)},createPrivateChannel(l,i){return new ne(l,i)},createPresenceChannel(l,i){return new Ne(l,i)},createEncryptedChannel(l,i,a){return new tr(l,i,a)},createTimelineSender(l,i){return new T(l,i)},createHandshake(l,i){return new b(l,i)},createAssistantToTheTransportManager(l,i,a){return new Ur(l,i,a)}};const Pt=jc;class Fi{constructor(i){this.options=i||{},this.livesLeft=this.options.lives||1/0}getAssistant(i){return Pt.createAssistantToTheTransportManager(this,i,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class tn{constructor(i,a){this.strategies=i,this.loop=!!a.loop,this.failFast=!!a.failFast,this.timeout=a.timeout,this.timeoutLimit=a.timeoutLimit}isSupported(){return Gn(this.strategies,_e.method("isSupported"))}connect(i,a){var f=this.strategies,g=0,y=this.timeout,E=null,$=(Z,X)=>{X?a(null,X):(g=g+1,this.loop&&(g=g%f.length),g<f.length?(y&&(y=y*2,this.timeoutLimit&&(y=Math.min(y,this.timeoutLimit))),E=this.tryStrategy(f[g],i,{timeout:y,failFast:this.failFast},$)):a(!0))};return E=this.tryStrategy(f[g],i,{timeout:y,failFast:this.failFast},$),{abort:function(){E.abort()},forceMinPriority:function(Z){i=Z,E&&E.forceMinPriority(Z)}}}tryStrategy(i,a,f,g){var y=null,E=null;return f.timeout>0&&(y=new Ue(f.timeout,function(){E.abort(),g(!0)})),E=i.connect(a,function($,Z){$&&y&&y.isRunning()&&!f.failFast||(y&&y.ensureAborted(),g($,Z))}),{abort:function(){y&&y.ensureAborted(),E.abort()},forceMinPriority:function($){E.forceMinPriority($)}}}}class Uo{constructor(i){this.strategies=i}isSupported(){return Gn(this.strategies,_e.method("isSupported"))}connect(i,a){return Zc(this.strategies,i,function(f,g){return function(y,E){if(g[f].error=y,y){qc(g)&&a(!0);return}Et(g,function($){$.forceMinPriority(E.transport.priority)}),a(null,E)}})}}function Zc(l,i,a){var f=bn(l,function(g,y,E,$){return g.connect(i,a(y,$))});return{abort:function(){Et(f,Fc)},forceMinPriority:function(g){Et(f,function(y){y.forceMinPriority(g)})}}}function qc(l){return $o(l,function(i){return!!i.error})}function Fc(l){!l.error&&!l.aborted&&(l.abort(),l.aborted=!0)}class Hc{constructor(i,a,f){this.strategy=i,this.transports=a,this.ttl=f.ttl||18e5,this.usingTLS=f.useTLS,this.timeline=f.timeline}isSupported(){return this.strategy.isSupported()}connect(i,a){var f=this.usingTLS,g=Bc(f),y=g&&g.cacheSkipCount?g.cacheSkipCount:0,E=[this.strategy];if(g&&g.timestamp+this.ttl>=_e.now()){var $=this.transports[g.transport];$&&(["ws","wss"].includes(g.transport)||y>3?(this.timeline.info({cached:!0,transport:g.transport,latency:g.latency}),E.push(new tn([$],{timeout:g.latency*2+1e3,failFast:!0}))):y++)}var Z=_e.now(),X=E.pop().connect(i,function ee(we,Br){we?(Hi(f),E.length>0?(Z=_e.now(),X=E.pop().connect(i,ee)):a(we)):(Gc(f,Br.transport.name,_e.now()-Z,y),a(null,Br))});return{abort:function(){X.abort()},forceMinPriority:function(ee){i=ee,X&&X.forceMinPriority(ee)}}}}function jo(l){return"pusherTransport"+(l?"TLS":"NonTLS")}function Bc(l){var i=q.getLocalStorage();if(i)try{var a=i[jo(l)];if(a)return JSON.parse(a)}catch{Hi(l)}return null}function Gc(l,i,a,f){var g=q.getLocalStorage();if(g)try{g[jo(l)]=Ze({timestamp:_e.now(),transport:i,latency:a,cacheSkipCount:f})}catch{}}function Hi(l){var i=q.getLocalStorage();if(i)try{delete i[jo(l)]}catch{}}class qr{constructor(i,{delay:a}){this.strategy=i,this.options={delay:a}}isSupported(){return this.strategy.isSupported()}connect(i,a){var f=this.strategy,g,y=new Ue(this.options.delay,function(){g=f.connect(i,a)});return{abort:function(){y.ensureAborted(),g&&g.abort()},forceMinPriority:function(E){i=E,g&&g.forceMinPriority(E)}}}}class nr{constructor(i,a,f){this.test=i,this.trueBranch=a,this.falseBranch=f}isSupported(){var i=this.test()?this.trueBranch:this.falseBranch;return i.isSupported()}connect(i,a){var f=this.test()?this.trueBranch:this.falseBranch;return f.connect(i,a)}}class Wc{constructor(i){this.strategy=i}isSupported(){return this.strategy.isSupported()}connect(i,a){var f=this.strategy.connect(i,function(g,y){y&&f.abort(),a(g,y)});return f}}function rr(l){return function(){return l.isSupported()}}var Jc=function(l,i,a){var f={};function g(rs,Bl,Gl,Wl,Jl){var os=a(l,rs,Bl,Gl,Wl,Jl);return f[rs]=os,os}var y=Object.assign({},i,{hostNonTLS:l.wsHost+":"+l.wsPort,hostTLS:l.wsHost+":"+l.wssPort,httpPath:l.wsPath}),E=Object.assign({},y,{useTLS:!0}),$=Object.assign({},i,{hostNonTLS:l.httpHost+":"+l.httpPort,hostTLS:l.httpHost+":"+l.httpsPort,httpPath:l.httpPath}),Z={loop:!0,timeout:15e3,timeoutLimit:6e4},X=new Fi({minPingDelay:1e4,maxPingDelay:l.activityTimeout}),ee=new Fi({lives:2,minPingDelay:1e4,maxPingDelay:l.activityTimeout}),we=g("ws","ws",3,y,X),Br=g("wss","ws",3,E,X),jl=g("sockjs","sockjs",1,$),Yi=g("xhr_streaming","xhr_streaming",1,$,ee),Zl=g("xdr_streaming","xdr_streaming",1,$,ee),Ki=g("xhr_polling","xhr_polling",1,$),ql=g("xdr_polling","xdr_polling",1,$),Qi=new tn([we],Z),Fl=new tn([Br],Z),Hl=new tn([jl],Z),es=new tn([new nr(rr(Yi),Yi,Zl)],Z),ts=new tn([new nr(rr(Ki),Ki,ql)],Z),ns=new tn([new nr(rr(es),new Uo([es,new qr(ts,{delay:4e3})]),ts)],Z),Fo=new nr(rr(ns),ns,Hl),Ho;return i.useTLS?Ho=new Uo([Qi,new qr(Fo,{delay:2e3})]):Ho=new Uo([Qi,new qr(Fl,{delay:2e3}),new qr(Fo,{delay:5e3})]),new Hc(new Wc(new nr(rr(we),Ho,Fo)),f,{ttl:18e5,timeline:i.timeline,useTLS:i.useTLS})};const Xc=Jc;function Vc(){var l=this;l.timeline.info(l.buildTimelineMessage({transport:l.name+(l.options.useTLS?"s":"")})),l.hooks.isInitialized()?l.changeState("initialized"):l.hooks.file?(l.changeState("initializing"),P.load(l.hooks.file,{useTLS:l.options.useTLS},function(i,a){l.hooks.isInitialized()?(l.changeState("initialized"),a(!0)):(i&&l.onError(i),l.onClose(),a(!1))})):l.onClose()}var Yc={getRequest:function(l){var i=new window.XDomainRequest;return i.ontimeout=function(){l.emit("error",new M),l.close()},i.onerror=function(a){l.emit("error",a),l.close()},i.onprogress=function(){i.responseText&&i.responseText.length>0&&l.onChunk(200,i.responseText)},i.onload=function(){i.responseText&&i.responseText.length>0&&l.onChunk(200,i.responseText),l.emit("finished",200),l.close()},i},abortRequest:function(l){l.ontimeout=l.onerror=l.onprogress=l.onload=null,l.abort()}};const Kc=Yc,Qc=256*1024;class el extends ut{constructor(i,a,f){super(),this.hooks=i,this.method=a,this.url=f}start(i){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},q.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(i)}close(){this.unloader&&(q.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(i,a){for(;;){var f=this.advanceBuffer(a);if(f)this.emit("chunk",{status:i,data:f});else break}this.isBufferTooLong(a)&&this.emit("buffer_too_long")}advanceBuffer(i){var a=i.slice(this.position),f=a.indexOf(`
|
|
1231
|
-
`);return f!==-1?(this.position+=f+1,a.slice(0,f)):null}isBufferTooLong(i){return this.position===i.length&&i.length>Qc}}var Zo;(function(l){l[l.CONNECTING=0]="CONNECTING",l[l.OPEN=1]="OPEN",l[l.CLOSED=3]="CLOSED"})(Zo||(Zo={}));const nn=Zo;var tl=1;class nl{constructor(i,a){this.hooks=i,this.session=Gi(1e3)+"/"+sl(8),this.location=rl(a),this.readyState=nn.CONNECTING,this.openStream()}send(i){return this.sendRaw(JSON.stringify([i]))}ping(){this.hooks.sendHeartbeat(this)}close(i,a){this.onClose(i,a,!0)}sendRaw(i){if(this.readyState===nn.OPEN)try{return q.createSocketRequest("POST",Bi(ol(this.location,this.session))).start(i),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(i,a,f){this.closeStream(),this.readyState=nn.CLOSED,this.onclose&&this.onclose({code:i,reason:a,wasClean:f})}onChunk(i){if(i.status===200){this.readyState===nn.OPEN&&this.onActivity();var a,f=i.data.slice(0,1);switch(f){case"o":a=JSON.parse(i.data.slice(1)||"{}"),this.onOpen(a);break;case"a":a=JSON.parse(i.data.slice(1)||"[]");for(var g=0;g<a.length;g++)this.onEvent(a[g]);break;case"m":a=JSON.parse(i.data.slice(1)||"null"),this.onEvent(a);break;case"h":this.hooks.onHeartbeat(this);break;case"c":a=JSON.parse(i.data.slice(1)||"[]"),this.onClose(a[0],a[1],!0);break}}}onOpen(i){this.readyState===nn.CONNECTING?(i&&i.hostname&&(this.location.base=il(this.location.base,i.hostname)),this.readyState=nn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(i){this.readyState===nn.OPEN&&this.onmessage&&this.onmessage({data:i})}onActivity(){this.onactivity&&this.onactivity()}onError(i){this.onerror&&this.onerror(i)}openStream(){this.stream=q.createSocketRequest("POST",Bi(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",i=>{this.onChunk(i)}),this.stream.bind("finished",i=>{this.hooks.onFinished(this,i)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(i){_e.defer(()=>{this.onError(i),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function rl(l){var i=/([^\?]*)\/*(\??.*)/.exec(l);return{base:i[1],queryString:i[2]}}function ol(l,i){return l.base+"/"+i+"/xhr_send"}function Bi(l){var i=l.indexOf("?")===-1?"?":"&";return l+i+"t="+ +new Date+"&n="+tl++}function il(l,i){var a=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(l);return a[1]+i+a[3]}function Gi(l){return q.randomInt(l)}function sl(l){for(var i=[],a=0;a<l;a++)i.push(Gi(32).toString(32));return i.join("")}const al=nl;var cl={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 ll=cl;var ul={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 dl=ul;var pl={getRequest:function(l){var i=q.getXHRAPI(),a=new i;return a.onreadystatechange=a.onprogress=function(){switch(a.readyState){case 3:a.responseText&&a.responseText.length>0&&l.onChunk(a.status,a.responseText);break;case 4:a.responseText&&a.responseText.length>0&&l.onChunk(a.status,a.responseText),l.emit("finished",a.status),l.close();break}},a},abortRequest:function(l){l.onreadystatechange=null,l.abort()}};const hl=pl;var fl={createStreamingSocket(l){return this.createSocket(ll,l)},createPollingSocket(l){return this.createSocket(dl,l)},createSocket(l,i){return new al(l,i)},createXHR(l,i){return this.createRequest(hl,l,i)},createRequest(l,i,a){return new el(l,i,a)}};const Wi=fl;Wi.createXDR=function(l,i){return this.createRequest(Kc,l,i)};var gl={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:w,getDefaultStrategy:Xc,Transports:dt,transportConnectionInitializer:Vc,HTTPFactory:Wi,TimelineTransport:Mt,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:Nt,jsonp:Xn}},onDocumentBody(l){document.body?l():setTimeout(()=>{this.onDocumentBody(l)},0)},createJSONPRequest(l,i){return new kn(l,i)},createScriptRequest(l){return new Lr(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 Mr},createWebSocket(l){var i=this.getWebSocketAPI();return new i(l)},createSocketRequest(l,i){if(this.isXHRSupported())return this.HTTPFactory.createXHR(l,i);if(this.isXDRSupported(i.indexOf("https:")===0))return this.HTTPFactory.createXDR(l,i);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var l=this.getXHRAPI();return!!l&&new l().withCredentials!==void 0},isXDRSupported(l){var i=l?"https:":"http:",a=this.getProtocol();return!!window.XDomainRequest&&a===i},addUnloadListener(l){window.addEventListener!==void 0?window.addEventListener("unload",l,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",l)},removeUnloadListener(l){window.addEventListener!==void 0?window.removeEventListener("unload",l,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",l)},randomInt(l){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*l)}};const q=gl;var qo;(function(l){l[l.ERROR=3]="ERROR",l[l.INFO=6]="INFO",l[l.DEBUG=7]="DEBUG"})(qo||(qo={}));const Fr=qo;class ml{constructor(i,a,f){this.key=i,this.session=a,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(i,a){i<=this.options.level&&(this.events.push(Ee({},a,{timestamp:_e.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(i){this.log(Fr.ERROR,i)}info(i){this.log(Fr.INFO,i)}debug(i){this.log(Fr.DEBUG,i)}isEmpty(){return this.events.length===0}send(i,a){var f=Ee({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],i(f,(g,y)=>{g||this.sent++,a&&a(g,y)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class bl{constructor(i,a,f,g){this.name=i,this.priority=a,this.transport=f,this.options=g||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(i,a){if(this.isSupported()){if(this.priority<i)return Ji(new se,a)}else return Ji(new V,a);var f=!1,g=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),y=null,E=function(){g.unbind("initialized",E),g.connect()},$=function(){y=Pt.createHandshake(g,function(we){f=!0,ee(),a(null,we)})},Z=function(we){ee(),a(we)},X=function(){ee();var we;we=Ze(g),a(new ke(we))},ee=function(){g.unbind("initialized",E),g.unbind("open",$),g.unbind("error",Z),g.unbind("closed",X)};return g.bind("initialized",E),g.bind("open",$),g.bind("error",Z),g.bind("closed",X),g.initialize(),{abort:()=>{f||(ee(),y?y.close():g.close())},forceMinPriority:we=>{f||this.priority<we&&(y?y.close():g.close())}}}}function Ji(l,i){return _e.defer(function(){i(l)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:kl}=q;var _l=function(l,i,a,f,g,y){var E=kl[a];if(!E)throw new We(a);var $=(!l.enabledTransports||Bn(l.enabledTransports,i)!==-1)&&(!l.disabledTransports||Bn(l.disabledTransports,i)===-1),Z;return $?(g=Object.assign({ignoreNullOrigin:l.ignoreNullOrigin},g),Z=new bl(i,f,y?y.getAssistant(E):E,g)):Z=vl,Z},vl={isSupported:function(){return!1},connect:function(l,i){var a=_e.defer(function(){i(new V)});return{abort:function(){a.ensureAborted()},forceMinPriority:function(){}}}};function yl(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 wl=(l,i)=>{var a="socket_id="+encodeURIComponent(l.socketId);for(var f in i.params)a+="&"+encodeURIComponent(f)+"="+encodeURIComponent(i.params[f]);if(i.paramsProvider!=null){let g=i.paramsProvider();for(var f in g)a+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return a},xl=l=>{if(typeof q.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(i,a)=>{const f=wl(i,l);q.getAuthorizers()[l.transport](q,f,l,x.UserAuthentication,a)}},Sl=(l,i)=>{var a="socket_id="+encodeURIComponent(l.socketId);a+="&channel_name="+encodeURIComponent(l.channelName);for(var f in i.params)a+="&"+encodeURIComponent(f)+"="+encodeURIComponent(i.params[f]);if(i.paramsProvider!=null){let g=i.paramsProvider();for(var f in g)a+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return a},Tl=l=>{if(typeof q.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(i,a)=>{const f=Sl(i,l);q.getAuthorizers()[l.transport](q,f,l,x.ChannelAuthorization,a)}},El=(l,i,a)=>{const f={authTransport:i.transport,authEndpoint:i.endpoint,auth:{params:i.params,headers:i.headers}};return(g,y)=>{const E=l.channel(g.channelName);a(E,f).authorize(g.socketId,y)}};function Xi(l,i){let a={activityTimeout:l.activityTimeout||m.activityTimeout,cluster:l.cluster,httpPath:l.httpPath||m.httpPath,httpPort:l.httpPort||m.httpPort,httpsPort:l.httpsPort||m.httpsPort,pongTimeout:l.pongTimeout||m.pongTimeout,statsHost:l.statsHost||m.stats_host,unavailableTimeout:l.unavailableTimeout||m.unavailableTimeout,wsPath:l.wsPath||m.wsPath,wsPort:l.wsPort||m.wsPort,wssPort:l.wssPort||m.wssPort,enableStats:zl(l),httpHost:Al(l),useTLS:Rl(l),wsHost:Cl(l),userAuthenticator:Ll(l),channelAuthorizer:$l(l,i)};return"disabledTransports"in l&&(a.disabledTransports=l.disabledTransports),"enabledTransports"in l&&(a.enabledTransports=l.enabledTransports),"ignoreNullOrigin"in l&&(a.ignoreNullOrigin=l.ignoreNullOrigin),"timelineParams"in l&&(a.timelineParams=l.timelineParams),"nacl"in l&&(a.nacl=l.nacl),a}function Al(l){return l.httpHost?l.httpHost:l.cluster?`sockjs-${l.cluster}.pusher.com`:m.httpHost}function Cl(l){return l.wsHost?l.wsHost:Pl(l.cluster)}function Pl(l){return`ws-${l}.pusher.com`}function Rl(l){return q.getProtocol()==="https:"?!0:l.forceTLS!==!1}function zl(l){return"enableStats"in l?l.enableStats:"disableStats"in l?!l.disableStats:!1}const Vi=l=>"customHandler"in l&&l.customHandler!=null;function Ll(l){const i=Object.assign(Object.assign({},m.userAuthentication),l.userAuthentication);return Vi(i)?i.customHandler:xl(i)}function Il(l,i){let a;if("channelAuthorization"in l)a=Object.assign(Object.assign({},m.channelAuthorization),l.channelAuthorization);else if(a={transport:l.authTransport||m.authTransport,endpoint:l.authEndpoint||m.authEndpoint},"auth"in l&&("params"in l.auth&&(a.params=l.auth.params),"headers"in l.auth&&(a.headers=l.auth.headers)),"authorizer"in l)return{customHandler:El(i,a,l.authorizer)};return a}function $l(l,i){const a=Il(l,i);return Vi(a)?a.customHandler:Tl(a)}class Nl extends ut{constructor(i){super(function(a,f){ae.debug(`No callbacks on watchlist events for ${a}`)}),this.pusher=i,this.bindWatchlistInternalEvent()}handleEvent(i){i.data.events.forEach(a=>{this.emit(a.name,a)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",i=>{var a=i.event;a==="pusher_internal:watchlist_events"&&this.handleEvent(i)})}}function Ol(){let l,i;return{promise:new Promise((f,g)=>{l=f,i=g}),resolve:l,reject:i}}const Dl=Ol;class Ml extends ut{constructor(i){super(function(a,f){ae.debug("No callbacks on user for "+a)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(a,f)=>{if(a){ae.warn(`Error during signin: ${a}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:f.auth,user_data:f.user_data})},this.pusher=i,this.pusher.connection.bind("state_change",({previous:a,current:f})=>{a!=="connected"&&f==="connected"&&this._signin(),a==="connected"&&f!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new Nl(i),this.pusher.connection.bind("message",a=>{var f=a.event;f==="pusher:signin_success"&&this._onSigninSuccess(a.data),this.serverToUserChannel&&this.serverToUserChannel.name===a.channel&&this.serverToUserChannel.handleEvent(a)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(i){try{this.user_data=JSON.parse(i.user_data)}catch{ae.error(`Failed parsing user data after signin: ${i.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){ae.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const i=a=>{a.subscriptionPending&&a.subscriptionCancelled?a.reinstateSubscription():!a.subscriptionPending&&this.pusher.connection.state==="connected"&&a.subscribe()};this.serverToUserChannel=new z(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((a,f)=>{a.indexOf("pusher_internal:")===0||a.indexOf("pusher:")===0||this.emit(a,f)}),i(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:i,resolve:a}=Dl();i.done=!1;const f=()=>{i.done=!0};i.then(f).catch(f),this.signinDonePromise=i,this._signinDoneResolve=a}}class ze{static ready(){ze.isReady=!0;for(var i=0,a=ze.instances.length;i<a;i++)ze.instances[i].connect()}static getClientFeatures(){return Xt(Yt({ws:q.Transports.ws},function(i){return i.isSupported({})}))}constructor(i,a){Ul(i),yl(a),this.key=i,this.options=a,this.config=Xi(this.options,this),this.channels=Pt.createChannels(),this.global_emitter=new ut,this.sessionID=q.randomInt(1e9),this.timeline=new ml(this.key,this.sessionID,{cluster:this.config.cluster,features:ze.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:Fr.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=Pt.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+q.TimelineTransport.name}));var f=g=>q.getDefaultStrategy(this.config,g,_l);this.connection=Pt.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)}),ze.instances.push(this),this.timeline.info({instances:ze.instances.length}),this.user=new Ml(this),ze.isReady&&this.connect()}switchCluster(i){const{appKey:a,cluster:f}=i;this.key=a,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=Xi(this.options,this),this.connection.switchCluster(this.key)}channel(i){return this.channels.find(i)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var i=this.connection.isUsingTLS(),a=this.timelineSender;this.timelineSenderTimer=new Xe(6e4,function(){a.send(i)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(i,a,f){return this.global_emitter.bind(i,a,f),this}unbind(i,a,f){return this.global_emitter.unbind(i,a,f),this}bind_global(i){return this.global_emitter.bind_global(i),this}unbind_global(i){return this.global_emitter.unbind_global(i),this}unbind_all(i){return this.global_emitter.unbind_all(),this}subscribeAll(){var i;for(i in this.channels.channels)this.channels.channels.hasOwnProperty(i)&&this.subscribe(i)}subscribe(i){var a=this.channels.add(i,this);return a.subscriptionPending&&a.subscriptionCancelled?a.reinstateSubscription():!a.subscriptionPending&&this.connection.state==="connected"&&a.subscribe(),a}unsubscribe(i){var a=this.channels.find(i);a&&a.subscriptionPending?a.cancelSubscription():(a=this.channels.remove(i),a&&a.subscribed&&a.unsubscribe())}send_event(i,a,f){return this.connection.send_event(i,a,f)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}ze.instances=[],ze.isReady=!1,ze.logToConsole=!1,ze.Runtime=q,ze.ScriptReceivers=q.ScriptReceivers,ze.DependenciesReceivers=q.DependenciesReceivers,ze.auth_callbacks=q.auth_callbacks;const Hr=ze;function Ul(l){if(l==null)throw"You must pass your app key when you instantiate Pusher."}q.setup(ze)}},r={};function o(c){var u=r[c];if(u!==void 0)return u.exports;var d=r[c]={exports:{}};return n[c].call(d.exports,d,d.exports,o),d.exports}o.d=(c,u)=>{for(var d in u)o.o(u,d)&&!o.o(c,d)&&Object.defineProperty(c,d,{enumerable:!0,get:u[d]})},o.o=(c,u)=>Object.prototype.hasOwnProperty.call(c,u);var s=o(721);return s})())})(Ja);var Sg=Ja.exports;const Tg=xg(Sg),Vr={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 mt=null,xn=null;async function Eg(e){return xn||(xn=(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();mt=new Tg(r.pusher.key,{cluster:r.pusher.cluster||"local",forceTLS:!0,wsHost:r.pusher.wsHost||void 0,wsPort:r.pusher.wssPort,wssPort:r.pusher.wssPort,enabledTransports:r.pusher.wsHost?["ws"]:void 0,channelAuthorization:{customHandler:({socketId:o,channelName:s},c)=>{fetch(`${t}/api/pusher/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({socket_id:o,channel_name:s})}).then(u=>u.json()).then(u=>c(null,u)).catch(u=>c(u instanceof Error?u:new Error(String(u)),null))}}})})(),xn.catch(()=>{xn=null}),xn)}function Ag(e){if(!e||!mt)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return mt.connection.bind("state_change",n),()=>mt==null?void 0:mt.connection.unbind("state_change",n)}async function Cg(e,t,n){if(await Eg(e),!mt)return()=>{};const r=mt.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(Vr.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(Vr.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(Vr.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(Vr.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=Ag(n.onReconnect);return()=>{r.unbind_all(),mt==null||mt.unsubscribe(`private-task-${t}`),o==null||o()}}const wi="ap-sdk-active-automation";function Pg(){try{const e=sessionStorage.getItem(wi);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 Xa(e){try{sessionStorage.setItem(wi,JSON.stringify(e))}catch{}}function Va(){try{sessionStorage.removeItem(wi)}catch{}}async function Rg(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 zg(),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 zg(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const xi="shared",Ya="ap-sdk-panel-size:",$s=280,Ns=200;function Lg(e){try{const t=sessionStorage.getItem(Ya+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 Ig(e,t){try{sessionStorage.setItem(Ya+e,JSON.stringify(t))}catch{}}function Yr(e,t,n){return Math.min(Math.max(e,t),n)}function Os(){return window.innerWidth-32}function Ds(){return window.innerHeight-64}function Si(e,t){const n=Lg(t);n&&(e.style.width=`${Yr(n.width,$s,Os())}px`,e.style.height=`${Yr(n.height,Ns,Ds())}px`);const r=document.createElement("div");r.className="ap-sdk-resize-handle",r.setAttribute("data-ap-sdk","1"),e.appendChild(r);let o=!1,s=0,c=0,u=0,d=0,p=0,h=0;const k=_=>{o&&(p=Yr(u+(_.clientX-s),$s,Os()),h=Yr(d+(_.clientY-c),Ns,Ds()),e.style.width=`${p}px`,e.style.height=`${h}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",m),Ig(t,{width:p,height:h}))};r.addEventListener("pointerdown",_=>{_.preventDefault(),_.stopPropagation(),o=!0,s=_.clientX,c=_.clientY;const w=e.getBoundingClientRect();u=w.width,d=w.height,p=u,h=d,document.addEventListener("pointermove",k),document.addEventListener("pointerup",m)})}function Ti(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var mn=Ti();function Ka(e){mn=e}var on={exec:()=>null};function Sn(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),o=t[r];return o||(o=e(r),t[r]=o),o}}function G(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(o,s)=>{let c=typeof s=="string"?s:s.source;return c=c.replace(Oe.caret,"$1"),n=n.replace(o,c),r},getRegex:()=>new RegExp(n,t)};return r}var $g=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch{return!1}})(),Oe={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:Sn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Sn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Sn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Sn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Sn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Sn(e=>new RegExp(`^ {0,${e}}>`))},Ng=/^(?:[ \t]*(?:\n|$))+/,Og=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Dg=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ar=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Mg=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ei=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Qa=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ec=G(Qa).replace(/bull/g,Ei).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(),Ug=G(Qa).replace(/bull/g,Ei).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(),Ai=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,jg=/^[^\n]+/,Ci=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Zg=G(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ci).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),qg=G(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ei).getRegex(),Lo="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",Pi=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Fg=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",Pi).replace("tag",Lo).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),tc=e=>G(Ai).replace("hr",Ar).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",Lo).getRegex(),Hg=tc(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Bg=tc(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Gg=G(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Bg).getRegex(),Ri={blockquote:Gg,code:Og,def:Zg,fences:Dg,heading:Mg,hr:Ar,html:Fg,lheading:ec,list:qg,newline:Ng,paragraph:Hg,table:on,text:jg},Ms=G("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ar).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",Lo).getRegex(),Wg={...Ri,lheading:Ug,table:Ms,paragraph:G(Ai).replace("hr",Ar).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ms).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",Lo).getRegex()},Jg={...Ri,html:G(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Pi).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:on,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:G(Ai).replace("hr",Ar).replace("heading",` *#{1,6} *[^
|
|
1232
|
-
]`).replace("lheading",
|
|
1233
|
-
`),n=t.length-1;for(;n>=0&&
|
|
1234
|
-
`)}function
|
|
1235
|
-
`).map(
|
|
1236
|
-
`)}var
|
|
1237
|
-
`),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:
|
|
1238
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=
|
|
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 ie in M)M.hasOwnProperty(ie)&&(C[ie]=M[ie])},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 ie=x.length-C;if(ie>0){var M=x[C]<<16|(ie===2?x[C+1]<<8:0);S+=this._encodeByte(M>>>3*6&63),S+=this._encodeByte(M>>>2*6&63),ie===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)),ie=0,ke=0,ze=0,Ye=0,V=0,_e=0,Ke=0;ke<C-4;ke+=4)Ye=this._decodeChar(x.charCodeAt(ke+0)),V=this._decodeChar(x.charCodeAt(ke+1)),_e=this._decodeChar(x.charCodeAt(ke+2)),Ke=this._decodeChar(x.charCodeAt(ke+3)),M[ie++]=Ye<<2|V>>>4,M[ie++]=V<<4|_e>>>2,M[ie++]=_e<<6|Ke,ze|=Ye&p,ze|=V&p,ze|=_e&p,ze|=Ke&p;if(ke<C-1&&(Ye=this._decodeChar(x.charCodeAt(ke)),V=this._decodeChar(x.charCodeAt(ke+1)),M[ie++]=Ye<<2|V>>>4,ze|=Ye&p,ze|=V&p),ke<C-2&&(_e=this._decodeChar(x.charCodeAt(ke+2)),M[ie++]=V<<4|_e>>>2,ze|=_e&p),ke<C-3&&(Ke=this._decodeChar(x.charCodeAt(ke+3)),M[ie++]=_e<<6|Ke,ze|=Ke&p),ze!==0)throw new Error("Base64Coder: incorrect characters for decoding");return M},R.prototype._encodeByte=function(x){var S=x;return S+=65,S+=25-x>>>8&6,S+=51-x>>>8&-75,S+=61-x>>>8&-15,S+=62-x>>>8&3,String.fromCharCode(S)},R.prototype._decodeChar=function(x){var S=p;return S+=(42-x&x-44)>>>8&-p+x-43+62,S+=(46-x&x-48)>>>8&-p+x-47+63,S+=(47-x&x-58)>>>8&-p+x-48+52,S+=(64-x&x-91)>>>8&-p+x-65+0,S+=(96-x&x-123)>>>8&-p+x-97+26,S},R.prototype._getPaddingLength=function(x){var S=0;if(this._paddingCharacter){for(var C=x.length-1;C>=0&&x[C]===this._paddingCharacter;C--)S++;if(x.length<4||S>2)throw new Error("Base64Coder: incorrect padding")}return S},R}();u.Coder=h;var k=new h;function m(R){return k.encode(R)}u.encode=m;function _(R){return k.decode(R)}u.decode=_;var w=function(R){d(x,R);function x(){return R!==null&&R.apply(this,arguments)||this}return x.prototype._encodeByte=function(S){var C=S;return C+=65,C+=25-S>>>8&6,C+=51-S>>>8&-75,C+=61-S>>>8&-13,C+=62-S>>>8&49,String.fromCharCode(C)},x.prototype._decodeChar=function(S){var C=p;return C+=(44-S&S-46)>>>8&-p+S-45+62,C+=(94-S&S-96)>>>8&-p+S-95+63,C+=(47-S&S-58)>>>8&-p+S-48+52,C+=(64-S&S-91)>>>8&-p+S-65+0,C+=(96-S&S-123)>>>8&-p+S-97+26,C},x}(h);u.URLSafeCoder=w;var P=new w;function N(R){return P.encode(R)}u.encodeURLSafe=N;function ee(R){return P.decode(R)}u.decodeURLSafe=ee,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],ee=h[++m];if((P&192)!==128||(N&192)!==128||(ee&192)!==128)throw new Error(d);_=(_&15)<<18|(P&63)<<12|(N&63)<<6|ee&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:()=>Qr});class p{constructor(s,c){this.lastId=0,this.prefix=s,this.name=c}create(s){this.lastId++;var c=this.lastId,f=this.prefix+c,g=this.name+"["+c+"]",y=!1,E=function(){y||(s.apply(null,arguments),y=!0)};return this[c]=E,{number:c,id:f,name:g,callback:E}}remove(s){delete this[s.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(s){this.options=s,this.receivers=s.receivers||h,this.loading={}}load(s,c,f){var g=this;if(g.loading[s]&&g.loading[s].length>0)g.loading[s].push(f);else{g.loading[s]=[f];var y=H.createScriptRequest(g.getPath(s,c)),E=g.receivers.create(function($){if(g.receivers.remove(E),g.loading[s]){var q=g.loading[s];delete g.loading[s];for(var X=function(xe){xe||y.cleanup()},Q=0;Q<q.length;Q++)q[Q]($,X)}});y.send(E)}}getRoot(s){var c,f=H.getDocument().location.protocol;return s&&s.useTLS||f==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(s,c){return this.getRoot(c)+"/"+s+this.options.suffix+".js"}}var w=new p("_pusher_dependencies","Pusher.DependenciesReceivers"),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 s="See:",c=N.urls[l];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=N.baseUrl+c.path),f?`${s} ${f}`:""}};var x;(function(l){l.UserAuthentication="user-authentication",l.ChannelAuthorization="channel-authorization"})(x||(x={}));class S extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class C extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class ie extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class ke extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class ze extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Ye extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class V extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class _e extends Error{constructor(s,c){super(c),this.status=s,Object.setPrototypeOf(this,new.target.prototype)}}const Z=function(l,s,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(s),y};function te(l){return ge(pt(l))}var Ce=String.fromCharCode,Pe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",dt=function(l){var s=l.charCodeAt(0);return s<128?l:s<2048?Ce(192|s>>>6)+Ce(128|s&63):Ce(224|s>>>12&15)+Ce(128|s>>>6&63)+Ce(128|s&63)},pt=function(l){return l.replace(/[^\x00-\x7F]/g,dt)},rn=function(l){var s=[0,2,1][l.length%3],c=l.charCodeAt(0)<<16|(l.length>1?l.charCodeAt(1):0)<<8|(l.length>2?l.charCodeAt(2):0),f=[Pe.charAt(c>>>18),Pe.charAt(c>>>12&63),s>=2?"=":Pe.charAt(c>>>6&63),s>=1?"=":Pe.charAt(c&63)];return f.join("")},ge=window.btoa||function(l){return l.replace(/[\s\S]{1,3}/g,rn)};class Ee{constructor(s,c,f,g){this.clear=c,this.timer=s(()=>{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=Ee;function Ue(l){window.clearTimeout(l)}function J(l){window.clearInterval(l)}class je extends W{constructor(s,c){super(setTimeout,Ue,s,function(f){return c(),null})}}class Ze extends W{constructor(s,c){super(setInterval,J,s,function(f){return c(),f})}}var qe={now(){return Date.now?Date.now():new Date().valueOf()},defer(l){return new je(0,l)},method(l,...s){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[l].apply(f,c.concat(arguments))}}};const ve=qe;function me(l,...s){for(var c=0;c<s.length;c++){var f=s[c];for(var g in f)f[g]&&f[g].constructor&&f[g].constructor===Object?l[g]=me(l[g]||{},f[g]):l[g]=f[g]}return l}function Mr(){for(var l=["Pusher"],s=0;s<arguments.length;s++)typeof arguments[s]=="string"?l.push(arguments[s]):l.push(He(arguments[s]));return l.join(" : ")}function rr(l,s){var c=Array.prototype.indexOf;if(l===null)return-1;if(c&&l.indexOf===c)return l.indexOf(s);for(var f=0,g=l.length;f<g;f++)if(l[f]===s)return f;return-1}function Ne(l,s){for(var c in l)Object.prototype.hasOwnProperty.call(l,c)&&s(l[c],c,l)}function on(l){var s=[];return Ne(l,function(c,f){s.push(f)}),s}function Lt(l){var s=[];return Ne(l,function(c){s.push(c)}),s}function zt(l,s,c){for(var f=0;f<l.length;f++)s.call(c||window,l[f],f,l)}function En(l,s){for(var c=[],f=0;f<l.length;f++)c.push(s(l[f],f,l,c));return c}function Ht(l,s){var c={};return Ne(l,function(f,g){c[g]=s(f)}),c}function sn(l,s){s=s||function(g){return!!g};for(var c=[],f=0;f<l.length;f++)s(l[f],f,l,c)&&c.push(l[f]);return c}function an(l,s){var c={};return Ne(l,function(f,g){(s&&s(f,g,l,c)||f)&&(c[g]=f)}),c}function Ur(l){var s=[];return Ne(l,function(c,f){s.push([f,c])}),s}function or(l,s){for(var c=0;c<l.length;c++)if(s(l[c],c,l))return!0;return!1}function Jo(l,s){for(var c=0;c<l.length;c++)if(!s(l[c],c,l))return!1;return!0}function sr(l){return Ht(l,function(s){return typeof s=="object"&&(s=He(s)),encodeURIComponent(te(s.toString()))})}function cn(l){var s=an(l,function(f){return f!==void 0}),c=En(Ur(sr(s)),ve.method("join","=")).join("&");return c}function Ft(l){var s=[],c=[];return function f(g,y){var E,$,q;switch(typeof g){case"object":if(!g)return null;for(E=0;E<s.length;E+=1)if(s[E]===g)return{$ref:c[E]};if(s.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 He(l){try{return JSON.stringify(l)}catch{return JSON.stringify(Ft(l))}}class ir{constructor(){this.globalLog=s=>{window.console&&window.console.log&&window.console.log(s)}}debug(...s){this.log(this.globalLog,s)}warn(...s){this.log(this.globalLogWarn,s)}error(...s){this.log(this.globalLogError,s)}globalLogWarn(s){window.console&&window.console.warn?window.console.warn(s):this.globalLog(s)}globalLogError(s){window.console&&window.console.error?window.console.error(s):this.globalLogWarn(s)}log(s,...c){var f=Mr.apply(this,arguments);Qr.log?Qr.log(f):Qr.logToConsole&&s.bind(this)(f)}}const ae=new ir;var jr=function(l,s,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)+"&"+s;var X=E.getElementsByTagName("head")[0]||E.documentElement;X.insertBefore($,X.firstChild)};const ar=jr;class Zr{constructor(s){this.src=s}send(s){var c=this,f="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=s.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){s.callback(f)},c.script.onload=function(){s.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&s.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=s.id+"_error",c.errorScript.text=s.name+"('"+f+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var 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 An{constructor(s,c){this.url=s,this.data=c}send(s){if(!this.request){var c=cn(this.data),f=this.url+"/"+s.number+"?"+c;this.request=H.createScriptRequest(f),this.request.send(s)}}cleanup(){this.request&&this.request.cleanup()}}var Cn=function(l,s){return function(c,f){var g="http"+(s?"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($)}},ht={name:"jsonp",getAgent:Cn};const Bt=ht;function ln(l,s,c){var f=l+(s.useTLS?"s":""),g=s.useTLS?s.hostTLS:s.hostNonTLS;return f+"://"+g+c}function un(l,s){var c="/app/"+l,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(s?"&"+s:"");return c+f}var Xo={getInitial:function(l,s){var c=(s.httpPath||"")+un(l,"flash=false");return ln("ws",s,c)}},Pn={getInitial:function(l,s){var c=(s.httpPath||"/pusher")+un(l);return ln("http",s,c)}},Rn={getInitial:function(l,s){return ln("http",s,s.httpPath||"/pusher")},getPath:function(l,s){return un(l)}};class Vo{constructor(){this._callbacks={}}get(s){return this._callbacks[It(s)]}add(s,c,f){var g=It(s);this._callbacks[g]=this._callbacks[g]||[],this._callbacks[g].push({fn:c,context:f})}remove(s,c,f){if(!s&&!c&&!f){this._callbacks={};return}var g=s?[It(s)]:on(this._callbacks);c||f?this.removeCallback(g,c,f):this.removeAllCallbacks(g)}removeCallback(s,c,f){zt(s,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(s){zt(s,function(c){delete this._callbacks[c]},this)}}function It(l){return"_"+l}class ft{constructor(s){this.callbacks=new Vo,this.global_callbacks=[],this.failThrough=s}bind(s,c,f){return this.callbacks.add(s,c,f),this}bind_global(s){return this.global_callbacks.push(s),this}unbind(s,c,f){return this.callbacks.remove(s,c,f),this}unbind_global(s){return s?(this.global_callbacks=sn(this.global_callbacks||[],c=>c!==s),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(s,c,f){for(var g=0;g<this.global_callbacks.length;g++)this.global_callbacks[g](s,c);var y=this.callbacks.get(s),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(s,c);return this}}class Yo extends ft{constructor(s,c,f,g,y){super(),this.initialize=H.transportConnectionInitializer,this.hooks=s,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 s=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(s,this.options)}catch(c){return ve.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),ae.debug("Connecting",{transport:this.name,url:s}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(s){return this.state==="open"?(ve.defer(()=>{this.socket&&this.socket.send(s)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(s){this.emit("error",{type:"WebSocketError",error:s}),this.timeline.error(this.buildTimelineMessage({error:s.toString()}))}onClose(s){s?this.changeState("closed",{code:s.code,reason:s.reason,wasClean:s.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(s){this.emit("message",s)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=s=>{this.onError(s)},this.socket.onclose=s=>{this.onClose(s)},this.socket.onmessage=s=>{this.onMessage(s)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(s,c){this.state=s,this.timeline.info(this.buildTimelineMessage({state:s,params:c})),this.emit(s,c)}buildTimelineMessage(s){return me({cid:this.id},s)}}class ce{constructor(s){this.hooks=s}isSupported(s){return this.hooks.isSupported(s)}createConnection(s,c,f,g){return new Yo(this.hooks,s,c,f,g)}}var Gt=new ce({urls:Xo,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!H.getWebSocketAPI()},isSupported:function(){return!!H.getWebSocketAPI()},getSocket:function(l){return H.createWebSocket(l)}}),qr={urls:Pn,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},cr=me({getSocket:function(l){return H.HTTPFactory.createStreamingSocket(l)}},qr),Ln=me({getSocket:function(l){return H.HTTPFactory.createPollingSocket(l)}},qr),lr={isSupported:function(){return H.isXHRSupported()}},Hr=new ce(me({},cr,lr)),Ko=new ce(me({},Ln,lr)),ot={ws:Gt,xhr_streaming:Hr,xhr_polling:Ko};const st=ot;var Fr=new ce({file:"sockjs",urls:Rn,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(l,s){return new window.SockJS(l,null,{js_path:P.getPath("sockjs",{useTLS:s.useTLS}),ignore_null_origin:s.ignoreNullOrigin})},beforeOpen:function(l,s){l.send(JSON.stringify({path:s}))}}),ur={isSupported:function(l){var s=H.isXDRSupported(l.useTLS);return s}},dr=new ce(me({},cr,ur)),Br=new ce(me({},Ln,ur));st.xdr_streaming=dr,st.xdr_polling=Br,st.sockjs=Fr;const gt=st;class Gr extends ft{constructor(){super();var s=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){s.emit("online")},!1),window.addEventListener("offline",function(){s.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Wr=new Gr;class Jr{constructor(s,c,f){this.manager=s,this.transport=c,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(s,c,f,g){g=me({},g,{activityTimeout:this.pingDelay});var y=this.transport.createConnection(s,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(s){return this.manager.isAlive()&&this.transport.isSupported(s)}}const pr={decodeMessage:function(l){try{var s=JSON.parse(l.data),c=s.data;if(typeof c=="string")try{c=JSON.parse(s.data)}catch{}var f={event:s.event,channel:s.channel,data:c};return s.user_id&&(f.user_id=s.user_id),f}catch(g){throw{type:"MessageParseError",error:g,data:l.data}}},encodeMessage:function(l){return JSON.stringify(l)},processHandshake:function(l){var s=pr.decodeMessage(l);if(s.event==="pusher:connection_established"){if(!s.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:s.data.socket_id,activityTimeout:s.data.activity_timeout*1e3}}else{if(s.event==="pusher:error")return{action:this.getCloseAction(s.data),error:this.getCloseError(s.data)};throw"Invalid handshake"}},getCloseAction:function(l){return l.code<4e3?l.code>=1002&&l.code<=1004?"backoff":null:l.code===4e3?"tls_only":l.code<4100?"refused":l.code<4200?"backoff":l.code<4300?"retry":"refused"},getCloseError:function(l){return l.code!==1e3&&l.code!==1001?{type:"PusherError",data:{code:l.code,message:l.reason||l.message}}:null}},$t=pr;class O extends ft{constructor(s,c){super(),this.id=s,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(s){return this.transport.send(s)}send_event(s,c,f){var g={event:s,data:c};return f&&(g.channel=f),ae.debug("Event sent",g),this.send($t.encodeMessage(g))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var s={message:f=>{var g;try{g=$t.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=()=>{Ne(s,(f,g)=>{this.transport.unbind(g,f)})};Ne(s,(f,g)=>{this.transport.bind(g,f)})}handleCloseEvent(s){var c=$t.getCloseAction(s),f=$t.getCloseError(s);f&&this.emit("error",f),c&&this.emit(c,{action:c,error:f})}}class b{constructor(s,c){this.transport=s,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=s=>{this.unbindListeners();var c;try{c=$t.processHandshake(s)}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=s=>{this.unbindListeners();var c=$t.getCloseAction(s)||"backoff",f=$t.getCloseError(s);this.finish(c,{error:f})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(s,c){this.callback(me({transport:this.transport,action:s},c))}}class T{constructor(s,c){this.timeline=s,this.options=c||{}}send(s,c){this.timeline.isEmpty()||this.timeline.send(H.TimelineTransport.getAgent(this,s),c)}}class L extends ft{constructor(s,c){super(function(f,g){ae.debug("No callbacks on "+s+" for "+f)}),this.name=s,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(s,c){return c(null,{auth:""})}trigger(s,c){if(s.indexOf("client-")!==0)throw new S("Event '"+s+"' does not start with 'client-'");if(!this.subscribed){var f=R.buildLogSuffix("triggeringClientEvents");ae.warn(`Client event triggered before channel 'subscription_succeeded' event . ${f}`)}return this.pusher.send_event(s,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(s){var c=s.event,f=s.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(s);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(s);else if(c.indexOf("pusher_internal:")!==0){var g={};this.emit(c,f,g)}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",s.data)}handleSubscriptionCountEvent(s){s.data.subscription_count&&(this.subscriptionCount=s.data.subscription_count),this.emit("pusher:subscription_count",s.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(s,c)=>{s?(this.subscriptionPending=!1,ae.error(s.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:s.message},s instanceof _e?{status:s.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:c.auth,channel_data:c.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class ne extends L{authorize(s,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:s},c)}}class Re{constructor(){this.reset()}get(s){return Object.prototype.hasOwnProperty.call(this.members,s)?{id:s,info:this.members[s]}:null}each(s){Ne(this.members,(c,f)=>{s(this.get(f))})}setMyID(s){this.myID=s}onSubscription(s){this.members=s.presence.hash,this.count=s.presence.count,this.me=this.get(this.myID)}addMember(s){return this.get(s.user_id)===null&&this.count++,this.members[s.user_id]=s.user_info,this.get(s.user_id)}removeMember(s){var c=this.get(s.user_id);return c&&(delete this.members[s.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var ye=function(l,s,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(xe){E(xe)}}function q(Q){try{X(f.throw(Q))}catch(xe){E(xe)}}function X(Q){Q.done?y(Q.value):g(Q.value).then($,q)}X((f=f.apply(l,s||[])).next())})};class Oe extends ne{constructor(s,c){super(s,c),this.members=new Re}authorize(s,c){super.authorize(s,(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(s){var c=s.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(s);else{var f=s.data,g={};s.user_id&&(g.user_id=s.user_id),this.emit(c,f,g)}}handleInternalEvent(s){var c=s.event,f=s.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(s);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(s);break;case"pusher_internal:member_added":var 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(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(s.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var mt=d(978),wt=d(594);class hr extends ne{constructor(s,c,f){super(s,c),this.key=null,this.nacl=f}authorize(s,c){super.authorize(s,(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,wt.decode)(y),delete g.shared_secret,c(null,g)})}trigger(s,c){throw new ze("Client events are not currently supported for encrypted channels")}handleEvent(s){var c=s.event,f=s.data;if(c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0){super.handleEvent(s);return}this.handleEncryptedEvent(c,f)}handleEncryptedEvent(s,c){if(!this.key){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,wt.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,wt.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(s,this.getDataToEmit(y))});return}this.emit(s,this.getDataToEmit(y))}getDataToEmit(s){let c=(0,mt.D4)(s);try{return JSON.parse(c)}catch{return c}}}class Ae extends ft{constructor(s,c){super(),this.state="initialized",this.connection=null,this.key=s,this.options=c,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var f=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(s){this.key=s,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(s){return this.connection?this.connection.send(s):!1}send_event(s,c,f){return this.connection?this.connection.send_event(s,c,f):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var s=(c,f)=>{c?this.runner=this.strategy.connect(0,s):f.action==="error"?(this.emit("error",{type:"HandshakeError",error:f.error}),this.timeline.error({handshakeError:f.error})):(this.abortConnecting(),this.handshakeCallbacks[f.action](f))};this.runner=this.strategy.connect(0,s)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var s=this.abandonConnection();s.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(s){this.timeline.info({action:"retry",delay:s}),s>0&&this.emit("connecting_in",Math.round(s/1e3)),this.retryTimer=new je(s||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(s){return me({},s,{message:c=>{this.resetActivityCheck(),this.emit("message",c)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:c=>{this.emit("error",c)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(s){return me({},s,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let s=c=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),c(f)};return{tls_only:s(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:s(()=>{this.disconnect()}),backoff:s(()=>{this.retryIn(1e3)}),retry:s(()=>{this.retryIn(0)})}}setConnection(s){this.connection=s;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var s in this.connectionCallbacks)this.connection.unbind(s,this.connectionCallbacks[s]);var c=this.connection;return this.connection=null,c}}updateState(s,c){var f=this.state;if(this.state=s,f!==s){var g=s;g==="connected"&&(g+=" with new socket ID "+c.socket_id),ae.debug("State changed",f+" -> "+g),this.timeline.info({state:s,params:c}),this.emit("state_change",{previous:f,current:s}),this.emit(s,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class Xr{constructor(){this.channels={}}add(s,c){return this.channels[s]||(this.channels[s]=Vr(s,c)),this.channels[s]}all(){return Lt(this.channels)}find(s){return this.channels[s]}remove(s){var c=this.channels[s];return delete this.channels[s],c}disconnect(){Ne(this.channels,function(s){s.disconnect()})}}function Vr(l,s){if(l.indexOf("private-encrypted-")===0){if(s.config.nacl)return Nt.createEncryptedChannel(l,s,s.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=R.buildLogSuffix("encryptedChannelSupport");throw new ze(`${c}. ${f}`)}else{if(l.indexOf("private-")===0)return Nt.createPrivateChannel(l,s);if(l.indexOf("presence-")===0)return Nt.createPresenceChannel(l,s);if(l.indexOf("#")===0)throw new C('Cannot create a channel with name "'+l+'".');return Nt.createChannel(l,s)}}var dl={createChannels(){return new Xr},createConnectionManager(l,s){return new Ae(l,s)},createChannel(l,s){return new L(l,s)},createPrivateChannel(l,s){return new ne(l,s)},createPresenceChannel(l,s){return new Oe(l,s)},createEncryptedChannel(l,s,c){return new hr(l,s,c)},createTimelineSender(l,s){return new T(l,s)},createHandshake(l,s){return new b(l,s)},createAssistantToTheTransportManager(l,s,c){return new Jr(l,s,c)}};const Nt=dl;class ii{constructor(s){this.options=s||{},this.livesLeft=this.options.lives||1/0}getAssistant(s){return Nt.createAssistantToTheTransportManager(this,s,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class dn{constructor(s,c){this.strategies=s,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return or(this.strategies,ve.method("isSupported"))}connect(s,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],s,{timeout:y,failFast:this.failFast},$)):c(!0))};return E=this.tryStrategy(f[g],s,{timeout:y,failFast:this.failFast},$),{abort:function(){E.abort()},forceMinPriority:function(q){s=q,E&&E.forceMinPriority(q)}}}tryStrategy(s,c,f,g){var y=null,E=null;return f.timeout>0&&(y=new je(f.timeout,function(){E.abort(),g(!0)})),E=s.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 Qo{constructor(s){this.strategies=s}isSupported(){return or(this.strategies,ve.method("isSupported"))}connect(s,c){return pl(this.strategies,s,function(f,g){return function(y,E){if(g[f].error=y,y){hl(g)&&c(!0);return}zt(g,function($){$.forceMinPriority(E.transport.priority)}),c(null,E)}})}}function pl(l,s,c){var f=En(l,function(g,y,E,$){return g.connect(s,c(y,$))});return{abort:function(){zt(f,fl)},forceMinPriority:function(g){zt(f,function(y){y.forceMinPriority(g)})}}}function hl(l){return Jo(l,function(s){return!!s.error})}function fl(l){!l.error&&!l.aborted&&(l.abort(),l.aborted=!0)}class gl{constructor(s,c,f){this.strategy=s,this.transports=c,this.ttl=f.ttl||18e5,this.usingTLS=f.useTLS,this.timeline=f.timeline}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.usingTLS,g=ml(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 dn([$],{timeout:g.latency*2+1e3,failFast:!0}))):y++)}var q=ve.now(),X=E.pop().connect(s,function Q(xe,eo){xe?(ai(f),E.length>0?(q=ve.now(),X=E.pop().connect(s,Q)):c(xe)):(bl(f,eo.transport.name,ve.now()-q,y),c(null,eo))});return{abort:function(){X.abort()},forceMinPriority:function(Q){s=Q,X&&X.forceMinPriority(Q)}}}}function es(l){return"pusherTransport"+(l?"TLS":"NonTLS")}function ml(l){var s=H.getLocalStorage();if(s)try{var c=s[es(l)];if(c)return JSON.parse(c)}catch{ai(l)}return null}function bl(l,s,c,f){var g=H.getLocalStorage();if(g)try{g[es(l)]=He({timestamp:ve.now(),transport:s,latency:c,cacheSkipCount:f})}catch{}}function ai(l){var s=H.getLocalStorage();if(s)try{delete s[es(l)]}catch{}}class Yr{constructor(s,{delay:c}){this.strategy=s,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy,g,y=new je(this.options.delay,function(){g=f.connect(s,c)});return{abort:function(){y.ensureAborted(),g&&g.abort()},forceMinPriority:function(E){s=E,g&&g.forceMinPriority(E)}}}}class fr{constructor(s,c,f){this.test=s,this.trueBranch=c,this.falseBranch=f}isSupported(){var s=this.test()?this.trueBranch:this.falseBranch;return s.isSupported()}connect(s,c){var f=this.test()?this.trueBranch:this.falseBranch;return f.connect(s,c)}}class kl{constructor(s){this.strategy=s}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy.connect(s,function(g,y){y&&f.abort(),c(g,y)});return f}}function gr(l){return function(){return l.isSupported()}}var _l=function(l,s,c){var f={};function g(vi,mu,bu,ku,_u){var yi=c(l,vi,mu,bu,ku,_u);return f[vi]=yi,yi}var y=Object.assign({},s,{hostNonTLS:l.wsHost+":"+l.wsPort,hostTLS:l.wsHost+":"+l.wssPort,httpPath:l.wsPath}),E=Object.assign({},y,{useTLS:!0}),$=Object.assign({},s,{hostNonTLS:l.httpHost+":"+l.httpPort,hostTLS:l.httpHost+":"+l.httpsPort,httpPath:l.httpPath}),q={loop:!0,timeout:15e3,timeoutLimit:6e4},X=new ii({minPingDelay:1e4,maxPingDelay:l.activityTimeout}),Q=new ii({lives:2,minPingDelay:1e4,maxPingDelay:l.activityTimeout}),xe=g("ws","ws",3,y,X),eo=g("wss","ws",3,E,X),du=g("sockjs","sockjs",1,$),fi=g("xhr_streaming","xhr_streaming",1,$,Q),pu=g("xdr_streaming","xdr_streaming",1,$,Q),gi=g("xhr_polling","xhr_polling",1,$),hu=g("xdr_polling","xdr_polling",1,$),mi=new dn([xe],q),fu=new dn([eo],q),gu=new dn([du],q),bi=new dn([new fr(gr(fi),fi,pu)],q),ki=new dn([new fr(gr(gi),gi,hu)],q),_i=new dn([new fr(gr(bi),new Qo([bi,new Yr(ki,{delay:4e3})]),ki)],q),rs=new fr(gr(_i),_i,gu),os;return s.useTLS?os=new Qo([mi,new Yr(rs,{delay:2e3})]):os=new Qo([mi,new Yr(fu,{delay:2e3}),new Yr(rs,{delay:5e3})]),new gl(new kl(new fr(gr(xe),os,rs)),f,{ttl:18e5,timeline:s.timeline,useTLS:s.useTLS})};const vl=_l;function yl(){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(s,c){l.hooks.isInitialized()?(l.changeState("initialized"),c(!0)):(s&&l.onError(s),l.onClose(),c(!1))})):l.onClose()}var wl={getRequest:function(l){var s=new window.XDomainRequest;return s.ontimeout=function(){l.emit("error",new M),l.close()},s.onerror=function(c){l.emit("error",c),l.close()},s.onprogress=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText)},s.onload=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText),l.emit("finished",200),l.close()},s},abortRequest:function(l){l.ontimeout=l.onerror=l.onprogress=l.onload=null,l.abort()}};const xl=wl,Sl=256*1024;class Tl extends ft{constructor(s,c,f){super(),this.hooks=s,this.method=c,this.url=f}start(s){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},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(s)}close(){this.unloader&&(H.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(s,c){for(;;){var f=this.advanceBuffer(c);if(f)this.emit("chunk",{status:s,data:f});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(s){var c=s.slice(this.position),f=c.indexOf(`
|
|
1375
|
+
`);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(s){return this.position===s.length&&s.length>Sl}}var ts;(function(l){l[l.CONNECTING=0]="CONNECTING",l[l.OPEN=1]="OPEN",l[l.CLOSED=3]="CLOSED"})(ts||(ts={}));const pn=ts;var El=1;class Al{constructor(s,c){this.hooks=s,this.session=li(1e3)+"/"+Ll(8),this.location=Cl(c),this.readyState=pn.CONNECTING,this.openStream()}send(s){return this.sendRaw(JSON.stringify([s]))}ping(){this.hooks.sendHeartbeat(this)}close(s,c){this.onClose(s,c,!0)}sendRaw(s){if(this.readyState===pn.OPEN)try{return H.createSocketRequest("POST",ci(Pl(this.location,this.session))).start(s),!0}catch{return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(s,c,f){this.closeStream(),this.readyState=pn.CLOSED,this.onclose&&this.onclose({code:s,reason:c,wasClean:f})}onChunk(s){if(s.status===200){this.readyState===pn.OPEN&&this.onActivity();var c,f=s.data.slice(0,1);switch(f){case"o":c=JSON.parse(s.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(s.data.slice(1)||"[]");for(var g=0;g<c.length;g++)this.onEvent(c[g]);break;case"m":c=JSON.parse(s.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(s.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(s){this.readyState===pn.CONNECTING?(s&&s.hostname&&(this.location.base=Rl(this.location.base,s.hostname)),this.readyState=pn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(s){this.readyState===pn.OPEN&&this.onmessage&&this.onmessage({data:s})}onActivity(){this.onactivity&&this.onactivity()}onError(s){this.onerror&&this.onerror(s)}openStream(){this.stream=H.createSocketRequest("POST",ci(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",s=>{this.onChunk(s)}),this.stream.bind("finished",s=>{this.hooks.onFinished(this,s)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(s){ve.defer(()=>{this.onError(s),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function Cl(l){var s=/([^\?]*)\/*(\??.*)/.exec(l);return{base:s[1],queryString:s[2]}}function Pl(l,s){return l.base+"/"+s+"/xhr_send"}function ci(l){var s=l.indexOf("?")===-1?"?":"&";return l+s+"t="+ +new Date+"&n="+El++}function Rl(l,s){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(l);return c[1]+s+c[3]}function li(l){return H.randomInt(l)}function Ll(l){for(var s=[],c=0;c<l;c++)s.push(li(32).toString(32));return s.join("")}const zl=Al;var Il={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr_streaming"+l.queryString},onHeartbeat:function(l){l.sendRaw("[]")},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const $l=Il;var Nl={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr"+l.queryString},onHeartbeat:function(){},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){s===200?l.reconnect():l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const Ol=Nl;var Dl={getRequest:function(l){var s=H.getXHRAPI(),c=new s;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText),l.emit("finished",c.status),l.close();break}},c},abortRequest:function(l){l.onreadystatechange=null,l.abort()}};const Ml=Dl;var Ul={createStreamingSocket(l){return this.createSocket($l,l)},createPollingSocket(l){return this.createSocket(Ol,l)},createSocket(l,s){return new zl(l,s)},createXHR(l,s){return this.createRequest(Ml,l,s)},createRequest(l,s,c){return new Tl(l,s,c)}};const ui=Ul;ui.createXDR=function(l,s){return this.createRequest(xl,l,s)};var jl={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:w,getDefaultStrategy:vl,Transports:gt,transportConnectionInitializer:yl,HTTPFactory:ui,TimelineTransport:Bt,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(l){window.Pusher=l;var s=()=>{this.onDocumentBody(l.ready)};window.JSON?s():P.load("json2",{},s)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:Z,jsonp:ar}},onDocumentBody(l){document.body?l():setTimeout(()=>{this.onDocumentBody(l)},0)},createJSONPRequest(l,s){return new An(l,s)},createScriptRequest(l){return new Zr(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 Wr},createWebSocket(l){var s=this.getWebSocketAPI();return new s(l)},createSocketRequest(l,s){if(this.isXHRSupported())return this.HTTPFactory.createXHR(l,s);if(this.isXDRSupported(s.indexOf("https:")===0))return this.HTTPFactory.createXDR(l,s);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var l=this.getXHRAPI();return!!l&&new l().withCredentials!==void 0},isXDRSupported(l){var s=l?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===s},addUnloadListener(l){window.addEventListener!==void 0?window.addEventListener("unload",l,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",l)},removeUnloadListener(l){window.addEventListener!==void 0?window.removeEventListener("unload",l,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",l)},randomInt(l){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*l)}};const H=jl;var ns;(function(l){l[l.ERROR=3]="ERROR",l[l.INFO=6]="INFO",l[l.DEBUG=7]="DEBUG"})(ns||(ns={}));const Kr=ns;class Zl{constructor(s,c,f){this.key=s,this.session=c,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(s,c){s<=this.options.level&&(this.events.push(me({},c,{timestamp:ve.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(s){this.log(Kr.ERROR,s)}info(s){this.log(Kr.INFO,s)}debug(s){this.log(Kr.DEBUG,s)}isEmpty(){return this.events.length===0}send(s,c){var f=me({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],s(f,(g,y)=>{g||this.sent++,c&&c(g,y)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class ql{constructor(s,c,f,g){this.name=s,this.priority=c,this.transport=f,this.options=g||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(s,c){if(this.isSupported()){if(this.priority<s)return di(new ie,c)}else return di(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=Nt.createHandshake(g,function(xe){f=!0,Q(),c(null,xe)})},q=function(xe){Q(),c(xe)},X=function(){Q();var xe;xe=He(g),c(new ke(xe))},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:xe=>{f||this.priority<xe&&(y?y.close():g.close())}}}}function di(l,s){return ve.defer(function(){s(l)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Hl}=H;var Fl=function(l,s,c,f,g,y){var E=Hl[c];if(!E)throw new Ye(c);var $=(!l.enabledTransports||rr(l.enabledTransports,s)!==-1)&&(!l.disabledTransports||rr(l.disabledTransports,s)===-1),q;return $?(g=Object.assign({ignoreNullOrigin:l.ignoreNullOrigin},g),q=new ql(s,f,y?y.getAssistant(E):E,g)):q=Bl,q},Bl={isSupported:function(){return!1},connect:function(l,s){var c=ve.defer(function(){s(new V)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function Gl(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 Wl=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let g=s.paramsProvider();for(var f in g)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return c},Jl=l=>{if(typeof H.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=Wl(s,l);H.getAuthorizers()[l.transport](H,f,l,x.UserAuthentication,c)}},Xl=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);c+="&channel_name="+encodeURIComponent(l.channelName);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let g=s.paramsProvider();for(var f in g)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(g[f])}return c},Vl=l=>{if(typeof H.getAuthorizers()[l.transport]>"u")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=Xl(s,l);H.getAuthorizers()[l.transport](H,f,l,x.ChannelAuthorization,c)}},Yl=(l,s,c)=>{const f={authTransport:s.transport,authEndpoint:s.endpoint,auth:{params:s.params,headers:s.headers}};return(g,y)=>{const E=l.channel(g.channelName);c(E,f).authorize(g.socketId,y)}};function pi(l,s){let c={activityTimeout:l.activityTimeout||m.activityTimeout,cluster:l.cluster,httpPath:l.httpPath||m.httpPath,httpPort:l.httpPort||m.httpPort,httpsPort:l.httpsPort||m.httpsPort,pongTimeout:l.pongTimeout||m.pongTimeout,statsHost:l.statsHost||m.stats_host,unavailableTimeout:l.unavailableTimeout||m.unavailableTimeout,wsPath:l.wsPath||m.wsPath,wsPort:l.wsPort||m.wsPort,wssPort:l.wssPort||m.wssPort,enableStats:nu(l),httpHost:Kl(l),useTLS:tu(l),wsHost:Ql(l),userAuthenticator:ru(l),channelAuthorizer:su(l,s)};return"disabledTransports"in l&&(c.disabledTransports=l.disabledTransports),"enabledTransports"in l&&(c.enabledTransports=l.enabledTransports),"ignoreNullOrigin"in l&&(c.ignoreNullOrigin=l.ignoreNullOrigin),"timelineParams"in l&&(c.timelineParams=l.timelineParams),"nacl"in l&&(c.nacl=l.nacl),c}function Kl(l){return l.httpHost?l.httpHost:l.cluster?`sockjs-${l.cluster}.pusher.com`:m.httpHost}function Ql(l){return l.wsHost?l.wsHost:eu(l.cluster)}function eu(l){return`ws-${l}.pusher.com`}function tu(l){return H.getProtocol()==="https:"?!0:l.forceTLS!==!1}function nu(l){return"enableStats"in l?l.enableStats:"disableStats"in l?!l.disableStats:!1}const hi=l=>"customHandler"in l&&l.customHandler!=null;function ru(l){const s=Object.assign(Object.assign({},m.userAuthentication),l.userAuthentication);return hi(s)?s.customHandler:Jl(s)}function ou(l,s){let c;if("channelAuthorization"in l)c=Object.assign(Object.assign({},m.channelAuthorization),l.channelAuthorization);else if(c={transport:l.authTransport||m.authTransport,endpoint:l.authEndpoint||m.authEndpoint},"auth"in l&&("params"in l.auth&&(c.params=l.auth.params),"headers"in l.auth&&(c.headers=l.auth.headers)),"authorizer"in l)return{customHandler:Yl(s,c,l.authorizer)};return c}function su(l,s){const c=ou(l,s);return hi(c)?c.customHandler:Vl(c)}class iu extends ft{constructor(s){super(function(c,f){ae.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=s,this.bindWatchlistInternalEvent()}handleEvent(s){s.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",s=>{var c=s.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(s)})}}function au(){let l,s;return{promise:new Promise((f,g)=>{l=f,s=g}),resolve:l,reject:s}}const cu=au;class lu extends ft{constructor(s){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=s,this.pusher.connection.bind("state_change",({previous:c,current:f})=>{c!=="connected"&&f==="connected"&&this._signin(),c==="connected"&&f!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new iu(s),this.pusher.connection.bind("message",c=>{var f=c.event;f==="pusher:signin_success"&&this._onSigninSuccess(c.data),this.serverToUserChannel&&this.serverToUserChannel.name===c.channel&&this.serverToUserChannel.handleEvent(c)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(s){try{this.user_data=JSON.parse(s.user_data)}catch{ae.error(`Failed parsing user data after signin: ${s.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 s=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)}),s(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:s,resolve:c}=cu();s.done=!1;const f=()=>{s.done=!0};s.then(f).catch(f),this.signinDonePromise=s,this._signinDoneResolve=c}}class Ie{static ready(){Ie.isReady=!0;for(var s=0,c=Ie.instances.length;s<c;s++)Ie.instances[s].connect()}static getClientFeatures(){return on(an({ws:H.Transports.ws},function(s){return s.isSupported({})}))}constructor(s,c){uu(s),Gl(c),this.key=s,this.options=c,this.config=pi(this.options,this),this.channels=Nt.createChannels(),this.global_emitter=new ft,this.sessionID=H.randomInt(1e9),this.timeline=new Zl(this.key,this.sessionID,{cluster:this.config.cluster,features:Ie.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:Kr.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=Nt.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+H.TimelineTransport.name}));var f=g=>H.getDefaultStrategy(this.config,g,Fl);this.connection=Nt.createConnectionManager(this.key,{getStrategy:f,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",g=>{var y=g.event,E=y.indexOf("pusher_internal:")===0;if(g.channel){var $=this.channel(g.channel);$&&$.handleEvent(g)}E||this.global_emitter.emit(g.event,g.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",g=>{ae.warn(g)}),Ie.instances.push(this),this.timeline.info({instances:Ie.instances.length}),this.user=new lu(this),Ie.isReady&&this.connect()}switchCluster(s){const{appKey:c,cluster:f}=s;this.key=c,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=pi(this.options,this),this.connection.switchCluster(this.key)}channel(s){return this.channels.find(s)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var s=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new Ze(6e4,function(){c.send(s)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(s,c,f){return this.global_emitter.bind(s,c,f),this}unbind(s,c,f){return this.global_emitter.unbind(s,c,f),this}bind_global(s){return this.global_emitter.bind_global(s),this}unbind_global(s){return this.global_emitter.unbind_global(s),this}unbind_all(s){return this.global_emitter.unbind_all(),this}subscribeAll(){var s;for(s in this.channels.channels)this.channels.channels.hasOwnProperty(s)&&this.subscribe(s)}subscribe(s){var c=this.channels.add(s,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(s){var c=this.channels.find(s);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(s),c&&c.subscribed&&c.unsubscribe())}send_event(s,c,f){return this.connection.send_event(s,c,f)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}Ie.instances=[],Ie.isReady=!1,Ie.logToConsole=!1,Ie.Runtime=H,Ie.ScriptReceivers=H.ScriptReceivers,Ie.DependenciesReceivers=H.DependenciesReceivers,Ie.auth_callbacks=H.auth_callbacks;const Qr=Ie;function uu(l){if(l==null)throw"You must pass your app key when you instantiate Pusher."}H.setup(Ie)}},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 i=o(721);return i})())})(fc);var Bg=fc.exports;const Gg=Fg(Bg),so={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 yt=null,zn=null;async function Wg(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();yt=new Gg(r.pusher.key,{cluster:r.pusher.cluster||"local",forceTLS:!0,wsHost:r.pusher.wsHost||void 0,wsPort:r.pusher.wssPort,wssPort:r.pusher.wssPort,enabledTransports:r.pusher.wsHost?["ws"]:void 0,channelAuthorization:{customHandler:({socketId:o,channelName:i},a)=>{fetch(`${t}/api/pusher/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({socket_id:o,channel_name:i})}).then(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 Jg(e){if(!e||!yt)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return yt.connection.bind("state_change",n),()=>yt==null?void 0:yt.connection.unbind("state_change",n)}async function Xg(e,t,n){if(await Wg(e),!yt)return()=>{};const r=yt.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(so.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(so.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(so.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(so.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=Jg(n.onReconnect);return()=>{r.unbind_all(),yt==null||yt.unsubscribe(`private-task-${t}`),o==null||o()}}const Ms="ap-sdk-active-automation";function Vg(){try{const e=sessionStorage.getItem(Ms);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 gc(e){try{sessionStorage.setItem(Ms,JSON.stringify(e))}catch{}}function mc(){try{sessionStorage.removeItem(Ms)}catch{}}async function Yg(e){var i;try{(i=e.focus)==null||i.call(e)}catch{}e.scrollIntoView({block:"center",inline:"center",behavior:"instant"});let t=e.getBoundingClientRect();t.width===0&&t.height===0&&(await Kg(),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 Kg(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const Us="shared",bc="ap-sdk-panel-size:",Vi=280,Yi=200;function Qg(e){try{const t=sessionStorage.getItem(bc+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 em(e,t){try{sessionStorage.setItem(bc+e,JSON.stringify(t))}catch{}}function io(e,t,n){return Math.min(Math.max(e,t),n)}function Ki(){return window.innerWidth-32}function Qi(){return window.innerHeight-64}function js(e,t){const n=Qg(t);n&&(e.style.width=`${io(n.width,Vi,Ki())}px`,e.style.height=`${io(n.height,Yi,Qi())}px`);const r=document.createElement("div");r.className="ap-sdk-resize-handle",r.setAttribute("data-ap-sdk","1"),e.appendChild(r);let o=!1,i=0,a=0,u=0,d=0,p=0,h=0;const k=_=>{o&&(p=io(u+(_.clientX-i),Vi,Ki()),h=io(d+(_.clientY-a),Yi,Qi()),e.style.width=`${p}px`,e.style.height=`${h}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",m),em(t,{width:p,height:h}))};r.addEventListener("pointerdown",_=>{_.preventDefault(),_.stopPropagation(),o=!0,i=_.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 Zs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Tn=Zs();function kc(e){Tn=e}var fn={exec:()=>null};function In(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,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(De.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var tm=((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:In(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:In(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:In(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:In(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:In(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:In(e=>new RegExp(`^ {0,${e}}>`))},nm=/^(?:[ \t]*(?:\n|$))+/,rm=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,om=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Or=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,sm=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,qs=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,_c=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,vc=G(_c).replace(/bull/g,qs).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(),im=G(_c).replace(/bull/g,qs).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(),Hs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,am=/^[^\n]+/,Fs=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,cm=G(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Fs).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),lm=G(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,qs).getRegex(),Wo="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",Bs=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,um=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",Bs).replace("tag",Wo).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),yc=e=>G(Hs).replace("hr",Or).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",Wo).getRegex(),dm=yc(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),pm=yc(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),hm=G(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",pm).getRegex(),Gs={blockquote:hm,code:rm,def:cm,fences:om,heading:sm,hr:Or,html:um,lheading:vc,list:lm,newline:nm,paragraph:dm,table:fn,text:am},ea=G("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Or).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",Wo).getRegex(),fm={...Gs,lheading:im,table:ea,paragraph:G(Hs).replace("hr",Or).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ea).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",Wo).getRegex()},gm={...Gs,html:G(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Bs).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:fn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:G(Hs).replace("hr",Or).replace("heading",` *#{1,6} *[^
|
|
1376
|
+
]`).replace("lheading",vc).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},mm=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,bm=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,wc=/^( {2,}|\\)\n(?!\s*$)/,km=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,qt=/[\p{P}\p{S}]/u,tr=/[\s\p{P}\p{S}]/u,Dr=/[^\s\p{P}\p{S}]/u,_m=G(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,tr).getRegex(),vm=/[\p{Pi}\p{Ps}"']/u,xc=/(?!~)[\p{P}\p{S}]/u,ym=/(?!~)[\s\p{P}\p{S}]/u,wm=/(?:[^\s\p{P}\p{S}]|~)/u,xm=G(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",tm?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Sc=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Sm=G(Sc,"u").replace(/punct/g,qt).getRegex(),Tm=G(Sc,"u").replace(/punct/g,xc).getRegex(),Em=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Am=G(Em,"u").replace(/openQuote/g,vm).replace(/punct/g,qt).getRegex(),Tc="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Cm=G(Tc,"gu").replace(/notPunctSpace/g,Dr).replace(/punctSpace/g,tr).replace(/punct/g,qt).getRegex(),Pm=G(Tc,"gu").replace(/notPunctSpace/g,wm).replace(/punctSpace/g,ym).replace(/punct/g,xc).getRegex(),Rm="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Lm=G(Rm,"gu").replace(/notPunctSpace/g,Dr).replace(/punctSpace/g,tr).replace(/punct/g,qt).getRegex(),zm=G("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Dr).replace(/punctSpace/g,tr).replace(/punct/g,qt).getRegex(),Im="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",$m=G(Im,"gu").replace(/notPunctSpace/g,Dr).replace(/punctSpace/g,tr).replace(/punct/g,qt).getRegex(),Nm=G(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,qt).getRegex(),Om="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Dm=G(Om,"gu").replace(/notPunctSpace/g,Dr).replace(/punctSpace/g,tr).replace(/punct/g,qt).getRegex(),Mm=G(/\\(punct)/,"gu").replace(/punct/g,qt).getRegex(),Um=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(),jm=G(Bs).replace("(?:-->|$)","-->").getRegex(),Zm=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",jm).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),zo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,qm=G(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",zo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ec=G(/^!?\[(label)\]\[(ref)\]/).replace("label",zo).replace("ref",Fs).getRegex(),Ac=G(/^!?\[(ref)\](?:\[\])?/).replace("ref",Fs).getRegex(),Hm=G("reflink|nolink(?!\\()","g").replace("reflink",Ec).replace("nolink",Ac).getRegex(),ta=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ws={_backpedal:fn,anyPunctuation:Mm,autolink:Um,blockSkip:xm,br:wc,code:bm,del:fn,delLDelim:fn,delRDelim:fn,emStrongLDelim:Sm,emStrongRDelimAst:Cm,emStrongRDelimUnd:zm,escape:mm,link:qm,nolink:Ac,punctuation:_m,reflink:Ec,reflinkSearch:Hm,tag:Zm,text:km,url:fn},Fm={...Ws,emStrongLDelim:Am,emStrongRDelimAst:Lm,emStrongRDelimUnd:$m,link:G(/^!?\[(label)\]\((.*?)\)/).replace("label",zo).getRegex(),reflink:G(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",zo).getRegex()},ys={...Ws,emStrongRDelimAst:Pm,emStrongLDelim:Tm,delLDelim:Nm,delRDelim:Dm,url:G(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ta).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:G(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ta).getRegex()},Bm={...ys,br:G(wc).replace("{2,}","*").getRegex(),text:G(ys.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ao={normal:Gs,gfm:fm,pedantic:gm},br={normal:Ws,gfm:ys,breaks:Bm,pedantic:Fm},Gm={"&":"&","<":"<",">":">",'"':""","'":"'"},na=e=>Gm[e];function xt(e,t){if(t){if(De.escapeTest.test(e))return e.replace(De.escapeReplace,na)}else if(De.escapeTestNoEncode.test(e))return e.replace(De.escapeReplaceNoEncode,na);return e}function ra(e){try{e=encodeURI(e).replace(De.percentDecode,"%")}catch{return null}return e}function oa(e,t){var i;let n=e.replace(De.findPipe,(a,u,d)=>{let p=!1,h=u;for(;--h>=0&&d[h]==="\\";)p=!p;return p?"|":" |"}),r=n.split(De.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(De.slashPipe,"|");return r}function Wt(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 sa(e){let t=e.split(`
|
|
1377
|
+
`),n=t.length-1;for(;n>=0&&De.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
1378
|
+
`)}function Wm(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 Jm(e,t=0){let n=t,r="";for(let o of e)if(o===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=o,n++;return r}function ia(e,t,n,r,o){let i=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:i,title:a,text:u,tokens:r.inlineTokens(u)};return r.state.inLink=!1,d}function Xm(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
|
|
1379
|
+
`).map(i=>{let a=i.match(n.other.beginningSpace);if(a===null)return i;let[u]=a;return u.length>=o.length?i.slice(o.length):i}).join(`
|
|
1380
|
+
`)}var Io=class{constructor(e){re(this,"options");re(this,"rules");re(this,"lexer");this.options=e||Tn}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]:sa(t[0]),r=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:r}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=Xm(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=Wt(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:Wt(t[0],`
|
|
1381
|
+
`),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Wt(t[0],`
|
|
1382
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=Wt(t[0],`
|
|
1239
1383
|
`).split(`
|
|
1240
|
-
`),r="",o="",
|
|
1384
|
+
`),r="",o="",i=[];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 p=u.join(`
|
|
1241
1385
|
`),h=p.replace(this.rules.other.blockquoteSetextReplace,`
|
|
1242
1386
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
1243
1387
|
${p}`:p,o=o?`${o}
|
|
1244
|
-
${h}`:h;let k=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,
|
|
1388
|
+
${h}`:h;let k=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,i,!0),this.lexer.state.top=k,n.length===0)break;let m=i.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){let _=m,w=n.join(`
|
|
1245
1389
|
`),P=_.raw+`
|
|
1246
|
-
`+w.replace(this.rules.other.blockquoteSetextReplace2,""),N=this.blockquote(P);
|
|
1390
|
+
`+w.replace(this.rules.other.blockquoteSetextReplace2,""),N=this.blockquote(P);i[i.length-1]=N,r=`${r}
|
|
1247
1391
|
${w}`,o=o.substring(0,o.length-_.text.length)+N.text;break}else if((m==null?void 0:m.type)==="list"){let _=m,w=_.raw+`
|
|
1248
1392
|
`+n.join(`
|
|
1249
|
-
`),P=this.list(w);
|
|
1250
|
-
`);continue}}return{type:"blockquote",raw:r,tokens:
|
|
1393
|
+
`),P=this.list(w);i[i.length-1]=P,r=r.substring(0,r.length-m.raw.length)+P.raw,o=o.substring(0,o.length-_.raw.length)+P.raw,n=w.substring(i.at(-1).raw.length).split(`
|
|
1394
|
+
`);continue}}return{type:"blockquote",raw:r,tokens:i,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,o={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let i=this.rules.other.listItemRegex(n),a=!1;for(;e;){let d=!1,p="",h="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let k=Jm(t[2].split(`
|
|
1251
1395
|
`,1)[0],t[1].length),m=e.split(`
|
|
1252
1396
|
`,1)[0],_=!k.trim(),w=0;if(this.options.pedantic?(w=2,h=k.trimStart()):_?w=t[1].length+1:(w=k.search(this.rules.other.nonSpaceChar),w=w>4?1:w,h=k.slice(w),w+=t[1].length),_&&this.rules.other.blankLine.test(m)&&(p+=m+`
|
|
1253
|
-
`,e=e.substring(m.length+1),d=!0),!d){let P=this.rules.other.nextBulletRegex(w),N=this.rules.other.hrRegex(w),
|
|
1254
|
-
`,1)[0],M;if(m=C,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),M=m):M=m.replace(this.rules.other.tabCharGlobal," "),
|
|
1255
|
-
`+M.slice(w);else{if(_||k.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||
|
|
1397
|
+
`,e=e.substring(m.length+1),d=!0),!d){let P=this.rules.other.nextBulletRegex(w),N=this.rules.other.hrRegex(w),ee=this.rules.other.fencesBeginRegex(w),R=this.rules.other.headingBeginRegex(w),x=this.rules.other.htmlBeginRegex(w),S=this.rules.other.blockquoteBeginRegex(w);for(;e;){let C=e.split(`
|
|
1398
|
+
`,1)[0],M;if(m=C,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),M=m):M=m.replace(this.rules.other.tabCharGlobal," "),ee.test(m)||R.test(m)||x.test(m)||S.test(m)||P.test(m)||N.test(m))break;if(M.search(this.rules.other.nonSpaceChar)>=w||!m.trim())h+=`
|
|
1399
|
+
`+M.slice(w);else{if(_||k.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||ee.test(k)||R.test(k)||N.test(k))break;h+=`
|
|
1256
1400
|
`+m}_=!m.trim(),p+=C+`
|
|
1257
|
-
`,e=e.substring(C.length+1),k=M.slice(w)}}o.loose||(
|
|
1258
|
-
`),href:r,title:o}}}table(e){var
|
|
1259
|
-
`):[],
|
|
1260
|
-
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let u of r)this.rules.other.tableAlignRight.test(u)?
|
|
1401
|
+
`,e=e.substring(C.length+1),k=M.slice(w)}}o.loose||(a?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(a=!0)),o.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),o.raw+=p}let u=o.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let d of o.items){this.lexer.state.top=!1,d.tokens=this.lexer.blockTokens(d.text,[]);let p=d.tokens[0];if(d.task&&((p==null?void 0:p.type)==="text"||(p==null?void 0:p.type)==="paragraph")){d.text=d.text.replace(this.rules.other.listReplaceTask,""),p.raw=p.raw.replace(this.rules.other.listReplaceTask,""),p.text=p.text.replace(this.rules.other.listReplaceTask,"");for(let k=this.lexer.inlineQueue.length-1;k>=0;k--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[k].src)){this.lexer.inlineQueue[k].src=this.lexer.inlineQueue[k].src.replace(this.rules.other.listReplaceTask,"");break}let h=this.rules.other.listTaskCheckbox.exec(d.raw);if(h){let k={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};d.checked=k.checked,o.loose?d.tokens[0]&&["paragraph","text"].includes(d.tokens[0].type)&&"tokens"in d.tokens[0]&&d.tokens[0].tokens?(d.tokens[0].raw=k.raw+d.tokens[0].raw,d.tokens[0].text=k.raw+d.tokens[0].text,d.tokens[0].tokens.unshift(k)):d.tokens.unshift({type:"paragraph",raw:k.raw,text:k.raw,tokens:[k]}):d.tokens.unshift(k)}}else d.task&&(d.task=!1);if(!o.loose){let h=d.tokens.filter(m=>m.type==="space"),k=h.length>0&&h.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=k}}if(o.loose)for(let d of o.items){d.loose=!0;for(let p of d.tokens)p.type==="text"&&(p.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=sa(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:Wt(t[0],`
|
|
1402
|
+
`),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=oa(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
|
+
`):[],i={type:"table",raw:Wt(t[0],`
|
|
1404
|
+
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let u of r)this.rules.other.tableAlignRight.test(u)?i.align.push("right"):this.rules.other.tableAlignCenter.test(u)?i.align.push("center"):this.rules.other.tableAlignLeft.test(u)?i.align.push("left"):i.align.push(null);for(let u=0;u<n.length;u++)i.header.push({text:n[u],tokens:this.lexer.inline(n[u]),header:!0,align:i.align[u]});for(let u of o)i.rows.push(oa(u,i.header.length).map((d,p)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:i.align[p]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:Wt(t[0],`
|
|
1261
1405
|
`),depth:t[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
|
|
1262
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let
|
|
1263
|
-
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var
|
|
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 i=Wt(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=Wm(t[2],"()");if(i===-2)return;if(i>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],o=i[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),ia(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[r.toLowerCase()];if(!o){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return ia(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,u=o,d=0,p=r[0][0],h=n===p,k=p==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(k.lastIndex=0,t=t.slice(-1*e.length+o);(r=k.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){u+=a;continue}else if(r[5]||r[6]){if(o%3&&!((o+a)%3)){d+=a;continue}if(h)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 P=_.slice(1,-1);return{type:"em",raw:_,text:P,tokens:this.lexer.inlineTokens(P)}}let w=_.slice(2,-2);return{type:"strong",raw:_,text:w,tokens:this.lexer.inlineTokens(w)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,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(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==o))continue;if(r[3]||r[4]){u+=a;continue}if(u-=a,u>0)continue;a=Math.min(a,a+u);let p=[...r[0]][0].length,h=e.slice(0,o+r.index+p+a),k=h.slice(o,-o);return{type:"del",raw:h,text:k,tokens:this.lexer.inlineTokens(k)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let r,o;if(t[2]==="@")r=t[0],o="mailto:"+r;else{let i;do i=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(i!==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}}}},_t=class ws{constructor(t){re(this,"tokens");re(this,"options");re(this,"state");re(this,"inlineQueue");re(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Tn,this.options.tokenizer=this.options.tokenizer||new Io,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:De,block:ao.normal,inline:br.normal};this.options.pedantic?(n.block=ao.pedantic,n.inline=br.pedantic):this.options.gfm&&(n.block=ao.gfm,this.options.breaks?n.inline=br.breaks:n.inline=br.gfm),this.tokenizer.rules=n}static get rules(){return{block:ao,inline:br}}static lex(t,n){return new ws(n).lex(t)}static lexInline(t,n){return new ws(n).inlineTokens(t)}lex(t){t=t.replace(De.carriageReturn,`
|
|
1407
|
+
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var i,a,u;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(De.tabCharGlobal," ").replace(De.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=(i=this.options.extensions)==null?void 0:i.block)!=null&&a.some(h=>(d=h.call({lexer:this},t,n))?(t=t.substring(d.raw.length),n.push(d),!0):!1))continue;if(d=this.tokenizer.space(t)){t=t.substring(d.raw.length);let h=n.at(-1);d.raw.length===1&&h!==void 0?h.raw+=`
|
|
1264
1408
|
`:n.push(d);continue}if(d=this.tokenizer.code(t)){t=t.substring(d.raw.length);let h=n.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
|
|
1265
1409
|
`)?"":`
|
|
1266
1410
|
`)+d.raw,h.text+=`
|
|
@@ -1273,27 +1417,27 @@ ${w}`,o=o.substring(0,o.length-_.text.length)+N.text;break}else if((m==null?void
|
|
|
1273
1417
|
`+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(d),r=p.length!==t.length,t=t.substring(d.raw.length);continue}if(d=this.tokenizer.text(t)){t=t.substring(d.raw.length);let h=n.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
|
|
1274
1418
|
`)?"":`
|
|
1275
1419
|
`)+d.raw,h.text+=`
|
|
1276
|
-
`+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(d);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var u,d,p,h,k;this.tokenizer.lexer=this;let r=t;if(this.tokens.links){let m=Object.keys(this.tokens.links);m.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,_=>m.includes(_.slice(_.lastIndexOf("[")+1,-1))?"["+"a".repeat(_.length-2)+"]":_))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(m,_,w)=>{let P=w?w.length:0;return m.slice(0,P)+"["+"a".repeat(m.length-P-2)+"]"}),r=((d=(u=this.options.hooks)==null?void 0:u.emStrongMask)==null?void 0:d.call({lexer:this},r))??r;let o=!1,
|
|
1277
|
-
`;return r?'<pre><code class="language-'+
|
|
1278
|
-
`:"<pre><code>"+(n?o:
|
|
1420
|
+
`+d.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(d);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var u,d,p,h,k;this.tokenizer.lexer=this;let r=t;if(this.tokens.links){let m=Object.keys(this.tokens.links);m.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,_=>m.includes(_.slice(_.lastIndexOf("[")+1,-1))?"["+"a".repeat(_.length-2)+"]":_))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(m,_,w)=>{let P=w?w.length:0;return m.slice(0,P)+"["+"a".repeat(m.length-P-2)+"]"}),r=((d=(u=this.options.hooks)==null?void 0:u.emStrongMask)==null?void 0:d.call({lexer:this},r))??r;let o=!1,i="",a=1/0;for(;t;){if(t.length<a)a=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}o||(i=""),o=!1;let m;if((h=(p=this.options.extensions)==null?void 0:p.inline)!=null&&h.some(w=>(m=w.call({lexer:this},t,n))?(t=t.substring(m.raw.length),n.push(m),!0):!1))continue;if(m=this.tokenizer.escape(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.tag(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.link(t)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(m.raw.length);let w=n.at(-1);m.type==="text"&&(w==null?void 0:w.type)==="text"?(w.raw+=m.raw,w.text+=m.text):n.push(m);continue}if(m=this.tokenizer.emStrong(t,r,i)){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,i)){t=t.substring(m.raw.length),n.push(m);continue}if(m=this.tokenizer.autolink(t)){t=t.substring(m.raw.length),n.push(m);continue}if(!this.state.inLink&&(m=this.tokenizer.url(t))){t=t.substring(m.raw.length),n.push(m);continue}let _=t;if((k=this.options.extensions)!=null&&k.startInline){let w=1/0,P=t.slice(1),N;this.options.extensions.startInline.forEach(ee=>{N=ee.call({lexer:this},P),typeof N=="number"&&N>=0&&(w=Math.min(w,N))}),w<1/0&&w>=0&&(_=t.substring(0,w+1))}if(m=this.tokenizer.inlineText(_)){t=t.substring(m.raw.length),m.raw.slice(-1)!=="_"&&(i=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)}},$o=class{constructor(e){re(this,"options");re(this,"parser");this.options=e||Tn}space(e){return""}code({text:e,lang:t,escaped:n}){var i;let r=(i=(t||"").match(De.notSpaceStart))==null?void 0:i[0],o=e.replace(De.endingNewline,"")+`
|
|
1421
|
+
`;return r?'<pre><code class="language-'+xt(r)+'">'+(n?o:xt(o,!0))+`</code></pre>
|
|
1422
|
+
`:"<pre><code>"+(n?o:xt(o,!0))+`</code></pre>
|
|
1279
1423
|
`}blockquote({tokens:e}){return`<blockquote>
|
|
1280
1424
|
${this.parser.parse(e)}</blockquote>
|
|
1281
1425
|
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
1282
1426
|
`}hr(e){return`<hr>
|
|
1283
|
-
`}list(e){let t=e.ordered,n=e.start,r="";for(let
|
|
1427
|
+
`}list(e){let t=e.ordered,n=e.start,r="";for(let a=0;a<e.items.length;a++){let u=e.items[a];r+=this.listitem(u)}let o=t?"ol":"ul",i=t&&n!==1?' start="'+n+'"':"";return"<"+o+i+`>
|
|
1284
1428
|
`+r+"</"+o+`>
|
|
1285
1429
|
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
1286
1430
|
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
1287
|
-
`}table(e){let t="",n="";for(let o=0;o<e.header.length;o++)n+=this.tablecell(e.header[o]);t+=this.tablerow({text:n});let r="";for(let o=0;o<e.rows.length;o++){let
|
|
1431
|
+
`}table(e){let t="",n="";for(let o=0;o<e.header.length;o++)n+=this.tablecell(e.header[o]);t+=this.tablerow({text:n});let r="";for(let o=0;o<e.rows.length;o++){let i=e.rows[o];n="";for(let a=0;a<i.length;a++)n+=this.tablecell(i[a]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
|
1288
1432
|
<thead>
|
|
1289
1433
|
`+t+`</thead>
|
|
1290
1434
|
`+r+`</table>
|
|
1291
1435
|
`}tablerow({text:e}){return`<tr>
|
|
1292
1436
|
${e}</tr>
|
|
1293
1437
|
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
1294
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${
|
|
1295
|
-
Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+_t(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},un=new Pm;function ie(e,t){return un.parse(e,t)}ie.options=ie.setOptions=function(e){return un.setOptions(e),ie.defaults=un.defaults,Ka(ie.defaults),ie};ie.getDefaults=Ti;ie.defaults=mn;function Rm(...e){return un.use(...e),ie.defaults=un.defaults,Ka(ie.defaults),ie}ie.use=Rm;ie.walkTokens=function(e,t){return un.walkTokens(e,t)};ie.parseInline=un.parseInline;ie.Parser=gt;ie.parser=gt.parse;ie.Renderer=vo;ie.TextRenderer=Li;ie.Lexer=ft;ie.lexer=ft.lex;ie.Tokenizer=_o;ie.Hooks=hr;ie.parse=ie;ie.options;ie.setOptions;ie.walkTokens;ie.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:cc,setPrototypeOf:Bs,isFrozen:zm,getPrototypeOf:Lm,getOwnPropertyDescriptor:Im}=Object;let{freeze:Be,seal:st,create:ui}=Object,{apply:di,construct:pi}=typeof Reflect<"u"&&Reflect;Be||(Be=function(t){return t});st||(st=function(t){return t});di||(di=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 Qr=Ge(Array.prototype.forEach),$m=Ge(Array.prototype.lastIndexOf),Gs=Ge(Array.prototype.pop),sr=Ge(Array.prototype.push),Nm=Ge(Array.prototype.splice),oo=Ge(String.prototype.toLowerCase),Jo=Ge(String.prototype.toString),Xo=Ge(String.prototype.match),ar=Ge(String.prototype.replace),Om=Ge(String.prototype.indexOf),Dm=Ge(String.prototype.trim),ht=Ge(Object.prototype.hasOwnProperty),qe=Ge(RegExp.prototype.test),cr=Mm(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 di(e,t,r)}}function Mm(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]:oo;Bs&&Bs(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const s=n(o);s!==o&&(zm(t)||(t[r]=s),o=s)}e[o]=!0}return e}function Um(e){for(let t=0;t<e.length;t++)ht(e,t)||(e[t]=null);return e}function vt(e){const t=ui(null);for(const[n,r]of cc(e))ht(e,n)&&(Array.isArray(r)?t[n]=Um(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=vt(r):t[n]=r);return t}function lr(e,t){for(;e!==null;){const r=Im(e,t);if(r){if(r.get)return Ge(r.get);if(typeof r.value=="function")return Ge(r.value)}e=Lm(e)}function n(){return null}return n}const Ws=Be(["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"]),Vo=Be(["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"]),Yo=Be(["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"]),jm=Be(["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"]),Ko=Be(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Zm=Be(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Js=Be(["#text"]),Xs=Be(["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"]),Qo=Be(["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"]),Vs=Be(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),eo=Be(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),qm=st(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Fm=st(/<%[\w\W]*|[\w\W]*%>/gm),Hm=st(/\$\{[\w\W]*/gm),Bm=st(/^data-[\-\w.\u00B7-\uFFFF]+$/),Gm=st(/^aria-[\-\w]+$/),lc=st(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Wm=st(/^(?:\w+script|data):/i),Jm=st(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),uc=st(/^html$/i),Xm=st(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ys=Object.freeze({__proto__:null,ARIA_ATTR:Gm,ATTR_WHITESPACE:Jm,CUSTOM_ELEMENT:Xm,DATA_ATTR:Bm,DOCTYPE_NAME:uc,ERB_EXPR:Fm,IS_ALLOWED_URI:lc,IS_SCRIPT_OR_DATA:Wm,MUSTACHE_EXPR:qm,TMPLIT_EXPR:Hm});const ur={element:1,text:3,progressingInstruction:7,comment:8,document:9},Vm=function(){return typeof window>"u"?null:window},Ym=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},Ks=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function dc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Vm();const t=O=>dc(O);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==ur.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:c,Node:u,Element:d,NodeFilter:p,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:k,DOMParser:m,trustedTypes:_}=e,w=d.prototype,P=lr(w,"cloneNode"),N=lr(w,"remove"),te=lr(w,"nextSibling"),R=lr(w,"childNodes"),x=lr(w,"parentNode");if(typeof c=="function"){const O=n.createElement("template");O.content&&O.content.ownerDocument&&(n=O.content.ownerDocument)}let S,C="";const{implementation:M,createNodeIterator:se,createDocumentFragment:ke,getElementsByTagName:Pe}=n,{importNode:We}=r;let V=Ks();t.isSupported=typeof cc=="function"&&typeof x=="function"&&M&&M.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ge,ERB_EXPR:Je,TMPLIT_EXPR:Nt,DATA_ATTR:j,ARIA_ATTR:Q,IS_SCRIPT_OR_DATA:Re,ATTR_WHITESPACE:Ie,CUSTOM_ELEMENT:bt}=Ys;let{IS_ALLOWED_URI:ct}=Ys,me=null;const Se=B({},[...Ws,...Vo,...Yo,...Ko,...Js]);let W=null;const Me=B({},[...Xs,...Qo,...Vs,...eo]);let J=Object.seal(ui(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}})),Ue=null,Xe=null;const je=Object.seal(ui(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let _e=!0,Ee=!0,Pr=!1,Bn=!0,$e=!1,Xt=!0,Tt=!1,Et=!1,bn=!1,Ot=!1,Vt=!1,Yt=!1,Rr=!0,Gn=!1;const $o="user-content-";let Wn=!0,Kt=!1,Dt={},Ze=null;const Jn=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 zr=B({},["audio","video","img","source","image","track"]);let Xn=null;const Lr=B({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),kn="http://www.w3.org/1998/Math/MathML",_n="http://www.w3.org/2000/svg",lt="http://www.w3.org/1999/xhtml";let Mt=lt,Qt=!1,en=null;const No=B({},[kn,_n,lt],Jo);let vn=B({},["mi","mo","mn","ms","mtext"]),yn=B({},["annotation-xml"]);const Oo=B({},["title","style","font","a","script"]);let At=null;const ut=["application/xhtml+xml","text/html"],Do="text/html";let ce=null,Ut=null;const Ir=n.createElement("form"),Vn=function(b){return b instanceof RegExp||b instanceof Function},wn=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ut&&Ut===b)){if((!b||typeof b!="object")&&(b={}),b=vt(b),At=ut.indexOf(b.PARSER_MEDIA_TYPE)===-1?Do:b.PARSER_MEDIA_TYPE,ce=At==="application/xhtml+xml"?Jo:oo,me=ht(b,"ALLOWED_TAGS")?B({},b.ALLOWED_TAGS,ce):Se,W=ht(b,"ALLOWED_ATTR")?B({},b.ALLOWED_ATTR,ce):Me,en=ht(b,"ALLOWED_NAMESPACES")?B({},b.ALLOWED_NAMESPACES,Jo):No,Xn=ht(b,"ADD_URI_SAFE_ATTR")?B(vt(Lr),b.ADD_URI_SAFE_ATTR,ce):Lr,ae=ht(b,"ADD_DATA_URI_TAGS")?B(vt(zr),b.ADD_DATA_URI_TAGS,ce):zr,Ze=ht(b,"FORBID_CONTENTS")?B({},b.FORBID_CONTENTS,ce):Jn,Ue=ht(b,"FORBID_TAGS")?B({},b.FORBID_TAGS,ce):vt({}),Xe=ht(b,"FORBID_ATTR")?B({},b.FORBID_ATTR,ce):vt({}),Dt=ht(b,"USE_PROFILES")?b.USE_PROFILES:!1,_e=b.ALLOW_ARIA_ATTR!==!1,Ee=b.ALLOW_DATA_ATTR!==!1,Pr=b.ALLOW_UNKNOWN_PROTOCOLS||!1,Bn=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,$e=b.SAFE_FOR_TEMPLATES||!1,Xt=b.SAFE_FOR_XML!==!1,Tt=b.WHOLE_DOCUMENT||!1,Ot=b.RETURN_DOM||!1,Vt=b.RETURN_DOM_FRAGMENT||!1,Yt=b.RETURN_TRUSTED_TYPE||!1,bn=b.FORCE_BODY||!1,Rr=b.SANITIZE_DOM!==!1,Gn=b.SANITIZE_NAMED_PROPS||!1,Wn=b.KEEP_CONTENT!==!1,Kt=b.IN_PLACE||!1,ct=b.ALLOWED_URI_REGEXP||lc,Mt=b.NAMESPACE||lt,vn=b.MATHML_TEXT_INTEGRATION_POINTS||vn,yn=b.HTML_INTEGRATION_POINTS||yn,J=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&Vn(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(J.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&Vn(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),$e&&(Ee=!1),Vt&&(Ot=!0),Dt&&(me=B({},Js),W=[],Dt.html===!0&&(B(me,Ws),B(W,Xs)),Dt.svg===!0&&(B(me,Vo),B(W,Qo),B(W,eo)),Dt.svgFilters===!0&&(B(me,Yo),B(W,Qo),B(W,eo)),Dt.mathMl===!0&&(B(me,Ko),B(W,Vs),B(W,eo))),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?je.tagCheck=b.ADD_TAGS:(me===Se&&(me=vt(me)),B(me,b.ADD_TAGS,ce))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?je.attributeCheck=b.ADD_ATTR:(W===Me&&(W=vt(W)),B(W,b.ADD_ATTR,ce))),b.ADD_URI_SAFE_ATTR&&B(Xn,b.ADD_URI_SAFE_ATTR,ce),b.FORBID_CONTENTS&&(Ze===Jn&&(Ze=vt(Ze)),B(Ze,b.FORBID_CONTENTS,ce)),b.ADD_FORBID_CONTENTS&&(Ze===Jn&&(Ze=vt(Ze)),B(Ze,b.ADD_FORBID_CONTENTS,ce)),Wn&&(me["#text"]=!0),Tt&&B(me,["html","head","body"]),me.table&&(B(me,["tbody"]),delete Ue.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw cr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw cr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=b.TRUSTED_TYPES_POLICY,C=S.createHTML("")}else S===void 0&&(S=Ym(_,o)),S!==null&&typeof C=="string"&&(C=S.createHTML(""));Be&&Be(b),Ut=b}},Yn=B({},[...Vo,...Yo,...jm]),$r=B({},[...Ko,...Zm]),Mo=function(b){let T=x(b);(!T||!T.tagName)&&(T={namespaceURI:Mt,tagName:"template"});const z=oo(b.tagName),ne=oo(T.tagName);return en[b.namespaceURI]?b.namespaceURI===_n?T.namespaceURI===lt?z==="svg":T.namespaceURI===kn?z==="svg"&&(ne==="annotation-xml"||vn[ne]):!!Yn[z]:b.namespaceURI===kn?T.namespaceURI===lt?z==="math":T.namespaceURI===_n?z==="math"&&yn[ne]:!!$r[z]:b.namespaceURI===lt?T.namespaceURI===_n&&!yn[ne]||T.namespaceURI===kn&&!vn[ne]?!1:!$r[z]&&(Oo[z]||!Yn[z]):!!(At==="application/xhtml+xml"&&en[b.namespaceURI]):!1},Qe=function(b){sr(t.removed,{element:b});try{x(b).removeChild(b)}catch{N(b)}},et=function(b,T){try{sr(t.removed,{attribute:T.getAttributeNode(b),from:T})}catch{sr(t.removed,{attribute:null,from:T})}if(T.removeAttribute(b),b==="is")if(Ot||Vt)try{Qe(T)}catch{}else try{T.setAttribute(b,"")}catch{}},Nr=function(b){let T=null,z=null;if(bn)b="<remove></remove>"+b;else{const ve=Xo(b,/^[\r\n\t ]+/);z=ve&&ve[0]}At==="application/xhtml+xml"&&Mt===lt&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const ne=S?S.createHTML(b):b;if(Mt===lt)try{T=new m().parseFromString(ne,At)}catch{}if(!T||!T.documentElement){T=M.createDocument(Mt,"template",null);try{T.documentElement.innerHTML=Qt?C:ne}catch{}}const Ae=T.body||T.documentElement;return b&&z&&Ae.insertBefore(n.createTextNode(z),Ae.childNodes[0]||null),Mt===lt?Pe.call(T,Tt?"html":"body")[0]:Tt?T.documentElement:Ae},Kn=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)},Qn=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")},Or=function(b){return typeof u=="function"&&b instanceof u};function dt(O,b,T){Qr(O,z=>{z.call(t,b,T,Ut)})}const Dr=function(b){let T=null;if(dt(V.beforeSanitizeElements,b,null),Qn(b))return Qe(b),!0;const z=ce(b.nodeName);if(dt(V.uponSanitizeElement,b,{tagName:z,allowedTags:me}),Xt&&b.hasChildNodes()&&!Or(b.firstElementChild)&&qe(/<[/\w!]/g,b.innerHTML)&&qe(/<[/\w!]/g,b.textContent)||b.nodeType===ur.progressingInstruction||Xt&&b.nodeType===ur.comment&&qe(/<[/\w]/g,b.data))return Qe(b),!0;if(!(je.tagCheck instanceof Function&&je.tagCheck(z))&&(!me[z]||Ue[z])){if(!Ue[z]&&Ur(z)&&(J.tagNameCheck instanceof RegExp&&qe(J.tagNameCheck,z)||J.tagNameCheck instanceof Function&&J.tagNameCheck(z)))return!1;if(Wn&&!Ze[z]){const ne=x(b)||b.parentNode,Ae=R(b)||b.childNodes;if(Ae&&ne){const ve=Ae.length;for(let Ne=ve-1;Ne>=0;--Ne){const pt=P(Ae[Ne],!0);pt.__removalCount=(b.__removalCount||0)+1,ne.insertBefore(pt,te(b))}}}return Qe(b),!0}return b instanceof d&&!Mo(b)||(z==="noscript"||z==="noembed"||z==="noframes")&&qe(/<\/no(script|embed|frames)/i,b.innerHTML)?(Qe(b),!0):($e&&b.nodeType===ur.text&&(T=b.textContent,Qr([ge,Je,Nt],ne=>{T=ar(T,ne," ")}),b.textContent!==T&&(sr(t.removed,{element:b.cloneNode()}),b.textContent=T)),dt(V.afterSanitizeElements,b,null),!1)},Mr=function(b,T,z){if(Rr&&(T==="id"||T==="name")&&(z in n||z in Ir))return!1;if(!(Ee&&!Xe[T]&&qe(j,T))){if(!(_e&&qe(Q,T))){if(!(je.attributeCheck instanceof Function&&je.attributeCheck(T,b))){if(!W[T]||Xe[T]){if(!(Ur(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,z)||J.tagNameCheck instanceof Function&&J.tagNameCheck(z))))return!1}else if(!Xn[T]){if(!qe(ct,ar(z,Ie,""))){if(!((T==="src"||T==="xlink:href"||T==="href")&&b!=="script"&&Om(z,"data:")===0&&ae[b])){if(!(Pr&&!qe(Re,ar(z,Ie,"")))){if(z)return!1}}}}}}}return!0},Ur=function(b){return b!=="annotation-xml"&&Xo(b,bt)},er=function(b){dt(V.beforeSanitizeAttributes,b,null);const{attributes:T}=b;if(!T||Qn(b))return;const z={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:W,forceKeepAttr:void 0};let ne=T.length;for(;ne--;){const Ae=T[ne],{name:ve,namespaceURI:Ne,value:pt}=Ae,kt=ce(ve),tr=pt;let Te=ve==="value"?tr:Dm(tr);if(z.attrName=kt,z.attrValue=Te,z.keepAttr=!0,z.forceKeepAttr=void 0,dt(V.uponSanitizeAttribute,b,z),Te=z.attrValue,Gn&&(kt==="id"||kt==="name")&&(et(ve,b),Te=$o+Te),Xt&&qe(/((--!?|])>)|<\/(style|title|textarea)/i,Te)){et(ve,b);continue}if(kt==="attributename"&&Xo(Te,"href")){et(ve,b);continue}if(z.forceKeepAttr)continue;if(!z.keepAttr){et(ve,b);continue}if(!Bn&&qe(/\/>/i,Te)){et(ve,b);continue}$e&&Qr([ge,Je,Nt],Zr=>{Te=ar(Te,Zr," ")});const jr=ce(b.nodeName);if(!Mr(jr,kt,Te)){et(ve,b);continue}if(S&&typeof _=="object"&&typeof _.getAttributeType=="function"&&!Ne)switch(_.getAttributeType(jr,kt)){case"TrustedHTML":{Te=S.createHTML(Te);break}case"TrustedScriptURL":{Te=S.createScriptURL(Te);break}}if(Te!==tr)try{Ne?b.setAttributeNS(Ne,ve,Te):b.setAttribute(ve,Te),Qn(b)?Qe(b):Gs(t.removed)}catch{et(ve,b)}}dt(V.afterSanitizeAttributes,b,null)},Ct=function O(b){let T=null;const z=Kn(b);for(dt(V.beforeSanitizeShadowDOM,b,null);T=z.nextNode();)dt(V.uponSanitizeShadowNode,T,null),Dr(T),er(T),T.content instanceof s&&O(T.content);dt(V.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(O){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},T=null,z=null,ne=null,Ae=null;if(Qt=!O,Qt&&(O="<!-->"),typeof O!="string"&&!Or(O))if(typeof O.toString=="function"){if(O=O.toString(),typeof O!="string")throw cr("dirty is not a string, aborting")}else throw cr("toString is not a function");if(!t.isSupported)return O;if(Et||wn(b),t.removed=[],typeof O=="string"&&(Kt=!1),Kt){if(O.nodeName){const pt=ce(O.nodeName);if(!me[pt]||Ue[pt])throw cr("root node is forbidden and cannot be sanitized in-place")}}else if(O instanceof u)T=Nr("<!---->"),z=T.ownerDocument.importNode(O,!0),z.nodeType===ur.element&&z.nodeName==="BODY"||z.nodeName==="HTML"?T=z:T.appendChild(z);else{if(!Ot&&!$e&&!Tt&&O.indexOf("<")===-1)return S&&Yt?S.createHTML(O):O;if(T=Nr(O),!T)return Ot?null:Yt?C:""}T&&bn&&Qe(T.firstChild);const ve=Kn(Kt?O:T);for(;ne=ve.nextNode();)Dr(ne),er(ne),ne.content instanceof s&&Ct(ne.content);if(Kt)return O;if(Ot){if(Vt)for(Ae=ke.call(T.ownerDocument);T.firstChild;)Ae.appendChild(T.firstChild);else Ae=T;return(W.shadowroot||W.shadowrootmode)&&(Ae=We.call(r,Ae,!0)),Ae}let Ne=Tt?T.outerHTML:T.innerHTML;return Tt&&me["!doctype"]&&T.ownerDocument&&T.ownerDocument.doctype&&T.ownerDocument.doctype.name&&qe(uc,T.ownerDocument.doctype.name)&&(Ne="<!DOCTYPE "+T.ownerDocument.doctype.name+`>
|
|
1296
|
-
`+Ne
|
|
1438
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${xt(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),o=ra(e);if(o===null)return r;e=o;let i='<a href="'+e+'"';return t&&(i+=' title="'+xt(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let o=ra(e);if(o===null)return xt(n);e=o;let i=`<img src="${e}" alt="${xt(n)}"`;return t&&(i+=` title="${xt(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:xt(e.text)}},Js=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},vt=class xs{constructor(t){re(this,"options");re(this,"renderer");re(this,"textRenderer");this.options=t||Tn,this.options.renderer=this.options.renderer||new $o,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Js}static parse(t,n){return new xs(n).parse(t)}static parseInline(t,n){return new xs(n).parseInline(t)}parse(t){var r,o;this.renderer.parser=this;let n="";for(let i=0;i<t.length;i++){let a=t[i];if((o=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&o[a.type]){let d=a,p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(d.type)){n+=p||"";continue}}let u=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,i;this.renderer.parser=this;let r="";for(let a=0;a<t.length;a++){let u=t[a];if((i=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&i[u.type]){let p=this.options.extensions.renderers[u.type].call({parser:this},u);if(p!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(u.type)){r+=p||"";continue}}let d=u;switch(d.type){case"escape":{r+=n.text(d);break}case"html":{r+=n.html(d);break}case"link":{r+=n.link(d);break}case"image":{r+=n.image(d);break}case"checkbox":{r+=n.checkbox(d);break}case"strong":{r+=n.strong(d);break}case"em":{r+=n.em(d);break}case"codespan":{r+=n.codespan(d);break}case"br":{r+=n.br(d);break}case"del":{r+=n.del(d);break}case"text":{r+=n.text(d);break}default:{let p='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return r}},ho,Er=(ho=class{constructor(e){re(this,"options");re(this,"block");this.options=e||Tn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?_t.lex:_t.lexInline}provideParser(e=this.block){return e?vt.parse:vt.parseInline}},re(ho,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),re(ho,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),ho),Vm=class{constructor(...e){re(this,"defaults",Zs());re(this,"options",this.setOptions);re(this,"parse",this.parseMarkdown(!0));re(this,"parseInline",this.parseMarkdown(!1));re(this,"Parser",vt);re(this,"Renderer",$o);re(this,"TextRenderer",Js);re(this,"Lexer",_t);re(this,"Tokenizer",Io);re(this,"Hooks",Er);this.use(...e)}walkTokens(e,t){var r,o;let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let a=i;for(let 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=i;n=n.concat(this.walkTokens(a.items,t));break}default:{let a=i;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(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 i=t.renderers[o.name];i?t.renderers[o.name]=function(...a){let u=o.renderer.apply(this,a);return u===!1&&(u=i.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 i=t[o.level];i?i.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),r.extensions=t),n.renderer){let o=this.defaults.renderer||new $o(this.defaults);for(let i in n.renderer){if(!(i in o))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let a=i,u=n.renderer[a],d=o[a];o[a]=(...p)=>{let h=u.apply(o,p);return h===!1&&(h=d.apply(o,p)),h||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new Io(this.defaults);for(let i in n.tokenizer){if(!(i in o))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,u=n.tokenizer[a],d=o[a];o[a]=(...p)=>{let h=u.apply(o,p);return h===!1&&(h=d.apply(o,p)),h}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new Er;for(let i in n.hooks){if(!(i in o))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,u=n.hooks[a],d=o[a];Er.passThroughHooks.has(i)?o[a]=p=>{if(this.defaults.async&&Er.passThroughHooksRespectAsync.has(i))return(async()=>{let k=await u.call(o,p);return d.call(o,k)})();let h=u.call(o,p);return d.call(o,h)}:o[a]=(...p)=>{if(this.defaults.async)return(async()=>{let k=await u.apply(o,p);return k===!1&&(k=await d.apply(o,p)),k})();let h=u.apply(o,p);return h===!1&&(h=d.apply(o,p)),h}}r.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(a){let u=[];return u.push(i.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 _t.lex(e,t??this.defaults)}parser(e,t){return vt.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},o={...this.defaults,...r},i=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return(async()=>{let a=o.hooks?await o.hooks.preprocess(t):t,u=await(o.hooks?await o.hooks.provideLexer(e):e?_t.lex:_t.lexInline)(a,o),d=o.hooks?await o.hooks.processAllTokens(u):u;o.walkTokens&&await Promise.all(this.walkTokens(d,o.walkTokens));let p=await(o.hooks?await o.hooks.provideParser(e):e?vt.parse:vt.parseInline)(d,o);return o.hooks?await o.hooks.postprocess(p):p})().catch(i);try{o.hooks&&(t=o.hooks.preprocess(t));let a=(o.hooks?o.hooks.provideLexer(e):e?_t.lex:_t.lexInline)(t,o);o.hooks&&(a=o.hooks.processAllTokens(a)),o.walkTokens&&this.walkTokens(a,o.walkTokens);let u=(o.hooks?o.hooks.provideParser(e):e?vt.parse:vt.parseInline)(a,o);return o.hooks&&(u=o.hooks.postprocess(u)),u}catch(a){return i(a)}}}onError(e,t){return n=>{if(n.message+=`
|
|
1439
|
+
Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+xt(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},vn=new Vm;function se(e,t){return vn.parse(e,t)}se.options=se.setOptions=function(e){return vn.setOptions(e),se.defaults=vn.defaults,kc(se.defaults),se};se.getDefaults=Zs;se.defaults=Tn;function Ym(...e){return vn.use(...e),se.defaults=vn.defaults,kc(se.defaults),se}se.use=Ym;se.walkTokens=function(e,t){return vn.walkTokens(e,t)};se.parseInline=vn.parseInline;se.Parser=vt;se.parser=vt.parse;se.Renderer=$o;se.TextRenderer=Js;se.Lexer=_t;se.lexer=_t.lex;se.Tokenizer=Io;se.Hooks=Er;se.parse=se;se.options;se.setOptions;se.walkTokens;se.parseInline;vt.parse;_t.lex;/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:Cc,setPrototypeOf:aa,isFrozen:Km,getPrototypeOf:Qm,getOwnPropertyDescriptor:eb}=Object;let{freeze:Xe,seal:lt,create:Ss}=Object,{apply:Ts,construct:Es}=typeof Reflect<"u"&&Reflect;Xe||(Xe=function(t){return t});lt||(lt=function(t){return t});Ts||(Ts=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return t.apply(n,o)});Es||(Es=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 co=Ve(Array.prototype.forEach),tb=Ve(Array.prototype.lastIndexOf),ca=Ve(Array.prototype.pop),kr=Ve(Array.prototype.push),nb=Ve(Array.prototype.splice),mo=Ve(String.prototype.toLowerCase),cs=Ve(String.prototype.toString),ls=Ve(String.prototype.match),_r=Ve(String.prototype.replace),rb=Ve(String.prototype.indexOf),ob=Ve(String.prototype.trim),bt=Ve(Object.prototype.hasOwnProperty),Fe=Ve(RegExp.prototype.test),vr=sb(TypeError);function Ve(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 Ts(e,t,r)}}function sb(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Es(e,n)}}function B(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:mo;aa&&aa(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(Km(t)||(t[r]=i),o=i)}e[o]=!0}return e}function ib(e){for(let t=0;t<e.length;t++)bt(e,t)||(e[t]=null);return e}function St(e){const t=Ss(null);for(const[n,r]of Cc(e))bt(e,n)&&(Array.isArray(r)?t[n]=ib(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=St(r):t[n]=r);return t}function yr(e,t){for(;e!==null;){const r=eb(e,t);if(r){if(r.get)return Ve(r.get);if(typeof r.value=="function")return Ve(r.value)}e=Qm(e)}function n(){return null}return n}const la=Xe(["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"]),us=Xe(["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"]),ds=Xe(["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"]),ab=Xe(["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"]),ps=Xe(["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"]),cb=Xe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ua=Xe(["#text"]),da=Xe(["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"]),hs=Xe(["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"]),pa=Xe(["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"]),lo=Xe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),lb=lt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ub=lt(/<%[\w\W]*|[\w\W]*%>/gm),db=lt(/\$\{[\w\W]*/gm),pb=lt(/^data-[\-\w.\u00B7-\uFFFF]+$/),hb=lt(/^aria-[\-\w]+$/),Pc=lt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),fb=lt(/^(?:\w+script|data):/i),gb=lt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Rc=lt(/^html$/i),mb=lt(/^[a-z][.\w]*(-[.\w]+)+$/i);var ha=Object.freeze({__proto__:null,ARIA_ATTR:hb,ATTR_WHITESPACE:gb,CUSTOM_ELEMENT:mb,DATA_ATTR:pb,DOCTYPE_NAME:Rc,ERB_EXPR:ub,IS_ALLOWED_URI:Pc,IS_SCRIPT_OR_DATA:fb,MUSTACHE_EXPR:lb,TMPLIT_EXPR:db});const wr={element:1,text:3,progressingInstruction:7,comment:8,document:9},bb=function(){return typeof window>"u"?null:window},kb=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},fa=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Lc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:bb();const t=O=>Lc(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:i,HTMLTemplateElement:a,Node:u,Element:d,NodeFilter:p,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:k,DOMParser:m,trustedTypes:_}=e,w=d.prototype,P=yr(w,"cloneNode"),N=yr(w,"remove"),ee=yr(w,"nextSibling"),R=yr(w,"childNodes"),x=yr(w,"parentNode");if(typeof a=="function"){const O=n.createElement("template");O.content&&O.content.ownerDocument&&(n=O.content.ownerDocument)}let S,C="";const{implementation:M,createNodeIterator:ie,createDocumentFragment:ke,getElementsByTagName:ze}=n,{importNode:Ye}=r;let V=fa();t.isSupported=typeof Cc=="function"&&typeof x=="function"&&M&&M.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:_e,ERB_EXPR:Ke,TMPLIT_EXPR:Z,DATA_ATTR:te,ARIA_ATTR:Ce,IS_SCRIPT_OR_DATA:Pe,ATTR_WHITESPACE:dt,CUSTOM_ELEMENT:pt}=ha;let{IS_ALLOWED_URI:rn}=ha,ge=null;const Ee=B({},[...la,...us,...ds,...ps,...ua]);let W=null;const Ue=B({},[...da,...hs,...pa,...lo]);let J=Object.seal(Ss(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,Ze=null;const qe=Object.seal(Ss(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ve=!0,me=!0,Mr=!1,rr=!0,Ne=!1,on=!0,Lt=!1,zt=!1,En=!1,Ht=!1,sn=!1,an=!1,Ur=!0,or=!1;const Jo="user-content-";let sr=!0,cn=!1,Ft={},He=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 ae=null;const jr=B({},["audio","video","img","source","image","track"]);let ar=null;const Zr=B({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),An="http://www.w3.org/1998/Math/MathML",Cn="http://www.w3.org/2000/svg",ht="http://www.w3.org/1999/xhtml";let Bt=ht,ln=!1,un=null;const Xo=B({},[An,Cn,ht],cs);let Pn=B({},["mi","mo","mn","ms","mtext"]),Rn=B({},["annotation-xml"]);const Vo=B({},["title","style","font","a","script"]);let It=null;const ft=["application/xhtml+xml","text/html"],Yo="text/html";let ce=null,Gt=null;const qr=n.createElement("form"),cr=function(b){return b instanceof RegExp||b instanceof Function},Ln=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Gt&&Gt===b)){if((!b||typeof b!="object")&&(b={}),b=St(b),It=ft.indexOf(b.PARSER_MEDIA_TYPE)===-1?Yo:b.PARSER_MEDIA_TYPE,ce=It==="application/xhtml+xml"?cs:mo,ge=bt(b,"ALLOWED_TAGS")?B({},b.ALLOWED_TAGS,ce):Ee,W=bt(b,"ALLOWED_ATTR")?B({},b.ALLOWED_ATTR,ce):Ue,un=bt(b,"ALLOWED_NAMESPACES")?B({},b.ALLOWED_NAMESPACES,cs):Xo,ar=bt(b,"ADD_URI_SAFE_ATTR")?B(St(Zr),b.ADD_URI_SAFE_ATTR,ce):Zr,ae=bt(b,"ADD_DATA_URI_TAGS")?B(St(jr),b.ADD_DATA_URI_TAGS,ce):jr,He=bt(b,"FORBID_CONTENTS")?B({},b.FORBID_CONTENTS,ce):ir,je=bt(b,"FORBID_TAGS")?B({},b.FORBID_TAGS,ce):St({}),Ze=bt(b,"FORBID_ATTR")?B({},b.FORBID_ATTR,ce):St({}),Ft=bt(b,"USE_PROFILES")?b.USE_PROFILES:!1,ve=b.ALLOW_ARIA_ATTR!==!1,me=b.ALLOW_DATA_ATTR!==!1,Mr=b.ALLOW_UNKNOWN_PROTOCOLS||!1,rr=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ne=b.SAFE_FOR_TEMPLATES||!1,on=b.SAFE_FOR_XML!==!1,Lt=b.WHOLE_DOCUMENT||!1,Ht=b.RETURN_DOM||!1,sn=b.RETURN_DOM_FRAGMENT||!1,an=b.RETURN_TRUSTED_TYPE||!1,En=b.FORCE_BODY||!1,Ur=b.SANITIZE_DOM!==!1,or=b.SANITIZE_NAMED_PROPS||!1,sr=b.KEEP_CONTENT!==!1,cn=b.IN_PLACE||!1,rn=b.ALLOWED_URI_REGEXP||Pc,Bt=b.NAMESPACE||ht,Pn=b.MATHML_TEXT_INTEGRATION_POINTS||Pn,Rn=b.HTML_INTEGRATION_POINTS||Rn,J=b.CUSTOM_ELEMENT_HANDLING||{},b.CUSTOM_ELEMENT_HANDLING&&cr(b.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(J.tagNameCheck=b.CUSTOM_ELEMENT_HANDLING.tagNameCheck),b.CUSTOM_ELEMENT_HANDLING&&cr(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),Ne&&(me=!1),sn&&(Ht=!0),Ft&&(ge=B({},ua),W=[],Ft.html===!0&&(B(ge,la),B(W,da)),Ft.svg===!0&&(B(ge,us),B(W,hs),B(W,lo)),Ft.svgFilters===!0&&(B(ge,ds),B(W,hs),B(W,lo)),Ft.mathMl===!0&&(B(ge,ps),B(W,pa),B(W,lo))),b.ADD_TAGS&&(typeof b.ADD_TAGS=="function"?qe.tagCheck=b.ADD_TAGS:(ge===Ee&&(ge=St(ge)),B(ge,b.ADD_TAGS,ce))),b.ADD_ATTR&&(typeof b.ADD_ATTR=="function"?qe.attributeCheck=b.ADD_ATTR:(W===Ue&&(W=St(W)),B(W,b.ADD_ATTR,ce))),b.ADD_URI_SAFE_ATTR&&B(ar,b.ADD_URI_SAFE_ATTR,ce),b.FORBID_CONTENTS&&(He===ir&&(He=St(He)),B(He,b.FORBID_CONTENTS,ce)),b.ADD_FORBID_CONTENTS&&(He===ir&&(He=St(He)),B(He,b.ADD_FORBID_CONTENTS,ce)),sr&&(ge["#text"]=!0),Lt&&B(ge,["html","head","body"]),ge.table&&(B(ge,["tbody"]),delete je.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw vr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw vr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=b.TRUSTED_TYPES_POLICY,C=S.createHTML("")}else S===void 0&&(S=kb(_,o)),S!==null&&typeof C=="string"&&(C=S.createHTML(""));Xe&&Xe(b),Gt=b}},lr=B({},[...us,...ds,...ab]),Hr=B({},[...ps,...cb]),Ko=function(b){let T=x(b);(!T||!T.tagName)&&(T={namespaceURI:Bt,tagName:"template"});const L=mo(b.tagName),ne=mo(T.tagName);return un[b.namespaceURI]?b.namespaceURI===Cn?T.namespaceURI===ht?L==="svg":T.namespaceURI===An?L==="svg"&&(ne==="annotation-xml"||Pn[ne]):!!lr[L]:b.namespaceURI===An?T.namespaceURI===ht?L==="math":T.namespaceURI===Cn?L==="math"&&Rn[ne]:!!Hr[L]:b.namespaceURI===ht?T.namespaceURI===Cn&&!Rn[ne]||T.namespaceURI===An&&!Pn[ne]?!1:!Hr[L]&&(Vo[L]||!lr[L]):!!(It==="application/xhtml+xml"&&un[b.namespaceURI]):!1},ot=function(b){kr(t.removed,{element:b});try{x(b).removeChild(b)}catch{N(b)}},st=function(b,T){try{kr(t.removed,{attribute:T.getAttributeNode(b),from:T})}catch{kr(t.removed,{attribute:null,from:T})}if(T.removeAttribute(b),b==="is")if(Ht||sn)try{ot(T)}catch{}else try{T.setAttribute(b,"")}catch{}},Fr=function(b){let T=null,L=null;if(En)b="<remove></remove>"+b;else{const ye=ls(b,/^[\r\n\t ]+/);L=ye&&ye[0]}It==="application/xhtml+xml"&&Bt===ht&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const ne=S?S.createHTML(b):b;if(Bt===ht)try{T=new m().parseFromString(ne,It)}catch{}if(!T||!T.documentElement){T=M.createDocument(Bt,"template",null);try{T.documentElement.innerHTML=ln?C:ne}catch{}}const Re=T.body||T.documentElement;return b&&L&&Re.insertBefore(n.createTextNode(L),Re.childNodes[0]||null),Bt===ht?ze.call(T,Lt?"html":"body")[0]:Lt?T.documentElement:Re},ur=function(b){return ie.call(b.ownerDocument||b,b,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},dr=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")},Br=function(b){return typeof u=="function"&&b instanceof u};function gt(O,b,T){co(O,L=>{L.call(t,b,T,Gt)})}const Gr=function(b){let T=null;if(gt(V.beforeSanitizeElements,b,null),dr(b))return ot(b),!0;const L=ce(b.nodeName);if(gt(V.uponSanitizeElement,b,{tagName:L,allowedTags:ge}),on&&b.hasChildNodes()&&!Br(b.firstElementChild)&&Fe(/<[/\w!]/g,b.innerHTML)&&Fe(/<[/\w!]/g,b.textContent)||b.nodeType===wr.progressingInstruction||on&&b.nodeType===wr.comment&&Fe(/<[/\w]/g,b.data))return ot(b),!0;if(!(qe.tagCheck instanceof Function&&qe.tagCheck(L))&&(!ge[L]||je[L])){if(!je[L]&&Jr(L)&&(J.tagNameCheck instanceof RegExp&&Fe(J.tagNameCheck,L)||J.tagNameCheck instanceof Function&&J.tagNameCheck(L)))return!1;if(sr&&!He[L]){const ne=x(b)||b.parentNode,Re=R(b)||b.childNodes;if(Re&&ne){const ye=Re.length;for(let Oe=ye-1;Oe>=0;--Oe){const mt=P(Re[Oe],!0);mt.__removalCount=(b.__removalCount||0)+1,ne.insertBefore(mt,ee(b))}}}return ot(b),!0}return b instanceof d&&!Ko(b)||(L==="noscript"||L==="noembed"||L==="noframes")&&Fe(/<\/no(script|embed|frames)/i,b.innerHTML)?(ot(b),!0):(Ne&&b.nodeType===wr.text&&(T=b.textContent,co([_e,Ke,Z],ne=>{T=_r(T,ne," ")}),b.textContent!==T&&(kr(t.removed,{element:b.cloneNode()}),b.textContent=T)),gt(V.afterSanitizeElements,b,null),!1)},Wr=function(b,T,L){if(Ur&&(T==="id"||T==="name")&&(L in n||L in qr))return!1;if(!(me&&!Ze[T]&&Fe(te,T))){if(!(ve&&Fe(Ce,T))){if(!(qe.attributeCheck instanceof Function&&qe.attributeCheck(T,b))){if(!W[T]||Ze[T]){if(!(Jr(b)&&(J.tagNameCheck instanceof RegExp&&Fe(J.tagNameCheck,b)||J.tagNameCheck instanceof Function&&J.tagNameCheck(b))&&(J.attributeNameCheck instanceof RegExp&&Fe(J.attributeNameCheck,T)||J.attributeNameCheck instanceof Function&&J.attributeNameCheck(T,b))||T==="is"&&J.allowCustomizedBuiltInElements&&(J.tagNameCheck instanceof RegExp&&Fe(J.tagNameCheck,L)||J.tagNameCheck instanceof Function&&J.tagNameCheck(L))))return!1}else if(!ar[T]){if(!Fe(rn,_r(L,dt,""))){if(!((T==="src"||T==="xlink:href"||T==="href")&&b!=="script"&&rb(L,"data:")===0&&ae[b])){if(!(Mr&&!Fe(Pe,_r(L,dt,"")))){if(L)return!1}}}}}}}return!0},Jr=function(b){return b!=="annotation-xml"&&ls(b,pt)},pr=function(b){gt(V.beforeSanitizeAttributes,b,null);const{attributes:T}=b;if(!T||dr(b))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:W,forceKeepAttr:void 0};let ne=T.length;for(;ne--;){const Re=T[ne],{name:ye,namespaceURI:Oe,value:mt}=Re,wt=ce(ye),hr=mt;let Ae=ye==="value"?hr:ob(hr);if(L.attrName=wt,L.attrValue=Ae,L.keepAttr=!0,L.forceKeepAttr=void 0,gt(V.uponSanitizeAttribute,b,L),Ae=L.attrValue,or&&(wt==="id"||wt==="name")&&(st(ye,b),Ae=Jo+Ae),on&&Fe(/((--!?|])>)|<\/(style|title|textarea)/i,Ae)){st(ye,b);continue}if(wt==="attributename"&&ls(Ae,"href")){st(ye,b);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){st(ye,b);continue}if(!rr&&Fe(/\/>/i,Ae)){st(ye,b);continue}Ne&&co([_e,Ke,Z],Vr=>{Ae=_r(Ae,Vr," ")});const Xr=ce(b.nodeName);if(!Wr(Xr,wt,Ae)){st(ye,b);continue}if(S&&typeof _=="object"&&typeof _.getAttributeType=="function"&&!Oe)switch(_.getAttributeType(Xr,wt)){case"TrustedHTML":{Ae=S.createHTML(Ae);break}case"TrustedScriptURL":{Ae=S.createScriptURL(Ae);break}}if(Ae!==hr)try{Oe?b.setAttributeNS(Oe,ye,Ae):b.setAttribute(ye,Ae),dr(b)?ot(b):ca(t.removed)}catch{st(ye,b)}}gt(V.afterSanitizeAttributes,b,null)},$t=function O(b){let T=null;const L=ur(b);for(gt(V.beforeSanitizeShadowDOM,b,null);T=L.nextNode();)gt(V.uponSanitizeShadowNode,T,null),Gr(T),pr(T),T.content instanceof i&&O(T.content);gt(V.afterSanitizeShadowDOM,b,null)};return t.sanitize=function(O){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},T=null,L=null,ne=null,Re=null;if(ln=!O,ln&&(O="<!-->"),typeof O!="string"&&!Br(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(zt||Ln(b),t.removed=[],typeof O=="string"&&(cn=!1),cn){if(O.nodeName){const mt=ce(O.nodeName);if(!ge[mt]||je[mt])throw vr("root node is forbidden and cannot be sanitized in-place")}}else if(O instanceof u)T=Fr("<!---->"),L=T.ownerDocument.importNode(O,!0),L.nodeType===wr.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?T=L:T.appendChild(L);else{if(!Ht&&!Ne&&!Lt&&O.indexOf("<")===-1)return S&&an?S.createHTML(O):O;if(T=Fr(O),!T)return Ht?null:an?C:""}T&&En&&ot(T.firstChild);const ye=ur(cn?O:T);for(;ne=ye.nextNode();)Gr(ne),pr(ne),ne.content instanceof i&&$t(ne.content);if(cn)return O;if(Ht){if(sn)for(Re=ke.call(T.ownerDocument);T.firstChild;)Re.appendChild(T.firstChild);else Re=T;return(W.shadowroot||W.shadowrootmode)&&(Re=Ye.call(r,Re,!0)),Re}let Oe=Lt?T.outerHTML:T.innerHTML;return Lt&&ge["!doctype"]&&T.ownerDocument&&T.ownerDocument.doctype&&T.ownerDocument.doctype.name&&Fe(Rc,T.ownerDocument.doctype.name)&&(Oe="<!DOCTYPE "+T.ownerDocument.doctype.name+`>
|
|
1440
|
+
`+Oe),Ne&&co([_e,Ke,Z],mt=>{Oe=_r(Oe,mt," ")}),S&&an?S.createHTML(Oe):Oe},t.setConfig=function(){let O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ln(O),zt=!0},t.clearConfig=function(){Gt=null,zt=!1},t.isValidAttribute=function(O,b,T){Gt||Ln({});const L=ce(O),ne=ce(b);return Wr(L,ne,T)},t.addHook=function(O,b){typeof b=="function"&&kr(V[O],b)},t.removeHook=function(O,b){if(b!==void 0){const T=tb(V[O],b);return T===-1?void 0:nb(V[O],T,1)[0]}return ca(V[O])},t.removeHooks=function(O){V[O]=[]},t.removeAllHooks=function(){V=fa()},t}var _b=Lc();function zc(e){const t=se.parse(e,{gfm:!0,breaks:!0,async:!1});return _b.sanitize(t)}const Ic=1e3,$c=32,ga=15e3,vb=new Set(["completed","failed","cancelled"]),yb=4e3;let I=null,Rt=null,$e=null,Xs=null,No=null,As=!1,bo=null,Cr=null,U={kind:"connecting"},Gn=[],Yn=null,de=null,Kn=null,Dt=null,Pr=-1,Je=null,Ut=!1,Mt=null,mn=new Set;function Cs(){ko(),mc(),Rt&&clearInterval(Rt),Rt=null,Mt==null||Mt(),Mt=null,$e==null||$e.destroy(),$e=null,I&&Zt(I),I==null||I.remove(),I=null,Xs=null,U={kind:"connecting"},Gn=[],Yn=null,de=null,Kn=null,Dt=null,No=null,Pr=-1,Je=null,Ut=!1,mn=new Set}function Vs(e,t,n,r,o){I&&Cs(),Xs=o??null,U={kind:"connecting"},Gn=[],Yn=null,Pr=-1,Je=null,Ut=!1,mn=new Set,de=e,Kn=n,Dt=t,No=r,gc({taskId:e,backendUrl:n,title:r}),I=document.createElement("div"),I.className="ap-sdk-panel",I.setAttribute("data-ap-sdk","1"),I.setAttribute("role","dialog"),I.setAttribute("aria-modal","true"),I.setAttribute("aria-label","Automation in progress");const i=r.length>55?`${r.slice(0,52)}…`:r;I.innerHTML=`
|
|
1297
1441
|
<div class="ap-sdk-panel__header">
|
|
1298
1442
|
<span class="ap-sdk-panel__title">
|
|
1299
1443
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1306,7 +1450,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
|
|
|
1306
1450
|
<div class="ap-sdk-runner__meta">
|
|
1307
1451
|
<div class="ap-sdk-runner__meta-row">
|
|
1308
1452
|
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--automate">Automate</span>
|
|
1309
|
-
<span class="ap-sdk-runner__title" title="${
|
|
1453
|
+
<span class="ap-sdk-runner__title" title="${Ib(r)}">${Ks(i)}</span>
|
|
1310
1454
|
</div>
|
|
1311
1455
|
<div class="ap-sdk-runner__meta-row ap-sdk-runner__meta-row--controls">
|
|
1312
1456
|
<span class="ap-sdk-runner__counter" data-ap-runner-counter>0 actions</span>
|
|
@@ -1332,17 +1476,17 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
|
|
|
1332
1476
|
</div>
|
|
1333
1477
|
<div class="ap-sdk-runner__hint" data-ap-runner-hint>Closing keeps the task running — resume anytime from My Captures.</div>
|
|
1334
1478
|
<div class="ap-sdk-panel__status" data-ap-runner-summary style="display:none"></div>
|
|
1335
|
-
`,
|
|
1336
|
-
<div class="ap-sdk-runner__question-label">${
|
|
1337
|
-
<div class="ap-sdk-runner__question-text ap-sdk-markdown">${
|
|
1479
|
+
`,I.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),I.addEventListener("touchmove",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild(I),$e=Rs(),jt(I),js(I,Us),I.querySelector("[data-ap-close]").addEventListener("click",()=>{Cs(),o==null||o()}),I.querySelector("[data-ap-runner-chat-form]").addEventListener("submit",a=>{a.preventDefault(),Sb(t,e)}),I.querySelector("[data-ap-runner-cancel]").addEventListener("click",a=>{a.stopPropagation();const u=a.currentTarget;if(!As){As=!0,u.textContent="Confirm",bo=setTimeout(ko,yb),Cr=d=>{d.target!==u&&ko()},document.addEventListener("click",Cr,!0);return}ko(),wb(t,e)}),Ys(),Nc(e,t)}function Nc(e,t){const n=async u=>{if(de!==e||!I||U.kind!=="idle"&&U.kind!=="connecting"||mn.has(u.commandId))return;mn.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()};gn({kind:"executing",command:d,actionsRun:U.kind==="idle"?U.actionsRun:0}),await ma(d,t,e)},r=u=>{if(!(de!==e||!I)&&vb.has(u)){if(U.kind==="executing")gn({kind:"finishing",status:u,actionsRun:U.actionsRun});else if(U.kind==="connecting"||U.kind==="idle"){const d=U.kind==="idle"?U.actionsRun:0;gn({kind:"finished",status:u,actionsRun:d})}}},o=u=>{de!==e||!I||(u.outputChunk&&ba([u.outputChunk]),r(u.status))},i=async()=>{if(!(de!==e||!I))try{const u=await Lo(t,e);de===e&&I&&(Je=u[0]??null,yn())}catch{}},a=async()=>{try{const[u,d,p,h]=await Promise.all([dc(t,e),Og(t,e),Lo(t,e),$g(t,e)]);if(de!==e||!I)return;ba(d),Je=p[0]??null,yn(),r(u.status),h&&h.status==="pending"&&(U.kind==="idle"||U.kind==="connecting")&&!mn.has(h.id)?(mn.add(h.id),gn({kind:"executing",command:h,actionsRun:U.kind==="idle"?U.actionsRun:0}),await ma(h,t,e)):U.kind==="connecting"&&gn({kind:"idle",actionsRun:0})}catch{}};a(),Xg(t,e,{onStatusUpdate:o,onInteractionCreated:i,onInteractionAnswered:i,onBrowserCommandCreated:n,onReconnect:()=>{a()}}).then(u=>{if(de!==e||U.kind==="finished"){u();return}Mt=u})}function gn(e){U=e,U.kind==="idle"&&Yn===null&&(Yn=Date.now(),Oo(),Rt=setInterval(Oo,Ic)),U.kind==="finished"&&(Rt&&(clearInterval(Rt),Rt=null),Mt==null||Mt(),Mt=null,$e==null||$e.hide(),mc()),Ys()}function ko(){As=!1,bo&&(clearTimeout(bo),bo=null),Cr&&(document.removeEventListener("click",Cr,!0),Cr=null);const e=I==null?void 0:I.querySelector("[data-ap-runner-cancel]");e&&(e.textContent="Cancel task")}async function wb(e,t){if(de!==t||!I)return;const n=I.querySelector("[data-ap-runner-cancel]");n&&(n.disabled=!0);try{await Mg(e,t)}catch{n&&(n.disabled=!1)}}function Oc(){if(!de||!Dt||!Kn||!No)return;const e=de,t=Dt;gc({taskId:e,backendUrl:Kn,title:No}),Rt&&clearInterval(Rt),Oo(),Rt=setInterval(Oo,Ic);const n=U.kind==="finished"?U.actionsRun:0;mn=new Set,U={kind:"idle",actionsRun:n},Ys(),Nc(e,t)}function Ys(){if(!I)return;const e=I.querySelector("[data-ap-runner-status]"),t=I.querySelector("[data-ap-runner-counter]"),n=I.querySelector("[data-ap-runner-log]"),r=I.querySelector("[data-ap-runner-hint]");if(!e||!t||!n||!r)return;const o="actionsRun"in 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",Lb(U.status)):(e.textContent="running",e.className="ap-sdk-status-badge ap-sdk-status-badge--in-progress",r.style.display="block");const i=n.querySelector("[data-ap-runner-placeholder]");if(Gn.length===0&&(U.kind==="connecting"||U.kind==="idle")){if(!i){const h=document.createElement("div");h.className="ap-sdk-runner__placeholder",h.setAttribute("data-ap-runner-placeholder","1"),h.textContent="Waiting for the agent's first action…",n.appendChild(h)}}else i==null||i.remove();yn();const a=I.querySelector("[data-ap-runner-chat-input]"),u=I.querySelector("[data-ap-runner-chat-send]");if(a&&u){const h=U.kind==="finished"&&U.status==="failed";a.disabled=h,u.disabled=h||Ut,h&&(a.placeholder="This task failed — start a new automation to continue.")}const d=I.querySelector("[data-ap-runner-cancel]");d&&(d.style.display=U.kind==="finished"?"none":"");const p=I.querySelector("[data-ap-runner-summary]");p&&U.kind!=="finished"&&(p.style.display="none",p.innerHTML="")}function yn(){if(!I)return;const e=I.querySelector("[data-ap-runner-question]"),t=I.querySelector("[data-ap-runner-chat-input]");if(!e||!t)return;if(!Je){e.style.display="none",e.innerHTML="",t.placeholder="Send a message to the agent…";return}const n=Je.questionMetadata,r=(n==null?void 0:n.options)??[];if(t.placeholder="Type your answer…",e.style.display="block",e.innerHTML=`
|
|
1480
|
+
<div class="ap-sdk-runner__question-label">${Ks((n==null?void 0:n.header)||"The agent has a question")}</div>
|
|
1481
|
+
<div class="ap-sdk-runner__question-text ap-sdk-markdown">${zc((n==null?void 0:n.question)||Je.question)}</div>
|
|
1338
1482
|
${r.length>0?'<div class="ap-sdk-runner__question-options" data-ap-runner-question-options></div>':""}
|
|
1339
|
-
`,r.length>0){const o=e.querySelector("[data-ap-runner-question-options]");for(const
|
|
1483
|
+
`,r.length>0){const o=e.querySelector("[data-ap-runner-question-options]");for(const i 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=i.label,a.addEventListener("click",()=>void xb(i.label)),o.appendChild(a)}}}async function xb(e){if(!I||!Je||!de||Ut)return;const t=de,n=Dt;if(n){Ut=!0;try{const r={selectedOption:e};await pc(n,t,Je.id,r),Je=null,yn();const o=await Lo(n,t);de===t&&I&&(Je=o[0]??null,yn())}catch{const r=I.querySelector("[data-ap-runner-chat-error]");r&&(r.textContent="Failed to send your answer — try again.",r.style.display="block")}finally{Ut=!1}}}function Oo(){if(!I||Yn===null)return;const e=I.querySelector("[data-ap-runner-timer]");if(!e)return;const t=Math.max(0,Math.floor((Date.now()-Yn)/1e3)),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");e.textContent=`${n}:${r}`}async function ma(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})`);$e==null||$e.update(a),o=Eb(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($e==null||$e.update(a),e.action==="click")await Yg(a),o="Clicked";else{if(e.value===void 0)throw new Error("inputText command is missing a value");Ab(a,e.value),o="Entered text"}}}catch(a){r="error",o=a instanceof Error?a.message:"Unknown error executing command"}if(de===n&&I&&Cb(r,e,o),await Tb(t,n,e.id,r,o),de!==n||!I)return;$e==null||$e.hide();const i=(U.kind==="executing"||U.kind==="finishing"?U.actionsRun:0)+1;U.kind==="finishing"?gn({kind:"finished",status:U.status,actionsRun:i}):U.kind==="executing"&&gn({kind:"idle",actionsRun:i})}async function Sb(e,t){if(!I||Ut||U.kind==="finished"&&U.status==="failed")return;const n=I.querySelector("[data-ap-runner-chat-input]"),r=I.querySelector("[data-ap-runner-chat-error]"),o=I.querySelector("[data-ap-runner-chat-send]");if(!n||!r||!o)return;const i=n.value.trim();if(i){Ut=!0,o.disabled=!0,r.style.display="none";try{if(Je){await pc(e,t,Je.id,i),Je=null,yn();try{const a=await Lo(e,t);de===t&&I&&(Je=a[0]??null,yn())}catch{}}else await Dg(e,t,i),U.kind==="finished"&&Oc();n.value=""}catch(a){r.textContent=a instanceof Error?a.message:"Failed to send — try again.",r.style.display="block"}finally{Ut=!1,o.disabled=!1}}}async function Tb(e,t,n,r,o){try{await Ng(e,t,n,r,o)}catch{}}function Eb(e){const t=e.cloneNode(!0);t.querySelectorAll("script, style, noscript").forEach(o=>o.remove()),Hg(t);let n=t.outerHTML,r=!1;return n.length>ga&&(n=n.slice(0,ga),r=!0),`URL: ${location.href}
|
|
1340
1484
|
Title: ${document.title}
|
|
1341
1485
|
|
|
1342
1486
|
${n}${r?`
|
|
1343
|
-
… (truncated)`:""}`}function
|
|
1487
|
+
… (truncated)`:""}`}function Ab(e,t){var i;const r=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,o=(i=Object.getOwnPropertyDescriptor(r,"value"))==null?void 0:i.set;if(!o)throw new Error("target element does not accept text input");o.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function Cb(e,t,n){var k;const r=e==="done"?"✓":"✗",o=t.selector?` \`${t.selector}\``:"",i=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(Gn.push({status:e,text:`${r} ${i}${u}`}),!I)return;const d=I.querySelector("[data-ap-runner-log]");if(!d)return;(k=d.querySelector("[data-ap-runner-placeholder]"))==null||k.remove();const p=d.scrollHeight-d.scrollTop-d.clientHeight<=$c,h=document.createElement("div");h.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--${e}`,h.textContent=Gn[Gn.length-1].text,d.appendChild(h),p&&(d.scrollTop=d.scrollHeight)}function Pb(e){var t;return((t=e.display)==null?void 0:t.variant)??e.sdkEventType}function Rb(e){const t=Pb(e);return(e.stream==="stdout"||e.stream==="stderr"||e.stream==="sdk_event"&&(t==="text"||t==="thinking"))&&e.data.trim()||null}function ba(e){var r;const t=e.filter(o=>o.sequence>Pr).sort((o,i)=>o.sequence-i.sequence);if(t.length===0||(Pr=Math.max(Pr,...t.map(o=>o.sequence)),!I))return;const n=I.querySelector("[data-ap-runner-log]");if(n)for(const o of t){const i=Rb(o);if(!i)continue;(r=n.querySelector("[data-ap-runner-placeholder]"))==null||r.remove();const a=n.scrollHeight-n.scrollTop-n.clientHeight<=$c,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=zc(i)):u.textContent=i,n.appendChild(u),a&&(n.scrollTop=n.scrollHeight)}}function Lb(e){if(!I||!de||!Kn)return;const t=I.querySelector("[data-ap-runner-summary]");if(!t)return;const n=`${Kn.replace(/\/+$/,"")}/tasks/${de}`,r=e==="completed"?"Automation complete!":"Automation ended",o=e==="completed";t.style.display="block",t.innerHTML=`
|
|
1344
1488
|
<div class="ap-sdk-success-card">
|
|
1345
|
-
<p class="ap-sdk-success-headline">${
|
|
1489
|
+
<p class="ap-sdk-success-headline">${Ks(r)}</p>
|
|
1346
1490
|
${o?`
|
|
1347
1491
|
<div class="ap-sdk-runner__approval" data-ap-runner-approval>
|
|
1348
1492
|
<div class="ap-sdk-runner__approval-actions">
|
|
@@ -1360,7 +1504,7 @@ ${n}${r?`
|
|
|
1360
1504
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-runner-close>Close</button>
|
|
1361
1505
|
</div>
|
|
1362
1506
|
</div>
|
|
1363
|
-
`,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const
|
|
1507
|
+
`,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const i=Xs;Cs(),i==null||i()}),o&&zb(t)}function zb(e){const t=e.querySelector("[data-ap-runner-approve]"),n=e.querySelector("[data-ap-runner-reject]"),r=e.querySelector("[data-ap-runner-reject-form]"),o=e.querySelector("[data-ap-runner-reject-feedback]"),i=e.querySelector("[data-ap-runner-reject-submit]"),a=e.querySelector("[data-ap-runner-approval-error]"),u=e.querySelector(".ap-sdk-runner__approval-actions"),d=h=>{a.textContent=h,a.style.display="block"};t.addEventListener("click",async()=>{if(!de||!Dt)return;const h=de,k=Dt;t.disabled=!0,n.disabled=!0,a.style.display="none";try{await Ug(k,h),u.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--approved">Approved</span>',r.style.display="none"}catch(m){t.disabled=!1,n.disabled=!1,d(m instanceof Error?m.message:"Failed to approve — try again.")}}),n.addEventListener("click",()=>{r.style.display=r.style.display==="none"?"block":"none",r.style.display==="block"&&o.focus()});const p=()=>{i.textContent=o.value.trim()?"Reject & Continue":"Reject Permanently"};o.addEventListener("input",p),i.addEventListener("click",async()=>{if(!de||!Dt)return;const h=de,k=Dt,m=o.value.trim();i.disabled=!0,t.disabled=!0,a.style.display="none",i.textContent="Rejecting…";try{await jg(k,h,m),m?Oc():(u.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--rejected">Rejected</span>',r.style.display="none")}catch(_){i.disabled=!1,t.disabled=!1,p(),d(_ instanceof Error?_.message:"Failed to reject — try again.")}})}function Ib(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ks(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function $b(e,t,n){const r=!!(t.backendUrl&&t.token),o=document.createElement("div");o.className="ap-sdk-advanced",o.innerHTML=`
|
|
1364
1508
|
<details class="ap-sdk-advanced__details">
|
|
1365
1509
|
<summary class="ap-sdk-advanced__summary">Advanced options</summary>
|
|
1366
1510
|
<div class="ap-sdk-advanced__body">
|
|
@@ -1379,7 +1523,12 @@ ${n}${r?`
|
|
|
1379
1523
|
</div>
|
|
1380
1524
|
</div>
|
|
1381
1525
|
</details>
|
|
1382
|
-
`,e.appendChild(o);const
|
|
1526
|
+
`,e.appendChild(o);const i=o.querySelector("[data-ap-adv-template-field]"),a=o.querySelector("[data-ap-template]"),u=o.querySelector("[data-ap-quickmode]");let d=[];if(r){const p={backendUrl:t.backendUrl,token:t.token};Lg(p,n??void 0).then(h=>{if(d=h,h.length===0){i.style.display="none";return}const k=h.find(m=>m.isDefault&&m.scope==="project")??h.find(m=>m.isDefault&&m.scope==="global");a.innerHTML='<option value="">None (use default)</option>'+h.map(m=>`<option value="${Nb(m.id)}">${Ob(m.name)}${m.isDefault?" (Default)":""}</option>`).join(""),a.value=(k==null?void 0:k.id)??""}).catch(()=>{i.style.display="none"})}else{a.innerHTML='<option value="">None</option>',a.disabled=!0;const p=document.createElement("span");p.className="ap-sdk-advanced__hint",p.textContent="Connect credentials to enable template selection",i.appendChild(p)}return{getOptions(){var k,m,_,w,P,N,ee;const p=a.value||null,h=p?((k=d.find(R=>R.id===p))==null?void 0:k.templateData)??{}:{};return{claudeTemplateId:p,quickMode:u.checked,...h.modelOverride!=null?{modelOverride:h.modelOverride}:{},...h.claudeProfileId!=null?{claudeProfileId:h.claudeProfileId}:{},...h.effort!=null?{effort:h.effort}:{},...h.executionMode!=null?{executionMode:h.executionMode}:{},...(m=h.selectedPluginIds)!=null&&m.length?{selectedPluginIds:h.selectedPluginIds}:{},...(_=h.selectedSkillIds)!=null&&_.length?{selectedSkillIds:h.selectedSkillIds}:{},...(w=h.selectedPluginSkillIds)!=null&&w.length?{selectedPluginSkillIds:h.selectedPluginSkillIds}:{},...(P=h.selectedMcpServerIds)!=null&&P.length?{selectedMcpServerIds:h.selectedMcpServerIds}:{},...(N=h.selectedSlashCommandIds)!=null&&N.length?{selectedSlashCommandIds:h.selectedSlashCommandIds}:{},...(ee=h.selectedRemoteContextProviderIds)!=null&&ee.length?{selectedRemoteContextProviderIds:h.selectedRemoteContextProviderIds}:{}}}}}function Nb(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ob(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const Qs="ap-sdk-captures",Db=50;function nr(){try{const e=localStorage.getItem(Qs);return e?JSON.parse(e):[]}catch{return[]}}function Mb(e){const t=nr(),n=[e,...t].slice(0,Db);try{localStorage.setItem(Qs,JSON.stringify(n))}catch{}}function Ub(){try{localStorage.removeItem(Qs)}catch{}}function Dc(e){var a,u,d,p,h;if(e.id){const k=document.querySelector(`label[for="${CSS.escape(e.id)}"]`),m=(a=k==null?void 0:k.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=(p=e.placeholder)==null?void 0:p.trim();if(o)return o;const i=(h=e.getAttribute("name"))==null?void 0:h.trim();return i||e.tagName.toLowerCase()}function jb(e,t){return`Click "${e}" ${t.toLowerCase()}`}function Mc(e,t,n){return n?`Typed [redacted] into ${e}`:`Typed "${t}" into ${e}`}function ka(e,t){return`Scrolled to (${e}, ${t})`}function Zb(e,t){return t?`Pressed "${e}" in ${t}`:`Pressed "${e}"`}function Uc(e){return e.map((t,n)=>`${n+1}. ${t.description}`).join(`
|
|
1527
|
+
`)}const qb=400,Hb=new Set(["Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),Fb=new Set(["Control","Meta","Alt","Shift"]);function Bb(e){if(Fb.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("+")):Hb.has(e.key)?e.key:null}function Gb(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?Dc(e):Eo(e)||e.tagName.toLowerCase()}let Qn=[],Be=null,Do=null,et=null,At=null,Ct=null;function jc(){Do&&(Do.textContent=`● Recording — ${Qn.length} step${Qn.length===1?"":"s"}`)}function Ps(){Ct&&(clearTimeout(Ct),Ct=null),At&&(Qn.push(At),At=null,jc())}function fs(e){Ps(),Qn.push(e),jc()}function Wb(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 Jb(e,t){et&&et(),Qn=[],At=null,Be=document.createElement("div"),Be.className="ap-sdk-recorder-bar",Be.setAttribute("data-ap-sdk","1"),Be.innerHTML=`
|
|
1528
|
+
<span class="ap-sdk-recorder-bar__counter" data-ap-recorder-counter>● Recording — 0 steps</span>
|
|
1529
|
+
<button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--stop" data-ap-recorder-stop type="button">Stop</button>
|
|
1530
|
+
<button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--discard" data-ap-recorder-discard type="button">Discard</button>
|
|
1531
|
+
`,document.body.appendChild(Be),jt(Be),Do=Be.querySelector("[data-ap-recorder-counter]");const n=()=>{Ps();const d=Qn;et==null||et(),e(d)},r=()=>{et==null||et()};Be.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),Be.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=d=>{if(Ar(d.target))return;const p=d.target;fs({action:"click",cssSelector:fo(p),elementText:Eo(p),description:jb(Eo(p),p.tagName),capturedAt:new Date().toISOString()})},i=d=>{if(Ar(d.target))return;const p=d.target;if(!(p instanceof HTMLInputElement)&&!(p instanceof HTMLTextAreaElement)&&!(p instanceof HTMLSelectElement))return;const h=Dc(p),k=qg(p),m=k?"[redacted]":Wb(p);fs({action:"inputText",cssSelector:fo(p),elementText:h,value:m,...k?{redacted:!0}:{},description:Mc(h,m,k),capturedAt:new Date().toISOString()})},a=()=>{const d=Math.round(window.scrollX),p=Math.round(window.scrollY);At?(At.scrollX=d,At.scrollY=p,At.description=ka(d,p)):At={action:"scroll",scrollX:d,scrollY:p,description:ka(d,p),capturedAt:new Date().toISOString()},Ct&&clearTimeout(Ct),Ct=setTimeout(()=>{Ct=null,Ps()},qb)},u=d=>{if(d.key==="Escape"){r();return}if(Ar(d.target))return;const p=Bb(d);if(!p)return;const h=d.target instanceof Element?d.target:document.body,k=Gb(h);fs({action:"keypress",cssSelector:fo(h),elementText:k,key:p,description:Zb(p,k),capturedAt:new Date().toISOString()})};document.addEventListener("click",o,{capture:!0}),document.addEventListener("change",i,{capture:!0}),window.addEventListener("scroll",a,{capture:!0,passive:!0}),document.addEventListener("keydown",u,{capture:!0}),et=()=>{document.removeEventListener("click",o,{capture:!0}),document.removeEventListener("change",i,{capture:!0}),window.removeEventListener("scroll",a,{capture:!0}),document.removeEventListener("keydown",u,{capture:!0}),Ct&&(clearTimeout(Ct),Ct=null),At=null,Be&&Zt(Be),Be==null||Be.remove(),Be=null,Do=null,et=null}}function Xb(){et==null||et()}function _o(){return et!==null}const Vb="data-ap-sdk",Yb="ap-sdk-fab",_a="ap-sdk-fab--dragging",ei="ap-sdk-fab--open",Zc="ap-sdk-fab-pos",Mo="ap-sdk-fab--left-edge",Kb='<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>',Qb='<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>',ek='<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>',tk='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>';let z=null,tt=null,Jt=null,Xt=null,Vt=null,Nn=null,On=null,Dn=null,vo=null,Rr=null,Wn=null,yo=null,wo=null,xo=null,qc=0,Hc=0,Fc=0,Bc=0,jn=!1,kt=!1,Lr=null,bn=null;function nk(){Lr=e=>{if(!z){So();return}if(!jn){if(Math.hypot(e.clientX-Fc,e.clientY-Bc)<5)return;jn=!0,kt=!0,z.classList.add(_a)}rk(e.clientX-qc,e.clientY-Hc)},bn=()=>{if(!z){So();return}jn?(jn=!1,z.classList.remove(_a),z.style.transition="",ok(z.getBoundingClientRect())):z.style.transition="",So()},window.addEventListener("pointermove",Lr),window.addEventListener("pointerup",bn),window.addEventListener("pointercancel",bn)}function So(){Lr&&(window.removeEventListener("pointermove",Lr),Lr=null),bn&&(window.removeEventListener("pointerup",bn),window.removeEventListener("pointercancel",bn),bn=null)}function rk(e,t){if(!z)return;const n=z.offsetWidth||52,r=z.offsetHeight||52;z.style.top=`${Math.max(0,Math.min(t,window.innerHeight-r))}px`,z.style.left=`${Math.max(0,Math.min(e,window.innerWidth-n))}px`,z.style.bottom="auto",z.style.right="auto"}function ok(e){if(!z)return;const n=Math.max(16,Math.min(window.innerHeight-e.bottom,window.innerHeight-52-16)),r=e.left+e.width/2<window.innerWidth/2?"left":"right";z.style.top="auto",z.style.bottom=`${n}px`,r==="left"?(z.style.right="auto",z.style.left="16px",z.classList.add(Mo)):(z.style.left="auto",z.style.right="16px",z.classList.remove(Mo));try{localStorage.setItem(Zc,JSON.stringify({edge:r,bottom:n}))}catch{}}function sk(){if(z)try{const e=localStorage.getItem(Zc);if(!e)return;const t=JSON.parse(e);if(typeof t.bottom!="number"||t.edge!=="left"&&t.edge!=="right")return;const r=Math.max(16,Math.min(t.bottom,window.innerHeight-52-16));z.style.top="auto",z.style.bottom=`${r}px`,t.edge==="left"?(z.style.right="auto",z.style.left="16px",z.classList.add(Mo)):(z.style.left="auto",z.style.right="16px",z.classList.remove(Mo))}catch{}}function Zn(){z==null||z.classList.remove(ei),Wn&&(window.removeEventListener("pointerdown",Wn,{capture:!0}),Wn=null)}function ik(){z&&(z.classList.add(ei),Wn=e=>{!z||z.contains(e.target)||Zn()},requestAnimationFrame(()=>{Wn&&window.addEventListener("pointerdown",Wn,{capture:!0})}))}function uo(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function Gc(e,t,n){if(yo=e,wo=t,xo=n,z)return;z=document.createElement("div"),z.className=Yb,z.setAttribute(Vb,"1"),Nn=document.createElement("div"),Nn.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="View captures",Vt=document.createElement("button"),Vt.className="ap-sdk-fab__list ap-sdk-fab__sub",Vt.setAttribute("aria-label","My captures"),Vt.setAttribute("title","View my captures"),Vt.appendChild(uo(tk)),Nn.appendChild(r),Nn.appendChild(Vt),On=document.createElement("div"),On.className="ap-sdk-fab__row";const o=document.createElement("span");o.className="ap-sdk-fab__label",o.textContent="Capture element",Jt=document.createElement("button"),Jt.className="ap-sdk-fab__capture ap-sdk-fab__sub",Jt.setAttribute("aria-label","Capture element"),Jt.setAttribute("title","Capture element to Agent Platform"),Jt.appendChild(uo(Qb)),On.appendChild(o),On.appendChild(Jt),Dn=document.createElement("div"),Dn.className="ap-sdk-fab__row";const i=document.createElement("span");i.className="ap-sdk-fab__label",i.textContent="Record interaction",Xt=document.createElement("button"),Xt.className="ap-sdk-fab__record ap-sdk-fab__sub",Xt.setAttribute("aria-label","Record interaction"),Xt.setAttribute("title","Record a sequence of interactions"),Xt.appendChild(uo(ek)),Dn.appendChild(i),Dn.appendChild(Xt),tt=document.createElement("button"),tt.className="ap-sdk-fab__main",tt.setAttribute("aria-label","Agent Platform"),tt.setAttribute("title","Agent Platform"),tt.appendChild(uo(Kb));const a=document.createElement("span");a.className="ap-sdk-fab__badge",a.setAttribute("data-ap-badge",""),a.style.display="none",tt.appendChild(a),z.appendChild(Nn),z.appendChild(On),z.appendChild(Dn),z.appendChild(tt),tt.addEventListener("click",u=>{if(kt){kt=!1;return}u.preventDefault(),u.stopPropagation(),z!=null&&z.classList.contains(ei)?Zn():ik()}),Jt.addEventListener("click",u=>{if(kt){kt=!1;return}u.preventDefault(),u.stopPropagation(),Zn(),!Fn()&&!_o()&&yo&&yo()}),Xt.addEventListener("click",u=>{if(kt){kt=!1;return}u.preventDefault(),u.stopPropagation(),Zn(),!Fn()&&!_o()&&wo&&wo()}),Vt.addEventListener("click",u=>{if(kt){kt=!1;return}u.preventDefault(),u.stopPropagation(),Zn(),xo&&xo()}),Rr=u=>{if(!z||!(z===u.target||z.contains(u.target)))return;const d=z.getBoundingClientRect();qc=u.clientX-d.left,Hc=u.clientY-d.top,Fc=u.clientX,Bc=u.clientY,jn=!1,kt=!1,z.style.transition="none",u.stopPropagation(),nk()},window.addEventListener("pointerdown",Rr,{capture:!0}),(document.body??document.documentElement).appendChild(z),jt(z),sk(),vo=setInterval(()=>{tt&&tt.classList.toggle("ap-sdk-fab__main--active",Fn()||_o())},200)}function wn(e){const t=tt==null?void 0:tt.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function Wc(){jn=!1,kt=!1,So(),Zn(),vo&&(clearInterval(vo),vo=null),Rr&&(window.removeEventListener("pointerdown",Rr,{capture:!0}),Rr=null),z&&Zt(z),z==null||z.remove(),z=null,tt=null,Jt=null,Xt=null,Vt=null,Nn=null,On=null,Dn=null,yo=null,wo=null,xo=null}async function Jc(e,t){try{if(e.type==="planning"){const r=await zg(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=await dc(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch{return{capture:e,status:"unavailable",approved:!1}}}function Xc(e){return e.filter(t=>!t.approved).length}async function Vc(e){const t=nr();if(!e||t.length===0){wn(t.length);return}const n=await Promise.all(t.map(r=>Jc(r,e)));wn(Xc(n))}let F=null,We=null,Ot=null;function ti(){return F!==null}function $r(){F&&Zt(F),F==null||F.remove(),F=null,Ot==null||Ot(),Ot=null,We==null||We.destroy(),We=null}function Yc(e,t,n,r,o,i,a,u,d){F&&$r();const p={captureType:"task",submitting:!1,completedPicks:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1},h=!n.backendUrl||!n.token;F=document.createElement("div"),F.className="ap-sdk-panel",F.setAttribute("data-ap-sdk","1"),F.setAttribute("role","dialog"),F.setAttribute("aria-modal","true"),F.setAttribute("aria-label","Capture to Agent Platform"),F.innerHTML=`
|
|
1383
1532
|
<div class="ap-sdk-panel__header">
|
|
1384
1533
|
<span class="ap-sdk-panel__title">
|
|
1385
1534
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1392,7 +1541,7 @@ ${n}${r?`
|
|
|
1392
1541
|
</div>
|
|
1393
1542
|
<div class="ap-sdk-pick-list" data-ap-pick-list style="display:none"></div>
|
|
1394
1543
|
<div class="ap-sdk-panel__context" data-ap-context>
|
|
1395
|
-
${
|
|
1544
|
+
${va(e)}
|
|
1396
1545
|
</div>
|
|
1397
1546
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-panel__btn--select-parent" data-ap-select-parent type="button">
|
|
1398
1547
|
⬆ Select parent
|
|
@@ -1437,26 +1586,41 @@ ${n}${r?`
|
|
|
1437
1586
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-submit>Submit</button>
|
|
1438
1587
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-cancel>Cancel</button>
|
|
1439
1588
|
</div>
|
|
1440
|
-
`,F.addEventListener("wheel",
|
|
1589
|
+
`,F.addEventListener("wheel",Z=>{Z.stopPropagation()},{passive:!0}),F.addEventListener("touchmove",Z=>{Z.stopPropagation()},{passive:!0});const k=F.querySelector(".ap-sdk-panel__body"),m=$b(k,n,(r==null?void 0:r.id)??null);document.body.appendChild(F),We=Rs(),p.currentPickedEl&&We.update(p.currentPickedEl),jt(F),js(F,Us);const _=F.querySelector("[data-ap-close]"),w=F.querySelector("[data-ap-cancel]"),P=F.querySelector("[data-ap-submit]"),N=F.querySelector("[data-ap-note]"),ee=F.querySelector("[data-ap-status]"),R=F.querySelectorAll("[data-ap-type]"),x=F.querySelector("[data-ap-pick-list]"),S=F.querySelector("[data-ap-context]"),C=F.querySelector("[data-ap-add-another]"),M=F.querySelector("[data-ap-select-parent]"),ie=()=>{p.currentPickedEl&&(We==null||We.update(p.currentPickedEl))};window.addEventListener("scroll",ie,{capture:!0,passive:!0}),window.addEventListener("resize",ie),Ot=()=>{window.removeEventListener("scroll",ie,!0),window.removeEventListener("resize",ie)};const ke=Z=>{Z?(S.innerHTML=va(Z),N.disabled=!1,N.placeholder="Describe the task or planning session…",setTimeout(()=>N.focus(),50)):(S.innerHTML=`
|
|
1441
1590
|
<div class="ap-sdk-panel__context-label">Next element</div>
|
|
1442
1591
|
<div class="ap-sdk-panel__context-text ap-sdk-awaiting-pick">👆 Hover and click any element on the page</div>
|
|
1443
|
-
`,N.disabled=!0,N.placeholder="Pick an element to continue…")},
|
|
1444
|
-
<div class="ap-sdk-pick-entry" data-pick-index="${
|
|
1592
|
+
`,N.disabled=!0,N.placeholder="Pick an element to continue…")},ze=()=>{if(p.completedPicks.length===0){x.style.display="none",x.innerHTML="";return}x.style.display="block",x.innerHTML=p.completedPicks.map((Z,te)=>`
|
|
1593
|
+
<div class="ap-sdk-pick-entry" data-pick-index="${te}">
|
|
1445
1594
|
<div class="ap-sdk-pick-entry__header">
|
|
1446
|
-
<span class="ap-sdk-pick-entry__number">${
|
|
1447
|
-
<span class="ap-sdk-pick-entry__element" title="${
|
|
1448
|
-
<button class="ap-sdk-pick-entry__remove" data-ap-remove="${
|
|
1595
|
+
<span class="ap-sdk-pick-entry__number">${te+1}</span>
|
|
1596
|
+
<span class="ap-sdk-pick-entry__element" title="${rt(Z.ctx.elementText??"")}">${rt(Z.ctx.elementText||"(no text)")}</span>
|
|
1597
|
+
<button class="ap-sdk-pick-entry__remove" data-ap-remove="${te}" aria-label="Remove pick ${te+1}">×</button>
|
|
1449
1598
|
</div>
|
|
1450
|
-
<div class="ap-sdk-pick-entry__instruction">${
|
|
1599
|
+
<div class="ap-sdk-pick-entry__instruction">${rt(Z.instruction)}</div>
|
|
1451
1600
|
</div>
|
|
1452
|
-
`).join(""),x.querySelectorAll("[data-ap-remove]").forEach(
|
|
1601
|
+
`).join(""),x.querySelectorAll("[data-ap-remove]").forEach(Z=>{Z.addEventListener("click",()=>{const te=parseInt(Z.dataset.apRemove,10);p.completedPicks.splice(te,1),ze()})})},Ye=()=>{if(!p.currentPickedEl){M.style.display="none";return}M.style.display="",M.disabled=!p.currentPickedEl.parentElement||p.awaitingPick},V=(Z,te)=>{p.currentCtx=Z,p.currentPickedEl=te,ke(Z),We==null||We.update(te),Ye()};Ye(),M.addEventListener("click",()=>{var te;const Z=(te=p.currentPickedEl)==null?void 0:te.parentElement;Z&&V(Ca(Z),Z)});const _e=()=>{$r(),d==null||d()};_.addEventListener("click",_e),w.addEventListener("click",_e),R.forEach(Z=>{Z.addEventListener("click",()=>{p.captureType=Z.dataset.apType,R.forEach(te=>te.classList.toggle("ap-sdk-active",te===Z))})});const Ke=F.querySelector("[data-ap-reconfigure]");if(a?Ke.addEventListener("click",()=>{_e(),a()}):Ke.style.display="none",C&&u){const Z=()=>{C.disabled=!N.value.trim()||p.submitting||p.awaitingPick};N.addEventListener("input",Z),C.addEventListener("click",()=>{const te=N.value.trim();!te||p.awaitingPick||(p.completedPicks.push({ctx:p.currentCtx,instruction:te}),ze(),N.value="",p.awaitingPick=!0,C.disabled=!0,Ye(),ke(null),u((Ce,Pe)=>{p.awaitingPick=!1,V(Ce,Pe),Z()}))})}P.addEventListener("click",async()=>{var rn,ge;if(p.submitting)return;let Z=n.backendUrl??"",te=n.token??"";if(h){const Ee=F==null?void 0:F.querySelector("[data-ap-backend-url]"),W=F==null?void 0:F.querySelector("[data-ap-token]");if(Ee&&(Z=Ee.value.trim()),W&&(te=W.value.trim()),!Z){xr(ee,"error","Backend URL is required.");return}if(!te){xr(ee,"error","API Token is required.");return}}const Ce=N.value.trim();if(!Ce){xr(ee,"error","Please enter an instruction.");return}p.submitting=!0,ya(F,!0),xr(ee,null,""),P.textContent="Submitting…";const Pe={backendUrl:Z,token:te},dt=m.getOptions(),pt=[...p.completedPicks,{ctx:p.currentCtx,instruction:Ce}];try{let Ee=r;Ee||(Ee=await uc(Pe,o),i({backendUrl:Z,token:te}));let W,Ue,J;if(pt.length===1)if(p.captureType==="task")W=(await vs(Pe,Ee.id,Ce,p.currentCtx,dt)).id,Ue="task",J=Ce.slice(0,120)||p.currentCtx.pageTitle||"Browser capture";else if(p.captureType==="planning"){let Ze=Iu(Ce,{...p.currentCtx,ancestry:p.currentCtx.outerTree||p.currentCtx.ancestry});(rn=p.currentCtx.innerTree)!=null&&rn.trim()&&(Ze+=`
|
|
1453
1602
|
|
|
1454
1603
|
Element tree:
|
|
1455
|
-
${p.currentCtx.innerTree}`),
|
|
1604
|
+
${p.currentCtx.innerTree}`),(ge=p.currentCtx.interactionSteps)!=null&&ge.length&&(Ze+=`
|
|
1605
|
+
|
|
1606
|
+
Recorded steps:
|
|
1607
|
+
${Uc(p.currentCtx.interactionSteps)}`),W=(await Xi(Pe,Ee.id,Ze,dt)).id,Ue="planning",J=Ce.slice(0,120)||p.currentCtx.pageTitle||"Planning session"}else W=(await Ji(Pe,Ee.id,Ce,p.currentCtx,dt)).id,Ue="automate",J=Ce.slice(0,120)||p.currentCtx.pageTitle||"Browser automation";else{const Ze=ck(pt),qe=pt[0].instruction.slice(0,120)||pt[0].ctx.pageTitle||"Multi-element capture",ve=pt.map(me=>me.instruction).filter(Boolean).join(`
|
|
1608
|
+
|
|
1609
|
+
`);p.captureType==="task"?(W=(await vs(Pe,Ee.id,Ze,pt[0].ctx,dt,qe,lc,ve)).id,Ue="task",J=qe):p.captureType==="planning"?(W=(await Xi(Pe,Ee.id,Ze,dt)).id,Ue="planning",J=qe):(W=(await Ji(Pe,Ee.id,Ze,pt[0].ctx,dt,qe,ve)).id,Ue="automate",J=qe)}if(Mb({id:W,type:Ue,title:J,backendUrl:Z,createdAt:new Date().toISOString()}),Vc(Pe).catch(()=>{}),h&&i({backendUrl:Z,token:te}),Ue==="automate"){_e(),Vs(W,Pe,Z,J,d);return}const je=Ue==="task"?`${Z.replace(/\/+$/,"")}/tasks/${W}`:`${Z.replace(/\/+$/,"")}/planning/${W}`;lk(ee,Ue,J,je,_e),F.classList.add("ap-sdk-panel--success"),Ot==null||Ot(),Ot=null,We==null||We.hide(),p.submitting=!1}catch(Ee){xr(ee,"error",Ee instanceof Error?Ee.message:"An unexpected error occurred."),p.submitting=!1,ya(F,!1),P.textContent="Submit"}}),setTimeout(()=>N.focus(),50)}const ak={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};function va(e){var t;return(t=e.interactionSteps)!=null&&t.length?`
|
|
1610
|
+
<div class="ap-sdk-panel__context-label">Recorded steps (${e.interactionSteps.length})</div>
|
|
1611
|
+
<div class="ap-sdk-panel__context-steps">
|
|
1612
|
+
${e.interactionSteps.map(n=>`
|
|
1613
|
+
<div class="ap-sdk-panel__context-step">
|
|
1614
|
+
<span class="ap-sdk-panel__context-step-icon">${ak[n.action]}</span>
|
|
1615
|
+
<span class="ap-sdk-panel__context-step-text">${rt(n.description)}</span>
|
|
1616
|
+
</div>
|
|
1617
|
+
`).join("")}
|
|
1618
|
+
</div>
|
|
1619
|
+
`:`
|
|
1456
1620
|
<div class="ap-sdk-panel__context-label">Captured element</div>
|
|
1457
|
-
<div class="ap-sdk-panel__context-text" title="${
|
|
1458
|
-
${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${
|
|
1459
|
-
`}function
|
|
1621
|
+
<div class="ap-sdk-panel__context-text" title="${rt(e.elementText??"")}">${rt(e.elementText||"(no text)")}</div>
|
|
1622
|
+
${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${rt(e.cssSelector)}">${rt(e.cssSelector)}</div>`:""}
|
|
1623
|
+
`}function ck(e){return e.map((t,n)=>{var o,i;const r=[`## Pick ${n+1}`,""];return(o=t.ctx.interactionSteps)!=null&&o.length?r.push("Recorded steps:",Uc(t.ctx.interactionSteps)):(r.push(`Element: ${t.ctx.elementText||"(no text)"}`),t.ctx.cssSelector&&r.push(`Selector: ${t.ctx.cssSelector}`),t.ctx.ancestry&&r.push(`Ancestry: ${t.ctx.ancestry}`)),r.push(`Page: ${t.ctx.pageTitle} (${t.ctx.pageUrl})`),(i=t.ctx.innerTree)!=null&&i.trim()&&r.push(`
|
|
1460
1624
|
Element tree:
|
|
1461
1625
|
${t.ctx.innerTree}`),r.push("",`Instruction:
|
|
1462
1626
|
${t.instruction}`),r.join(`
|
|
@@ -1464,23 +1628,23 @@ ${t.instruction}`),r.join(`
|
|
|
1464
1628
|
|
|
1465
1629
|
---
|
|
1466
1630
|
|
|
1467
|
-
`)}function
|
|
1631
|
+
`)}function xr(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 lk(e,t,n,r,o){const i=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=`
|
|
1468
1632
|
<div class="ap-sdk-success-card">
|
|
1469
1633
|
<svg class="ap-sdk-success-check" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
|
|
1470
1634
|
<circle class="ap-sdk-success-check__circle" cx="24" cy="24" r="22"/>
|
|
1471
1635
|
<path class="ap-sdk-success-check__tick" d="M14 24l7 7 13-14"/>
|
|
1472
1636
|
</svg>
|
|
1473
|
-
<p class="ap-sdk-success-headline">${
|
|
1637
|
+
<p class="ap-sdk-success-headline">${rt(a)}</p>
|
|
1474
1638
|
<div class="ap-sdk-success-meta">
|
|
1475
|
-
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${
|
|
1476
|
-
<span class="ap-sdk-success-title" title="${
|
|
1639
|
+
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${rt(i)}</span>
|
|
1640
|
+
<span class="ap-sdk-success-title" title="${rt(n)}">${rt(d)}</span>
|
|
1477
1641
|
</div>
|
|
1478
1642
|
<div class="ap-sdk-success-actions">
|
|
1479
|
-
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${
|
|
1643
|
+
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${rt(u)}</button>
|
|
1480
1644
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-success-close>Close</button>
|
|
1481
1645
|
</div>
|
|
1482
1646
|
</div>
|
|
1483
|
-
`,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function
|
|
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 ya(e,t){e.querySelectorAll("button, input, textarea, select").forEach(n=>{n.disabled=t})}function rt(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}let oe=null;function Kc(){return oe!==null}function _n(){oe&&Zt(oe),oe==null||oe.remove(),oe=null}function uk(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function dk(e){if(oe){_n();return}oe=document.createElement("div"),oe.className="ap-sdk-panel",oe.setAttribute("data-ap-sdk","1"),oe.setAttribute("role","dialog"),oe.setAttribute("aria-modal","true"),oe.setAttribute("aria-label","My captures"),oe.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),oe.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),oe.innerHTML=`
|
|
1484
1648
|
<div class="ap-sdk-panel__header">
|
|
1485
1649
|
<span class="ap-sdk-panel__title">
|
|
1486
1650
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1493,18 +1657,18 @@ ${t.instruction}`),r.join(`
|
|
|
1493
1657
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-clear-history>Clear history</button>
|
|
1494
1658
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-close-list>Close</button>
|
|
1495
1659
|
</div>
|
|
1496
|
-
`,document.body.appendChild(oe),
|
|
1660
|
+
`,document.body.appendChild(oe),jt(oe),js(oe,Us),oe.querySelector("[data-ap-close]").addEventListener("click",()=>{_n()}),oe.querySelector("[data-ap-close-list]").addEventListener("click",()=>{_n()}),oe.querySelector("[data-ap-clear-history]").addEventListener("click",()=>{Ub(),wn(0),wa(e)}),wa(e)}function wa(e){if(!oe)return;const t=oe.querySelector("[data-ap-list-body]"),n=nr();if(n.length===0){t.innerHTML='<p class="ap-sdk-list-empty">No captures yet. Use the capture button to get started.</p>';return}if(t.innerHTML=n.map(r=>`
|
|
1497
1661
|
<div class="ap-sdk-list-item">
|
|
1498
1662
|
<div class="ap-sdk-list-item__row">
|
|
1499
|
-
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${
|
|
1500
|
-
<span class="ap-sdk-list-item__title" title="${
|
|
1663
|
+
<span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${uk(r.type)}</span>
|
|
1664
|
+
<span class="ap-sdk-list-item__title" title="${po(r.title)}">${fk(r.title)}</span>
|
|
1501
1665
|
</div>
|
|
1502
1666
|
<div class="ap-sdk-list-item__row">
|
|
1503
|
-
<span class="ap-sdk-status-badge" data-ap-status="${
|
|
1504
|
-
${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${
|
|
1667
|
+
<span class="ap-sdk-status-badge" data-ap-status="${po(r.id)}">${e?"…":"—"}</span>
|
|
1668
|
+
${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(hk(r))}" target="_blank" rel="noopener noreferrer">View →</a>`}
|
|
1505
1669
|
</div>
|
|
1506
1670
|
</div>
|
|
1507
|
-
`).join(""),e){const r=e;Promise.all(n.map(o
|
|
1671
|
+
`).join(""),e){const r=e;Promise.all(n.map(o=>pk(o,r))).then(o=>{wn(Xc(o))}),t.querySelectorAll("[data-ap-resume]").forEach(o=>{o.addEventListener("click",()=>{const i=o.dataset.apResume,a=n.find(u=>u.id===i);a&&(_n(),Vs(a.id,r,a.backendUrl,a.title,()=>{}))})})}}async function pk(e,t){const n=await Jc(e,t),r=oe==null?void 0:oe.querySelector(`[data-ap-status="${CSS.escape(e.id)}"]`);return r&&(r.textContent=n.status.replace(/_/g," "),r.className=`ap-sdk-status-badge ap-sdk-status-badge--${n.status.replace(/_/g,"-")}`),n}function hk(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 fk(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}const ni="ap-sdk-config";function gk(){try{const e=localStorage.getItem(ni);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 mk(e){localStorage.setItem(ni,JSON.stringify(e))}function bk(){localStorage.removeItem(ni)}let Y=null;function Sr(){Y&&Zt(Y),Y==null||Y.remove(),Y=null}function kk(e){Y&&Sr(),Y=document.createElement("div"),Y.className="ap-sdk-panel",Y.setAttribute("data-ap-sdk","1"),Y.setAttribute("role","dialog"),Y.setAttribute("aria-modal","true"),Y.setAttribute("aria-label","Connect to Agent Platform"),t("",""),document.body.appendChild(Y),jt(Y);function t(r,o){if(!Y)return;Y.innerHTML=`
|
|
1508
1672
|
<div class="ap-sdk-panel__header">
|
|
1509
1673
|
<span class="ap-sdk-panel__title">
|
|
1510
1674
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1517,13 +1681,13 @@ ${t.instruction}`),r.join(`
|
|
|
1517
1681
|
<label class="ap-sdk-panel__label" for="ap-sdk-cfg-url">Backend URL</label>
|
|
1518
1682
|
<input id="ap-sdk-cfg-url" class="ap-sdk-panel__input" type="url"
|
|
1519
1683
|
placeholder="https://your-platform.example.com"
|
|
1520
|
-
value="${
|
|
1684
|
+
value="${gs(r)}" autocomplete="off" data-ap-cfg-url />
|
|
1521
1685
|
</div>
|
|
1522
1686
|
<div class="ap-sdk-panel__field">
|
|
1523
1687
|
<label class="ap-sdk-panel__label" for="ap-sdk-cfg-token">API Token</label>
|
|
1524
1688
|
<input id="ap-sdk-cfg-token" class="ap-sdk-panel__input" type="password"
|
|
1525
1689
|
placeholder="Paste your personal API token"
|
|
1526
|
-
value="${
|
|
1690
|
+
value="${gs(o)}" autocomplete="off" data-ap-cfg-token />
|
|
1527
1691
|
</div>
|
|
1528
1692
|
<p class="ap-sdk-config-hint">
|
|
1529
1693
|
Create a token at <strong>Settings › API Tokens</strong> in Agent Platform.
|
|
@@ -1534,7 +1698,7 @@ ${t.instruction}`),r.join(`
|
|
|
1534
1698
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-connect>Connect</button>
|
|
1535
1699
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-cancel>Cancel</button>
|
|
1536
1700
|
</div>
|
|
1537
|
-
`;const
|
|
1701
|
+
`;const i=Y.querySelector("[data-ap-cfg-url]"),a=Y.querySelector("[data-ap-cfg-token]"),u=Y.querySelector("[data-ap-cfg-status]"),d=Y.querySelector("[data-ap-connect]");Y.querySelector("[data-ap-close]").addEventListener("click",()=>{Sr()}),Y.querySelector("[data-ap-cancel]").addEventListener("click",()=>{Sr()}),d.addEventListener("click",async()=>{const p=i.value.trim(),h=a.value.trim();if(!p){$n(u,"error","Backend URL is required.");return}if(!h){$n(u,"error","API Token is required.");return}d.disabled=!0,d.textContent="Connecting…",$n(u,null,"");try{const m=await Ig({backendUrl:p,token:h});if(m.length===0){$n(u,"error","No projects found — check your token permissions."),d.disabled=!1,d.textContent="Connect";return}n(p,h,m)}catch(k){$n(u,"error",`Could not connect — ${k instanceof Error?k.message:"check URL and token"}`),d.disabled=!1,d.textContent="Connect"}}),setTimeout(()=>i.focus(),50)}function n(r,o,i){if(!Y)return;const a=i.map(p=>`<option value="${gs(p.key)}">${xa(p.name)} (${xa(p.key)})</option>`).join("");Y.innerHTML=`
|
|
1538
1702
|
<div class="ap-sdk-panel__header">
|
|
1539
1703
|
<span class="ap-sdk-panel__title">
|
|
1540
1704
|
<span class="ap-sdk-panel__logo">AP</span>
|
|
@@ -1547,7 +1711,7 @@ ${t.instruction}`),r.join(`
|
|
|
1547
1711
|
<label class="ap-sdk-panel__label" for="ap-sdk-cfg-project">Project</label>
|
|
1548
1712
|
<select id="ap-sdk-cfg-project" class="ap-sdk-panel__input" data-ap-cfg-project>
|
|
1549
1713
|
<option value="">Select a project…</option>
|
|
1550
|
-
${
|
|
1714
|
+
${a}
|
|
1551
1715
|
</select>
|
|
1552
1716
|
</div>
|
|
1553
1717
|
</div>
|
|
@@ -1556,5 +1720,26 @@ ${t.instruction}`),r.join(`
|
|
|
1556
1720
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-save>Save</button>
|
|
1557
1721
|
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-back>Back</button>
|
|
1558
1722
|
</div>
|
|
1559
|
-
`;const
|
|
1723
|
+
`;const u=Y.querySelector("[data-ap-cfg-project]"),d=Y.querySelector("[data-ap-cfg-status]");Y.querySelector("[data-ap-close]").addEventListener("click",()=>{Sr()}),Y.querySelector("[data-ap-back]").addEventListener("click",()=>t(r,o)),Y.querySelector("[data-ap-save]").addEventListener("click",()=>{const p=u.value;if(!p){$n(d,"error","Please select a project.");return}Sr(),e({backendUrl:r,token:o,projectCode:p})})}}function $n(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 gs(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function xa(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}let ct=null,Uo=!1;function _k(){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}),Uo=!1}function Qc(){ct||(ct=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||Uo||(Uo=!0,queueMicrotask(_k))}),ct.observe(document.body,{childList:!0}))}function vk(){ct==null||ct.disconnect(),ct=null,Uo=!1}const yk={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};let Se=null,Yt=[];function To(){Se&&Zt(Se),Se==null||Se.remove(),Se=null,Yt=[]}function wk(e,t,n){Se&&To(),Yt=[...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
|
+
<div class="ap-sdk-panel__header">
|
|
1725
|
+
<span class="ap-sdk-panel__title">
|
|
1726
|
+
<span class="ap-sdk-panel__logo">AP</span>
|
|
1727
|
+
Review recorded steps
|
|
1728
|
+
</span>
|
|
1729
|
+
<div class="ap-sdk-panel__header-actions">
|
|
1730
|
+
<button class="ap-sdk-panel__close" aria-label="Close" data-ap-review-close>×</button>
|
|
1731
|
+
</div>
|
|
1732
|
+
</div>
|
|
1733
|
+
<div class="ap-sdk-record-review__list" data-ap-review-list></div>
|
|
1734
|
+
<div class="ap-sdk-panel__footer">
|
|
1735
|
+
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-review-continue>Continue</button>
|
|
1736
|
+
<button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-review-cancel>Cancel</button>
|
|
1737
|
+
</div>
|
|
1738
|
+
`,document.body.appendChild(Se),jt(Se);const r=Se.querySelector("[data-ap-review-list]"),o=Se.querySelector("[data-ap-review-continue]"),i=()=>{if(Yt.length===0){r.innerHTML='<p class="ap-sdk-list-empty">No steps recorded.</p>',o.disabled=!0;return}o.disabled=!1,r.innerHTML=Yt.map((u,d)=>`
|
|
1739
|
+
<div class="ap-sdk-record-step" data-step-index="${d}">
|
|
1740
|
+
<span class="ap-sdk-record-step__icon">${yk[u.action]}</span>
|
|
1741
|
+
${u.action==="inputText"&&!u.redacted?`<input class="ap-sdk-record-step__input" type="text" value="${xk(u.value??"")}" data-ap-step-value />`:`<span class="ap-sdk-record-step__description">${el(u.description)}</span>`}
|
|
1742
|
+
<button class="ap-sdk-record-step__remove" data-ap-step-remove="${d}" aria-label="Remove step ${d+1}">✕</button>
|
|
1743
|
+
</div>
|
|
1744
|
+
`).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(u=>{u.addEventListener("click",()=>{const d=parseInt(u.dataset.apStepRemove,10);Yt.splice(d,1),i()})}),r.querySelectorAll("[data-ap-step-value]").forEach(u=>{const d=u.closest("[data-step-index]"),p=parseInt(d.dataset.stepIndex,10);u.addEventListener("input",()=>{const h=Yt[p];h.value=u.value,h.description=Mc(h.elementText??"",u.value,!1)})})};i();const a=()=>{To()};Se.querySelector("[data-ap-review-close]").addEventListener("click",a),Se.querySelector("[data-ap-review-cancel]").addEventListener("click",a),o.addEventListener("click",()=>{if(Yt.length===0)return;const u=Yt,d={...Ea(),pageUrl:window.location.href,pageTitle:document.title,interactionSteps:u};To(),t(d)})}function el(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function xk(e){return el(e)}let j=null,jo=null,Zo=null,qo=null;function ri(e,t,n){jo=e,Zo=t,qo=n,Gc(e,t,n)}const tl="#agent-platform-web-sdk",nl="ap-sdk-fab-unlocked";let kn=null;function rl(){try{if(localStorage.getItem(nl)==="1")return!0}catch{}return window.location.hash===tl}function Sa(){try{localStorage.setItem(nl,"1")}catch{}}async function ol(e){if(Nr(),!(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},ri(()=>sl(),()=>Tk(),()=>si()),wn(nr().length),j.backendUrl&&j.token){const t=j.backendUrl,n=j.token;await ul(),Vc({backendUrl:t,token:n}).catch(()=>{});const r=Vg();r&&Vs(r.taskId,{backendUrl:t,token:n},r.backendUrl,r.title,()=>{})}Qc()}}async function oi(e,t){if(!j)throw new Error("AgentPlatformSDK: call init() first.");j.backendUrl=e,j.token=t,j.project=null,await ul()}function sl(){if(!j)throw new Error("AgentPlatformSDK: call init() first.");Fn()||(Nr(),Ti(async(e,t)=>{Kc()&&_n(),Yc(e,t,{backendUrl:j.backendUrl,token:j.token},j.project,j.projectCode,async n=>{await oi(n.backendUrl,n.token)},xn,n=>{Ti((r,o)=>{ti()&&n(r,o)},()=>{il()})},()=>{Fn()&&Ls()})},()=>{}))}function Sk(){Ls()}function Tk(){if(!j)throw new Error("AgentPlatformSDK: call init() first.");_o()||(Nr(),Jb(e=>{wk(e,t=>{Yc(t,null,{backendUrl:j.backendUrl,token:j.token},j.project,j.projectCode,async n=>{await oi(n.backendUrl,n.token)},xn,void 0,()=>{})})}))}function il(){ti()&&$r()}function Ek(){return Fn()}function al(){vk(),kn&&(window.removeEventListener("hashchange",kn),kn=null),Ls(),Xb(),To(),$r(),_n(),Wc(),jo=null,Zo=null,qo=null,j=null}function cl(){if(typeof window>"u"||typeof document>"u")return;Nr();const e=gk(),t=()=>{e?ll(e).catch(console.error):(ri(()=>xn(),()=>xn(),()=>si()),wn(nr().length),Qc())};if(rl()){Sa(),t();return}kn=()=>{window.location.hash===tl&&(Sa(),window.removeEventListener("hashchange",kn),kn=null,t())},window.addEventListener("hashchange",kn)}function Ak(){jo&&Zo&&qo&&Gc(jo,Zo,qo)}function Ck(){Wc()}function xn(){kk(e=>{mk(e),ll(e).catch(console.error)})}function Pk(){bk(),al(),Nr(),rl()&&(ri(()=>xn(),()=>xn(),()=>si()),wn(nr().length))}async function ll(e){await ol({projectCode:e.projectCode,backendUrl:e.backendUrl,token:e.token})}function si(){if(Kc()){_n();return}ti()&&$r();const e=j!=null&&j.backendUrl&&(j!=null&&j.token)?{backendUrl:j.backendUrl,token:j.token}:null;dk(e)}async function ul(){if(!(!j||!j.backendUrl||!j.token||j.project||j.resolvingProject)){j.resolvingProject=!0;try{j.project=await uc({backendUrl:j.backendUrl,token:j.token},j.projectCode)}catch{}finally{j&&(j.resolvingProject=!1)}}}cl();exports.activateElementPicker=sl;exports.autoInit=cl;exports.clearConfig=Pk;exports.closePanelIfOpen=il;exports.configure=xn;exports.deactivateElementPicker=Sk;exports.destroy=al;exports.hideFab=Ck;exports.init=ol;exports.isPickerRunning=Ek;exports.showFab=Ak;exports.updateCredentials=oi;
|
|
1560
1745
|
//# sourceMappingURL=web-sdk.cjs.map
|