@tung-engineering/agent-platform-web-sdk 0.0.71 → 0.0.73

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.
@@ -1355,14 +1355,14 @@ button.ap-sdk-list-item__link {
1355
1355
 
1356
1356
  `)}k.write("payload.value = newResult;"),k.write("return payload;");const N=k.compile();return(S,P)=>N(m,S,P)};let i;const a=br,d=!$i.jitless,p=d&&cu.value,h=t.catchall;let g;e._zod.parse=(m,k)=>{g!=null||(g=r.value);const y=m.value;return a(y)?d&&p&&(k==null?void 0:k.async)===!1&&k.jitless!==!0?(i||(i=o(t.shape)),m=i(m,k),h?ta([],y,m,k,g,e):m):n(m,k):(m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m)}});function na(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=>!Gn(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(a=>an(a,r,rn())))}),t)}const ra=w("$ZodUnion",(e,t)=>{me.init(e,t),te(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),te(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),te(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),te(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>fs(i.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let a=!1;const d=[];for(const u of t.options){const p=u._zod.run({value:o.value,issues:[]},i);if(p instanceof Promise)d.push(p),a=!0;else{if(p.issues.length===0)return p;d.push(p)}}return a?Promise.all(d).then(u=>na(u,o,e,i)):na(d,o,e,i)}}),Yd=w("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ra.init(e,t);const n=e._zod.parse;te(e._zod,"propValues",()=>{const o={};for(const i of t.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[d,u]of Object.entries(a)){o[d]||(o[d]=new Set);for(const p of u)o[d].add(p)}}return o});const r=to(()=>{var a;const o=t.options,i=new Map;for(const d of o){const u=(a=d._zod.propValues)==null?void 0:a[t.discriminator];if(!u||u.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(d)}"`);for(const p of u){if(i.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);i.set(p,d)}}return i});e._zod.parse=(o,i)=>{const a=o.value;if(!br(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const d=r.value.get(a==null?void 0:a[t.discriminator]);return d?d._zod.run(o,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),Vd=w("$ZodIntersection",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([u,p])=>oa(n,u,p)):oa(n,i,a)}});function _s(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Fn(e)&&Fn(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o=v(v({},e),t);for(const i of r){const a=_s(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],a=_s(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function oa(e,t,n){const r=new Map;let o;for(const d of t.issues)if(d.code==="unrecognized_keys"){o!=null||(o=d);for(const u of d.keys)r.has(u)||r.set(u,{}),r.get(u).l=!0}else e.issues.push(d);for(const d of n.issues)if(d.code==="unrecognized_keys")for(const u of d.keys)r.has(u)||r.set(u,{}),r.get(u).r=!0;else e.issues.push(d);const i=[...r].filter(([,d])=>d.l&&d.r).map(([d])=>d);if(i.length&&o&&e.issues.push(U(v({},o),{keys:i})),Gn(e))return e;const a=_s(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const Xd=w("$ZodRecord",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Fn(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],a=t.keyType._zod.values;if(a){n.value={};const d=new Set;for(const p of a)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){d.add(typeof p=="number"?p.toString():p);const h=t.valueType._zod.run({value:o[p],issues:[]},r);h instanceof Promise?i.push(h.then(g=>{g.issues.length&&n.issues.push(...Wn(p,g.issues)),n.value[p]=g.value})):(h.issues.length&&n.issues.push(...Wn(p,h.issues)),n.value[p]=h.value)}let u;for(const p in o)d.has(p)||(u=u!=null?u:[],u.push(p));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:u})}else{n.value={};for(const d of Reflect.ownKeys(o)){if(d==="__proto__")continue;let u=t.keyType._zod.run({value:d,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof d=="string"&&Wi.test(d)&&u.issues.length&&u.issues.some(g=>g.code==="invalid_type"&&g.expected==="number")){const g=t.keyType._zod.run({value:Number(d),issues:[]},r);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(u=g)}if(u.issues.length){t.mode==="loose"?n.value[d]=o[d]:n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(g=>an(g,r,rn())),input:d,path:[d],inst:e});continue}const h=t.valueType._zod.run({value:o[d],issues:[]},r);h instanceof Promise?i.push(h.then(g=>{g.issues.length&&n.issues.push(...Wn(d,g.issues)),n.value[u.value]=g.value})):(h.issues.length&&n.issues.push(...Wn(d,h.issues)),n.value[u.value]=h.value)}}return i.length?Promise.all(i).then(()=>n):n}}),Kd=w("$ZodEnum",(e,t)=>{me.init(e,t);const n=Oi(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>lu.has(typeof o)).map(o=>typeof o=="string"?Bn(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),Qd=w("$ZodLiteral",(e,t)=>{if(me.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Bn(r):r?Bn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),ep=w("$ZodTransform",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new zi(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 Hn;return n.value=o,n}});function sa(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const ia=w("$ZodOptional",(e,t)=>{me.init(e,t),e._zod.optin="optional",e._zod.optout="optional",te(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),te(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${fs(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>sa(i,n.value)):sa(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),tp=w("$ZodExactOptional",(e,t)=>{ia.init(e,t),te(e._zod,"values",()=>t.innerType._zod.values),te(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),np=w("$ZodNullable",(e,t)=>{me.init(e,t),te(e._zod,"optin",()=>t.innerType._zod.optin),te(e._zod,"optout",()=>t.innerType._zod.optout),te(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${fs(n.source)}|null)$`):void 0}),te(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),rp=w("$ZodDefault",(e,t)=>{me.init(e,t),e._zod.optin="optional",te(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=>aa(i,t)):aa(o,t)}});function aa(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const op=w("$ZodPrefault",(e,t)=>{me.init(e,t),e._zod.optin="optional",te(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),sp=w("$ZodNonOptional",(e,t)=>{me.init(e,t),te(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=>ca(i,e)):ca(o,e)}});function ca(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const ip=w("$ZodCatch",(e,t)=>{me.init(e,t),te(e._zod,"optin",()=>t.innerType._zod.optin),te(e._zod,"optout",()=>t.innerType._zod.optout),te(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue(U(v({},n),{error:{issues:i.issues.map(a=>an(a,r,rn()))},input:n.value})),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue(U(v({},n),{error:{issues:o.issues.map(i=>an(i,r,rn()))},input:n.value})),n.issues=[]),n)}}),ap=w("$ZodPipe",(e,t)=>{me.init(e,t),te(e._zod,"values",()=>t.in._zod.values),te(e._zod,"optin",()=>t.in._zod.optin),te(e._zod,"optout",()=>t.out._zod.optout),te(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=>ao(a,t.in,r)):ao(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>ao(i,t.out,r)):ao(o,t.out,r)}});function ao(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const cp=w("$ZodReadonly",(e,t)=>{me.init(e,t),te(e._zod,"propValues",()=>t.innerType._zod.propValues),te(e._zod,"values",()=>t.innerType._zod.values),te(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),te(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(la):la(o)}});function la(e){return e.value=Object.freeze(e.value),e}const lp=w("$ZodCustom",(e,t)=>{it.init(e,t),me.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>ua(i,n,r,e));ua(o,n,r,e)}});function ua(e,t,n,r){var o;if(!e){const i={code:"custom",input:n,inst:r,path:[...(o=r._zod.def.path)!=null?o:[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(kr(i))}}var da;class up{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){var r;const n=t._zod.parent;if(n){const o=v({},(r=this.get(n))!=null?r:{});delete o.id;const i=v(v({},o),this._map.get(t));return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function dp(){return new up}(wl=(da=globalThis).__zod_globalRegistry)!=null||(da.__zod_globalRegistry=dp());const _r=globalThis.__zod_globalRegistry;function pp(e,t){return new e(v({type:"string"},D(t)))}function hp(e,t){return new e(v({type:"string",format:"email",check:"string_format",abort:!1},D(t)))}function pa(e,t){return new e(v({type:"string",format:"guid",check:"string_format",abort:!1},D(t)))}function fp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1},D(t)))}function gp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4"},D(t)))}function mp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6"},D(t)))}function bp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7"},D(t)))}function kp(e,t){return new e(v({type:"string",format:"url",check:"string_format",abort:!1},D(t)))}function _p(e,t){return new e(v({type:"string",format:"emoji",check:"string_format",abort:!1},D(t)))}function vp(e,t){return new e(v({type:"string",format:"nanoid",check:"string_format",abort:!1},D(t)))}function yp(e,t){return new e(v({type:"string",format:"cuid",check:"string_format",abort:!1},D(t)))}function wp(e,t){return new e(v({type:"string",format:"cuid2",check:"string_format",abort:!1},D(t)))}function xp(e,t){return new e(v({type:"string",format:"ulid",check:"string_format",abort:!1},D(t)))}function Sp(e,t){return new e(v({type:"string",format:"xid",check:"string_format",abort:!1},D(t)))}function Tp(e,t){return new e(v({type:"string",format:"ksuid",check:"string_format",abort:!1},D(t)))}function Ep(e,t){return new e(v({type:"string",format:"ipv4",check:"string_format",abort:!1},D(t)))}function Ap(e,t){return new e(v({type:"string",format:"ipv6",check:"string_format",abort:!1},D(t)))}function Cp(e,t){return new e(v({type:"string",format:"cidrv4",check:"string_format",abort:!1},D(t)))}function Pp(e,t){return new e(v({type:"string",format:"cidrv6",check:"string_format",abort:!1},D(t)))}function Rp(e,t){return new e(v({type:"string",format:"base64",check:"string_format",abort:!1},D(t)))}function Lp(e,t){return new e(v({type:"string",format:"base64url",check:"string_format",abort:!1},D(t)))}function Ip(e,t){return new e(v({type:"string",format:"e164",check:"string_format",abort:!1},D(t)))}function zp(e,t){return new e(v({type:"string",format:"jwt",check:"string_format",abort:!1},D(t)))}function $p(e,t){return new e(v({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null},D(t)))}function Op(e,t){return new e(v({type:"string",format:"date",check:"string_format"},D(t)))}function Np(e,t){return new e(v({type:"string",format:"time",check:"string_format",precision:null},D(t)))}function Dp(e,t){return new e(v({type:"string",format:"duration",check:"string_format"},D(t)))}function Mp(e,t){return new e(v({type:"number",checks:[]},D(t)))}function Up(e,t){return new e(v({type:"number",check:"number_format",abort:!1,format:"safeint"},D(t)))}function jp(e,t){return new e(v({type:"boolean"},D(t)))}function Zp(e){return new e({type:"any"})}function qp(e){return new e({type:"unknown"})}function Hp(e,t){return new e(v({type:"never"},D(t)))}function ha(e,t){return new Yi(U(v({check:"less_than"},D(t)),{value:e,inclusive:!1}))}function vs(e,t){return new Yi(U(v({check:"less_than"},D(t)),{value:e,inclusive:!0}))}function fa(e,t){return new Vi(U(v({check:"greater_than"},D(t)),{value:e,inclusive:!1}))}function ys(e,t){return new Vi(U(v({check:"greater_than"},D(t)),{value:e,inclusive:!0}))}function ga(e,t){return new nd(U(v({check:"multiple_of"},D(t)),{value:e}))}function ma(e,t){return new od(U(v({check:"max_length"},D(t)),{maximum:e}))}function co(e,t){return new sd(U(v({check:"min_length"},D(t)),{minimum:e}))}function ba(e,t){return new id(U(v({check:"length_equals"},D(t)),{length:e}))}function Fp(e,t){return new ad(U(v({check:"string_format",format:"regex"},D(t)),{pattern:e}))}function Bp(e){return new cd(v({check:"string_format",format:"lowercase"},D(e)))}function Gp(e){return new ld(v({check:"string_format",format:"uppercase"},D(e)))}function Wp(e,t){return new ud(U(v({check:"string_format",format:"includes"},D(t)),{includes:e}))}function Jp(e,t){return new dd(U(v({check:"string_format",format:"starts_with"},D(t)),{prefix:e}))}function Yp(e,t){return new pd(U(v({check:"string_format",format:"ends_with"},D(t)),{suffix:e}))}function Jn(e){return new hd({check:"overwrite",tx:e})}function Vp(e){return Jn(t=>t.normalize(e))}function Xp(){return Jn(e=>e.trim())}function Kp(){return Jn(e=>e.toLowerCase())}function Qp(){return Jn(e=>e.toUpperCase())}function eh(){return Jn(e=>au(e))}function th(e,t,n){return new e(v({type:"array",element:t},D(n)))}function nh(e,t,n){return new e(v({type:"custom",check:"custom",fn:t},D(n)))}function rh(e){const t=oh(n=>(n.addIssue=r=>{var o,i,a,d;if(typeof r=="string")n.issues.push(kr(r,n.value,t._zod.def));else{const u=r;u.fatal&&(u.continue=!1),(o=u.code)!=null||(u.code="custom"),(i=u.input)!=null||(u.input=n.value),(a=u.inst)!=null||(u.inst=t),(d=u.continue)!=null||(u.continue=!t._zod.def.abort),n.issues.push(kr(u))}},e(n.value,n)));return t}function oh(e,t){const n=new it(v({check:"custom"},D(t)));return n._zod.check=e,n}function ka(e){var n,r,o,i,a,d,u,p,h;let t=(n=e==null?void 0:e.target)!=null?n:"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:(r=e.processors)!=null?r:{},metadataRegistry:(o=e==null?void 0:e.metadata)!=null?o:_r,target:t,unrepresentable:(i=e==null?void 0:e.unrepresentable)!=null?i:"throw",override:(a=e==null?void 0:e.override)!=null?a:(()=>{}),io:(d=e==null?void 0:e.io)!=null?d:"output",counter:0,seen:new Map,cycles:(u=e==null?void 0:e.cycles)!=null?u:"ref",reused:(p=e==null?void 0:e.reused)!=null?p:"inline",external:(h=e==null?void 0:e.external)!=null?h:void 0}}function Ae(e,t,n={path:[],schemaPath:[]}){var h,g,m;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const d=(g=(h=e._zod).toJSONSchema)==null?void 0:g.call(h);if(d)a.schema=d;else{const k=U(v({},n),{schemaPath:[...n.schemaPath,e],path:n.path});if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,k);else{const E=a.schema,j=t.processors[o.type];if(!j)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);j(e,t,E,k)}const y=e._zod.parent;y&&(a.ref||(a.ref=y),Ae(y,t,k),t.seen.get(y).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),t.io==="input"&&Ve(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((m=(r=a.schema).default)!=null||(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function _a(e,t){var a,d,u,p;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const h of e.seen.entries()){const g=(a=e.metadataRegistry.get(h[0]))==null?void 0:a.id;if(g){const m=r.get(g);if(m&&m!==h[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(g,h[0])}}const o=h=>{var E,j,Q,N,T;const g=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const S=(E=e.external.registry.get(h[0]))==null?void 0:E.id,P=(j=e.external.uri)!=null?j:(Y=>Y);if(S)return{ref:P(S)};const Z=(N=(Q=h[1].defId)!=null?Q:h[1].schema.id)!=null?N:`schema${e.counter++}`;return h[1].defId=Z,{defId:Z,ref:`${P("__shared")}#/${g}/${Z}`}}if(h[1]===n)return{ref:"#"};const k=`#/${g}/`,y=(T=h[1].schema.id)!=null?T:`__schema${e.counter++}`;return{defId:y,ref:k+y}},i=h=>{if(h[1].schema.$ref)return;const g=h[1],{ref:m,defId:k}=o(h);g.def=v({},g.schema),k&&(g.defId=k);const y=g.schema;for(const E in y)delete y[E];y.$ref=m};if(e.cycles==="throw")for(const h of e.seen.entries()){const g=h[1];if(g.cycle)throw new Error(`Cycle detected: #/${(d=g.cycle)==null?void 0:d.join("/")}/<root>
1357
1357
 
1358
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const g=h[1];if(t===h[0]){i(h);continue}if(e.external){const k=(u=e.external.registry.get(h[0]))==null?void 0:u.id;if(t!==h[0]&&k){i(h);continue}}if((p=e.metadataRegistry.get(h[0]))==null?void 0:p.id){i(h);continue}if(g.cycle){i(h);continue}if(g.count>1&&e.reused==="ref"){i(h);continue}}}function va(e,t){var a,d,u,p,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=g=>{var Q,N,T;const m=e.seen.get(g);if(m.ref===null)return;const k=(Q=m.def)!=null?Q:m.schema,y=v({},k),E=m.ref;if(m.ref=null,E){r(E);const S=e.seen.get(E),P=S.schema;if(P.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=(N=k.allOf)!=null?N:[],k.allOf.push(P)):Object.assign(k,P),Object.assign(k,y),g._zod.parent===E)for(const Y in k)Y==="$ref"||Y==="allOf"||Y in y||delete k[Y];if(P.$ref)for(const Y in k)Y==="$ref"||Y==="allOf"||Y in S.def&&JSON.stringify(k[Y])===JSON.stringify(S.def[Y])&&delete k[Y]}const j=g._zod.parent;if(j&&j!==E){r(j);const S=e.seen.get(j);if(S!=null&&S.schema.$ref&&(k.$ref=S.schema.$ref,S.def))for(const P in k)P==="$ref"||P==="allOf"||P in S.def&&JSON.stringify(k[P])===JSON.stringify(S.def[P])&&delete k[P]}e.override({zodSchema:g,jsonSchema:k,path:(T=m.path)!=null?T:[]})};for(const g of[...e.seen.entries()].reverse())r(g[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const g=(d=e.external.registry.get(t))==null?void 0:d.id;if(!g)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(g)}Object.assign(o,(u=n.def)!=null?u:n.schema);const i=(h=(p=e.external)==null?void 0:p.defs)!=null?h:{};for(const g of e.seen.entries()){const m=g[1];m.def&&m.defId&&(i[m.defId]=m.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const g=JSON.parse(JSON.stringify(o));return Object.defineProperty(g,"~standard",{value:U(v({},t["~standard"]),{jsonSchema:{input:lo(t,"input",e.processors),output:lo(t,"output",e.processors)}}),enumerable:!1,writable:!1}),g}catch(g){throw new Error("Error converting schema to JSON.")}}function Ve(e,t){const n=t!=null?t:{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Ve(r.element,n);if(r.type==="set")return Ve(r.valueType,n);if(r.type==="lazy")return Ve(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 Ve(r.innerType,n);if(r.type==="intersection")return Ve(r.left,n)||Ve(r.right,n);if(r.type==="record"||r.type==="map")return Ve(r.keyType,n)||Ve(r.valueType,n);if(r.type==="pipe")return Ve(r.in,n)||Ve(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Ve(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Ve(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Ve(o,n))return!0;return!!(r.rest&&Ve(r.rest,n))}return!1}const sh=(e,t={})=>n=>{const r=ka(U(v({},n),{processors:t}));return Ae(e,r),_a(r,e),va(r,e)},lo=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=ka(U(v({},o!=null?o:{}),{target:i,io:t,processors:n}));return Ae(e,a),_a(a,e),va(a,e)},ih={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ah=(e,t,n,r)=>{var h;const o=n;o.type="string";const{minimum:i,maximum:a,format:d,patterns:u,contentEncoding:p}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),d&&(o.format=(h=ih[d])!=null?h:d,o.format===""&&delete o.format,d==="time"&&delete o.format),p&&(o.contentEncoding=p),u&&u.size>0){const g=[...u];g.length===1?o.pattern=g[0].source:g.length>1&&(o.allOf=[...g.map(m=>U(v({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:m.source}))])}},ch=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:d,multipleOf:u,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof d=="string"&&d.includes("int")?o.type="integer":o.type="number",typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=h,o.exclusiveMinimum=!0):o.exclusiveMinimum=h),typeof i=="number"&&(o.minimum=i,typeof h=="number"&&t.target!=="draft-04"&&(h>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p),typeof a=="number"&&(o.maximum=a,typeof p=="number"&&t.target!=="draft-04"&&(p<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof u=="number"&&(o.multipleOf=u)},lh=(e,t,n,r)=>{n.type="boolean"},uh=(e,t,n,r)=>{n.not={}},dh=(e,t,n,r)=>{},ph=(e,t,n,r)=>{},hh=(e,t,n,r)=>{const o=e._zod.def,i=Oi(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},fh=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i},gh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},mh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},bh=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:a,maximum:d}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof d=="number"&&(o.maxItems=d),o.type="array",o.items=Ae(i.element,t,U(v({},r),{path:[...r.path,"items"]}))},kh=(e,t,n,r)=>{var p;const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const h in a)o.properties[h]=Ae(a[h],t,U(v({},r),{path:[...r.path,"properties",h]}));const d=new Set(Object.keys(a)),u=new Set([...d].filter(h=>{const g=i.shape[h]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));u.size>0&&(o.required=Array.from(u)),((p=i.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Ae(i.catchall,t,U(v({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},_h=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((d,u)=>Ae(d,t,U(v({},r),{path:[...r.path,i?"oneOf":"anyOf",u]})));i?n.oneOf=a:n.anyOf=a},vh=(e,t,n,r)=>{const o=e._zod.def,i=Ae(o.left,t,U(v({},r),{path:[...r.path,"allOf",0]})),a=Ae(o.right,t,U(v({},r),{path:[...r.path,"allOf",1]})),d=p=>"allOf"in p&&Object.keys(p).length===1,u=[...d(i)?i.allOf:[i],...d(a)?a.allOf:[a]];n.allOf=u},yh=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,d=a._zod.bag,u=d==null?void 0:d.patterns;if(i.mode==="loose"&&u&&u.size>0){const h=Ae(i.valueType,t,U(v({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const g of u)o.patternProperties[g.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Ae(i.keyType,t,U(v({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=Ae(i.valueType,t,U(v({},r),{path:[...r.path,"additionalProperties"]}));const p=a._zod.values;if(p){const h=[...p].filter(g=>typeof g=="string"||typeof g=="number");h.length>0&&(o.required=h)}},wh=(e,t,n,r)=>{const o=e._zod.def,i=Ae(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},xh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Sh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Th=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Eh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch(d){throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},Ah=(e,t,n,r)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Ae(i,t,r);const a=t.seen.get(e);a.ref=i},Ch=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},ya=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Ph=w("ZodISODateTime",(e,t)=>{Ad.init(e,t),ye.init(e,t)});function Rh(e){return $p(Ph,e)}const Lh=w("ZodISODate",(e,t)=>{Cd.init(e,t),ye.init(e,t)});function Ih(e){return Op(Lh,e)}const zh=w("ZodISOTime",(e,t)=>{Pd.init(e,t),ye.init(e,t)});function $h(e){return Np(zh,e)}const Oh=w("ZodISODuration",(e,t)=>{Rd.init(e,t),ye.init(e,t)});function Nh(e){return Dp(Oh,e)}const lt=w("ZodError",(e,t)=>{Zi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>vu(e,n)},flatten:{value:n=>_u(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ps,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ps,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Dh=ms(lt),Mh=bs(lt),Uh=ro(lt),jh=oo(lt),Zh=xu(lt),qh=Su(lt),Hh=Tu(lt),Fh=Eu(lt),Bh=Au(lt),Gh=Cu(lt),Wh=Pu(lt),Jh=Ru(lt),ke=w("ZodType",(e,t)=>(me.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:lo(e,"input"),output:lo(e,"output")}}),e.toJSONSchema=sh(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(on(t,{checks:[...(r=t.checks)!=null?r:[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},e.with=e.check,e.clone=(n,r)=>sn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>Dh(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Uh(e,n,r),e.parseAsync=(n,r)=>L(null,null,function*(){return Mh(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>L(null,null,function*(){return jh(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>Zh(e,n,r),e.decode=(n,r)=>qh(e,n,r),e.encodeAsync=(n,r)=>L(null,null,function*(){return Hh(e,n,r)}),e.decodeAsync=(n,r)=>L(null,null,function*(){return Fh(e,n,r)}),e.safeEncode=(n,r)=>Bh(e,n,r),e.safeDecode=(n,r)=>Gh(e,n,r),e.safeEncodeAsync=(n,r)=>L(null,null,function*(){return Wh(e,n,r)}),e.safeDecodeAsync=(n,r)=>L(null,null,function*(){return Jh(e,n,r)}),e.refine=(n,r)=>e.check(Ff(n,r)),e.superRefine=n=>e.check(Bf(n)),e.overwrite=n=>e.check(Jn(n)),e.optional=()=>La(e),e.exactOptional=()=>Lf(e),e.nullable=()=>Ia(e),e.nullish=()=>La(Ia(e)),e.nonoptional=n=>Df(e,n),e.array=()=>kt(e),e.or=n=>wf([e,n]),e.and=n=>Tf(e,n),e.transform=n=>$a(e,Pf(n)),e.default=n=>$f(e,n),e.prefault=n=>Nf(e,n),e.catch=n=>Uf(e,n),e.pipe=n=>$a(e,n),e.readonly=()=>qf(e),e.describe=n=>{const r=e.clone();return _r.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=_r.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return _r.get(e);const r=e.clone();return _r.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),wa=w("_ZodString",(e,t)=>{var r,o,i;ks.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(a,d,u)=>ah(e,a,d);const n=e._zod.bag;e.format=(r=n.format)!=null?r:null,e.minLength=(o=n.minimum)!=null?o:null,e.maxLength=(i=n.maximum)!=null?i:null,e.regex=(...a)=>e.check(Fp(...a)),e.includes=(...a)=>e.check(Wp(...a)),e.startsWith=(...a)=>e.check(Jp(...a)),e.endsWith=(...a)=>e.check(Yp(...a)),e.min=(...a)=>e.check(co(...a)),e.max=(...a)=>e.check(ma(...a)),e.length=(...a)=>e.check(ba(...a)),e.nonempty=(...a)=>e.check(co(1,...a)),e.lowercase=a=>e.check(Bp(a)),e.uppercase=a=>e.check(Gp(a)),e.trim=()=>e.check(Xp()),e.normalize=(...a)=>e.check(Vp(...a)),e.toLowerCase=()=>e.check(Kp()),e.toUpperCase=()=>e.check(Qp()),e.slugify=()=>e.check(eh())}),Yh=w("ZodString",(e,t)=>{ks.init(e,t),wa.init(e,t),e.email=n=>e.check(hp(Vh,n)),e.url=n=>e.check(kp(Xh,n)),e.jwt=n=>e.check(zp(hf,n)),e.emoji=n=>e.check(_p(Kh,n)),e.guid=n=>e.check(pa(xa,n)),e.uuid=n=>e.check(fp(uo,n)),e.uuidv4=n=>e.check(gp(uo,n)),e.uuidv6=n=>e.check(mp(uo,n)),e.uuidv7=n=>e.check(bp(uo,n)),e.nanoid=n=>e.check(vp(Qh,n)),e.guid=n=>e.check(pa(xa,n)),e.cuid=n=>e.check(yp(ef,n)),e.cuid2=n=>e.check(wp(tf,n)),e.ulid=n=>e.check(xp(nf,n)),e.base64=n=>e.check(Rp(uf,n)),e.base64url=n=>e.check(Lp(df,n)),e.xid=n=>e.check(Sp(rf,n)),e.ksuid=n=>e.check(Tp(of,n)),e.ipv4=n=>e.check(Ep(sf,n)),e.ipv6=n=>e.check(Ap(af,n)),e.cidrv4=n=>e.check(Cp(cf,n)),e.cidrv6=n=>e.check(Pp(lf,n)),e.e164=n=>e.check(Ip(pf,n)),e.datetime=n=>e.check(Rh(n)),e.date=n=>e.check(Ih(n)),e.time=n=>e.check($h(n)),e.duration=n=>e.check(Nh(n))});function C(e){return pp(Yh,e)}const ye=w("ZodStringFormat",(e,t)=>{be.init(e,t),wa.init(e,t)}),Vh=w("ZodEmail",(e,t)=>{kd.init(e,t),ye.init(e,t)}),xa=w("ZodGUID",(e,t)=>{md.init(e,t),ye.init(e,t)}),uo=w("ZodUUID",(e,t)=>{bd.init(e,t),ye.init(e,t)}),Xh=w("ZodURL",(e,t)=>{_d.init(e,t),ye.init(e,t)}),Kh=w("ZodEmoji",(e,t)=>{vd.init(e,t),ye.init(e,t)}),Qh=w("ZodNanoID",(e,t)=>{yd.init(e,t),ye.init(e,t)}),ef=w("ZodCUID",(e,t)=>{wd.init(e,t),ye.init(e,t)}),tf=w("ZodCUID2",(e,t)=>{xd.init(e,t),ye.init(e,t)}),nf=w("ZodULID",(e,t)=>{Sd.init(e,t),ye.init(e,t)}),rf=w("ZodXID",(e,t)=>{Td.init(e,t),ye.init(e,t)}),of=w("ZodKSUID",(e,t)=>{Ed.init(e,t),ye.init(e,t)}),sf=w("ZodIPv4",(e,t)=>{Ld.init(e,t),ye.init(e,t)}),af=w("ZodIPv6",(e,t)=>{Id.init(e,t),ye.init(e,t)}),cf=w("ZodCIDRv4",(e,t)=>{zd.init(e,t),ye.init(e,t)}),lf=w("ZodCIDRv6",(e,t)=>{$d.init(e,t),ye.init(e,t)}),uf=w("ZodBase64",(e,t)=>{Od.init(e,t),ye.init(e,t)}),df=w("ZodBase64URL",(e,t)=>{Dd.init(e,t),ye.init(e,t)}),pf=w("ZodE164",(e,t)=>{Md.init(e,t),ye.init(e,t)}),hf=w("ZodJWT",(e,t)=>{jd.init(e,t),ye.init(e,t)}),Sa=w("ZodNumber",(e,t)=>{var r,o,i,a,d,u,p,h,g;Ki.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(m,k,y)=>ch(e,m,k),e.gt=(m,k)=>e.check(fa(m,k)),e.gte=(m,k)=>e.check(ys(m,k)),e.min=(m,k)=>e.check(ys(m,k)),e.lt=(m,k)=>e.check(ha(m,k)),e.lte=(m,k)=>e.check(vs(m,k)),e.max=(m,k)=>e.check(vs(m,k)),e.int=m=>e.check(Ta(m)),e.safe=m=>e.check(Ta(m)),e.positive=m=>e.check(fa(0,m)),e.nonnegative=m=>e.check(ys(0,m)),e.negative=m=>e.check(ha(0,m)),e.nonpositive=m=>e.check(vs(0,m)),e.multipleOf=(m,k)=>e.check(ga(m,k)),e.step=(m,k)=>e.check(ga(m,k)),e.finite=()=>e;const n=e._zod.bag;e.minValue=(i=Math.max((r=n.minimum)!=null?r:Number.NEGATIVE_INFINITY,(o=n.exclusiveMinimum)!=null?o:Number.NEGATIVE_INFINITY))!=null?i:null,e.maxValue=(u=Math.min((a=n.maximum)!=null?a:Number.POSITIVE_INFINITY,(d=n.exclusiveMaximum)!=null?d:Number.POSITIVE_INFINITY))!=null?u:null,e.isInt=((p=n.format)!=null?p:"").includes("int")||Number.isSafeInteger((h=n.multipleOf)!=null?h:.5),e.isFinite=!0,e.format=(g=n.format)!=null?g:null});function Lt(e){return Mp(Sa,e)}const ff=w("ZodNumberFormat",(e,t)=>{Zd.init(e,t),Sa.init(e,t)});function Ta(e){return Up(ff,e)}const gf=w("ZodBoolean",(e,t)=>{qd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lh(e,n,r)});function _e(e){return jp(gf,e)}const mf=w("ZodAny",(e,t)=>{Hd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dh()});function Ea(){return Zp(mf)}const bf=w("ZodUnknown",(e,t)=>{Fd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ph()});function Aa(){return qp(bf)}const kf=w("ZodNever",(e,t)=>{Bd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>uh(e,n,r)});function _f(e){return Hp(kf,e)}const vf=w("ZodArray",(e,t)=>{Gd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bh(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(co(n,r)),e.nonempty=n=>e.check(co(1,n)),e.max=(n,r)=>e.check(ma(n,r)),e.length=(n,r)=>e.check(ba(n,r)),e.unwrap=()=>e.element});function kt(e,t){return th(vf,e,t)}const yf=w("ZodObject",(e,t)=>{Jd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kh(e,n,r,o),te(e,"shape",()=>t.shape),e.keyof=()=>ut(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone(U(v({},e._zod.def),{catchall:n})),e.passthrough=()=>e.clone(U(v({},e._zod.def),{catchall:Aa()})),e.loose=()=>e.clone(U(v({},e._zod.def),{catchall:Aa()})),e.strict=()=>e.clone(U(v({},e._zod.def),{catchall:_f()})),e.strip=()=>e.clone(U(v({},e._zod.def),{catchall:void 0})),e.extend=n=>fu(e,n),e.safeExtend=n=>gu(e,n),e.merge=n=>mu(e,n),e.pick=n=>pu(e,n),e.omit=n=>hu(e,n),e.partial=(...n)=>bu(Ra,e,n[0]),e.required=(...n)=>ku(za,e,n[0])});function fe(e,t){const n=v({type:"object",shape:e!=null?e:{}},D(t));return new yf(n)}const Ca=w("ZodUnion",(e,t)=>{ra.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_h(e,n,r,o),e.options=t.options});function wf(e,t){return new Ca(v({type:"union",options:e},D(t)))}const xf=w("ZodDiscriminatedUnion",(e,t)=>{Ca.init(e,t),Yd.init(e,t)});function Pa(e,t,n){return new xf(v({type:"union",options:t,discriminator:e},D(n)))}const Sf=w("ZodIntersection",(e,t)=>{Vd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vh(e,n,r,o)});function Tf(e,t){return new Sf({type:"intersection",left:e,right:t})}const Ef=w("ZodRecord",(e,t)=>{Xd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yh(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function It(e,t,n){return new Ef(v({type:"record",keyType:e,valueType:t},D(n)))}const ws=w("ZodEnum",(e,t)=>{Kd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,i)=>hh(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const a of r)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ws(U(v(U(v({},t),{checks:[]}),D(o)),{entries:i}))},e.exclude=(r,o)=>{const i=v({},t.entries);for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new ws(U(v(U(v({},t),{checks:[]}),D(o)),{entries:i}))}});function ut(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ws(v({type:"enum",entries:n},D(t)))}const Af=w("ZodLiteral",(e,t)=>{Qd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fh(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function dt(e,t){return new Af(v({type:"literal",values:Array.isArray(e)?e:[e]},D(t)))}const Cf=w("ZodTransform",(e,t)=>{ep.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mh(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new zi(e.constructor.name);n.addIssue=i=>{var a,d,u;if(typeof i=="string")n.issues.push(kr(i,n.value,t));else{const p=i;p.fatal&&(p.continue=!1),(a=p.code)!=null||(p.code="custom"),(d=p.input)!=null||(p.input=n.value),(u=p.inst)!=null||(p.inst=e),n.issues.push(kr(p))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Pf(e){return new Cf({type:"transform",transform:e})}const Ra=w("ZodOptional",(e,t)=>{ia.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ya(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function La(e){return new Ra({type:"optional",innerType:e})}const Rf=w("ZodExactOptional",(e,t)=>{tp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ya(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Lf(e){return new Rf({type:"optional",innerType:e})}const If=w("ZodNullable",(e,t)=>{np.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ia(e){return new If({type:"nullable",innerType:e})}const zf=w("ZodDefault",(e,t)=>{rp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $f(e,t){return new zf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ui(t)}})}const Of=w("ZodPrefault",(e,t)=>{op.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Th(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Nf(e,t){return new Of({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ui(t)}})}const za=w("ZodNonOptional",(e,t)=>{sp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Df(e,t){return new za(v({type:"nonoptional",innerType:e},D(t)))}const Mf=w("ZodCatch",(e,t)=>{ip.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Uf(e,t){return new Mf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const jf=w("ZodPipe",(e,t)=>{ap.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ah(e,n,r,o),e.in=t.in,e.out=t.out});function $a(e,t){return new jf({type:"pipe",in:e,out:t})}const Zf=w("ZodReadonly",(e,t)=>{cp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ch(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function qf(e){return new Zf({type:"readonly",innerType:e})}const Hf=w("ZodCustom",(e,t)=>{lp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gh(e,n)});function Ff(e,t={}){return nh(Hf,e,t)}function Bf(e){return rh(e)}const Gf=fe({name:C().min(1).max(100).optional(),command:C().min(1).max(500),args:kt(C()).optional(),failOnError:_e().default(!0).optional(),timeout:Lt().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:C().optional(),env:It(C(),C()).optional(),runOnBackground:_e().optional()});fe({name:C(),command:C(),success:_e(),exitCode:Lt().optional(),stdout:C().optional(),stderr:C().optional(),error:C().optional(),duration:Lt(),failOnError:_e()});const _n=fe({path:C(),extraCommands:kt(Gf).optional(),id:C().uuid().optional(),rotationKey:C().optional(),usageStatus:ut(["free","in_use"]).optional()}),Wf=Pa("operation",[_n.extend({operation:dt("create"),content:C().optional(),contentPath:C().optional(),encoding:ut(["utf-8","base64"]).optional()}),_n.extend({operation:dt("merge"),data:It(C(),Ea()),mergeStrategy:ut(["deep","shallow"]).optional(),arrayMergeStrategy:ut(["concat","replace"]).optional()}),_n.extend({operation:dt("modify"),content:C().optional(),contentPath:C().optional(),createIfMissing:_e().optional()}),_n.extend({operation:dt("delete"),ignoreIfMissing:_e().optional()}),_n.extend({operation:dt("createDirectory"),contentPath:C().optional(),mode:Lt().optional(),ignoreIfExists:_e().optional()}),_n.extend({operation:dt("download"),url:C().url(),headers:It(C(),C()).optional(),timeout:Lt().min(1e3).max(3e5).optional()}),_n.extend({operation:dt("gitClone"),gitUrl:C(),gitSecretKey:C().optional(),sourceBranch:C().optional(),targetBranch:C().optional(),originalBranch:C().optional(),defaultBranch:C().optional()})]);var Te=(e=>(e.PENDING="pending",e.ASSIGNED="assigned",e.IN_PROGRESS="in_progress",e.WAITING_FOR_INPUT="waiting_for_input",e.WAITING_FOR_PLAN_APPROVAL="waiting_for_plan_approval",e.PLAN_APPROVED="plan_approved",e.PLAN_REJECTED="plan_rejected",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.RESULT_REJECTED="result_rejected",e))(Te||{});const Jf=fe({type:ut(["json","file","regex"]).describe("Extraction method"),source:C().describe("Source to extract from (file path or stdout/stderr)"),schema:fe({}).passthrough().optional().describe("JSON schema for validation"),pattern:C().optional().describe("Regex pattern for extraction")}),Yf=fe({type:ut(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:Ea().describe("Hook-specific configuration")});fe({command:C().optional().describe("Legacy — unused in SDK mode"),args:kt(C()).optional().describe("Legacy — unused in SDK mode"),env:It(C(),C()).optional().describe("Environment variables"),workingDirectory:C().optional().describe("Working directory for command execution"),fileOperations:kt(Wf).optional().describe("File operations to perform during setup"),gitUrl:C().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:C().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:C().optional().describe("Commit message for git operations"),resultExtraction:Jf.optional().describe("Schema for extracting result data"),postExecutionHooks:kt(Yf).optional().describe("Hooks to run after task completion"),executionMode:ut(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:Pa("executionMode",[fe({executionMode:dt("claudeAgentSdk"),promptText:C(),sdkOptions:fe({model:C(),permissionMode:ut(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:kt(C()),allowDangerouslySkipPermissions:_e(),persistSession:_e(),streamSdkEvents:_e().optional(),allowedTools:kt(C()).optional(),settings:fe({enabledPlugins:It(C(),_e())}),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()}),fe({executionMode:dt("opencodeSdk"),promptText:C(),sdkOptions:fe({provider:C(),model:C(),allowedTools:kt(C()).optional(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()}),fe({executionMode:dt("openaiAgentSdk"),promptText:C(),sdkOptions:fe({model:C(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()}),fe({executionMode:dt("codexSdk"),promptText:C(),sdkOptions:fe({model:C().optional(),sandboxMode:ut(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:ut(["never","on-request","on-failure","untrusted"]).optional(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()}),fe({executionMode:dt("cursorSdk"),promptText:C(),sdkOptions:fe({model:C(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:_e().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:C().optional().describe("Final approved plan content"),planApproved:_e().optional().describe("Plan approval status"),planApprovedAt:C().optional().describe("ISO timestamp of approval"),planRejected:_e().optional().describe("Plan rejection flag"),planRejectionFeedback:C().optional().describe("User rejection feedback"),rejectedPlanContent:C().optional().describe("Previously rejected plan content"),planCompletedAt:C().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:C().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:C().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:C().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:kt(fe({feedback:C(),rejectedAt:C()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:Lt().optional(),notificationChannelPlanMessageSentAt:C().optional(),notificationChannelCompletedMessageId:Lt().optional(),notificationChannelFailedMessageId:Lt().optional(),streamSdkEvents:_e().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:C().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:_e().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:kt(fe({id:C(),selectedText:C(),startOffset:Lt(),endOffset:Lt(),commentText:C(),createdAt:C()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:_e().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:_e().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:ut(["all","ignoreExistingMcpServers"]).optional().describe("MCP server strategy for this run; 'ignoreExistingMcpServers' overrides the existing .mcp.json with only the template's configured servers plus the agent-platform server"),enableBrowserTools:_e().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")}),Te.PENDING+"",Te.CANCELLED,Te.ASSIGNED+"",Te.CANCELLED,Te.IN_PROGRESS+"",Te.CANCELLED,Te.FAILED,Te.WAITING_FOR_INPUT+"",Te.CANCELLED,Te.WAITING_FOR_PLAN_APPROVAL+"",Te.CANCELLED,Te.PLAN_APPROVED+"",Te.CANCELLED,Te.PLAN_REJECTED+"",Te.CANCELLED,Te.COMPLETED+"",Te.RESULT_REJECTED+"",Te.CANCELLED,Te.FAILED+"",Te.CANCELLED+"";const Oa="browser_capture",Vf="browser_automate";function Na(e){let t=(e||"").trim().toLowerCase();const n=t.indexOf("@");return n>=0&&(t=t.slice(n+1)),t=t.split("/")[0].split(":")[0],t.startsWith("www.")&&(t=t.slice(4)),t}function Xf(e,t){const n=Na(e),r=(t||"").trim().toLowerCase();if(!n||!r)return!1;if(r.startsWith("*.")){const o=r.slice(2);return n===o||n.endsWith("."+o)}return n===Na(r)}function Da(e,t){var i;let n;try{const a=new URL(e);if(a.protocol!=="http:"&&a.protocol!=="https:")return null;n=a.hostname}catch(a){return null}let r=null,o=-1;for(const a of t)for(const d of(i=a.domains)!=null?i:[])Xf(n,d)&&d.length>o&&(o=d.length,r=a.id);return r}function Ma(e){return L(this,null,function*(){if(!e.ok){const t=yield e.json().catch(()=>({message:`HTTP ${e.status}`}));throw new Error(t.message||t.error||`HTTP ${e.status}`)}return e.json()})}const Kf=3e4;function po(r){return L(this,arguments,function*(e,t={},n=Kf){const o=new AbortController,i=setTimeout(()=>o.abort(),n);try{return yield fetch(e,U(v({},t),{signal:o.signal}))}catch(a){throw a instanceof DOMException&&a.name==="AbortError"?new Error(`Request timed out after ${Math.round(n/1e3)}s. Please check your connection and try again.`):a}finally{clearTimeout(i)}})}function Ue(e,t,n,r){return L(this,null,function*(){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=yield po(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return Ma(a)})}function Ua(e,t){return L(this,null,function*(){return Ue(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)})}const Qf=["projectId","note","ctx"];function eg(e){const t=Qf.filter(n=>e[n]===void 0||e[n]===null);if(t.length>0)throw new Error(`createTask: missing required field(s): ${t.join(", ")}`)}function xs(e,t){return L(this,null,function*(){var h,g,m,k,y,E;eg(t);const{projectId:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:d,allowSubmit:u,type:p=Oa}=t;return Ue(e,"POST","/tasks",U(v(v(v(v(v(v(v(v(v(v(v(v({type:p,title:a||r.slice(0,120)||o.pageTitle||"Browser capture",titleInstruction:d!=null?d:r,projectId:n,autoAssign:!0},i!=null&&i.claudeTemplateId?{claudeTemplateId:i.claudeTemplateId}:{}),(i==null?void 0:i.quickMode)!==void 0?{quickMode:i.quickMode}:{}),(i==null?void 0:i.modelOverride)!=null?{modelOverride:i.modelOverride}:{}),(i==null?void 0:i.claudeProfileId)!=null?{claudeProfileId:i.claudeProfileId}:{}),(i==null?void 0:i.effort)!=null?{effort:i.effort}:{}),(i==null?void 0:i.executionMode)!=null?{executionMode:i.executionMode}:{}),(h=i==null?void 0:i.selectedPluginIds)!=null&&h.length?{selectedPluginIds:i.selectedPluginIds}:{}),(g=i==null?void 0:i.selectedSkillIds)!=null&&g.length?{selectedSkillIds:i.selectedSkillIds}:{}),(m=i==null?void 0:i.selectedPluginSkillIds)!=null&&m.length?{selectedPluginSkillIds:i.selectedPluginSkillIds}:{}),(k=i==null?void 0:i.selectedMcpServerIds)!=null&&k.length?{selectedMcpServerIds:i.selectedMcpServerIds}:{}),(y=i==null?void 0:i.selectedSlashCommandIds)!=null&&y.length?{selectedSlashCommandIds:i.selectedSlashCommandIds}:{}),(E=i==null?void 0:i.selectedRemoteContextProviderIds)!=null&&E.length?{selectedRemoteContextProviderIds:i.selectedRemoteContextProviderIds}:{}),{metadata:v({type:p,note:r,source:"web-sdk",pageUrl:o.pageUrl,pageTitle:o.pageTitle,elementText:o.elementText,cssSelector:o.cssSelector,elementOuterHtml:o.elementOuterHtml,ancestry:o.ancestry,elementRole:o.elementRole,elementAriaLabel:o.elementAriaLabel,enclosingSection:o.enclosingSection,description:o.description,canonicalUrl:o.canonicalUrl,lang:o.lang,ogTitle:o.ogTitle,ogDescription:o.ogDescription,ogType:o.ogType,ogSiteName:o.ogSiteName,viewportWidth:o.viewportWidth,viewportHeight:o.viewportHeight,scrollX:o.scrollX,scrollY:o.scrollY,selectionText:o.selectionText,capturedAt:o.capturedAt,interactionSteps:o.interactionSteps},u!==void 0?{allowSubmit:u}:{})}))})}function ja(e,t){return L(this,null,function*(){return xs(e,U(v({},t),{type:Vf}))})}function Za(e,t,n,r){return L(this,null,function*(){var o;return Ue(e,"POST","/planning-sessions",v({projectId:t,instruction:n,quickMode:(o=r==null?void 0:r.quickMode)!=null?o:!1},r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}))})}function tg(e,t){return L(this,null,function*(){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Ue(e,"GET",`/claude-templates${n}`)})}function qa(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}`)})}function ng(e,t){return L(this,null,function*(){return Ue(e,"GET",`/planning-sessions/${t}`)})}function Ha(e){return L(this,null,function*(){return Ue(e,"GET","/projects")})}function rg(e){return L(this,null,function*(){return(yield Ue(e,"GET","/tenants/current")).membership})}function og(e,t){if(!e||e.includes("tenant:*")||e.includes(t))return!0;const n=t.split(":")[0];return e.includes(`${n}:*`)}function Fa(e,t,n){return L(this,null,function*(){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=yield po(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return Ma(i)})}function sg(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/browser-commands/pending`)})}function ig(e,t,n,r,o){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})})}function ag(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/chunks`)})}function cg(e,t,n){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/instructions`,{content:n})})}function lg(e,t){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/cancel`)})}function ug(e,t){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/approve-result`)})}function dg(e,t,n){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})})}function ho(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)})}function Ba(e,t,n,r){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})})}function pg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ss={exports:{}};/*!
1358
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const g=h[1];if(t===h[0]){i(h);continue}if(e.external){const k=(u=e.external.registry.get(h[0]))==null?void 0:u.id;if(t!==h[0]&&k){i(h);continue}}if((p=e.metadataRegistry.get(h[0]))==null?void 0:p.id){i(h);continue}if(g.cycle){i(h);continue}if(g.count>1&&e.reused==="ref"){i(h);continue}}}function va(e,t){var a,d,u,p,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=g=>{var Q,N,T;const m=e.seen.get(g);if(m.ref===null)return;const k=(Q=m.def)!=null?Q:m.schema,y=v({},k),E=m.ref;if(m.ref=null,E){r(E);const S=e.seen.get(E),P=S.schema;if(P.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=(N=k.allOf)!=null?N:[],k.allOf.push(P)):Object.assign(k,P),Object.assign(k,y),g._zod.parent===E)for(const Y in k)Y==="$ref"||Y==="allOf"||Y in y||delete k[Y];if(P.$ref)for(const Y in k)Y==="$ref"||Y==="allOf"||Y in S.def&&JSON.stringify(k[Y])===JSON.stringify(S.def[Y])&&delete k[Y]}const j=g._zod.parent;if(j&&j!==E){r(j);const S=e.seen.get(j);if(S!=null&&S.schema.$ref&&(k.$ref=S.schema.$ref,S.def))for(const P in k)P==="$ref"||P==="allOf"||P in S.def&&JSON.stringify(k[P])===JSON.stringify(S.def[P])&&delete k[P]}e.override({zodSchema:g,jsonSchema:k,path:(T=m.path)!=null?T:[]})};for(const g of[...e.seen.entries()].reverse())r(g[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const g=(d=e.external.registry.get(t))==null?void 0:d.id;if(!g)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(g)}Object.assign(o,(u=n.def)!=null?u:n.schema);const i=(h=(p=e.external)==null?void 0:p.defs)!=null?h:{};for(const g of e.seen.entries()){const m=g[1];m.def&&m.defId&&(i[m.defId]=m.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const g=JSON.parse(JSON.stringify(o));return Object.defineProperty(g,"~standard",{value:U(v({},t["~standard"]),{jsonSchema:{input:lo(t,"input",e.processors),output:lo(t,"output",e.processors)}}),enumerable:!1,writable:!1}),g}catch(g){throw new Error("Error converting schema to JSON.")}}function Ve(e,t){const n=t!=null?t:{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Ve(r.element,n);if(r.type==="set")return Ve(r.valueType,n);if(r.type==="lazy")return Ve(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 Ve(r.innerType,n);if(r.type==="intersection")return Ve(r.left,n)||Ve(r.right,n);if(r.type==="record"||r.type==="map")return Ve(r.keyType,n)||Ve(r.valueType,n);if(r.type==="pipe")return Ve(r.in,n)||Ve(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Ve(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Ve(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Ve(o,n))return!0;return!!(r.rest&&Ve(r.rest,n))}return!1}const sh=(e,t={})=>n=>{const r=ka(U(v({},n),{processors:t}));return Ae(e,r),_a(r,e),va(r,e)},lo=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=ka(U(v({},o!=null?o:{}),{target:i,io:t,processors:n}));return Ae(e,a),_a(a,e),va(a,e)},ih={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ah=(e,t,n,r)=>{var h;const o=n;o.type="string";const{minimum:i,maximum:a,format:d,patterns:u,contentEncoding:p}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),d&&(o.format=(h=ih[d])!=null?h:d,o.format===""&&delete o.format,d==="time"&&delete o.format),p&&(o.contentEncoding=p),u&&u.size>0){const g=[...u];g.length===1?o.pattern=g[0].source:g.length>1&&(o.allOf=[...g.map(m=>U(v({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:m.source}))])}},ch=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:d,multipleOf:u,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof d=="string"&&d.includes("int")?o.type="integer":o.type="number",typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=h,o.exclusiveMinimum=!0):o.exclusiveMinimum=h),typeof i=="number"&&(o.minimum=i,typeof h=="number"&&t.target!=="draft-04"&&(h>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p),typeof a=="number"&&(o.maximum=a,typeof p=="number"&&t.target!=="draft-04"&&(p<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof u=="number"&&(o.multipleOf=u)},lh=(e,t,n,r)=>{n.type="boolean"},uh=(e,t,n,r)=>{n.not={}},dh=(e,t,n,r)=>{},ph=(e,t,n,r)=>{},hh=(e,t,n,r)=>{const o=e._zod.def,i=Oi(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},fh=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i},gh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},mh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},bh=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:a,maximum:d}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof d=="number"&&(o.maxItems=d),o.type="array",o.items=Ae(i.element,t,U(v({},r),{path:[...r.path,"items"]}))},kh=(e,t,n,r)=>{var p;const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const h in a)o.properties[h]=Ae(a[h],t,U(v({},r),{path:[...r.path,"properties",h]}));const d=new Set(Object.keys(a)),u=new Set([...d].filter(h=>{const g=i.shape[h]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));u.size>0&&(o.required=Array.from(u)),((p=i.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Ae(i.catchall,t,U(v({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},_h=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((d,u)=>Ae(d,t,U(v({},r),{path:[...r.path,i?"oneOf":"anyOf",u]})));i?n.oneOf=a:n.anyOf=a},vh=(e,t,n,r)=>{const o=e._zod.def,i=Ae(o.left,t,U(v({},r),{path:[...r.path,"allOf",0]})),a=Ae(o.right,t,U(v({},r),{path:[...r.path,"allOf",1]})),d=p=>"allOf"in p&&Object.keys(p).length===1,u=[...d(i)?i.allOf:[i],...d(a)?a.allOf:[a]];n.allOf=u},yh=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,d=a._zod.bag,u=d==null?void 0:d.patterns;if(i.mode==="loose"&&u&&u.size>0){const h=Ae(i.valueType,t,U(v({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const g of u)o.patternProperties[g.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Ae(i.keyType,t,U(v({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=Ae(i.valueType,t,U(v({},r),{path:[...r.path,"additionalProperties"]}));const p=a._zod.values;if(p){const h=[...p].filter(g=>typeof g=="string"||typeof g=="number");h.length>0&&(o.required=h)}},wh=(e,t,n,r)=>{const o=e._zod.def,i=Ae(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},xh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Sh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Th=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Eh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch(d){throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},Ah=(e,t,n,r)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Ae(i,t,r);const a=t.seen.get(e);a.ref=i},Ch=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},ya=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Ph=w("ZodISODateTime",(e,t)=>{Ad.init(e,t),ye.init(e,t)});function Rh(e){return $p(Ph,e)}const Lh=w("ZodISODate",(e,t)=>{Cd.init(e,t),ye.init(e,t)});function Ih(e){return Op(Lh,e)}const zh=w("ZodISOTime",(e,t)=>{Pd.init(e,t),ye.init(e,t)});function $h(e){return Np(zh,e)}const Oh=w("ZodISODuration",(e,t)=>{Rd.init(e,t),ye.init(e,t)});function Nh(e){return Dp(Oh,e)}const ut=w("ZodError",(e,t)=>{Zi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>vu(e,n)},flatten:{value:n=>_u(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ps,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ps,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Dh=ms(ut),Mh=bs(ut),Uh=ro(ut),jh=oo(ut),Zh=xu(ut),qh=Su(ut),Hh=Tu(ut),Fh=Eu(ut),Bh=Au(ut),Gh=Cu(ut),Wh=Pu(ut),Jh=Ru(ut),ke=w("ZodType",(e,t)=>(me.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:lo(e,"input"),output:lo(e,"output")}}),e.toJSONSchema=sh(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(on(t,{checks:[...(r=t.checks)!=null?r:[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},e.with=e.check,e.clone=(n,r)=>sn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>Dh(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Uh(e,n,r),e.parseAsync=(n,r)=>L(null,null,function*(){return Mh(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>L(null,null,function*(){return jh(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>Zh(e,n,r),e.decode=(n,r)=>qh(e,n,r),e.encodeAsync=(n,r)=>L(null,null,function*(){return Hh(e,n,r)}),e.decodeAsync=(n,r)=>L(null,null,function*(){return Fh(e,n,r)}),e.safeEncode=(n,r)=>Bh(e,n,r),e.safeDecode=(n,r)=>Gh(e,n,r),e.safeEncodeAsync=(n,r)=>L(null,null,function*(){return Wh(e,n,r)}),e.safeDecodeAsync=(n,r)=>L(null,null,function*(){return Jh(e,n,r)}),e.refine=(n,r)=>e.check(Ff(n,r)),e.superRefine=n=>e.check(Bf(n)),e.overwrite=n=>e.check(Jn(n)),e.optional=()=>La(e),e.exactOptional=()=>Lf(e),e.nullable=()=>Ia(e),e.nullish=()=>La(Ia(e)),e.nonoptional=n=>Df(e,n),e.array=()=>ct(e),e.or=n=>wf([e,n]),e.and=n=>Tf(e,n),e.transform=n=>$a(e,Pf(n)),e.default=n=>$f(e,n),e.prefault=n=>Nf(e,n),e.catch=n=>Uf(e,n),e.pipe=n=>$a(e,n),e.readonly=()=>qf(e),e.describe=n=>{const r=e.clone();return _r.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=_r.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return _r.get(e);const r=e.clone();return _r.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),wa=w("_ZodString",(e,t)=>{var r,o,i;ks.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(a,d,u)=>ah(e,a,d);const n=e._zod.bag;e.format=(r=n.format)!=null?r:null,e.minLength=(o=n.minimum)!=null?o:null,e.maxLength=(i=n.maximum)!=null?i:null,e.regex=(...a)=>e.check(Fp(...a)),e.includes=(...a)=>e.check(Wp(...a)),e.startsWith=(...a)=>e.check(Jp(...a)),e.endsWith=(...a)=>e.check(Yp(...a)),e.min=(...a)=>e.check(co(...a)),e.max=(...a)=>e.check(ma(...a)),e.length=(...a)=>e.check(ba(...a)),e.nonempty=(...a)=>e.check(co(1,...a)),e.lowercase=a=>e.check(Bp(a)),e.uppercase=a=>e.check(Gp(a)),e.trim=()=>e.check(Xp()),e.normalize=(...a)=>e.check(Vp(...a)),e.toLowerCase=()=>e.check(Kp()),e.toUpperCase=()=>e.check(Qp()),e.slugify=()=>e.check(eh())}),Yh=w("ZodString",(e,t)=>{ks.init(e,t),wa.init(e,t),e.email=n=>e.check(hp(Vh,n)),e.url=n=>e.check(kp(Xh,n)),e.jwt=n=>e.check(zp(hf,n)),e.emoji=n=>e.check(_p(Kh,n)),e.guid=n=>e.check(pa(xa,n)),e.uuid=n=>e.check(fp(uo,n)),e.uuidv4=n=>e.check(gp(uo,n)),e.uuidv6=n=>e.check(mp(uo,n)),e.uuidv7=n=>e.check(bp(uo,n)),e.nanoid=n=>e.check(vp(Qh,n)),e.guid=n=>e.check(pa(xa,n)),e.cuid=n=>e.check(yp(ef,n)),e.cuid2=n=>e.check(wp(tf,n)),e.ulid=n=>e.check(xp(nf,n)),e.base64=n=>e.check(Rp(uf,n)),e.base64url=n=>e.check(Lp(df,n)),e.xid=n=>e.check(Sp(rf,n)),e.ksuid=n=>e.check(Tp(of,n)),e.ipv4=n=>e.check(Ep(sf,n)),e.ipv6=n=>e.check(Ap(af,n)),e.cidrv4=n=>e.check(Cp(cf,n)),e.cidrv6=n=>e.check(Pp(lf,n)),e.e164=n=>e.check(Ip(pf,n)),e.datetime=n=>e.check(Rh(n)),e.date=n=>e.check(Ih(n)),e.time=n=>e.check($h(n)),e.duration=n=>e.check(Nh(n))});function C(e){return pp(Yh,e)}const ye=w("ZodStringFormat",(e,t)=>{be.init(e,t),wa.init(e,t)}),Vh=w("ZodEmail",(e,t)=>{kd.init(e,t),ye.init(e,t)}),xa=w("ZodGUID",(e,t)=>{md.init(e,t),ye.init(e,t)}),uo=w("ZodUUID",(e,t)=>{bd.init(e,t),ye.init(e,t)}),Xh=w("ZodURL",(e,t)=>{_d.init(e,t),ye.init(e,t)}),Kh=w("ZodEmoji",(e,t)=>{vd.init(e,t),ye.init(e,t)}),Qh=w("ZodNanoID",(e,t)=>{yd.init(e,t),ye.init(e,t)}),ef=w("ZodCUID",(e,t)=>{wd.init(e,t),ye.init(e,t)}),tf=w("ZodCUID2",(e,t)=>{xd.init(e,t),ye.init(e,t)}),nf=w("ZodULID",(e,t)=>{Sd.init(e,t),ye.init(e,t)}),rf=w("ZodXID",(e,t)=>{Td.init(e,t),ye.init(e,t)}),of=w("ZodKSUID",(e,t)=>{Ed.init(e,t),ye.init(e,t)}),sf=w("ZodIPv4",(e,t)=>{Ld.init(e,t),ye.init(e,t)}),af=w("ZodIPv6",(e,t)=>{Id.init(e,t),ye.init(e,t)}),cf=w("ZodCIDRv4",(e,t)=>{zd.init(e,t),ye.init(e,t)}),lf=w("ZodCIDRv6",(e,t)=>{$d.init(e,t),ye.init(e,t)}),uf=w("ZodBase64",(e,t)=>{Od.init(e,t),ye.init(e,t)}),df=w("ZodBase64URL",(e,t)=>{Dd.init(e,t),ye.init(e,t)}),pf=w("ZodE164",(e,t)=>{Md.init(e,t),ye.init(e,t)}),hf=w("ZodJWT",(e,t)=>{jd.init(e,t),ye.init(e,t)}),Sa=w("ZodNumber",(e,t)=>{var r,o,i,a,d,u,p,h,g;Ki.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(m,k,y)=>ch(e,m,k),e.gt=(m,k)=>e.check(fa(m,k)),e.gte=(m,k)=>e.check(ys(m,k)),e.min=(m,k)=>e.check(ys(m,k)),e.lt=(m,k)=>e.check(ha(m,k)),e.lte=(m,k)=>e.check(vs(m,k)),e.max=(m,k)=>e.check(vs(m,k)),e.int=m=>e.check(Ta(m)),e.safe=m=>e.check(Ta(m)),e.positive=m=>e.check(fa(0,m)),e.nonnegative=m=>e.check(ys(0,m)),e.negative=m=>e.check(ha(0,m)),e.nonpositive=m=>e.check(vs(0,m)),e.multipleOf=(m,k)=>e.check(ga(m,k)),e.step=(m,k)=>e.check(ga(m,k)),e.finite=()=>e;const n=e._zod.bag;e.minValue=(i=Math.max((r=n.minimum)!=null?r:Number.NEGATIVE_INFINITY,(o=n.exclusiveMinimum)!=null?o:Number.NEGATIVE_INFINITY))!=null?i:null,e.maxValue=(u=Math.min((a=n.maximum)!=null?a:Number.POSITIVE_INFINITY,(d=n.exclusiveMaximum)!=null?d:Number.POSITIVE_INFINITY))!=null?u:null,e.isInt=((p=n.format)!=null?p:"").includes("int")||Number.isSafeInteger((h=n.multipleOf)!=null?h:.5),e.isFinite=!0,e.format=(g=n.format)!=null?g:null});function Lt(e){return Mp(Sa,e)}const ff=w("ZodNumberFormat",(e,t)=>{Zd.init(e,t),Sa.init(e,t)});function Ta(e){return Up(ff,e)}const gf=w("ZodBoolean",(e,t)=>{qd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lh(e,n,r)});function _e(e){return jp(gf,e)}const mf=w("ZodAny",(e,t)=>{Hd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dh()});function Ea(){return Zp(mf)}const bf=w("ZodUnknown",(e,t)=>{Fd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ph()});function Aa(){return qp(bf)}const kf=w("ZodNever",(e,t)=>{Bd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>uh(e,n,r)});function _f(e){return Hp(kf,e)}const vf=w("ZodArray",(e,t)=>{Gd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bh(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(co(n,r)),e.nonempty=n=>e.check(co(1,n)),e.max=(n,r)=>e.check(ma(n,r)),e.length=(n,r)=>e.check(ba(n,r)),e.unwrap=()=>e.element});function ct(e,t){return th(vf,e,t)}const yf=w("ZodObject",(e,t)=>{Jd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kh(e,n,r,o),te(e,"shape",()=>t.shape),e.keyof=()=>dt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone(U(v({},e._zod.def),{catchall:n})),e.passthrough=()=>e.clone(U(v({},e._zod.def),{catchall:Aa()})),e.loose=()=>e.clone(U(v({},e._zod.def),{catchall:Aa()})),e.strict=()=>e.clone(U(v({},e._zod.def),{catchall:_f()})),e.strip=()=>e.clone(U(v({},e._zod.def),{catchall:void 0})),e.extend=n=>fu(e,n),e.safeExtend=n=>gu(e,n),e.merge=n=>mu(e,n),e.pick=n=>pu(e,n),e.omit=n=>hu(e,n),e.partial=(...n)=>bu(Ra,e,n[0]),e.required=(...n)=>ku(za,e,n[0])});function fe(e,t){const n=v({type:"object",shape:e!=null?e:{}},D(t));return new yf(n)}const Ca=w("ZodUnion",(e,t)=>{ra.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_h(e,n,r,o),e.options=t.options});function wf(e,t){return new Ca(v({type:"union",options:e},D(t)))}const xf=w("ZodDiscriminatedUnion",(e,t)=>{Ca.init(e,t),Yd.init(e,t)});function Pa(e,t,n){return new xf(v({type:"union",options:t,discriminator:e},D(n)))}const Sf=w("ZodIntersection",(e,t)=>{Vd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vh(e,n,r,o)});function Tf(e,t){return new Sf({type:"intersection",left:e,right:t})}const Ef=w("ZodRecord",(e,t)=>{Xd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yh(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function It(e,t,n){return new Ef(v({type:"record",keyType:e,valueType:t},D(n)))}const ws=w("ZodEnum",(e,t)=>{Kd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,i)=>hh(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const a of r)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ws(U(v(U(v({},t),{checks:[]}),D(o)),{entries:i}))},e.exclude=(r,o)=>{const i=v({},t.entries);for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new ws(U(v(U(v({},t),{checks:[]}),D(o)),{entries:i}))}});function dt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ws(v({type:"enum",entries:n},D(t)))}const Af=w("ZodLiteral",(e,t)=>{Qd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fh(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function pt(e,t){return new Af(v({type:"literal",values:Array.isArray(e)?e:[e]},D(t)))}const Cf=w("ZodTransform",(e,t)=>{ep.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mh(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new zi(e.constructor.name);n.addIssue=i=>{var a,d,u;if(typeof i=="string")n.issues.push(kr(i,n.value,t));else{const p=i;p.fatal&&(p.continue=!1),(a=p.code)!=null||(p.code="custom"),(d=p.input)!=null||(p.input=n.value),(u=p.inst)!=null||(p.inst=e),n.issues.push(kr(p))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Pf(e){return new Cf({type:"transform",transform:e})}const Ra=w("ZodOptional",(e,t)=>{ia.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ya(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function La(e){return new Ra({type:"optional",innerType:e})}const Rf=w("ZodExactOptional",(e,t)=>{tp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ya(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Lf(e){return new Rf({type:"optional",innerType:e})}const If=w("ZodNullable",(e,t)=>{np.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ia(e){return new If({type:"nullable",innerType:e})}const zf=w("ZodDefault",(e,t)=>{rp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $f(e,t){return new zf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ui(t)}})}const Of=w("ZodPrefault",(e,t)=>{op.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Th(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Nf(e,t){return new Of({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ui(t)}})}const za=w("ZodNonOptional",(e,t)=>{sp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Df(e,t){return new za(v({type:"nonoptional",innerType:e},D(t)))}const Mf=w("ZodCatch",(e,t)=>{ip.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Uf(e,t){return new Mf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const jf=w("ZodPipe",(e,t)=>{ap.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ah(e,n,r,o),e.in=t.in,e.out=t.out});function $a(e,t){return new jf({type:"pipe",in:e,out:t})}const Zf=w("ZodReadonly",(e,t)=>{cp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ch(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function qf(e){return new Zf({type:"readonly",innerType:e})}const Hf=w("ZodCustom",(e,t)=>{lp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gh(e,n)});function Ff(e,t={}){return nh(Hf,e,t)}function Bf(e){return rh(e)}const Gf=fe({name:C().min(1).max(100).optional(),command:C().min(1).max(500),args:ct(C()).optional(),failOnError:_e().default(!0).optional(),timeout:Lt().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:C().optional(),env:It(C(),C()).optional(),runOnBackground:_e().optional(),agentTags:ct(C()).optional()});fe({name:C(),command:C(),success:_e(),exitCode:Lt().optional(),stdout:C().optional(),stderr:C().optional(),error:C().optional(),duration:Lt(),failOnError:_e()});const _n=fe({path:C(),extraCommands:ct(Gf).optional(),id:C().uuid().optional(),rotationKey:C().optional(),usageStatus:dt(["free","in_use"]).optional(),agentTags:ct(C()).optional()}),Wf=Pa("operation",[_n.extend({operation:pt("create"),content:C().optional(),contentPath:C().optional(),encoding:dt(["utf-8","base64"]).optional()}),_n.extend({operation:pt("merge"),data:It(C(),Ea()),mergeStrategy:dt(["deep","shallow"]).optional(),arrayMergeStrategy:dt(["concat","replace"]).optional()}),_n.extend({operation:pt("modify"),content:C().optional(),contentPath:C().optional(),createIfMissing:_e().optional()}),_n.extend({operation:pt("delete"),ignoreIfMissing:_e().optional()}),_n.extend({operation:pt("createDirectory"),contentPath:C().optional(),mode:Lt().optional(),ignoreIfExists:_e().optional()}),_n.extend({operation:pt("download"),url:C().url(),headers:It(C(),C()).optional(),timeout:Lt().min(1e3).max(3e5).optional()}),_n.extend({operation:pt("gitClone"),gitUrl:C(),gitSecretKey:C().optional(),sourceBranch:C().optional(),targetBranch:C().optional(),originalBranch:C().optional(),defaultBranch:C().optional()})]);var Te=(e=>(e.PENDING="pending",e.ASSIGNED="assigned",e.IN_PROGRESS="in_progress",e.WAITING_FOR_INPUT="waiting_for_input",e.WAITING_FOR_PLAN_APPROVAL="waiting_for_plan_approval",e.PLAN_APPROVED="plan_approved",e.PLAN_REJECTED="plan_rejected",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.RESULT_REJECTED="result_rejected",e))(Te||{});const Jf=fe({type:dt(["json","file","regex"]).describe("Extraction method"),source:C().describe("Source to extract from (file path or stdout/stderr)"),schema:fe({}).passthrough().optional().describe("JSON schema for validation"),pattern:C().optional().describe("Regex pattern for extraction")}),Yf=fe({type:dt(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:Ea().describe("Hook-specific configuration")});fe({command:C().optional().describe("Legacy — unused in SDK mode"),args:ct(C()).optional().describe("Legacy — unused in SDK mode"),env:It(C(),C()).optional().describe("Environment variables"),workingDirectory:C().optional().describe("Working directory for command execution"),fileOperations:ct(Wf).optional().describe("File operations to perform during setup"),gitUrl:C().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:C().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:C().optional().describe("Commit message for git operations"),resultExtraction:Jf.optional().describe("Schema for extracting result data"),postExecutionHooks:ct(Yf).optional().describe("Hooks to run after task completion"),executionMode:dt(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:Pa("executionMode",[fe({executionMode:pt("claudeAgentSdk"),promptText:C(),sdkOptions:fe({model:C(),permissionMode:dt(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:ct(C()),allowDangerouslySkipPermissions:_e(),persistSession:_e(),streamSdkEvents:_e().optional(),allowedTools:ct(C()).optional(),settings:fe({enabledPlugins:It(C(),_e())}),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()}),fe({executionMode:pt("opencodeSdk"),promptText:C(),sdkOptions:fe({provider:C(),model:C(),allowedTools:ct(C()).optional(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()}),fe({executionMode:pt("openaiAgentSdk"),promptText:C(),sdkOptions:fe({model:C(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()}),fe({executionMode:pt("codexSdk"),promptText:C(),sdkOptions:fe({model:C().optional(),sandboxMode:dt(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:dt(["never","on-request","on-failure","untrusted"]).optional(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()}),fe({executionMode:pt("cursorSdk"),promptText:C(),sdkOptions:fe({model:C(),env:It(C(),C()).optional()}),resume:fe({sessionId:C().optional(),continue:_e()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:_e().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:C().optional().describe("Final approved plan content"),planApproved:_e().optional().describe("Plan approval status"),planApprovedAt:C().optional().describe("ISO timestamp of approval"),planRejected:_e().optional().describe("Plan rejection flag"),planRejectionFeedback:C().optional().describe("User rejection feedback"),rejectedPlanContent:C().optional().describe("Previously rejected plan content"),planCompletedAt:C().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:C().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:C().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:C().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:ct(fe({feedback:C(),rejectedAt:C()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:Lt().optional(),notificationChannelPlanMessageSentAt:C().optional(),notificationChannelCompletedMessageId:Lt().optional(),notificationChannelFailedMessageId:Lt().optional(),streamSdkEvents:_e().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:C().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:_e().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:ct(fe({id:C(),selectedText:C(),startOffset:Lt(),endOffset:Lt(),commentText:C(),createdAt:C()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:_e().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:_e().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:dt(["all","ignoreExistingMcpServers"]).optional().describe("MCP server strategy for this run; 'ignoreExistingMcpServers' overrides the existing .mcp.json with only the template's configured servers plus the agent-platform server"),enableBrowserTools:_e().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")}),Te.PENDING+"",Te.CANCELLED,Te.ASSIGNED+"",Te.CANCELLED,Te.IN_PROGRESS+"",Te.CANCELLED,Te.FAILED,Te.WAITING_FOR_INPUT+"",Te.CANCELLED,Te.WAITING_FOR_PLAN_APPROVAL+"",Te.CANCELLED,Te.PLAN_APPROVED+"",Te.CANCELLED,Te.PLAN_REJECTED+"",Te.CANCELLED,Te.COMPLETED+"",Te.RESULT_REJECTED+"",Te.CANCELLED,Te.FAILED+"",Te.CANCELLED+"";const Oa="browser_capture",Vf="browser_automate";function Na(e){let t=(e||"").trim().toLowerCase();const n=t.indexOf("@");return n>=0&&(t=t.slice(n+1)),t=t.split("/")[0].split(":")[0],t.startsWith("www.")&&(t=t.slice(4)),t}function Xf(e,t){const n=Na(e),r=(t||"").trim().toLowerCase();if(!n||!r)return!1;if(r.startsWith("*.")){const o=r.slice(2);return n===o||n.endsWith("."+o)}return n===Na(r)}function Da(e,t){var i;let n;try{const a=new URL(e);if(a.protocol!=="http:"&&a.protocol!=="https:")return null;n=a.hostname}catch(a){return null}let r=null,o=-1;for(const a of t)for(const d of(i=a.domains)!=null?i:[])Xf(n,d)&&d.length>o&&(o=d.length,r=a.id);return r}function Ma(e){return L(this,null,function*(){if(!e.ok){const t=yield e.json().catch(()=>({message:`HTTP ${e.status}`}));throw new Error(t.message||t.error||`HTTP ${e.status}`)}return e.json()})}const Kf=3e4;function po(r){return L(this,arguments,function*(e,t={},n=Kf){const o=new AbortController,i=setTimeout(()=>o.abort(),n);try{return yield fetch(e,U(v({},t),{signal:o.signal}))}catch(a){throw a instanceof DOMException&&a.name==="AbortError"?new Error(`Request timed out after ${Math.round(n/1e3)}s. Please check your connection and try again.`):a}finally{clearTimeout(i)}})}function Ue(e,t,n,r){return L(this,null,function*(){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=yield po(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return Ma(a)})}function Ua(e,t){return L(this,null,function*(){return Ue(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)})}const Qf=["projectId","note","ctx"];function eg(e){const t=Qf.filter(n=>e[n]===void 0||e[n]===null);if(t.length>0)throw new Error(`createTask: missing required field(s): ${t.join(", ")}`)}function xs(e,t){return L(this,null,function*(){var h,g,m,k,y,E;eg(t);const{projectId:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:d,allowSubmit:u,type:p=Oa}=t;return Ue(e,"POST","/tasks",U(v(v(v(v(v(v(v(v(v(v(v(v({type:p,title:a||r.slice(0,120)||o.pageTitle||"Browser capture",titleInstruction:d!=null?d:r,projectId:n,autoAssign:!0},i!=null&&i.claudeTemplateId?{claudeTemplateId:i.claudeTemplateId}:{}),(i==null?void 0:i.quickMode)!==void 0?{quickMode:i.quickMode}:{}),(i==null?void 0:i.modelOverride)!=null?{modelOverride:i.modelOverride}:{}),(i==null?void 0:i.claudeProfileId)!=null?{claudeProfileId:i.claudeProfileId}:{}),(i==null?void 0:i.effort)!=null?{effort:i.effort}:{}),(i==null?void 0:i.executionMode)!=null?{executionMode:i.executionMode}:{}),(h=i==null?void 0:i.selectedPluginIds)!=null&&h.length?{selectedPluginIds:i.selectedPluginIds}:{}),(g=i==null?void 0:i.selectedSkillIds)!=null&&g.length?{selectedSkillIds:i.selectedSkillIds}:{}),(m=i==null?void 0:i.selectedPluginSkillIds)!=null&&m.length?{selectedPluginSkillIds:i.selectedPluginSkillIds}:{}),(k=i==null?void 0:i.selectedMcpServerIds)!=null&&k.length?{selectedMcpServerIds:i.selectedMcpServerIds}:{}),(y=i==null?void 0:i.selectedSlashCommandIds)!=null&&y.length?{selectedSlashCommandIds:i.selectedSlashCommandIds}:{}),(E=i==null?void 0:i.selectedRemoteContextProviderIds)!=null&&E.length?{selectedRemoteContextProviderIds:i.selectedRemoteContextProviderIds}:{}),{metadata:v({type:p,note:r,source:"web-sdk",pageUrl:o.pageUrl,pageTitle:o.pageTitle,elementText:o.elementText,cssSelector:o.cssSelector,elementOuterHtml:o.elementOuterHtml,ancestry:o.ancestry,elementRole:o.elementRole,elementAriaLabel:o.elementAriaLabel,enclosingSection:o.enclosingSection,description:o.description,canonicalUrl:o.canonicalUrl,lang:o.lang,ogTitle:o.ogTitle,ogDescription:o.ogDescription,ogType:o.ogType,ogSiteName:o.ogSiteName,viewportWidth:o.viewportWidth,viewportHeight:o.viewportHeight,scrollX:o.scrollX,scrollY:o.scrollY,selectionText:o.selectionText,capturedAt:o.capturedAt,interactionSteps:o.interactionSteps},u!==void 0?{allowSubmit:u}:{})}))})}function ja(e,t){return L(this,null,function*(){return xs(e,U(v({},t),{type:Vf}))})}function Za(e,t,n,r){return L(this,null,function*(){var o;return Ue(e,"POST","/planning-sessions",v({projectId:t,instruction:n,quickMode:(o=r==null?void 0:r.quickMode)!=null?o:!1},r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}))})}function tg(e,t){return L(this,null,function*(){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Ue(e,"GET",`/claude-templates${n}`)})}function qa(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}`)})}function ng(e,t){return L(this,null,function*(){return Ue(e,"GET",`/planning-sessions/${t}`)})}function Ha(e){return L(this,null,function*(){return Ue(e,"GET","/projects")})}function rg(e){return L(this,null,function*(){return(yield Ue(e,"GET","/tenants/current")).membership})}function og(e,t){if(!e||e.includes("tenant:*")||e.includes(t))return!0;const n=t.split(":")[0];return e.includes(`${n}:*`)}function Fa(e,t,n){return L(this,null,function*(){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=yield po(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return Ma(i)})}function sg(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/browser-commands/pending`)})}function ig(e,t,n,r,o){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})})}function ag(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/chunks`)})}function cg(e,t,n){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/instructions`,{content:n})})}function lg(e,t){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/cancel`)})}function ug(e,t){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/approve-result`)})}function dg(e,t,n){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})})}function ho(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)})}function Ba(e,t,n,r){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})})}function pg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ss={exports:{}};/*!
1359
1359
  * Pusher JavaScript Library v8.5.0
1360
1360
  * https://pusher.com/
1361
1361
  *
1362
1362
  * Copyright 2020, Pusher
1363
1363
  * Released under the MIT licence.
1364
- */var Ga;function hg(){return Ga||(Ga=1,(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(a,d){var u=this&&this.__extends||(function(){var N=function(T,S){return N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(P,Z){P.__proto__=Z}||function(P,Z){for(var Y in Z)Z.hasOwnProperty(Y)&&(P[Y]=Z[Y])},N(T,S)};return function(T,S){N(T,S);function P(){this.constructor=T}T.prototype=S===null?Object.create(S):(P.prototype=S.prototype,new P)}})();Object.defineProperty(d,"__esModule",{value:!0});var p=256,h=(function(){function N(T){T===void 0&&(T="="),this._paddingCharacter=T}return N.prototype.encodedLength=function(T){return this._paddingCharacter?(T+2)/3*4|0:(T*8+5)/6|0},N.prototype.encode=function(T){for(var S="",P=0;P<T.length-2;P+=3){var Z=T[P]<<16|T[P+1]<<8|T[P+2];S+=this._encodeByte(Z>>>18&63),S+=this._encodeByte(Z>>>12&63),S+=this._encodeByte(Z>>>6&63),S+=this._encodeByte(Z>>>0&63)}var Y=T.length-P;if(Y>0){var Z=T[P]<<16|(Y===2?T[P+1]<<8:0);S+=this._encodeByte(Z>>>18&63),S+=this._encodeByte(Z>>>12&63),Y===2?S+=this._encodeByte(Z>>>6&63):S+=this._paddingCharacter||"",S+=this._paddingCharacter||""}return S},N.prototype.maxDecodedLength=function(T){return this._paddingCharacter?T/4*3|0:(T*6+7)/8|0},N.prototype.decodedLength=function(T){return this.maxDecodedLength(T.length-this._getPaddingLength(T))},N.prototype.decode=function(T){if(T.length===0)return new Uint8Array(0);for(var S=this._getPaddingLength(T),P=T.length-S,Z=new Uint8Array(this.maxDecodedLength(P)),Y=0,ge=0,Ze=0,Ge=0,ne=0,Ie=0,We=0;ge<P-4;ge+=4)Ge=this._decodeChar(T.charCodeAt(ge+0)),ne=this._decodeChar(T.charCodeAt(ge+1)),Ie=this._decodeChar(T.charCodeAt(ge+2)),We=this._decodeChar(T.charCodeAt(ge+3)),Z[Y++]=Ge<<2|ne>>>4,Z[Y++]=ne<<4|Ie>>>2,Z[Y++]=Ie<<6|We,Ze|=Ge&p,Ze|=ne&p,Ze|=Ie&p,Ze|=We&p;if(ge<P-1&&(Ge=this._decodeChar(T.charCodeAt(ge)),ne=this._decodeChar(T.charCodeAt(ge+1)),Z[Y++]=Ge<<2|ne>>>4,Ze|=Ge&p,Ze|=ne&p),ge<P-2&&(Ie=this._decodeChar(T.charCodeAt(ge+2)),Z[Y++]=ne<<4|Ie>>>2,Ze|=Ie&p),ge<P-3&&(We=this._decodeChar(T.charCodeAt(ge+3)),Z[Y++]=Ie<<6|We,Ze|=We&p),Ze!==0)throw new Error("Base64Coder: incorrect characters for decoding");return Z},N.prototype._encodeByte=function(T){var S=T;return S+=65,S+=25-T>>>8&6,S+=51-T>>>8&-75,S+=61-T>>>8&-15,S+=62-T>>>8&3,String.fromCharCode(S)},N.prototype._decodeChar=function(T){var S=p;return S+=(42-T&T-44)>>>8&-p+T-43+62,S+=(46-T&T-48)>>>8&-p+T-47+63,S+=(47-T&T-58)>>>8&-p+T-48+52,S+=(64-T&T-91)>>>8&-p+T-65+0,S+=(96-T&T-123)>>>8&-p+T-97+26,S},N.prototype._getPaddingLength=function(T){var S=0;if(this._paddingCharacter){for(var P=T.length-1;P>=0&&T[P]===this._paddingCharacter;P--)S++;if(T.length<4||S>2)throw new Error("Base64Coder: incorrect padding")}return S},N})();d.Coder=h;var g=new h;function m(N){return g.encode(N)}d.encode=m;function k(N){return g.decode(N)}d.decode=k;var y=(function(N){u(T,N);function T(){return N!==null&&N.apply(this,arguments)||this}return T.prototype._encodeByte=function(S){var P=S;return P+=65,P+=25-S>>>8&6,P+=51-S>>>8&-75,P+=61-S>>>8&-13,P+=62-S>>>8&49,String.fromCharCode(P)},T.prototype._decodeChar=function(S){var P=p;return P+=(44-S&S-46)>>>8&-p+S-45+62,P+=(94-S&S-96)>>>8&-p+S-95+63,P+=(47-S&S-58)>>>8&-p+S-48+52,P+=(64-S&S-91)>>>8&-p+S-65+0,P+=(96-S&S-123)>>>8&-p+S-97+26,P},T})(h);d.URLSafeCoder=y;var E=new y;function j(N){return E.encode(N)}d.encodeURLSafe=j;function Q(N){return E.decode(N)}d.decodeURLSafe=Q,d.encodedLength=function(N){return g.encodedLength(N)},d.maxDecodedLength=function(N){return g.maxDecodedLength(N)},d.decodedLength=function(N){return g.decodedLength(N)}},978(a,d){var u="utf8: invalid source encoding";function p(h){for(var g=[],m=0;m<h.length;m++){var k=h[m];if(k&128){var y=void 0;if(k<224){if(m>=h.length)throw new Error(u);var E=h[++m];if((E&192)!==128)throw new Error(u);k=(k&31)<<6|E&63,y=128}else if(k<240){if(m>=h.length-1)throw new Error(u);var E=h[++m],j=h[++m];if((E&192)!==128||(j&192)!==128)throw new Error(u);k=(k&15)<<12|(E&63)<<6|j&63,y=2048}else if(k<248){if(m>=h.length-2)throw new Error(u);var E=h[++m],j=h[++m],Q=h[++m];if((E&192)!==128||(j&192)!==128||(Q&192)!==128)throw new Error(u);k=(k&15)<<18|(E&63)<<12|(j&63)<<6|Q&63,y=65536}else throw new Error(u);if(k<y||k>=55296&&k<=57343)throw new Error(u);if(k>=65536){if(k>1114111)throw new Error(u);k-=65536,g.push(String.fromCharCode(55296|k>>10)),k=56320|k&1023}}g.push(String.fromCharCode(k))}return g.join("")}d.D4=p},721(a,d,u){a.exports=u(207).default},207(a,d,u){u.d(d,{default:()=>os});class p{constructor(s,c){this.lastId=0,this.prefix=s,this.name=c}create(s){this.lastId++;var c=this.lastId,f=this.prefix+c,b=this.name+"["+c+"]",x=!1,R=function(){x||(s.apply(null,arguments),x=!0)};return this[c]=R,{number:c,id:f,name:b,callback:R}}remove(s){delete this[s.number]}}var h=new p("_pusher_script_","Pusher.ScriptReceivers"),g={VERSION:"8.5.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""};const m=g;class k{constructor(s){this.options=s,this.receivers=s.receivers||h,this.loading={}}load(s,c,f){var b=this;if(b.loading[s]&&b.loading[s].length>0)b.loading[s].push(f);else{b.loading[s]=[f];var x=G.createScriptRequest(b.getPath(s,c)),R=b.receivers.create(function(O){if(b.receivers.remove(R),b.loading[s]){var B=b.loading[s];delete b.loading[s];for(var ee=function(Pe){Pe||x.cleanup()},oe=0;oe<B.length;oe++)B[oe](O,ee)}});x.send(R)}}getRoot(s){var c,f=G.getDocument().location.protocol;return s&&s.useTLS||f==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(s,c){return this.getRoot(c)+"/"+s+this.options.suffix+".js"}}var y=new p("_pusher_dependencies","Pusher.DependenciesReceivers"),E=new k({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:y});const j={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}},N={buildLogSuffix:function(l){const s="See:",c=j.urls[l];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=j.baseUrl+c.path),f?`${s} ${f}`:""}};var T;(function(l){l.UserAuthentication="user-authentication",l.ChannelAuthorization="channel-authorization"})(T||(T={}));class S extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class P extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Z extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Y extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class ge 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 Ge extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class ne extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Ie extends Error{constructor(s,c){super(c),this.status=s,Object.setPrototypeOf(this,new.target.prototype)}}const Ut=function(l,s,c,f,b){const x=G.createXHR();x.open("POST",c.endpoint,!0),x.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var R in c.headers)x.setRequestHeader(R,c.headers[R]);if(c.headersProvider!=null){let O=c.headersProvider();for(var R in O)x.setRequestHeader(R,O[R])}return x.onreadystatechange=function(){if(x.readyState===4)if(x.status===200){let O,B=!1;try{O=JSON.parse(x.responseText),B=!0}catch(ee){b(new Ie(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${x.responseText}`),null)}B&&b(null,O)}else{let O="";switch(f){case T.UserAuthentication:O=N.buildLogSuffix("authenticationEndpoint");break;case T.ChannelAuthorization:O=`Clients must be authorized to join private or presence channels. ${N.buildLogSuffix("authorizationEndpoint")}`;break}b(new Ie(x.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${x.status} from ${c.endpoint}. ${O}`),null)}},x.send(s),x};function Ln(l){return we(fn(l))}var jt=String.fromCharCode,St="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Zt=function(l){var s=l.charCodeAt(0);return s<128?l:s<2048?jt(192|s>>>6)+jt(128|s&63):jt(224|s>>>12&15)+jt(128|s>>>6&63)+jt(128|s&63)},fn=function(l){return l.replace(/[^\x00-\x7F]/g,Zt)},Tt=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=[St.charAt(c>>>18),St.charAt(c>>>12&63),s>=2?"=":St.charAt(c>>>6&63),s>=1?"=":St.charAt(c&63)];return f.join("")},we=window.btoa||function(l){return l.replace(/[\s\S]{1,3}/g,Tt)};class In{constructor(s,c,f,b){this.clear=c,this.timer=s(()=>{this.timer&&(this.timer=b(this.timer))},f)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const xe=In;function W(l){window.clearTimeout(l)}function H(l){window.clearInterval(l)}class re extends xe{constructor(s,c){super(setTimeout,W,s,function(f){return c(),null})}}class qe extends xe{constructor(s,c){super(setInterval,H,s,function(f){return c(),f})}}var rt={now(){return Date.now?Date.now():new Date().valueOf()},defer(l){return new re(0,l)},method(l,...s){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[l].apply(f,c.concat(arguments))}}};const ue=rt;function Ee(l,...s){for(var c=0;c<s.length;c++){var f=s[c];for(var b in f)f[b]&&f[b].constructor&&f[b].constructor===Object?l[b]=Ee(l[b]||{},f[b]):l[b]=f[b]}return l}function zn(){for(var l=["Pusher"],s=0;s<arguments.length;s++)typeof arguments[s]=="string"?l.push(arguments[s]):l.push(st(arguments[s]));return l.join(" : ")}function He(l,s){var c=Array.prototype.indexOf;if(l===null)return-1;if(c&&l.indexOf===c)return l.indexOf(s);for(var f=0,b=l.length;f<b;f++)if(l[f]===s)return f;return-1}function de(l,s){for(var c in l)Object.prototype.hasOwnProperty.call(l,c)&&s(l[c],c,l)}function Ne(l){var s=[];return de(l,function(c,f){s.push(f)}),s}function ze(l){var s=[];return de(l,function(c){s.push(c)}),s}function Et(l,s,c){for(var f=0;f<l.length;f++)s.call(c||window,l[f],f,l)}function Je(l,s){for(var c=[],f=0;f<l.length;f++)c.push(s(l[f],f,l,c));return c}function ot(l,s){var c={};return de(l,function(f,b){c[b]=s(f)}),c}function qt(l,s){s=s||function(b){return!!b};for(var c=[],f=0;f<l.length;f++)s(l[f],f,l,c)&&c.push(l[f]);return c}function gt(l,s){var c={};return de(l,function(f,b){(s&&s(f,b,l,c)||f)&&(c[b]=f)}),c}function Fo(l){var s=[];return de(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 ai(l,s){for(var c=0;c<l.length;c++)if(!s(l[c],c,l))return!1;return!0}function Nr(l){return ot(l,function(s){return typeof s=="object"&&(s=st(s)),encodeURIComponent(Ln(s.toString()))})}function $n(l){var s=gt(l,function(f){return f!==void 0}),c=Je(Fo(Nr(s)),ue.method("join","=")).join("&");return c}function gn(l){var s=[],c=[];return(function f(b,x){var R,O,B;switch(typeof b){case"object":if(!b)return null;for(R=0;R<s.length;R+=1)if(s[R]===b)return{$ref:c[R]};if(s.push(b),c.push(x),Object.prototype.toString.apply(b)==="[object Array]")for(B=[],R=0;R<b.length;R+=1)B[R]=f(b[R],x+"["+R+"]");else{B={};for(O in b)Object.prototype.hasOwnProperty.call(b,O)&&(B[O]=f(b[O],x+"["+JSON.stringify(O)+"]"))}return B;case"number":case"string":case"boolean":return b}})(l,"$")}function st(l){try{return JSON.stringify(l)}catch(s){return JSON.stringify(gn(l))}}class Dr{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=zn.apply(this,arguments);os.log?os.log(f):os.logToConsole&&s.bind(this)(f)}}const pe=new Dr;var Bo=function(l,s,c,f,b){(c.headers!==void 0||c.headersProvider!=null)&&pe.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var x=l.nextAuthCallbackID.toString();l.nextAuthCallbackID++;var R=l.getDocument(),O=R.createElement("script");l.auth_callbacks[x]=function(oe){b(null,oe)};var B="Pusher.auth_callbacks['"+x+"']";O.src=c.endpoint+"?callback="+encodeURIComponent(B)+"&"+s;var ee=R.getElementsByTagName("head")[0]||R.documentElement;ee.insertBefore(O,ee.firstChild)};const Mr=Bo;class Go{constructor(s){this.src=s}send(s){var c=this,f="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=s.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){s.callback(f)},c.script.onload=function(){s.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&s.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=s.id+"_error",c.errorScript.text=s.name+"('"+f+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var b=document.getElementsByTagName("head")[0];b.insertBefore(c.script,b.firstChild),c.errorScript&&b.insertBefore(c.errorScript,c.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class lr{constructor(s,c){this.url=s,this.data=c}send(s){if(!this.request){var c=$n(this.data),f=this.url+"/"+s.number+"?"+c;this.request=G.createScriptRequest(f),this.request.send(s)}}cleanup(){this.request&&this.request.cleanup()}}var ur=function(l,s){return function(c,f){var b="http"+(s?"s":"")+"://",x=b+(l.host||l.options.host)+l.options.path,R=G.createJSONPRequest(x,c),O=G.ScriptReceivers.create(function(B,ee){h.remove(O),R.cleanup(),ee&&ee.host&&(l.host=ee.host),f&&f(B,ee)});R.send(O)}},At={name:"jsonp",getAgent:ur};const mn=At;function On(l,s,c){var f=l+(s.useTLS?"s":""),b=s.useTLS?s.hostTLS:s.hostNonTLS;return f+"://"+b+c}function Nn(l,s){var c="/app/"+l,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(s?"&"+s:"");return c+f}var ci={getInitial:function(l,s){var c=(s.httpPath||"")+Nn(l,"flash=false");return On("ws",s,c)}},dr={getInitial:function(l,s){var c=(s.httpPath||"/pusher")+Nn(l);return On("http",s,c)}},pr={getInitial:function(l,s){return On("http",s,s.httpPath||"/pusher")},getPath:function(l,s){return Nn(l)}};class li{constructor(){this._callbacks={}}get(s){return this._callbacks[Kt(s)]}add(s,c,f){var b=Kt(s);this._callbacks[b]=this._callbacks[b]||[],this._callbacks[b].push({fn:c,context:f})}remove(s,c,f){if(!s&&!c&&!f){this._callbacks={};return}var b=s?[Kt(s)]:Ne(this._callbacks);c||f?this.removeCallback(b,c,f):this.removeAllCallbacks(b)}removeCallback(s,c,f){Et(s,function(b){this._callbacks[b]=qt(this._callbacks[b]||[],function(x){return c&&c!==x.fn||f&&f!==x.context}),this._callbacks[b].length===0&&delete this._callbacks[b]},this)}removeAllCallbacks(s){Et(s,function(c){delete this._callbacks[c]},this)}}function Kt(l){return"_"+l}class Ct{constructor(s){this.callbacks=new li,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=qt(this.global_callbacks||[],c=>c!==s),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(s,c,f){for(var b=0;b<this.global_callbacks.length;b++)this.global_callbacks[b](s,c);var x=this.callbacks.get(s),R=[];if(f?R.push(c,f):c&&R.push(c),x&&x.length>0)for(var b=0;b<x.length;b++)x[b].fn.apply(x[b].context||window,R);else this.failThrough&&this.failThrough(s,c);return this}}class ui extends Ct{constructor(s,c,f,b,x){super(),this.initialize=G.transportConnectionInitializer,this.hooks=s,this.name=c,this.priority=f,this.key=b,this.options=x,this.state="new",this.timeline=x.timeline,this.activityTimeout=x.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var s=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(s,this.options)}catch(c){return ue.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),pe.debug("Connecting",{transport:this.name,url:s}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(s){return this.state==="open"?(ue.defer(()=>{this.socket&&this.socket.send(s)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(s){this.emit("error",{type:"WebSocketError",error:s}),this.timeline.error(this.buildTimelineMessage({error:s.toString()}))}onClose(s){s?this.changeState("closed",{code:s.code,reason:s.reason,wasClean:s.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(s){this.emit("message",s)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=s=>{this.onError(s)},this.socket.onclose=s=>{this.onClose(s)},this.socket.onmessage=s=>{this.onMessage(s)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(s,c){this.state=s,this.timeline.info(this.buildTimelineMessage({state:s,params:c})),this.emit(s,c)}buildTimelineMessage(s){return Ee({cid:this.id},s)}}class he{constructor(s){this.hooks=s}isSupported(s){return this.hooks.isSupported(s)}createConnection(s,c,f,b){return new ui(this.hooks,s,c,f,b)}}var bn=new he({urls:ci,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!G.getWebSocketAPI()},isSupported:function(){return!!G.getWebSocketAPI()},getSocket:function(l){return G.createWebSocket(l)}}),Wo={urls:dr,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Ur=Ee({getSocket:function(l){return G.HTTPFactory.createStreamingSocket(l)}},Wo),hr=Ee({getSocket:function(l){return G.HTTPFactory.createPollingSocket(l)}},Wo),jr={isSupported:function(){return G.isXHRSupported()}},Jo=new he(Ee({},Ur,jr)),di=new he(Ee({},hr,jr)),mt={ws:bn,xhr_streaming:Jo,xhr_polling:di};const bt=mt;var Yo=new he({file:"sockjs",urls:pr,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:E.getPath("sockjs",{useTLS:s.useTLS}),ignore_null_origin:s.ignoreNullOrigin})},beforeOpen:function(l,s){l.send(JSON.stringify({path:s}))}}),Zr={isSupported:function(l){var s=G.isXDRSupported(l.useTLS);return s}},qr=new he(Ee({},Ur,Zr)),Vo=new he(Ee({},hr,Zr));bt.xdr_streaming=qr,bt.xdr_polling=Vo,bt.sockjs=Yo;const Pt=bt;class Xo extends Ct{constructor(){super();var s=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){s.emit("online")},!1),window.addEventListener("offline",function(){s.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Ko=new Xo;class Qo{constructor(s,c,f){this.manager=s,this.transport=c,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(s,c,f,b){b=Ee({},b,{activityTimeout:this.pingDelay});var x=this.transport.createConnection(s,c,f,b),R=null,O=function(){x.unbind("open",O),x.bind("closed",B),R=ue.now()},B=ee=>{if(x.unbind("closed",B),ee.code===1002||ee.code===1003)this.manager.reportDeath();else if(!ee.wasClean&&R){var oe=ue.now()-R;oe<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(oe/2,this.minPingDelay))}};return x.bind("open",O),x}isSupported(s){return this.manager.isAlive()&&this.transport.isSupported(s)}}const Hr={decodeMessage:function(l){try{var s=JSON.parse(l.data),c=s.data;if(typeof c=="string")try{c=JSON.parse(s.data)}catch(b){}var f={event:s.event,channel:s.channel,data:c};return s.user_id&&(f.user_id=s.user_id),f}catch(b){throw{type:"MessageParseError",error:b,data:l.data}}},encodeMessage:function(l){return JSON.stringify(l)},processHandshake:function(l){var s=Hr.decodeMessage(l);if(s.event==="pusher:connection_established"){if(!s.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:s.data.socket_id,activityTimeout:s.data.activity_timeout*1e3}}else{if(s.event==="pusher:error")return{action:this.getCloseAction(s.data),error:this.getCloseError(s.data)};throw"Invalid handshake"}},getCloseAction:function(l){return l.code<4e3?l.code>=1002&&l.code<=1004?"backoff":null:l.code===4e3?"tls_only":l.code<4100?"refused":l.code<4200?"backoff":l.code<4300?"retry":"refused"},getCloseError:function(l){return l.code!==1e3&&l.code!==1001?{type:"PusherError",data:{code:l.code,message:l.reason||l.message}}:null}},Qt=Hr;class M extends Ct{constructor(s,c){super(),this.id=s,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(s){return this.transport.send(s)}send_event(s,c,f){var b={event:s,data:c};return f&&(b.channel=f),pe.debug("Event sent",b),this.send(Qt.encodeMessage(b))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var s={message:f=>{var b;try{b=Qt.decodeMessage(f)}catch(x){this.emit("error",{type:"MessageParseError",error:x,data:f.data})}if(b!==void 0){switch(pe.debug("Event recd",b),b.event){case"pusher:error":this.emit("error",{type:"PusherError",data:b.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",b)}},activity:()=>{this.emit("activity")},error:f=>{this.emit("error",f)},closed:f=>{c(),f&&f.code&&this.handleCloseEvent(f),this.transport=null,this.emit("closed")}},c=()=>{de(s,(f,b)=>{this.transport.unbind(b,f)})};de(s,(f,b)=>{this.transport.bind(b,f)})}handleCloseEvent(s){var c=Qt.getCloseAction(s),f=Qt.getCloseError(s);f&&this.emit("error",f),c&&this.emit(c,{action:c,error:f})}}class _{constructor(s,c){this.transport=s,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=s=>{this.unbindListeners();var c;try{c=Qt.processHandshake(s)}catch(f){this.finish("error",{error:f}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new M(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=s=>{this.unbindListeners();var c=Qt.getCloseAction(s)||"backoff",f=Qt.getCloseError(s);this.finish(c,{error:f})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(s,c){this.callback(Ee({transport:this.transport,action:s},c))}}class A{constructor(s,c){this.timeline=s,this.options=c||{}}send(s,c){this.timeline.isEmpty()||this.timeline.send(G.TimelineTransport.getAgent(this,s),c)}}class I extends Ct{constructor(s,c){super(function(f,b){pe.debug("No callbacks on "+s+" for "+f)}),this.name=s,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(s,c){return c(null,{auth:""})}trigger(s,c){if(s.indexOf("client-")!==0)throw new S("Event '"+s+"' does not start with 'client-'");if(!this.subscribed){var f=N.buildLogSuffix("triggeringClientEvents");pe.warn(`Client event triggered before channel 'subscription_succeeded' event . ${f}`)}return this.pusher.send_event(s,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(s){var c=s.event,f=s.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(s);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(s);else if(c.indexOf("pusher_internal:")!==0){var b={};this.emit(c,f,b)}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",s.data)}handleSubscriptionCountEvent(s){s.data.subscription_count&&(this.subscriptionCount=s.data.subscription_count),this.emit("pusher:subscription_count",s.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(s,c)=>{s?(this.subscriptionPending=!1,pe.error(s.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:s.message},s instanceof Ie?{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 ce extends I{authorize(s,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:s},c)}}class De{constructor(){this.reset()}get(s){return Object.prototype.hasOwnProperty.call(this.members,s)?{id:s,info:this.members[s]}:null}each(s){de(this.members,(c,f)=>{s(this.get(f))})}setMyID(s){this.myID=s}onSubscription(s){this.members=s.presence.hash,this.count=s.presence.count,this.me=this.get(this.myID)}addMember(s){return this.get(s.user_id)===null&&this.count++,this.members[s.user_id]=s.user_info,this.get(s.user_id)}removeMember(s){var c=this.get(s.user_id);return c&&(delete this.members[s.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var Se=function(l,s,c,f){function b(x){return x instanceof c?x:new c(function(R){R(x)})}return new(c||(c=Promise))(function(x,R){function O(oe){try{ee(f.next(oe))}catch(Pe){R(Pe)}}function B(oe){try{ee(f.throw(oe))}catch(Pe){R(Pe)}}function ee(oe){oe.done?x(oe.value):b(oe.value).then(O,B)}ee((f=f.apply(l,s||[])).next())})};class Ye extends ce{constructor(s,c){super(s,c),this.members=new De}authorize(s,c){super.authorize(s,(f,b)=>Se(this,void 0,void 0,function*(){if(!f)if(b=b,b.channel_data!=null){var x=JSON.parse(b.channel_data);this.members.setMyID(x.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let R=N.buildLogSuffix("authorizationEndpoint");pe.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${R}, or the user should be signed in.`),c("Invalid auth response");return}c(f,b)}))}handleEvent(s){var c=s.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(s);else{var f=s.data,b={};s.user_id&&(b.user_id=s.user_id),this.emit(c,f,b)}}handleInternalEvent(s){var c=s.event,f=s.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(s);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(s);break;case"pusher_internal:member_added":var b=this.members.addMember(f);this.emit("pusher:member_added",b);break;case"pusher_internal:member_removed":var x=this.members.removeMember(f);x&&this.emit("pusher:member_removed",x);break}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(s.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var Rt=u(978),Ht=u(594);class Fr extends ce{constructor(s,c,f){super(s,c),this.key=null,this.nacl=f}authorize(s,c){super.authorize(s,(f,b)=>{if(f){c(f,b);return}let x=b.shared_secret;if(!x){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,Ht.decode)(x),delete b.shared_secret,c(null,b)})}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){pe.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){pe.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let f=(0,Ht.decode)(c.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){pe.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let b=(0,Ht.decode)(c.nonce);if(b.length<this.nacl.secretbox.nonceLength){pe.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${b.length}`);return}let x=this.nacl.secretbox.open(f,b,this.key);if(x===null){pe.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(R,O)=>{if(R){pe.error(`Failed to make a request to the authEndpoint: ${O}. Unable to fetch new key, so dropping encrypted event`);return}if(x=this.nacl.secretbox.open(f,b,this.key),x===null){pe.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(s,this.getDataToEmit(x))});return}this.emit(s,this.getDataToEmit(x))}getDataToEmit(s){let c=(0,Rt.D4)(s);try{return JSON.parse(c)}catch(f){return c}}}class $e extends Ct{constructor(s,c){super(),this.state="initialized",this.connection=null,this.key=s,this.options=c,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var f=G.getNetwork();f.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),f.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(s){this.key=s,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(s){return this.connection?this.connection.send(s):!1}send_event(s,c,f){return this.connection?this.connection.send_event(s,c,f):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var s=(c,f)=>{c?this.runner=this.strategy.connect(0,s):f.action==="error"?(this.emit("error",{type:"HandshakeError",error:f.error}),this.timeline.error({handshakeError:f.error})):(this.abortConnecting(),this.handshakeCallbacks[f.action](f))};this.runner=this.strategy.connect(0,s)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var s=this.abandonConnection();s.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(s){this.timeline.info({action:"retry",delay:s}),s>0&&this.emit("connecting_in",Math.round(s/1e3)),this.retryTimer=new re(s||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new re(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new re(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new re(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(s){return Ee({},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 Ee({},s,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let s=c=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),c(f)};return{tls_only:s(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:s(()=>{this.disconnect()}),backoff:s(()=>{this.retryIn(1e3)}),retry:s(()=>{this.retryIn(0)})}}setConnection(s){this.connection=s;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var s in this.connectionCallbacks)this.connection.unbind(s,this.connectionCallbacks[s]);var c=this.connection;return this.connection=null,c}}updateState(s,c){var f=this.state;if(this.state=s,f!==s){var b=s;b==="connected"&&(b+=" with new socket ID "+c.socket_id),pe.debug("State changed",f+" -> "+b),this.timeline.info({state:s,params:c}),this.emit("state_change",{previous:f,current:s}),this.emit(s,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class es{constructor(){this.channels={}}add(s,c){return this.channels[s]||(this.channels[s]=ts(s,c)),this.channels[s]}all(){return ze(this.channels)}find(s){return this.channels[s]}remove(s){var c=this.channels[s];return delete this.channels[s],c}disconnect(){de(this.channels,function(s){s.disconnect()})}}function ts(l,s){if(l.indexOf("private-encrypted-")===0){if(s.config.nacl)return en.createEncryptedChannel(l,s,s.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=N.buildLogSuffix("encryptedChannelSupport");throw new Ze(`${c}. ${f}`)}else{if(l.indexOf("private-")===0)return en.createPrivateChannel(l,s);if(l.indexOf("presence-")===0)return en.createPresenceChannel(l,s);if(l.indexOf("#")===0)throw new P('Cannot create a channel with name "'+l+'".');return en.createChannel(l,s)}}var nk={createChannels(){return new es},createConnectionManager(l,s){return new $e(l,s)},createChannel(l,s){return new I(l,s)},createPrivateChannel(l,s){return new ce(l,s)},createPresenceChannel(l,s){return new Ye(l,s)},createEncryptedChannel(l,s,c){return new Fr(l,s,c)},createTimelineSender(l,s){return new A(l,s)},createHandshake(l,s){return new _(l,s)},createAssistantToTheTransportManager(l,s,c){return new Qo(l,s,c)}};const en=nk;class xl{constructor(s){this.options=s||{},this.livesLeft=this.options.lives||1/0}getAssistant(s){return en.createAssistantToTheTransportManager(this,s,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class 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,ue.method("isSupported"))}connect(s,c){var f=this.strategies,b=0,x=this.timeout,R=null,O=(B,ee)=>{ee?c(null,ee):(b=b+1,this.loop&&(b=b%f.length),b<f.length?(x&&(x=x*2,this.timeoutLimit&&(x=Math.min(x,this.timeoutLimit))),R=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},O)):c(!0))};return R=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},O),{abort:function(){R.abort()},forceMinPriority:function(B){s=B,R&&R.forceMinPriority(B)}}}tryStrategy(s,c,f,b){var x=null,R=null;return f.timeout>0&&(x=new re(f.timeout,function(){R.abort(),b(!0)})),R=s.connect(c,function(O,B){O&&x&&x.isRunning()&&!f.failFast||(x&&x.ensureAborted(),b(O,B))}),{abort:function(){x&&x.ensureAborted(),R.abort()},forceMinPriority:function(O){R.forceMinPriority(O)}}}}class pi{constructor(s){this.strategies=s}isSupported(){return Or(this.strategies,ue.method("isSupported"))}connect(s,c){return rk(this.strategies,s,function(f,b){return function(x,R){if(b[f].error=x,x){ok(b)&&c(!0);return}Et(b,function(O){O.forceMinPriority(R.transport.priority)}),c(null,R)}})}}function rk(l,s,c){var f=Je(l,function(b,x,R,O){return b.connect(s,c(x,O))});return{abort:function(){Et(f,sk)},forceMinPriority:function(b){Et(f,function(x){x.forceMinPriority(b)})}}}function ok(l){return ai(l,function(s){return!!s.error})}function sk(l){!l.error&&!l.aborted&&(l.abort(),l.aborted=!0)}class ik{constructor(s,c,f){this.strategy=s,this.transports=c,this.ttl=f.ttl||18e5,this.usingTLS=f.useTLS,this.timeline=f.timeline}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.usingTLS,b=ak(f),x=b&&b.cacheSkipCount?b.cacheSkipCount:0,R=[this.strategy];if(b&&b.timestamp+this.ttl>=ue.now()){var O=this.transports[b.transport];O&&(["ws","wss"].includes(b.transport)||x>3?(this.timeline.info({cached:!0,transport:b.transport,latency:b.latency}),R.push(new Dn([O],{timeout:b.latency*2+1e3,failFast:!0}))):x++)}var B=ue.now(),ee=R.pop().connect(s,function oe(Pe,ss){Pe?(Sl(f),R.length>0?(B=ue.now(),ee=R.pop().connect(s,oe)):c(Pe)):(ck(f,ss.transport.name,ue.now()-B,x),c(null,ss))});return{abort:function(){ee.abort()},forceMinPriority:function(oe){s=oe,ee&&ee.forceMinPriority(oe)}}}}function hi(l){return"pusherTransport"+(l?"TLS":"NonTLS")}function ak(l){var s=G.getLocalStorage();if(s)try{var c=s[hi(l)];if(c)return JSON.parse(c)}catch(f){Sl(l)}return null}function ck(l,s,c,f){var b=G.getLocalStorage();if(b)try{b[hi(l)]=st({timestamp:ue.now(),transport:s,latency:c,cacheSkipCount:f})}catch(x){}}function Sl(l){var s=G.getLocalStorage();if(s)try{delete s[hi(l)]}catch(c){}}class ns{constructor(s,{delay:c}){this.strategy=s,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy,b,x=new re(this.options.delay,function(){b=f.connect(s,c)});return{abort:function(){x.ensureAborted(),b&&b.abort()},forceMinPriority:function(R){s=R,b&&b.forceMinPriority(R)}}}}class Br{constructor(s,c,f){this.test=s,this.trueBranch=c,this.falseBranch=f}isSupported(){var s=this.test()?this.trueBranch:this.falseBranch;return s.isSupported()}connect(s,c){var f=this.test()?this.trueBranch:this.falseBranch;return f.connect(s,c)}}class lk{constructor(s){this.strategy=s}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy.connect(s,function(b,x){x&&f.abort(),c(b,x)});return f}}function Gr(l){return function(){return l.isSupported()}}var uk=function(l,s,c){var f={};function b(Dl,a_,c_,l_,u_){var Ml=c(l,Dl,a_,c_,l_,u_);return f[Dl]=Ml,Ml}var x=Object.assign({},s,{hostNonTLS:l.wsHost+":"+l.wsPort,hostTLS:l.wsHost+":"+l.wssPort,httpPath:l.wsPath}),R=Object.assign({},x,{useTLS:!0}),O=Object.assign({},s,{hostNonTLS:l.httpHost+":"+l.httpPort,hostTLS:l.httpHost+":"+l.httpsPort,httpPath:l.httpPath}),B={loop:!0,timeout:15e3,timeoutLimit:6e4},ee=new xl({minPingDelay:1e4,maxPingDelay:l.activityTimeout}),oe=new xl({lives:2,minPingDelay:1e4,maxPingDelay:l.activityTimeout}),Pe=b("ws","ws",3,x,ee),ss=b("wss","ws",3,R,ee),n_=b("sockjs","sockjs",1,O),Ll=b("xhr_streaming","xhr_streaming",1,O,oe),r_=b("xdr_streaming","xdr_streaming",1,O,oe),Il=b("xhr_polling","xhr_polling",1,O),o_=b("xdr_polling","xdr_polling",1,O),zl=new Dn([Pe],B),s_=new Dn([ss],B),i_=new Dn([n_],B),$l=new Dn([new Br(Gr(Ll),Ll,r_)],B),Ol=new Dn([new Br(Gr(Il),Il,o_)],B),Nl=new Dn([new Br(Gr($l),new pi([$l,new ns(Ol,{delay:4e3})]),Ol)],B),mi=new Br(Gr(Nl),Nl,i_),bi;return s.useTLS?bi=new pi([zl,new ns(mi,{delay:2e3})]):bi=new pi([zl,new ns(s_,{delay:2e3}),new ns(mi,{delay:5e3})]),new ik(new lk(new Br(Gr(Pe),bi,mi)),f,{ttl:18e5,timeline:s.timeline,useTLS:s.useTLS})};const dk=uk;function pk(){var l=this;l.timeline.info(l.buildTimelineMessage({transport:l.name+(l.options.useTLS?"s":"")})),l.hooks.isInitialized()?l.changeState("initialized"):l.hooks.file?(l.changeState("initializing"),E.load(l.hooks.file,{useTLS:l.options.useTLS},function(s,c){l.hooks.isInitialized()?(l.changeState("initialized"),c(!0)):(s&&l.onError(s),l.onClose(),c(!1))})):l.onClose()}var hk={getRequest:function(l){var s=new window.XDomainRequest;return s.ontimeout=function(){l.emit("error",new Z),l.close()},s.onerror=function(c){l.emit("error",c),l.close()},s.onprogress=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText)},s.onload=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText),l.emit("finished",200),l.close()},s},abortRequest:function(l){l.ontimeout=l.onerror=l.onprogress=l.onload=null,l.abort()}};const fk=hk,gk=256*1024;class mk extends Ct{constructor(s,c,f){super(),this.hooks=s,this.method=c,this.url=f}start(s){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},G.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(s)}close(){this.unloader&&(G.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(s,c){for(;;){var f=this.advanceBuffer(c);if(f)this.emit("chunk",{status:s,data:f});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(s){var c=s.slice(this.position),f=c.indexOf(`
1365
- `);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(s){return this.position===s.length&&s.length>gk}}var fi;(function(l){l[l.CONNECTING=0]="CONNECTING",l[l.OPEN=1]="OPEN",l[l.CLOSED=3]="CLOSED"})(fi||(fi={}));const Mn=fi;var bk=1;class kk{constructor(s,c){this.hooks=s,this.session=El(1e3)+"/"+wk(8),this.location=_k(c),this.readyState=Mn.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===Mn.OPEN)try{return G.createSocketRequest("POST",Tl(vk(this.location,this.session))).start(s),!0}catch(c){return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(s,c,f){this.closeStream(),this.readyState=Mn.CLOSED,this.onclose&&this.onclose({code:s,reason:c,wasClean:f})}onChunk(s){if(s.status===200){this.readyState===Mn.OPEN&&this.onActivity();var c,f=s.data.slice(0,1);switch(f){case"o":c=JSON.parse(s.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(s.data.slice(1)||"[]");for(var b=0;b<c.length;b++)this.onEvent(c[b]);break;case"m":c=JSON.parse(s.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(s.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(s){this.readyState===Mn.CONNECTING?(s&&s.hostname&&(this.location.base=yk(this.location.base,s.hostname)),this.readyState=Mn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(s){this.readyState===Mn.OPEN&&this.onmessage&&this.onmessage({data:s})}onActivity(){this.onactivity&&this.onactivity()}onError(s){this.onerror&&this.onerror(s)}openStream(){this.stream=G.createSocketRequest("POST",Tl(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",s=>{this.onChunk(s)}),this.stream.bind("finished",s=>{this.hooks.onFinished(this,s)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(s){ue.defer(()=>{this.onError(s),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function _k(l){var s=/([^\?]*)\/*(\??.*)/.exec(l);return{base:s[1],queryString:s[2]}}function vk(l,s){return l.base+"/"+s+"/xhr_send"}function Tl(l){var s=l.indexOf("?")===-1?"?":"&";return l+s+"t="+ +new Date+"&n="+bk++}function yk(l,s){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(l);return c[1]+s+c[3]}function El(l){return G.randomInt(l)}function wk(l){for(var s=[],c=0;c<l;c++)s.push(El(32).toString(32));return s.join("")}const xk=kk;var Sk={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr_streaming"+l.queryString},onHeartbeat:function(l){l.sendRaw("[]")},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const Tk=Sk;var Ek={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr"+l.queryString},onHeartbeat:function(){},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){s===200?l.reconnect():l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const Ak=Ek;var Ck={getRequest:function(l){var s=G.getXHRAPI(),c=new s;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText),l.emit("finished",c.status),l.close();break}},c},abortRequest:function(l){l.onreadystatechange=null,l.abort()}};const Pk=Ck;var Rk={createStreamingSocket(l){return this.createSocket(Tk,l)},createPollingSocket(l){return this.createSocket(Ak,l)},createSocket(l,s){return new xk(l,s)},createXHR(l,s){return this.createRequest(Pk,l,s)},createRequest(l,s,c){return new mk(l,s,c)}};const Al=Rk;Al.createXDR=function(l,s){return this.createRequest(fk,l,s)};var Lk={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:y,getDefaultStrategy:dk,Transports:Pt,transportConnectionInitializer:pk,HTTPFactory:Al,TimelineTransport:mn,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(l){window.Pusher=l;var s=()=>{this.onDocumentBody(l.ready)};window.JSON?s():E.load("json2",{},s)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:Ut,jsonp:Mr}},onDocumentBody(l){document.body?l():setTimeout(()=>{this.onDocumentBody(l)},0)},createJSONPRequest(l,s){return new lr(l,s)},createScriptRequest(l){return new Go(l)},getLocalStorage(){try{return window.localStorage}catch(l){return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var l=this.getXHRAPI();return new l},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Ko},createWebSocket(l){var s=this.getWebSocketAPI();return new s(l)},createSocketRequest(l,s){if(this.isXHRSupported())return this.HTTPFactory.createXHR(l,s);if(this.isXDRSupported(s.indexOf("https:")===0))return this.HTTPFactory.createXDR(l,s);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var l=this.getXHRAPI();return!!l&&new l().withCredentials!==void 0},isXDRSupported(l){var s=l?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===s},addUnloadListener(l){window.addEventListener!==void 0?window.addEventListener("unload",l,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",l)},removeUnloadListener(l){window.addEventListener!==void 0?window.removeEventListener("unload",l,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",l)},randomInt(l){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*l)}};const G=Lk;var gi;(function(l){l[l.ERROR=3]="ERROR",l[l.INFO=6]="INFO",l[l.DEBUG=7]="DEBUG"})(gi||(gi={}));const rs=gi;class Ik{constructor(s,c,f){this.key=s,this.session=c,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(s,c){s<=this.options.level&&(this.events.push(Ee({},c,{timestamp:ue.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(s){this.log(rs.ERROR,s)}info(s){this.log(rs.INFO,s)}debug(s){this.log(rs.DEBUG,s)}isEmpty(){return this.events.length===0}send(s,c){var f=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=[],s(f,(b,x)=>{b||this.sent++,c&&c(b,x)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class zk{constructor(s,c,f,b){this.name=s,this.priority=c,this.transport=f,this.options=b||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(s,c){if(this.isSupported()){if(this.priority<s)return Cl(new Y,c)}else return Cl(new ne,c);var f=!1,b=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),x=null,R=function(){b.unbind("initialized",R),b.connect()},O=function(){x=en.createHandshake(b,function(Pe){f=!0,oe(),c(null,Pe)})},B=function(Pe){oe(),c(Pe)},ee=function(){oe();var Pe;Pe=st(b),c(new ge(Pe))},oe=function(){b.unbind("initialized",R),b.unbind("open",O),b.unbind("error",B),b.unbind("closed",ee)};return b.bind("initialized",R),b.bind("open",O),b.bind("error",B),b.bind("closed",ee),b.initialize(),{abort:()=>{f||(oe(),x?x.close():b.close())},forceMinPriority:Pe=>{f||this.priority<Pe&&(x?x.close():b.close())}}}}function Cl(l,s){return ue.defer(function(){s(l)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:$k}=G;var Ok=function(l,s,c,f,b,x){var R=$k[c];if(!R)throw new Ge(c);var O=(!l.enabledTransports||He(l.enabledTransports,s)!==-1)&&(!l.disabledTransports||He(l.disabledTransports,s)===-1),B;return O?(b=Object.assign({ignoreNullOrigin:l.ignoreNullOrigin},b),B=new zk(s,f,x?x.getAssistant(R):R,b)):B=Nk,B},Nk={isSupported:function(){return!1},connect:function(l,s){var c=ue.defer(function(){s(new ne)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function Dk(l){if(l==null)throw"You must pass an options object";if(l.cluster==null)throw"Options object must provide a cluster";"disableStats"in l&&pe.warn("The disableStats option is deprecated in favor of enableStats")}const Mk=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},Uk=l=>{if(typeof G.getAuthorizers()[l.transport]=="undefined")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=Mk(s,l);G.getAuthorizers()[l.transport](G,f,l,T.UserAuthentication,c)}},jk=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);c+="&channel_name="+encodeURIComponent(l.channelName);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},Zk=l=>{if(typeof G.getAuthorizers()[l.transport]=="undefined")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=jk(s,l);G.getAuthorizers()[l.transport](G,f,l,T.ChannelAuthorization,c)}},qk=(l,s,c)=>{const f={authTransport:s.transport,authEndpoint:s.endpoint,auth:{params:s.params,headers:s.headers}};return(b,x)=>{const R=l.channel(b.channelName);c(R,f).authorize(b.socketId,x)}};function Pl(l,s){let c={activityTimeout:l.activityTimeout||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:Wk(l),httpHost:Hk(l),useTLS:Gk(l),wsHost:Fk(l),userAuthenticator:Jk(l),channelAuthorizer:Vk(l,s)};return"disabledTransports"in l&&(c.disabledTransports=l.disabledTransports),"enabledTransports"in l&&(c.enabledTransports=l.enabledTransports),"ignoreNullOrigin"in l&&(c.ignoreNullOrigin=l.ignoreNullOrigin),"timelineParams"in l&&(c.timelineParams=l.timelineParams),"nacl"in l&&(c.nacl=l.nacl),c}function Hk(l){return l.httpHost?l.httpHost:l.cluster?`sockjs-${l.cluster}.pusher.com`:m.httpHost}function Fk(l){return l.wsHost?l.wsHost:Bk(l.cluster)}function Bk(l){return`ws-${l}.pusher.com`}function Gk(l){return G.getProtocol()==="https:"?!0:l.forceTLS!==!1}function Wk(l){return"enableStats"in l?l.enableStats:"disableStats"in l?!l.disableStats:!1}const Rl=l=>"customHandler"in l&&l.customHandler!=null;function Jk(l){const s=Object.assign(Object.assign({},m.userAuthentication),l.userAuthentication);return Rl(s)?s.customHandler:Uk(s)}function Yk(l,s){let c;if("channelAuthorization"in l)c=Object.assign(Object.assign({},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:qk(s,c,l.authorizer)};return c}function Vk(l,s){const c=Yk(l,s);return Rl(c)?c.customHandler:Zk(c)}class Xk extends Ct{constructor(s){super(function(c,f){pe.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=s,this.bindWatchlistInternalEvent()}handleEvent(s){s.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",s=>{var c=s.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(s)})}}function Kk(){let l,s;return{promise:new Promise((f,b)=>{l=f,s=b}),resolve:l,reject:s}}const Qk=Kk;class e_ extends Ct{constructor(s){super(function(c,f){pe.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){pe.warn(`Error during signin: ${c}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:f.auth,user_data:f.user_data})},this.pusher=s,this.pusher.connection.bind("state_change",({previous:c,current:f})=>{c!=="connected"&&f==="connected"&&this._signin(),c==="connected"&&f!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new Xk(s),this.pusher.connection.bind("message",c=>{var f=c.event;f==="pusher:signin_success"&&this._onSigninSuccess(c.data),this.serverToUserChannel&&this.serverToUserChannel.name===c.channel&&this.serverToUserChannel.handleEvent(c)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(s){try{this.user_data=JSON.parse(s.user_data)}catch(c){pe.error(`Failed parsing user data after signin: ${s.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){pe.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const s=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new I(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((c,f)=>{c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0||this.emit(c,f)}),s(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:s,resolve:c}=Qk();s.done=!1;const f=()=>{s.done=!0};s.then(f).catch(f),this.signinDonePromise=s,this._signinDoneResolve=c}}class Fe{static ready(){Fe.isReady=!0;for(var s=0,c=Fe.instances.length;s<c;s++)Fe.instances[s].connect()}static getClientFeatures(){return Ne(gt({ws:G.Transports.ws},function(s){return s.isSupported({})}))}constructor(s,c){t_(s),Dk(c),this.key=s,this.options=c,this.config=Pl(this.options,this),this.channels=en.createChannels(),this.global_emitter=new Ct,this.sessionID=G.randomInt(1e9),this.timeline=new Ik(this.key,this.sessionID,{cluster:this.config.cluster,features:Fe.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:rs.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=en.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+G.TimelineTransport.name}));var f=b=>G.getDefaultStrategy(this.config,b,Ok);this.connection=en.createConnectionManager(this.key,{getStrategy:f,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",b=>{var x=b.event,R=x.indexOf("pusher_internal:")===0;if(b.channel){var O=this.channel(b.channel);O&&O.handleEvent(b)}R||this.global_emitter.emit(b.event,b.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",b=>{pe.warn(b)}),Fe.instances.push(this),this.timeline.info({instances:Fe.instances.length}),this.user=new e_(this),Fe.isReady&&this.connect()}switchCluster(s){const{appKey:c,cluster:f}=s;this.key=c,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=Pl(this.options,this),this.connection.switchCluster(this.key)}channel(s){return this.channels.find(s)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var s=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new qe(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()}}Fe.instances=[],Fe.isReady=!1,Fe.logToConsole=!1,Fe.Runtime=G,Fe.ScriptReceivers=G.ScriptReceivers,Fe.DependenciesReceivers=G.DependenciesReceivers,Fe.auth_callbacks=G.auth_callbacks;const os=Fe;function t_(l){if(l==null)throw"You must pass your app key when you instantiate Pusher."}G.setup(Fe)}},r={};function o(a){var d=r[a];if(d!==void 0)return d.exports;var u=r[a]={exports:{}};return n[a].call(u.exports,u,u.exports,o),u.exports}o.d=(a,d)=>{for(var u in d)o.o(d,u)&&!o.o(a,u)&&Object.defineProperty(a,u,{enumerable:!0,get:d[u]})},o.o=(a,d)=>Object.prototype.hasOwnProperty.call(a,d);var i=o(721);return i})())})(Ss)),Ss.exports}var fg=hg();const gg=pg(fg);let _t=null,Yn=null;function mg(e){return L(this,null,function*(){return Yn||(Yn=L(null,null,function*(){const t=e.backendUrl.replace(/\/+$/,""),n=yield po(`${t}/api/settings`,{headers:{Authorization:`Bearer ${e.token}`}});if(!n.ok)throw new Error(`Failed to fetch settings: HTTP ${n.status}`);const r=yield n.json();_t=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)=>{po(`${t}/api/pusher/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({socket_id:o,channel_name:i})}).then(d=>d.json()).then(d=>a(null,d)).catch(d=>a(d instanceof Error?d:new Error(String(d)),null))}}})}),Yn.catch(()=>{Yn=null}),Yn)})}function bg(e){if(!e||!_t)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return _t.connection.bind("state_change",n),()=>_t==null?void 0:_t.connection.unbind("state_change",n)}function kg(e,t,n){return L(this,null,function*(){if(yield mg(e),!_t)return()=>{};const r=_t.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(eo.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(eo.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(eo.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(eo.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=bg(n.onReconnect);return()=>{r.unbind_all(),_t==null||_t.unsubscribe(`private-task-${t}`),o==null||o()}})}const Ts="ap-sdk-active-automation";function _g(){try{const e=sessionStorage.getItem(Ts);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.taskId&&(t!=null&&t.backendUrl)&&(t!=null&&t.title)?t:null}catch(e){return null}}function Wa(e){try{sessionStorage.setItem(Ts,JSON.stringify(e))}catch(t){}}function Ja(){try{sessionStorage.removeItem(Ts)}catch(e){}}function vg(e){return L(this,null,function*(){var i;try{(i=e.focus)==null||i.call(e)}catch(a){}e.scrollIntoView({block:"center",inline:"center",behavior:"instant"});let t=e.getBoundingClientRect();t.width===0&&t.height===0&&(yield yg(),t=e.getBoundingClientRect());const n=t.left+t.width/2,r=t.top+t.height/2,o={bubbles:!0,cancelable:!0,clientX:n,clientY:r};typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerdown",o)),e.dispatchEvent(new MouseEvent("mousedown",o)),typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerup",o)),e.dispatchEvent(new MouseEvent("mouseup",o)),e.click()})}function yg(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const Es="shared",Ya="ap-sdk-panel-size:",Va=280,Xa=200;function wg(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(t){return null}}function xg(e,t){try{sessionStorage.setItem(Ya+e,JSON.stringify(t))}catch(n){}}function fo(e,t,n){return Math.min(Math.max(e,t),n)}function Ka(){return window.innerWidth-32}function Qa(){return window.innerHeight-64}function As(e,t){const n=wg(t);n&&(e.style.width=`${fo(n.width,Va,Ka())}px`,e.style.height=`${fo(n.height,Xa,Qa())}px`);const r=document.createElement("div");r.className="ap-sdk-resize-handle",r.setAttribute("data-ap-sdk","1"),e.appendChild(r);let o=!1,i=0,a=0,d=0,u=0,p=0,h=0;const g=k=>{o&&(p=fo(d+(k.clientX-i),Va,Ka()),h=fo(u+(k.clientY-a),Xa,Qa()),e.style.width=`${p}px`,e.style.height=`${h}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",m),xg(t,{width:p,height:h}))};r.addEventListener("pointerdown",k=>{k.preventDefault(),k.stopPropagation(),o=!0,i=k.clientX,a=k.clientY;const y=e.getBoundingClientRect();d=y.width,u=y.height,p=d,h=u,document.addEventListener("pointermove",g),document.addEventListener("pointerup",m)})}function Cs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var vn=Cs();function ec(e){vn=e}var yn={exec:()=>null};function Vn(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 X(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(Be.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var Sg=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch(t){return!1}})(),Be={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:Vn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Vn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Vn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Vn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Vn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Vn(e=>new RegExp(`^ {0,${e}}>`))},Tg=/^(?:[ \t]*(?:\n|$))+/,Eg=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ag=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,vr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Cg=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ps=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,tc=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,nc=X(tc).replace(/bull/g,Ps).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Pg=X(tc).replace(/bull/g,Ps).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Rs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Rg=/^[^\n]+/,Ls=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Lg=X(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ls).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ig=X(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ps).getRegex(),go="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Is=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,zg=X("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Is).replace("tag",go).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),rc=e=>X(Rs).replace("hr",vr).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",go).getRegex(),$g=rc(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Og=rc(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Ng=X(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Og).getRegex(),zs={blockquote:Ng,code:Eg,def:Lg,fences:Ag,heading:Cg,hr:vr,html:zg,lheading:nc,list:Ig,newline:Tg,paragraph:$g,table:yn,text:Rg},oc=X("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",vr).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",go).getRegex(),Dg=U(v({},zs),{lheading:Pg,table:oc,paragraph:X(Rs).replace("hr",vr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",oc).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",go).getRegex()}),Mg=U(v({},zs),{html:X(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Is).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:yn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:X(Rs).replace("hr",vr).replace("heading",` *#{1,6} *[^
1364
+ */var Ga;function hg(){return Ga||(Ga=1,(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(a,d){var u=this&&this.__extends||(function(){var N=function(T,S){return N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(P,Z){P.__proto__=Z}||function(P,Z){for(var Y in Z)Z.hasOwnProperty(Y)&&(P[Y]=Z[Y])},N(T,S)};return function(T,S){N(T,S);function P(){this.constructor=T}T.prototype=S===null?Object.create(S):(P.prototype=S.prototype,new P)}})();Object.defineProperty(d,"__esModule",{value:!0});var p=256,h=(function(){function N(T){T===void 0&&(T="="),this._paddingCharacter=T}return N.prototype.encodedLength=function(T){return this._paddingCharacter?(T+2)/3*4|0:(T*8+5)/6|0},N.prototype.encode=function(T){for(var S="",P=0;P<T.length-2;P+=3){var Z=T[P]<<16|T[P+1]<<8|T[P+2];S+=this._encodeByte(Z>>>18&63),S+=this._encodeByte(Z>>>12&63),S+=this._encodeByte(Z>>>6&63),S+=this._encodeByte(Z>>>0&63)}var Y=T.length-P;if(Y>0){var Z=T[P]<<16|(Y===2?T[P+1]<<8:0);S+=this._encodeByte(Z>>>18&63),S+=this._encodeByte(Z>>>12&63),Y===2?S+=this._encodeByte(Z>>>6&63):S+=this._paddingCharacter||"",S+=this._paddingCharacter||""}return S},N.prototype.maxDecodedLength=function(T){return this._paddingCharacter?T/4*3|0:(T*6+7)/8|0},N.prototype.decodedLength=function(T){return this.maxDecodedLength(T.length-this._getPaddingLength(T))},N.prototype.decode=function(T){if(T.length===0)return new Uint8Array(0);for(var S=this._getPaddingLength(T),P=T.length-S,Z=new Uint8Array(this.maxDecodedLength(P)),Y=0,ge=0,Ze=0,Ge=0,ne=0,Ie=0,We=0;ge<P-4;ge+=4)Ge=this._decodeChar(T.charCodeAt(ge+0)),ne=this._decodeChar(T.charCodeAt(ge+1)),Ie=this._decodeChar(T.charCodeAt(ge+2)),We=this._decodeChar(T.charCodeAt(ge+3)),Z[Y++]=Ge<<2|ne>>>4,Z[Y++]=ne<<4|Ie>>>2,Z[Y++]=Ie<<6|We,Ze|=Ge&p,Ze|=ne&p,Ze|=Ie&p,Ze|=We&p;if(ge<P-1&&(Ge=this._decodeChar(T.charCodeAt(ge)),ne=this._decodeChar(T.charCodeAt(ge+1)),Z[Y++]=Ge<<2|ne>>>4,Ze|=Ge&p,Ze|=ne&p),ge<P-2&&(Ie=this._decodeChar(T.charCodeAt(ge+2)),Z[Y++]=ne<<4|Ie>>>2,Ze|=Ie&p),ge<P-3&&(We=this._decodeChar(T.charCodeAt(ge+3)),Z[Y++]=Ie<<6|We,Ze|=We&p),Ze!==0)throw new Error("Base64Coder: incorrect characters for decoding");return Z},N.prototype._encodeByte=function(T){var S=T;return S+=65,S+=25-T>>>8&6,S+=51-T>>>8&-75,S+=61-T>>>8&-15,S+=62-T>>>8&3,String.fromCharCode(S)},N.prototype._decodeChar=function(T){var S=p;return S+=(42-T&T-44)>>>8&-p+T-43+62,S+=(46-T&T-48)>>>8&-p+T-47+63,S+=(47-T&T-58)>>>8&-p+T-48+52,S+=(64-T&T-91)>>>8&-p+T-65+0,S+=(96-T&T-123)>>>8&-p+T-97+26,S},N.prototype._getPaddingLength=function(T){var S=0;if(this._paddingCharacter){for(var P=T.length-1;P>=0&&T[P]===this._paddingCharacter;P--)S++;if(T.length<4||S>2)throw new Error("Base64Coder: incorrect padding")}return S},N})();d.Coder=h;var g=new h;function m(N){return g.encode(N)}d.encode=m;function k(N){return g.decode(N)}d.decode=k;var y=(function(N){u(T,N);function T(){return N!==null&&N.apply(this,arguments)||this}return T.prototype._encodeByte=function(S){var P=S;return P+=65,P+=25-S>>>8&6,P+=51-S>>>8&-75,P+=61-S>>>8&-13,P+=62-S>>>8&49,String.fromCharCode(P)},T.prototype._decodeChar=function(S){var P=p;return P+=(44-S&S-46)>>>8&-p+S-45+62,P+=(94-S&S-96)>>>8&-p+S-95+63,P+=(47-S&S-58)>>>8&-p+S-48+52,P+=(64-S&S-91)>>>8&-p+S-65+0,P+=(96-S&S-123)>>>8&-p+S-97+26,P},T})(h);d.URLSafeCoder=y;var E=new y;function j(N){return E.encode(N)}d.encodeURLSafe=j;function Q(N){return E.decode(N)}d.decodeURLSafe=Q,d.encodedLength=function(N){return g.encodedLength(N)},d.maxDecodedLength=function(N){return g.maxDecodedLength(N)},d.decodedLength=function(N){return g.decodedLength(N)}},978(a,d){var u="utf8: invalid source encoding";function p(h){for(var g=[],m=0;m<h.length;m++){var k=h[m];if(k&128){var y=void 0;if(k<224){if(m>=h.length)throw new Error(u);var E=h[++m];if((E&192)!==128)throw new Error(u);k=(k&31)<<6|E&63,y=128}else if(k<240){if(m>=h.length-1)throw new Error(u);var E=h[++m],j=h[++m];if((E&192)!==128||(j&192)!==128)throw new Error(u);k=(k&15)<<12|(E&63)<<6|j&63,y=2048}else if(k<248){if(m>=h.length-2)throw new Error(u);var E=h[++m],j=h[++m],Q=h[++m];if((E&192)!==128||(j&192)!==128||(Q&192)!==128)throw new Error(u);k=(k&15)<<18|(E&63)<<12|(j&63)<<6|Q&63,y=65536}else throw new Error(u);if(k<y||k>=55296&&k<=57343)throw new Error(u);if(k>=65536){if(k>1114111)throw new Error(u);k-=65536,g.push(String.fromCharCode(55296|k>>10)),k=56320|k&1023}}g.push(String.fromCharCode(k))}return g.join("")}d.D4=p},721(a,d,u){a.exports=u(207).default},207(a,d,u){u.d(d,{default:()=>os});class p{constructor(s,c){this.lastId=0,this.prefix=s,this.name=c}create(s){this.lastId++;var c=this.lastId,f=this.prefix+c,b=this.name+"["+c+"]",x=!1,R=function(){x||(s.apply(null,arguments),x=!0)};return this[c]=R,{number:c,id:f,name:b,callback:R}}remove(s){delete this[s.number]}}var h=new p("_pusher_script_","Pusher.ScriptReceivers"),g={VERSION:"8.5.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""};const m=g;class k{constructor(s){this.options=s,this.receivers=s.receivers||h,this.loading={}}load(s,c,f){var b=this;if(b.loading[s]&&b.loading[s].length>0)b.loading[s].push(f);else{b.loading[s]=[f];var x=G.createScriptRequest(b.getPath(s,c)),R=b.receivers.create(function(O){if(b.receivers.remove(R),b.loading[s]){var B=b.loading[s];delete b.loading[s];for(var ee=function(Pe){Pe||x.cleanup()},oe=0;oe<B.length;oe++)B[oe](O,ee)}});x.send(R)}}getRoot(s){var c,f=G.getDocument().location.protocol;return s&&s.useTLS||f==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(s,c){return this.getRoot(c)+"/"+s+this.options.suffix+".js"}}var y=new p("_pusher_dependencies","Pusher.DependenciesReceivers"),E=new k({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:y});const j={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}},N={buildLogSuffix:function(l){const s="See:",c=j.urls[l];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=j.baseUrl+c.path),f?`${s} ${f}`:""}};var T;(function(l){l.UserAuthentication="user-authentication",l.ChannelAuthorization="channel-authorization"})(T||(T={}));class S extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class P extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Z extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Y extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class ge 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 Ge extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class ne extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Ie extends Error{constructor(s,c){super(c),this.status=s,Object.setPrototypeOf(this,new.target.prototype)}}const Ut=function(l,s,c,f,b){const x=G.createXHR();x.open("POST",c.endpoint,!0),x.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var R in c.headers)x.setRequestHeader(R,c.headers[R]);if(c.headersProvider!=null){let O=c.headersProvider();for(var R in O)x.setRequestHeader(R,O[R])}return x.onreadystatechange=function(){if(x.readyState===4)if(x.status===200){let O,B=!1;try{O=JSON.parse(x.responseText),B=!0}catch(ee){b(new Ie(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${x.responseText}`),null)}B&&b(null,O)}else{let O="";switch(f){case T.UserAuthentication:O=N.buildLogSuffix("authenticationEndpoint");break;case T.ChannelAuthorization:O=`Clients must be authorized to join private or presence channels. ${N.buildLogSuffix("authorizationEndpoint")}`;break}b(new Ie(x.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${x.status} from ${c.endpoint}. ${O}`),null)}},x.send(s),x};function Ln(l){return we(fn(l))}var jt=String.fromCharCode,St="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Zt=function(l){var s=l.charCodeAt(0);return s<128?l:s<2048?jt(192|s>>>6)+jt(128|s&63):jt(224|s>>>12&15)+jt(128|s>>>6&63)+jt(128|s&63)},fn=function(l){return l.replace(/[^\x00-\x7F]/g,Zt)},Tt=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=[St.charAt(c>>>18),St.charAt(c>>>12&63),s>=2?"=":St.charAt(c>>>6&63),s>=1?"=":St.charAt(c&63)];return f.join("")},we=window.btoa||function(l){return l.replace(/[\s\S]{1,3}/g,Tt)};class In{constructor(s,c,f,b){this.clear=c,this.timer=s(()=>{this.timer&&(this.timer=b(this.timer))},f)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const xe=In;function W(l){window.clearTimeout(l)}function H(l){window.clearInterval(l)}class re extends xe{constructor(s,c){super(setTimeout,W,s,function(f){return c(),null})}}class qe extends xe{constructor(s,c){super(setInterval,H,s,function(f){return c(),f})}}var rt={now(){return Date.now?Date.now():new Date().valueOf()},defer(l){return new re(0,l)},method(l,...s){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[l].apply(f,c.concat(arguments))}}};const ue=rt;function Ee(l,...s){for(var c=0;c<s.length;c++){var f=s[c];for(var b in f)f[b]&&f[b].constructor&&f[b].constructor===Object?l[b]=Ee(l[b]||{},f[b]):l[b]=f[b]}return l}function zn(){for(var l=["Pusher"],s=0;s<arguments.length;s++)typeof arguments[s]=="string"?l.push(arguments[s]):l.push(st(arguments[s]));return l.join(" : ")}function He(l,s){var c=Array.prototype.indexOf;if(l===null)return-1;if(c&&l.indexOf===c)return l.indexOf(s);for(var f=0,b=l.length;f<b;f++)if(l[f]===s)return f;return-1}function de(l,s){for(var c in l)Object.prototype.hasOwnProperty.call(l,c)&&s(l[c],c,l)}function Ne(l){var s=[];return de(l,function(c,f){s.push(f)}),s}function ze(l){var s=[];return de(l,function(c){s.push(c)}),s}function Et(l,s,c){for(var f=0;f<l.length;f++)s.call(c||window,l[f],f,l)}function Je(l,s){for(var c=[],f=0;f<l.length;f++)c.push(s(l[f],f,l,c));return c}function ot(l,s){var c={};return de(l,function(f,b){c[b]=s(f)}),c}function qt(l,s){s=s||function(b){return!!b};for(var c=[],f=0;f<l.length;f++)s(l[f],f,l,c)&&c.push(l[f]);return c}function mt(l,s){var c={};return de(l,function(f,b){(s&&s(f,b,l,c)||f)&&(c[b]=f)}),c}function Fo(l){var s=[];return de(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 ai(l,s){for(var c=0;c<l.length;c++)if(!s(l[c],c,l))return!1;return!0}function Nr(l){return ot(l,function(s){return typeof s=="object"&&(s=st(s)),encodeURIComponent(Ln(s.toString()))})}function $n(l){var s=mt(l,function(f){return f!==void 0}),c=Je(Fo(Nr(s)),ue.method("join","=")).join("&");return c}function gn(l){var s=[],c=[];return(function f(b,x){var R,O,B;switch(typeof b){case"object":if(!b)return null;for(R=0;R<s.length;R+=1)if(s[R]===b)return{$ref:c[R]};if(s.push(b),c.push(x),Object.prototype.toString.apply(b)==="[object Array]")for(B=[],R=0;R<b.length;R+=1)B[R]=f(b[R],x+"["+R+"]");else{B={};for(O in b)Object.prototype.hasOwnProperty.call(b,O)&&(B[O]=f(b[O],x+"["+JSON.stringify(O)+"]"))}return B;case"number":case"string":case"boolean":return b}})(l,"$")}function st(l){try{return JSON.stringify(l)}catch(s){return JSON.stringify(gn(l))}}class Dr{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=zn.apply(this,arguments);os.log?os.log(f):os.logToConsole&&s.bind(this)(f)}}const pe=new Dr;var Bo=function(l,s,c,f,b){(c.headers!==void 0||c.headersProvider!=null)&&pe.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var x=l.nextAuthCallbackID.toString();l.nextAuthCallbackID++;var R=l.getDocument(),O=R.createElement("script");l.auth_callbacks[x]=function(oe){b(null,oe)};var B="Pusher.auth_callbacks['"+x+"']";O.src=c.endpoint+"?callback="+encodeURIComponent(B)+"&"+s;var ee=R.getElementsByTagName("head")[0]||R.documentElement;ee.insertBefore(O,ee.firstChild)};const Mr=Bo;class Go{constructor(s){this.src=s}send(s){var c=this,f="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=s.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){s.callback(f)},c.script.onload=function(){s.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&s.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=s.id+"_error",c.errorScript.text=s.name+"('"+f+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var b=document.getElementsByTagName("head")[0];b.insertBefore(c.script,b.firstChild),c.errorScript&&b.insertBefore(c.errorScript,c.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class lr{constructor(s,c){this.url=s,this.data=c}send(s){if(!this.request){var c=$n(this.data),f=this.url+"/"+s.number+"?"+c;this.request=G.createScriptRequest(f),this.request.send(s)}}cleanup(){this.request&&this.request.cleanup()}}var ur=function(l,s){return function(c,f){var b="http"+(s?"s":"")+"://",x=b+(l.host||l.options.host)+l.options.path,R=G.createJSONPRequest(x,c),O=G.ScriptReceivers.create(function(B,ee){h.remove(O),R.cleanup(),ee&&ee.host&&(l.host=ee.host),f&&f(B,ee)});R.send(O)}},At={name:"jsonp",getAgent:ur};const mn=At;function On(l,s,c){var f=l+(s.useTLS?"s":""),b=s.useTLS?s.hostTLS:s.hostNonTLS;return f+"://"+b+c}function Nn(l,s){var c="/app/"+l,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(s?"&"+s:"");return c+f}var ci={getInitial:function(l,s){var c=(s.httpPath||"")+Nn(l,"flash=false");return On("ws",s,c)}},dr={getInitial:function(l,s){var c=(s.httpPath||"/pusher")+Nn(l);return On("http",s,c)}},pr={getInitial:function(l,s){return On("http",s,s.httpPath||"/pusher")},getPath:function(l,s){return Nn(l)}};class li{constructor(){this._callbacks={}}get(s){return this._callbacks[Kt(s)]}add(s,c,f){var b=Kt(s);this._callbacks[b]=this._callbacks[b]||[],this._callbacks[b].push({fn:c,context:f})}remove(s,c,f){if(!s&&!c&&!f){this._callbacks={};return}var b=s?[Kt(s)]:Ne(this._callbacks);c||f?this.removeCallback(b,c,f):this.removeAllCallbacks(b)}removeCallback(s,c,f){Et(s,function(b){this._callbacks[b]=qt(this._callbacks[b]||[],function(x){return c&&c!==x.fn||f&&f!==x.context}),this._callbacks[b].length===0&&delete this._callbacks[b]},this)}removeAllCallbacks(s){Et(s,function(c){delete this._callbacks[c]},this)}}function Kt(l){return"_"+l}class Ct{constructor(s){this.callbacks=new li,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=qt(this.global_callbacks||[],c=>c!==s),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(s,c,f){for(var b=0;b<this.global_callbacks.length;b++)this.global_callbacks[b](s,c);var x=this.callbacks.get(s),R=[];if(f?R.push(c,f):c&&R.push(c),x&&x.length>0)for(var b=0;b<x.length;b++)x[b].fn.apply(x[b].context||window,R);else this.failThrough&&this.failThrough(s,c);return this}}class ui extends Ct{constructor(s,c,f,b,x){super(),this.initialize=G.transportConnectionInitializer,this.hooks=s,this.name=c,this.priority=f,this.key=b,this.options=x,this.state="new",this.timeline=x.timeline,this.activityTimeout=x.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var s=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(s,this.options)}catch(c){return ue.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),pe.debug("Connecting",{transport:this.name,url:s}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(s){return this.state==="open"?(ue.defer(()=>{this.socket&&this.socket.send(s)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(s){this.emit("error",{type:"WebSocketError",error:s}),this.timeline.error(this.buildTimelineMessage({error:s.toString()}))}onClose(s){s?this.changeState("closed",{code:s.code,reason:s.reason,wasClean:s.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(s){this.emit("message",s)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=s=>{this.onError(s)},this.socket.onclose=s=>{this.onClose(s)},this.socket.onmessage=s=>{this.onMessage(s)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(s,c){this.state=s,this.timeline.info(this.buildTimelineMessage({state:s,params:c})),this.emit(s,c)}buildTimelineMessage(s){return Ee({cid:this.id},s)}}class he{constructor(s){this.hooks=s}isSupported(s){return this.hooks.isSupported(s)}createConnection(s,c,f,b){return new ui(this.hooks,s,c,f,b)}}var bn=new he({urls:ci,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!G.getWebSocketAPI()},isSupported:function(){return!!G.getWebSocketAPI()},getSocket:function(l){return G.createWebSocket(l)}}),Wo={urls:dr,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Ur=Ee({getSocket:function(l){return G.HTTPFactory.createStreamingSocket(l)}},Wo),hr=Ee({getSocket:function(l){return G.HTTPFactory.createPollingSocket(l)}},Wo),jr={isSupported:function(){return G.isXHRSupported()}},Jo=new he(Ee({},Ur,jr)),di=new he(Ee({},hr,jr)),bt={ws:bn,xhr_streaming:Jo,xhr_polling:di};const kt=bt;var Yo=new he({file:"sockjs",urls:pr,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:E.getPath("sockjs",{useTLS:s.useTLS}),ignore_null_origin:s.ignoreNullOrigin})},beforeOpen:function(l,s){l.send(JSON.stringify({path:s}))}}),Zr={isSupported:function(l){var s=G.isXDRSupported(l.useTLS);return s}},qr=new he(Ee({},Ur,Zr)),Vo=new he(Ee({},hr,Zr));kt.xdr_streaming=qr,kt.xdr_polling=Vo,kt.sockjs=Yo;const Pt=kt;class Xo extends Ct{constructor(){super();var s=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){s.emit("online")},!1),window.addEventListener("offline",function(){s.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Ko=new Xo;class Qo{constructor(s,c,f){this.manager=s,this.transport=c,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(s,c,f,b){b=Ee({},b,{activityTimeout:this.pingDelay});var x=this.transport.createConnection(s,c,f,b),R=null,O=function(){x.unbind("open",O),x.bind("closed",B),R=ue.now()},B=ee=>{if(x.unbind("closed",B),ee.code===1002||ee.code===1003)this.manager.reportDeath();else if(!ee.wasClean&&R){var oe=ue.now()-R;oe<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(oe/2,this.minPingDelay))}};return x.bind("open",O),x}isSupported(s){return this.manager.isAlive()&&this.transport.isSupported(s)}}const Hr={decodeMessage:function(l){try{var s=JSON.parse(l.data),c=s.data;if(typeof c=="string")try{c=JSON.parse(s.data)}catch(b){}var f={event:s.event,channel:s.channel,data:c};return s.user_id&&(f.user_id=s.user_id),f}catch(b){throw{type:"MessageParseError",error:b,data:l.data}}},encodeMessage:function(l){return JSON.stringify(l)},processHandshake:function(l){var s=Hr.decodeMessage(l);if(s.event==="pusher:connection_established"){if(!s.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:s.data.socket_id,activityTimeout:s.data.activity_timeout*1e3}}else{if(s.event==="pusher:error")return{action:this.getCloseAction(s.data),error:this.getCloseError(s.data)};throw"Invalid handshake"}},getCloseAction:function(l){return l.code<4e3?l.code>=1002&&l.code<=1004?"backoff":null:l.code===4e3?"tls_only":l.code<4100?"refused":l.code<4200?"backoff":l.code<4300?"retry":"refused"},getCloseError:function(l){return l.code!==1e3&&l.code!==1001?{type:"PusherError",data:{code:l.code,message:l.reason||l.message}}:null}},Qt=Hr;class M extends Ct{constructor(s,c){super(),this.id=s,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(s){return this.transport.send(s)}send_event(s,c,f){var b={event:s,data:c};return f&&(b.channel=f),pe.debug("Event sent",b),this.send(Qt.encodeMessage(b))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var s={message:f=>{var b;try{b=Qt.decodeMessage(f)}catch(x){this.emit("error",{type:"MessageParseError",error:x,data:f.data})}if(b!==void 0){switch(pe.debug("Event recd",b),b.event){case"pusher:error":this.emit("error",{type:"PusherError",data:b.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",b)}},activity:()=>{this.emit("activity")},error:f=>{this.emit("error",f)},closed:f=>{c(),f&&f.code&&this.handleCloseEvent(f),this.transport=null,this.emit("closed")}},c=()=>{de(s,(f,b)=>{this.transport.unbind(b,f)})};de(s,(f,b)=>{this.transport.bind(b,f)})}handleCloseEvent(s){var c=Qt.getCloseAction(s),f=Qt.getCloseError(s);f&&this.emit("error",f),c&&this.emit(c,{action:c,error:f})}}class _{constructor(s,c){this.transport=s,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=s=>{this.unbindListeners();var c;try{c=Qt.processHandshake(s)}catch(f){this.finish("error",{error:f}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new M(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=s=>{this.unbindListeners();var c=Qt.getCloseAction(s)||"backoff",f=Qt.getCloseError(s);this.finish(c,{error:f})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(s,c){this.callback(Ee({transport:this.transport,action:s},c))}}class A{constructor(s,c){this.timeline=s,this.options=c||{}}send(s,c){this.timeline.isEmpty()||this.timeline.send(G.TimelineTransport.getAgent(this,s),c)}}class I extends Ct{constructor(s,c){super(function(f,b){pe.debug("No callbacks on "+s+" for "+f)}),this.name=s,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(s,c){return c(null,{auth:""})}trigger(s,c){if(s.indexOf("client-")!==0)throw new S("Event '"+s+"' does not start with 'client-'");if(!this.subscribed){var f=N.buildLogSuffix("triggeringClientEvents");pe.warn(`Client event triggered before channel 'subscription_succeeded' event . ${f}`)}return this.pusher.send_event(s,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(s){var c=s.event,f=s.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(s);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(s);else if(c.indexOf("pusher_internal:")!==0){var b={};this.emit(c,f,b)}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",s.data)}handleSubscriptionCountEvent(s){s.data.subscription_count&&(this.subscriptionCount=s.data.subscription_count),this.emit("pusher:subscription_count",s.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(s,c)=>{s?(this.subscriptionPending=!1,pe.error(s.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:s.message},s instanceof Ie?{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 ce extends I{authorize(s,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:s},c)}}class De{constructor(){this.reset()}get(s){return Object.prototype.hasOwnProperty.call(this.members,s)?{id:s,info:this.members[s]}:null}each(s){de(this.members,(c,f)=>{s(this.get(f))})}setMyID(s){this.myID=s}onSubscription(s){this.members=s.presence.hash,this.count=s.presence.count,this.me=this.get(this.myID)}addMember(s){return this.get(s.user_id)===null&&this.count++,this.members[s.user_id]=s.user_info,this.get(s.user_id)}removeMember(s){var c=this.get(s.user_id);return c&&(delete this.members[s.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var Se=function(l,s,c,f){function b(x){return x instanceof c?x:new c(function(R){R(x)})}return new(c||(c=Promise))(function(x,R){function O(oe){try{ee(f.next(oe))}catch(Pe){R(Pe)}}function B(oe){try{ee(f.throw(oe))}catch(Pe){R(Pe)}}function ee(oe){oe.done?x(oe.value):b(oe.value).then(O,B)}ee((f=f.apply(l,s||[])).next())})};class Ye extends ce{constructor(s,c){super(s,c),this.members=new De}authorize(s,c){super.authorize(s,(f,b)=>Se(this,void 0,void 0,function*(){if(!f)if(b=b,b.channel_data!=null){var x=JSON.parse(b.channel_data);this.members.setMyID(x.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let R=N.buildLogSuffix("authorizationEndpoint");pe.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${R}, or the user should be signed in.`),c("Invalid auth response");return}c(f,b)}))}handleEvent(s){var c=s.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(s);else{var f=s.data,b={};s.user_id&&(b.user_id=s.user_id),this.emit(c,f,b)}}handleInternalEvent(s){var c=s.event,f=s.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(s);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(s);break;case"pusher_internal:member_added":var b=this.members.addMember(f);this.emit("pusher:member_added",b);break;case"pusher_internal:member_removed":var x=this.members.removeMember(f);x&&this.emit("pusher:member_removed",x);break}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(s.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var Rt=u(978),Ht=u(594);class Fr extends ce{constructor(s,c,f){super(s,c),this.key=null,this.nacl=f}authorize(s,c){super.authorize(s,(f,b)=>{if(f){c(f,b);return}let x=b.shared_secret;if(!x){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,Ht.decode)(x),delete b.shared_secret,c(null,b)})}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){pe.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){pe.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let f=(0,Ht.decode)(c.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){pe.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let b=(0,Ht.decode)(c.nonce);if(b.length<this.nacl.secretbox.nonceLength){pe.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${b.length}`);return}let x=this.nacl.secretbox.open(f,b,this.key);if(x===null){pe.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(R,O)=>{if(R){pe.error(`Failed to make a request to the authEndpoint: ${O}. Unable to fetch new key, so dropping encrypted event`);return}if(x=this.nacl.secretbox.open(f,b,this.key),x===null){pe.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(s,this.getDataToEmit(x))});return}this.emit(s,this.getDataToEmit(x))}getDataToEmit(s){let c=(0,Rt.D4)(s);try{return JSON.parse(c)}catch(f){return c}}}class $e extends Ct{constructor(s,c){super(),this.state="initialized",this.connection=null,this.key=s,this.options=c,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var f=G.getNetwork();f.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),f.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(s){this.key=s,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(s){return this.connection?this.connection.send(s):!1}send_event(s,c,f){return this.connection?this.connection.send_event(s,c,f):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var s=(c,f)=>{c?this.runner=this.strategy.connect(0,s):f.action==="error"?(this.emit("error",{type:"HandshakeError",error:f.error}),this.timeline.error({handshakeError:f.error})):(this.abortConnecting(),this.handshakeCallbacks[f.action](f))};this.runner=this.strategy.connect(0,s)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var s=this.abandonConnection();s.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(s){this.timeline.info({action:"retry",delay:s}),s>0&&this.emit("connecting_in",Math.round(s/1e3)),this.retryTimer=new re(s||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new re(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new re(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new re(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(s){return Ee({},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 Ee({},s,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let s=c=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),c(f)};return{tls_only:s(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:s(()=>{this.disconnect()}),backoff:s(()=>{this.retryIn(1e3)}),retry:s(()=>{this.retryIn(0)})}}setConnection(s){this.connection=s;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var s in this.connectionCallbacks)this.connection.unbind(s,this.connectionCallbacks[s]);var c=this.connection;return this.connection=null,c}}updateState(s,c){var f=this.state;if(this.state=s,f!==s){var b=s;b==="connected"&&(b+=" with new socket ID "+c.socket_id),pe.debug("State changed",f+" -> "+b),this.timeline.info({state:s,params:c}),this.emit("state_change",{previous:f,current:s}),this.emit(s,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class es{constructor(){this.channels={}}add(s,c){return this.channels[s]||(this.channels[s]=ts(s,c)),this.channels[s]}all(){return ze(this.channels)}find(s){return this.channels[s]}remove(s){var c=this.channels[s];return delete this.channels[s],c}disconnect(){de(this.channels,function(s){s.disconnect()})}}function ts(l,s){if(l.indexOf("private-encrypted-")===0){if(s.config.nacl)return en.createEncryptedChannel(l,s,s.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=N.buildLogSuffix("encryptedChannelSupport");throw new Ze(`${c}. ${f}`)}else{if(l.indexOf("private-")===0)return en.createPrivateChannel(l,s);if(l.indexOf("presence-")===0)return en.createPresenceChannel(l,s);if(l.indexOf("#")===0)throw new P('Cannot create a channel with name "'+l+'".');return en.createChannel(l,s)}}var nk={createChannels(){return new es},createConnectionManager(l,s){return new $e(l,s)},createChannel(l,s){return new I(l,s)},createPrivateChannel(l,s){return new ce(l,s)},createPresenceChannel(l,s){return new Ye(l,s)},createEncryptedChannel(l,s,c){return new Fr(l,s,c)},createTimelineSender(l,s){return new A(l,s)},createHandshake(l,s){return new _(l,s)},createAssistantToTheTransportManager(l,s,c){return new Qo(l,s,c)}};const en=nk;class xl{constructor(s){this.options=s||{},this.livesLeft=this.options.lives||1/0}getAssistant(s){return en.createAssistantToTheTransportManager(this,s,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class 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,ue.method("isSupported"))}connect(s,c){var f=this.strategies,b=0,x=this.timeout,R=null,O=(B,ee)=>{ee?c(null,ee):(b=b+1,this.loop&&(b=b%f.length),b<f.length?(x&&(x=x*2,this.timeoutLimit&&(x=Math.min(x,this.timeoutLimit))),R=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},O)):c(!0))};return R=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},O),{abort:function(){R.abort()},forceMinPriority:function(B){s=B,R&&R.forceMinPriority(B)}}}tryStrategy(s,c,f,b){var x=null,R=null;return f.timeout>0&&(x=new re(f.timeout,function(){R.abort(),b(!0)})),R=s.connect(c,function(O,B){O&&x&&x.isRunning()&&!f.failFast||(x&&x.ensureAborted(),b(O,B))}),{abort:function(){x&&x.ensureAborted(),R.abort()},forceMinPriority:function(O){R.forceMinPriority(O)}}}}class pi{constructor(s){this.strategies=s}isSupported(){return Or(this.strategies,ue.method("isSupported"))}connect(s,c){return rk(this.strategies,s,function(f,b){return function(x,R){if(b[f].error=x,x){ok(b)&&c(!0);return}Et(b,function(O){O.forceMinPriority(R.transport.priority)}),c(null,R)}})}}function rk(l,s,c){var f=Je(l,function(b,x,R,O){return b.connect(s,c(x,O))});return{abort:function(){Et(f,sk)},forceMinPriority:function(b){Et(f,function(x){x.forceMinPriority(b)})}}}function ok(l){return ai(l,function(s){return!!s.error})}function sk(l){!l.error&&!l.aborted&&(l.abort(),l.aborted=!0)}class ik{constructor(s,c,f){this.strategy=s,this.transports=c,this.ttl=f.ttl||18e5,this.usingTLS=f.useTLS,this.timeline=f.timeline}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.usingTLS,b=ak(f),x=b&&b.cacheSkipCount?b.cacheSkipCount:0,R=[this.strategy];if(b&&b.timestamp+this.ttl>=ue.now()){var O=this.transports[b.transport];O&&(["ws","wss"].includes(b.transport)||x>3?(this.timeline.info({cached:!0,transport:b.transport,latency:b.latency}),R.push(new Dn([O],{timeout:b.latency*2+1e3,failFast:!0}))):x++)}var B=ue.now(),ee=R.pop().connect(s,function oe(Pe,ss){Pe?(Sl(f),R.length>0?(B=ue.now(),ee=R.pop().connect(s,oe)):c(Pe)):(ck(f,ss.transport.name,ue.now()-B,x),c(null,ss))});return{abort:function(){ee.abort()},forceMinPriority:function(oe){s=oe,ee&&ee.forceMinPriority(oe)}}}}function hi(l){return"pusherTransport"+(l?"TLS":"NonTLS")}function ak(l){var s=G.getLocalStorage();if(s)try{var c=s[hi(l)];if(c)return JSON.parse(c)}catch(f){Sl(l)}return null}function ck(l,s,c,f){var b=G.getLocalStorage();if(b)try{b[hi(l)]=st({timestamp:ue.now(),transport:s,latency:c,cacheSkipCount:f})}catch(x){}}function Sl(l){var s=G.getLocalStorage();if(s)try{delete s[hi(l)]}catch(c){}}class ns{constructor(s,{delay:c}){this.strategy=s,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy,b,x=new re(this.options.delay,function(){b=f.connect(s,c)});return{abort:function(){x.ensureAborted(),b&&b.abort()},forceMinPriority:function(R){s=R,b&&b.forceMinPriority(R)}}}}class Br{constructor(s,c,f){this.test=s,this.trueBranch=c,this.falseBranch=f}isSupported(){var s=this.test()?this.trueBranch:this.falseBranch;return s.isSupported()}connect(s,c){var f=this.test()?this.trueBranch:this.falseBranch;return f.connect(s,c)}}class lk{constructor(s){this.strategy=s}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy.connect(s,function(b,x){x&&f.abort(),c(b,x)});return f}}function Gr(l){return function(){return l.isSupported()}}var uk=function(l,s,c){var f={};function b(Dl,a_,c_,l_,u_){var Ml=c(l,Dl,a_,c_,l_,u_);return f[Dl]=Ml,Ml}var x=Object.assign({},s,{hostNonTLS:l.wsHost+":"+l.wsPort,hostTLS:l.wsHost+":"+l.wssPort,httpPath:l.wsPath}),R=Object.assign({},x,{useTLS:!0}),O=Object.assign({},s,{hostNonTLS:l.httpHost+":"+l.httpPort,hostTLS:l.httpHost+":"+l.httpsPort,httpPath:l.httpPath}),B={loop:!0,timeout:15e3,timeoutLimit:6e4},ee=new xl({minPingDelay:1e4,maxPingDelay:l.activityTimeout}),oe=new xl({lives:2,minPingDelay:1e4,maxPingDelay:l.activityTimeout}),Pe=b("ws","ws",3,x,ee),ss=b("wss","ws",3,R,ee),n_=b("sockjs","sockjs",1,O),Ll=b("xhr_streaming","xhr_streaming",1,O,oe),r_=b("xdr_streaming","xdr_streaming",1,O,oe),Il=b("xhr_polling","xhr_polling",1,O),o_=b("xdr_polling","xdr_polling",1,O),zl=new Dn([Pe],B),s_=new Dn([ss],B),i_=new Dn([n_],B),$l=new Dn([new Br(Gr(Ll),Ll,r_)],B),Ol=new Dn([new Br(Gr(Il),Il,o_)],B),Nl=new Dn([new Br(Gr($l),new pi([$l,new ns(Ol,{delay:4e3})]),Ol)],B),mi=new Br(Gr(Nl),Nl,i_),bi;return s.useTLS?bi=new pi([zl,new ns(mi,{delay:2e3})]):bi=new pi([zl,new ns(s_,{delay:2e3}),new ns(mi,{delay:5e3})]),new ik(new lk(new Br(Gr(Pe),bi,mi)),f,{ttl:18e5,timeline:s.timeline,useTLS:s.useTLS})};const dk=uk;function pk(){var l=this;l.timeline.info(l.buildTimelineMessage({transport:l.name+(l.options.useTLS?"s":"")})),l.hooks.isInitialized()?l.changeState("initialized"):l.hooks.file?(l.changeState("initializing"),E.load(l.hooks.file,{useTLS:l.options.useTLS},function(s,c){l.hooks.isInitialized()?(l.changeState("initialized"),c(!0)):(s&&l.onError(s),l.onClose(),c(!1))})):l.onClose()}var hk={getRequest:function(l){var s=new window.XDomainRequest;return s.ontimeout=function(){l.emit("error",new Z),l.close()},s.onerror=function(c){l.emit("error",c),l.close()},s.onprogress=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText)},s.onload=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText),l.emit("finished",200),l.close()},s},abortRequest:function(l){l.ontimeout=l.onerror=l.onprogress=l.onload=null,l.abort()}};const fk=hk,gk=256*1024;class mk extends Ct{constructor(s,c,f){super(),this.hooks=s,this.method=c,this.url=f}start(s){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},G.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(s)}close(){this.unloader&&(G.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(s,c){for(;;){var f=this.advanceBuffer(c);if(f)this.emit("chunk",{status:s,data:f});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(s){var c=s.slice(this.position),f=c.indexOf(`
1365
+ `);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(s){return this.position===s.length&&s.length>gk}}var fi;(function(l){l[l.CONNECTING=0]="CONNECTING",l[l.OPEN=1]="OPEN",l[l.CLOSED=3]="CLOSED"})(fi||(fi={}));const Mn=fi;var bk=1;class kk{constructor(s,c){this.hooks=s,this.session=El(1e3)+"/"+wk(8),this.location=_k(c),this.readyState=Mn.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===Mn.OPEN)try{return G.createSocketRequest("POST",Tl(vk(this.location,this.session))).start(s),!0}catch(c){return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(s,c,f){this.closeStream(),this.readyState=Mn.CLOSED,this.onclose&&this.onclose({code:s,reason:c,wasClean:f})}onChunk(s){if(s.status===200){this.readyState===Mn.OPEN&&this.onActivity();var c,f=s.data.slice(0,1);switch(f){case"o":c=JSON.parse(s.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(s.data.slice(1)||"[]");for(var b=0;b<c.length;b++)this.onEvent(c[b]);break;case"m":c=JSON.parse(s.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(s.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(s){this.readyState===Mn.CONNECTING?(s&&s.hostname&&(this.location.base=yk(this.location.base,s.hostname)),this.readyState=Mn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(s){this.readyState===Mn.OPEN&&this.onmessage&&this.onmessage({data:s})}onActivity(){this.onactivity&&this.onactivity()}onError(s){this.onerror&&this.onerror(s)}openStream(){this.stream=G.createSocketRequest("POST",Tl(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",s=>{this.onChunk(s)}),this.stream.bind("finished",s=>{this.hooks.onFinished(this,s)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(s){ue.defer(()=>{this.onError(s),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function _k(l){var s=/([^\?]*)\/*(\??.*)/.exec(l);return{base:s[1],queryString:s[2]}}function vk(l,s){return l.base+"/"+s+"/xhr_send"}function Tl(l){var s=l.indexOf("?")===-1?"?":"&";return l+s+"t="+ +new Date+"&n="+bk++}function yk(l,s){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(l);return c[1]+s+c[3]}function El(l){return G.randomInt(l)}function wk(l){for(var s=[],c=0;c<l;c++)s.push(El(32).toString(32));return s.join("")}const xk=kk;var Sk={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr_streaming"+l.queryString},onHeartbeat:function(l){l.sendRaw("[]")},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const Tk=Sk;var Ek={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr"+l.queryString},onHeartbeat:function(){},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){s===200?l.reconnect():l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const Ak=Ek;var Ck={getRequest:function(l){var s=G.getXHRAPI(),c=new s;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText),l.emit("finished",c.status),l.close();break}},c},abortRequest:function(l){l.onreadystatechange=null,l.abort()}};const Pk=Ck;var Rk={createStreamingSocket(l){return this.createSocket(Tk,l)},createPollingSocket(l){return this.createSocket(Ak,l)},createSocket(l,s){return new xk(l,s)},createXHR(l,s){return this.createRequest(Pk,l,s)},createRequest(l,s,c){return new mk(l,s,c)}};const Al=Rk;Al.createXDR=function(l,s){return this.createRequest(fk,l,s)};var Lk={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:y,getDefaultStrategy:dk,Transports:Pt,transportConnectionInitializer:pk,HTTPFactory:Al,TimelineTransport:mn,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(l){window.Pusher=l;var s=()=>{this.onDocumentBody(l.ready)};window.JSON?s():E.load("json2",{},s)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:Ut,jsonp:Mr}},onDocumentBody(l){document.body?l():setTimeout(()=>{this.onDocumentBody(l)},0)},createJSONPRequest(l,s){return new lr(l,s)},createScriptRequest(l){return new Go(l)},getLocalStorage(){try{return window.localStorage}catch(l){return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var l=this.getXHRAPI();return new l},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Ko},createWebSocket(l){var s=this.getWebSocketAPI();return new s(l)},createSocketRequest(l,s){if(this.isXHRSupported())return this.HTTPFactory.createXHR(l,s);if(this.isXDRSupported(s.indexOf("https:")===0))return this.HTTPFactory.createXDR(l,s);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var l=this.getXHRAPI();return!!l&&new l().withCredentials!==void 0},isXDRSupported(l){var s=l?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===s},addUnloadListener(l){window.addEventListener!==void 0?window.addEventListener("unload",l,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",l)},removeUnloadListener(l){window.addEventListener!==void 0?window.removeEventListener("unload",l,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",l)},randomInt(l){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*l)}};const G=Lk;var gi;(function(l){l[l.ERROR=3]="ERROR",l[l.INFO=6]="INFO",l[l.DEBUG=7]="DEBUG"})(gi||(gi={}));const rs=gi;class Ik{constructor(s,c,f){this.key=s,this.session=c,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(s,c){s<=this.options.level&&(this.events.push(Ee({},c,{timestamp:ue.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(s){this.log(rs.ERROR,s)}info(s){this.log(rs.INFO,s)}debug(s){this.log(rs.DEBUG,s)}isEmpty(){return this.events.length===0}send(s,c){var f=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=[],s(f,(b,x)=>{b||this.sent++,c&&c(b,x)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class zk{constructor(s,c,f,b){this.name=s,this.priority=c,this.transport=f,this.options=b||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(s,c){if(this.isSupported()){if(this.priority<s)return Cl(new Y,c)}else return Cl(new ne,c);var f=!1,b=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),x=null,R=function(){b.unbind("initialized",R),b.connect()},O=function(){x=en.createHandshake(b,function(Pe){f=!0,oe(),c(null,Pe)})},B=function(Pe){oe(),c(Pe)},ee=function(){oe();var Pe;Pe=st(b),c(new ge(Pe))},oe=function(){b.unbind("initialized",R),b.unbind("open",O),b.unbind("error",B),b.unbind("closed",ee)};return b.bind("initialized",R),b.bind("open",O),b.bind("error",B),b.bind("closed",ee),b.initialize(),{abort:()=>{f||(oe(),x?x.close():b.close())},forceMinPriority:Pe=>{f||this.priority<Pe&&(x?x.close():b.close())}}}}function Cl(l,s){return ue.defer(function(){s(l)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:$k}=G;var Ok=function(l,s,c,f,b,x){var R=$k[c];if(!R)throw new Ge(c);var O=(!l.enabledTransports||He(l.enabledTransports,s)!==-1)&&(!l.disabledTransports||He(l.disabledTransports,s)===-1),B;return O?(b=Object.assign({ignoreNullOrigin:l.ignoreNullOrigin},b),B=new zk(s,f,x?x.getAssistant(R):R,b)):B=Nk,B},Nk={isSupported:function(){return!1},connect:function(l,s){var c=ue.defer(function(){s(new ne)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function Dk(l){if(l==null)throw"You must pass an options object";if(l.cluster==null)throw"Options object must provide a cluster";"disableStats"in l&&pe.warn("The disableStats option is deprecated in favor of enableStats")}const Mk=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},Uk=l=>{if(typeof G.getAuthorizers()[l.transport]=="undefined")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=Mk(s,l);G.getAuthorizers()[l.transport](G,f,l,T.UserAuthentication,c)}},jk=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);c+="&channel_name="+encodeURIComponent(l.channelName);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},Zk=l=>{if(typeof G.getAuthorizers()[l.transport]=="undefined")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=jk(s,l);G.getAuthorizers()[l.transport](G,f,l,T.ChannelAuthorization,c)}},qk=(l,s,c)=>{const f={authTransport:s.transport,authEndpoint:s.endpoint,auth:{params:s.params,headers:s.headers}};return(b,x)=>{const R=l.channel(b.channelName);c(R,f).authorize(b.socketId,x)}};function Pl(l,s){let c={activityTimeout:l.activityTimeout||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:Wk(l),httpHost:Hk(l),useTLS:Gk(l),wsHost:Fk(l),userAuthenticator:Jk(l),channelAuthorizer:Vk(l,s)};return"disabledTransports"in l&&(c.disabledTransports=l.disabledTransports),"enabledTransports"in l&&(c.enabledTransports=l.enabledTransports),"ignoreNullOrigin"in l&&(c.ignoreNullOrigin=l.ignoreNullOrigin),"timelineParams"in l&&(c.timelineParams=l.timelineParams),"nacl"in l&&(c.nacl=l.nacl),c}function Hk(l){return l.httpHost?l.httpHost:l.cluster?`sockjs-${l.cluster}.pusher.com`:m.httpHost}function Fk(l){return l.wsHost?l.wsHost:Bk(l.cluster)}function Bk(l){return`ws-${l}.pusher.com`}function Gk(l){return G.getProtocol()==="https:"?!0:l.forceTLS!==!1}function Wk(l){return"enableStats"in l?l.enableStats:"disableStats"in l?!l.disableStats:!1}const Rl=l=>"customHandler"in l&&l.customHandler!=null;function Jk(l){const s=Object.assign(Object.assign({},m.userAuthentication),l.userAuthentication);return Rl(s)?s.customHandler:Uk(s)}function Yk(l,s){let c;if("channelAuthorization"in l)c=Object.assign(Object.assign({},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:qk(s,c,l.authorizer)};return c}function Vk(l,s){const c=Yk(l,s);return Rl(c)?c.customHandler:Zk(c)}class Xk extends Ct{constructor(s){super(function(c,f){pe.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=s,this.bindWatchlistInternalEvent()}handleEvent(s){s.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",s=>{var c=s.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(s)})}}function Kk(){let l,s;return{promise:new Promise((f,b)=>{l=f,s=b}),resolve:l,reject:s}}const Qk=Kk;class e_ extends Ct{constructor(s){super(function(c,f){pe.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){pe.warn(`Error during signin: ${c}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:f.auth,user_data:f.user_data})},this.pusher=s,this.pusher.connection.bind("state_change",({previous:c,current:f})=>{c!=="connected"&&f==="connected"&&this._signin(),c==="connected"&&f!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new Xk(s),this.pusher.connection.bind("message",c=>{var f=c.event;f==="pusher:signin_success"&&this._onSigninSuccess(c.data),this.serverToUserChannel&&this.serverToUserChannel.name===c.channel&&this.serverToUserChannel.handleEvent(c)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(s){try{this.user_data=JSON.parse(s.user_data)}catch(c){pe.error(`Failed parsing user data after signin: ${s.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){pe.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const s=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new I(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((c,f)=>{c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0||this.emit(c,f)}),s(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:s,resolve:c}=Qk();s.done=!1;const f=()=>{s.done=!0};s.then(f).catch(f),this.signinDonePromise=s,this._signinDoneResolve=c}}class Fe{static ready(){Fe.isReady=!0;for(var s=0,c=Fe.instances.length;s<c;s++)Fe.instances[s].connect()}static getClientFeatures(){return Ne(mt({ws:G.Transports.ws},function(s){return s.isSupported({})}))}constructor(s,c){t_(s),Dk(c),this.key=s,this.options=c,this.config=Pl(this.options,this),this.channels=en.createChannels(),this.global_emitter=new Ct,this.sessionID=G.randomInt(1e9),this.timeline=new Ik(this.key,this.sessionID,{cluster:this.config.cluster,features:Fe.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:rs.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=en.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+G.TimelineTransport.name}));var f=b=>G.getDefaultStrategy(this.config,b,Ok);this.connection=en.createConnectionManager(this.key,{getStrategy:f,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",b=>{var x=b.event,R=x.indexOf("pusher_internal:")===0;if(b.channel){var O=this.channel(b.channel);O&&O.handleEvent(b)}R||this.global_emitter.emit(b.event,b.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",b=>{pe.warn(b)}),Fe.instances.push(this),this.timeline.info({instances:Fe.instances.length}),this.user=new e_(this),Fe.isReady&&this.connect()}switchCluster(s){const{appKey:c,cluster:f}=s;this.key=c,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=Pl(this.options,this),this.connection.switchCluster(this.key)}channel(s){return this.channels.find(s)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var s=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new qe(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()}}Fe.instances=[],Fe.isReady=!1,Fe.logToConsole=!1,Fe.Runtime=G,Fe.ScriptReceivers=G.ScriptReceivers,Fe.DependenciesReceivers=G.DependenciesReceivers,Fe.auth_callbacks=G.auth_callbacks;const os=Fe;function t_(l){if(l==null)throw"You must pass your app key when you instantiate Pusher."}G.setup(Fe)}},r={};function o(a){var d=r[a];if(d!==void 0)return d.exports;var u=r[a]={exports:{}};return n[a].call(u.exports,u,u.exports,o),u.exports}o.d=(a,d)=>{for(var u in d)o.o(d,u)&&!o.o(a,u)&&Object.defineProperty(a,u,{enumerable:!0,get:d[u]})},o.o=(a,d)=>Object.prototype.hasOwnProperty.call(a,d);var i=o(721);return i})())})(Ss)),Ss.exports}var fg=hg();const gg=pg(fg);let _t=null,Yn=null;function mg(e){return L(this,null,function*(){return Yn||(Yn=L(null,null,function*(){const t=e.backendUrl.replace(/\/+$/,""),n=yield po(`${t}/api/settings`,{headers:{Authorization:`Bearer ${e.token}`}});if(!n.ok)throw new Error(`Failed to fetch settings: HTTP ${n.status}`);const r=yield n.json();_t=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)=>{po(`${t}/api/pusher/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({socket_id:o,channel_name:i})}).then(d=>d.json()).then(d=>a(null,d)).catch(d=>a(d instanceof Error?d:new Error(String(d)),null))}}})}),Yn.catch(()=>{Yn=null}),Yn)})}function bg(e){if(!e||!_t)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return _t.connection.bind("state_change",n),()=>_t==null?void 0:_t.connection.unbind("state_change",n)}function kg(e,t,n){return L(this,null,function*(){if(yield mg(e),!_t)return()=>{};const r=_t.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(eo.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(eo.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(eo.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(eo.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=bg(n.onReconnect);return()=>{r.unbind_all(),_t==null||_t.unsubscribe(`private-task-${t}`),o==null||o()}})}const Ts="ap-sdk-active-automation";function _g(){try{const e=sessionStorage.getItem(Ts);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.taskId&&(t!=null&&t.backendUrl)&&(t!=null&&t.title)?t:null}catch(e){return null}}function Wa(e){try{sessionStorage.setItem(Ts,JSON.stringify(e))}catch(t){}}function Ja(){try{sessionStorage.removeItem(Ts)}catch(e){}}function vg(e){return L(this,null,function*(){var i;try{(i=e.focus)==null||i.call(e)}catch(a){}e.scrollIntoView({block:"center",inline:"center",behavior:"instant"});let t=e.getBoundingClientRect();t.width===0&&t.height===0&&(yield yg(),t=e.getBoundingClientRect());const n=t.left+t.width/2,r=t.top+t.height/2,o={bubbles:!0,cancelable:!0,clientX:n,clientY:r};typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerdown",o)),e.dispatchEvent(new MouseEvent("mousedown",o)),typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerup",o)),e.dispatchEvent(new MouseEvent("mouseup",o)),e.click()})}function yg(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const Es="shared",Ya="ap-sdk-panel-size:",Va=280,Xa=200;function wg(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(t){return null}}function xg(e,t){try{sessionStorage.setItem(Ya+e,JSON.stringify(t))}catch(n){}}function fo(e,t,n){return Math.min(Math.max(e,t),n)}function Ka(){return window.innerWidth-32}function Qa(){return window.innerHeight-64}function As(e,t){const n=wg(t);n&&(e.style.width=`${fo(n.width,Va,Ka())}px`,e.style.height=`${fo(n.height,Xa,Qa())}px`);const r=document.createElement("div");r.className="ap-sdk-resize-handle",r.setAttribute("data-ap-sdk","1"),e.appendChild(r);let o=!1,i=0,a=0,d=0,u=0,p=0,h=0;const g=k=>{o&&(p=fo(d+(k.clientX-i),Va,Ka()),h=fo(u+(k.clientY-a),Xa,Qa()),e.style.width=`${p}px`,e.style.height=`${h}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",m),xg(t,{width:p,height:h}))};r.addEventListener("pointerdown",k=>{k.preventDefault(),k.stopPropagation(),o=!0,i=k.clientX,a=k.clientY;const y=e.getBoundingClientRect();d=y.width,u=y.height,p=d,h=u,document.addEventListener("pointermove",g),document.addEventListener("pointerup",m)})}function Cs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var vn=Cs();function ec(e){vn=e}var yn={exec:()=>null};function Vn(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 X(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(Be.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var Sg=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch(t){return!1}})(),Be={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:Vn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Vn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Vn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Vn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Vn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Vn(e=>new RegExp(`^ {0,${e}}>`))},Tg=/^(?:[ \t]*(?:\n|$))+/,Eg=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ag=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,vr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Cg=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ps=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,tc=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,nc=X(tc).replace(/bull/g,Ps).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Pg=X(tc).replace(/bull/g,Ps).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Rs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Rg=/^[^\n]+/,Ls=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Lg=X(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ls).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ig=X(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ps).getRegex(),go="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Is=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,zg=X("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Is).replace("tag",go).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),rc=e=>X(Rs).replace("hr",vr).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",go).getRegex(),$g=rc(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Og=rc(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Ng=X(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Og).getRegex(),zs={blockquote:Ng,code:Eg,def:Lg,fences:Ag,heading:Cg,hr:vr,html:zg,lheading:nc,list:Ig,newline:Tg,paragraph:$g,table:yn,text:Rg},oc=X("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",vr).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",go).getRegex(),Dg=U(v({},zs),{lheading:Pg,table:oc,paragraph:X(Rs).replace("hr",vr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",oc).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",go).getRegex()}),Mg=U(v({},zs),{html:X(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Is).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:yn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:X(Rs).replace("hr",vr).replace("heading",` *#{1,6} *[^
1366
1366
  ]`).replace("lheading",nc).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),Ug=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,jg=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,sc=/^( {2,}|\\)\n(?!\s*$)/,Zg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Gt=/[\p{P}\p{S}]/u,Xn=/[\s\p{P}\p{S}]/u,yr=/[^\s\p{P}\p{S}]/u,qg=X(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Xn).getRegex(),Hg=/[\p{Pi}\p{Ps}"']/u,ic=/(?!~)[\p{P}\p{S}]/u,Fg=/(?!~)[\s\p{P}\p{S}]/u,Bg=/(?:[^\s\p{P}\p{S}]|~)/u,Gg=X(/link|precode-code|html/,"g").replace("link",new RegExp("\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)")).replace("precode-",Sg?"(?<!`)()":"(^^|[^`])").replace("code",new RegExp("(?<b>`+)[^`]+\\k<b>(?!`)")).replace("html",/<(?! )[^<>]*?>/).getRegex(),ac=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Wg=X(ac,"u").replace(/punct/g,Gt).getRegex(),Jg=X(ac,"u").replace(/punct/g,ic).getRegex(),Yg=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Vg=X(Yg,"u").replace(/openQuote/g,Hg).replace(/punct/g,Gt).getRegex(),cc="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Xg=X(cc,"gu").replace(/notPunctSpace/g,yr).replace(/punctSpace/g,Xn).replace(/punct/g,Gt).getRegex(),Kg=X(cc,"gu").replace(/notPunctSpace/g,Bg).replace(/punctSpace/g,Fg).replace(/punct/g,ic).getRegex(),Qg="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",em=X(Qg,"gu").replace(/notPunctSpace/g,yr).replace(/punctSpace/g,Xn).replace(/punct/g,Gt).getRegex(),tm=X("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,yr).replace(/punctSpace/g,Xn).replace(/punct/g,Gt).getRegex(),nm="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",rm=X(nm,"gu").replace(/notPunctSpace/g,yr).replace(/punctSpace/g,Xn).replace(/punct/g,Gt).getRegex(),om=X(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Gt).getRegex(),sm="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",im=X(sm,"gu").replace(/notPunctSpace/g,yr).replace(/punctSpace/g,Xn).replace(/punct/g,Gt).getRegex(),am=X(/\\(punct)/,"gu").replace(/punct/g,Gt).getRegex(),cm=X(/^<(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(),lm=X(Is).replace("(?:-->|$)","-->").getRegex(),um=X("^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",lm).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),mo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,dm=X(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",mo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),lc=X(/^!?\[(label)\]\[(ref)\]/).replace("label",mo).replace("ref",Ls).getRegex(),uc=X(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ls).getRegex(),pm=X("reflink|nolink(?!\\()","g").replace("reflink",lc).replace("nolink",uc).getRegex(),dc=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,$s={_backpedal:yn,anyPunctuation:am,autolink:cm,blockSkip:Gg,br:sc,code:jg,del:yn,delLDelim:yn,delRDelim:yn,emStrongLDelim:Wg,emStrongRDelimAst:Xg,emStrongRDelimUnd:tm,escape:Ug,link:dm,nolink:uc,punctuation:qg,reflink:lc,reflinkSearch:pm,tag:um,text:Zg,url:yn},hm=U(v({},$s),{emStrongLDelim:Vg,emStrongRDelimAst:em,emStrongRDelimUnd:rm,link:X(/^!?\[(label)\]\((.*?)\)/).replace("label",mo).getRegex(),reflink:X(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",mo).getRegex()}),Os=U(v({},$s),{emStrongRDelimAst:Kg,emStrongLDelim:Jg,delLDelim:om,delRDelim:im,url:X(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",dc).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:X(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",dc).getRegex()}),fm=U(v({},Os),{br:X(sc).replace("{2,}","*").getRegex(),text:X(Os.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),bo={normal:zs,gfm:Dg,pedantic:Mg},wr={normal:$s,gfm:Os,breaks:fm,pedantic:hm},gm={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},pc=e=>gm[e];function zt(e,t){if(t){if(Be.escapeTest.test(e))return e.replace(Be.escapeReplace,pc)}else if(Be.escapeTestNoEncode.test(e))return e.replace(Be.escapeReplaceNoEncode,pc);return e}function hc(e){try{e=encodeURI(e).replace(Be.percentDecode,"%")}catch(t){return null}return e}function fc(e,t){var i;let n=e.replace(Be.findPipe,(a,d,u)=>{let p=!1,h=d;for(;--h>=0&&u[h]==="\\";)p=!p;return p?"|":" |"}),r=n.split(Be.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(Be.slashPipe,"|");return r}function cn(e,t,n){let r=e.length;if(r===0)return"";let o=0;for(;o<r&&e.charAt(r-o-1)===t;)o++;return e.slice(0,r-o)}function gc(e){let t=e.split(`
1367
1367
  `),n=t.length-1;for(;n>=0&&Be.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
1368
1368
  `)}function mm(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 bm(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 mc(e,t,n,r,o){let i=t.href,a=t.title||null,d=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let u={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:d,tokens:r.inlineTokens(d)};return r.state.inLink=!1,u}function km(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
@@ -1426,8 +1426,8 @@ ${this.parser.parse(e)}</blockquote>
1426
1426
  ${e}</tr>
1427
1427
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
1428
1428
  `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${zt(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),o=hc(e);if(o===null)return r;e=o;let i='<a href="'+e+'"';return t&&(i+=' title="'+zt(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let o=hc(e);if(o===null)return zt(n);e=o;let i=`<img src="${e}" alt="${zt(n)}"`;return t&&(i+=` title="${zt(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:zt(e.text)}},Ns=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}},yt=class vi{constructor(t){le(this,"options");le(this,"renderer");le(this,"textRenderer");this.options=t||vn,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 Ns}static parse(t,n){return new vi(n).parse(t)}static parseInline(t,n){return new vi(n).parseInline(t)}parse(t){var r,o;this.renderer.parser=this;let n="";for(let i=0;i<t.length;i++){let a=t[i];if((o=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&o[a.type]){let u=a,p=this.options.extensions.renderers[u.type].call({parser:this},u);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(u.type)){n+=p||"";continue}}let d=a;switch(d.type){case"space":{n+=this.renderer.space(d);break}case"hr":{n+=this.renderer.hr(d);break}case"heading":{n+=this.renderer.heading(d);break}case"code":{n+=this.renderer.code(d);break}case"table":{n+=this.renderer.table(d);break}case"blockquote":{n+=this.renderer.blockquote(d);break}case"list":{n+=this.renderer.list(d);break}case"checkbox":{n+=this.renderer.checkbox(d);break}case"html":{n+=this.renderer.html(d);break}case"def":{n+=this.renderer.def(d);break}case"paragraph":{n+=this.renderer.paragraph(d);break}case"text":{n+=this.renderer.text(d);break}default:{let u='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return n}parseInline(t,n=this.renderer){var o,i;this.renderer.parser=this;let r="";for(let a=0;a<t.length;a++){let d=t[a];if((i=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&i[d.type]){let p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(d.type)){r+=p||"";continue}}let u=d;switch(u.type){case"escape":{r+=n.text(u);break}case"html":{r+=n.html(u);break}case"link":{r+=n.link(u);break}case"image":{r+=n.image(u);break}case"checkbox":{r+=n.checkbox(u);break}case"strong":{r+=n.strong(u);break}case"em":{r+=n.em(u);break}case"codespan":{r+=n.codespan(u);break}case"br":{r+=n.br(u);break}case"del":{r+=n.del(u);break}case"text":{r+=n.text(u);break}default:{let p='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return r}},xr=(Ho=class{constructor(e){le(this,"options");le(this,"block");this.options=e||vn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?vt.lex:vt.lexInline}provideParser(e=this.block){return e?yt.parse:yt.parseInline}},le(Ho,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),le(Ho,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Ho),_m=class{constructor(...e){le(this,"defaults",Cs());le(this,"options",this.setOptions);le(this,"parse",this.parseMarkdown(!0));le(this,"parseInline",this.parseMarkdown(!1));le(this,"Parser",yt);le(this,"Renderer",_o);le(this,"TextRenderer",Ns);le(this,"Lexer",vt);le(this,"Tokenizer",ko);le(this,"Hooks",xr);this.use(...e)}walkTokens(e,t){var r,o;let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let a=i;for(let d of a.header)n=n.concat(this.walkTokens(d.tokens,t));for(let d of a.rows)for(let u of d)n=n.concat(this.walkTokens(u.tokens,t));break}case"list":{let a=i;n=n.concat(this.walkTokens(a.items,t));break}default:{let a=i;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(d=>{let u=a[d].flat(1/0);n=n.concat(this.walkTokens(u,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r=v({},n);if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let i=t.renderers[o.name];i?t.renderers[o.name]=function(...a){let d=o.renderer.apply(this,a);return d===!1&&(d=i.apply(this,a)),d}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[o.level];i?i.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),r.extensions=t),n.renderer){let o=this.defaults.renderer||new _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,d=n.renderer[a],u=o[a];o[a]=(...p)=>{let h=d.apply(o,p);return h===!1&&(h=u.apply(o,p)),h||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new ko(this.defaults);for(let i in n.tokenizer){if(!(i in o))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,d=n.tokenizer[a],u=o[a];o[a]=(...p)=>{let h=d.apply(o,p);return h===!1&&(h=u.apply(o,p)),h}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new xr;for(let i in n.hooks){if(!(i in o))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,d=n.hooks[a],u=o[a];xr.passThroughHooks.has(i)?o[a]=p=>{if(this.defaults.async&&xr.passThroughHooksRespectAsync.has(i))return L(this,null,function*(){let g=yield d.call(o,p);return u.call(o,g)});let h=d.call(o,p);return u.call(o,h)}:o[a]=(...p)=>{if(this.defaults.async)return L(this,null,function*(){let g=yield d.apply(o,p);return g===!1&&(g=yield u.apply(o,p)),g});let h=d.apply(o,p);return h===!1&&(h=u.apply(o,p)),h}}r.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(a){let d=[];return d.push(i.call(this,a)),o&&(d=d.concat(o.call(this,a))),d}}this.defaults=v(v({},this.defaults),r)}),this}setOptions(e){return this.defaults=v(v({},this.defaults),e),this}lexer(e,t){return vt.lex(e,t!=null?t:this.defaults)}parser(e,t){return yt.parse(e,t!=null?t:this.defaults)}parseMarkdown(e){return(t,n)=>{let r=v({},n),o=v(v({},this.defaults),r),i=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return L(this,null,function*(){let a=o.hooks?yield o.hooks.preprocess(t):t,d=yield(o.hooks?yield o.hooks.provideLexer(e):e?vt.lex:vt.lexInline)(a,o),u=o.hooks?yield o.hooks.processAllTokens(d):d;o.walkTokens&&(yield Promise.all(this.walkTokens(u,o.walkTokens)));let p=yield(o.hooks?yield o.hooks.provideParser(e):e?yt.parse:yt.parseInline)(u,o);return o.hooks?yield o.hooks.postprocess(p):p}).catch(i);try{o.hooks&&(t=o.hooks.preprocess(t));let a=(o.hooks?o.hooks.provideLexer(e):e?vt.lex:vt.lexInline)(t,o);o.hooks&&(a=o.hooks.processAllTokens(a)),o.walkTokens&&this.walkTokens(a,o.walkTokens);let d=(o.hooks?o.hooks.provideParser(e):e?yt.parse:yt.parseInline)(a,o);return o.hooks&&(d=o.hooks.postprocess(d)),d}catch(a){return i(a)}}}onError(e,t){return n=>{if(n.message+=`
1429
- Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+zt(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},wn=new _m;function ie(e,t){return wn.parse(e,t)}ie.options=ie.setOptions=function(e){return wn.setOptions(e),ie.defaults=wn.defaults,ec(ie.defaults),ie},ie.getDefaults=Cs,ie.defaults=vn;function vm(...e){return wn.use(...e),ie.defaults=wn.defaults,ec(ie.defaults),ie}ie.use=vm,ie.walkTokens=function(e,t){return wn.walkTokens(e,t)},ie.parseInline=wn.parseInline,ie.Parser=yt,ie.parser=yt.parse,ie.Renderer=_o,ie.TextRenderer=Ns,ie.Lexer=vt,ie.lexer=vt.lex,ie.Tokenizer=ko,ie.Hooks=xr,ie.parse=ie,ie.options,ie.setOptions,ie.walkTokens,ie.parseInline,yt.parse,vt.lex;/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:bc,setPrototypeOf:kc,isFrozen:ym,getPrototypeOf:wm,getOwnPropertyDescriptor:xm}=Object;let{freeze:Xe,seal:pt,create:Ds}=Object,{apply:Ms,construct:Us}=typeof Reflect!="undefined"&&Reflect;Xe||(Xe=function(t){return t}),pt||(pt=function(t){return t}),Ms||(Ms=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return t.apply(n,o)}),Us||(Us=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new t(...r)});const vo=Qe(Array.prototype.forEach),Sm=Qe(Array.prototype.lastIndexOf),_c=Qe(Array.prototype.pop),Sr=Qe(Array.prototype.push),Tm=Qe(Array.prototype.splice),yo=Qe(String.prototype.toLowerCase),js=Qe(String.prototype.toString),Zs=Qe(String.prototype.match),Tr=Qe(String.prototype.replace),Em=Qe(String.prototype.indexOf),Am=Qe(String.prototype.trim),wt=Qe(Object.prototype.hasOwnProperty),Ke=Qe(RegExp.prototype.test),Er=Cm(TypeError);function Qe(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Ms(e,t,r)}}function Cm(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Us(e,n)}}function V(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yo;kc&&kc(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(ym(t)||(t[r]=i),o=i)}e[o]=!0}return e}function Pm(e){for(let t=0;t<e.length;t++)wt(e,t)||(e[t]=null);return e}function $t(e){const t=Ds(null);for(const[n,r]of bc(e))wt(e,n)&&(Array.isArray(r)?t[n]=Pm(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=$t(r):t[n]=r);return t}function Ar(e,t){for(;e!==null;){const r=xm(e,t);if(r){if(r.get)return Qe(r.get);if(typeof r.value=="function")return Qe(r.value)}e=wm(e)}function n(){return null}return n}const vc=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"]),qs=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"]),Hs=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"]),Rm=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"]),Fs=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"]),Lm=Xe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),yc=Xe(["#text"]),wc=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"]),Bs=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"]),xc=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"]),wo=Xe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Im=pt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),zm=pt(/<%[\w\W]*|[\w\W]*%>/gm),$m=pt(/\$\{[\w\W]*/gm),Om=pt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Nm=pt(/^aria-[\-\w]+$/),Sc=pt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Dm=pt(/^(?:\w+script|data):/i),Mm=pt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Tc=pt(/^html$/i),Um=pt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ec=Object.freeze({__proto__:null,ARIA_ATTR:Nm,ATTR_WHITESPACE:Mm,CUSTOM_ELEMENT:Um,DATA_ATTR:Om,DOCTYPE_NAME:Tc,ERB_EXPR:zm,IS_ALLOWED_URI:Sc,IS_SCRIPT_OR_DATA:Dm,MUSTACHE_EXPR:Im,TMPLIT_EXPR:$m});const Cr={element:1,text:3,progressingInstruction:7,comment:8,document:9},jm=function(){return typeof window=="undefined"?null:window},Zm=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch(a){return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Ac=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Cc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:jm();const t=M=>Cc(M);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Cr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:d,Element:u,NodeFilter:p,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:m,trustedTypes:k}=e,y=u.prototype,E=Ar(y,"cloneNode"),j=Ar(y,"remove"),Q=Ar(y,"nextSibling"),N=Ar(y,"childNodes"),T=Ar(y,"parentNode");if(typeof a=="function"){const M=n.createElement("template");M.content&&M.content.ownerDocument&&(n=M.content.ownerDocument)}let S,P="";const{implementation:Z,createNodeIterator:Y,createDocumentFragment:ge,getElementsByTagName:Ze}=n,{importNode:Ge}=r;let ne=Ac();t.isSupported=typeof bc=="function"&&typeof T=="function"&&Z&&Z.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ie,ERB_EXPR:We,TMPLIT_EXPR:Ut,DATA_ATTR:Ln,ARIA_ATTR:jt,IS_SCRIPT_OR_DATA:St,ATTR_WHITESPACE:Zt,CUSTOM_ELEMENT:fn}=Ec;let{IS_ALLOWED_URI:Tt}=Ec,we=null;const In=V({},[...vc,...qs,...Hs,...Fs,...yc]);let xe=null;const W=V({},[...wc,...Bs,...xc,...wo]);let H=Object.seal(Ds(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),re=null,qe=null;const rt=Object.seal(Ds(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ue=!0,Ee=!0,zn=!1,He=!0,de=!1,Ne=!0,ze=!1,Et=!1,Je=!1,ot=!1,qt=!1,gt=!1,Fo=!0,Or=!1;const ai="user-content-";let Nr=!0,$n=!1,gn={},st=null;const Dr=V({},["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 pe=null;const Bo=V({},["audio","video","img","source","image","track"]);let Mr=null;const Go=V({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),lr="http://www.w3.org/1998/Math/MathML",ur="http://www.w3.org/2000/svg",At="http://www.w3.org/1999/xhtml";let mn=At,On=!1,Nn=null;const ci=V({},[lr,ur,At],js);let dr=V({},["mi","mo","mn","ms","mtext"]),pr=V({},["annotation-xml"]);const li=V({},["title","style","font","a","script"]);let Kt=null;const Ct=["application/xhtml+xml","text/html"],ui="text/html";let he=null,bn=null;const Wo=n.createElement("form"),Ur=function(_){return _ instanceof RegExp||_ instanceof Function},hr=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(bn&&bn===_)){if((!_||typeof _!="object")&&(_={}),_=$t(_),Kt=Ct.indexOf(_.PARSER_MEDIA_TYPE)===-1?ui:_.PARSER_MEDIA_TYPE,he=Kt==="application/xhtml+xml"?js:yo,we=wt(_,"ALLOWED_TAGS")?V({},_.ALLOWED_TAGS,he):In,xe=wt(_,"ALLOWED_ATTR")?V({},_.ALLOWED_ATTR,he):W,Nn=wt(_,"ALLOWED_NAMESPACES")?V({},_.ALLOWED_NAMESPACES,js):ci,Mr=wt(_,"ADD_URI_SAFE_ATTR")?V($t(Go),_.ADD_URI_SAFE_ATTR,he):Go,pe=wt(_,"ADD_DATA_URI_TAGS")?V($t(Bo),_.ADD_DATA_URI_TAGS,he):Bo,st=wt(_,"FORBID_CONTENTS")?V({},_.FORBID_CONTENTS,he):Dr,re=wt(_,"FORBID_TAGS")?V({},_.FORBID_TAGS,he):$t({}),qe=wt(_,"FORBID_ATTR")?V({},_.FORBID_ATTR,he):$t({}),gn=wt(_,"USE_PROFILES")?_.USE_PROFILES:!1,ue=_.ALLOW_ARIA_ATTR!==!1,Ee=_.ALLOW_DATA_ATTR!==!1,zn=_.ALLOW_UNKNOWN_PROTOCOLS||!1,He=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,de=_.SAFE_FOR_TEMPLATES||!1,Ne=_.SAFE_FOR_XML!==!1,ze=_.WHOLE_DOCUMENT||!1,ot=_.RETURN_DOM||!1,qt=_.RETURN_DOM_FRAGMENT||!1,gt=_.RETURN_TRUSTED_TYPE||!1,Je=_.FORCE_BODY||!1,Fo=_.SANITIZE_DOM!==!1,Or=_.SANITIZE_NAMED_PROPS||!1,Nr=_.KEEP_CONTENT!==!1,$n=_.IN_PLACE||!1,Tt=_.ALLOWED_URI_REGEXP||Sc,mn=_.NAMESPACE||At,dr=_.MATHML_TEXT_INTEGRATION_POINTS||dr,pr=_.HTML_INTEGRATION_POINTS||pr,H=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&Ur(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&Ur(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),de&&(Ee=!1),qt&&(ot=!0),gn&&(we=V({},yc),xe=[],gn.html===!0&&(V(we,vc),V(xe,wc)),gn.svg===!0&&(V(we,qs),V(xe,Bs),V(xe,wo)),gn.svgFilters===!0&&(V(we,Hs),V(xe,Bs),V(xe,wo)),gn.mathMl===!0&&(V(we,Fs),V(xe,xc),V(xe,wo))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?rt.tagCheck=_.ADD_TAGS:(we===In&&(we=$t(we)),V(we,_.ADD_TAGS,he))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?rt.attributeCheck=_.ADD_ATTR:(xe===W&&(xe=$t(xe)),V(xe,_.ADD_ATTR,he))),_.ADD_URI_SAFE_ATTR&&V(Mr,_.ADD_URI_SAFE_ATTR,he),_.FORBID_CONTENTS&&(st===Dr&&(st=$t(st)),V(st,_.FORBID_CONTENTS,he)),_.ADD_FORBID_CONTENTS&&(st===Dr&&(st=$t(st)),V(st,_.ADD_FORBID_CONTENTS,he)),Nr&&(we["#text"]=!0),ze&&V(we,["html","head","body"]),we.table&&(V(we,["tbody"]),delete re.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=_.TRUSTED_TYPES_POLICY,P=S.createHTML("")}else S===void 0&&(S=Zm(k,o)),S!==null&&typeof P=="string"&&(P=S.createHTML(""));Xe&&Xe(_),bn=_}},jr=V({},[...qs,...Hs,...Rm]),Jo=V({},[...Fs,...Lm]),di=function(_){let A=T(_);(!A||!A.tagName)&&(A={namespaceURI:mn,tagName:"template"});const I=yo(_.tagName),ce=yo(A.tagName);return Nn[_.namespaceURI]?_.namespaceURI===ur?A.namespaceURI===At?I==="svg":A.namespaceURI===lr?I==="svg"&&(ce==="annotation-xml"||dr[ce]):!!jr[I]:_.namespaceURI===lr?A.namespaceURI===At?I==="math":A.namespaceURI===ur?I==="math"&&pr[ce]:!!Jo[I]:_.namespaceURI===At?A.namespaceURI===ur&&!pr[ce]||A.namespaceURI===lr&&!dr[ce]?!1:!Jo[I]&&(li[I]||!jr[I]):!!(Kt==="application/xhtml+xml"&&Nn[_.namespaceURI]):!1},mt=function(_){Sr(t.removed,{element:_});try{T(_).removeChild(_)}catch(A){j(_)}},bt=function(_,A){try{Sr(t.removed,{attribute:A.getAttributeNode(_),from:A})}catch(I){Sr(t.removed,{attribute:null,from:A})}if(A.removeAttribute(_),_==="is")if(ot||qt)try{mt(A)}catch(I){}else try{A.setAttribute(_,"")}catch(I){}},Yo=function(_){let A=null,I=null;if(Je)_="<remove></remove>"+_;else{const Se=Zs(_,/^[\r\n\t ]+/);I=Se&&Se[0]}Kt==="application/xhtml+xml"&&mn===At&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const ce=S?S.createHTML(_):_;if(mn===At)try{A=new m().parseFromString(ce,Kt)}catch(Se){}if(!A||!A.documentElement){A=Z.createDocument(mn,"template",null);try{A.documentElement.innerHTML=On?P:ce}catch(Se){}}const De=A.body||A.documentElement;return _&&I&&De.insertBefore(n.createTextNode(I),De.childNodes[0]||null),mn===At?Ze.call(A,ze?"html":"body")[0]:ze?A.documentElement:De},Zr=function(_){return Y.call(_.ownerDocument||_,_,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},qr=function(_){return _ instanceof g&&(typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||!(_.attributes instanceof h)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function")},Vo=function(_){return typeof d=="function"&&_ instanceof d};function Pt(M,_,A){vo(M,I=>{I.call(t,_,A,bn)})}const Xo=function(_){let A=null;if(Pt(ne.beforeSanitizeElements,_,null),qr(_))return mt(_),!0;const I=he(_.nodeName);if(Pt(ne.uponSanitizeElement,_,{tagName:I,allowedTags:we}),Ne&&_.hasChildNodes()&&!Vo(_.firstElementChild)&&Ke(/<[/\w!]/g,_.innerHTML)&&Ke(/<[/\w!]/g,_.textContent)||_.nodeType===Cr.progressingInstruction||Ne&&_.nodeType===Cr.comment&&Ke(/<[/\w]/g,_.data))return mt(_),!0;if(!(rt.tagCheck instanceof Function&&rt.tagCheck(I))&&(!we[I]||re[I])){if(!re[I]&&Qo(I)&&(H.tagNameCheck instanceof RegExp&&Ke(H.tagNameCheck,I)||H.tagNameCheck instanceof Function&&H.tagNameCheck(I)))return!1;if(Nr&&!st[I]){const ce=T(_)||_.parentNode,De=N(_)||_.childNodes;if(De&&ce){const Se=De.length;for(let Ye=Se-1;Ye>=0;--Ye){const Rt=E(De[Ye],!0);Rt.__removalCount=(_.__removalCount||0)+1,ce.insertBefore(Rt,Q(_))}}}return mt(_),!0}return _ instanceof u&&!di(_)||(I==="noscript"||I==="noembed"||I==="noframes")&&Ke(/<\/no(script|embed|frames)/i,_.innerHTML)?(mt(_),!0):(de&&_.nodeType===Cr.text&&(A=_.textContent,vo([Ie,We,Ut],ce=>{A=Tr(A,ce," ")}),_.textContent!==A&&(Sr(t.removed,{element:_.cloneNode()}),_.textContent=A)),Pt(ne.afterSanitizeElements,_,null),!1)},Ko=function(_,A,I){if(Fo&&(A==="id"||A==="name")&&(I in n||I in Wo))return!1;if(!(Ee&&!qe[A]&&Ke(Ln,A))){if(!(ue&&Ke(jt,A))){if(!(rt.attributeCheck instanceof Function&&rt.attributeCheck(A,_))){if(!xe[A]||qe[A]){if(!(Qo(_)&&(H.tagNameCheck instanceof RegExp&&Ke(H.tagNameCheck,_)||H.tagNameCheck instanceof Function&&H.tagNameCheck(_))&&(H.attributeNameCheck instanceof RegExp&&Ke(H.attributeNameCheck,A)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(A,_))||A==="is"&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&Ke(H.tagNameCheck,I)||H.tagNameCheck instanceof Function&&H.tagNameCheck(I))))return!1}else if(!Mr[A]){if(!Ke(Tt,Tr(I,Zt,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&_!=="script"&&Em(I,"data:")===0&&pe[_])){if(!(zn&&!Ke(St,Tr(I,Zt,"")))){if(I)return!1}}}}}}}return!0},Qo=function(_){return _!=="annotation-xml"&&Zs(_,fn)},Hr=function(_){Pt(ne.beforeSanitizeAttributes,_,null);const{attributes:A}=_;if(!A||qr(_))return;const I={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:xe,forceKeepAttr:void 0};let ce=A.length;for(;ce--;){const De=A[ce],{name:Se,namespaceURI:Ye,value:Rt}=De,Ht=he(Se),Fr=Rt;let $e=Se==="value"?Fr:Am(Fr);if(I.attrName=Ht,I.attrValue=$e,I.keepAttr=!0,I.forceKeepAttr=void 0,Pt(ne.uponSanitizeAttribute,_,I),$e=I.attrValue,Or&&(Ht==="id"||Ht==="name")&&(bt(Se,_),$e=ai+$e),Ne&&Ke(/((--!?|])>)|<\/(style|title|textarea)/i,$e)){bt(Se,_);continue}if(Ht==="attributename"&&Zs($e,"href")){bt(Se,_);continue}if(I.forceKeepAttr)continue;if(!I.keepAttr){bt(Se,_);continue}if(!He&&Ke(/\/>/i,$e)){bt(Se,_);continue}de&&vo([Ie,We,Ut],ts=>{$e=Tr($e,ts," ")});const es=he(_.nodeName);if(!Ko(es,Ht,$e)){bt(Se,_);continue}if(S&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!Ye)switch(k.getAttributeType(es,Ht)){case"TrustedHTML":{$e=S.createHTML($e);break}case"TrustedScriptURL":{$e=S.createScriptURL($e);break}}if($e!==Fr)try{Ye?_.setAttributeNS(Ye,Se,$e):_.setAttribute(Se,$e),qr(_)?mt(_):_c(t.removed)}catch(ts){bt(Se,_)}}Pt(ne.afterSanitizeAttributes,_,null)},Qt=function M(_){let A=null;const I=Zr(_);for(Pt(ne.beforeSanitizeShadowDOM,_,null);A=I.nextNode();)Pt(ne.uponSanitizeShadowNode,A,null),Xo(A),Hr(A),A.content instanceof i&&M(A.content);Pt(ne.afterSanitizeShadowDOM,_,null)};return t.sanitize=function(M){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,I=null,ce=null,De=null;if(On=!M,On&&(M="<!-->"),typeof M!="string"&&!Vo(M))if(typeof M.toString=="function"){if(M=M.toString(),typeof M!="string")throw Er("dirty is not a string, aborting")}else throw Er("toString is not a function");if(!t.isSupported)return M;if(Et||hr(_),t.removed=[],typeof M=="string"&&($n=!1),$n){if(M.nodeName){const Rt=he(M.nodeName);if(!we[Rt]||re[Rt])throw Er("root node is forbidden and cannot be sanitized in-place")}}else if(M instanceof d)A=Yo("<!---->"),I=A.ownerDocument.importNode(M,!0),I.nodeType===Cr.element&&I.nodeName==="BODY"||I.nodeName==="HTML"?A=I:A.appendChild(I);else{if(!ot&&!de&&!ze&&M.indexOf("<")===-1)return S&&gt?S.createHTML(M):M;if(A=Yo(M),!A)return ot?null:gt?P:""}A&&Je&&mt(A.firstChild);const Se=Zr($n?M:A);for(;ce=Se.nextNode();)Xo(ce),Hr(ce),ce.content instanceof i&&Qt(ce.content);if($n)return M;if(ot){if(qt)for(De=ge.call(A.ownerDocument);A.firstChild;)De.appendChild(A.firstChild);else De=A;return(xe.shadowroot||xe.shadowrootmode)&&(De=Ge.call(r,De,!0)),De}let Ye=ze?A.outerHTML:A.innerHTML;return ze&&we["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&Ke(Tc,A.ownerDocument.doctype.name)&&(Ye="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
1430
- `+Ye),de&&vo([Ie,We,Ut],Rt=>{Ye=Tr(Ye,Rt," ")}),S&&gt?S.createHTML(Ye):Ye},t.setConfig=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};hr(M),Et=!0},t.clearConfig=function(){bn=null,Et=!1},t.isValidAttribute=function(M,_,A){bn||hr({});const I=he(M),ce=he(_);return Ko(I,ce,A)},t.addHook=function(M,_){typeof _=="function"&&Sr(ne[M],_)},t.removeHook=function(M,_){if(_!==void 0){const A=Sm(ne[M],_);return A===-1?void 0:Tm(ne[M],A,1)[0]}return _c(ne[M])},t.removeHooks=function(M){ne[M]=[]},t.removeAllHooks=function(){ne=Ac()},t}var qm=Cc();function Pc(e){const t=ie.parse(e,{gfm:!0,breaks:!0,async:!1});return qm.sanitize(t)}const Rc=1e3,Lc=32,Ic=15e3,Hm=new Set(["completed","failed","cancelled"]),Fm=4e3;let z=null,Ot=null,je=null,Gs=null,xo=null,Ws=!1,So=null,Pr=null,F={kind:"connecting"},Kn=[],Qn=null,ve=null,er=null,Wt=null,Rr=-1,et=null,Jt=!1,Yt=null,xn=new Set;function Js(){To(),Ja(),Ot&&clearInterval(Ot),Ot=null,Yt==null||Yt(),Yt=null,je==null||je.destroy(),je=null,z&&Bt(z),z==null||z.remove(),z=null,Gs=null,F={kind:"connecting"},Kn=[],Qn=null,ve=null,er=null,Wt=null,xo=null,Rr=-1,et=null,Jt=!1,xn=new Set}function Ys(e,t,n,r,o){z&&Js(),Gs=o!=null?o:null,F={kind:"connecting"},Kn=[],Qn=null,Rr=-1,et=null,Jt=!1,xn=new Set,ve=e,er=n,Wt=t,xo=r,Wa({taskId:e,backendUrl:n,title:r}),z=document.createElement("div"),z.className="ap-sdk-panel",z.setAttribute("data-ap-sdk","1"),z.setAttribute("role","dialog"),z.setAttribute("aria-modal","true"),z.setAttribute("aria-label","Automation in progress");const i=r.length>55?`${r.slice(0,52)}…`:r;z.innerHTML=`
1429
+ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+zt(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},wn=new _m;function ie(e,t){return wn.parse(e,t)}ie.options=ie.setOptions=function(e){return wn.setOptions(e),ie.defaults=wn.defaults,ec(ie.defaults),ie},ie.getDefaults=Cs,ie.defaults=vn;function vm(...e){return wn.use(...e),ie.defaults=wn.defaults,ec(ie.defaults),ie}ie.use=vm,ie.walkTokens=function(e,t){return wn.walkTokens(e,t)},ie.parseInline=wn.parseInline,ie.Parser=yt,ie.parser=yt.parse,ie.Renderer=_o,ie.TextRenderer=Ns,ie.Lexer=vt,ie.lexer=vt.lex,ie.Tokenizer=ko,ie.Hooks=xr,ie.parse=ie,ie.options,ie.setOptions,ie.walkTokens,ie.parseInline,yt.parse,vt.lex;/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:bc,setPrototypeOf:kc,isFrozen:ym,getPrototypeOf:wm,getOwnPropertyDescriptor:xm}=Object;let{freeze:Xe,seal:ht,create:Ds}=Object,{apply:Ms,construct:Us}=typeof Reflect!="undefined"&&Reflect;Xe||(Xe=function(t){return t}),ht||(ht=function(t){return t}),Ms||(Ms=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return t.apply(n,o)}),Us||(Us=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new t(...r)});const vo=Qe(Array.prototype.forEach),Sm=Qe(Array.prototype.lastIndexOf),_c=Qe(Array.prototype.pop),Sr=Qe(Array.prototype.push),Tm=Qe(Array.prototype.splice),yo=Qe(String.prototype.toLowerCase),js=Qe(String.prototype.toString),Zs=Qe(String.prototype.match),Tr=Qe(String.prototype.replace),Em=Qe(String.prototype.indexOf),Am=Qe(String.prototype.trim),wt=Qe(Object.prototype.hasOwnProperty),Ke=Qe(RegExp.prototype.test),Er=Cm(TypeError);function Qe(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Ms(e,t,r)}}function Cm(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Us(e,n)}}function V(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yo;kc&&kc(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(ym(t)||(t[r]=i),o=i)}e[o]=!0}return e}function Pm(e){for(let t=0;t<e.length;t++)wt(e,t)||(e[t]=null);return e}function $t(e){const t=Ds(null);for(const[n,r]of bc(e))wt(e,n)&&(Array.isArray(r)?t[n]=Pm(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=$t(r):t[n]=r);return t}function Ar(e,t){for(;e!==null;){const r=xm(e,t);if(r){if(r.get)return Qe(r.get);if(typeof r.value=="function")return Qe(r.value)}e=wm(e)}function n(){return null}return n}const vc=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"]),qs=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"]),Hs=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"]),Rm=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"]),Fs=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"]),Lm=Xe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),yc=Xe(["#text"]),wc=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"]),Bs=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"]),xc=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"]),wo=Xe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Im=ht(/\{\{[\w\W]*|[\w\W]*\}\}/gm),zm=ht(/<%[\w\W]*|[\w\W]*%>/gm),$m=ht(/\$\{[\w\W]*/gm),Om=ht(/^data-[\-\w.\u00B7-\uFFFF]+$/),Nm=ht(/^aria-[\-\w]+$/),Sc=ht(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Dm=ht(/^(?:\w+script|data):/i),Mm=ht(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Tc=ht(/^html$/i),Um=ht(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ec=Object.freeze({__proto__:null,ARIA_ATTR:Nm,ATTR_WHITESPACE:Mm,CUSTOM_ELEMENT:Um,DATA_ATTR:Om,DOCTYPE_NAME:Tc,ERB_EXPR:zm,IS_ALLOWED_URI:Sc,IS_SCRIPT_OR_DATA:Dm,MUSTACHE_EXPR:Im,TMPLIT_EXPR:$m});const Cr={element:1,text:3,progressingInstruction:7,comment:8,document:9},jm=function(){return typeof window=="undefined"?null:window},Zm=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch(a){return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Ac=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Cc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:jm();const t=M=>Cc(M);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Cr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:d,Element:u,NodeFilter:p,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:m,trustedTypes:k}=e,y=u.prototype,E=Ar(y,"cloneNode"),j=Ar(y,"remove"),Q=Ar(y,"nextSibling"),N=Ar(y,"childNodes"),T=Ar(y,"parentNode");if(typeof a=="function"){const M=n.createElement("template");M.content&&M.content.ownerDocument&&(n=M.content.ownerDocument)}let S,P="";const{implementation:Z,createNodeIterator:Y,createDocumentFragment:ge,getElementsByTagName:Ze}=n,{importNode:Ge}=r;let ne=Ac();t.isSupported=typeof bc=="function"&&typeof T=="function"&&Z&&Z.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ie,ERB_EXPR:We,TMPLIT_EXPR:Ut,DATA_ATTR:Ln,ARIA_ATTR:jt,IS_SCRIPT_OR_DATA:St,ATTR_WHITESPACE:Zt,CUSTOM_ELEMENT:fn}=Ec;let{IS_ALLOWED_URI:Tt}=Ec,we=null;const In=V({},[...vc,...qs,...Hs,...Fs,...yc]);let xe=null;const W=V({},[...wc,...Bs,...xc,...wo]);let H=Object.seal(Ds(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),re=null,qe=null;const rt=Object.seal(Ds(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ue=!0,Ee=!0,zn=!1,He=!0,de=!1,Ne=!0,ze=!1,Et=!1,Je=!1,ot=!1,qt=!1,mt=!1,Fo=!0,Or=!1;const ai="user-content-";let Nr=!0,$n=!1,gn={},st=null;const Dr=V({},["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 pe=null;const Bo=V({},["audio","video","img","source","image","track"]);let Mr=null;const Go=V({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),lr="http://www.w3.org/1998/Math/MathML",ur="http://www.w3.org/2000/svg",At="http://www.w3.org/1999/xhtml";let mn=At,On=!1,Nn=null;const ci=V({},[lr,ur,At],js);let dr=V({},["mi","mo","mn","ms","mtext"]),pr=V({},["annotation-xml"]);const li=V({},["title","style","font","a","script"]);let Kt=null;const Ct=["application/xhtml+xml","text/html"],ui="text/html";let he=null,bn=null;const Wo=n.createElement("form"),Ur=function(_){return _ instanceof RegExp||_ instanceof Function},hr=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(bn&&bn===_)){if((!_||typeof _!="object")&&(_={}),_=$t(_),Kt=Ct.indexOf(_.PARSER_MEDIA_TYPE)===-1?ui:_.PARSER_MEDIA_TYPE,he=Kt==="application/xhtml+xml"?js:yo,we=wt(_,"ALLOWED_TAGS")?V({},_.ALLOWED_TAGS,he):In,xe=wt(_,"ALLOWED_ATTR")?V({},_.ALLOWED_ATTR,he):W,Nn=wt(_,"ALLOWED_NAMESPACES")?V({},_.ALLOWED_NAMESPACES,js):ci,Mr=wt(_,"ADD_URI_SAFE_ATTR")?V($t(Go),_.ADD_URI_SAFE_ATTR,he):Go,pe=wt(_,"ADD_DATA_URI_TAGS")?V($t(Bo),_.ADD_DATA_URI_TAGS,he):Bo,st=wt(_,"FORBID_CONTENTS")?V({},_.FORBID_CONTENTS,he):Dr,re=wt(_,"FORBID_TAGS")?V({},_.FORBID_TAGS,he):$t({}),qe=wt(_,"FORBID_ATTR")?V({},_.FORBID_ATTR,he):$t({}),gn=wt(_,"USE_PROFILES")?_.USE_PROFILES:!1,ue=_.ALLOW_ARIA_ATTR!==!1,Ee=_.ALLOW_DATA_ATTR!==!1,zn=_.ALLOW_UNKNOWN_PROTOCOLS||!1,He=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,de=_.SAFE_FOR_TEMPLATES||!1,Ne=_.SAFE_FOR_XML!==!1,ze=_.WHOLE_DOCUMENT||!1,ot=_.RETURN_DOM||!1,qt=_.RETURN_DOM_FRAGMENT||!1,mt=_.RETURN_TRUSTED_TYPE||!1,Je=_.FORCE_BODY||!1,Fo=_.SANITIZE_DOM!==!1,Or=_.SANITIZE_NAMED_PROPS||!1,Nr=_.KEEP_CONTENT!==!1,$n=_.IN_PLACE||!1,Tt=_.ALLOWED_URI_REGEXP||Sc,mn=_.NAMESPACE||At,dr=_.MATHML_TEXT_INTEGRATION_POINTS||dr,pr=_.HTML_INTEGRATION_POINTS||pr,H=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&Ur(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&Ur(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),de&&(Ee=!1),qt&&(ot=!0),gn&&(we=V({},yc),xe=[],gn.html===!0&&(V(we,vc),V(xe,wc)),gn.svg===!0&&(V(we,qs),V(xe,Bs),V(xe,wo)),gn.svgFilters===!0&&(V(we,Hs),V(xe,Bs),V(xe,wo)),gn.mathMl===!0&&(V(we,Fs),V(xe,xc),V(xe,wo))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?rt.tagCheck=_.ADD_TAGS:(we===In&&(we=$t(we)),V(we,_.ADD_TAGS,he))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?rt.attributeCheck=_.ADD_ATTR:(xe===W&&(xe=$t(xe)),V(xe,_.ADD_ATTR,he))),_.ADD_URI_SAFE_ATTR&&V(Mr,_.ADD_URI_SAFE_ATTR,he),_.FORBID_CONTENTS&&(st===Dr&&(st=$t(st)),V(st,_.FORBID_CONTENTS,he)),_.ADD_FORBID_CONTENTS&&(st===Dr&&(st=$t(st)),V(st,_.ADD_FORBID_CONTENTS,he)),Nr&&(we["#text"]=!0),ze&&V(we,["html","head","body"]),we.table&&(V(we,["tbody"]),delete re.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=_.TRUSTED_TYPES_POLICY,P=S.createHTML("")}else S===void 0&&(S=Zm(k,o)),S!==null&&typeof P=="string"&&(P=S.createHTML(""));Xe&&Xe(_),bn=_}},jr=V({},[...qs,...Hs,...Rm]),Jo=V({},[...Fs,...Lm]),di=function(_){let A=T(_);(!A||!A.tagName)&&(A={namespaceURI:mn,tagName:"template"});const I=yo(_.tagName),ce=yo(A.tagName);return Nn[_.namespaceURI]?_.namespaceURI===ur?A.namespaceURI===At?I==="svg":A.namespaceURI===lr?I==="svg"&&(ce==="annotation-xml"||dr[ce]):!!jr[I]:_.namespaceURI===lr?A.namespaceURI===At?I==="math":A.namespaceURI===ur?I==="math"&&pr[ce]:!!Jo[I]:_.namespaceURI===At?A.namespaceURI===ur&&!pr[ce]||A.namespaceURI===lr&&!dr[ce]?!1:!Jo[I]&&(li[I]||!jr[I]):!!(Kt==="application/xhtml+xml"&&Nn[_.namespaceURI]):!1},bt=function(_){Sr(t.removed,{element:_});try{T(_).removeChild(_)}catch(A){j(_)}},kt=function(_,A){try{Sr(t.removed,{attribute:A.getAttributeNode(_),from:A})}catch(I){Sr(t.removed,{attribute:null,from:A})}if(A.removeAttribute(_),_==="is")if(ot||qt)try{bt(A)}catch(I){}else try{A.setAttribute(_,"")}catch(I){}},Yo=function(_){let A=null,I=null;if(Je)_="<remove></remove>"+_;else{const Se=Zs(_,/^[\r\n\t ]+/);I=Se&&Se[0]}Kt==="application/xhtml+xml"&&mn===At&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const ce=S?S.createHTML(_):_;if(mn===At)try{A=new m().parseFromString(ce,Kt)}catch(Se){}if(!A||!A.documentElement){A=Z.createDocument(mn,"template",null);try{A.documentElement.innerHTML=On?P:ce}catch(Se){}}const De=A.body||A.documentElement;return _&&I&&De.insertBefore(n.createTextNode(I),De.childNodes[0]||null),mn===At?Ze.call(A,ze?"html":"body")[0]:ze?A.documentElement:De},Zr=function(_){return Y.call(_.ownerDocument||_,_,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},qr=function(_){return _ instanceof g&&(typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||!(_.attributes instanceof h)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function")},Vo=function(_){return typeof d=="function"&&_ instanceof d};function Pt(M,_,A){vo(M,I=>{I.call(t,_,A,bn)})}const Xo=function(_){let A=null;if(Pt(ne.beforeSanitizeElements,_,null),qr(_))return bt(_),!0;const I=he(_.nodeName);if(Pt(ne.uponSanitizeElement,_,{tagName:I,allowedTags:we}),Ne&&_.hasChildNodes()&&!Vo(_.firstElementChild)&&Ke(/<[/\w!]/g,_.innerHTML)&&Ke(/<[/\w!]/g,_.textContent)||_.nodeType===Cr.progressingInstruction||Ne&&_.nodeType===Cr.comment&&Ke(/<[/\w]/g,_.data))return bt(_),!0;if(!(rt.tagCheck instanceof Function&&rt.tagCheck(I))&&(!we[I]||re[I])){if(!re[I]&&Qo(I)&&(H.tagNameCheck instanceof RegExp&&Ke(H.tagNameCheck,I)||H.tagNameCheck instanceof Function&&H.tagNameCheck(I)))return!1;if(Nr&&!st[I]){const ce=T(_)||_.parentNode,De=N(_)||_.childNodes;if(De&&ce){const Se=De.length;for(let Ye=Se-1;Ye>=0;--Ye){const Rt=E(De[Ye],!0);Rt.__removalCount=(_.__removalCount||0)+1,ce.insertBefore(Rt,Q(_))}}}return bt(_),!0}return _ instanceof u&&!di(_)||(I==="noscript"||I==="noembed"||I==="noframes")&&Ke(/<\/no(script|embed|frames)/i,_.innerHTML)?(bt(_),!0):(de&&_.nodeType===Cr.text&&(A=_.textContent,vo([Ie,We,Ut],ce=>{A=Tr(A,ce," ")}),_.textContent!==A&&(Sr(t.removed,{element:_.cloneNode()}),_.textContent=A)),Pt(ne.afterSanitizeElements,_,null),!1)},Ko=function(_,A,I){if(Fo&&(A==="id"||A==="name")&&(I in n||I in Wo))return!1;if(!(Ee&&!qe[A]&&Ke(Ln,A))){if(!(ue&&Ke(jt,A))){if(!(rt.attributeCheck instanceof Function&&rt.attributeCheck(A,_))){if(!xe[A]||qe[A]){if(!(Qo(_)&&(H.tagNameCheck instanceof RegExp&&Ke(H.tagNameCheck,_)||H.tagNameCheck instanceof Function&&H.tagNameCheck(_))&&(H.attributeNameCheck instanceof RegExp&&Ke(H.attributeNameCheck,A)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(A,_))||A==="is"&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&Ke(H.tagNameCheck,I)||H.tagNameCheck instanceof Function&&H.tagNameCheck(I))))return!1}else if(!Mr[A]){if(!Ke(Tt,Tr(I,Zt,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&_!=="script"&&Em(I,"data:")===0&&pe[_])){if(!(zn&&!Ke(St,Tr(I,Zt,"")))){if(I)return!1}}}}}}}return!0},Qo=function(_){return _!=="annotation-xml"&&Zs(_,fn)},Hr=function(_){Pt(ne.beforeSanitizeAttributes,_,null);const{attributes:A}=_;if(!A||qr(_))return;const I={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:xe,forceKeepAttr:void 0};let ce=A.length;for(;ce--;){const De=A[ce],{name:Se,namespaceURI:Ye,value:Rt}=De,Ht=he(Se),Fr=Rt;let $e=Se==="value"?Fr:Am(Fr);if(I.attrName=Ht,I.attrValue=$e,I.keepAttr=!0,I.forceKeepAttr=void 0,Pt(ne.uponSanitizeAttribute,_,I),$e=I.attrValue,Or&&(Ht==="id"||Ht==="name")&&(kt(Se,_),$e=ai+$e),Ne&&Ke(/((--!?|])>)|<\/(style|title|textarea)/i,$e)){kt(Se,_);continue}if(Ht==="attributename"&&Zs($e,"href")){kt(Se,_);continue}if(I.forceKeepAttr)continue;if(!I.keepAttr){kt(Se,_);continue}if(!He&&Ke(/\/>/i,$e)){kt(Se,_);continue}de&&vo([Ie,We,Ut],ts=>{$e=Tr($e,ts," ")});const es=he(_.nodeName);if(!Ko(es,Ht,$e)){kt(Se,_);continue}if(S&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!Ye)switch(k.getAttributeType(es,Ht)){case"TrustedHTML":{$e=S.createHTML($e);break}case"TrustedScriptURL":{$e=S.createScriptURL($e);break}}if($e!==Fr)try{Ye?_.setAttributeNS(Ye,Se,$e):_.setAttribute(Se,$e),qr(_)?bt(_):_c(t.removed)}catch(ts){kt(Se,_)}}Pt(ne.afterSanitizeAttributes,_,null)},Qt=function M(_){let A=null;const I=Zr(_);for(Pt(ne.beforeSanitizeShadowDOM,_,null);A=I.nextNode();)Pt(ne.uponSanitizeShadowNode,A,null),Xo(A),Hr(A),A.content instanceof i&&M(A.content);Pt(ne.afterSanitizeShadowDOM,_,null)};return t.sanitize=function(M){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,I=null,ce=null,De=null;if(On=!M,On&&(M="<!-->"),typeof M!="string"&&!Vo(M))if(typeof M.toString=="function"){if(M=M.toString(),typeof M!="string")throw Er("dirty is not a string, aborting")}else throw Er("toString is not a function");if(!t.isSupported)return M;if(Et||hr(_),t.removed=[],typeof M=="string"&&($n=!1),$n){if(M.nodeName){const Rt=he(M.nodeName);if(!we[Rt]||re[Rt])throw Er("root node is forbidden and cannot be sanitized in-place")}}else if(M instanceof d)A=Yo("<!---->"),I=A.ownerDocument.importNode(M,!0),I.nodeType===Cr.element&&I.nodeName==="BODY"||I.nodeName==="HTML"?A=I:A.appendChild(I);else{if(!ot&&!de&&!ze&&M.indexOf("<")===-1)return S&&mt?S.createHTML(M):M;if(A=Yo(M),!A)return ot?null:mt?P:""}A&&Je&&bt(A.firstChild);const Se=Zr($n?M:A);for(;ce=Se.nextNode();)Xo(ce),Hr(ce),ce.content instanceof i&&Qt(ce.content);if($n)return M;if(ot){if(qt)for(De=ge.call(A.ownerDocument);A.firstChild;)De.appendChild(A.firstChild);else De=A;return(xe.shadowroot||xe.shadowrootmode)&&(De=Ge.call(r,De,!0)),De}let Ye=ze?A.outerHTML:A.innerHTML;return ze&&we["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&Ke(Tc,A.ownerDocument.doctype.name)&&(Ye="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
1430
+ `+Ye),de&&vo([Ie,We,Ut],Rt=>{Ye=Tr(Ye,Rt," ")}),S&&mt?S.createHTML(Ye):Ye},t.setConfig=function(){let M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};hr(M),Et=!0},t.clearConfig=function(){bn=null,Et=!1},t.isValidAttribute=function(M,_,A){bn||hr({});const I=he(M),ce=he(_);return Ko(I,ce,A)},t.addHook=function(M,_){typeof _=="function"&&Sr(ne[M],_)},t.removeHook=function(M,_){if(_!==void 0){const A=Sm(ne[M],_);return A===-1?void 0:Tm(ne[M],A,1)[0]}return _c(ne[M])},t.removeHooks=function(M){ne[M]=[]},t.removeAllHooks=function(){ne=Ac()},t}var qm=Cc();function Pc(e){const t=ie.parse(e,{gfm:!0,breaks:!0,async:!1});return qm.sanitize(t)}const Rc=1e3,Lc=32,Ic=15e3,Hm=new Set(["completed","failed","cancelled"]),Fm=4e3;let z=null,Ot=null,je=null,Gs=null,xo=null,Ws=!1,So=null,Pr=null,F={kind:"connecting"},Kn=[],Qn=null,ve=null,er=null,Wt=null,Rr=-1,et=null,Jt=!1,Yt=null,xn=new Set;function Js(){To(),Ja(),Ot&&clearInterval(Ot),Ot=null,Yt==null||Yt(),Yt=null,je==null||je.destroy(),je=null,z&&Bt(z),z==null||z.remove(),z=null,Gs=null,F={kind:"connecting"},Kn=[],Qn=null,ve=null,er=null,Wt=null,xo=null,Rr=-1,et=null,Jt=!1,xn=new Set}function Ys(e,t,n,r,o){z&&Js(),Gs=o!=null?o:null,F={kind:"connecting"},Kn=[],Qn=null,Rr=-1,et=null,Jt=!1,xn=new Set,ve=e,er=n,Wt=t,xo=r,Wa({taskId:e,backendUrl:n,title:r}),z=document.createElement("div"),z.className="ap-sdk-panel",z.setAttribute("data-ap-sdk","1"),z.setAttribute("role","dialog"),z.setAttribute("aria-modal","true"),z.setAttribute("aria-label","Automation in progress");const i=r.length>55?`${r.slice(0,52)}…`:r;z.innerHTML=`
1431
1431
  <div class="ap-sdk-panel__header">
1432
1432
  <span class="ap-sdk-panel__title">
1433
1433
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1518,7 +1518,7 @@ ${n}${r?`
1518
1518
  <span class="ap-sdk-recorder-bar__counter" data-ap-recorder-counter>● Recording — 0 steps</span>
1519
1519
  <button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--stop" data-ap-recorder-stop type="button">Stop</button>
1520
1520
  <button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--discard" data-ap-recorder-discard type="button">Discard</button>
1521
- `,document.body.appendChild(tt),Ft(tt),Ao=tt.querySelector("[data-ap-recorder-counter]");const n=()=>{Qs();const u=nr;at==null||at(),e(u)},r=()=>{at==null||at()};tt.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),tt.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=u=>{if(mr(u.target))return;const p=u.target;ei({action:"click",cssSelector:Yr(p),elementText:Vr(p),description:lb(Vr(p),p.tagName),capturedAt:new Date().toISOString()})},i=u=>{if(mr(u.target))return;const p=u.target;if(!(p instanceof HTMLInputElement)&&!(p instanceof HTMLTextAreaElement)&&!(p instanceof HTMLSelectElement))return;const h=Dc(p),g=ru(p),m=g?"[redacted]":mb(p);ei(U(v({action:"inputText",cssSelector:Yr(p),elementText:h,value:m},g?{redacted:!0}:{}),{description:Mc(h,m,g),capturedAt:new Date().toISOString()}))},a=()=>{const u=Math.round(window.scrollX),p=Math.round(window.scrollY);Nt?(Nt.scrollX=u,Nt.scrollY=p,Nt.description=Uc(u,p)):Nt={action:"scroll",scrollX:u,scrollY:p,description:Uc(u,p),capturedAt:new Date().toISOString()},Dt&&clearTimeout(Dt),Dt=setTimeout(()=>{Dt=null,Qs()},db)},d=u=>{if(u.key==="Escape"){r();return}if(mr(u.target))return;const p=fb(u);if(!p)return;const h=u.target instanceof Element?u.target:document.body,g=gb(h);ei({action:"keypress",cssSelector:Yr(h),elementText:g,key:p,description:ub(p,g),capturedAt:new Date().toISOString()})};document.addEventListener("click",o,{capture:!0}),document.addEventListener("change",i,{capture:!0}),window.addEventListener("scroll",a,{capture:!0,passive:!0}),document.addEventListener("keydown",d,{capture:!0}),at=()=>{document.removeEventListener("click",o,{capture:!0}),document.removeEventListener("change",i,{capture:!0}),window.removeEventListener("scroll",a,{capture:!0}),document.removeEventListener("keydown",d,{capture:!0}),Dt&&(clearTimeout(Dt),Dt=null),Nt=null,tt&&Bt(tt),tt==null||tt.remove(),tt=null,Ao=null,at=null}}function kb(){at==null||at()}function Co(){return at!==null}const _b="data-ap-sdk",vb="ap-sdk-fab",qc="ap-sdk-fab--dragging",ti="ap-sdk-fab--open",Hc="ap-sdk-fab-pos",Po="ap-sdk-fab--left-edge",yb='<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>',wb='<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>',xb='<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>',Sb='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>';let $=null,Mt=null,ln=null,un=null,ht=null,rr=null,or=null,sr=null,Ro=null,Lr=null,ir=null,Lo=null,Io=null,zo=null,Fc=0,Bc=0,Gc=0,Wc=0,ar=!1,xt=!1,Ir=null,En=null;function Tb(){Ir=e=>{if(!$){$o();return}if(!ar){if(Math.hypot(e.clientX-Gc,e.clientY-Wc)<5)return;ar=!0,xt=!0,$.classList.add(qc)}Eb(e.clientX-Fc,e.clientY-Bc)},En=()=>{if(!$){$o();return}ar?(ar=!1,$.classList.remove(qc),$.style.transition="",Ab($.getBoundingClientRect())):$.style.transition="",$o()},window.addEventListener("pointermove",Ir),window.addEventListener("pointerup",En),window.addEventListener("pointercancel",En)}function $o(){Ir&&(window.removeEventListener("pointermove",Ir),Ir=null),En&&(window.removeEventListener("pointerup",En),window.removeEventListener("pointercancel",En),En=null)}function Eb(e,t){if(!$)return;const n=$.offsetWidth||52,r=$.offsetHeight||52;$.style.top=`${Math.max(0,Math.min(t,window.innerHeight-r))}px`,$.style.left=`${Math.max(0,Math.min(e,window.innerWidth-n))}px`,$.style.bottom="auto",$.style.right="auto"}function Ab(e){if(!$)return;const n=Math.max(16,Math.min(window.innerHeight-e.bottom,window.innerHeight-52-16)),r=e.left+e.width/2<window.innerWidth/2?"left":"right";$.style.top="auto",$.style.bottom=`${n}px`,r==="left"?($.style.right="auto",$.style.left="16px",$.classList.add(Po)):($.style.left="auto",$.style.right="16px",$.classList.remove(Po));try{localStorage.setItem(Hc,JSON.stringify({edge:r,bottom:n}))}catch(o){}}function Cb(){if($)try{const e=localStorage.getItem(Hc);if(!e)return;const t=JSON.parse(e);if(typeof t.bottom!="number"||t.edge!=="left"&&t.edge!=="right")return;const r=Math.max(16,Math.min(t.bottom,window.innerHeight-52-16));$.style.top="auto",$.style.bottom=`${r}px`,t.edge==="left"?($.style.right="auto",$.style.left="16px",$.classList.add(Po)):($.style.left="auto",$.style.right="16px",$.classList.remove(Po))}catch(e){}}function cr(){$==null||$.classList.remove(ti),ir&&(window.removeEventListener("pointerdown",ir,{capture:!0}),ir=null)}function Pb(){$&&($.classList.add(ti),ir=e=>{!$||$.contains(e.target)||cr()},requestAnimationFrame(()=>{ir&&window.addEventListener("pointerdown",ir,{capture:!0})}))}function Oo(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function Jc(e,t,n){var d;if(Lo=e,Io=t,zo=n,$)return;$=document.createElement("div"),$.className=vb,$.setAttribute(_b,"1"),rr=document.createElement("div"),rr.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="View captures",ht=document.createElement("button"),ht.className="ap-sdk-fab__list ap-sdk-fab__sub",ht.setAttribute("aria-label","My captures"),ht.setAttribute("title","View my captures"),ht.appendChild(Oo(Sb));const o=document.createElement("span");o.className="ap-sdk-fab__badge",o.setAttribute("data-ap-badge",""),o.style.display="none",ht.appendChild(o),rr.appendChild(r),rr.appendChild(ht),or=document.createElement("div"),or.className="ap-sdk-fab__row";const i=document.createElement("span");i.className="ap-sdk-fab__label",i.textContent="Capture element",ln=document.createElement("button"),ln.className="ap-sdk-fab__capture ap-sdk-fab__sub",ln.setAttribute("aria-label","Capture element"),ln.setAttribute("title","Capture element to Agent Platform"),ln.appendChild(Oo(wb)),or.appendChild(i),or.appendChild(ln),sr=document.createElement("div"),sr.className="ap-sdk-fab__row";const a=document.createElement("span");a.className="ap-sdk-fab__label",a.textContent="Record interaction",un=document.createElement("button"),un.className="ap-sdk-fab__record ap-sdk-fab__sub",un.setAttribute("aria-label","Record interaction"),un.setAttribute("title","Record a sequence of interactions"),un.appendChild(Oo(xb)),sr.appendChild(a),sr.appendChild(un),Mt=document.createElement("button"),Mt.className="ap-sdk-fab__main",Mt.setAttribute("aria-label","Agent Platform"),Mt.setAttribute("title","Agent Platform"),Mt.appendChild(Oo(yb)),$.appendChild(rr),$.appendChild(or),$.appendChild(sr),$.appendChild(Mt),Mt.addEventListener("click",u=>{if(xt){xt=!1;return}u.preventDefault(),u.stopPropagation(),$!=null&&$.classList.contains(ti)?cr():Pb()}),ln.addEventListener("click",u=>{if(xt){xt=!1;return}u.preventDefault(),u.stopPropagation(),cr(),!qn()&&!Co()&&Lo&&Lo()}),un.addEventListener("click",u=>{if(xt){xt=!1;return}u.preventDefault(),u.stopPropagation(),cr(),!qn()&&!Co()&&Io&&Io()}),ht.addEventListener("click",u=>{if(xt){xt=!1;return}u.preventDefault(),u.stopPropagation(),cr(),zo&&zo()}),Lr=u=>{if(!$||!($===u.target||$.contains(u.target)))return;const p=$.getBoundingClientRect();Fc=u.clientX-p.left,Bc=u.clientY-p.top,Gc=u.clientX,Wc=u.clientY,ar=!1,xt=!1,$.style.transition="none",u.stopPropagation(),Tb()},window.addEventListener("pointerdown",Lr,{capture:!0}),((d=document.body)!=null?d:document.documentElement).appendChild($),Ft($),Cb(),Ro=setInterval(()=>{Mt&&Mt.classList.toggle("ap-sdk-fab__main--active",qn()||Co())},200)}function An(e){const t=ht==null?void 0:ht.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function Yc(){ar=!1,xt=!1,$o(),cr(),Ro&&(clearInterval(Ro),Ro=null),Lr&&(window.removeEventListener("pointerdown",Lr,{capture:!0}),Lr=null),$&&Bt($),$==null||$.remove(),$=null,Mt=null,ln=null,un=null,ht=null,rr=null,or=null,sr=null,Lo=null,Io=null,zo=null}function Vc(e,t){return L(this,null,function*(){try{if(e.type==="planning"){const r=yield ng(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=yield qa(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch(n){return{capture:e,status:"unavailable",approved:!1}}})}function Xc(e){return e.filter(t=>!t.approved).length}function Kc(e){return L(this,null,function*(){const t=tr();if(!e||t.length===0){An(t.length);return}const n=yield Promise.all(t.map(r=>Vc(r,e)));An(Xc(n))})}let J=null,nt=null,Vt=null;function zr(){return J!==null}function $r(){J&&Bt(J),J==null||J.remove(),J=null,Vt==null||Vt(),Vt=null,nt==null||nt.destroy(),nt=null}function Qc(e,t,n,r,o,i,a,d,u,p,h=null){var xe;J&&$r();const g={captureType:"task",submitting:!1,completedPicks:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1,allowSubmit:!1},m=!n.backendUrl||!n.token,k=og(h,"planning-sessions:write");J=document.createElement("div"),J.className="ap-sdk-panel",J.setAttribute("data-ap-sdk","1"),J.setAttribute("role","dialog"),J.setAttribute("aria-modal","true"),J.setAttribute("aria-label","Capture to Agent Platform"),J.innerHTML=`
1521
+ `,document.body.appendChild(tt),Ft(tt),Ao=tt.querySelector("[data-ap-recorder-counter]");const n=()=>{Qs();const u=nr;at==null||at(),e(u)},r=()=>{at==null||at()};tt.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),tt.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=u=>{if(mr(u.target))return;const p=u.target;ei({action:"click",cssSelector:Yr(p),elementText:Vr(p),description:lb(Vr(p),p.tagName),capturedAt:new Date().toISOString()})},i=u=>{if(mr(u.target))return;const p=u.target;if(!(p instanceof HTMLInputElement)&&!(p instanceof HTMLTextAreaElement)&&!(p instanceof HTMLSelectElement))return;const h=Dc(p),g=ru(p),m=g?"[redacted]":mb(p);ei(U(v({action:"inputText",cssSelector:Yr(p),elementText:h,value:m},g?{redacted:!0}:{}),{description:Mc(h,m,g),capturedAt:new Date().toISOString()}))},a=()=>{const u=Math.round(window.scrollX),p=Math.round(window.scrollY);Nt?(Nt.scrollX=u,Nt.scrollY=p,Nt.description=Uc(u,p)):Nt={action:"scroll",scrollX:u,scrollY:p,description:Uc(u,p),capturedAt:new Date().toISOString()},Dt&&clearTimeout(Dt),Dt=setTimeout(()=>{Dt=null,Qs()},db)},d=u=>{if(u.key==="Escape"){r();return}if(mr(u.target))return;const p=fb(u);if(!p)return;const h=u.target instanceof Element?u.target:document.body,g=gb(h);ei({action:"keypress",cssSelector:Yr(h),elementText:g,key:p,description:ub(p,g),capturedAt:new Date().toISOString()})};document.addEventListener("click",o,{capture:!0}),document.addEventListener("change",i,{capture:!0}),window.addEventListener("scroll",a,{capture:!0,passive:!0}),document.addEventListener("keydown",d,{capture:!0}),at=()=>{document.removeEventListener("click",o,{capture:!0}),document.removeEventListener("change",i,{capture:!0}),window.removeEventListener("scroll",a,{capture:!0}),document.removeEventListener("keydown",d,{capture:!0}),Dt&&(clearTimeout(Dt),Dt=null),Nt=null,tt&&Bt(tt),tt==null||tt.remove(),tt=null,Ao=null,at=null}}function kb(){at==null||at()}function Co(){return at!==null}const _b="data-ap-sdk",vb="ap-sdk-fab",qc="ap-sdk-fab--dragging",ti="ap-sdk-fab--open",Hc="ap-sdk-fab-pos",Po="ap-sdk-fab--left-edge",yb='<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>',wb='<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>',xb='<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>',Sb='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>';let $=null,Mt=null,ln=null,un=null,ft=null,rr=null,or=null,sr=null,Ro=null,Lr=null,ir=null,Lo=null,Io=null,zo=null,Fc=0,Bc=0,Gc=0,Wc=0,ar=!1,xt=!1,Ir=null,En=null;function Tb(){Ir=e=>{if(!$){$o();return}if(!ar){if(Math.hypot(e.clientX-Gc,e.clientY-Wc)<5)return;ar=!0,xt=!0,$.classList.add(qc)}Eb(e.clientX-Fc,e.clientY-Bc)},En=()=>{if(!$){$o();return}ar?(ar=!1,$.classList.remove(qc),$.style.transition="",Ab($.getBoundingClientRect())):$.style.transition="",$o()},window.addEventListener("pointermove",Ir),window.addEventListener("pointerup",En),window.addEventListener("pointercancel",En)}function $o(){Ir&&(window.removeEventListener("pointermove",Ir),Ir=null),En&&(window.removeEventListener("pointerup",En),window.removeEventListener("pointercancel",En),En=null)}function Eb(e,t){if(!$)return;const n=$.offsetWidth||52,r=$.offsetHeight||52;$.style.top=`${Math.max(0,Math.min(t,window.innerHeight-r))}px`,$.style.left=`${Math.max(0,Math.min(e,window.innerWidth-n))}px`,$.style.bottom="auto",$.style.right="auto"}function Ab(e){if(!$)return;const n=Math.max(16,Math.min(window.innerHeight-e.bottom,window.innerHeight-52-16)),r=e.left+e.width/2<window.innerWidth/2?"left":"right";$.style.top="auto",$.style.bottom=`${n}px`,r==="left"?($.style.right="auto",$.style.left="16px",$.classList.add(Po)):($.style.left="auto",$.style.right="16px",$.classList.remove(Po));try{localStorage.setItem(Hc,JSON.stringify({edge:r,bottom:n}))}catch(o){}}function Cb(){if($)try{const e=localStorage.getItem(Hc);if(!e)return;const t=JSON.parse(e);if(typeof t.bottom!="number"||t.edge!=="left"&&t.edge!=="right")return;const r=Math.max(16,Math.min(t.bottom,window.innerHeight-52-16));$.style.top="auto",$.style.bottom=`${r}px`,t.edge==="left"?($.style.right="auto",$.style.left="16px",$.classList.add(Po)):($.style.left="auto",$.style.right="16px",$.classList.remove(Po))}catch(e){}}function cr(){$==null||$.classList.remove(ti),ir&&(window.removeEventListener("pointerdown",ir,{capture:!0}),ir=null)}function Pb(){$&&($.classList.add(ti),ir=e=>{!$||$.contains(e.target)||cr()},requestAnimationFrame(()=>{ir&&window.addEventListener("pointerdown",ir,{capture:!0})}))}function Oo(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function Jc(e,t,n){var d;if(Lo=e,Io=t,zo=n,$)return;$=document.createElement("div"),$.className=vb,$.setAttribute(_b,"1"),rr=document.createElement("div"),rr.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="View captures",ft=document.createElement("button"),ft.className="ap-sdk-fab__list ap-sdk-fab__sub",ft.setAttribute("aria-label","My captures"),ft.setAttribute("title","View my captures"),ft.appendChild(Oo(Sb));const o=document.createElement("span");o.className="ap-sdk-fab__badge",o.setAttribute("data-ap-badge",""),o.style.display="none",ft.appendChild(o),rr.appendChild(r),rr.appendChild(ft),or=document.createElement("div"),or.className="ap-sdk-fab__row";const i=document.createElement("span");i.className="ap-sdk-fab__label",i.textContent="Capture element",ln=document.createElement("button"),ln.className="ap-sdk-fab__capture ap-sdk-fab__sub",ln.setAttribute("aria-label","Capture element"),ln.setAttribute("title","Capture element to Agent Platform"),ln.appendChild(Oo(wb)),or.appendChild(i),or.appendChild(ln),sr=document.createElement("div"),sr.className="ap-sdk-fab__row";const a=document.createElement("span");a.className="ap-sdk-fab__label",a.textContent="Record interaction",un=document.createElement("button"),un.className="ap-sdk-fab__record ap-sdk-fab__sub",un.setAttribute("aria-label","Record interaction"),un.setAttribute("title","Record a sequence of interactions"),un.appendChild(Oo(xb)),sr.appendChild(a),sr.appendChild(un),Mt=document.createElement("button"),Mt.className="ap-sdk-fab__main",Mt.setAttribute("aria-label","Agent Platform"),Mt.setAttribute("title","Agent Platform"),Mt.appendChild(Oo(yb)),$.appendChild(rr),$.appendChild(or),$.appendChild(sr),$.appendChild(Mt),Mt.addEventListener("click",u=>{if(xt){xt=!1;return}u.preventDefault(),u.stopPropagation(),$!=null&&$.classList.contains(ti)?cr():Pb()}),ln.addEventListener("click",u=>{if(xt){xt=!1;return}u.preventDefault(),u.stopPropagation(),cr(),!qn()&&!Co()&&Lo&&Lo()}),un.addEventListener("click",u=>{if(xt){xt=!1;return}u.preventDefault(),u.stopPropagation(),cr(),!qn()&&!Co()&&Io&&Io()}),ft.addEventListener("click",u=>{if(xt){xt=!1;return}u.preventDefault(),u.stopPropagation(),cr(),zo&&zo()}),Lr=u=>{if(!$||!($===u.target||$.contains(u.target)))return;const p=$.getBoundingClientRect();Fc=u.clientX-p.left,Bc=u.clientY-p.top,Gc=u.clientX,Wc=u.clientY,ar=!1,xt=!1,$.style.transition="none",u.stopPropagation(),Tb()},window.addEventListener("pointerdown",Lr,{capture:!0}),((d=document.body)!=null?d:document.documentElement).appendChild($),Ft($),Cb(),Ro=setInterval(()=>{Mt&&Mt.classList.toggle("ap-sdk-fab__main--active",qn()||Co())},200)}function An(e){const t=ft==null?void 0:ft.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function Yc(){ar=!1,xt=!1,$o(),cr(),Ro&&(clearInterval(Ro),Ro=null),Lr&&(window.removeEventListener("pointerdown",Lr,{capture:!0}),Lr=null),$&&Bt($),$==null||$.remove(),$=null,Mt=null,ln=null,un=null,ft=null,rr=null,or=null,sr=null,Lo=null,Io=null,zo=null}function Vc(e,t){return L(this,null,function*(){try{if(e.type==="planning"){const r=yield ng(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=yield qa(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch(n){return{capture:e,status:"unavailable",approved:!1}}})}function Xc(e){return e.filter(t=>!t.approved).length}function Kc(e){return L(this,null,function*(){const t=tr();if(!e||t.length===0){An(t.length);return}const n=yield Promise.all(t.map(r=>Vc(r,e)));An(Xc(n))})}let J=null,nt=null,Vt=null;function zr(){return J!==null}function $r(){J&&Bt(J),J==null||J.remove(),J=null,Vt==null||Vt(),Vt=null,nt==null||nt.destroy(),nt=null}function Qc(e,t,n,r,o,i,a,d,u,p,h=null){var xe;J&&$r();const g={captureType:"task",submitting:!1,completedPicks:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1,allowSubmit:!1},m=!n.backendUrl||!n.token,k=og(h,"planning-sessions:write");J=document.createElement("div"),J.className="ap-sdk-panel",J.setAttribute("data-ap-sdk","1"),J.setAttribute("role","dialog"),J.setAttribute("aria-modal","true"),J.setAttribute("aria-label","Capture to Agent Platform"),J.innerHTML=`
1522
1522
  <div class="ap-sdk-panel__header">
1523
1523
  <span class="ap-sdk-panel__title">
1524
1524
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1586,10 +1586,10 @@ ${n}${r?`
1586
1586
  <div class="ap-sdk-pick-entry" data-pick-index="${H}">
1587
1587
  <div class="ap-sdk-pick-entry__header">
1588
1588
  <span class="ap-sdk-pick-entry__number">${H+1}</span>
1589
- <span class="ap-sdk-pick-entry__element" title="${ct((re=W.ctx.elementText)!=null?re:"")}">${ct(W.ctx.elementText||"(no text)")}</span>
1589
+ <span class="ap-sdk-pick-entry__element" title="${lt((re=W.ctx.elementText)!=null?re:"")}">${lt(W.ctx.elementText||"(no text)")}</span>
1590
1590
  <button class="ap-sdk-pick-entry__remove" data-ap-remove="${H}" aria-label="Remove pick ${H+1}">×</button>
1591
1591
  </div>
1592
- <div class="ap-sdk-pick-entry__instruction">${ct(W.instruction)}</div>
1592
+ <div class="ap-sdk-pick-entry__instruction">${lt(W.instruction)}</div>
1593
1593
  </div>
1594
1594
  `}).join(""),ge.querySelectorAll("[data-ap-remove]").forEach(W=>{W.addEventListener("click",()=>{const H=parseInt(W.dataset.apRemove,10);g.completedPicks.splice(H,1),jt()})})},St=()=>{if(!g.currentPickedEl){ne.style.display="none";return}ne.style.display="",Ie.disabled=!g.currentPickedEl.parentElement||g.awaitingPick,We&&(We.disabled=g.awaitingPick)},Zt=()=>{Ge&&(Ge.disabled=!T.value.trim()||g.submitting||g.awaitingPick)},fn=(W,H)=>{g.currentCtx=W,g.currentPickedEl=H,Ln(W),nt==null||nt.update(H),St()};St(),Ie.addEventListener("click",()=>{var H;const W=(H=g.currentPickedEl)==null?void 0:H.parentElement;W&&fn(Ii(W),W)}),We&&u&&We.addEventListener("click",()=>{if(g.awaitingPick)return;const W=g.currentCtx,H=g.currentPickedEl;g.awaitingPick=!0,St(),Zt(),Ln(null),u((re,qe)=>{g.awaitingPick=!1,fn(re,qe),Zt()},()=>{g.awaitingPick=!1,H&&fn(W,H),Zt()})});const Tt=()=>{$r(),p==null||p()};j.addEventListener("click",Tt),Q.addEventListener("click",Tt);const we=J.querySelector("[data-ap-connect-required]");we&&a&&we.addEventListener("click",()=>{Tt(),a()}),P.forEach(W=>{W.addEventListener("click",()=>{g.captureType=W.dataset.apType,P.forEach(H=>H.classList.toggle("ap-sdk-active",H===W)),Z.style.display=g.captureType==="automate"?"":"none"})}),Y.addEventListener("change",()=>{g.allowSubmit=Y.checked});const In=J.querySelector("[data-ap-reconfigure]");a?In.addEventListener("click",()=>{Tt(),a()}):In.style.display="none",Ge&&d&&(T.addEventListener("input",Zt),Ge.addEventListener("click",()=>{const W=T.value.trim();!W||g.awaitingPick||(g.completedPicks.push({ctx:g.currentCtx,instruction:W}),jt(),T.value="",g.awaitingPick=!0,Ge.disabled=!0,St(),Ln(null),d((H,re)=>{g.awaitingPick=!1,fn(H,re),Zt()}))})),N.addEventListener("click",()=>L(null,null,function*(){var Ee,zn;if(g.submitting)return;if(m){No(S,"error","Connect to Agent Platform first.");return}const W=n.backendUrl,H=n.token,re=T.value.trim();if(!re){No(S,"error","Please enter an instruction.");return}g.submitting=!0,tl(J,!0),No(S,null,""),N.textContent="Submitting…";const qe={backendUrl:W,token:H},rt=E.getOptions(),ue=[...g.completedPicks,{ctx:g.currentCtx,instruction:re}];try{let He=r;He||(He=yield Ua(qe,o),i({backendUrl:W,token:H}));let de,Ne,ze;if(ue.length===1)if(g.captureType==="task")de=(yield xs(qe,{projectId:He.id,note:re,ctx:g.currentCtx,advancedOpts:rt})).id,Ne="task",ze=re.slice(0,120)||g.currentCtx.pageTitle||"Browser capture";else if(g.captureType==="planning"){let Je=Kl(re,U(v({},g.currentCtx),{ancestry:g.currentCtx.outerTree||g.currentCtx.ancestry}));(Ee=g.currentCtx.innerTree)!=null&&Ee.trim()&&(Je+=`
1595
1595
 
@@ -1597,7 +1597,7 @@ Element tree:
1597
1597
  ${g.currentCtx.innerTree}`),(zn=g.currentCtx.interactionSteps)!=null&&zn.length&&(Je+=`
1598
1598
 
1599
1599
  Recorded steps:
1600
- ${jc(g.currentCtx.interactionSteps)}`),de=(yield Za(qe,He.id,Je,rt)).id,Ne="planning",ze=re.slice(0,120)||g.currentCtx.pageTitle||"Planning session"}else de=(yield ja(qe,{projectId:He.id,note:re,ctx:g.currentCtx,advancedOpts:rt,allowSubmit:g.allowSubmit})).id,Ne="automate",ze=re.slice(0,120)||g.currentCtx.pageTitle||"Browser automation";else{const Je=Lb(ue),ot=ue[0].instruction.slice(0,120)||ue[0].ctx.pageTitle||"Multi-element capture",qt=ue.map(gt=>gt.instruction).filter(Boolean).join(`
1600
+ ${jc(g.currentCtx.interactionSteps)}`),de=(yield Za(qe,He.id,Je,rt)).id,Ne="planning",ze=re.slice(0,120)||g.currentCtx.pageTitle||"Planning session"}else de=(yield ja(qe,{projectId:He.id,note:re,ctx:g.currentCtx,advancedOpts:rt,allowSubmit:g.allowSubmit})).id,Ne="automate",ze=re.slice(0,120)||g.currentCtx.pageTitle||"Browser automation";else{const Je=Lb(ue),ot=ue[0].instruction.slice(0,120)||ue[0].ctx.pageTitle||"Multi-element capture",qt=ue.map(mt=>mt.instruction).filter(Boolean).join(`
1601
1601
 
1602
1602
  `);g.captureType==="task"?(de=(yield xs(qe,{projectId:He.id,note:Je,ctx:ue[0].ctx,advancedOpts:rt,titleOverride:ot,type:Oa,titleInstruction:qt})).id,Ne="task",ze=ot):g.captureType==="planning"?(de=(yield Za(qe,He.id,Je,rt)).id,Ne="planning",ze=ot):(de=(yield ja(qe,{projectId:He.id,note:Je,ctx:ue[0].ctx,advancedOpts:rt,titleOverride:ot,titleInstruction:qt,allowSubmit:g.allowSubmit})).id,Ne="automate",ze=ot)}if(ab({id:de,type:Ne,title:ze,backendUrl:W,createdAt:new Date().toISOString()}),Kc(qe).catch(()=>{}),Ne==="automate"){Tt(),Ys(de,qe,W,ze,p);return}const Et=Ne==="task"?`${W.replace(/\/+$/,"")}/tasks/${de}`:`${W.replace(/\/+$/,"")}/planning/${de}`;Ib(S,Ne,ze,Et,Tt),J.classList.add("ap-sdk-panel--success"),Vt==null||Vt(),Vt=null,nt==null||nt.hide(),g.submitting=!1}catch(He){No(S,"error",He instanceof Error?He.message:"An unexpected error occurred."),g.submitting=!1,tl(J,!1),N.textContent="Submit"}})),setTimeout(()=>T.focus(),50)}const Rb={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};function el(e){var t,n;return(t=e.interactionSteps)!=null&&t.length?`
1603
1603
  <div class="ap-sdk-panel__context-label">Recorded steps (${e.interactionSteps.length})</div>
@@ -1605,14 +1605,14 @@ ${jc(g.currentCtx.interactionSteps)}`),de=(yield Za(qe,He.id,Je,rt)).id,Ne="plan
1605
1605
  ${e.interactionSteps.map(r=>`
1606
1606
  <div class="ap-sdk-panel__context-step">
1607
1607
  <span class="ap-sdk-panel__context-step-icon">${Rb[r.action]}</span>
1608
- <span class="ap-sdk-panel__context-step-text">${ct(r.description)}</span>
1608
+ <span class="ap-sdk-panel__context-step-text">${lt(r.description)}</span>
1609
1609
  </div>
1610
1610
  `).join("")}
1611
1611
  </div>
1612
1612
  `:`
1613
1613
  <div class="ap-sdk-panel__context-label">Captured element</div>
1614
- <div class="ap-sdk-panel__context-text" title="${ct((n=e.elementText)!=null?n:"")}">${ct(e.elementText||"(no text)")}</div>
1615
- ${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${ct(e.cssSelector)}">${ct(e.cssSelector)}</div>`:""}
1614
+ <div class="ap-sdk-panel__context-text" title="${lt((n=e.elementText)!=null?n:"")}">${lt(e.elementText||"(no text)")}</div>
1615
+ ${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${lt(e.cssSelector)}">${lt(e.cssSelector)}</div>`:""}
1616
1616
  `}function Lb(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:",jc(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(`
1617
1617
  Element tree:
1618
1618
  ${t.ctx.innerTree}`),r.push("",`Instruction:
@@ -1627,17 +1627,17 @@ ${t.instruction}`),r.join(`
1627
1627
  <circle class="ap-sdk-success-check__circle" cx="24" cy="24" r="22"/>
1628
1628
  <path class="ap-sdk-success-check__tick" d="M14 24l7 7 13-14"/>
1629
1629
  </svg>
1630
- <p class="ap-sdk-success-headline">${ct(a)}</p>
1630
+ <p class="ap-sdk-success-headline">${lt(a)}</p>
1631
1631
  <div class="ap-sdk-success-meta">
1632
- <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${ct(i)}</span>
1633
- <span class="ap-sdk-success-title" title="${ct(n)}">${ct(u)}</span>
1632
+ <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${lt(i)}</span>
1633
+ <span class="ap-sdk-success-title" title="${lt(n)}">${lt(u)}</span>
1634
1634
  </div>
1635
1635
  <div class="ap-sdk-success-actions">
1636
- <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${ct(d)}</button>
1636
+ <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${lt(d)}</button>
1637
1637
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-success-close>Close</button>
1638
1638
  </div>
1639
1639
  </div>
1640
- `,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function tl(e,t){e.querySelectorAll("button, input, textarea, select").forEach(n=>{n.disabled=t})}function ct(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}let ae=null;function nl(){return ae!==null}function Cn(){ae&&Bt(ae),ae==null||ae.remove(),ae=null}function zb(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function $b(e){if(ae){Cn();return}ae=document.createElement("div"),ae.className="ap-sdk-panel",ae.setAttribute("data-ap-sdk","1"),ae.setAttribute("role","dialog"),ae.setAttribute("aria-modal","true"),ae.setAttribute("aria-label","My captures"),ae.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),ae.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),ae.innerHTML=`
1640
+ `,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function tl(e,t){e.querySelectorAll("button, input, textarea, select").forEach(n=>{n.disabled=t})}function lt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}let ae=null;function nl(){return ae!==null}function Cn(){ae&&Bt(ae),ae==null||ae.remove(),ae=null}function zb(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function $b(e){if(ae){Cn();return}ae=document.createElement("div"),ae.className="ap-sdk-panel",ae.setAttribute("data-ap-sdk","1"),ae.setAttribute("role","dialog"),ae.setAttribute("aria-modal","true"),ae.setAttribute("aria-label","My captures"),ae.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),ae.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),ae.innerHTML=`
1641
1641
  <div class="ap-sdk-panel__header">
1642
1642
  <span class="ap-sdk-panel__title">
1643
1643
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1726,7 +1726,7 @@ ${t.instruction}`),r.join(`
1726
1726
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-save>Save</button>
1727
1727
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-back>Back</button>
1728
1728
  </div>
1729
- `;const h=K.querySelector("[data-ap-cfg-project]"),g=K.querySelector("[data-ap-cfg-status]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Xt()}),K.querySelector("[data-ap-back]").addEventListener("click",()=>r(i)),K.querySelector("[data-ap-save]").addEventListener("click",()=>{const m=h.value;if(!m){pn(g,"error","Please select a project.");return}Xt(),e({backendUrl:i,token:a,projectCode:m,expiresAt:d})})}}function pn(e,t,n){if(!t){e.style.display="none",e.textContent="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function al(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ri(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let ft=null,Mo=!1;function Bb(){ft==null||ft.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),ft&&ft.observe(document.body,{childList:!0}),Mo=!1}function cl(){ft||(ft=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||Mo||(Mo=!0,queueMicrotask(Bb))}),ft.observe(document.body,{childList:!0}))}function Gb(){ft==null||ft.disconnect(),ft=null,Mo=!1}const Wb={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};let Ce=null,hn=[];function Uo(){Ce&&Bt(Ce),Ce==null||Ce.remove(),Ce=null,hn=[]}function Jb(e,t,n){Ce&&Uo(),hn=[...e],Ce=document.createElement("div"),Ce.className="ap-sdk-panel ap-sdk-record-review",Ce.setAttribute("data-ap-sdk","1"),Ce.setAttribute("role","dialog"),Ce.setAttribute("aria-modal","true"),Ce.setAttribute("aria-label","Review recorded steps"),Ce.innerHTML=`
1729
+ `;const h=K.querySelector("[data-ap-cfg-project]"),g=K.querySelector("[data-ap-cfg-status]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Xt()}),K.querySelector("[data-ap-back]").addEventListener("click",()=>r(i)),K.querySelector("[data-ap-save]").addEventListener("click",()=>{const m=h.value;if(!m){pn(g,"error","Please select a project.");return}Xt(),e({backendUrl:i,token:a,projectCode:m,expiresAt:d})})}}function pn(e,t,n){if(!t){e.style.display="none",e.textContent="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function al(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ri(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let gt=null,Mo=!1;function Bb(){gt==null||gt.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),gt&&gt.observe(document.body,{childList:!0}),Mo=!1}function cl(){gt||(gt=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||Mo||(Mo=!0,queueMicrotask(Bb))}),gt.observe(document.body,{childList:!0}))}function Gb(){gt==null||gt.disconnect(),gt=null,Mo=!1}const Wb={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};let Ce=null,hn=[];function Uo(){Ce&&Bt(Ce),Ce==null||Ce.remove(),Ce=null,hn=[]}function Jb(e,t,n){Ce&&Uo(),hn=[...e],Ce=document.createElement("div"),Ce.className="ap-sdk-panel ap-sdk-record-review",Ce.setAttribute("data-ap-sdk","1"),Ce.setAttribute("role","dialog"),Ce.setAttribute("aria-modal","true"),Ce.setAttribute("aria-label","Review recorded steps"),Ce.innerHTML=`
1730
1730
  <div class="ap-sdk-panel__header">
1731
1731
  <span class="ap-sdk-panel__title">
1732
1732
  <span class="ap-sdk-panel__logo">AP</span>