@uipath/delegate-sdk 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +13 -13
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1501,13 +1501,13 @@ When partialName omitted, lists all recent files without filtering.
|
|
|
1501
1501
|
Returns { confidence: 'exact', resolved: {filePath, fileName, source} } for one match,
|
|
1502
1502
|
{ confidence: 'ambiguous', matches: [...] } for multiple candidates,
|
|
1503
1503
|
or a NOT FOUND message \u2014 in that case you MUST ask the user for the full path. IMPORTANT: When NOT FOUND, you are STRICTLY FORBIDDEN from searching the filesystem. Do NOT use find, ls, Get-ChildItem, mdfind, locate, bash, execute_bash_command, or any other command to look for files. Just ask the user for the full path.
|
|
1504
|
-
If further Office operations needed after resolving, use Office API to open/attach (e.g. /excel/open-or-attach-workbook) rather than OS-level commands.`;this.inputSchema=UG8;this.autoExecute=!0;this.isReadOnly=!0;this.availability="autopilotAgent"}canExecute(t,r){return!0}canRevert(t,r){return!1}async revert(t,r){return new A2("Cannot revert file discovery","error")}validateProps(t,r){return!0}async execute(t,r){try{let a=Nr.getHttpClient(r),i=Nr.getAuthProvider(r),n=new TW2(a,i,r.sessionId,this._toolsUrlProvider,r.turnPolicySnapshot),o=t.maxRecentFiles??20,h=t.appType,u=new Set,g=[],f=(y,z)=>{y.FilePath&&!u.has(y.FilePath)&&(u.add(y.FilePath),g.push({file:y,source:z}))};if(h){let y=this._toolsUrlProvider.getToolsUrl(r.sessionId),z=await s9(i,r),[S,B,R]=await Promise.all([Vn3?tj8(h,a,z,y):$G8(n,h),Vn3?ej8(h,o,a,z,y):KG8(n,h,o),n.getSystemRecentFiles(o)]);for(let N of S)f(N,"open");for(let N of B)f(N,"recent");let F=WG8[h]??[];for(let N of R){let j=N.toLowerCase();F.some(Y=>j.endsWith(Y))&&f({FilePath:N,FileName:""},"recent")}}else{let y=await n.getSystemRecentFiles(o);for(let z of y)f({FilePath:z,FileName:""},"recent")}let v=y=>y.replace(/\\/g,"/").split("/").pop()??y;if(!t.partialName){let y=g.map(({file:z,source:S})=>({filePath:z.FilePath,fileName:z.FileName||v(z.FilePath),source:S}));return y.length===0?new A2("No recent files found.","text"):new A2(JSON.stringify({files:y}),"text")}let C=g.map(({file:y,source:z})=>{let S=y.FileName||v(y.FilePath);return{filePath:y.FilePath,fileName:S,score:qG8(t.partialName,S),source:z}}).filter(y=>y.score>=GG8).sort((y,z)=>z.score!==y.score?z.score-y.score:y.source==="open"&&z.source!=="open"?-1:z.source==="open"&&y.source!=="open"?1:0);if(C.length===0)return new A2("NOT FOUND. The file was not found in open or recent files. You MUST ask the user for the full file path. STRICTLY FORBIDDEN: Do NOT attempt to search the filesystem \u2014 no find, ls, Get-ChildItem, mdfind, locate, execute_bash_command, or any other command. Simply ask the user to provide the complete file path.","text");let L;if(C.length===1&&C[0].score>=jG8){let{filePath:y,fileName:z,source:S}=C[0];L={confidence:"exact",resolved:{filePath:y,fileName:z,source:S}}}else L={confidence:"ambiguous",matches:C};return new A2(JSON.stringify(L),"text")}catch(a){let i=a instanceof Error?a.message:String(a);return new A2(`Error resolving file path: ${i}`,"error")}}}});var _n3=C1(()=>{zn3();Hn3();Tn3();Bn3();Pn3()});var En3,rj8,Cm1,I54=C1(()=>{En3=w4(li());a7();Jv1();rj8=En3.z.object({}),Cm1=class extends Yn{name="EnterPlanningMode";friendlyName="Enter Planning Mode";inputSchema=rj8;activationTrigger="Plan complex multi-step tasks before acting";autoExecute=!0;isReadOnly=!0;availability="autopilotAgent";excludeFromAgents=!0;allowedPlanningPhases=["idle","executing","completed"];description=`Enter planning mode for complex tasks where upfront planning improves execution.
|
|
1504
|
+
If further Office operations needed after resolving, use Office API to open/attach (e.g. /excel/open-or-attach-workbook) rather than OS-level commands.`;this.inputSchema=UG8;this.autoExecute=!0;this.isReadOnly=!0;this.availability="autopilotAgent"}canExecute(t,r){return!0}canRevert(t,r){return!1}async revert(t,r){return new A2("Cannot revert file discovery","error")}validateProps(t,r){return!0}async execute(t,r){try{let a=Nr.getHttpClient(r),i=Nr.getAuthProvider(r),n=new TW2(a,i,r.sessionId,this._toolsUrlProvider,r.turnPolicySnapshot),o=t.maxRecentFiles??20,h=t.appType,u=new Set,g=[],f=(y,z)=>{y.FilePath&&!u.has(y.FilePath)&&(u.add(y.FilePath),g.push({file:y,source:z}))};if(h){let y=this._toolsUrlProvider.getToolsUrl(r.sessionId),z=await s9(i,r),[S,B,R]=await Promise.all([Vn3?tj8(h,a,z,y):$G8(n,h),Vn3?ej8(h,o,a,z,y):KG8(n,h,o),n.getSystemRecentFiles(o)]);for(let N of S)f(N,"open");for(let N of B)f(N,"recent");let F=WG8[h]??[];for(let N of R){let j=N.toLowerCase();F.some(Y=>j.endsWith(Y))&&f({FilePath:N,FileName:""},"recent")}}else{let y=await n.getSystemRecentFiles(o);for(let z of y)f({FilePath:z,FileName:""},"recent")}let v=y=>y.replace(/\\/g,"/").split("/").pop()??y;if(!t.partialName){let y=g.map(({file:z,source:S})=>({filePath:z.FilePath,fileName:z.FileName||v(z.FilePath),source:S}));return y.length===0?new A2("No recent files found.","text"):new A2(JSON.stringify({files:y}),"text")}let C=g.map(({file:y,source:z})=>{let S=y.FileName||v(y.FilePath);return{filePath:y.FilePath,fileName:S,score:qG8(t.partialName,S),source:z}}).filter(y=>y.score>=GG8).sort((y,z)=>z.score!==y.score?z.score-y.score:y.source==="open"&&z.source!=="open"?-1:z.source==="open"&&y.source!=="open"?1:0);if(C.length===0)return new A2("NOT FOUND. The file was not found in open or recent files. You MUST ask the user for the full file path. STRICTLY FORBIDDEN: Do NOT attempt to search the filesystem \u2014 no find, ls, Get-ChildItem, mdfind, locate, execute_bash_command, or any other command. Simply ask the user to provide the complete file path.","text");let L;if(C.length===1&&C[0].score>=jG8){let{filePath:y,fileName:z,source:S}=C[0];L={confidence:"exact",resolved:{filePath:y,fileName:z,source:S}}}else L={confidence:"ambiguous",matches:C};return new A2(JSON.stringify(L),"text")}catch(a){let i=a instanceof Error?a.message:String(a);return new A2(`Error resolving file path: ${i}`,"error")}}}});var _n3=C1(()=>{zn3();Hn3();Tn3();Bn3();Pn3()});var En3,rj8,Cm1,I54=C1(()=>{En3=w4(li());a7();Jv1();rj8=En3.z.object({}),Cm1=class extends Yn{constructor(r){super(r);this.name="EnterPlanningMode";this.friendlyName="Enter Planning Mode";this.inputSchema=rj8;this.activationTrigger="Plan complex multi-step tasks before acting";this.autoExecute=!0;this.isReadOnly=!0;this.availability="autopilotAgent";this.excludeFromAgents=!0;this.allowedPlanningPhases=["idle","executing","completed"];this.description=`Enter planning mode for complex tasks where upfront planning improves execution.
|
|
1505
1505
|
|
|
1506
1506
|
Use when:
|
|
1507
1507
|
- User asks for a plan \u2014 always.
|
|
1508
1508
|
- Task spans multiple applications requiring careful coordination.
|
|
1509
1509
|
- Batch processing (files, emails, records).
|
|
1510
|
-
- Through exploration needed before acting
|
|
1510
|
+
- Through exploration needed before acting.`}async execute(r,a){let i=`Planning mode activated. Research and design before acting.
|
|
1511
1511
|
|
|
1512
1512
|
## Planning Mode Rules
|
|
1513
1513
|
- No system modifications, non-readonly ops, or UI automation while planning.
|
|
@@ -1517,7 +1517,7 @@ Use when:
|
|
|
1517
1517
|
- Use AskUser for any questions or choices.
|
|
1518
1518
|
- Call GeneratePlan when the plan is complete; approval auto-starts execution (then use UpdatePlan).
|
|
1519
1519
|
- On user feedback or change requests, revise and call GeneratePlan again \u2014 don't exit.
|
|
1520
|
-
- Call ExitPlanningMode only to abandon planning, or after a final rejection without feedback.`;if(this._localSessionStore&&
|
|
1520
|
+
- Call ExitPlanningMode only to abandon planning, or after a final rejection without feedback.`;if(this._localSessionStore&&a.sessionId)try{let n=await this._osService.getWellKnownPath("userData");if(n){let o=`${n}/sessions/${a.sessionId}/plan.md`;this._localSessionStore.enterPlanningMode(a.sessionId,o)}}catch{}return new A2(i,"text",void 0,!1,{planningState:{planning_phase:"planning"}})}async getSubHeader(r){return"Entering planning mode..."}}});var N54,aj8,Mm1,U54=C1(()=>{N54=w4(li());a7();Jv1();aj8=N54.z.object({outcome:N54.z.enum(["plan_approved","plan_rejected"]).describe("Planning session outcome.")}),Mm1=class extends Yn{constructor(r){super(r);this.name="ExitPlanningMode";this.friendlyName="Exit Planning Mode";this.activationTrigger="Exit planning mode after user decision";this.inputSchema=aj8;this.autoExecute=!0;this.isReadOnly=!0;this.availability="autopilotAgent";this.excludeFromAgents=!0;this.allowedPlanningPhases=["planning","awaiting_approval","awaiting_llm_response"];this.description="Exit planning mode and start executing."}async execute(r,a){if(r.outcome==="plan_approved"){let i=`Plan approved. Executing now.
|
|
1521
1521
|
|
|
1522
1522
|
## Execution Guidelines
|
|
1523
1523
|
- Follow steps in order; complete each before the next.
|
|
@@ -1528,20 +1528,20 @@ Use when:
|
|
|
1528
1528
|
- Indicators: \u2705 done, \u{1F504} in progress, \u274C failed (keep visible).
|
|
1529
1529
|
- Verify each action \u2014 screenshots for UI, file checks for FS.
|
|
1530
1530
|
- Errors: adapt minor; retry recoverable (\u22643); ask user on blockers; re-enter planning on invalidation.
|
|
1531
|
-
- Re-enter planning if requirements shift, the plan can't reach the goal, or multiple steps fail.`;return this._localSessionStore&&
|
|
1531
|
+
- Re-enter planning if requirements shift, the plan can't reach the goal, or multiple steps fail.`;return this._localSessionStore&&a.sessionId&&this._localSessionStore.approvePlan(a.sessionId),new A2(i,"text",void 0,!1,{planningState:{planning_phase:"executing"}})}else return this._localSessionStore&&a.sessionId&&this._localSessionStore.rejectPlan(a.sessionId),new A2("Plan rejected. Idle mode \u2014 await new instructions.","text",void 0,!1,{planningState:{planning_phase:"idle",plan_content:null}})}async getSubHeader(r){return r.outcome==="plan_approved"?"Plan approved, proceeding...":"Plan rejected, exiting..."}}});var G54,ij8,xm1,j54=C1(()=>{G54=w4(li());a7();Jv1();rG2();ij8=G54.z.object({plan_content:G54.z.string().describe("Markdown plan.")}),xm1=class extends Yn{constructor(r){super(r);this.name="GeneratePlan";this.friendlyName="Generate Plan";this.activationTrigger="Submit a plan for user approval";this.inputSchema=ij8;this.autoExecute=!1;this.isReadOnly=!0;this.availability="autopilotAgent";this.excludeFromAgents=!0;this.allowedPlanningPhases=["planning","awaiting_approval","awaiting_llm_response"];this.description=`Submit a plan for user approval.
|
|
1532
1532
|
|
|
1533
1533
|
Plan format rules:
|
|
1534
1534
|
- Every step must be executable autonomously.
|
|
1535
1535
|
- Markdown with sections and subsections.
|
|
1536
1536
|
- Use \`## Steps\` (h2) with \`### Step N: Title\` (h3) subsections \u2014 one per logical operation.
|
|
1537
1537
|
- Step titles state what to do, not how \u2014 keep the how in the step body.
|
|
1538
|
-
- Repeated work = one "For each" step, internals as lettered substeps. No per-iteration or pilot/learn-the-pattern steps \u2014 the loop covers all items
|
|
1538
|
+
- Repeated work = one "For each" step, internals as lettered substeps. No per-iteration or pilot/learn-the-pattern steps \u2014 the loop covers all items.`}async execute(r,a){return this._localSessionStore?.approvePlan(a.sessionId),new A2("Plan approved. Executing now.","text",void 0,!1,{planningState:{planning_phase:"executing",plan_content:r.plan_content}})}async getRejectMessage(r,a){return this._localSessionStore?.rejectPlan(a.sessionId),"Plan rejected. Back to idle mode \u2014 await new instructions."}validateProps(r,a){return!r.plan_content||r.plan_content.trim()===""?{valid:!1,errorsMessage:"Plan content is required."}:yk1(r.plan_content).length===0?/^## Steps\s*:?\s*$/m.test(r.plan_content)?{valid:!1,errorsMessage:'Invalid plan format \u2014 the "## Steps" section has no steps. Each step must be a "### Step N: Title" header (e.g., "### Step 1: Open the spreadsheet").'}:{valid:!1,errorsMessage:'Invalid plan format \u2014 missing the required "## Steps" section. The plan content must include a "## Steps" header (markdown h2) followed by "### Step N: Title" subsections.'}:!0}onPending(r,a,i){this._localSessionStore&&(this._localSessionStore.setPendingPlan(a,i),r.plan_content&&this._localSessionStore.writePlan(a,r.plan_content))}async getSubHeader(r){return"Presenting plan for approval..."}}});var eT1,nj8,Lm1,W54=C1(()=>{eT1=w4(li());a7();Jv1();nj8=eT1.z.object({step_number:eT1.z.number().min(1).describe("Step currently executing (1-indexed)."),mode:eT1.z.enum(["replace","append"]).describe("Edit mode for the progress document."),old_string:eT1.z.string().optional().describe('Exact text to find. Required for "replace".'),new_string:eT1.z.string().describe("Replacement or appended text."),completed:eT1.z.boolean().default(!1).describe("Whether plan execution is complete.")}),Lm1=class extends Yn{constructor(r){super(r);this.name="UpdatePlan";this.friendlyName="Update Plan Progress";this.activationTrigger="Update execution progress on the current plan";this.inputSchema=nj8;this.autoExecute=!0;this.availability="autopilotAgent";this.excludeFromAgents=!0;this.allowedPlanningPhases=["executing"];this.description=`Update the plan's progress document.
|
|
1539
1539
|
|
|
1540
1540
|
Progress format rules:
|
|
1541
1541
|
- First call for a step appends a \`### Step N: Title\` header before any progress entries.
|
|
1542
1542
|
- Indicators: \u2705 done, \u{1F504} in progress, \u274C failed (keep \u274C visible).
|
|
1543
1543
|
- Entries are specific ("\u2705 Created 5 slides", not "\u2705 Done").
|
|
1544
|
-
- For loops: include position/item per entry; maintain a tally line you replace each iteration.`;constructor(t){super(t)}async execute(t,r){let a={progress_edit:{mode:t.mode,old_string:t.old_string,new_string:t.new_string},current_step_number:t.step_number};t.completed&&(a.planning_phase="completed"),this._localSessionStore&&r.sessionId&&(this._localSessionStore.applyProgressEdit(r.sessionId,{mode:t.mode,old_string:t.old_string,new_string:t.new_string},t.step_number),t.completed===!0&&this._localSessionStore.completePlan(r.sessionId));let i=t.mode==="append"?"Added":"Updated",n=t.completed?" Plan completed!":"";return new A2(`${i} progress (Step ${t.step_number}).${n}`,"text",void 0,!1,{planningState:a})}validateProps(t,r){return!t.step_number||t.step_number<1?{valid:!1,errorsMessage:"step_number is required and must be at least 1"}:t.mode?t.new_string?t.mode==="replace"&&!t.old_string?{valid:!1,errorsMessage:"old_string is required for replace mode"}:!0:{valid:!1,errorsMessage:"new_string is required"}:{valid:!1,errorsMessage:'mode is required ("replace" or "append")'}}async getSubHeader(t){return t.completed?"Plan completed!":`${t.mode==="append"?"Adding":"Updating"} progress for step ${t.step_number}...`}}});function Rn3(e){return`opt_${e}`}function VW2(e){return`q_${e}`}function Zn3(e){return e.trim().toLowerCase().replace(/\s+/g," ")}var Fn3,q54=C1(()=>{Fn3="userinput"});function On3(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:void 0}catch{return}}function oj8(e,t){for(let r=t;r<e.length;r++)if(!/\s/.test(e[r]))return e[r];return""}function lj8(e,t){return e.escaped?{inString:!0,escaped:!1}:t==="\\"?{inString:!0,escaped:!0}:t==='"'?Dn3:e}function cj8(e){let t=[],r=Dn3,a=0,i=0,n=()=>{a<=0||(t.push("}".repeat(a)),a=0)};for(let o=0;o<e.length;o++){let h=e[o];if(r.inString){t.push(h),r=lj8(r,h);continue}switch(h){case'"':r={inString:!0,escaped:!1};break;case"{":a++;break;case"}":a--;break;case"[":i++;break;case"]":i===1&&n(),i--;break;case",":i===1&&oj8(e,o+1)==="{"&&n();break;default:break}t.push(h)}return t.join("")}function yl2(e){if(typeof e!="string")return e;let t=On3(e);return t||(e.length>64e3?e:On3(cj8(e))??e)}var Dn3,$54=C1(()=>{Dn3={inString:!1,escaped:!1}});function KG1(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function K54(e,t){return Object.fromEntries(Object.entries(e).filter(([r])=>!t(r)))}function sj8(e,t){let r=Object.keys(e).filter(i=>In3.has(i));if(r.length===0)return e;let a={...t};for(let i of r)i in a||(a[i]=e[i]);return{...K54(e,i=>In3.has(i)),payload:a}}function hj8(e){let t=K54(e,r=>r==="type");return"type"in e?{type:e.type,payload:t}:{payload:t}}function dj8(e){return"fields"in e?"numeric":"buckets"in e||"items"in e?"bucket":"recordable"in e||"attachable"in e?"media":"text"}function uj8(e){if(!KG1(e.payload))return e;let t=e.payload.options;return!Array.isArray(t)||!t.some(r=>typeof r=="string")?e:{...e,payload:{...e.payload,options:t.map(r=>typeof r=="string"?{label:r}:r)}}}function gj8(e){if(e.type!=="media"||!KG1(e.payload))return e;let t=i=>i===void 0||i===!1,{recordable:r,attachable:a}=e.payload;return!t(r)||!t(a)?e:{...e,type:"text",payload:K54(e.payload,i=>i==="recordable"||i==="attachable")}}function Y54(e){if(!KG1(e))return{value:e,repairs:[]};if("payload"in e&&!KG1(e.payload))return{value:e,repairs:[]};let t=[],r="type"in e,a;if(KG1(e.payload)?(a=sj8(e,e.payload),a!==e&&t.push("keys_lifted")):(a=hj8(e),t.push("payload_wrapped")),!("type"in a)){let o=KG1(a.payload)?a.payload:{};a={...a,type:dj8(o)},t.push("type_inferred")}let i=gj8(a);i!==a&&r&&t.push("media_demoted");let n=uj8(i);return n!==i&&t.push("option_labels_recovered"),{value:n,repairs:t}}function Un3(e){return Y54(e).value}var In3,Nn3,X54=C1(()=>{In3=new Set(["question","header","optional"]);Nn3=["questions_unstringified","payload_wrapped","keys_lifted","type_inferred","media_demoted","option_labels_recovered"]});function J54(e){return"kind"in e&&e.kind==="userinput"}function Al2(e,t,r){let a={};for(let n of e)(a[Zn3(n)]??=[]).push(n);let i=[...new Set(Object.values(a).filter(n=>n.length>1).flat())];i.length!==0&&r.addIssue({code:Ba.z.ZodIssueCode.custom,message:`${t} must have distinct labels, but the following appear more than once: ${i.map(n=>`"${n}"`).join(", ")}. Use clearer, more distinct labels.`})}function mj8(e,t){e<=1||t.addIssue({code:Ba.z.ZodIssueCode.custom,message:`only one option can be the free-text choice, but ${e} carry {"kind":"userinput"}. Keep one and make the rest labelled choices.`})}function Bj8(e){let t="";for(let r of e)typeof r=="number"?t+=`[${r}]`:t===""?t=r:t+=`.${r}`;return t}function jn3(e){return e.flatMap(t=>{if(t.code===Ba.z.ZodIssueCode.invalid_union){let[a]=[...t.unionErrors].sort((i,n)=>i.issues.length-n.issues.length);return a?jn3(a.issues):[]}let r=Bj8(t.path);return[r?`${r}: ${t.message}`:t.message]})}function Vj8(e){let t=[...new Set(jn3(e))];return t.length>0?t.join("; "):"AskUser arguments are invalid."}var Ba,pj8,fj8,vj8,Cj8,Gn3,Mj8,xj8,Lj8,wj8,yj8,Aj8,zj8,bj8,Sj8,Hj8,kj8,Tj8,Pj8,PW2,Wn3=C1(()=>{Ba=w4(li());a7();Jv1();q54();$54();X54();pj8=Ba.z.object({label:Ba.z.string().trim().min(1).describe("Option text the user clicks."),description:Ba.z.string().optional().describe("Brief explanation of the option.")}).strict(),fj8=Ba.z.object({kind:Ba.z.literal("userinput"),label:Ba.z.string().trim().min(1).optional().describe('Wording for the choice, e.g. "Other destination".')}).strict().describe("Collects free-text input."),vj8=Ba.z.union([pj8,fj8]);Cj8=Ba.z.object({question:Ba.z.string().min(1,"question must not be empty").describe("Question text."),optional:Ba.z.boolean().default(!1).describe("User can skip without answering."),header:Ba.z.string().optional(),options:Ba.z.array(vj8).describe("Predefined choices, optionally with the free-text branch.").superRefine((e,t)=>{let r=e.map(a=>J54(a)?a.label??"Other":a.label);Al2(r,"options",t),mj8(e.filter(J54).length,t)}).transform(e=>e.map((t,r)=>J54(t)?{kind:"userinput",id:Fn3,...t.label===void 0?{}:{label:t.label}}:{...t,kind:"choice",id:Rn3(r)})),multiSelect:Ba.z.boolean().default(!1).describe("Allow multiple selections."),folderPicker:Ba.z.boolean().optional().describe("Set when the answer is a local folder path. Requires options: []. Desktop hosts add a native folder picker; typing stays available.")}).strict(),Gn3=Ba.z.object({question:Ba.z.string().min(1,"question must not be empty").describe("Question text."),optional:Ba.z.boolean().default(!1).describe("User can skip without answering."),header:Ba.z.string().optional()}),Mj8=Ba.z.union([Gn3.extend({recordable:Ba.z.literal(!0).describe("Show a Record button."),attachable:Ba.z.boolean().optional().describe("Show a file drop zone.")}).strict(),Gn3.extend({recordable:Ba.z.boolean().optional().describe("Show a Record button."),attachable:Ba.z.literal(!0).describe("Show a file drop zone.")}).strict()]),xj8=Ba.z.object({id:Ba.z.string().min(1).describe("Sub-field id, unique within the bucket."),label:Ba.z.string().min(1).describe("Sub-field label shown next to the input."),placeholder:Ba.z.string().optional().describe("Hint text for the sub-field input."),optional:Ba.z.boolean().default(!1).describe("Sub-field can be left blank.")}).strict(),Lj8=Ba.z.object({id:Ba.z.string().min(1).describe("Bucket id, unique within the question."),label:Ba.z.string().min(1).describe("Bucket label shown above the column."),subFields:Ba.z.preprocess(e=>Array.isArray(e)&&e.length===0?void 0:e,Ba.z.array(xj8).optional()).describe("Per-item sub-fields shown only when an item lands in this bucket.")}).strict(),wj8=Ba.z.object({id:Ba.z.string().min(1).describe("Item id, unique within the question."),label:Ba.z.string().min(1).describe("Item label shown in the column."),description:Ba.z.string().optional().describe("Brief description of the item.")}).strict(),yj8=Ba.z.object({question:Ba.z.string().min(1,"question must not be empty").describe("Question text."),optional:Ba.z.boolean().default(!1).describe("User can skip without assigning items."),header:Ba.z.string().optional(),buckets:Ba.z.array(Lj8).min(2).describe("Buckets to assign items to. At least 2.").refine(e=>new Set(e.map(t=>t.id)).size===e.length,{message:"bucket ids must be unique within the question"}).refine(e=>e.every(t=>!t.subFields||new Set(t.subFields.map(r=>r.id)).size===t.subFields.length),{message:"sub-field ids must be unique within their bucket"}).superRefine((e,t)=>{Al2(e.map(r=>r.label),"buckets",t);for(let r of e)r.subFields&&Al2(r.subFields.map(a=>a.label),`sub-fields of bucket "${r.label}"`,t)}),items:Ba.z.array(wj8).min(1).describe("Items the user assigns to buckets.").refine(e=>new Set(e.map(t=>t.id)).size===e.length,{message:"item ids must be unique within the question"}).superRefine((e,t)=>Al2(e.map(r=>r.label),"items",t))}).strict(),Aj8=Ba.z.object({id:Ba.z.string().min(1).describe("Field id, unique within the question."),label:Ba.z.string().min(1).describe("Field label shown above the slider."),unit:Ba.z.string().optional().describe("Unit suffix shown next to the value."),min:Ba.z.number().finite().describe("Minimum allowed value."),max:Ba.z.number().finite().describe("Maximum allowed value."),step:Ba.z.number().positive().finite().default(1).describe("Slider increment."),default:Ba.z.number().finite().optional().describe("Initial value. Defaults to min."),description:Ba.z.string().optional().describe("Brief description of the field.")}).strict().superRefine((e,t)=>{if(e.max<=e.min){t.addIssue({code:Ba.z.ZodIssueCode.custom,path:["max"],message:`${e.id}: max (${e.max}) must be greater than min (${e.min}).`});return}if(e.step>e.max-e.min&&t.addIssue({code:Ba.z.ZodIssueCode.custom,path:["step"],message:`${e.id}: step (${e.step}) must not exceed max - min (${e.max-e.min}).`}),e.default===void 0)return;if(e.default<e.min||e.default>e.max){t.addIssue({code:Ba.z.ZodIssueCode.custom,path:["default"],message:`${e.id}: default (${e.default}) must be within [${e.min}, ${e.max}].`});return}let r=(e.default-e.min)/e.step;Math.abs(r-Math.round(r))>1e-9*Math.max(1,Math.abs(r))&&t.addIssue({code:Ba.z.ZodIssueCode.custom,path:["default"],message:`${e.id}: default (${e.default}) must fall on a step boundary (min ${e.min} plus a multiple of step ${e.step}).`})}),zj8=Ba.z.object({question:Ba.z.string().min(1,"question must not be empty").describe("Question text."),optional:Ba.z.boolean().default(!1).describe("User can skip without entering values."),header:Ba.z.string().optional(),fields:Ba.z.array(Aj8).min(1).describe("Numeric fields. One slider per field.").refine(e=>new Set(e.map(t=>t.id)).size===e.length,{message:"field ids must be unique within the question"}).superRefine((e,t)=>Al2(e.map(r=>r.label),"fields",t))}).strict(),bj8=Ba.z.object({type:Ba.z.literal("text").default("text").describe("Click or typed answer."),payload:Ba.z.preprocess(e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&!Object.prototype.hasOwnProperty.call(e,"options")?{...e,options:[]}:e,Cj8)}).strict(),Sj8=Ba.z.object({type:Ba.z.literal("media").describe("Record a process or upload an artifact."),payload:Mj8}).strict(),Hj8=Ba.z.object({type:Ba.z.literal("bucket").describe("Assign items to categories."),payload:yj8}).strict(),kj8=Ba.z.object({type:Ba.z.literal("numeric").describe("Pick numbers via labeled sliders."),payload:zj8}).strict(),Tj8=Ba.z.preprocess(Un3,Ba.z.discriminatedUnion("type",[bj8,Sj8,Hj8,kj8]).transform((e,t)=>{let r=Number(t.path[t.path.length-1])||0,a=VW2(r);if(e.type==="media"){let o=e.payload,h=o.header||"Question";return{type:"media",...o,id:a,header:h}}if(e.type==="bucket"){let o=e.payload,h=o.header||"Question";return{type:"bucket",...o,id:a,header:h}}if(e.type==="numeric"){let o=e.payload,h=o.header||"Question";return{type:"numeric",...o,id:a,header:h}}let i=e.payload,n=i.header||"Question";return{type:"text",...i,id:a,header:n}}));Pj8=Ba.z.object({intro:Ba.z.string().optional().describe("Optional preamble shown once above the questions."),questions:Ba.z.preprocess(yl2,Ba.z.array(Tj8).min(1)).describe("Questions to ask.")}),PW2=class e extends Yn{constructor(r){super(r);this.name="AskUser";this.friendlyName="Ask User";this.activationTrigger="Ask the user a clarifying question with options";this.inputSchema=Pj8;this.autoExecute=!0;this.isReadOnly=!0;this.availability="autopilotAgent";this.excludeFromAgents=!0;this.description='Ask the user clarifying questions during execution.\n\nWhen to ask:\n- Clarification after exploration\n- User preferences or requirements\n- Ambiguous instructions\n- Direction or approach decisions\n- Mid-task execution choices\n\nUsage notes:\n- Default type=text. Covers any click-or-type answer.\n- type=media is narrow: record a process or upload a pre-existing artifact.\n- type=bucket for assigning items to categories.\n- type=numeric for picking numbers via sliders.\n- One AskUser call at a time. Multiple questions \u2192 `questions` array, not multiple calls.\n- Questions in one call must be independent. Ask a dependent question in a later call, after the answer.\n- `intro` (optional): preamble shown once above the questions. Never put framing in a question entry; every `questions` entry is its own answerable step.\n- Use whenever you\'d bullet-list choices in chat for the user to pick. Bullet lists only to summarize or explain.\n- Don\'t ask "Should I proceed?" or "Does this look right?" \u2014 act on your best inference.\n\ntext:\n- `options`: predefined choices. Partial coverage or large spaces \u2192 list common choices, then the free-text branch:\n `"options": [{"label":"Weekly"}, {"label":"Monthly"}, {"kind":"userinput"}]`\n- `{"kind":"userinput"}` is the only choice that opens a text box. Max one per question; omit for exhaustive options.\n- Optional `label` retags it: `{"kind":"userinput","label":"Other destination"}`. Without one it renders as "Other".\n- A plain `{"label":"Other"}` is a normal choice \u2014 no text box, answers with the label. Use only for a terminal answer with nothing to type.\n- If recommending one option: put it first, suffix the label with "(Recommended)".\n- `options: []`: only for fully open-ended values.\n- Answer is a local folder path \u2192 `options: []` plus `folderPicker: true`; desktop hosts add a native picker, typing stays available.\n- Duplicate option labels fail validation.\n\nmedia (record OR upload):\n- `recordable: true`: only for "show me how you do X" process-step questions.\n- `attachable: true`: only when the user likely has a relevant existing file (SOPs, samples, screenshots, exports, audio recordings). Uploaded audio is transcribed and can be edited before submission.\n\nbucket (assignment grid):\n- Use when the user needs to sort items across named categories that share a structure.\n- `buckets`: 2 or more. Each has `id`, `label`, optional `subFields` (extra inputs shown only when an item is in that bucket, e.g. an "Auth" field for a "Primary" bucket). Sub-fields are required by default; set `optional: true` for ones the user may leave blank.\n- `items`: at least one. The list the user assigns.\n\nnumeric (sliders):\n- Use when the user picks a quantity with a sensible range.\n- `fields`: one labeled slider per number. Each needs `id`, `label`, `min`, `max`. Optional `unit`, `step`, `default`, `description`.\n- Group related sliders in one question rather than asking each separately.\n\nSkip when: you can find the answer by exploring or checking context, or a safe assumption is available (note it in the plan).'}validateProps(r,a){let i=this.inputSchema.safeParse(r);if(!i.success)return{valid:!1,errorsMessage:Vj8(i.error.issues)};if(this._getFeatures().recording)return!0;let n=i.data.questions.filter(h=>h.type==="media"&&h.recordable&&!h.attachable);return n.length===0?!0:{valid:!1,errorsMessage:`This host does not support in-app screen recording. The following media question(s) require recordable=true with no attachable fallback: ${n.map(h=>h.id).join(", ")}. Either set attachable=true so the user can submit a media file, or rephrase as a text question.`}}static{this.ASK_USER_TIMEOUT_MS=10080*60*1e3}async getExecutionTimeout(){return e.ASK_USER_TIMEOUT_MS}async execute(r,a){let{executionId:i,sessionId:n}=a,o=this._localSessionStore;if(!o)throw new Error("AskUser requires localSessionStore; none provided.");let h=o.getPendingUserQuestionSet(n,i);if(h===void 0)throw new Error(`AskUser invariant: question set ${i} missing in store; onPending did not run.`);return h.status==="answered"?new A2(h.userResponseMessage??""):h.status==="cancelled"?e._cancelledResponse():a.abortSignal.aborted?(o.cancelPendingUserQuestionSet(n,i),e._cancelledResponse()):new Promise(u=>{let g=()=>{v(),a.abortSignal.removeEventListener("abort",f)},f=()=>{g(),o.cancelPendingUserQuestionSet(n,i),u(e._cancelledResponse())},v=o.subscribePendingUserQuestionSet(n,i,C=>{switch(C.status){case"answered":g(),u(new A2(C.userResponseMessage??""));return;case"cancelled":g(),u(e._cancelledResponse());return;case"awaiting_response":return;default:return C.status}});a.abortSignal.addEventListener("abort",f,{once:!0})})}static _cancelledResponse(){return new A2("User cancelled this AskUser call by sending a new message. Do not re-ask; respond to the user's latest message.","interrupted")}onPending(r,a,i){this._localSessionStore&&this._localSessionStore.addPendingUserQuestionSet(a,{id:i,status:"awaiting_response"})}async getSubHeader(r){let a=yl2(r.questions),i=Array.isArray(a)?a.length:0;return`Asking ${i} clarifying question${i!==1?"s":""}...`}}});var mc1,Q54=C1(()=>{a7();LL();mc1=class{_dependencies;constructor(t){this._dependencies=t}async execute(t,r){let a=t.arguments.description;if(typeof a!="string"||a.trim().length===0)return new A2("Process Knowledge needs a non-empty `description` inside the operation `body`. This is not the top-level `description` field, which is only the UI label. Retry with body.description set to a few sentences: industry, goal, key current steps, systems.","error");try{let i=Nr.getHttpClient(r),n=Nr.getAuthProvider(r),h=await r.services.get(Bc).getAgenticLoopUrl(),u=h.length;for(;u>0&&h[u-1]==="/";)u--;let g=h.slice(0,u),f=await s9(n,r,g),v=this._dependencies.modelConfigProvider.getModelConfig(),C=await i.post(`${g}/v1/process-knowledge/retrieve`,{description:a,model:v.model_name},f);return new A2(this.formatResponse(C),"text")}catch(i){return new A2(`Failed to retrieve process knowledge: ${vj(i)}`,"error")}}formatResponse(t){if(!t?.matched)return"**No matching process found.**";let r=t.matches?.filter(i=>!!i.content)??[];if(r.length>0)return this.formatMatchesResponse(r);let a=t.content??"";return`${this.formatHeading(t)}
|
|
1544
|
+
- For loops: include position/item per entry; maintain a tally line you replace each iteration.`}async execute(r,a){let i={progress_edit:{mode:r.mode,old_string:r.old_string,new_string:r.new_string},current_step_number:r.step_number};r.completed&&(i.planning_phase="completed"),this._localSessionStore&&a.sessionId&&(this._localSessionStore.applyProgressEdit(a.sessionId,{mode:r.mode,old_string:r.old_string,new_string:r.new_string},r.step_number),r.completed===!0&&this._localSessionStore.completePlan(a.sessionId));let n=r.mode==="append"?"Added":"Updated",o=r.completed?" Plan completed!":"";return new A2(`${n} progress (Step ${r.step_number}).${o}`,"text",void 0,!1,{planningState:i})}validateProps(r,a){return!r.step_number||r.step_number<1?{valid:!1,errorsMessage:"step_number is required and must be at least 1"}:r.mode?r.new_string?r.mode==="replace"&&!r.old_string?{valid:!1,errorsMessage:"old_string is required for replace mode"}:!0:{valid:!1,errorsMessage:"new_string is required"}:{valid:!1,errorsMessage:'mode is required ("replace" or "append")'}}async getSubHeader(r){return r.completed?"Plan completed!":`${r.mode==="append"?"Adding":"Updating"} progress for step ${r.step_number}...`}}});function Rn3(e){return`opt_${e}`}function VW2(e){return`q_${e}`}function Zn3(e){return e.trim().toLowerCase().replace(/\s+/g," ")}var Fn3,q54=C1(()=>{Fn3="userinput"});function On3(e){try{let t=JSON.parse(e);return Array.isArray(t)?t:void 0}catch{return}}function oj8(e,t){for(let r=t;r<e.length;r++)if(!/\s/.test(e[r]))return e[r];return""}function lj8(e,t){return e.escaped?{inString:!0,escaped:!1}:t==="\\"?{inString:!0,escaped:!0}:t==='"'?Dn3:e}function cj8(e){let t=[],r=Dn3,a=0,i=0,n=()=>{a<=0||(t.push("}".repeat(a)),a=0)};for(let o=0;o<e.length;o++){let h=e[o];if(r.inString){t.push(h),r=lj8(r,h);continue}switch(h){case'"':r={inString:!0,escaped:!1};break;case"{":a++;break;case"}":a--;break;case"[":i++;break;case"]":i===1&&n(),i--;break;case",":i===1&&oj8(e,o+1)==="{"&&n();break;default:break}t.push(h)}return t.join("")}function yl2(e){if(typeof e!="string")return e;let t=On3(e);return t||(e.length>64e3?e:On3(cj8(e))??e)}var Dn3,$54=C1(()=>{Dn3={inString:!1,escaped:!1}});function KG1(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function K54(e,t){return Object.fromEntries(Object.entries(e).filter(([r])=>!t(r)))}function sj8(e,t){let r=Object.keys(e).filter(i=>In3.has(i));if(r.length===0)return e;let a={...t};for(let i of r)i in a||(a[i]=e[i]);return{...K54(e,i=>In3.has(i)),payload:a}}function hj8(e){let t=K54(e,r=>r==="type");return"type"in e?{type:e.type,payload:t}:{payload:t}}function dj8(e){return"fields"in e?"numeric":"buckets"in e||"items"in e?"bucket":"recordable"in e||"attachable"in e?"media":"text"}function uj8(e){if(!KG1(e.payload))return e;let t=e.payload.options;return!Array.isArray(t)||!t.some(r=>typeof r=="string")?e:{...e,payload:{...e.payload,options:t.map(r=>typeof r=="string"?{label:r}:r)}}}function gj8(e){if(e.type!=="media"||!KG1(e.payload))return e;let t=i=>i===void 0||i===!1,{recordable:r,attachable:a}=e.payload;return!t(r)||!t(a)?e:{...e,type:"text",payload:K54(e.payload,i=>i==="recordable"||i==="attachable")}}function Y54(e){if(!KG1(e))return{value:e,repairs:[]};if("payload"in e&&!KG1(e.payload))return{value:e,repairs:[]};let t=[],r="type"in e,a;if(KG1(e.payload)?(a=sj8(e,e.payload),a!==e&&t.push("keys_lifted")):(a=hj8(e),t.push("payload_wrapped")),!("type"in a)){let o=KG1(a.payload)?a.payload:{};a={...a,type:dj8(o)},t.push("type_inferred")}let i=gj8(a);i!==a&&r&&t.push("media_demoted");let n=uj8(i);return n!==i&&t.push("option_labels_recovered"),{value:n,repairs:t}}function Un3(e){return Y54(e).value}var In3,Nn3,X54=C1(()=>{In3=new Set(["question","header","optional"]);Nn3=["questions_unstringified","payload_wrapped","keys_lifted","type_inferred","media_demoted","option_labels_recovered"]});function J54(e){return"kind"in e&&e.kind==="userinput"}function Al2(e,t,r){let a={};for(let n of e)(a[Zn3(n)]??=[]).push(n);let i=[...new Set(Object.values(a).filter(n=>n.length>1).flat())];i.length!==0&&r.addIssue({code:Ba.z.ZodIssueCode.custom,message:`${t} must have distinct labels, but the following appear more than once: ${i.map(n=>`"${n}"`).join(", ")}. Use clearer, more distinct labels.`})}function mj8(e,t){e<=1||t.addIssue({code:Ba.z.ZodIssueCode.custom,message:`only one option can be the free-text choice, but ${e} carry {"kind":"userinput"}. Keep one and make the rest labelled choices.`})}function Bj8(e){let t="";for(let r of e)typeof r=="number"?t+=`[${r}]`:t===""?t=r:t+=`.${r}`;return t}function jn3(e){return e.flatMap(t=>{if(t.code===Ba.z.ZodIssueCode.invalid_union){let[a]=[...t.unionErrors].sort((i,n)=>i.issues.length-n.issues.length);return a?jn3(a.issues):[]}let r=Bj8(t.path);return[r?`${r}: ${t.message}`:t.message]})}function Vj8(e){let t=[...new Set(jn3(e))];return t.length>0?t.join("; "):"AskUser arguments are invalid."}var Ba,pj8,fj8,vj8,Cj8,Gn3,Mj8,xj8,Lj8,wj8,yj8,Aj8,zj8,bj8,Sj8,Hj8,kj8,Tj8,Pj8,PW2,Wn3=C1(()=>{Ba=w4(li());a7();Jv1();q54();$54();X54();pj8=Ba.z.object({label:Ba.z.string().trim().min(1).describe("Option text the user clicks."),description:Ba.z.string().optional().describe("Brief explanation of the option.")}).strict(),fj8=Ba.z.object({kind:Ba.z.literal("userinput"),label:Ba.z.string().trim().min(1).optional().describe('Wording for the choice, e.g. "Other destination".')}).strict().describe("Collects free-text input."),vj8=Ba.z.union([pj8,fj8]);Cj8=Ba.z.object({question:Ba.z.string().min(1,"question must not be empty").describe("Question text."),optional:Ba.z.boolean().default(!1).describe("User can skip without answering."),header:Ba.z.string().optional(),options:Ba.z.array(vj8).describe("Predefined choices, optionally with the free-text branch.").superRefine((e,t)=>{let r=e.map(a=>J54(a)?a.label??"Other":a.label);Al2(r,"options",t),mj8(e.filter(J54).length,t)}).transform(e=>e.map((t,r)=>J54(t)?{kind:"userinput",id:Fn3,...t.label===void 0?{}:{label:t.label}}:{...t,kind:"choice",id:Rn3(r)})),multiSelect:Ba.z.boolean().default(!1).describe("Allow multiple selections."),folderPicker:Ba.z.boolean().optional().describe("Set when the answer is a local folder path. Requires options: []. Desktop hosts add a native folder picker; typing stays available.")}).strict(),Gn3=Ba.z.object({question:Ba.z.string().min(1,"question must not be empty").describe("Question text."),optional:Ba.z.boolean().default(!1).describe("User can skip without answering."),header:Ba.z.string().optional()}),Mj8=Ba.z.union([Gn3.extend({recordable:Ba.z.literal(!0).describe("Show a Record button."),attachable:Ba.z.boolean().optional().describe("Show a file drop zone.")}).strict(),Gn3.extend({recordable:Ba.z.boolean().optional().describe("Show a Record button."),attachable:Ba.z.literal(!0).describe("Show a file drop zone.")}).strict()]),xj8=Ba.z.object({id:Ba.z.string().min(1).describe("Sub-field id, unique within the bucket."),label:Ba.z.string().min(1).describe("Sub-field label shown next to the input."),placeholder:Ba.z.string().optional().describe("Hint text for the sub-field input."),optional:Ba.z.boolean().default(!1).describe("Sub-field can be left blank.")}).strict(),Lj8=Ba.z.object({id:Ba.z.string().min(1).describe("Bucket id, unique within the question."),label:Ba.z.string().min(1).describe("Bucket label shown above the column."),subFields:Ba.z.preprocess(e=>Array.isArray(e)&&e.length===0?void 0:e,Ba.z.array(xj8).optional()).describe("Per-item sub-fields shown only when an item lands in this bucket.")}).strict(),wj8=Ba.z.object({id:Ba.z.string().min(1).describe("Item id, unique within the question."),label:Ba.z.string().min(1).describe("Item label shown in the column."),description:Ba.z.string().optional().describe("Brief description of the item.")}).strict(),yj8=Ba.z.object({question:Ba.z.string().min(1,"question must not be empty").describe("Question text."),optional:Ba.z.boolean().default(!1).describe("User can skip without assigning items."),header:Ba.z.string().optional(),buckets:Ba.z.array(Lj8).min(2).describe("Buckets to assign items to. At least 2.").refine(e=>new Set(e.map(t=>t.id)).size===e.length,{message:"bucket ids must be unique within the question"}).refine(e=>e.every(t=>!t.subFields||new Set(t.subFields.map(r=>r.id)).size===t.subFields.length),{message:"sub-field ids must be unique within their bucket"}).superRefine((e,t)=>{Al2(e.map(r=>r.label),"buckets",t);for(let r of e)r.subFields&&Al2(r.subFields.map(a=>a.label),`sub-fields of bucket "${r.label}"`,t)}),items:Ba.z.array(wj8).min(1).describe("Items the user assigns to buckets.").refine(e=>new Set(e.map(t=>t.id)).size===e.length,{message:"item ids must be unique within the question"}).superRefine((e,t)=>Al2(e.map(r=>r.label),"items",t))}).strict(),Aj8=Ba.z.object({id:Ba.z.string().min(1).describe("Field id, unique within the question."),label:Ba.z.string().min(1).describe("Field label shown above the slider."),unit:Ba.z.string().optional().describe("Unit suffix shown next to the value."),min:Ba.z.number().finite().describe("Minimum allowed value."),max:Ba.z.number().finite().describe("Maximum allowed value."),step:Ba.z.number().positive().finite().default(1).describe("Slider increment."),default:Ba.z.number().finite().optional().describe("Initial value. Defaults to min."),description:Ba.z.string().optional().describe("Brief description of the field.")}).strict().superRefine((e,t)=>{if(e.max<=e.min){t.addIssue({code:Ba.z.ZodIssueCode.custom,path:["max"],message:`${e.id}: max (${e.max}) must be greater than min (${e.min}).`});return}if(e.step>e.max-e.min&&t.addIssue({code:Ba.z.ZodIssueCode.custom,path:["step"],message:`${e.id}: step (${e.step}) must not exceed max - min (${e.max-e.min}).`}),e.default===void 0)return;if(e.default<e.min||e.default>e.max){t.addIssue({code:Ba.z.ZodIssueCode.custom,path:["default"],message:`${e.id}: default (${e.default}) must be within [${e.min}, ${e.max}].`});return}let r=(e.default-e.min)/e.step;Math.abs(r-Math.round(r))>1e-9*Math.max(1,Math.abs(r))&&t.addIssue({code:Ba.z.ZodIssueCode.custom,path:["default"],message:`${e.id}: default (${e.default}) must fall on a step boundary (min ${e.min} plus a multiple of step ${e.step}).`})}),zj8=Ba.z.object({question:Ba.z.string().min(1,"question must not be empty").describe("Question text."),optional:Ba.z.boolean().default(!1).describe("User can skip without entering values."),header:Ba.z.string().optional(),fields:Ba.z.array(Aj8).min(1).describe("Numeric fields. One slider per field.").refine(e=>new Set(e.map(t=>t.id)).size===e.length,{message:"field ids must be unique within the question"}).superRefine((e,t)=>Al2(e.map(r=>r.label),"fields",t))}).strict(),bj8=Ba.z.object({type:Ba.z.literal("text").default("text").describe("Click or typed answer."),payload:Ba.z.preprocess(e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&!Object.prototype.hasOwnProperty.call(e,"options")?{...e,options:[]}:e,Cj8)}).strict(),Sj8=Ba.z.object({type:Ba.z.literal("media").describe("Record a process or upload an artifact."),payload:Mj8}).strict(),Hj8=Ba.z.object({type:Ba.z.literal("bucket").describe("Assign items to categories."),payload:yj8}).strict(),kj8=Ba.z.object({type:Ba.z.literal("numeric").describe("Pick numbers via labeled sliders."),payload:zj8}).strict(),Tj8=Ba.z.preprocess(Un3,Ba.z.discriminatedUnion("type",[bj8,Sj8,Hj8,kj8]).transform((e,t)=>{let r=Number(t.path[t.path.length-1])||0,a=VW2(r);if(e.type==="media"){let o=e.payload,h=o.header||"Question";return{type:"media",...o,id:a,header:h}}if(e.type==="bucket"){let o=e.payload,h=o.header||"Question";return{type:"bucket",...o,id:a,header:h}}if(e.type==="numeric"){let o=e.payload,h=o.header||"Question";return{type:"numeric",...o,id:a,header:h}}let i=e.payload,n=i.header||"Question";return{type:"text",...i,id:a,header:n}}));Pj8=Ba.z.object({intro:Ba.z.string().optional().describe("Optional preamble shown once above the questions."),questions:Ba.z.preprocess(yl2,Ba.z.array(Tj8).min(1)).describe("Questions to ask.")}),PW2=class e extends Yn{constructor(r){super(r);this.name="AskUser";this.friendlyName="Ask User";this.activationTrigger="Ask the user a clarifying question with options";this.inputSchema=Pj8;this.autoExecute=!0;this.isReadOnly=!0;this.availability="autopilotAgent";this.excludeFromAgents=!0;this.description='Ask the user clarifying questions during execution.\n\nWhen to ask:\n- Clarification after exploration\n- User preferences or requirements\n- Ambiguous instructions\n- Direction or approach decisions\n- Mid-task execution choices\n\nUsage notes:\n- Default type=text. Covers any click-or-type answer.\n- type=media is narrow: record a process or upload a pre-existing artifact.\n- type=bucket for assigning items to categories.\n- type=numeric for picking numbers via sliders.\n- One AskUser call at a time. Multiple questions \u2192 `questions` array, not multiple calls.\n- Questions in one call must be independent. Ask a dependent question in a later call, after the answer.\n- `intro` (optional): preamble shown once above the questions. Never put framing in a question entry; every `questions` entry is its own answerable step.\n- Use whenever you\'d bullet-list choices in chat for the user to pick. Bullet lists only to summarize or explain.\n- Don\'t ask "Should I proceed?" or "Does this look right?" \u2014 act on your best inference.\n\ntext:\n- `options`: predefined choices. Partial coverage or large spaces \u2192 list common choices, then the free-text branch:\n `"options": [{"label":"Weekly"}, {"label":"Monthly"}, {"kind":"userinput"}]`\n- `{"kind":"userinput"}` is the only choice that opens a text box. Max one per question; omit for exhaustive options.\n- Optional `label` retags it: `{"kind":"userinput","label":"Other destination"}`. Without one it renders as "Other".\n- A plain `{"label":"Other"}` is a normal choice \u2014 no text box, answers with the label. Use only for a terminal answer with nothing to type.\n- If recommending one option: put it first, suffix the label with "(Recommended)".\n- `options: []`: only for fully open-ended values.\n- Answer is a local folder path \u2192 `options: []` plus `folderPicker: true`; desktop hosts add a native picker, typing stays available.\n- Duplicate option labels fail validation.\n\nmedia (record OR upload):\n- `recordable: true`: only for "show me how you do X" process-step questions.\n- `attachable: true`: only when the user likely has a relevant existing file (SOPs, samples, screenshots, exports, audio recordings). Uploaded audio is transcribed and can be edited before submission.\n\nbucket (assignment grid):\n- Use when the user needs to sort items across named categories that share a structure.\n- `buckets`: 2 or more. Each has `id`, `label`, optional `subFields` (extra inputs shown only when an item is in that bucket, e.g. an "Auth" field for a "Primary" bucket). Sub-fields are required by default; set `optional: true` for ones the user may leave blank.\n- `items`: at least one. The list the user assigns.\n\nnumeric (sliders):\n- Use when the user picks a quantity with a sensible range.\n- `fields`: one labeled slider per number. Each needs `id`, `label`, `min`, `max`. Optional `unit`, `step`, `default`, `description`.\n- Group related sliders in one question rather than asking each separately.\n\nSkip when: you can find the answer by exploring or checking context, or a safe assumption is available (note it in the plan).'}validateProps(r,a){let i=this.inputSchema.safeParse(r);if(!i.success)return{valid:!1,errorsMessage:Vj8(i.error.issues)};if(this._getFeatures().recording)return!0;let n=i.data.questions.filter(h=>h.type==="media"&&h.recordable&&!h.attachable);return n.length===0?!0:{valid:!1,errorsMessage:`This host does not support in-app screen recording. The following media question(s) require recordable=true with no attachable fallback: ${n.map(h=>h.id).join(", ")}. Either set attachable=true so the user can submit a media file, or rephrase as a text question.`}}static{this.ASK_USER_TIMEOUT_MS=10080*60*1e3}async getExecutionTimeout(){return e.ASK_USER_TIMEOUT_MS}async execute(r,a){let{executionId:i,sessionId:n}=a,o=this._localSessionStore;if(!o)throw new Error("AskUser requires localSessionStore; none provided.");let h=o.getPendingUserQuestionSet(n,i);if(h===void 0)throw new Error(`AskUser invariant: question set ${i} missing in store; onPending did not run.`);return h.status==="answered"?new A2(h.userResponseMessage??""):h.status==="cancelled"?e._cancelledResponse():a.abortSignal.aborted?(o.cancelPendingUserQuestionSet(n,i),e._cancelledResponse()):new Promise(u=>{let g=()=>{v(),a.abortSignal.removeEventListener("abort",f)},f=()=>{g(),o.cancelPendingUserQuestionSet(n,i),u(e._cancelledResponse())},v=o.subscribePendingUserQuestionSet(n,i,C=>{switch(C.status){case"answered":g(),u(new A2(C.userResponseMessage??""));return;case"cancelled":g(),u(e._cancelledResponse());return;case"awaiting_response":return;default:return C.status}});a.abortSignal.addEventListener("abort",f,{once:!0})})}static _cancelledResponse(){return new A2("User cancelled this AskUser call by sending a new message. Do not re-ask; respond to the user's latest message.","interrupted")}onPending(r,a,i){this._localSessionStore&&this._localSessionStore.addPendingUserQuestionSet(a,{id:i,status:"awaiting_response"})}async getSubHeader(r){let a=yl2(r.questions),i=Array.isArray(a)?a.length:0;return`Asking ${i} clarifying question${i!==1?"s":""}...`}}});var mc1,Q54=C1(()=>{a7();LL();mc1=class{_dependencies;constructor(t){this._dependencies=t}async execute(t,r){let a=t.arguments.description;if(typeof a!="string"||a.trim().length===0)return new A2("Process Knowledge needs a non-empty `description` inside the operation `body`. This is not the top-level `description` field, which is only the UI label. Retry with body.description set to a few sentences: industry, goal, key current steps, systems.","error");try{let i=Nr.getHttpClient(r),n=Nr.getAuthProvider(r),h=await r.services.get(Bc).getAgenticLoopUrl(),u=h.length;for(;u>0&&h[u-1]==="/";)u--;let g=h.slice(0,u),f=await s9(n,r,g),v=this._dependencies.modelConfigProvider.getModelConfig(),C=await i.post(`${g}/v1/process-knowledge/retrieve`,{description:a,model:v.model_name},f);return new A2(this.formatResponse(C),"text")}catch(i){return new A2(`Failed to retrieve process knowledge: ${vj(i)}`,"error")}}formatResponse(t){if(!t?.matched)return"**No matching process found.**";let r=t.matches?.filter(i=>!!i.content)??[];if(r.length>0)return this.formatMatchesResponse(r);let a=t.content??"";return`${this.formatHeading(t)}
|
|
1545
1545
|
|
|
1546
1546
|
${a}`}formatMatchesResponse(t){if(t.length===1){let[i]=t;return`**Process knowledge: ${this.formatMatchLabel(i)}:**
|
|
1547
1547
|
|
|
@@ -1604,10 +1604,10 @@ Use the returned credential name and folder type with AppAct's type_from_credent
|
|
|
1604
1604
|
Did you mean:`;for(let o of i)n+=`
|
|
1605
1605
|
- ${o}`;return n}catch{return""}}async function ym1(e,t,r,a){let i="Path does not exist";r==="file"?i="File path does not exist":r==="directory"&&(i="Directory path does not exist");let n=t?`${i}: ${t}.`:`${i}.`;return t&&(n+=await wm1(e,t,r,a)),new A2(n,"error")}var Qn3,Sl2=C1(()=>{a7();Qn3=5});async function FW2(e,t,r,a){let i=await e();if(!i.blockedBySandbox)return i;let n=Nr.getElevationApprovalService(r);if(!n||!i.canElevate)throw new Error(ZW2(a,i));if(!(await n.requestApproval({executionId:r.executionId,toolName:a,command:t,reason:i.sandboxReason??"Blocked by sandbox security policy",suggestedElevationReason:i.suggestedElevationReason,sessionId:r.sessionId})).approved)throw new Error(ZW2(a,i));let h=await n.requestElevationToken(r.sessionId);if(!h)throw new Error(ZW2(a,i));let u=await e(h);if(u.blockedBySandbox)throw new Error(ZW2(a,u));return u}function ZW2(e,t){let r=`${e} BLOCKED by sandbox security policy.`;return t.sandboxReason&&(r+=`
|
|
1606
1606
|
Reason: ${t.sandboxReason}`),t.canElevate&&t.suggestedElevationReason&&(r+=`
|
|
1607
|
-
This command can be elevated with user approval: ${t.suggestedElevationReason}`),r}var r64=C1(()=>{Tx()});function to3(e){let t=Cc1.splitAbsolutePattern(e.pattern);return t?{...e,pattern:t.relativePattern,path:t.baseDir}:e}function Dj8(e,t){let r={pattern:e.pattern,path:e.path,exclude:e.exclude,max_depth:e.max_depth,sort_by:e.sort_by,output_mode:e.output_mode,head_limit:e.head_limit,offset:e.offset,include_hidden:e.include_hidden};return t&&(r.elevationToken=t),r}function Ij8(e){return`glob "${e.pattern}" in ${e.path}`}function i64(e){return!(e!=null&&(e<0||!Number.isInteger(e)))}function Hl2(e,t,r){let a=[];return e>0&&r>=e&&a.push(`limit: ${e}`),t>0&&a.push(`offset: ${t}`),a}var w31,Fj8,a64,Oj8,Cc1,OW2=C1(()=>{a7();w31=w4(li());QH();Sl2();vQ();r64();Fj8=w31.z.object({pattern:w31.z.string().describe("Glob pattern to match files against."),path:w31.z.string().describe("REQUIRED. Absolute directory path to search."),exclude:w31.z.string().optional().describe("Glob pattern to exclude."),max_depth:w31.z.number().optional().describe("Max directory depth (default: unlimited)."),sort_by:w31.z.enum(["modified","name","size","none"]).optional().describe('"none" (default, fastest), "modified" (newest first), "name" (alphabetical), "size" (largest first).'),output_mode:w31.z.enum(["files","count"]).optional().describe('"files" (default): list paths. "count": number of matching files only.'),head_limit:w31.z.number().optional().describe("Limit to first N entries (default 0 = unlimited)."),offset:w31.z.number().optional().describe("Skip first N entries before head_limit (default 0)."),include_hidden:w31.z.boolean().optional().describe("Include hidden files and ignore .gitignore (default false).")}),a64=/(?:^|[\\/])\.\.(?:[\\/]|$)|%2e%2e/i,Oj8="(Results are truncated. Consider using a more specific path or pattern, or use head_limit/offset to paginate.)",Cc1=class e{static findFirstUnescapedGlobChar(t,r=!1){if(r){let a=t.match(/[*?\[{]/);return a?a.index:-1}for(let a of t.matchAll(/\\.|[*?\[{]/g))if(a[0].length===1)return a.index;return-1}static formatFileSize(t){if(t<=0)return"0 B";let r=1024,a=["B","KB","MB","GB"],i=Math.min(Math.floor(Math.log(t)/Math.log(r)),a.length-1);return`${parseFloat((t/Math.pow(r,i)).toFixed(1))} ${a[i]}`}static splitAbsolutePattern(t){let r=t.startsWith("/"),a=/^[A-Za-z]:[/\\]/.test(t);if(!r&&!a)return null;let i=e.findFirstUnescapedGlobChar(t,a),n=f=>a?Math.max(f.lastIndexOf("/"),f.lastIndexOf("\\")):f.lastIndexOf("/");if(i===-1){let f=n(t);if(f<=0&&r){let L=t.substring(1);return L?{baseDir:"/",relativePattern:L}:null}if(f===-1)return null;let v=t.substring(f+1);if(!v)return null;let C=t.substring(0,f);return a&&/^[A-Za-z]:$/.test(C)&&(C+="\\"),{baseDir:C,relativePattern:v}}let o=t.substring(0,i),h=n(o);if(h<=0&&r){let f=t.substring(1);return f?{baseDir:"/",relativePattern:f}:null}if(h===-1)return null;let u=t.substring(0,h),g=t.substring(h+1);return g?(a&&/^[A-Za-z]:$/.test(u)&&(u+="\\"),{baseDir:u,relativePattern:g}):null}
|
|
1607
|
+
This command can be elevated with user approval: ${t.suggestedElevationReason}`),r}var r64=C1(()=>{Tx()});function to3(e){let t=Cc1.splitAbsolutePattern(e.pattern);return t?{...e,pattern:t.relativePattern,path:t.baseDir}:e}function Dj8(e,t){let r={pattern:e.pattern,path:e.path,exclude:e.exclude,max_depth:e.max_depth,sort_by:e.sort_by,output_mode:e.output_mode,head_limit:e.head_limit,offset:e.offset,include_hidden:e.include_hidden};return t&&(r.elevationToken=t),r}function Ij8(e){return`glob "${e.pattern}" in ${e.path}`}function i64(e){return!(e!=null&&(e<0||!Number.isInteger(e)))}function Hl2(e,t,r){let a=[];return e>0&&r>=e&&a.push(`limit: ${e}`),t>0&&a.push(`offset: ${t}`),a}var w31,Fj8,a64,Oj8,Cc1,OW2=C1(()=>{a7();w31=w4(li());QH();Sl2();vQ();r64();Fj8=w31.z.object({pattern:w31.z.string().describe("Glob pattern to match files against."),path:w31.z.string().describe("REQUIRED. Absolute directory path to search."),exclude:w31.z.string().optional().describe("Glob pattern to exclude."),max_depth:w31.z.number().optional().describe("Max directory depth (default: unlimited)."),sort_by:w31.z.enum(["modified","name","size","none"]).optional().describe('"none" (default, fastest), "modified" (newest first), "name" (alphabetical), "size" (largest first).'),output_mode:w31.z.enum(["files","count"]).optional().describe('"files" (default): list paths. "count": number of matching files only.'),head_limit:w31.z.number().optional().describe("Limit to first N entries (default 0 = unlimited)."),offset:w31.z.number().optional().describe("Skip first N entries before head_limit (default 0)."),include_hidden:w31.z.boolean().optional().describe("Include hidden files and ignore .gitignore (default false).")}),a64=/(?:^|[\\/])\.\.(?:[\\/]|$)|%2e%2e/i,Oj8="(Results are truncated. Consider using a more specific path or pattern, or use head_limit/offset to paginate.)",Cc1=class e{constructor(t,r){this.name="Glob";this.friendlyName="Glob";this.autoExecute=!0;this.isReadOnly=!0;this.isOffloadable=!0;this.availability="autopilotAgent";this.inputSchema=Fj8;this.description='Fast file-by-name pattern matching across the filesystem.\n\n- ALWAYS use Glob for file-by-name search. NEVER invoke `find`, `ls`, `Get-ChildItem`, or `dir` via ExecuteBashCommand/ExecutePowershellCommand.\n- Patterns: `*.pdf`, `*.{jpg,png}`, `report*`, `**/*.docx`.\n- Brackets = character classes (`[0-9]`). Escape for literals: `file\\[name\\].txt`.\n- Unsorted by default (fastest). Use sort_by for modified/name/size.\n- exclude filters noise (e.g. "node_modules"); max_depth limits recursion.\n- output_mode="count" returns only the count.\n- head_limit/offset paginate large result sets.\n- IMPORTANT: path is REQUIRED. Must be a specific directory \u2014 do NOT pass /, ~, or C:\\. Use targeted paths like ~/Documents or ~/Desktop.\n- Speculatively run multiple searches in parallel when potentially useful.';this._search=t,this._pathSuggestions=r}static findFirstUnescapedGlobChar(t,r=!1){if(r){let a=t.match(/[*?\[{]/);return a?a.index:-1}for(let a of t.matchAll(/\\.|[*?\[{]/g))if(a[0].length===1)return a.index;return-1}static formatFileSize(t){if(t<=0)return"0 B";let r=1024,a=["B","KB","MB","GB"],i=Math.min(Math.floor(Math.log(t)/Math.log(r)),a.length-1);return`${parseFloat((t/Math.pow(r,i)).toFixed(1))} ${a[i]}`}static splitAbsolutePattern(t){let r=t.startsWith("/"),a=/^[A-Za-z]:[/\\]/.test(t);if(!r&&!a)return null;let i=e.findFirstUnescapedGlobChar(t,a),n=f=>a?Math.max(f.lastIndexOf("/"),f.lastIndexOf("\\")):f.lastIndexOf("/");if(i===-1){let f=n(t);if(f<=0&&r){let L=t.substring(1);return L?{baseDir:"/",relativePattern:L}:null}if(f===-1)return null;let v=t.substring(f+1);if(!v)return null;let C=t.substring(0,f);return a&&/^[A-Za-z]:$/.test(C)&&(C+="\\"),{baseDir:C,relativePattern:v}}let o=t.substring(0,i),h=n(o);if(h<=0&&r){let f=t.substring(1);return f?{baseDir:"/",relativePattern:f}:null}if(h===-1)return null;let u=t.substring(0,h),g=t.substring(h+1);return g?(a&&/^[A-Za-z]:$/.test(u)&&(u+="\\"),{baseDir:u,relativePattern:g}):null}canRunInParallel(t,r){return!0}canExecute(t,r){return!0}canRevert(t,r){return!1}async revert(t,r){return new A2("Cannot revert glob operation","error")}validateProps(t,r){if(!t.pattern||t.pattern.trim()==="")return{valid:!1,errorsMessage:"pattern is required and cannot be empty."};let a=e.splitAbsolutePattern(t.pattern),i=t.pattern.startsWith("~/")||t.pattern.startsWith("~\\");return(!t.path||t.path.trim()==="")&&!a&&!i?{valid:!1,errorsMessage:"path is required. You must provide an absolute directory path to search in."}:t.path&&a64.test(t.path)?{valid:!1,errorsMessage:"Path traversal detected in path."}:t.exclude&&a64.test(t.exclude)?{valid:!1,errorsMessage:"Path traversal detected in exclude."}:i64(t.max_depth)?i64(t.head_limit)?i64(t.offset)?a&&a64.test(a.baseDir)?{valid:!1,errorsMessage:"Path traversal detected in pattern."}:!0:{valid:!1,errorsMessage:"offset must be a non-negative integer."}:{valid:!1,errorsMessage:"head_limit must be a non-negative integer."}:{valid:!1,errorsMessage:"max_depth must be a non-negative integer."}}async execute(t,r){let a=kx(r);try{let i=to3(t),n=await FW2(o=>this._search.glob(Dj8(i,o),a),Ij8(i),r,this.name);return n.blockedByPolicy?new A2(n.policyBlockReason||"Search blocked by your security policy.","error"):n.notFound?await ym1(this._pathSuggestions,i.path,"directory",a):await this._formatGlobResult(n,i,a)}catch(i){let n=i instanceof Error?i.message:String(i);return new A2(`Glob error: ${n}`,"error")}}async getSubHeader(t){let r=to3(t),a=Ly(r.path),i=[];t.output_mode==="count"&&i.push("count"),t.sort_by&&t.sort_by!=="none"&&i.push(t.sort_by);let n=i.length>0?` (${i.join(", ")})`:"";return`glob "${r.pattern}" in ${a}${n}`}async _formatGlobResult(t,r,a){let i=r.output_mode||"files",n=t.truncated===!0&&t.truncationReason==="byte-cap";return i==="count"?await this._formatCountMode(t,r,a):await this._formatFilesMode(t,r,n,a)}async _formatCountMode(t,r,a){let i=t.counts??[],n=i.length>0?i[0].count:0;if(n===0&&r.path){let o=await wm1(this._pathSuggestions,r.path,"directory",a);if(o)return new A2(`Found 0 files.${o}`)}return new A2(n===0?"Found 0 files.":`Found ${n} files.`)}async _formatFilesMode(t,r,a,i){let n=t.files??[];if(n.length===0){if(r.path){let C=await wm1(this._pathSuggestions,r.path,"directory",i);if(C)return A2.warning({notice:`No files found.${C}`},"success")}return A2.warning({notice:"No files found."},"success")}let o=r.sort_by||"none",h=r.head_limit||0,u=r.offset||0,g=Hl2(h,u,n.length),f=g.length>0?` ${g.join(", ")}`:"",v=`Found ${n.length} files${f}
|
|
1608
1608
|
`;if(o==="size")for(let C of n){let L=C.line??0,y=e.formatFileSize(L).padStart(10);v+=`${y} ${C.path}
|
|
1609
1609
|
`}else for(let C of n)v+=`${C.path}
|
|
1610
|
-
`;return a&&(v+=Oj8),new A2(v.trimEnd())}}});function jj8(e,t){let r={pattern:e.pattern,path:e.path,output_mode:e.output_mode,glob:e.glob,type:e.type,context_before:e.context_before,context_after:e.context_after,context:e.context,case_insensitive:e.case_insensitive,line_numbers:e.line_numbers,multiline:e.multiline,head_limit:e.head_limit,offset:e.offset,max_columns:e.max_columns,include_hidden:e.include_hidden};return t&&(r.elevationToken=t),r}function Wj8(e){let t=e.output_mode||"files_with_matches";return`grep "${e.pattern}" in ${e.path??"cwd"} (${t})`}function qj8(e){let t=e.text??"";return e.path?e.line!=null?`${e.path}:${e.line}:${t}`:`${e.path}:${t}`:t}function XG1(e){return!(e!=null&&(e<0||!Number.isInteger(e)))}function o64(e){if(e.head_limit===0)return 0;if(e.head_limit&&e.head_limit>0)return e.head_limit;let t=e.output_mode||"files_with_matches";return Gj8[t]??100}var wR,Nj8,Uj8,Gj8,Am1,n64,l64=C1(()=>{a7();wR=w4(li());QH();Sl2();vQ();r64();OW2();Nj8=wR.z.object({pattern:wR.z.string().describe("Regex pattern (ripgrep syntax)."),path:wR.z.string().optional().describe("File/directory to search (default: cwd)."),output_mode:wR.z.enum(["content","files_with_matches","count"]).optional().describe('"files_with_matches" (default): file paths. "content": matching lines with line numbers. "count": match counts per file.'),glob:wR.z.string().optional().describe('Glob filter (e.g. "*.js", "*.{ts,tsx}").'),type:wR.z.string().optional().describe('File type filter (e.g. "js", "py", "rust") \u2014 faster than glob for standard types.'),context_before:wR.z.number().optional().describe('Lines before each match (default 0). Requires output_mode="content".'),context_after:wR.z.number().optional().describe('Lines after each match (default 0). Requires output_mode="content".'),context:wR.z.number().optional().describe('Lines before AND after each match (default 0). Requires output_mode="content".'),case_insensitive:wR.z.boolean().optional().describe("Case-insensitive (default false)."),line_numbers:wR.z.boolean().optional().describe('Show line numbers (default true). Requires output_mode="content".'),multiline:wR.z.boolean().optional().describe("Pattern can span lines, . matches newlines (default false)."),head_limit:wR.z.number().optional().describe("Limit output to first N entries. Defaults: files_with_matches=100, content=150, count=100. 0 = unlimited."),offset:wR.z.number().optional().describe("Skip first N entries before head_limit (default 0)."),max_columns:wR.z.number().optional().describe("Max chars per line before truncation (default 1000)."),include_hidden:wR.z.boolean().optional().describe("Include hidden files and ignore .gitignore (default false).")}),Uj8=/(?:^|[\\/])\.\.(?:[\\/]|$)|%2e%2e/i,Gj8={files_with_matches:100,content:150,count:100},Am1=class{name="Grep";friendlyName="Grep";autoExecute=!0;isReadOnly=!0;isOffloadable=!0;activationTrigger="Search text content in files (ripgrep)";availability="autopilotAgent";inputSchema=Nj8;description='Search file contents with ripgrep (rg). Regex, glob/type filtering, multi-line, context lines, head-limit pagination.\n\n- ALWAYS use Grep for file content search. NEVER invoke `grep`, `rg`, `Select-String`, `find`, or `Get-ChildItem` via ExecuteBashCommand/ExecutePowershellCommand.\n- Context params require output_mode="content" (silently ignored otherwise). Use 2-3 lines for orientation, 5-10 for surrounding logic.\n- Patterns match single lines by default; multiline=true for cross-line patterns.\n- Preferred over ReadFile for offloaded memory files \u2014 faster, more targeted.\n- Always provide a specific path \u2014 avoid /, ~, or C:\\.\n- Results capped by default (files:100, content:150, count:100). Use head_limit/offset to paginate. head_limit=0 = unlimited (sparingly).\n- If truncated, refine or paginate \u2014 do NOT retry the same search.';
|
|
1610
|
+
`;return a&&(v+=Oj8),new A2(v.trimEnd())}}});function jj8(e,t){let r={pattern:e.pattern,path:e.path,output_mode:e.output_mode,glob:e.glob,type:e.type,context_before:e.context_before,context_after:e.context_after,context:e.context,case_insensitive:e.case_insensitive,line_numbers:e.line_numbers,multiline:e.multiline,head_limit:e.head_limit,offset:e.offset,max_columns:e.max_columns,include_hidden:e.include_hidden};return t&&(r.elevationToken=t),r}function Wj8(e){let t=e.output_mode||"files_with_matches";return`grep "${e.pattern}" in ${e.path??"cwd"} (${t})`}function qj8(e){let t=e.text??"";return e.path?e.line!=null?`${e.path}:${e.line}:${t}`:`${e.path}:${t}`:t}function XG1(e){return!(e!=null&&(e<0||!Number.isInteger(e)))}function o64(e){if(e.head_limit===0)return 0;if(e.head_limit&&e.head_limit>0)return e.head_limit;let t=e.output_mode||"files_with_matches";return Gj8[t]??100}var wR,Nj8,Uj8,Gj8,Am1,n64,l64=C1(()=>{a7();wR=w4(li());QH();Sl2();vQ();r64();OW2();Nj8=wR.z.object({pattern:wR.z.string().describe("Regex pattern (ripgrep syntax)."),path:wR.z.string().optional().describe("File/directory to search (default: cwd)."),output_mode:wR.z.enum(["content","files_with_matches","count"]).optional().describe('"files_with_matches" (default): file paths. "content": matching lines with line numbers. "count": match counts per file.'),glob:wR.z.string().optional().describe('Glob filter (e.g. "*.js", "*.{ts,tsx}").'),type:wR.z.string().optional().describe('File type filter (e.g. "js", "py", "rust") \u2014 faster than glob for standard types.'),context_before:wR.z.number().optional().describe('Lines before each match (default 0). Requires output_mode="content".'),context_after:wR.z.number().optional().describe('Lines after each match (default 0). Requires output_mode="content".'),context:wR.z.number().optional().describe('Lines before AND after each match (default 0). Requires output_mode="content".'),case_insensitive:wR.z.boolean().optional().describe("Case-insensitive (default false)."),line_numbers:wR.z.boolean().optional().describe('Show line numbers (default true). Requires output_mode="content".'),multiline:wR.z.boolean().optional().describe("Pattern can span lines, . matches newlines (default false)."),head_limit:wR.z.number().optional().describe("Limit output to first N entries. Defaults: files_with_matches=100, content=150, count=100. 0 = unlimited."),offset:wR.z.number().optional().describe("Skip first N entries before head_limit (default 0)."),max_columns:wR.z.number().optional().describe("Max chars per line before truncation (default 1000)."),include_hidden:wR.z.boolean().optional().describe("Include hidden files and ignore .gitignore (default false).")}),Uj8=/(?:^|[\\/])\.\.(?:[\\/]|$)|%2e%2e/i,Gj8={files_with_matches:100,content:150,count:100},Am1=class{constructor(t,r){this.name="Grep";this.friendlyName="Grep";this.autoExecute=!0;this.isReadOnly=!0;this.isOffloadable=!0;this.activationTrigger="Search text content in files (ripgrep)";this.availability="autopilotAgent";this.inputSchema=Nj8;this.description='Search file contents with ripgrep (rg). Regex, glob/type filtering, multi-line, context lines, head-limit pagination.\n\n- ALWAYS use Grep for file content search. NEVER invoke `grep`, `rg`, `Select-String`, `find`, or `Get-ChildItem` via ExecuteBashCommand/ExecutePowershellCommand.\n- Context params require output_mode="content" (silently ignored otherwise). Use 2-3 lines for orientation, 5-10 for surrounding logic.\n- Patterns match single lines by default; multiline=true for cross-line patterns.\n- Preferred over ReadFile for offloaded memory files \u2014 faster, more targeted.\n- Always provide a specific path \u2014 avoid /, ~, or C:\\.\n- Results capped by default (files:100, content:150, count:100). Use head_limit/offset to paginate. head_limit=0 = unlimited (sparingly).\n- If truncated, refine or paginate \u2014 do NOT retry the same search.';this._search=t,this._pathSuggestions=r}canRunInParallel(t,r){return!0}canExecute(t,r){return!0}canRevert(t,r){return!1}async revert(t,r){return new A2("Cannot revert grep operation","error")}validateProps(t,r){return!t.pattern||t.pattern.trim()===""?{valid:!1,errorsMessage:"pattern is required and cannot be empty."}:t.path&&Uj8.test(t.path)?{valid:!1,errorsMessage:"Path traversal detected in path."}:XG1(t.head_limit)?XG1(t.offset)?XG1(t.context)?XG1(t.context_before)?XG1(t.context_after)?XG1(t.max_columns)?!0:{valid:!1,errorsMessage:"max_columns must be a non-negative integer."}:{valid:!1,errorsMessage:"context_after must be a non-negative integer."}:{valid:!1,errorsMessage:"context_before must be a non-negative integer."}:{valid:!1,errorsMessage:"context must be a non-negative integer."}:{valid:!1,errorsMessage:"offset must be a non-negative integer."}:{valid:!1,errorsMessage:"head_limit must be a non-negative integer."}}async execute(t,r){let a=kx(r);try{let i=await FW2(n=>this._search.grep(jj8(t,n),a),Wj8(t),r,this.name);return i.blockedByPolicy?new A2(i.policyBlockReason||"Search blocked by your security policy.","error"):i.notFound?await ym1(this._pathSuggestions,t.path,void 0,a):await this._formatGrepResult(i,t,a)}catch(i){let n=i instanceof Error?i.message:String(i);return new A2(`Grep error: ${n}`,"error")}}async getSubHeader(t){let r=t.path?Ly(t.path):"~",a=t.output_mode||"files_with_matches";return`grep "${t.pattern}" in ${r} (${a})`}async _formatGrepResult(t,r,a){let i=r.output_mode||"files_with_matches",n=t.truncated===!0&&t.truncationReason==="byte-cap";return i==="files_with_matches"?await this._formatFilesMode(t,r,n,a):i==="count"?await this._formatCountMode(t,r,n,a):await this._formatContentMode(t,r,n,a)}async _formatFilesMode(t,r,a,i){let n=t.files??[];if(n.length===0){if(r.path){let g=await wm1(this._pathSuggestions,r.path,void 0,i);if(g)return A2.warning({notice:`No files found.${g}`},"success")}return A2.warning({notice:"No files found."},"success")}let o=Hl2(o64(r),r.offset||0,n.length),h=o.length>0?` ${o.join(", ")}`:"",u=`Found ${n.length} files${h}
|
|
1611
1611
|
`;for(let g of n)u+=`${g.path}
|
|
1612
1612
|
`;return a&&(u+=`
|
|
1613
1613
|
`+n64),new A2(u.trimEnd())}async _formatCountMode(t,r,a,i){let n=t.counts??[],o=o64(r),h=r.offset||0;if(n.length===0){if(r.path){let z=await wm1(this._pathSuggestions,r.path,void 0,i);if(z)return A2.warning({notice:`No matches found.${z}`},"success")}return A2.warning({notice:"No matches found."},"success")}let u=h,g=o>0?n.slice(u,u+o):n.slice(u),f="";for(let{path:z,count:S}of g)f+=`${z}:${S}
|
|
@@ -1618,7 +1618,7 @@ This command can be elevated with user approval: ${t.suggestedElevationReason}`)
|
|
|
1618
1618
|
[Showing results with pagination = ${h.join(", ")}]`),a&&(o+=`
|
|
1619
1619
|
`+n64),new A2(o.trimEnd())}},n64="(Results are truncated. Consider using a more specific pattern, path, or head_limit/offset to paginate.)"});var eo3,ro3,ao3=C1(()=>{eo3=w4(li()),ro3=eo3.z.object({})});var DW2,io3=C1(()=>{a7();ao3();wQ();zk1();DW2=class{constructor(){this.availability="autopilotAgent";this.name="RefreshConnectionsTool";this.friendlyName="Refresh Connections";this.activationTrigger="Refresh Integration Service connections when status changed or may be stale";this.description="Force refresh Integration Service connections. Use when integration-related skills fail due to stale connection data.";this.inputSchema=ro3;this.autoExecute=!0;this.isReadOnly=!0}canRunInParallel(t,r){return!1}async execute(t,r){try{let i=await UF().getAllConnections(!0);if(i.length===0)return new A2(this.generateNotFoundMessage(),"text");let n=Ak1(i);if(n.length===0)return new A2(this.generateNotFoundMessage(),"text");let o=zo2(n);for(let u of Object.keys(o))o[u]=iG2(o[u]);let h=`Connections refreshed successfully.
|
|
1620
1620
|
|
|
1621
|
-
`+cG2(o);return new A2(h,"text")}catch(a){let i=a instanceof Error?a.message:String(a);return new A2(`Failed to refresh connections: ${i}`,"error")}}generateNotFoundMessage(){return"No connections found. Please configure connections in UiPath Automation Cloud > Integration Service."}canExecute(t,r){return!0}revert(t,r){return Promise.resolve(new A2("Not implemented","text"))}canRevert(t,r){return!1}validateProps(t,r){return!0}async getSubHeader(t){return"Refreshing connections..."}}});var c64,no3,oo3=C1(()=>{c64=w4(li()),no3=c64.z.object({duration:c64.z.number().positive().max(3e5).describe("Duration to wait in milliseconds. Maximum 300000 (5 minutes).")})});var zm1,s64=C1(()=>{a7();oo3();vw();zm1=class extends Yn{inputSchema=no3;name="Wait";friendlyName="Wait";isReadOnly=!0;description="Pause for `duration` ms (max 300000). Use for non-UI waits: replies (Slack/email), polling files/inbox, background jobs. Not for pauses between UI actions in one AppAct call (AppAct wait covers that).";autoExecute=!0;canRunInParallel(t,r){return!1}constructor(t){super(t)}async execute(t,r){let a=Math.min(t.duration,3e5),i=Date.now(),n=!1,{abortSignal:o,skipSignal:h}=r;await new Promise((C,L)=>{let y=setTimeout(C,a);if(o?.aborted){clearTimeout(y),L(new Error("Wait aborted"));return}if(h?.aborted){clearTimeout(y),n=!0,C();return}let z=()=>{clearTimeout(y),L(new Error("Wait aborted"))},S=()=>{clearTimeout(y),n=!0,C()};o?.addEventListener("abort",z,{once:!0}),h?.addEventListener("abort",S,{once:!0})});let u=Date.now()-i,g=(a/1e3).toFixed(1),f=n?`Skipped wait after ${(u/1e3).toFixed(1)}s (of ${g}s requested).`:`Waited ${g} seconds.`,v=new A2(f);return v.metadata={skipped:n,elapsedMs:u,requestedMs:a},v}}});function Yj8(e){return e.map(t=>`${t.agentId} (${t.status})`).join(", ")}function lo3(e,t){switch(t.kind){case"none":return new Error("No detached agents in this session. Spawn one with the Agent tool.");case"needs-reinvocation":return new Error(`Agent "${e}" is no longer live. Reinvoke it with the Agent tool and the same agent_id; prior turns are preserved in its session.`);case"unknown":{let r=t.known.some(a=>a.status==="not-live")?" Reinvoke a not-live agent with the Agent tool and its agent_id.":"";return new Error(`No agent "${e}". Known agents: ${Yj8(t.known)}. Check agent_id or spawn a new Agent.${r}`)}}}function h64(e,t){return typeof e=="string"&&e.trim().length>0?!0:{valid:!1,errorsMessage:`${t} must be a non-empty string.`}}var JG1,$j8,Kj8,QG1,tj1,co3=C1(()=>{JG1=w4(li());a7();vw();$j8=JG1.z.object({agent_id:JG1.z.string().trim().min(1).describe("Detached agent identifier."),message:JG1.z.string().trim().min(1).describe("Message to send.")}),Kj8=JG1.z.object({agent_id:JG1.z.string().trim().min(1).describe("Detached agent identifier.")});QG1=class extends Yn{constructor(r,a){super(r);this.gateway=a;this.name="SendMessageToAgent";this.friendlyName="Send Message to Agent";this.description="Send a message to a detached agent.";this.inputSchema=$j8;this.autoExecute=!0;this.excludeFromAgents=!0}canRunInParallel(r,a){return!0}async execute(r,a){let i=await this.gateway.sendMessage(a.sessionId,r.agent_id,r.message,a.executionId);switch(i.kind){case"steered":return new A2(`Message delivered to agent "${r.agent_id}"; it reads it on its next step.`);case"queue-full":throw new Error(`Agent "${r.agent_id}" is busy; message not delivered. Retry shortly.`);case"resumed":return new A2(`Agent "${r.agent_id}" resumed with your message. Completion will notify again.`,"text",void 0,!1,{agentId:r.agent_id,backgroundAgent:!0,description:i.description});case"blocked-by-user":throw new Error(`Agent "${r.agent_id}" was stopped by the user. Do not resume or replace it unless the user explicitly asks.`);case"needs-reinvocation":case"unknown":case"none":throw lo3(r.agent_id,i)}}validateProps(r,a){let i=h64(r.agent_id,"agent_id");return i!==!0?i:h64(r.message,"message")}},tj1=class extends Yn{constructor(r,a){super(r);this.gateway=a;this.name="InterruptAgent";this.friendlyName="Interrupt Agent";this.description="Interrupt a running detached agent.";this.inputSchema=Kj8;this.autoExecute=!0;this.excludeFromAgents=!0}canRunInParallel(r,a){return!0}async execute(r,a){let i=this.gateway.interrupt(a.sessionId,r.agent_id);switch(i.kind){case"interrupted":return new A2(`Stopping agent "${r.agent_id}". It stays resumable via SendMessageToAgent; an interrupted notification with partial findings follows.`);case"idle":throw new Error(`Agent "${r.agent_id}" is not running (status: ${i.status}). Nothing to interrupt. Resume it with SendMessageToAgent.`);case"needs-reinvocation":case"unknown":case"none":throw lo3(r.agent_id,i)}}validateProps(r,a){return h64(r.agent_id,"agent_id")}}});var d64,Xj8,IW2,u64=C1(()=>{d64=w4(li());a7();vw();Xj8=d64.z.object({message:d64.z.string().trim().min(1).describe("Message to the main agent.")}),IW2=class extends Yn{constructor(r,a){super(r);this.sendToParent=a;this.name="SendMessageToMainAgent";this.friendlyName="Send Message to Main Agent";this.description="Send a message to the main agent.";this.inputSchema=Xj8;this.systemPromptInstructions="SendMessageToMainAgent: for blockers, escalations, significant progress only. Use sparingly. Final answer goes through normal completion, not this tool.";this.autoExecute=!0}canRunInParallel(r,a){return!0}async execute(r,a){switch(await this.sendToParent(a.sessionId,r.message)){case"delivered":return new A2("Message sent to main agent.");case"delivery-failed":throw new Error("Main agent could not receive the message. Retry shortly.");case"queue-full":throw new Error("Main agent is busy; message not delivered. Retry shortly.");case"parent-gone":throw new Error("Main agent session closed. Message not delivered.");case"unknown-child":throw new Error("This session is not a registered detached agent. Message not delivered.")}}validateProps(r,a){return typeof r.message=="string"&&r.message.trim().length>0?!0:{valid:!1,errorsMessage:"message must be a non-empty string."}}}});var so3=C1(()=>{co3();u64()});function ej1(e){return!!e&&Jj8.has(e)}var NW2,Jj8,kl2=C1(()=>{NW2={"text/plain":[".txt",".text",".log",".md",".markdown",".ini",".conf",".cfg",".properties",".env"],"text/csv":[".csv"],"text/html":[".html",".htm"],"text/css":[".css",".scss",".sass",".less"],"text/javascript":[".js",".jsx",".mjs"],"text/typescript":[".ts",".tsx"],"text/x-python":[".py"],"text/x-java":[".java"],"text/x-c":[".c",".h"],"text/x-c++":[".cpp",".hpp",".cc",".cxx"],"text/x-csharp":[".cs"],"text/xml":[".xml"],"text/yaml":[".yaml",".yml"],"text/x-sh":[".sh"],"text/x-powershell":[".ps1"],"text/x-applescript":[".applescript",".scpt"],"text/x-sql":[".sql"],"application/json":[".json"],"application/xml":[".xml"],"application/pdf":[".pdf"],"application/zip":[".zip"],"application/x-tar":[".tar"],"application/gzip":[".gz"],"image/jpeg":[".jpg",".jpeg"],"image/png":[".png"],"image/gif":[".gif"],"image/bmp":[".bmp"],"image/webp":[".webp"],"image/svg+xml":[".svg"],"image/tiff":[".tiff",".tif"],"image/x-icon":[".ico"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[".docx"],"application/msword":[".doc"],"application/vnd.ms-word.document.macroEnabled.12":[".docm"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":[".dotx"],"application/msword-template":[".dot"],"application/rtf":[".rtf"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":[".xlsx"],"application/vnd.ms-excel":[".xls"],"application/vnd.ms-excel.sheet.macroEnabled.12":[".xlsm"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":[".xltx"],"application/vnd.ms-excel.template.macroEnabled.12":[".xlt"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":[".pptx"],"application/vnd.ms-powerpoint":[".ppt"],"application/vnd.ms-powerpoint.presentation.macroEnabled.12":[".pptm"],"application/vnd.openxmlformats-officedocument.presentationml.template":[".potx"],"application/vnd.ms-powerpoint.template.macroEnabled.12":[".pot"],"application/vnd.oasis.opendocument.text":[".odt"],"application/vnd.oasis.opendocument.spreadsheet":[".ods"],"application/vnd.oasis.opendocument.presentation":[".odp"],"application/vnd.ms-outlook":[".msg"]},Jj8=new Set(["application/pdf","image/png","image/jpeg","image/webp","image/gif","image/bmp","image/tiff","image/svg+xml","text/plain","text/xaml","application/xaml+xml","application/json","application/x-yaml","text/yaml","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/rtf","text/markdown","text/csv","application/xml","text/xml","video/mp2t","text/x-python","text/javascript","text/vnd.trolltech.linguist","text/x-java","application/java-vm","application/java-archive","text/x-c++src","text/x-csrc","text/x-chdr","text/x-c++hdr","application/x-ruby","application/rls-services+xml","text/x-scala","text/x-perl","application/vnd.wolfram.mathematica.package","text/x-sh","text/html","application/xhtml+xml","text/css","application/xslt+xml","application/sql","application/vnd.dart","application/vnd.ms-visio.drawing","application/vnd.ms-visio.viewer","application/vnd.visio","application/vnd.visio2013","application/vnd.ms-outlook"])});function ho3(e){return e?[Jm.PasswordRequired,Jm.UnsupportedFeature,Jm.InvalidHeader,Jm.Corrupt,Jm.Truncated,Jm.Empty,Jm.ConversionFailed,Jm.MaxPagesExceeded,Jm.PageRangeTooLarge,Jm.PageOutOfBounds,Jm.SecureStagingUnavailable,Jm.InvalidRequest].find(r=>r===e):void 0}var UW2,Jm,Mc1,GW2=C1(()=>{UW2=class extends Error{constructor(r,a){super(a);this.pageCount=r;this.name="MaxPagesExceededError"}},Jm={PasswordRequired:"PDF_PASSWORD_REQUIRED",UnsupportedFeature:"PDF_UNSUPPORTED_FEATURE",InvalidHeader:"PDF_INVALID_HEADER",Corrupt:"PDF_CORRUPT",Truncated:"PDF_TRUNCATED",Empty:"PDF_EMPTY",ConversionFailed:"PDF_CONVERSION_FAILED",MaxPagesExceeded:"PDF_MAX_PAGES_EXCEEDED",PageRangeTooLarge:"PDF_PAGE_RANGE_TOO_LARGE",PageOutOfBounds:"PDF_PAGE_OUT_OF_BOUNDS",SecureStagingUnavailable:"PDF_SECURE_STAGING_UNAVAILABLE",InvalidRequest:"PDF_INVALID_REQUEST"},Mc1=class extends Error{constructor(r,a){super(a);this.code=r;this.name="PdfError"}}});function rj1(e){return e?Qj8.some(t=>t.test(e)):!1}function do3(e){return e?.match(tW8)?.[1]??"the Office app"}function uo3(e){if(!rj1(e))return;let t=do3(e);return`macOS denied UiPath Delegate permission to control ${t}. Tell the user to open System Settings > Privacy & Security > Automation, find UiPath Delegate (or the app running Delegate), enable ${t}, and confirm when done. Do not retry until the user confirms.`}function go3(e){if(!rj1(e))return;let t=do3(e);return`macOS denied UiPath Delegate permission to control ${t}. Rendering pages requires the user to enable ${t} for UiPath Delegate in System Settings > Privacy & Security > Automation.`}var Qj8,tW8,jW2=C1(()=>{Qj8=[/not authori[sz]ed to send/i,/not permitted to send/i,/(?<!\d)-1743(?!\d)/,/(?<!\d)-9074(?!\d)/],tW8=/not (?:authori[sz]ed|permitted) to send apple events to (Microsoft (?:Excel|PowerPoint|Word))/i});function g64(e){let t=`PDF conversion failed (${e}).`,r=go3(e),a=uo3(e);return{whenTextExtracted:r?`${t} ${r}`:t,whenExtractionUnavailable:a?`${t} ${a}`:t}}function p64(e){return{whenTextExtracted:e,whenExtractionUnavailable:e}}var po3=C1(()=>{jW2()});function fo3(e){let t=[];for(let r=0;r<e.length;r+=32768)t.push(String.fromCharCode(...e.subarray(r,r+32768)));return btoa(t.join(""))}function xc1(e){let t=atob(e),r=new Uint8Array(t.length);for(let a=0;a<t.length;a++)r[a]=t.charCodeAt(a);return r}var WW2=C1(()=>{});var Tl2=M1((Fm9,f64)=>{"use strict";typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?f64.exports={nextTick:eW8}:f64.exports=process;function eW8(e,t,r,a){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var i=arguments.length,n,o;switch(i){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,t)});case 3:return process.nextTick(function(){e.call(null,t,r)});case 4:return process.nextTick(function(){e.call(null,t,r,a)});default:for(n=new Array(i-1),o=0;o<n.length;)n[o++]=arguments[o];return process.nextTick(function(){e.apply(null,n)})}}});var mo3=M1((Om9,vo3)=>{var rW8={}.toString;vo3.exports=Array.isArray||function(e){return rW8.call(e)=="[object Array]"}});var v64=M1((Dm9,Co3)=>{Co3.exports=Z4("stream")});var Bl2=M1((m64,xo3)=>{var qW2=Z4("buffer"),Lc1=qW2.Buffer;function Mo3(e,t){for(var r in e)t[r]=e[r]}Lc1.from&&Lc1.alloc&&Lc1.allocUnsafe&&Lc1.allocUnsafeSlow?xo3.exports=qW2:(Mo3(qW2,m64),m64.Buffer=aj1);function aj1(e,t,r){return Lc1(e,t,r)}Mo3(Lc1,aj1);aj1.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Lc1(e,t,r)};aj1.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var a=Lc1(e);return t!==void 0?typeof r=="string"?a.fill(t,r):a.fill(t):a.fill(0),a};aj1.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Lc1(e)};aj1.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return qW2.SlowBuffer(e)}});var ij1=M1(KF=>{function aW8(e){return Array.isArray?Array.isArray(e):$W2(e)==="[object Array]"}KF.isArray=aW8;function iW8(e){return typeof e=="boolean"}KF.isBoolean=iW8;function nW8(e){return e===null}KF.isNull=nW8;function oW8(e){return e==null}KF.isNullOrUndefined=oW8;function lW8(e){return typeof e=="number"}KF.isNumber=lW8;function cW8(e){return typeof e=="string"}KF.isString=cW8;function sW8(e){return typeof e=="symbol"}KF.isSymbol=sW8;function hW8(e){return e===void 0}KF.isUndefined=hW8;function dW8(e){return $W2(e)==="[object RegExp]"}KF.isRegExp=dW8;function uW8(e){return typeof e=="object"&&e!==null}KF.isObject=uW8;function gW8(e){return $W2(e)==="[object Date]"}KF.isDate=gW8;function pW8(e){return $W2(e)==="[object Error]"||e instanceof Error}KF.isError=pW8;function fW8(e){return typeof e=="function"}KF.isFunction=fW8;function vW8(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}KF.isPrimitive=vW8;KF.isBuffer=Z4("buffer").Buffer.isBuffer;function $W2(e){return Object.prototype.toString.call(e)}});var Lo3=M1((Nm9,C64)=>{typeof Object.create=="function"?C64.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:C64.exports=function(t,r){if(r){t.super_=r;var a=function(){};a.prototype=r.prototype,t.prototype=new a,t.prototype.constructor=t}}});var PT=M1((Um9,x64)=>{try{if(M64=Z4("util"),typeof M64.inherits!="function")throw"";x64.exports=M64.inherits}catch{x64.exports=Lo3()}var M64});var yo3=M1((Gm9,L64)=>{"use strict";function mW8(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var wo3=Bl2().Buffer,Vl2=Z4("util");function CW8(e,t,r){e.copy(t,r)}L64.exports=(function(){function e(){mW8(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(r){var a={data:r,next:null};this.length>0?this.tail.next=a:this.head=a,this.tail=a,++this.length},e.prototype.unshift=function(r){var a={data:r,next:this.head};this.length===0&&(this.tail=a),this.head=a,++this.length},e.prototype.shift=function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(r){if(this.length===0)return"";for(var a=this.head,i=""+a.data;a=a.next;)i+=r+a.data;return i},e.prototype.concat=function(r){if(this.length===0)return wo3.alloc(0);for(var a=wo3.allocUnsafe(r>>>0),i=this.head,n=0;i;)CW8(i.data,a,n),n+=i.data.length,i=i.next;return a},e})();Vl2&&Vl2.inspect&&Vl2.inspect.custom&&(L64.exports.prototype[Vl2.inspect.custom]=function(){var e=Vl2.inspect({length:this.length});return this.constructor.name+" "+e})});var w64=M1((jm9,Ao3)=>{"use strict";var KW2=Tl2();function MW8(e,t){var r=this,a=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return a||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,KW2.nextTick(YW2,this,e)):KW2.nextTick(YW2,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(n){!t&&n?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,KW2.nextTick(YW2,r,n)):KW2.nextTick(YW2,r,n):t&&t(n)}),this)}function xW8(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function YW2(e,t){e.emit("error",t)}Ao3.exports={destroy:MW8,undestroy:xW8}});var bo3=M1((Wm9,zo3)=>{zo3.exports=Z4("util").deprecate});var QW2=M1((qm9,_o3)=>{"use strict";var rT1=Tl2();_o3.exports=_T;function Ho3(e){var t=this;this.next=null,this.entry=null,this.finish=function(){FW8(t,e)}}var LW8=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:rT1.nextTick,nj1;_T.WritableState=_l2;var ko3=Object.create(ij1());ko3.inherits=PT();var wW8={deprecate:bo3()},To3=v64(),JW2=Bl2().Buffer,yW8=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function AW8(e){return JW2.from(e)}function zW8(e){return JW2.isBuffer(e)||e instanceof yW8}var Bo3=w64();ko3.inherits(_T,To3);function bW8(){}function _l2(e,t){nj1=nj1||aT1(),e=e||{};var r=t instanceof nj1;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var a=e.highWaterMark,i=e.writableHighWaterMark,n=this.objectMode?16:16*1024;a||a===0?this.highWaterMark=a:r&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=n,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=e.decodeStrings===!1;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(h){PW8(t,h)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new Ho3(this)}_l2.prototype.getBuffer=function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r};(function(){try{Object.defineProperty(_l2.prototype,"buffer",{get:wW8.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var XW2;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(XW2=Function.prototype[Symbol.hasInstance],Object.defineProperty(_T,Symbol.hasInstance,{value:function(e){return XW2.call(this,e)?!0:this!==_T?!1:e&&e._writableState instanceof _l2}})):XW2=function(e){return e instanceof this};function _T(e){if(nj1=nj1||aT1(),!XW2.call(_T,this)&&!(this instanceof nj1))return new _T(e);this._writableState=new _l2(e,this),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),To3.call(this)}_T.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function SW8(e,t){var r=new Error("write after end");e.emit("error",r),rT1.nextTick(t,r)}function HW8(e,t,r,a){var i=!0,n=!1;return r===null?n=new TypeError("May not write null values to stream"):typeof r!="string"&&r!==void 0&&!t.objectMode&&(n=new TypeError("Invalid non-string/buffer chunk")),n&&(e.emit("error",n),rT1.nextTick(a,n),i=!1),i}_T.prototype.write=function(e,t,r){var a=this._writableState,i=!1,n=!a.objectMode&&zW8(e);return n&&!JW2.isBuffer(e)&&(e=AW8(e)),typeof t=="function"&&(r=t,t=null),n?t="buffer":t||(t=a.defaultEncoding),typeof r!="function"&&(r=bW8),a.ended?SW8(this,r):(n||HW8(this,a,e,r))&&(a.pendingcb++,i=TW8(this,a,n,e,t,r)),i};_T.prototype.cork=function(){var e=this._writableState;e.corked++};_T.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&Vo3(this,e))};_T.prototype.setDefaultEncoding=function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this};function kW8(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=JW2.from(t,r)),t}Object.defineProperty(_T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function TW8(e,t,r,a,i,n){if(!r){var o=kW8(t,a,i);a!==o&&(r=!0,i="buffer",a=o)}var h=t.objectMode?1:a.length;t.length+=h;var u=t.length<t.highWaterMark;if(u||(t.needDrain=!0),t.writing||t.corked){var g=t.lastBufferedRequest;t.lastBufferedRequest={chunk:a,encoding:i,isBuf:r,callback:n,next:null},g?g.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else y64(e,t,!1,h,a,i,n);return u}function y64(e,t,r,a,i,n,o){t.writelen=a,t.writecb=o,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,n,t.onwrite),t.sync=!1}function BW8(e,t,r,a,i){--t.pendingcb,r?(rT1.nextTick(i,a),rT1.nextTick(Pl2,e,t),e._writableState.errorEmitted=!0,e.emit("error",a)):(i(a),e._writableState.errorEmitted=!0,e.emit("error",a),Pl2(e,t))}function VW8(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function PW8(e,t){var r=e._writableState,a=r.sync,i=r.writecb;if(VW8(r),t)BW8(e,r,a,t,i);else{var n=Po3(r);!n&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&Vo3(e,r),a?LW8(So3,e,r,n,i):So3(e,r,n,i)}}function So3(e,t,r,a){r||_W8(e,t),t.pendingcb--,a(),Pl2(e,t)}function _W8(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function Vo3(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var a=t.bufferedRequestCount,i=new Array(a),n=t.corkedRequestsFree;n.entry=r;for(var o=0,h=!0;r;)i[o]=r,r.isBuf||(h=!1),r=r.next,o+=1;i.allBuffers=h,y64(e,t,!0,t.length,i,"",n.finish),t.pendingcb++,t.lastBufferedRequest=null,n.next?(t.corkedRequestsFree=n.next,n.next=null):t.corkedRequestsFree=new Ho3(t),t.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,g=r.encoding,f=r.callback,v=t.objectMode?1:u.length;if(y64(e,t,!1,v,u,g,f),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}_T.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))};_T.prototype._writev=null;_T.prototype.end=function(e,t,r){var a=this._writableState;typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),a.corked&&(a.corked=1,this.uncork()),a.ending||ZW8(this,a,r)};function Po3(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function EW8(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),Pl2(e,t)})}function RW8(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,rT1.nextTick(EW8,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function Pl2(e,t){var r=Po3(t);return r&&(RW8(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),r}function ZW8(e,t,r){t.ending=!0,Pl2(e,t),r&&(t.finished?rT1.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function FW8(e,t,r){var a=e.entry;for(e.entry=null;a;){var i=a.callback;t.pendingcb--,i(r),a=a.next}t.corkedRequestsFree.next=e}Object.defineProperty(_T.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});_T.prototype.destroy=Bo3.destroy;_T.prototype._undestroy=Bo3.undestroy;_T.prototype._destroy=function(e,t){this.end(),t(e)}});var aT1=M1(($m9,Fo3)=>{"use strict";var Eo3=Tl2(),OW8=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};Fo3.exports=wc1;var Ro3=Object.create(ij1());Ro3.inherits=PT();var Zo3=b64(),z64=QW2();Ro3.inherits(wc1,Zo3);for(A64=OW8(z64.prototype),tq2=0;tq2<A64.length;tq2++)eq2=A64[tq2],wc1.prototype[eq2]||(wc1.prototype[eq2]=z64.prototype[eq2]);var A64,eq2,tq2;function wc1(e){if(!(this instanceof wc1))return new wc1(e);Zo3.call(this,e),z64.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",DW8)}Object.defineProperty(wc1.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function DW8(){this.allowHalfOpen||this._writableState.ended||Eo3.nextTick(IW8,this)}function IW8(e){e.end()}Object.defineProperty(wc1.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}});wc1.prototype._destroy=function(e,t){this.push(null),this.end(),Eo3.nextTick(t,e)}});var k64=M1(Do3=>{"use strict";var H64=Bl2().Buffer,Oo3=H64.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function NW8(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function UW8(e){var t=NW8(e);if(typeof t!="string"&&(H64.isEncoding===Oo3||!Oo3(e)))throw new Error("Unknown encoding: "+e);return t||e}Do3.StringDecoder=El2;function El2(e){this.encoding=UW8(e);var t;switch(this.encoding){case"utf16le":this.text=KW8,this.end=YW8,t=4;break;case"utf8":this.fillLast=WW8,t=4;break;case"base64":this.text=XW8,this.end=JW8,t=3;break;default:this.write=QW8,this.end=tq8;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=H64.allocUnsafe(t)}El2.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""};El2.prototype.end=$W8;El2.prototype.text=qW8;El2.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function S64(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function GW8(e,t,r){var a=t.length-1;if(a<r)return 0;var i=S64(t[a]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--a<r||i===-2?0:(i=S64(t[a]),i>=0?(i>0&&(e.lastNeed=i-2),i):--a<r||i===-2?0:(i=S64(t[a]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function jW8(e,t,r){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}function WW8(e){var t=this.lastTotal-this.lastNeed,r=jW8(this,e,t);if(r!==void 0)return r;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function qW8(e,t){var r=GW8(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var a=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,a),e.toString("utf8",t,a)}function $W8(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function KW8(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var a=r.charCodeAt(r.length-1);if(a>=55296&&a<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function YW8(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function XW8(e,t){var r=(e.length-t)%3;return r===0?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function JW8(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function QW8(e){return e.toString(this.encoding)}function tq8(e){return e&&e.length?this.write(e):""}});var b64=M1((Xm9,Jo3)=>{"use strict";var lj1=Tl2();Jo3.exports=wy;var eq8=mo3(),Rl2;wy.ReadableState=qo3;var Ym9=Z4("events").EventEmitter,Go3=function(e,t){return e.listeners(t).length},_64=v64(),Zl2=Bl2().Buffer,rq8=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function aq8(e){return Zl2.from(e)}function iq8(e){return Zl2.isBuffer(e)||e instanceof rq8}var jo3=Object.create(ij1());jo3.inherits=PT();var T64=Z4("util"),Qm=void 0;T64&&T64.debuglog?Qm=T64.debuglog("stream"):Qm=function(){};var nq8=yo3(),Wo3=w64(),oj1;jo3.inherits(wy,_64);var B64=["error","close","destroy","pause","resume"];function oq8(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):eq8(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}function qo3(e,t){Rl2=Rl2||aT1(),e=e||{};var r=t instanceof Rl2;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var a=e.highWaterMark,i=e.readableHighWaterMark,n=this.objectMode?16:16*1024;a||a===0?this.highWaterMark=a:r&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=n,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new nq8,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(oj1||(oj1=k64().StringDecoder),this.decoder=new oj1(e.encoding),this.encoding=e.encoding)}function wy(e){if(Rl2=Rl2||aT1(),!(this instanceof wy))return new wy(e);this._readableState=new qo3(e,this),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),_64.call(this)}Object.defineProperty(wy.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});wy.prototype.destroy=Wo3.destroy;wy.prototype._undestroy=Wo3.undestroy;wy.prototype._destroy=function(e,t){this.push(null),t(e)};wy.prototype.push=function(e,t){var r=this._readableState,a;return r.objectMode?a=!0:typeof e=="string"&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=Zl2.from(e,t),t=""),a=!0),$o3(this,e,t,!1,a)};wy.prototype.unshift=function(e){return $o3(this,e,null,!0,!1)};function $o3(e,t,r,a,i){var n=e._readableState;if(t===null)n.reading=!1,hq8(e,n);else{var o;i||(o=lq8(n,t)),o?e.emit("error",o):n.objectMode||t&&t.length>0?(typeof t!="string"&&!n.objectMode&&Object.getPrototypeOf(t)!==Zl2.prototype&&(t=aq8(t)),a?n.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):V64(e,n,t,!0):n.ended?e.emit("error",new Error("stream.push() after EOF")):(n.reading=!1,n.decoder&&!r?(t=n.decoder.write(t),n.objectMode||t.length!==0?V64(e,n,t,!1):Ko3(e,n)):V64(e,n,t,!1))):a||(n.reading=!1)}return cq8(n)}function V64(e,t,r,a){t.flowing&&t.length===0&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,a?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&rq2(e)),Ko3(e,t)}function lq8(e,t){var r;return!iq8(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(r=new TypeError("Invalid non-string/buffer chunk")),r}function cq8(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}wy.prototype.isPaused=function(){return this._readableState.flowing===!1};wy.prototype.setEncoding=function(e){return oj1||(oj1=k64().StringDecoder),this._readableState.decoder=new oj1(e),this._readableState.encoding=e,this};var Io3=8388608;function sq8(e){return e>=Io3?e=Io3:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function No3(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=sq8(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}wy.prototype.read=function(e){Qm("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return Qm("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?P64(this):rq2(this),null;if(e=No3(e,t),e===0&&t.ended)return t.length===0&&P64(this),null;var a=t.needReadable;Qm("need readable",a),(t.length===0||t.length-e<t.highWaterMark)&&(a=!0,Qm("length less than watermark",a)),t.ended||t.reading?(a=!1,Qm("reading or ended",a)):a&&(Qm("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=No3(r,t)));var i;return e>0?i=Yo3(e,t):i=null,i===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&P64(this)),i!==null&&this.emit("data",i),i};function hq8(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,rq2(e)}}function rq2(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Qm("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?lj1.nextTick(Uo3,e):Uo3(e))}function Uo3(e){Qm("emit readable"),e.emit("readable"),E64(e)}function Ko3(e,t){t.readingMore||(t.readingMore=!0,lj1.nextTick(dq8,e,t))}function dq8(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(Qm("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}wy.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))};wy.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e);break}a.pipesCount+=1,Qm("pipe count=%d opts=%j",a.pipesCount,t);var i=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,n=i?h:S;a.endEmitted?lj1.nextTick(n):r.once("end",n),e.on("unpipe",o);function o(B,R){Qm("onunpipe"),B===r&&R&&R.hasUnpiped===!1&&(R.hasUnpiped=!0,f())}function h(){Qm("onend"),e.end()}var u=uq8(r);e.on("drain",u);var g=!1;function f(){Qm("cleanup"),e.removeListener("close",y),e.removeListener("finish",z),e.removeListener("drain",u),e.removeListener("error",L),e.removeListener("unpipe",o),r.removeListener("end",h),r.removeListener("end",S),r.removeListener("data",C),g=!0,a.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&u()}var v=!1;r.on("data",C);function C(B){Qm("ondata"),v=!1;var R=e.write(B);R===!1&&!v&&((a.pipesCount===1&&a.pipes===e||a.pipesCount>1&&Xo3(a.pipes,e)!==-1)&&!g&&(Qm("false write response, pause",a.awaitDrain),a.awaitDrain++,v=!0),r.pause())}function L(B){Qm("onerror",B),S(),e.removeListener("error",L),Go3(e,"error")===0&&e.emit("error",B)}oq8(e,"error",L);function y(){e.removeListener("finish",z),S()}e.once("close",y);function z(){Qm("onfinish"),e.removeListener("close",y),S()}e.once("finish",z);function S(){Qm("unpipe"),r.unpipe(e)}return e.emit("pipe",r),a.flowing||(Qm("pipe resume"),r.resume()),e};function uq8(e){return function(){var t=e._readableState;Qm("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&Go3(e,"data")&&(t.flowing=!0,E64(e))}}wy.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var a=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var n=0;n<i;n++)a[n].emit("unpipe",this,{hasUnpiped:!1});return this}var o=Xo3(t.pipes,e);return o===-1?this:(t.pipes.splice(o,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)};wy.prototype.on=function(e,t){var r=_64.prototype.on.call(this,e,t);if(e==="data")this._readableState.flowing!==!1&&this.resume();else if(e==="readable"){var a=this._readableState;!a.endEmitted&&!a.readableListening&&(a.readableListening=a.needReadable=!0,a.emittedReadable=!1,a.reading?a.length&&rq2(this):lj1.nextTick(gq8,this))}return r};wy.prototype.addListener=wy.prototype.on;function gq8(e){Qm("readable nexttick read 0"),e.read(0)}wy.prototype.resume=function(){var e=this._readableState;return e.flowing||(Qm("resume"),e.flowing=!0,pq8(this,e)),this};function pq8(e,t){t.resumeScheduled||(t.resumeScheduled=!0,lj1.nextTick(fq8,e,t))}function fq8(e,t){t.reading||(Qm("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),E64(e),t.flowing&&!t.reading&&e.read(0)}wy.prototype.pause=function(){return Qm("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Qm("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function E64(e){var t=e._readableState;for(Qm("flow",t.flowing);t.flowing&&e.read()!==null;);}wy.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;e.on("end",function(){if(Qm("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&t.push(o)}t.push(null)}),e.on("data",function(o){if(Qm("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var h=t.push(o);h||(a=!0,e.pause())}});for(var i in e)this[i]===void 0&&typeof e[i]=="function"&&(this[i]=(function(o){return function(){return e[o].apply(e,arguments)}})(i));for(var n=0;n<B64.length;n++)e.on(B64[n],this.emit.bind(this,B64[n]));return this._read=function(o){Qm("wrapped _read",o),a&&(a=!1,e.resume())},this};Object.defineProperty(wy.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});wy._fromList=Yo3;function Yo3(e,t){if(t.length===0)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.head.data:r=t.buffer.concat(t.length),t.buffer.clear()):r=vq8(e,t.buffer,t.decoder),r}function vq8(e,t,r){var a;return e<t.head.data.length?(a=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):e===t.head.data.length?a=t.shift():a=r?mq8(e,t):Cq8(e,t),a}function mq8(e,t){var r=t.head,a=1,i=r.data;for(e-=i.length;r=r.next;){var n=r.data,o=e>n.length?n.length:e;if(o===n.length?i+=n:i+=n.slice(0,e),e-=o,e===0){o===n.length?(++a,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=n.slice(o));break}++a}return t.length-=a,i}function Cq8(e,t){var r=Zl2.allocUnsafe(e),a=t.head,i=1;for(a.data.copy(r),e-=a.data.length;a=a.next;){var n=a.data,o=e>n.length?n.length:e;if(n.copy(r,r.length-e,0,o),e-=o,e===0){o===n.length?(++i,a.next?t.head=a.next:t.head=t.tail=null):(t.head=a,a.data=n.slice(o));break}++i}return t.length-=i,r}function P64(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,lj1.nextTick(Mq8,t,e))}function Mq8(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Xo3(e,t){for(var r=0,a=e.length;r<a;r++)if(e[r]===t)return r;return-1}});var R64=M1((Jm9,el3)=>{"use strict";el3.exports=yc1;var aq2=aT1(),tl3=Object.create(ij1());tl3.inherits=PT();tl3.inherits(yc1,aq2);function xq8(e,t){var r=this._transformState;r.transforming=!1;var a=r.writecb;if(!a)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,t!=null&&this.push(t),a(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function yc1(e){if(!(this instanceof yc1))return new yc1(e);aq2.call(this,e),this._transformState={afterTransform:xq8.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",Lq8)}function Lq8(){var e=this;typeof this._flush=="function"?this._flush(function(t,r){Qo3(e,t,r)}):Qo3(this,null,null)}yc1.prototype.push=function(e,t){return this._transformState.needTransform=!1,aq2.prototype.push.call(this,e,t)};yc1.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")};yc1.prototype._write=function(e,t,r){var a=this._transformState;if(a.writecb=r,a.writechunk=e,a.writeencoding=t,!a.transforming){var i=this._readableState;(a.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};yc1.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};yc1.prototype._destroy=function(e,t){var r=this;aq2.prototype._destroy.call(this,e,function(a){t(a),r.emit("close")})};function Qo3(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}});var nl3=M1((Qm9,il3)=>{"use strict";il3.exports=Fl2;var rl3=R64(),al3=Object.create(ij1());al3.inherits=PT();al3.inherits(Fl2,rl3);function Fl2(e){if(!(this instanceof Fl2))return new Fl2(e);rl3.call(this,e)}Fl2.prototype._transform=function(e,t,r){r(null,e)}});var Vx=M1((yR,iq2)=>{var ur1=Z4("stream");process.env.READABLE_STREAM==="disable"&&ur1?(iq2.exports=ur1,yR=iq2.exports=ur1.Readable,yR.Readable=ur1.Readable,yR.Writable=ur1.Writable,yR.Duplex=ur1.Duplex,yR.Transform=ur1.Transform,yR.PassThrough=ur1.PassThrough,yR.Stream=ur1):(yR=iq2.exports=b64(),yR.Stream=ur1||yR,yR.Readable=yR,yR.Writable=QW2(),yR.Duplex=aT1(),yR.Transform=R64(),yR.PassThrough=nl3())});var Ac1=M1(gK=>{"use strict";gK.base64=!0;gK.array=!0;gK.string=!0;gK.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";gK.nodebuffer=typeof Buffer<"u";gK.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")gK.blob=!1;else{Z64=new ArrayBuffer(0);try{gK.blob=new Blob([Z64],{type:"application/zip"}).size===0}catch{try{ol3=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,F64=new ol3,F64.append(Z64),gK.blob=F64.getBlob("application/zip").size===0}catch{gK.blob=!1}}}var Z64,ol3,F64;try{gK.nodestream=!!Vx().Readable}catch{gK.nodestream=!1}});var D64=M1(O64=>{"use strict";var wq8=Mb(),yq8=Ac1(),gr1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";O64.encode=function(e){for(var t=[],r,a,i,n,o,h,u,g=0,f=e.length,v=f,C=wq8.getTypeOf(e)!=="string";g<e.length;)v=f-g,C?(r=e[g++],a=g<f?e[g++]:0,i=g<f?e[g++]:0):(r=e.charCodeAt(g++),a=g<f?e.charCodeAt(g++):0,i=g<f?e.charCodeAt(g++):0),n=r>>2,o=(r&3)<<4|a>>4,h=v>1?(a&15)<<2|i>>6:64,u=v>2?i&63:64,t.push(gr1.charAt(n)+gr1.charAt(o)+gr1.charAt(h)+gr1.charAt(u));return t.join("")};O64.decode=function(e){var t,r,a,i,n,o,h,u=0,g=0,f="data:";if(e.substr(0,f.length)===f)throw new Error("Invalid base64 input, it looks like a data url.");e=e.replace(/[^A-Za-z0-9+/=]/g,"");var v=e.length*3/4;if(e.charAt(e.length-1)===gr1.charAt(64)&&v--,e.charAt(e.length-2)===gr1.charAt(64)&&v--,v%1!==0)throw new Error("Invalid base64 input, bad content length.");var C;for(yq8.uint8array?C=new Uint8Array(v|0):C=new Array(v|0);u<e.length;)i=gr1.indexOf(e.charAt(u++)),n=gr1.indexOf(e.charAt(u++)),o=gr1.indexOf(e.charAt(u++)),h=gr1.indexOf(e.charAt(u++)),t=i<<2|n>>4,r=(n&15)<<4|o>>2,a=(o&3)<<6|h,C[g++]=t,o!==64&&(C[g++]=r),h!==64&&(C[g++]=a);return C}});var Ol2=M1((rC9,ll3)=>{"use strict";ll3.exports={isNode:typeof Buffer<"u",newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if(typeof e=="number")throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&typeof e.on=="function"&&typeof e.pause=="function"&&typeof e.resume=="function"}}});var dl3=M1((aC9,hl3)=>{"use strict";var cl3=global.MutationObserver||global.WebKitMutationObserver,cj1;process.browser?cl3?(I64=0,sl3=new cl3(Dl2),N64=global.document.createTextNode(""),sl3.observe(N64,{characterData:!0}),cj1=function(){N64.data=I64=++I64%2}):!global.setImmediate&&typeof global.MessageChannel<"u"?(U64=new global.MessageChannel,U64.port1.onmessage=Dl2,cj1=function(){U64.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?cj1=function(){var e=global.document.createElement("script");e.onreadystatechange=function(){Dl2(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)}:cj1=function(){setTimeout(Dl2,0)}:cj1=function(){process.nextTick(Dl2)};var I64,sl3,N64,U64,G64,Il2=[];function Dl2(){G64=!0;for(var e,t,r=Il2.length;r;){for(t=Il2,Il2=[],e=-1;++e<r;)t[e]();r=Il2.length}G64=!1}hl3.exports=Aq8;function Aq8(e){Il2.push(e)===1&&!G64&&cj1()}});var Cl3=M1((iC9,ml3)=>{"use strict";var ul3=dl3();function sj1(){}var YF={},gl3=["REJECTED"],j64=["FULFILLED"],pl3=["PENDING"];process.browser||(Nl2=["UNHANDLED"]);var Nl2;ml3.exports=bm1;function bm1(e){if(typeof e!="function")throw new TypeError("resolver must be a function");this.state=pl3,this.queue=[],this.outcome=void 0,process.browser||(this.handled=Nl2),e!==sj1&&fl3(this,e)}bm1.prototype.finally=function(e){if(typeof e!="function")return this;var t=this.constructor;return this.then(r,a);function r(i){function n(){return i}return t.resolve(e()).then(n)}function a(i){function n(){throw i}return t.resolve(e()).then(n)}};bm1.prototype.catch=function(e){return this.then(null,e)};bm1.prototype.then=function(e,t){if(typeof e!="function"&&this.state===j64||typeof t!="function"&&this.state===gl3)return this;var r=new this.constructor(sj1);if(process.browser||this.handled===Nl2&&(this.handled=null),this.state!==pl3){var a=this.state===j64?e:t;W64(r,a,this.outcome)}else this.queue.push(new Ul2(r,e,t));return r};function Ul2(e,t,r){this.promise=e,typeof t=="function"&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),typeof r=="function"&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}Ul2.prototype.callFulfilled=function(e){YF.resolve(this.promise,e)};Ul2.prototype.otherCallFulfilled=function(e){W64(this.promise,this.onFulfilled,e)};Ul2.prototype.callRejected=function(e){YF.reject(this.promise,e)};Ul2.prototype.otherCallRejected=function(e){W64(this.promise,this.onRejected,e)};function W64(e,t,r){ul3(function(){var a;try{a=t(r)}catch(i){return YF.reject(e,i)}a===e?YF.reject(e,new TypeError("Cannot resolve promise with itself")):YF.resolve(e,a)})}YF.resolve=function(e,t){var r=vl3(zq8,t);if(r.status==="error")return YF.reject(e,r.value);var a=r.value;if(a)fl3(e,a);else{e.state=j64,e.outcome=t;for(var i=-1,n=e.queue.length;++i<n;)e.queue[i].callFulfilled(t)}return e};YF.reject=function(e,t){e.state=gl3,e.outcome=t,process.browser||e.handled===Nl2&&ul3(function(){e.handled===Nl2&&process.emit("unhandledRejection",t,e)});for(var r=-1,a=e.queue.length;++r<a;)e.queue[r].callRejected(t);return e};function zq8(e){var t=e&&e.then;if(e&&(typeof e=="object"||typeof e=="function")&&typeof t=="function")return function(){t.apply(e,arguments)}}function fl3(e,t){var r=!1;function a(h){r||(r=!0,YF.reject(e,h))}function i(h){r||(r=!0,YF.resolve(e,h))}function n(){t(i,a)}var o=vl3(n);o.status==="error"&&a(o.value)}function vl3(e,t){var r={};try{r.value=e(t),r.status="success"}catch(a){r.status="error",r.value=a}return r}bm1.resolve=bq8;function bq8(e){return e instanceof this?e:YF.resolve(new this(sj1),e)}bm1.reject=Sq8;function Sq8(e){var t=new this(sj1);return YF.reject(t,e)}bm1.all=Hq8;function Hq8(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var r=e.length,a=!1;if(!r)return this.resolve([]);for(var i=new Array(r),n=0,o=-1,h=new this(sj1);++o<r;)u(e[o],o);return h;function u(g,f){t.resolve(g).then(v,function(C){a||(a=!0,YF.reject(h,C))});function v(C){i[f]=C,++n===r&&!a&&(a=!0,YF.resolve(h,i))}}}bm1.race=kq8;function kq8(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var r=e.length,a=!1;if(!r)return this.resolve([]);for(var i=-1,n=new this(sj1);++i<r;)o(e[i]);return n;function o(h){t.resolve(h).then(function(u){a||(a=!0,YF.resolve(n,u))},function(u){a||(a=!0,YF.reject(n,u))})}}});var hj1=M1((nC9,Ml3)=>{"use strict";var q64=null;typeof Promise<"u"?q64=Promise:q64=Cl3();Ml3.exports={Promise:q64}});var $64=M1(xl3=>{(function(e,t){"use strict";if(e.setImmediate)return;var r=1,a={},i=!1,n=e.document,o;function h(R){typeof R!="function"&&(R=new Function(""+R));for(var F=new Array(arguments.length-1),N=0;N<F.length;N++)F[N]=arguments[N+1];var j={callback:R,args:F};return a[r]=j,o(r),r++}function u(R){delete a[R]}function g(R){var F=R.callback,N=R.args;switch(N.length){case 0:F();break;case 1:F(N[0]);break;case 2:F(N[0],N[1]);break;case 3:F(N[0],N[1],N[2]);break;default:F.apply(t,N);break}}function f(R){if(i)setTimeout(f,0,R);else{var F=a[R];if(F){i=!0;try{g(F)}finally{u(R),i=!1}}}}function v(){o=function(R){process.nextTick(function(){f(R)})}}function C(){if(e.postMessage&&!e.importScripts){var R=!0,F=e.onmessage;return e.onmessage=function(){R=!1},e.postMessage("","*"),e.onmessage=F,R}}function L(){var R="setImmediate$"+Math.random()+"$",F=function(N){N.source===e&&typeof N.data=="string"&&N.data.indexOf(R)===0&&f(+N.data.slice(R.length))};e.addEventListener?e.addEventListener("message",F,!1):e.attachEvent("onmessage",F),o=function(N){e.postMessage(R+N,"*")}}function y(){var R=new MessageChannel;R.port1.onmessage=function(F){var N=F.data;f(N)},o=function(F){R.port2.postMessage(F)}}function z(){var R=n.documentElement;o=function(F){var N=n.createElement("script");N.onreadystatechange=function(){f(F),N.onreadystatechange=null,R.removeChild(N),N=null},R.appendChild(N)}}function S(){o=function(R){setTimeout(f,0,R)}}var B=Object.getPrototypeOf&&Object.getPrototypeOf(e);B=B&&B.setTimeout?B:e,{}.toString.call(e.process)==="[object process]"?v():C()?L():e.MessageChannel?y():n&&"onreadystatechange"in n.createElement("script")?z():S(),B.setImmediate=h,B.clearImmediate=u})(typeof self>"u"?typeof global>"u"?xl3:global:self)});var Mb=M1(ET=>{"use strict";var Sm1=Ac1(),Tq8=D64(),dj1=Ol2(),K64=hj1();$64();function Bq8(e){var t=null;return Sm1.uint8array?t=new Uint8Array(e.length):t=new Array(e.length),oq2(e,t)}ET.newBlob=function(e,t){ET.checkSupport("blob");try{return new Blob([e],{type:t})}catch{try{var r=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,a=new r;return a.append(e),a.getBlob(t)}catch{throw new Error("Bug : can't construct the Blob.")}}};function Gl2(e){return e}function oq2(e,t){for(var r=0;r<e.length;++r)t[r]=e.charCodeAt(r)&255;return t}var nq2={stringifyByChunk:function(e,t,r){var a=[],i=0,n=e.length;if(n<=r)return String.fromCharCode.apply(null,e);for(;i<n;)t==="array"||t==="nodebuffer"?a.push(String.fromCharCode.apply(null,e.slice(i,Math.min(i+r,n)))):a.push(String.fromCharCode.apply(null,e.subarray(i,Math.min(i+r,n)))),i+=r;return a.join("")},stringifyByChar:function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},applyCanBeUsed:{uint8array:(function(){try{return Sm1.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return Sm1.nodebuffer&&String.fromCharCode.apply(null,dj1.allocBuffer(1)).length===1}catch{return!1}})()}};function jl2(e){var t=65536,r=ET.getTypeOf(e),a=!0;if(r==="uint8array"?a=nq2.applyCanBeUsed.uint8array:r==="nodebuffer"&&(a=nq2.applyCanBeUsed.nodebuffer),a)for(;t>1;)try{return nq2.stringifyByChunk(e,r,t)}catch{t=Math.floor(t/2)}return nq2.stringifyByChar(e)}ET.applyFromCharCode=jl2;function lq2(e,t){for(var r=0;r<e.length;r++)t[r]=e[r];return t}var Hm1={};Hm1.string={string:Gl2,array:function(e){return oq2(e,new Array(e.length))},arraybuffer:function(e){return Hm1.string.uint8array(e).buffer},uint8array:function(e){return oq2(e,new Uint8Array(e.length))},nodebuffer:function(e){return oq2(e,dj1.allocBuffer(e.length))}};Hm1.array={string:jl2,array:Gl2,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return dj1.newBufferFrom(e)}};Hm1.arraybuffer={string:function(e){return jl2(new Uint8Array(e))},array:function(e){return lq2(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:Gl2,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return dj1.newBufferFrom(new Uint8Array(e))}};Hm1.uint8array={string:jl2,array:function(e){return lq2(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:Gl2,nodebuffer:function(e){return dj1.newBufferFrom(e)}};Hm1.nodebuffer={string:jl2,array:function(e){return lq2(e,new Array(e.length))},arraybuffer:function(e){return Hm1.nodebuffer.uint8array(e).buffer},uint8array:function(e){return lq2(e,new Uint8Array(e.length))},nodebuffer:Gl2};ET.transformTo=function(e,t){if(t||(t=""),!e)return t;ET.checkSupport(e);var r=ET.getTypeOf(t),a=Hm1[r][e](t);return a};ET.resolve=function(e){for(var t=e.split("/"),r=[],a=0;a<t.length;a++){var i=t[a];i==="."||i===""&&a!==0&&a!==t.length-1||(i===".."?r.pop():r.push(i))}return r.join("/")};ET.getTypeOf=function(e){if(typeof e=="string")return"string";if(Object.prototype.toString.call(e)==="[object Array]")return"array";if(Sm1.nodebuffer&&dj1.isBuffer(e))return"nodebuffer";if(Sm1.uint8array&&e instanceof Uint8Array)return"uint8array";if(Sm1.arraybuffer&&e instanceof ArrayBuffer)return"arraybuffer"};ET.checkSupport=function(e){var t=Sm1[e.toLowerCase()];if(!t)throw new Error(e+" is not supported by this platform")};ET.MAX_VALUE_16BITS=65535;ET.MAX_VALUE_32BITS=-1;ET.pretty=function(e){var t="",r,a;for(a=0;a<(e||"").length;a++)r=e.charCodeAt(a),t+="\\x"+(r<16?"0":"")+r.toString(16).toUpperCase();return t};ET.delay=function(e,t,r){setImmediate(function(){e.apply(r||null,t||[])})};ET.inherits=function(e,t){var r=function(){};r.prototype=t.prototype,e.prototype=new r};ET.extend=function(){var e={},t,r;for(t=0;t<arguments.length;t++)for(r in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],r)&&typeof e[r]>"u"&&(e[r]=arguments[t][r]);return e};ET.prepareContent=function(e,t,r,a,i){var n=K64.Promise.resolve(t).then(function(o){var h=Sm1.blob&&(o instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(o))!==-1);return h&&typeof FileReader<"u"?new K64.Promise(function(u,g){var f=new FileReader;f.onload=function(v){u(v.target.result)},f.onerror=function(v){g(v.target.error)},f.readAsArrayBuffer(o)}):o});return n.then(function(o){var h=ET.getTypeOf(o);return h?(h==="arraybuffer"?o=ET.transformTo("uint8array",o):h==="string"&&(i?o=Tq8.decode(o):r&&a!==!0&&(o=Bq8(o))),o):K64.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}});var pK=M1((cC9,wl3)=>{"use strict";function Ll3(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}Ll3.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return this.isFinished?!1:(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r<this._listeners[e].length;r++)this._listeners[e][r].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(r){t.processChunk(r)}),e.on("end",function(){t.end()}),e.on("error",function(r){t.error(r)}),this},pause:function(){return this.isPaused||this.isFinished?!1:(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var e=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}};wl3.exports=Ll3});var gj1=M1(km1=>{"use strict";var uj1=Mb(),iT1=Ac1(),Vq8=Ol2(),cq2=pK(),Wl2=new Array(256);for(zc1=0;zc1<256;zc1++)Wl2[zc1]=zc1>=252?6:zc1>=248?5:zc1>=240?4:zc1>=224?3:zc1>=192?2:1;var zc1;Wl2[254]=Wl2[254]=1;var Pq8=function(e){var t,r,a,i,n,o=e.length,h=0;for(i=0;i<o;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(a=e.charCodeAt(i+1),(a&64512)===56320&&(r=65536+(r-55296<<10)+(a-56320),i++)),h+=r<128?1:r<2048?2:r<65536?3:4;for(iT1.uint8array?t=new Uint8Array(h):t=new Array(h),n=0,i=0;n<h;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(a=e.charCodeAt(i+1),(a&64512)===56320&&(r=65536+(r-55296<<10)+(a-56320),i++)),r<128?t[n++]=r:r<2048?(t[n++]=192|r>>>6,t[n++]=128|r&63):r<65536?(t[n++]=224|r>>>12,t[n++]=128|r>>>6&63,t[n++]=128|r&63):(t[n++]=240|r>>>18,t[n++]=128|r>>>12&63,t[n++]=128|r>>>6&63,t[n++]=128|r&63);return t},_q8=function(e,t){var r;for(t=t||e.length,t>e.length&&(t=e.length),r=t-1;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+Wl2[e[r]]>t?r:t},Eq8=function(e){var t,r,a,i,n=e.length,o=new Array(n*2);for(r=0,t=0;t<n;){if(a=e[t++],a<128){o[r++]=a;continue}if(i=Wl2[a],i>4){o[r++]=65533,t+=i-1;continue}for(a&=i===2?31:i===3?15:7;i>1&&t<n;)a=a<<6|e[t++]&63,i--;if(i>1){o[r++]=65533;continue}a<65536?o[r++]=a:(a-=65536,o[r++]=55296|a>>10&1023,o[r++]=56320|a&1023)}return o.length!==r&&(o.subarray?o=o.subarray(0,r):o.length=r),uj1.applyFromCharCode(o)};km1.utf8encode=function(t){return iT1.nodebuffer?Vq8.newBufferFrom(t,"utf-8"):Pq8(t)};km1.utf8decode=function(t){return iT1.nodebuffer?uj1.transformTo("nodebuffer",t).toString("utf-8"):(t=uj1.transformTo(iT1.uint8array?"uint8array":"array",t),Eq8(t))};function sq2(){cq2.call(this,"utf-8 decode"),this.leftOver=null}uj1.inherits(sq2,cq2);sq2.prototype.processChunk=function(e){var t=uj1.transformTo(iT1.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(iT1.uint8array){var r=t;t=new Uint8Array(r.length+this.leftOver.length),t.set(this.leftOver,0),t.set(r,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var a=_q8(t),i=t;a!==t.length&&(iT1.uint8array?(i=t.subarray(0,a),this.leftOver=t.subarray(a,t.length)):(i=t.slice(0,a),this.leftOver=t.slice(a,t.length))),this.push({data:km1.utf8decode(i),meta:e.meta})};sq2.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:km1.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)};km1.Utf8DecodeWorker=sq2;function Y64(){cq2.call(this,"utf-8 encode")}uj1.inherits(Y64,cq2);Y64.prototype.processChunk=function(e){this.push({data:km1.utf8encode(e.data),meta:e.meta})};km1.Utf8EncodeWorker=Y64});var bl3=M1((hC9,zl3)=>{"use strict";var yl3=pK(),Al3=Mb();function X64(e){yl3.call(this,"ConvertWorker to "+e),this.destType=e}Al3.inherits(X64,yl3);X64.prototype.processChunk=function(e){this.push({data:Al3.transformTo(this.destType,e.data),meta:e.meta})};zl3.exports=X64});var kl3=M1((dC9,Hl3)=>{"use strict";var Sl3=Vx().Readable,Rq8=Mb();Rq8.inherits(J64,Sl3);function J64(e,t,r){Sl3.call(this,t),this._helper=e;var a=this;e.on("data",function(i,n){a.push(i)||a._helper.pause(),r&&r(n)}).on("error",function(i){a.emit("error",i)}).on("end",function(){a.push(null)})}J64.prototype._read=function(){this._helper.resume()};Hl3.exports=J64});var Q64=M1((uC9,Vl3)=>{"use strict";var nT1=Mb(),Zq8=bl3(),Fq8=pK(),Oq8=D64(),Dq8=Ac1(),Iq8=hj1(),Tl3=null;if(Dq8.nodestream)try{Tl3=kl3()}catch{}function Nq8(e,t,r){switch(e){case"blob":return nT1.newBlob(nT1.transformTo("arraybuffer",t),r);case"base64":return Oq8.encode(t);default:return nT1.transformTo(e,t)}}function Uq8(e,t){var r,a=0,i=null,n=0;for(r=0;r<t.length;r++)n+=t[r].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(i=new Uint8Array(n),r=0;r<t.length;r++)i.set(t[r],a),a+=t[r].length;return i;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}function Gq8(e,t){return new Iq8.Promise(function(r,a){var i=[],n=e._internalType,o=e._outputType,h=e._mimeType;e.on("data",function(u,g){i.push(u),t&&t(g)}).on("error",function(u){i=[],a(u)}).on("end",function(){try{var u=Nq8(o,Uq8(n,i),h);r(u)}catch(g){a(g)}i=[]}).resume()})}function Bl3(e,t,r){var a=t;switch(t){case"blob":case"arraybuffer":a="uint8array";break;case"base64":a="string";break}try{this._internalType=a,this._outputType=t,this._mimeType=r,nT1.checkSupport(a),this._worker=e.pipe(new Zq8(a)),e.lock()}catch(i){this._worker=new Fq8("error"),this._worker.error(i)}}Bl3.prototype={accumulate:function(e){return Gq8(this,e)},on:function(e,t){var r=this;return e==="data"?this._worker.on(e,function(a){t.call(r,a.data,a.meta)}):this._worker.on(e,function(){nT1.delay(t,arguments,r)}),this},resume:function(){return nT1.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(nT1.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new Tl3(this,{objectMode:this._outputType!=="nodebuffer"},e)}};Vl3.exports=Bl3});var t84=M1(y31=>{"use strict";y31.base64=!1;y31.binary=!1;y31.dir=!1;y31.createFolders=!0;y31.date=null;y31.compression=null;y31.compressionOptions=null;y31.comment=null;y31.unixPermissions=null;y31.dosPermissions=null});var e84=M1((pC9,Pl3)=>{"use strict";var hq2=Mb(),dq2=pK(),jq8=16*1024;function pj1(e){dq2.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(r){t.dataIsReady=!0,t.data=r,t.max=r&&r.length||0,t.type=hq2.getTypeOf(r),t.isPaused||t._tickAndRepeat()},function(r){t.error(r)})}hq2.inherits(pj1,dq2);pj1.prototype.cleanUp=function(){dq2.prototype.cleanUp.call(this),this.data=null};pj1.prototype.resume=function(){return dq2.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,hq2.delay(this._tickAndRepeat,[],this)),!0):!1};pj1.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(hq2.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))};pj1.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=jq8,t=null,r=Math.min(this.max,this.index+e);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,r);break;case"uint8array":t=this.data.subarray(this.index,r);break;case"array":case"nodebuffer":t=this.data.slice(this.index,r);break}return this.index=r,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})};Pl3.exports=pj1});var uq2=M1((fC9,El3)=>{"use strict";var Wq8=Mb();function qq8(){for(var e,t=[],r=0;r<256;r++){e=r;for(var a=0;a<8;a++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var _l3=qq8();function $q8(e,t,r,a){var i=_l3,n=a+r;e=e^-1;for(var o=a;o<n;o++)e=e>>>8^i[(e^t[o])&255];return e^-1}function Kq8(e,t,r,a){var i=_l3,n=a+r;e=e^-1;for(var o=a;o<n;o++)e=e>>>8^i[(e^t.charCodeAt(o))&255];return e^-1}El3.exports=function(t,r){if(typeof t>"u"||!t.length)return 0;var a=Wq8.getTypeOf(t)!=="string";return a?$q8(r|0,t,t.length,0):Kq8(r|0,t,t.length,0)}});var a84=M1((vC9,Zl3)=>{"use strict";var Rl3=pK(),Yq8=uq2(),Xq8=Mb();function r84(){Rl3.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}Xq8.inherits(r84,Rl3);r84.prototype.processChunk=function(e){this.streamInfo.crc32=Yq8(e.data,this.streamInfo.crc32||0),this.push(e)};Zl3.exports=r84});var Ol3=M1((mC9,Fl3)=>{"use strict";var Jq8=Mb(),i84=pK();function n84(e){i84.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}Jq8.inherits(n84,i84);n84.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i84.prototype.processChunk.call(this,e)};Fl3.exports=n84});var gq2=M1((CC9,Nl3)=>{"use strict";var Dl3=hj1(),Il3=e84(),Qq8=a84(),o84=Ol3();function l84(e,t,r,a,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=a,this.compressedContent=i}l84.prototype={getContentWorker:function(){var e=new Il3(Dl3.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o84("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new Il3(Dl3.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};l84.createWorkerFrom=function(e,t,r){return e.pipe(new Qq8).pipe(new o84("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new o84("compressedSize")).withStreamInfo("compression",t)};Nl3.exports=l84});var Wl3=M1((MC9,jl3)=>{"use strict";var t$8=Q64(),e$8=e84(),c84=gj1(),s84=gq2(),Ul3=pK(),h84=function(e,t,r){this.name=e,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=t,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}};h84.prototype={internalStream:function(e){var t=null,r="string";try{if(!e)throw new Error("No output type specified.");r=e.toLowerCase();var a=r==="string"||r==="text";(r==="binarystring"||r==="text")&&(r="string"),t=this._decompressWorker();var i=!this._dataBinary;i&&!a&&(t=t.pipe(new c84.Utf8EncodeWorker)),!i&&a&&(t=t.pipe(new c84.Utf8DecodeWorker))}catch(n){t=new Ul3("error"),t.error(n)}return new t$8(t,r,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof s84&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new c84.Utf8EncodeWorker)),s84.createWorkerFrom(r,e,t)},_decompressWorker:function(){return this._data instanceof s84?this._data.getContentWorker():this._data instanceof Ul3?this._data:new e$8(this._data)}};var Gl3=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],r$8=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(pq2=0;pq2<Gl3.length;pq2++)h84.prototype[Gl3[pq2]]=r$8;var pq2;jl3.exports=h84});var bc1=M1(XI=>{"use strict";var a$8=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function i$8(e,t){return Object.prototype.hasOwnProperty.call(e,t)}XI.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var a in r)i$8(r,a)&&(e[a]=r[a])}}return e};XI.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n$8={arraySet:function(e,t,r,a,i){if(t.subarray&&e.subarray){e.set(t.subarray(r,r+a),i);return}for(var n=0;n<a;n++)e[i+n]=t[r+n]},flattenChunks:function(e){var t,r,a,i,n,o;for(a=0,t=0,r=e.length;t<r;t++)a+=e[t].length;for(o=new Uint8Array(a),i=0,t=0,r=e.length;t<r;t++)n=e[t],o.set(n,i),i+=n.length;return o}},o$8={arraySet:function(e,t,r,a,i){for(var n=0;n<a;n++)e[i+n]=t[r+n]},flattenChunks:function(e){return[].concat.apply([],e)}};XI.setTyped=function(e){e?(XI.Buf8=Uint8Array,XI.Buf16=Uint16Array,XI.Buf32=Int32Array,XI.assign(XI,n$8)):(XI.Buf8=Array,XI.Buf16=Array,XI.Buf32=Array,XI.assign(XI,o$8))};XI.setTyped(a$8)});var fc3=M1(mj1=>{"use strict";var l$8=bc1(),c$8=4,ql3=0,$l3=1,s$8=2;function vj1(e){for(var t=e.length;--t>=0;)e[t]=0}var h$8=0,tc3=1,d$8=2,u$8=3,g$8=258,m84=29,Jl2=256,$l2=Jl2+1+m84,fj1=30,C84=19,ec3=2*$l2+1,oT1=15,d84=16,p$8=7,M84=256,rc3=16,ac3=17,ic3=18,f84=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],fq2=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],f$8=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],nc3=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],v$8=512,Sc1=new Array(($l2+2)*2);vj1(Sc1);var ql2=new Array(fj1*2);vj1(ql2);var Kl2=new Array(v$8);vj1(Kl2);var Yl2=new Array(g$8-u$8+1);vj1(Yl2);var x84=new Array(m84);vj1(x84);var vq2=new Array(fj1);vj1(vq2);function u84(e,t,r,a,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=a,this.max_length=i,this.has_stree=e&&e.length}var oc3,lc3,cc3;function g84(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function sc3(e){return e<256?Kl2[e]:Kl2[256+(e>>>7)]}function Xl2(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function zj(e,t,r){e.bi_valid>d84-r?(e.bi_buf|=t<<e.bi_valid&65535,Xl2(e,e.bi_buf),e.bi_buf=t>>d84-e.bi_valid,e.bi_valid+=r-d84):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function pr1(e,t,r){zj(e,r[t*2],r[t*2+1])}function hc3(e,t){var r=0;do r|=e&1,e>>>=1,r<<=1;while(--t>0);return r>>>1}function m$8(e){e.bi_valid===16?(Xl2(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function C$8(e,t){var r=t.dyn_tree,a=t.max_code,i=t.stat_desc.static_tree,n=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,h=t.stat_desc.extra_base,u=t.stat_desc.max_length,g,f,v,C,L,y,z=0;for(C=0;C<=oT1;C++)e.bl_count[C]=0;for(r[e.heap[e.heap_max]*2+1]=0,g=e.heap_max+1;g<ec3;g++)f=e.heap[g],C=r[r[f*2+1]*2+1]+1,C>u&&(C=u,z++),r[f*2+1]=C,!(f>a)&&(e.bl_count[C]++,L=0,f>=h&&(L=o[f-h]),y=r[f*2],e.opt_len+=y*(C+L),n&&(e.static_len+=y*(i[f*2+1]+L)));if(z!==0){do{for(C=u-1;e.bl_count[C]===0;)C--;e.bl_count[C]--,e.bl_count[C+1]+=2,e.bl_count[u]--,z-=2}while(z>0);for(C=u;C!==0;C--)for(f=e.bl_count[C];f!==0;)v=e.heap[--g],!(v>a)&&(r[v*2+1]!==C&&(e.opt_len+=(C-r[v*2+1])*r[v*2],r[v*2+1]=C),f--)}}function dc3(e,t,r){var a=new Array(oT1+1),i=0,n,o;for(n=1;n<=oT1;n++)a[n]=i=i+r[n-1]<<1;for(o=0;o<=t;o++){var h=e[o*2+1];h!==0&&(e[o*2]=hc3(a[h]++,h))}}function M$8(){var e,t,r,a,i,n=new Array(oT1+1);for(r=0,a=0;a<m84-1;a++)for(x84[a]=r,e=0;e<1<<f84[a];e++)Yl2[r++]=a;for(Yl2[r-1]=a,i=0,a=0;a<16;a++)for(vq2[a]=i,e=0;e<1<<fq2[a];e++)Kl2[i++]=a;for(i>>=7;a<fj1;a++)for(vq2[a]=i<<7,e=0;e<1<<fq2[a]-7;e++)Kl2[256+i++]=a;for(t=0;t<=oT1;t++)n[t]=0;for(e=0;e<=143;)Sc1[e*2+1]=8,e++,n[8]++;for(;e<=255;)Sc1[e*2+1]=9,e++,n[9]++;for(;e<=279;)Sc1[e*2+1]=7,e++,n[7]++;for(;e<=287;)Sc1[e*2+1]=8,e++,n[8]++;for(dc3(Sc1,$l2+1,n),e=0;e<fj1;e++)ql2[e*2+1]=5,ql2[e*2]=hc3(e,5);oc3=new u84(Sc1,f84,Jl2+1,$l2,oT1),lc3=new u84(ql2,fq2,0,fj1,oT1),cc3=new u84(new Array(0),f$8,0,C84,p$8)}function uc3(e){var t;for(t=0;t<$l2;t++)e.dyn_ltree[t*2]=0;for(t=0;t<fj1;t++)e.dyn_dtree[t*2]=0;for(t=0;t<C84;t++)e.bl_tree[t*2]=0;e.dyn_ltree[M84*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function gc3(e){e.bi_valid>8?Xl2(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function x$8(e,t,r,a){gc3(e),a&&(Xl2(e,r),Xl2(e,~r)),l$8.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function Kl3(e,t,r,a){var i=t*2,n=r*2;return e[i]<e[n]||e[i]===e[n]&&a[t]<=a[r]}function p84(e,t,r){for(var a=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&Kl3(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Kl3(t,a,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=a}function Yl3(e,t,r){var a,i,n=0,o,h;if(e.last_lit!==0)do a=e.pending_buf[e.d_buf+n*2]<<8|e.pending_buf[e.d_buf+n*2+1],i=e.pending_buf[e.l_buf+n],n++,a===0?pr1(e,i,t):(o=Yl2[i],pr1(e,o+Jl2+1,t),h=f84[o],h!==0&&(i-=x84[o],zj(e,i,h)),a--,o=sc3(a),pr1(e,o,r),h=fq2[o],h!==0&&(a-=vq2[o],zj(e,a,h)));while(n<e.last_lit);pr1(e,M84,t)}function v84(e,t){var r=t.dyn_tree,a=t.stat_desc.static_tree,i=t.stat_desc.has_stree,n=t.stat_desc.elems,o,h,u=-1,g;for(e.heap_len=0,e.heap_max=ec3,o=0;o<n;o++)r[o*2]!==0?(e.heap[++e.heap_len]=u=o,e.depth[o]=0):r[o*2+1]=0;for(;e.heap_len<2;)g=e.heap[++e.heap_len]=u<2?++u:0,r[g*2]=1,e.depth[g]=0,e.opt_len--,i&&(e.static_len-=a[g*2+1]);for(t.max_code=u,o=e.heap_len>>1;o>=1;o--)p84(e,r,o);g=n;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],p84(e,r,1),h=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=h,r[g*2]=r[o*2]+r[h*2],e.depth[g]=(e.depth[o]>=e.depth[h]?e.depth[o]:e.depth[h])+1,r[o*2+1]=r[h*2+1]=g,e.heap[1]=g++,p84(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],C$8(e,t),dc3(r,u,e.bl_count)}function Xl3(e,t,r){var a,i=-1,n,o=t[1],h=0,u=7,g=4;for(o===0&&(u=138,g=3),t[(r+1)*2+1]=65535,a=0;a<=r;a++)n=o,o=t[(a+1)*2+1],!(++h<u&&n===o)&&(h<g?e.bl_tree[n*2]+=h:n!==0?(n!==i&&e.bl_tree[n*2]++,e.bl_tree[rc3*2]++):h<=10?e.bl_tree[ac3*2]++:e.bl_tree[ic3*2]++,h=0,i=n,o===0?(u=138,g=3):n===o?(u=6,g=3):(u=7,g=4))}function Jl3(e,t,r){var a,i=-1,n,o=t[1],h=0,u=7,g=4;for(o===0&&(u=138,g=3),a=0;a<=r;a++)if(n=o,o=t[(a+1)*2+1],!(++h<u&&n===o)){if(h<g)do pr1(e,n,e.bl_tree);while(--h!==0);else n!==0?(n!==i&&(pr1(e,n,e.bl_tree),h--),pr1(e,rc3,e.bl_tree),zj(e,h-3,2)):h<=10?(pr1(e,ac3,e.bl_tree),zj(e,h-3,3)):(pr1(e,ic3,e.bl_tree),zj(e,h-11,7));h=0,i=n,o===0?(u=138,g=3):n===o?(u=6,g=3):(u=7,g=4)}}function L$8(e){var t;for(Xl3(e,e.dyn_ltree,e.l_desc.max_code),Xl3(e,e.dyn_dtree,e.d_desc.max_code),v84(e,e.bl_desc),t=C84-1;t>=3&&e.bl_tree[nc3[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function w$8(e,t,r,a){var i;for(zj(e,t-257,5),zj(e,r-1,5),zj(e,a-4,4),i=0;i<a;i++)zj(e,e.bl_tree[nc3[i]*2+1],3);Jl3(e,e.dyn_ltree,t-1),Jl3(e,e.dyn_dtree,r-1)}function y$8(e){var t=4093624447,r;for(r=0;r<=31;r++,t>>>=1)if(t&1&&e.dyn_ltree[r*2]!==0)return ql3;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return $l3;for(r=32;r<Jl2;r++)if(e.dyn_ltree[r*2]!==0)return $l3;return ql3}var Ql3=!1;function A$8(e){Ql3||(M$8(),Ql3=!0),e.l_desc=new g84(e.dyn_ltree,oc3),e.d_desc=new g84(e.dyn_dtree,lc3),e.bl_desc=new g84(e.bl_tree,cc3),e.bi_buf=0,e.bi_valid=0,uc3(e)}function pc3(e,t,r,a){zj(e,(h$8<<1)+(a?1:0),3),x$8(e,t,r,!0)}function z$8(e){zj(e,tc3<<1,3),pr1(e,M84,Sc1),m$8(e)}function b$8(e,t,r,a){var i,n,o=0;e.level>0?(e.strm.data_type===s$8&&(e.strm.data_type=y$8(e)),v84(e,e.l_desc),v84(e,e.d_desc),o=L$8(e),i=e.opt_len+3+7>>>3,n=e.static_len+3+7>>>3,n<=i&&(i=n)):i=n=r+5,r+4<=i&&t!==-1?pc3(e,t,r,a):e.strategy===c$8||n===i?(zj(e,(tc3<<1)+(a?1:0),3),Yl3(e,Sc1,ql2)):(zj(e,(d$8<<1)+(a?1:0),3),w$8(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Yl3(e,e.dyn_ltree,e.dyn_dtree)),uc3(e),a&&gc3(e)}function S$8(e,t,r){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=r&255,e.last_lit++,t===0?e.dyn_ltree[r*2]++:(e.matches++,t--,e.dyn_ltree[(Yl2[r]+Jl2+1)*2]++,e.dyn_dtree[sc3(t)*2]++),e.last_lit===e.lit_bufsize-1}mj1._tr_init=A$8;mj1._tr_stored_block=pc3;mj1._tr_flush_block=b$8;mj1._tr_tally=S$8;mj1._tr_align=z$8});var L84=M1((wC9,vc3)=>{"use strict";function H$8(e,t,r,a){for(var i=e&65535|0,n=e>>>16&65535|0,o=0;r!==0;){o=r>2e3?2e3:r,r-=o;do i=i+t[a++]|0,n=n+i|0;while(--o);i%=65521,n%=65521}return i|n<<16|0}vc3.exports=H$8});var w84=M1((yC9,mc3)=>{"use strict";function k$8(){for(var e,t=[],r=0;r<256;r++){e=r;for(var a=0;a<8;a++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var T$8=k$8();function B$8(e,t,r,a){var i=T$8,n=a+r;e^=-1;for(var o=a;o<n;o++)e=e>>>8^i[(e^t[o])&255];return e^-1}mc3.exports=B$8});var mq2=M1((AC9,Cc3)=>{"use strict";Cc3.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var Sc3=M1(mr1=>{"use strict";var JI=bc1(),bQ=fc3(),wc3=L84(),Tm1=w84(),V$8=mq2(),hT1=0,P$8=1,_$8=3,Em1=4,Mc3=5,vr1=0,xc3=1,SQ=-2,E$8=-3,y84=-5,R$8=-1,Z$8=1,Cq2=2,F$8=3,O$8=4,D$8=0,I$8=2,wq2=8,N$8=9,U$8=15,G$8=8,j$8=29,W$8=256,z84=W$8+1+j$8,q$8=30,$$8=19,K$8=2*z84+1,Y$8=15,tf=3,Pm1=258,A31=Pm1+tf+1,X$8=32,yq2=42,b84=69,Mq2=73,xq2=91,Lq2=103,lT1=113,tc2=666,mV=1,ec2=2,cT1=3,xj1=4,J$8=3;function _m1(e,t){return e.msg=V$8[t],t}function Lc3(e){return(e<<1)-(e>4?9:0)}function Vm1(e){for(var t=e.length;--t>=0;)e[t]=0}function Bm1(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(JI.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))}function AR(e,t){bQ._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Bm1(e.strm)}function hm(e,t){e.pending_buf[e.pending++]=t}function Ql2(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function Q$8(e,t,r,a){var i=e.avail_in;return i>a&&(i=a),i===0?0:(e.avail_in-=i,JI.arraySet(t,e.input,e.next_in,i,r),e.state.wrap===1?e.adler=wc3(e.adler,t,i,r):e.state.wrap===2&&(e.adler=Tm1(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)}function yc3(e,t){var r=e.max_chain_length,a=e.strstart,i,n,o=e.prev_length,h=e.nice_match,u=e.strstart>e.w_size-A31?e.strstart-(e.w_size-A31):0,g=e.window,f=e.w_mask,v=e.prev,C=e.strstart+Pm1,L=g[a+o-1],y=g[a+o];e.prev_length>=e.good_match&&(r>>=2),h>e.lookahead&&(h=e.lookahead);do if(i=t,!(g[i+o]!==y||g[i+o-1]!==L||g[i]!==g[a]||g[++i]!==g[a+1])){a+=2,i++;do;while(g[++a]===g[++i]&&g[++a]===g[++i]&&g[++a]===g[++i]&&g[++a]===g[++i]&&g[++a]===g[++i]&&g[++a]===g[++i]&&g[++a]===g[++i]&&g[++a]===g[++i]&&a<C);if(n=Pm1-(C-a),a=C-Pm1,n>o){if(e.match_start=t,o=n,n>=h)break;L=g[a+o-1],y=g[a+o]}}while((t=v[t&f])>u&&--r!==0);return o<=e.lookahead?o:e.lookahead}function sT1(e){var t=e.w_size,r,a,i,n,o;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-A31)){JI.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,a=e.hash_size,r=a;do i=e.head[--r],e.head[r]=i>=t?i-t:0;while(--a);a=t,r=a;do i=e.prev[--r],e.prev[r]=i>=t?i-t:0;while(--a);n+=t}if(e.strm.avail_in===0)break;if(a=Q$8(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=a,e.lookahead+e.insert>=tf)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+tf-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<tf)););}while(e.lookahead<A31&&e.strm.avail_in!==0)}function tK8(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(sT1(e),e.lookahead===0&&t===hT1)return mV;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var a=e.block_start+r;if((e.strstart===0||e.strstart>=a)&&(e.lookahead=e.strstart-a,e.strstart=a,AR(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-A31&&(AR(e,!1),e.strm.avail_out===0))return mV}return e.insert=0,t===Em1?(AR(e,!0),e.strm.avail_out===0?cT1:xj1):(e.strstart>e.block_start&&(AR(e,!1),e.strm.avail_out===0),mV)}function A84(e,t){for(var r,a;;){if(e.lookahead<A31){if(sT1(e),e.lookahead<A31&&t===hT1)return mV;if(e.lookahead===0)break}if(r=0,e.lookahead>=tf&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+tf-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),r!==0&&e.strstart-r<=e.w_size-A31&&(e.match_length=yc3(e,r)),e.match_length>=tf)if(a=bQ._tr_tally(e,e.strstart-e.match_start,e.match_length-tf),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=tf){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+tf-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else a=bQ._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(a&&(AR(e,!1),e.strm.avail_out===0))return mV}return e.insert=e.strstart<tf-1?e.strstart:tf-1,t===Em1?(AR(e,!0),e.strm.avail_out===0?cT1:xj1):e.last_lit&&(AR(e,!1),e.strm.avail_out===0)?mV:ec2}function Cj1(e,t){for(var r,a,i;;){if(e.lookahead<A31){if(sT1(e),e.lookahead<A31&&t===hT1)return mV;if(e.lookahead===0)break}if(r=0,e.lookahead>=tf&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+tf-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=tf-1,r!==0&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-A31&&(e.match_length=yc3(e,r),e.match_length<=5&&(e.strategy===Z$8||e.match_length===tf&&e.strstart-e.match_start>4096)&&(e.match_length=tf-1)),e.prev_length>=tf&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-tf,a=bQ._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-tf),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+tf-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=tf-1,e.strstart++,a&&(AR(e,!1),e.strm.avail_out===0))return mV}else if(e.match_available){if(a=bQ._tr_tally(e,0,e.window[e.strstart-1]),a&&AR(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return mV}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(a=bQ._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<tf-1?e.strstart:tf-1,t===Em1?(AR(e,!0),e.strm.avail_out===0?cT1:xj1):e.last_lit&&(AR(e,!1),e.strm.avail_out===0)?mV:ec2}function eK8(e,t){for(var r,a,i,n,o=e.window;;){if(e.lookahead<=Pm1){if(sT1(e),e.lookahead<=Pm1&&t===hT1)return mV;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=tf&&e.strstart>0&&(i=e.strstart-1,a=o[i],a===o[++i]&&a===o[++i]&&a===o[++i])){n=e.strstart+Pm1;do;while(a===o[++i]&&a===o[++i]&&a===o[++i]&&a===o[++i]&&a===o[++i]&&a===o[++i]&&a===o[++i]&&a===o[++i]&&i<n);e.match_length=Pm1-(n-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=tf?(r=bQ._tr_tally(e,1,e.match_length-tf),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=bQ._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(AR(e,!1),e.strm.avail_out===0))return mV}return e.insert=0,t===Em1?(AR(e,!0),e.strm.avail_out===0?cT1:xj1):e.last_lit&&(AR(e,!1),e.strm.avail_out===0)?mV:ec2}function rK8(e,t){for(var r;;){if(e.lookahead===0&&(sT1(e),e.lookahead===0)){if(t===hT1)return mV;break}if(e.match_length=0,r=bQ._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(AR(e,!1),e.strm.avail_out===0))return mV}return e.insert=0,t===Em1?(AR(e,!0),e.strm.avail_out===0?cT1:xj1):e.last_lit&&(AR(e,!1),e.strm.avail_out===0)?mV:ec2}function fr1(e,t,r,a,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=a,this.func=i}var Mj1;Mj1=[new fr1(0,0,0,0,tK8),new fr1(4,4,8,4,A84),new fr1(4,5,16,8,A84),new fr1(4,6,32,32,A84),new fr1(4,4,16,16,Cj1),new fr1(8,16,32,32,Cj1),new fr1(8,16,128,128,Cj1),new fr1(8,32,128,256,Cj1),new fr1(32,128,258,1024,Cj1),new fr1(32,258,258,4096,Cj1)];function aK8(e){e.window_size=2*e.w_size,Vm1(e.head),e.max_lazy_match=Mj1[e.level].max_lazy,e.good_match=Mj1[e.level].good_length,e.nice_match=Mj1[e.level].nice_length,e.max_chain_length=Mj1[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=tf-1,e.match_available=0,e.ins_h=0}function iK8(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=wq2,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new JI.Buf16(K$8*2),this.dyn_dtree=new JI.Buf16((2*q$8+1)*2),this.bl_tree=new JI.Buf16((2*$$8+1)*2),Vm1(this.dyn_ltree),Vm1(this.dyn_dtree),Vm1(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new JI.Buf16(Y$8+1),this.heap=new JI.Buf16(2*z84+1),Vm1(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new JI.Buf16(2*z84+1),Vm1(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Ac3(e){var t;return!e||!e.state?_m1(e,SQ):(e.total_in=e.total_out=0,e.data_type=I$8,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?yq2:lT1,e.adler=t.wrap===2?0:1,t.last_flush=hT1,bQ._tr_init(t),vr1)}function zc3(e){var t=Ac3(e);return t===vr1&&aK8(e.state),t}function nK8(e,t){return!e||!e.state||e.state.wrap!==2?SQ:(e.state.gzhead=t,vr1)}function bc3(e,t,r,a,i,n){if(!e)return SQ;var o=1;if(t===R$8&&(t=6),a<0?(o=0,a=-a):a>15&&(o=2,a-=16),i<1||i>N$8||r!==wq2||a<8||a>15||t<0||t>9||n<0||n>O$8)return _m1(e,SQ);a===8&&(a=9);var h=new iK8;return e.state=h,h.strm=e,h.wrap=o,h.gzhead=null,h.w_bits=a,h.w_size=1<<h.w_bits,h.w_mask=h.w_size-1,h.hash_bits=i+7,h.hash_size=1<<h.hash_bits,h.hash_mask=h.hash_size-1,h.hash_shift=~~((h.hash_bits+tf-1)/tf),h.window=new JI.Buf8(h.w_size*2),h.head=new JI.Buf16(h.hash_size),h.prev=new JI.Buf16(h.w_size),h.lit_bufsize=1<<i+6,h.pending_buf_size=h.lit_bufsize*4,h.pending_buf=new JI.Buf8(h.pending_buf_size),h.d_buf=1*h.lit_bufsize,h.l_buf=3*h.lit_bufsize,h.level=t,h.strategy=n,h.method=r,zc3(e)}function oK8(e,t){return bc3(e,t,wq2,U$8,G$8,D$8)}function lK8(e,t){var r,a,i,n;if(!e||!e.state||t>Mc3||t<0)return e?_m1(e,SQ):SQ;if(a=e.state,!e.output||!e.input&&e.avail_in!==0||a.status===tc2&&t!==Em1)return _m1(e,e.avail_out===0?y84:SQ);if(a.strm=e,r=a.last_flush,a.last_flush=t,a.status===yq2)if(a.wrap===2)e.adler=0,hm(a,31),hm(a,139),hm(a,8),a.gzhead?(hm(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),hm(a,a.gzhead.time&255),hm(a,a.gzhead.time>>8&255),hm(a,a.gzhead.time>>16&255),hm(a,a.gzhead.time>>24&255),hm(a,a.level===9?2:a.strategy>=Cq2||a.level<2?4:0),hm(a,a.gzhead.os&255),a.gzhead.extra&&a.gzhead.extra.length&&(hm(a,a.gzhead.extra.length&255),hm(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=Tm1(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=b84):(hm(a,0),hm(a,0),hm(a,0),hm(a,0),hm(a,0),hm(a,a.level===9?2:a.strategy>=Cq2||a.level<2?4:0),hm(a,J$8),a.status=lT1);else{var o=wq2+(a.w_bits-8<<4)<<8,h=-1;a.strategy>=Cq2||a.level<2?h=0:a.level<6?h=1:a.level===6?h=2:h=3,o|=h<<6,a.strstart!==0&&(o|=X$8),o+=31-o%31,a.status=lT1,Ql2(a,o),a.strstart!==0&&(Ql2(a,e.adler>>>16),Ql2(a,e.adler&65535)),e.adler=1}if(a.status===b84)if(a.gzhead.extra){for(i=a.pending;a.gzindex<(a.gzhead.extra.length&65535)&&!(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>i&&(e.adler=Tm1(e.adler,a.pending_buf,a.pending-i,i)),Bm1(e),i=a.pending,a.pending===a.pending_buf_size));)hm(a,a.gzhead.extra[a.gzindex]&255),a.gzindex++;a.gzhead.hcrc&&a.pending>i&&(e.adler=Tm1(e.adler,a.pending_buf,a.pending-i,i)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=Mq2)}else a.status=Mq2;if(a.status===Mq2)if(a.gzhead.name){i=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>i&&(e.adler=Tm1(e.adler,a.pending_buf,a.pending-i,i)),Bm1(e),i=a.pending,a.pending===a.pending_buf_size)){n=1;break}a.gzindex<a.gzhead.name.length?n=a.gzhead.name.charCodeAt(a.gzindex++)&255:n=0,hm(a,n)}while(n!==0);a.gzhead.hcrc&&a.pending>i&&(e.adler=Tm1(e.adler,a.pending_buf,a.pending-i,i)),n===0&&(a.gzindex=0,a.status=xq2)}else a.status=xq2;if(a.status===xq2)if(a.gzhead.comment){i=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>i&&(e.adler=Tm1(e.adler,a.pending_buf,a.pending-i,i)),Bm1(e),i=a.pending,a.pending===a.pending_buf_size)){n=1;break}a.gzindex<a.gzhead.comment.length?n=a.gzhead.comment.charCodeAt(a.gzindex++)&255:n=0,hm(a,n)}while(n!==0);a.gzhead.hcrc&&a.pending>i&&(e.adler=Tm1(e.adler,a.pending_buf,a.pending-i,i)),n===0&&(a.status=Lq2)}else a.status=Lq2;if(a.status===Lq2&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&Bm1(e),a.pending+2<=a.pending_buf_size&&(hm(a,e.adler&255),hm(a,e.adler>>8&255),e.adler=0,a.status=lT1)):a.status=lT1),a.pending!==0){if(Bm1(e),e.avail_out===0)return a.last_flush=-1,vr1}else if(e.avail_in===0&&Lc3(t)<=Lc3(r)&&t!==Em1)return _m1(e,y84);if(a.status===tc2&&e.avail_in!==0)return _m1(e,y84);if(e.avail_in!==0||a.lookahead!==0||t!==hT1&&a.status!==tc2){var u=a.strategy===Cq2?rK8(a,t):a.strategy===F$8?eK8(a,t):Mj1[a.level].func(a,t);if((u===cT1||u===xj1)&&(a.status=tc2),u===mV||u===cT1)return e.avail_out===0&&(a.last_flush=-1),vr1;if(u===ec2&&(t===P$8?bQ._tr_align(a):t!==Mc3&&(bQ._tr_stored_block(a,0,0,!1),t===_$8&&(Vm1(a.head),a.lookahead===0&&(a.strstart=0,a.block_start=0,a.insert=0))),Bm1(e),e.avail_out===0))return a.last_flush=-1,vr1}return t!==Em1?vr1:a.wrap<=0?xc3:(a.wrap===2?(hm(a,e.adler&255),hm(a,e.adler>>8&255),hm(a,e.adler>>16&255),hm(a,e.adler>>24&255),hm(a,e.total_in&255),hm(a,e.total_in>>8&255),hm(a,e.total_in>>16&255),hm(a,e.total_in>>24&255)):(Ql2(a,e.adler>>>16),Ql2(a,e.adler&65535)),Bm1(e),a.wrap>0&&(a.wrap=-a.wrap),a.pending!==0?vr1:xc3)}function cK8(e){var t;return!e||!e.state?SQ:(t=e.state.status,t!==yq2&&t!==b84&&t!==Mq2&&t!==xq2&&t!==Lq2&&t!==lT1&&t!==tc2?_m1(e,SQ):(e.state=null,t===lT1?_m1(e,E$8):vr1))}function sK8(e,t){var r=t.length,a,i,n,o,h,u,g,f;if(!e||!e.state||(a=e.state,o=a.wrap,o===2||o===1&&a.status!==yq2||a.lookahead))return SQ;for(o===1&&(e.adler=wc3(e.adler,t,r,0)),a.wrap=0,r>=a.w_size&&(o===0&&(Vm1(a.head),a.strstart=0,a.block_start=0,a.insert=0),f=new JI.Buf8(a.w_size),JI.arraySet(f,t,r-a.w_size,a.w_size,0),t=f,r=a.w_size),h=e.avail_in,u=e.next_in,g=e.input,e.avail_in=r,e.next_in=0,e.input=t,sT1(a);a.lookahead>=tf;){i=a.strstart,n=a.lookahead-(tf-1);do a.ins_h=(a.ins_h<<a.hash_shift^a.window[i+tf-1])&a.hash_mask,a.prev[i&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=i,i++;while(--n);a.strstart=i,a.lookahead=tf-1,sT1(a)}return a.strstart+=a.lookahead,a.block_start=a.strstart,a.insert=a.lookahead,a.lookahead=0,a.match_length=a.prev_length=tf-1,a.match_available=0,e.next_in=u,e.input=g,e.avail_in=h,a.wrap=o,vr1}mr1.deflateInit=oK8;mr1.deflateInit2=bc3;mr1.deflateReset=zc3;mr1.deflateResetKeep=Ac3;mr1.deflateSetHeader=nK8;mr1.deflate=lK8;mr1.deflateEnd=cK8;mr1.deflateSetDictionary=sK8;mr1.deflateInfo="pako deflate (from Nodeca project)"});var S84=M1(Lj1=>{"use strict";var Aq2=bc1(),Hc3=!0,kc3=!0;try{String.fromCharCode.apply(null,[0])}catch{Hc3=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{kc3=!1}var rc2=new Aq2.Buf8(256);for(Hc1=0;Hc1<256;Hc1++)rc2[Hc1]=Hc1>=252?6:Hc1>=248?5:Hc1>=240?4:Hc1>=224?3:Hc1>=192?2:1;var Hc1;rc2[254]=rc2[254]=1;Lj1.string2buf=function(e){var t,r,a,i,n,o=e.length,h=0;for(i=0;i<o;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(a=e.charCodeAt(i+1),(a&64512)===56320&&(r=65536+(r-55296<<10)+(a-56320),i++)),h+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Aq2.Buf8(h),n=0,i=0;n<h;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(a=e.charCodeAt(i+1),(a&64512)===56320&&(r=65536+(r-55296<<10)+(a-56320),i++)),r<128?t[n++]=r:r<2048?(t[n++]=192|r>>>6,t[n++]=128|r&63):r<65536?(t[n++]=224|r>>>12,t[n++]=128|r>>>6&63,t[n++]=128|r&63):(t[n++]=240|r>>>18,t[n++]=128|r>>>12&63,t[n++]=128|r>>>6&63,t[n++]=128|r&63);return t};function Tc3(e,t){if(t<65534&&(e.subarray&&kc3||!e.subarray&&Hc3))return String.fromCharCode.apply(null,Aq2.shrinkBuf(e,t));for(var r="",a=0;a<t;a++)r+=String.fromCharCode(e[a]);return r}Lj1.buf2binstring=function(e){return Tc3(e,e.length)};Lj1.binstring2buf=function(e){for(var t=new Aq2.Buf8(e.length),r=0,a=t.length;r<a;r++)t[r]=e.charCodeAt(r);return t};Lj1.buf2string=function(e,t){var r,a,i,n,o=t||e.length,h=new Array(o*2);for(a=0,r=0;r<o;){if(i=e[r++],i<128){h[a++]=i;continue}if(n=rc2[i],n>4){h[a++]=65533,r+=n-1;continue}for(i&=n===2?31:n===3?15:7;n>1&&r<o;)i=i<<6|e[r++]&63,n--;if(n>1){h[a++]=65533;continue}i<65536?h[a++]=i:(i-=65536,h[a++]=55296|i>>10&1023,h[a++]=56320|i&1023)}return Tc3(h,a)};Lj1.utf8border=function(e,t){var r;for(t=t||e.length,t>e.length&&(t=e.length),r=t-1;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+rc2[e[r]]>t?r:t}});var H84=M1((SC9,Bc3)=>{"use strict";function hK8(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}Bc3.exports=hK8});var Ec3=M1(nc2=>{"use strict";var ac2=Sc3(),ic2=bc1(),T84=S84(),B84=mq2(),dK8=H84(),_c3=Object.prototype.toString,uK8=0,k84=4,wj1=0,Vc3=1,Pc3=2,gK8=-1,pK8=0,fK8=8;function dT1(e){if(!(this instanceof dT1))return new dT1(e);this.options=ic2.assign({level:gK8,method:fK8,chunkSize:16384,windowBits:15,memLevel:8,strategy:pK8,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new dK8,this.strm.avail_out=0;var r=ac2.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==wj1)throw new Error(B84[r]);if(t.header&&ac2.deflateSetHeader(this.strm,t.header),t.dictionary){var a;if(typeof t.dictionary=="string"?a=T84.string2buf(t.dictionary):_c3.call(t.dictionary)==="[object ArrayBuffer]"?a=new Uint8Array(t.dictionary):a=t.dictionary,r=ac2.deflateSetDictionary(this.strm,a),r!==wj1)throw new Error(B84[r]);this._dict_set=!0}}dT1.prototype.push=function(e,t){var r=this.strm,a=this.options.chunkSize,i,n;if(this.ended)return!1;n=t===~~t?t:t===!0?k84:uK8,typeof e=="string"?r.input=T84.string2buf(e):_c3.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new ic2.Buf8(a),r.next_out=0,r.avail_out=a),i=ac2.deflate(r,n),i!==Vc3&&i!==wj1)return this.onEnd(i),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(n===k84||n===Pc3))&&(this.options.to==="string"?this.onData(T84.buf2binstring(ic2.shrinkBuf(r.output,r.next_out))):this.onData(ic2.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&i!==Vc3);return n===k84?(i=ac2.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===wj1):(n===Pc3&&(this.onEnd(wj1),r.avail_out=0),!0)};dT1.prototype.onData=function(e){this.chunks.push(e)};dT1.prototype.onEnd=function(e){e===wj1&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=ic2.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function V84(e,t){var r=new dT1(t);if(r.push(e,!0),r.err)throw r.msg||B84[r.err];return r.result}function vK8(e,t){return t=t||{},t.raw=!0,V84(e,t)}function mK8(e,t){return t=t||{},t.gzip=!0,V84(e,t)}nc2.Deflate=dT1;nc2.deflate=V84;nc2.deflateRaw=vK8;nc2.gzip=mK8});var Zc3=M1((kC9,Rc3)=>{"use strict";var zq2=30,CK8=12;Rc3.exports=function(t,r){var a,i,n,o,h,u,g,f,v,C,L,y,z,S,B,R,F,N,j,Y,t1,n1,a1,s1,p1;a=t.state,i=t.next_in,s1=t.input,n=i+(t.avail_in-5),o=t.next_out,p1=t.output,h=o-(r-t.avail_out),u=o+(t.avail_out-257),g=a.dmax,f=a.wsize,v=a.whave,C=a.wnext,L=a.window,y=a.hold,z=a.bits,S=a.lencode,B=a.distcode,R=(1<<a.lenbits)-1,F=(1<<a.distbits)-1;t:do{z<15&&(y+=s1[i++]<<z,z+=8,y+=s1[i++]<<z,z+=8),N=S[y&R];e:for(;;){if(j=N>>>24,y>>>=j,z-=j,j=N>>>16&255,j===0)p1[o++]=N&65535;else if(j&16){Y=N&65535,j&=15,j&&(z<j&&(y+=s1[i++]<<z,z+=8),Y+=y&(1<<j)-1,y>>>=j,z-=j),z<15&&(y+=s1[i++]<<z,z+=8,y+=s1[i++]<<z,z+=8),N=B[y&F];r:for(;;){if(j=N>>>24,y>>>=j,z-=j,j=N>>>16&255,j&16){if(t1=N&65535,j&=15,z<j&&(y+=s1[i++]<<z,z+=8,z<j&&(y+=s1[i++]<<z,z+=8)),t1+=y&(1<<j)-1,t1>g){t.msg="invalid distance too far back",a.mode=zq2;break t}if(y>>>=j,z-=j,j=o-h,t1>j){if(j=t1-j,j>v&&a.sane){t.msg="invalid distance too far back",a.mode=zq2;break t}if(n1=0,a1=L,C===0){if(n1+=f-j,j<Y){Y-=j;do p1[o++]=L[n1++];while(--j);n1=o-t1,a1=p1}}else if(C<j){if(n1+=f+C-j,j-=C,j<Y){Y-=j;do p1[o++]=L[n1++];while(--j);if(n1=0,C<Y){j=C,Y-=j;do p1[o++]=L[n1++];while(--j);n1=o-t1,a1=p1}}}else if(n1+=C-j,j<Y){Y-=j;do p1[o++]=L[n1++];while(--j);n1=o-t1,a1=p1}for(;Y>2;)p1[o++]=a1[n1++],p1[o++]=a1[n1++],p1[o++]=a1[n1++],Y-=3;Y&&(p1[o++]=a1[n1++],Y>1&&(p1[o++]=a1[n1++]))}else{n1=o-t1;do p1[o++]=p1[n1++],p1[o++]=p1[n1++],p1[o++]=p1[n1++],Y-=3;while(Y>2);Y&&(p1[o++]=p1[n1++],Y>1&&(p1[o++]=p1[n1++]))}}else if((j&64)===0){N=B[(N&65535)+(y&(1<<j)-1)];continue r}else{t.msg="invalid distance code",a.mode=zq2;break t}break}}else if((j&64)===0){N=S[(N&65535)+(y&(1<<j)-1)];continue e}else if(j&32){a.mode=CK8;break t}else{t.msg="invalid literal/length code",a.mode=zq2;break t}break}}while(i<n&&o<u);Y=z>>3,i-=Y,z-=Y<<3,y&=(1<<z)-1,t.next_in=i,t.next_out=o,t.avail_in=i<n?5+(n-i):5-(i-n),t.avail_out=o<u?257+(u-o):257-(o-u),a.hold=y,a.bits=z}});var Gc3=M1((TC9,Uc3)=>{"use strict";var Fc3=bc1(),yj1=15,Oc3=852,Dc3=592,Ic3=0,P84=1,Nc3=2,MK8=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],xK8=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],LK8=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],wK8=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];Uc3.exports=function(t,r,a,i,n,o,h,u){var g=u.bits,f=0,v=0,C=0,L=0,y=0,z=0,S=0,B=0,R=0,F=0,N,j,Y,t1,n1,a1=null,s1=0,p1,u1=new Fc3.Buf16(yj1+1),v1=new Fc3.Buf16(yj1+1),h1=null,H1=0,z1,b1,m1;for(f=0;f<=yj1;f++)u1[f]=0;for(v=0;v<i;v++)u1[r[a+v]]++;for(y=g,L=yj1;L>=1&&u1[L]===0;L--);if(y>L&&(y=L),L===0)return n[o++]=1<<24|64<<16|0,n[o++]=1<<24|64<<16|0,u.bits=1,0;for(C=1;C<L&&u1[C]===0;C++);for(y<C&&(y=C),B=1,f=1;f<=yj1;f++)if(B<<=1,B-=u1[f],B<0)return-1;if(B>0&&(t===Ic3||L!==1))return-1;for(v1[1]=0,f=1;f<yj1;f++)v1[f+1]=v1[f]+u1[f];for(v=0;v<i;v++)r[a+v]!==0&&(h[v1[r[a+v]]++]=v);if(t===Ic3?(a1=h1=h,p1=19):t===P84?(a1=MK8,s1-=257,h1=xK8,H1-=257,p1=256):(a1=LK8,h1=wK8,p1=-1),F=0,v=0,f=C,n1=o,z=y,S=0,Y=-1,R=1<<y,t1=R-1,t===P84&&R>Oc3||t===Nc3&&R>Dc3)return 1;for(;;){z1=f-S,h[v]<p1?(b1=0,m1=h[v]):h[v]>p1?(b1=h1[H1+h[v]],m1=a1[s1+h[v]]):(b1=96,m1=0),N=1<<f-S,j=1<<z,C=j;do j-=N,n[n1+(F>>S)+j]=z1<<24|b1<<16|m1|0;while(j!==0);for(N=1<<f-1;F&N;)N>>=1;if(N!==0?(F&=N-1,F+=N):F=0,v++,--u1[f]===0){if(f===L)break;f=r[a+h[v]]}if(f>y&&(F&t1)!==Y){for(S===0&&(S=y),n1+=C,z=f-S,B=1<<z;z+S<L&&(B-=u1[z+S],!(B<=0));)z++,B<<=1;if(R+=1<<z,t===P84&&R>Oc3||t===Nc3&&R>Dc3)return 1;Y=F&t1,n[Y]=y<<24|z<<16|n1-o|0}}return F!==0&&(n[n1+F]=f-S<<24|64<<16|0),u.bits=y,0}});var zs3=M1(z31=>{"use strict";var fK=bc1(),O84=L84(),Cr1=w84(),yK8=Zc3(),oc2=Gc3(),AK8=0,vs3=1,ms3=2,jc3=4,zK8=5,bq2=6,uT1=0,bK8=1,SK8=2,HQ=-2,Cs3=-3,D84=-4,HK8=-5,Wc3=8,Ms3=1,qc3=2,$c3=3,Kc3=4,Yc3=5,Xc3=6,Jc3=7,Qc3=8,ts3=9,es3=10,kq2=11,kc1=12,_84=13,rs3=14,E84=15,as3=16,is3=17,ns3=18,os3=19,Sq2=20,Hq2=21,ls3=22,cs3=23,ss3=24,hs3=25,ds3=26,R84=27,us3=28,gs3=29,WA=30,I84=31,kK8=32,TK8=852,BK8=592,VK8=15,PK8=VK8;function ps3(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function _K8(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new fK.Buf16(320),this.work=new fK.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function xs3(e){var t;return!e||!e.state?HQ:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Ms3,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new fK.Buf32(TK8),t.distcode=t.distdyn=new fK.Buf32(BK8),t.sane=1,t.back=-1,uT1)}function Ls3(e){var t;return!e||!e.state?HQ:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,xs3(e))}function ws3(e,t){var r,a;return!e||!e.state||(a=e.state,t<0?(r=0,t=-t):(r=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?HQ:(a.window!==null&&a.wbits!==t&&(a.window=null),a.wrap=r,a.wbits=t,Ls3(e))}function ys3(e,t){var r,a;return e?(a=new _K8,e.state=a,a.window=null,r=ws3(e,t),r!==uT1&&(e.state=null),r):HQ}function EK8(e){return ys3(e,PK8)}var fs3=!0,Z84,F84;function RK8(e){if(fs3){var t;for(Z84=new fK.Buf32(512),F84=new fK.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(oc2(vs3,e.lens,0,288,Z84,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;oc2(ms3,e.lens,0,32,F84,0,e.work,{bits:5}),fs3=!1}e.lencode=Z84,e.lenbits=9,e.distcode=F84,e.distbits=5}function As3(e,t,r,a){var i,n=e.state;return n.window===null&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0,n.window=new fK.Buf8(n.wsize)),a>=n.wsize?(fK.arraySet(n.window,t,r-n.wsize,n.wsize,0),n.wnext=0,n.whave=n.wsize):(i=n.wsize-n.wnext,i>a&&(i=a),fK.arraySet(n.window,t,r-a,i,n.wnext),a-=i,a?(fK.arraySet(n.window,t,r-a,a,0),n.wnext=a,n.whave=n.wsize):(n.wnext+=i,n.wnext===n.wsize&&(n.wnext=0),n.whave<n.wsize&&(n.whave+=i))),0}function ZK8(e,t){var r,a,i,n,o,h,u,g,f,v,C,L,y,z,S=0,B,R,F,N,j,Y,t1,n1,a1=new fK.Buf8(4),s1,p1,u1=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return HQ;r=e.state,r.mode===kc1&&(r.mode=_84),o=e.next_out,i=e.output,u=e.avail_out,n=e.next_in,a=e.input,h=e.avail_in,g=r.hold,f=r.bits,v=h,C=u,n1=uT1;t:for(;;)switch(r.mode){case Ms3:if(r.wrap===0){r.mode=_84;break}for(;f<16;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if(r.wrap&2&&g===35615){r.check=0,a1[0]=g&255,a1[1]=g>>>8&255,r.check=Cr1(r.check,a1,2,0),g=0,f=0,r.mode=qc3;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((g&255)<<8)+(g>>8))%31){e.msg="incorrect header check",r.mode=WA;break}if((g&15)!==Wc3){e.msg="unknown compression method",r.mode=WA;break}if(g>>>=4,f-=4,t1=(g&15)+8,r.wbits===0)r.wbits=t1;else if(t1>r.wbits){e.msg="invalid window size",r.mode=WA;break}r.dmax=1<<t1,e.adler=r.check=1,r.mode=g&512?es3:kc1,g=0,f=0;break;case qc3:for(;f<16;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if(r.flags=g,(r.flags&255)!==Wc3){e.msg="unknown compression method",r.mode=WA;break}if(r.flags&57344){e.msg="unknown header flags set",r.mode=WA;break}r.head&&(r.head.text=g>>8&1),r.flags&512&&(a1[0]=g&255,a1[1]=g>>>8&255,r.check=Cr1(r.check,a1,2,0)),g=0,f=0,r.mode=$c3;case $c3:for(;f<32;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}r.head&&(r.head.time=g),r.flags&512&&(a1[0]=g&255,a1[1]=g>>>8&255,a1[2]=g>>>16&255,a1[3]=g>>>24&255,r.check=Cr1(r.check,a1,4,0)),g=0,f=0,r.mode=Kc3;case Kc3:for(;f<16;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}r.head&&(r.head.xflags=g&255,r.head.os=g>>8),r.flags&512&&(a1[0]=g&255,a1[1]=g>>>8&255,r.check=Cr1(r.check,a1,2,0)),g=0,f=0,r.mode=Yc3;case Yc3:if(r.flags&1024){for(;f<16;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}r.length=g,r.head&&(r.head.extra_len=g),r.flags&512&&(a1[0]=g&255,a1[1]=g>>>8&255,r.check=Cr1(r.check,a1,2,0)),g=0,f=0}else r.head&&(r.head.extra=null);r.mode=Xc3;case Xc3:if(r.flags&1024&&(L=r.length,L>h&&(L=h),L&&(r.head&&(t1=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),fK.arraySet(r.head.extra,a,n,L,t1)),r.flags&512&&(r.check=Cr1(r.check,a,L,n)),h-=L,n+=L,r.length-=L),r.length))break t;r.length=0,r.mode=Jc3;case Jc3:if(r.flags&2048){if(h===0)break t;L=0;do t1=a[n+L++],r.head&&t1&&r.length<65536&&(r.head.name+=String.fromCharCode(t1));while(t1&&L<h);if(r.flags&512&&(r.check=Cr1(r.check,a,L,n)),h-=L,n+=L,t1)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=Qc3;case Qc3:if(r.flags&4096){if(h===0)break t;L=0;do t1=a[n+L++],r.head&&t1&&r.length<65536&&(r.head.comment+=String.fromCharCode(t1));while(t1&&L<h);if(r.flags&512&&(r.check=Cr1(r.check,a,L,n)),h-=L,n+=L,t1)break t}else r.head&&(r.head.comment=null);r.mode=ts3;case ts3:if(r.flags&512){for(;f<16;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if(g!==(r.check&65535)){e.msg="header crc mismatch",r.mode=WA;break}g=0,f=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=kc1;break;case es3:for(;f<32;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}e.adler=r.check=ps3(g),g=0,f=0,r.mode=kq2;case kq2:if(r.havedict===0)return e.next_out=o,e.avail_out=u,e.next_in=n,e.avail_in=h,r.hold=g,r.bits=f,SK8;e.adler=r.check=1,r.mode=kc1;case kc1:if(t===zK8||t===bq2)break t;case _84:if(r.last){g>>>=f&7,f-=f&7,r.mode=R84;break}for(;f<3;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}switch(r.last=g&1,g>>>=1,f-=1,g&3){case 0:r.mode=rs3;break;case 1:if(RK8(r),r.mode=Sq2,t===bq2){g>>>=2,f-=2;break t}break;case 2:r.mode=is3;break;case 3:e.msg="invalid block type",r.mode=WA}g>>>=2,f-=2;break;case rs3:for(g>>>=f&7,f-=f&7;f<32;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if((g&65535)!==(g>>>16^65535)){e.msg="invalid stored block lengths",r.mode=WA;break}if(r.length=g&65535,g=0,f=0,r.mode=E84,t===bq2)break t;case E84:r.mode=as3;case as3:if(L=r.length,L){if(L>h&&(L=h),L>u&&(L=u),L===0)break t;fK.arraySet(i,a,n,L,o),h-=L,n+=L,u-=L,o+=L,r.length-=L;break}r.mode=kc1;break;case is3:for(;f<14;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if(r.nlen=(g&31)+257,g>>>=5,f-=5,r.ndist=(g&31)+1,g>>>=5,f-=5,r.ncode=(g&15)+4,g>>>=4,f-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=WA;break}r.have=0,r.mode=ns3;case ns3:for(;r.have<r.ncode;){for(;f<3;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}r.lens[u1[r.have++]]=g&7,g>>>=3,f-=3}for(;r.have<19;)r.lens[u1[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,s1={bits:r.lenbits},n1=oc2(AK8,r.lens,0,19,r.lencode,0,r.work,s1),r.lenbits=s1.bits,n1){e.msg="invalid code lengths set",r.mode=WA;break}r.have=0,r.mode=os3;case os3:for(;r.have<r.nlen+r.ndist;){for(;S=r.lencode[g&(1<<r.lenbits)-1],B=S>>>24,R=S>>>16&255,F=S&65535,!(B<=f);){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if(F<16)g>>>=B,f-=B,r.lens[r.have++]=F;else{if(F===16){for(p1=B+2;f<p1;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if(g>>>=B,f-=B,r.have===0){e.msg="invalid bit length repeat",r.mode=WA;break}t1=r.lens[r.have-1],L=3+(g&3),g>>>=2,f-=2}else if(F===17){for(p1=B+3;f<p1;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}g>>>=B,f-=B,t1=0,L=3+(g&7),g>>>=3,f-=3}else{for(p1=B+7;f<p1;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}g>>>=B,f-=B,t1=0,L=11+(g&127),g>>>=7,f-=7}if(r.have+L>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=WA;break}for(;L--;)r.lens[r.have++]=t1}}if(r.mode===WA)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=WA;break}if(r.lenbits=9,s1={bits:r.lenbits},n1=oc2(vs3,r.lens,0,r.nlen,r.lencode,0,r.work,s1),r.lenbits=s1.bits,n1){e.msg="invalid literal/lengths set",r.mode=WA;break}if(r.distbits=6,r.distcode=r.distdyn,s1={bits:r.distbits},n1=oc2(ms3,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,s1),r.distbits=s1.bits,n1){e.msg="invalid distances set",r.mode=WA;break}if(r.mode=Sq2,t===bq2)break t;case Sq2:r.mode=Hq2;case Hq2:if(h>=6&&u>=258){e.next_out=o,e.avail_out=u,e.next_in=n,e.avail_in=h,r.hold=g,r.bits=f,yK8(e,C),o=e.next_out,i=e.output,u=e.avail_out,n=e.next_in,a=e.input,h=e.avail_in,g=r.hold,f=r.bits,r.mode===kc1&&(r.back=-1);break}for(r.back=0;S=r.lencode[g&(1<<r.lenbits)-1],B=S>>>24,R=S>>>16&255,F=S&65535,!(B<=f);){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if(R&&(R&240)===0){for(N=B,j=R,Y=F;S=r.lencode[Y+((g&(1<<N+j)-1)>>N)],B=S>>>24,R=S>>>16&255,F=S&65535,!(N+B<=f);){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}g>>>=N,f-=N,r.back+=N}if(g>>>=B,f-=B,r.back+=B,r.length=F,R===0){r.mode=ds3;break}if(R&32){r.back=-1,r.mode=kc1;break}if(R&64){e.msg="invalid literal/length code",r.mode=WA;break}r.extra=R&15,r.mode=ls3;case ls3:if(r.extra){for(p1=r.extra;f<p1;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}r.length+=g&(1<<r.extra)-1,g>>>=r.extra,f-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=cs3;case cs3:for(;S=r.distcode[g&(1<<r.distbits)-1],B=S>>>24,R=S>>>16&255,F=S&65535,!(B<=f);){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if((R&240)===0){for(N=B,j=R,Y=F;S=r.distcode[Y+((g&(1<<N+j)-1)>>N)],B=S>>>24,R=S>>>16&255,F=S&65535,!(N+B<=f);){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}g>>>=N,f-=N,r.back+=N}if(g>>>=B,f-=B,r.back+=B,R&64){e.msg="invalid distance code",r.mode=WA;break}r.offset=F,r.extra=R&15,r.mode=ss3;case ss3:if(r.extra){for(p1=r.extra;f<p1;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}r.offset+=g&(1<<r.extra)-1,g>>>=r.extra,f-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=WA;break}r.mode=hs3;case hs3:if(u===0)break t;if(L=C-u,r.offset>L){if(L=r.offset-L,L>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=WA;break}L>r.wnext?(L-=r.wnext,y=r.wsize-L):y=r.wnext-L,L>r.length&&(L=r.length),z=r.window}else z=i,y=o-r.offset,L=r.length;L>u&&(L=u),u-=L,r.length-=L;do i[o++]=z[y++];while(--L);r.length===0&&(r.mode=Hq2);break;case ds3:if(u===0)break t;i[o++]=r.length,u--,r.mode=Hq2;break;case R84:if(r.wrap){for(;f<32;){if(h===0)break t;h--,g|=a[n++]<<f,f+=8}if(C-=u,e.total_out+=C,r.total+=C,C&&(e.adler=r.check=r.flags?Cr1(r.check,i,C,o-C):O84(r.check,i,C,o-C)),C=u,(r.flags?g:ps3(g))!==r.check){e.msg="incorrect data check",r.mode=WA;break}g=0,f=0}r.mode=us3;case us3:if(r.wrap&&r.flags){for(;f<32;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if(g!==(r.total&4294967295)){e.msg="incorrect length check",r.mode=WA;break}g=0,f=0}r.mode=gs3;case gs3:n1=bK8;break t;case WA:n1=Cs3;break t;case I84:return D84;case kK8:default:return HQ}return e.next_out=o,e.avail_out=u,e.next_in=n,e.avail_in=h,r.hold=g,r.bits=f,(r.wsize||C!==e.avail_out&&r.mode<WA&&(r.mode<R84||t!==jc3))&&As3(e,e.output,e.next_out,C-e.avail_out)?(r.mode=I84,D84):(v-=e.avail_in,C-=e.avail_out,e.total_in+=v,e.total_out+=C,r.total+=C,r.wrap&&C&&(e.adler=r.check=r.flags?Cr1(r.check,i,C,e.next_out-C):O84(r.check,i,C,e.next_out-C)),e.data_type=r.bits+(r.last?64:0)+(r.mode===kc1?128:0)+(r.mode===Sq2||r.mode===E84?256:0),(v===0&&C===0||t===jc3)&&n1===uT1&&(n1=HK8),n1)}function FK8(e){if(!e||!e.state)return HQ;var t=e.state;return t.window&&(t.window=null),e.state=null,uT1}function OK8(e,t){var r;return!e||!e.state||(r=e.state,(r.wrap&2)===0)?HQ:(r.head=t,t.done=!1,uT1)}function DK8(e,t){var r=t.length,a,i,n;return!e||!e.state||(a=e.state,a.wrap!==0&&a.mode!==kq2)?HQ:a.mode===kq2&&(i=1,i=O84(i,t,r,0),i!==a.check)?Cs3:(n=As3(e,t,r,r),n?(a.mode=I84,D84):(a.havedict=1,uT1))}z31.inflateReset=Ls3;z31.inflateReset2=ws3;z31.inflateResetKeep=xs3;z31.inflateInit=EK8;z31.inflateInit2=ys3;z31.inflate=ZK8;z31.inflateEnd=FK8;z31.inflateGetHeader=OK8;z31.inflateSetDictionary=DK8;z31.inflateInfo="pako inflate (from Nodeca project)"});var N84=M1((VC9,bs3)=>{"use strict";bs3.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var Hs3=M1((PC9,Ss3)=>{"use strict";function IK8(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}Ss3.exports=IK8});var Ts3=M1(cc2=>{"use strict";var Aj1=zs3(),lc2=bc1(),Tq2=S84(),ik=N84(),U84=mq2(),NK8=H84(),UK8=Hs3(),ks3=Object.prototype.toString;function gT1(e){if(!(this instanceof gT1))return new gT1(e);this.options=lc2.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new NK8,this.strm.avail_out=0;var r=Aj1.inflateInit2(this.strm,t.windowBits);if(r!==ik.Z_OK)throw new Error(U84[r]);if(this.header=new UK8,Aj1.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Tq2.string2buf(t.dictionary):ks3.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Aj1.inflateSetDictionary(this.strm,t.dictionary),r!==ik.Z_OK)))throw new Error(U84[r])}gT1.prototype.push=function(e,t){var r=this.strm,a=this.options.chunkSize,i=this.options.dictionary,n,o,h,u,g,f=!1;if(this.ended)return!1;o=t===~~t?t:t===!0?ik.Z_FINISH:ik.Z_NO_FLUSH,typeof e=="string"?r.input=Tq2.binstring2buf(e):ks3.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new lc2.Buf8(a),r.next_out=0,r.avail_out=a),n=Aj1.inflate(r,ik.Z_NO_FLUSH),n===ik.Z_NEED_DICT&&i&&(n=Aj1.inflateSetDictionary(this.strm,i)),n===ik.Z_BUF_ERROR&&f===!0&&(n=ik.Z_OK,f=!1),n!==ik.Z_STREAM_END&&n!==ik.Z_OK)return this.onEnd(n),this.ended=!0,!1;r.next_out&&(r.avail_out===0||n===ik.Z_STREAM_END||r.avail_in===0&&(o===ik.Z_FINISH||o===ik.Z_SYNC_FLUSH))&&(this.options.to==="string"?(h=Tq2.utf8border(r.output,r.next_out),u=r.next_out-h,g=Tq2.buf2string(r.output,h),r.next_out=u,r.avail_out=a-u,u&&lc2.arraySet(r.output,r.output,h,u,0),this.onData(g)):this.onData(lc2.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(f=!0)}while((r.avail_in>0||r.avail_out===0)&&n!==ik.Z_STREAM_END);return n===ik.Z_STREAM_END&&(o=ik.Z_FINISH),o===ik.Z_FINISH?(n=Aj1.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===ik.Z_OK):(o===ik.Z_SYNC_FLUSH&&(this.onEnd(ik.Z_OK),r.avail_out=0),!0)};gT1.prototype.onData=function(e){this.chunks.push(e)};gT1.prototype.onEnd=function(e){e===ik.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=lc2.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function G84(e,t){var r=new gT1(t);if(r.push(e,!0),r.err)throw r.msg||U84[r.err];return r.result}function GK8(e,t){return t=t||{},t.raw=!0,G84(e,t)}cc2.Inflate=gT1;cc2.inflate=G84;cc2.inflateRaw=GK8;cc2.ungzip=G84});var Ps3=M1((EC9,Vs3)=>{"use strict";var jK8=bc1().assign,WK8=Ec3(),qK8=Ts3(),$K8=N84(),Bs3={};jK8(Bs3,WK8,qK8,$K8);Vs3.exports=Bs3});var Es3=M1(Vq2=>{"use strict";var KK8=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",YK8=Ps3(),_s3=Mb(),Bq2=pK(),XK8=KK8?"uint8array":"array";Vq2.magic="\b\0";function pT1(e,t){Bq2.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}_s3.inherits(pT1,Bq2);pT1.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(_s3.transformTo(XK8,e.data),!1)};pT1.prototype.flush=function(){Bq2.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)};pT1.prototype.cleanUp=function(){Bq2.prototype.cleanUp.call(this),this._pako=null};pT1.prototype._createPako=function(){this._pako=new YK8[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}};Vq2.compressWorker=function(e){return new pT1("Deflate",e)};Vq2.uncompressWorker=function(){return new pT1("Inflate",{})}});var W84=M1(j84=>{"use strict";var Rs3=pK();j84.STORE={magic:"\0\0",compressWorker:function(){return new Rs3("STORE compression")},uncompressWorker:function(){return new Rs3("STORE decompression")}};j84.DEFLATE=Es3()});var q84=M1(fT1=>{"use strict";fT1.LOCAL_FILE_HEADER="PK";fT1.CENTRAL_FILE_HEADER="PK";fT1.CENTRAL_DIRECTORY_END="PK";fT1.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07";fT1.ZIP64_CENTRAL_DIRECTORY_END="PK";fT1.DATA_DESCRIPTOR="PK\x07\b"});var Ds3=M1((OC9,Os3)=>{"use strict";var zj1=Mb(),bj1=pK(),$84=gj1(),Zs3=uq2(),Pq2=q84(),mw=function(e,t){var r="",a;for(a=0;a<t;a++)r+=String.fromCharCode(e&255),e=e>>>8;return r},JK8=function(e,t){var r=e;return e||(r=t?16893:33204),(r&65535)<<16},QK8=function(e){return(e||0)&63},Fs3=function(e,t,r,a,i,n){var o=e.file,h=e.compression,u=n!==$84.utf8encode,g=zj1.transformTo("string",n(o.name)),f=zj1.transformTo("string",$84.utf8encode(o.name)),v=o.comment,C=zj1.transformTo("string",n(v)),L=zj1.transformTo("string",$84.utf8encode(v)),y=f.length!==o.name.length,z=L.length!==v.length,S,B,R="",F="",N="",j=o.dir,Y=o.date,t1={crc32:0,compressedSize:0,uncompressedSize:0};(!t||r)&&(t1.crc32=e.crc32,t1.compressedSize=e.compressedSize,t1.uncompressedSize=e.uncompressedSize);var n1=0;t&&(n1|=8),!u&&(y||z)&&(n1|=2048);var a1=0,s1=0;j&&(a1|=16),i==="UNIX"?(s1=798,a1|=JK8(o.unixPermissions,j)):(s1=20,a1|=QK8(o.dosPermissions,j)),S=Y.getUTCHours(),S=S<<6,S=S|Y.getUTCMinutes(),S=S<<5,S=S|Y.getUTCSeconds()/2,B=Y.getUTCFullYear()-1980,B=B<<4,B=B|Y.getUTCMonth()+1,B=B<<5,B=B|Y.getUTCDate(),y&&(F=mw(1,1)+mw(Zs3(g),4)+f,R+="up"+mw(F.length,2)+F),z&&(N=mw(1,1)+mw(Zs3(C),4)+L,R+="uc"+mw(N.length,2)+N);var p1="";p1+=`
|
|
1621
|
+
`+cG2(o);return new A2(h,"text")}catch(a){let i=a instanceof Error?a.message:String(a);return new A2(`Failed to refresh connections: ${i}`,"error")}}generateNotFoundMessage(){return"No connections found. Please configure connections in UiPath Automation Cloud > Integration Service."}canExecute(t,r){return!0}revert(t,r){return Promise.resolve(new A2("Not implemented","text"))}canRevert(t,r){return!1}validateProps(t,r){return!0}async getSubHeader(t){return"Refreshing connections..."}}});var c64,no3,oo3=C1(()=>{c64=w4(li()),no3=c64.z.object({duration:c64.z.number().positive().max(3e5).describe("Duration to wait in milliseconds. Maximum 300000 (5 minutes).")})});var zm1,s64=C1(()=>{a7();oo3();vw();zm1=class extends Yn{constructor(r){super(r);this.inputSchema=no3;this.name="Wait";this.friendlyName="Wait";this.isReadOnly=!0;this.description="Pause for `duration` ms (max 300000). Use for non-UI waits: replies (Slack/email), polling files/inbox, background jobs. Not for pauses between UI actions in one AppAct call (AppAct wait covers that).";this.autoExecute=!0}canRunInParallel(r,a){return!1}async execute(r,a){let i=Math.min(r.duration,3e5),n=Date.now(),o=!1,{abortSignal:h,skipSignal:u}=a;await new Promise((L,y)=>{let z=setTimeout(L,i);if(h?.aborted){clearTimeout(z),y(new Error("Wait aborted"));return}if(u?.aborted){clearTimeout(z),o=!0,L();return}let S=()=>{clearTimeout(z),y(new Error("Wait aborted"))},B=()=>{clearTimeout(z),o=!0,L()};h?.addEventListener("abort",S,{once:!0}),u?.addEventListener("abort",B,{once:!0})});let g=Date.now()-n,f=(i/1e3).toFixed(1),v=o?`Skipped wait after ${(g/1e3).toFixed(1)}s (of ${f}s requested).`:`Waited ${f} seconds.`,C=new A2(v);return C.metadata={skipped:o,elapsedMs:g,requestedMs:i},C}}});function Yj8(e){return e.map(t=>`${t.agentId} (${t.status})`).join(", ")}function lo3(e,t){switch(t.kind){case"none":return new Error("No detached agents in this session. Spawn one with the Agent tool.");case"needs-reinvocation":return new Error(`Agent "${e}" is no longer live. Reinvoke it with the Agent tool and the same agent_id; prior turns are preserved in its session.`);case"unknown":{let r=t.known.some(a=>a.status==="not-live")?" Reinvoke a not-live agent with the Agent tool and its agent_id.":"";return new Error(`No agent "${e}". Known agents: ${Yj8(t.known)}. Check agent_id or spawn a new Agent.${r}`)}}}function h64(e,t){return typeof e=="string"&&e.trim().length>0?!0:{valid:!1,errorsMessage:`${t} must be a non-empty string.`}}var JG1,$j8,Kj8,QG1,tj1,co3=C1(()=>{JG1=w4(li());a7();vw();$j8=JG1.z.object({agent_id:JG1.z.string().trim().min(1).describe("Detached agent identifier."),message:JG1.z.string().trim().min(1).describe("Message to send.")}),Kj8=JG1.z.object({agent_id:JG1.z.string().trim().min(1).describe("Detached agent identifier.")});QG1=class extends Yn{constructor(r,a){super(r);this.gateway=a;this.name="SendMessageToAgent";this.friendlyName="Send Message to Agent";this.description="Send a message to a detached agent.";this.inputSchema=$j8;this.autoExecute=!0;this.excludeFromAgents=!0}canRunInParallel(r,a){return!0}async execute(r,a){let i=await this.gateway.sendMessage(a.sessionId,r.agent_id,r.message,a.executionId);switch(i.kind){case"steered":return new A2(`Message delivered to agent "${r.agent_id}"; it reads it on its next step.`);case"queue-full":throw new Error(`Agent "${r.agent_id}" is busy; message not delivered. Retry shortly.`);case"resumed":return new A2(`Agent "${r.agent_id}" resumed with your message. Completion will notify again.`,"text",void 0,!1,{agentId:r.agent_id,backgroundAgent:!0,description:i.description});case"blocked-by-user":throw new Error(`Agent "${r.agent_id}" was stopped by the user. Do not resume or replace it unless the user explicitly asks.`);case"needs-reinvocation":case"unknown":case"none":throw lo3(r.agent_id,i)}}validateProps(r,a){let i=h64(r.agent_id,"agent_id");return i!==!0?i:h64(r.message,"message")}},tj1=class extends Yn{constructor(r,a){super(r);this.gateway=a;this.name="InterruptAgent";this.friendlyName="Interrupt Agent";this.description="Interrupt a running detached agent.";this.inputSchema=Kj8;this.autoExecute=!0;this.excludeFromAgents=!0}canRunInParallel(r,a){return!0}async execute(r,a){let i=this.gateway.interrupt(a.sessionId,r.agent_id);switch(i.kind){case"interrupted":return new A2(`Stopping agent "${r.agent_id}". It stays resumable via SendMessageToAgent; an interrupted notification with partial findings follows.`);case"idle":throw new Error(`Agent "${r.agent_id}" is not running (status: ${i.status}). Nothing to interrupt. Resume it with SendMessageToAgent.`);case"needs-reinvocation":case"unknown":case"none":throw lo3(r.agent_id,i)}}validateProps(r,a){return h64(r.agent_id,"agent_id")}}});var d64,Xj8,IW2,u64=C1(()=>{d64=w4(li());a7();vw();Xj8=d64.z.object({message:d64.z.string().trim().min(1).describe("Message to the main agent.")}),IW2=class extends Yn{constructor(r,a){super(r);this.sendToParent=a;this.name="SendMessageToMainAgent";this.friendlyName="Send Message to Main Agent";this.description="Send a message to the main agent.";this.inputSchema=Xj8;this.systemPromptInstructions="SendMessageToMainAgent: for blockers, escalations, significant progress only. Use sparingly. Final answer goes through normal completion, not this tool.";this.autoExecute=!0}canRunInParallel(r,a){return!0}async execute(r,a){switch(await this.sendToParent(a.sessionId,r.message)){case"delivered":return new A2("Message sent to main agent.");case"delivery-failed":throw new Error("Main agent could not receive the message. Retry shortly.");case"queue-full":throw new Error("Main agent is busy; message not delivered. Retry shortly.");case"parent-gone":throw new Error("Main agent session closed. Message not delivered.");case"unknown-child":throw new Error("This session is not a registered detached agent. Message not delivered.")}}validateProps(r,a){return typeof r.message=="string"&&r.message.trim().length>0?!0:{valid:!1,errorsMessage:"message must be a non-empty string."}}}});var so3=C1(()=>{co3();u64()});function ej1(e){return!!e&&Jj8.has(e)}var NW2,Jj8,kl2=C1(()=>{NW2={"text/plain":[".txt",".text",".log",".md",".markdown",".ini",".conf",".cfg",".properties",".env"],"text/csv":[".csv"],"text/html":[".html",".htm"],"text/css":[".css",".scss",".sass",".less"],"text/javascript":[".js",".jsx",".mjs"],"text/typescript":[".ts",".tsx"],"text/x-python":[".py"],"text/x-java":[".java"],"text/x-c":[".c",".h"],"text/x-c++":[".cpp",".hpp",".cc",".cxx"],"text/x-csharp":[".cs"],"text/xml":[".xml"],"text/yaml":[".yaml",".yml"],"text/x-sh":[".sh"],"text/x-powershell":[".ps1"],"text/x-applescript":[".applescript",".scpt"],"text/x-sql":[".sql"],"application/json":[".json"],"application/xml":[".xml"],"application/pdf":[".pdf"],"application/zip":[".zip"],"application/x-tar":[".tar"],"application/gzip":[".gz"],"image/jpeg":[".jpg",".jpeg"],"image/png":[".png"],"image/gif":[".gif"],"image/bmp":[".bmp"],"image/webp":[".webp"],"image/svg+xml":[".svg"],"image/tiff":[".tiff",".tif"],"image/x-icon":[".ico"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[".docx"],"application/msword":[".doc"],"application/vnd.ms-word.document.macroEnabled.12":[".docm"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":[".dotx"],"application/msword-template":[".dot"],"application/rtf":[".rtf"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":[".xlsx"],"application/vnd.ms-excel":[".xls"],"application/vnd.ms-excel.sheet.macroEnabled.12":[".xlsm"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":[".xltx"],"application/vnd.ms-excel.template.macroEnabled.12":[".xlt"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":[".pptx"],"application/vnd.ms-powerpoint":[".ppt"],"application/vnd.ms-powerpoint.presentation.macroEnabled.12":[".pptm"],"application/vnd.openxmlformats-officedocument.presentationml.template":[".potx"],"application/vnd.ms-powerpoint.template.macroEnabled.12":[".pot"],"application/vnd.oasis.opendocument.text":[".odt"],"application/vnd.oasis.opendocument.spreadsheet":[".ods"],"application/vnd.oasis.opendocument.presentation":[".odp"],"application/vnd.ms-outlook":[".msg"]},Jj8=new Set(["application/pdf","image/png","image/jpeg","image/webp","image/gif","image/bmp","image/tiff","image/svg+xml","text/plain","text/xaml","application/xaml+xml","application/json","application/x-yaml","text/yaml","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/rtf","text/markdown","text/csv","application/xml","text/xml","video/mp2t","text/x-python","text/javascript","text/vnd.trolltech.linguist","text/x-java","application/java-vm","application/java-archive","text/x-c++src","text/x-csrc","text/x-chdr","text/x-c++hdr","application/x-ruby","application/rls-services+xml","text/x-scala","text/x-perl","application/vnd.wolfram.mathematica.package","text/x-sh","text/html","application/xhtml+xml","text/css","application/xslt+xml","application/sql","application/vnd.dart","application/vnd.ms-visio.drawing","application/vnd.ms-visio.viewer","application/vnd.visio","application/vnd.visio2013","application/vnd.ms-outlook"])});function ho3(e){return e?[Jm.PasswordRequired,Jm.UnsupportedFeature,Jm.InvalidHeader,Jm.Corrupt,Jm.Truncated,Jm.Empty,Jm.ConversionFailed,Jm.MaxPagesExceeded,Jm.PageRangeTooLarge,Jm.PageOutOfBounds,Jm.SecureStagingUnavailable,Jm.InvalidRequest].find(r=>r===e):void 0}var UW2,Jm,Mc1,GW2=C1(()=>{UW2=class extends Error{constructor(r,a){super(a);this.pageCount=r;this.name="MaxPagesExceededError"}},Jm={PasswordRequired:"PDF_PASSWORD_REQUIRED",UnsupportedFeature:"PDF_UNSUPPORTED_FEATURE",InvalidHeader:"PDF_INVALID_HEADER",Corrupt:"PDF_CORRUPT",Truncated:"PDF_TRUNCATED",Empty:"PDF_EMPTY",ConversionFailed:"PDF_CONVERSION_FAILED",MaxPagesExceeded:"PDF_MAX_PAGES_EXCEEDED",PageRangeTooLarge:"PDF_PAGE_RANGE_TOO_LARGE",PageOutOfBounds:"PDF_PAGE_OUT_OF_BOUNDS",SecureStagingUnavailable:"PDF_SECURE_STAGING_UNAVAILABLE",InvalidRequest:"PDF_INVALID_REQUEST"},Mc1=class extends Error{constructor(r,a){super(a);this.code=r;this.name="PdfError"}}});function rj1(e){return e?Qj8.some(t=>t.test(e)):!1}function do3(e){return e?.match(tW8)?.[1]??"the Office app"}function uo3(e){if(!rj1(e))return;let t=do3(e);return`macOS denied UiPath Delegate permission to control ${t}. Tell the user to open System Settings > Privacy & Security > Automation, find UiPath Delegate (or the app running Delegate), enable ${t}, and confirm when done. Do not retry until the user confirms.`}function go3(e){if(!rj1(e))return;let t=do3(e);return`macOS denied UiPath Delegate permission to control ${t}. Rendering pages requires the user to enable ${t} for UiPath Delegate in System Settings > Privacy & Security > Automation.`}var Qj8,tW8,jW2=C1(()=>{Qj8=[/not authori[sz]ed to send/i,/not permitted to send/i,/(?<!\d)-1743(?!\d)/,/(?<!\d)-9074(?!\d)/],tW8=/not (?:authori[sz]ed|permitted) to send apple events to (Microsoft (?:Excel|PowerPoint|Word))/i});function g64(e){let t=`PDF conversion failed (${e}).`,r=go3(e),a=uo3(e);return{whenTextExtracted:r?`${t} ${r}`:t,whenExtractionUnavailable:a?`${t} ${a}`:t}}function p64(e){return{whenTextExtracted:e,whenExtractionUnavailable:e}}var po3=C1(()=>{jW2()});function fo3(e){let t=[];for(let r=0;r<e.length;r+=32768)t.push(String.fromCharCode(...e.subarray(r,r+32768)));return btoa(t.join(""))}function xc1(e){let t=atob(e),r=new Uint8Array(t.length);for(let a=0;a<t.length;a++)r[a]=t.charCodeAt(a);return r}var WW2=C1(()=>{});var Tl2=M1((Fm9,f64)=>{"use strict";typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?f64.exports={nextTick:eW8}:f64.exports=process;function eW8(e,t,r,a){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var i=arguments.length,n,o;switch(i){case 0:case 1:return process.nextTick(e);case 2:return process.nextTick(function(){e.call(null,t)});case 3:return process.nextTick(function(){e.call(null,t,r)});case 4:return process.nextTick(function(){e.call(null,t,r,a)});default:for(n=new Array(i-1),o=0;o<n.length;)n[o++]=arguments[o];return process.nextTick(function(){e.apply(null,n)})}}});var mo3=M1((Om9,vo3)=>{var rW8={}.toString;vo3.exports=Array.isArray||function(e){return rW8.call(e)=="[object Array]"}});var v64=M1((Dm9,Co3)=>{Co3.exports=Z4("stream")});var Bl2=M1((m64,xo3)=>{var qW2=Z4("buffer"),Lc1=qW2.Buffer;function Mo3(e,t){for(var r in e)t[r]=e[r]}Lc1.from&&Lc1.alloc&&Lc1.allocUnsafe&&Lc1.allocUnsafeSlow?xo3.exports=qW2:(Mo3(qW2,m64),m64.Buffer=aj1);function aj1(e,t,r){return Lc1(e,t,r)}Mo3(Lc1,aj1);aj1.from=function(e,t,r){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Lc1(e,t,r)};aj1.alloc=function(e,t,r){if(typeof e!="number")throw new TypeError("Argument must be a number");var a=Lc1(e);return t!==void 0?typeof r=="string"?a.fill(t,r):a.fill(t):a.fill(0),a};aj1.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Lc1(e)};aj1.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return qW2.SlowBuffer(e)}});var ij1=M1(KF=>{function aW8(e){return Array.isArray?Array.isArray(e):$W2(e)==="[object Array]"}KF.isArray=aW8;function iW8(e){return typeof e=="boolean"}KF.isBoolean=iW8;function nW8(e){return e===null}KF.isNull=nW8;function oW8(e){return e==null}KF.isNullOrUndefined=oW8;function lW8(e){return typeof e=="number"}KF.isNumber=lW8;function cW8(e){return typeof e=="string"}KF.isString=cW8;function sW8(e){return typeof e=="symbol"}KF.isSymbol=sW8;function hW8(e){return e===void 0}KF.isUndefined=hW8;function dW8(e){return $W2(e)==="[object RegExp]"}KF.isRegExp=dW8;function uW8(e){return typeof e=="object"&&e!==null}KF.isObject=uW8;function gW8(e){return $W2(e)==="[object Date]"}KF.isDate=gW8;function pW8(e){return $W2(e)==="[object Error]"||e instanceof Error}KF.isError=pW8;function fW8(e){return typeof e=="function"}KF.isFunction=fW8;function vW8(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}KF.isPrimitive=vW8;KF.isBuffer=Z4("buffer").Buffer.isBuffer;function $W2(e){return Object.prototype.toString.call(e)}});var Lo3=M1((Nm9,C64)=>{typeof Object.create=="function"?C64.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:C64.exports=function(t,r){if(r){t.super_=r;var a=function(){};a.prototype=r.prototype,t.prototype=new a,t.prototype.constructor=t}}});var PT=M1((Um9,x64)=>{try{if(M64=Z4("util"),typeof M64.inherits!="function")throw"";x64.exports=M64.inherits}catch{x64.exports=Lo3()}var M64});var yo3=M1((Gm9,L64)=>{"use strict";function mW8(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var wo3=Bl2().Buffer,Vl2=Z4("util");function CW8(e,t,r){e.copy(t,r)}L64.exports=(function(){function e(){mW8(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(r){var a={data:r,next:null};this.length>0?this.tail.next=a:this.head=a,this.tail=a,++this.length},e.prototype.unshift=function(r){var a={data:r,next:this.head};this.length===0&&(this.tail=a),this.head=a,++this.length},e.prototype.shift=function(){if(this.length!==0){var r=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,r}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(r){if(this.length===0)return"";for(var a=this.head,i=""+a.data;a=a.next;)i+=r+a.data;return i},e.prototype.concat=function(r){if(this.length===0)return wo3.alloc(0);for(var a=wo3.allocUnsafe(r>>>0),i=this.head,n=0;i;)CW8(i.data,a,n),n+=i.data.length,i=i.next;return a},e})();Vl2&&Vl2.inspect&&Vl2.inspect.custom&&(L64.exports.prototype[Vl2.inspect.custom]=function(){var e=Vl2.inspect({length:this.length});return this.constructor.name+" "+e})});var w64=M1((jm9,Ao3)=>{"use strict";var KW2=Tl2();function MW8(e,t){var r=this,a=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return a||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,KW2.nextTick(YW2,this,e)):KW2.nextTick(YW2,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(n){!t&&n?r._writableState?r._writableState.errorEmitted||(r._writableState.errorEmitted=!0,KW2.nextTick(YW2,r,n)):KW2.nextTick(YW2,r,n):t&&t(n)}),this)}function xW8(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function YW2(e,t){e.emit("error",t)}Ao3.exports={destroy:MW8,undestroy:xW8}});var bo3=M1((Wm9,zo3)=>{zo3.exports=Z4("util").deprecate});var QW2=M1((qm9,_o3)=>{"use strict";var rT1=Tl2();_o3.exports=_T;function Ho3(e){var t=this;this.next=null,this.entry=null,this.finish=function(){FW8(t,e)}}var LW8=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:rT1.nextTick,nj1;_T.WritableState=_l2;var ko3=Object.create(ij1());ko3.inherits=PT();var wW8={deprecate:bo3()},To3=v64(),JW2=Bl2().Buffer,yW8=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function AW8(e){return JW2.from(e)}function zW8(e){return JW2.isBuffer(e)||e instanceof yW8}var Bo3=w64();ko3.inherits(_T,To3);function bW8(){}function _l2(e,t){nj1=nj1||aT1(),e=e||{};var r=t instanceof nj1;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var a=e.highWaterMark,i=e.writableHighWaterMark,n=this.objectMode?16:16*1024;a||a===0?this.highWaterMark=a:r&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=n,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=e.decodeStrings===!1;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(h){PW8(t,h)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new Ho3(this)}_l2.prototype.getBuffer=function(){for(var t=this.bufferedRequest,r=[];t;)r.push(t),t=t.next;return r};(function(){try{Object.defineProperty(_l2.prototype,"buffer",{get:wW8.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var XW2;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(XW2=Function.prototype[Symbol.hasInstance],Object.defineProperty(_T,Symbol.hasInstance,{value:function(e){return XW2.call(this,e)?!0:this!==_T?!1:e&&e._writableState instanceof _l2}})):XW2=function(e){return e instanceof this};function _T(e){if(nj1=nj1||aT1(),!XW2.call(_T,this)&&!(this instanceof nj1))return new _T(e);this._writableState=new _l2(e,this),this.writable=!0,e&&(typeof e.write=="function"&&(this._write=e.write),typeof e.writev=="function"&&(this._writev=e.writev),typeof e.destroy=="function"&&(this._destroy=e.destroy),typeof e.final=="function"&&(this._final=e.final)),To3.call(this)}_T.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function SW8(e,t){var r=new Error("write after end");e.emit("error",r),rT1.nextTick(t,r)}function HW8(e,t,r,a){var i=!0,n=!1;return r===null?n=new TypeError("May not write null values to stream"):typeof r!="string"&&r!==void 0&&!t.objectMode&&(n=new TypeError("Invalid non-string/buffer chunk")),n&&(e.emit("error",n),rT1.nextTick(a,n),i=!1),i}_T.prototype.write=function(e,t,r){var a=this._writableState,i=!1,n=!a.objectMode&&zW8(e);return n&&!JW2.isBuffer(e)&&(e=AW8(e)),typeof t=="function"&&(r=t,t=null),n?t="buffer":t||(t=a.defaultEncoding),typeof r!="function"&&(r=bW8),a.ended?SW8(this,r):(n||HW8(this,a,e,r))&&(a.pendingcb++,i=TW8(this,a,n,e,t,r)),i};_T.prototype.cork=function(){var e=this._writableState;e.corked++};_T.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.bufferProcessing&&e.bufferedRequest&&Vo3(this,e))};_T.prototype.setDefaultEncoding=function(t){if(typeof t=="string"&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this};function kW8(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=JW2.from(t,r)),t}Object.defineProperty(_T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function TW8(e,t,r,a,i,n){if(!r){var o=kW8(t,a,i);a!==o&&(r=!0,i="buffer",a=o)}var h=t.objectMode?1:a.length;t.length+=h;var u=t.length<t.highWaterMark;if(u||(t.needDrain=!0),t.writing||t.corked){var g=t.lastBufferedRequest;t.lastBufferedRequest={chunk:a,encoding:i,isBuf:r,callback:n,next:null},g?g.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else y64(e,t,!1,h,a,i,n);return u}function y64(e,t,r,a,i,n,o){t.writelen=a,t.writecb=o,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,n,t.onwrite),t.sync=!1}function BW8(e,t,r,a,i){--t.pendingcb,r?(rT1.nextTick(i,a),rT1.nextTick(Pl2,e,t),e._writableState.errorEmitted=!0,e.emit("error",a)):(i(a),e._writableState.errorEmitted=!0,e.emit("error",a),Pl2(e,t))}function VW8(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function PW8(e,t){var r=e._writableState,a=r.sync,i=r.writecb;if(VW8(r),t)BW8(e,r,a,t,i);else{var n=Po3(r);!n&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest&&Vo3(e,r),a?LW8(So3,e,r,n,i):So3(e,r,n,i)}}function So3(e,t,r,a){r||_W8(e,t),t.pendingcb--,a(),Pl2(e,t)}function _W8(e,t){t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function Vo3(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var a=t.bufferedRequestCount,i=new Array(a),n=t.corkedRequestsFree;n.entry=r;for(var o=0,h=!0;r;)i[o]=r,r.isBuf||(h=!1),r=r.next,o+=1;i.allBuffers=h,y64(e,t,!0,t.length,i,"",n.finish),t.pendingcb++,t.lastBufferedRequest=null,n.next?(t.corkedRequestsFree=n.next,n.next=null):t.corkedRequestsFree=new Ho3(t),t.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,g=r.encoding,f=r.callback,v=t.objectMode?1:u.length;if(y64(e,t,!1,v,u,g,f),r=r.next,t.bufferedRequestCount--,t.writing)break}r===null&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}_T.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))};_T.prototype._writev=null;_T.prototype.end=function(e,t,r){var a=this._writableState;typeof e=="function"?(r=e,e=null,t=null):typeof t=="function"&&(r=t,t=null),e!=null&&this.write(e,t),a.corked&&(a.corked=1,this.uncork()),a.ending||ZW8(this,a,r)};function Po3(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function EW8(e,t){e._final(function(r){t.pendingcb--,r&&e.emit("error",r),t.prefinished=!0,e.emit("prefinish"),Pl2(e,t)})}function RW8(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final=="function"?(t.pendingcb++,t.finalCalled=!0,rT1.nextTick(EW8,e,t)):(t.prefinished=!0,e.emit("prefinish")))}function Pl2(e,t){var r=Po3(t);return r&&(RW8(e,t),t.pendingcb===0&&(t.finished=!0,e.emit("finish"))),r}function ZW8(e,t,r){t.ending=!0,Pl2(e,t),r&&(t.finished?rT1.nextTick(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function FW8(e,t,r){var a=e.entry;for(e.entry=null;a;){var i=a.callback;t.pendingcb--,i(r),a=a.next}t.corkedRequestsFree.next=e}Object.defineProperty(_T.prototype,"destroyed",{get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}});_T.prototype.destroy=Bo3.destroy;_T.prototype._undestroy=Bo3.undestroy;_T.prototype._destroy=function(e,t){this.end(),t(e)}});var aT1=M1(($m9,Fo3)=>{"use strict";var Eo3=Tl2(),OW8=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};Fo3.exports=wc1;var Ro3=Object.create(ij1());Ro3.inherits=PT();var Zo3=b64(),z64=QW2();Ro3.inherits(wc1,Zo3);for(A64=OW8(z64.prototype),tq2=0;tq2<A64.length;tq2++)eq2=A64[tq2],wc1.prototype[eq2]||(wc1.prototype[eq2]=z64.prototype[eq2]);var A64,eq2,tq2;function wc1(e){if(!(this instanceof wc1))return new wc1(e);Zo3.call(this,e),z64.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",DW8)}Object.defineProperty(wc1.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function DW8(){this.allowHalfOpen||this._writableState.ended||Eo3.nextTick(IW8,this)}function IW8(e){e.end()}Object.defineProperty(wc1.prototype,"destroyed",{get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(e){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=e,this._writableState.destroyed=e)}});wc1.prototype._destroy=function(e,t){this.push(null),this.end(),Eo3.nextTick(t,e)}});var k64=M1(Do3=>{"use strict";var H64=Bl2().Buffer,Oo3=H64.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function NW8(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function UW8(e){var t=NW8(e);if(typeof t!="string"&&(H64.isEncoding===Oo3||!Oo3(e)))throw new Error("Unknown encoding: "+e);return t||e}Do3.StringDecoder=El2;function El2(e){this.encoding=UW8(e);var t;switch(this.encoding){case"utf16le":this.text=KW8,this.end=YW8,t=4;break;case"utf8":this.fillLast=WW8,t=4;break;case"base64":this.text=XW8,this.end=JW8,t=3;break;default:this.write=QW8,this.end=tq8;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=H64.allocUnsafe(t)}El2.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""};El2.prototype.end=$W8;El2.prototype.text=qW8;El2.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function S64(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function GW8(e,t,r){var a=t.length-1;if(a<r)return 0;var i=S64(t[a]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--a<r||i===-2?0:(i=S64(t[a]),i>=0?(i>0&&(e.lastNeed=i-2),i):--a<r||i===-2?0:(i=S64(t[a]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function jW8(e,t,r){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}function WW8(e){var t=this.lastTotal-this.lastNeed,r=jW8(this,e,t);if(r!==void 0)return r;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function qW8(e,t){var r=GW8(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var a=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,a),e.toString("utf8",t,a)}function $W8(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function KW8(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var a=r.charCodeAt(r.length-1);if(a>=55296&&a<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function YW8(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function XW8(e,t){var r=(e.length-t)%3;return r===0?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function JW8(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function QW8(e){return e.toString(this.encoding)}function tq8(e){return e&&e.length?this.write(e):""}});var b64=M1((Xm9,Jo3)=>{"use strict";var lj1=Tl2();Jo3.exports=wy;var eq8=mo3(),Rl2;wy.ReadableState=qo3;var Ym9=Z4("events").EventEmitter,Go3=function(e,t){return e.listeners(t).length},_64=v64(),Zl2=Bl2().Buffer,rq8=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function aq8(e){return Zl2.from(e)}function iq8(e){return Zl2.isBuffer(e)||e instanceof rq8}var jo3=Object.create(ij1());jo3.inherits=PT();var T64=Z4("util"),Qm=void 0;T64&&T64.debuglog?Qm=T64.debuglog("stream"):Qm=function(){};var nq8=yo3(),Wo3=w64(),oj1;jo3.inherits(wy,_64);var B64=["error","close","destroy","pause","resume"];function oq8(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):eq8(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}function qo3(e,t){Rl2=Rl2||aT1(),e=e||{};var r=t instanceof Rl2;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var a=e.highWaterMark,i=e.readableHighWaterMark,n=this.objectMode?16:16*1024;a||a===0?this.highWaterMark=a:r&&(i||i===0)?this.highWaterMark=i:this.highWaterMark=n,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new nq8,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(oj1||(oj1=k64().StringDecoder),this.decoder=new oj1(e.encoding),this.encoding=e.encoding)}function wy(e){if(Rl2=Rl2||aT1(),!(this instanceof wy))return new wy(e);this._readableState=new qo3(e,this),this.readable=!0,e&&(typeof e.read=="function"&&(this._read=e.read),typeof e.destroy=="function"&&(this._destroy=e.destroy)),_64.call(this)}Object.defineProperty(wy.prototype,"destroyed",{get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}});wy.prototype.destroy=Wo3.destroy;wy.prototype._undestroy=Wo3.undestroy;wy.prototype._destroy=function(e,t){this.push(null),t(e)};wy.prototype.push=function(e,t){var r=this._readableState,a;return r.objectMode?a=!0:typeof e=="string"&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=Zl2.from(e,t),t=""),a=!0),$o3(this,e,t,!1,a)};wy.prototype.unshift=function(e){return $o3(this,e,null,!0,!1)};function $o3(e,t,r,a,i){var n=e._readableState;if(t===null)n.reading=!1,hq8(e,n);else{var o;i||(o=lq8(n,t)),o?e.emit("error",o):n.objectMode||t&&t.length>0?(typeof t!="string"&&!n.objectMode&&Object.getPrototypeOf(t)!==Zl2.prototype&&(t=aq8(t)),a?n.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):V64(e,n,t,!0):n.ended?e.emit("error",new Error("stream.push() after EOF")):(n.reading=!1,n.decoder&&!r?(t=n.decoder.write(t),n.objectMode||t.length!==0?V64(e,n,t,!1):Ko3(e,n)):V64(e,n,t,!1))):a||(n.reading=!1)}return cq8(n)}function V64(e,t,r,a){t.flowing&&t.length===0&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,a?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&rq2(e)),Ko3(e,t)}function lq8(e,t){var r;return!iq8(t)&&typeof t!="string"&&t!==void 0&&!e.objectMode&&(r=new TypeError("Invalid non-string/buffer chunk")),r}function cq8(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}wy.prototype.isPaused=function(){return this._readableState.flowing===!1};wy.prototype.setEncoding=function(e){return oj1||(oj1=k64().StringDecoder),this._readableState.decoder=new oj1(e),this._readableState.encoding=e,this};var Io3=8388608;function sq8(e){return e>=Io3?e=Io3:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function No3(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=sq8(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}wy.prototype.read=function(e){Qm("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return Qm("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?P64(this):rq2(this),null;if(e=No3(e,t),e===0&&t.ended)return t.length===0&&P64(this),null;var a=t.needReadable;Qm("need readable",a),(t.length===0||t.length-e<t.highWaterMark)&&(a=!0,Qm("length less than watermark",a)),t.ended||t.reading?(a=!1,Qm("reading or ended",a)):a&&(Qm("do read"),t.reading=!0,t.sync=!0,t.length===0&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=No3(r,t)));var i;return e>0?i=Yo3(e,t):i=null,i===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&P64(this)),i!==null&&this.emit("data",i),i};function hq8(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,rq2(e)}}function rq2(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Qm("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?lj1.nextTick(Uo3,e):Uo3(e))}function Uo3(e){Qm("emit readable"),e.emit("readable"),E64(e)}function Ko3(e,t){t.readingMore||(t.readingMore=!0,lj1.nextTick(dq8,e,t))}function dq8(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(Qm("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}wy.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))};wy.prototype.pipe=function(e,t){var r=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e);break}a.pipesCount+=1,Qm("pipe count=%d opts=%j",a.pipesCount,t);var i=(!t||t.end!==!1)&&e!==process.stdout&&e!==process.stderr,n=i?h:S;a.endEmitted?lj1.nextTick(n):r.once("end",n),e.on("unpipe",o);function o(B,R){Qm("onunpipe"),B===r&&R&&R.hasUnpiped===!1&&(R.hasUnpiped=!0,f())}function h(){Qm("onend"),e.end()}var u=uq8(r);e.on("drain",u);var g=!1;function f(){Qm("cleanup"),e.removeListener("close",y),e.removeListener("finish",z),e.removeListener("drain",u),e.removeListener("error",L),e.removeListener("unpipe",o),r.removeListener("end",h),r.removeListener("end",S),r.removeListener("data",C),g=!0,a.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&u()}var v=!1;r.on("data",C);function C(B){Qm("ondata"),v=!1;var R=e.write(B);R===!1&&!v&&((a.pipesCount===1&&a.pipes===e||a.pipesCount>1&&Xo3(a.pipes,e)!==-1)&&!g&&(Qm("false write response, pause",a.awaitDrain),a.awaitDrain++,v=!0),r.pause())}function L(B){Qm("onerror",B),S(),e.removeListener("error",L),Go3(e,"error")===0&&e.emit("error",B)}oq8(e,"error",L);function y(){e.removeListener("finish",z),S()}e.once("close",y);function z(){Qm("onfinish"),e.removeListener("close",y),S()}e.once("finish",z);function S(){Qm("unpipe"),r.unpipe(e)}return e.emit("pipe",r),a.flowing||(Qm("pipe resume"),r.resume()),e};function uq8(e){return function(){var t=e._readableState;Qm("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&Go3(e,"data")&&(t.flowing=!0,E64(e))}}wy.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var a=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var n=0;n<i;n++)a[n].emit("unpipe",this,{hasUnpiped:!1});return this}var o=Xo3(t.pipes,e);return o===-1?this:(t.pipes.splice(o,1),t.pipesCount-=1,t.pipesCount===1&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)};wy.prototype.on=function(e,t){var r=_64.prototype.on.call(this,e,t);if(e==="data")this._readableState.flowing!==!1&&this.resume();else if(e==="readable"){var a=this._readableState;!a.endEmitted&&!a.readableListening&&(a.readableListening=a.needReadable=!0,a.emittedReadable=!1,a.reading?a.length&&rq2(this):lj1.nextTick(gq8,this))}return r};wy.prototype.addListener=wy.prototype.on;function gq8(e){Qm("readable nexttick read 0"),e.read(0)}wy.prototype.resume=function(){var e=this._readableState;return e.flowing||(Qm("resume"),e.flowing=!0,pq8(this,e)),this};function pq8(e,t){t.resumeScheduled||(t.resumeScheduled=!0,lj1.nextTick(fq8,e,t))}function fq8(e,t){t.reading||(Qm("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),E64(e),t.flowing&&!t.reading&&e.read(0)}wy.prototype.pause=function(){return Qm("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(Qm("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function E64(e){var t=e._readableState;for(Qm("flow",t.flowing);t.flowing&&e.read()!==null;);}wy.prototype.wrap=function(e){var t=this,r=this._readableState,a=!1;e.on("end",function(){if(Qm("wrapped end"),r.decoder&&!r.ended){var o=r.decoder.end();o&&o.length&&t.push(o)}t.push(null)}),e.on("data",function(o){if(Qm("wrapped data"),r.decoder&&(o=r.decoder.write(o)),!(r.objectMode&&o==null)&&!(!r.objectMode&&(!o||!o.length))){var h=t.push(o);h||(a=!0,e.pause())}});for(var i in e)this[i]===void 0&&typeof e[i]=="function"&&(this[i]=(function(o){return function(){return e[o].apply(e,arguments)}})(i));for(var n=0;n<B64.length;n++)e.on(B64[n],this.emit.bind(this,B64[n]));return this._read=function(o){Qm("wrapped _read",o),a&&(a=!1,e.resume())},this};Object.defineProperty(wy.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});wy._fromList=Yo3;function Yo3(e,t){if(t.length===0)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.head.data:r=t.buffer.concat(t.length),t.buffer.clear()):r=vq8(e,t.buffer,t.decoder),r}function vq8(e,t,r){var a;return e<t.head.data.length?(a=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):e===t.head.data.length?a=t.shift():a=r?mq8(e,t):Cq8(e,t),a}function mq8(e,t){var r=t.head,a=1,i=r.data;for(e-=i.length;r=r.next;){var n=r.data,o=e>n.length?n.length:e;if(o===n.length?i+=n:i+=n.slice(0,e),e-=o,e===0){o===n.length?(++a,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=n.slice(o));break}++a}return t.length-=a,i}function Cq8(e,t){var r=Zl2.allocUnsafe(e),a=t.head,i=1;for(a.data.copy(r),e-=a.data.length;a=a.next;){var n=a.data,o=e>n.length?n.length:e;if(n.copy(r,r.length-e,0,o),e-=o,e===0){o===n.length?(++i,a.next?t.head=a.next:t.head=t.tail=null):(t.head=a,a.data=n.slice(o));break}++i}return t.length-=i,r}function P64(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,lj1.nextTick(Mq8,t,e))}function Mq8(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function Xo3(e,t){for(var r=0,a=e.length;r<a;r++)if(e[r]===t)return r;return-1}});var R64=M1((Jm9,el3)=>{"use strict";el3.exports=yc1;var aq2=aT1(),tl3=Object.create(ij1());tl3.inherits=PT();tl3.inherits(yc1,aq2);function xq8(e,t){var r=this._transformState;r.transforming=!1;var a=r.writecb;if(!a)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,t!=null&&this.push(t),a(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function yc1(e){if(!(this instanceof yc1))return new yc1(e);aq2.call(this,e),this._transformState={afterTransform:xq8.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",Lq8)}function Lq8(){var e=this;typeof this._flush=="function"?this._flush(function(t,r){Qo3(e,t,r)}):Qo3(this,null,null)}yc1.prototype.push=function(e,t){return this._transformState.needTransform=!1,aq2.prototype.push.call(this,e,t)};yc1.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")};yc1.prototype._write=function(e,t,r){var a=this._transformState;if(a.writecb=r,a.writechunk=e,a.writeencoding=t,!a.transforming){var i=this._readableState;(a.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}};yc1.prototype._read=function(e){var t=this._transformState;t.writechunk!==null&&t.writecb&&!t.transforming?(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform)):t.needTransform=!0};yc1.prototype._destroy=function(e,t){var r=this;aq2.prototype._destroy.call(this,e,function(a){t(a),r.emit("close")})};function Qo3(e,t,r){if(t)return e.emit("error",t);if(r!=null&&e.push(r),e._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(e._transformState.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}});var nl3=M1((Qm9,il3)=>{"use strict";il3.exports=Fl2;var rl3=R64(),al3=Object.create(ij1());al3.inherits=PT();al3.inherits(Fl2,rl3);function Fl2(e){if(!(this instanceof Fl2))return new Fl2(e);rl3.call(this,e)}Fl2.prototype._transform=function(e,t,r){r(null,e)}});var Vx=M1((yR,iq2)=>{var ur1=Z4("stream");process.env.READABLE_STREAM==="disable"&&ur1?(iq2.exports=ur1,yR=iq2.exports=ur1.Readable,yR.Readable=ur1.Readable,yR.Writable=ur1.Writable,yR.Duplex=ur1.Duplex,yR.Transform=ur1.Transform,yR.PassThrough=ur1.PassThrough,yR.Stream=ur1):(yR=iq2.exports=b64(),yR.Stream=ur1||yR,yR.Readable=yR,yR.Writable=QW2(),yR.Duplex=aT1(),yR.Transform=R64(),yR.PassThrough=nl3())});var Ac1=M1(gK=>{"use strict";gK.base64=!0;gK.array=!0;gK.string=!0;gK.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";gK.nodebuffer=typeof Buffer<"u";gK.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")gK.blob=!1;else{Z64=new ArrayBuffer(0);try{gK.blob=new Blob([Z64],{type:"application/zip"}).size===0}catch{try{ol3=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,F64=new ol3,F64.append(Z64),gK.blob=F64.getBlob("application/zip").size===0}catch{gK.blob=!1}}}var Z64,ol3,F64;try{gK.nodestream=!!Vx().Readable}catch{gK.nodestream=!1}});var D64=M1(O64=>{"use strict";var wq8=Mb(),yq8=Ac1(),gr1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";O64.encode=function(e){for(var t=[],r,a,i,n,o,h,u,g=0,f=e.length,v=f,C=wq8.getTypeOf(e)!=="string";g<e.length;)v=f-g,C?(r=e[g++],a=g<f?e[g++]:0,i=g<f?e[g++]:0):(r=e.charCodeAt(g++),a=g<f?e.charCodeAt(g++):0,i=g<f?e.charCodeAt(g++):0),n=r>>2,o=(r&3)<<4|a>>4,h=v>1?(a&15)<<2|i>>6:64,u=v>2?i&63:64,t.push(gr1.charAt(n)+gr1.charAt(o)+gr1.charAt(h)+gr1.charAt(u));return t.join("")};O64.decode=function(e){var t,r,a,i,n,o,h,u=0,g=0,f="data:";if(e.substr(0,f.length)===f)throw new Error("Invalid base64 input, it looks like a data url.");e=e.replace(/[^A-Za-z0-9+/=]/g,"");var v=e.length*3/4;if(e.charAt(e.length-1)===gr1.charAt(64)&&v--,e.charAt(e.length-2)===gr1.charAt(64)&&v--,v%1!==0)throw new Error("Invalid base64 input, bad content length.");var C;for(yq8.uint8array?C=new Uint8Array(v|0):C=new Array(v|0);u<e.length;)i=gr1.indexOf(e.charAt(u++)),n=gr1.indexOf(e.charAt(u++)),o=gr1.indexOf(e.charAt(u++)),h=gr1.indexOf(e.charAt(u++)),t=i<<2|n>>4,r=(n&15)<<4|o>>2,a=(o&3)<<6|h,C[g++]=t,o!==64&&(C[g++]=r),h!==64&&(C[g++]=a);return C}});var Ol2=M1((rC9,ll3)=>{"use strict";ll3.exports={isNode:typeof Buffer<"u",newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if(typeof e=="number")throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&typeof e.on=="function"&&typeof e.pause=="function"&&typeof e.resume=="function"}}});var dl3=M1((aC9,hl3)=>{"use strict";var cl3=global.MutationObserver||global.WebKitMutationObserver,cj1;process.browser?cl3?(I64=0,sl3=new cl3(Dl2),N64=global.document.createTextNode(""),sl3.observe(N64,{characterData:!0}),cj1=function(){N64.data=I64=++I64%2}):!global.setImmediate&&typeof global.MessageChannel<"u"?(U64=new global.MessageChannel,U64.port1.onmessage=Dl2,cj1=function(){U64.port2.postMessage(0)}):"document"in global&&"onreadystatechange"in global.document.createElement("script")?cj1=function(){var e=global.document.createElement("script");e.onreadystatechange=function(){Dl2(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},global.document.documentElement.appendChild(e)}:cj1=function(){setTimeout(Dl2,0)}:cj1=function(){process.nextTick(Dl2)};var I64,sl3,N64,U64,G64,Il2=[];function Dl2(){G64=!0;for(var e,t,r=Il2.length;r;){for(t=Il2,Il2=[],e=-1;++e<r;)t[e]();r=Il2.length}G64=!1}hl3.exports=Aq8;function Aq8(e){Il2.push(e)===1&&!G64&&cj1()}});var Cl3=M1((iC9,ml3)=>{"use strict";var ul3=dl3();function sj1(){}var YF={},gl3=["REJECTED"],j64=["FULFILLED"],pl3=["PENDING"];process.browser||(Nl2=["UNHANDLED"]);var Nl2;ml3.exports=bm1;function bm1(e){if(typeof e!="function")throw new TypeError("resolver must be a function");this.state=pl3,this.queue=[],this.outcome=void 0,process.browser||(this.handled=Nl2),e!==sj1&&fl3(this,e)}bm1.prototype.finally=function(e){if(typeof e!="function")return this;var t=this.constructor;return this.then(r,a);function r(i){function n(){return i}return t.resolve(e()).then(n)}function a(i){function n(){throw i}return t.resolve(e()).then(n)}};bm1.prototype.catch=function(e){return this.then(null,e)};bm1.prototype.then=function(e,t){if(typeof e!="function"&&this.state===j64||typeof t!="function"&&this.state===gl3)return this;var r=new this.constructor(sj1);if(process.browser||this.handled===Nl2&&(this.handled=null),this.state!==pl3){var a=this.state===j64?e:t;W64(r,a,this.outcome)}else this.queue.push(new Ul2(r,e,t));return r};function Ul2(e,t,r){this.promise=e,typeof t=="function"&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),typeof r=="function"&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}Ul2.prototype.callFulfilled=function(e){YF.resolve(this.promise,e)};Ul2.prototype.otherCallFulfilled=function(e){W64(this.promise,this.onFulfilled,e)};Ul2.prototype.callRejected=function(e){YF.reject(this.promise,e)};Ul2.prototype.otherCallRejected=function(e){W64(this.promise,this.onRejected,e)};function W64(e,t,r){ul3(function(){var a;try{a=t(r)}catch(i){return YF.reject(e,i)}a===e?YF.reject(e,new TypeError("Cannot resolve promise with itself")):YF.resolve(e,a)})}YF.resolve=function(e,t){var r=vl3(zq8,t);if(r.status==="error")return YF.reject(e,r.value);var a=r.value;if(a)fl3(e,a);else{e.state=j64,e.outcome=t;for(var i=-1,n=e.queue.length;++i<n;)e.queue[i].callFulfilled(t)}return e};YF.reject=function(e,t){e.state=gl3,e.outcome=t,process.browser||e.handled===Nl2&&ul3(function(){e.handled===Nl2&&process.emit("unhandledRejection",t,e)});for(var r=-1,a=e.queue.length;++r<a;)e.queue[r].callRejected(t);return e};function zq8(e){var t=e&&e.then;if(e&&(typeof e=="object"||typeof e=="function")&&typeof t=="function")return function(){t.apply(e,arguments)}}function fl3(e,t){var r=!1;function a(h){r||(r=!0,YF.reject(e,h))}function i(h){r||(r=!0,YF.resolve(e,h))}function n(){t(i,a)}var o=vl3(n);o.status==="error"&&a(o.value)}function vl3(e,t){var r={};try{r.value=e(t),r.status="success"}catch(a){r.status="error",r.value=a}return r}bm1.resolve=bq8;function bq8(e){return e instanceof this?e:YF.resolve(new this(sj1),e)}bm1.reject=Sq8;function Sq8(e){var t=new this(sj1);return YF.reject(t,e)}bm1.all=Hq8;function Hq8(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var r=e.length,a=!1;if(!r)return this.resolve([]);for(var i=new Array(r),n=0,o=-1,h=new this(sj1);++o<r;)u(e[o],o);return h;function u(g,f){t.resolve(g).then(v,function(C){a||(a=!0,YF.reject(h,C))});function v(C){i[f]=C,++n===r&&!a&&(a=!0,YF.resolve(h,i))}}}bm1.race=kq8;function kq8(e){var t=this;if(Object.prototype.toString.call(e)!=="[object Array]")return this.reject(new TypeError("must be an array"));var r=e.length,a=!1;if(!r)return this.resolve([]);for(var i=-1,n=new this(sj1);++i<r;)o(e[i]);return n;function o(h){t.resolve(h).then(function(u){a||(a=!0,YF.resolve(n,u))},function(u){a||(a=!0,YF.reject(n,u))})}}});var hj1=M1((nC9,Ml3)=>{"use strict";var q64=null;typeof Promise<"u"?q64=Promise:q64=Cl3();Ml3.exports={Promise:q64}});var $64=M1(xl3=>{(function(e,t){"use strict";if(e.setImmediate)return;var r=1,a={},i=!1,n=e.document,o;function h(R){typeof R!="function"&&(R=new Function(""+R));for(var F=new Array(arguments.length-1),N=0;N<F.length;N++)F[N]=arguments[N+1];var j={callback:R,args:F};return a[r]=j,o(r),r++}function u(R){delete a[R]}function g(R){var F=R.callback,N=R.args;switch(N.length){case 0:F();break;case 1:F(N[0]);break;case 2:F(N[0],N[1]);break;case 3:F(N[0],N[1],N[2]);break;default:F.apply(t,N);break}}function f(R){if(i)setTimeout(f,0,R);else{var F=a[R];if(F){i=!0;try{g(F)}finally{u(R),i=!1}}}}function v(){o=function(R){process.nextTick(function(){f(R)})}}function C(){if(e.postMessage&&!e.importScripts){var R=!0,F=e.onmessage;return e.onmessage=function(){R=!1},e.postMessage("","*"),e.onmessage=F,R}}function L(){var R="setImmediate$"+Math.random()+"$",F=function(N){N.source===e&&typeof N.data=="string"&&N.data.indexOf(R)===0&&f(+N.data.slice(R.length))};e.addEventListener?e.addEventListener("message",F,!1):e.attachEvent("onmessage",F),o=function(N){e.postMessage(R+N,"*")}}function y(){var R=new MessageChannel;R.port1.onmessage=function(F){var N=F.data;f(N)},o=function(F){R.port2.postMessage(F)}}function z(){var R=n.documentElement;o=function(F){var N=n.createElement("script");N.onreadystatechange=function(){f(F),N.onreadystatechange=null,R.removeChild(N),N=null},R.appendChild(N)}}function S(){o=function(R){setTimeout(f,0,R)}}var B=Object.getPrototypeOf&&Object.getPrototypeOf(e);B=B&&B.setTimeout?B:e,{}.toString.call(e.process)==="[object process]"?v():C()?L():e.MessageChannel?y():n&&"onreadystatechange"in n.createElement("script")?z():S(),B.setImmediate=h,B.clearImmediate=u})(typeof self>"u"?typeof global>"u"?xl3:global:self)});var Mb=M1(ET=>{"use strict";var Sm1=Ac1(),Tq8=D64(),dj1=Ol2(),K64=hj1();$64();function Bq8(e){var t=null;return Sm1.uint8array?t=new Uint8Array(e.length):t=new Array(e.length),oq2(e,t)}ET.newBlob=function(e,t){ET.checkSupport("blob");try{return new Blob([e],{type:t})}catch{try{var r=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,a=new r;return a.append(e),a.getBlob(t)}catch{throw new Error("Bug : can't construct the Blob.")}}};function Gl2(e){return e}function oq2(e,t){for(var r=0;r<e.length;++r)t[r]=e.charCodeAt(r)&255;return t}var nq2={stringifyByChunk:function(e,t,r){var a=[],i=0,n=e.length;if(n<=r)return String.fromCharCode.apply(null,e);for(;i<n;)t==="array"||t==="nodebuffer"?a.push(String.fromCharCode.apply(null,e.slice(i,Math.min(i+r,n)))):a.push(String.fromCharCode.apply(null,e.subarray(i,Math.min(i+r,n)))),i+=r;return a.join("")},stringifyByChar:function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},applyCanBeUsed:{uint8array:(function(){try{return Sm1.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return Sm1.nodebuffer&&String.fromCharCode.apply(null,dj1.allocBuffer(1)).length===1}catch{return!1}})()}};function jl2(e){var t=65536,r=ET.getTypeOf(e),a=!0;if(r==="uint8array"?a=nq2.applyCanBeUsed.uint8array:r==="nodebuffer"&&(a=nq2.applyCanBeUsed.nodebuffer),a)for(;t>1;)try{return nq2.stringifyByChunk(e,r,t)}catch{t=Math.floor(t/2)}return nq2.stringifyByChar(e)}ET.applyFromCharCode=jl2;function lq2(e,t){for(var r=0;r<e.length;r++)t[r]=e[r];return t}var Hm1={};Hm1.string={string:Gl2,array:function(e){return oq2(e,new Array(e.length))},arraybuffer:function(e){return Hm1.string.uint8array(e).buffer},uint8array:function(e){return oq2(e,new Uint8Array(e.length))},nodebuffer:function(e){return oq2(e,dj1.allocBuffer(e.length))}};Hm1.array={string:jl2,array:Gl2,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return dj1.newBufferFrom(e)}};Hm1.arraybuffer={string:function(e){return jl2(new Uint8Array(e))},array:function(e){return lq2(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:Gl2,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return dj1.newBufferFrom(new Uint8Array(e))}};Hm1.uint8array={string:jl2,array:function(e){return lq2(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:Gl2,nodebuffer:function(e){return dj1.newBufferFrom(e)}};Hm1.nodebuffer={string:jl2,array:function(e){return lq2(e,new Array(e.length))},arraybuffer:function(e){return Hm1.nodebuffer.uint8array(e).buffer},uint8array:function(e){return lq2(e,new Uint8Array(e.length))},nodebuffer:Gl2};ET.transformTo=function(e,t){if(t||(t=""),!e)return t;ET.checkSupport(e);var r=ET.getTypeOf(t),a=Hm1[r][e](t);return a};ET.resolve=function(e){for(var t=e.split("/"),r=[],a=0;a<t.length;a++){var i=t[a];i==="."||i===""&&a!==0&&a!==t.length-1||(i===".."?r.pop():r.push(i))}return r.join("/")};ET.getTypeOf=function(e){if(typeof e=="string")return"string";if(Object.prototype.toString.call(e)==="[object Array]")return"array";if(Sm1.nodebuffer&&dj1.isBuffer(e))return"nodebuffer";if(Sm1.uint8array&&e instanceof Uint8Array)return"uint8array";if(Sm1.arraybuffer&&e instanceof ArrayBuffer)return"arraybuffer"};ET.checkSupport=function(e){var t=Sm1[e.toLowerCase()];if(!t)throw new Error(e+" is not supported by this platform")};ET.MAX_VALUE_16BITS=65535;ET.MAX_VALUE_32BITS=-1;ET.pretty=function(e){var t="",r,a;for(a=0;a<(e||"").length;a++)r=e.charCodeAt(a),t+="\\x"+(r<16?"0":"")+r.toString(16).toUpperCase();return t};ET.delay=function(e,t,r){setImmediate(function(){e.apply(r||null,t||[])})};ET.inherits=function(e,t){var r=function(){};r.prototype=t.prototype,e.prototype=new r};ET.extend=function(){var e={},t,r;for(t=0;t<arguments.length;t++)for(r in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],r)&&typeof e[r]>"u"&&(e[r]=arguments[t][r]);return e};ET.prepareContent=function(e,t,r,a,i){var n=K64.Promise.resolve(t).then(function(o){var h=Sm1.blob&&(o instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(o))!==-1);return h&&typeof FileReader<"u"?new K64.Promise(function(u,g){var f=new FileReader;f.onload=function(v){u(v.target.result)},f.onerror=function(v){g(v.target.error)},f.readAsArrayBuffer(o)}):o});return n.then(function(o){var h=ET.getTypeOf(o);return h?(h==="arraybuffer"?o=ET.transformTo("uint8array",o):h==="string"&&(i?o=Tq8.decode(o):r&&a!==!0&&(o=Bq8(o))),o):K64.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}});var pK=M1((cC9,wl3)=>{"use strict";function Ll3(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}Ll3.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return this.isFinished?!1:(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r<this._listeners[e].length;r++)this._listeners[e][r].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(r){t.processChunk(r)}),e.on("end",function(){t.end()}),e.on("error",function(r){t.error(r)}),this},pause:function(){return this.isPaused||this.isFinished?!1:(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var e=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}};wl3.exports=Ll3});var gj1=M1(km1=>{"use strict";var uj1=Mb(),iT1=Ac1(),Vq8=Ol2(),cq2=pK(),Wl2=new Array(256);for(zc1=0;zc1<256;zc1++)Wl2[zc1]=zc1>=252?6:zc1>=248?5:zc1>=240?4:zc1>=224?3:zc1>=192?2:1;var zc1;Wl2[254]=Wl2[254]=1;var Pq8=function(e){var t,r,a,i,n,o=e.length,h=0;for(i=0;i<o;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(a=e.charCodeAt(i+1),(a&64512)===56320&&(r=65536+(r-55296<<10)+(a-56320),i++)),h+=r<128?1:r<2048?2:r<65536?3:4;for(iT1.uint8array?t=new Uint8Array(h):t=new Array(h),n=0,i=0;n<h;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(a=e.charCodeAt(i+1),(a&64512)===56320&&(r=65536+(r-55296<<10)+(a-56320),i++)),r<128?t[n++]=r:r<2048?(t[n++]=192|r>>>6,t[n++]=128|r&63):r<65536?(t[n++]=224|r>>>12,t[n++]=128|r>>>6&63,t[n++]=128|r&63):(t[n++]=240|r>>>18,t[n++]=128|r>>>12&63,t[n++]=128|r>>>6&63,t[n++]=128|r&63);return t},_q8=function(e,t){var r;for(t=t||e.length,t>e.length&&(t=e.length),r=t-1;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+Wl2[e[r]]>t?r:t},Eq8=function(e){var t,r,a,i,n=e.length,o=new Array(n*2);for(r=0,t=0;t<n;){if(a=e[t++],a<128){o[r++]=a;continue}if(i=Wl2[a],i>4){o[r++]=65533,t+=i-1;continue}for(a&=i===2?31:i===3?15:7;i>1&&t<n;)a=a<<6|e[t++]&63,i--;if(i>1){o[r++]=65533;continue}a<65536?o[r++]=a:(a-=65536,o[r++]=55296|a>>10&1023,o[r++]=56320|a&1023)}return o.length!==r&&(o.subarray?o=o.subarray(0,r):o.length=r),uj1.applyFromCharCode(o)};km1.utf8encode=function(t){return iT1.nodebuffer?Vq8.newBufferFrom(t,"utf-8"):Pq8(t)};km1.utf8decode=function(t){return iT1.nodebuffer?uj1.transformTo("nodebuffer",t).toString("utf-8"):(t=uj1.transformTo(iT1.uint8array?"uint8array":"array",t),Eq8(t))};function sq2(){cq2.call(this,"utf-8 decode"),this.leftOver=null}uj1.inherits(sq2,cq2);sq2.prototype.processChunk=function(e){var t=uj1.transformTo(iT1.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(iT1.uint8array){var r=t;t=new Uint8Array(r.length+this.leftOver.length),t.set(this.leftOver,0),t.set(r,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var a=_q8(t),i=t;a!==t.length&&(iT1.uint8array?(i=t.subarray(0,a),this.leftOver=t.subarray(a,t.length)):(i=t.slice(0,a),this.leftOver=t.slice(a,t.length))),this.push({data:km1.utf8decode(i),meta:e.meta})};sq2.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:km1.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)};km1.Utf8DecodeWorker=sq2;function Y64(){cq2.call(this,"utf-8 encode")}uj1.inherits(Y64,cq2);Y64.prototype.processChunk=function(e){this.push({data:km1.utf8encode(e.data),meta:e.meta})};km1.Utf8EncodeWorker=Y64});var bl3=M1((hC9,zl3)=>{"use strict";var yl3=pK(),Al3=Mb();function X64(e){yl3.call(this,"ConvertWorker to "+e),this.destType=e}Al3.inherits(X64,yl3);X64.prototype.processChunk=function(e){this.push({data:Al3.transformTo(this.destType,e.data),meta:e.meta})};zl3.exports=X64});var kl3=M1((dC9,Hl3)=>{"use strict";var Sl3=Vx().Readable,Rq8=Mb();Rq8.inherits(J64,Sl3);function J64(e,t,r){Sl3.call(this,t),this._helper=e;var a=this;e.on("data",function(i,n){a.push(i)||a._helper.pause(),r&&r(n)}).on("error",function(i){a.emit("error",i)}).on("end",function(){a.push(null)})}J64.prototype._read=function(){this._helper.resume()};Hl3.exports=J64});var Q64=M1((uC9,Vl3)=>{"use strict";var nT1=Mb(),Zq8=bl3(),Fq8=pK(),Oq8=D64(),Dq8=Ac1(),Iq8=hj1(),Tl3=null;if(Dq8.nodestream)try{Tl3=kl3()}catch{}function Nq8(e,t,r){switch(e){case"blob":return nT1.newBlob(nT1.transformTo("arraybuffer",t),r);case"base64":return Oq8.encode(t);default:return nT1.transformTo(e,t)}}function Uq8(e,t){var r,a=0,i=null,n=0;for(r=0;r<t.length;r++)n+=t[r].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(i=new Uint8Array(n),r=0;r<t.length;r++)i.set(t[r],a),a+=t[r].length;return i;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}function Gq8(e,t){return new Iq8.Promise(function(r,a){var i=[],n=e._internalType,o=e._outputType,h=e._mimeType;e.on("data",function(u,g){i.push(u),t&&t(g)}).on("error",function(u){i=[],a(u)}).on("end",function(){try{var u=Nq8(o,Uq8(n,i),h);r(u)}catch(g){a(g)}i=[]}).resume()})}function Bl3(e,t,r){var a=t;switch(t){case"blob":case"arraybuffer":a="uint8array";break;case"base64":a="string";break}try{this._internalType=a,this._outputType=t,this._mimeType=r,nT1.checkSupport(a),this._worker=e.pipe(new Zq8(a)),e.lock()}catch(i){this._worker=new Fq8("error"),this._worker.error(i)}}Bl3.prototype={accumulate:function(e){return Gq8(this,e)},on:function(e,t){var r=this;return e==="data"?this._worker.on(e,function(a){t.call(r,a.data,a.meta)}):this._worker.on(e,function(){nT1.delay(t,arguments,r)}),this},resume:function(){return nT1.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(nT1.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new Tl3(this,{objectMode:this._outputType!=="nodebuffer"},e)}};Vl3.exports=Bl3});var t84=M1(y31=>{"use strict";y31.base64=!1;y31.binary=!1;y31.dir=!1;y31.createFolders=!0;y31.date=null;y31.compression=null;y31.compressionOptions=null;y31.comment=null;y31.unixPermissions=null;y31.dosPermissions=null});var e84=M1((pC9,Pl3)=>{"use strict";var hq2=Mb(),dq2=pK(),jq8=16*1024;function pj1(e){dq2.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(r){t.dataIsReady=!0,t.data=r,t.max=r&&r.length||0,t.type=hq2.getTypeOf(r),t.isPaused||t._tickAndRepeat()},function(r){t.error(r)})}hq2.inherits(pj1,dq2);pj1.prototype.cleanUp=function(){dq2.prototype.cleanUp.call(this),this.data=null};pj1.prototype.resume=function(){return dq2.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,hq2.delay(this._tickAndRepeat,[],this)),!0):!1};pj1.prototype._tickAndRepeat=function(){this._tickScheduled=!1,!(this.isPaused||this.isFinished)&&(this._tick(),this.isFinished||(hq2.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))};pj1.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=jq8,t=null,r=Math.min(this.max,this.index+e);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,r);break;case"uint8array":t=this.data.subarray(this.index,r);break;case"array":case"nodebuffer":t=this.data.slice(this.index,r);break}return this.index=r,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})};Pl3.exports=pj1});var uq2=M1((fC9,El3)=>{"use strict";var Wq8=Mb();function qq8(){for(var e,t=[],r=0;r<256;r++){e=r;for(var a=0;a<8;a++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var _l3=qq8();function $q8(e,t,r,a){var i=_l3,n=a+r;e=e^-1;for(var o=a;o<n;o++)e=e>>>8^i[(e^t[o])&255];return e^-1}function Kq8(e,t,r,a){var i=_l3,n=a+r;e=e^-1;for(var o=a;o<n;o++)e=e>>>8^i[(e^t.charCodeAt(o))&255];return e^-1}El3.exports=function(t,r){if(typeof t>"u"||!t.length)return 0;var a=Wq8.getTypeOf(t)!=="string";return a?$q8(r|0,t,t.length,0):Kq8(r|0,t,t.length,0)}});var a84=M1((vC9,Zl3)=>{"use strict";var Rl3=pK(),Yq8=uq2(),Xq8=Mb();function r84(){Rl3.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}Xq8.inherits(r84,Rl3);r84.prototype.processChunk=function(e){this.streamInfo.crc32=Yq8(e.data,this.streamInfo.crc32||0),this.push(e)};Zl3.exports=r84});var Ol3=M1((mC9,Fl3)=>{"use strict";var Jq8=Mb(),i84=pK();function n84(e){i84.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}Jq8.inherits(n84,i84);n84.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i84.prototype.processChunk.call(this,e)};Fl3.exports=n84});var gq2=M1((CC9,Nl3)=>{"use strict";var Dl3=hj1(),Il3=e84(),Qq8=a84(),o84=Ol3();function l84(e,t,r,a,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=a,this.compressedContent=i}l84.prototype={getContentWorker:function(){var e=new Il3(Dl3.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o84("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new Il3(Dl3.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};l84.createWorkerFrom=function(e,t,r){return e.pipe(new Qq8).pipe(new o84("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new o84("compressedSize")).withStreamInfo("compression",t)};Nl3.exports=l84});var Wl3=M1((MC9,jl3)=>{"use strict";var t$8=Q64(),e$8=e84(),c84=gj1(),s84=gq2(),Ul3=pK(),h84=function(e,t,r){this.name=e,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=t,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}};h84.prototype={internalStream:function(e){var t=null,r="string";try{if(!e)throw new Error("No output type specified.");r=e.toLowerCase();var a=r==="string"||r==="text";(r==="binarystring"||r==="text")&&(r="string"),t=this._decompressWorker();var i=!this._dataBinary;i&&!a&&(t=t.pipe(new c84.Utf8EncodeWorker)),!i&&a&&(t=t.pipe(new c84.Utf8DecodeWorker))}catch(n){t=new Ul3("error"),t.error(n)}return new t$8(t,r,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof s84&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new c84.Utf8EncodeWorker)),s84.createWorkerFrom(r,e,t)},_decompressWorker:function(){return this._data instanceof s84?this._data.getContentWorker():this._data instanceof Ul3?this._data:new e$8(this._data)}};var Gl3=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],r$8=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(pq2=0;pq2<Gl3.length;pq2++)h84.prototype[Gl3[pq2]]=r$8;var pq2;jl3.exports=h84});var bc1=M1(XI=>{"use strict";var a$8=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function i$8(e,t){return Object.prototype.hasOwnProperty.call(e,t)}XI.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var a in r)i$8(r,a)&&(e[a]=r[a])}}return e};XI.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n$8={arraySet:function(e,t,r,a,i){if(t.subarray&&e.subarray){e.set(t.subarray(r,r+a),i);return}for(var n=0;n<a;n++)e[i+n]=t[r+n]},flattenChunks:function(e){var t,r,a,i,n,o;for(a=0,t=0,r=e.length;t<r;t++)a+=e[t].length;for(o=new Uint8Array(a),i=0,t=0,r=e.length;t<r;t++)n=e[t],o.set(n,i),i+=n.length;return o}},o$8={arraySet:function(e,t,r,a,i){for(var n=0;n<a;n++)e[i+n]=t[r+n]},flattenChunks:function(e){return[].concat.apply([],e)}};XI.setTyped=function(e){e?(XI.Buf8=Uint8Array,XI.Buf16=Uint16Array,XI.Buf32=Int32Array,XI.assign(XI,n$8)):(XI.Buf8=Array,XI.Buf16=Array,XI.Buf32=Array,XI.assign(XI,o$8))};XI.setTyped(a$8)});var fc3=M1(mj1=>{"use strict";var l$8=bc1(),c$8=4,ql3=0,$l3=1,s$8=2;function vj1(e){for(var t=e.length;--t>=0;)e[t]=0}var h$8=0,tc3=1,d$8=2,u$8=3,g$8=258,m84=29,Jl2=256,$l2=Jl2+1+m84,fj1=30,C84=19,ec3=2*$l2+1,oT1=15,d84=16,p$8=7,M84=256,rc3=16,ac3=17,ic3=18,f84=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],fq2=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],f$8=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],nc3=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],v$8=512,Sc1=new Array(($l2+2)*2);vj1(Sc1);var ql2=new Array(fj1*2);vj1(ql2);var Kl2=new Array(v$8);vj1(Kl2);var Yl2=new Array(g$8-u$8+1);vj1(Yl2);var x84=new Array(m84);vj1(x84);var vq2=new Array(fj1);vj1(vq2);function u84(e,t,r,a,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=a,this.max_length=i,this.has_stree=e&&e.length}var oc3,lc3,cc3;function g84(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function sc3(e){return e<256?Kl2[e]:Kl2[256+(e>>>7)]}function Xl2(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function zj(e,t,r){e.bi_valid>d84-r?(e.bi_buf|=t<<e.bi_valid&65535,Xl2(e,e.bi_buf),e.bi_buf=t>>d84-e.bi_valid,e.bi_valid+=r-d84):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function pr1(e,t,r){zj(e,r[t*2],r[t*2+1])}function hc3(e,t){var r=0;do r|=e&1,e>>>=1,r<<=1;while(--t>0);return r>>>1}function m$8(e){e.bi_valid===16?(Xl2(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function C$8(e,t){var r=t.dyn_tree,a=t.max_code,i=t.stat_desc.static_tree,n=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,h=t.stat_desc.extra_base,u=t.stat_desc.max_length,g,f,v,C,L,y,z=0;for(C=0;C<=oT1;C++)e.bl_count[C]=0;for(r[e.heap[e.heap_max]*2+1]=0,g=e.heap_max+1;g<ec3;g++)f=e.heap[g],C=r[r[f*2+1]*2+1]+1,C>u&&(C=u,z++),r[f*2+1]=C,!(f>a)&&(e.bl_count[C]++,L=0,f>=h&&(L=o[f-h]),y=r[f*2],e.opt_len+=y*(C+L),n&&(e.static_len+=y*(i[f*2+1]+L)));if(z!==0){do{for(C=u-1;e.bl_count[C]===0;)C--;e.bl_count[C]--,e.bl_count[C+1]+=2,e.bl_count[u]--,z-=2}while(z>0);for(C=u;C!==0;C--)for(f=e.bl_count[C];f!==0;)v=e.heap[--g],!(v>a)&&(r[v*2+1]!==C&&(e.opt_len+=(C-r[v*2+1])*r[v*2],r[v*2+1]=C),f--)}}function dc3(e,t,r){var a=new Array(oT1+1),i=0,n,o;for(n=1;n<=oT1;n++)a[n]=i=i+r[n-1]<<1;for(o=0;o<=t;o++){var h=e[o*2+1];h!==0&&(e[o*2]=hc3(a[h]++,h))}}function M$8(){var e,t,r,a,i,n=new Array(oT1+1);for(r=0,a=0;a<m84-1;a++)for(x84[a]=r,e=0;e<1<<f84[a];e++)Yl2[r++]=a;for(Yl2[r-1]=a,i=0,a=0;a<16;a++)for(vq2[a]=i,e=0;e<1<<fq2[a];e++)Kl2[i++]=a;for(i>>=7;a<fj1;a++)for(vq2[a]=i<<7,e=0;e<1<<fq2[a]-7;e++)Kl2[256+i++]=a;for(t=0;t<=oT1;t++)n[t]=0;for(e=0;e<=143;)Sc1[e*2+1]=8,e++,n[8]++;for(;e<=255;)Sc1[e*2+1]=9,e++,n[9]++;for(;e<=279;)Sc1[e*2+1]=7,e++,n[7]++;for(;e<=287;)Sc1[e*2+1]=8,e++,n[8]++;for(dc3(Sc1,$l2+1,n),e=0;e<fj1;e++)ql2[e*2+1]=5,ql2[e*2]=hc3(e,5);oc3=new u84(Sc1,f84,Jl2+1,$l2,oT1),lc3=new u84(ql2,fq2,0,fj1,oT1),cc3=new u84(new Array(0),f$8,0,C84,p$8)}function uc3(e){var t;for(t=0;t<$l2;t++)e.dyn_ltree[t*2]=0;for(t=0;t<fj1;t++)e.dyn_dtree[t*2]=0;for(t=0;t<C84;t++)e.bl_tree[t*2]=0;e.dyn_ltree[M84*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function gc3(e){e.bi_valid>8?Xl2(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function x$8(e,t,r,a){gc3(e),a&&(Xl2(e,r),Xl2(e,~r)),l$8.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function Kl3(e,t,r,a){var i=t*2,n=r*2;return e[i]<e[n]||e[i]===e[n]&&a[t]<=a[r]}function p84(e,t,r){for(var a=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&Kl3(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Kl3(t,a,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=a}function Yl3(e,t,r){var a,i,n=0,o,h;if(e.last_lit!==0)do a=e.pending_buf[e.d_buf+n*2]<<8|e.pending_buf[e.d_buf+n*2+1],i=e.pending_buf[e.l_buf+n],n++,a===0?pr1(e,i,t):(o=Yl2[i],pr1(e,o+Jl2+1,t),h=f84[o],h!==0&&(i-=x84[o],zj(e,i,h)),a--,o=sc3(a),pr1(e,o,r),h=fq2[o],h!==0&&(a-=vq2[o],zj(e,a,h)));while(n<e.last_lit);pr1(e,M84,t)}function v84(e,t){var r=t.dyn_tree,a=t.stat_desc.static_tree,i=t.stat_desc.has_stree,n=t.stat_desc.elems,o,h,u=-1,g;for(e.heap_len=0,e.heap_max=ec3,o=0;o<n;o++)r[o*2]!==0?(e.heap[++e.heap_len]=u=o,e.depth[o]=0):r[o*2+1]=0;for(;e.heap_len<2;)g=e.heap[++e.heap_len]=u<2?++u:0,r[g*2]=1,e.depth[g]=0,e.opt_len--,i&&(e.static_len-=a[g*2+1]);for(t.max_code=u,o=e.heap_len>>1;o>=1;o--)p84(e,r,o);g=n;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],p84(e,r,1),h=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=h,r[g*2]=r[o*2]+r[h*2],e.depth[g]=(e.depth[o]>=e.depth[h]?e.depth[o]:e.depth[h])+1,r[o*2+1]=r[h*2+1]=g,e.heap[1]=g++,p84(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],C$8(e,t),dc3(r,u,e.bl_count)}function Xl3(e,t,r){var a,i=-1,n,o=t[1],h=0,u=7,g=4;for(o===0&&(u=138,g=3),t[(r+1)*2+1]=65535,a=0;a<=r;a++)n=o,o=t[(a+1)*2+1],!(++h<u&&n===o)&&(h<g?e.bl_tree[n*2]+=h:n!==0?(n!==i&&e.bl_tree[n*2]++,e.bl_tree[rc3*2]++):h<=10?e.bl_tree[ac3*2]++:e.bl_tree[ic3*2]++,h=0,i=n,o===0?(u=138,g=3):n===o?(u=6,g=3):(u=7,g=4))}function Jl3(e,t,r){var a,i=-1,n,o=t[1],h=0,u=7,g=4;for(o===0&&(u=138,g=3),a=0;a<=r;a++)if(n=o,o=t[(a+1)*2+1],!(++h<u&&n===o)){if(h<g)do pr1(e,n,e.bl_tree);while(--h!==0);else n!==0?(n!==i&&(pr1(e,n,e.bl_tree),h--),pr1(e,rc3,e.bl_tree),zj(e,h-3,2)):h<=10?(pr1(e,ac3,e.bl_tree),zj(e,h-3,3)):(pr1(e,ic3,e.bl_tree),zj(e,h-11,7));h=0,i=n,o===0?(u=138,g=3):n===o?(u=6,g=3):(u=7,g=4)}}function L$8(e){var t;for(Xl3(e,e.dyn_ltree,e.l_desc.max_code),Xl3(e,e.dyn_dtree,e.d_desc.max_code),v84(e,e.bl_desc),t=C84-1;t>=3&&e.bl_tree[nc3[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function w$8(e,t,r,a){var i;for(zj(e,t-257,5),zj(e,r-1,5),zj(e,a-4,4),i=0;i<a;i++)zj(e,e.bl_tree[nc3[i]*2+1],3);Jl3(e,e.dyn_ltree,t-1),Jl3(e,e.dyn_dtree,r-1)}function y$8(e){var t=4093624447,r;for(r=0;r<=31;r++,t>>>=1)if(t&1&&e.dyn_ltree[r*2]!==0)return ql3;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return $l3;for(r=32;r<Jl2;r++)if(e.dyn_ltree[r*2]!==0)return $l3;return ql3}var Ql3=!1;function A$8(e){Ql3||(M$8(),Ql3=!0),e.l_desc=new g84(e.dyn_ltree,oc3),e.d_desc=new g84(e.dyn_dtree,lc3),e.bl_desc=new g84(e.bl_tree,cc3),e.bi_buf=0,e.bi_valid=0,uc3(e)}function pc3(e,t,r,a){zj(e,(h$8<<1)+(a?1:0),3),x$8(e,t,r,!0)}function z$8(e){zj(e,tc3<<1,3),pr1(e,M84,Sc1),m$8(e)}function b$8(e,t,r,a){var i,n,o=0;e.level>0?(e.strm.data_type===s$8&&(e.strm.data_type=y$8(e)),v84(e,e.l_desc),v84(e,e.d_desc),o=L$8(e),i=e.opt_len+3+7>>>3,n=e.static_len+3+7>>>3,n<=i&&(i=n)):i=n=r+5,r+4<=i&&t!==-1?pc3(e,t,r,a):e.strategy===c$8||n===i?(zj(e,(tc3<<1)+(a?1:0),3),Yl3(e,Sc1,ql2)):(zj(e,(d$8<<1)+(a?1:0),3),w$8(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Yl3(e,e.dyn_ltree,e.dyn_dtree)),uc3(e),a&&gc3(e)}function S$8(e,t,r){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=r&255,e.last_lit++,t===0?e.dyn_ltree[r*2]++:(e.matches++,t--,e.dyn_ltree[(Yl2[r]+Jl2+1)*2]++,e.dyn_dtree[sc3(t)*2]++),e.last_lit===e.lit_bufsize-1}mj1._tr_init=A$8;mj1._tr_stored_block=pc3;mj1._tr_flush_block=b$8;mj1._tr_tally=S$8;mj1._tr_align=z$8});var L84=M1((wC9,vc3)=>{"use strict";function H$8(e,t,r,a){for(var i=e&65535|0,n=e>>>16&65535|0,o=0;r!==0;){o=r>2e3?2e3:r,r-=o;do i=i+t[a++]|0,n=n+i|0;while(--o);i%=65521,n%=65521}return i|n<<16|0}vc3.exports=H$8});var w84=M1((yC9,mc3)=>{"use strict";function k$8(){for(var e,t=[],r=0;r<256;r++){e=r;for(var a=0;a<8;a++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var T$8=k$8();function B$8(e,t,r,a){var i=T$8,n=a+r;e^=-1;for(var o=a;o<n;o++)e=e>>>8^i[(e^t[o])&255];return e^-1}mc3.exports=B$8});var mq2=M1((AC9,Cc3)=>{"use strict";Cc3.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var Sc3=M1(mr1=>{"use strict";var JI=bc1(),bQ=fc3(),wc3=L84(),Tm1=w84(),V$8=mq2(),hT1=0,P$8=1,_$8=3,Em1=4,Mc3=5,vr1=0,xc3=1,SQ=-2,E$8=-3,y84=-5,R$8=-1,Z$8=1,Cq2=2,F$8=3,O$8=4,D$8=0,I$8=2,wq2=8,N$8=9,U$8=15,G$8=8,j$8=29,W$8=256,z84=W$8+1+j$8,q$8=30,$$8=19,K$8=2*z84+1,Y$8=15,tf=3,Pm1=258,A31=Pm1+tf+1,X$8=32,yq2=42,b84=69,Mq2=73,xq2=91,Lq2=103,lT1=113,tc2=666,mV=1,ec2=2,cT1=3,xj1=4,J$8=3;function _m1(e,t){return e.msg=V$8[t],t}function Lc3(e){return(e<<1)-(e>4?9:0)}function Vm1(e){for(var t=e.length;--t>=0;)e[t]=0}function Bm1(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(JI.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))}function AR(e,t){bQ._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Bm1(e.strm)}function hm(e,t){e.pending_buf[e.pending++]=t}function Ql2(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function Q$8(e,t,r,a){var i=e.avail_in;return i>a&&(i=a),i===0?0:(e.avail_in-=i,JI.arraySet(t,e.input,e.next_in,i,r),e.state.wrap===1?e.adler=wc3(e.adler,t,i,r):e.state.wrap===2&&(e.adler=Tm1(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)}function yc3(e,t){var r=e.max_chain_length,a=e.strstart,i,n,o=e.prev_length,h=e.nice_match,u=e.strstart>e.w_size-A31?e.strstart-(e.w_size-A31):0,g=e.window,f=e.w_mask,v=e.prev,C=e.strstart+Pm1,L=g[a+o-1],y=g[a+o];e.prev_length>=e.good_match&&(r>>=2),h>e.lookahead&&(h=e.lookahead);do if(i=t,!(g[i+o]!==y||g[i+o-1]!==L||g[i]!==g[a]||g[++i]!==g[a+1])){a+=2,i++;do;while(g[++a]===g[++i]&&g[++a]===g[++i]&&g[++a]===g[++i]&&g[++a]===g[++i]&&g[++a]===g[++i]&&g[++a]===g[++i]&&g[++a]===g[++i]&&g[++a]===g[++i]&&a<C);if(n=Pm1-(C-a),a=C-Pm1,n>o){if(e.match_start=t,o=n,n>=h)break;L=g[a+o-1],y=g[a+o]}}while((t=v[t&f])>u&&--r!==0);return o<=e.lookahead?o:e.lookahead}function sT1(e){var t=e.w_size,r,a,i,n,o;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-A31)){JI.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,a=e.hash_size,r=a;do i=e.head[--r],e.head[r]=i>=t?i-t:0;while(--a);a=t,r=a;do i=e.prev[--r],e.prev[r]=i>=t?i-t:0;while(--a);n+=t}if(e.strm.avail_in===0)break;if(a=Q$8(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=a,e.lookahead+e.insert>=tf)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+tf-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<tf)););}while(e.lookahead<A31&&e.strm.avail_in!==0)}function tK8(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(sT1(e),e.lookahead===0&&t===hT1)return mV;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var a=e.block_start+r;if((e.strstart===0||e.strstart>=a)&&(e.lookahead=e.strstart-a,e.strstart=a,AR(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-A31&&(AR(e,!1),e.strm.avail_out===0))return mV}return e.insert=0,t===Em1?(AR(e,!0),e.strm.avail_out===0?cT1:xj1):(e.strstart>e.block_start&&(AR(e,!1),e.strm.avail_out===0),mV)}function A84(e,t){for(var r,a;;){if(e.lookahead<A31){if(sT1(e),e.lookahead<A31&&t===hT1)return mV;if(e.lookahead===0)break}if(r=0,e.lookahead>=tf&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+tf-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),r!==0&&e.strstart-r<=e.w_size-A31&&(e.match_length=yc3(e,r)),e.match_length>=tf)if(a=bQ._tr_tally(e,e.strstart-e.match_start,e.match_length-tf),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=tf){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+tf-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else a=bQ._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(a&&(AR(e,!1),e.strm.avail_out===0))return mV}return e.insert=e.strstart<tf-1?e.strstart:tf-1,t===Em1?(AR(e,!0),e.strm.avail_out===0?cT1:xj1):e.last_lit&&(AR(e,!1),e.strm.avail_out===0)?mV:ec2}function Cj1(e,t){for(var r,a,i;;){if(e.lookahead<A31){if(sT1(e),e.lookahead<A31&&t===hT1)return mV;if(e.lookahead===0)break}if(r=0,e.lookahead>=tf&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+tf-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=tf-1,r!==0&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-A31&&(e.match_length=yc3(e,r),e.match_length<=5&&(e.strategy===Z$8||e.match_length===tf&&e.strstart-e.match_start>4096)&&(e.match_length=tf-1)),e.prev_length>=tf&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-tf,a=bQ._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-tf),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+tf-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=tf-1,e.strstart++,a&&(AR(e,!1),e.strm.avail_out===0))return mV}else if(e.match_available){if(a=bQ._tr_tally(e,0,e.window[e.strstart-1]),a&&AR(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return mV}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(a=bQ._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<tf-1?e.strstart:tf-1,t===Em1?(AR(e,!0),e.strm.avail_out===0?cT1:xj1):e.last_lit&&(AR(e,!1),e.strm.avail_out===0)?mV:ec2}function eK8(e,t){for(var r,a,i,n,o=e.window;;){if(e.lookahead<=Pm1){if(sT1(e),e.lookahead<=Pm1&&t===hT1)return mV;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=tf&&e.strstart>0&&(i=e.strstart-1,a=o[i],a===o[++i]&&a===o[++i]&&a===o[++i])){n=e.strstart+Pm1;do;while(a===o[++i]&&a===o[++i]&&a===o[++i]&&a===o[++i]&&a===o[++i]&&a===o[++i]&&a===o[++i]&&a===o[++i]&&i<n);e.match_length=Pm1-(n-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=tf?(r=bQ._tr_tally(e,1,e.match_length-tf),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=bQ._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(AR(e,!1),e.strm.avail_out===0))return mV}return e.insert=0,t===Em1?(AR(e,!0),e.strm.avail_out===0?cT1:xj1):e.last_lit&&(AR(e,!1),e.strm.avail_out===0)?mV:ec2}function rK8(e,t){for(var r;;){if(e.lookahead===0&&(sT1(e),e.lookahead===0)){if(t===hT1)return mV;break}if(e.match_length=0,r=bQ._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(AR(e,!1),e.strm.avail_out===0))return mV}return e.insert=0,t===Em1?(AR(e,!0),e.strm.avail_out===0?cT1:xj1):e.last_lit&&(AR(e,!1),e.strm.avail_out===0)?mV:ec2}function fr1(e,t,r,a,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=a,this.func=i}var Mj1;Mj1=[new fr1(0,0,0,0,tK8),new fr1(4,4,8,4,A84),new fr1(4,5,16,8,A84),new fr1(4,6,32,32,A84),new fr1(4,4,16,16,Cj1),new fr1(8,16,32,32,Cj1),new fr1(8,16,128,128,Cj1),new fr1(8,32,128,256,Cj1),new fr1(32,128,258,1024,Cj1),new fr1(32,258,258,4096,Cj1)];function aK8(e){e.window_size=2*e.w_size,Vm1(e.head),e.max_lazy_match=Mj1[e.level].max_lazy,e.good_match=Mj1[e.level].good_length,e.nice_match=Mj1[e.level].nice_length,e.max_chain_length=Mj1[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=tf-1,e.match_available=0,e.ins_h=0}function iK8(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=wq2,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new JI.Buf16(K$8*2),this.dyn_dtree=new JI.Buf16((2*q$8+1)*2),this.bl_tree=new JI.Buf16((2*$$8+1)*2),Vm1(this.dyn_ltree),Vm1(this.dyn_dtree),Vm1(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new JI.Buf16(Y$8+1),this.heap=new JI.Buf16(2*z84+1),Vm1(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new JI.Buf16(2*z84+1),Vm1(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Ac3(e){var t;return!e||!e.state?_m1(e,SQ):(e.total_in=e.total_out=0,e.data_type=I$8,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?yq2:lT1,e.adler=t.wrap===2?0:1,t.last_flush=hT1,bQ._tr_init(t),vr1)}function zc3(e){var t=Ac3(e);return t===vr1&&aK8(e.state),t}function nK8(e,t){return!e||!e.state||e.state.wrap!==2?SQ:(e.state.gzhead=t,vr1)}function bc3(e,t,r,a,i,n){if(!e)return SQ;var o=1;if(t===R$8&&(t=6),a<0?(o=0,a=-a):a>15&&(o=2,a-=16),i<1||i>N$8||r!==wq2||a<8||a>15||t<0||t>9||n<0||n>O$8)return _m1(e,SQ);a===8&&(a=9);var h=new iK8;return e.state=h,h.strm=e,h.wrap=o,h.gzhead=null,h.w_bits=a,h.w_size=1<<h.w_bits,h.w_mask=h.w_size-1,h.hash_bits=i+7,h.hash_size=1<<h.hash_bits,h.hash_mask=h.hash_size-1,h.hash_shift=~~((h.hash_bits+tf-1)/tf),h.window=new JI.Buf8(h.w_size*2),h.head=new JI.Buf16(h.hash_size),h.prev=new JI.Buf16(h.w_size),h.lit_bufsize=1<<i+6,h.pending_buf_size=h.lit_bufsize*4,h.pending_buf=new JI.Buf8(h.pending_buf_size),h.d_buf=1*h.lit_bufsize,h.l_buf=3*h.lit_bufsize,h.level=t,h.strategy=n,h.method=r,zc3(e)}function oK8(e,t){return bc3(e,t,wq2,U$8,G$8,D$8)}function lK8(e,t){var r,a,i,n;if(!e||!e.state||t>Mc3||t<0)return e?_m1(e,SQ):SQ;if(a=e.state,!e.output||!e.input&&e.avail_in!==0||a.status===tc2&&t!==Em1)return _m1(e,e.avail_out===0?y84:SQ);if(a.strm=e,r=a.last_flush,a.last_flush=t,a.status===yq2)if(a.wrap===2)e.adler=0,hm(a,31),hm(a,139),hm(a,8),a.gzhead?(hm(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),hm(a,a.gzhead.time&255),hm(a,a.gzhead.time>>8&255),hm(a,a.gzhead.time>>16&255),hm(a,a.gzhead.time>>24&255),hm(a,a.level===9?2:a.strategy>=Cq2||a.level<2?4:0),hm(a,a.gzhead.os&255),a.gzhead.extra&&a.gzhead.extra.length&&(hm(a,a.gzhead.extra.length&255),hm(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=Tm1(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=b84):(hm(a,0),hm(a,0),hm(a,0),hm(a,0),hm(a,0),hm(a,a.level===9?2:a.strategy>=Cq2||a.level<2?4:0),hm(a,J$8),a.status=lT1);else{var o=wq2+(a.w_bits-8<<4)<<8,h=-1;a.strategy>=Cq2||a.level<2?h=0:a.level<6?h=1:a.level===6?h=2:h=3,o|=h<<6,a.strstart!==0&&(o|=X$8),o+=31-o%31,a.status=lT1,Ql2(a,o),a.strstart!==0&&(Ql2(a,e.adler>>>16),Ql2(a,e.adler&65535)),e.adler=1}if(a.status===b84)if(a.gzhead.extra){for(i=a.pending;a.gzindex<(a.gzhead.extra.length&65535)&&!(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>i&&(e.adler=Tm1(e.adler,a.pending_buf,a.pending-i,i)),Bm1(e),i=a.pending,a.pending===a.pending_buf_size));)hm(a,a.gzhead.extra[a.gzindex]&255),a.gzindex++;a.gzhead.hcrc&&a.pending>i&&(e.adler=Tm1(e.adler,a.pending_buf,a.pending-i,i)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=Mq2)}else a.status=Mq2;if(a.status===Mq2)if(a.gzhead.name){i=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>i&&(e.adler=Tm1(e.adler,a.pending_buf,a.pending-i,i)),Bm1(e),i=a.pending,a.pending===a.pending_buf_size)){n=1;break}a.gzindex<a.gzhead.name.length?n=a.gzhead.name.charCodeAt(a.gzindex++)&255:n=0,hm(a,n)}while(n!==0);a.gzhead.hcrc&&a.pending>i&&(e.adler=Tm1(e.adler,a.pending_buf,a.pending-i,i)),n===0&&(a.gzindex=0,a.status=xq2)}else a.status=xq2;if(a.status===xq2)if(a.gzhead.comment){i=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>i&&(e.adler=Tm1(e.adler,a.pending_buf,a.pending-i,i)),Bm1(e),i=a.pending,a.pending===a.pending_buf_size)){n=1;break}a.gzindex<a.gzhead.comment.length?n=a.gzhead.comment.charCodeAt(a.gzindex++)&255:n=0,hm(a,n)}while(n!==0);a.gzhead.hcrc&&a.pending>i&&(e.adler=Tm1(e.adler,a.pending_buf,a.pending-i,i)),n===0&&(a.status=Lq2)}else a.status=Lq2;if(a.status===Lq2&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&Bm1(e),a.pending+2<=a.pending_buf_size&&(hm(a,e.adler&255),hm(a,e.adler>>8&255),e.adler=0,a.status=lT1)):a.status=lT1),a.pending!==0){if(Bm1(e),e.avail_out===0)return a.last_flush=-1,vr1}else if(e.avail_in===0&&Lc3(t)<=Lc3(r)&&t!==Em1)return _m1(e,y84);if(a.status===tc2&&e.avail_in!==0)return _m1(e,y84);if(e.avail_in!==0||a.lookahead!==0||t!==hT1&&a.status!==tc2){var u=a.strategy===Cq2?rK8(a,t):a.strategy===F$8?eK8(a,t):Mj1[a.level].func(a,t);if((u===cT1||u===xj1)&&(a.status=tc2),u===mV||u===cT1)return e.avail_out===0&&(a.last_flush=-1),vr1;if(u===ec2&&(t===P$8?bQ._tr_align(a):t!==Mc3&&(bQ._tr_stored_block(a,0,0,!1),t===_$8&&(Vm1(a.head),a.lookahead===0&&(a.strstart=0,a.block_start=0,a.insert=0))),Bm1(e),e.avail_out===0))return a.last_flush=-1,vr1}return t!==Em1?vr1:a.wrap<=0?xc3:(a.wrap===2?(hm(a,e.adler&255),hm(a,e.adler>>8&255),hm(a,e.adler>>16&255),hm(a,e.adler>>24&255),hm(a,e.total_in&255),hm(a,e.total_in>>8&255),hm(a,e.total_in>>16&255),hm(a,e.total_in>>24&255)):(Ql2(a,e.adler>>>16),Ql2(a,e.adler&65535)),Bm1(e),a.wrap>0&&(a.wrap=-a.wrap),a.pending!==0?vr1:xc3)}function cK8(e){var t;return!e||!e.state?SQ:(t=e.state.status,t!==yq2&&t!==b84&&t!==Mq2&&t!==xq2&&t!==Lq2&&t!==lT1&&t!==tc2?_m1(e,SQ):(e.state=null,t===lT1?_m1(e,E$8):vr1))}function sK8(e,t){var r=t.length,a,i,n,o,h,u,g,f;if(!e||!e.state||(a=e.state,o=a.wrap,o===2||o===1&&a.status!==yq2||a.lookahead))return SQ;for(o===1&&(e.adler=wc3(e.adler,t,r,0)),a.wrap=0,r>=a.w_size&&(o===0&&(Vm1(a.head),a.strstart=0,a.block_start=0,a.insert=0),f=new JI.Buf8(a.w_size),JI.arraySet(f,t,r-a.w_size,a.w_size,0),t=f,r=a.w_size),h=e.avail_in,u=e.next_in,g=e.input,e.avail_in=r,e.next_in=0,e.input=t,sT1(a);a.lookahead>=tf;){i=a.strstart,n=a.lookahead-(tf-1);do a.ins_h=(a.ins_h<<a.hash_shift^a.window[i+tf-1])&a.hash_mask,a.prev[i&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=i,i++;while(--n);a.strstart=i,a.lookahead=tf-1,sT1(a)}return a.strstart+=a.lookahead,a.block_start=a.strstart,a.insert=a.lookahead,a.lookahead=0,a.match_length=a.prev_length=tf-1,a.match_available=0,e.next_in=u,e.input=g,e.avail_in=h,a.wrap=o,vr1}mr1.deflateInit=oK8;mr1.deflateInit2=bc3;mr1.deflateReset=zc3;mr1.deflateResetKeep=Ac3;mr1.deflateSetHeader=nK8;mr1.deflate=lK8;mr1.deflateEnd=cK8;mr1.deflateSetDictionary=sK8;mr1.deflateInfo="pako deflate (from Nodeca project)"});var S84=M1(Lj1=>{"use strict";var Aq2=bc1(),Hc3=!0,kc3=!0;try{String.fromCharCode.apply(null,[0])}catch{Hc3=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{kc3=!1}var rc2=new Aq2.Buf8(256);for(Hc1=0;Hc1<256;Hc1++)rc2[Hc1]=Hc1>=252?6:Hc1>=248?5:Hc1>=240?4:Hc1>=224?3:Hc1>=192?2:1;var Hc1;rc2[254]=rc2[254]=1;Lj1.string2buf=function(e){var t,r,a,i,n,o=e.length,h=0;for(i=0;i<o;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(a=e.charCodeAt(i+1),(a&64512)===56320&&(r=65536+(r-55296<<10)+(a-56320),i++)),h+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Aq2.Buf8(h),n=0,i=0;n<h;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<o&&(a=e.charCodeAt(i+1),(a&64512)===56320&&(r=65536+(r-55296<<10)+(a-56320),i++)),r<128?t[n++]=r:r<2048?(t[n++]=192|r>>>6,t[n++]=128|r&63):r<65536?(t[n++]=224|r>>>12,t[n++]=128|r>>>6&63,t[n++]=128|r&63):(t[n++]=240|r>>>18,t[n++]=128|r>>>12&63,t[n++]=128|r>>>6&63,t[n++]=128|r&63);return t};function Tc3(e,t){if(t<65534&&(e.subarray&&kc3||!e.subarray&&Hc3))return String.fromCharCode.apply(null,Aq2.shrinkBuf(e,t));for(var r="",a=0;a<t;a++)r+=String.fromCharCode(e[a]);return r}Lj1.buf2binstring=function(e){return Tc3(e,e.length)};Lj1.binstring2buf=function(e){for(var t=new Aq2.Buf8(e.length),r=0,a=t.length;r<a;r++)t[r]=e.charCodeAt(r);return t};Lj1.buf2string=function(e,t){var r,a,i,n,o=t||e.length,h=new Array(o*2);for(a=0,r=0;r<o;){if(i=e[r++],i<128){h[a++]=i;continue}if(n=rc2[i],n>4){h[a++]=65533,r+=n-1;continue}for(i&=n===2?31:n===3?15:7;n>1&&r<o;)i=i<<6|e[r++]&63,n--;if(n>1){h[a++]=65533;continue}i<65536?h[a++]=i:(i-=65536,h[a++]=55296|i>>10&1023,h[a++]=56320|i&1023)}return Tc3(h,a)};Lj1.utf8border=function(e,t){var r;for(t=t||e.length,t>e.length&&(t=e.length),r=t-1;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+rc2[e[r]]>t?r:t}});var H84=M1((SC9,Bc3)=>{"use strict";function hK8(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}Bc3.exports=hK8});var Ec3=M1(nc2=>{"use strict";var ac2=Sc3(),ic2=bc1(),T84=S84(),B84=mq2(),dK8=H84(),_c3=Object.prototype.toString,uK8=0,k84=4,wj1=0,Vc3=1,Pc3=2,gK8=-1,pK8=0,fK8=8;function dT1(e){if(!(this instanceof dT1))return new dT1(e);this.options=ic2.assign({level:gK8,method:fK8,chunkSize:16384,windowBits:15,memLevel:8,strategy:pK8,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new dK8,this.strm.avail_out=0;var r=ac2.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==wj1)throw new Error(B84[r]);if(t.header&&ac2.deflateSetHeader(this.strm,t.header),t.dictionary){var a;if(typeof t.dictionary=="string"?a=T84.string2buf(t.dictionary):_c3.call(t.dictionary)==="[object ArrayBuffer]"?a=new Uint8Array(t.dictionary):a=t.dictionary,r=ac2.deflateSetDictionary(this.strm,a),r!==wj1)throw new Error(B84[r]);this._dict_set=!0}}dT1.prototype.push=function(e,t){var r=this.strm,a=this.options.chunkSize,i,n;if(this.ended)return!1;n=t===~~t?t:t===!0?k84:uK8,typeof e=="string"?r.input=T84.string2buf(e):_c3.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new ic2.Buf8(a),r.next_out=0,r.avail_out=a),i=ac2.deflate(r,n),i!==Vc3&&i!==wj1)return this.onEnd(i),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(n===k84||n===Pc3))&&(this.options.to==="string"?this.onData(T84.buf2binstring(ic2.shrinkBuf(r.output,r.next_out))):this.onData(ic2.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&i!==Vc3);return n===k84?(i=ac2.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===wj1):(n===Pc3&&(this.onEnd(wj1),r.avail_out=0),!0)};dT1.prototype.onData=function(e){this.chunks.push(e)};dT1.prototype.onEnd=function(e){e===wj1&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=ic2.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function V84(e,t){var r=new dT1(t);if(r.push(e,!0),r.err)throw r.msg||B84[r.err];return r.result}function vK8(e,t){return t=t||{},t.raw=!0,V84(e,t)}function mK8(e,t){return t=t||{},t.gzip=!0,V84(e,t)}nc2.Deflate=dT1;nc2.deflate=V84;nc2.deflateRaw=vK8;nc2.gzip=mK8});var Zc3=M1((kC9,Rc3)=>{"use strict";var zq2=30,CK8=12;Rc3.exports=function(t,r){var a,i,n,o,h,u,g,f,v,C,L,y,z,S,B,R,F,N,j,Y,t1,n1,a1,s1,p1;a=t.state,i=t.next_in,s1=t.input,n=i+(t.avail_in-5),o=t.next_out,p1=t.output,h=o-(r-t.avail_out),u=o+(t.avail_out-257),g=a.dmax,f=a.wsize,v=a.whave,C=a.wnext,L=a.window,y=a.hold,z=a.bits,S=a.lencode,B=a.distcode,R=(1<<a.lenbits)-1,F=(1<<a.distbits)-1;t:do{z<15&&(y+=s1[i++]<<z,z+=8,y+=s1[i++]<<z,z+=8),N=S[y&R];e:for(;;){if(j=N>>>24,y>>>=j,z-=j,j=N>>>16&255,j===0)p1[o++]=N&65535;else if(j&16){Y=N&65535,j&=15,j&&(z<j&&(y+=s1[i++]<<z,z+=8),Y+=y&(1<<j)-1,y>>>=j,z-=j),z<15&&(y+=s1[i++]<<z,z+=8,y+=s1[i++]<<z,z+=8),N=B[y&F];r:for(;;){if(j=N>>>24,y>>>=j,z-=j,j=N>>>16&255,j&16){if(t1=N&65535,j&=15,z<j&&(y+=s1[i++]<<z,z+=8,z<j&&(y+=s1[i++]<<z,z+=8)),t1+=y&(1<<j)-1,t1>g){t.msg="invalid distance too far back",a.mode=zq2;break t}if(y>>>=j,z-=j,j=o-h,t1>j){if(j=t1-j,j>v&&a.sane){t.msg="invalid distance too far back",a.mode=zq2;break t}if(n1=0,a1=L,C===0){if(n1+=f-j,j<Y){Y-=j;do p1[o++]=L[n1++];while(--j);n1=o-t1,a1=p1}}else if(C<j){if(n1+=f+C-j,j-=C,j<Y){Y-=j;do p1[o++]=L[n1++];while(--j);if(n1=0,C<Y){j=C,Y-=j;do p1[o++]=L[n1++];while(--j);n1=o-t1,a1=p1}}}else if(n1+=C-j,j<Y){Y-=j;do p1[o++]=L[n1++];while(--j);n1=o-t1,a1=p1}for(;Y>2;)p1[o++]=a1[n1++],p1[o++]=a1[n1++],p1[o++]=a1[n1++],Y-=3;Y&&(p1[o++]=a1[n1++],Y>1&&(p1[o++]=a1[n1++]))}else{n1=o-t1;do p1[o++]=p1[n1++],p1[o++]=p1[n1++],p1[o++]=p1[n1++],Y-=3;while(Y>2);Y&&(p1[o++]=p1[n1++],Y>1&&(p1[o++]=p1[n1++]))}}else if((j&64)===0){N=B[(N&65535)+(y&(1<<j)-1)];continue r}else{t.msg="invalid distance code",a.mode=zq2;break t}break}}else if((j&64)===0){N=S[(N&65535)+(y&(1<<j)-1)];continue e}else if(j&32){a.mode=CK8;break t}else{t.msg="invalid literal/length code",a.mode=zq2;break t}break}}while(i<n&&o<u);Y=z>>3,i-=Y,z-=Y<<3,y&=(1<<z)-1,t.next_in=i,t.next_out=o,t.avail_in=i<n?5+(n-i):5-(i-n),t.avail_out=o<u?257+(u-o):257-(o-u),a.hold=y,a.bits=z}});var Gc3=M1((TC9,Uc3)=>{"use strict";var Fc3=bc1(),yj1=15,Oc3=852,Dc3=592,Ic3=0,P84=1,Nc3=2,MK8=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],xK8=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],LK8=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],wK8=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];Uc3.exports=function(t,r,a,i,n,o,h,u){var g=u.bits,f=0,v=0,C=0,L=0,y=0,z=0,S=0,B=0,R=0,F=0,N,j,Y,t1,n1,a1=null,s1=0,p1,u1=new Fc3.Buf16(yj1+1),v1=new Fc3.Buf16(yj1+1),h1=null,H1=0,z1,b1,m1;for(f=0;f<=yj1;f++)u1[f]=0;for(v=0;v<i;v++)u1[r[a+v]]++;for(y=g,L=yj1;L>=1&&u1[L]===0;L--);if(y>L&&(y=L),L===0)return n[o++]=1<<24|64<<16|0,n[o++]=1<<24|64<<16|0,u.bits=1,0;for(C=1;C<L&&u1[C]===0;C++);for(y<C&&(y=C),B=1,f=1;f<=yj1;f++)if(B<<=1,B-=u1[f],B<0)return-1;if(B>0&&(t===Ic3||L!==1))return-1;for(v1[1]=0,f=1;f<yj1;f++)v1[f+1]=v1[f]+u1[f];for(v=0;v<i;v++)r[a+v]!==0&&(h[v1[r[a+v]]++]=v);if(t===Ic3?(a1=h1=h,p1=19):t===P84?(a1=MK8,s1-=257,h1=xK8,H1-=257,p1=256):(a1=LK8,h1=wK8,p1=-1),F=0,v=0,f=C,n1=o,z=y,S=0,Y=-1,R=1<<y,t1=R-1,t===P84&&R>Oc3||t===Nc3&&R>Dc3)return 1;for(;;){z1=f-S,h[v]<p1?(b1=0,m1=h[v]):h[v]>p1?(b1=h1[H1+h[v]],m1=a1[s1+h[v]]):(b1=96,m1=0),N=1<<f-S,j=1<<z,C=j;do j-=N,n[n1+(F>>S)+j]=z1<<24|b1<<16|m1|0;while(j!==0);for(N=1<<f-1;F&N;)N>>=1;if(N!==0?(F&=N-1,F+=N):F=0,v++,--u1[f]===0){if(f===L)break;f=r[a+h[v]]}if(f>y&&(F&t1)!==Y){for(S===0&&(S=y),n1+=C,z=f-S,B=1<<z;z+S<L&&(B-=u1[z+S],!(B<=0));)z++,B<<=1;if(R+=1<<z,t===P84&&R>Oc3||t===Nc3&&R>Dc3)return 1;Y=F&t1,n[Y]=y<<24|z<<16|n1-o|0}}return F!==0&&(n[n1+F]=f-S<<24|64<<16|0),u.bits=y,0}});var zs3=M1(z31=>{"use strict";var fK=bc1(),O84=L84(),Cr1=w84(),yK8=Zc3(),oc2=Gc3(),AK8=0,vs3=1,ms3=2,jc3=4,zK8=5,bq2=6,uT1=0,bK8=1,SK8=2,HQ=-2,Cs3=-3,D84=-4,HK8=-5,Wc3=8,Ms3=1,qc3=2,$c3=3,Kc3=4,Yc3=5,Xc3=6,Jc3=7,Qc3=8,ts3=9,es3=10,kq2=11,kc1=12,_84=13,rs3=14,E84=15,as3=16,is3=17,ns3=18,os3=19,Sq2=20,Hq2=21,ls3=22,cs3=23,ss3=24,hs3=25,ds3=26,R84=27,us3=28,gs3=29,WA=30,I84=31,kK8=32,TK8=852,BK8=592,VK8=15,PK8=VK8;function ps3(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function _K8(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new fK.Buf16(320),this.work=new fK.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function xs3(e){var t;return!e||!e.state?HQ:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Ms3,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new fK.Buf32(TK8),t.distcode=t.distdyn=new fK.Buf32(BK8),t.sane=1,t.back=-1,uT1)}function Ls3(e){var t;return!e||!e.state?HQ:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,xs3(e))}function ws3(e,t){var r,a;return!e||!e.state||(a=e.state,t<0?(r=0,t=-t):(r=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?HQ:(a.window!==null&&a.wbits!==t&&(a.window=null),a.wrap=r,a.wbits=t,Ls3(e))}function ys3(e,t){var r,a;return e?(a=new _K8,e.state=a,a.window=null,r=ws3(e,t),r!==uT1&&(e.state=null),r):HQ}function EK8(e){return ys3(e,PK8)}var fs3=!0,Z84,F84;function RK8(e){if(fs3){var t;for(Z84=new fK.Buf32(512),F84=new fK.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(oc2(vs3,e.lens,0,288,Z84,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;oc2(ms3,e.lens,0,32,F84,0,e.work,{bits:5}),fs3=!1}e.lencode=Z84,e.lenbits=9,e.distcode=F84,e.distbits=5}function As3(e,t,r,a){var i,n=e.state;return n.window===null&&(n.wsize=1<<n.wbits,n.wnext=0,n.whave=0,n.window=new fK.Buf8(n.wsize)),a>=n.wsize?(fK.arraySet(n.window,t,r-n.wsize,n.wsize,0),n.wnext=0,n.whave=n.wsize):(i=n.wsize-n.wnext,i>a&&(i=a),fK.arraySet(n.window,t,r-a,i,n.wnext),a-=i,a?(fK.arraySet(n.window,t,r-a,a,0),n.wnext=a,n.whave=n.wsize):(n.wnext+=i,n.wnext===n.wsize&&(n.wnext=0),n.whave<n.wsize&&(n.whave+=i))),0}function ZK8(e,t){var r,a,i,n,o,h,u,g,f,v,C,L,y,z,S=0,B,R,F,N,j,Y,t1,n1,a1=new fK.Buf8(4),s1,p1,u1=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return HQ;r=e.state,r.mode===kc1&&(r.mode=_84),o=e.next_out,i=e.output,u=e.avail_out,n=e.next_in,a=e.input,h=e.avail_in,g=r.hold,f=r.bits,v=h,C=u,n1=uT1;t:for(;;)switch(r.mode){case Ms3:if(r.wrap===0){r.mode=_84;break}for(;f<16;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if(r.wrap&2&&g===35615){r.check=0,a1[0]=g&255,a1[1]=g>>>8&255,r.check=Cr1(r.check,a1,2,0),g=0,f=0,r.mode=qc3;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((g&255)<<8)+(g>>8))%31){e.msg="incorrect header check",r.mode=WA;break}if((g&15)!==Wc3){e.msg="unknown compression method",r.mode=WA;break}if(g>>>=4,f-=4,t1=(g&15)+8,r.wbits===0)r.wbits=t1;else if(t1>r.wbits){e.msg="invalid window size",r.mode=WA;break}r.dmax=1<<t1,e.adler=r.check=1,r.mode=g&512?es3:kc1,g=0,f=0;break;case qc3:for(;f<16;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if(r.flags=g,(r.flags&255)!==Wc3){e.msg="unknown compression method",r.mode=WA;break}if(r.flags&57344){e.msg="unknown header flags set",r.mode=WA;break}r.head&&(r.head.text=g>>8&1),r.flags&512&&(a1[0]=g&255,a1[1]=g>>>8&255,r.check=Cr1(r.check,a1,2,0)),g=0,f=0,r.mode=$c3;case $c3:for(;f<32;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}r.head&&(r.head.time=g),r.flags&512&&(a1[0]=g&255,a1[1]=g>>>8&255,a1[2]=g>>>16&255,a1[3]=g>>>24&255,r.check=Cr1(r.check,a1,4,0)),g=0,f=0,r.mode=Kc3;case Kc3:for(;f<16;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}r.head&&(r.head.xflags=g&255,r.head.os=g>>8),r.flags&512&&(a1[0]=g&255,a1[1]=g>>>8&255,r.check=Cr1(r.check,a1,2,0)),g=0,f=0,r.mode=Yc3;case Yc3:if(r.flags&1024){for(;f<16;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}r.length=g,r.head&&(r.head.extra_len=g),r.flags&512&&(a1[0]=g&255,a1[1]=g>>>8&255,r.check=Cr1(r.check,a1,2,0)),g=0,f=0}else r.head&&(r.head.extra=null);r.mode=Xc3;case Xc3:if(r.flags&1024&&(L=r.length,L>h&&(L=h),L&&(r.head&&(t1=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),fK.arraySet(r.head.extra,a,n,L,t1)),r.flags&512&&(r.check=Cr1(r.check,a,L,n)),h-=L,n+=L,r.length-=L),r.length))break t;r.length=0,r.mode=Jc3;case Jc3:if(r.flags&2048){if(h===0)break t;L=0;do t1=a[n+L++],r.head&&t1&&r.length<65536&&(r.head.name+=String.fromCharCode(t1));while(t1&&L<h);if(r.flags&512&&(r.check=Cr1(r.check,a,L,n)),h-=L,n+=L,t1)break t}else r.head&&(r.head.name=null);r.length=0,r.mode=Qc3;case Qc3:if(r.flags&4096){if(h===0)break t;L=0;do t1=a[n+L++],r.head&&t1&&r.length<65536&&(r.head.comment+=String.fromCharCode(t1));while(t1&&L<h);if(r.flags&512&&(r.check=Cr1(r.check,a,L,n)),h-=L,n+=L,t1)break t}else r.head&&(r.head.comment=null);r.mode=ts3;case ts3:if(r.flags&512){for(;f<16;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if(g!==(r.check&65535)){e.msg="header crc mismatch",r.mode=WA;break}g=0,f=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=kc1;break;case es3:for(;f<32;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}e.adler=r.check=ps3(g),g=0,f=0,r.mode=kq2;case kq2:if(r.havedict===0)return e.next_out=o,e.avail_out=u,e.next_in=n,e.avail_in=h,r.hold=g,r.bits=f,SK8;e.adler=r.check=1,r.mode=kc1;case kc1:if(t===zK8||t===bq2)break t;case _84:if(r.last){g>>>=f&7,f-=f&7,r.mode=R84;break}for(;f<3;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}switch(r.last=g&1,g>>>=1,f-=1,g&3){case 0:r.mode=rs3;break;case 1:if(RK8(r),r.mode=Sq2,t===bq2){g>>>=2,f-=2;break t}break;case 2:r.mode=is3;break;case 3:e.msg="invalid block type",r.mode=WA}g>>>=2,f-=2;break;case rs3:for(g>>>=f&7,f-=f&7;f<32;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if((g&65535)!==(g>>>16^65535)){e.msg="invalid stored block lengths",r.mode=WA;break}if(r.length=g&65535,g=0,f=0,r.mode=E84,t===bq2)break t;case E84:r.mode=as3;case as3:if(L=r.length,L){if(L>h&&(L=h),L>u&&(L=u),L===0)break t;fK.arraySet(i,a,n,L,o),h-=L,n+=L,u-=L,o+=L,r.length-=L;break}r.mode=kc1;break;case is3:for(;f<14;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if(r.nlen=(g&31)+257,g>>>=5,f-=5,r.ndist=(g&31)+1,g>>>=5,f-=5,r.ncode=(g&15)+4,g>>>=4,f-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=WA;break}r.have=0,r.mode=ns3;case ns3:for(;r.have<r.ncode;){for(;f<3;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}r.lens[u1[r.have++]]=g&7,g>>>=3,f-=3}for(;r.have<19;)r.lens[u1[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,s1={bits:r.lenbits},n1=oc2(AK8,r.lens,0,19,r.lencode,0,r.work,s1),r.lenbits=s1.bits,n1){e.msg="invalid code lengths set",r.mode=WA;break}r.have=0,r.mode=os3;case os3:for(;r.have<r.nlen+r.ndist;){for(;S=r.lencode[g&(1<<r.lenbits)-1],B=S>>>24,R=S>>>16&255,F=S&65535,!(B<=f);){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if(F<16)g>>>=B,f-=B,r.lens[r.have++]=F;else{if(F===16){for(p1=B+2;f<p1;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if(g>>>=B,f-=B,r.have===0){e.msg="invalid bit length repeat",r.mode=WA;break}t1=r.lens[r.have-1],L=3+(g&3),g>>>=2,f-=2}else if(F===17){for(p1=B+3;f<p1;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}g>>>=B,f-=B,t1=0,L=3+(g&7),g>>>=3,f-=3}else{for(p1=B+7;f<p1;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}g>>>=B,f-=B,t1=0,L=11+(g&127),g>>>=7,f-=7}if(r.have+L>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=WA;break}for(;L--;)r.lens[r.have++]=t1}}if(r.mode===WA)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=WA;break}if(r.lenbits=9,s1={bits:r.lenbits},n1=oc2(vs3,r.lens,0,r.nlen,r.lencode,0,r.work,s1),r.lenbits=s1.bits,n1){e.msg="invalid literal/lengths set",r.mode=WA;break}if(r.distbits=6,r.distcode=r.distdyn,s1={bits:r.distbits},n1=oc2(ms3,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,s1),r.distbits=s1.bits,n1){e.msg="invalid distances set",r.mode=WA;break}if(r.mode=Sq2,t===bq2)break t;case Sq2:r.mode=Hq2;case Hq2:if(h>=6&&u>=258){e.next_out=o,e.avail_out=u,e.next_in=n,e.avail_in=h,r.hold=g,r.bits=f,yK8(e,C),o=e.next_out,i=e.output,u=e.avail_out,n=e.next_in,a=e.input,h=e.avail_in,g=r.hold,f=r.bits,r.mode===kc1&&(r.back=-1);break}for(r.back=0;S=r.lencode[g&(1<<r.lenbits)-1],B=S>>>24,R=S>>>16&255,F=S&65535,!(B<=f);){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if(R&&(R&240)===0){for(N=B,j=R,Y=F;S=r.lencode[Y+((g&(1<<N+j)-1)>>N)],B=S>>>24,R=S>>>16&255,F=S&65535,!(N+B<=f);){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}g>>>=N,f-=N,r.back+=N}if(g>>>=B,f-=B,r.back+=B,r.length=F,R===0){r.mode=ds3;break}if(R&32){r.back=-1,r.mode=kc1;break}if(R&64){e.msg="invalid literal/length code",r.mode=WA;break}r.extra=R&15,r.mode=ls3;case ls3:if(r.extra){for(p1=r.extra;f<p1;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}r.length+=g&(1<<r.extra)-1,g>>>=r.extra,f-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=cs3;case cs3:for(;S=r.distcode[g&(1<<r.distbits)-1],B=S>>>24,R=S>>>16&255,F=S&65535,!(B<=f);){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if((R&240)===0){for(N=B,j=R,Y=F;S=r.distcode[Y+((g&(1<<N+j)-1)>>N)],B=S>>>24,R=S>>>16&255,F=S&65535,!(N+B<=f);){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}g>>>=N,f-=N,r.back+=N}if(g>>>=B,f-=B,r.back+=B,R&64){e.msg="invalid distance code",r.mode=WA;break}r.offset=F,r.extra=R&15,r.mode=ss3;case ss3:if(r.extra){for(p1=r.extra;f<p1;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}r.offset+=g&(1<<r.extra)-1,g>>>=r.extra,f-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=WA;break}r.mode=hs3;case hs3:if(u===0)break t;if(L=C-u,r.offset>L){if(L=r.offset-L,L>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=WA;break}L>r.wnext?(L-=r.wnext,y=r.wsize-L):y=r.wnext-L,L>r.length&&(L=r.length),z=r.window}else z=i,y=o-r.offset,L=r.length;L>u&&(L=u),u-=L,r.length-=L;do i[o++]=z[y++];while(--L);r.length===0&&(r.mode=Hq2);break;case ds3:if(u===0)break t;i[o++]=r.length,u--,r.mode=Hq2;break;case R84:if(r.wrap){for(;f<32;){if(h===0)break t;h--,g|=a[n++]<<f,f+=8}if(C-=u,e.total_out+=C,r.total+=C,C&&(e.adler=r.check=r.flags?Cr1(r.check,i,C,o-C):O84(r.check,i,C,o-C)),C=u,(r.flags?g:ps3(g))!==r.check){e.msg="incorrect data check",r.mode=WA;break}g=0,f=0}r.mode=us3;case us3:if(r.wrap&&r.flags){for(;f<32;){if(h===0)break t;h--,g+=a[n++]<<f,f+=8}if(g!==(r.total&4294967295)){e.msg="incorrect length check",r.mode=WA;break}g=0,f=0}r.mode=gs3;case gs3:n1=bK8;break t;case WA:n1=Cs3;break t;case I84:return D84;case kK8:default:return HQ}return e.next_out=o,e.avail_out=u,e.next_in=n,e.avail_in=h,r.hold=g,r.bits=f,(r.wsize||C!==e.avail_out&&r.mode<WA&&(r.mode<R84||t!==jc3))&&As3(e,e.output,e.next_out,C-e.avail_out)?(r.mode=I84,D84):(v-=e.avail_in,C-=e.avail_out,e.total_in+=v,e.total_out+=C,r.total+=C,r.wrap&&C&&(e.adler=r.check=r.flags?Cr1(r.check,i,C,e.next_out-C):O84(r.check,i,C,e.next_out-C)),e.data_type=r.bits+(r.last?64:0)+(r.mode===kc1?128:0)+(r.mode===Sq2||r.mode===E84?256:0),(v===0&&C===0||t===jc3)&&n1===uT1&&(n1=HK8),n1)}function FK8(e){if(!e||!e.state)return HQ;var t=e.state;return t.window&&(t.window=null),e.state=null,uT1}function OK8(e,t){var r;return!e||!e.state||(r=e.state,(r.wrap&2)===0)?HQ:(r.head=t,t.done=!1,uT1)}function DK8(e,t){var r=t.length,a,i,n;return!e||!e.state||(a=e.state,a.wrap!==0&&a.mode!==kq2)?HQ:a.mode===kq2&&(i=1,i=O84(i,t,r,0),i!==a.check)?Cs3:(n=As3(e,t,r,r),n?(a.mode=I84,D84):(a.havedict=1,uT1))}z31.inflateReset=Ls3;z31.inflateReset2=ws3;z31.inflateResetKeep=xs3;z31.inflateInit=EK8;z31.inflateInit2=ys3;z31.inflate=ZK8;z31.inflateEnd=FK8;z31.inflateGetHeader=OK8;z31.inflateSetDictionary=DK8;z31.inflateInfo="pako inflate (from Nodeca project)"});var N84=M1((VC9,bs3)=>{"use strict";bs3.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var Hs3=M1((PC9,Ss3)=>{"use strict";function IK8(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}Ss3.exports=IK8});var Ts3=M1(cc2=>{"use strict";var Aj1=zs3(),lc2=bc1(),Tq2=S84(),ik=N84(),U84=mq2(),NK8=H84(),UK8=Hs3(),ks3=Object.prototype.toString;function gT1(e){if(!(this instanceof gT1))return new gT1(e);this.options=lc2.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new NK8,this.strm.avail_out=0;var r=Aj1.inflateInit2(this.strm,t.windowBits);if(r!==ik.Z_OK)throw new Error(U84[r]);if(this.header=new UK8,Aj1.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=Tq2.string2buf(t.dictionary):ks3.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Aj1.inflateSetDictionary(this.strm,t.dictionary),r!==ik.Z_OK)))throw new Error(U84[r])}gT1.prototype.push=function(e,t){var r=this.strm,a=this.options.chunkSize,i=this.options.dictionary,n,o,h,u,g,f=!1;if(this.ended)return!1;o=t===~~t?t:t===!0?ik.Z_FINISH:ik.Z_NO_FLUSH,typeof e=="string"?r.input=Tq2.binstring2buf(e):ks3.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new lc2.Buf8(a),r.next_out=0,r.avail_out=a),n=Aj1.inflate(r,ik.Z_NO_FLUSH),n===ik.Z_NEED_DICT&&i&&(n=Aj1.inflateSetDictionary(this.strm,i)),n===ik.Z_BUF_ERROR&&f===!0&&(n=ik.Z_OK,f=!1),n!==ik.Z_STREAM_END&&n!==ik.Z_OK)return this.onEnd(n),this.ended=!0,!1;r.next_out&&(r.avail_out===0||n===ik.Z_STREAM_END||r.avail_in===0&&(o===ik.Z_FINISH||o===ik.Z_SYNC_FLUSH))&&(this.options.to==="string"?(h=Tq2.utf8border(r.output,r.next_out),u=r.next_out-h,g=Tq2.buf2string(r.output,h),r.next_out=u,r.avail_out=a-u,u&&lc2.arraySet(r.output,r.output,h,u,0),this.onData(g)):this.onData(lc2.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(f=!0)}while((r.avail_in>0||r.avail_out===0)&&n!==ik.Z_STREAM_END);return n===ik.Z_STREAM_END&&(o=ik.Z_FINISH),o===ik.Z_FINISH?(n=Aj1.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===ik.Z_OK):(o===ik.Z_SYNC_FLUSH&&(this.onEnd(ik.Z_OK),r.avail_out=0),!0)};gT1.prototype.onData=function(e){this.chunks.push(e)};gT1.prototype.onEnd=function(e){e===ik.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=lc2.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function G84(e,t){var r=new gT1(t);if(r.push(e,!0),r.err)throw r.msg||U84[r.err];return r.result}function GK8(e,t){return t=t||{},t.raw=!0,G84(e,t)}cc2.Inflate=gT1;cc2.inflate=G84;cc2.inflateRaw=GK8;cc2.ungzip=G84});var Ps3=M1((EC9,Vs3)=>{"use strict";var jK8=bc1().assign,WK8=Ec3(),qK8=Ts3(),$K8=N84(),Bs3={};jK8(Bs3,WK8,qK8,$K8);Vs3.exports=Bs3});var Es3=M1(Vq2=>{"use strict";var KK8=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",YK8=Ps3(),_s3=Mb(),Bq2=pK(),XK8=KK8?"uint8array":"array";Vq2.magic="\b\0";function pT1(e,t){Bq2.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}_s3.inherits(pT1,Bq2);pT1.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(_s3.transformTo(XK8,e.data),!1)};pT1.prototype.flush=function(){Bq2.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)};pT1.prototype.cleanUp=function(){Bq2.prototype.cleanUp.call(this),this._pako=null};pT1.prototype._createPako=function(){this._pako=new YK8[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}};Vq2.compressWorker=function(e){return new pT1("Deflate",e)};Vq2.uncompressWorker=function(){return new pT1("Inflate",{})}});var W84=M1(j84=>{"use strict";var Rs3=pK();j84.STORE={magic:"\0\0",compressWorker:function(){return new Rs3("STORE compression")},uncompressWorker:function(){return new Rs3("STORE decompression")}};j84.DEFLATE=Es3()});var q84=M1(fT1=>{"use strict";fT1.LOCAL_FILE_HEADER="PK";fT1.CENTRAL_FILE_HEADER="PK";fT1.CENTRAL_DIRECTORY_END="PK";fT1.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07";fT1.ZIP64_CENTRAL_DIRECTORY_END="PK";fT1.DATA_DESCRIPTOR="PK\x07\b"});var Ds3=M1((OC9,Os3)=>{"use strict";var zj1=Mb(),bj1=pK(),$84=gj1(),Zs3=uq2(),Pq2=q84(),mw=function(e,t){var r="",a;for(a=0;a<t;a++)r+=String.fromCharCode(e&255),e=e>>>8;return r},JK8=function(e,t){var r=e;return e||(r=t?16893:33204),(r&65535)<<16},QK8=function(e){return(e||0)&63},Fs3=function(e,t,r,a,i,n){var o=e.file,h=e.compression,u=n!==$84.utf8encode,g=zj1.transformTo("string",n(o.name)),f=zj1.transformTo("string",$84.utf8encode(o.name)),v=o.comment,C=zj1.transformTo("string",n(v)),L=zj1.transformTo("string",$84.utf8encode(v)),y=f.length!==o.name.length,z=L.length!==v.length,S,B,R="",F="",N="",j=o.dir,Y=o.date,t1={crc32:0,compressedSize:0,uncompressedSize:0};(!t||r)&&(t1.crc32=e.crc32,t1.compressedSize=e.compressedSize,t1.uncompressedSize=e.uncompressedSize);var n1=0;t&&(n1|=8),!u&&(y||z)&&(n1|=2048);var a1=0,s1=0;j&&(a1|=16),i==="UNIX"?(s1=798,a1|=JK8(o.unixPermissions,j)):(s1=20,a1|=QK8(o.dosPermissions,j)),S=Y.getUTCHours(),S=S<<6,S=S|Y.getUTCMinutes(),S=S<<5,S=S|Y.getUTCSeconds()/2,B=Y.getUTCFullYear()-1980,B=B<<4,B=B|Y.getUTCMonth()+1,B=B<<5,B=B|Y.getUTCDate(),y&&(F=mw(1,1)+mw(Zs3(g),4)+f,R+="up"+mw(F.length,2)+F),z&&(N=mw(1,1)+mw(Zs3(C),4)+L,R+="uc"+mw(N.length,2)+N);var p1="";p1+=`
|
|
1622
1622
|
\0`,p1+=mw(n1,2),p1+=h.magic,p1+=mw(S,2),p1+=mw(B,2),p1+=mw(t1.crc32,4),p1+=mw(t1.compressedSize,4),p1+=mw(t1.uncompressedSize,4),p1+=mw(g.length,2),p1+=mw(R.length,2);var u1=Pq2.LOCAL_FILE_HEADER+p1+g+R,v1=Pq2.CENTRAL_FILE_HEADER+mw(s1,2)+p1+mw(C.length,2)+"\0\0\0\0"+mw(a1,4)+mw(a,4)+g+R+C;return{fileRecord:u1,dirRecord:v1}},tY8=function(e,t,r,a,i){var n="",o=zj1.transformTo("string",i(a));return n=Pq2.CENTRAL_DIRECTORY_END+"\0\0\0\0"+mw(e,2)+mw(e,2)+mw(t,4)+mw(r,4)+mw(o.length,2)+o,n},eY8=function(e){var t="";return t=Pq2.DATA_DESCRIPTOR+mw(e.crc32,4)+mw(e.compressedSize,4)+mw(e.uncompressedSize,4),t};function b31(e,t,r,a){bj1.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=a,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}zj1.inherits(b31,bj1);b31.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,a=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,bj1.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-a-1))/r:100}}))};b31.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=Fs3(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0};b31.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=Fs3(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:eY8(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null};b31.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var r=this.bytesWritten-e,a=tY8(this.dirRecords.length,r,e,this.zipComment,this.encodeFileName);this.push({data:a,meta:{percent:100}})};b31.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()};b31.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",function(r){t.processChunk(r)}),e.on("end",function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()}),e.on("error",function(r){t.error(r)}),this};b31.prototype.resume=function(){if(!bj1.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0};b31.prototype.error=function(e){var t=this._sources;if(!bj1.prototype.error.call(this,e))return!1;for(var r=0;r<t.length;r++)try{t[r].error(e)}catch{}return!0};b31.prototype.lock=function(){bj1.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()};Os3.exports=b31});var Ns3=M1(Is3=>{"use strict";var rY8=W84(),aY8=Ds3(),iY8=function(e,t){var r=e||t,a=rY8[r];if(!a)throw new Error(r+" is not a valid compression method !");return a};Is3.generateWorker=function(e,t,r){var a=new aY8(t.streamFiles,r,t.platform,t.encodeFileName),i=0;try{e.forEach(function(n,o){i++;var h=iY8(o.options.compression,t.compression),u=o.options.compressionOptions||t.compressionOptions||{},g=o.dir,f=o.date;o._compressWorker(h,u).withStreamInfo("file",{name:n,dir:g,date:f,comment:o.comment||"",unixPermissions:o.unixPermissions,dosPermissions:o.dosPermissions}).pipe(a)}),a.entriesCount=i}catch(n){a.error(n)}return a}});var Gs3=M1((IC9,Us3)=>{"use strict";var nY8=Mb(),_q2=pK();function sc2(e,t){_q2.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}nY8.inherits(sc2,_q2);sc2.prototype._bindStream=function(e){var t=this;this._stream=e,e.pause(),e.on("data",function(r){t.push({data:r,meta:{percent:0}})}).on("error",function(r){t.isPaused?this.generatedError=r:t.error(r)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})};sc2.prototype.pause=function(){return _q2.prototype.pause.call(this)?(this._stream.pause(),!0):!1};sc2.prototype.resume=function(){return _q2.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1};Us3.exports=sc2});var th3=M1((NC9,Qs3)=>{"use strict";var oY8=gj1(),hc2=Mb(),$s3=pK(),lY8=Q64(),Ks3=t84(),js3=gq2(),cY8=Wl3(),sY8=Ns3(),Ws3=Ol2(),hY8=Gs3(),Ys3=function(e,t,r){var a=hc2.getTypeOf(t),i,n=hc2.extend(r||{},Ks3);n.date=n.date||new Date,n.compression!==null&&(n.compression=n.compression.toUpperCase()),typeof n.unixPermissions=="string"&&(n.unixPermissions=parseInt(n.unixPermissions,8)),n.unixPermissions&&n.unixPermissions&16384&&(n.dir=!0),n.dosPermissions&&n.dosPermissions&16&&(n.dir=!0),n.dir&&(e=Xs3(e)),n.createFolders&&(i=dY8(e))&&Js3.call(this,i,!0);var o=a==="string"&&n.binary===!1&&n.base64===!1;(!r||typeof r.binary>"u")&&(n.binary=!o);var h=t instanceof js3&&t.uncompressedSize===0;(h||n.dir||!t||t.length===0)&&(n.base64=!1,n.binary=!0,t="",n.compression="STORE",a="string");var u=null;t instanceof js3||t instanceof $s3?u=t:Ws3.isNode&&Ws3.isStream(t)?u=new hY8(e,t):u=hc2.prepareContent(e,t,n.binary,n.optimizedBinaryString,n.base64);var g=new cY8(e,u,n);this.files[e]=g},dY8=function(e){e.slice(-1)==="/"&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},Xs3=function(e){return e.slice(-1)!=="/"&&(e+="/"),e},Js3=function(e,t){return t=typeof t<"u"?t:Ks3.createFolders,e=Xs3(e),this.files[e]||Ys3.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function qs3(e){return Object.prototype.toString.call(e)==="[object RegExp]"}var uY8={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,r,a;for(t in this.files)a=this.files[t],r=t.slice(this.root.length,t.length),r&&t.slice(0,this.root.length)===this.root&&e(r,a)},filter:function(e){var t=[];return this.forEach(function(r,a){e(r,a)&&t.push(a)}),t},file:function(e,t,r){if(arguments.length===1)if(qs3(e)){var a=e;return this.filter(function(n,o){return!o.dir&&a.test(n)})}else{var i=this.files[this.root+e];return i&&!i.dir?i:null}else e=this.root+e,Ys3.call(this,e,t,r);return this},folder:function(e){if(!e)return this;if(qs3(e))return this.filter(function(i,n){return n.dir&&e.test(i)});var t=this.root+e,r=Js3.call(this,t),a=this.clone();return a.root=r.name,a},remove:function(e){e=this.root+e;var t=this.files[e];if(t||(e.slice(-1)!=="/"&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var r=this.filter(function(i,n){return n.name.slice(0,e.length)===e}),a=0;a<r.length;a++)delete this.files[r[a].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,r={};try{if(r=hc2.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:oY8.utf8encode}),r.type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),r.type==="binarystring"&&(r.type="string"),!r.type)throw new Error("No output type specified.");hc2.checkSupport(r.type),(r.platform==="darwin"||r.platform==="freebsd"||r.platform==="linux"||r.platform==="sunos")&&(r.platform="UNIX"),r.platform==="win32"&&(r.platform="DOS");var a=r.comment||this.comment||"";t=sY8.generateWorker(this,r,a)}catch(i){t=new $s3("error"),t.error(i)}return new lY8(t,r.type||"string",r.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return e=e||{},e.type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};Qs3.exports=uY8});var K84=M1((UC9,rh3)=>{"use strict";var gY8=Mb();function eh3(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}eh3.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t=0,r;for(this.checkOffset(e),r=this.index+e-1;r>=this.index;r--)t=(t<<8)+this.byteAt(r);return this.index+=e,t},readString:function(e){return gY8.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC((e>>25&127)+1980,(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(e&31)<<1))}};rh3.exports=eh3});var Y84=M1((GC9,ih3)=>{"use strict";var ah3=K84(),pY8=Mb();function Sj1(e){ah3.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=e[t]&255}pY8.inherits(Sj1,ah3);Sj1.prototype.byteAt=function(e){return this.data[this.zero+e]};Sj1.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),r=e.charCodeAt(1),a=e.charCodeAt(2),i=e.charCodeAt(3),n=this.length-4;n>=0;--n)if(this.data[n]===t&&this.data[n+1]===r&&this.data[n+2]===a&&this.data[n+3]===i)return n-this.zero;return-1};Sj1.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),a=e.charCodeAt(2),i=e.charCodeAt(3),n=this.readData(4);return t===n[0]&&r===n[1]&&a===n[2]&&i===n[3]};Sj1.prototype.readData=function(e){if(this.checkOffset(e),e===0)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};ih3.exports=Sj1});var lh3=M1((jC9,oh3)=>{"use strict";var nh3=K84(),fY8=Mb();function Hj1(e){nh3.call(this,e)}fY8.inherits(Hj1,nh3);Hj1.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)};Hj1.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero};Hj1.prototype.readAndCheckSignature=function(e){var t=this.readData(4);return e===t};Hj1.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};oh3.exports=Hj1});var J84=M1((WC9,sh3)=>{"use strict";var ch3=Y84(),vY8=Mb();function X84(e){ch3.call(this,e)}vY8.inherits(X84,ch3);X84.prototype.readData=function(e){if(this.checkOffset(e),e===0)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};sh3.exports=X84});var uh3=M1((qC9,dh3)=>{"use strict";var hh3=J84(),mY8=Mb();function Q84(e){hh3.call(this,e)}mY8.inherits(Q84,hh3);Q84.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t};dh3.exports=Q84});var te4=M1(($C9,ph3)=>{"use strict";var Eq2=Mb(),gh3=Ac1(),CY8=Y84(),MY8=lh3(),xY8=uh3(),LY8=J84();ph3.exports=function(e){var t=Eq2.getTypeOf(e);return Eq2.checkSupport(t),t==="string"&&!gh3.uint8array?new MY8(e):t==="nodebuffer"?new xY8(e):gh3.uint8array?new LY8(Eq2.transformTo("uint8array",e)):new CY8(Eq2.transformTo("array",e))}});var Ch3=M1((KC9,mh3)=>{"use strict";var ee4=te4(),Rm1=Mb(),wY8=gq2(),fh3=uq2(),Rq2=gj1(),Zq2=W84(),yY8=Ac1(),AY8=0,zY8=3,bY8=function(e){for(var t in Zq2)if(Object.prototype.hasOwnProperty.call(Zq2,t)&&Zq2[t].magic===e)return Zq2[t];return null};function vh3(e,t){this.options=e,this.loadOptions=t}vh3.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function(e){var t,r;if(e.skip(22),this.fileNameLength=e.readInt(2),r=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(r),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(t=bY8(this.compressionMethod),t===null)throw new Error("Corrupted zip : compression "+Rm1.pretty(this.compressionMethod)+" unknown (inner file : "+Rm1.transformTo("string",this.fileName)+")");this.decompressed=new wY8(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(this.externalFileAttributes&16),e===AY8&&(this.dosPermissions=this.externalFileAttributes&63),e===zY8&&(this.unixPermissions=this.externalFileAttributes>>16&65535),!this.dir&&this.fileNameStr.slice(-1)==="/"&&(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=ee4(this.extraFields[1].value);this.uncompressedSize===Rm1.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===Rm1.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===Rm1.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===Rm1.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t=e.index+this.extraFieldsLength,r,a,i;for(this.extraFields||(this.extraFields={});e.index+4<t;)r=e.readInt(2),a=e.readInt(2),i=e.readData(a),this.extraFields[r]={id:r,length:a,value:i};e.setIndex(t)},handleUTF8:function(){var e=yY8.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=Rq2.utf8decode(this.fileName),this.fileCommentStr=Rq2.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(t!==null)this.fileNameStr=t;else{var r=Rm1.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var a=this.findExtraFieldUnicodeComment();if(a!==null)this.fileCommentStr=a;else{var i=Rm1.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(i)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=ee4(e.value);return t.readInt(1)!==1||fh3(this.fileName)!==t.readInt(4)?null:Rq2.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=ee4(e.value);return t.readInt(1)!==1||fh3(this.fileComment)!==t.readInt(4)?null:Rq2.utf8decode(t.readData(e.length-5))}return null}};mh3.exports=vh3});var Lh3=M1((YC9,xh3)=>{"use strict";var SY8=te4(),Tc1=Mb(),S31=q84(),HY8=Ch3(),kY8=Ac1();function Mh3(e){this.files=[],this.loadOptions=e}Mh3.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+Tc1.pretty(t)+", expected "+Tc1.pretty(e)+")")}},isSignature:function(e,t){var r=this.reader.index;this.reader.setIndex(e);var a=this.reader.readString(4),i=a===t;return this.reader.setIndex(r),i},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=kY8.uint8array?"uint8array":"array",r=Tc1.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(r)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e=this.zip64EndOfCentralSize-44,t=0,r,a,i;t<e;)r=this.reader.readInt(2),a=this.reader.readInt(4),i=this.reader.readData(a),this.zip64ExtensibleData[r]={id:r,length:a,value:i}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(S31.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(S31.CENTRAL_FILE_HEADER);)e=new HY8({zip64:this.zip64},this.loadOptions),e.readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(S31.CENTRAL_DIRECTORY_END);if(e<0){var t=!this.isSignature(0,S31.LOCAL_FILE_HEADER);throw t?new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html"):new Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex(e);var r=e;if(this.checkSignature(S31.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===Tc1.MAX_VALUE_16BITS||this.diskWithCentralDirStart===Tc1.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===Tc1.MAX_VALUE_16BITS||this.centralDirRecords===Tc1.MAX_VALUE_16BITS||this.centralDirSize===Tc1.MAX_VALUE_32BITS||this.centralDirOffset===Tc1.MAX_VALUE_32BITS){if(this.zip64=!0,e=this.reader.lastIndexOfSignature(S31.ZIP64_CENTRAL_DIRECTORY_LOCATOR),e<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(S31.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,S31.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(S31.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(S31.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var a=this.centralDirOffset+this.centralDirSize;this.zip64&&(a+=20,a+=12+this.zip64EndOfCentralSize);var i=r-a;if(i>0)this.isSignature(r,S31.CENTRAL_FILE_HEADER)||(this.reader.zero=i);else if(i<0)throw new Error("Corrupted zip: missing "+Math.abs(i)+" bytes.")},prepareReader:function(e){this.reader=SY8(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};xh3.exports=Mh3});var Ah3=M1((XC9,yh3)=>{"use strict";var re4=Mb(),Fq2=hj1(),TY8=gj1(),BY8=Lh3(),VY8=a84(),wh3=Ol2();function PY8(e){return new Fq2.Promise(function(t,r){var a=e.decompressed.getContentWorker().pipe(new VY8);a.on("error",function(i){r(i)}).on("end",function(){a.streamInfo.crc32!==e.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}yh3.exports=function(e,t){var r=this;return t=re4.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:TY8.utf8decode}),wh3.isNode&&wh3.isStream(e)?Fq2.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):re4.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(a){var i=new BY8(t);return i.load(a),i}).then(function(i){var n=[Fq2.Promise.resolve(i)],o=i.files;if(t.checkCRC32)for(var h=0;h<o.length;h++)n.push(PY8(o[h]));return Fq2.Promise.all(n)}).then(function(i){for(var n=i.shift(),o=n.files,h=0;h<o.length;h++){var u=o[h],g=u.fileNameStr,f=re4.resolve(u.fileNameStr);r.file(f,u.decompressed,{binary:!0,optimizedBinaryString:!0,date:u.date,dir:u.dir,comment:u.fileCommentStr.length?u.fileCommentStr:null,unixPermissions:u.unixPermissions,dosPermissions:u.dosPermissions,createFolders:t.createFolders}),u.dir||(r.file(f).unsafeOriginalName=g)}return n.zipComment.length&&(r.comment=n.zipComment),r})}});var H31=M1((JC9,zh3)=>{"use strict";function kQ(){if(!(this instanceof kQ))return new kQ;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new kQ;for(var t in this)typeof this[t]!="function"&&(e[t]=this[t]);return e}}kQ.prototype=th3();kQ.prototype.loadAsync=Ah3();kQ.support=Ac1();kQ.defaults=t84();kQ.version="3.10.1";kQ.loadAsync=function(e,t){return new kQ().loadAsync(e,t)};kQ.external=hj1();zh3.exports=kQ});var nu3=M1(Q8=>{Object.defineProperty(Q8,"__esModule",{value:!0});var se4="1.13.8",bh3=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global||Function("return this")()||{},qq2=Array.prototype,he4=Object.prototype,Sh3=typeof Symbol<"u"?Symbol.prototype:null,_Y8=qq2.push,fc2=qq2.slice,uc2=he4.toString,EY8=he4.hasOwnProperty,_h3=typeof ArrayBuffer<"u",RY8=typeof DataView<"u",ZY8=Array.isArray,Hh3=Object.keys,kh3=Object.create,Th3=_h3&&ArrayBuffer.isView,FY8=isNaN,OY8=isFinite,Eh3=!{toString:null}.propertyIsEnumerable("toString"),Bh3=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],DY8=Math.pow(2,53)-1;function QI(e,t){return t=t==null?e.length-1:+t,function(){for(var r=Math.max(arguments.length-t,0),a=Array(r),i=0;i<r;i++)a[i]=arguments[i+t];switch(t){case 0:return e.call(this,a);case 1:return e.call(this,arguments[0],a);case 2:return e.call(this,arguments[0],arguments[1],a)}var n=Array(t+1);for(i=0;i<t;i++)n[i]=arguments[i];return n[t]=a,e.apply(this,n)}}function Fm1(e){var t=typeof e;return t==="function"||t==="object"&&!!e}function Rh3(e){return e===null}function de4(e){return e===void 0}function ue4(e){return e===!0||e===!1||uc2.call(e)==="[object Boolean]"}function Zh3(e){return!!(e&&e.nodeType===1)}function QF(e){var t="[object "+e+"]";return function(r){return uc2.call(r)===t}}var $q2=QF("String"),ge4=QF("Number"),Fh3=QF("Date"),Oh3=QF("RegExp"),Dh3=QF("Error"),pe4=QF("Symbol"),fe4=QF("ArrayBuffer"),Ih3=QF("Function"),IY8=bh3.document&&bh3.document.childNodes;typeof/./!="function"&&typeof Int8Array!="object"&&typeof IY8!="function"&&(Ih3=function(e){return typeof e=="function"||!1});var JF=Ih3,Nh3=QF("Object"),Uh3=RY8&&(!/\[native code\]/.test(String(DataView))||Nh3(new DataView(new ArrayBuffer(8)))),ve4=typeof Map<"u"&&Nh3(new Map),NY8=QF("DataView");function UY8(e){return e!=null&&JF(e.getInt8)&&fe4(e.buffer)}var gc2=Uh3?UY8:NY8,Om1=ZY8||QF("Array");function Dm1(e,t){return e!=null&&EY8.call(e,t)}var ie4=QF("Arguments");(function(){ie4(arguments)||(ie4=function(e){return Dm1(e,"callee")})})();var Kq2=ie4;function Gh3(e){return!pe4(e)&&OY8(e)&&!isNaN(parseFloat(e))}function me4(e){return ge4(e)&&FY8(e)}function Ce4(e){return function(){return e}}function jh3(e){return function(t){var r=e(t);return typeof r=="number"&&r>=0&&r<=DY8}}function Wh3(e){return function(t){return t?.[e]}}var Iq2=Wh3("byteLength"),GY8=jh3(Iq2),jY8=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;function WY8(e){return Th3?Th3(e)&&!gc2(e):GY8(e)&&jY8.test(uc2.call(e))}var Me4=_h3?WY8:Ce4(!1),XF=Wh3("length");function qY8(e){for(var t={},r=e.length,a=0;a<r;++a)t[e[a]]=!0;return{contains:function(i){return t[i]===!0},push:function(i){return t[i]=!0,e.push(i)}}}function qh3(e,t){t=qY8(t);var r=Bh3.length,a=e.constructor,i=JF(a)&&a.prototype||he4,n="constructor";for(Dm1(e,n)&&!t.contains(n)&&t.push(n);r--;)n=Bh3[r],n in e&&e[n]!==i[n]&&!t.contains(n)&&t.push(n)}function CV(e){if(!Fm1(e))return[];if(Hh3)return Hh3(e);var t=[];for(var r in e)Dm1(e,r)&&t.push(r);return Eh3&&qh3(e,t),t}function $h3(e){if(e==null)return!0;var t=XF(e);return typeof t=="number"&&(Om1(e)||$q2(e)||Kq2(e))?t===0:XF(CV(e))===0}function xe4(e,t){var r=CV(t),a=r.length;if(e==null)return!a;for(var i=Object(e),n=0;n<a;n++){var o=r[n];if(t[o]!==i[o]||!(o in i))return!1}return!0}function NC(e){if(e instanceof NC)return e;if(!(this instanceof NC))return new NC(e);this._wrapped=e}NC.VERSION=se4;NC.prototype.value=function(){return this._wrapped};NC.prototype.valueOf=NC.prototype.toJSON=NC.prototype.value;NC.prototype.toString=function(){return String(this._wrapped)};function Vh3(e){return new Uint8Array(e.buffer||e,e.byteOffset||0,Iq2(e))}var Ph3="[object DataView]";function Kh3(e,t){for(var r=[{a:e,b:t}],a=[],i=[];r.length;){var n=r.pop();if(n===!0){a.pop(),i.pop();continue}if(e=n.a,t=n.b,e===t){if(e!==0||1/e===1/t)continue;return!1}if(e==null||t==null)return!1;if(e!==e){if(t!==t)continue;return!1}var o=typeof e;if(o!=="function"&&o!=="object"&&typeof t!="object")return!1;e instanceof NC&&(e=e._wrapped),t instanceof NC&&(t=t._wrapped);var h=uc2.call(e);if(h!==uc2.call(t))return!1;if(Uh3&&h=="[object Object]"&&gc2(e)){if(!gc2(t))return!1;h=Ph3}switch(h){case"[object RegExp]":case"[object String]":if(""+e==""+t)continue;return!1;case"[object Number]":r.push({a:+e,b:+t});continue;case"[object Date]":case"[object Boolean]":if(+e==+t)continue;return!1;case"[object Symbol]":if(Sh3.valueOf.call(e)===Sh3.valueOf.call(t))continue;return!1;case"[object ArrayBuffer]":case Ph3:r.push({a:Vh3(e),b:Vh3(t)});continue}var u=h==="[object Array]";if(!u&&Me4(e)){var g=Iq2(e);if(g!==Iq2(t))return!1;if(e.buffer===t.buffer&&e.byteOffset===t.byteOffset)continue;u=!0}if(!u){if(typeof e!="object"||typeof t!="object")return!1;var f=e.constructor,v=t.constructor;if(f!==v&&!(JF(f)&&f instanceof f&&JF(v)&&v instanceof v)&&"constructor"in e&&"constructor"in t)return!1}for(var C=a.length;C--;)if(a[C]===e){if(i[C]===t)break;return!1}if(!(C>=0))if(a.push(e),i.push(t),r.push(!0),u){if(C=e.length,C!==t.length)return!1;for(;C--;)r.push({a:e[C],b:t[C]})}else{var L=CV(e),y;if(C=L.length,CV(t).length!==C)return!1;for(;C--;){if(y=L[C],!Dm1(t,y))return!1;r.push({a:e[y],b:t[y]})}}}return!0}function Bj1(e){if(!Fm1(e))return[];var t=[];for(var r in e)t.push(r);return Eh3&&qh3(e,t),t}function Le4(e){var t=XF(e);return function(r){if(r==null)return!1;var a=Bj1(r);if(XF(a))return!1;for(var i=0;i<t;i++)if(!JF(r[e[i]]))return!1;return e!==Jh3||!JF(r[we4])}}var we4="forEach",Yh3="has",ye4=["clear","delete"],Xh3=["get",Yh3,"set"],$Y8=ye4.concat(we4,Xh3),Jh3=ye4.concat(Xh3),KY8=["add"].concat(ye4,we4,Yh3),Qh3=ve4?Le4($Y8):QF("Map"),td3=ve4?Le4(Jh3):QF("WeakMap"),ed3=ve4?Le4(KY8):QF("Set"),rd3=QF("WeakSet");function mT1(e){for(var t=CV(e),r=t.length,a=Array(r),i=0;i<r;i++)a[i]=e[t[i]];return a}function ad3(e){for(var t=CV(e),r=t.length,a=Array(r),i=0;i<r;i++)a[i]=[t[i],e[t[i]]];return a}function Ae4(e){for(var t={},r=CV(e),a=0,i=r.length;a<i;a++)t[e[r[a]]]=r[a];return t}function Nq2(e){var t=[];for(var r in e)JF(e[r])&&t.push(r);return t.sort()}function ze4(e,t){return function(r){var a=arguments.length;if(t&&(r=Object(r)),a<2||r==null)return r;for(var i=1;i<a;i++)for(var n=arguments[i],o=e(n),h=o.length,u=0;u<h;u++){var g=o[u];(!t||r[g]===void 0)&&(r[g]=n[g])}return r}}var be4=ze4(Bj1),pc2=ze4(CV),Se4=ze4(Bj1,!0);function YY8(){return function(){}}function id3(e){if(!Fm1(e))return{};if(kh3)return kh3(e);var t=YY8();t.prototype=e;var r=new t;return t.prototype=null,r}function nd3(e,t){var r=id3(e);return t&&pc2(r,t),r}function od3(e){return Fm1(e)?Om1(e)?e.slice():be4({},e):e}function ld3(e,t){return t(e),e}function He4(e){return Om1(e)?e:[e]}NC.toPath=He4;function vc2(e){return NC.toPath(e)}function ke4(e,t){for(var r=t.length,a=0;a<r;a++){if(e==null)return;e=e[t[a]]}return r?e:void 0}function Te4(e,t,r){var a=ke4(e,vc2(t));return de4(a)?r:a}function cd3(e,t){t=vc2(t);for(var r=t.length,a=0;a<r;a++){var i=t[a];if(!Dm1(e,i))return!1;e=e[i]}return!!r}function Yq2(e){return e}function kj1(e){return e=pc2({},e),function(t){return xe4(t,e)}}function Xq2(e){return e=vc2(e),function(t){return ke4(t,e)}}function mc2(e,t,r){if(t===void 0)return e;switch(r??3){case 1:return function(a){return e.call(t,a)};case 3:return function(a,i,n){return e.call(t,a,i,n)};case 4:return function(a,i,n,o){return e.call(t,a,i,n,o)}}return function(){return e.apply(t,arguments)}}function sd3(e,t,r){return e==null?Yq2:JF(e)?mc2(e,t,r):Fm1(e)&&!Om1(e)?kj1(e):Xq2(e)}function Jq2(e,t){return sd3(e,t,1/0)}NC.iteratee=Jq2;function bj(e,t,r){return NC.iteratee!==Jq2?NC.iteratee(e,t):sd3(e,t,r)}function hd3(e,t,r){t=bj(t,r);for(var a=CV(e),i=a.length,n={},o=0;o<i;o++){var h=a[o];n[h]=t(e[h],h,e)}return n}function Be4(){}function dd3(e){return e==null?Be4:function(t){return Te4(e,t)}}function ud3(e,t,r){var a=Array(Math.max(0,e));t=mc2(t,r,1);for(var i=0;i<e;i++)a[i]=t(i);return a}function Uq2(e,t){return t==null&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))}var Tj1=Date.now||function(){return new Date().getTime()};function gd3(e){var t=function(n){return e[n]},r="(?:"+CV(e).join("|")+")",a=RegExp(r),i=RegExp(r,"g");return function(n){return n=n==null?"":""+n,a.test(n)?n.replace(i,t):n}}var pd3={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},fd3=gd3(pd3),XY8=Ae4(pd3),vd3=gd3(XY8),md3=NC.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},ae4=/(.)^/,JY8={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},QY8=/\\|'|\r|\n|\u2028|\u2029/g;function tX8(e){return"\\"+JY8[e]}var eX8=/^\s*(\w|\$)+\s*$/;function Cd3(e,t,r){!t&&r&&(t=r),t=Se4({},t,NC.templateSettings);var a=RegExp([(t.escape||ae4).source,(t.interpolate||ae4).source,(t.evaluate||ae4).source].join("|")+"|$","g"),i=0,n="__p+='";e.replace(a,function(g,f,v,C,L){return n+=e.slice(i,L).replace(QY8,tX8),i=L+g.length,f?n+=`'+
|
|
1623
1623
|
((__t=(`+f+`))==null?'':_.escape(__t))+
|
|
1624
1624
|
'`:v?n+=`'+
|
|
@@ -9893,7 +9893,7 @@ Answer from {{email}}:
|
|
|
9893
9893
|
|
|
9894
9894
|
{{target}}`,knowledgeAttachmentsNote:"The answer carries {{count}} attached file(s), attached to this message. Read them before writing the page \u2014 the answer text may only point at them.",knowledgeRecordingsNote:"The answer carries a screen recording, imported locally at: {{paths}}. Review it before writing the page.",knowledgeAttachmentsUnavailable:"These attached files could not be read and are NOT available to you: {{names}}. Do not guess their contents; say so in your summary.",createDescriptionProject:"Describe what you need help with. They'll get your request plus the project context, no conversation needed.",contextChecklistItem:`This is a checklist item from the project's business-analysis checklist: "{{title}}". Help document this step of the business process: what happens, who does it, which systems are involved, and any rules or exceptions worth knowing.`,contextDiagram:`This question is about a business-process diagram. The diagram as it looked when the question was asked (Mermaid source):
|
|
9895
9895
|
|
|
9896
|
-
{{snapshot}}`,checklistItemRequest:'Help me document more details for "{{process}}". I need to capture a part of "{{category}}" \u2014 specifically: "{{item}}".',checklistItemRequestNoCategory:'Help me document more details for "{{process}}" \u2014 specifically: "{{item}}".',attachmentsAnswerText:"Please view my attachments to answer your task.",attachmentsBlockedByPolicy:"File attachments are disabled by your organization's governance policy. The answer was sent without them.",attachRecordingTooLarge:"That recording is too large to send. Record a shorter one, or attach it another way.",attachRecordingNotLive:"This task is no longer open, so the recording can't be sent.",useAsAnswer:"Use as answer",recordingNotUploadedYet:"uploads when you send",completedMessage:"Your answer was sent back to **{{email}}**. This delegated task is complete.",composerAnsweredTooltip:"You already sent your answer, so this task is closed."},appsAndDefaults:{description:"Pick the apps the agent uses to open files, send mail, and handle Office documents.",systemDefault:"System default",mailHandler:"Mail handler",officeApp:"Office suite",fileOpener:"File open handler",customProvider:"Custom...",sameAsMail:"Same as mail",calendarHandler:"Calendar handler",customMailPlaceholder:"Provider name (e.g. Fastmail, ProtonMail)",customCalendarPlaceholder:"Provider name (e.g. Fantastical, Cron)",namedProfilesTitle:"Named browser profiles",namedProfilesDescription:"Up to 3. Surfaced to the agent so it can pick the right one for each task (e.g. Personal vs Work).",namedProfilePlaceholder:"Profile name (e.g. Personal)",namedProfileMissing:"Profile no longer detected",removeNamedProfile:"Remove profile",addNamedProfile:"Add profile ({{count}}/{{max}})",addNamedProfileShort:"Add profile",browserSection:"Browser",appsSection:"Apps",pipPreviewTitle:"PiP preview",pipPreviewDescription:"Move the PiP preview back to its default position and size.",resetPipPreview:"Reset",noBrowserDetectedTitle:"No supported browser detected",noBrowserDetectedBody:"Install the Delegate extension in Chrome or Edge to enable background browsing.",tabDescription:"Tell Delegate which app to open for each kind of work, so it stops asking and just does the right thing."},notifications:{clearAll:"Clear all",empty:"No notifications",justNow:"just now",minutesAgo:"{{count}}m ago",hoursAgo:"{{count}}h ago",daysAgo:"{{count}}d ago"},insights:{title:"Your Delegate insights",titleTag:"Delegate insights, {{date}}",generatedOn:"Generated on {{date}}",statSessions:"Sessions",statActiveDays:"Active days",statTotalCost:"Total cost",statCurrentStreak:"Current streak",statFastestTask:"Fastest task",statZeroErrorTasks:"Zero-error tasks",statToolCategories:"Tool categories",statAchievements:"Achievements",aboutYourUsage:"About your usage",noAgentAnalysis:"No agent analysis available.",activityPatterns:"Activity patterns",activityDescription:"You're most active on {{day}} and tend to use Delegate most around {{hour}}.",dayOfWeek:"Day of week",hourOfDay:"Hour of day",thirtyDayActivity:"30-Day activity",activityFooter:"{{active}} active days \xB7 Peak: {{peak}}",modelsUsed:"Models used",commonTopics:"Common topics",recentConversations:"Recent conversations ({{total}} total)",moreConversations:"...and {{count}} more",achievementsTitle:"Achievements ({{unlocked}} / {{total}})",unlockedDate:"Unlocked {{date}}",footer:"Generated by UiPath Delegate",savedToDownloads:"Insights report saved to Downloads",savedDefault:"Insights report saved",generateError:"Failed to generate insights report",untitled:"Untitled",daySun:"Sun",dayMon:"Mon",dayTue:"Tue",dayWed:"Wed",dayThu:"Thu",dayFri:"Fri",daySat:"Sat",dayNA:"N/A"},wiki:{reviseDisabledTooltip:"Add some content first.",cardAddTitle:"Building your knowledge base",cardAddDescription:"Drop in a few files (PDFs, transcripts, notes), describe what it should cover, or tell Delegate what to research. Delegate will read what you share and add it to your local knowledge base.",cardReviseTitle:"Reviewing your knowledge base",cardReviseDescription:"Delegate will read the knowledge base end to end, surface inconsistencies and gaps, and propose fixes. You decide which ones to apply before anything is written.",createButton:"Create knowledge base",growButton:"Expand knowledge base",tidyButton:"Tidy up knowledge base",tidyKickstart:"Begin the knowledge-base review now. Read the knowledge base end to end and list any internal inconsistencies, missing cross-links, structural gaps, stale references, or entries that are duplicated or significantly overlap and should be consolidated. For each issue, describe the proposed change (for duplicates, name which entry to keep and which to merge into it). Do NOT apply any changes yet, present your findings and proposed fixes to the user, then wait for them to tell you which ones to apply (or to modify, or to skip). Once they approve, apply only what they approved using the existing file tools. After the internal pass, offer an external fact-check pass.",startFailedTitle:"Could not start the session",startFailedDescription:"Something went wrong while starting your knowledge base session. Please try again.",ariaCategories:"{{categoryCount}} categories in graph",clusterStats:"{{count}} entities",clusterHoverHint:"Click to enter this category",modeToggleToCategory:"Switch to category view",modeToggleToNode:"Switch to graph view",legendOther:"Other",iconAlt:"Wiki graph icon",openInFileExplorer:"Open in file explorer",titleFallback:"Knowledge base",collapse:"Collapse wiki panel",expand:"Expand wiki panel",activity:"Recent wiki activity",subtitle:"{{pageCount}} pages, {{edgeCount}} edges, updated {{updatedAt}}",tabGraph:"Graph",tabPages:"Pages",tabLog:"Log",tabDiagrams:"Diagrams",documentTabs:{ariaLabel:"Business analysis document views",diagram:"Diagram",taskDesign:"Task design",processDesign:"Process Design",solutionDesign:"Solution Design",processDesignDisabledTooltip:"Available once the Process Design Document (PDD) is generated. Ask Delegate to generate the PDD.",solutionDesignDisabledTooltip:"Available once the Solution Design Document (SDD) is generated. Ask Delegate to generate the SDD.",checklist:"Checklist"},tabSolutionDesign:"Solution design",viewDiagramCta:"View diagram",diagrams:{empty:"No process maps yet. Capture the current process, or design the future process when this is net new.",section:{"as-is-diagram":"AS-IS","to-be-diagram":"TO-BE","task-diagram":"Task flow"},sectionEmpty:"Not yet documented.",zoomIn:"Zoom in",zoomOut:"Zoom out",fit:"Fit",fullscreen:"Fullscreen",toolbarLabel:"Diagram zoom controls",previous:"Previous diagram",next:"Next diagram",pagerLabel:"Switch between diagrams in this page",notCreatedYet:"This diagram has not been created yet",askToCreate:"Ask the agent to create the <em>{{label}}</em> diagram",createPrompt:"I want to create the {{label}} diagram for the current project.",createPage:"Create page",openPage:"Open file",doesNotExistYet:"This diagram does not exist yet.",diagramSuffix:"{{label}} diagram",chipsGroupLabel:"Diagrams",renderFailed:"This diagram could not be displayed.",modeLabel:{automated:"Automated",agent:"Agent",assisted:"Assisted",review:"Review",manual:"Manual"},caseEndsCase:"Ends case",screenshot:{hint:"Click to view the captured screenshot",dialogTitleFallback:"Captured screenshot",loading:"Loading screenshot\u2026",unavailable:"This screenshot could not be loaded."},caseTaskTypeLabel:{process:"Process",action:"Human action",agent:"AI agent","api-workflow":"API workflow",rpa:"RPA","wait-for-timer":"Timer wait","wait-for-connector":"Connector wait","execute-connector-activity":"Connector action","case-management":"Child case"},richView:{toggleGroupLabel:"Diagram view",toggleRich:"Visual",toggleMermaid:"Source",readOnlyBadge:"Read-only",revise:"Revise diagram",prepare:"Prepare visual view",repair:"Repair visual view",sending:"Sending\u2026",degradedWarning:"Some steps could not be fully interpreted. The visual view may be incomplete.",enlarge:"Enlarge diagram",fullscreenTitle:"Diagram view"},attachments:{local:"Provided",generated:"Generated",add:"Attach evidence file",more:"+{{count}} more",humanReviewed:"Reviewed",machineConfirmed:"Verified",remove:"Remove reference",attachFailed:'Could not attach "{{name}}". The reference was not saved.',openFailed:'Could not open "{{name}}". The file may have been moved or deleted.',removeFailed:'Could not remove "{{name}}". The reference is still saved.',orphanedKeys:"Evidence in attachments.md is keyed to stages not on this diagram ({{count}}):"},caseDetail:{noNote:"No capture note yet.",attachments:"Attachments"},sourceTooLong:"Mermaid source exceeds the {{limit}} character limit."},searchPlaceholder:"Search pages",comingSoon:"Coming soon",comingSoonPages:"The Pages tab will list every wiki page with filters and sorting.",comingSoonLog:"The Log tab will show wiki activity over time.",selectedStatsKind:"{{type}} \xB7 {{words}} words",selectedStatsLinks:"Linked from {{backlinks}} \xB7 Links to {{outlinks}}",openPage:"Open file",hoverHint:"Click to open page",zoomIn:"Zoom in",zoomOut:"Zoom out",zoomFit:"Reset zoom",ariaGraph:"Wiki graph, {{pageCount}} pages and {{edgeCount}} connections",ariaCategoryGraph:"Wiki category overview, {{categoryCount}} categories",ariaCategoryItem:"{{name}} category, {{count}} pages",ariaPanel:"Knowledge base",typeLabelEntity:"Entity",typeLabelConcept:"Concept",typeLabelComparison:"Comparison",typeLabelQuery:"Query",typeLabelRaw:"Raw source",viewToggle:{graph:"Graph",files:"Files view",checklist:"Checklist"},contextMenu:{categoryAskPrompt:"Tell me about the {{name}} category in the current project's knowledge base.",categoryEnhancePrompt:"I'd like to improve the {{name}} category in the current project's knowledge base. Suggest a few specific improvements and ask me which to apply. Do not make any changes yet.",folderAskPrompt:"Tell me about the {{path}} folder in the current project's knowledge base.",folderEnhancePrompt:"I'd like to improve the {{path}} folder in the current project's knowledge base. Suggest a few specific improvements and ask me which to apply. Do not make any changes yet.",folderReplacePrompt:"I want to revise the {{path}} folder in the current project's knowledge base. Ask me what should change and suggest a few options first. Do not make any changes yet.",askAboutProject:"Ask about the project...",blockAskStep:"Ask about this step...",blockAskConditional:"Ask about this decision...",blockAskTerminal:"Ask about this terminator...",blockEnhancePrompt:`I'd like to improve "{{label}}" in the {{diagramLabel}} diagram. Suggest a few specific options and ask me which to apply. Do not make any changes yet.`,blockReplacePrompt:'I want to change "{{label}}" in the {{diagramLabel}} diagram. Ask me what it should become and suggest a couple of options. Do not make any changes yet.',projectAskPrompt:"Give me an overview of the current project from its knowledge base, and point out the key areas I can explore.",projectEnhancePrompt:"Review the current project's knowledge base and suggest a few high-value improvements or gaps. Ask me which to pursue. Do not make any changes yet.",pageEnhancePrompt:"I'd like to improve {{name}} ({{path}}) in the current project's knowledge base. Suggest a few specific improvements and ask me which to apply. Do not make any changes yet.",fileEnhancePrompt:"I'd like to improve {{path}} in the current project's knowledge base. Suggest a few specific improvements and ask me which to apply. Do not make any changes yet.",askAbout:"Ask about this...",replace:"Replace this...",enhance:"Suggest improvements...",diagramAskPrompt:"Tell me about the {{label}} diagram in the current project's knowledge base.",diagramReplacePrompt:"I want to revise the {{label}} diagram. Ask me what should change and suggest a few options first. Do not make any changes yet.",diagramEnhancePrompt:"Review the {{label}} diagram and suggest a few specific improvements to the process it describes. Ask me which to apply. Do not make any changes yet.",blockStepAskPrompt:'Explain what the "{{label}}" step does in the {{diagramLabel}} diagram.',blockConditionalAskPrompt:'Explain what the "{{label}}" decision checks in the {{diagramLabel}} diagram.',blockTerminalAskPrompt:'Explain what the "{{label}}" terminator represents in the {{diagramLabel}} diagram.',pageAskPrompt:"Tell me about {{name}} ({{path}}) from the current project's knowledge base.",pageReplacePrompt:"I want to revise {{name}} ({{path}}) in the current project's knowledge base. Ask me what should change and suggest a few options first. Do not make any changes yet.",fileAskPrompt:"Tell me about {{path}} in the current project's knowledge base.",fileReplacePrompt:"I want to revise {{path}} in the current project's knowledge base. Ask me what should change and suggest a few options first. Do not make any changes yet."},fileTree:{ariaLabel:"Wiki files",empty:"No files in this wiki yet",searchEmpty:"No files match your search",errorTitle:"Could not load files",retry:"Retry",editFile:"Edit {{name}}"}},ba:{untitledProjectName:"Untitled",cta:{documentAsIs:"Document AS-IS",documentToBe:"Define TO-BE",documentToBeDisabled:"Document the AS-IS process first.",generatePdd:"Generate PDD",generatePddDisabled:"Document the TO-BE process first."},kickstart:{documentAsIs:"Use the business-analysis skill to document the current process.",generatePdd:"Use the business-analysis skill to generate the PDD.",documentToBe:"Use the business-analysis skill to define the future process."},card:{documentAsIsTitle:"Documenting the AS-IS process",documentAsIsDescription:"Walk Delegate through the current process end to end: who triggers it, the steps that run, the rules, the exceptions, the volumes, the pain points. Delegate writes it up under wiki/as-is/ with a mermaid flowchart.",documentToBeTitle:"Designing the TO-BE process",documentToBeDescription:"Decide what the redesigned process looks like: BPMN process model, Case design, or RPA automation. Delegate writes it up under wiki/to-be/ with the route-specific process model.",generatePddTitle:"Generating the PDD",generatePddDescription:"Delegate is reading wiki/as-is/ and wiki/to-be/ end to end to produce the Process Definition Document: scope, gap analysis, automation candidates, exceptions, volumetrics, and implementation notes."}},bt:{defaultProjectName:"New business task",captureSessionTitle:"Capturing the task",captureGreeting:"Let's set up a new business task - a single, repeatable job I can learn once and then run for you on demand. To get started, **tell me what this task does** in a line or two \u2014 or skip, and just show me by recording the manual run.",recordIt:"Record it",describeIt:"Describe it",recordItPrompt:"I'll record the run.",describeItPrompt:"I'll describe the task.",captureSessionCreateFailed:"Created the task, but couldn't start the conversation. Try again.",newTaskFromRecordingMessage:"I've already recorded this process \u2014 here's the clip. Let's start from it.",recordingReview:{title:"Recording captured",analyse:"Analyse this recording"}},fileEditor:{title:{files:"Files",wiki:"Edit wiki file",skill:"Edit skill: {{name}}"},refreshFiles:"Refresh files",resizeTree:"Resize file tree",openInFinder:"Open in Finder",openInExplorer:"Open in Explorer",saveAll:"Save all (Cmd+Shift+S)",save:"Save (Cmd+S)",okf:{humanReviewed:"Reviewed",machineConfirmed:"Verified",generated:"By agent",generatedBy:"Generated by {{actor}}",verifiedBy:"Verified by {{actor}}",sources:"Sources",staleAfter:"Stale after {{date}}"},frontmatter:"Metadata",binaryFile:"This file isn't editable as text. Open it in its default application instead.",openExternally:"Open in default app"},notices:{spendingLimitReached:{title:"Monthly limit reached",subtitle:"Start a new task with {{modelNames}} to keep going this month.",resetSubtitle:"Wait for the reset on the 1st of next month."}},exportProject:{partialExportWarning:"Could not fetch {{count}} conversation(s); they were skipped.",bundleSaved:"Project exported.",bundleFailed:"Export failed: {{error}}"},exportMarkdown:{partialExportWarning:"Export saved. Some visibility labels may show as UNKNOWN (backend metadata unavailable)."},sdkSettings:{tabs:{security:"Security",tools:"Tools",knowledge:"Knowledge",mcpServers:"MCP servers",behavior:"Behavior",personalization:"Personalization",skills:"Skills",scrollLeft:"Scroll tabs left",scrollRight:"Scroll tabs right"},tools:{description:"Tools available to the agent. Each row shows whether the tool is enabled or governed by your organization.",fileSystemTools:"File system",utilityTools:"Utility",readFile:"Read file",readFileDesc:"Read files from the host filesystem.",writeFile:"Write file",writeFileDesc:"Create or overwrite files on the host filesystem.",editFile:"Edit file",editFileDesc:"Apply targeted edits to existing files.",deleteFile:"Delete file",deleteFileDesc:"Permanently remove files from the host filesystem.",lsDirectory:"List directory",lsDirectoryDesc:"Enumerate directory contents.",grep:"Grep",grepDesc:"Search for text patterns across files.",glob:"Glob",globDesc:"Find files by name pattern.",todo:"Todo",todoDesc:"Track multi-step tasks within a conversation.",offBadge:"Off",preferencesSection:"Preferences",scriptCardDefaultView:{title:"Show raw script in tool cards",description:"When on, shell tool cards open showing the raw script instead of plain-language comments."},useDeferredTools:{title:"Use deferred tools",description:"Send lightweight stubs for rarely-used tools to reduce token usage."}},knowledge:{indexesSection:{title:"Active knowledge sources",description:"Choose which knowledge sources the agent can search."},indexToggle:{ariaLabel:"Toggle knowledge source {{name}}"}},saveError:{title:"Couldn't save your changes",description:"We couldn't save the following: {{fields}}. Try again.",retryButton:"Retry",dismissButton:"Dismiss",fields:{toolExecutionPolicy:"Approval mode",toolSettings:"Tool preferences",behaviorPreferences:"Behavior preferences",customProfiles:"Custom profiles",customInstruction:"Custom instruction",useFollowUps:"Follow-up suggestions",scriptCardDefaultView:"Tool card view",useDeferredTools:"Deferred tools",contextGroundingIndexes:"Knowledge sources"}},skills:{description:"Skills the agent can draw on. Toggle a skill off to keep it out of the agent\u2019s context for this session.",builtInSkills:"Built-in skills",otherSkills:"Other skills",loading:"Loading skills\u2026",empty:"No skills available.",emptyHint:"Skills become available when your host environment provides them.",newSkill:"+ New skill",editSkill:"Edit skill",deleteSkillAria:"Delete skill",deleteConfirm:"Delete this skill?",deleting:"Deleting\u2026",editor:{nameLabel:"Name",contentLabel:"Content",nameTooLong:"Name must be 64 characters or fewer.",nameTaken:"A skill with this name already exists.",namePathSeparator:"Name cannot contain slashes or control characters.",nameTraversal:'Name cannot be "." or "..".',nameReserved:"This name is reserved by the skill scanner \u2014 pick a different one.",saveFailed:"Could not save skill. {{detail}}",deleteFailed:"Could not delete skill. {{detail}}",readFailed:"Could not load skill. {{detail}}",fsUnavailable:"Filesystem service is not available.",newSubtitle:"Describe what the skill does and when the agent should use it.",editSubtitle:"Update the description, content, or examples used by the agent.",viewSubtitle:"Read-only view of a built-in skill.",renameWarning:"Saving will move this skill to a new file. Open chats that refer to the previous name may not find it until the session refreshes.",nameKebabHint:"Suggested: lowercase letters, digits, and dashes.",saving:"Saving\u2026"},viewSkill:"View skill contents",viewSkillTitle:"View skill",localSkills:"Local skills",localSkillsEmpty:'Create your first skill with "+ New skill".',downloadSkill:"Download skill",downloadSkillNamed:"Download {{name}}",importSkill:"Import",importOverwriteTitle:"Replace existing skill?",importOverwriteBody:'A skill named "{{name}}" already exists. Replace it with the imported one?',importReplace:"Replace",importFailed:"Could not import skill. {{detail}}",exportFailed:"Could not export skill. {{detail}}",deleteConfirmBody:'Permanently removes "{{name}}" from your skills. This cannot be undone.'}},skillDup:{dialog:{title:"Skill already exists",bodyExisting:"Existing:",bodyIncoming:"Incoming:",versionAnnotation:{newer:"Existing: v{{existingVersion}} \xB7 Incoming: v{{incomingVersion}} (newer)",older:"Existing: v{{existingVersion}} \xB7 Incoming: v{{incomingVersion}} (older)",same:"Both are version v{{version}}"},bodyExistingMany:'{{count}} existing skills are named "{{name}}":',replaceAllNotice:"Replacing will remove all {{count}} existing copies and install the new one in their place.",actions:{cancel:"Cancel",replace:"Replace existing",replaceAll:"Replace all ({{count}})",keepBoth:"Keep both"},pluginBundledCaption:"Replace isn't available because one of the existing copies is bundled with a plugin. Use Keep both to install your copy alongside it.",srDescription:"Choose how to handle the duplicate skill name",existingFolder:"In folder: {{folder}}"},pluginAutoDisable:{toast_one:"Plugin {{name}} installed. 1 skill was disabled because it conflicts with an existing copy. Review it in Add-ons & Integrations \u2192 Skills.",toast_other:"Plugin {{name}} installed. {{count}} skills were disabled because they conflict with existing copies. Review them in Add-ons & Integrations \u2192 Skills."},badge:{tooltipHeader:"Duplicate skill ({{count}} copies installed)",memberLine:"{{source}} \xB7 v{{version}} \xB7 {{folder}}",memberLineNoVersion:"{{source}} \xB7 {{folder}}",actionHint:"To remove a copy, use the row's actions on each one.",ariaLabel:"Duplicate skill warning"}},routineDup:{badge:{tooltipHeader:"Duplicate routine ({{count}} copies installed)",actionHint:"To remove a copy, use the row's actions on each one.",ariaLabel:"Duplicate routine warning"}},recordingReference:{sectionTitle:"Recordings",empty:"No recordings yet",emptyHint:"Record your screen to reference it here",noMatches:'No matches for "{{query}}"',alreadyAdded:"Already added",placeholderHint:"Type / for routines, @ to mention, # for a recording"},fileReference:{empty:"No files in this project",noMatches:'No files match "{{query}}"'},livingDocument:{tdd:{regionLabel:"Task design document",navRegion:"Document sections",hideNav:"Hide section navigation",showNav:"Show section navigation"},table:{caption:"Table"},callout:{note:"Note",info:"Info",warning:"Warning",tip:"Tip"},image:{alt:"Image",unavailable:"Image not available",caption:"Figure"},cover:{region:"Document cover",client:"Client",author:"Author",date:"Date"},toc:{region:"Table of contents",title:"Contents",placeholder:"Table of contents (up to level {{maxLevel}})"},diagram:{loading:"Loading diagram...",unavailable:"Diagram not available",emptyAlt:"Empty diagram",bpmnAlt:"BPMN process model",bpmnLoading:"Loading BPMN diagram...",bpmnUnavailable:"BPMN diagram is unavailable.",caption:"Figure"},action:{updateSection:"Update section",activate:"Activate action: {{label}}",markReviewed:"Mark as reviewed",reviewed:"Reviewed",download:"Download",editDetails:"Edit details",refineSection:"Refine section",downloading:"Preparing download\u2026",unavailable:"This action isn't available here. Use the controls in the document panel."},navigation:{needsReview:"{{section}}, needs review"},section:{needsReview:"{{section}} needs review.",sourceChanged:"Source content changed after this draft was generated. Review this entire section.",unnamed:"Unnamed section",renderError:"Section could not be rendered."},view:{regionLabel:"Process design document",bodyRegionLabel:"Document body"},find:{open:"Find in document",placeholder:"Find in document",count:"{{current}} of {{total}}",noResults:"No results",previous:"Previous match",next:"Next match",close:"Close find"},tab:{label:"Process design (PDD)"},status:{draft:"Draft",completed:"Completed",generating:"Generating draft",discovering:"Loading draft"},summary:{sectionsNeedReview:"{{count}} sections need review",sectionsNeedReview_one:"{{count}} section needs review",reviewAffected:"Review or update these sections:",openItems_one:"{{count}} open item remains",openItems_other:"{{count}} open items remain"},hint:{deliverableOutOfDate:"Deliverable out of date"},empty:{noDraft:"No draft yet"},metadata:{title:"Edit document details",client:"Client",author:"Author",date:"Date",version:"Version",editField:"Edit {{field}}",addField:"Add {{field}}",saveFailed:"Save failed. Please try again.",save:"Save",cancel:"Cancel"},badge:{outOfDate:"Out of date"},error:{downloadRequiresReview:"Mark the document as reviewed to download it.",downloadFailed:"Couldn't create the document: {{error}}"},warning:{diagramsOmitted_one:"The document was saved, but {{count}} diagram could not be rendered and was omitted.",diagramsOmitted_other:"The document was saved, but {{count}} diagrams could not be rendered and were omitted.",imagesOmitted_one:"The document was saved, but {{count}} image could not be read and was omitted.",imagesOmitted_other:"The document was saved, but {{count}} images could not be read and were omitted."},gapGate:{title:"Mark as reviewed?",description:"These sections have no captured content and will be omitted from the downloaded document:",confirm_one:"Mark reviewed & omit {{count}} section",confirm_other:"Mark reviewed & omit {{count}} sections",markReviewedFailed:"Could not mark as reviewed. The draft was kept. Please try again.",resyncReviewNeeded:"This document was updated with the latest information, and some sections now need review. Mark as reviewed again to confirm."},openItem:{label:"Open item",ariaLabel:"Open item: {{reason}}"}},panelResizeHandle:{ariaLabel:"Resize document panel"},richDiagram:{reason:{missingFamily:"The diagram type is not set. Add a diagram family to enable rich view.",unsupportedFamily:"The declared diagram type is not supported for rich view.",frontmatterParseError:"The diagram frontmatter could not be parsed. Check the page header.",invalidSyntax:"The diagram contains syntax errors that prevent rich rendering.",unsupportedDiagramType:"This diagram type is not supported for rich view.",adapterFailure:"The diagram could not be processed for rich view.",unresolvedEndpoint:"Some diagram connections could not be resolved.",sparseGraph:"The diagram does not have enough elements for rich view.",missingSemantics:"The diagram nodes are missing semantic class annotations.",degradedSemanticCoverage:"Some steps could not be fully classified. The rich view may be incomplete.",unknownClasses:"Some diagram nodes have unrecognized class annotations.",conflictingSemantics:"Some diagram nodes have conflicting class annotations.",sourceTooLarge:"The diagram is too large for rich view."}},subAgents:{title:"Agents",count_one:"{{count}} agent",count_other:"{{count}} agents",running:"{{count}} running",failed:"{{count}} failed",stopped:"{{count}} stopped",stop:"Stop",stopAll:"Stop all",stopping:"Stopping\u2026",needAttention_one:"{{count}} needs your attention",needAttention_other:"{{count}} need your attention",tooltip:"Agents",statusDone:"Done",statusFailed:"Failed",statusStopped:"Stopped",statusNeedsAttention:"Needs your attention",waitingForApproval:"Waiting for your approval",backToParent:"Back to {{title}}",backToParentGeneric:"Back to parent session"},deepLinkConfirm:{title:"Run from link?",warning:"This was opened from an external link. Review it before running.",run:"Run",cancel:"Cancel"},importConversations:{alreadyImported:"Already imported",close:"Close",done:"Done",empty:"No conversations found from Claude Code, Claude Cowork, or Codex",failedItems:"Failed items:",importButton:"Import selected",importing:"Importing...",partialScanWarning:"Some sources could not be scanned, so results may be incomplete",privacyNote:"Imported conversations are stored only on this device.",progress:"Importing {{done}} of {{total}}: {{title}}",resultSummary_one:"{{imported}} imported, {{skipped}} skipped, {{failed}} failed.",resultSummary_other:"{{imported}} imported, {{skipped}} skipped, {{failed}} failed.",scanError:"Scan failed",scanning:"Scanning for conversations...",selectAll:"Select all",title:"Import conversations"},dataTable:{noResultsTitle:"No results found",tryDifferentSearch:"Try a different search term.",emptyDefault:"No data available.",emptyFilterDefault:"No results match your search.",expandRow:"Expand row"},spendingLimit:{srTitle:"Spending limit warning",srDescription:"Usage limit warning with option to request a reset",title:"Spending limit reached",bodyWithUsage:"You've used {{percent}}% of your monthly limit. To request a usage reset, reach out on Slack.",body:"To request a usage reset, reach out on Slack.",openChannel:"Open {{channel}}",skip:"Skip for now"},sessionShare:{copyFailed:"Session shared, but the link could not be copied to the clipboard",copied:"Shared link was copied to clipboard",failed:"Share failed: {{message}}",failedFallback:"Failed to share session"},cartographer:{fre:{defaultProjectName:"New business process",discoveringTitle:"Discovering the process",mappingAsIsTitle:"Mapping the as-is",greeting:"Let's start with **one process you know well**. Tell me what it is and how it runs today \u2014 in your own words, however messy. I'll ask about the steps, the decisions and the systems as we go.",pickOneCaption:"Pick one to start from, or describe your own below.",sessionCreateFailed:"Created the project, but couldn't start the conversation. Try again.",splash:{title:"Your organization, mapped.",subtitle:"Start with one business process you know well. Talk it through with the agent, and what you say becomes something your team can follow.",value1Title:"Say how it works",value1Desc:"In your own words, messy parts included.",value2Title:"See it read back",value2Desc:"Steps, decisions and systems, as you talk.",value3Title:"Keep the write-up",value3Desc:"A process your team can follow and find.",chooseIndustry:"Choose your industry",industryQuestion:"Which industry do you work in?",industryHint:"It picks the examples the agent opens with, and narrows the map to the work your kind of company does. Change it any time.",other:"Other",customIndustryPlaceholder:"Type your industry",startMapping:"Start mapping",previousPage:"Previous page",nextPage:"Next page",starting:"Setting up your project\u2026"},industry:{healthcare:"Healthcare",banking:"Banking",insurance:"Insurance",manufacturing:"Manufacturing",telecom:"Telecom",utilities:"Utilities",retail:"Retail","finance-accounting":"Finance & Accounting","cross-industry":"Cross-industry"},suggestions:{healthcare:{"1":"Patient intake & registration","2":"Insurance claim submissions","3":"Prior authorization requests","4":"Discharge summaries & follow-ups"},banking:{"1":"Loan application processing","2":"KYC onboarding checks","3":"Dispute & chargeback handling","4":"Account closure requests"},insurance:{"1":"Claims intake & triage","2":"Policy renewals","3":"Underwriting file preparation","4":"Policy endorsement changes"},manufacturing:{"1":"Purchase order processing","2":"Quality inspection reports","3":"Production change requests","4":"Supplier onboarding"},telecom:{"1":"Service activation orders","2":"Billing dispute resolution","3":"Network incident tickets","4":"Customer plan changes"},utilities:{"1":"New service connections","2":"Meter reading validation","3":"Outage report handling","4":"Billing exception reviews"},retail:{"1":"Customer refunds & returns","2":"Inventory replenishment","3":"Price change approvals","4":"Supplier invoice matching"},"finance-accounting":{"1":"Invoice approvals","2":"Month-end close checks","3":"Expense report reviews","4":"Vendor payment queries"},"cross-industry":{"1":"Employee onboarding","2":"Purchase approvals","3":"Customer complaint handling","4":"Contract reviews"}},roleQuestion:"Quick one before we start \u2014 what's your role?",roleSkip:"Skip for now",processQuestion:"Great \u2014 now, which process should we map first?",combinedAnswer:"I work in {{role}}. The process I want to map is {{process}}."}},delegate:{fre:{splash:{title:"Work, delegated.",subtitle:"Hand over the small, repeating work that eats your day. Describe it once, watch it run, and keep whatever you'd rather not do again.",value1Title:"Say what you need",value1Desc:"Describe the task the way you'd ask a colleague.",value2Title:"It does the work",value2Desc:"In the apps you already use, step by step.",value3Title:"You check it off",value3Desc:"Look it over, then let it run on its own.",cta:"Hand off my first task",starting:"Getting things ready\u2026"},tour:{step1Title:"Hand off from here",step1Body:`Say what you need in a sentence. Type "/" for something you've set up already, "@" for one of your apps.`,step2Title:"Keep related work together",step2Body:"Point the conversation at a project and everything you hand off stays in one place.",step3Title:"Pick up where you left off",step3Body:"Everything you've handed off is waiting in the side panel, still running or ready to review.",counter:"{{current}} of {{total}}",skip:"Skip",next:"Next",done:"Got it"}}}}});function Ck5(e){if(e==="auto"){let t=navigator.language;if(mk5.some(a=>a.code===t))return t;let r=t.split("-")[0];return mk5.some(a=>a.code===r)?r:"en"}return e}function bQ1(){return A91.default.resolvedLanguage??A91.default.language}function Mk5(e){e&&(typeof document>"u"||(document.documentElement.lang=e))}var A91,nZ4,mk5,k9,CW=C1(()=>{A91=w4(Si0(),1),nZ4=w4(jh1(),1);fk5();mk5=[{code:"auto",name:"Auto detect"},{code:"en",name:"English"},{code:"de",name:"Deutsch (Germany)"},{code:"es",name:"Espa\xF1ol (Spain)"},{code:"es-MX",name:"Espa\xF1ol (Mexico)"},{code:"fr",name:"Fran\xE7ais (France)"},{code:"ja",name:"\u65E5\u672C\u8A9E (Japan)"},{code:"ko",name:"\uD55C\uAD6D\uC5B4 (Korea)"},{code:"pt",name:"Portugu\xEAs (Portugal)"},{code:"pt-BR",name:"Portugu\xEAs (Brazil)"},{code:"ro",name:"Rom\xE2n\u0103 (Romania)"},{code:"tr",name:"T\xFCrk\xE7e (Turkey)"},{code:"zh-CN",name:"\u7B80\u4F53\u4E2D\u6587 (China)"},{code:"zh-TW",name:"\u7E41\u9AD4\u4E2D\u6587 (Taiwan)"}];nZ4.initReactI18next&&A91.default.use(nZ4.initReactI18next);A91.default.init({resources:{en:{translation:vk5}},lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1},react:{useSuspense:!1}});typeof A91.default.on=="function"&&A91.default.on("languageChanged",Mk5);Mk5(A91.default.resolvedLanguage??A91.default.language);k9=A91.default});function $i0(e){return SQ1.has(e)}var Wi0,SQ1,oZ4,xk5,Rx7,qi0,gRi,HQ1=C1(()=>{Wi0=[{snapshotKey:"pathBlocklist",policyKey:"restrictedPaths"},{snapshotKey:"blockedSites",policyKey:"blockedUiaSites"},{snapshotKey:"blockedApplications",policyKey:"blockedApps"},{snapshotKey:"preApprovedSites",policyKey:"trustedSites"},{snapshotKey:"preApprovedApplications",policyKey:"preApprovedApps"}],SQ1=new Set(["theme","accentColor","foregroundColor","backgroundColor","uiFont","codeFont","language","soundEffectsEnabled","flashOnApprovalNeeded","showE2ERecordingButton","privacy","agentName","sessionId","selectedTenant","tenantByOrg","keyboardShortcuts","assistantHotkeys","mergedShortcutDefaultsSeeded","hasSeenPermissionsSetup","permissionsSetupAppVersion","hasCompletedSetup","hasSeenOnboarding","hasSeenConversationalOnboarding","hasSeenCartographerFre","userIndustry","userIndustryCustomText","hasSeenDelegateFreSplash","hasSeenDelegateHomeTour","permissionsTabSeen","browserExtensionsTabSeen","position","autoDownloadUpdates","authTcpPort","pipModePreference","enableAutoMinimize","maximizeTargetApp","defaultScreenContextMode","firstUserTurnSendsFullScreen","sendAttachableWindowTitles","backgroundSubMode","backgroundModeProfile","browserExtensionAvailable","screenshotShortcutCaptureMode","defaultFileOpener","defaultMailHandler","defaultMailProviderCustomName","defaultCalendarHandler","defaultCalendarProviderCustomName","defaultOfficeApp","namedBrowserProfiles","conversationStorageMode","uipCliAuthMode","marketplaceFeeds","feedEtags","pluginUserConfig","pluginEnabledState","skillsConfig","localMcpServers","useDeterministicRoutineTitles","pinnedConversationIds","contextGroundingIndexes","singleClickPerTurn","rcChannelEnabled","lastKnownAppVersion","zoomLevel","lastConnectFolderByTenant","remoteWorkerEnabled","installationId","projectAccessPolicy"]),oZ4=new Set(["version","limitScreenshotsToAttachedApps","screenContextEnabled"]),xk5=new Set(["toolSettings","toolExecutionPolicy"]),Rx7=["selectedModel","cartographerModel","effort","effortHasUserOverride","executionMode","useEagerPlanning","showAdvancedSettings","useDeferredTools","behaviorPreferences","customProfiles","favoriteRoutineIds","favouriteSkills","alwaysCollapseToolCards","scriptCardDefaultView","connectionFilterMode","toolSettings","toolExecutionPolicy"],qi0=new Set(Rx7),gRi=new Set(["mcpServers",...oZ4])});var oY,z91,Ki0=C1(()=>{oY="Delegate.Extension.",z91="Delegate.Plugin."});function Lk5(e){return`${oY}${Ci0(e)}`}function kQ1(e){return`${z91}${Ci0(e)}`}function lZ4(e){let t=e.startsWith(oY)?e.slice(oY.length):e;return eM2(t)}function cZ4(e){let t=e.startsWith(z91)?e.slice(z91.length):e;return eM2(t)}function P_1(e){if(!e)return{role:null,type:null,topicTags:[]};let t=e.includes("|")?"|":" ",r=e.split(t).map(o=>o.trim().toLowerCase()).filter(o=>o.length>0),a=null,i=null,n=[];for(let o of r)o.startsWith("role:")?a=o.slice(5):o.startsWith("type:")?i=o.slice(5):o!=="delegate"&&o!=="skill"&&n.push(o);return{role:a,type:i,topicTags:n}}function wk5(e){return(e.startsWith(oY)?e.slice(oY.length):e).replace(/([a-z])([A-Z])/g,"$1 $2").trim()}function sZ4(e){let t=[oY,z91].find(r=>e.startsWith(r));return eM2(t?e.slice(t.length):e)}function yk5(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function t61(e){return e&&e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&#(\d+);/g,(t,r)=>String.fromCodePoint(Number(r))).replace(/&#x([0-9a-fA-F]+);/g,(t,r)=>String.fromCodePoint(parseInt(r,16))).replace(/&/g,"&")}function Ak5(e){return`broker/${encodeURIComponent(e)}`}var hM2=C1(()=>{Ki0();Mi0();Mi0()});function Yi0(e){let{skills:t,enabledSkills:r,lastEnabledByName:a}=e,i=new Map;for(let h of t){if(!h.frontmatterName)continue;let u=pL1(h.frontmatterName);if(u==="")continue;let g=i.get(u);g?g.push(h):i.set(u,[h])}let n=null,o=[];for(let[h,u]of i){let g=u.filter(L=>r[L.location]!==!1);if(g.length<=1)continue;let f=Zx7(h,g,a),v=g.filter(L=>L.location!==f.location).map(L=>L.location);n===null&&(n={...r});for(let L of v)n[L]=!1;let C=[...new Set(g.map(L=>L.source))].sort((L,y)=>L.localeCompare(y));o.push({name:h,keptLocation:f.location,disabledLocations:v,reason:f.reason,sources:C})}return{enabledSkills:n??r,corrections:o}}function Zx7(e,t,r){let a=r[e];if(a){let C=t.find(L=>L.location===a.winnerLocation);if(C)return{location:C.location,reason:"user-toggle"}}let i=t.filter(C=>C.tracked===!0),n=i.length>0?i:t;if(n.length===1)return{location:n[0].location,reason:"tracked"};let o=n.filter(C=>C.version!==void 0&&C.version!==null),h=n;if(o.length>0){let C=o.reduce((y,z)=>J51(z.version,y)>0?z.version:y,o[0].version),L=o.filter(y=>J51(y.version,C)===0);if(L.length<n.length){if(L.length===1)return{location:L[0].location,reason:"version"};h=L}}let u=h.filter(C=>typeof C.mtime=="number"),g=h;if(u.length>0){let C=Math.max(...u.map(y=>y.mtime)),L=u.filter(y=>y.mtime===C);if(L.length<h.length){if(L.length===1)return{location:L[0].location,reason:"mtime"};g=L}}return{location:[...g].sort((C,L)=>C.location<L.location?-1:C.location>L.location?1:0)[0].location,reason:"path"}}var hZ4=C1(()=>{xi0();hM2()});function Fx7(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}var zk5,bk5=C1(()=>{hZ4();zk5=e=>(t,r,a)=>e(((n,o)=>{t(n,o);let h=r();if(!Array.isArray(h?.skills))return;let u=h?.skillsConfig;if(!u||typeof u.enabledSkills!="object"||u.enabledSkills===null)return;let g=u.enabledSkills,f=u.lastEnabledByName??{},v=Yi0({skills:h.skills,enabledSkills:g,lastEnabledByName:f});if(!Object.is(v.enabledSkills,g)){t({skillsConfig:{...h.skillsConfig,enabledSkills:v.enabledSkills}},!1);for(let C of v.corrections){let L=C.disabledLocations.length+1,y=C.sources.join(","),z=Fx7(C.keptLocation),S=`[SkillDupGuard] invariant: group=${C.name} size=${L} sources=${y} kept=${z} reason=${C.reason}`;window.debugApi?.log?.(S)}}}),r,a)});function Sk5(e,t){let r={};for(let[i,n]of Object.entries(e))r[pL1(i)]=n;let a={};for(let i of t){let n=pL1(i.name);if(n&&n in r){a[i.location]=r[n];continue}if(i.frontmatterName){let o=pL1(i.frontmatterName);o&&o in r&&(a[i.location]=r[o])}}return a}var Hk5=C1(()=>{xi0()});function lY(){return b91.getState().status==="online"}var Tk5,kk5,b91,__1=C1(()=>{Tk5=w4(Lu(),1),kk5={status:"online",reason:null,lastCheckedAt:null,lastOnlineAt:null,offlineSince:null,lastErrorSource:null},b91=(0,Tk5.create)()((e,t)=>({...kk5,setChecking:()=>e({status:"checking",lastCheckedAt:Date.now()}),markOnline:r=>e({status:"online",reason:null,offlineSince:null,lastErrorSource:r??null,lastOnlineAt:Date.now(),lastCheckedAt:Date.now()}),markReconnectAvailable:r=>e({status:"reconnectAvailable",reason:null,lastErrorSource:r??null,lastOnlineAt:Date.now(),lastCheckedAt:Date.now()}),markOffline:(r,a)=>{let{offlineSince:i}=t();e({status:"offline",reason:r,lastErrorSource:a??null,offlineSince:i??Date.now(),lastCheckedAt:Date.now()})},reset:()=>e({...kk5})}))});function Ox7(e){return typeof navigator<"u"&&navigator.onLine===!1?"browser-offline":Pk5(e)!==null||Ux7(e)?null:Gx7(e)?"timeout":jx7(e)?"network":null}function Dx7(e){let t=Pk5(e);return t!==null&&t>=500}function Ix7(e){let t=e?.config;return t?`${t.baseURL??""}${t.url??""}`.includes("/v1/chat"):!1}function Nx7(e){let t=e?.config;if(!t)return!1;let r=`${t.baseURL??""}${t.url??""}`;if(!r||typeof window>"u")return!1;try{return new URL(r,window.location.href).origin!==window.location.origin}catch{return!1}}function mL1(e,t){if(!ic("offlineMode")||t==="ariaHttpClient"&&!Ix7(e))return;let r=Ox7(e);if(r){if(r!=="browser-offline"&&Nx7(e)&&dZ4){dZ4(`${t}-cross-origin`);return}b91.getState().markOffline(r,t);return}Dx7(e)&&dZ4?.(`${t}-5xx`)}function Bk5(e,t="preflight"){if(!ic("offlineMode"))return!1;let r=typeof navigator<"u"&&navigator.onLine===!1?"browser-offline":e.cause==="timeout"?"timeout":e.cause==="server"?"server-unavailable":"network";return b91.getState().markOffline(r,t),!0}function IO(e){return lY()?!0:(console.debug(`[backendAvailability] blocked "${e}" while offline`),!1)}function Vk5(e){if(!lY())throw new uZ4(e)}function Pk5(e){if(e&&typeof e=="object"){let t=e.response;if(t&&typeof t.status=="number")return t.status;let r=e.status;if(typeof r=="number")return r}return null}function Ux7(e){if(!e||typeof e!="object")return!1;let t=e.name;return t==="AbortError"||t==="CanceledError"?!0:e.code==="ERR_CANCELED"}function Gx7(e){if(!e||typeof e!="object")return!1;let t=e.code;if(t==="ECONNABORTED"||t==="ETIMEDOUT")return!0;let r=(e.message??"").toLowerCase();return r.includes("timeout")||r.includes("timed out")||r.includes("aborted")}function jx7(e){if(!e||typeof e!="object")return!1;let t=e.code;if(t==="ERR_NETWORK"||t==="ECONNREFUSED"||t==="ENOTFOUND")return!0;let r=(e.name??"").toLowerCase(),a=(e.message??"").toLowerCase();return a.includes("failed to fetch")||a.includes("network error")||a.includes("networkerror")||a.includes("err_network")||a.includes("net::err_")||a.includes("connection_timed_out")||a.includes("err_connection_refused")||a.includes("err_name_not_resolved")||r==="typeerror"&&a.includes("fetch")}var dZ4,uZ4,E_1=C1(()=>{OO();__1();__1();dZ4=null,uZ4=class extends Error{constructor(t){super(`Backend is offline; "${t}" is unavailable.`),this.name="OfflineMutationBlockedError",this.operation=t}}});var dM2=M1((Xi0,_k5)=>{(function(e,t){typeof Xi0=="object"?_k5.exports=Xi0=t():typeof define=="function"&&define.amd?define([],t):e.CryptoJS=t()})(Xi0,function(){var e=e||(function(t,r){var a;if(typeof window<"u"&&window.crypto&&(a=window.crypto),typeof self<"u"&&self.crypto&&(a=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(a=globalThis.crypto),!a&&typeof window<"u"&&window.msCrypto&&(a=window.msCrypto),!a&&typeof global<"u"&&global.crypto&&(a=global.crypto),!a&&typeof Z4=="function")try{a=Z4("crypto")}catch{}var i=function(){if(a){if(typeof a.getRandomValues=="function")try{return a.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof a.randomBytes=="function")try{return a.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},n=Object.create||(function(){function B(){}return function(R){var F;return B.prototype=R,F=new B,B.prototype=null,F}})(),o={},h=o.lib={},u=h.Base=(function(){return{extend:function(B){var R=n(this);return B&&R.mixIn(B),(!R.hasOwnProperty("init")||this.init===R.init)&&(R.init=function(){R.$super.init.apply(this,arguments)}),R.init.prototype=R,R.$super=this,R},create:function(){var B=this.extend();return B.init.apply(B,arguments),B},init:function(){},mixIn:function(B){for(var R in B)B.hasOwnProperty(R)&&(this[R]=B[R]);B.hasOwnProperty("toString")&&(this.toString=B.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),g=h.WordArray=u.extend({init:function(B,R){B=this.words=B||[],R!=r?this.sigBytes=R:this.sigBytes=B.length*4},toString:function(B){return(B||v).stringify(this)},concat:function(B){var R=this.words,F=B.words,N=this.sigBytes,j=B.sigBytes;if(this.clamp(),N%4)for(var Y=0;Y<j;Y++){var t1=F[Y>>>2]>>>24-Y%4*8&255;R[N+Y>>>2]|=t1<<24-(N+Y)%4*8}else for(var n1=0;n1<j;n1+=4)R[N+n1>>>2]=F[n1>>>2];return this.sigBytes+=j,this},clamp:function(){var B=this.words,R=this.sigBytes;B[R>>>2]&=4294967295<<32-R%4*8,B.length=t.ceil(R/4)},clone:function(){var B=u.clone.call(this);return B.words=this.words.slice(0),B},random:function(B){for(var R=[],F=0;F<B;F+=4)R.push(i());return new g.init(R,B)}}),f=o.enc={},v=f.Hex={stringify:function(B){for(var R=B.words,F=B.sigBytes,N=[],j=0;j<F;j++){var Y=R[j>>>2]>>>24-j%4*8&255;N.push((Y>>>4).toString(16)),N.push((Y&15).toString(16))}return N.join("")},parse:function(B){for(var R=B.length,F=[],N=0;N<R;N+=2)F[N>>>3]|=parseInt(B.substr(N,2),16)<<24-N%8*4;return new g.init(F,R/2)}},C=f.Latin1={stringify:function(B){for(var R=B.words,F=B.sigBytes,N=[],j=0;j<F;j++){var Y=R[j>>>2]>>>24-j%4*8&255;N.push(String.fromCharCode(Y))}return N.join("")},parse:function(B){for(var R=B.length,F=[],N=0;N<R;N++)F[N>>>2]|=(B.charCodeAt(N)&255)<<24-N%4*8;return new g.init(F,R)}},L=f.Utf8={stringify:function(B){try{return decodeURIComponent(escape(C.stringify(B)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(B){return C.parse(unescape(encodeURIComponent(B)))}},y=h.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(B){typeof B=="string"&&(B=L.parse(B)),this._data.concat(B),this._nDataBytes+=B.sigBytes},_process:function(B){var R,F=this._data,N=F.words,j=F.sigBytes,Y=this.blockSize,t1=Y*4,n1=j/t1;B?n1=t.ceil(n1):n1=t.max((n1|0)-this._minBufferSize,0);var a1=n1*Y,s1=t.min(a1*4,j);if(a1){for(var p1=0;p1<a1;p1+=Y)this._doProcessBlock(N,p1);R=N.splice(0,a1),F.sigBytes-=s1}return new g.init(R,s1)},clone:function(){var B=u.clone.call(this);return B._data=this._data.clone(),B},_minBufferSize:0}),z=h.Hasher=y.extend({cfg:u.extend(),init:function(B){this.cfg=this.cfg.extend(B),this.reset()},reset:function(){y.reset.call(this),this._doReset()},update:function(B){return this._append(B),this._process(),this},finalize:function(B){B&&this._append(B);var R=this._doFinalize();return R},blockSize:512/32,_createHelper:function(B){return function(R,F){return new B.init(F).finalize(R)}},_createHmacHelper:function(B){return function(R,F){return new S.HMAC.init(B,F).finalize(R)}}}),S=o.algo={};return o})(Math);return e})});var Rk5=M1((Ji0,Ek5)=>{(function(e,t){typeof Ji0=="object"?Ek5.exports=Ji0=t(dM2()):typeof define=="function"&&define.amd?define(["./core"],t):t(e.CryptoJS)})(Ji0,function(e){return(function(t){var r=e,a=r.lib,i=a.WordArray,n=a.Hasher,o=r.algo,h=[],u=[];(function(){function v(z){for(var S=t.sqrt(z),B=2;B<=S;B++)if(!(z%B))return!1;return!0}function C(z){return(z-(z|0))*4294967296|0}for(var L=2,y=0;y<64;)v(L)&&(y<8&&(h[y]=C(t.pow(L,1/2))),u[y]=C(t.pow(L,1/3)),y++),L++})();var g=[],f=o.SHA256=n.extend({_doReset:function(){this._hash=new i.init(h.slice(0))},_doProcessBlock:function(v,C){for(var L=this._hash.words,y=L[0],z=L[1],S=L[2],B=L[3],R=L[4],F=L[5],N=L[6],j=L[7],Y=0;Y<64;Y++){if(Y<16)g[Y]=v[C+Y]|0;else{var t1=g[Y-15],n1=(t1<<25|t1>>>7)^(t1<<14|t1>>>18)^t1>>>3,a1=g[Y-2],s1=(a1<<15|a1>>>17)^(a1<<13|a1>>>19)^a1>>>10;g[Y]=n1+g[Y-7]+s1+g[Y-16]}var p1=R&F^~R&N,u1=y&z^y&S^z&S,v1=(y<<30|y>>>2)^(y<<19|y>>>13)^(y<<10|y>>>22),h1=(R<<26|R>>>6)^(R<<21|R>>>11)^(R<<7|R>>>25),H1=j+h1+p1+u[Y]+g[Y],z1=v1+u1;j=N,N=F,F=R,R=B+H1|0,B=S,S=z,z=y,y=H1+z1|0}L[0]=L[0]+y|0,L[1]=L[1]+z|0,L[2]=L[2]+S|0,L[3]=L[3]+B|0,L[4]=L[4]+R|0,L[5]=L[5]+F|0,L[6]=L[6]+N|0,L[7]=L[7]+j|0},_doFinalize:function(){var v=this._data,C=v.words,L=this._nDataBytes*8,y=v.sigBytes*8;return C[y>>>5]|=128<<24-y%32,C[(y+64>>>9<<4)+14]=t.floor(L/4294967296),C[(y+64>>>9<<4)+15]=L,v.sigBytes=C.length*4,this._process(),this._hash},clone:function(){var v=n.clone.call(this);return v._hash=this._hash.clone(),v}});r.SHA256=n._createHelper(f),r.HmacSHA256=n._createHmacHelper(f)})(Math),e.SHA256})});var Fk5=M1((Qi0,Zk5)=>{(function(e,t){typeof Qi0=="object"?Zk5.exports=Qi0=t(dM2()):typeof define=="function"&&define.amd?define(["./core"],t):t(e.CryptoJS)})(Qi0,function(e){return(function(){var t=e,r=t.lib,a=r.WordArray,i=t.enc,n=i.Base64={stringify:function(h){var u=h.words,g=h.sigBytes,f=this._map;h.clamp();for(var v=[],C=0;C<g;C+=3)for(var L=u[C>>>2]>>>24-C%4*8&255,y=u[C+1>>>2]>>>24-(C+1)%4*8&255,z=u[C+2>>>2]>>>24-(C+2)%4*8&255,S=L<<16|y<<8|z,B=0;B<4&&C+B*.75<g;B++)v.push(f.charAt(S>>>6*(3-B)&63));var R=f.charAt(64);if(R)for(;v.length%4;)v.push(R);return v.join("")},parse:function(h){var u=h.length,g=this._map,f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var v=0;v<g.length;v++)f[g.charCodeAt(v)]=v}var C=g.charAt(64);if(C){var L=h.indexOf(C);L!==-1&&(u=L)}return o(h,u,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function o(h,u,g){for(var f=[],v=0,C=0;C<u;C++)if(C%4){var L=g[h.charCodeAt(C-1)]<<C%4*2,y=g[h.charCodeAt(C)]>>>6-C%4*2,z=L|y;f[v>>>2]|=z<<24-v%4*8,v++}return a.create(f,v)}})(),e.enc.Base64})});var Dk5=M1((tn0,Ok5)=>{(function(e,t){typeof tn0=="object"?Ok5.exports=tn0=t(dM2()):typeof define=="function"&&define.amd?define(["./core"],t):t(e.CryptoJS)})(tn0,function(e){return e.enc.Utf8})});var Gk5=M1((RRi,Uk5)=>{"use strict";function pZ4(e){this.message=e}pZ4.prototype=new Error,pZ4.prototype.name="InvalidCharacterError";var Ik5=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new pZ4("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,a,i=0,n=0,o="";a=t.charAt(n++);~a&&(r=i%4?64*r+a:a,i++%4)?o+=String.fromCharCode(255&r>>(-2*i&6)):0)a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a);return o};function Wx7(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return(function(r){return decodeURIComponent(Ik5(r).replace(/(.)/g,(function(a,i){var n=i.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))})(t)}catch{return Ik5(t)}}function uM2(e){this.message=e}function Nk5(e,t){if(typeof e!="string")throw new uM2("Invalid token specified");var r=(t=t||{}).header===!0?0:1;try{return JSON.parse(Wx7(e.split(".")[r]))}catch(a){throw new uM2("Invalid token specified: "+a.message)}}uM2.prototype=new Error,uM2.prototype.name="InvalidTokenError";var gZ4=Nk5;gZ4.default=Nk5,gZ4.InvalidTokenError=uM2,Uk5.exports=gZ4});var TQ1=M1((ZRi,sT5)=>{"use strict";var qx7=Object.create,an0=Object.defineProperty,$x7=Object.getOwnPropertyDescriptor,Kx7=Object.getOwnPropertyNames,Yx7=Object.getPrototypeOf,Xx7=Object.prototype.hasOwnProperty,Jx7=(e,t)=>{for(var r in t)an0(e,r,{get:t[r],enumerable:!0})},Kk5=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Kx7(t))!Xx7.call(e,i)&&i!==r&&an0(e,i,{get:()=>t[i],enumerable:!(a=$x7(t,i))||a.enumerable});return e},fM2=(e,t,r)=>(r=e!=null?qx7(Yx7(e)):{},Kk5(t||!e||!e.__esModule?an0(r,"default",{value:e,enumerable:!0}):r,e)),Qx7=e=>Kk5(an0({},"__esModule",{value:!0}),e),Yk5={};Jx7(Yk5,{AccessTokenEvents:()=>Xk5,CheckSessionIFrame:()=>Jk5,ErrorResponse:()=>ML1,ErrorTimeout:()=>in0,InMemoryWebStorage:()=>MZ4,Log:()=>pM2,Logger:()=>bh,MetadataService:()=>Qk5,OidcClient:()=>rT5,OidcClientSettingsStore:()=>rn0,SessionMonitor:()=>aT5,SigninResponse:()=>en0,SigninState:()=>nn0,SignoutResponse:()=>eT5,State:()=>R_1,User:()=>gM2,UserManager:()=>TL7,UserManagerSettingsStore:()=>cT5,Version:()=>VL7,WebStorageStateStore:()=>LZ4});sT5.exports=Qx7(Yk5);var tL7=fM2(dM2()),eL7=fM2(Rk5()),jk5=fM2(Fk5()),rL7=fM2(Dk5()),aL7={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},S91,H91,pM2=(e=>(e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(pM2||{});(e=>{function t(){S91=3,H91=aL7}e.reset=t;function r(i){if(!(0<=i&&i<=4))throw new Error("Invalid log level");S91=i}e.setLevel=r;function a(i){H91=i}e.setLogger=a})(pM2||(pM2={}));var bh=class{constructor(e){this._name=e}debug(...e){S91>=4&&H91.debug(bh._format(this._name,this._method),...e)}info(...e){S91>=3&&H91.info(bh._format(this._name,this._method),...e)}warn(...e){S91>=2&&H91.warn(bh._format(this._name,this._method),...e)}error(...e){S91>=1&&H91.error(bh._format(this._name,this._method),...e)}throw(e){throw this.error(e),e}create(e){let t=Object.create(this);return t._method=e,t.debug("begin"),t}static createStatic(e,t){let r=new bh(`${e}.${t}`);return r.debug("begin"),r}static _format(e,t){let r=`[${e}]`;return t?`${r} ${t}:`:r}static debug(e,...t){S91>=4&&H91.debug(bh._format(e),...t)}static info(e,...t){S91>=3&&H91.info(bh._format(e),...t)}static warn(e,...t){S91>=2&&H91.warn(bh._format(e),...t)}static error(e,...t){S91>=1&&H91.error(bh._format(e),...t)}};pM2.reset();var iL7="10000000-1000-4000-8000-100000000000",k91=class{static _randomWord(){return tL7.default.lib.WordArray.random(1).words[0]}static generateUUIDv4(){return iL7.replace(/[018]/g,t=>(+t^k91._randomWord()&15>>+t/4).toString(16)).replace(/-/g,"")}static generateCodeVerifier(){return k91.generateUUIDv4()+k91.generateUUIDv4()+k91.generateUUIDv4()}static generateCodeChallenge(e){try{let t=(0,eL7.default)(e);return jk5.default.stringify(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(t){throw bh.error("CryptoUtils.generateCodeChallenge",t),t}}static generateBasicAuth(e,t){let r=rL7.default.parse([e,t].join(":"));return jk5.default.stringify(r)}},CL1=class{constructor(e){this._name=e,this._logger=new bh(`Event('${this._name}')`),this._callbacks=[]}addHandler(e){return this._callbacks.push(e),()=>this.removeHandler(e)}removeHandler(e){let t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}raise(...e){this._logger.debug("raise:",...e);for(let t of this._callbacks)t(...e)}},nL7=fM2(Gk5()),fZ4=class{static decode(e){try{return(0,nL7.default)(e)}catch(t){throw bh.error("JwtUtils.decode",t),t}}},Wk5=class{static center({...e}){var t,r,a;return e.width==null&&(e.width=(t=[800,720,600,480].find(i=>i<=window.outerWidth/1.618))!=null?t:360),(r=e.left)!=null||(e.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-e.width)/2))),e.height!=null&&((a=e.top)!=null||(e.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-e.height)/2)))),e}static serialize(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,r])=>`${t}=${typeof r!="boolean"?r:r?"yes":"no"}`).join(",")}},i21=class extends CL1{constructor(){super(...arguments),this._logger=new bh(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{let e=this._expiration-i21.getEpochTime();this._logger.debug("timer completes in",e),this._expiration<=i21.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(e){let t=this._logger.create("init");e=Math.max(Math.floor(e),1);let r=i21.getEpochTime()+e;if(this.expiration===r&&this._timerHandle){t.debug("skipping since already initialized for expiration at",this.expiration);return}this.cancel(),t.debug("using duration",e),this._expiration=r;let a=Math.min(e,5);this._timerHandle=setInterval(this._callback,a*1e3)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},vZ4=class{static readParams(e,t="query"){if(!e)throw new TypeError("Invalid URL");let a=new URL(e,"http://127.0.0.1")[t==="fragment"?"hash":"search"];return new URLSearchParams(a.slice(1))}},mZ4=";",ML1=class extends Error{constructor(e,t){var r,a,i;if(super(e.error_description||e.error||""),this.form=t,this.name="ErrorResponse",!e.error)throw bh.error("ErrorResponse","No error passed"),new Error("No error passed");this.error=e.error,this.error_description=(r=e.error_description)!=null?r:null,this.error_uri=(a=e.error_uri)!=null?a:null,this.state=e.userState,this.session_state=(i=e.session_state)!=null?i:null,this.url_state=e.url_state}},in0=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},Xk5=class{constructor(e){this._logger=new bh("AccessTokenEvents"),this._expiringTimer=new i21("Access token expiring"),this._expiredTimer=new i21("Access token expired"),this._expiringNotificationTimeInSeconds=e.expiringNotificationTimeInSeconds}load(e){let t=this._logger.create("load");if(e.access_token&&e.expires_in!==void 0){let r=e.expires_in;if(t.debug("access token present, remaining duration:",r),r>0){let i=r-this._expiringNotificationTimeInSeconds;i<=0&&(i=1),t.debug("registering expiring timer, raising in",i,"seconds"),this._expiringTimer.init(i)}else t.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();let a=r+1;t.debug("registering expired timer, raising in",a,"seconds"),this._expiredTimer.init(a)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(e){return this._expiringTimer.addHandler(e)}removeAccessTokenExpiring(e){this._expiringTimer.removeHandler(e)}addAccessTokenExpired(e){return this._expiredTimer.addHandler(e)}removeAccessTokenExpired(e){this._expiredTimer.removeHandler(e)}},Jk5=class{constructor(e,t,r,a,i){this._callback=e,this._client_id=t,this._intervalInSeconds=a,this._stopOnError=i,this._logger=new bh("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=o=>{o.origin===this._frame_origin&&o.source===this._frame.contentWindow&&(o.data==="error"?(this._logger.error("error message from check session op iframe"),this._stopOnError&&this.stop()):o.data==="changed"?(this._logger.debug("changed message from check session op iframe"),this.stop(),this._callback()):this._logger.debug(o.data+" message from check session op iframe"))};let n=new URL(r);this._frame_origin=n.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=n.href}load(){return new Promise(e=>{this._frame.onload=()=>{e()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)})}start(e){if(this._session_state===e)return;this._logger.create("start"),this.stop(),this._session_state=e;let t=()=>{!this._frame.contentWindow||!this._session_state||this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};t(),this._timer=setInterval(t,this._intervalInSeconds*1e3)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}},MZ4=class{constructor(){this._logger=new bh("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(e){return this._logger.create(`getItem('${e}')`),this._data[e]}setItem(e,t){this._logger.create(`setItem('${e}')`),this._data[e]=t}removeItem(e){this._logger.create(`removeItem('${e}')`),delete this._data[e]}get length(){return Object.getOwnPropertyNames(this._data).length}key(e){return Object.getOwnPropertyNames(this._data)[e]}},xZ4=class{constructor(e=[],t=null,r={}){this._jwtHandler=t,this._extraHeaders=r,this._logger=new bh("JsonService"),this._contentTypes=[],this._contentTypes.push(...e,"application/json"),t&&this._contentTypes.push("application/jwt")}async fetchWithTimeout(e,t={}){let{timeoutInSeconds:r,...a}=t;if(!r)return await fetch(e,a);let i=new AbortController,n=setTimeout(()=>i.abort(),r*1e3);try{return await fetch(e,{...t,signal:i.signal})}catch(o){throw o instanceof DOMException&&o.name==="AbortError"?new in0("Network timed out"):o}finally{clearTimeout(n)}}async getJson(e,{token:t,credentials:r}={}){let a=this._logger.create("getJson"),i={Accept:this._contentTypes.join(", ")};t&&(a.debug("token passed, setting Authorization header"),i.Authorization="Bearer "+t),this.appendExtraHeaders(i);let n;try{a.debug("url:",e),n=await this.fetchWithTimeout(e,{method:"GET",headers:i,credentials:r})}catch(u){throw a.error("Network Error"),u}a.debug("HTTP response received, status",n.status);let o=n.headers.get("Content-Type");if(o&&!this._contentTypes.find(u=>o.startsWith(u))&&a.throw(new Error(`Invalid response Content-Type: ${o??"undefined"}, from URL: ${e}`)),n.ok&&this._jwtHandler&&o?.startsWith("application/jwt"))return await this._jwtHandler(await n.text());let h;try{h=await n.json()}catch(u){throw a.error("Error parsing JSON response",u),n.ok?u:new Error(`${n.statusText} (${n.status})`)}if(!n.ok)throw a.error("Error from server:",h),h.error?new ML1(h):new Error(`${n.statusText} (${n.status}): ${JSON.stringify(h)}`);return h}async postForm(e,{body:t,basicAuth:r,timeoutInSeconds:a,initCredentials:i}){let n=this._logger.create("postForm"),o={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded"};r!==void 0&&(o.Authorization="Basic "+r),this.appendExtraHeaders(o);let h;try{n.debug("url:",e),h=await this.fetchWithTimeout(e,{method:"POST",headers:o,body:t,timeoutInSeconds:a,credentials:i})}catch(v){throw n.error("Network error"),v}n.debug("HTTP response received, status",h.status);let u=h.headers.get("Content-Type");if(u&&!this._contentTypes.find(v=>u.startsWith(v)))throw new Error(`Invalid response Content-Type: ${u??"undefined"}, from URL: ${e}`);let g=await h.text(),f={};if(g)try{f=JSON.parse(g)}catch(v){throw n.error("Error parsing JSON response",v),h.ok?v:new Error(`${h.statusText} (${h.status})`)}if(!h.ok)throw n.error("Error from server:",f),f.error?new ML1(f,t):new Error(`${h.statusText} (${h.status}): ${JSON.stringify(f)}`);return f}appendExtraHeaders(e){let t=this._logger.create("appendExtraHeaders"),r=Object.keys(this._extraHeaders),a=["authorization","accept","content-type"];r.length!==0&&r.forEach(i=>{if(a.includes(i.toLocaleLowerCase())){t.warn("Protected header could not be overridden",i,a);return}let n=typeof this._extraHeaders[i]=="function"?this._extraHeaders[i]():this._extraHeaders[i];n&&n!==""&&(e[i]=n)})}},Qk5=class{constructor(e){this._settings=e,this._logger=new bh("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new xZ4(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}resetSigningKeys(){this._signingKeys=null}async getMetadata(){let e=this._logger.create("getMetadata");if(this._metadata)return e.debug("using cached values"),this._metadata;if(!this._metadataUrl)throw e.throw(new Error("No authority or metadataUrl configured on settings")),null;e.debug("getting metadata from",this._metadataUrl);let t=await this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials});return e.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},this._settings.metadataSeed,t),this._metadata}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(e=!0){return this._getMetadataProperty("token_endpoint",e)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(e=!0){return this._getMetadataProperty("revocation_endpoint",e)}getKeysEndpoint(e=!0){return this._getMetadataProperty("jwks_uri",e)}async _getMetadataProperty(e,t=!1){let r=this._logger.create(`_getMetadataProperty('${e}')`),a=await this.getMetadata();if(r.debug("resolved"),a[e]===void 0){if(t===!0){r.warn("Metadata does not contain optional property");return}r.throw(new Error("Metadata does not contain property "+e))}return a[e]}async getSigningKeys(){let e=this._logger.create("getSigningKeys");if(this._signingKeys)return e.debug("returning signingKeys from cache"),this._signingKeys;let t=await this.getKeysEndpoint(!1);e.debug("got jwks_uri",t);let r=await this._jsonService.getJson(t);if(e.debug("got key set",r),!Array.isArray(r.keys))throw e.throw(new Error("Missing keys on keyset")),null;return this._signingKeys=r.keys,this._signingKeys}},LZ4=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new bh("WebStorageStateStore"),this._store=t,this._prefix=e}async set(e,t){this._logger.create(`set('${e}')`),e=this._prefix+e,await this._store.setItem(e,t)}async get(e){return this._logger.create(`get('${e}')`),e=this._prefix+e,await this._store.getItem(e)}async remove(e){this._logger.create(`remove('${e}')`),e=this._prefix+e;let t=await this._store.getItem(e);return await this._store.removeItem(e),t}async getAllKeys(){this._logger.create("getAllKeys");let e=await this._store.length,t=[];for(let r=0;r<e;r++){let a=await this._store.key(r);a&&a.indexOf(this._prefix)===0&&t.push(a.substr(this._prefix.length))}return t}},oL7="code",lL7="openid",cL7="client_secret_post",sL7="query",hL7=900,dL7=300,rn0=class{constructor({authority:e,metadataUrl:t,metadata:r,signingKeys:a,metadataSeed:i,client_id:n,client_secret:o,response_type:h=oL7,scope:u=lL7,redirect_uri:g,post_logout_redirect_uri:f,client_authentication:v=cL7,prompt:C,display:L,max_age:y,ui_locales:z,acr_values:S,resource:B,response_mode:R=sL7,filterProtocolClaims:F=!0,loadUserInfo:N=!1,staleStateAgeInSeconds:j=hL7,clockSkewInSeconds:Y=dL7,userInfoJwtIssuer:t1="OP",mergeClaims:n1=!1,disablePKCE:a1=!1,stateStore:s1,refreshTokenCredentials:p1,revokeTokenAdditionalContentTypes:u1,fetchRequestCredentials:v1,refreshTokenAllowedScope:h1,extraQueryParams:H1={},extraTokenParams:z1={},extraHeaders:b1={}}){if(this.authority=e,t?this.metadataUrl=t:(this.metadataUrl=e,e&&(this.metadataUrl.endsWith("/")||(this.metadataUrl+="/"),this.metadataUrl+=".well-known/openid-configuration")),this.metadata=r,this.metadataSeed=i,this.signingKeys=a,this.client_id=n,this.client_secret=o,this.response_type=h,this.scope=u,this.redirect_uri=g,this.post_logout_redirect_uri=f,this.client_authentication=v,this.prompt=C,this.display=L,this.max_age=y,this.ui_locales=z,this.acr_values=S,this.resource=B,this.response_mode=R,this.filterProtocolClaims=F??!0,this.loadUserInfo=!!N,this.staleStateAgeInSeconds=j,this.clockSkewInSeconds=Y,this.userInfoJwtIssuer=t1,this.mergeClaims=!!n1,this.disablePKCE=!!a1,this.revokeTokenAdditionalContentTypes=u1,v1&&p1&&console.warn("Both fetchRequestCredentials and refreshTokenCredentials is set. Only fetchRequestCredentials will be used."),this.fetchRequestCredentials=v1||p1||"same-origin",s1)this.stateStore=s1;else{let m1=typeof window<"u"?window.localStorage:new MZ4;this.stateStore=new LZ4({store:m1})}this.refreshTokenAllowedScope=h1,this.extraQueryParams=H1,this.extraTokenParams=z1,this.extraHeaders=b1}},uL7=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new bh("UserInfoService"),this._getClaimsFromJwt=async r=>{let a=this._logger.create("_getClaimsFromJwt");try{let i=fZ4.decode(r);return a.debug("JWT decoding successful"),i}catch(i){throw a.error("Error parsing JWT response"),i}},this._jsonService=new xZ4(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}async getClaims(e){let t=this._logger.create("getClaims");e||this._logger.throw(new Error("No token passed"));let r=await this._metadataService.getUserInfoEndpoint();t.debug("got userinfo url",r);let a=await this._jsonService.getJson(r,{token:e,credentials:this._settings.fetchRequestCredentials});return t.debug("got claims",a),a}},tT5=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new bh("TokenClient"),this._jsonService=new xZ4(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}async exchangeCode({grant_type:e="authorization_code",redirect_uri:t=this._settings.redirect_uri,client_id:r=this._settings.client_id,client_secret:a=this._settings.client_secret,...i}){let n=this._logger.create("exchangeCode");r||n.throw(new Error("A client_id is required")),t||n.throw(new Error("A redirect_uri is required")),i.code||n.throw(new Error("A code is required"));let o=new URLSearchParams({grant_type:e,redirect_uri:t});for(let[f,v]of Object.entries(i))v!=null&&o.set(f,v);let h;switch(this._settings.client_authentication){case"client_secret_basic":if(!a)throw n.throw(new Error("A client_secret is required")),null;h=k91.generateBasicAuth(r,a);break;case"client_secret_post":o.append("client_id",r),a&&o.append("client_secret",a);break}let u=await this._metadataService.getTokenEndpoint(!1);n.debug("got token endpoint");let g=await this._jsonService.postForm(u,{body:o,basicAuth:h,initCredentials:this._settings.fetchRequestCredentials});return n.debug("got response"),g}async exchangeCredentials({grant_type:e="password",client_id:t=this._settings.client_id,client_secret:r=this._settings.client_secret,scope:a=this._settings.scope,...i}){let n=this._logger.create("exchangeCredentials");t||n.throw(new Error("A client_id is required"));let o=new URLSearchParams({grant_type:e,scope:a});for(let[f,v]of Object.entries(i))v!=null&&o.set(f,v);let h;switch(this._settings.client_authentication){case"client_secret_basic":if(!r)throw n.throw(new Error("A client_secret is required")),null;h=k91.generateBasicAuth(t,r);break;case"client_secret_post":o.append("client_id",t),r&&o.append("client_secret",r);break}let u=await this._metadataService.getTokenEndpoint(!1);n.debug("got token endpoint");let g=await this._jsonService.postForm(u,{body:o,basicAuth:h,initCredentials:this._settings.fetchRequestCredentials});return n.debug("got response"),g}async exchangeRefreshToken({grant_type:e="refresh_token",client_id:t=this._settings.client_id,client_secret:r=this._settings.client_secret,timeoutInSeconds:a,...i}){let n=this._logger.create("exchangeRefreshToken");t||n.throw(new Error("A client_id is required")),i.refresh_token||n.throw(new Error("A refresh_token is required"));let o=new URLSearchParams({grant_type:e});for(let[f,v]of Object.entries(i))Array.isArray(v)?v.forEach(C=>o.append(f,C)):v!=null&&o.set(f,v);let h;switch(this._settings.client_authentication){case"client_secret_basic":if(!r)throw n.throw(new Error("A client_secret is required")),null;h=k91.generateBasicAuth(t,r);break;case"client_secret_post":o.append("client_id",t),r&&o.append("client_secret",r);break}let u=await this._metadataService.getTokenEndpoint(!1);n.debug("got token endpoint");let g=await this._jsonService.postForm(u,{body:o,basicAuth:h,timeoutInSeconds:a,initCredentials:this._settings.fetchRequestCredentials});return n.debug("got response"),g}async revoke(e){var t;let r=this._logger.create("revoke");e.token||r.throw(new Error("A token is required"));let a=await this._metadataService.getRevocationEndpoint(!1);r.debug(`got revocation endpoint, revoking ${(t=e.token_type_hint)!=null?t:"default token type"}`);let i=new URLSearchParams;for(let[n,o]of Object.entries(e))o!=null&&i.set(n,o);i.set("client_id",this._settings.client_id),this._settings.client_secret&&i.set("client_secret",this._settings.client_secret),await this._jsonService.postForm(a,{body:i}),r.debug("got response")}},gL7=class{constructor(e,t,r){this._settings=e,this._metadataService=t,this._claimsService=r,this._logger=new bh("ResponseValidator"),this._userInfoService=new uL7(this._settings,this._metadataService),this._tokenClient=new tT5(this._settings,this._metadataService)}async validateSigninResponse(e,t){let r=this._logger.create("validateSigninResponse");this._processSigninState(e,t),r.debug("state processed"),await this._processCode(e,t),r.debug("code processed"),e.isOpenId&&this._validateIdTokenAttributes(e),r.debug("tokens validated"),await this._processClaims(e,t?.skipUserInfo,e.isOpenId),r.debug("claims processed")}async validateCredentialsResponse(e,t){let r=this._logger.create("validateCredentialsResponse");e.isOpenId&&e.id_token&&this._validateIdTokenAttributes(e),r.debug("tokens validated"),await this._processClaims(e,t,e.isOpenId),r.debug("claims processed")}async validateRefreshResponse(e,t){var r,a;let i=this._logger.create("validateRefreshResponse");e.userState=t.data,(r=e.session_state)!=null||(e.session_state=t.session_state),(a=e.scope)!=null||(e.scope=t.scope),e.isOpenId&&e.id_token&&(this._validateIdTokenAttributes(e,t.id_token),i.debug("ID Token validated")),e.id_token||(e.id_token=t.id_token,e.profile=t.profile);let n=e.isOpenId&&!!e.id_token;await this._processClaims(e,!1,n),i.debug("claims processed")}validateSignoutResponse(e,t){let r=this._logger.create("validateSignoutResponse");if(t.id!==e.state&&r.throw(new Error("State does not match")),r.debug("state validated"),e.userState=t.data,e.error)throw r.warn("Response was error",e.error),new ML1(e)}_processSigninState(e,t){var r;let a=this._logger.create("_processSigninState");if(t.id!==e.state&&a.throw(new Error("State does not match")),t.client_id||a.throw(new Error("No client_id on state")),t.authority||a.throw(new Error("No authority on state")),this._settings.authority!==t.authority&&a.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==t.client_id&&a.throw(new Error("client_id mismatch on settings vs. signin state")),a.debug("state validated"),e.userState=t.data,e.url_state=t.url_state,(r=e.scope)!=null||(e.scope=t.scope),e.error)throw a.warn("Response was error",e.error),new ML1(e);t.code_verifier&&!e.code&&a.throw(new Error("Expected code in response"))}async _processClaims(e,t=!1,r=!0){let a=this._logger.create("_processClaims");if(e.profile=this._claimsService.filterProtocolClaims(e.profile),t||!this._settings.loadUserInfo||!e.access_token){a.debug("not loading user info");return}a.debug("loading user info");let i=await this._userInfoService.getClaims(e.access_token);a.debug("user info claims received from user info endpoint"),r&&i.sub!==e.profile.sub&&a.throw(new Error("subject from UserInfo response does not match subject in ID Token")),e.profile=this._claimsService.mergeClaims(e.profile,this._claimsService.filterProtocolClaims(i)),a.debug("user info claims received, updated profile:",e.profile)}async _processCode(e,t){let r=this._logger.create("_processCode");if(e.code){r.debug("Validating code");let a=await this._tokenClient.exchangeCode({client_id:t.client_id,client_secret:t.client_secret,code:e.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier,...t.extraTokenParams});Object.assign(e,a)}else r.debug("No code to process")}_validateIdTokenAttributes(e,t){var r;let a=this._logger.create("_validateIdTokenAttributes");a.debug("decoding ID Token JWT");let i=fZ4.decode((r=e.id_token)!=null?r:"");if(i.sub||a.throw(new Error("ID Token is missing a subject claim")),t){let n=fZ4.decode(t);i.sub!==n.sub&&a.throw(new Error("sub in id_token does not match current sub")),i.auth_time&&i.auth_time!==n.auth_time&&a.throw(new Error("auth_time in id_token does not match original auth_time")),i.azp&&i.azp!==n.azp&&a.throw(new Error("azp in id_token does not match original azp")),!i.azp&&n.azp&&a.throw(new Error("azp not in id_token, but present in original id_token"))}e.profile=i}},R_1=class{constructor(e){this.id=e.id||k91.generateUUIDv4(),this.data=e.data,e.created&&e.created>0?this.created=e.created:this.created=i21.getEpochTime(),this.request_type=e.request_type,this.url_state=e.url_state}toStorageString(){return new bh("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state})}static fromStorageString(e){return bh.createStatic("State","fromStorageString"),new R_1(JSON.parse(e))}static async clearStaleState(e,t){let r=bh.createStatic("State","clearStaleState"),a=i21.getEpochTime()-t,i=await e.getAllKeys();r.debug("got keys",i);for(let n=0;n<i.length;n++){let o=i[n],h=await e.get(o),u=!1;if(h)try{let g=R_1.fromStorageString(h);r.debug("got item from key:",o,g.created),g.created<=a&&(u=!0)}catch(g){r.error("Error parsing state for key:",o,g),u=!0}else r.debug("no item in storage for key:",o),u=!0;u&&(r.debug("removed item for key:",o),e.remove(o))}}},nn0=class extends R_1{constructor(e){super(e),e.code_verifier===!0?this.code_verifier=k91.generateCodeVerifier():e.code_verifier&&(this.code_verifier=e.code_verifier),this.code_verifier&&(this.code_challenge=k91.generateCodeChallenge(this.code_verifier)),this.authority=e.authority,this.client_id=e.client_id,this.redirect_uri=e.redirect_uri,this.scope=e.scope,this.client_secret=e.client_secret,this.extraTokenParams=e.extraTokenParams,this.response_mode=e.response_mode,this.skipUserInfo=e.skipUserInfo}toStorageString(){return new bh("SigninState").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state,code_verifier:this.code_verifier,authority:this.authority,client_id:this.client_id,redirect_uri:this.redirect_uri,scope:this.scope,client_secret:this.client_secret,extraTokenParams:this.extraTokenParams,response_mode:this.response_mode,skipUserInfo:this.skipUserInfo})}static fromStorageString(e){bh.createStatic("SigninState","fromStorageString");let t=JSON.parse(e);return new nn0(t)}},pL7=class{constructor({url:e,authority:t,client_id:r,redirect_uri:a,response_type:i,scope:n,state_data:o,response_mode:h,request_type:u,client_secret:g,nonce:f,url_state:v,resource:C,skipUserInfo:L,extraQueryParams:y,extraTokenParams:z,disablePKCE:S,...B}){if(this._logger=new bh("SigninRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");if(!r)throw this._logger.error("ctor: No client_id passed"),new Error("client_id");if(!a)throw this._logger.error("ctor: No redirect_uri passed"),new Error("redirect_uri");if(!i)throw this._logger.error("ctor: No response_type passed"),new Error("response_type");if(!n)throw this._logger.error("ctor: No scope passed"),new Error("scope");if(!t)throw this._logger.error("ctor: No authority passed"),new Error("authority");this.state=new nn0({data:o,request_type:u,url_state:v,code_verifier:!S,client_id:r,authority:t,redirect_uri:a,response_mode:h,client_secret:g,scope:n,extraTokenParams:z,skipUserInfo:L});let R=new URL(e);R.searchParams.append("client_id",r),R.searchParams.append("redirect_uri",a),R.searchParams.append("response_type",i),R.searchParams.append("scope",n),f&&R.searchParams.append("nonce",f);let F=this.state.id;v&&(F=`${F}${mZ4}${v}`),R.searchParams.append("state",F),this.state.code_challenge&&(R.searchParams.append("code_challenge",this.state.code_challenge),R.searchParams.append("code_challenge_method","S256")),C&&(Array.isArray(C)?C:[C]).forEach(j=>R.searchParams.append("resource",j));for(let[N,j]of Object.entries({response_mode:h,...B,...y}))j!=null&&R.searchParams.append(N,j.toString());this.url=R.href}},fL7="openid",en0=class{constructor(e){if(this.access_token="",this.token_type="",this.profile={},this.state=e.get("state"),this.session_state=e.get("session_state"),this.state){let t=decodeURIComponent(this.state).split(mZ4);this.state=t[0],t.length>1&&(this.url_state=t.slice(1).join(mZ4))}this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri"),this.code=e.get("code")}get expires_in(){if(this.expires_at!==void 0)return this.expires_at-i21.getEpochTime()}set expires_in(e){typeof e=="string"&&(e=Number(e)),e!==void 0&&e>=0&&(this.expires_at=Math.floor(e)+i21.getEpochTime())}get isOpenId(){var e;return((e=this.scope)==null?void 0:e.split(" ").includes(fL7))||!!this.id_token}},vL7=class{constructor({url:e,state_data:t,id_token_hint:r,post_logout_redirect_uri:a,extraQueryParams:i,request_type:n,client_id:o}){if(this._logger=new bh("SignoutRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");let h=new URL(e);r&&h.searchParams.append("id_token_hint",r),o&&h.searchParams.append("client_id",o),a&&(h.searchParams.append("post_logout_redirect_uri",a),t&&(this.state=new R_1({data:t,request_type:n}),h.searchParams.append("state",this.state.id)));for(let[u,g]of Object.entries({...i}))g!=null&&h.searchParams.append(u,g.toString());this.url=h.href}},eT5=class{constructor(e){this.state=e.get("state"),this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri")}},mL7=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],CL7=["sub","iss","aud","exp","iat"],ML7=class{constructor(e){this._settings=e,this._logger=new bh("ClaimsService")}filterProtocolClaims(e){let t={...e};if(this._settings.filterProtocolClaims){let r;Array.isArray(this._settings.filterProtocolClaims)?r=this._settings.filterProtocolClaims:r=mL7;for(let a of r)CL7.includes(a)||delete t[a]}return t}mergeClaims(e,t){let r={...e};for(let[a,i]of Object.entries(t))for(let n of Array.isArray(i)?i:[i]){let o=r[a];o===void 0?r[a]=n:Array.isArray(o)?o.includes(n)||o.push(n):r[a]!==n&&(typeof n=="object"&&this._settings.mergeClaims?r[a]=this.mergeClaims(o,n):r[a]=[o,n])}return r}},rT5=class{constructor(e,t){this._logger=new bh("OidcClient"),this.settings=e instanceof rn0?e:new rn0(e),this.metadataService=t??new Qk5(this.settings),this._claimsService=new ML7(this.settings),this._validator=new gL7(this.settings,this.metadataService,this._claimsService),this._tokenClient=new tT5(this.settings,this.metadataService)}async createSigninRequest({state:e,request:t,request_uri:r,request_type:a,id_token_hint:i,login_hint:n,skipUserInfo:o,nonce:h,url_state:u,response_type:g=this.settings.response_type,scope:f=this.settings.scope,redirect_uri:v=this.settings.redirect_uri,prompt:C=this.settings.prompt,display:L=this.settings.display,max_age:y=this.settings.max_age,ui_locales:z=this.settings.ui_locales,acr_values:S=this.settings.acr_values,resource:B=this.settings.resource,response_mode:R=this.settings.response_mode,extraQueryParams:F=this.settings.extraQueryParams,extraTokenParams:N=this.settings.extraTokenParams}){let j=this._logger.create("createSigninRequest");if(g!=="code")throw new Error("Only the Authorization Code flow (with PKCE) is supported");let Y=await this.metadataService.getAuthorizationEndpoint();j.debug("Received authorization endpoint",Y);let t1=new pL7({url:Y,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:v,response_type:g,scope:f,state_data:e,url_state:u,prompt:C,display:L,max_age:y,ui_locales:z,id_token_hint:i,login_hint:n,acr_values:S,resource:B,request:t,request_uri:r,extraQueryParams:F,extraTokenParams:N,request_type:a,response_mode:R,client_secret:this.settings.client_secret,skipUserInfo:o,nonce:h,disablePKCE:this.settings.disablePKCE});await this.clearStaleState();let n1=t1.state;return await this.settings.stateStore.set(n1.id,n1.toStorageString()),t1}async readSigninResponseState(e,t=!1){let r=this._logger.create("readSigninResponseState"),a=new en0(vZ4.readParams(e,this.settings.response_mode));if(!a.state)throw r.throw(new Error("No state in response")),null;let i=await this.settings.stateStore[t?"remove":"get"](a.state);if(!i)throw r.throw(new Error("No matching state found in storage")),null;return{state:nn0.fromStorageString(i),response:a}}async processSigninResponse(e){let t=this._logger.create("processSigninResponse"),{state:r,response:a}=await this.readSigninResponseState(e,!0);return t.debug("received state from storage; validating response"),await this._validator.validateSigninResponse(a,r),a}async processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:r=!1,extraTokenParams:a={}}){let i=await this._tokenClient.exchangeCredentials({username:e,password:t,...a}),n=new en0(new URLSearchParams);return Object.assign(n,i),await this._validator.validateCredentialsResponse(n,r),n}async useRefreshToken({state:e,timeoutInSeconds:t}){var r;let a=this._logger.create("useRefreshToken"),i;if(this.settings.refreshTokenAllowedScope===void 0)i=e.scope;else{let h=this.settings.refreshTokenAllowedScope.split(" ");i=(((r=e.scope)==null?void 0:r.split(" "))||[]).filter(g=>h.includes(g)).join(" ")}let n=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,resource:e.resource,scope:i,timeoutInSeconds:t}),o=new en0(new URLSearchParams);return Object.assign(o,n),a.debug("validating response",o),await this._validator.validateRefreshResponse(o,{...e,scope:i}),o}async createSignoutRequest({state:e,id_token_hint:t,client_id:r,request_type:a,post_logout_redirect_uri:i=this.settings.post_logout_redirect_uri,extraQueryParams:n=this.settings.extraQueryParams}={}){let o=this._logger.create("createSignoutRequest"),h=await this.metadataService.getEndSessionEndpoint();if(!h)throw o.throw(new Error("No end session endpoint")),null;o.debug("Received end session endpoint",h),!r&&i&&!t&&(r=this.settings.client_id);let u=new vL7({url:h,id_token_hint:t,client_id:r,post_logout_redirect_uri:i,state_data:e,extraQueryParams:n,request_type:a});await this.clearStaleState();let g=u.state;return g&&(o.debug("Signout request has state to persist"),await this.settings.stateStore.set(g.id,g.toStorageString())),u}async readSignoutResponseState(e,t=!1){let r=this._logger.create("readSignoutResponseState"),a=new eT5(vZ4.readParams(e,this.settings.response_mode));if(!a.state){if(r.debug("No state in response"),a.error)throw r.warn("Response was error:",a.error),new ML1(a);return{state:void 0,response:a}}let i=await this.settings.stateStore[t?"remove":"get"](a.state);if(!i)throw r.throw(new Error("No matching state found in storage")),null;return{state:R_1.fromStorageString(i),response:a}}async processSignoutResponse(e){let t=this._logger.create("processSignoutResponse"),{state:r,response:a}=await this.readSignoutResponseState(e,!0);return r?(t.debug("Received state from storage; validating response"),this._validator.validateSignoutResponse(a,r)):t.debug("No state from storage; skipping response validation"),a}clearStaleState(){return this._logger.create("clearStaleState"),R_1.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}async revokeToken(e,t){return this._logger.create("revokeToken"),await this._tokenClient.revoke({token:e,token_type_hint:t})}},aT5=class{constructor(e){this._userManager=e,this._logger=new bh("SessionMonitor"),this._start=async t=>{let r=t.session_state;if(!r)return;let a=this._logger.create("_start");if(t.profile?(this._sub=t.profile.sub,this._sid=t.profile.sid,a.debug("session_state",r,", sub",this._sub)):(this._sub=void 0,this._sid=void 0,a.debug("session_state",r,", anonymous user")),this._checkSessionIFrame){this._checkSessionIFrame.start(r);return}try{let i=await this._userManager.metadataService.getCheckSessionIframe();if(i){a.debug("initializing check session iframe");let n=this._userManager.settings.client_id,o=this._userManager.settings.checkSessionIntervalInSeconds,h=this._userManager.settings.stopCheckSessionOnError,u=new Jk5(this._callback,n,i,o,h);await u.load(),this._checkSessionIFrame=u,u.start(r)}else a.warn("no check session iframe found in the metadata")}catch(i){a.error("Error from getCheckSessionIframe:",i instanceof Error?i.message:i)}},this._stop=()=>{let t=this._logger.create("_stop");if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){let r=setInterval(async()=>{clearInterval(r);try{let a=await this._userManager.querySessionStatus();if(a){let i={session_state:a.session_state,profile:a.sub&&a.sid?{sub:a.sub,sid:a.sid}:null};this._start(i)}}catch(a){t.error("error from querySessionStatus",a instanceof Error?a.message:a)}},1e3)}},this._callback=async()=>{let t=this._logger.create("_callback");try{let r=await this._userManager.querySessionStatus(),a=!0;r&&this._checkSessionIFrame?r.sub===this._sub?(a=!1,this._checkSessionIFrame.start(r.session_state),r.sid===this._sid?t.debug("same sub still logged in at OP, restarting check session iframe; session_state",r.session_state):(t.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",r.session_state),this._userManager.events._raiseUserSessionChanged())):t.debug("different subject signed into OP",r.sub):t.debug("subject no longer signed into OP"),a?this._sub?this._userManager.events._raiseUserSignedOut():this._userManager.events._raiseUserSignedIn():t.debug("no change in session detected, no event to raise")}catch(r){this._sub&&(t.debug("Error calling queryCurrentSigninSession; raising signed out event",r),this._userManager.events._raiseUserSignedOut())}},e||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch(t=>{this._logger.error(t)})}async _init(){this._logger.create("_init");let e=await this._userManager.getUser();if(e)this._start(e);else if(this._userManager.settings.monitorAnonymousSession){let t=await this._userManager.querySessionStatus();if(t){let r={session_state:t.session_state,profile:t.sub&&t.sid?{sub:t.sub,sid:t.sid}:null};this._start(r)}}}},gM2=class{constructor(e){var t;this.id_token=e.id_token,this.session_state=(t=e.session_state)!=null?t:null,this.access_token=e.access_token,this.refresh_token=e.refresh_token,this.token_type=e.token_type,this.scope=e.scope,this.profile=e.profile,this.expires_at=e.expires_at,this.state=e.userState,this.url_state=e.url_state}get expires_in(){if(this.expires_at!==void 0)return this.expires_at-i21.getEpochTime()}set expires_in(e){e!==void 0&&(this.expires_at=Math.floor(e)+i21.getEpochTime())}get expired(){let e=this.expires_in;if(e!==void 0)return e<=0}get scopes(){var e,t;return(t=(e=this.scope)==null?void 0:e.split(" "))!=null?t:[]}toStorageString(){return new bh("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(e){return bh.createStatic("User","fromStorageString"),new gM2(JSON.parse(e))}},qk5="oidc-client",iT5=class{constructor(){this._abort=new CL1("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}async navigate(e){let t=this._logger.create("navigate");if(!this._window)throw new Error("Attempted to navigate on a disposed window");t.debug("setting URL in window"),this._window.location.replace(e.url);let{url:r,keepOpen:a}=await new Promise((i,n)=>{let o=h=>{var u;let g=h.data,f=(u=e.scriptOrigin)!=null?u:window.location.origin;if(!(h.origin!==f||g?.source!==qk5)){try{let v=vZ4.readParams(g.url,e.response_mode).get("state");if(v||t.warn("no state found in response url"),h.source!==this._window&&v!==e.state)return}catch{this._dispose(),n(new Error("Invalid response from window"))}i(g)}};window.addEventListener("message",o,!1),this._disposeHandlers.add(()=>window.removeEventListener("message",o,!1)),this._disposeHandlers.add(this._abort.addHandler(h=>{this._dispose(),n(h)}))});return t.debug("got response from window"),this._dispose(),a||this.close(),{url:r}}_dispose(){this._logger.create("_dispose");for(let e of this._disposeHandlers)e();this._disposeHandlers.clear()}static _notifyParent(e,t,r=!1,a=window.location.origin){e.postMessage({source:qk5,url:t,keepOpen:r},a)}},nT5={location:!1,toolbar:!1,height:640,closePopupWindowAfterInSeconds:-1},oT5="_blank",xL7=60,LL7=2,lT5=10,cT5=class extends rn0{constructor(e){let{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:r=e.post_logout_redirect_uri,popupWindowFeatures:a=nT5,popupWindowTarget:i=oT5,redirectMethod:n="assign",redirectTarget:o="self",iframeNotifyParentOrigin:h=e.iframeNotifyParentOrigin,iframeScriptOrigin:u=e.iframeScriptOrigin,silent_redirect_uri:g=e.redirect_uri,silentRequestTimeoutInSeconds:f=lT5,automaticSilentRenew:v=!0,validateSubOnSilentRenew:C=!0,includeIdTokenInSilentRenew:L=!1,monitorSession:y=!1,monitorAnonymousSession:z=!1,checkSessionIntervalInSeconds:S=LL7,query_status_response_type:B="code",stopCheckSessionOnError:R=!0,revokeTokenTypes:F=["access_token","refresh_token"],revokeTokensOnSignout:N=!1,includeIdTokenInSilentSignout:j=!1,accessTokenExpiringNotificationTimeInSeconds:Y=xL7,userStore:t1}=e;if(super(e),this.popup_redirect_uri=t,this.popup_post_logout_redirect_uri=r,this.popupWindowFeatures=a,this.popupWindowTarget=i,this.redirectMethod=n,this.redirectTarget=o,this.iframeNotifyParentOrigin=h,this.iframeScriptOrigin=u,this.silent_redirect_uri=g,this.silentRequestTimeoutInSeconds=f,this.automaticSilentRenew=v,this.validateSubOnSilentRenew=C,this.includeIdTokenInSilentRenew=L,this.monitorSession=y,this.monitorAnonymousSession=z,this.checkSessionIntervalInSeconds=S,this.stopCheckSessionOnError=R,this.query_status_response_type=B,this.revokeTokenTypes=F,this.revokeTokensOnSignout=N,this.includeIdTokenInSilentSignout=j,this.accessTokenExpiringNotificationTimeInSeconds=Y,t1)this.userStore=t1;else{let n1=typeof window<"u"?window.sessionStorage:new MZ4;this.userStore=new LZ4({store:n1})}}},CZ4=class extends iT5{constructor({silentRequestTimeoutInSeconds:e=lT5}){super(),this._logger=new bh("IFrameWindow"),this._timeoutInSeconds=e,this._frame=CZ4.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){let e=window.document.createElement("iframe");return e.style.visibility="hidden",e.style.position="fixed",e.style.left="-1000px",e.style.top="0",e.width="0",e.height="0",window.document.body.appendChild(e),e}async navigate(e){this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds);let t=setTimeout(()=>this._abort.raise(new in0("IFrame timed out without a response")),this._timeoutInSeconds*1e3);return this._disposeHandlers.add(()=>clearTimeout(t)),await super.navigate(e)}close(){var e;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",t=>{var r;let a=t.target;(r=a.parentNode)==null||r.removeChild(a),this._abort.raise(new Error("IFrame removed from DOM"))},!0),(e=this._frame.contentWindow)==null||e.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(e,t){return super._notifyParent(window.parent,e,!1,t)}},wL7=class{constructor(e){this._settings=e,this._logger=new bh("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new CZ4({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),CZ4.notifyParent(e,this._settings.iframeNotifyParentOrigin)}},yL7=500,AL7=1e3,$k5=class extends iT5{constructor({popupWindowTarget:e=oT5,popupWindowFeatures:t={}}){super(),this._logger=new bh("PopupWindow");let r=Wk5.center({...nT5,...t});this._window=window.open(void 0,e,Wk5.serialize(r)),t.closePopupWindowAfterInSeconds&&t.closePopupWindowAfterInSeconds>0&&setTimeout(()=>{if(!this._window||typeof this._window.closed!="boolean"||this._window.closed){this._abort.raise(new Error("Popup blocked by user"));return}this.close()},t.closePopupWindowAfterInSeconds*AL7)}async navigate(e){var t;(t=this._window)==null||t.focus();let r=setInterval(()=>{(!this._window||this._window.closed)&&this._abort.raise(new Error("Popup closed by user"))},yL7);return this._disposeHandlers.add(()=>clearInterval(r)),await super.navigate(e)}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(e,t){if(!window.opener)throw new Error("No window.opener. Can't complete notification.");return super._notifyParent(window.opener,e,t)}},zL7=class{constructor(e){this._settings=e,this._logger=new bh("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget}){return new $k5({popupWindowFeatures:e,popupWindowTarget:t})}async callback(e,{keepOpen:t=!1}){this._logger.create("callback"),$k5.notifyOpener(e,t)}},bL7=class{constructor(e){this._settings=e,this._logger=new bh("RedirectNavigator")}async prepare({redirectMethod:e=this._settings.redirectMethod,redirectTarget:t=this._settings.redirectTarget}){var r;this._logger.create("prepare");let a=window.self;t==="top"&&(a=(r=window.top)!=null?r:window.self);let i=a.location[e].bind(a.location),n;return{navigate:async o=>{this._logger.create("navigate");let h=new Promise((u,g)=>{n=g});return i(o.url),await h},close:()=>{this._logger.create("close"),n?.(new Error("Redirect aborted")),a.stop()}}}async callback(){}},SL7=class extends Xk5{constructor(e){super({expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new bh("UserManagerEvents"),this._userLoaded=new CL1("User loaded"),this._userUnloaded=new CL1("User unloaded"),this._silentRenewError=new CL1("Silent renew error"),this._userSignedIn=new CL1("User signed in"),this._userSignedOut=new CL1("User signed out"),this._userSessionChanged=new CL1("User session changed")}load(e,t=!0){super.load(e),t&&this._userLoaded.raise(e)}unload(){super.unload(),this._userUnloaded.raise()}addUserLoaded(e){return this._userLoaded.addHandler(e)}removeUserLoaded(e){return this._userLoaded.removeHandler(e)}addUserUnloaded(e){return this._userUnloaded.addHandler(e)}removeUserUnloaded(e){return this._userUnloaded.removeHandler(e)}addSilentRenewError(e){return this._silentRenewError.addHandler(e)}removeSilentRenewError(e){return this._silentRenewError.removeHandler(e)}_raiseSilentRenewError(e){this._silentRenewError.raise(e)}addUserSignedIn(e){return this._userSignedIn.addHandler(e)}removeUserSignedIn(e){this._userSignedIn.removeHandler(e)}_raiseUserSignedIn(){this._userSignedIn.raise()}addUserSignedOut(e){return this._userSignedOut.addHandler(e)}removeUserSignedOut(e){this._userSignedOut.removeHandler(e)}_raiseUserSignedOut(){this._userSignedOut.raise()}addUserSessionChanged(e){return this._userSessionChanged.addHandler(e)}removeUserSessionChanged(e){this._userSessionChanged.removeHandler(e)}_raiseUserSessionChanged(){this._userSessionChanged.raise()}},HL7=class{constructor(e){this._userManager=e,this._logger=new bh("SilentRenewService"),this._isStarted=!1,this._retryTimer=new i21("Retry Silent Renew"),this._tokenExpiring=async()=>{let t=this._logger.create("_tokenExpiring");try{await this._userManager.signinSilent(),t.debug("silent token renewal successful")}catch(r){if(r instanceof in0){t.warn("ErrorTimeout from signinSilent:",r,"retry in 5s"),this._retryTimer.init(5);return}t.error("Error from signinSilent:",r),this._userManager.events._raiseSilentRenewError(r)}}}async start(){let e=this._logger.create("start");if(!this._isStarted){this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring);try{await this._userManager.getUser()}catch(t){e.error("getUser error",t)}}}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}},kL7=class{constructor(e,t){this.refresh_token=e.refresh_token,this.id_token=e.id_token,this.session_state=e.session_state,this.scope=e.scope,this.profile=e.profile,this.resource=t,this.data=e.state}},TL7=class{constructor(e,t,r,a){this._logger=new bh("UserManager"),this.settings=new cT5(e),this._client=new rT5(e),this._redirectNavigator=t??new bL7(this.settings),this._popupNavigator=r??new zL7(this.settings),this._iframeNavigator=a??new wL7(this.settings),this._events=new SL7(this.settings),this._silentRenewService=new HL7(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new aT5(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}async getUser(){let e=this._logger.create("getUser"),t=await this._loadUser();return t?(e.info("user loaded"),this._events.load(t,!1),t):(e.info("user not found in storage"),null)}async removeUser(){let e=this._logger.create("removeUser");await this.storeUser(null),e.info("user removed from storage"),this._events.unload()}async signinRedirect(e={}){this._logger.create("signinRedirect");let{redirectMethod:t,...r}=e,a=await this._redirectNavigator.prepare({redirectMethod:t});await this._signinStart({request_type:"si:r",...r},a)}async signinRedirectCallback(e=window.location.href){let t=this._logger.create("signinRedirectCallback"),r=await this._signinEnd(e);return r.profile&&r.profile.sub?t.info("success, signed in subject",r.profile.sub):t.info("no subject"),r}async signinResourceOwnerCredentials({username:e,password:t,skipUserInfo:r=!1}){let a=this._logger.create("signinResourceOwnerCredential"),i=await this._client.processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:r,extraTokenParams:this.settings.extraTokenParams});a.debug("got signin response");let n=await this._buildUser(i);return n.profile&&n.profile.sub?a.info("success, signed in subject",n.profile.sub):a.info("no subject"),n}async signinPopup(e={}){let t=this._logger.create("signinPopup"),{popupWindowFeatures:r,popupWindowTarget:a,...i}=e,n=this.settings.popup_redirect_uri;n||t.throw(new Error("No popup_redirect_uri configured"));let o=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:a}),h=await this._signin({request_type:"si:p",redirect_uri:n,display:"popup",...i},o);return h&&(h.profile&&h.profile.sub?t.info("success, signed in subject",h.profile.sub):t.info("no subject")),h}async signinPopupCallback(e=window.location.href,t=!1){let r=this._logger.create("signinPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),r.info("success")}async signinSilent(e={}){var t;let r=this._logger.create("signinSilent"),{silentRequestTimeoutInSeconds:a,resource:i,...n}=e,o=await this._loadUser();if(o?.refresh_token){r.debug("using refresh token");let f=new kL7(o,i);return await this._useRefreshToken(f)}let h=this.settings.silent_redirect_uri;h||r.throw(new Error("No silent_redirect_uri configured"));let u;o&&this.settings.validateSubOnSilentRenew&&(r.debug("subject prior to silent renew:",o.profile.sub),u=o.profile.sub);let g=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:a});return o=await this._signin({request_type:"si:s",redirect_uri:h,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?o?.id_token:void 0,...n},g,u),o&&((t=o.profile)!=null&&t.sub?r.info("success, signed in subject",o.profile.sub):r.info("no subject")),o}async _useRefreshToken(e){let t=await this._client.useRefreshToken({state:e,timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds}),r=new gM2({...e,...t});return await this.storeUser(r),this._events.load(r),r}async signinSilentCallback(e=window.location.href){let t=this._logger.create("signinSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async signinCallback(e=window.location.href){let{state:t}=await this._client.readSigninResponseState(e);switch(t.request_type){case"si:r":return await this.signinRedirectCallback(e);case"si:p":return await this.signinPopupCallback(e);case"si:s":return await this.signinSilentCallback(e);default:throw new Error("invalid response_type in state")}}async signoutCallback(e=window.location.href,t=!1){let{state:r}=await this._client.readSignoutResponseState(e);if(r)switch(r.request_type){case"so:r":await this.signoutRedirectCallback(e);break;case"so:p":await this.signoutPopupCallback(e,t);break;case"so:s":await this.signoutSilentCallback(e);break;default:throw new Error("invalid response_type in state")}}async querySessionStatus(e={}){let t=this._logger.create("querySessionStatus"),{silentRequestTimeoutInSeconds:r,...a}=e,i=this.settings.silent_redirect_uri;i||t.throw(new Error("No silent_redirect_uri configured"));let n=await this._loadUser(),o=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:r}),h=await this._signinStart({request_type:"si:s",redirect_uri:i,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?n?.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0,...a},o);try{let u=await this._client.processSigninResponse(h.url);return t.debug("got signin response"),u.session_state&&u.profile.sub?(t.info("success for subject",u.profile.sub),{session_state:u.session_state,sub:u.profile.sub,sid:u.profile.sid}):(t.info("success, user not authenticated"),null)}catch(u){if(this.settings.monitorAnonymousSession&&u instanceof ML1)switch(u.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return t.info("success for anonymous user"),{session_state:u.session_state}}throw u}}async _signin(e,t,r){let a=await this._signinStart(e,t);return await this._signinEnd(a.url,r)}async _signinStart(e,t){let r=this._logger.create("_signinStart");try{let a=await this._client.createSigninRequest(e);return r.debug("got signin request"),await t.navigate({url:a.url,state:a.state.id,response_mode:a.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin})}catch(a){throw r.debug("error after preparing navigator, closing navigator window"),t.close(),a}}async _signinEnd(e,t){let r=this._logger.create("_signinEnd"),a=await this._client.processSigninResponse(e);return r.debug("got signin response"),await this._buildUser(a,t)}async _buildUser(e,t){let r=this._logger.create("_buildUser"),a=new gM2(e);if(t){if(t!==a.profile.sub)throw r.debug("current user does not match user returned from signin. sub from signin:",a.profile.sub),new ML1({...e,error:"login_required"});r.debug("current user matches user returned from signin")}return await this.storeUser(a),r.debug("user stored"),this._events.load(a),a}async signoutRedirect(e={}){let t=this._logger.create("signoutRedirect"),{redirectMethod:r,...a}=e,i=await this._redirectNavigator.prepare({redirectMethod:r});await this._signoutStart({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri,...a},i),t.info("success")}async signoutRedirectCallback(e=window.location.href){let t=this._logger.create("signoutRedirectCallback"),r=await this._signoutEnd(e);return t.info("success"),r}async signoutPopup(e={}){let t=this._logger.create("signoutPopup"),{popupWindowFeatures:r,popupWindowTarget:a,...i}=e,n=this.settings.popup_post_logout_redirect_uri,o=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:a});await this._signout({request_type:"so:p",post_logout_redirect_uri:n,state:n==null?void 0:{},...i},o),t.info("success")}async signoutPopupCallback(e=window.location.href,t=!1){let r=this._logger.create("signoutPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),r.info("success")}async _signout(e,t){let r=await this._signoutStart(e,t);return await this._signoutEnd(r.url)}async _signoutStart(e={},t){var r;let a=this._logger.create("_signoutStart");try{let i=await this._loadUser();a.debug("loaded current user from storage"),this.settings.revokeTokensOnSignout&&await this._revokeInternal(i);let n=e.id_token_hint||i&&i.id_token;n&&(a.debug("setting id_token_hint in signout request"),e.id_token_hint=n),await this.removeUser(),a.debug("user removed, creating signout request");let o=await this._client.createSignoutRequest(e);return a.debug("got signout request"),await t.navigate({url:o.url,state:(r=o.state)==null?void 0:r.id,scriptOrigin:this.settings.iframeScriptOrigin})}catch(i){throw a.debug("error after preparing navigator, closing navigator window"),t.close(),i}}async _signoutEnd(e){let t=this._logger.create("_signoutEnd"),r=await this._client.processSignoutResponse(e);return t.debug("got signout response"),r}async signoutSilent(e={}){var t;let r=this._logger.create("signoutSilent"),{silentRequestTimeoutInSeconds:a,...i}=e,n=this.settings.includeIdTokenInSilentSignout?(t=await this._loadUser())==null?void 0:t.id_token:void 0,o=this.settings.popup_post_logout_redirect_uri,h=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:a});await this._signout({request_type:"so:s",post_logout_redirect_uri:o,id_token_hint:n,...i},h),r.info("success")}async signoutSilentCallback(e=window.location.href){let t=this._logger.create("signoutSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async revokeTokens(e){let t=await this._loadUser();await this._revokeInternal(t,e)}async _revokeInternal(e,t=this.settings.revokeTokenTypes){let r=this._logger.create("_revokeInternal");if(!e)return;let a=t.filter(i=>typeof e[i]=="string");if(!a.length){r.debug("no need to revoke due to no token(s)");return}for(let i of a)await this._client.revokeToken(e[i],i),r.info(`${i} revoked successfully`),i!=="access_token"&&(e[i]=null);await this.storeUser(e),r.debug("user stored"),this._events.load(e)}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}async _loadUser(){let e=this._logger.create("_loadUser"),t=await this.settings.userStore.get(this._userStoreKey);return t?(e.debug("user storageString loaded"),gM2.fromStorageString(t)):(e.debug("no user storageString"),null)}async storeUser(e){let t=this._logger.create("storeUser");if(e){t.debug("storing user");let r=e.toStorageString();await this.settings.userStore.set(this._userStoreKey,r)}else this._logger.debug("removing user"),await this.settings.userStore.remove(this._userStoreKey)}async clearStaleState(){await this._client.clearStaleState()}},BL7="2.4.0",VL7=BL7});async function hT5(e,t,r,a=PL7){let i=new AbortController,n=setTimeout(()=>i.abort(),a);try{let o=await fetch(e,{...t,signal:i.signal});return await r(o)}finally{clearTimeout(n)}}var PL7,wZ4,yZ4,AZ4=C1(()=>{dj();PL7=1e4;wZ4=async(e,t)=>hT5(io2(e,`api/organization/${e}`),{headers:{Authorization:`Bearer ${t}`}},async r=>{if(r.status===401)throw new Error("Unauthorized");if(!r.ok)throw new Error(`Failed to fetch organization: ${r.status} ${r.statusText}`);return r.json()}),yZ4=async(e,t,r)=>hT5(r?J03(e,`api/organization/${e}/tenants`,r):io2(e,`api/organization/${e}/tenants`),{headers:{Authorization:`Bearer ${t}`}},async a=>{if(a.status===401)throw new Error("Unauthorized");if(!a.ok)throw new Error(`Failed to fetch tenants: ${a.status} ${a.statusText}`);let i=await a.json(),n=i.value||i.items||i;if(!Array.isArray(n))throw console.error("[getTenants] Expected array but got:",typeof n),new Error("Invalid tenants response: expected an array");return console.debug(`[getTenants] received ${n.length} tenant(s)`),n})});var Ur,MW=C1(()=>{Ur={Initialized:"Delegate.Initialized",TaskInitiated:"Delegate.TaskInitiated",ComputerStateGetBatch:"ComputerState.GetBatch",ComputerStateInteropRecovery:"ComputerState.InteropRecovery",HttpResponse:"Delegate.HttpResponse",HttpRequestDenied:"Delegate.Http.RequestDenied",HttpClientRetry:"Delegate.HttpClient.Retry",HttpClientRetryExhausted:"Delegate.HttpClient.RetryExhausted",HttpClientCachePoison:"Delegate.HttpClient.CachePoison",ChatFrameworkInitFetchSessionsFailed:"Delegate.ChatFramework.Init.FetchSessionsFailed",UpdateCheckRequested:"Delegate.UpdateCheckRequested",UpdateAvailable:"Delegate.UpdateAvailable",UpdateNotAvailable:"Delegate.UpdateNotAvailable",UpdateDownloaded:"Delegate.UpdateDownloaded",UpdateInstallRequested:"Delegate.UpdateInstallRequested",UpdateInstallSucceeded:"Delegate.UpdateInstallSucceeded",UpdateDismissed:"Delegate.UpdateDismissed",UpdateError:"Delegate.UpdateError",AutoUpdateFeedSet:"Delegate.AutoUpdateFeedSet",AutoUpdateFeedPolled:"Delegate.AutoUpdateFeedPolled",SkillCreated:"Delegate.SkillCreated",SkillImported:"Delegate.SkillImported",RoutineCreated:"Delegate.RoutineCreated",ProgressCurrentFallback:"progress_current_fallback",ProgressParseFailed:"progress_parse_failed",ConnectorAdded:"Delegate.ConnectorAdded",RecordingCreated:"Delegate.RecordingCreated",UserFeedback:"UserFeedback",SSEConnectionRetry:"Delegate.SSE.ConnectionRetry",SSEConnectionRetryExhausted:"Delegate.SSE.ConnectionRetryExhausted",SSEGatewayRetry:"Delegate.SSE.GatewayRetry",SSEGatewayRetryExhausted:"Delegate.SSE.GatewayRetryExhausted",SSEIdleAbort:"Delegate.SSE.IdleAbort",SSEConnectTimeout:"Delegate.SSE.ConnectTimeout",ToolSyncFailed:"Delegate.ToolExecution.SyncFailed",SSENetworkRetry:"Delegate.SSE.NetworkRetry",SSENetworkRetryExhausted:"Delegate.SSE.NetworkRetryExhausted",SSEParseError:"Delegate.SSE.ParseError",SSEStreamError:"Delegate.SSE.StreamError",SSEUnsupportedAttachmentRetry:"Delegate.SSE.UnsupportedAttachmentRetry",SSEJwtExpiredAutoRefresh:"Delegate.SSE.JwtExpiredAutoRefresh",AgenticLoopThinkOnlyResponse:"Delegate.AgenticLoop.ThinkOnlyResponse",ToolExecutionDoomLoop:"Delegate.Tool.DoomLoopDetected",ToolExecutionRecoveryAction:"Delegate.Tool.RecoveryAction",ToolExecutionOrphaned:"Delegate.Tool.OrphanedExecution",ToolExecutionValidationError:"Delegate.Tool.ValidationError",ToolExecutionThrew:"Delegate.Tool.ExecutionThrew",ToolExecutionFailed:"Delegate.Tool.ExecutionFailed",ToolRiskClassification:"Delegate.Tool.RiskClassification",ToolClassificationDowngrade:"Delegate.Tool.ClassificationDowngrade",ToolAllowlistBeatUnrecoverable:"Delegate.Tool.AllowlistBeatUnrecoverable",ProjectAccessPolicySnapshot:"Delegate.ProjectAccess.PolicySnapshot",ProjectAccessCapabilityDecision:"Delegate.ProjectAccess.CapabilityDecision",ProjectAccessResourceLifecycle:"Delegate.ProjectAccess.ResourceLifecycle",ProjectAccessCleanup:"Delegate.ProjectAccess.Cleanup",SandboxCapabilityDecision:"Delegate.Sandbox.CapabilityDecision",SandboxAvailability:"Delegate.Sandbox.Availability",SandboxPolicyChanged:"Delegate.Sandbox.PolicyChanged",SandboxFilesystemDecision:"Delegate.Sandbox.FilesystemDecision",SandboxOperationDenied:"Delegate.Sandbox.OperationDenied",AuthInvalidGrant:"Delegate.Auth.InvalidGrant",AuthRefreshRetryExhausted:"Delegate.Auth.RefreshRetryExhausted",AuthRestoreFailed:"Delegate.Auth.RestoreFailed",SessionRestoreFailed:"Delegate.Session.RestoreFailed",SessionCreateFailed:"Delegate.Session.CreateFailed",ClipboardOperationFailed:"Delegate.Clipboard.OperationFailed",AskUserResumeAttempted:"Delegate.AskUser.ResumeAttempted",AskUserResumeFailed:"Delegate.AskUser.ResumeFailed",AuthOrgInvalidAutoLogout:"Delegate.Auth.OrgInvalidAutoLogout",AuthOrgNotEntitled:"Delegate.Auth.OrgNotEntitled",AuthAssistantCloudUnsupported:"Delegate.Auth.AssistantCloudUnsupported",BackgroundSubModeSelected:"Delegate.BackgroundSubMode.Selected",UnifiedPipSpawnFailed:"Delegate.Unified.PipSpawnFailed",SeededToolCallOutcome:"Delegate.SeededToolCall.Outcome",AnswerNowClicked:"Delegate.AnswerNow.Clicked",OnSendMessage:"Biz.Framework.OnSendMessage",OnCreateSession:"Biz.Framework.OnCreateSession",OnToolExecution:"Biz.Framework.OnToolExecution",ToolPayloadsReceived:"Biz.Framework.ToolPayloadsReceived",ToolExecutionStarted:"Biz.Framework.ToolExecutionStarted",ToolExecutionCompleted:"Biz.Framework.ToolExecutionCompleted",BizToolExecutionFailed:"Biz.Framework.ToolExecutionFailed",ToolExecutionInterrupted:"Biz.Framework.ToolExecutionInterrupted",ToolExecutionInvalidProperties:"Biz.Framework.ToolExecutionInvalidProperties",ToolExecutionReverted:"Biz.Framework.ToolExecutionReverted",ToolExecutionPreviewAccepted:"Biz.Framework.ToolExecutionPreviewAccepted",ToolExecutionPreviewRejected:"Biz.Framework.ToolExecutionPreviewRejected",Feedback:"Biz.Framework.Feedback",OnCopyToClipboard:"Biz.Framework.OnCopyToClipboard",SetOperatingModel:"Biz.Framework.SetOperatingModel",SetOperatingMode:"Biz.Framework.SetOperatingMode",DeepLinkReceived:"Delegate.DeepLink.Received",DeepLinkConfirmShown:"Delegate.DeepLink.ConfirmShown",DeepLinkResolved:"Delegate.DeepLink.Resolved",ExternalConversationsImported:"Delegate.ExternalConversations.Imported"}});function Z_1(e){return e&&(e.length>32768?e.slice(0,32768):e).replace(_L7,"C:\\Users\\[REDACTED]\\").replace(EL7,"/Users/[REDACTED]/").replace(RL7,"[EMAIL_REDACTED]")}function dT5(e){let t=new Error(Z_1(e.message));return t.name=Z_1(e.name),e.stack&&(t.stack=Z_1(e.stack)),t}function BQ1(e){return typeof e=="string"?Z_1(e):Array.isArray(e)?e.map(t=>BQ1(t)):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,r])=>[t,BQ1(r)])):e}var _L7,EL7,RL7,on0=C1(()=>{_L7=/C:\\Users\\[^\\]+\\/gi,EL7=/\/Users\/[^/]+\//g,RL7=/[a-zA-Z0-9._%+-]{1,64}@[a-zA-Z0-9.-]{1,253}\.[a-zA-Z]{2,10}/g});var ZL7,uT5,gT5,ln0,T91,FL7,pT5,xL1=C1(()=>{wu();n21();dj();no2();ZL7=(e,t,r=!1,a)=>r||a?!1:e==="true"?!0:!t;console.log("[backendUrl] Module loaded - VITE_USE_CLOUD_URL:",process.env.VITE_USE_CLOUD_URL,"backend URL set:",!!Fx?.explicitBackendUrl);uT5=()=>ZL7(process.env.VITE_USE_CLOUD_URL,Fx?.explicitBackendUrl,!!Fh1,Fx?.e2eRuntimeBackendUrl),gT5=()=>{let{organization:e,tenant:t}=Mr.getState(),r=e?.logicalName||"",a=t?.name||"";if(!r||!a){let i=!r&&!a?"organization and tenant":r?"tenant":"organization";throw console.error(`[backendUrl] Missing ${i} \u2014 cannot build cloud URL. org=${r||"(empty)"}, tenant=${a||"(empty)"}`),new Error(`Cannot connect to backend: missing ${i}. Please sign out and sign in again.`)}return tk1(FM,r,a)},ln0=async()=>{if(uT5()){let e=gT5();return console.log("[backendUrl] Using cloud URL:",e),e}return console.log("[backendUrl] Using direct backend URL:",Fx.apiBaseUrl),Fx.apiBaseUrl},T91=()=>{if(uT5())try{return gT5()}catch{return""}return Fx.apiBaseUrl},FL7=()=>FM,pT5=()=>{let{organization:e,tenant:t}=Mr.getState(),r=FL7(),a=e?.logicalName||"",i=t?.name||"";return`${r}/${a}/${i}`}});var fT5=C1(()=>{MU2()});var vT5,zZ4,Vr,o21=C1(()=>{Rj2();vT5=w4(Km(),1);wu();wd();MU2();n21();dj();on0();xL1();MW();ri0();fT5();zZ4=class{constructor(){this._namePrefix="Delegate";this._tracker=null;this._connectionString=null;this._isInitialized=!1;this._trackerInstanceId=(0,vT5.v4)();this._sharedTrackerIdReady=Promise.resolve();this._crashReportsEnabled=!0;this._additionalProperties={}}setCrashReportsEnabled(t){this._crashReportsEnabled=t}setAdditionalProperties(t){this._additionalProperties=Object.fromEntries(Object.entries(t).filter(([,r])=>r!=null&&r!==""))}isCrashReportsEnabled(){return this._crashReportsEnabled}initialize(t,{clientApplication:r="Delegate"}={}){if(!this._isInitialized){if(this._connectionString=t||{}.APP_INSIGHTS_CONNECTION_STR||null,!this._connectionString){console.warn("[TelemetryService] No App Insights connection string provided, telemetry disabled");return}try{let a=mr3.withConfig({connectionString:this._connectionString,namePrefix:this._namePrefix,disableFetchTracking:!0,disableAjaxTracking:!0}).build();this._tracker=new _j2(Bx.External,"UiPath.Delegate",a),this._tracker.initialize({isDevelopment:process.env.NODE_ENV==="development",language:"en-US",preserveQueryParams:!0}),this._tracker.setMetadata({TrackerInstanceId:this._trackerInstanceId,ApplicationArea:this._parseTelemetryArea(),ClientApplication:r}),this._isInitialized=!0,console.log("[TelemetryService] Initialized successfully"),this._sharedTrackerIdReady=(window.electronAPI?.getTrackerInstanceId?.()??Promise.resolve("")).then(i=>{i&&(this._trackerInstanceId=i,this._tracker?.setMetadata({TrackerInstanceId:i}))}).catch(()=>{})}catch(a){console.error("[TelemetryService] Failed to initialize:",a)}}}async trackEvent(t,r,a,i){if(!this._tracker||!this._crashReportsEnabled)return;let n,o;typeof r=="object"?o=r:(n=r,o=i);let h=await this._getEnhancedProperties(o,n,a);this._tracker.trackEvent(t,h)}async sendBugTraceContent(t,r){if(!this._tracker)throw new Error("Telemetry not initialized");let a=7500,i=[];for(let n=0;n<t.length;n+=a)i.push(t.slice(n,n+a));for(let n=0;n<i.length;n++)await this.trackEvent("BugTrace.ContentChunk",{correlationId:r.correlationId,sessionId:r.sessionId,chunkIndex:n,totalChunks:i.length,chunk:i[n]})}async trackFeedback(t,r,a){await this.trackEvent(Ur.UserFeedback,{feedback:t,page:r,sessionId:st.getState().currentSessionId,...a})}async trackError(t,r,a,i,n){if(!this._tracker||!this._crashReportsEnabled)return;let o=await this._getEnhancedProperties(n,a,i);this._tracker.trackError(dT5(t),r??GF.Major,o)}async trackTrace(t,r,a,i,n){if(!this._tracker||!this._crashReportsEnabled)return;let o=await this._getEnhancedProperties(n,a,i);this._tracker.trackTrace(Z_1(t),r??GF.Info,o)}async trackApplicationStart(t){if(!this._tracker||!this._crashReportsEnabled)return;await this._sharedTrackerIdReady;let r=await this._getEnhancedProperties(t);this._tracker.trackApplicationStart(r)}async _getEnhancedProperties(t,r,a){let i=Mr.getState(),{user:n,organization:o,tenant:h}=i,u=n?.profile?.sub||null,g=n?.profile?.email||null,f=h?.id||null,v=h?.name||null,C=o?.id||null,L=o?.name||null,y={"x-uipath-organization-id":C,"x-uipath-organization-name":L,"x-uipath-tenant-id":f,"x-uipath-tenant-name":v,"x-uipath-user-id":u};g?.endsWith("@uipath.com")&&(y["x-uipath-is-internal-user"]="true");let{modelId:z,modelType:S}=VS5(),B=this._resolveSessionId(t,r),R=B?a??st.getState().selectTurnCorrelationId(B):a,F={...z?{"x-delegate-model-id":z}:{},...S?{"x-delegate-model-type":S}:{},...B?{"x-autopilot-session-id":B}:{},...R?{"x-autopilot-turn-correlation-id":R}:{}},j=this._additionalProperties.licenseType?.toLowerCase().replace(/\s+/g,"")==="community",Y=t?.SendMessage&&!j?{...t,SendMessage:""}:t,t1={...y,...F,"x-delegate-agent":Fx.agentName,"x-delegate-version":"0.1.3",timestamp:new Date().toISOString(),...Y??{},...this._additionalProperties};return Object.fromEntries(Object.entries(t1).filter(([,n1])=>n1!=null).map(([n1,a1])=>[n1,typeof a1=="string"?Z_1(a1):a1]))}_resolveSessionId(t,r){if(r)return r;let a=t?.sessionId;return typeof a=="string"&&a?a:void 0}getArea(){return this._parseTelemetryArea()}_parseTelemetryArea(){let t=T91().toLowerCase(),r=t||FM.toLowerCase();return t.includes("localhost")?"local":r.includes("nst.kubefabric")?"nst":r.includes("alpha")||r.includes("-alp-")?"alpha":r.includes("staging")||r.includes("-stg-")?"staging":r.includes("cloud")||r.includes("-prd-")?"production":"local"}async initializeTelemetry(t,r,a,i,n){this.initialize(t)}async updateTrackerLanguage(t){}get isEnabled(){return this._isInitialized&&this._tracker!==null}},Vr=new zZ4});function mT5(){if(!(typeof window>"u"||typeof localStorage>"u"))try{let t=Object.keys(localStorage).filter(r=>r.startsWith("oidc."));if(t.length>1){let r=null,a=0;for(let i of t)try{let n=localStorage.getItem(i);if(n){let h=JSON.parse(n).created||0;h>a&&(a=h,r=i)}}catch{}for(let i of t)i!==r&&localStorage.removeItem(i)}}catch(e){console.error("Failed to cleanup old OIDC sessions:",e)}}function CT5(){if(!(typeof window>"u"||typeof localStorage>"u"))try{Object.keys(localStorage).forEach(t=>{t.startsWith("oidc.")&&localStorage.removeItem(t)})}catch(e){console.error("Failed to clean OIDC data from localStorage:",e)}}var bZ4=C1(()=>{});function DL7(e){return e.map(t=>{if(t instanceof Error)return t.stack??t.message;if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}).join(" ")}function cn0(e){let t=SZ4.default.getLogger(e);return t.methodFactory!==MT5&&(t.methodFactory=MT5,t.setLevel(t.getLevel())),t.getLevel()||t.setLevel(process.env.NODE_ENV==="production"?"warn":"debug"),t}var SZ4,IL7,MT5,HZ4=C1(()=>{SZ4=w4(eU2(),1);IL7=SZ4.default.methodFactory,MT5=(e,t,r)=>{let a=IL7(e,t,r);return e!=="warn"&&e!=="error"?a:(...i)=>{a(...i);let n=typeof window<"u"?window.debugApi:void 0;if(!n)return;let o=`[${String(r)}] ${DL7(i)}`;e==="error"?n.logError?.(o):n.logWarn?.(o)}}});function cY(e,t,r){return new Promise((a,i)=>{let n=setTimeout(()=>{i(new Error(`${r} timed out after ${t}ms`))},t);e.then(o=>{clearTimeout(n),a(o)},o=>{clearTimeout(n),i(o)})})}function kZ4(e,t,r){return t.aborted?Promise.reject(new Error(`${r} aborted`)):new Promise((a,i)=>{let n=()=>i(new Error(`${r} aborted`));t.addEventListener("abort",n,{once:!0}),e.then(o=>{t.removeEventListener("abort",n),a(o)},o=>{t.removeEventListener("abort",n),i(o)})})}var VQ1=C1(()=>{});function jL7(e){try{let t=new URL(e).hostname.toLowerCase();return t==="alpha.uipath.com"||t.endsWith(".alpha.uipath.com")}catch{return!1}}function LT5(e,t){return e&&!jL7(t)?GL7:null}var NL7,UL7,xT5,QZi,GL7,wT5=C1(()=>{NL7="localhost",UL7="/portal_/loginsuccess",xT5=`http://${NL7}:3000${UL7}`,QZi=300*1e3,GL7="Named Delegate dev instances require alpha Identity because they use a localhost OAuth redirect for isolation. Staging and production reject that redirect URI."});function yT5(e){let t=WL7.exec(e);if(!t)return null;let[r,a,i]=t;return{org:a,tenant:i,basePath:r}}function AT5(e,t){let r=t.tenant?`/${t.tenant}`:"";return`${e}/${t.org}${r}/delegate_/loginsuccess`}var WL7,zT5=C1(()=>{WL7=/^\/([^/]+)(?:\/([^/]+))?\/delegate_(?=\/|$)/});function bT5(e){let t=yT5(e.pathname);return t?{clientId:sn0,redirectUri:AT5(e.origin,t),portalRoute:t}:{clientId:sn0,redirectUri:`${e.origin}/portal_/loginsuccess`,portalRoute:null}}var sn0,ST5=C1(()=>{zT5();sn0="9a04590e-e000-443d-b1b2-8a22ac6ad018"});var vM2,qL7,$L7,TZ4,KL7,TT5,HT5,YL7,kT5,hn0,BZ4=C1(()=>{wu();ZE4();dj();wT5();ST5();vM2=i04,qL7=typeof window<"u"&&window.electronAPI?.isE2EMode===!0,$L7=typeof window<"u"&&window.electronAPI?.isInstalledAppE2E===!0,TZ4=pZ?bT5(window.location):null,KL7=typeof window<"u"?ZC2({},process.env.NODE_ENV==="development"):null,TT5=!pZ&&!!KL7,HT5=LT5(TT5,vM2);HT5&&console.warn(`[Auth] ${HT5}`);YL7=qL7&&!$L7||TT5,kT5=TZ4?TZ4.redirectUri:YL7?xT5:"com.uipath.delegate.oidc://oauthredirect",hn0={authority:vM2,redirect_uri:kT5,response_type:"code",silent_redirect_uri:kT5,overrides:{client_id:TZ4?.clientId??sn0,scope:"openid profile email ConnectionService ConnectionServiceUser CustomerPortal DataService DataServiceApiUserAccess DocumentUnderstanding Du.Metering Du.Digitization.Api Du.Classification.Api Du.Extraction.Api Du.Validation.Api Du.Storage.PresignedUrl Docs.GPT.Search Docs.Service Directory IdentityServerApi OrchestratorApiUserAccess ReferenceToken LLMGateway LLMOps Traces.Api OMS PIMS Relay.Service RCS.FolderAuthorization Robot.Local SRS.Recommendations SRS.Events SCP.Jobs.Read SCP.Runtimes SCP.Runtimes.Read StudioWebBackend StudioWebTypeCacheService TM.Projects TM.TestCases TM.TestExecutions TM.Requirements TM.TestSets TestmanagerApiUserAccess TM.Attachments TM.ObjectLabels TM.CustomFieldDefinitions TM.CustomFieldValues TM.PerformanceScenarios TM.PerformanceScenarioExecutions offline_access"},automaticSilentRenew:!1,monitorSession:!1,silentRequestTimeoutInSeconds:2,useRefreshToken:!0,iframeNotifyParentTimeoutInSeconds:2,loadUserInfo:!1,checkSessionIntervalInSeconds:0}});var _Q1=M1((hFi,ET5)=>{"use strict";var XL7=Object.create,un0=Object.defineProperty,JL7=Object.getOwnPropertyDescriptor,QL7=Object.getOwnPropertyNames,tw7=Object.getPrototypeOf,ew7=Object.prototype.hasOwnProperty,rw7=(e,t)=>{for(var r in t)un0(e,r,{get:t[r],enumerable:!0})},VT5=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of QL7(t))!ew7.call(e,i)&&i!==r&&un0(e,i,{get:()=>t[i],enumerable:!(a=JL7(t,i))||a.enumerable});return e},PQ1=(e,t,r)=>(r=e!=null?XL7(tw7(e)):{},VT5(t||!e||!e.__esModule?un0(r,"default",{value:e,enumerable:!0}):r,e)),aw7=e=>VT5(un0({},"__esModule",{value:!0}),e),PT5={};rw7(PT5,{AuthContext:()=>gn0,AuthProvider:()=>gw7,hasAuthParams:()=>pn0,useAuth:()=>fn0,useAutoSignin:()=>fw7,withAuth:()=>mw7,withAuthenticationRequired:()=>Cw7});ET5.exports=aw7(PT5);var iw7=PQ1(rr()),gn0=iw7.default.createContext(void 0);gn0.displayName="AuthContext";var nw7=TQ1(),Wh1=PQ1(rr()),ow7={isLoading:!0,isAuthenticated:!1},lw7=(e,t)=>{switch(t.type){case"INITIALISED":case"USER_LOADED":return{...e,user:t.user,isLoading:!1,isAuthenticated:t.user?!t.user.expired:!1,error:void 0};case"USER_SIGNED_OUT":case"USER_UNLOADED":return{...e,user:void 0,isAuthenticated:!1};case"NAVIGATOR_INIT":return{...e,isLoading:!0,activeNavigator:t.method};case"NAVIGATOR_CLOSE":return{...e,isLoading:!1,activeNavigator:void 0};case"ERROR":{let r=t.error;return r.toString=()=>`${r.name}: ${r.message}`,{...e,isLoading:!1,error:r}}default:{let r=new TypeError(`unknown type ${t.type}`),a={name:r.name,message:r.message,innerError:r,stack:r.stack,source:"unknown"};return a.toString=()=>`${a.name}: ${a.message}`,{...e,isLoading:!1,error:a}}}},pn0=(e=window.location)=>{let t=new URLSearchParams(e.search);return!!((t.get("code")||t.get("error"))&&t.get("state")||(t=new URLSearchParams(e.hash.replace("#","?")),(t.get("code")||t.get("error"))&&t.get("state")))},cw7=EZ4("signinCallback","Sign-in failed"),sw7=EZ4("signoutCallback","Sign-out failed"),hw7=EZ4("renewSilent","Renew silent failed");function _T5(e,t){return{name:VZ4(e,"name",()=>"Error"),message:VZ4(e,"message",()=>t),stack:VZ4(e,"stack",()=>new Error().stack),innerError:e}}function EZ4(e,t){return r=>({..._T5(r,t),source:e})}function VZ4(e,t,r){if(e&&typeof e=="object"){let a=e[t];if(typeof a=="string")return a}return r()}var dw7=["clearStaleState","querySessionStatus","revokeTokens","startSilentRenew","stopSilentRenew"],uw7=["signinPopup","signinSilent","signinRedirect","signinResourceOwnerCredentials","signoutPopup","signoutRedirect","signoutSilent"],PZ4=e=>()=>{throw new Error(`UserManager#${e} was called from an unsupported context. If this is a server-rendered page, defer this call with useEffect() or pass a custom UserManager implementation.`)},BT5=typeof window>"u"?null:nw7.UserManager,gw7=e=>{let{children:t,onSigninCallback:r,skipSigninCallback:a,matchSignoutCallback:i,onSignoutCallback:n,onRemoveUser:o,userManager:h=null,...u}=e,[g]=Wh1.default.useState(()=>h??(BT5?new BT5(u):{settings:u})),[f,v]=Wh1.default.useReducer(lw7,ow7),C=Wh1.default.useMemo(()=>Object.assign({settings:g.settings,events:g.events},Object.fromEntries(dw7.map(S=>{var B,R;return[S,(R=(B=g[S])==null?void 0:B.bind(g))!=null?R:PZ4(S)]})),Object.fromEntries(uw7.map(S=>[S,g[S]?async B=>{v({type:"NAVIGATOR_INIT",method:S});try{return await g[S](B)}catch(R){return v({type:"ERROR",error:{..._T5(R,`Unknown error while executing ${S}(...).`),source:S,args:B}}),null}finally{v({type:"NAVIGATOR_CLOSE"})}}:PZ4(S)]))),[g]),L=Wh1.default.useRef(!1);Wh1.default.useEffect(()=>{!g||L.current||(L.current=!0,(async()=>{try{let S=null;pn0()&&!a&&(S=await g.signinCallback(),r&&await r(S)),S=S||await g.getUser(),v({type:"INITIALISED",user:S})}catch(S){v({type:"ERROR",error:cw7(S)})}try{if(i&&i(g.settings)){let S=await g.signoutCallback();n&&await n(S)}}catch(S){v({type:"ERROR",error:sw7(S)})}})())},[g,a,r,n,i]),Wh1.default.useEffect(()=>{if(!g)return;let S=N=>{v({type:"USER_LOADED",user:N})};g.events.addUserLoaded(S);let B=()=>{v({type:"USER_UNLOADED"})};g.events.addUserUnloaded(B);let R=()=>{v({type:"USER_SIGNED_OUT"})};g.events.addUserSignedOut(R);let F=N=>{v({type:"ERROR",error:hw7(N)})};return g.events.addSilentRenewError(F),()=>{g.events.removeUserLoaded(S),g.events.removeUserUnloaded(B),g.events.removeUserSignedOut(R),g.events.removeSilentRenewError(F)}},[g]);let y=Wh1.default.useCallback(async()=>{g||PZ4("removeUser"),await g.removeUser(),o&&await o()},[g,o]),z=Wh1.default.useMemo(()=>({...f,...C,removeUser:y}),[f,C,y]);return Wh1.default.createElement(gn0.Provider,{value:z},t)},pw7=PQ1(rr()),fn0=()=>{let e=pw7.default.useContext(gn0);return e||console.warn("AuthProvider context is undefined, please verify you are calling useAuth() as child of a <AuthProvider> component."),e},_Z4=PQ1(rr()),fw7=({signinMethod:e="signinRedirect"}={})=>{let t=fn0(),[r,a]=_Z4.default.useState(!1),i=_Z4.default.useMemo(()=>!pn0()&&!t.isAuthenticated&&!t.activeNavigator&&!t.isLoading&&!r,[t.activeNavigator,t.isAuthenticated,t.isLoading,r]);return _Z4.default.useEffect(()=>{i&&(e==="signinPopup"?t.signinPopup():t.signinRedirect(),a(!0))},[t,r,i,e]),{isLoading:t.isLoading,isAuthenticated:t.isAuthenticated,error:t.error}},vw7=PQ1(rr());function mw7(e){let t=`withAuth(${e.displayName||e.name})`,r=a=>{let i=fn0();return vw7.default.createElement(e,{...a,auth:i})};return r.displayName=t,r}var dn0=PQ1(rr()),Cw7=(e,t={})=>{let{OnRedirecting:r=()=>dn0.default.createElement(dn0.default.Fragment,null),onBeforeSignin:a,signinRedirectArgs:i}=t,n=`withAuthenticationRequired(${e.displayName||e.name})`,o=h=>{let u=fn0();return dn0.default.useEffect(()=>{pn0()||u.isLoading||u.activeNavigator||u.isAuthenticated||(async()=>(a&&await a(),await u.signinRedirect(i)))()},[u.isLoading,u.isAuthenticated,u]),u.isAuthenticated?dn0.default.createElement(e,{...h}):r()};return o.displayName=n,o}});var RT5=M1((RZ4,ZZ4)=>{(function(e,t){typeof RZ4=="object"&&typeof ZZ4<"u"?ZZ4.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,(function(){var r=e.Cookies,a=e.Cookies=t();a.noConflict=function(){return e.Cookies=r,a}})())})(RZ4,(function(){"use strict";function e(i){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var h in o)i[h]=o[h]}return i}var t={read:function(i){return i[0]==='"'&&(i=i.slice(1,-1)),i.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(i){return encodeURIComponent(i).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function r(i,n){function o(u,g,f){if(!(typeof document>"u")){f=e({},n,f),typeof f.expires=="number"&&(f.expires=new Date(Date.now()+f.expires*864e5)),f.expires&&(f.expires=f.expires.toUTCString()),u=encodeURIComponent(u).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var v="";for(var C in f)f[C]&&(v+="; "+C,f[C]!==!0&&(v+="="+f[C].split(";")[0]));return document.cookie=u+"="+i.write(g,u)+v}}function h(u){if(!(typeof document>"u"||arguments.length&&!u)){for(var g=document.cookie?document.cookie.split("; "):[],f={},v=0;v<g.length;v++){var C=g[v].split("="),L=C.slice(1).join("=");try{var y=decodeURIComponent(C[0]);if(f[y]=i.read(L,y),u===y)break}catch{}}return u?f[u]:f}}return Object.create({set:o,get:h,remove:function(u,g){o(u,"",e({},g,{expires:-1}))},withAttributes:function(u){return r(this.converter,e({},this.attributes,u))},withConverter:function(u){return r(e({},this.converter,u),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(i)}})}var a=r(t,{path:"/"});return a}))});var Mn0=M1((dFi,WT5)=>{"use strict";var Mw7=Object.create,Cn0=Object.defineProperty,xw7=Object.getOwnPropertyDescriptor,Lw7=Object.getOwnPropertyNames,ww7=Object.getPrototypeOf,yw7=Object.prototype.hasOwnProperty,Aw7=(e,t)=>{for(var r in t)Cn0(e,r,{get:t[r],enumerable:!0})},FT5=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Lw7(t))!yw7.call(e,i)&&i!==r&&Cn0(e,i,{get:()=>t[i],enumerable:!(a=xw7(t,i))||a.enumerable});return e},zw7=(e,t,r)=>(r=e!=null?Mw7(ww7(e)):{},FT5(t||!e||!e.__esModule?Cn0(r,"default",{value:e,enumerable:!0}):r,e)),bw7=e=>FT5(Cn0({},"__esModule",{value:!0}),e),OT5={};Aw7(OT5,{AuthLogger:()=>NT5,IdentityUserManager:()=>Uw7,InMemoryWebStorage:()=>mM2.InMemoryWebStorage,Log:()=>mM2.Log,UberClientId:()=>jT5,User:()=>mM2.User,UserManager:()=>mM2.UserManager,WebStorageStateStore:()=>mM2.WebStorageStateStore,WellKnownAuthErrors:()=>GT5,getAccessToken:()=>Bw7,getIdToken:()=>Vw7,getIdentityAuthority:()=>DT5,getUser:()=>Pw7,getUserManager:()=>Ew7,hasValidSession:()=>IT5,setUserManager:()=>UT5,validateReturnUrl:()=>_w7});WT5.exports=bw7(OT5);var Sw7=["plt-nst-tms-we-01-apim.azure-api.net","alpha.uipath.com","staging.uipath.com","cloud.uipath.com","staging.gov.uipath-dev.com","alpha.gov.uipath-dev.com","govcloud.uipath.us"];function DT5(e){let t=window.location.host;return Sw7.includes(t)?`https://${t}/identity_`:`https://${t}/${e?"identity":"identity_"}`}var vn0=zw7(RT5()),Hw7=Km(),mn0="UiPathIdentitySessionId";function FZ4(){vn0.default.get(mn0)||vn0.default.set(mn0,(0,Hw7.v4)(),{path:"/",secure:!0})}function kw7(){vn0.default.remove(mn0,{path:"/",domain:window.location.hostname,secure:!0})}function Tw7(){return vn0.default.get(mn0)}function Bw7(){return window.User?.access_token}function Vw7(){return window.User?.id_token}function Pw7(){return window.User??null}function IT5(){return!!Tw7()}var NT5=class CM2{static instance;constructor(){}static getInstance(){return CM2.instance||(CM2.instance=new CM2),CM2.instance}error(t,...r){console.error(t,...r)}info(t,...r){console.log(t,...r)}debug(t,...r){console.log(t,...r)}warn(t,...r){console.warn(t,...r)}};function _w7(e){if(!e)return!1;if(e==="/")return!0;let t=/^\/[a-zA-Z0-9_\-/():]*(\?[\w%&\-=,.+]+)?$/,r=/^(http|https):\/\/[^ "]+$/;return t.test(e)?!0:!(!r.test(e)||new URL(e).hostname!==window.location.hostname)}var Ew7=()=>window.__IdentityUserManager__,UT5=e=>{window.__IdentityUserManager__=e},GT5=(e=>(e.NoMatchingState="No matching state found in storage",e.IFrameTimeout="IFrame timed out without a response",e.InvalidGrant="invalid_grant",e.LoginRequired="login_required",e.FailedToFetch="Failed to fetch",e))(GT5||{}),Rw7=e=>{let t=`${window.location.origin}/portal_/autherror`;if(e instanceof Error){window.location.assign(`${t}?error=${e.message}`);return}window.location.assign(t)},ZT5=TQ1(),OZ4=TQ1();function Zw7(){return window.localStorage.getItem("AUTH_DEBUG")==="true"}function Fw7(){OZ4.Log.setLogger(NT5.getInstance()),OZ4.Log.setLevel(OZ4.Log.DEBUG)}var Ow7=class{constructor(){this.set(null)}set(e){window.User=e}remove(){window.User=null}get(){return window.User}},Dw7=class{_isSigningOut=!1;constructor(){}get isSigningOut(){return this._isSigningOut}set isSigningOut(e){this._isSigningOut=e}},jT5="1119a927-10ab-4543-bd1a-ad6bfbbc27f4",Iw7="/portal_/api/tokenFactory/callback",Nw7=["openid","profile","offline_access"],Uw7=class extends ZT5.UserManager{_user=new Ow7;_failedToFetchCount=0;_refreshPromise=null;_signoutState=new Dw7;_onSigninError;constructor(e){let t=e.authority??DT5(e.isMsi),r=new URL(t).origin,a=e.usePortalSilentRedirectUri?`${r}${Iw7}`:e.redirect_uri,i=e.post_logout_redirect_uri??`${r}/portal_/cloudrpa`,n=(e.overrides?.client_id??jT5).toLowerCase(),o=e.overrides?.scope??Nw7.join(" ");super({...e,client_id:n,scope:o,authority:t,monitorSession:e.monitorSession??!0,stopCheckSessionOnError:!0,response_type:"code",userStore:new ZT5.WebStorageStateStore({store:window.sessionStorage,prefix:e.storagePrefix}),silent_redirect_uri:a,post_logout_redirect_uri:i}),this._onSigninError=e.onSigninError??Rw7,Zw7()&&Fw7(),this.signinComplete=this.signinComplete.bind(this),this._handleSigninError=this._handleSigninError.bind(this),this._expireSession=this._expireSession.bind(this),this._onFailedToFetch=this._onFailedToFetch.bind(this),this._onNetworkChange=this._onNetworkChange.bind(this),this._onSilentRenewError=this._onSilentRenewError.bind(this),this.registerCustomEvents(),this.clearRefreshToken(),UT5(this)}registerCustomEvents(){window.addEventListener("online",this._onNetworkChange),this.events.addUserSignedOut(this._expireSession),this.events.addUserLoaded(FZ4),this.events.addAccessTokenExpired(this.signinComplete),this.events.addSilentRenewError(this._onSilentRenewError)}unregisterCustomEvents(){window.removeEventListener("online",this._onNetworkChange),this.events.removeUserSignedOut(this._expireSession),this.events.removeUserLoaded(FZ4),this.events.removeAccessTokenExpired(this.signinComplete),this.events.removeSilentRenewError(this._onSilentRenewError)}async clearRefreshToken(){let e=await this.getUser();e&&(e.refresh_token=void 0,await this.storeUser(e))}async getUser(){let e=await super.getUser();return e&&!this._user.get()&&this._user.set(e),e}async storeUser(e){await super.storeUser(e),this._user.set(e),e&&(this._failedToFetchCount=0,FZ4())}async removeUser(){return kw7(),this._user.remove(),super.removeUser()}async signinRedirect(e){let t=e?.state;if(!t?.returnTo)if(this._logger.warn("no returnTo provided, using default"),location.href.startsWith(document.baseURI)){let r=location.href.substring(document.baseURI.length);t={returnTo:r.startsWith("/")?r:`/${r}`}}else t={returnTo:location.pathname+location.search};return e?.organizationName&&(e.acr_values=`tenantName:${e.organizationName}`,delete e.organizationName),super.signinRedirect({...e,state:t})}async signinCallback(e){try{return super.signinCallback(e)}catch(t){await this._handleSigninError(t,{state:{returnTo:"/"}});return}}async signoutRedirect(e){return this._signoutState.isSigningOut=!0,super.signoutRedirect(e)}async signoutRedirectCallback(e){return this._signoutState.isSigningOut=!1,super.signoutRedirectCallback(e)}async signinComplete(e){try{if(await this.clearStaleState(),this._signoutState.isSigningOut)return;IT5()?await this.signinSilent(e):await this.signinRedirect(e)}catch(t){await this._handleSigninError(t,e)}}async _useRefreshToken(e){if(this._refreshPromise)return this._refreshPromise;this._refreshPromise=super._useRefreshToken(e);try{return await this._refreshPromise}finally{this._refreshPromise=null}}async _handleSigninError(e,t){let r="unknown";switch(e instanceof Error&&(r=e.message),r){case"No matching state found in storage":case"IFrame timed out without a response":case"login_required":this._logger.warn(`Well known error occurred: ${r} - retrying...`),await this.signinRedirect(t);break;case"invalid_grant":await this.removeUser(),await this.signinSilent();break;case"Failed to fetch":break;default:this._logger.error(`Unknown error occurred: ${e}`),this._onSigninError(e)}}async _expireSession(){let e=await this.getUser();sessionStorage.clear(),this.stopSilentRenew(),await this.signoutRedirect({id_token_hint:e?.id_token})}async _onNetworkChange(){this._logger.debug("Network change detected, validating user object");let e=await this.getUser();(!e||e.expired)&&(this._logger.debug("Stale or missing user object detected, signing in silently..."),await this.signinSilent())}_onFailedToFetch(e){if(this._failedToFetchCount++,this._logger.warn(`Failed to fetch count: ${this._failedToFetchCount}`),this._failedToFetchCount>=3){this._onSigninError(e);return}setTimeout(()=>{window.dispatchEvent(new Event("online"))},5e3*this._failedToFetchCount)}_onSilentRenewError(e){e.message==="Failed to fetch"&&this._onFailedToFetch(e)}},mM2=TQ1()});var YT5=M1((fFi,GZ4)=>{"use strict";var Gw7=Object.create,yn0=Object.defineProperty,jw7=Object.getOwnPropertyDescriptor,Ww7=Object.getOwnPropertyNames,qw7=Object.getPrototypeOf,$w7=Object.prototype.hasOwnProperty,Kw7=(e,t)=>{for(var r in t)yn0(e,r,{get:t[r],enumerable:!0})},wn0=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ww7(t))!$w7.call(e,i)&&i!==r&&yn0(e,i,{get:()=>t[i],enumerable:!(a=jw7(t,i))||a.enumerable});return e},Yw7=(e,t,r)=>(wn0(e,t,"default"),r&&wn0(r,t,"default")),IZ4=(e,t,r)=>(r=e!=null?Gw7(qw7(e)):{},wn0(t||!e||!e.__esModule?yn0(r,"default",{value:e,enumerable:!0}):r,e)),Xw7=e=>wn0(yn0({},"__esModule",{value:!0}),e),NZ4={};Kw7(NZ4,{AuthContext:()=>Ln0.AuthContext,AuthGuard:()=>ey7,UiPathAuthProvider:()=>ay7,getCallbackState:()=>KT5,hasAuthParams:()=>Ln0.hasAuthParams,onCallback:()=>sy7,useAuth:()=>Ln0.useAuth,useIdentityAuth:()=>ny7,useSignoutRedirect:()=>ly7,withAuth:()=>Ln0.withAuth});GZ4.exports=Xw7(NZ4);var DZ4=IZ4(rr()),Jw7=_Q1(),UZ4=IZ4(rr()),$T5=UZ4.default.createContext({userManager:{}}),Qw7=()=>UZ4.default.useContext($T5).userManager,ty7=({children:e,userManager:t})=>UZ4.default.createElement($T5.Provider,{value:{userManager:t}},e),ey7=({children:e,extraSigninRequestArgs:t})=>{let{isAuthenticated:r,isLoading:a,error:i,activeNavigator:n}=(0,Jw7.useAuth)(),{signinComplete:o}=Qw7();return(0,DZ4.useEffect)(()=>{n==="signoutRedirect"||r||a||o(t)},[i,a,r,n,o,t]),r?DZ4.default.createElement(DZ4.default.Fragment,null,e):null},qT5=Mn0(),xn0=IZ4(rr()),ry7=_Q1(),ay7=({children:e,configuration:t,onSigninCallback:r,onError:a})=>{let i=(0,xn0.useMemo)(()=>(0,qT5.getUserManager)()??new qT5.IdentityUserManager({...t,onSigninError:a}),[]);return(0,xn0.useEffect)(()=>()=>{i.unregisterCustomEvents()},[i]),xn0.default.createElement(ty7,{userManager:i},xn0.default.createElement(ry7.AuthProvider,{userManager:i,onSigninCallback:r},e))},iy7=_Q1();function ny7(){let{user:e,events:t}=(0,iy7.useAuth)();return{accessToken:e?.access_token,idToken:e?.id_token,user:e,events:t}}var oy7=_Q1();function ly7(){return(0,oy7.useAuth)().signoutRedirect}var cy7=Mn0();function KT5(e){let t=e?.state;return(0,cy7.validateReturnUrl)(t?.returnTo)?t:{...t,returnTo:"/"}}function sy7(e,t){let r=KT5(e).returnTo;t(r)}var Ln0=_Q1();Yw7(NZ4,Mn0(),GZ4.exports)});var jZ4,XT5=C1(()=>{jZ4={storeUser:()=>Promise.resolve(),removeUser:()=>Promise.resolve(),clearRefreshToken:()=>Promise.resolve(),getUser:()=>Promise.resolve(null),signinCallback:()=>Promise.resolve(null),signinRedirect:()=>Promise.resolve(),signinSilent:()=>Promise.resolve(null),events:{addUserLoaded:()=>{},addUserUnloaded:()=>{},addAccessTokenExpiring:()=>{},addAccessTokenExpired:()=>{},addSilentRenewError:()=>{}}}});function hy7(){return xn?jZ4:!window.secureAuthApi&&!pZ?jZ4:(An0||(An0=new JT5.IdentityUserManager(hn0),An0.unregisterCustomEvents()),An0)}var JT5,An0,xm,WZ4=C1(()=>{JT5=w4(YT5(),1);wu();XT5();BZ4();An0=null;xm=new Proxy({},{get(e,t){let r=hy7(),a=r[t];return typeof a=="function"?a.bind(r):a}})});function MM2(e){return typeof e?.expires_at=="number"&&e.expires_at>0?e.expires_at:typeof e?.profile?.exp=="number"?e.profile.exp:0}function $Z4(e){return MM2(e)-Math.floor(Date.now()/1e3)}function F_1(e){return!!e?.access_token&&$Z4(e)>0}function vy7(e){let t=e?.message?.toLowerCase()||"",r=e?.name?.toLowerCase()||"";return t.includes("failed to fetch")||t.includes("network")||t.includes("err_network")||t.includes("net::err_")||t.includes("networkerror")||t.includes("connection_timed_out")||t.includes("aborted")||t.includes("connection")||r==="typeerror"&&t.includes("fetch")}function my7(e){let t=e?.message||"";return t.includes("signinSilent")&&t.includes("timed out")}function e61(){return xn?Cy7:(EQ1||(ge.debug("Creating new AuthService instance"),EQ1=new KZ4),EQ1)}function My7(){EQ1&&(ge.debug("Cleaning up AuthService for HMR"),EQ1.stop(),EQ1=null)}var ge,dy7,qZ4,uy7,gy7,zn0,py7,QT5,fy7,tB5,KZ4,EQ1,Cy7,xM2=C1(()=>{AZ4();wu();MW();o21();If();n21();bZ4();HZ4();VQ1();BZ4();WZ4();ge=cn0("auth");ge.setLevel("debug");dy7=60,qZ4=2*dy7,uy7=2e3,gy7=6e4,zn0=10,py7=3,QT5=5e3,fy7=35e3;tB5=3e4,KZ4=class{constructor(){this.isInitialized=!1;this.isRefreshing=!1;this.refreshPromise=null;this.backgroundRefreshPromise=null;this.sharedRefreshPromise=null;this.refreshEpoch=0;this.activeSilentSignins=0;this.networkRetryCount=0;this.silentTimeoutCount=0;this.pendingNetworkRefresh=!1;this.onlineHandler=null;this.lastSuccessfulRefreshTime=0;this.lastUsedRefreshToken=null;this.authInvalidated=!1;this.networkRetryTimer=null;this.onlineRetryTimer=null;this.refreshAbortControllers=new Set;this.userLoadedHandler=null;this.userUnloadedHandler=null;this.accessTokenExpiringHandler=null;this.accessTokenExpiredHandler=null;this.silentRenewErrorHandler=null}async initialize(){if(this.isInitialized){ge.trace("\u2190 initialize() - already initialized");return}ge.debug("\u2192 initialize()"),this.isInitialized=!0,this.authInvalidated=!1,mT5(),this.removeEventListeners(),this.onlineHandler&&(window.removeEventListener("online",this.onlineHandler),this.onlineHandler=null),this.userLoadedHandler=async t=>{if(ge.debug("\u2192 EVENT userLoaded triggered"),this.activeSilentSignins>0){ge.debug("\u2190 EVENT userLoaded skipped (managed refresh owns the write)");return}let{tenants:r,mode:a,tenant:i,organization:n}=Mr.getState();Mr.getState().setUser(t,n,r,a,i),ge.debug("User tokens saved to store");try{let o=await XZ4(t,!1),h=await this.refetchTenantsIfNeeded(t,r,i,o);Mr.getState().setUser(t,o,h.tenants,a,h.selectedTenant),ge.debug("\u2190 EVENT userLoaded completed with organization")}catch(o){ge.warn("Failed to get organization during userLoaded, but tokens are preserved:",o),ge.debug("\u2190 EVENT userLoaded completed (organization fetch failed)")}},this.userUnloadedHandler=()=>{ge.debug("\u2192 EVENT userUnloaded triggered"),ge.debug("\u2190 EVENT userUnloaded completed")},this.accessTokenExpiringHandler=()=>{if(ge.debug("\u2192 EVENT accessTokenExpiring triggered"),this.authInvalidated||qh1()){ge.debug("\u2190 EVENT accessTokenExpiring skipped (auth invalidated or shutting down)");return}let t=Date.now()-this.lastSuccessfulRefreshTime;if(this.lastSuccessfulRefreshTime>0&&t<tB5){ge.debug(`\u2190 EVENT accessTokenExpiring skipped (refreshed ${t}ms ago)`);return}this.refreshToken(),ge.debug("\u2190 EVENT accessTokenExpiring completed")},this.accessTokenExpiredHandler=()=>{if(ge.debug("\u2192 EVENT accessTokenExpired triggered"),this.authInvalidated||qh1()){ge.debug("\u2190 EVENT accessTokenExpired skipped (auth invalidated or shutting down)");return}if(this.pendingNetworkRefresh){ge.info("Token expired but network retry already in progress"),ge.debug("\u2190 EVENT accessTokenExpired skipped (pending network refresh)");return}ge.info("Token expired - attempting refresh"),this.refreshToken(),ge.debug("\u2190 EVENT accessTokenExpired - refresh triggered")},this.silentRenewErrorHandler=t=>{if(ge.debug("\u2192 EVENT silentRenewError triggered"),ge.error("Silent renew error:",t),t?.error==="invalid_grant"||t?.message?.includes("invalid_grant")){ge.error("Silent renew failed with invalid_grant - logging out"),Mr.getState().logout(),ge.debug("\u2190 EVENT silentRenewError - invalid_grant, logged out");return}ge.info("Silent renew failed - scheduling retry"),this.scheduleNetworkRetry(),ge.debug("\u2190 EVENT silentRenewError - retry scheduled")},xm.events.addUserLoaded(this.userLoadedHandler),xm.events.addUserUnloaded(this.userUnloadedHandler),xm.events.addAccessTokenExpiring(this.accessTokenExpiringHandler),xm.events.addAccessTokenExpired(this.accessTokenExpiredHandler),xm.events.addSilentRenewError(this.silentRenewErrorHandler),this.onlineHandler=()=>{ge.info("Network came back online"),this.pendingNetworkRefresh&&(ge.info("Retrying token refresh after network recovery..."),this.pendingNetworkRefresh=!1,this.networkRetryTimer&&(clearTimeout(this.networkRetryTimer),this.networkRetryTimer=null),this.onlineRetryTimer&&clearTimeout(this.onlineRetryTimer),this.onlineRetryTimer=setTimeout(()=>{this.onlineRetryTimer=null,this.refreshToken()},1e3))},window.addEventListener("online",this.onlineHandler),await this.handleStartupTokenValidation(),ge.debug("\u2190 initialize()")}async refetchTenantsIfNeeded(t,r,a,i){if(Mr.getState().isRobotMode)return{tenants:r,selectedTenant:a};if(Array.isArray(r)&&r.length>0)return{tenants:r,selectedTenant:a};ge.info("Tenants missing after token refresh \u2014 re-fetching");let n=t.profile.prt_id;if(!n)return{tenants:r,selectedTenant:a};let h=(await yZ4(n,t.access_token)).filter(f=>f.status==="Enabled"),u=a?.id;if(!u&&i?.id){let f=b5.getState().tenantByOrg?.[i.id];f?.id&&(u=f.id,ge.info(`Using tenantByOrg[${i.id}].id=${u} for restoration`))}if(!u){let f=b5.getState().selectedTenant;f?.id&&(u=f.id,ge.info(`Falling back to legacy appStore.selectedTenant.id=${u}`))}let g=u?h.find(f=>f.id===u)||h[0]||null:h[0]||null;return ge.info(`Re-fetched ${h.length} enabled tenants, selected=${g?.name??"none"}`),{tenants:h,selectedTenant:g}}removeEventListeners(){this.userLoadedHandler&&xm.events.removeUserLoaded(this.userLoadedHandler),this.userUnloadedHandler&&xm.events.removeUserUnloaded(this.userUnloadedHandler),this.accessTokenExpiringHandler&&xm.events.removeAccessTokenExpiring(this.accessTokenExpiringHandler),this.accessTokenExpiredHandler&&xm.events.removeAccessTokenExpired(this.accessTokenExpiredHandler),this.silentRenewErrorHandler&&xm.events.removeSilentRenewError(this.silentRenewErrorHandler)}async handleStartupTokenValidation(){ge.debug("\u2192 handleStartupTokenValidation()"),await new Promise(a=>setTimeout(a,1e3));let{user:t}=Mr.getState();if(!t){ge.debug("\u2190 handleStartupTokenValidation() - no cached user");return}let r=this.refreshEpoch;try{let a=Math.floor(Date.now()/1e3),i=MM2(t),n=i-a;if(n<qZ4){ge.info(`Token expires in ${Math.floor(n/60)} minutes, refreshing before continuing...`),await this.runCoalescedRefresh();let{user:o}=Mr.getState();F_1(o)&&MM2(o)>i&&b5.getState().setNetworkStatus("online"),ge.debug("\u2190 handleStartupTokenValidation() - token refreshed, continuing")}else if(Mr.getState().isRobotMode)ge.info(`Token valid for ${Math.floor(n/60)} minutes (robot mode, rotation handled by the robot layer)`),b5.getState().setNetworkStatus("online"),ge.debug("\u2190 handleStartupTokenValidation() - robot mode, returning immediately");else{let o=YZ4(t);o&&(await xm.storeUser(o),ge.info(`Token valid for ${Math.floor(n/60)} minutes, accessTokenExpiring event will handle refresh`)),b5.getState().setNetworkStatus("online"),ge.debug("\u2190 handleStartupTokenValidation() - token still valid, returning immediately")}}catch(a){if(r!==this.refreshEpoch){ge.debug("\u2190 handleStartupTokenValidation() - abandoned refresh settled late, suppressing side effects");return}if(ge.error("Error during startup token validation:",a),a?.error==="invalid_grant"||a?.message?.includes("invalid_grant")){if(this.authInvalidated)return;ge.error("Refresh token is invalid on startup - clearing auth state"),this.authInvalidated=!0,this.removeEventListeners(),await xm.clearRefreshToken(),await xm.removeUser(),Mr.getState().logout(),ge.debug("\u2190 handleStartupTokenValidation() - invalid_grant, auth cleared");return}ge.warn("Non-fatal error on startup - scheduling retry"),this.scheduleNetworkRetry(),ge.debug("\u2190 handleStartupTokenValidation() - error, retry scheduled")}}runCoalescedRefresh(){if(this.sharedRefreshPromise)return this.sharedRefreshPromise;let t=this.refreshEpoch,r=Promise.resolve().then(()=>this.refreshTokenInternal(t)).finally(()=>{this.sharedRefreshPromise===r&&(this.sharedRefreshPromise=null)});return this.sharedRefreshPromise=r,r}trackSilentSignin(t,r){this.activeSilentSignins++;let a=this.refreshEpoch;return t.then(i=>{this.activeSilentSignins--,i&&r()&&this.adoptLateSigninSuccess(i,a)},()=>{this.activeSilentSignins--}),t}adoptLateSigninSuccess(t,r){if(r!==this.refreshEpoch||this.authInvalidated||qh1())return;let{user:a,tenants:i,mode:n,tenant:o,organization:h}=Mr.getState();!a||!t.access_token||MM2(t)<=MM2(a)||(ge.info("Silent signin succeeded after its refresh run gave up; adopting the rotated tokens"),this.lastSuccessfulRefreshTime=Date.now(),this.silentTimeoutCount=0,this.lastUsedRefreshToken=a.refresh_token??null,this.networkRetryCount=0,this.pendingNetworkRefresh=!1,this.networkRetryTimer&&(clearTimeout(this.networkRetryTimer),this.networkRetryTimer=null),Mr.getState().setUser(t,h,i,n,o),b5.getState().setNetworkStatus("online"))}async refreshTokenInternal(t){if(Mr.getState().isRobotMode){ge.debug("refreshTokenInternal: robot mode, skipping OIDC silent refresh"),await this.revendRobotToken();return}let{user:r,tenant:a}=Mr.getState();if(!r)throw new Error("No user to refresh");let i=YZ4(r);if(!i)throw new Error("Failed to convert user");let n=i.refresh_token;if(n&&n===this.lastUsedRefreshToken)throw ge.warn("Refresh token already used, skipping refresh (waiting for new token to propagate)"),new Error("Refresh token already consumed");let o=Date.now()-this.lastSuccessfulRefreshTime;if(o<tB5)throw ge.warn(`Refresh attempted too soon (${o}ms since last refresh), skipping`),new Error("Refresh too soon after last refresh");await xm.storeUser(i);let h=new AbortController;this.refreshAbortControllers.add(h);let{signal:u}=h,g=null,f=!1,v=!1;try{g=await kZ4(cY(this.trackSilentSignin(xm.signinSilent(),()=>f),QT5,"signinSilent"),u,"signinSilent")}catch(C){if(f=!0,u.aborted)throw C;ge.warn("Silent signin failed, attempting with prompt=none:",C);try{g=await kZ4(cY(this.trackSilentSignin(xm.signinSilent({redirect_uri:hn0.redirect_uri,prompt:"none"}),()=>v),QT5,"signinSilent (prompt=none)"),u,"signinSilent (prompt=none)")}catch(L){throw v=!0,ge.error("Refresh token usage failed:",L),my7(L)?this.silentTimeoutCount++:this.silentTimeoutCount=0,(L?.error==="invalid_grant"||L?.message?.includes("invalid_grant"))&&ge.error("Refresh token is invalid/expired - will require re-authentication"),L}}finally{this.refreshAbortControllers.delete(h)}if(u.aborted||qh1()){ge.warn("Auth shutdown started during token refresh - discarding refreshed tokens");return}if(g){if(t!==this.refreshEpoch){ge.debug("Refresh settled after being abandoned; discarding result");return}ge.info("Token refreshed successfully"),this.lastSuccessfulRefreshTime=Date.now(),this.silentTimeoutCount=0,this.lastUsedRefreshToken=n||null;let{tenants:C,mode:L,organization:y}=Mr.getState();Mr.getState().setUser(g,y,C,L,a),ge.debug("User tokens saved to store");try{let z=await XZ4(g,!1),S=await this.refetchTenantsIfNeeded(g,C,a,z);if(t!==this.refreshEpoch||u.aborted||qh1()){ge.debug("Refresh abandoned or shutting down during organization fetch; skipping enrichment write");return}Mr.getState().setUser(g,z,S.tenants,L,S.selectedTenant),ge.debug("Organization updated successfully")}catch(z){ge.warn("Failed to get organization after refresh, but tokens are preserved:",z)}}else throw new Error("No user returned from silent refresh")}async drainInFlightRefresh(){let t=this.refreshPromise??this.backgroundRefreshPromise??this.sharedRefreshPromise;if(!t)return!1;let r=this.refreshEpoch;ge.debug("Refresh in progress, waiting for it...");let a,i=await Promise.race([t.then(()=>!1,()=>!1),new Promise(n=>{a=setTimeout(()=>n(!0),fy7)})]);if(clearTimeout(a),i){if(!(r===this.refreshEpoch&&(this.refreshPromise===t||this.backgroundRefreshPromise===t||this.sharedRefreshPromise===t)))return!1;ge.warn("In-flight refresh did not settle in time, abandoning every refresh lane"),this.refreshEpoch++;for(let o of this.refreshAbortControllers)o.abort();return this.refreshAbortControllers.clear(),this.refreshPromise=null,this.backgroundRefreshPromise=null,this.sharedRefreshPromise=null,!1}return!0}async getValidAccessToken(){let t=Mr.getState().user;if(t?.access_token&&$Z4(t)>qZ4)return t.access_token;await this.drainInFlightRefresh();let{user:r}=Mr.getState();if(!r?.access_token)throw new Error("No user or access token available");let a=$Z4(r);if(a<=qZ4){ge.debug(`Token expires in ${a}s, triggering refresh...`);try{let i=await this.refreshAccessToken();return ge.debug("\u2190 getValidAccessToken() - refreshed expiring token"),i}catch{if(this.authInvalidated)throw new Error("Token refresh invalidated auth state");if(F_1(r))return ge.warn("Refresh failed, returning current token before it expires"),r.access_token;throw new Error("Token expired and refresh failed")}}return r.access_token}async revendRobotToken(){let t=typeof window<"u"?window.assistantServicesApi:void 0;if(t?.isAssistantFirst)try{let r=await t.getAccessToken();if(r){let a=r.startsWith("Bearer ")?r.slice(7):r;return Mr.getState().reseedRobotToken(a),a}ge.warn("Assistant robot token vend returned empty, falling back to current token")}catch(r){ge.warn("Assistant robot token re-vend failed, falling back to current token:",r)}return null}async refreshAccessToken(){if(ge.debug("\u2192 refreshAccessToken()"),qh1()){ge.debug("\u2190 refreshAccessToken() - shutting down, returning current token");let{user:a}=Mr.getState();if(a?.access_token)return a.access_token;throw new Error("Auth shutdown in progress")}if(Mr.getState().isRobotMode){let a=await this.revendRobotToken();if(a)return ge.debug("\u2190 refreshAccessToken() - robot mode, re-vended assistant robot token"),a;ge.debug("\u2190 refreshAccessToken() - robot mode, returning current token");let{user:i}=Mr.getState();if(i?.access_token)return i.access_token;throw new Error("Robot mode: no access token available")}let{user:t}=Mr.getState();if(!t)throw new Error("No user to refresh");if(await this.drainInFlightRefresh()){let{user:a}=Mr.getState();if(F_1(a))return ge.debug("\u2190 refreshAccessToken() - reusing token from a just-completed refresh"),a.access_token}if(this.isRefreshing&&this.refreshPromise)return ge.debug("Refresh already in progress, waiting..."),this.refreshPromise;this.isRefreshing=!0,this.refreshPromise=(async()=>{let a=this.refreshEpoch;try{await this.runCoalescedRefresh();let{user:i}=Mr.getState();if(F_1(i))return ge.debug("\u2190 refreshAccessToken() - success"),i.access_token;throw new Error("No fresh access token after refresh")}catch(i){let n=i?.message||"";if(a!==this.refreshEpoch)throw ge.debug("refreshAccessToken: abandoned run settled late, suppressing side effects"),i;if(n.includes("already consumed")||n.includes("too soon")){ge.debug(`refreshAccessToken skipped: ${n}`);let u=await xm.getUser();if(F_1(u))return u.access_token;throw i}if(ge.error("Token refresh failed:",i),i?.error==="invalid_grant"||n.includes("invalid_grant"))throw this.authInvalidated||(ge.error("Refresh token is invalid - clearing all auth state"),Vr.trackEvent(Ur.AuthInvalidGrant,{source:"refreshAccessToken"}),this.authInvalidated=!0,this.pendingNetworkRefresh=!1,this.networkRetryTimer&&(clearTimeout(this.networkRetryTimer),this.networkRetryTimer=null),this.removeEventListeners(),await xm.clearRefreshToken(),await xm.removeUser(),Mr.getState().logout()),i;if(ge.warn("Non-fatal error during refreshAccessToken - scheduling retry"),this.scheduleNetworkRetry(),this.authInvalidated)throw i;let h=await xm.getUser();if(F_1(h))return ge.warn("Returning existing token while waiting for retry"),h.access_token;throw i}})();let r=this.refreshPromise.finally(()=>{this.isRefreshing=!1,this.refreshPromise===r&&(this.refreshPromise=null)});return this.refreshPromise=r,r}async scheduleNetworkRetry(){if(ge.debug("\u2192 scheduleNetworkRetry()"),this.authInvalidated||qh1()){ge.debug("\u2190 scheduleNetworkRetry() - auth invalidated or shutting down, skipping");return}if(this.pendingNetworkRefresh){ge.debug("\u2190 scheduleNetworkRetry() - already pending");return}this.networkRetryCount++;let t=this.silentTimeoutCount>=py7;if(this.networkRetryCount>zn0||t){ge.error(t?`Refresh wedged (${this.silentTimeoutCount} silent-signin timeouts) - forcing re-login`:`Token refresh failed after ${zn0} attempts, forcing re-login`),Vr.trackEvent(Ur.AuthRefreshRetryExhausted,{reason:t?"wedged":"retry_exhausted",attempts:t?this.silentTimeoutCount:zn0}),this.authInvalidated=!0,this.isInitialized=!1,this.networkRetryCount=0,this.silentTimeoutCount=0,this.pendingNetworkRefresh=!1,this.networkRetryTimer&&(clearTimeout(this.networkRetryTimer),this.networkRetryTimer=null),this.removeEventListeners(),Mr.getState().logout();try{await xm.clearRefreshToken(),await xm.removeUser()}catch(a){ge.warn("Error during auth cleanup after max retries:",a)}ge.debug("\u2190 scheduleNetworkRetry() - max attempts exceeded, auth cleared");return}b5.getState().setNetworkStatus("retrying"),this.pendingNetworkRefresh=!0;let r=Math.min(uy7*Math.pow(2,this.networkRetryCount-1),gy7);ge.info(`Network error - retrying in ${r}ms (attempt ${this.networkRetryCount}/${zn0})`),this.networkRetryTimer=setTimeout(()=>{this.networkRetryTimer=null,this.pendingNetworkRefresh=!1,this.refreshToken()},r),ge.debug("\u2190 scheduleNetworkRetry()")}async refreshToken(){if(ge.debug("\u2192 refreshToken()"),this.authInvalidated||qh1()){ge.debug("\u2190 refreshToken() - auth invalidated or shutting down, skipping");return}if(this.backgroundRefreshPromise){ge.debug("Refresh already in progress, waiting for existing refresh...");try{await this.backgroundRefreshPromise,ge.debug("\u2190 refreshToken() - existing refresh completed successfully")}catch{ge.debug("\u2190 refreshToken() - existing refresh failed (already handled)")}return}let r=(async()=>{let a=this.refreshEpoch;this.isRefreshing=!0;try{ge.info("Attempting to refresh token..."),await this.runCoalescedRefresh();let{user:i}=Mr.getState();F_1(i)?(this.networkRetryCount=0,this.pendingNetworkRefresh=!1,b5.getState().setNetworkStatus("online"),ge.debug("\u2190 refreshToken() - success")):ge.debug("\u2190 refreshToken() - resolved without a fresh token (no-op), not marking online")}catch(i){let n=i?.message||"";if(a!==this.refreshEpoch){ge.debug("\u2190 refreshToken() - abandoned run settled late, suppressing side effects");return}if(n.includes("already consumed")||n.includes("too soon")){ge.debug(`\u2190 refreshToken() - skipped: ${n}`);return}if(ge.error("Failed to refresh token:",i),i?.error==="invalid_grant"||n.includes("invalid_grant")){if(this.authInvalidated)return;ge.error("Refresh token is invalid - clearing all auth state"),Vr.trackEvent(Ur.AuthInvalidGrant,{source:"refreshToken"}),this.authInvalidated=!0,this.networkRetryCount=0,this.pendingNetworkRefresh=!1,this.networkRetryTimer&&(clearTimeout(this.networkRetryTimer),this.networkRetryTimer=null),this.removeEventListeners(),await xm.clearRefreshToken(),await xm.removeUser(),Mr.getState().logout(),ge.debug("\u2190 refreshToken() - invalid_grant, auth cleared");return}if(vy7(i)){ge.warn("Network error during token refresh - scheduling retry"),this.scheduleNetworkRetry(),ge.debug("\u2190 refreshToken() - network error, retry scheduled");return}ge.warn("Unknown error during refresh, treating as network issue - scheduling retry"),this.scheduleNetworkRetry(),ge.debug("\u2190 refreshToken() - unknown error, retry scheduled")}})().finally(()=>{this.isRefreshing=!1,this.backgroundRefreshPromise===r&&(this.backgroundRefreshPromise=null)});this.backgroundRefreshPromise=r,await r}async switchOrganization(){ge.info("[switchOrg] -> start");try{let r=(await xm.getUser())?.id_token;ge.info(`[switchOrg] id_token_hint present: ${!!r}`);let a=new URLSearchParams;r&&a.set("id_token_hint",r);let i=`${vM2}/connect/endsession?${a.toString()}`;if(ge.info(`[switchOrg] endSessionUrl: ${vM2}/connect/endsession?id_token_hint=[REDACTED]`),window.electronAPI?.openExternalUrl)ge.info("[switchOrg] opening endSessionUrl in external browser"),window.electronAPI.openExternalUrl(i);else throw ge.warn("[switchOrg] openExternalUrl NOT available"),new Error("openExternalUrl IPC not available");ge.info("[switchOrg] clearing local auth state"),Mr.getState().logout();let n=!1,o=g=>{n||(n=!0,window.removeEventListener("focus",h),clearTimeout(u),ge.info(`[switchOrg] triggering signinRedirect (reason: ${g})`),xm.signinRedirect().catch(f=>{ge.error("[switchOrg] signinRedirect failed:",f)}))},h=()=>o("window-focus");window.addEventListener("focus",h);let u=setTimeout(()=>o("5s-timeout"),5e3);ge.info("[switchOrg] <- end (waiting for window focus or 5s timeout)")}catch(t){throw ge.error("[switchOrg] failed:",t),t}}abandonInFlightRefreshes(){ge.debug("\u2192 abandonInFlightRefreshes()"),this.refreshEpoch++,this.networkRetryTimer&&(clearTimeout(this.networkRetryTimer),this.networkRetryTimer=null),this.onlineRetryTimer&&(clearTimeout(this.onlineRetryTimer),this.onlineRetryTimer=null),this.pendingNetworkRefresh=!1,this.networkRetryCount=0,this.silentTimeoutCount=0;for(let t of this.refreshAbortControllers)t.abort();this.refreshAbortControllers.clear(),this.refreshPromise=null,this.backgroundRefreshPromise=null,this.sharedRefreshPromise=null,ge.debug("\u2190 abandonInFlightRefreshes()")}stop(){ge.debug("\u2192 stop()"),this.isInitialized=!1,this.authInvalidated=!1,this.abandonInFlightRefreshes(),this.removeEventListeners(),this.userLoadedHandler=null,this.userUnloadedHandler=null,this.accessTokenExpiringHandler=null,this.accessTokenExpiredHandler=null,this.silentRenewErrorHandler=null,this.onlineHandler&&(window.removeEventListener("online",this.onlineHandler),this.onlineHandler=null),ge.debug("\u2190 stop()")}},EQ1=null,Cy7={initialize:()=>Promise.resolve(),refreshAccessToken:()=>Promise.resolve("mock_access_token"),getValidAccessToken:()=>Promise.resolve("mock_access_token"),switchOrganization:()=>Promise.resolve(),abandonInFlightRefreshes:()=>{},stop:()=>{}};import.meta.hot&&import.meta.hot.dispose(()=>{ge.debug("HMR dispose: cleaning up AuthService"),My7()})});function eB5(e){let r={uploading:"uploading",processing:"processing",completed:"completed",error:"error"}[e.toLowerCase()];if(!r)throw new Error(`Invalid processing status: ${e}`);return r}var rB5,JZ4=C1(()=>{O_1();rB5={async getAllFlows(e={}){let{page:t=1,page_size:r=100}=e;return(await $M.get("/flows",{params:{page:t,page_size:r}})).data},async getFlow(e){return(await $M.get(`/flows/${e}`)).data},async createFlow(e){return(await $M.post("/flows",e)).data},async updateFlow(e,t){return(await $M.patch(`/flows/${e}`,t)).data},async deleteFlow(e){await $M.delete(`/flows/${e}`)},async createEmptyFlow(){return(await $M.post("/flows/empty")).data},async generateMockedFlows(){return(await $M.post("/flows/generate-mocked")).data}}});var aB5,iB5=C1(()=>{aB5=()=>[{id:"debug-flow-1",user_id:"debug-user",lastupdate:Date.now(),flow:{title:"Customer Data Generation",user_goal:"This workflow generates folders with customer profiles and purchases for testing purposes.",summary:"This workflow generates folders with customer profiles and purchases for testing purposes.",steps:[{type:"task",task_title:"Create Customer Master List",task_prompt:"Generate and save a list of 20 customer names into a customers.txt file.",specific_instructions:"Generate and save a list of 20 customer names into a customers.txt file.",video_timestamp:"00:15",expected_inputs:["A list of customer names to be processed"],expected_outputs:["A master list of 20 customer names saved in customers.txt","Individual folders created for each customer"],execution_details:[{action_description:"Create new text file",ui_element_description:"File Explorer context menu",element_location:"Desktop folder",applications:["File Explorer","Notepad"],urls:["file:///C:/Users/jane.doe/Desktop/tmp/llm_playground/customers.txt"]}]},{type:"task",task_title:"Create Customer Folder Structure",task_prompt:"For each customer in the list, create a dedicated folder named with their name.",specific_instructions:"For each customer in the list, create a dedicated folder named with their name.",video_timestamp:"00:45",expected_inputs:["The customers.txt file with all customer names"],expected_outputs:["20 customer folders created with underscore-separated names","Each folder contains two files: profile and purchases"],execution_details:[{action_description:"Create folder for each customer",ui_element_description:"Command Prompt or File Explorer",element_location:"Target directory",applications:["File Explorer","Command Prompt"],urls:["file:///C:/Users/jane.doe/Desktop/tmp/llm_playground/"]}]},{type:"task",task_title:"Populate Customer Data Files",task_prompt:"Fill each customer's profile file with their basic information.",specific_instructions:"Fill each customer's profile and purchases files with generated data.",video_timestamp:"01:15",expected_inputs:["Customer folder structure already created","Basic customer information template"],expected_outputs:["Profile files with customer details","Purchase files with transaction history"],execution_details:[{action_description:"Edit profile file",ui_element_description:"Notepad editor",element_location:"Customer folder",applications:["Notepad","File Explorer"],urls:["file:///C:/Users/jane.doe/Desktop/tmp/llm_playground/"]}]}]},created_at:new Date().toISOString(),updated_at:new Date().toISOString()},{id:"debug-flow-2",user_id:"debug-user",lastupdate:Date.now(),flow:{title:"Customer Order Processing Workflow",user_goal:"Process customer orders from multiple channels, verify inventory, and coordinate shipping.",summary:"Process customer orders from multiple channels, verify inventory, and coordinate shipping through various systems.",steps:[{type:"task",task_title:"Review Pending Orders",task_prompt:"Access the order management system to review all pending customer orders.",specific_instructions:"Access the order management system to review pending orders and gather customer information.",video_timestamp:"00:15",expected_inputs:["Access to order management system."],expected_outputs:["List of pending orders to process.","Customer information and order details."],execution_details:[{action_description:"Navigate to orders page",ui_element_description:"SAP Order Management portal",element_location:"Main navigation menu",applications:["SAP","Order Management"],accounts:[],urls:["https://sap.company.com/orders"]}]},{type:"task",task_title:"Verify Inventory Availability",task_prompt:"Check the inventory system to confirm product availability.",specific_instructions:"Check inventory system to confirm availability and reserve items for the order.",video_timestamp:"01:45",expected_inputs:["Order details with product SKUs and quantities."],expected_outputs:["Confirmation of product availability.","Reserved inventory for the order."],execution_details:[{action_description:"Check inventory levels",ui_element_description:"Inventory System dashboard",element_location:"Product search panel",applications:["Inventory System","Microsoft Excel"],accounts:["inventory.user@company.com"],urls:["https://inventory.company.com/check"]}]}]},created_at:new Date().toISOString(),updated_at:new Date().toISOString()},{id:"debug-flow-3",user_id:"debug-user",lastupdate:Date.now(),flow:{title:"Employee Onboarding Automation",user_goal:"Automate the complete employee onboarding process.",summary:"Automate the complete employee onboarding process including system access, equipment requests, and training assignments.",steps:[{type:"task",task_title:"Create Employee Profile",task_prompt:"Create a new employee profile in the HR system and generate Active Directory credentials.",specific_instructions:"Create new employee profile in HR system and generate user credentials.",video_timestamp:"00:30",expected_inputs:["Employee personal information.","Job role and department details."],expected_outputs:["New employee profile created.","User credentials generated."],execution_details:[{action_description:"Fill employee form",ui_element_description:"HR Portal onboarding form",element_location:"New employee section",applications:["HR Portal","Active Directory"],accounts:["hr.admin@company.com"],urls:["https://hr.company.com/onboarding"]}]},{type:"task",task_title:"Send Welcome Communications",task_prompt:"Send welcome email to new employee and schedule team introduction meeting.",specific_instructions:"Send welcome email and schedule team introduction meeting.",video_timestamp:"02:00",expected_inputs:["Employee email address.","Team calendar availability."],expected_outputs:["Welcome email sent.","Team introduction scheduled."],execution_details:[{action_description:"Compose welcome email",ui_element_description:"Microsoft Teams compose window",element_location:"Chat section",applications:["Microsoft Teams","Email"],accounts:["team.lead@company.com"],urls:["https://teams.microsoft.com"]}]}]},created_at:new Date().toISOString(),updated_at:new Date().toISOString()},{id:"debug-flow-4",user_id:"debug-user",lastupdate:Date.now(),flow:{title:"Product Restocking and Supplier Communication Workflow",user_goal:"Identify products needing restocking and communicate with suppliers.",summary:"Identify a product that needs restocking from an inventory list, gather detailed supplier contact information, and compose and send an email with all necessary details.",steps:[{type:"task",task_title:"Identify Product for Restocking",task_prompt:"In the Inventory status sheet, identify products needing restock.",specific_instructions:"Identify products that need restocking based on threshold.",video_timestamp:"00:01:08",expected_inputs:["The Inventory status sheet is open."],expected_outputs:["The specific product and quantity to reorder are identified."],execution_details:[{action_description:"Filter low stock items",ui_element_description:"Google Sheets inventory spreadsheet",element_location:"Stock level column",applications:["Google Chrome"],urls:["https://docs.google.com/spreadsheets/inventory"]}]},{type:"task",task_title:"Create New Email in Outlook",task_prompt:"Navigate to Outlook and click New mail to start composing.",specific_instructions:"Create a new email in Outlook for supplier communication.",video_timestamp:"00:01:28",expected_inputs:[],expected_outputs:["A new, blank email draft is opened."],execution_details:[{action_description:"Click New mail button",ui_element_description:"Outlook toolbar",element_location:"Top navigation bar",applications:["msedge.exe"],urls:["https://outlook.office.com/mail/"]}]},{type:"task",task_title:"Search for Supplier in Coupa",task_prompt:"Search for the supplier in the Coupa system.",specific_instructions:"Search for supplier in Coupa system to get contact details.",video_timestamp:"00:04:27",expected_inputs:["User is on the Coupa Suppliers page."],expected_outputs:["The supplier is listed in search results."],execution_details:[{action_description:"Enter supplier name in search",ui_element_description:"Coupa supplier search box",element_location:"Suppliers page header",applications:["msedge.exe"],urls:["https://uipath-test.coupahost.com/suppliers"]}]}]},created_at:new Date().toISOString(),updated_at:new Date().toISOString()},{id:"debug-flow-5",user_id:"debug-user",lastupdate:Date.now(),flow:{title:"Daily Slack Standup Report",user_goal:"Automatically gather team updates from Jira and post a formatted standup summary to Slack.",summary:"Collect yesterday's completed tasks and today's planned work from Jira, then post a formatted daily standup report to the team Slack channel.",steps:[{type:"task",task_title:"Fetch Jira Updates",task_prompt:"Query Jira for tasks completed yesterday and tasks planned for today.",specific_instructions:"Query Jira for yesterday's and today's tasks.",video_timestamp:"00:20",expected_inputs:["Jira project key and team member list"],expected_outputs:["List of completed tasks from yesterday","List of in-progress tasks for today"],execution_details:[{action_description:"Run JQL query for completed tasks",ui_element_description:"Jira search bar",element_location:"Main navigation",applications:["Jira","Google Chrome"],accounts:["jira.bot@company.com"],urls:["https://uipath.atlassian.net/jira"]}]},{type:"task",task_title:"Format Standup Message",task_prompt:"Create a nicely formatted standup message with emojis and sections.",specific_instructions:"Format the standup message with proper sections.",video_timestamp:"00:45",expected_inputs:["Raw task data from Jira"],expected_outputs:["Formatted standup message ready for Slack"],execution_details:[{action_description:"Format message with sections",ui_element_description:"Text editor",element_location:"Editor window",applications:["Notepad"]}]},{type:"task",task_title:"Post to Slack Channel",task_prompt:"Send the formatted standup report to the team's Slack channel.",specific_instructions:"Post the standup summary to Slack.",video_timestamp:"01:00",expected_inputs:["Formatted standup message"],expected_outputs:["Standup message posted to #team-standup channel"],execution_details:[{action_description:"Paste and send message",ui_element_description:"Slack message input",element_location:"#team-standup channel",applications:["Slack"],accounts:["slack.bot@company.com"],urls:["https://app.slack.com/client"]}]}]},created_at:new Date().toISOString(),updated_at:new Date().toISOString()},{id:"debug-flow-6",user_id:"debug-user",lastupdate:Date.now(),flow:{title:"Invoice Processing Pipeline",user_goal:"Extract data from PDF invoices and enter them into the accounting system.",summary:"Automatically process incoming PDF invoices by extracting key data fields and entering them into SAP for payment processing.",steps:[{type:"task",task_title:"Download Invoice Attachments",task_prompt:"Check email inbox for new invoice attachments and download PDFs.",specific_instructions:"Download invoice PDFs from email.",video_timestamp:"00:10",expected_inputs:["Access to invoices@company.com mailbox"],expected_outputs:["PDF invoices downloaded to processing folder","Email marked as processed"],execution_details:[{action_description:"Download attachment",ui_element_description:"Outlook attachment button",element_location:"Email detail view",applications:["Outlook","File Explorer"],accounts:["invoices@company.com"],urls:["https://outlook.office.com/mail/"]}]},{type:"task",task_title:"Extract Invoice Data",task_prompt:"Use OCR to extract vendor name, invoice number, amount, and due date.",specific_instructions:"Extract data from invoice using OCR.",video_timestamp:"00:40",expected_inputs:["PDF invoice files"],expected_outputs:["Extracted invoice data in structured format","Confidence scores for each field"],execution_details:[{action_description:"Process PDF with OCR",ui_element_description:"Document Understanding interface",element_location:"Processing queue",applications:["Document Understanding","Excel"]}]},{type:"task",task_title:"Enter into SAP",task_prompt:"Create new vendor invoice entry in SAP with extracted data.",specific_instructions:"Enter invoice data into SAP system.",video_timestamp:"01:30",expected_inputs:["Validated invoice data"],expected_outputs:["Invoice created in SAP with document number"],execution_details:[{action_description:"Create invoice entry",ui_element_description:"SAP Fiori invoice form",element_location:"Vendor invoices section",applications:["SAP"],accounts:["sap.automation@company.com"],urls:["https://sap.company.com/fiori"]}]}]},created_at:new Date().toISOString(),updated_at:new Date().toISOString()},{id:"debug-flow-7",user_id:"debug-user",lastupdate:Date.now(),flow:{title:"Weekly Sales Report Generator",user_goal:"Generate a comprehensive weekly sales report from Salesforce data.",summary:"Pull sales data from Salesforce, create charts in Excel, and distribute the report via email to stakeholders.",steps:[{type:"task",task_title:"Export Salesforce Data",task_prompt:"Run Salesforce report and export weekly sales data to CSV.",specific_instructions:"Export sales data from Salesforce.",video_timestamp:"00:15",expected_inputs:["Salesforce report ID and date range"],expected_outputs:["CSV file with weekly sales data"],execution_details:[{action_description:"Run and export report",ui_element_description:"Salesforce reports page",element_location:"Reports tab",applications:["Salesforce","Google Chrome"],accounts:["reports@company.com"],urls:["https://company.lightning.force.com/reports"]}]},{type:"task",task_title:"Create Excel Dashboard",task_prompt:"Import data into Excel template and generate charts and pivot tables.",specific_instructions:"Create dashboard in Excel with charts.",video_timestamp:"01:00",expected_inputs:["CSV sales data file"],expected_outputs:["Excel workbook with formatted data","Sales charts and trend analysis"],execution_details:[{action_description:"Import and refresh data",ui_element_description:"Excel Data tab",element_location:"Data connection panel",applications:["Microsoft Excel"]}]},{type:"task",task_title:"Email Report to Stakeholders",task_prompt:"Attach the Excel report and send to the distribution list.",specific_instructions:"Send weekly report to stakeholders.",video_timestamp:"02:00",expected_inputs:["Completed Excel report","Distribution list"],expected_outputs:["Email sent with report attachment"],execution_details:[{action_description:"Compose and send email",ui_element_description:"Outlook compose window",element_location:"New email form",applications:["Outlook"],accounts:["sales.reports@company.com"],urls:["https://outlook.office.com/mail/"]}]}]},created_at:new Date().toISOString(),updated_at:new Date().toISOString()},{id:"debug-flow-8",user_id:"debug-user",lastupdate:Date.now(),flow:{title:"LinkedIn Job Application Tracker",user_goal:"Track job applications from LinkedIn and update a Google Sheet.",summary:"Monitor LinkedIn for job application status updates and maintain a tracking spreadsheet with all applications and their current status.",steps:[{type:"task",task_title:"Check LinkedIn Applications",task_prompt:"Log into LinkedIn and check the status of submitted applications.",specific_instructions:"Check LinkedIn for application updates.",video_timestamp:"00:20",expected_inputs:["LinkedIn credentials"],expected_outputs:["List of applications with current status","Any new responses or interview requests"],execution_details:[{action_description:"Navigate to jobs tracker",ui_element_description:"LinkedIn Jobs section",element_location:"My Jobs tab",applications:["Google Chrome","LinkedIn"],accounts:["user@email.com"],urls:["https://www.linkedin.com/jobs/tracker/"]}]},{type:"task",task_title:"Update Tracking Sheet",task_prompt:"Add new applications and update status of existing ones in Google Sheets.",specific_instructions:"Update the job tracking spreadsheet.",video_timestamp:"01:00",expected_inputs:["Application data from LinkedIn"],expected_outputs:["Updated tracking spreadsheet"],execution_details:[{action_description:"Update cells in spreadsheet",ui_element_description:"Google Sheets cells",element_location:"Job tracker sheet",applications:["Google Sheets","Google Chrome"],accounts:["user@gmail.com"],urls:["https://docs.google.com/spreadsheets/job-tracker"]}]}]},created_at:new Date().toISOString(),updated_at:new Date().toISOString()}]});var QZ4,bn0,nB5,oB5,LL1,lB5=C1(()=>{QZ4=w4(Lu(),1),bn0=w4(vW(),1);Dh1();JZ4();wu();iY();nB5={flows:[],recordedFlows:[],lastRecordedFlowId:null,unprocessedFlows:{},flowErrors:{},isLoaded:!1,isLoading:!1,error:null},oB5=e=>({...nB5,setFlows:t=>e({flows:t,isLoaded:!0,isLoading:!1}),addFlow:t=>e(r=>({flows:[...r.flows,t]})),updateFlow:(t,r)=>e(a=>({flows:a.flows.map(i=>i.id===t?r:i)})),deleteFlow:t=>e(r=>({flows:r.flows.filter(a=>a.id!==t)})),addRecordedFlow:t=>e(r=>({recordedFlows:[...r.recordedFlows,t]})),setLastRecordedFlowId:t=>e({lastRecordedFlowId:t}),addUnprocessedFlow:(t,r)=>e(a=>({unprocessedFlows:{...a.unprocessedFlows,[t]:r}})),removeUnprocessedFlow:t=>e(r=>{let{[t]:a,...i}=r.unprocessedFlows;return{unprocessedFlows:i}}),setFlowError:(t,r)=>e(a=>{if(r===null){let{[t]:i,...n}=a.flowErrors;return{flowErrors:n}}return{flowErrors:{...a.flowErrors,[t]:r}}}),clearFlowError:t=>e(r=>{let{[t]:a,...i}=r.flowErrors;return{flowErrors:i}}),updateRecordedFlowStatus:(t,r)=>e(a=>({recordedFlows:r==="completed"?a.recordedFlows.filter(i=>i.id!==t):a.recordedFlows.map(i=>i.id===t?{...i,processingStatus:r}:i)})),updateRecordedFlowData:(t,r)=>e(a=>({recordedFlows:a.recordedFlows.map(i=>i.id===t?{...i,recordingData:r}:i)})),removeRecordedFlow:t=>e(r=>{let{[t]:a,...i}=r.flowErrors;return{recordedFlows:r.recordedFlows.filter(n=>n.id!==t),flowErrors:i}}),setIsLoading:t=>e({isLoading:t}),setIsLoaded:t=>e({isLoaded:t}),setError:t=>e({error:t,isLoading:!1}),reset:()=>e(nB5)}),LL1=Fx.persistStore?(0,QZ4.create)()((0,bn0.persist)(oB5,{name:"agents",storage:(0,bn0.createJSONStorage)(()=>DO),partialize:e=>({unprocessedFlows:e.unprocessedFlows})})):(0,QZ4.create)()(oB5);lz(LL1,"agents-store-sync");typeof window<"u"&&(window.agentsStore=LL1)});function sB5(){switch(window.windowApi?.getWindowMode?.()||"mainWindow"){case"minified":return"minified";case"recording":return"recording";case"recordingFrame":return"recordingFrame";default:return"mainWindow"}}var cB5,WFi,hB5=C1(()=>{cB5=w4(rr(),1);WN();WFi=typeof window<"u"&&window.windowApi?.getWindowMode?.()||"mainWindow"});function dB5(e,t=!1){let a=sB5()==="minified",i=document.hasFocus();if(a){i||window.notificationApi&&window.notificationApi.sendNotification(e);return}if(!t&&i){wk(e.title,"info");return}if(!window.notificationApi){console.warn("Notification API not available");return}window.notificationApi.sendNotification(e)}var uB5=C1(()=>{Nh1();wu();hB5()});var Ly7,gB5,wy7,pB5=C1(()=>{JZ4();wu();iB5();lB5();uB5();Ly7=async()=>{try{if(xn){let t=aB5();return LL1.getState().setFlows(t),window.dispatchEvent(new CustomEvent("flows_data_updated")),t}let e=await rB5.getAllFlows();return LL1.getState().setFlows(e),window.dispatchEvent(new CustomEvent("flows_data_updated")),e}catch(e){throw console.error("Failed to refresh flows:",e),e}},gB5=()=>{LL1.getState().reset()},wy7=e=>{let r=e.detail;r.type==="flow_processed"&&(console.log("Flow created event received, reloading flows..."),LL1.getState().updateRecordedFlowStatus(r.state.flow_id,eB5(r.state.status)),Ly7(),dB5({title:"Flow ready",body:"Your flow has been processed successfully."})),r.type==="error"&&(console.error("Flow processing error:",r.state.error_message),LL1.getState().updateRecordedFlowStatus(r.state.flow_id,"error"))};typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("agent_explainer",wy7)});var fB5=C1(()=>{});var RQ1,tF4=C1(()=>{fB5();RQ1=class{enabledSessions=new Set;activeTraces=new Map;traceContexts=new Map;checkpoints=new Map;_mappers=[];registerMapper(t){this._mappers.push(t)}get mappers(){return this._mappers}enable(t){this.enabledSessions.add(t)}isEnabled(t){return this.enabledSessions.has(t)}setTraceContext(t,r){let a=this.activeTraces.get(t),i=a&&(a.metadata.traceId!==r.traceId||!a.metadata.traceId),n=a&&i?this._buildTraceFile(a):null;if(n&&(this.activeTraces.delete(t),this.checkpoints.delete(t)),this.traceContexts.set(t,r),this.activeTraces.has(t)){let o=this.activeTraces.get(t);o.metadata={...o.metadata,...r}}else this.activeTraces.set(t,this._createTrace(r,t));return n}setCheckpoint(t,r){this.checkpoints.set(t,r)}currentCheckpoint(t){return this.checkpoints.get(t)}recordAction(t,r){if(!this.enabledSessions.has(t))return;let a=this.activeTraces.get(t);a||(a=this._createTrace(this.traceContexts.get(t)??{},t),this.activeTraces.set(t,a)),a.actions.push({...r,index:a.actions.length+1,metadata:r.metadata??this.checkpoints.get(t)})}peekTrace(t){let r=this.activeTraces.get(t);return r?this._buildTraceFile(r):null}clearTrace(t){this.activeTraces.delete(t),this.checkpoints.delete(t)}finalizeTrace(t){let r=this.peekTrace(t);return r&&this.clearTrace(t),r}activeTraceId(t){return this.activeTraces.get(t)?.traceId??null}_createTrace(t,r){let a=t.traceId??crypto.randomUUID();return{traceId:a,metadata:{traceId:a,title:t.title??"",sessionId:r,startedAt:new Date().toISOString(),...t},actions:[]}}_buildTraceFile(t){return{schemaVersion:"1.0",traceId:t.traceId,metadata:{...t.metadata,endedAt:new Date().toISOString()},actions:t.actions}}}});var mB5=M1((uOi,vB5)=>{vB5.exports=function(e){return{all:e=e||new Map,on:function(t,r){var a=e.get(t);a?a.push(r):e.set(t,[r])},off:function(t,r){var a=e.get(t);a&&(r?a.splice(a.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var a=e.get(t);a&&a.slice().map(function(i){i(r)}),(a=e.get("*"))&&a.slice().map(function(i){i(t,r)})}}}});function Ay7(e){Sn0.has(e)&&clearTimeout(Sn0.get(e)),Sn0.set(e,setTimeout(()=>{D_1.delete(e),Sn0.delete(e)},0))}function r61(e,t){return t?`${e}:${t}`:e}function zy7(e,t,r){let a=[];if(e.frameworkId===Hn0){a.push(r61(e.topic));for(let[i]of D_1)i.startsWith(`${e.topic}:`)&&a.push(i)}else e.frameworkId&&a.push(r61(e.topic,e.frameworkId)),a.push(r61(e.topic));for(let i of a)if(D_1.has(i)){let n=D_1.get(i)??[],o=i.includes(":")?i.split(":")[1]:"broadcast";for(let h of n)t({...h,source:o});r&&e.frameworkId!==Hn0&&Ay7(i)}}function by7(e,t){D_1.has(e)||D_1.set(e,[]),D_1.get(e).push(t)}function $h1(e,t){let{topic:r,frameworkId:a,evaluatePendingEvents:i=!0}=e,n=e.shouldConsume??a!==Hn0;a&&B91.on(r61(r,a),t),B91.on(r61(r),t);let o=!1;return i&&queueMicrotask(()=>{o||zy7({topic:r,frameworkId:a},t,n)}),()=>{o=!0,a&&B91.off(r61(r,a),t),B91.off(r61(r),t)}}function eF4(e,t){let r=e.type,a=r61(r,t),i=r61(r,Hn0),n=r61(r),o=t&&!!B91.all.get(a)?.length,h=!!B91.all.get(i)?.length,u=!t&&!!B91.all.get(n)?.length;o||h||u?(o&&B91.emit(a,{...e,source:t??"broadcast"}),h&&B91.emit(i,{...e,source:t??"broadcast"}),u&&B91.emit(n,{...e,source:"broadcast"})):by7(t?a:n,e)}var CB5,B91,Hn0,D_1,Sn0,rF4=C1(()=>{"use strict";CB5=w4(mB5());globalThis.__autopilotFrameworkEventBus||(globalThis.__autopilotFrameworkEventBus=(0,CB5.default)(),typeof window<"u"&&(window.__autopilotFrameworkEventBus=globalThis.__autopilotFrameworkEventBus));B91=globalThis.__autopilotFrameworkEventBus,Hn0="global",D_1=new Map,Sn0=new Map});var MB5=C1(()=>{"use strict"});var xB5=C1(()=>{"use strict";rF4()});var LB5=C1(()=>{"use strict";rF4();MB5();xB5()});var ZQ1=C1(()=>{LB5()});function jS(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function sY(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Pn0({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function FQ1(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function sF4(e){return{defaultValue:e}}function hF4(e,t,r="/"){return Hy7(e,t,r,!1)}function Hy7(e,t,r,a){let i=typeof t=="string"?FQ1(t):t,n=V91(i.pathname||"/",r);if(n==null)return null;let o=SB5(e);Ty7(o);let h=null;for(let u=0;h==null&&u<o.length;++u){let g=Iy7(n);h=Oy7(o[u],g,a)}return h}function ky7(e,t){let{route:r,pathname:a,params:i}=e;return{id:r.id,pathname:a,params:i,data:t[r.id],loaderData:t[r.id],handle:r.handle}}function SB5(e,t=[],r=[],a="",i=!1){let n=(o,h,u=i,g)=>{let f={relativePath:g===void 0?o.path||"":g,caseSensitive:o.caseSensitive===!0,childrenIndex:h,route:o};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(a)&&u)return;jS(f.relativePath.startsWith(a),`Absolute route path "${f.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(a.length)}let v=Kh1([a,f.relativePath]),C=r.concat(f);o.children&&o.children.length>0&&(jS(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),SB5(o.children,t,C,v,u)),!(o.path==null&&!o.index)&&t.push({path:v,score:Zy7(v,o.index),routesMeta:C})};return e.forEach((o,h)=>{if(o.path===""||!o.path?.includes("?"))n(o,h);else for(let u of HB5(o.path))n(o,h,!0,u)}),t}function HB5(e){let t=e.split("/");if(t.length===0)return[];let[r,...a]=t,i=r.endsWith("?"),n=r.replace(/\?$/,"");if(a.length===0)return i?[n,""]:[n];let o=HB5(a.join("/")),h=[];return h.push(...o.map(u=>u===""?n:[n,u].join("/"))),i&&h.push(...o),h.map(u=>e.startsWith("/")&&u===""?"/":u)}function Ty7(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Fy7(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}function Zy7(e,t){let r=e.split("/"),a=r.length;return r.some(wB5)&&(a+=Ry7),t&&(a+=Py7),r.filter(i=>!wB5(i)).reduce((i,n)=>i+(By7.test(n)?Vy7:n===""?_y7:Ey7),a)}function Fy7(e,t){return e.length===t.length&&e.slice(0,-1).every((a,i)=>a===t[i])?e[e.length-1]-t[t.length-1]:0}function Oy7(e,t,r=!1){let{routesMeta:a}=e,i={},n="/",o=[];for(let h=0;h<a.length;++h){let u=a[h],g=h===a.length-1,f=n==="/"?t:t.slice(n.length)||"/",v=wM2({path:u.relativePath,caseSensitive:u.caseSensitive,end:g},f),C=u.route;if(!v&&g&&r&&!a[a.length-1].route.index&&(v=wM2({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},f)),!v)return null;Object.assign(i,v.params),o.push({params:i,pathname:Kh1([n,v.pathname]),pathnameBase:Gy7(Kh1([n,v.pathnameBase])),route:C}),v.pathnameBase!=="/"&&(n=Kh1([n,v.pathnameBase]))}return o}function wM2(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Dy7(e.path,e.caseSensitive,e.end),i=t.match(r);if(!i)return null;let n=i[0],o=n.replace(/(.)\/+$/,"$1"),h=i.slice(1);return{params:a.reduce((g,{paramName:f,isOptional:v},C)=>{if(f==="*"){let y=h[C]||"";o=n.slice(0,n.length-y.length).replace(/(.)\/+$/,"$1")}let L=h[C];return v&&!L?g[f]=void 0:g[f]=(L||"").replace(/%2F/g,"/"),g},{}),pathname:n,pathnameBase:o,pattern:e}}function Dy7(e,t=!1,r=!0){sY(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,h,u)=>(a.push({paramName:h,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),a]}function Iy7(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return sY(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function V91(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function TB5(e,t="/"){let{pathname:r,search:a="",hash:i=""}=typeof e=="string"?FQ1(e):e,n;if(r)if(Ny7(r))n=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),sY(!1,`Pathnames cannot have embedded double slashes - normalizing ${o} -> ${r}`)}r.startsWith("/")?n=yB5(r.substring(1),"/"):n=yB5(r,t)}else n=t;return{pathname:n,search:jy7(a),hash:Wy7(i)}}function yB5(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function aF4(e,t,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Uy7(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function BB5(e){let t=Uy7(e);return t.map((r,a)=>a===t.length-1?r.pathname:r.pathnameBase)}function VB5(e,t,r,a=!1){let i;typeof e=="string"?i=FQ1(e):(i={...e},jS(!i.pathname||!i.pathname.includes("?"),aF4("?","pathname","search",i)),jS(!i.pathname||!i.pathname.includes("#"),aF4("#","pathname","hash",i)),jS(!i.search||!i.search.includes("#"),aF4("#","search","hash",i)));let n=e===""||i.pathname==="",o=n?"/":i.pathname,h;if(o==null)h=r;else{let v=t.length-1;if(!a&&o.startsWith("..")){let C=o.split("/");for(;C[0]==="..";)C.shift(),v-=1;i.pathname=C.join("/")}h=v>=0?t[v]:"/"}let u=TB5(i,h),g=o&&o!=="/"&&o.endsWith("/"),f=(n||o===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(g||f)&&(u.pathname+="/"),u}function PB5(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function qy7(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}function EB5(e,t){let r=e;if(typeof r!="string"||!kB5.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,i=!1;if(_B5)try{let n=new URL(window.location.href),o=r.startsWith("//")?new URL(n.protocol+r):new URL(r),h=V91(o.pathname,t);o.origin===n.origin&&h!=null?r=h+o.search+o.hash:i=!0}catch{sY(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:i,to:r}}function Jy7(e){if(e.startsWith(`${OB5}:${Yy7}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function Qy7(e){if(e.startsWith(`${OB5}:${Xy7}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new dF4(t.status,t.statusText,t.data)}catch{}}function DB5(e,{relative:t}={}){jS(IQ1(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=to.useContext($N),{hash:i,pathname:n,search:o}=NQ1(e,{relative:t}),h=n;return r!=="/"&&(h=n==="/"?r:Kh1([r,n])),a.createHref({pathname:h,search:o,hash:i})}function IQ1(){return to.useContext(DQ1)!=null}function _91(){return jS(IQ1(),"useLocation() may be used only in the context of a <Router> component."),to.useContext(DQ1).location}function NB5(e){to.useContext($N).static||to.useLayoutEffect(e)}function _n0(){let{isDataRoute:e}=to.useContext(P91);return e?hA7():tA7()}function tA7(){jS(IQ1(),"useNavigate() may be used only in the context of a <Router> component.");let e=to.useContext(I_1),{basename:t,navigator:r}=to.useContext($N),{matches:a}=to.useContext(P91),{pathname:i}=_91(),n=JSON.stringify(BB5(a)),o=to.useRef(!1);return NB5(()=>{o.current=!0}),to.useCallback((u,g={})=>{if(sY(o.current,IB5),!o.current)return;if(typeof u=="number"){r.go(u);return}let f=VB5(u,JSON.parse(n),i,g.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Kh1([t,f.pathname])),(g.replace?r.replace:r.push)(f,g.state,g)},[t,r,n,i,e])}function NQ1(e,{relative:t}={}){let{matches:r}=to.useContext(P91),{pathname:a}=_91(),i=JSON.stringify(BB5(r));return to.useMemo(()=>VB5(e,JSON.parse(i),a,t==="path"),[e,i,a,t])}function eA7(e,t,r,a,i){jS(IQ1(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=to.useContext($N),{matches:o}=to.useContext(P91),h=o[o.length-1],u=h?h.params:{},g=h?h.pathname:"/",f=h?h.pathnameBase:"/",v=h&&h.route;if(oF4){let R=v&&v.path||"";WB5(g,!v||R.endsWith("*")||R.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${g}" (under <Route path="${R}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
9896
|
+
{{snapshot}}`,checklistItemRequest:'Help me document more details for "{{process}}". I need to capture a part of "{{category}}" \u2014 specifically: "{{item}}".',checklistItemRequestNoCategory:'Help me document more details for "{{process}}" \u2014 specifically: "{{item}}".',attachmentsAnswerText:"Please view my attachments to answer your task.",attachmentsBlockedByPolicy:"File attachments are disabled by your organization's governance policy. The answer was sent without them.",attachRecordingTooLarge:"That recording is too large to send. Record a shorter one, or attach it another way.",attachRecordingNotLive:"This task is no longer open, so the recording can't be sent.",useAsAnswer:"Use as answer",recordingNotUploadedYet:"uploads when you send",completedMessage:"Your answer was sent back to **{{email}}**. This delegated task is complete.",composerAnsweredTooltip:"You already sent your answer, so this task is closed."},appsAndDefaults:{description:"Pick the apps the agent uses to open files, send mail, and handle Office documents.",systemDefault:"System default",mailHandler:"Mail handler",officeApp:"Office suite",fileOpener:"File open handler",customProvider:"Custom...",sameAsMail:"Same as mail",calendarHandler:"Calendar handler",customMailPlaceholder:"Provider name (e.g. Fastmail, ProtonMail)",customCalendarPlaceholder:"Provider name (e.g. Fantastical, Cron)",namedProfilesTitle:"Named browser profiles",namedProfilesDescription:"Up to 3. Surfaced to the agent so it can pick the right one for each task (e.g. Personal vs Work).",namedProfilePlaceholder:"Profile name (e.g. Personal)",namedProfileMissing:"Profile no longer detected",removeNamedProfile:"Remove profile",addNamedProfile:"Add profile ({{count}}/{{max}})",addNamedProfileShort:"Add profile",browserSection:"Browser",appsSection:"Apps",pipPreviewTitle:"PiP preview",pipPreviewDescription:"Move the PiP preview back to its default position and size.",resetPipPreview:"Reset",noBrowserDetectedTitle:"No supported browser detected",noBrowserDetectedBody:"Install the Delegate extension in Chrome or Edge to enable background browsing.",tabDescription:"Tell Delegate which app to open for each kind of work, so it stops asking and just does the right thing."},notifications:{clearAll:"Clear all",empty:"No notifications",justNow:"just now",minutesAgo:"{{count}}m ago",hoursAgo:"{{count}}h ago",daysAgo:"{{count}}d ago"},insights:{title:"Your Delegate insights",titleTag:"Delegate insights, {{date}}",generatedOn:"Generated on {{date}}",statSessions:"Sessions",statActiveDays:"Active days",statTotalCost:"Total cost",statCurrentStreak:"Current streak",statFastestTask:"Fastest task",statZeroErrorTasks:"Zero-error tasks",statToolCategories:"Tool categories",statAchievements:"Achievements",aboutYourUsage:"About your usage",noAgentAnalysis:"No agent analysis available.",activityPatterns:"Activity patterns",activityDescription:"You're most active on {{day}} and tend to use Delegate most around {{hour}}.",dayOfWeek:"Day of week",hourOfDay:"Hour of day",thirtyDayActivity:"30-Day activity",activityFooter:"{{active}} active days \xB7 Peak: {{peak}}",modelsUsed:"Models used",commonTopics:"Common topics",recentConversations:"Recent conversations ({{total}} total)",moreConversations:"...and {{count}} more",achievementsTitle:"Achievements ({{unlocked}} / {{total}})",unlockedDate:"Unlocked {{date}}",footer:"Generated by UiPath Delegate",savedToDownloads:"Insights report saved to Downloads",savedDefault:"Insights report saved",generateError:"Failed to generate insights report",untitled:"Untitled",daySun:"Sun",dayMon:"Mon",dayTue:"Tue",dayWed:"Wed",dayThu:"Thu",dayFri:"Fri",daySat:"Sat",dayNA:"N/A"},wiki:{reviseDisabledTooltip:"Add some content first.",cardAddTitle:"Building your knowledge base",cardAddDescription:"Drop in a few files (PDFs, transcripts, notes), describe what it should cover, or tell Delegate what to research. Delegate will read what you share and add it to your local knowledge base.",cardReviseTitle:"Reviewing your knowledge base",cardReviseDescription:"Delegate will read the knowledge base end to end, surface inconsistencies and gaps, and propose fixes. You decide which ones to apply before anything is written.",createButton:"Create knowledge base",growButton:"Expand knowledge base",tidyButton:"Tidy up knowledge base",tidyKickstart:"Begin the knowledge-base review now. Read the knowledge base end to end and list any internal inconsistencies, missing cross-links, structural gaps, stale references, or entries that are duplicated or significantly overlap and should be consolidated. For each issue, describe the proposed change (for duplicates, name which entry to keep and which to merge into it). Do NOT apply any changes yet, present your findings and proposed fixes to the user, then wait for them to tell you which ones to apply (or to modify, or to skip). Once they approve, apply only what they approved using the existing file tools. After the internal pass, offer an external fact-check pass.",startFailedTitle:"Could not start the session",startFailedDescription:"Something went wrong while starting your knowledge base session. Please try again.",ariaCategories:"{{categoryCount}} categories in graph",clusterStats:"{{count}} entities",clusterHoverHint:"Click to enter this category",modeToggleToCategory:"Switch to category view",modeToggleToNode:"Switch to graph view",legendOther:"Other",iconAlt:"Wiki graph icon",openInFileExplorer:"Open in file explorer",titleFallback:"Knowledge base",collapse:"Collapse wiki panel",expand:"Expand wiki panel",activity:"Recent wiki activity",subtitle:"{{pageCount}} pages, {{edgeCount}} edges, updated {{updatedAt}}",tabGraph:"Graph",tabPages:"Pages",tabLog:"Log",tabDiagrams:"Diagrams",documentTabs:{ariaLabel:"Business analysis document views",diagram:"Diagram",taskDesign:"Task design",processDesign:"Process Design",solutionDesign:"Solution Design",processDesignDisabledTooltip:"Available once the Process Design Document (PDD) is generated. Ask Delegate to generate the PDD.",solutionDesignDisabledTooltip:"Available once the Solution Design Document (SDD) is generated. Ask Delegate to generate the SDD.",checklist:"Checklist"},tabSolutionDesign:"Solution design",viewDiagramCta:"View diagram",diagrams:{empty:"No process maps yet. Capture the current process, or design the future process when this is net new.",section:{"as-is-diagram":"AS-IS","to-be-diagram":"TO-BE","task-diagram":"Task flow"},sectionEmpty:"Not yet documented.",zoomIn:"Zoom in",zoomOut:"Zoom out",fit:"Fit",fullscreen:"Fullscreen",toolbarLabel:"Diagram zoom controls",previous:"Previous diagram",next:"Next diagram",pagerLabel:"Switch between diagrams in this page",notCreatedYet:"This diagram has not been created yet",askToCreate:"Ask the agent to create the <em>{{label}}</em> diagram",createPrompt:"I want to create the {{label}} diagram for the current project.",createPage:"Create page",openPage:"Open file",doesNotExistYet:"This diagram does not exist yet.",diagramSuffix:"{{label}} diagram",chipsGroupLabel:"Diagrams",renderFailed:"This diagram could not be displayed.",modeLabel:{automated:"Automated",agent:"Agent",assisted:"Assisted",review:"Review",manual:"Manual"},caseEndsCase:"Ends case",screenshot:{hint:"Click to view the captured screenshot",dialogTitleFallback:"Captured screenshot",loading:"Loading screenshot\u2026",unavailable:"This screenshot could not be loaded."},caseTaskTypeLabel:{process:"Process",action:"Human action",agent:"AI agent","api-workflow":"API workflow",rpa:"RPA","wait-for-timer":"Timer wait","wait-for-connector":"Connector wait","execute-connector-activity":"Connector action","case-management":"Child case"},richView:{toggleGroupLabel:"Diagram view",toggleRich:"Visual",toggleMermaid:"Source",readOnlyBadge:"Read-only",revise:"Revise diagram",prepare:"Prepare visual view",repair:"Repair visual view",sending:"Sending\u2026",degradedWarning:"Some steps could not be fully interpreted. The visual view may be incomplete.",enlarge:"Enlarge diagram",fullscreenTitle:"Diagram view"},attachments:{local:"Provided",generated:"Generated",add:"Attach evidence file",more:"+{{count}} more",humanReviewed:"Reviewed",machineConfirmed:"Verified",remove:"Remove reference",attachFailed:'Could not attach "{{name}}". The reference was not saved.',openFailed:'Could not open "{{name}}". The file may have been moved or deleted.',removeFailed:'Could not remove "{{name}}". The reference is still saved.',orphanedKeys:"Evidence in attachments.md is keyed to stages not on this diagram ({{count}}):"},caseDetail:{noNote:"No capture note yet.",attachments:"Attachments"},sourceTooLong:"Mermaid source exceeds the {{limit}} character limit."},searchPlaceholder:"Search pages",comingSoon:"Coming soon",comingSoonPages:"The Pages tab will list every wiki page with filters and sorting.",comingSoonLog:"The Log tab will show wiki activity over time.",selectedStatsKind:"{{type}} \xB7 {{words}} words",selectedStatsLinks:"Linked from {{backlinks}} \xB7 Links to {{outlinks}}",openPage:"Open file",hoverHint:"Click to open page",zoomIn:"Zoom in",zoomOut:"Zoom out",zoomFit:"Reset zoom",ariaGraph:"Wiki graph, {{pageCount}} pages and {{edgeCount}} connections",ariaCategoryGraph:"Wiki category overview, {{categoryCount}} categories",ariaCategoryItem:"{{name}} category, {{count}} pages",ariaPanel:"Knowledge base",typeLabelEntity:"Entity",typeLabelConcept:"Concept",typeLabelComparison:"Comparison",typeLabelQuery:"Query",typeLabelRaw:"Raw source",viewToggle:{graph:"Graph",files:"Files view",checklist:"Checklist"},contextMenu:{categoryAskPrompt:"Tell me about the {{name}} category in the current project's knowledge base.",categoryEnhancePrompt:"I'd like to improve the {{name}} category in the current project's knowledge base. Suggest a few specific improvements and ask me which to apply. Do not make any changes yet.",folderAskPrompt:"Tell me about the {{path}} folder in the current project's knowledge base.",folderEnhancePrompt:"I'd like to improve the {{path}} folder in the current project's knowledge base. Suggest a few specific improvements and ask me which to apply. Do not make any changes yet.",folderReplacePrompt:"I want to revise the {{path}} folder in the current project's knowledge base. Ask me what should change and suggest a few options first. Do not make any changes yet.",askAboutProject:"Ask about the project...",blockAskStep:"Ask about this step...",blockAskConditional:"Ask about this decision...",blockAskTerminal:"Ask about this terminator...",blockEnhancePrompt:`I'd like to improve "{{label}}" in the {{diagramLabel}} diagram. Suggest a few specific options and ask me which to apply. Do not make any changes yet.`,blockReplacePrompt:'I want to change "{{label}}" in the {{diagramLabel}} diagram. Ask me what it should become and suggest a couple of options. Do not make any changes yet.',projectAskPrompt:"Give me an overview of the current project from its knowledge base, and point out the key areas I can explore.",projectEnhancePrompt:"Review the current project's knowledge base and suggest a few high-value improvements or gaps. Ask me which to pursue. Do not make any changes yet.",pageEnhancePrompt:"I'd like to improve {{name}} ({{path}}) in the current project's knowledge base. Suggest a few specific improvements and ask me which to apply. Do not make any changes yet.",fileEnhancePrompt:"I'd like to improve {{path}} in the current project's knowledge base. Suggest a few specific improvements and ask me which to apply. Do not make any changes yet.",askAbout:"Ask about this...",replace:"Replace this...",enhance:"Suggest improvements...",diagramAskPrompt:"Tell me about the {{label}} diagram in the current project's knowledge base.",diagramReplacePrompt:"I want to revise the {{label}} diagram. Ask me what should change and suggest a few options first. Do not make any changes yet.",diagramEnhancePrompt:"Review the {{label}} diagram and suggest a few specific improvements to the process it describes. Ask me which to apply. Do not make any changes yet.",blockStepAskPrompt:'Explain what the "{{label}}" step does in the {{diagramLabel}} diagram.',blockConditionalAskPrompt:'Explain what the "{{label}}" decision checks in the {{diagramLabel}} diagram.',blockTerminalAskPrompt:'Explain what the "{{label}}" terminator represents in the {{diagramLabel}} diagram.',pageAskPrompt:"Tell me about {{name}} ({{path}}) from the current project's knowledge base.",pageReplacePrompt:"I want to revise {{name}} ({{path}}) in the current project's knowledge base. Ask me what should change and suggest a few options first. Do not make any changes yet.",fileAskPrompt:"Tell me about {{path}} in the current project's knowledge base.",fileReplacePrompt:"I want to revise {{path}} in the current project's knowledge base. Ask me what should change and suggest a few options first. Do not make any changes yet."},fileTree:{ariaLabel:"Wiki files",empty:"No files in this wiki yet",searchEmpty:"No files match your search",errorTitle:"Could not load files",retry:"Retry",editFile:"Edit {{name}}"}},ba:{untitledProjectName:"Untitled",cta:{documentAsIs:"Document AS-IS",documentToBe:"Define TO-BE",documentToBeDisabled:"Document the AS-IS process first.",generatePdd:"Generate PDD",generatePddDisabled:"Document the TO-BE process first."},kickstart:{documentAsIs:"Use the business-analysis skill to document the current process.",generatePdd:"Use the business-analysis skill to generate the PDD.",documentToBe:"Use the business-analysis skill to define the future process."},card:{documentAsIsTitle:"Documenting the AS-IS process",documentAsIsDescription:"Walk Delegate through the current process end to end: who triggers it, the steps that run, the rules, the exceptions, the volumes, the pain points. Delegate writes it up under wiki/as-is/ with a mermaid flowchart.",documentToBeTitle:"Designing the TO-BE process",documentToBeDescription:"Decide what the redesigned process looks like: BPMN process model, Case design, or RPA automation. Delegate writes it up under wiki/to-be/ with the route-specific process model.",generatePddTitle:"Generating the PDD",generatePddDescription:"Delegate is reading wiki/as-is/ and wiki/to-be/ end to end to produce the Process Definition Document: scope, gap analysis, automation candidates, exceptions, volumetrics, and implementation notes."}},bt:{defaultProjectName:"New business task",captureSessionTitle:"Capturing the task",captureGreeting:"Let's set up a new business task - a single, repeatable job I can learn once and then run for you on demand. To get started, **tell me what this task does** in a line or two \u2014 or skip, and just show me by recording the manual run.",recordIt:"Record it",describeIt:"Describe it",recordItPrompt:"I'll record the run.",describeItPrompt:"I'll describe the task.",captureSessionCreateFailed:"Created the task, but couldn't start the conversation. Try again.",newTaskFromRecordingMessage:"I've already recorded this process \u2014 here's the clip. Let's start from it.",recordingReview:{title:"Recording captured",analyse:"Analyse this recording"}},fileEditor:{title:{files:"Files",wiki:"Edit wiki file",skill:"Edit skill: {{name}}"},refreshFiles:"Refresh files",resizeTree:"Resize file tree",openInFinder:"Open in Finder",openInExplorer:"Open in Explorer",saveAll:"Save all (Cmd+Shift+S)",save:"Save (Cmd+S)",okf:{humanReviewed:"Reviewed",machineConfirmed:"Verified",generated:"By agent",generatedBy:"Generated by {{actor}}",verifiedBy:"Verified by {{actor}}",sources:"Sources",staleAfter:"Stale after {{date}}"},frontmatter:"Metadata",binaryFile:"This file isn't editable as text. Open it in its default application instead.",openExternally:"Open in default app"},notices:{spendingLimitReached:{title:"Monthly limit reached",subtitle:"Start a new task with {{modelNames}} to keep going this month.",resetSubtitle:"Wait for the reset on the 1st of next month."}},exportProject:{partialExportWarning:"Could not fetch {{count}} conversation(s); they were skipped.",bundleSaved:"Project exported.",bundleFailed:"Export failed: {{error}}"},exportMarkdown:{partialExportWarning:"Export saved. Some visibility labels may show as UNKNOWN (backend metadata unavailable)."},sdkSettings:{tabs:{security:"Security",tools:"Tools",knowledge:"Knowledge",mcpServers:"MCP servers",behavior:"Behavior",personalization:"Personalization",skills:"Skills",scrollLeft:"Scroll tabs left",scrollRight:"Scroll tabs right"},tools:{description:"Tools available to the agent. Each row shows whether the tool is enabled or governed by your organization.",fileSystemTools:"File system",utilityTools:"Utility",readFile:"Read file",readFileDesc:"Read files from the host filesystem.",writeFile:"Write file",writeFileDesc:"Create or overwrite files on the host filesystem.",editFile:"Edit file",editFileDesc:"Apply targeted edits to existing files.",deleteFile:"Delete file",deleteFileDesc:"Permanently remove files from the host filesystem.",lsDirectory:"List directory",lsDirectoryDesc:"Enumerate directory contents.",grep:"Grep",grepDesc:"Search for text patterns across files.",glob:"Glob",globDesc:"Find files by name pattern.",todo:"Todo",todoDesc:"Track multi-step tasks within a conversation.",offBadge:"Off",preferencesSection:"Preferences",scriptCardDefaultView:{title:"Show raw script in tool cards",description:"When on, shell tool cards open showing the raw script instead of plain-language comments."},useDeferredTools:{title:"Use deferred tools",description:"Send lightweight stubs for rarely-used tools to reduce token usage."}},knowledge:{indexesSection:{title:"Active knowledge sources",description:"Choose which knowledge sources the agent can search."},indexToggle:{ariaLabel:"Toggle knowledge source {{name}}"}},saveError:{title:"Couldn't save your changes",description:"We couldn't save the following: {{fields}}. Try again.",retryButton:"Retry",dismissButton:"Dismiss",fields:{toolExecutionPolicy:"Approval mode",toolSettings:"Tool preferences",behaviorPreferences:"Behavior preferences",customProfiles:"Custom profiles",customInstruction:"Custom instruction",useFollowUps:"Follow-up suggestions",scriptCardDefaultView:"Tool card view",useDeferredTools:"Deferred tools",contextGroundingIndexes:"Knowledge sources"}},skills:{description:"Skills the agent can draw on. Toggle a skill off to keep it out of the agent\u2019s context for this session.",builtInSkills:"Built-in skills",otherSkills:"Other skills",loading:"Loading skills\u2026",empty:"No skills available.",emptyHint:"Skills become available when your host environment provides them.",newSkill:"+ New skill",editSkill:"Edit skill",deleteSkillAria:"Delete skill",deleteConfirm:"Delete this skill?",deleting:"Deleting\u2026",editor:{nameLabel:"Name",contentLabel:"Content",nameTooLong:"Name must be 64 characters or fewer.",nameTaken:"A skill with this name already exists.",namePathSeparator:"Name cannot contain slashes or control characters.",nameTraversal:'Name cannot be "." or "..".',nameReserved:"This name is reserved by the skill scanner \u2014 pick a different one.",saveFailed:"Could not save skill. {{detail}}",deleteFailed:"Could not delete skill. {{detail}}",readFailed:"Could not load skill. {{detail}}",fsUnavailable:"Filesystem service is not available.",newSubtitle:"Describe what the skill does and when the agent should use it.",editSubtitle:"Update the description, content, or examples used by the agent.",viewSubtitle:"Read-only view of a built-in skill.",renameWarning:"Saving will move this skill to a new file. Open chats that refer to the previous name may not find it until the session refreshes.",nameKebabHint:"Suggested: lowercase letters, digits, and dashes.",saving:"Saving\u2026"},viewSkill:"View skill contents",viewSkillTitle:"View skill",localSkills:"Local skills",localSkillsEmpty:'Create your first skill with "+ New skill".',downloadSkill:"Download skill",downloadSkillNamed:"Download {{name}}",importSkill:"Import",importOverwriteTitle:"Replace existing skill?",importOverwriteBody:'A skill named "{{name}}" already exists. Replace it with the imported one?',importReplace:"Replace",importFailed:"Could not import skill. {{detail}}",exportFailed:"Could not export skill. {{detail}}",deleteConfirmBody:'Permanently removes "{{name}}" from your skills. This cannot be undone.'}},skillDup:{dialog:{title:"Skill already exists",bodyExisting:"Existing:",bodyIncoming:"Incoming:",versionAnnotation:{newer:"Existing: v{{existingVersion}} \xB7 Incoming: v{{incomingVersion}} (newer)",older:"Existing: v{{existingVersion}} \xB7 Incoming: v{{incomingVersion}} (older)",same:"Both are version v{{version}}"},bodyExistingMany:'{{count}} existing skills are named "{{name}}":',replaceAllNotice:"Replacing will remove all {{count}} existing copies and install the new one in their place.",actions:{cancel:"Cancel",replace:"Replace existing",replaceAll:"Replace all ({{count}})",keepBoth:"Keep both"},pluginBundledCaption:"Replace isn't available because one of the existing copies is bundled with a plugin. Use Keep both to install your copy alongside it.",srDescription:"Choose how to handle the duplicate skill name",existingFolder:"In folder: {{folder}}"},pluginAutoDisable:{toast_one:"Plugin {{name}} installed. 1 skill was disabled because it conflicts with an existing copy. Review it in Add-ons & Integrations \u2192 Skills.",toast_other:"Plugin {{name}} installed. {{count}} skills were disabled because they conflict with existing copies. Review them in Add-ons & Integrations \u2192 Skills."},badge:{tooltipHeader:"Duplicate skill ({{count}} copies installed)",memberLine:"{{source}} \xB7 v{{version}} \xB7 {{folder}}",memberLineNoVersion:"{{source}} \xB7 {{folder}}",actionHint:"To remove a copy, use the row's actions on each one.",ariaLabel:"Duplicate skill warning"}},routineDup:{badge:{tooltipHeader:"Duplicate routine ({{count}} copies installed)",actionHint:"To remove a copy, use the row's actions on each one.",ariaLabel:"Duplicate routine warning"}},recordingReference:{sectionTitle:"Recordings",empty:"No recordings yet",emptyHint:"Record your screen to reference it here",noMatches:'No matches for "{{query}}"',alreadyAdded:"Already added",placeholderHint:"Type / for routines, @ to mention, # for a recording"},fileReference:{empty:"No files in this project",noMatches:'No files match "{{query}}"'},livingDocument:{tdd:{regionLabel:"Task design document",navRegion:"Document sections",hideNav:"Hide section navigation",showNav:"Show section navigation"},table:{caption:"Table"},callout:{note:"Note",info:"Info",warning:"Warning",tip:"Tip"},image:{alt:"Image",unavailable:"Image not available",caption:"Figure"},cover:{region:"Document cover",client:"Client",author:"Author",date:"Date"},toc:{region:"Table of contents",title:"Contents",placeholder:"Table of contents (up to level {{maxLevel}})"},diagram:{loading:"Loading diagram...",unavailable:"Diagram not available",emptyAlt:"Empty diagram",bpmnAlt:"BPMN process model",bpmnLoading:"Loading BPMN diagram...",bpmnUnavailable:"BPMN diagram is unavailable.",caption:"Figure"},action:{updateSection:"Update section",activate:"Activate action: {{label}}",markReviewed:"Mark as reviewed",reviewed:"Reviewed",download:"Download",editDetails:"Edit details",refineSection:"Refine section",downloading:"Preparing download\u2026",unavailable:"This action isn't available here. Use the controls in the document panel."},navigation:{needsReview:"{{section}}, needs review"},section:{needsReview:"{{section}} needs review.",sourceChanged:"Source content changed after this draft was generated. Review this entire section.",unnamed:"Unnamed section",renderError:"Section could not be rendered."},view:{regionLabel:"Process design document",bodyRegionLabel:"Document body"},find:{open:"Find in document",placeholder:"Find in document",count:"{{current}} of {{total}}",noResults:"No results",previous:"Previous match",next:"Next match",close:"Close find"},tab:{label:"Process design (PDD)"},status:{draft:"Draft",completed:"Completed",generating:"Generating draft",discovering:"Loading draft"},summary:{sectionsNeedReview:"{{count}} sections need review",sectionsNeedReview_one:"{{count}} section needs review",reviewAffected:"Review or update these sections:",openItems_one:"{{count}} open item remains",openItems_other:"{{count}} open items remain"},hint:{deliverableOutOfDate:"Deliverable out of date"},empty:{noDraft:"No draft yet"},metadata:{title:"Edit document details",client:"Client",author:"Author",date:"Date",version:"Version",editField:"Edit {{field}}",addField:"Add {{field}}",saveFailed:"Save failed. Please try again.",save:"Save",cancel:"Cancel"},badge:{outOfDate:"Out of date"},error:{downloadRequiresReview:"Mark the document as reviewed to download it.",downloadFailed:"Couldn't create the document: {{error}}"},warning:{diagramsOmitted_one:"The document was saved, but {{count}} diagram could not be rendered and was omitted.",diagramsOmitted_other:"The document was saved, but {{count}} diagrams could not be rendered and were omitted.",imagesOmitted_one:"The document was saved, but {{count}} image could not be read and was omitted.",imagesOmitted_other:"The document was saved, but {{count}} images could not be read and were omitted."},gapGate:{title:"Mark as reviewed?",description:"These sections have no captured content and will be omitted from the downloaded document:",confirm_one:"Mark reviewed & omit {{count}} section",confirm_other:"Mark reviewed & omit {{count}} sections",markReviewedFailed:"Could not mark as reviewed. The draft was kept. Please try again.",resyncReviewNeeded:"This document was updated with the latest information, and some sections now need review. Mark as reviewed again to confirm."},openItem:{label:"Open item",ariaLabel:"Open item: {{reason}}"}},panelResizeHandle:{ariaLabel:"Resize document panel"},richDiagram:{reason:{missingFamily:"The diagram type is not set. Add a diagram family to enable rich view.",unsupportedFamily:"The declared diagram type is not supported for rich view.",frontmatterParseError:"The diagram frontmatter could not be parsed. Check the page header.",invalidSyntax:"The diagram contains syntax errors that prevent rich rendering.",unsupportedDiagramType:"This diagram type is not supported for rich view.",adapterFailure:"The diagram could not be processed for rich view.",unresolvedEndpoint:"Some diagram connections could not be resolved.",sparseGraph:"The diagram does not have enough elements for rich view.",missingSemantics:"The diagram nodes are missing semantic class annotations.",degradedSemanticCoverage:"Some steps could not be fully classified. The rich view may be incomplete.",unknownClasses:"Some diagram nodes have unrecognized class annotations.",conflictingSemantics:"Some diagram nodes have conflicting class annotations.",sourceTooLarge:"The diagram is too large for rich view."}},subAgents:{title:"Agents",count_one:"{{count}} agent",count_other:"{{count}} agents",running:"{{count}} running",failed:"{{count}} failed",stopped:"{{count}} stopped",stop:"Stop",stopAll:"Stop all",stopping:"Stopping\u2026",needAttention_one:"{{count}} needs your attention",needAttention_other:"{{count}} need your attention",tooltip:"Agents",statusDone:"Done",statusFailed:"Failed",statusStopped:"Stopped",statusNeedsAttention:"Needs your attention",waitingForApproval:"Waiting for your approval",backToParent:"Back to {{title}}",backToParentGeneric:"Back to parent session"},deepLinkConfirm:{title:"Run from link?",warning:"This was opened from an external link. Review it before running.",run:"Run",cancel:"Cancel"},importConversations:{alreadyImported:"Already imported",close:"Close",done:"Done",empty:"No conversations found from Claude Code, Claude Cowork, or Codex",failedItems:"Failed items:",importButton:"Import selected",importing:"Importing...",partialScanWarning:"Some sources could not be scanned, so results may be incomplete",privacyNote:"Imported conversations are stored only on this device.",progress:"Importing {{done}} of {{total}}: {{title}}",resultSummary_one:"{{imported}} imported, {{skipped}} skipped, {{failed}} failed.",resultSummary_other:"{{imported}} imported, {{skipped}} skipped, {{failed}} failed.",scanError:"Scan failed",scanning:"Scanning for conversations...",selectAll:"Select all",title:"Import conversations"},dataTable:{noResultsTitle:"No results found",tryDifferentSearch:"Try a different search term.",emptyDefault:"No data available.",emptyFilterDefault:"No results match your search.",expandRow:"Expand row"},spendingLimit:{srTitle:"Spending limit warning",srDescription:"Usage limit warning with option to request a reset",title:"Spending limit reached",bodyWithUsage:"You've used {{percent}}% of your monthly limit. To request a usage reset, reach out on Slack.",body:"To request a usage reset, reach out on Slack.",openChannel:"Open {{channel}}",skip:"Skip for now"},sessionShare:{copyFailed:"Session shared, but the link could not be copied to the clipboard",copied:"Shared link was copied to clipboard",failed:"Share failed: {{message}}",failedFallback:"Failed to share session"},cartographer:{fre:{defaultProjectName:"New business process",discoveringTitle:"Discovering the process",mappingAsIsTitle:"Mapping the as-is",greeting:"Let's start with **one process you know well**. Tell me what it is and how it runs today \u2014 in your own words, however messy. I'll ask about the steps, the decisions and the systems as we go.",pickOneCaption:"Pick one to start from, or describe your own below.",sessionCreateFailed:"Created the project, but couldn't start the conversation. Try again.",splash:{title:"Your organization, mapped.",subtitle:"Start with one business process you know well. Talk it through with the agent, and what you say becomes something your team can follow.",value1Title:"Say how it works",value1Desc:"In your own words, messy parts included.",value2Title:"See it read back",value2Desc:"Steps, decisions and systems, as you talk.",value3Title:"Keep the write-up",value3Desc:"A process your team can follow and find.",chooseIndustry:"Choose your industry",industryQuestion:"Which industry do you work in?",industryHint:"It picks the examples the agent opens with, and narrows the map to the work your kind of company does. Change it any time.",other:"Other",customIndustryPlaceholder:"Type your industry",startMapping:"Start mapping",previousPage:"Previous page",nextPage:"Next page",starting:"Setting up your project\u2026"},industry:{healthcare:"Healthcare",banking:"Banking",insurance:"Insurance",manufacturing:"Manufacturing",telecom:"Telecom",utilities:"Utilities",retail:"Retail","finance-accounting":"Finance & Accounting","cross-industry":"Cross-industry"},suggestions:{healthcare:{"1":"Patient intake & registration","2":"Insurance claim submissions","3":"Prior authorization requests","4":"Discharge summaries & follow-ups"},banking:{"1":"Loan application processing","2":"KYC onboarding checks","3":"Dispute & chargeback handling","4":"Account closure requests"},insurance:{"1":"Claims intake & triage","2":"Policy renewals","3":"Underwriting file preparation","4":"Policy endorsement changes"},manufacturing:{"1":"Purchase order processing","2":"Quality inspection reports","3":"Production change requests","4":"Supplier onboarding"},telecom:{"1":"Service activation orders","2":"Billing dispute resolution","3":"Network incident tickets","4":"Customer plan changes"},utilities:{"1":"New service connections","2":"Meter reading validation","3":"Outage report handling","4":"Billing exception reviews"},retail:{"1":"Customer refunds & returns","2":"Inventory replenishment","3":"Price change approvals","4":"Supplier invoice matching"},"finance-accounting":{"1":"Invoice approvals","2":"Month-end close checks","3":"Expense report reviews","4":"Vendor payment queries"},"cross-industry":{"1":"Employee onboarding","2":"Purchase approvals","3":"Customer complaint handling","4":"Contract reviews"}},roleQuestion:"Quick one before we start \u2014 what's your role?",roleSkip:"Skip for now",processQuestion:"Great \u2014 now, which process should we map first?",combinedAnswer:"I work in {{role}}. The process I want to map is {{process}}."}},delegate:{fre:{splash:{title:"Work, delegated.",subtitle:"Hand over the small, repeating work that eats your day. Describe it once, watch it run, and keep whatever you'd rather not do again.",value1Title:"Say what you need",value1Desc:"Describe the task the way you'd ask a colleague.",value2Title:"It does the work",value2Desc:"In the apps you already use, step by step.",value3Title:"You check it off",value3Desc:"Look it over, then let it run on its own.",cta:"Hand off my first task",starting:"Getting things ready\u2026"},tour:{step1Title:"Hand off from here",step1Body:`Say what you need in a sentence. Type "/" for something you've set up already, "@" for one of your apps.`,step2Title:"Keep related work together",step2Body:"Point the conversation at a project and everything you hand off stays in one place.",step3Title:"Pick up where you left off",step3Body:"Everything you've handed off is waiting in the side panel, still running or ready to review.",counter:"{{current}} of {{total}}",skip:"Skip",next:"Next",done:"Got it"}}}}});function Ck5(e){if(e==="auto"){let t=navigator.language;if(mk5.some(a=>a.code===t))return t;let r=t.split("-")[0];return mk5.some(a=>a.code===r)?r:"en"}return e}function bQ1(){return A91.default.resolvedLanguage??A91.default.language}function Mk5(e){e&&(typeof document>"u"||(document.documentElement.lang=e))}var A91,nZ4,mk5,k9,CW=C1(()=>{A91=w4(Si0(),1),nZ4=w4(jh1(),1);fk5();mk5=[{code:"auto",name:"Auto detect"},{code:"en",name:"English"},{code:"de",name:"Deutsch (Germany)"},{code:"es",name:"Espa\xF1ol (Spain)"},{code:"es-MX",name:"Espa\xF1ol (Mexico)"},{code:"fr",name:"Fran\xE7ais (France)"},{code:"ja",name:"\u65E5\u672C\u8A9E (Japan)"},{code:"ko",name:"\uD55C\uAD6D\uC5B4 (Korea)"},{code:"pt",name:"Portugu\xEAs (Portugal)"},{code:"pt-BR",name:"Portugu\xEAs (Brazil)"},{code:"ro",name:"Rom\xE2n\u0103 (Romania)"},{code:"tr",name:"T\xFCrk\xE7e (Turkey)"},{code:"zh-CN",name:"\u7B80\u4F53\u4E2D\u6587 (China)"},{code:"zh-TW",name:"\u7E41\u9AD4\u4E2D\u6587 (Taiwan)"}];nZ4.initReactI18next&&A91.default.use(nZ4.initReactI18next);A91.default.init({resources:{en:{translation:vk5}},lng:"en",fallbackLng:"en",interpolation:{escapeValue:!1},react:{useSuspense:!1}});typeof A91.default.on=="function"&&A91.default.on("languageChanged",Mk5);Mk5(A91.default.resolvedLanguage??A91.default.language);k9=A91.default});function $i0(e){return SQ1.has(e)}var Wi0,SQ1,oZ4,xk5,Rx7,qi0,gRi,HQ1=C1(()=>{Wi0=[{snapshotKey:"pathBlocklist",policyKey:"restrictedPaths"},{snapshotKey:"blockedSites",policyKey:"blockedUiaSites"},{snapshotKey:"blockedApplications",policyKey:"blockedApps"},{snapshotKey:"preApprovedSites",policyKey:"trustedSites"},{snapshotKey:"preApprovedApplications",policyKey:"preApprovedApps"}],SQ1=new Set(["theme","accentColor","foregroundColor","backgroundColor","uiFont","codeFont","language","soundEffectsEnabled","flashOnApprovalNeeded","showE2ERecordingButton","privacy","agentName","sessionId","selectedTenant","tenantByOrg","keyboardShortcuts","assistantHotkeys","mergedShortcutDefaultsSeeded","hasSeenPermissionsSetup","permissionsSetupAppVersion","hasCompletedSetup","hasSeenOnboarding","hasSeenConversationalOnboarding","hasSeenCartographerFre","userIndustry","userIndustryCustomText","hasSeenDelegateFreSplash","hasSeenDelegateHomeTour","permissionsTabSeen","browserExtensionsTabSeen","position","autoDownloadUpdates","authTcpPort","pipModePreference","enableAutoMinimize","maximizeTargetApp","defaultScreenContextMode","firstUserTurnSendsFullScreen","sendAttachableWindowTitles","backgroundSubMode","backgroundModeProfile","browserExtensionAvailable","screenshotShortcutCaptureMode","defaultFileOpener","defaultMailHandler","defaultMailProviderCustomName","defaultCalendarHandler","defaultCalendarProviderCustomName","defaultOfficeApp","namedBrowserProfiles","conversationStorageMode","uipCliAuthMode","marketplaceFeeds","feedEtags","pluginUserConfig","pluginEnabledState","skillsConfig","localMcpServers","useDeterministicRoutineTitles","pinnedConversationIds","contextGroundingIndexes","singleClickPerTurn","rcChannelEnabled","lastKnownAppVersion","zoomLevel","lastConnectFolderByTenant","remoteWorkerEnabled","installationId","projectAccessPolicy"]),oZ4=new Set(["version","limitScreenshotsToAttachedApps","screenContextEnabled"]),xk5=new Set(["toolSettings","toolExecutionPolicy"]),Rx7=["selectedModel","cartographerModel","effort","effortHasUserOverride","executionMode","useEagerPlanning","showAdvancedSettings","useDeferredTools","behaviorPreferences","customProfiles","favoriteRoutineIds","favouriteSkills","alwaysCollapseToolCards","scriptCardDefaultView","connectionFilterMode","toolSettings","toolExecutionPolicy"],qi0=new Set(Rx7),gRi=new Set(["mcpServers",...oZ4])});var oY,z91,Ki0=C1(()=>{oY="Delegate.Extension.",z91="Delegate.Plugin."});function Lk5(e){return`${oY}${Ci0(e)}`}function kQ1(e){return`${z91}${Ci0(e)}`}function lZ4(e){let t=e.startsWith(oY)?e.slice(oY.length):e;return eM2(t)}function cZ4(e){let t=e.startsWith(z91)?e.slice(z91.length):e;return eM2(t)}function P_1(e){if(!e)return{role:null,type:null,topicTags:[]};let t=e.includes("|")?"|":" ",r=e.split(t).map(o=>o.trim().toLowerCase()).filter(o=>o.length>0),a=null,i=null,n=[];for(let o of r)o.startsWith("role:")?a=o.slice(5):o.startsWith("type:")?i=o.slice(5):o!=="delegate"&&o!=="skill"&&n.push(o);return{role:a,type:i,topicTags:n}}function wk5(e){return(e.startsWith(oY)?e.slice(oY.length):e).replace(/([a-z])([A-Z])/g,"$1 $2").trim()}function sZ4(e){let t=[oY,z91].find(r=>e.startsWith(r));return eM2(t?e.slice(t.length):e)}function yk5(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function t61(e){return e&&e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&#(\d+);/g,(t,r)=>String.fromCodePoint(Number(r))).replace(/&#x([0-9a-fA-F]+);/g,(t,r)=>String.fromCodePoint(parseInt(r,16))).replace(/&/g,"&")}function Ak5(e){return`broker/${encodeURIComponent(e)}`}var hM2=C1(()=>{Ki0();Mi0();Mi0()});function Yi0(e){let{skills:t,enabledSkills:r,lastEnabledByName:a}=e,i=new Map;for(let h of t){if(!h.frontmatterName)continue;let u=pL1(h.frontmatterName);if(u==="")continue;let g=i.get(u);g?g.push(h):i.set(u,[h])}let n=null,o=[];for(let[h,u]of i){let g=u.filter(L=>r[L.location]!==!1);if(g.length<=1)continue;let f=Zx7(h,g,a),v=g.filter(L=>L.location!==f.location).map(L=>L.location);n===null&&(n={...r});for(let L of v)n[L]=!1;let C=[...new Set(g.map(L=>L.source))].sort((L,y)=>L.localeCompare(y));o.push({name:h,keptLocation:f.location,disabledLocations:v,reason:f.reason,sources:C})}return{enabledSkills:n??r,corrections:o}}function Zx7(e,t,r){let a=r[e];if(a){let C=t.find(L=>L.location===a.winnerLocation);if(C)return{location:C.location,reason:"user-toggle"}}let i=t.filter(C=>C.tracked===!0),n=i.length>0?i:t;if(n.length===1)return{location:n[0].location,reason:"tracked"};let o=n.filter(C=>C.version!==void 0&&C.version!==null),h=n;if(o.length>0){let C=o.reduce((y,z)=>J51(z.version,y)>0?z.version:y,o[0].version),L=o.filter(y=>J51(y.version,C)===0);if(L.length<n.length){if(L.length===1)return{location:L[0].location,reason:"version"};h=L}}let u=h.filter(C=>typeof C.mtime=="number"),g=h;if(u.length>0){let C=Math.max(...u.map(y=>y.mtime)),L=u.filter(y=>y.mtime===C);if(L.length<h.length){if(L.length===1)return{location:L[0].location,reason:"mtime"};g=L}}return{location:[...g].sort((C,L)=>C.location<L.location?-1:C.location>L.location?1:0)[0].location,reason:"path"}}var hZ4=C1(()=>{xi0();hM2()});function Fx7(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619)>>>0;return t.toString(16).padStart(8,"0")}var zk5,bk5=C1(()=>{hZ4();zk5=e=>(t,r,a)=>e(((n,o)=>{t(n,o);let h=r();if(!Array.isArray(h?.skills))return;let u=h?.skillsConfig;if(!u||typeof u.enabledSkills!="object"||u.enabledSkills===null)return;let g=u.enabledSkills,f=u.lastEnabledByName??{},v=Yi0({skills:h.skills,enabledSkills:g,lastEnabledByName:f});if(!Object.is(v.enabledSkills,g)){t({skillsConfig:{...h.skillsConfig,enabledSkills:v.enabledSkills}},!1);for(let C of v.corrections){let L=C.disabledLocations.length+1,y=C.sources.join(","),z=Fx7(C.keptLocation),S=`[SkillDupGuard] invariant: group=${C.name} size=${L} sources=${y} kept=${z} reason=${C.reason}`;window.debugApi?.log?.(S)}}}),r,a)});function Sk5(e,t){let r={};for(let[i,n]of Object.entries(e))r[pL1(i)]=n;let a={};for(let i of t){let n=pL1(i.name);if(n&&n in r){a[i.location]=r[n];continue}if(i.frontmatterName){let o=pL1(i.frontmatterName);o&&o in r&&(a[i.location]=r[o])}}return a}var Hk5=C1(()=>{xi0()});function lY(){return b91.getState().status==="online"}var Tk5,kk5,b91,__1=C1(()=>{Tk5=w4(Lu(),1),kk5={status:"online",reason:null,lastCheckedAt:null,lastOnlineAt:null,offlineSince:null,lastErrorSource:null},b91=(0,Tk5.create)()((e,t)=>({...kk5,setChecking:()=>e({status:"checking",lastCheckedAt:Date.now()}),markOnline:r=>e({status:"online",reason:null,offlineSince:null,lastErrorSource:r??null,lastOnlineAt:Date.now(),lastCheckedAt:Date.now()}),markReconnectAvailable:r=>e({status:"reconnectAvailable",reason:null,lastErrorSource:r??null,lastOnlineAt:Date.now(),lastCheckedAt:Date.now()}),markOffline:(r,a)=>{let{offlineSince:i}=t();e({status:"offline",reason:r,lastErrorSource:a??null,offlineSince:i??Date.now(),lastCheckedAt:Date.now()})},reset:()=>e({...kk5})}))});function Ox7(e){return typeof navigator<"u"&&navigator.onLine===!1?"browser-offline":Pk5(e)!==null||Ux7(e)?null:Gx7(e)?"timeout":jx7(e)?"network":null}function Dx7(e){let t=Pk5(e);return t!==null&&t>=500}function Ix7(e){let t=e?.config;return t?`${t.baseURL??""}${t.url??""}`.includes("/v1/chat"):!1}function Nx7(e){let t=e?.config;if(!t)return!1;let r=`${t.baseURL??""}${t.url??""}`;if(!r||typeof window>"u")return!1;try{return new URL(r,window.location.href).origin!==window.location.origin}catch{return!1}}function mL1(e,t){if(!ic("offlineMode")||t==="ariaHttpClient"&&!Ix7(e))return;let r=Ox7(e);if(r){if(r!=="browser-offline"&&Nx7(e)&&dZ4){dZ4(`${t}-cross-origin`);return}b91.getState().markOffline(r,t);return}Dx7(e)&&dZ4?.(`${t}-5xx`)}function Bk5(e,t="preflight"){if(!ic("offlineMode"))return!1;let r=typeof navigator<"u"&&navigator.onLine===!1?"browser-offline":e.cause==="timeout"?"timeout":e.cause==="server"?"server-unavailable":"network";return b91.getState().markOffline(r,t),!0}function IO(e){return lY()?!0:(console.debug(`[backendAvailability] blocked "${e}" while offline`),!1)}function Vk5(e){if(!lY())throw new uZ4(e)}function Pk5(e){if(e&&typeof e=="object"){let t=e.response;if(t&&typeof t.status=="number")return t.status;let r=e.status;if(typeof r=="number")return r}return null}function Ux7(e){if(!e||typeof e!="object")return!1;let t=e.name;return t==="AbortError"||t==="CanceledError"?!0:e.code==="ERR_CANCELED"}function Gx7(e){if(!e||typeof e!="object")return!1;let t=e.code;if(t==="ECONNABORTED"||t==="ETIMEDOUT")return!0;let r=(e.message??"").toLowerCase();return r.includes("timeout")||r.includes("timed out")||r.includes("aborted")}function jx7(e){if(!e||typeof e!="object")return!1;let t=e.code;if(t==="ERR_NETWORK"||t==="ECONNREFUSED"||t==="ENOTFOUND")return!0;let r=(e.name??"").toLowerCase(),a=(e.message??"").toLowerCase();return a.includes("failed to fetch")||a.includes("network error")||a.includes("networkerror")||a.includes("err_network")||a.includes("net::err_")||a.includes("connection_timed_out")||a.includes("err_connection_refused")||a.includes("err_name_not_resolved")||r==="typeerror"&&a.includes("fetch")}var dZ4,uZ4,E_1=C1(()=>{OO();__1();__1();dZ4=null,uZ4=class extends Error{constructor(t){super(`Backend is offline; "${t}" is unavailable.`),this.name="OfflineMutationBlockedError",this.operation=t}}});var dM2=M1((Xi0,_k5)=>{(function(e,t){typeof Xi0=="object"?_k5.exports=Xi0=t():typeof define=="function"&&define.amd?define([],t):e.CryptoJS=t()})(Xi0,function(){var e=e||(function(t,r){var a;if(typeof window<"u"&&window.crypto&&(a=window.crypto),typeof self<"u"&&self.crypto&&(a=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(a=globalThis.crypto),!a&&typeof window<"u"&&window.msCrypto&&(a=window.msCrypto),!a&&typeof global<"u"&&global.crypto&&(a=global.crypto),!a&&typeof Z4=="function")try{a=Z4("crypto")}catch{}var i=function(){if(a){if(typeof a.getRandomValues=="function")try{return a.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof a.randomBytes=="function")try{return a.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},n=Object.create||(function(){function B(){}return function(R){var F;return B.prototype=R,F=new B,B.prototype=null,F}})(),o={},h=o.lib={},u=h.Base=(function(){return{extend:function(B){var R=n(this);return B&&R.mixIn(B),(!R.hasOwnProperty("init")||this.init===R.init)&&(R.init=function(){R.$super.init.apply(this,arguments)}),R.init.prototype=R,R.$super=this,R},create:function(){var B=this.extend();return B.init.apply(B,arguments),B},init:function(){},mixIn:function(B){for(var R in B)B.hasOwnProperty(R)&&(this[R]=B[R]);B.hasOwnProperty("toString")&&(this.toString=B.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),g=h.WordArray=u.extend({init:function(B,R){B=this.words=B||[],R!=r?this.sigBytes=R:this.sigBytes=B.length*4},toString:function(B){return(B||v).stringify(this)},concat:function(B){var R=this.words,F=B.words,N=this.sigBytes,j=B.sigBytes;if(this.clamp(),N%4)for(var Y=0;Y<j;Y++){var t1=F[Y>>>2]>>>24-Y%4*8&255;R[N+Y>>>2]|=t1<<24-(N+Y)%4*8}else for(var n1=0;n1<j;n1+=4)R[N+n1>>>2]=F[n1>>>2];return this.sigBytes+=j,this},clamp:function(){var B=this.words,R=this.sigBytes;B[R>>>2]&=4294967295<<32-R%4*8,B.length=t.ceil(R/4)},clone:function(){var B=u.clone.call(this);return B.words=this.words.slice(0),B},random:function(B){for(var R=[],F=0;F<B;F+=4)R.push(i());return new g.init(R,B)}}),f=o.enc={},v=f.Hex={stringify:function(B){for(var R=B.words,F=B.sigBytes,N=[],j=0;j<F;j++){var Y=R[j>>>2]>>>24-j%4*8&255;N.push((Y>>>4).toString(16)),N.push((Y&15).toString(16))}return N.join("")},parse:function(B){for(var R=B.length,F=[],N=0;N<R;N+=2)F[N>>>3]|=parseInt(B.substr(N,2),16)<<24-N%8*4;return new g.init(F,R/2)}},C=f.Latin1={stringify:function(B){for(var R=B.words,F=B.sigBytes,N=[],j=0;j<F;j++){var Y=R[j>>>2]>>>24-j%4*8&255;N.push(String.fromCharCode(Y))}return N.join("")},parse:function(B){for(var R=B.length,F=[],N=0;N<R;N++)F[N>>>2]|=(B.charCodeAt(N)&255)<<24-N%4*8;return new g.init(F,R)}},L=f.Utf8={stringify:function(B){try{return decodeURIComponent(escape(C.stringify(B)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(B){return C.parse(unescape(encodeURIComponent(B)))}},y=h.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new g.init,this._nDataBytes=0},_append:function(B){typeof B=="string"&&(B=L.parse(B)),this._data.concat(B),this._nDataBytes+=B.sigBytes},_process:function(B){var R,F=this._data,N=F.words,j=F.sigBytes,Y=this.blockSize,t1=Y*4,n1=j/t1;B?n1=t.ceil(n1):n1=t.max((n1|0)-this._minBufferSize,0);var a1=n1*Y,s1=t.min(a1*4,j);if(a1){for(var p1=0;p1<a1;p1+=Y)this._doProcessBlock(N,p1);R=N.splice(0,a1),F.sigBytes-=s1}return new g.init(R,s1)},clone:function(){var B=u.clone.call(this);return B._data=this._data.clone(),B},_minBufferSize:0}),z=h.Hasher=y.extend({cfg:u.extend(),init:function(B){this.cfg=this.cfg.extend(B),this.reset()},reset:function(){y.reset.call(this),this._doReset()},update:function(B){return this._append(B),this._process(),this},finalize:function(B){B&&this._append(B);var R=this._doFinalize();return R},blockSize:512/32,_createHelper:function(B){return function(R,F){return new B.init(F).finalize(R)}},_createHmacHelper:function(B){return function(R,F){return new S.HMAC.init(B,F).finalize(R)}}}),S=o.algo={};return o})(Math);return e})});var Rk5=M1((Ji0,Ek5)=>{(function(e,t){typeof Ji0=="object"?Ek5.exports=Ji0=t(dM2()):typeof define=="function"&&define.amd?define(["./core"],t):t(e.CryptoJS)})(Ji0,function(e){return(function(t){var r=e,a=r.lib,i=a.WordArray,n=a.Hasher,o=r.algo,h=[],u=[];(function(){function v(z){for(var S=t.sqrt(z),B=2;B<=S;B++)if(!(z%B))return!1;return!0}function C(z){return(z-(z|0))*4294967296|0}for(var L=2,y=0;y<64;)v(L)&&(y<8&&(h[y]=C(t.pow(L,1/2))),u[y]=C(t.pow(L,1/3)),y++),L++})();var g=[],f=o.SHA256=n.extend({_doReset:function(){this._hash=new i.init(h.slice(0))},_doProcessBlock:function(v,C){for(var L=this._hash.words,y=L[0],z=L[1],S=L[2],B=L[3],R=L[4],F=L[5],N=L[6],j=L[7],Y=0;Y<64;Y++){if(Y<16)g[Y]=v[C+Y]|0;else{var t1=g[Y-15],n1=(t1<<25|t1>>>7)^(t1<<14|t1>>>18)^t1>>>3,a1=g[Y-2],s1=(a1<<15|a1>>>17)^(a1<<13|a1>>>19)^a1>>>10;g[Y]=n1+g[Y-7]+s1+g[Y-16]}var p1=R&F^~R&N,u1=y&z^y&S^z&S,v1=(y<<30|y>>>2)^(y<<19|y>>>13)^(y<<10|y>>>22),h1=(R<<26|R>>>6)^(R<<21|R>>>11)^(R<<7|R>>>25),H1=j+h1+p1+u[Y]+g[Y],z1=v1+u1;j=N,N=F,F=R,R=B+H1|0,B=S,S=z,z=y,y=H1+z1|0}L[0]=L[0]+y|0,L[1]=L[1]+z|0,L[2]=L[2]+S|0,L[3]=L[3]+B|0,L[4]=L[4]+R|0,L[5]=L[5]+F|0,L[6]=L[6]+N|0,L[7]=L[7]+j|0},_doFinalize:function(){var v=this._data,C=v.words,L=this._nDataBytes*8,y=v.sigBytes*8;return C[y>>>5]|=128<<24-y%32,C[(y+64>>>9<<4)+14]=t.floor(L/4294967296),C[(y+64>>>9<<4)+15]=L,v.sigBytes=C.length*4,this._process(),this._hash},clone:function(){var v=n.clone.call(this);return v._hash=this._hash.clone(),v}});r.SHA256=n._createHelper(f),r.HmacSHA256=n._createHmacHelper(f)})(Math),e.SHA256})});var Fk5=M1((Qi0,Zk5)=>{(function(e,t){typeof Qi0=="object"?Zk5.exports=Qi0=t(dM2()):typeof define=="function"&&define.amd?define(["./core"],t):t(e.CryptoJS)})(Qi0,function(e){return(function(){var t=e,r=t.lib,a=r.WordArray,i=t.enc,n=i.Base64={stringify:function(h){var u=h.words,g=h.sigBytes,f=this._map;h.clamp();for(var v=[],C=0;C<g;C+=3)for(var L=u[C>>>2]>>>24-C%4*8&255,y=u[C+1>>>2]>>>24-(C+1)%4*8&255,z=u[C+2>>>2]>>>24-(C+2)%4*8&255,S=L<<16|y<<8|z,B=0;B<4&&C+B*.75<g;B++)v.push(f.charAt(S>>>6*(3-B)&63));var R=f.charAt(64);if(R)for(;v.length%4;)v.push(R);return v.join("")},parse:function(h){var u=h.length,g=this._map,f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var v=0;v<g.length;v++)f[g.charCodeAt(v)]=v}var C=g.charAt(64);if(C){var L=h.indexOf(C);L!==-1&&(u=L)}return o(h,u,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function o(h,u,g){for(var f=[],v=0,C=0;C<u;C++)if(C%4){var L=g[h.charCodeAt(C-1)]<<C%4*2,y=g[h.charCodeAt(C)]>>>6-C%4*2,z=L|y;f[v>>>2]|=z<<24-v%4*8,v++}return a.create(f,v)}})(),e.enc.Base64})});var Dk5=M1((tn0,Ok5)=>{(function(e,t){typeof tn0=="object"?Ok5.exports=tn0=t(dM2()):typeof define=="function"&&define.amd?define(["./core"],t):t(e.CryptoJS)})(tn0,function(e){return e.enc.Utf8})});var Gk5=M1((RRi,Uk5)=>{"use strict";function pZ4(e){this.message=e}pZ4.prototype=new Error,pZ4.prototype.name="InvalidCharacterError";var Ik5=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new pZ4("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,a,i=0,n=0,o="";a=t.charAt(n++);~a&&(r=i%4?64*r+a:a,i++%4)?o+=String.fromCharCode(255&r>>(-2*i&6)):0)a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(a);return o};function Wx7(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return(function(r){return decodeURIComponent(Ik5(r).replace(/(.)/g,(function(a,i){var n=i.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))})(t)}catch{return Ik5(t)}}function uM2(e){this.message=e}function Nk5(e,t){if(typeof e!="string")throw new uM2("Invalid token specified");var r=(t=t||{}).header===!0?0:1;try{return JSON.parse(Wx7(e.split(".")[r]))}catch(a){throw new uM2("Invalid token specified: "+a.message)}}uM2.prototype=new Error,uM2.prototype.name="InvalidTokenError";var gZ4=Nk5;gZ4.default=Nk5,gZ4.InvalidTokenError=uM2,Uk5.exports=gZ4});var TQ1=M1((ZRi,sT5)=>{"use strict";var qx7=Object.create,an0=Object.defineProperty,$x7=Object.getOwnPropertyDescriptor,Kx7=Object.getOwnPropertyNames,Yx7=Object.getPrototypeOf,Xx7=Object.prototype.hasOwnProperty,Jx7=(e,t)=>{for(var r in t)an0(e,r,{get:t[r],enumerable:!0})},Kk5=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Kx7(t))!Xx7.call(e,i)&&i!==r&&an0(e,i,{get:()=>t[i],enumerable:!(a=$x7(t,i))||a.enumerable});return e},fM2=(e,t,r)=>(r=e!=null?qx7(Yx7(e)):{},Kk5(t||!e||!e.__esModule?an0(r,"default",{value:e,enumerable:!0}):r,e)),Qx7=e=>Kk5(an0({},"__esModule",{value:!0}),e),Yk5={};Jx7(Yk5,{AccessTokenEvents:()=>Xk5,CheckSessionIFrame:()=>Jk5,ErrorResponse:()=>ML1,ErrorTimeout:()=>in0,InMemoryWebStorage:()=>MZ4,Log:()=>pM2,Logger:()=>bh,MetadataService:()=>Qk5,OidcClient:()=>rT5,OidcClientSettingsStore:()=>rn0,SessionMonitor:()=>aT5,SigninResponse:()=>en0,SigninState:()=>nn0,SignoutResponse:()=>eT5,State:()=>R_1,User:()=>gM2,UserManager:()=>TL7,UserManagerSettingsStore:()=>cT5,Version:()=>VL7,WebStorageStateStore:()=>LZ4});sT5.exports=Qx7(Yk5);var tL7=fM2(dM2()),eL7=fM2(Rk5()),jk5=fM2(Fk5()),rL7=fM2(Dk5()),aL7={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{}},S91,H91,pM2=(e=>(e[e.NONE=0]="NONE",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.DEBUG=4]="DEBUG",e))(pM2||{});(e=>{function t(){S91=3,H91=aL7}e.reset=t;function r(i){if(!(0<=i&&i<=4))throw new Error("Invalid log level");S91=i}e.setLevel=r;function a(i){H91=i}e.setLogger=a})(pM2||(pM2={}));var bh=class{constructor(e){this._name=e}debug(...e){S91>=4&&H91.debug(bh._format(this._name,this._method),...e)}info(...e){S91>=3&&H91.info(bh._format(this._name,this._method),...e)}warn(...e){S91>=2&&H91.warn(bh._format(this._name,this._method),...e)}error(...e){S91>=1&&H91.error(bh._format(this._name,this._method),...e)}throw(e){throw this.error(e),e}create(e){let t=Object.create(this);return t._method=e,t.debug("begin"),t}static createStatic(e,t){let r=new bh(`${e}.${t}`);return r.debug("begin"),r}static _format(e,t){let r=`[${e}]`;return t?`${r} ${t}:`:r}static debug(e,...t){S91>=4&&H91.debug(bh._format(e),...t)}static info(e,...t){S91>=3&&H91.info(bh._format(e),...t)}static warn(e,...t){S91>=2&&H91.warn(bh._format(e),...t)}static error(e,...t){S91>=1&&H91.error(bh._format(e),...t)}};pM2.reset();var iL7="10000000-1000-4000-8000-100000000000",k91=class{static _randomWord(){return tL7.default.lib.WordArray.random(1).words[0]}static generateUUIDv4(){return iL7.replace(/[018]/g,t=>(+t^k91._randomWord()&15>>+t/4).toString(16)).replace(/-/g,"")}static generateCodeVerifier(){return k91.generateUUIDv4()+k91.generateUUIDv4()+k91.generateUUIDv4()}static generateCodeChallenge(e){try{let t=(0,eL7.default)(e);return jk5.default.stringify(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}catch(t){throw bh.error("CryptoUtils.generateCodeChallenge",t),t}}static generateBasicAuth(e,t){let r=rL7.default.parse([e,t].join(":"));return jk5.default.stringify(r)}},CL1=class{constructor(e){this._name=e,this._logger=new bh(`Event('${this._name}')`),this._callbacks=[]}addHandler(e){return this._callbacks.push(e),()=>this.removeHandler(e)}removeHandler(e){let t=this._callbacks.lastIndexOf(e);t>=0&&this._callbacks.splice(t,1)}raise(...e){this._logger.debug("raise:",...e);for(let t of this._callbacks)t(...e)}},nL7=fM2(Gk5()),fZ4=class{static decode(e){try{return(0,nL7.default)(e)}catch(t){throw bh.error("JwtUtils.decode",t),t}}},Wk5=class{static center({...e}){var t,r,a;return e.width==null&&(e.width=(t=[800,720,600,480].find(i=>i<=window.outerWidth/1.618))!=null?t:360),(r=e.left)!=null||(e.left=Math.max(0,Math.round(window.screenX+(window.outerWidth-e.width)/2))),e.height!=null&&((a=e.top)!=null||(e.top=Math.max(0,Math.round(window.screenY+(window.outerHeight-e.height)/2)))),e}static serialize(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,r])=>`${t}=${typeof r!="boolean"?r:r?"yes":"no"}`).join(",")}},i21=class extends CL1{constructor(){super(...arguments),this._logger=new bh(`Timer('${this._name}')`),this._timerHandle=null,this._expiration=0,this._callback=()=>{let e=this._expiration-i21.getEpochTime();this._logger.debug("timer completes in",e),this._expiration<=i21.getEpochTime()&&(this.cancel(),super.raise())}}static getEpochTime(){return Math.floor(Date.now()/1e3)}init(e){let t=this._logger.create("init");e=Math.max(Math.floor(e),1);let r=i21.getEpochTime()+e;if(this.expiration===r&&this._timerHandle){t.debug("skipping since already initialized for expiration at",this.expiration);return}this.cancel(),t.debug("using duration",e),this._expiration=r;let a=Math.min(e,5);this._timerHandle=setInterval(this._callback,a*1e3)}get expiration(){return this._expiration}cancel(){this._logger.create("cancel"),this._timerHandle&&(clearInterval(this._timerHandle),this._timerHandle=null)}},vZ4=class{static readParams(e,t="query"){if(!e)throw new TypeError("Invalid URL");let a=new URL(e,"http://127.0.0.1")[t==="fragment"?"hash":"search"];return new URLSearchParams(a.slice(1))}},mZ4=";",ML1=class extends Error{constructor(e,t){var r,a,i;if(super(e.error_description||e.error||""),this.form=t,this.name="ErrorResponse",!e.error)throw bh.error("ErrorResponse","No error passed"),new Error("No error passed");this.error=e.error,this.error_description=(r=e.error_description)!=null?r:null,this.error_uri=(a=e.error_uri)!=null?a:null,this.state=e.userState,this.session_state=(i=e.session_state)!=null?i:null,this.url_state=e.url_state}},in0=class extends Error{constructor(e){super(e),this.name="ErrorTimeout"}},Xk5=class{constructor(e){this._logger=new bh("AccessTokenEvents"),this._expiringTimer=new i21("Access token expiring"),this._expiredTimer=new i21("Access token expired"),this._expiringNotificationTimeInSeconds=e.expiringNotificationTimeInSeconds}load(e){let t=this._logger.create("load");if(e.access_token&&e.expires_in!==void 0){let r=e.expires_in;if(t.debug("access token present, remaining duration:",r),r>0){let i=r-this._expiringNotificationTimeInSeconds;i<=0&&(i=1),t.debug("registering expiring timer, raising in",i,"seconds"),this._expiringTimer.init(i)}else t.debug("canceling existing expiring timer because we're past expiration."),this._expiringTimer.cancel();let a=r+1;t.debug("registering expired timer, raising in",a,"seconds"),this._expiredTimer.init(a)}else this._expiringTimer.cancel(),this._expiredTimer.cancel()}unload(){this._logger.debug("unload: canceling existing access token timers"),this._expiringTimer.cancel(),this._expiredTimer.cancel()}addAccessTokenExpiring(e){return this._expiringTimer.addHandler(e)}removeAccessTokenExpiring(e){this._expiringTimer.removeHandler(e)}addAccessTokenExpired(e){return this._expiredTimer.addHandler(e)}removeAccessTokenExpired(e){this._expiredTimer.removeHandler(e)}},Jk5=class{constructor(e,t,r,a,i){this._callback=e,this._client_id=t,this._intervalInSeconds=a,this._stopOnError=i,this._logger=new bh("CheckSessionIFrame"),this._timer=null,this._session_state=null,this._message=o=>{o.origin===this._frame_origin&&o.source===this._frame.contentWindow&&(o.data==="error"?(this._logger.error("error message from check session op iframe"),this._stopOnError&&this.stop()):o.data==="changed"?(this._logger.debug("changed message from check session op iframe"),this.stop(),this._callback()):this._logger.debug(o.data+" message from check session op iframe"))};let n=new URL(r);this._frame_origin=n.origin,this._frame=window.document.createElement("iframe"),this._frame.style.visibility="hidden",this._frame.style.position="fixed",this._frame.style.left="-1000px",this._frame.style.top="0",this._frame.width="0",this._frame.height="0",this._frame.src=n.href}load(){return new Promise(e=>{this._frame.onload=()=>{e()},window.document.body.appendChild(this._frame),window.addEventListener("message",this._message,!1)})}start(e){if(this._session_state===e)return;this._logger.create("start"),this.stop(),this._session_state=e;let t=()=>{!this._frame.contentWindow||!this._session_state||this._frame.contentWindow.postMessage(this._client_id+" "+this._session_state,this._frame_origin)};t(),this._timer=setInterval(t,this._intervalInSeconds*1e3)}stop(){this._logger.create("stop"),this._session_state=null,this._timer&&(clearInterval(this._timer),this._timer=null)}},MZ4=class{constructor(){this._logger=new bh("InMemoryWebStorage"),this._data={}}clear(){this._logger.create("clear"),this._data={}}getItem(e){return this._logger.create(`getItem('${e}')`),this._data[e]}setItem(e,t){this._logger.create(`setItem('${e}')`),this._data[e]=t}removeItem(e){this._logger.create(`removeItem('${e}')`),delete this._data[e]}get length(){return Object.getOwnPropertyNames(this._data).length}key(e){return Object.getOwnPropertyNames(this._data)[e]}},xZ4=class{constructor(e=[],t=null,r={}){this._jwtHandler=t,this._extraHeaders=r,this._logger=new bh("JsonService"),this._contentTypes=[],this._contentTypes.push(...e,"application/json"),t&&this._contentTypes.push("application/jwt")}async fetchWithTimeout(e,t={}){let{timeoutInSeconds:r,...a}=t;if(!r)return await fetch(e,a);let i=new AbortController,n=setTimeout(()=>i.abort(),r*1e3);try{return await fetch(e,{...t,signal:i.signal})}catch(o){throw o instanceof DOMException&&o.name==="AbortError"?new in0("Network timed out"):o}finally{clearTimeout(n)}}async getJson(e,{token:t,credentials:r}={}){let a=this._logger.create("getJson"),i={Accept:this._contentTypes.join(", ")};t&&(a.debug("token passed, setting Authorization header"),i.Authorization="Bearer "+t),this.appendExtraHeaders(i);let n;try{a.debug("url:",e),n=await this.fetchWithTimeout(e,{method:"GET",headers:i,credentials:r})}catch(u){throw a.error("Network Error"),u}a.debug("HTTP response received, status",n.status);let o=n.headers.get("Content-Type");if(o&&!this._contentTypes.find(u=>o.startsWith(u))&&a.throw(new Error(`Invalid response Content-Type: ${o??"undefined"}, from URL: ${e}`)),n.ok&&this._jwtHandler&&o?.startsWith("application/jwt"))return await this._jwtHandler(await n.text());let h;try{h=await n.json()}catch(u){throw a.error("Error parsing JSON response",u),n.ok?u:new Error(`${n.statusText} (${n.status})`)}if(!n.ok)throw a.error("Error from server:",h),h.error?new ML1(h):new Error(`${n.statusText} (${n.status}): ${JSON.stringify(h)}`);return h}async postForm(e,{body:t,basicAuth:r,timeoutInSeconds:a,initCredentials:i}){let n=this._logger.create("postForm"),o={Accept:this._contentTypes.join(", "),"Content-Type":"application/x-www-form-urlencoded"};r!==void 0&&(o.Authorization="Basic "+r),this.appendExtraHeaders(o);let h;try{n.debug("url:",e),h=await this.fetchWithTimeout(e,{method:"POST",headers:o,body:t,timeoutInSeconds:a,credentials:i})}catch(v){throw n.error("Network error"),v}n.debug("HTTP response received, status",h.status);let u=h.headers.get("Content-Type");if(u&&!this._contentTypes.find(v=>u.startsWith(v)))throw new Error(`Invalid response Content-Type: ${u??"undefined"}, from URL: ${e}`);let g=await h.text(),f={};if(g)try{f=JSON.parse(g)}catch(v){throw n.error("Error parsing JSON response",v),h.ok?v:new Error(`${h.statusText} (${h.status})`)}if(!h.ok)throw n.error("Error from server:",f),f.error?new ML1(f,t):new Error(`${h.statusText} (${h.status}): ${JSON.stringify(f)}`);return f}appendExtraHeaders(e){let t=this._logger.create("appendExtraHeaders"),r=Object.keys(this._extraHeaders),a=["authorization","accept","content-type"];r.length!==0&&r.forEach(i=>{if(a.includes(i.toLocaleLowerCase())){t.warn("Protected header could not be overridden",i,a);return}let n=typeof this._extraHeaders[i]=="function"?this._extraHeaders[i]():this._extraHeaders[i];n&&n!==""&&(e[i]=n)})}},Qk5=class{constructor(e){this._settings=e,this._logger=new bh("MetadataService"),this._signingKeys=null,this._metadata=null,this._metadataUrl=this._settings.metadataUrl,this._jsonService=new xZ4(["application/jwk-set+json"],null,this._settings.extraHeaders),this._settings.signingKeys&&(this._logger.debug("using signingKeys from settings"),this._signingKeys=this._settings.signingKeys),this._settings.metadata&&(this._logger.debug("using metadata from settings"),this._metadata=this._settings.metadata),this._settings.fetchRequestCredentials&&(this._logger.debug("using fetchRequestCredentials from settings"),this._fetchRequestCredentials=this._settings.fetchRequestCredentials)}resetSigningKeys(){this._signingKeys=null}async getMetadata(){let e=this._logger.create("getMetadata");if(this._metadata)return e.debug("using cached values"),this._metadata;if(!this._metadataUrl)throw e.throw(new Error("No authority or metadataUrl configured on settings")),null;e.debug("getting metadata from",this._metadataUrl);let t=await this._jsonService.getJson(this._metadataUrl,{credentials:this._fetchRequestCredentials});return e.debug("merging remote JSON with seed metadata"),this._metadata=Object.assign({},this._settings.metadataSeed,t),this._metadata}getIssuer(){return this._getMetadataProperty("issuer")}getAuthorizationEndpoint(){return this._getMetadataProperty("authorization_endpoint")}getUserInfoEndpoint(){return this._getMetadataProperty("userinfo_endpoint")}getTokenEndpoint(e=!0){return this._getMetadataProperty("token_endpoint",e)}getCheckSessionIframe(){return this._getMetadataProperty("check_session_iframe",!0)}getEndSessionEndpoint(){return this._getMetadataProperty("end_session_endpoint",!0)}getRevocationEndpoint(e=!0){return this._getMetadataProperty("revocation_endpoint",e)}getKeysEndpoint(e=!0){return this._getMetadataProperty("jwks_uri",e)}async _getMetadataProperty(e,t=!1){let r=this._logger.create(`_getMetadataProperty('${e}')`),a=await this.getMetadata();if(r.debug("resolved"),a[e]===void 0){if(t===!0){r.warn("Metadata does not contain optional property");return}r.throw(new Error("Metadata does not contain property "+e))}return a[e]}async getSigningKeys(){let e=this._logger.create("getSigningKeys");if(this._signingKeys)return e.debug("returning signingKeys from cache"),this._signingKeys;let t=await this.getKeysEndpoint(!1);e.debug("got jwks_uri",t);let r=await this._jsonService.getJson(t);if(e.debug("got key set",r),!Array.isArray(r.keys))throw e.throw(new Error("Missing keys on keyset")),null;return this._signingKeys=r.keys,this._signingKeys}},LZ4=class{constructor({prefix:e="oidc.",store:t=localStorage}={}){this._logger=new bh("WebStorageStateStore"),this._store=t,this._prefix=e}async set(e,t){this._logger.create(`set('${e}')`),e=this._prefix+e,await this._store.setItem(e,t)}async get(e){return this._logger.create(`get('${e}')`),e=this._prefix+e,await this._store.getItem(e)}async remove(e){this._logger.create(`remove('${e}')`),e=this._prefix+e;let t=await this._store.getItem(e);return await this._store.removeItem(e),t}async getAllKeys(){this._logger.create("getAllKeys");let e=await this._store.length,t=[];for(let r=0;r<e;r++){let a=await this._store.key(r);a&&a.indexOf(this._prefix)===0&&t.push(a.substr(this._prefix.length))}return t}},oL7="code",lL7="openid",cL7="client_secret_post",sL7="query",hL7=900,dL7=300,rn0=class{constructor({authority:e,metadataUrl:t,metadata:r,signingKeys:a,metadataSeed:i,client_id:n,client_secret:o,response_type:h=oL7,scope:u=lL7,redirect_uri:g,post_logout_redirect_uri:f,client_authentication:v=cL7,prompt:C,display:L,max_age:y,ui_locales:z,acr_values:S,resource:B,response_mode:R=sL7,filterProtocolClaims:F=!0,loadUserInfo:N=!1,staleStateAgeInSeconds:j=hL7,clockSkewInSeconds:Y=dL7,userInfoJwtIssuer:t1="OP",mergeClaims:n1=!1,disablePKCE:a1=!1,stateStore:s1,refreshTokenCredentials:p1,revokeTokenAdditionalContentTypes:u1,fetchRequestCredentials:v1,refreshTokenAllowedScope:h1,extraQueryParams:H1={},extraTokenParams:z1={},extraHeaders:b1={}}){if(this.authority=e,t?this.metadataUrl=t:(this.metadataUrl=e,e&&(this.metadataUrl.endsWith("/")||(this.metadataUrl+="/"),this.metadataUrl+=".well-known/openid-configuration")),this.metadata=r,this.metadataSeed=i,this.signingKeys=a,this.client_id=n,this.client_secret=o,this.response_type=h,this.scope=u,this.redirect_uri=g,this.post_logout_redirect_uri=f,this.client_authentication=v,this.prompt=C,this.display=L,this.max_age=y,this.ui_locales=z,this.acr_values=S,this.resource=B,this.response_mode=R,this.filterProtocolClaims=F??!0,this.loadUserInfo=!!N,this.staleStateAgeInSeconds=j,this.clockSkewInSeconds=Y,this.userInfoJwtIssuer=t1,this.mergeClaims=!!n1,this.disablePKCE=!!a1,this.revokeTokenAdditionalContentTypes=u1,v1&&p1&&console.warn("Both fetchRequestCredentials and refreshTokenCredentials is set. Only fetchRequestCredentials will be used."),this.fetchRequestCredentials=v1||p1||"same-origin",s1)this.stateStore=s1;else{let m1=typeof window<"u"?window.localStorage:new MZ4;this.stateStore=new LZ4({store:m1})}this.refreshTokenAllowedScope=h1,this.extraQueryParams=H1,this.extraTokenParams=z1,this.extraHeaders=b1}},uL7=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new bh("UserInfoService"),this._getClaimsFromJwt=async r=>{let a=this._logger.create("_getClaimsFromJwt");try{let i=fZ4.decode(r);return a.debug("JWT decoding successful"),i}catch(i){throw a.error("Error parsing JWT response"),i}},this._jsonService=new xZ4(void 0,this._getClaimsFromJwt,this._settings.extraHeaders)}async getClaims(e){let t=this._logger.create("getClaims");e||this._logger.throw(new Error("No token passed"));let r=await this._metadataService.getUserInfoEndpoint();t.debug("got userinfo url",r);let a=await this._jsonService.getJson(r,{token:e,credentials:this._settings.fetchRequestCredentials});return t.debug("got claims",a),a}},tT5=class{constructor(e,t){this._settings=e,this._metadataService=t,this._logger=new bh("TokenClient"),this._jsonService=new xZ4(this._settings.revokeTokenAdditionalContentTypes,null,this._settings.extraHeaders)}async exchangeCode({grant_type:e="authorization_code",redirect_uri:t=this._settings.redirect_uri,client_id:r=this._settings.client_id,client_secret:a=this._settings.client_secret,...i}){let n=this._logger.create("exchangeCode");r||n.throw(new Error("A client_id is required")),t||n.throw(new Error("A redirect_uri is required")),i.code||n.throw(new Error("A code is required"));let o=new URLSearchParams({grant_type:e,redirect_uri:t});for(let[f,v]of Object.entries(i))v!=null&&o.set(f,v);let h;switch(this._settings.client_authentication){case"client_secret_basic":if(!a)throw n.throw(new Error("A client_secret is required")),null;h=k91.generateBasicAuth(r,a);break;case"client_secret_post":o.append("client_id",r),a&&o.append("client_secret",a);break}let u=await this._metadataService.getTokenEndpoint(!1);n.debug("got token endpoint");let g=await this._jsonService.postForm(u,{body:o,basicAuth:h,initCredentials:this._settings.fetchRequestCredentials});return n.debug("got response"),g}async exchangeCredentials({grant_type:e="password",client_id:t=this._settings.client_id,client_secret:r=this._settings.client_secret,scope:a=this._settings.scope,...i}){let n=this._logger.create("exchangeCredentials");t||n.throw(new Error("A client_id is required"));let o=new URLSearchParams({grant_type:e,scope:a});for(let[f,v]of Object.entries(i))v!=null&&o.set(f,v);let h;switch(this._settings.client_authentication){case"client_secret_basic":if(!r)throw n.throw(new Error("A client_secret is required")),null;h=k91.generateBasicAuth(t,r);break;case"client_secret_post":o.append("client_id",t),r&&o.append("client_secret",r);break}let u=await this._metadataService.getTokenEndpoint(!1);n.debug("got token endpoint");let g=await this._jsonService.postForm(u,{body:o,basicAuth:h,initCredentials:this._settings.fetchRequestCredentials});return n.debug("got response"),g}async exchangeRefreshToken({grant_type:e="refresh_token",client_id:t=this._settings.client_id,client_secret:r=this._settings.client_secret,timeoutInSeconds:a,...i}){let n=this._logger.create("exchangeRefreshToken");t||n.throw(new Error("A client_id is required")),i.refresh_token||n.throw(new Error("A refresh_token is required"));let o=new URLSearchParams({grant_type:e});for(let[f,v]of Object.entries(i))Array.isArray(v)?v.forEach(C=>o.append(f,C)):v!=null&&o.set(f,v);let h;switch(this._settings.client_authentication){case"client_secret_basic":if(!r)throw n.throw(new Error("A client_secret is required")),null;h=k91.generateBasicAuth(t,r);break;case"client_secret_post":o.append("client_id",t),r&&o.append("client_secret",r);break}let u=await this._metadataService.getTokenEndpoint(!1);n.debug("got token endpoint");let g=await this._jsonService.postForm(u,{body:o,basicAuth:h,timeoutInSeconds:a,initCredentials:this._settings.fetchRequestCredentials});return n.debug("got response"),g}async revoke(e){var t;let r=this._logger.create("revoke");e.token||r.throw(new Error("A token is required"));let a=await this._metadataService.getRevocationEndpoint(!1);r.debug(`got revocation endpoint, revoking ${(t=e.token_type_hint)!=null?t:"default token type"}`);let i=new URLSearchParams;for(let[n,o]of Object.entries(e))o!=null&&i.set(n,o);i.set("client_id",this._settings.client_id),this._settings.client_secret&&i.set("client_secret",this._settings.client_secret),await this._jsonService.postForm(a,{body:i}),r.debug("got response")}},gL7=class{constructor(e,t,r){this._settings=e,this._metadataService=t,this._claimsService=r,this._logger=new bh("ResponseValidator"),this._userInfoService=new uL7(this._settings,this._metadataService),this._tokenClient=new tT5(this._settings,this._metadataService)}async validateSigninResponse(e,t){let r=this._logger.create("validateSigninResponse");this._processSigninState(e,t),r.debug("state processed"),await this._processCode(e,t),r.debug("code processed"),e.isOpenId&&this._validateIdTokenAttributes(e),r.debug("tokens validated"),await this._processClaims(e,t?.skipUserInfo,e.isOpenId),r.debug("claims processed")}async validateCredentialsResponse(e,t){let r=this._logger.create("validateCredentialsResponse");e.isOpenId&&e.id_token&&this._validateIdTokenAttributes(e),r.debug("tokens validated"),await this._processClaims(e,t,e.isOpenId),r.debug("claims processed")}async validateRefreshResponse(e,t){var r,a;let i=this._logger.create("validateRefreshResponse");e.userState=t.data,(r=e.session_state)!=null||(e.session_state=t.session_state),(a=e.scope)!=null||(e.scope=t.scope),e.isOpenId&&e.id_token&&(this._validateIdTokenAttributes(e,t.id_token),i.debug("ID Token validated")),e.id_token||(e.id_token=t.id_token,e.profile=t.profile);let n=e.isOpenId&&!!e.id_token;await this._processClaims(e,!1,n),i.debug("claims processed")}validateSignoutResponse(e,t){let r=this._logger.create("validateSignoutResponse");if(t.id!==e.state&&r.throw(new Error("State does not match")),r.debug("state validated"),e.userState=t.data,e.error)throw r.warn("Response was error",e.error),new ML1(e)}_processSigninState(e,t){var r;let a=this._logger.create("_processSigninState");if(t.id!==e.state&&a.throw(new Error("State does not match")),t.client_id||a.throw(new Error("No client_id on state")),t.authority||a.throw(new Error("No authority on state")),this._settings.authority!==t.authority&&a.throw(new Error("authority mismatch on settings vs. signin state")),this._settings.client_id&&this._settings.client_id!==t.client_id&&a.throw(new Error("client_id mismatch on settings vs. signin state")),a.debug("state validated"),e.userState=t.data,e.url_state=t.url_state,(r=e.scope)!=null||(e.scope=t.scope),e.error)throw a.warn("Response was error",e.error),new ML1(e);t.code_verifier&&!e.code&&a.throw(new Error("Expected code in response"))}async _processClaims(e,t=!1,r=!0){let a=this._logger.create("_processClaims");if(e.profile=this._claimsService.filterProtocolClaims(e.profile),t||!this._settings.loadUserInfo||!e.access_token){a.debug("not loading user info");return}a.debug("loading user info");let i=await this._userInfoService.getClaims(e.access_token);a.debug("user info claims received from user info endpoint"),r&&i.sub!==e.profile.sub&&a.throw(new Error("subject from UserInfo response does not match subject in ID Token")),e.profile=this._claimsService.mergeClaims(e.profile,this._claimsService.filterProtocolClaims(i)),a.debug("user info claims received, updated profile:",e.profile)}async _processCode(e,t){let r=this._logger.create("_processCode");if(e.code){r.debug("Validating code");let a=await this._tokenClient.exchangeCode({client_id:t.client_id,client_secret:t.client_secret,code:e.code,redirect_uri:t.redirect_uri,code_verifier:t.code_verifier,...t.extraTokenParams});Object.assign(e,a)}else r.debug("No code to process")}_validateIdTokenAttributes(e,t){var r;let a=this._logger.create("_validateIdTokenAttributes");a.debug("decoding ID Token JWT");let i=fZ4.decode((r=e.id_token)!=null?r:"");if(i.sub||a.throw(new Error("ID Token is missing a subject claim")),t){let n=fZ4.decode(t);i.sub!==n.sub&&a.throw(new Error("sub in id_token does not match current sub")),i.auth_time&&i.auth_time!==n.auth_time&&a.throw(new Error("auth_time in id_token does not match original auth_time")),i.azp&&i.azp!==n.azp&&a.throw(new Error("azp in id_token does not match original azp")),!i.azp&&n.azp&&a.throw(new Error("azp not in id_token, but present in original id_token"))}e.profile=i}},R_1=class{constructor(e){this.id=e.id||k91.generateUUIDv4(),this.data=e.data,e.created&&e.created>0?this.created=e.created:this.created=i21.getEpochTime(),this.request_type=e.request_type,this.url_state=e.url_state}toStorageString(){return new bh("State").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state})}static fromStorageString(e){return bh.createStatic("State","fromStorageString"),new R_1(JSON.parse(e))}static async clearStaleState(e,t){let r=bh.createStatic("State","clearStaleState"),a=i21.getEpochTime()-t,i=await e.getAllKeys();r.debug("got keys",i);for(let n=0;n<i.length;n++){let o=i[n],h=await e.get(o),u=!1;if(h)try{let g=R_1.fromStorageString(h);r.debug("got item from key:",o,g.created),g.created<=a&&(u=!0)}catch(g){r.error("Error parsing state for key:",o,g),u=!0}else r.debug("no item in storage for key:",o),u=!0;u&&(r.debug("removed item for key:",o),e.remove(o))}}},nn0=class extends R_1{constructor(e){super(e),e.code_verifier===!0?this.code_verifier=k91.generateCodeVerifier():e.code_verifier&&(this.code_verifier=e.code_verifier),this.code_verifier&&(this.code_challenge=k91.generateCodeChallenge(this.code_verifier)),this.authority=e.authority,this.client_id=e.client_id,this.redirect_uri=e.redirect_uri,this.scope=e.scope,this.client_secret=e.client_secret,this.extraTokenParams=e.extraTokenParams,this.response_mode=e.response_mode,this.skipUserInfo=e.skipUserInfo}toStorageString(){return new bh("SigninState").create("toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created,request_type:this.request_type,url_state:this.url_state,code_verifier:this.code_verifier,authority:this.authority,client_id:this.client_id,redirect_uri:this.redirect_uri,scope:this.scope,client_secret:this.client_secret,extraTokenParams:this.extraTokenParams,response_mode:this.response_mode,skipUserInfo:this.skipUserInfo})}static fromStorageString(e){bh.createStatic("SigninState","fromStorageString");let t=JSON.parse(e);return new nn0(t)}},pL7=class{constructor({url:e,authority:t,client_id:r,redirect_uri:a,response_type:i,scope:n,state_data:o,response_mode:h,request_type:u,client_secret:g,nonce:f,url_state:v,resource:C,skipUserInfo:L,extraQueryParams:y,extraTokenParams:z,disablePKCE:S,...B}){if(this._logger=new bh("SigninRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");if(!r)throw this._logger.error("ctor: No client_id passed"),new Error("client_id");if(!a)throw this._logger.error("ctor: No redirect_uri passed"),new Error("redirect_uri");if(!i)throw this._logger.error("ctor: No response_type passed"),new Error("response_type");if(!n)throw this._logger.error("ctor: No scope passed"),new Error("scope");if(!t)throw this._logger.error("ctor: No authority passed"),new Error("authority");this.state=new nn0({data:o,request_type:u,url_state:v,code_verifier:!S,client_id:r,authority:t,redirect_uri:a,response_mode:h,client_secret:g,scope:n,extraTokenParams:z,skipUserInfo:L});let R=new URL(e);R.searchParams.append("client_id",r),R.searchParams.append("redirect_uri",a),R.searchParams.append("response_type",i),R.searchParams.append("scope",n),f&&R.searchParams.append("nonce",f);let F=this.state.id;v&&(F=`${F}${mZ4}${v}`),R.searchParams.append("state",F),this.state.code_challenge&&(R.searchParams.append("code_challenge",this.state.code_challenge),R.searchParams.append("code_challenge_method","S256")),C&&(Array.isArray(C)?C:[C]).forEach(j=>R.searchParams.append("resource",j));for(let[N,j]of Object.entries({response_mode:h,...B,...y}))j!=null&&R.searchParams.append(N,j.toString());this.url=R.href}},fL7="openid",en0=class{constructor(e){if(this.access_token="",this.token_type="",this.profile={},this.state=e.get("state"),this.session_state=e.get("session_state"),this.state){let t=decodeURIComponent(this.state).split(mZ4);this.state=t[0],t.length>1&&(this.url_state=t.slice(1).join(mZ4))}this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri"),this.code=e.get("code")}get expires_in(){if(this.expires_at!==void 0)return this.expires_at-i21.getEpochTime()}set expires_in(e){typeof e=="string"&&(e=Number(e)),e!==void 0&&e>=0&&(this.expires_at=Math.floor(e)+i21.getEpochTime())}get isOpenId(){var e;return((e=this.scope)==null?void 0:e.split(" ").includes(fL7))||!!this.id_token}},vL7=class{constructor({url:e,state_data:t,id_token_hint:r,post_logout_redirect_uri:a,extraQueryParams:i,request_type:n,client_id:o}){if(this._logger=new bh("SignoutRequest"),!e)throw this._logger.error("ctor: No url passed"),new Error("url");let h=new URL(e);r&&h.searchParams.append("id_token_hint",r),o&&h.searchParams.append("client_id",o),a&&(h.searchParams.append("post_logout_redirect_uri",a),t&&(this.state=new R_1({data:t,request_type:n}),h.searchParams.append("state",this.state.id)));for(let[u,g]of Object.entries({...i}))g!=null&&h.searchParams.append(u,g.toString());this.url=h.href}},eT5=class{constructor(e){this.state=e.get("state"),this.error=e.get("error"),this.error_description=e.get("error_description"),this.error_uri=e.get("error_uri")}},mL7=["nbf","jti","auth_time","nonce","acr","amr","azp","at_hash"],CL7=["sub","iss","aud","exp","iat"],ML7=class{constructor(e){this._settings=e,this._logger=new bh("ClaimsService")}filterProtocolClaims(e){let t={...e};if(this._settings.filterProtocolClaims){let r;Array.isArray(this._settings.filterProtocolClaims)?r=this._settings.filterProtocolClaims:r=mL7;for(let a of r)CL7.includes(a)||delete t[a]}return t}mergeClaims(e,t){let r={...e};for(let[a,i]of Object.entries(t))for(let n of Array.isArray(i)?i:[i]){let o=r[a];o===void 0?r[a]=n:Array.isArray(o)?o.includes(n)||o.push(n):r[a]!==n&&(typeof n=="object"&&this._settings.mergeClaims?r[a]=this.mergeClaims(o,n):r[a]=[o,n])}return r}},rT5=class{constructor(e,t){this._logger=new bh("OidcClient"),this.settings=e instanceof rn0?e:new rn0(e),this.metadataService=t??new Qk5(this.settings),this._claimsService=new ML7(this.settings),this._validator=new gL7(this.settings,this.metadataService,this._claimsService),this._tokenClient=new tT5(this.settings,this.metadataService)}async createSigninRequest({state:e,request:t,request_uri:r,request_type:a,id_token_hint:i,login_hint:n,skipUserInfo:o,nonce:h,url_state:u,response_type:g=this.settings.response_type,scope:f=this.settings.scope,redirect_uri:v=this.settings.redirect_uri,prompt:C=this.settings.prompt,display:L=this.settings.display,max_age:y=this.settings.max_age,ui_locales:z=this.settings.ui_locales,acr_values:S=this.settings.acr_values,resource:B=this.settings.resource,response_mode:R=this.settings.response_mode,extraQueryParams:F=this.settings.extraQueryParams,extraTokenParams:N=this.settings.extraTokenParams}){let j=this._logger.create("createSigninRequest");if(g!=="code")throw new Error("Only the Authorization Code flow (with PKCE) is supported");let Y=await this.metadataService.getAuthorizationEndpoint();j.debug("Received authorization endpoint",Y);let t1=new pL7({url:Y,authority:this.settings.authority,client_id:this.settings.client_id,redirect_uri:v,response_type:g,scope:f,state_data:e,url_state:u,prompt:C,display:L,max_age:y,ui_locales:z,id_token_hint:i,login_hint:n,acr_values:S,resource:B,request:t,request_uri:r,extraQueryParams:F,extraTokenParams:N,request_type:a,response_mode:R,client_secret:this.settings.client_secret,skipUserInfo:o,nonce:h,disablePKCE:this.settings.disablePKCE});await this.clearStaleState();let n1=t1.state;return await this.settings.stateStore.set(n1.id,n1.toStorageString()),t1}async readSigninResponseState(e,t=!1){let r=this._logger.create("readSigninResponseState"),a=new en0(vZ4.readParams(e,this.settings.response_mode));if(!a.state)throw r.throw(new Error("No state in response")),null;let i=await this.settings.stateStore[t?"remove":"get"](a.state);if(!i)throw r.throw(new Error("No matching state found in storage")),null;return{state:nn0.fromStorageString(i),response:a}}async processSigninResponse(e){let t=this._logger.create("processSigninResponse"),{state:r,response:a}=await this.readSigninResponseState(e,!0);return t.debug("received state from storage; validating response"),await this._validator.validateSigninResponse(a,r),a}async processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:r=!1,extraTokenParams:a={}}){let i=await this._tokenClient.exchangeCredentials({username:e,password:t,...a}),n=new en0(new URLSearchParams);return Object.assign(n,i),await this._validator.validateCredentialsResponse(n,r),n}async useRefreshToken({state:e,timeoutInSeconds:t}){var r;let a=this._logger.create("useRefreshToken"),i;if(this.settings.refreshTokenAllowedScope===void 0)i=e.scope;else{let h=this.settings.refreshTokenAllowedScope.split(" ");i=(((r=e.scope)==null?void 0:r.split(" "))||[]).filter(g=>h.includes(g)).join(" ")}let n=await this._tokenClient.exchangeRefreshToken({refresh_token:e.refresh_token,resource:e.resource,scope:i,timeoutInSeconds:t}),o=new en0(new URLSearchParams);return Object.assign(o,n),a.debug("validating response",o),await this._validator.validateRefreshResponse(o,{...e,scope:i}),o}async createSignoutRequest({state:e,id_token_hint:t,client_id:r,request_type:a,post_logout_redirect_uri:i=this.settings.post_logout_redirect_uri,extraQueryParams:n=this.settings.extraQueryParams}={}){let o=this._logger.create("createSignoutRequest"),h=await this.metadataService.getEndSessionEndpoint();if(!h)throw o.throw(new Error("No end session endpoint")),null;o.debug("Received end session endpoint",h),!r&&i&&!t&&(r=this.settings.client_id);let u=new vL7({url:h,id_token_hint:t,client_id:r,post_logout_redirect_uri:i,state_data:e,extraQueryParams:n,request_type:a});await this.clearStaleState();let g=u.state;return g&&(o.debug("Signout request has state to persist"),await this.settings.stateStore.set(g.id,g.toStorageString())),u}async readSignoutResponseState(e,t=!1){let r=this._logger.create("readSignoutResponseState"),a=new eT5(vZ4.readParams(e,this.settings.response_mode));if(!a.state){if(r.debug("No state in response"),a.error)throw r.warn("Response was error:",a.error),new ML1(a);return{state:void 0,response:a}}let i=await this.settings.stateStore[t?"remove":"get"](a.state);if(!i)throw r.throw(new Error("No matching state found in storage")),null;return{state:R_1.fromStorageString(i),response:a}}async processSignoutResponse(e){let t=this._logger.create("processSignoutResponse"),{state:r,response:a}=await this.readSignoutResponseState(e,!0);return r?(t.debug("Received state from storage; validating response"),this._validator.validateSignoutResponse(a,r)):t.debug("No state from storage; skipping response validation"),a}clearStaleState(){return this._logger.create("clearStaleState"),R_1.clearStaleState(this.settings.stateStore,this.settings.staleStateAgeInSeconds)}async revokeToken(e,t){return this._logger.create("revokeToken"),await this._tokenClient.revoke({token:e,token_type_hint:t})}},aT5=class{constructor(e){this._userManager=e,this._logger=new bh("SessionMonitor"),this._start=async t=>{let r=t.session_state;if(!r)return;let a=this._logger.create("_start");if(t.profile?(this._sub=t.profile.sub,this._sid=t.profile.sid,a.debug("session_state",r,", sub",this._sub)):(this._sub=void 0,this._sid=void 0,a.debug("session_state",r,", anonymous user")),this._checkSessionIFrame){this._checkSessionIFrame.start(r);return}try{let i=await this._userManager.metadataService.getCheckSessionIframe();if(i){a.debug("initializing check session iframe");let n=this._userManager.settings.client_id,o=this._userManager.settings.checkSessionIntervalInSeconds,h=this._userManager.settings.stopCheckSessionOnError,u=new Jk5(this._callback,n,i,o,h);await u.load(),this._checkSessionIFrame=u,u.start(r)}else a.warn("no check session iframe found in the metadata")}catch(i){a.error("Error from getCheckSessionIframe:",i instanceof Error?i.message:i)}},this._stop=()=>{let t=this._logger.create("_stop");if(this._sub=void 0,this._sid=void 0,this._checkSessionIFrame&&this._checkSessionIFrame.stop(),this._userManager.settings.monitorAnonymousSession){let r=setInterval(async()=>{clearInterval(r);try{let a=await this._userManager.querySessionStatus();if(a){let i={session_state:a.session_state,profile:a.sub&&a.sid?{sub:a.sub,sid:a.sid}:null};this._start(i)}}catch(a){t.error("error from querySessionStatus",a instanceof Error?a.message:a)}},1e3)}},this._callback=async()=>{let t=this._logger.create("_callback");try{let r=await this._userManager.querySessionStatus(),a=!0;r&&this._checkSessionIFrame?r.sub===this._sub?(a=!1,this._checkSessionIFrame.start(r.session_state),r.sid===this._sid?t.debug("same sub still logged in at OP, restarting check session iframe; session_state",r.session_state):(t.debug("same sub still logged in at OP, session state has changed, restarting check session iframe; session_state",r.session_state),this._userManager.events._raiseUserSessionChanged())):t.debug("different subject signed into OP",r.sub):t.debug("subject no longer signed into OP"),a?this._sub?this._userManager.events._raiseUserSignedOut():this._userManager.events._raiseUserSignedIn():t.debug("no change in session detected, no event to raise")}catch(r){this._sub&&(t.debug("Error calling queryCurrentSigninSession; raising signed out event",r),this._userManager.events._raiseUserSignedOut())}},e||this._logger.throw(new Error("No user manager passed")),this._userManager.events.addUserLoaded(this._start),this._userManager.events.addUserUnloaded(this._stop),this._init().catch(t=>{this._logger.error(t)})}async _init(){this._logger.create("_init");let e=await this._userManager.getUser();if(e)this._start(e);else if(this._userManager.settings.monitorAnonymousSession){let t=await this._userManager.querySessionStatus();if(t){let r={session_state:t.session_state,profile:t.sub&&t.sid?{sub:t.sub,sid:t.sid}:null};this._start(r)}}}},gM2=class{constructor(e){var t;this.id_token=e.id_token,this.session_state=(t=e.session_state)!=null?t:null,this.access_token=e.access_token,this.refresh_token=e.refresh_token,this.token_type=e.token_type,this.scope=e.scope,this.profile=e.profile,this.expires_at=e.expires_at,this.state=e.userState,this.url_state=e.url_state}get expires_in(){if(this.expires_at!==void 0)return this.expires_at-i21.getEpochTime()}set expires_in(e){e!==void 0&&(this.expires_at=Math.floor(e)+i21.getEpochTime())}get expired(){let e=this.expires_in;if(e!==void 0)return e<=0}get scopes(){var e,t;return(t=(e=this.scope)==null?void 0:e.split(" "))!=null?t:[]}toStorageString(){return new bh("User").create("toStorageString"),JSON.stringify({id_token:this.id_token,session_state:this.session_state,access_token:this.access_token,refresh_token:this.refresh_token,token_type:this.token_type,scope:this.scope,profile:this.profile,expires_at:this.expires_at})}static fromStorageString(e){return bh.createStatic("User","fromStorageString"),new gM2(JSON.parse(e))}},qk5="oidc-client",iT5=class{constructor(){this._abort=new CL1("Window navigation aborted"),this._disposeHandlers=new Set,this._window=null}async navigate(e){let t=this._logger.create("navigate");if(!this._window)throw new Error("Attempted to navigate on a disposed window");t.debug("setting URL in window"),this._window.location.replace(e.url);let{url:r,keepOpen:a}=await new Promise((i,n)=>{let o=h=>{var u;let g=h.data,f=(u=e.scriptOrigin)!=null?u:window.location.origin;if(!(h.origin!==f||g?.source!==qk5)){try{let v=vZ4.readParams(g.url,e.response_mode).get("state");if(v||t.warn("no state found in response url"),h.source!==this._window&&v!==e.state)return}catch{this._dispose(),n(new Error("Invalid response from window"))}i(g)}};window.addEventListener("message",o,!1),this._disposeHandlers.add(()=>window.removeEventListener("message",o,!1)),this._disposeHandlers.add(this._abort.addHandler(h=>{this._dispose(),n(h)}))});return t.debug("got response from window"),this._dispose(),a||this.close(),{url:r}}_dispose(){this._logger.create("_dispose");for(let e of this._disposeHandlers)e();this._disposeHandlers.clear()}static _notifyParent(e,t,r=!1,a=window.location.origin){e.postMessage({source:qk5,url:t,keepOpen:r},a)}},nT5={location:!1,toolbar:!1,height:640,closePopupWindowAfterInSeconds:-1},oT5="_blank",xL7=60,LL7=2,lT5=10,cT5=class extends rn0{constructor(e){let{popup_redirect_uri:t=e.redirect_uri,popup_post_logout_redirect_uri:r=e.post_logout_redirect_uri,popupWindowFeatures:a=nT5,popupWindowTarget:i=oT5,redirectMethod:n="assign",redirectTarget:o="self",iframeNotifyParentOrigin:h=e.iframeNotifyParentOrigin,iframeScriptOrigin:u=e.iframeScriptOrigin,silent_redirect_uri:g=e.redirect_uri,silentRequestTimeoutInSeconds:f=lT5,automaticSilentRenew:v=!0,validateSubOnSilentRenew:C=!0,includeIdTokenInSilentRenew:L=!1,monitorSession:y=!1,monitorAnonymousSession:z=!1,checkSessionIntervalInSeconds:S=LL7,query_status_response_type:B="code",stopCheckSessionOnError:R=!0,revokeTokenTypes:F=["access_token","refresh_token"],revokeTokensOnSignout:N=!1,includeIdTokenInSilentSignout:j=!1,accessTokenExpiringNotificationTimeInSeconds:Y=xL7,userStore:t1}=e;if(super(e),this.popup_redirect_uri=t,this.popup_post_logout_redirect_uri=r,this.popupWindowFeatures=a,this.popupWindowTarget=i,this.redirectMethod=n,this.redirectTarget=o,this.iframeNotifyParentOrigin=h,this.iframeScriptOrigin=u,this.silent_redirect_uri=g,this.silentRequestTimeoutInSeconds=f,this.automaticSilentRenew=v,this.validateSubOnSilentRenew=C,this.includeIdTokenInSilentRenew=L,this.monitorSession=y,this.monitorAnonymousSession=z,this.checkSessionIntervalInSeconds=S,this.stopCheckSessionOnError=R,this.query_status_response_type=B,this.revokeTokenTypes=F,this.revokeTokensOnSignout=N,this.includeIdTokenInSilentSignout=j,this.accessTokenExpiringNotificationTimeInSeconds=Y,t1)this.userStore=t1;else{let n1=typeof window<"u"?window.sessionStorage:new MZ4;this.userStore=new LZ4({store:n1})}}},CZ4=class extends iT5{constructor({silentRequestTimeoutInSeconds:e=lT5}){super(),this._logger=new bh("IFrameWindow"),this._timeoutInSeconds=e,this._frame=CZ4.createHiddenIframe(),this._window=this._frame.contentWindow}static createHiddenIframe(){let e=window.document.createElement("iframe");return e.style.visibility="hidden",e.style.position="fixed",e.style.left="-1000px",e.style.top="0",e.width="0",e.height="0",window.document.body.appendChild(e),e}async navigate(e){this._logger.debug("navigate: Using timeout of:",this._timeoutInSeconds);let t=setTimeout(()=>this._abort.raise(new in0("IFrame timed out without a response")),this._timeoutInSeconds*1e3);return this._disposeHandlers.add(()=>clearTimeout(t)),await super.navigate(e)}close(){var e;this._frame&&(this._frame.parentNode&&(this._frame.addEventListener("load",t=>{var r;let a=t.target;(r=a.parentNode)==null||r.removeChild(a),this._abort.raise(new Error("IFrame removed from DOM"))},!0),(e=this._frame.contentWindow)==null||e.location.replace("about:blank")),this._frame=null),this._window=null}static notifyParent(e,t){return super._notifyParent(window.parent,e,!1,t)}},wL7=class{constructor(e){this._settings=e,this._logger=new bh("IFrameNavigator")}async prepare({silentRequestTimeoutInSeconds:e=this._settings.silentRequestTimeoutInSeconds}){return new CZ4({silentRequestTimeoutInSeconds:e})}async callback(e){this._logger.create("callback"),CZ4.notifyParent(e,this._settings.iframeNotifyParentOrigin)}},yL7=500,AL7=1e3,$k5=class extends iT5{constructor({popupWindowTarget:e=oT5,popupWindowFeatures:t={}}){super(),this._logger=new bh("PopupWindow");let r=Wk5.center({...nT5,...t});this._window=window.open(void 0,e,Wk5.serialize(r)),t.closePopupWindowAfterInSeconds&&t.closePopupWindowAfterInSeconds>0&&setTimeout(()=>{if(!this._window||typeof this._window.closed!="boolean"||this._window.closed){this._abort.raise(new Error("Popup blocked by user"));return}this.close()},t.closePopupWindowAfterInSeconds*AL7)}async navigate(e){var t;(t=this._window)==null||t.focus();let r=setInterval(()=>{(!this._window||this._window.closed)&&this._abort.raise(new Error("Popup closed by user"))},yL7);return this._disposeHandlers.add(()=>clearInterval(r)),await super.navigate(e)}close(){this._window&&(this._window.closed||(this._window.close(),this._abort.raise(new Error("Popup closed")))),this._window=null}static notifyOpener(e,t){if(!window.opener)throw new Error("No window.opener. Can't complete notification.");return super._notifyParent(window.opener,e,t)}},zL7=class{constructor(e){this._settings=e,this._logger=new bh("PopupNavigator")}async prepare({popupWindowFeatures:e=this._settings.popupWindowFeatures,popupWindowTarget:t=this._settings.popupWindowTarget}){return new $k5({popupWindowFeatures:e,popupWindowTarget:t})}async callback(e,{keepOpen:t=!1}){this._logger.create("callback"),$k5.notifyOpener(e,t)}},bL7=class{constructor(e){this._settings=e,this._logger=new bh("RedirectNavigator")}async prepare({redirectMethod:e=this._settings.redirectMethod,redirectTarget:t=this._settings.redirectTarget}){var r;this._logger.create("prepare");let a=window.self;t==="top"&&(a=(r=window.top)!=null?r:window.self);let i=a.location[e].bind(a.location),n;return{navigate:async o=>{this._logger.create("navigate");let h=new Promise((u,g)=>{n=g});return i(o.url),await h},close:()=>{this._logger.create("close"),n?.(new Error("Redirect aborted")),a.stop()}}}async callback(){}},SL7=class extends Xk5{constructor(e){super({expiringNotificationTimeInSeconds:e.accessTokenExpiringNotificationTimeInSeconds}),this._logger=new bh("UserManagerEvents"),this._userLoaded=new CL1("User loaded"),this._userUnloaded=new CL1("User unloaded"),this._silentRenewError=new CL1("Silent renew error"),this._userSignedIn=new CL1("User signed in"),this._userSignedOut=new CL1("User signed out"),this._userSessionChanged=new CL1("User session changed")}load(e,t=!0){super.load(e),t&&this._userLoaded.raise(e)}unload(){super.unload(),this._userUnloaded.raise()}addUserLoaded(e){return this._userLoaded.addHandler(e)}removeUserLoaded(e){return this._userLoaded.removeHandler(e)}addUserUnloaded(e){return this._userUnloaded.addHandler(e)}removeUserUnloaded(e){return this._userUnloaded.removeHandler(e)}addSilentRenewError(e){return this._silentRenewError.addHandler(e)}removeSilentRenewError(e){return this._silentRenewError.removeHandler(e)}_raiseSilentRenewError(e){this._silentRenewError.raise(e)}addUserSignedIn(e){return this._userSignedIn.addHandler(e)}removeUserSignedIn(e){this._userSignedIn.removeHandler(e)}_raiseUserSignedIn(){this._userSignedIn.raise()}addUserSignedOut(e){return this._userSignedOut.addHandler(e)}removeUserSignedOut(e){this._userSignedOut.removeHandler(e)}_raiseUserSignedOut(){this._userSignedOut.raise()}addUserSessionChanged(e){return this._userSessionChanged.addHandler(e)}removeUserSessionChanged(e){this._userSessionChanged.removeHandler(e)}_raiseUserSessionChanged(){this._userSessionChanged.raise()}},HL7=class{constructor(e){this._userManager=e,this._logger=new bh("SilentRenewService"),this._isStarted=!1,this._retryTimer=new i21("Retry Silent Renew"),this._tokenExpiring=async()=>{let t=this._logger.create("_tokenExpiring");try{await this._userManager.signinSilent(),t.debug("silent token renewal successful")}catch(r){if(r instanceof in0){t.warn("ErrorTimeout from signinSilent:",r,"retry in 5s"),this._retryTimer.init(5);return}t.error("Error from signinSilent:",r),this._userManager.events._raiseSilentRenewError(r)}}}async start(){let e=this._logger.create("start");if(!this._isStarted){this._isStarted=!0,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring),this._retryTimer.addHandler(this._tokenExpiring);try{await this._userManager.getUser()}catch(t){e.error("getUser error",t)}}}stop(){this._isStarted&&(this._retryTimer.cancel(),this._retryTimer.removeHandler(this._tokenExpiring),this._userManager.events.removeAccessTokenExpiring(this._tokenExpiring),this._isStarted=!1)}},kL7=class{constructor(e,t){this.refresh_token=e.refresh_token,this.id_token=e.id_token,this.session_state=e.session_state,this.scope=e.scope,this.profile=e.profile,this.resource=t,this.data=e.state}},TL7=class{constructor(e,t,r,a){this._logger=new bh("UserManager"),this.settings=new cT5(e),this._client=new rT5(e),this._redirectNavigator=t??new bL7(this.settings),this._popupNavigator=r??new zL7(this.settings),this._iframeNavigator=a??new wL7(this.settings),this._events=new SL7(this.settings),this._silentRenewService=new HL7(this),this.settings.automaticSilentRenew&&this.startSilentRenew(),this._sessionMonitor=null,this.settings.monitorSession&&(this._sessionMonitor=new aT5(this))}get events(){return this._events}get metadataService(){return this._client.metadataService}async getUser(){let e=this._logger.create("getUser"),t=await this._loadUser();return t?(e.info("user loaded"),this._events.load(t,!1),t):(e.info("user not found in storage"),null)}async removeUser(){let e=this._logger.create("removeUser");await this.storeUser(null),e.info("user removed from storage"),this._events.unload()}async signinRedirect(e={}){this._logger.create("signinRedirect");let{redirectMethod:t,...r}=e,a=await this._redirectNavigator.prepare({redirectMethod:t});await this._signinStart({request_type:"si:r",...r},a)}async signinRedirectCallback(e=window.location.href){let t=this._logger.create("signinRedirectCallback"),r=await this._signinEnd(e);return r.profile&&r.profile.sub?t.info("success, signed in subject",r.profile.sub):t.info("no subject"),r}async signinResourceOwnerCredentials({username:e,password:t,skipUserInfo:r=!1}){let a=this._logger.create("signinResourceOwnerCredential"),i=await this._client.processResourceOwnerPasswordCredentials({username:e,password:t,skipUserInfo:r,extraTokenParams:this.settings.extraTokenParams});a.debug("got signin response");let n=await this._buildUser(i);return n.profile&&n.profile.sub?a.info("success, signed in subject",n.profile.sub):a.info("no subject"),n}async signinPopup(e={}){let t=this._logger.create("signinPopup"),{popupWindowFeatures:r,popupWindowTarget:a,...i}=e,n=this.settings.popup_redirect_uri;n||t.throw(new Error("No popup_redirect_uri configured"));let o=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:a}),h=await this._signin({request_type:"si:p",redirect_uri:n,display:"popup",...i},o);return h&&(h.profile&&h.profile.sub?t.info("success, signed in subject",h.profile.sub):t.info("no subject")),h}async signinPopupCallback(e=window.location.href,t=!1){let r=this._logger.create("signinPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),r.info("success")}async signinSilent(e={}){var t;let r=this._logger.create("signinSilent"),{silentRequestTimeoutInSeconds:a,resource:i,...n}=e,o=await this._loadUser();if(o?.refresh_token){r.debug("using refresh token");let f=new kL7(o,i);return await this._useRefreshToken(f)}let h=this.settings.silent_redirect_uri;h||r.throw(new Error("No silent_redirect_uri configured"));let u;o&&this.settings.validateSubOnSilentRenew&&(r.debug("subject prior to silent renew:",o.profile.sub),u=o.profile.sub);let g=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:a});return o=await this._signin({request_type:"si:s",redirect_uri:h,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?o?.id_token:void 0,...n},g,u),o&&((t=o.profile)!=null&&t.sub?r.info("success, signed in subject",o.profile.sub):r.info("no subject")),o}async _useRefreshToken(e){let t=await this._client.useRefreshToken({state:e,timeoutInSeconds:this.settings.silentRequestTimeoutInSeconds}),r=new gM2({...e,...t});return await this.storeUser(r),this._events.load(r),r}async signinSilentCallback(e=window.location.href){let t=this._logger.create("signinSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async signinCallback(e=window.location.href){let{state:t}=await this._client.readSigninResponseState(e);switch(t.request_type){case"si:r":return await this.signinRedirectCallback(e);case"si:p":return await this.signinPopupCallback(e);case"si:s":return await this.signinSilentCallback(e);default:throw new Error("invalid response_type in state")}}async signoutCallback(e=window.location.href,t=!1){let{state:r}=await this._client.readSignoutResponseState(e);if(r)switch(r.request_type){case"so:r":await this.signoutRedirectCallback(e);break;case"so:p":await this.signoutPopupCallback(e,t);break;case"so:s":await this.signoutSilentCallback(e);break;default:throw new Error("invalid response_type in state")}}async querySessionStatus(e={}){let t=this._logger.create("querySessionStatus"),{silentRequestTimeoutInSeconds:r,...a}=e,i=this.settings.silent_redirect_uri;i||t.throw(new Error("No silent_redirect_uri configured"));let n=await this._loadUser(),o=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:r}),h=await this._signinStart({request_type:"si:s",redirect_uri:i,prompt:"none",id_token_hint:this.settings.includeIdTokenInSilentRenew?n?.id_token:void 0,response_type:this.settings.query_status_response_type,scope:"openid",skipUserInfo:!0,...a},o);try{let u=await this._client.processSigninResponse(h.url);return t.debug("got signin response"),u.session_state&&u.profile.sub?(t.info("success for subject",u.profile.sub),{session_state:u.session_state,sub:u.profile.sub,sid:u.profile.sid}):(t.info("success, user not authenticated"),null)}catch(u){if(this.settings.monitorAnonymousSession&&u instanceof ML1)switch(u.error){case"login_required":case"consent_required":case"interaction_required":case"account_selection_required":return t.info("success for anonymous user"),{session_state:u.session_state}}throw u}}async _signin(e,t,r){let a=await this._signinStart(e,t);return await this._signinEnd(a.url,r)}async _signinStart(e,t){let r=this._logger.create("_signinStart");try{let a=await this._client.createSigninRequest(e);return r.debug("got signin request"),await t.navigate({url:a.url,state:a.state.id,response_mode:a.state.response_mode,scriptOrigin:this.settings.iframeScriptOrigin})}catch(a){throw r.debug("error after preparing navigator, closing navigator window"),t.close(),a}}async _signinEnd(e,t){let r=this._logger.create("_signinEnd"),a=await this._client.processSigninResponse(e);return r.debug("got signin response"),await this._buildUser(a,t)}async _buildUser(e,t){let r=this._logger.create("_buildUser"),a=new gM2(e);if(t){if(t!==a.profile.sub)throw r.debug("current user does not match user returned from signin. sub from signin:",a.profile.sub),new ML1({...e,error:"login_required"});r.debug("current user matches user returned from signin")}return await this.storeUser(a),r.debug("user stored"),this._events.load(a),a}async signoutRedirect(e={}){let t=this._logger.create("signoutRedirect"),{redirectMethod:r,...a}=e,i=await this._redirectNavigator.prepare({redirectMethod:r});await this._signoutStart({request_type:"so:r",post_logout_redirect_uri:this.settings.post_logout_redirect_uri,...a},i),t.info("success")}async signoutRedirectCallback(e=window.location.href){let t=this._logger.create("signoutRedirectCallback"),r=await this._signoutEnd(e);return t.info("success"),r}async signoutPopup(e={}){let t=this._logger.create("signoutPopup"),{popupWindowFeatures:r,popupWindowTarget:a,...i}=e,n=this.settings.popup_post_logout_redirect_uri,o=await this._popupNavigator.prepare({popupWindowFeatures:r,popupWindowTarget:a});await this._signout({request_type:"so:p",post_logout_redirect_uri:n,state:n==null?void 0:{},...i},o),t.info("success")}async signoutPopupCallback(e=window.location.href,t=!1){let r=this._logger.create("signoutPopupCallback");await this._popupNavigator.callback(e,{keepOpen:t}),r.info("success")}async _signout(e,t){let r=await this._signoutStart(e,t);return await this._signoutEnd(r.url)}async _signoutStart(e={},t){var r;let a=this._logger.create("_signoutStart");try{let i=await this._loadUser();a.debug("loaded current user from storage"),this.settings.revokeTokensOnSignout&&await this._revokeInternal(i);let n=e.id_token_hint||i&&i.id_token;n&&(a.debug("setting id_token_hint in signout request"),e.id_token_hint=n),await this.removeUser(),a.debug("user removed, creating signout request");let o=await this._client.createSignoutRequest(e);return a.debug("got signout request"),await t.navigate({url:o.url,state:(r=o.state)==null?void 0:r.id,scriptOrigin:this.settings.iframeScriptOrigin})}catch(i){throw a.debug("error after preparing navigator, closing navigator window"),t.close(),i}}async _signoutEnd(e){let t=this._logger.create("_signoutEnd"),r=await this._client.processSignoutResponse(e);return t.debug("got signout response"),r}async signoutSilent(e={}){var t;let r=this._logger.create("signoutSilent"),{silentRequestTimeoutInSeconds:a,...i}=e,n=this.settings.includeIdTokenInSilentSignout?(t=await this._loadUser())==null?void 0:t.id_token:void 0,o=this.settings.popup_post_logout_redirect_uri,h=await this._iframeNavigator.prepare({silentRequestTimeoutInSeconds:a});await this._signout({request_type:"so:s",post_logout_redirect_uri:o,id_token_hint:n,...i},h),r.info("success")}async signoutSilentCallback(e=window.location.href){let t=this._logger.create("signoutSilentCallback");await this._iframeNavigator.callback(e),t.info("success")}async revokeTokens(e){let t=await this._loadUser();await this._revokeInternal(t,e)}async _revokeInternal(e,t=this.settings.revokeTokenTypes){let r=this._logger.create("_revokeInternal");if(!e)return;let a=t.filter(i=>typeof e[i]=="string");if(!a.length){r.debug("no need to revoke due to no token(s)");return}for(let i of a)await this._client.revokeToken(e[i],i),r.info(`${i} revoked successfully`),i!=="access_token"&&(e[i]=null);await this.storeUser(e),r.debug("user stored"),this._events.load(e)}startSilentRenew(){this._logger.create("startSilentRenew"),this._silentRenewService.start()}stopSilentRenew(){this._silentRenewService.stop()}get _userStoreKey(){return`user:${this.settings.authority}:${this.settings.client_id}`}async _loadUser(){let e=this._logger.create("_loadUser"),t=await this.settings.userStore.get(this._userStoreKey);return t?(e.debug("user storageString loaded"),gM2.fromStorageString(t)):(e.debug("no user storageString"),null)}async storeUser(e){let t=this._logger.create("storeUser");if(e){t.debug("storing user");let r=e.toStorageString();await this.settings.userStore.set(this._userStoreKey,r)}else this._logger.debug("removing user"),await this.settings.userStore.remove(this._userStoreKey)}async clearStaleState(){await this._client.clearStaleState()}},BL7="2.4.0",VL7=BL7});async function hT5(e,t,r,a=PL7){let i=new AbortController,n=setTimeout(()=>i.abort(),a);try{let o=await fetch(e,{...t,signal:i.signal});return await r(o)}finally{clearTimeout(n)}}var PL7,wZ4,yZ4,AZ4=C1(()=>{dj();PL7=1e4;wZ4=async(e,t)=>hT5(io2(e,`api/organization/${e}`),{headers:{Authorization:`Bearer ${t}`}},async r=>{if(r.status===401)throw new Error("Unauthorized");if(!r.ok)throw new Error(`Failed to fetch organization: ${r.status} ${r.statusText}`);return r.json()}),yZ4=async(e,t,r)=>hT5(r?J03(e,`api/organization/${e}/tenants`,r):io2(e,`api/organization/${e}/tenants`),{headers:{Authorization:`Bearer ${t}`}},async a=>{if(a.status===401)throw new Error("Unauthorized");if(!a.ok)throw new Error(`Failed to fetch tenants: ${a.status} ${a.statusText}`);let i=await a.json(),n=i.value||i.items||i;if(!Array.isArray(n))throw console.error("[getTenants] Expected array but got:",typeof n),new Error("Invalid tenants response: expected an array");return console.debug(`[getTenants] received ${n.length} tenant(s)`),n})});var Ur,MW=C1(()=>{Ur={Initialized:"Delegate.Initialized",TaskInitiated:"Delegate.TaskInitiated",ComputerStateGetBatch:"ComputerState.GetBatch",ComputerStateInteropRecovery:"ComputerState.InteropRecovery",HttpResponse:"Delegate.HttpResponse",HttpRequestDenied:"Delegate.Http.RequestDenied",HttpClientRetry:"Delegate.HttpClient.Retry",HttpClientRetryExhausted:"Delegate.HttpClient.RetryExhausted",HttpClientCachePoison:"Delegate.HttpClient.CachePoison",ChatFrameworkInitFetchSessionsFailed:"Delegate.ChatFramework.Init.FetchSessionsFailed",UpdateCheckRequested:"Delegate.UpdateCheckRequested",UpdateAvailable:"Delegate.UpdateAvailable",UpdateNotAvailable:"Delegate.UpdateNotAvailable",UpdateDownloaded:"Delegate.UpdateDownloaded",UpdateInstallRequested:"Delegate.UpdateInstallRequested",UpdateInstallSucceeded:"Delegate.UpdateInstallSucceeded",UpdateDismissed:"Delegate.UpdateDismissed",UpdateError:"Delegate.UpdateError",AutoUpdateFeedSet:"Delegate.AutoUpdateFeedSet",AutoUpdateFeedPolled:"Delegate.AutoUpdateFeedPolled",SkillCreated:"Delegate.SkillCreated",SkillImported:"Delegate.SkillImported",RoutineCreated:"Delegate.RoutineCreated",ProgressCurrentFallback:"progress_current_fallback",ProgressParseFailed:"progress_parse_failed",ConnectorAdded:"Delegate.ConnectorAdded",RecordingCreated:"Delegate.RecordingCreated",UserFeedback:"UserFeedback",SSEConnectionRetry:"Delegate.SSE.ConnectionRetry",SSEConnectionRetryExhausted:"Delegate.SSE.ConnectionRetryExhausted",SSEGatewayRetry:"Delegate.SSE.GatewayRetry",SSEGatewayRetryExhausted:"Delegate.SSE.GatewayRetryExhausted",SSEIdleAbort:"Delegate.SSE.IdleAbort",SSEConnectTimeout:"Delegate.SSE.ConnectTimeout",ToolSyncFailed:"Delegate.ToolExecution.SyncFailed",SSENetworkRetry:"Delegate.SSE.NetworkRetry",SSENetworkRetryExhausted:"Delegate.SSE.NetworkRetryExhausted",SSEParseError:"Delegate.SSE.ParseError",SSEStreamError:"Delegate.SSE.StreamError",SSEUnsupportedAttachmentRetry:"Delegate.SSE.UnsupportedAttachmentRetry",SSEJwtExpiredAutoRefresh:"Delegate.SSE.JwtExpiredAutoRefresh",AgenticLoopThinkOnlyResponse:"Delegate.AgenticLoop.ThinkOnlyResponse",ToolExecutionDoomLoop:"Delegate.Tool.DoomLoopDetected",ToolExecutionRecoveryAction:"Delegate.Tool.RecoveryAction",ToolExecutionOrphaned:"Delegate.Tool.OrphanedExecution",ToolExecutionValidationError:"Delegate.Tool.ValidationError",ToolExecutionThrew:"Delegate.Tool.ExecutionThrew",ToolExecutionFailed:"Delegate.Tool.ExecutionFailed",ToolRiskClassification:"Delegate.Tool.RiskClassification",ToolClassificationDowngrade:"Delegate.Tool.ClassificationDowngrade",ToolAllowlistBeatUnrecoverable:"Delegate.Tool.AllowlistBeatUnrecoverable",ProjectAccessPolicySnapshot:"Delegate.ProjectAccess.PolicySnapshot",ProjectAccessCapabilityDecision:"Delegate.ProjectAccess.CapabilityDecision",ProjectAccessResourceLifecycle:"Delegate.ProjectAccess.ResourceLifecycle",ProjectAccessCleanup:"Delegate.ProjectAccess.Cleanup",SandboxCapabilityDecision:"Delegate.Sandbox.CapabilityDecision",SandboxAvailability:"Delegate.Sandbox.Availability",SandboxPolicyChanged:"Delegate.Sandbox.PolicyChanged",SandboxFilesystemDecision:"Delegate.Sandbox.FilesystemDecision",SandboxOperationDenied:"Delegate.Sandbox.OperationDenied",AuthInvalidGrant:"Delegate.Auth.InvalidGrant",AuthRefreshRetryExhausted:"Delegate.Auth.RefreshRetryExhausted",AuthRestoreFailed:"Delegate.Auth.RestoreFailed",SessionRestoreFailed:"Delegate.Session.RestoreFailed",SessionCreateFailed:"Delegate.Session.CreateFailed",ClipboardOperationFailed:"Delegate.Clipboard.OperationFailed",AskUserResumeAttempted:"Delegate.AskUser.ResumeAttempted",AskUserResumeFailed:"Delegate.AskUser.ResumeFailed",AuthOrgInvalidAutoLogout:"Delegate.Auth.OrgInvalidAutoLogout",AuthOrgNotEntitled:"Delegate.Auth.OrgNotEntitled",AuthAssistantCloudUnsupported:"Delegate.Auth.AssistantCloudUnsupported",BackgroundSubModeSelected:"Delegate.BackgroundSubMode.Selected",UnifiedPipSpawnFailed:"Delegate.Unified.PipSpawnFailed",SeededToolCallOutcome:"Delegate.SeededToolCall.Outcome",AnswerNowClicked:"Delegate.AnswerNow.Clicked",OnSendMessage:"Biz.Framework.OnSendMessage",OnCreateSession:"Biz.Framework.OnCreateSession",OnToolExecution:"Biz.Framework.OnToolExecution",ToolPayloadsReceived:"Biz.Framework.ToolPayloadsReceived",ToolExecutionStarted:"Biz.Framework.ToolExecutionStarted",ToolExecutionCompleted:"Biz.Framework.ToolExecutionCompleted",BizToolExecutionFailed:"Biz.Framework.ToolExecutionFailed",ToolExecutionInterrupted:"Biz.Framework.ToolExecutionInterrupted",ToolExecutionInvalidProperties:"Biz.Framework.ToolExecutionInvalidProperties",ToolExecutionReverted:"Biz.Framework.ToolExecutionReverted",ToolExecutionPreviewAccepted:"Biz.Framework.ToolExecutionPreviewAccepted",ToolExecutionPreviewRejected:"Biz.Framework.ToolExecutionPreviewRejected",Feedback:"Biz.Framework.Feedback",OnCopyToClipboard:"Biz.Framework.OnCopyToClipboard",SetOperatingModel:"Biz.Framework.SetOperatingModel",SetOperatingMode:"Biz.Framework.SetOperatingMode",DeepLinkReceived:"Delegate.DeepLink.Received",DeepLinkConfirmShown:"Delegate.DeepLink.ConfirmShown",DeepLinkResolved:"Delegate.DeepLink.Resolved",ExternalConversationsImported:"Delegate.ExternalConversations.Imported"}});function Z_1(e){return e&&(e.length>32768?e.slice(0,32768):e).replace(_L7,"C:\\Users\\[REDACTED]\\").replace(EL7,"/Users/[REDACTED]/").replace(RL7,"[EMAIL_REDACTED]")}function dT5(e){let t=new Error(Z_1(e.message));return t.name=Z_1(e.name),e.stack&&(t.stack=Z_1(e.stack)),t}function BQ1(e){return typeof e=="string"?Z_1(e):Array.isArray(e)?e.map(t=>BQ1(t)):e!==null&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([t,r])=>[t,BQ1(r)])):e}var _L7,EL7,RL7,on0=C1(()=>{_L7=/C:\\Users\\[^\\]+\\/gi,EL7=/\/Users\/[^/]+\//g,RL7=/[a-zA-Z0-9._%+-]{1,64}@[a-zA-Z0-9.-]{1,253}\.[a-zA-Z]{2,10}/g});var ZL7,uT5,gT5,ln0,T91,FL7,pT5,xL1=C1(()=>{wu();n21();dj();no2();ZL7=(e,t,r=!1,a)=>r||a?!1:e==="true"?!0:!t;console.log("[backendUrl] Module loaded - VITE_USE_CLOUD_URL:",process.env.VITE_USE_CLOUD_URL,"backend URL set:",!!Fx?.explicitBackendUrl);uT5=()=>ZL7(process.env.VITE_USE_CLOUD_URL,Fx?.explicitBackendUrl,!!Fh1,Fx?.e2eRuntimeBackendUrl),gT5=()=>{let{organization:e,tenant:t}=Mr.getState(),r=e?.logicalName||"",a=t?.name||"";if(!r||!a){let i=!r&&!a?"organization and tenant":r?"tenant":"organization";throw console.error(`[backendUrl] Missing ${i} \u2014 cannot build cloud URL. org=${r||"(empty)"}, tenant=${a||"(empty)"}`),new Error(`Cannot connect to backend: missing ${i}. Please sign out and sign in again.`)}return tk1(FM,r,a)},ln0=async()=>{if(uT5()){let e=gT5();return console.log("[backendUrl] Using cloud URL:",e),e}return console.log("[backendUrl] Using direct backend URL:",Fx.apiBaseUrl),Fx.apiBaseUrl},T91=()=>{if(uT5())try{return gT5()}catch{return""}return Fx.apiBaseUrl},FL7=()=>FM,pT5=()=>{let{organization:e,tenant:t}=Mr.getState(),r=FL7(),a=e?.logicalName||"",i=t?.name||"";return`${r}/${a}/${i}`}});var fT5=C1(()=>{MU2()});var vT5,zZ4,Vr,o21=C1(()=>{Rj2();vT5=w4(Km(),1);wu();wd();MU2();n21();dj();on0();xL1();MW();ri0();fT5();zZ4=class{constructor(){this._namePrefix="Delegate";this._tracker=null;this._connectionString=null;this._isInitialized=!1;this._trackerInstanceId=(0,vT5.v4)();this._sharedTrackerIdReady=Promise.resolve();this._crashReportsEnabled=!0;this._additionalProperties={}}setCrashReportsEnabled(t){this._crashReportsEnabled=t}setAdditionalProperties(t){this._additionalProperties=Object.fromEntries(Object.entries(t).filter(([,r])=>r!=null&&r!==""))}isCrashReportsEnabled(){return this._crashReportsEnabled}initialize(t,{clientApplication:r="Delegate"}={}){if(!this._isInitialized){if(this._connectionString=t||{}.APP_INSIGHTS_CONNECTION_STR||null,!this._connectionString){console.warn("[TelemetryService] No App Insights connection string provided, telemetry disabled");return}try{let a=mr3.withConfig({connectionString:this._connectionString,namePrefix:this._namePrefix,disableFetchTracking:!0,disableAjaxTracking:!0}).build();this._tracker=new _j2(Bx.External,"UiPath.Delegate",a),this._tracker.initialize({isDevelopment:process.env.NODE_ENV==="development",language:"en-US",preserveQueryParams:!0}),this._tracker.setMetadata({TrackerInstanceId:this._trackerInstanceId,ApplicationArea:this._parseTelemetryArea(),ClientApplication:r}),this._isInitialized=!0,console.log("[TelemetryService] Initialized successfully"),this._sharedTrackerIdReady=(window.electronAPI?.getTrackerInstanceId?.()??Promise.resolve("")).then(i=>{i&&(this._trackerInstanceId=i,this._tracker?.setMetadata({TrackerInstanceId:i}))}).catch(()=>{})}catch(a){console.error("[TelemetryService] Failed to initialize:",a)}}}async trackEvent(t,r,a,i){if(!this._tracker||!this._crashReportsEnabled)return;let n,o;typeof r=="object"?o=r:(n=r,o=i);let h=await this._getEnhancedProperties(o,n,a);this._tracker.trackEvent(t,h)}async sendBugTraceContent(t,r){if(!this._tracker)throw new Error("Telemetry not initialized");let a=7500,i=[];for(let n=0;n<t.length;n+=a)i.push(t.slice(n,n+a));for(let n=0;n<i.length;n++)await this.trackEvent("BugTrace.ContentChunk",{correlationId:r.correlationId,sessionId:r.sessionId,chunkIndex:n,totalChunks:i.length,chunk:i[n]})}async trackFeedback(t,r,a){await this.trackEvent(Ur.UserFeedback,{feedback:t,page:r,sessionId:st.getState().currentSessionId,...a})}async trackError(t,r,a,i,n){if(!this._tracker||!this._crashReportsEnabled)return;let o=await this._getEnhancedProperties(n,a,i);this._tracker.trackError(dT5(t),r??GF.Major,o)}async trackTrace(t,r,a,i,n){if(!this._tracker||!this._crashReportsEnabled)return;let o=await this._getEnhancedProperties(n,a,i);this._tracker.trackTrace(Z_1(t),r??GF.Info,o)}async trackApplicationStart(t){if(!this._tracker||!this._crashReportsEnabled)return;await this._sharedTrackerIdReady;let r=await this._getEnhancedProperties(t);this._tracker.trackApplicationStart(r)}async _getEnhancedProperties(t,r,a){let i=Mr.getState(),{user:n,organization:o,tenant:h}=i,u=n?.profile?.sub||null,g=n?.profile?.email||null,f=h?.id||null,v=h?.name||null,C=o?.id||null,L=o?.name||null,y={"x-uipath-organization-id":C,"x-uipath-organization-name":L,"x-uipath-tenant-id":f,"x-uipath-tenant-name":v,"x-uipath-user-id":u};g?.endsWith("@uipath.com")&&(y["x-uipath-is-internal-user"]="true");let{modelId:z,modelType:S}=VS5(),B=this._resolveSessionId(t,r),R=B?a??st.getState().selectTurnCorrelationId(B):a,F={...z?{"x-delegate-model-id":z}:{},...S?{"x-delegate-model-type":S}:{},...B?{"x-autopilot-session-id":B}:{},...R?{"x-autopilot-turn-correlation-id":R}:{}},j=this._additionalProperties.licenseType?.toLowerCase().replace(/\s+/g,"")==="community",Y=t?.SendMessage&&!j?{...t,SendMessage:""}:t,t1={...y,...F,"x-delegate-agent":Fx.agentName,"x-delegate-version":"0.1.4",timestamp:new Date().toISOString(),...Y??{},...this._additionalProperties};return Object.fromEntries(Object.entries(t1).filter(([,n1])=>n1!=null).map(([n1,a1])=>[n1,typeof a1=="string"?Z_1(a1):a1]))}_resolveSessionId(t,r){if(r)return r;let a=t?.sessionId;return typeof a=="string"&&a?a:void 0}getArea(){return this._parseTelemetryArea()}_parseTelemetryArea(){let t=T91().toLowerCase(),r=t||FM.toLowerCase();return t.includes("localhost")?"local":r.includes("nst.kubefabric")?"nst":r.includes("alpha")||r.includes("-alp-")?"alpha":r.includes("staging")||r.includes("-stg-")?"staging":r.includes("cloud")||r.includes("-prd-")?"production":"local"}async initializeTelemetry(t,r,a,i,n){this.initialize(t)}async updateTrackerLanguage(t){}get isEnabled(){return this._isInitialized&&this._tracker!==null}},Vr=new zZ4});function mT5(){if(!(typeof window>"u"||typeof localStorage>"u"))try{let t=Object.keys(localStorage).filter(r=>r.startsWith("oidc."));if(t.length>1){let r=null,a=0;for(let i of t)try{let n=localStorage.getItem(i);if(n){let h=JSON.parse(n).created||0;h>a&&(a=h,r=i)}}catch{}for(let i of t)i!==r&&localStorage.removeItem(i)}}catch(e){console.error("Failed to cleanup old OIDC sessions:",e)}}function CT5(){if(!(typeof window>"u"||typeof localStorage>"u"))try{Object.keys(localStorage).forEach(t=>{t.startsWith("oidc.")&&localStorage.removeItem(t)})}catch(e){console.error("Failed to clean OIDC data from localStorage:",e)}}var bZ4=C1(()=>{});function DL7(e){return e.map(t=>{if(t instanceof Error)return t.stack??t.message;if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}).join(" ")}function cn0(e){let t=SZ4.default.getLogger(e);return t.methodFactory!==MT5&&(t.methodFactory=MT5,t.setLevel(t.getLevel())),t.getLevel()||t.setLevel(process.env.NODE_ENV==="production"?"warn":"debug"),t}var SZ4,IL7,MT5,HZ4=C1(()=>{SZ4=w4(eU2(),1);IL7=SZ4.default.methodFactory,MT5=(e,t,r)=>{let a=IL7(e,t,r);return e!=="warn"&&e!=="error"?a:(...i)=>{a(...i);let n=typeof window<"u"?window.debugApi:void 0;if(!n)return;let o=`[${String(r)}] ${DL7(i)}`;e==="error"?n.logError?.(o):n.logWarn?.(o)}}});function cY(e,t,r){return new Promise((a,i)=>{let n=setTimeout(()=>{i(new Error(`${r} timed out after ${t}ms`))},t);e.then(o=>{clearTimeout(n),a(o)},o=>{clearTimeout(n),i(o)})})}function kZ4(e,t,r){return t.aborted?Promise.reject(new Error(`${r} aborted`)):new Promise((a,i)=>{let n=()=>i(new Error(`${r} aborted`));t.addEventListener("abort",n,{once:!0}),e.then(o=>{t.removeEventListener("abort",n),a(o)},o=>{t.removeEventListener("abort",n),i(o)})})}var VQ1=C1(()=>{});function jL7(e){try{let t=new URL(e).hostname.toLowerCase();return t==="alpha.uipath.com"||t.endsWith(".alpha.uipath.com")}catch{return!1}}function LT5(e,t){return e&&!jL7(t)?GL7:null}var NL7,UL7,xT5,QZi,GL7,wT5=C1(()=>{NL7="localhost",UL7="/portal_/loginsuccess",xT5=`http://${NL7}:3000${UL7}`,QZi=300*1e3,GL7="Named Delegate dev instances require alpha Identity because they use a localhost OAuth redirect for isolation. Staging and production reject that redirect URI."});function yT5(e){let t=WL7.exec(e);if(!t)return null;let[r,a,i]=t;return{org:a,tenant:i,basePath:r}}function AT5(e,t){let r=t.tenant?`/${t.tenant}`:"";return`${e}/${t.org}${r}/delegate_/loginsuccess`}var WL7,zT5=C1(()=>{WL7=/^\/([^/]+)(?:\/([^/]+))?\/delegate_(?=\/|$)/});function bT5(e){let t=yT5(e.pathname);return t?{clientId:sn0,redirectUri:AT5(e.origin,t),portalRoute:t}:{clientId:sn0,redirectUri:`${e.origin}/portal_/loginsuccess`,portalRoute:null}}var sn0,ST5=C1(()=>{zT5();sn0="9a04590e-e000-443d-b1b2-8a22ac6ad018"});var vM2,qL7,$L7,TZ4,KL7,TT5,HT5,YL7,kT5,hn0,BZ4=C1(()=>{wu();ZE4();dj();wT5();ST5();vM2=i04,qL7=typeof window<"u"&&window.electronAPI?.isE2EMode===!0,$L7=typeof window<"u"&&window.electronAPI?.isInstalledAppE2E===!0,TZ4=pZ?bT5(window.location):null,KL7=typeof window<"u"?ZC2({},process.env.NODE_ENV==="development"):null,TT5=!pZ&&!!KL7,HT5=LT5(TT5,vM2);HT5&&console.warn(`[Auth] ${HT5}`);YL7=qL7&&!$L7||TT5,kT5=TZ4?TZ4.redirectUri:YL7?xT5:"com.uipath.delegate.oidc://oauthredirect",hn0={authority:vM2,redirect_uri:kT5,response_type:"code",silent_redirect_uri:kT5,overrides:{client_id:TZ4?.clientId??sn0,scope:"openid profile email ConnectionService ConnectionServiceUser CustomerPortal DataService DataServiceApiUserAccess DocumentUnderstanding Du.Metering Du.Digitization.Api Du.Classification.Api Du.Extraction.Api Du.Validation.Api Du.Storage.PresignedUrl Docs.GPT.Search Docs.Service Directory IdentityServerApi OrchestratorApiUserAccess ReferenceToken LLMGateway LLMOps Traces.Api OMS PIMS Relay.Service RCS.FolderAuthorization Robot.Local SRS.Recommendations SRS.Events SCP.Jobs.Read SCP.Runtimes SCP.Runtimes.Read StudioWebBackend StudioWebTypeCacheService TM.Projects TM.TestCases TM.TestExecutions TM.Requirements TM.TestSets TestmanagerApiUserAccess TM.Attachments TM.ObjectLabels TM.CustomFieldDefinitions TM.CustomFieldValues TM.PerformanceScenarios TM.PerformanceScenarioExecutions offline_access"},automaticSilentRenew:!1,monitorSession:!1,silentRequestTimeoutInSeconds:2,useRefreshToken:!0,iframeNotifyParentTimeoutInSeconds:2,loadUserInfo:!1,checkSessionIntervalInSeconds:0}});var _Q1=M1((hFi,ET5)=>{"use strict";var XL7=Object.create,un0=Object.defineProperty,JL7=Object.getOwnPropertyDescriptor,QL7=Object.getOwnPropertyNames,tw7=Object.getPrototypeOf,ew7=Object.prototype.hasOwnProperty,rw7=(e,t)=>{for(var r in t)un0(e,r,{get:t[r],enumerable:!0})},VT5=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of QL7(t))!ew7.call(e,i)&&i!==r&&un0(e,i,{get:()=>t[i],enumerable:!(a=JL7(t,i))||a.enumerable});return e},PQ1=(e,t,r)=>(r=e!=null?XL7(tw7(e)):{},VT5(t||!e||!e.__esModule?un0(r,"default",{value:e,enumerable:!0}):r,e)),aw7=e=>VT5(un0({},"__esModule",{value:!0}),e),PT5={};rw7(PT5,{AuthContext:()=>gn0,AuthProvider:()=>gw7,hasAuthParams:()=>pn0,useAuth:()=>fn0,useAutoSignin:()=>fw7,withAuth:()=>mw7,withAuthenticationRequired:()=>Cw7});ET5.exports=aw7(PT5);var iw7=PQ1(rr()),gn0=iw7.default.createContext(void 0);gn0.displayName="AuthContext";var nw7=TQ1(),Wh1=PQ1(rr()),ow7={isLoading:!0,isAuthenticated:!1},lw7=(e,t)=>{switch(t.type){case"INITIALISED":case"USER_LOADED":return{...e,user:t.user,isLoading:!1,isAuthenticated:t.user?!t.user.expired:!1,error:void 0};case"USER_SIGNED_OUT":case"USER_UNLOADED":return{...e,user:void 0,isAuthenticated:!1};case"NAVIGATOR_INIT":return{...e,isLoading:!0,activeNavigator:t.method};case"NAVIGATOR_CLOSE":return{...e,isLoading:!1,activeNavigator:void 0};case"ERROR":{let r=t.error;return r.toString=()=>`${r.name}: ${r.message}`,{...e,isLoading:!1,error:r}}default:{let r=new TypeError(`unknown type ${t.type}`),a={name:r.name,message:r.message,innerError:r,stack:r.stack,source:"unknown"};return a.toString=()=>`${a.name}: ${a.message}`,{...e,isLoading:!1,error:a}}}},pn0=(e=window.location)=>{let t=new URLSearchParams(e.search);return!!((t.get("code")||t.get("error"))&&t.get("state")||(t=new URLSearchParams(e.hash.replace("#","?")),(t.get("code")||t.get("error"))&&t.get("state")))},cw7=EZ4("signinCallback","Sign-in failed"),sw7=EZ4("signoutCallback","Sign-out failed"),hw7=EZ4("renewSilent","Renew silent failed");function _T5(e,t){return{name:VZ4(e,"name",()=>"Error"),message:VZ4(e,"message",()=>t),stack:VZ4(e,"stack",()=>new Error().stack),innerError:e}}function EZ4(e,t){return r=>({..._T5(r,t),source:e})}function VZ4(e,t,r){if(e&&typeof e=="object"){let a=e[t];if(typeof a=="string")return a}return r()}var dw7=["clearStaleState","querySessionStatus","revokeTokens","startSilentRenew","stopSilentRenew"],uw7=["signinPopup","signinSilent","signinRedirect","signinResourceOwnerCredentials","signoutPopup","signoutRedirect","signoutSilent"],PZ4=e=>()=>{throw new Error(`UserManager#${e} was called from an unsupported context. If this is a server-rendered page, defer this call with useEffect() or pass a custom UserManager implementation.`)},BT5=typeof window>"u"?null:nw7.UserManager,gw7=e=>{let{children:t,onSigninCallback:r,skipSigninCallback:a,matchSignoutCallback:i,onSignoutCallback:n,onRemoveUser:o,userManager:h=null,...u}=e,[g]=Wh1.default.useState(()=>h??(BT5?new BT5(u):{settings:u})),[f,v]=Wh1.default.useReducer(lw7,ow7),C=Wh1.default.useMemo(()=>Object.assign({settings:g.settings,events:g.events},Object.fromEntries(dw7.map(S=>{var B,R;return[S,(R=(B=g[S])==null?void 0:B.bind(g))!=null?R:PZ4(S)]})),Object.fromEntries(uw7.map(S=>[S,g[S]?async B=>{v({type:"NAVIGATOR_INIT",method:S});try{return await g[S](B)}catch(R){return v({type:"ERROR",error:{..._T5(R,`Unknown error while executing ${S}(...).`),source:S,args:B}}),null}finally{v({type:"NAVIGATOR_CLOSE"})}}:PZ4(S)]))),[g]),L=Wh1.default.useRef(!1);Wh1.default.useEffect(()=>{!g||L.current||(L.current=!0,(async()=>{try{let S=null;pn0()&&!a&&(S=await g.signinCallback(),r&&await r(S)),S=S||await g.getUser(),v({type:"INITIALISED",user:S})}catch(S){v({type:"ERROR",error:cw7(S)})}try{if(i&&i(g.settings)){let S=await g.signoutCallback();n&&await n(S)}}catch(S){v({type:"ERROR",error:sw7(S)})}})())},[g,a,r,n,i]),Wh1.default.useEffect(()=>{if(!g)return;let S=N=>{v({type:"USER_LOADED",user:N})};g.events.addUserLoaded(S);let B=()=>{v({type:"USER_UNLOADED"})};g.events.addUserUnloaded(B);let R=()=>{v({type:"USER_SIGNED_OUT"})};g.events.addUserSignedOut(R);let F=N=>{v({type:"ERROR",error:hw7(N)})};return g.events.addSilentRenewError(F),()=>{g.events.removeUserLoaded(S),g.events.removeUserUnloaded(B),g.events.removeUserSignedOut(R),g.events.removeSilentRenewError(F)}},[g]);let y=Wh1.default.useCallback(async()=>{g||PZ4("removeUser"),await g.removeUser(),o&&await o()},[g,o]),z=Wh1.default.useMemo(()=>({...f,...C,removeUser:y}),[f,C,y]);return Wh1.default.createElement(gn0.Provider,{value:z},t)},pw7=PQ1(rr()),fn0=()=>{let e=pw7.default.useContext(gn0);return e||console.warn("AuthProvider context is undefined, please verify you are calling useAuth() as child of a <AuthProvider> component."),e},_Z4=PQ1(rr()),fw7=({signinMethod:e="signinRedirect"}={})=>{let t=fn0(),[r,a]=_Z4.default.useState(!1),i=_Z4.default.useMemo(()=>!pn0()&&!t.isAuthenticated&&!t.activeNavigator&&!t.isLoading&&!r,[t.activeNavigator,t.isAuthenticated,t.isLoading,r]);return _Z4.default.useEffect(()=>{i&&(e==="signinPopup"?t.signinPopup():t.signinRedirect(),a(!0))},[t,r,i,e]),{isLoading:t.isLoading,isAuthenticated:t.isAuthenticated,error:t.error}},vw7=PQ1(rr());function mw7(e){let t=`withAuth(${e.displayName||e.name})`,r=a=>{let i=fn0();return vw7.default.createElement(e,{...a,auth:i})};return r.displayName=t,r}var dn0=PQ1(rr()),Cw7=(e,t={})=>{let{OnRedirecting:r=()=>dn0.default.createElement(dn0.default.Fragment,null),onBeforeSignin:a,signinRedirectArgs:i}=t,n=`withAuthenticationRequired(${e.displayName||e.name})`,o=h=>{let u=fn0();return dn0.default.useEffect(()=>{pn0()||u.isLoading||u.activeNavigator||u.isAuthenticated||(async()=>(a&&await a(),await u.signinRedirect(i)))()},[u.isLoading,u.isAuthenticated,u]),u.isAuthenticated?dn0.default.createElement(e,{...h}):r()};return o.displayName=n,o}});var RT5=M1((RZ4,ZZ4)=>{(function(e,t){typeof RZ4=="object"&&typeof ZZ4<"u"?ZZ4.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self,(function(){var r=e.Cookies,a=e.Cookies=t();a.noConflict=function(){return e.Cookies=r,a}})())})(RZ4,(function(){"use strict";function e(i){for(var n=1;n<arguments.length;n++){var o=arguments[n];for(var h in o)i[h]=o[h]}return i}var t={read:function(i){return i[0]==='"'&&(i=i.slice(1,-1)),i.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(i){return encodeURIComponent(i).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function r(i,n){function o(u,g,f){if(!(typeof document>"u")){f=e({},n,f),typeof f.expires=="number"&&(f.expires=new Date(Date.now()+f.expires*864e5)),f.expires&&(f.expires=f.expires.toUTCString()),u=encodeURIComponent(u).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var v="";for(var C in f)f[C]&&(v+="; "+C,f[C]!==!0&&(v+="="+f[C].split(";")[0]));return document.cookie=u+"="+i.write(g,u)+v}}function h(u){if(!(typeof document>"u"||arguments.length&&!u)){for(var g=document.cookie?document.cookie.split("; "):[],f={},v=0;v<g.length;v++){var C=g[v].split("="),L=C.slice(1).join("=");try{var y=decodeURIComponent(C[0]);if(f[y]=i.read(L,y),u===y)break}catch{}}return u?f[u]:f}}return Object.create({set:o,get:h,remove:function(u,g){o(u,"",e({},g,{expires:-1}))},withAttributes:function(u){return r(this.converter,e({},this.attributes,u))},withConverter:function(u){return r(e({},this.converter,u),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(i)}})}var a=r(t,{path:"/"});return a}))});var Mn0=M1((dFi,WT5)=>{"use strict";var Mw7=Object.create,Cn0=Object.defineProperty,xw7=Object.getOwnPropertyDescriptor,Lw7=Object.getOwnPropertyNames,ww7=Object.getPrototypeOf,yw7=Object.prototype.hasOwnProperty,Aw7=(e,t)=>{for(var r in t)Cn0(e,r,{get:t[r],enumerable:!0})},FT5=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Lw7(t))!yw7.call(e,i)&&i!==r&&Cn0(e,i,{get:()=>t[i],enumerable:!(a=xw7(t,i))||a.enumerable});return e},zw7=(e,t,r)=>(r=e!=null?Mw7(ww7(e)):{},FT5(t||!e||!e.__esModule?Cn0(r,"default",{value:e,enumerable:!0}):r,e)),bw7=e=>FT5(Cn0({},"__esModule",{value:!0}),e),OT5={};Aw7(OT5,{AuthLogger:()=>NT5,IdentityUserManager:()=>Uw7,InMemoryWebStorage:()=>mM2.InMemoryWebStorage,Log:()=>mM2.Log,UberClientId:()=>jT5,User:()=>mM2.User,UserManager:()=>mM2.UserManager,WebStorageStateStore:()=>mM2.WebStorageStateStore,WellKnownAuthErrors:()=>GT5,getAccessToken:()=>Bw7,getIdToken:()=>Vw7,getIdentityAuthority:()=>DT5,getUser:()=>Pw7,getUserManager:()=>Ew7,hasValidSession:()=>IT5,setUserManager:()=>UT5,validateReturnUrl:()=>_w7});WT5.exports=bw7(OT5);var Sw7=["plt-nst-tms-we-01-apim.azure-api.net","alpha.uipath.com","staging.uipath.com","cloud.uipath.com","staging.gov.uipath-dev.com","alpha.gov.uipath-dev.com","govcloud.uipath.us"];function DT5(e){let t=window.location.host;return Sw7.includes(t)?`https://${t}/identity_`:`https://${t}/${e?"identity":"identity_"}`}var vn0=zw7(RT5()),Hw7=Km(),mn0="UiPathIdentitySessionId";function FZ4(){vn0.default.get(mn0)||vn0.default.set(mn0,(0,Hw7.v4)(),{path:"/",secure:!0})}function kw7(){vn0.default.remove(mn0,{path:"/",domain:window.location.hostname,secure:!0})}function Tw7(){return vn0.default.get(mn0)}function Bw7(){return window.User?.access_token}function Vw7(){return window.User?.id_token}function Pw7(){return window.User??null}function IT5(){return!!Tw7()}var NT5=class CM2{static instance;constructor(){}static getInstance(){return CM2.instance||(CM2.instance=new CM2),CM2.instance}error(t,...r){console.error(t,...r)}info(t,...r){console.log(t,...r)}debug(t,...r){console.log(t,...r)}warn(t,...r){console.warn(t,...r)}};function _w7(e){if(!e)return!1;if(e==="/")return!0;let t=/^\/[a-zA-Z0-9_\-/():]*(\?[\w%&\-=,.+]+)?$/,r=/^(http|https):\/\/[^ "]+$/;return t.test(e)?!0:!(!r.test(e)||new URL(e).hostname!==window.location.hostname)}var Ew7=()=>window.__IdentityUserManager__,UT5=e=>{window.__IdentityUserManager__=e},GT5=(e=>(e.NoMatchingState="No matching state found in storage",e.IFrameTimeout="IFrame timed out without a response",e.InvalidGrant="invalid_grant",e.LoginRequired="login_required",e.FailedToFetch="Failed to fetch",e))(GT5||{}),Rw7=e=>{let t=`${window.location.origin}/portal_/autherror`;if(e instanceof Error){window.location.assign(`${t}?error=${e.message}`);return}window.location.assign(t)},ZT5=TQ1(),OZ4=TQ1();function Zw7(){return window.localStorage.getItem("AUTH_DEBUG")==="true"}function Fw7(){OZ4.Log.setLogger(NT5.getInstance()),OZ4.Log.setLevel(OZ4.Log.DEBUG)}var Ow7=class{constructor(){this.set(null)}set(e){window.User=e}remove(){window.User=null}get(){return window.User}},Dw7=class{_isSigningOut=!1;constructor(){}get isSigningOut(){return this._isSigningOut}set isSigningOut(e){this._isSigningOut=e}},jT5="1119a927-10ab-4543-bd1a-ad6bfbbc27f4",Iw7="/portal_/api/tokenFactory/callback",Nw7=["openid","profile","offline_access"],Uw7=class extends ZT5.UserManager{_user=new Ow7;_failedToFetchCount=0;_refreshPromise=null;_signoutState=new Dw7;_onSigninError;constructor(e){let t=e.authority??DT5(e.isMsi),r=new URL(t).origin,a=e.usePortalSilentRedirectUri?`${r}${Iw7}`:e.redirect_uri,i=e.post_logout_redirect_uri??`${r}/portal_/cloudrpa`,n=(e.overrides?.client_id??jT5).toLowerCase(),o=e.overrides?.scope??Nw7.join(" ");super({...e,client_id:n,scope:o,authority:t,monitorSession:e.monitorSession??!0,stopCheckSessionOnError:!0,response_type:"code",userStore:new ZT5.WebStorageStateStore({store:window.sessionStorage,prefix:e.storagePrefix}),silent_redirect_uri:a,post_logout_redirect_uri:i}),this._onSigninError=e.onSigninError??Rw7,Zw7()&&Fw7(),this.signinComplete=this.signinComplete.bind(this),this._handleSigninError=this._handleSigninError.bind(this),this._expireSession=this._expireSession.bind(this),this._onFailedToFetch=this._onFailedToFetch.bind(this),this._onNetworkChange=this._onNetworkChange.bind(this),this._onSilentRenewError=this._onSilentRenewError.bind(this),this.registerCustomEvents(),this.clearRefreshToken(),UT5(this)}registerCustomEvents(){window.addEventListener("online",this._onNetworkChange),this.events.addUserSignedOut(this._expireSession),this.events.addUserLoaded(FZ4),this.events.addAccessTokenExpired(this.signinComplete),this.events.addSilentRenewError(this._onSilentRenewError)}unregisterCustomEvents(){window.removeEventListener("online",this._onNetworkChange),this.events.removeUserSignedOut(this._expireSession),this.events.removeUserLoaded(FZ4),this.events.removeAccessTokenExpired(this.signinComplete),this.events.removeSilentRenewError(this._onSilentRenewError)}async clearRefreshToken(){let e=await this.getUser();e&&(e.refresh_token=void 0,await this.storeUser(e))}async getUser(){let e=await super.getUser();return e&&!this._user.get()&&this._user.set(e),e}async storeUser(e){await super.storeUser(e),this._user.set(e),e&&(this._failedToFetchCount=0,FZ4())}async removeUser(){return kw7(),this._user.remove(),super.removeUser()}async signinRedirect(e){let t=e?.state;if(!t?.returnTo)if(this._logger.warn("no returnTo provided, using default"),location.href.startsWith(document.baseURI)){let r=location.href.substring(document.baseURI.length);t={returnTo:r.startsWith("/")?r:`/${r}`}}else t={returnTo:location.pathname+location.search};return e?.organizationName&&(e.acr_values=`tenantName:${e.organizationName}`,delete e.organizationName),super.signinRedirect({...e,state:t})}async signinCallback(e){try{return super.signinCallback(e)}catch(t){await this._handleSigninError(t,{state:{returnTo:"/"}});return}}async signoutRedirect(e){return this._signoutState.isSigningOut=!0,super.signoutRedirect(e)}async signoutRedirectCallback(e){return this._signoutState.isSigningOut=!1,super.signoutRedirectCallback(e)}async signinComplete(e){try{if(await this.clearStaleState(),this._signoutState.isSigningOut)return;IT5()?await this.signinSilent(e):await this.signinRedirect(e)}catch(t){await this._handleSigninError(t,e)}}async _useRefreshToken(e){if(this._refreshPromise)return this._refreshPromise;this._refreshPromise=super._useRefreshToken(e);try{return await this._refreshPromise}finally{this._refreshPromise=null}}async _handleSigninError(e,t){let r="unknown";switch(e instanceof Error&&(r=e.message),r){case"No matching state found in storage":case"IFrame timed out without a response":case"login_required":this._logger.warn(`Well known error occurred: ${r} - retrying...`),await this.signinRedirect(t);break;case"invalid_grant":await this.removeUser(),await this.signinSilent();break;case"Failed to fetch":break;default:this._logger.error(`Unknown error occurred: ${e}`),this._onSigninError(e)}}async _expireSession(){let e=await this.getUser();sessionStorage.clear(),this.stopSilentRenew(),await this.signoutRedirect({id_token_hint:e?.id_token})}async _onNetworkChange(){this._logger.debug("Network change detected, validating user object");let e=await this.getUser();(!e||e.expired)&&(this._logger.debug("Stale or missing user object detected, signing in silently..."),await this.signinSilent())}_onFailedToFetch(e){if(this._failedToFetchCount++,this._logger.warn(`Failed to fetch count: ${this._failedToFetchCount}`),this._failedToFetchCount>=3){this._onSigninError(e);return}setTimeout(()=>{window.dispatchEvent(new Event("online"))},5e3*this._failedToFetchCount)}_onSilentRenewError(e){e.message==="Failed to fetch"&&this._onFailedToFetch(e)}},mM2=TQ1()});var YT5=M1((fFi,GZ4)=>{"use strict";var Gw7=Object.create,yn0=Object.defineProperty,jw7=Object.getOwnPropertyDescriptor,Ww7=Object.getOwnPropertyNames,qw7=Object.getPrototypeOf,$w7=Object.prototype.hasOwnProperty,Kw7=(e,t)=>{for(var r in t)yn0(e,r,{get:t[r],enumerable:!0})},wn0=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ww7(t))!$w7.call(e,i)&&i!==r&&yn0(e,i,{get:()=>t[i],enumerable:!(a=jw7(t,i))||a.enumerable});return e},Yw7=(e,t,r)=>(wn0(e,t,"default"),r&&wn0(r,t,"default")),IZ4=(e,t,r)=>(r=e!=null?Gw7(qw7(e)):{},wn0(t||!e||!e.__esModule?yn0(r,"default",{value:e,enumerable:!0}):r,e)),Xw7=e=>wn0(yn0({},"__esModule",{value:!0}),e),NZ4={};Kw7(NZ4,{AuthContext:()=>Ln0.AuthContext,AuthGuard:()=>ey7,UiPathAuthProvider:()=>ay7,getCallbackState:()=>KT5,hasAuthParams:()=>Ln0.hasAuthParams,onCallback:()=>sy7,useAuth:()=>Ln0.useAuth,useIdentityAuth:()=>ny7,useSignoutRedirect:()=>ly7,withAuth:()=>Ln0.withAuth});GZ4.exports=Xw7(NZ4);var DZ4=IZ4(rr()),Jw7=_Q1(),UZ4=IZ4(rr()),$T5=UZ4.default.createContext({userManager:{}}),Qw7=()=>UZ4.default.useContext($T5).userManager,ty7=({children:e,userManager:t})=>UZ4.default.createElement($T5.Provider,{value:{userManager:t}},e),ey7=({children:e,extraSigninRequestArgs:t})=>{let{isAuthenticated:r,isLoading:a,error:i,activeNavigator:n}=(0,Jw7.useAuth)(),{signinComplete:o}=Qw7();return(0,DZ4.useEffect)(()=>{n==="signoutRedirect"||r||a||o(t)},[i,a,r,n,o,t]),r?DZ4.default.createElement(DZ4.default.Fragment,null,e):null},qT5=Mn0(),xn0=IZ4(rr()),ry7=_Q1(),ay7=({children:e,configuration:t,onSigninCallback:r,onError:a})=>{let i=(0,xn0.useMemo)(()=>(0,qT5.getUserManager)()??new qT5.IdentityUserManager({...t,onSigninError:a}),[]);return(0,xn0.useEffect)(()=>()=>{i.unregisterCustomEvents()},[i]),xn0.default.createElement(ty7,{userManager:i},xn0.default.createElement(ry7.AuthProvider,{userManager:i,onSigninCallback:r},e))},iy7=_Q1();function ny7(){let{user:e,events:t}=(0,iy7.useAuth)();return{accessToken:e?.access_token,idToken:e?.id_token,user:e,events:t}}var oy7=_Q1();function ly7(){return(0,oy7.useAuth)().signoutRedirect}var cy7=Mn0();function KT5(e){let t=e?.state;return(0,cy7.validateReturnUrl)(t?.returnTo)?t:{...t,returnTo:"/"}}function sy7(e,t){let r=KT5(e).returnTo;t(r)}var Ln0=_Q1();Yw7(NZ4,Mn0(),GZ4.exports)});var jZ4,XT5=C1(()=>{jZ4={storeUser:()=>Promise.resolve(),removeUser:()=>Promise.resolve(),clearRefreshToken:()=>Promise.resolve(),getUser:()=>Promise.resolve(null),signinCallback:()=>Promise.resolve(null),signinRedirect:()=>Promise.resolve(),signinSilent:()=>Promise.resolve(null),events:{addUserLoaded:()=>{},addUserUnloaded:()=>{},addAccessTokenExpiring:()=>{},addAccessTokenExpired:()=>{},addSilentRenewError:()=>{}}}});function hy7(){return xn?jZ4:!window.secureAuthApi&&!pZ?jZ4:(An0||(An0=new JT5.IdentityUserManager(hn0),An0.unregisterCustomEvents()),An0)}var JT5,An0,xm,WZ4=C1(()=>{JT5=w4(YT5(),1);wu();XT5();BZ4();An0=null;xm=new Proxy({},{get(e,t){let r=hy7(),a=r[t];return typeof a=="function"?a.bind(r):a}})});function MM2(e){return typeof e?.expires_at=="number"&&e.expires_at>0?e.expires_at:typeof e?.profile?.exp=="number"?e.profile.exp:0}function $Z4(e){return MM2(e)-Math.floor(Date.now()/1e3)}function F_1(e){return!!e?.access_token&&$Z4(e)>0}function vy7(e){let t=e?.message?.toLowerCase()||"",r=e?.name?.toLowerCase()||"";return t.includes("failed to fetch")||t.includes("network")||t.includes("err_network")||t.includes("net::err_")||t.includes("networkerror")||t.includes("connection_timed_out")||t.includes("aborted")||t.includes("connection")||r==="typeerror"&&t.includes("fetch")}function my7(e){let t=e?.message||"";return t.includes("signinSilent")&&t.includes("timed out")}function e61(){return xn?Cy7:(EQ1||(ge.debug("Creating new AuthService instance"),EQ1=new KZ4),EQ1)}function My7(){EQ1&&(ge.debug("Cleaning up AuthService for HMR"),EQ1.stop(),EQ1=null)}var ge,dy7,qZ4,uy7,gy7,zn0,py7,QT5,fy7,tB5,KZ4,EQ1,Cy7,xM2=C1(()=>{AZ4();wu();MW();o21();If();n21();bZ4();HZ4();VQ1();BZ4();WZ4();ge=cn0("auth");ge.setLevel("debug");dy7=60,qZ4=2*dy7,uy7=2e3,gy7=6e4,zn0=10,py7=3,QT5=5e3,fy7=35e3;tB5=3e4,KZ4=class{constructor(){this.isInitialized=!1;this.isRefreshing=!1;this.refreshPromise=null;this.backgroundRefreshPromise=null;this.sharedRefreshPromise=null;this.refreshEpoch=0;this.activeSilentSignins=0;this.networkRetryCount=0;this.silentTimeoutCount=0;this.pendingNetworkRefresh=!1;this.onlineHandler=null;this.lastSuccessfulRefreshTime=0;this.lastUsedRefreshToken=null;this.authInvalidated=!1;this.networkRetryTimer=null;this.onlineRetryTimer=null;this.refreshAbortControllers=new Set;this.userLoadedHandler=null;this.userUnloadedHandler=null;this.accessTokenExpiringHandler=null;this.accessTokenExpiredHandler=null;this.silentRenewErrorHandler=null}async initialize(){if(this.isInitialized){ge.trace("\u2190 initialize() - already initialized");return}ge.debug("\u2192 initialize()"),this.isInitialized=!0,this.authInvalidated=!1,mT5(),this.removeEventListeners(),this.onlineHandler&&(window.removeEventListener("online",this.onlineHandler),this.onlineHandler=null),this.userLoadedHandler=async t=>{if(ge.debug("\u2192 EVENT userLoaded triggered"),this.activeSilentSignins>0){ge.debug("\u2190 EVENT userLoaded skipped (managed refresh owns the write)");return}let{tenants:r,mode:a,tenant:i,organization:n}=Mr.getState();Mr.getState().setUser(t,n,r,a,i),ge.debug("User tokens saved to store");try{let o=await XZ4(t,!1),h=await this.refetchTenantsIfNeeded(t,r,i,o);Mr.getState().setUser(t,o,h.tenants,a,h.selectedTenant),ge.debug("\u2190 EVENT userLoaded completed with organization")}catch(o){ge.warn("Failed to get organization during userLoaded, but tokens are preserved:",o),ge.debug("\u2190 EVENT userLoaded completed (organization fetch failed)")}},this.userUnloadedHandler=()=>{ge.debug("\u2192 EVENT userUnloaded triggered"),ge.debug("\u2190 EVENT userUnloaded completed")},this.accessTokenExpiringHandler=()=>{if(ge.debug("\u2192 EVENT accessTokenExpiring triggered"),this.authInvalidated||qh1()){ge.debug("\u2190 EVENT accessTokenExpiring skipped (auth invalidated or shutting down)");return}let t=Date.now()-this.lastSuccessfulRefreshTime;if(this.lastSuccessfulRefreshTime>0&&t<tB5){ge.debug(`\u2190 EVENT accessTokenExpiring skipped (refreshed ${t}ms ago)`);return}this.refreshToken(),ge.debug("\u2190 EVENT accessTokenExpiring completed")},this.accessTokenExpiredHandler=()=>{if(ge.debug("\u2192 EVENT accessTokenExpired triggered"),this.authInvalidated||qh1()){ge.debug("\u2190 EVENT accessTokenExpired skipped (auth invalidated or shutting down)");return}if(this.pendingNetworkRefresh){ge.info("Token expired but network retry already in progress"),ge.debug("\u2190 EVENT accessTokenExpired skipped (pending network refresh)");return}ge.info("Token expired - attempting refresh"),this.refreshToken(),ge.debug("\u2190 EVENT accessTokenExpired - refresh triggered")},this.silentRenewErrorHandler=t=>{if(ge.debug("\u2192 EVENT silentRenewError triggered"),ge.error("Silent renew error:",t),t?.error==="invalid_grant"||t?.message?.includes("invalid_grant")){ge.error("Silent renew failed with invalid_grant - logging out"),Mr.getState().logout(),ge.debug("\u2190 EVENT silentRenewError - invalid_grant, logged out");return}ge.info("Silent renew failed - scheduling retry"),this.scheduleNetworkRetry(),ge.debug("\u2190 EVENT silentRenewError - retry scheduled")},xm.events.addUserLoaded(this.userLoadedHandler),xm.events.addUserUnloaded(this.userUnloadedHandler),xm.events.addAccessTokenExpiring(this.accessTokenExpiringHandler),xm.events.addAccessTokenExpired(this.accessTokenExpiredHandler),xm.events.addSilentRenewError(this.silentRenewErrorHandler),this.onlineHandler=()=>{ge.info("Network came back online"),this.pendingNetworkRefresh&&(ge.info("Retrying token refresh after network recovery..."),this.pendingNetworkRefresh=!1,this.networkRetryTimer&&(clearTimeout(this.networkRetryTimer),this.networkRetryTimer=null),this.onlineRetryTimer&&clearTimeout(this.onlineRetryTimer),this.onlineRetryTimer=setTimeout(()=>{this.onlineRetryTimer=null,this.refreshToken()},1e3))},window.addEventListener("online",this.onlineHandler),await this.handleStartupTokenValidation(),ge.debug("\u2190 initialize()")}async refetchTenantsIfNeeded(t,r,a,i){if(Mr.getState().isRobotMode)return{tenants:r,selectedTenant:a};if(Array.isArray(r)&&r.length>0)return{tenants:r,selectedTenant:a};ge.info("Tenants missing after token refresh \u2014 re-fetching");let n=t.profile.prt_id;if(!n)return{tenants:r,selectedTenant:a};let h=(await yZ4(n,t.access_token)).filter(f=>f.status==="Enabled"),u=a?.id;if(!u&&i?.id){let f=b5.getState().tenantByOrg?.[i.id];f?.id&&(u=f.id,ge.info(`Using tenantByOrg[${i.id}].id=${u} for restoration`))}if(!u){let f=b5.getState().selectedTenant;f?.id&&(u=f.id,ge.info(`Falling back to legacy appStore.selectedTenant.id=${u}`))}let g=u?h.find(f=>f.id===u)||h[0]||null:h[0]||null;return ge.info(`Re-fetched ${h.length} enabled tenants, selected=${g?.name??"none"}`),{tenants:h,selectedTenant:g}}removeEventListeners(){this.userLoadedHandler&&xm.events.removeUserLoaded(this.userLoadedHandler),this.userUnloadedHandler&&xm.events.removeUserUnloaded(this.userUnloadedHandler),this.accessTokenExpiringHandler&&xm.events.removeAccessTokenExpiring(this.accessTokenExpiringHandler),this.accessTokenExpiredHandler&&xm.events.removeAccessTokenExpired(this.accessTokenExpiredHandler),this.silentRenewErrorHandler&&xm.events.removeSilentRenewError(this.silentRenewErrorHandler)}async handleStartupTokenValidation(){ge.debug("\u2192 handleStartupTokenValidation()"),await new Promise(a=>setTimeout(a,1e3));let{user:t}=Mr.getState();if(!t){ge.debug("\u2190 handleStartupTokenValidation() - no cached user");return}let r=this.refreshEpoch;try{let a=Math.floor(Date.now()/1e3),i=MM2(t),n=i-a;if(n<qZ4){ge.info(`Token expires in ${Math.floor(n/60)} minutes, refreshing before continuing...`),await this.runCoalescedRefresh();let{user:o}=Mr.getState();F_1(o)&&MM2(o)>i&&b5.getState().setNetworkStatus("online"),ge.debug("\u2190 handleStartupTokenValidation() - token refreshed, continuing")}else if(Mr.getState().isRobotMode)ge.info(`Token valid for ${Math.floor(n/60)} minutes (robot mode, rotation handled by the robot layer)`),b5.getState().setNetworkStatus("online"),ge.debug("\u2190 handleStartupTokenValidation() - robot mode, returning immediately");else{let o=YZ4(t);o&&(await xm.storeUser(o),ge.info(`Token valid for ${Math.floor(n/60)} minutes, accessTokenExpiring event will handle refresh`)),b5.getState().setNetworkStatus("online"),ge.debug("\u2190 handleStartupTokenValidation() - token still valid, returning immediately")}}catch(a){if(r!==this.refreshEpoch){ge.debug("\u2190 handleStartupTokenValidation() - abandoned refresh settled late, suppressing side effects");return}if(ge.error("Error during startup token validation:",a),a?.error==="invalid_grant"||a?.message?.includes("invalid_grant")){if(this.authInvalidated)return;ge.error("Refresh token is invalid on startup - clearing auth state"),this.authInvalidated=!0,this.removeEventListeners(),await xm.clearRefreshToken(),await xm.removeUser(),Mr.getState().logout(),ge.debug("\u2190 handleStartupTokenValidation() - invalid_grant, auth cleared");return}ge.warn("Non-fatal error on startup - scheduling retry"),this.scheduleNetworkRetry(),ge.debug("\u2190 handleStartupTokenValidation() - error, retry scheduled")}}runCoalescedRefresh(){if(this.sharedRefreshPromise)return this.sharedRefreshPromise;let t=this.refreshEpoch,r=Promise.resolve().then(()=>this.refreshTokenInternal(t)).finally(()=>{this.sharedRefreshPromise===r&&(this.sharedRefreshPromise=null)});return this.sharedRefreshPromise=r,r}trackSilentSignin(t,r){this.activeSilentSignins++;let a=this.refreshEpoch;return t.then(i=>{this.activeSilentSignins--,i&&r()&&this.adoptLateSigninSuccess(i,a)},()=>{this.activeSilentSignins--}),t}adoptLateSigninSuccess(t,r){if(r!==this.refreshEpoch||this.authInvalidated||qh1())return;let{user:a,tenants:i,mode:n,tenant:o,organization:h}=Mr.getState();!a||!t.access_token||MM2(t)<=MM2(a)||(ge.info("Silent signin succeeded after its refresh run gave up; adopting the rotated tokens"),this.lastSuccessfulRefreshTime=Date.now(),this.silentTimeoutCount=0,this.lastUsedRefreshToken=a.refresh_token??null,this.networkRetryCount=0,this.pendingNetworkRefresh=!1,this.networkRetryTimer&&(clearTimeout(this.networkRetryTimer),this.networkRetryTimer=null),Mr.getState().setUser(t,h,i,n,o),b5.getState().setNetworkStatus("online"))}async refreshTokenInternal(t){if(Mr.getState().isRobotMode){ge.debug("refreshTokenInternal: robot mode, skipping OIDC silent refresh"),await this.revendRobotToken();return}let{user:r,tenant:a}=Mr.getState();if(!r)throw new Error("No user to refresh");let i=YZ4(r);if(!i)throw new Error("Failed to convert user");let n=i.refresh_token;if(n&&n===this.lastUsedRefreshToken)throw ge.warn("Refresh token already used, skipping refresh (waiting for new token to propagate)"),new Error("Refresh token already consumed");let o=Date.now()-this.lastSuccessfulRefreshTime;if(o<tB5)throw ge.warn(`Refresh attempted too soon (${o}ms since last refresh), skipping`),new Error("Refresh too soon after last refresh");await xm.storeUser(i);let h=new AbortController;this.refreshAbortControllers.add(h);let{signal:u}=h,g=null,f=!1,v=!1;try{g=await kZ4(cY(this.trackSilentSignin(xm.signinSilent(),()=>f),QT5,"signinSilent"),u,"signinSilent")}catch(C){if(f=!0,u.aborted)throw C;ge.warn("Silent signin failed, attempting with prompt=none:",C);try{g=await kZ4(cY(this.trackSilentSignin(xm.signinSilent({redirect_uri:hn0.redirect_uri,prompt:"none"}),()=>v),QT5,"signinSilent (prompt=none)"),u,"signinSilent (prompt=none)")}catch(L){throw v=!0,ge.error("Refresh token usage failed:",L),my7(L)?this.silentTimeoutCount++:this.silentTimeoutCount=0,(L?.error==="invalid_grant"||L?.message?.includes("invalid_grant"))&&ge.error("Refresh token is invalid/expired - will require re-authentication"),L}}finally{this.refreshAbortControllers.delete(h)}if(u.aborted||qh1()){ge.warn("Auth shutdown started during token refresh - discarding refreshed tokens");return}if(g){if(t!==this.refreshEpoch){ge.debug("Refresh settled after being abandoned; discarding result");return}ge.info("Token refreshed successfully"),this.lastSuccessfulRefreshTime=Date.now(),this.silentTimeoutCount=0,this.lastUsedRefreshToken=n||null;let{tenants:C,mode:L,organization:y}=Mr.getState();Mr.getState().setUser(g,y,C,L,a),ge.debug("User tokens saved to store");try{let z=await XZ4(g,!1),S=await this.refetchTenantsIfNeeded(g,C,a,z);if(t!==this.refreshEpoch||u.aborted||qh1()){ge.debug("Refresh abandoned or shutting down during organization fetch; skipping enrichment write");return}Mr.getState().setUser(g,z,S.tenants,L,S.selectedTenant),ge.debug("Organization updated successfully")}catch(z){ge.warn("Failed to get organization after refresh, but tokens are preserved:",z)}}else throw new Error("No user returned from silent refresh")}async drainInFlightRefresh(){let t=this.refreshPromise??this.backgroundRefreshPromise??this.sharedRefreshPromise;if(!t)return!1;let r=this.refreshEpoch;ge.debug("Refresh in progress, waiting for it...");let a,i=await Promise.race([t.then(()=>!1,()=>!1),new Promise(n=>{a=setTimeout(()=>n(!0),fy7)})]);if(clearTimeout(a),i){if(!(r===this.refreshEpoch&&(this.refreshPromise===t||this.backgroundRefreshPromise===t||this.sharedRefreshPromise===t)))return!1;ge.warn("In-flight refresh did not settle in time, abandoning every refresh lane"),this.refreshEpoch++;for(let o of this.refreshAbortControllers)o.abort();return this.refreshAbortControllers.clear(),this.refreshPromise=null,this.backgroundRefreshPromise=null,this.sharedRefreshPromise=null,!1}return!0}async getValidAccessToken(){let t=Mr.getState().user;if(t?.access_token&&$Z4(t)>qZ4)return t.access_token;await this.drainInFlightRefresh();let{user:r}=Mr.getState();if(!r?.access_token)throw new Error("No user or access token available");let a=$Z4(r);if(a<=qZ4){ge.debug(`Token expires in ${a}s, triggering refresh...`);try{let i=await this.refreshAccessToken();return ge.debug("\u2190 getValidAccessToken() - refreshed expiring token"),i}catch{if(this.authInvalidated)throw new Error("Token refresh invalidated auth state");if(F_1(r))return ge.warn("Refresh failed, returning current token before it expires"),r.access_token;throw new Error("Token expired and refresh failed")}}return r.access_token}async revendRobotToken(){let t=typeof window<"u"?window.assistantServicesApi:void 0;if(t?.isAssistantFirst)try{let r=await t.getAccessToken();if(r){let a=r.startsWith("Bearer ")?r.slice(7):r;return Mr.getState().reseedRobotToken(a),a}ge.warn("Assistant robot token vend returned empty, falling back to current token")}catch(r){ge.warn("Assistant robot token re-vend failed, falling back to current token:",r)}return null}async refreshAccessToken(){if(ge.debug("\u2192 refreshAccessToken()"),qh1()){ge.debug("\u2190 refreshAccessToken() - shutting down, returning current token");let{user:a}=Mr.getState();if(a?.access_token)return a.access_token;throw new Error("Auth shutdown in progress")}if(Mr.getState().isRobotMode){let a=await this.revendRobotToken();if(a)return ge.debug("\u2190 refreshAccessToken() - robot mode, re-vended assistant robot token"),a;ge.debug("\u2190 refreshAccessToken() - robot mode, returning current token");let{user:i}=Mr.getState();if(i?.access_token)return i.access_token;throw new Error("Robot mode: no access token available")}let{user:t}=Mr.getState();if(!t)throw new Error("No user to refresh");if(await this.drainInFlightRefresh()){let{user:a}=Mr.getState();if(F_1(a))return ge.debug("\u2190 refreshAccessToken() - reusing token from a just-completed refresh"),a.access_token}if(this.isRefreshing&&this.refreshPromise)return ge.debug("Refresh already in progress, waiting..."),this.refreshPromise;this.isRefreshing=!0,this.refreshPromise=(async()=>{let a=this.refreshEpoch;try{await this.runCoalescedRefresh();let{user:i}=Mr.getState();if(F_1(i))return ge.debug("\u2190 refreshAccessToken() - success"),i.access_token;throw new Error("No fresh access token after refresh")}catch(i){let n=i?.message||"";if(a!==this.refreshEpoch)throw ge.debug("refreshAccessToken: abandoned run settled late, suppressing side effects"),i;if(n.includes("already consumed")||n.includes("too soon")){ge.debug(`refreshAccessToken skipped: ${n}`);let u=await xm.getUser();if(F_1(u))return u.access_token;throw i}if(ge.error("Token refresh failed:",i),i?.error==="invalid_grant"||n.includes("invalid_grant"))throw this.authInvalidated||(ge.error("Refresh token is invalid - clearing all auth state"),Vr.trackEvent(Ur.AuthInvalidGrant,{source:"refreshAccessToken"}),this.authInvalidated=!0,this.pendingNetworkRefresh=!1,this.networkRetryTimer&&(clearTimeout(this.networkRetryTimer),this.networkRetryTimer=null),this.removeEventListeners(),await xm.clearRefreshToken(),await xm.removeUser(),Mr.getState().logout()),i;if(ge.warn("Non-fatal error during refreshAccessToken - scheduling retry"),this.scheduleNetworkRetry(),this.authInvalidated)throw i;let h=await xm.getUser();if(F_1(h))return ge.warn("Returning existing token while waiting for retry"),h.access_token;throw i}})();let r=this.refreshPromise.finally(()=>{this.isRefreshing=!1,this.refreshPromise===r&&(this.refreshPromise=null)});return this.refreshPromise=r,r}async scheduleNetworkRetry(){if(ge.debug("\u2192 scheduleNetworkRetry()"),this.authInvalidated||qh1()){ge.debug("\u2190 scheduleNetworkRetry() - auth invalidated or shutting down, skipping");return}if(this.pendingNetworkRefresh){ge.debug("\u2190 scheduleNetworkRetry() - already pending");return}this.networkRetryCount++;let t=this.silentTimeoutCount>=py7;if(this.networkRetryCount>zn0||t){ge.error(t?`Refresh wedged (${this.silentTimeoutCount} silent-signin timeouts) - forcing re-login`:`Token refresh failed after ${zn0} attempts, forcing re-login`),Vr.trackEvent(Ur.AuthRefreshRetryExhausted,{reason:t?"wedged":"retry_exhausted",attempts:t?this.silentTimeoutCount:zn0}),this.authInvalidated=!0,this.isInitialized=!1,this.networkRetryCount=0,this.silentTimeoutCount=0,this.pendingNetworkRefresh=!1,this.networkRetryTimer&&(clearTimeout(this.networkRetryTimer),this.networkRetryTimer=null),this.removeEventListeners(),Mr.getState().logout();try{await xm.clearRefreshToken(),await xm.removeUser()}catch(a){ge.warn("Error during auth cleanup after max retries:",a)}ge.debug("\u2190 scheduleNetworkRetry() - max attempts exceeded, auth cleared");return}b5.getState().setNetworkStatus("retrying"),this.pendingNetworkRefresh=!0;let r=Math.min(uy7*Math.pow(2,this.networkRetryCount-1),gy7);ge.info(`Network error - retrying in ${r}ms (attempt ${this.networkRetryCount}/${zn0})`),this.networkRetryTimer=setTimeout(()=>{this.networkRetryTimer=null,this.pendingNetworkRefresh=!1,this.refreshToken()},r),ge.debug("\u2190 scheduleNetworkRetry()")}async refreshToken(){if(ge.debug("\u2192 refreshToken()"),this.authInvalidated||qh1()){ge.debug("\u2190 refreshToken() - auth invalidated or shutting down, skipping");return}if(this.backgroundRefreshPromise){ge.debug("Refresh already in progress, waiting for existing refresh...");try{await this.backgroundRefreshPromise,ge.debug("\u2190 refreshToken() - existing refresh completed successfully")}catch{ge.debug("\u2190 refreshToken() - existing refresh failed (already handled)")}return}let r=(async()=>{let a=this.refreshEpoch;this.isRefreshing=!0;try{ge.info("Attempting to refresh token..."),await this.runCoalescedRefresh();let{user:i}=Mr.getState();F_1(i)?(this.networkRetryCount=0,this.pendingNetworkRefresh=!1,b5.getState().setNetworkStatus("online"),ge.debug("\u2190 refreshToken() - success")):ge.debug("\u2190 refreshToken() - resolved without a fresh token (no-op), not marking online")}catch(i){let n=i?.message||"";if(a!==this.refreshEpoch){ge.debug("\u2190 refreshToken() - abandoned run settled late, suppressing side effects");return}if(n.includes("already consumed")||n.includes("too soon")){ge.debug(`\u2190 refreshToken() - skipped: ${n}`);return}if(ge.error("Failed to refresh token:",i),i?.error==="invalid_grant"||n.includes("invalid_grant")){if(this.authInvalidated)return;ge.error("Refresh token is invalid - clearing all auth state"),Vr.trackEvent(Ur.AuthInvalidGrant,{source:"refreshToken"}),this.authInvalidated=!0,this.networkRetryCount=0,this.pendingNetworkRefresh=!1,this.networkRetryTimer&&(clearTimeout(this.networkRetryTimer),this.networkRetryTimer=null),this.removeEventListeners(),await xm.clearRefreshToken(),await xm.removeUser(),Mr.getState().logout(),ge.debug("\u2190 refreshToken() - invalid_grant, auth cleared");return}if(vy7(i)){ge.warn("Network error during token refresh - scheduling retry"),this.scheduleNetworkRetry(),ge.debug("\u2190 refreshToken() - network error, retry scheduled");return}ge.warn("Unknown error during refresh, treating as network issue - scheduling retry"),this.scheduleNetworkRetry(),ge.debug("\u2190 refreshToken() - unknown error, retry scheduled")}})().finally(()=>{this.isRefreshing=!1,this.backgroundRefreshPromise===r&&(this.backgroundRefreshPromise=null)});this.backgroundRefreshPromise=r,await r}async switchOrganization(){ge.info("[switchOrg] -> start");try{let r=(await xm.getUser())?.id_token;ge.info(`[switchOrg] id_token_hint present: ${!!r}`);let a=new URLSearchParams;r&&a.set("id_token_hint",r);let i=`${vM2}/connect/endsession?${a.toString()}`;if(ge.info(`[switchOrg] endSessionUrl: ${vM2}/connect/endsession?id_token_hint=[REDACTED]`),window.electronAPI?.openExternalUrl)ge.info("[switchOrg] opening endSessionUrl in external browser"),window.electronAPI.openExternalUrl(i);else throw ge.warn("[switchOrg] openExternalUrl NOT available"),new Error("openExternalUrl IPC not available");ge.info("[switchOrg] clearing local auth state"),Mr.getState().logout();let n=!1,o=g=>{n||(n=!0,window.removeEventListener("focus",h),clearTimeout(u),ge.info(`[switchOrg] triggering signinRedirect (reason: ${g})`),xm.signinRedirect().catch(f=>{ge.error("[switchOrg] signinRedirect failed:",f)}))},h=()=>o("window-focus");window.addEventListener("focus",h);let u=setTimeout(()=>o("5s-timeout"),5e3);ge.info("[switchOrg] <- end (waiting for window focus or 5s timeout)")}catch(t){throw ge.error("[switchOrg] failed:",t),t}}abandonInFlightRefreshes(){ge.debug("\u2192 abandonInFlightRefreshes()"),this.refreshEpoch++,this.networkRetryTimer&&(clearTimeout(this.networkRetryTimer),this.networkRetryTimer=null),this.onlineRetryTimer&&(clearTimeout(this.onlineRetryTimer),this.onlineRetryTimer=null),this.pendingNetworkRefresh=!1,this.networkRetryCount=0,this.silentTimeoutCount=0;for(let t of this.refreshAbortControllers)t.abort();this.refreshAbortControllers.clear(),this.refreshPromise=null,this.backgroundRefreshPromise=null,this.sharedRefreshPromise=null,ge.debug("\u2190 abandonInFlightRefreshes()")}stop(){ge.debug("\u2192 stop()"),this.isInitialized=!1,this.authInvalidated=!1,this.abandonInFlightRefreshes(),this.removeEventListeners(),this.userLoadedHandler=null,this.userUnloadedHandler=null,this.accessTokenExpiringHandler=null,this.accessTokenExpiredHandler=null,this.silentRenewErrorHandler=null,this.onlineHandler&&(window.removeEventListener("online",this.onlineHandler),this.onlineHandler=null),ge.debug("\u2190 stop()")}},EQ1=null,Cy7={initialize:()=>Promise.resolve(),refreshAccessToken:()=>Promise.resolve("mock_access_token"),getValidAccessToken:()=>Promise.resolve("mock_access_token"),switchOrganization:()=>Promise.resolve(),abandonInFlightRefreshes:()=>{},stop:()=>{}};import.meta.hot&&import.meta.hot.dispose(()=>{ge.debug("HMR dispose: cleaning up AuthService"),My7()})});function eB5(e){let r={uploading:"uploading",processing:"processing",completed:"completed",error:"error"}[e.toLowerCase()];if(!r)throw new Error(`Invalid processing status: ${e}`);return r}var rB5,JZ4=C1(()=>{O_1();rB5={async getAllFlows(e={}){let{page:t=1,page_size:r=100}=e;return(await $M.get("/flows",{params:{page:t,page_size:r}})).data},async getFlow(e){return(await $M.get(`/flows/${e}`)).data},async createFlow(e){return(await $M.post("/flows",e)).data},async updateFlow(e,t){return(await $M.patch(`/flows/${e}`,t)).data},async deleteFlow(e){await $M.delete(`/flows/${e}`)},async createEmptyFlow(){return(await $M.post("/flows/empty")).data},async generateMockedFlows(){return(await $M.post("/flows/generate-mocked")).data}}});var aB5,iB5=C1(()=>{aB5=()=>[{id:"debug-flow-1",user_id:"debug-user",lastupdate:Date.now(),flow:{title:"Customer Data Generation",user_goal:"This workflow generates folders with customer profiles and purchases for testing purposes.",summary:"This workflow generates folders with customer profiles and purchases for testing purposes.",steps:[{type:"task",task_title:"Create Customer Master List",task_prompt:"Generate and save a list of 20 customer names into a customers.txt file.",specific_instructions:"Generate and save a list of 20 customer names into a customers.txt file.",video_timestamp:"00:15",expected_inputs:["A list of customer names to be processed"],expected_outputs:["A master list of 20 customer names saved in customers.txt","Individual folders created for each customer"],execution_details:[{action_description:"Create new text file",ui_element_description:"File Explorer context menu",element_location:"Desktop folder",applications:["File Explorer","Notepad"],urls:["file:///C:/Users/jane.doe/Desktop/tmp/llm_playground/customers.txt"]}]},{type:"task",task_title:"Create Customer Folder Structure",task_prompt:"For each customer in the list, create a dedicated folder named with their name.",specific_instructions:"For each customer in the list, create a dedicated folder named with their name.",video_timestamp:"00:45",expected_inputs:["The customers.txt file with all customer names"],expected_outputs:["20 customer folders created with underscore-separated names","Each folder contains two files: profile and purchases"],execution_details:[{action_description:"Create folder for each customer",ui_element_description:"Command Prompt or File Explorer",element_location:"Target directory",applications:["File Explorer","Command Prompt"],urls:["file:///C:/Users/jane.doe/Desktop/tmp/llm_playground/"]}]},{type:"task",task_title:"Populate Customer Data Files",task_prompt:"Fill each customer's profile file with their basic information.",specific_instructions:"Fill each customer's profile and purchases files with generated data.",video_timestamp:"01:15",expected_inputs:["Customer folder structure already created","Basic customer information template"],expected_outputs:["Profile files with customer details","Purchase files with transaction history"],execution_details:[{action_description:"Edit profile file",ui_element_description:"Notepad editor",element_location:"Customer folder",applications:["Notepad","File Explorer"],urls:["file:///C:/Users/jane.doe/Desktop/tmp/llm_playground/"]}]}]},created_at:new Date().toISOString(),updated_at:new Date().toISOString()},{id:"debug-flow-2",user_id:"debug-user",lastupdate:Date.now(),flow:{title:"Customer Order Processing Workflow",user_goal:"Process customer orders from multiple channels, verify inventory, and coordinate shipping.",summary:"Process customer orders from multiple channels, verify inventory, and coordinate shipping through various systems.",steps:[{type:"task",task_title:"Review Pending Orders",task_prompt:"Access the order management system to review all pending customer orders.",specific_instructions:"Access the order management system to review pending orders and gather customer information.",video_timestamp:"00:15",expected_inputs:["Access to order management system."],expected_outputs:["List of pending orders to process.","Customer information and order details."],execution_details:[{action_description:"Navigate to orders page",ui_element_description:"SAP Order Management portal",element_location:"Main navigation menu",applications:["SAP","Order Management"],accounts:[],urls:["https://sap.company.com/orders"]}]},{type:"task",task_title:"Verify Inventory Availability",task_prompt:"Check the inventory system to confirm product availability.",specific_instructions:"Check inventory system to confirm availability and reserve items for the order.",video_timestamp:"01:45",expected_inputs:["Order details with product SKUs and quantities."],expected_outputs:["Confirmation of product availability.","Reserved inventory for the order."],execution_details:[{action_description:"Check inventory levels",ui_element_description:"Inventory System dashboard",element_location:"Product search panel",applications:["Inventory System","Microsoft Excel"],accounts:["inventory.user@company.com"],urls:["https://inventory.company.com/check"]}]}]},created_at:new Date().toISOString(),updated_at:new Date().toISOString()},{id:"debug-flow-3",user_id:"debug-user",lastupdate:Date.now(),flow:{title:"Employee Onboarding Automation",user_goal:"Automate the complete employee onboarding process.",summary:"Automate the complete employee onboarding process including system access, equipment requests, and training assignments.",steps:[{type:"task",task_title:"Create Employee Profile",task_prompt:"Create a new employee profile in the HR system and generate Active Directory credentials.",specific_instructions:"Create new employee profile in HR system and generate user credentials.",video_timestamp:"00:30",expected_inputs:["Employee personal information.","Job role and department details."],expected_outputs:["New employee profile created.","User credentials generated."],execution_details:[{action_description:"Fill employee form",ui_element_description:"HR Portal onboarding form",element_location:"New employee section",applications:["HR Portal","Active Directory"],accounts:["hr.admin@company.com"],urls:["https://hr.company.com/onboarding"]}]},{type:"task",task_title:"Send Welcome Communications",task_prompt:"Send welcome email to new employee and schedule team introduction meeting.",specific_instructions:"Send welcome email and schedule team introduction meeting.",video_timestamp:"02:00",expected_inputs:["Employee email address.","Team calendar availability."],expected_outputs:["Welcome email sent.","Team introduction scheduled."],execution_details:[{action_description:"Compose welcome email",ui_element_description:"Microsoft Teams compose window",element_location:"Chat section",applications:["Microsoft Teams","Email"],accounts:["team.lead@company.com"],urls:["https://teams.microsoft.com"]}]}]},created_at:new Date().toISOString(),updated_at:new Date().toISOString()},{id:"debug-flow-4",user_id:"debug-user",lastupdate:Date.now(),flow:{title:"Product Restocking and Supplier Communication Workflow",user_goal:"Identify products needing restocking and communicate with suppliers.",summary:"Identify a product that needs restocking from an inventory list, gather detailed supplier contact information, and compose and send an email with all necessary details.",steps:[{type:"task",task_title:"Identify Product for Restocking",task_prompt:"In the Inventory status sheet, identify products needing restock.",specific_instructions:"Identify products that need restocking based on threshold.",video_timestamp:"00:01:08",expected_inputs:["The Inventory status sheet is open."],expected_outputs:["The specific product and quantity to reorder are identified."],execution_details:[{action_description:"Filter low stock items",ui_element_description:"Google Sheets inventory spreadsheet",element_location:"Stock level column",applications:["Google Chrome"],urls:["https://docs.google.com/spreadsheets/inventory"]}]},{type:"task",task_title:"Create New Email in Outlook",task_prompt:"Navigate to Outlook and click New mail to start composing.",specific_instructions:"Create a new email in Outlook for supplier communication.",video_timestamp:"00:01:28",expected_inputs:[],expected_outputs:["A new, blank email draft is opened."],execution_details:[{action_description:"Click New mail button",ui_element_description:"Outlook toolbar",element_location:"Top navigation bar",applications:["msedge.exe"],urls:["https://outlook.office.com/mail/"]}]},{type:"task",task_title:"Search for Supplier in Coupa",task_prompt:"Search for the supplier in the Coupa system.",specific_instructions:"Search for supplier in Coupa system to get contact details.",video_timestamp:"00:04:27",expected_inputs:["User is on the Coupa Suppliers page."],expected_outputs:["The supplier is listed in search results."],execution_details:[{action_description:"Enter supplier name in search",ui_element_description:"Coupa supplier search box",element_location:"Suppliers page header",applications:["msedge.exe"],urls:["https://uipath-test.coupahost.com/suppliers"]}]}]},created_at:new Date().toISOString(),updated_at:new Date().toISOString()},{id:"debug-flow-5",user_id:"debug-user",lastupdate:Date.now(),flow:{title:"Daily Slack Standup Report",user_goal:"Automatically gather team updates from Jira and post a formatted standup summary to Slack.",summary:"Collect yesterday's completed tasks and today's planned work from Jira, then post a formatted daily standup report to the team Slack channel.",steps:[{type:"task",task_title:"Fetch Jira Updates",task_prompt:"Query Jira for tasks completed yesterday and tasks planned for today.",specific_instructions:"Query Jira for yesterday's and today's tasks.",video_timestamp:"00:20",expected_inputs:["Jira project key and team member list"],expected_outputs:["List of completed tasks from yesterday","List of in-progress tasks for today"],execution_details:[{action_description:"Run JQL query for completed tasks",ui_element_description:"Jira search bar",element_location:"Main navigation",applications:["Jira","Google Chrome"],accounts:["jira.bot@company.com"],urls:["https://uipath.atlassian.net/jira"]}]},{type:"task",task_title:"Format Standup Message",task_prompt:"Create a nicely formatted standup message with emojis and sections.",specific_instructions:"Format the standup message with proper sections.",video_timestamp:"00:45",expected_inputs:["Raw task data from Jira"],expected_outputs:["Formatted standup message ready for Slack"],execution_details:[{action_description:"Format message with sections",ui_element_description:"Text editor",element_location:"Editor window",applications:["Notepad"]}]},{type:"task",task_title:"Post to Slack Channel",task_prompt:"Send the formatted standup report to the team's Slack channel.",specific_instructions:"Post the standup summary to Slack.",video_timestamp:"01:00",expected_inputs:["Formatted standup message"],expected_outputs:["Standup message posted to #team-standup channel"],execution_details:[{action_description:"Paste and send message",ui_element_description:"Slack message input",element_location:"#team-standup channel",applications:["Slack"],accounts:["slack.bot@company.com"],urls:["https://app.slack.com/client"]}]}]},created_at:new Date().toISOString(),updated_at:new Date().toISOString()},{id:"debug-flow-6",user_id:"debug-user",lastupdate:Date.now(),flow:{title:"Invoice Processing Pipeline",user_goal:"Extract data from PDF invoices and enter them into the accounting system.",summary:"Automatically process incoming PDF invoices by extracting key data fields and entering them into SAP for payment processing.",steps:[{type:"task",task_title:"Download Invoice Attachments",task_prompt:"Check email inbox for new invoice attachments and download PDFs.",specific_instructions:"Download invoice PDFs from email.",video_timestamp:"00:10",expected_inputs:["Access to invoices@company.com mailbox"],expected_outputs:["PDF invoices downloaded to processing folder","Email marked as processed"],execution_details:[{action_description:"Download attachment",ui_element_description:"Outlook attachment button",element_location:"Email detail view",applications:["Outlook","File Explorer"],accounts:["invoices@company.com"],urls:["https://outlook.office.com/mail/"]}]},{type:"task",task_title:"Extract Invoice Data",task_prompt:"Use OCR to extract vendor name, invoice number, amount, and due date.",specific_instructions:"Extract data from invoice using OCR.",video_timestamp:"00:40",expected_inputs:["PDF invoice files"],expected_outputs:["Extracted invoice data in structured format","Confidence scores for each field"],execution_details:[{action_description:"Process PDF with OCR",ui_element_description:"Document Understanding interface",element_location:"Processing queue",applications:["Document Understanding","Excel"]}]},{type:"task",task_title:"Enter into SAP",task_prompt:"Create new vendor invoice entry in SAP with extracted data.",specific_instructions:"Enter invoice data into SAP system.",video_timestamp:"01:30",expected_inputs:["Validated invoice data"],expected_outputs:["Invoice created in SAP with document number"],execution_details:[{action_description:"Create invoice entry",ui_element_description:"SAP Fiori invoice form",element_location:"Vendor invoices section",applications:["SAP"],accounts:["sap.automation@company.com"],urls:["https://sap.company.com/fiori"]}]}]},created_at:new Date().toISOString(),updated_at:new Date().toISOString()},{id:"debug-flow-7",user_id:"debug-user",lastupdate:Date.now(),flow:{title:"Weekly Sales Report Generator",user_goal:"Generate a comprehensive weekly sales report from Salesforce data.",summary:"Pull sales data from Salesforce, create charts in Excel, and distribute the report via email to stakeholders.",steps:[{type:"task",task_title:"Export Salesforce Data",task_prompt:"Run Salesforce report and export weekly sales data to CSV.",specific_instructions:"Export sales data from Salesforce.",video_timestamp:"00:15",expected_inputs:["Salesforce report ID and date range"],expected_outputs:["CSV file with weekly sales data"],execution_details:[{action_description:"Run and export report",ui_element_description:"Salesforce reports page",element_location:"Reports tab",applications:["Salesforce","Google Chrome"],accounts:["reports@company.com"],urls:["https://company.lightning.force.com/reports"]}]},{type:"task",task_title:"Create Excel Dashboard",task_prompt:"Import data into Excel template and generate charts and pivot tables.",specific_instructions:"Create dashboard in Excel with charts.",video_timestamp:"01:00",expected_inputs:["CSV sales data file"],expected_outputs:["Excel workbook with formatted data","Sales charts and trend analysis"],execution_details:[{action_description:"Import and refresh data",ui_element_description:"Excel Data tab",element_location:"Data connection panel",applications:["Microsoft Excel"]}]},{type:"task",task_title:"Email Report to Stakeholders",task_prompt:"Attach the Excel report and send to the distribution list.",specific_instructions:"Send weekly report to stakeholders.",video_timestamp:"02:00",expected_inputs:["Completed Excel report","Distribution list"],expected_outputs:["Email sent with report attachment"],execution_details:[{action_description:"Compose and send email",ui_element_description:"Outlook compose window",element_location:"New email form",applications:["Outlook"],accounts:["sales.reports@company.com"],urls:["https://outlook.office.com/mail/"]}]}]},created_at:new Date().toISOString(),updated_at:new Date().toISOString()},{id:"debug-flow-8",user_id:"debug-user",lastupdate:Date.now(),flow:{title:"LinkedIn Job Application Tracker",user_goal:"Track job applications from LinkedIn and update a Google Sheet.",summary:"Monitor LinkedIn for job application status updates and maintain a tracking spreadsheet with all applications and their current status.",steps:[{type:"task",task_title:"Check LinkedIn Applications",task_prompt:"Log into LinkedIn and check the status of submitted applications.",specific_instructions:"Check LinkedIn for application updates.",video_timestamp:"00:20",expected_inputs:["LinkedIn credentials"],expected_outputs:["List of applications with current status","Any new responses or interview requests"],execution_details:[{action_description:"Navigate to jobs tracker",ui_element_description:"LinkedIn Jobs section",element_location:"My Jobs tab",applications:["Google Chrome","LinkedIn"],accounts:["user@email.com"],urls:["https://www.linkedin.com/jobs/tracker/"]}]},{type:"task",task_title:"Update Tracking Sheet",task_prompt:"Add new applications and update status of existing ones in Google Sheets.",specific_instructions:"Update the job tracking spreadsheet.",video_timestamp:"01:00",expected_inputs:["Application data from LinkedIn"],expected_outputs:["Updated tracking spreadsheet"],execution_details:[{action_description:"Update cells in spreadsheet",ui_element_description:"Google Sheets cells",element_location:"Job tracker sheet",applications:["Google Sheets","Google Chrome"],accounts:["user@gmail.com"],urls:["https://docs.google.com/spreadsheets/job-tracker"]}]}]},created_at:new Date().toISOString(),updated_at:new Date().toISOString()}]});var QZ4,bn0,nB5,oB5,LL1,lB5=C1(()=>{QZ4=w4(Lu(),1),bn0=w4(vW(),1);Dh1();JZ4();wu();iY();nB5={flows:[],recordedFlows:[],lastRecordedFlowId:null,unprocessedFlows:{},flowErrors:{},isLoaded:!1,isLoading:!1,error:null},oB5=e=>({...nB5,setFlows:t=>e({flows:t,isLoaded:!0,isLoading:!1}),addFlow:t=>e(r=>({flows:[...r.flows,t]})),updateFlow:(t,r)=>e(a=>({flows:a.flows.map(i=>i.id===t?r:i)})),deleteFlow:t=>e(r=>({flows:r.flows.filter(a=>a.id!==t)})),addRecordedFlow:t=>e(r=>({recordedFlows:[...r.recordedFlows,t]})),setLastRecordedFlowId:t=>e({lastRecordedFlowId:t}),addUnprocessedFlow:(t,r)=>e(a=>({unprocessedFlows:{...a.unprocessedFlows,[t]:r}})),removeUnprocessedFlow:t=>e(r=>{let{[t]:a,...i}=r.unprocessedFlows;return{unprocessedFlows:i}}),setFlowError:(t,r)=>e(a=>{if(r===null){let{[t]:i,...n}=a.flowErrors;return{flowErrors:n}}return{flowErrors:{...a.flowErrors,[t]:r}}}),clearFlowError:t=>e(r=>{let{[t]:a,...i}=r.flowErrors;return{flowErrors:i}}),updateRecordedFlowStatus:(t,r)=>e(a=>({recordedFlows:r==="completed"?a.recordedFlows.filter(i=>i.id!==t):a.recordedFlows.map(i=>i.id===t?{...i,processingStatus:r}:i)})),updateRecordedFlowData:(t,r)=>e(a=>({recordedFlows:a.recordedFlows.map(i=>i.id===t?{...i,recordingData:r}:i)})),removeRecordedFlow:t=>e(r=>{let{[t]:a,...i}=r.flowErrors;return{recordedFlows:r.recordedFlows.filter(n=>n.id!==t),flowErrors:i}}),setIsLoading:t=>e({isLoading:t}),setIsLoaded:t=>e({isLoaded:t}),setError:t=>e({error:t,isLoading:!1}),reset:()=>e(nB5)}),LL1=Fx.persistStore?(0,QZ4.create)()((0,bn0.persist)(oB5,{name:"agents",storage:(0,bn0.createJSONStorage)(()=>DO),partialize:e=>({unprocessedFlows:e.unprocessedFlows})})):(0,QZ4.create)()(oB5);lz(LL1,"agents-store-sync");typeof window<"u"&&(window.agentsStore=LL1)});function sB5(){switch(window.windowApi?.getWindowMode?.()||"mainWindow"){case"minified":return"minified";case"recording":return"recording";case"recordingFrame":return"recordingFrame";default:return"mainWindow"}}var cB5,WFi,hB5=C1(()=>{cB5=w4(rr(),1);WN();WFi=typeof window<"u"&&window.windowApi?.getWindowMode?.()||"mainWindow"});function dB5(e,t=!1){let a=sB5()==="minified",i=document.hasFocus();if(a){i||window.notificationApi&&window.notificationApi.sendNotification(e);return}if(!t&&i){wk(e.title,"info");return}if(!window.notificationApi){console.warn("Notification API not available");return}window.notificationApi.sendNotification(e)}var uB5=C1(()=>{Nh1();wu();hB5()});var Ly7,gB5,wy7,pB5=C1(()=>{JZ4();wu();iB5();lB5();uB5();Ly7=async()=>{try{if(xn){let t=aB5();return LL1.getState().setFlows(t),window.dispatchEvent(new CustomEvent("flows_data_updated")),t}let e=await rB5.getAllFlows();return LL1.getState().setFlows(e),window.dispatchEvent(new CustomEvent("flows_data_updated")),e}catch(e){throw console.error("Failed to refresh flows:",e),e}},gB5=()=>{LL1.getState().reset()},wy7=e=>{let r=e.detail;r.type==="flow_processed"&&(console.log("Flow created event received, reloading flows..."),LL1.getState().updateRecordedFlowStatus(r.state.flow_id,eB5(r.state.status)),Ly7(),dB5({title:"Flow ready",body:"Your flow has been processed successfully."})),r.type==="error"&&(console.error("Flow processing error:",r.state.error_message),LL1.getState().updateRecordedFlowStatus(r.state.flow_id,"error"))};typeof window<"u"&&typeof window.addEventListener=="function"&&window.addEventListener("agent_explainer",wy7)});var fB5=C1(()=>{});var RQ1,tF4=C1(()=>{fB5();RQ1=class{enabledSessions=new Set;activeTraces=new Map;traceContexts=new Map;checkpoints=new Map;_mappers=[];registerMapper(t){this._mappers.push(t)}get mappers(){return this._mappers}enable(t){this.enabledSessions.add(t)}isEnabled(t){return this.enabledSessions.has(t)}setTraceContext(t,r){let a=this.activeTraces.get(t),i=a&&(a.metadata.traceId!==r.traceId||!a.metadata.traceId),n=a&&i?this._buildTraceFile(a):null;if(n&&(this.activeTraces.delete(t),this.checkpoints.delete(t)),this.traceContexts.set(t,r),this.activeTraces.has(t)){let o=this.activeTraces.get(t);o.metadata={...o.metadata,...r}}else this.activeTraces.set(t,this._createTrace(r,t));return n}setCheckpoint(t,r){this.checkpoints.set(t,r)}currentCheckpoint(t){return this.checkpoints.get(t)}recordAction(t,r){if(!this.enabledSessions.has(t))return;let a=this.activeTraces.get(t);a||(a=this._createTrace(this.traceContexts.get(t)??{},t),this.activeTraces.set(t,a)),a.actions.push({...r,index:a.actions.length+1,metadata:r.metadata??this.checkpoints.get(t)})}peekTrace(t){let r=this.activeTraces.get(t);return r?this._buildTraceFile(r):null}clearTrace(t){this.activeTraces.delete(t),this.checkpoints.delete(t)}finalizeTrace(t){let r=this.peekTrace(t);return r&&this.clearTrace(t),r}activeTraceId(t){return this.activeTraces.get(t)?.traceId??null}_createTrace(t,r){let a=t.traceId??crypto.randomUUID();return{traceId:a,metadata:{traceId:a,title:t.title??"",sessionId:r,startedAt:new Date().toISOString(),...t},actions:[]}}_buildTraceFile(t){return{schemaVersion:"1.0",traceId:t.traceId,metadata:{...t.metadata,endedAt:new Date().toISOString()},actions:t.actions}}}});var mB5=M1((uOi,vB5)=>{vB5.exports=function(e){return{all:e=e||new Map,on:function(t,r){var a=e.get(t);a?a.push(r):e.set(t,[r])},off:function(t,r){var a=e.get(t);a&&(r?a.splice(a.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var a=e.get(t);a&&a.slice().map(function(i){i(r)}),(a=e.get("*"))&&a.slice().map(function(i){i(t,r)})}}}});function Ay7(e){Sn0.has(e)&&clearTimeout(Sn0.get(e)),Sn0.set(e,setTimeout(()=>{D_1.delete(e),Sn0.delete(e)},0))}function r61(e,t){return t?`${e}:${t}`:e}function zy7(e,t,r){let a=[];if(e.frameworkId===Hn0){a.push(r61(e.topic));for(let[i]of D_1)i.startsWith(`${e.topic}:`)&&a.push(i)}else e.frameworkId&&a.push(r61(e.topic,e.frameworkId)),a.push(r61(e.topic));for(let i of a)if(D_1.has(i)){let n=D_1.get(i)??[],o=i.includes(":")?i.split(":")[1]:"broadcast";for(let h of n)t({...h,source:o});r&&e.frameworkId!==Hn0&&Ay7(i)}}function by7(e,t){D_1.has(e)||D_1.set(e,[]),D_1.get(e).push(t)}function $h1(e,t){let{topic:r,frameworkId:a,evaluatePendingEvents:i=!0}=e,n=e.shouldConsume??a!==Hn0;a&&B91.on(r61(r,a),t),B91.on(r61(r),t);let o=!1;return i&&queueMicrotask(()=>{o||zy7({topic:r,frameworkId:a},t,n)}),()=>{o=!0,a&&B91.off(r61(r,a),t),B91.off(r61(r),t)}}function eF4(e,t){let r=e.type,a=r61(r,t),i=r61(r,Hn0),n=r61(r),o=t&&!!B91.all.get(a)?.length,h=!!B91.all.get(i)?.length,u=!t&&!!B91.all.get(n)?.length;o||h||u?(o&&B91.emit(a,{...e,source:t??"broadcast"}),h&&B91.emit(i,{...e,source:t??"broadcast"}),u&&B91.emit(n,{...e,source:"broadcast"})):by7(t?a:n,e)}var CB5,B91,Hn0,D_1,Sn0,rF4=C1(()=>{"use strict";CB5=w4(mB5());globalThis.__autopilotFrameworkEventBus||(globalThis.__autopilotFrameworkEventBus=(0,CB5.default)(),typeof window<"u"&&(window.__autopilotFrameworkEventBus=globalThis.__autopilotFrameworkEventBus));B91=globalThis.__autopilotFrameworkEventBus,Hn0="global",D_1=new Map,Sn0=new Map});var MB5=C1(()=>{"use strict"});var xB5=C1(()=>{"use strict";rF4()});var LB5=C1(()=>{"use strict";rF4();MB5();xB5()});var ZQ1=C1(()=>{LB5()});function jS(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function sY(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Pn0({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function FQ1(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function sF4(e){return{defaultValue:e}}function hF4(e,t,r="/"){return Hy7(e,t,r,!1)}function Hy7(e,t,r,a){let i=typeof t=="string"?FQ1(t):t,n=V91(i.pathname||"/",r);if(n==null)return null;let o=SB5(e);Ty7(o);let h=null;for(let u=0;h==null&&u<o.length;++u){let g=Iy7(n);h=Oy7(o[u],g,a)}return h}function ky7(e,t){let{route:r,pathname:a,params:i}=e;return{id:r.id,pathname:a,params:i,data:t[r.id],loaderData:t[r.id],handle:r.handle}}function SB5(e,t=[],r=[],a="",i=!1){let n=(o,h,u=i,g)=>{let f={relativePath:g===void 0?o.path||"":g,caseSensitive:o.caseSensitive===!0,childrenIndex:h,route:o};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(a)&&u)return;jS(f.relativePath.startsWith(a),`Absolute route path "${f.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(a.length)}let v=Kh1([a,f.relativePath]),C=r.concat(f);o.children&&o.children.length>0&&(jS(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${v}".`),SB5(o.children,t,C,v,u)),!(o.path==null&&!o.index)&&t.push({path:v,score:Zy7(v,o.index),routesMeta:C})};return e.forEach((o,h)=>{if(o.path===""||!o.path?.includes("?"))n(o,h);else for(let u of HB5(o.path))n(o,h,!0,u)}),t}function HB5(e){let t=e.split("/");if(t.length===0)return[];let[r,...a]=t,i=r.endsWith("?"),n=r.replace(/\?$/,"");if(a.length===0)return i?[n,""]:[n];let o=HB5(a.join("/")),h=[];return h.push(...o.map(u=>u===""?n:[n,u].join("/"))),i&&h.push(...o),h.map(u=>e.startsWith("/")&&u===""?"/":u)}function Ty7(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Fy7(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}function Zy7(e,t){let r=e.split("/"),a=r.length;return r.some(wB5)&&(a+=Ry7),t&&(a+=Py7),r.filter(i=>!wB5(i)).reduce((i,n)=>i+(By7.test(n)?Vy7:n===""?_y7:Ey7),a)}function Fy7(e,t){return e.length===t.length&&e.slice(0,-1).every((a,i)=>a===t[i])?e[e.length-1]-t[t.length-1]:0}function Oy7(e,t,r=!1){let{routesMeta:a}=e,i={},n="/",o=[];for(let h=0;h<a.length;++h){let u=a[h],g=h===a.length-1,f=n==="/"?t:t.slice(n.length)||"/",v=wM2({path:u.relativePath,caseSensitive:u.caseSensitive,end:g},f),C=u.route;if(!v&&g&&r&&!a[a.length-1].route.index&&(v=wM2({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},f)),!v)return null;Object.assign(i,v.params),o.push({params:i,pathname:Kh1([n,v.pathname]),pathnameBase:Gy7(Kh1([n,v.pathnameBase])),route:C}),v.pathnameBase!=="/"&&(n=Kh1([n,v.pathnameBase]))}return o}function wM2(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Dy7(e.path,e.caseSensitive,e.end),i=t.match(r);if(!i)return null;let n=i[0],o=n.replace(/(.)\/+$/,"$1"),h=i.slice(1);return{params:a.reduce((g,{paramName:f,isOptional:v},C)=>{if(f==="*"){let y=h[C]||"";o=n.slice(0,n.length-y.length).replace(/(.)\/+$/,"$1")}let L=h[C];return v&&!L?g[f]=void 0:g[f]=(L||"").replace(/%2F/g,"/"),g},{}),pathname:n,pathnameBase:o,pattern:e}}function Dy7(e,t=!1,r=!0){sY(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,h,u)=>(a.push({paramName:h,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),a]}function Iy7(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return sY(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function V91(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function TB5(e,t="/"){let{pathname:r,search:a="",hash:i=""}=typeof e=="string"?FQ1(e):e,n;if(r)if(Ny7(r))n=r;else{if(r.includes("//")){let o=r;r=r.replace(/\/\/+/g,"/"),sY(!1,`Pathnames cannot have embedded double slashes - normalizing ${o} -> ${r}`)}r.startsWith("/")?n=yB5(r.substring(1),"/"):n=yB5(r,t)}else n=t;return{pathname:n,search:jy7(a),hash:Wy7(i)}}function yB5(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function aF4(e,t,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Uy7(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function BB5(e){let t=Uy7(e);return t.map((r,a)=>a===t.length-1?r.pathname:r.pathnameBase)}function VB5(e,t,r,a=!1){let i;typeof e=="string"?i=FQ1(e):(i={...e},jS(!i.pathname||!i.pathname.includes("?"),aF4("?","pathname","search",i)),jS(!i.pathname||!i.pathname.includes("#"),aF4("#","pathname","hash",i)),jS(!i.search||!i.search.includes("#"),aF4("#","search","hash",i)));let n=e===""||i.pathname==="",o=n?"/":i.pathname,h;if(o==null)h=r;else{let v=t.length-1;if(!a&&o.startsWith("..")){let C=o.split("/");for(;C[0]==="..";)C.shift(),v-=1;i.pathname=C.join("/")}h=v>=0?t[v]:"/"}let u=TB5(i,h),g=o&&o!=="/"&&o.endsWith("/"),f=(n||o===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(g||f)&&(u.pathname+="/"),u}function PB5(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function qy7(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}function EB5(e,t){let r=e;if(typeof r!="string"||!kB5.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,i=!1;if(_B5)try{let n=new URL(window.location.href),o=r.startsWith("//")?new URL(n.protocol+r):new URL(r),h=V91(o.pathname,t);o.origin===n.origin&&h!=null?r=h+o.search+o.hash:i=!0}catch{sY(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:i,to:r}}function Jy7(e){if(e.startsWith(`${OB5}:${Yy7}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function Qy7(e){if(e.startsWith(`${OB5}:${Xy7}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new dF4(t.status,t.statusText,t.data)}catch{}}function DB5(e,{relative:t}={}){jS(IQ1(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=to.useContext($N),{hash:i,pathname:n,search:o}=NQ1(e,{relative:t}),h=n;return r!=="/"&&(h=n==="/"?r:Kh1([r,n])),a.createHref({pathname:h,search:o,hash:i})}function IQ1(){return to.useContext(DQ1)!=null}function _91(){return jS(IQ1(),"useLocation() may be used only in the context of a <Router> component."),to.useContext(DQ1).location}function NB5(e){to.useContext($N).static||to.useLayoutEffect(e)}function _n0(){let{isDataRoute:e}=to.useContext(P91);return e?hA7():tA7()}function tA7(){jS(IQ1(),"useNavigate() may be used only in the context of a <Router> component.");let e=to.useContext(I_1),{basename:t,navigator:r}=to.useContext($N),{matches:a}=to.useContext(P91),{pathname:i}=_91(),n=JSON.stringify(BB5(a)),o=to.useRef(!1);return NB5(()=>{o.current=!0}),to.useCallback((u,g={})=>{if(sY(o.current,IB5),!o.current)return;if(typeof u=="number"){r.go(u);return}let f=VB5(u,JSON.parse(n),i,g.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:Kh1([t,f.pathname])),(g.replace?r.replace:r.push)(f,g.state,g)},[t,r,n,i,e])}function NQ1(e,{relative:t}={}){let{matches:r}=to.useContext(P91),{pathname:a}=_91(),i=JSON.stringify(BB5(r));return to.useMemo(()=>VB5(e,JSON.parse(i),a,t==="path"),[e,i,a,t])}function eA7(e,t,r,a,i){jS(IQ1(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:n}=to.useContext($N),{matches:o}=to.useContext(P91),h=o[o.length-1],u=h?h.params:{},g=h?h.pathname:"/",f=h?h.pathnameBase:"/",v=h&&h.route;if(oF4){let R=v&&v.path||"";WB5(g,!v||R.endsWith("*")||R.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${g}" (under <Route path="${R}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
9897
9897
|
|
|
9898
9898
|
Please change the parent <Route path="${R}"> to <Route path="${R==="/"?"*":`${R}/*`}">.`)}let C=_91(),L;if(t){let R=typeof t=="string"?FQ1(t):t;jS(f==="/"||R.pathname?.startsWith(f),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${R.pathname}" was given in the \`location\` prop.`),L=R}else L=C;let y=L.pathname||"/",z=y;if(f!=="/"){let R=f.replace(/^\//,"").split("/");z="/"+y.replace(/^\//,"").split("/").slice(R.length).join("/")}let S=hF4(e,{pathname:z});oF4&&(sY(v||S!=null,`No routes matched location "${L.pathname}${L.search}${L.hash}" `),sY(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${L.pathname}${L.search}${L.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`));let B=oA7(S&&S.map(R=>Object.assign({},R,{params:Object.assign({},u,R.params),pathname:Kh1([f,n.encodeLocation?n.encodeLocation(R.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathname]),pathnameBase:R.pathnameBase==="/"?f:Kh1([f,n.encodeLocation?n.encodeLocation(R.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathnameBase])})),o,r,a,i);return t&&B?to.createElement(DQ1.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...L},navigationType:"POP"}},B):B}function rA7(){let e=jB5(),t=PB5(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:a},n={padding:"2px 4px",backgroundColor:a},o=null;return oF4&&(console.error("Error handled by React Router default ErrorBoundary:",e),o=to.createElement(to.Fragment,null,to.createElement("p",null,"\u{1F4BF} Hey developer \u{1F44B}"),to.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",to.createElement("code",{style:n},"ErrorBoundary")," or"," ",to.createElement("code",{style:n},"errorElement")," prop on your route."))),to.createElement(to.Fragment,null,to.createElement("h2",null,"Unexpected Application Error!"),to.createElement("h3",{style:{fontStyle:"italic"}},t),r?to.createElement("pre",{style:i},r):null,o)}function iA7({children:e,error:t}){let{basename:r}=to.useContext($N);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=Jy7(t.digest);if(a){let i=iF4.get(t);if(i)throw i;let n=EB5(a.location,r);if(_B5&&!iF4.get(t))if(n.isExternal||a.reloadDocument)window.location.href=n.absoluteURL||n.to;else{let o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(n.to,{replace:a.replace}));throw iF4.set(t,o),o}return to.createElement("meta",{httpEquiv:"refresh",content:`0;url=${n.absoluteURL||n.to}`})}}return e}function nA7({routeContext:e,match:t,children:r}){let a=to.useContext(I_1);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),to.createElement(P91.Provider,{value:e},r)}function oA7(e,t=[],r=null,a=null,i=null){if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let n=e,o=r?.errors;if(o!=null){let f=n.findIndex(v=>v.route.id&&o?.[v.route.id]!==void 0);jS(f>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),n=n.slice(0,Math.min(n.length,f+1))}let h=!1,u=-1;if(r)for(let f=0;f<n.length;f++){let v=n[f];if((v.route.HydrateFallback||v.route.hydrateFallbackElement)&&(u=f),v.route.id){let{loaderData:C,errors:L}=r,y=v.route.loader&&!C.hasOwnProperty(v.route.id)&&(!L||L[v.route.id]===void 0);if(v.route.lazy||y){h=!0,u>=0?n=n.slice(0,u+1):n=[n[0]];break}}}let g=r&&a?(f,v)=>{a(f,{location:r.location,params:r.matches?.[0]?.params??{},unstable_pattern:qy7(r.matches),errorInfo:v})}:void 0;return n.reduceRight((f,v,C)=>{let L,y=!1,z=null,S=null;r&&(L=o&&v.route.id?o[v.route.id]:void 0,z=v.route.errorElement||aA7,h&&(u<0&&C===0?(WB5("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),y=!0,S=null):u===C&&(y=!0,S=v.route.hydrateFallbackElement||null)));let B=t.concat(n.slice(0,C+1)),R=()=>{let F;return L?F=z:y?F=S:v.route.Component?F=to.createElement(v.route.Component,null):v.route.element?F=v.route.element:F=f,to.createElement(nA7,{match:v,routeContext:{outlet:f,matches:B,isDataRoute:r!=null},children:F})};return r&&(v.route.ErrorBoundary||v.route.errorElement||C===0)?to.createElement(UB5,{location:r.location,revalidation:r.revalidation,component:z,error:L,children:R(),routeContext:{outlet:null,matches:B,isDataRoute:!0},onError:g}):R()},null)}function pF4(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function lA7(e){let t=to.useContext(I_1);return jS(t,pF4(e)),t}function fF4(e){let t=to.useContext(OQ1);return jS(t,pF4(e)),t}function cA7(e){let t=to.useContext(P91);return jS(t,pF4(e)),t}function vF4(e){let t=cA7(e),r=t.matches[t.matches.length-1];return jS(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function sA7(){return vF4("useRouteId")}function GB5(){return fF4("useNavigation").navigation}function mF4(){let{matches:e,loaderData:t}=fF4("useMatches");return to.useMemo(()=>e.map(r=>ky7(r,t)),[e,t])}function jB5(){let e=to.useContext(gF4),t=fF4("useRouteError"),r=vF4("useRouteError");return e!==void 0?e:t.errors?.[r]}function hA7(){let{router:e}=lA7("useNavigate"),t=vF4("useNavigate"),r=to.useRef(!1);return NB5(()=>{r.current=!0}),to.useCallback(async(i,n={})=>{sY(r.current,IB5),r.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:t,...n}))},[e,t])}function WB5(e,t,r){!t&&!AB5[e]&&(AB5[e]=!0,sY(!1,r))}function uA7({routes:e,future:t,state:r,onError:a}){return eA7(e,void 0,r,a,t)}function qB5({basename:e="/",children:t=null,location:r,navigationType:a="POP",navigator:i,static:n=!1,unstable_useTransitions:o}){jS(!IQ1(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=e.replace(/^\/*/,"/"),u=yk.useMemo(()=>({basename:h,navigator:i,static:n,unstable_useTransitions:o,future:{}}),[h,i,n,o]);typeof r=="string"&&(r=FQ1(r));let{pathname:g="/",search:f="",hash:v="",state:C=null,key:L="default"}=r,y=yk.useMemo(()=>{let z=V91(g,h);return z==null?null:{location:{pathname:z,search:f,hash:v,state:C,key:L},navigationType:a}},[h,g,f,v,C,L,a]);return sY(y!=null,`<Router basename="${h}"> is not able to match the URL "${g}${f}${v}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:yk.createElement($N.Provider,{value:u},yk.createElement(DQ1.Provider,{children:t,value:y}))}function En0(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function gA7(e){return En0(e)&&e.tagName.toLowerCase()==="button"}function pA7(e){return En0(e)&&e.tagName.toLowerCase()==="form"}function fA7(e){return En0(e)&&e.tagName.toLowerCase()==="input"}function vA7(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function mA7(e,t){return e.button===0&&(!t||t==="_self")&&!vA7(e)}function CA7(){if(kn0===null)try{new FormData(document.createElement("form"),0),kn0=!1}catch{kn0=!0}return kn0}function nF4(e){return e!=null&&!MA7.has(e)?(sY(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Vn0}"`),null):e}function xA7(e,t){let r,a,i,n,o;if(pA7(e)){let h=e.getAttribute("action");a=h?V91(h,t):null,r=e.getAttribute("method")||Bn0,i=nF4(e.getAttribute("enctype"))||Vn0,n=new FormData(e)}else if(gA7(e)||fA7(e)&&(e.type==="submit"||e.type==="image")){let h=e.form;if(h==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||h.getAttribute("action");if(a=u?V91(u,t):null,r=e.getAttribute("formmethod")||h.getAttribute("method")||Bn0,i=nF4(e.getAttribute("formenctype"))||nF4(h.getAttribute("enctype"))||Vn0,n=new FormData(h,e),!CA7()){let{name:g,type:f,value:v}=e;if(f==="image"){let C=g?`${g}.`:"";n.append(`${C}x`,"0"),n.append(`${C}y`,"0")}else g&&n.append(g,v)}}else{if(En0(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Bn0,a=null,i=Vn0,o=e}return n&&i==="text/plain"&&(o=n,n=void 0),{action:a,method:r.toLowerCase(),encType:i,formData:n,body:o}}function zB5(e){return e.replace(wA7,t=>LA7[t])}function MF4(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function $B5(e,t,r,a){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${a}`:i.pathname=`${i.pathname}.${a}`:i.pathname==="/"?i.pathname=`_root.${a}`:t&&V91(i.pathname,t)==="/"?i.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${a}`,i}async function yA7(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){if(console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode&&import.meta.hot)throw r;return window.location.reload(),new Promise(()=>{})}}function AA7(e){return e!=null&&typeof e.page=="string"}function zA7(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function bA7(e,t,r){let a=await Promise.all(e.map(async i=>{let n=t.routes[i.route.id];if(n){let o=await yA7(n,r);return o.links?o.links():[]}return[]}));return TA7(a.flat(1).filter(zA7).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function bB5(e,t,r,a,i,n){let o=(u,g)=>r[g]?u.route.id!==r[g].route.id:!0,h=(u,g)=>r[g].pathname!==u.pathname||r[g].route.path?.endsWith("*")&&r[g].params["*"]!==u.params["*"];return n==="assets"?t.filter((u,g)=>o(u,g)||h(u,g)):n==="data"?t.filter((u,g)=>{let f=a.routes[u.route.id];if(!f||!f.hasLoader)return!1;if(o(u,g)||h(u,g))return!0;if(u.route.shouldRevalidate){let v=u.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof v=="boolean")return v}return!0}):[]}function SA7(e,t,{includeHydrateFallback:r}={}){return HA7(e.map(a=>{let i=t.routes[a.route.id];if(!i)return[];let n=[i.module];return i.clientActionModule&&(n=n.concat(i.clientActionModule)),i.clientLoaderModule&&(n=n.concat(i.clientLoaderModule)),r&&i.hydrateFallbackModule&&(n=n.concat(i.hydrateFallbackModule)),i.imports&&(n=n.concat(i.imports)),n}).flat(1))}function HA7(e){return[...new Set(e)]}function kA7(e){let t={},r=Object.keys(e).sort();for(let a of r)t[a]=e[a];return t}function TA7(e,t){let r=new Set,a=new Set(t);return e.reduce((i,n)=>{if(t&&!AA7(n)&&n.as==="script"&&n.href&&a.has(n.href))return i;let h=JSON.stringify(kA7(n));return r.has(h)||(r.add(h),i.push({key:h,link:n})),i},[])}function YB5(){let e=lC.useContext(I_1);return MF4(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function _A7(){let e=lC.useContext(OQ1);return MF4(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}function XB5(){let e=lC.useContext(UQ1);return MF4(e,"You must render this element inside a <HydratedRouter> element"),e}function EA7(e,t){let r=lC.useContext(UQ1),[a,i]=lC.useState(!1),[n,o]=lC.useState(!1),{onFocus:h,onBlur:u,onMouseEnter:g,onMouseLeave:f,onTouchStart:v}=t,C=lC.useRef(null);lC.useEffect(()=>{if(e==="render"&&o(!0),e==="viewport"){let z=B=>{B.forEach(R=>{o(R.isIntersecting)})},S=new IntersectionObserver(z,{threshold:.5});return C.current&&S.observe(C.current),()=>{S.disconnect()}}},[e]),lC.useEffect(()=>{if(a){let z=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(z)}}},[a]);let L=()=>{i(!0)},y=()=>{i(!1),o(!1)};return r?e!=="intent"?[n,C,{}]:[n,C,{onFocus:LM2(h,L),onBlur:LM2(u,y),onMouseEnter:LM2(g,L),onMouseLeave:LM2(f,y),onTouchStart:LM2(v,L)}]:[!1,C,{}]}function LM2(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function JB5({page:e,...t}){let{router:r}=YB5(),a=lC.useMemo(()=>hF4(r.routes,e,r.basename),[r.routes,e,r.basename]);return a?lC.createElement(ZA7,{page:e,matches:a,...t}):null}function RA7(e){let{manifest:t,routeModules:r}=XB5(),[a,i]=lC.useState([]);return lC.useEffect(()=>{let n=!1;return bA7(e,t,r).then(o=>{n||i(o)}),()=>{n=!0}},[e,t,r]),a}function ZA7({page:e,matches:t,...r}){let a=_91(),{future:i,manifest:n,routeModules:o}=XB5(),{basename:h}=YB5(),{loaderData:u,matches:g}=_A7(),f=lC.useMemo(()=>bB5(e,t,g,n,a,"data"),[e,t,g,n,a]),v=lC.useMemo(()=>bB5(e,t,g,n,a,"assets"),[e,t,g,n,a]),C=lC.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let z=new Set,S=!1;if(t.forEach(R=>{let F=n.routes[R.route.id];!F||!F.hasLoader||(!f.some(N=>N.route.id===R.route.id)&&R.route.id in u&&o[R.route.id]?.shouldRevalidate||F.hasClientLoader?S=!0:z.add(R.route.id))}),z.size===0)return[];let B=$B5(e,h,i.unstable_trailingSlashAwareDataRequests,"data");return S&&z.size>0&&B.searchParams.set("_routes",t.filter(R=>z.has(R.route.id)).map(R=>R.route.id).join(",")),[B.pathname+B.search]},[h,i.unstable_trailingSlashAwareDataRequests,u,a,n,f,t,e,o]),L=lC.useMemo(()=>SA7(v,n),[v,n]),y=RA7(v);return lC.createElement(lC.Fragment,null,C.map(z=>lC.createElement("link",{key:z,rel:"prefetch",as:"fetch",href:z,...r})),L.map(z=>lC.createElement("link",{key:z,rel:"modulepreload",href:z,...r})),y.map(({key:z,link:S})=>lC.createElement("link",{key:z,nonce:r.nonce,...S})))}function FA7(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}function QB5({basename:e,children:t,history:r,unstable_useTransitions:a}){let[i,n]=nc.useState({action:r.action,location:r.location}),o=nc.useCallback(h=>{a===!1?n(h):nc.startTransition(()=>n(h))},[a]);return nc.useLayoutEffect(()=>r.listen(o),[r,o]),nc.createElement(qB5,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:r,unstable_useTransitions:a})}function aV5({getKey:e,storageKey:t,...r}){let a=nc.useContext(UQ1),{basename:i}=nc.useContext($N),n=_91(),o=mF4();cV5({getKey:e,storageKey:t});let h=nc.useMemo(()=>{if(!a||!e)return null;let g=cF4(n,o,i,e);return g!==n.key?g:null},[]);if(!a||a.isSpaMode)return null;let u=((g,f)=>{if(!window.history.state||!window.history.state.key){let v=Math.random().toString(32).slice(2);window.history.replaceState({key:v},"")}try{let C=JSON.parse(sessionStorage.getItem(g)||"{}")[f||window.history.state.key];typeof C=="number"&&window.scrollTo(0,C)}catch(v){console.error(v),sessionStorage.removeItem(g)}}).toString();return nc.createElement("script",{...r,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${u})(${zB5(JSON.stringify(t||lF4))}, ${zB5(JSON.stringify(h))})`}})}function iV5(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function LF4(e){let t=nc.useContext(I_1);return jS(t,iV5(e)),t}function DA7(e){let t=nc.useContext(OQ1);return jS(t,iV5(e)),t}function nV5(e,{target:t,replace:r,state:a,preventScrollReset:i,relative:n,viewTransition:o,unstable_defaultShouldRevalidate:h,unstable_useTransitions:u}={}){let g=_n0(),f=_91(),v=NQ1(e,{relative:n});return nc.useCallback(C=>{if(mA7(C,t)){C.preventDefault();let L=r!==void 0?r:Pn0(f)===Pn0(v),y=()=>g(e,{replace:L,state:a,preventScrollReset:i,relative:n,viewTransition:o,unstable_defaultShouldRevalidate:h});u?nc.startTransition(()=>y()):y()}},[f,g,v,r,a,t,e,i,n,o,h,u])}function oV5(){let{router:e}=LF4("useSubmit"),{basename:t}=nc.useContext($N),r=sA7(),a=e.fetch,i=e.navigate;return nc.useCallback(async(n,o={})=>{let{action:h,method:u,encType:g,formData:f,body:v}=xA7(n,t);if(o.navigate===!1){let C=o.fetcherKey||NA7();await a(C,r,o.action||h,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:f,body:v,formMethod:o.method||u,formEncType:o.encType||g,flushSync:o.flushSync})}else await i(o.action||h,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:f,body:v,formMethod:o.method||u,formEncType:o.encType||g,replace:o.replace,state:o.state,fromRouteId:r,flushSync:o.flushSync,viewTransition:o.viewTransition})},[a,i,t,r])}function lV5(e,{relative:t}={}){let{basename:r}=nc.useContext($N),a=nc.useContext(P91);jS(a,"useFormAction must be used inside a RouteContext");let[i]=a.matches.slice(-1),n={...NQ1(e||".",{relative:t})},o=_91();if(e==null){n.search=o.search;let h=new URLSearchParams(n.search),u=h.getAll("index");if(u.some(f=>f==="")){h.delete("index"),u.filter(v=>v).forEach(v=>h.append("index",v));let f=h.toString();n.search=f?`?${f}`:""}}return(!e||e===".")&&i.route.index&&(n.search=n.search?n.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(n.pathname=n.pathname==="/"?r:Kh1([r,n.pathname])),Pn0(n)}function cF4(e,t,r,a){let i=null;return a&&(r!=="/"?i=a({...e,pathname:V91(e.pathname,r)||e.pathname},t):i=a(e,t)),i==null&&(i=e.key),i}function cV5({getKey:e,storageKey:t}={}){let{router:r}=LF4("useScrollRestoration"),{restoreScrollPosition:a,preventScrollReset:i}=DA7("useScrollRestoration"),{basename:n}=nc.useContext($N),o=_91(),h=mF4(),u=GB5();nc.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),UA7(nc.useCallback(()=>{if(u.state==="idle"){let g=cF4(o,h,n,e);Tn0[g]=window.scrollY}try{sessionStorage.setItem(t||lF4,JSON.stringify(Tn0))}catch(g){sY(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${g}).`)}window.history.scrollRestoration="auto"},[u.state,e,n,o,h,t])),typeof document<"u"&&(nc.useLayoutEffect(()=>{try{let g=sessionStorage.getItem(t||lF4);g&&(Tn0=JSON.parse(g))}catch{}},[t]),nc.useLayoutEffect(()=>{let g=r?.enableScrollRestoration(Tn0,()=>window.scrollY,e?(f,v)=>cF4(f,v,n,e):void 0);return()=>g&&g()},[r,n,e]),nc.useLayoutEffect(()=>{if(a!==!1){if(typeof a=="number"){window.scrollTo(0,a);return}try{if(o.hash){let g=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(g){g.scrollIntoView();return}}}catch{sY(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,a,i]))}function UA7(e,t){let{capture:r}=t||{};nc.useEffect(()=>{let a=r!=null?{capture:r}:void 0;return window.addEventListener("pagehide",e,a),()=>{window.removeEventListener("pagehide",e,a)}},[e,r])}function sV5(e,{relative:t}={}){let r=nc.useContext(uF4);jS(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=LF4("useViewTransitionState"),i=NQ1(e,{relative:t});if(!r.isTransitioning)return!1;let n=V91(r.currentLocation.pathname,a)||r.currentLocation.pathname,o=V91(r.nextLocation.pathname,a)||r.nextLocation.pathname;return wM2(i.pathname,o)!=null||wM2(i.pathname,n)!=null}var hY,to,yk,CF4,KB5,lC,BA7,VA7,PA7,nc,hV5,Sy7,By7,Vy7,Py7,_y7,Ey7,Ry7,wB5,kB5,Ny7,Kh1,Gy7,jy7,Wy7,dF4,_B5,AOi,RB5,zOi,$y7,bOi,I_1,OQ1,ZB5,uF4,FB5,Ky7,$N,DQ1,P91,gF4,oF4,OB5,Yy7,Xy7,IB5,SOi,aA7,UB5,iF4,AB5,dA7,HOi,kOi,Bn0,Vn0,kn0,MA7,TOi,LA7,wA7,UQ1,OA7,tV5,xF4,eV5,rV5,IA7,NA7,lF4,Tn0,wF4=C1(()=>{hY=w4(rr(),1),to=w4(rr(),1),yk=w4(rr(),1),CF4=w4(rr(),1),KB5=w4(rr(),1),lC=w4(rr(),1),BA7=w4(rr(),1),VA7=w4(rr(),1),PA7=w4(rr(),1),nc=w4(rr(),1),hV5=w4(rr(),1);Sy7=new WeakMap;By7=/^:[\w-]+$/,Vy7=3,Py7=2,_y7=1,Ey7=10,Ry7=-2,wB5=e=>e==="*";kB5=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ny7=e=>kB5.test(e);Kh1=e=>e.join("/").replace(/\/\/+/g,"/"),Gy7=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),jy7=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Wy7=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,dF4=class{constructor(e,t,r,a=!1){this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};_B5=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";AOi=Object.getOwnPropertyNames(Object.prototype).sort().join("\0"),RB5=["POST","PUT","PATCH","DELETE"],zOi=new Set(RB5),$y7=["GET",...RB5],bOi=new Set($y7),I_1=hY.createContext(null);I_1.displayName="DataRouter";OQ1=hY.createContext(null);OQ1.displayName="DataRouterState";ZB5=hY.createContext(!1),uF4=hY.createContext({isTransitioning:!1});uF4.displayName="ViewTransition";FB5=hY.createContext(new Map);FB5.displayName="Fetchers";Ky7=hY.createContext(null);Ky7.displayName="Await";$N=hY.createContext(null);$N.displayName="Navigation";DQ1=hY.createContext(null);DQ1.displayName="Location";P91=hY.createContext({outlet:null,matches:[],isDataRoute:!1});P91.displayName="Route";gF4=hY.createContext(null);gF4.displayName="RouteError";oF4=!0,OB5="REACT_ROUTER_ERROR",Yy7="REDIRECT",Xy7="ROUTE_ERROR_RESPONSE";IB5="You should call navigate() in a React.useEffect(), not when your component is first rendered.";SOi=to.createContext(null);aA7=to.createElement(rA7,null),UB5=class extends to.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=Qy7(e.digest);r&&(e=r)}let t=e!==void 0?to.createElement(P91.Provider,{value:this.props.routeContext},to.createElement(gF4.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?to.createElement(iA7,{error:e},t):t}};UB5.contextType=ZB5;iF4=new WeakMap;AB5={};dA7="useOptimistic",HOi=yk[dA7],kOi=yk.memo(uA7);Bn0="get",Vn0="application/x-www-form-urlencoded";kn0=null;MA7=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);TOi=Object.getOwnPropertyNames(Object.prototype).sort().join("\0"),LA7={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},wA7=/[&><\u2028\u2029]/g;UQ1=lC.createContext(void 0);UQ1.displayName="FrameworkContext";OA7=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{OA7&&(window.__reactRouterVersion="7.12.0")}catch{}QB5.displayName="unstable_HistoryRouter";tV5=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,xF4=nc.forwardRef(function({onClick:t,discover:r="render",prefetch:a="none",relative:i,reloadDocument:n,replace:o,state:h,target:u,to:g,preventScrollReset:f,viewTransition:v,unstable_defaultShouldRevalidate:C,...L},y){let{basename:z,unstable_useTransitions:S}=nc.useContext($N),B=typeof g=="string"&&tV5.test(g),R=EB5(g,z);g=R.to;let F=DB5(g,{relative:i}),[N,j,Y]=EA7(a,L),t1=nV5(g,{replace:o,state:h,target:u,preventScrollReset:f,relative:i,viewTransition:v,unstable_defaultShouldRevalidate:C,unstable_useTransitions:S});function n1(s1){t&&t(s1),s1.defaultPrevented||t1(s1)}let a1=nc.createElement("a",{...L,...Y,href:R.absoluteURL||F,onClick:R.isExternal||n?t:n1,ref:FA7(y,j),target:u,"data-discover":!B&&r==="render"?"true":void 0});return N&&!B?nc.createElement(nc.Fragment,null,a1,nc.createElement(JB5,{page:F})):a1});xF4.displayName="Link";eV5=nc.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:a="",end:i=!1,style:n,to:o,viewTransition:h,children:u,...g},f){let v=NQ1(o,{relative:g.relative}),C=_91(),L=nc.useContext(OQ1),{navigator:y,basename:z}=nc.useContext($N),S=L!=null&&sV5(v)&&h===!0,B=y.encodeLocation?y.encodeLocation(v).pathname:v.pathname,R=C.pathname,F=L&&L.navigation&&L.navigation.location?L.navigation.location.pathname:null;r||(R=R.toLowerCase(),F=F?F.toLowerCase():null,B=B.toLowerCase()),F&&z&&(F=V91(F,z)||F);let N=B!=="/"&&B.endsWith("/")?B.length-1:B.length,j=R===B||!i&&R.startsWith(B)&&R.charAt(N)==="/",Y=F!=null&&(F===B||!i&&F.startsWith(B)&&F.charAt(B.length)==="/"),t1={isActive:j,isPending:Y,isTransitioning:S},n1=j?t:void 0,a1;typeof a=="function"?a1=a(t1):a1=[a,j?"active":null,Y?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let s1=typeof n=="function"?n(t1):n;return nc.createElement(xF4,{...g,"aria-current":n1,className:a1,ref:f,style:s1,to:o,viewTransition:h},typeof u=="function"?u(t1):u)});eV5.displayName="NavLink";rV5=nc.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:a,replace:i,state:n,method:o=Bn0,action:h,onSubmit:u,relative:g,preventScrollReset:f,viewTransition:v,unstable_defaultShouldRevalidate:C,...L},y)=>{let{unstable_useTransitions:z}=nc.useContext($N),S=oV5(),B=lV5(h,{relative:g}),R=o.toLowerCase()==="get"?"get":"post",F=typeof h=="string"&&tV5.test(h);return nc.createElement("form",{ref:y,method:R,action:B,onSubmit:a?u:j=>{if(u&&u(j),j.defaultPrevented)return;j.preventDefault();let Y=j.nativeEvent.submitter,t1=Y?.getAttribute("formmethod")||o,n1=()=>S(Y||j.currentTarget,{fetcherKey:t,method:t1,navigate:r,replace:i,state:n,relative:g,preventScrollReset:f,viewTransition:v,unstable_defaultShouldRevalidate:C});z&&r!==!1?nc.startTransition(()=>n1()):n1()},...L,"data-discover":!F&&e==="render"?"true":void 0})});rV5.displayName="Form";aV5.displayName="ScrollRestoration";IA7=0,NA7=()=>`__${String(++IA7)}__`;lF4="react-router-scroll-positions",Tn0={}});var az7,iz7,yM2,GQ1,nz7,NOi,dV5=C1(()=>{"use client";wF4();az7=w4(rr(),1),iz7=w4(IQ(),1),yM2=w4(rr(),1),GQ1=w4(rr(),1),nz7=w4(IQ(),1);NOi=sF4()});var uV5=C1(()=>{"use client";wF4();});var gV5=C1(()=>{dV5();uV5();});var Rn0=C1(()=>{});var N_1,Zn0=C1(()=>{N_1="answer-now"});function Fn0(e){return{...e,availableTools:[],unavailableTools:[],toolInstructions:""}}var yF4=C1(()=>{});function oz7(e){let t=e?.ContextData;if(!t||typeof t!="object")return e;let{planSteering:r,...a}=t;return r===void 0?e:{...e,ContextData:a}}var pV5,fV5=C1(()=>{Zn0();yF4();pV5={name:"answerNowApiClamp",decorate(e,t){if(t.source!==N_1)return e;let r=Fn0(e);return r.context=oz7(r.context),r}}});var BZ5=M1((hIi,TZ5)=>{"use strict";var n7;typeof window>"u"?(AF4={hostname:""},n7={crypto:{randomUUID:function(){throw Error("unsupported")}},navigator:{userAgent:"",onLine:!0},document:{createElement:function(){return{}},location:AF4,referrer:""},screen:{width:0,height:0},location:AF4,addEventListener:function(){},removeEventListener:function(){},dispatchEvent:function(){},CustomEvent:function(){}}):n7=window;var AF4,i61="__mp_targeting",QF4="__mp_recorder";function vV5(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,a=new Array(t);r<t;r++)a[r]=e[r];return a}function mV5(e,t,r,a,i,n,o){try{var h=e[n](o),u=h.value}catch(g){r(g);return}h.done?t(u):Promise.resolve(u).then(a,i)}function sl0(e){return function(){var t=this,r=arguments;return new Promise(function(a,i){var n=e.apply(t,r);function o(u){mV5(n,a,i,o,h,"next",u)}function h(u){mV5(n,a,i,o,h,"throw",u)}o(void 0)})}}function Lo0(e,t,r){return c_5()?Lo0=Reflect.construct:Lo0=function(i,n,o){var h=[null];h.push.apply(h,n);var u=Function.bind.apply(i,h),g=new u;return o&&OM2(g,o.prototype),g},Lo0.apply(null,arguments)}function lz7(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}function Zy(e,t,r){return t&&lz7(e.prototype,t),e}function yu(){return yu=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},yu.apply(this,arguments)}function tO4(e){return tO4=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},tO4(e)}function cz(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&OM2(e,t)}function dl(e,t){return t!=null&&typeof Symbol<"u"&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function cz7(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function U_1(e,t){if(e==null)return{};var r={},a=Object.keys(e),i,n;for(n=0;n<a.length;n++)i=a[n],!(t.indexOf(i)>=0)&&(r[i]=e[i]);return r}function OM2(e,t){return OM2=Object.setPrototypeOf||function(a,i){return a.__proto__=i,a},OM2(e,t)}function bl(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function sz7(e,t){if(e){if(typeof e=="string")return vV5(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return vV5(e,t)}}function DM2(e){var t=typeof Map=="function"?new Map:void 0;return DM2=function(a){if(a===null||!cz7(a))return a;if(typeof a!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(a))return t.get(a);t.set(a,i)}function i(){return Lo0(a,arguments,tO4(this).constructor)}return i.prototype=Object.create(a.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),OM2(i,a)},DM2(e)}function c_5(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(c_5=function(){return!!e})()}function Hr(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=sz7(e))||t){r&&(e=r);var a=0;return function(){return a>=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function G_1(e,t){var r,a,i,n,o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]};return n={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function h(g){return function(f){return u([g,f])}}function u(g){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,a&&(i=g[0]&2?a.return:g[0]?a.throw||((i=a.return)&&i.call(a),0):a.next)&&!(i=i.call(a,g[1])).done)return i;switch(a=0,i&&(g=[g[0]&2,i.value]),g[0]){case 0:case 1:i=g;break;case 4:return o.label++,{value:g[1],done:!1};case 5:o.label++,a=g[1],g=[0];continue;case 7:g=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!(i=i.length>0&&i[i.length-1])&&(g[0]===6||g[0]===2)){o=0;continue}if(g[0]===3&&(!i||g[1]>i[0]&&g[1]<i[3])){o.label=g[1];break}if(g[0]===6&&o.label<i[1]){o.label=i[1],i=g;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(g);break}i[2]&&o.ops.pop(),o.trys.pop();continue}g=t.call(e,o)}catch(f){g=[6,f],a=0}finally{r=i=0}if(g[0]&5)throw g[1];return{value:g[0]?g[1]:void 0,done:!0}}}function uD4(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var hz7=Object.defineProperty,dz7=function(e,t,r){return t in e?hz7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},_a=function(e,t,r){return dz7(e,(typeof t>"u"?"undefined":bl(t))!=="symbol"?t+"":t,r)},CV5,uz7=Object.defineProperty,gz7=function(e,t,r){return t in e?uz7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r},MV5=function(e,t,r){return gz7(e,(typeof t>"u"?"undefined":bl(t))!=="symbol"?t+"":t,r)},OV=(function(e){return e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e})(OV||{}),xV5={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},LV5={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},On0={},pz7=function(){return!!globalThis.Zone};function gD4(e){if(On0[e])return On0[e];var t=globalThis[e],r=t.prototype,a=e in xV5?xV5[e]:void 0,i=!!(a&&a.every(function(f){var v,C;return!!((C=(v=Object.getOwnPropertyDescriptor(r,f))==null?void 0:v.get)!=null&&C.toString().includes("[native code]"))})),n=e in LV5?LV5[e]:void 0,o=!!(n&&n.every(function(f){var v;return typeof r[f]=="function"&&((v=r[f])==null?void 0:v.toString().includes("[native code]"))}));if(i&&o&&!pz7())return On0[e]=t.prototype,t.prototype;try{var h=document.createElement("iframe");document.body.appendChild(h);var u=h.contentWindow;if(!u)return t.prototype;var g=u[e].prototype;return document.body.removeChild(h),g?On0[e]=g:r}catch{return r}}var zF4={};function HL1(e,t,r){var a,i=e+"."+String(r);if(zF4[i])return zF4[i].call(t);var n=gD4(e),o=(a=Object.getOwnPropertyDescriptor(n,r))==null?void 0:a.get;return o?(zF4[i]=o,o.call(t)):t[r]}var bF4={};function s_5(e,t,r){var a=e+"."+String(r);if(bF4[a])return bF4[a].bind(t);var i=gD4(e),n=i[r];return typeof n!="function"?t[r]:(bF4[a]=n,n.bind(t))}function fz7(e){return HL1("Node",e,"childNodes")}function vz7(e){return HL1("Node",e,"parentNode")}function mz7(e){return HL1("Node",e,"parentElement")}function Cz7(e){return HL1("Node",e,"textContent")}function Mz7(e,t){return s_5("Node",e,"contains")(t)}function xz7(e){return s_5("Node",e,"getRootNode")()}function Lz7(e){return!e||!("host"in e)?null:HL1("ShadowRoot",e,"host")}function wz7(e){return e.styleSheets}function yz7(e){return!e||!("shadowRoot"in e)?null:HL1("Element",e,"shadowRoot")}function Az7(e,t){return HL1("Element",e,"querySelector")(t)}function zz7(e,t){return HL1("Element",e,"querySelectorAll")(t)}function bz7(){return gD4("MutationObserver").constructor}function Sz7(e,t,r){try{if(!(t in e))return function(){};var a=e[t],i=r(a);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:a}})),e[t]=i,function(){e[t]=a}}catch{return function(){}}}var UO={childNodes:fz7,parentNode:vz7,parentElement:mz7,textContent:Cz7,contains:Mz7,getRootNode:xz7,host:Lz7,styleSheets:wz7,shadowRoot:yz7,querySelector:Az7,querySelectorAll:zz7,mutationObserver:bz7,patch:Sz7};function h_5(e){return e.nodeType===e.ELEMENT_NODE}function VM2(e){var t=e&&"host"in e&&"mode"in e&&UO.host(e)||null;return!!(t&&"shadowRoot"in t&&UO.shadowRoot(t)===e)}function PM2(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Hz7(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function kz7(e){var t=e.cssText;if(t.split('"').length<3)return t;var r=["@import","url("+JSON.stringify(e.href)+")"];return e.layerName===""?r.push("layer"):e.layerName&&r.push("layer("+e.layerName+")"),e.supportsText&&r.push("supports("+e.supportsText+")"),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function eO4(e){try{var t=e.rules||e.cssRules;if(!t)return null;var r=e.href;!r&&e.ownerNode&&e.ownerNode.ownerDocument&&(r=e.ownerNode.ownerDocument.location.href);var a=Array.from(t,function(i){return d_5(i,r)}).join("");return Hz7(a)}catch{return null}}function d_5(e,t){if(Bz7(e)){var r;try{r=eO4(e.styleSheet)||kz7(e)}catch{r=e.cssText}return e.styleSheet.href?Po0(r,e.styleSheet.href):r}else{var a=e.cssText;return Vz7(e)&&e.selectorText.includes(":")&&(a=Tz7(a)),t?Po0(a,t):a}}function Tz7(e){var t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function Bz7(e){return"styleSheet"in e}function Vz7(e){return"selectorText"in e}var u_5=(function(){function e(){MV5(this,"idNodeMap",new Map),MV5(this,"nodeMetaMap",new WeakMap)}var t=e.prototype;return t.getId=function(a){var i;if(!a)return-1;var n=(i=this.getMeta(a))==null?void 0:i.id;return n??-1},t.getNode=function(a){return this.idNodeMap.get(a)||null},t.getIds=function(){return Array.from(this.idNodeMap.keys())},t.getMeta=function(a){return this.nodeMetaMap.get(a)||null},t.removeNodeFromMap=function(a,i){var n=this;i===void 0&&(i=!1);var o=this.getId(a);this.idNodeMap.delete(o),i&&this.nodeMetaMap.delete(a),a.childNodes&&a.childNodes.forEach(function(h){return n.removeNodeFromMap(h,i)})},t.has=function(a){return this.idNodeMap.has(a)},t.hasNode=function(a){return this.nodeMetaMap.has(a)},t.add=function(a,i){var n=i.id;this.idNodeMap.set(n,a),this.nodeMetaMap.set(a,i)},t.replace=function(a,i){var n=this.getNode(a);if(n){var o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(i,o)}this.idNodeMap.set(a,i)},t.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e})();function Pz7(){return new u_5}function Bo0(e){var t=e.element,r=e.maskInputOptions,a=e.tagName,i=e.type,n=e.value,o=e.maskInputFn,h=n||"",u=i&&j_1(i);return(r[a.toLowerCase()]||u&&r[u])&&(o?h=o(h,t):h="*".repeat(h.length)),h}function j_1(e){return e.toLowerCase()}var wV5="__rrweb_original__";function _z7(e){var t=e.getContext("2d");if(!t)return!0;for(var r=50,a=0;a<e.width;a+=r)for(var i=0;i<e.height;i+=r){var n=t.getImageData,o=wV5 in n?n[wV5]:n,h=new Uint32Array(o.call(t,a,i,Math.min(r,e.width-a),Math.min(r,e.height-i)).data.buffer);if(h.some(function(u){return u!==0}))return!1}return!0}function Vo0(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?j_1(t):null}function g_5(e,t){var r;try{r=new URL(e,t??window.location.href)}catch{return null}var a=/\.([0-9a-z]+)(?:$)/i,i=r.pathname.match(a),n;return(n=i?.[1])!=null?n:null}function Ez7(e){var t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var Rz7=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Zz7=/^(?:[a-z+]+:)?\/\//i,Fz7=/^www\..*/i,Oz7=/^(data:)([^,]*),(.*)/i;function Po0(e,t){return(e||"").replace(Rz7,function(r,a,i,n,o,h){var u=i||o||h,g=a||n||"";if(!u)return r;if(Zz7.test(u)||Fz7.test(u)||Oz7.test(u))return"url("+g+u+g+")";if(u[0]==="/")return"url("+g+(Ez7(t)+u)+g+")";var f=t.split("/"),v=u.split("/");f.pop();for(var C=Hr(v),L;!(L=C()).done;){var y=L.value;y!=="."&&(y===".."?f.pop():f.push(y))}return"url("+g+f.join("/")+g+")"})}function Dn0(e,t){return t===void 0&&(t=!1),t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function Dz7(e,t,r){r===void 0&&(r=!1);var a=Array.from(t.childNodes),i=[],n=0;if(a.length>1&&e&&typeof e=="string"){for(var o=Dn0(e,r),h=o.length/e.length,u=1;u<a.length;u++)if(a[u].textContent&&typeof a[u].textContent=="string"){for(var g=Dn0(a[u].textContent,r),f=100,v=3;v<g.length&&(g[v].match(/[a-zA-Z0-9]/)||g.indexOf(g.substring(0,v),1)!==-1);v++);for(;v<g.length;v++){var C=g.substring(0,v),L=o.split(C),y=-1;if(L.length===2)y=L[0].length;else if(L.length>2&&L[0]===""&&a[u-1].textContent!=="")y=o.indexOf(C,1);else if(L.length===1){if(C=C.substring(0,C.length-1),L=o.split(C),L.length<=1)return i.push(e),i;v=f+1}else v===g.length-1&&(y=o.indexOf(C));if(L.length>=2&&v>f){var z=a[u-1].textContent;if(z&&typeof z=="string"){var S=Dn0(z).length;y=o.indexOf(C,S)}y===-1&&(y=L[0].length)}if(y!==-1){for(var B=Math.floor(y/h);B>0&&B<e.length;){if(n+=1,n>50*a.length)return i.push(e),i;var R=Dn0(e.substring(0,B),r);if(R.length===y){i.push(e.substring(0,B)),e=e.substring(B),o=o.substring(y);break}else R.length<y?B+=Math.max(1,Math.floor((y-R.length)/h)):B-=Math.max(1,Math.floor((R.length-y)*h))}break}}}}return i.push(e),i}function Iz7(e,t){return Dz7(e,t).join("/* rr_split */")}var Nz7=1,Uz7=new RegExp("[^a-z0-9-_:]"),IM2=-2;function p_5(){return Nz7++}function Gz7(e){if(dl(e,HTMLFormElement))return"form";var t=j_1(e.tagName);return Uz7.test(t)?"div":t}var jQ1,yV5,jz7=/^[^ \t\n\r\u000c]+/,Wz7=/^[, \t\n\r\u000c]+/;function qz7(e,t){if(t.trim()==="")return t;var r=0;function a(g){var f,v=g.exec(t.substring(r));return v?(f=v[0],r+=f.length,f):""}for(var i=[];a(Wz7),!(r>=t.length);){var n=a(jz7);if(n.slice(-1)===",")n=YQ1(e,n.substring(0,n.length-1)),i.push(n);else{var o="";n=YQ1(e,n);for(var h=!1;;){var u=t.charAt(r);if(u===""){i.push((n+o).trim());break}else if(h)u===")"&&(h=!1);else if(u===","){r+=1,i.push((n+o).trim());break}else u==="("&&(h=!0);o+=u,r+=1}}}return i.join(", ")}var AV5=new WeakMap;function YQ1(e,t){return!t||t.trim()===""?t:pD4(e,t)}function $z7(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function pD4(e,t){var r=AV5.get(e);if(r||(r=e.createElement("a"),AV5.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function f_5(e,t,r,a){return a&&(r==="src"||r==="href"&&!(t==="use"&&a[0]==="#")||r==="xlink:href"&&a[0]!=="#"||r==="background"&&(t==="table"||t==="td"||t==="th")?YQ1(e,a):r==="srcset"?qz7(e,a):r==="style"?Po0(a,pD4(e)):t==="object"&&r==="data"?YQ1(e,a):a)}function v_5(e,t,r){return(e==="video"||e==="audio")&&t==="autoplay"}function Kz7(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(var a=e.classList.length;a--;){var i=e.classList[a];if(t.test(i))return!0}if(r)return e.matches(r)}catch{}return!1}function _o0(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?_o0(UO.parentNode(e),t,r):!1;for(var a=e.classList.length;a--;){var i=e.classList[a];if(t.test(i))return!0}return r?_o0(UO.parentNode(e),t,r):!1}function m_5(e,t,r,a){var i;if(h_5(e)){if(i=e,!UO.childNodes(i).length)return!1}else{if(UO.parentElement(e)===null)return!1;i=UO.parentElement(e)}try{if(typeof t=="string"){if(a){if(i.closest("."+t))return!0}else if(i.classList.contains(t))return!0}else if(_o0(i,t,a))return!0;if(r){if(a){if(i.closest(r))return!0}else if(i.matches(r))return!0}}catch{}return!1}function Yz7(e,t,r){var a=e.contentWindow;if(a){var i=!1,n;try{n=a.document.readyState}catch{return}if(n!=="complete"){var o=setTimeout(function(){i||(t(),i=!0)},r);e.addEventListener("load",function(){clearTimeout(o),i=!0,t()});return}var h="about:blank";if(a.location.href!==h||e.src===h||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}}function Xz7(e,t,r){var a=!1,i;try{i=e.sheet}catch{return}if(!i){var n=setTimeout(function(){a||(t(),a=!0)},r);e.addEventListener("load",function(){clearTimeout(n),a=!0,t()})}}function Jz7(e,t){var r=t.doc,a=t.mirror,i=t.blockClass,n=t.blockSelector,o=t.needsMask,h=t.inlineStylesheet,u=t.maskInputOptions,g=u===void 0?{}:u,f=t.maskTextFn,v=t.maskInputFn,C=t.dataURLOptions,L=C===void 0?{}:C,y=t.inlineImages,z=t.recordCanvas,S=t.keepIframeSrcFn,B=t.newlyAddedElement,R=B===void 0?!1:B,F=t.cssCaptured,N=F===void 0?!1:F,j=Qz7(r,a);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:OV.Document,childNodes:[],compatMode:e.compatMode}:{type:OV.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:OV.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:j};case e.ELEMENT_NODE:return eb7(e,{doc:r,blockClass:i,blockSelector:n,inlineStylesheet:h,maskInputOptions:g,maskInputFn:v,dataURLOptions:L,inlineImages:y,recordCanvas:z,keepIframeSrcFn:S,newlyAddedElement:R,rootId:j});case e.TEXT_NODE:return tb7(e,{doc:r,needsMask:o,maskTextFn:f,rootId:j,cssCaptured:N});case e.CDATA_SECTION_NODE:return{type:OV.CDATA,textContent:"",rootId:j};case e.COMMENT_NODE:return{type:OV.Comment,textContent:UO.textContent(e)||"",rootId:j};default:return!1}}function Qz7(e,t){if(t.hasNode(e)){var r=t.getId(e);return r===1?void 0:r}}function tb7(e,t){var r=t.needsMask,a=t.maskTextFn,i=t.rootId,n=t.cssCaptured,o=UO.parentNode(e),h=o&&o.tagName,u="",g=h==="STYLE"?!0:void 0,f=h==="SCRIPT"?!0:void 0;return f?u="SCRIPT_PLACEHOLDER":n||(u=UO.textContent(e),g&&u&&(u=Po0(u,pD4(t.doc)))),!g&&!f&&u&&r&&(u=a?a(u,UO.parentElement(e)):u.replace(/[\S]/g,"*")),{type:OV.Text,textContent:u||"",rootId:i}}function eb7(e,t){for(var r=t.doc,a=t.blockClass,i=t.blockSelector,n=t.inlineStylesheet,o=t.maskInputOptions,h=o===void 0?{}:o,u=t.maskInputFn,g=t.dataURLOptions,f=g===void 0?{}:g,v=t.inlineImages,C=t.recordCanvas,L=t.keepIframeSrcFn,y=t.newlyAddedElement,z=y===void 0?!1:y,S=t.rootId,B=Kz7(e,a,i),R=Gz7(e),F={},N=e.attributes.length,j=0;j<N;j++){var Y=e.attributes[j];v_5(R,Y.name,Y.value)||(F[Y.name]=f_5(r,R,j_1(Y.name),Y.value))}if(R==="link"&&n){var t1=Array.from(r.styleSheets).find(function(x2){return x2.href===e.href}),n1=null;t1&&(n1=eO4(t1)),n1&&(delete F.rel,delete F.href,F._cssText=n1)}if(R==="style"&&e.sheet){var a1=eO4(e.sheet);a1&&(e.childNodes.length>1&&(a1=Iz7(a1,e)),F._cssText=a1)}if(R==="input"||R==="textarea"||R==="select"){var s1=e.value,p1=e.checked;F.type!=="radio"&&F.type!=="checkbox"&&F.type!=="submit"&&F.type!=="button"&&s1?F.value=Bo0({element:e,type:Vo0(e),tagName:R,value:s1,maskInputOptions:h,maskInputFn:u}):p1&&(F.checked=p1)}if(R==="option"&&(e.selected&&!h.select?F.selected=!0:delete F.selected),R==="dialog"&&e.open&&(F.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),R==="canvas"&&C){if(e.__context==="2d")_z7(e)||(F.rr_dataURL=e.toDataURL(f.type,f.quality));else if(!("__context"in e)){var u1=e.toDataURL(f.type,f.quality),v1=r.createElement("canvas");v1.width=e.width,v1.height=e.height;var h1=v1.toDataURL(f.type,f.quality);u1!==h1&&(F.rr_dataURL=u1)}}if(R==="img"&&v){jQ1||(jQ1=r.createElement("canvas"),yV5=jQ1.getContext("2d"));var H1=e,z1=H1.currentSrc||H1.getAttribute("src")||"<unknown-src>",b1=H1.crossOrigin,m1=function(){H1.removeEventListener("load",m1);try{jQ1.width=H1.naturalWidth,jQ1.height=H1.naturalHeight,yV5.drawImage(H1,0,0),F.rr_dataURL=jQ1.toDataURL(f.type,f.quality)}catch(x2){if(H1.crossOrigin!=="anonymous"){H1.crossOrigin="anonymous",H1.complete&&H1.naturalWidth!==0?m1():H1.addEventListener("load",m1);return}else console.warn("Cannot inline img src="+z1+"! Error: "+x2)}H1.crossOrigin==="anonymous"&&(b1?F.crossOrigin=b1:H1.removeAttribute("crossorigin"))};H1.complete&&H1.naturalWidth!==0?m1():H1.addEventListener("load",m1)}if(R==="audio"||R==="video"){var T1=F;T1.rr_mediaState=e.paused?"paused":"played",T1.rr_mediaCurrentTime=e.currentTime,T1.rr_mediaPlaybackRate=e.playbackRate,T1.rr_mediaMuted=e.muted,T1.rr_mediaLoop=e.loop,T1.rr_mediaVolume=e.volume}if(z||(e.scrollLeft&&(F.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(F.rr_scrollTop=e.scrollTop)),B){var G1=e.getBoundingClientRect(),Z1=G1.width,J1=G1.height;F={class:F.class,rr_width:""+Z1+"px",rr_height:""+J1+"px"}}R==="iframe"&&!L(F.src)&&(e.contentDocument||(F.rr_src=F.src),delete F.src);var n2;try{customElements.get(R)&&(n2=!0)}catch{}return{type:OV.Element,tagName:R,attributes:F,childNodes:[],isSVG:$z7(e)||void 0,needBlock:B,rootId:S,isCustom:n2}}function Vw(e){return e==null?"":e.toLowerCase()}function rb7(e,t){if(t.comment&&e.type===OV.Comment)return!0;if(e.type===OV.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&g_5(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(Vw(e.attributes.name).match(/^msapplication-tile(image|color)$/)||Vw(e.attributes.name)==="application-name"||Vw(e.attributes.rel)==="icon"||Vw(e.attributes.rel)==="apple-touch-icon"||Vw(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&Vw(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(Vw(e.attributes.property).match(/^(og|twitter|fb):/)||Vw(e.attributes.name).match(/^(og|twitter):/)||Vw(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(Vw(e.attributes.name)==="robots"||Vw(e.attributes.name)==="googlebot"||Vw(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(Vw(e.attributes.name)==="author"||Vw(e.attributes.name)==="generator"||Vw(e.attributes.name)==="framework"||Vw(e.attributes.name)==="publisher"||Vw(e.attributes.name)==="progid"||Vw(e.attributes.property).match(/^article:/)||Vw(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(Vw(e.attributes.name)==="google-site-verification"||Vw(e.attributes.name)==="yandex-verification"||Vw(e.attributes.name)==="csrf-token"||Vw(e.attributes.name)==="p:domain_verify"||Vw(e.attributes.name)==="verify-v1"||Vw(e.attributes.name)==="verification"||Vw(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function XQ1(e,t){var r=t.doc,a=t.mirror,i=t.blockClass,n=t.blockSelector,o=t.maskTextClass,h=t.maskTextSelector,u=t.skipChild,g=u===void 0?!1:u,f=t.inlineStylesheet,v=f===void 0?!0:f,C=t.maskInputOptions,L=C===void 0?{}:C,y=t.maskTextFn,z=t.maskInputFn,S=t.slimDOMOptions,B=t.dataURLOptions,R=B===void 0?{}:B,F=t.inlineImages,N=F===void 0?!1:F,j=t.recordCanvas,Y=j===void 0?!1:j,t1=t.onSerialize,n1=t.onIframeLoad,a1=t.iframeLoadTimeout,s1=a1===void 0?5e3:a1,p1=t.onStylesheetLoad,u1=t.stylesheetLoadTimeout,v1=u1===void 0?5e3:u1,h1=t.keepIframeSrcFn,H1=h1===void 0?function(){return!1}:h1,z1=t.newlyAddedElement,b1=z1===void 0?!1:z1,m1=t.cssCaptured,T1=m1===void 0?!1:m1,G1=t.needsMask,Z1=t.preserveWhiteSpace,J1=Z1===void 0?!0:Z1;if(!G1){var n2=G1===void 0;G1=m_5(e,o,h,n2)}var x2=Jz7(e,{doc:r,mirror:a,blockClass:i,blockSelector:n,needsMask:G1,inlineStylesheet:v,maskInputOptions:L,maskTextFn:y,maskInputFn:z,dataURLOptions:R,inlineImages:N,recordCanvas:Y,keepIframeSrcFn:H1,newlyAddedElement:b1,cssCaptured:T1});if(!x2)return console.warn(e,"not serialized"),null;var L2;a.hasNode(e)?L2=a.getId(e):rb7(x2,S)||!J1&&x2.type===OV.Text&&!x2.textContent.replace(/^\s+|\s+$/gm,"").length?L2=IM2:L2=p_5();var K2=Object.assign(x2,{id:L2});if(a.add(e,K2),L2===IM2)return null;t1&&t1(e);var M2=!g;if(K2.type===OV.Element){M2=M2&&!K2.needBlock,delete K2.needBlock;var w2=UO.shadowRoot(e);w2&&PM2(w2)&&(K2.isShadowHost=!0)}if((K2.type===OV.Document||K2.type===OV.Element)&&M2){S.headWhitespace&&K2.type===OV.Element&&K2.tagName==="head"&&(J1=!1);var b2={doc:r,mirror:a,blockClass:i,blockSelector:n,needsMask:G1,maskTextClass:o,maskTextSelector:h,skipChild:g,inlineStylesheet:v,maskInputOptions:L,maskTextFn:y,maskInputFn:z,slimDOMOptions:S,dataURLOptions:R,inlineImages:N,recordCanvas:Y,preserveWhiteSpace:J1,onSerialize:t1,onIframeLoad:n1,iframeLoadTimeout:s1,onStylesheetLoad:p1,stylesheetLoadTimeout:v1,keepIframeSrcFn:H1,cssCaptured:!1};if(!(K2.type===OV.Element&&K2.tagName==="textarea"&&K2.attributes.value!==void 0)){K2.type===OV.Element&&K2.attributes._cssText!==void 0&&typeof K2.attributes._cssText=="string"&&(b2.cssCaptured=!0);for(var v2=Hr(Array.from(UO.childNodes(e))),a2;!(a2=v2()).done;){var Y1=a2.value,u2=XQ1(Y1,b2);u2&&K2.childNodes.push(u2)}}var _1=null;if(h_5(e)&&(_1=UO.shadowRoot(e)))for(var S2=Hr(Array.from(UO.childNodes(_1))),o2;!(o2=S2()).done;){var e2=o2.value,P1=XQ1(e2,b2);P1&&(PM2(_1)&&(P1.isShadow=!0),K2.childNodes.push(P1))}}var H2=UO.parentNode(e);return H2&&VM2(H2)&&PM2(H2)&&(K2.isShadow=!0),K2.type===OV.Element&&K2.tagName==="iframe"&&Yz7(e,function(){var F2=e.contentDocument;if(F2&&n1){var m0=XQ1(F2,{doc:F2,mirror:a,blockClass:i,blockSelector:n,needsMask:G1,maskTextClass:o,maskTextSelector:h,skipChild:!1,inlineStylesheet:v,maskInputOptions:L,maskTextFn:y,maskInputFn:z,slimDOMOptions:S,dataURLOptions:R,inlineImages:N,recordCanvas:Y,preserveWhiteSpace:J1,onSerialize:t1,onIframeLoad:n1,iframeLoadTimeout:s1,onStylesheetLoad:p1,stylesheetLoadTimeout:v1,keepIframeSrcFn:H1});m0&&n1(e,m0)}},s1),K2.type===OV.Element&&K2.tagName==="link"&&typeof K2.attributes.rel=="string"&&(K2.attributes.rel==="stylesheet"||K2.attributes.rel==="preload"&&typeof K2.attributes.href=="string"&&g_5(K2.attributes.href)==="css")&&Xz7(e,function(){if(p1){var F2=XQ1(e,{doc:r,mirror:a,blockClass:i,blockSelector:n,needsMask:G1,maskTextClass:o,maskTextSelector:h,skipChild:!1,inlineStylesheet:v,maskInputOptions:L,maskTextFn:y,maskInputFn:z,slimDOMOptions:S,dataURLOptions:R,inlineImages:N,recordCanvas:Y,preserveWhiteSpace:J1,onSerialize:t1,onIframeLoad:n1,iframeLoadTimeout:s1,onStylesheetLoad:p1,stylesheetLoadTimeout:v1,keepIframeSrcFn:H1});F2&&p1(e,F2)}},v1),K2}function ab7(e,t){var r=t||{},a=r.mirror,i=a===void 0?new u_5:a,n=r.blockClass,o=n===void 0?"rr-block":n,h=r.blockSelector,u=h===void 0?null:h,g=r.maskTextClass,f=g===void 0?"rr-mask":g,v=r.maskTextSelector,C=v===void 0?null:v,L=r.inlineStylesheet,y=L===void 0?!0:L,z=r.inlineImages,S=z===void 0?!1:z,B=r.recordCanvas,R=B===void 0?!1:B,F=r.maskAllInputs,N=F===void 0?!1:F,j=r.maskTextFn,Y=r.maskInputFn,t1=r.slimDOM,n1=t1===void 0?!1:t1,a1=r.dataURLOptions,s1=r.preserveWhiteSpace,p1=r.onSerialize,u1=r.onIframeLoad,v1=r.iframeLoadTimeout,h1=r.onStylesheetLoad,H1=r.stylesheetLoadTimeout,z1=r.keepIframeSrcFn,b1=z1===void 0?function(){return!1}:z1,m1=N===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0,hidden:!0}:N===!1?{password:!0}:N,T1=n1===!0||n1==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:n1==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:n1===!1?{}:n1;return XQ1(e,{doc:e,mirror:i,blockClass:o,blockSelector:u,maskTextClass:f,maskTextSelector:C,skipChild:!1,inlineStylesheet:y,maskInputOptions:m1,maskTextFn:j,maskInputFn:Y,slimDOMOptions:T1,dataURLOptions:a1,inlineImages:S,recordCanvas:R,preserveWhiteSpace:s1,onSerialize:p1,onIframeLoad:u1,iframeLoadTimeout:v1,onStylesheetLoad:h1,stylesheetLoadTimeout:H1,keepIframeSrcFn:b1,newlyAddedElement:!1})}function ib7(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function nb7(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function a(){return dl(this,a)?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(a){var i=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(r,a,i.get?i:{enumerable:!0,get:function(){return e[a]}})}),r}var fD4={exports:{}},Py=String,C_5=function(){return{isColorSupported:!1,reset:Py,bold:Py,dim:Py,italic:Py,underline:Py,inverse:Py,hidden:Py,strikethrough:Py,black:Py,red:Py,green:Py,yellow:Py,blue:Py,magenta:Py,cyan:Py,white:Py,gray:Py,bgBlack:Py,bgRed:Py,bgGreen:Py,bgYellow:Py,bgBlue:Py,bgMagenta:Py,bgCyan:Py,bgWhite:Py}};fD4.exports=C_5();fD4.exports.createColors=C_5;var ob7=fD4.exports,lb7={},cb7=Object.freeze(Object.defineProperty({__proto__:null,default:lb7},Symbol.toStringTag,{value:"Module"})),Ak=nb7(cb7),zV5=ob7,bV5=Ak,rO4=(function(e){cz(t,e);function t(a,i,n,o,h,u){var g;return g=e.call(this,a)||this,g.name="CssSyntaxError",g.reason=a,h&&(g.file=h),o&&(g.source=o),u&&(g.plugin=u),typeof i<"u"&&typeof n<"u"&&(typeof i=="number"?(g.line=i,g.column=n):(g.line=i.line,g.column=i.column,g.endLine=n.line,g.endColumn=n.column)),g.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(g,t),g}var r=t.prototype;return r.setMessage=function(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason},r.showSourceCode=function(i){var n=this;if(!this.source)return"";var o=this.source;i==null&&(i=zV5.isColorSupported),bV5&&i&&(o=bV5(o));var h=o.split(/\r?\n/),u=Math.max(this.line-3,0),g=Math.min(this.line+2,h.length),f=String(g).length,v,C;if(i){var L=zV5.createColors(!0),y=L.bold,z=L.gray,S=L.red;v=function(B){return y(S(B))},C=function(B){return z(B)}}else v=C=function(B){return B};return h.slice(u,g).map(function(B,R){var F=u+1+R,N=" "+(" "+F).slice(-f)+" | ";if(F===n.line){var j=C(N.replace(/\d/g," "))+B.slice(0,n.column-1).replace(/[^\t]/g," ");return v(">")+C(N)+B+`
|
|
9899
9899
|
`+j+v("^")}return" "+C(N)+B}).join(`
|
|
@@ -9996,7 +9996,7 @@ End of stack for Error object`:u.name+": "+u.message}return u});function n(h){re
|
|
|
9996
9996
|
`+C+"]":"["+L.join(",")+"]",o=C,f}for(g in y)Sl0.call(y,g)&&(f=a(g,y),f&&L.push(r(g)+(o?": ":":")+f));return f=L.length===0?"{}":o?"{"+L.join(",")+C+"}":"{"+L.join(",")+"}",o=C,f}};return a("",{"":t})}})();d4.JSONDecode=(function(){var e,t,r={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
9997
9997
|
`,r:"\r",t:" "},a,i=function(L){var y=new SyntaxError(L);throw y.at=e,y.text=a,y},n=function(L){return L&&L!==t&&i("Expected '"+L+"' instead of '"+t+"'"),t=a.charAt(e),e+=1,t},o=function(){var L,y="";for(t==="-"&&(y="-",n("-"));t>="0"&&t<="9";)y+=t,n();if(t===".")for(y+=".";n()&&t>="0"&&t<="9";)y+=t;if(t==="e"||t==="E")for(y+=t,n(),(t==="-"||t==="+")&&(y+=t,n());t>="0"&&t<="9";)y+=t,n();if(L=+y,!isFinite(L))i("Bad number");else return L},h=function(){var L,y,z="",S;if(t==='"')for(;n();){if(t==='"')return n(),z;if(t==="\\")if(n(),t==="u"){for(S=0,y=0;y<4&&(L=parseInt(n(),16),!!isFinite(L));y+=1)S=S*16+L;z+=String.fromCharCode(S)}else if(typeof r[t]=="string")z+=r[t];else break;else z+=t}i("Bad string")},u=function(){for(;t&&t<=" ";)n()},g=function(){switch(t){case"t":return n("t"),n("r"),n("u"),n("e"),!0;case"f":return n("f"),n("a"),n("l"),n("s"),n("e"),!1;case"n":return n("n"),n("u"),n("l"),n("l"),null}i('Unexpected "'+t+'"')},f,v=function(){var L=[];if(t==="["){if(n("["),u(),t==="]")return n("]"),L;for(;t;){if(L.push(f()),u(),t==="]")return n("]"),L;n(","),u()}}i("Bad array")},C=function(){var L,y={};if(t==="{"){if(n("{"),u(),t==="}")return n("}"),y;for(;t;){if(L=h(),u(),n(":"),Object.hasOwnProperty.call(y,L)&&i('Duplicate key "'+L+'"'),y[L]=f(),u(),t==="}")return n("}"),y;n(","),u()}}i("Bad object")};return f=function(){switch(u(),t){case"{":return C();case"[":return v();case'"':return h();case"-":return o();default:return t>="0"&&t<="9"?o():g()}},function(L){var y;return a=L,e=0,t=" ",y=f(),u(),t&&i("Syntax error"),y}})();d4.base64Encode=function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r,a,i,n,o,h,u,g,f=0,v=0,C="",L=[];if(!e)return e;e=d4.utf8Encode(e);do r=e.charCodeAt(f++),a=e.charCodeAt(f++),i=e.charCodeAt(f++),g=r<<16|a<<8|i,n=g>>18&63,o=g>>12&63,h=g>>6&63,u=g&63,L[v++]=t.charAt(n)+t.charAt(o)+t.charAt(h)+t.charAt(u);while(f<e.length);switch(C=L.join(""),e.length%3){case 1:C=C.slice(0,-2)+"==";break;case 2:C=C.slice(0,-1)+"=";break}return C};d4.utf8Encode=function(e){e=(e+"").replace(/\r\n/g,`
|
|
9998
9998
|
`).replace(/\r/g,`
|
|
9999
|
-
`);var t="",r,a,i=0,n;for(r=a=0,i=e.length,n=0;n<i;n++){var o=e.charCodeAt(n),h=null;o<128?a++:o>127&&o<2048?h=String.fromCharCode(o>>6|192,o&63|128):h=String.fromCharCode(o>>12|224,o>>6&63|128,o&63|128),h!==null&&(a>r&&(t+=e.substring(r,a)),t+=h,r=a=n+1)}return a>r&&(t+=e.substring(r,e.length)),t};d4.UUID=function(){try{return n7.crypto.randomUUID()}catch{for(var e=new Array(36),t=0;t<36;t++)e[t]=Math.floor(Math.random()*16);return e[14]=4,e[19]=e[19]&=-5,e[19]=e[19]|=8,e[8]=e[13]=e[18]=e[23]="-",d4.map(e,function(a){return a.toString(16)}).join("")}};var qP5=["ahrefsbot","ahrefssiteaudit","amazonbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandex","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];d4.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<qP5.length;t++)if(e.indexOf(qP5[t])!==-1)return!0;return!1};d4.HTTPBuildQuery=function(e,t){var r,a,i=[];return d4.isUndefined(t)&&(t="&"),d4.each(e,function(n,o){r=encodeURIComponent(n.toString()),a=encodeURIComponent(o),i[i.length]=a+"="+r}),i.join(t)};d4.getQueryParam=function(e,t){t=t.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var r="[\\?&]"+t+"=([^&#]*)",a=new RegExp(r),i=a.exec(e);if(i===null||i&&typeof i[1]!="string"&&i[1].length)return"";var n=i[1];try{n=decodeURIComponent(n)}catch{jd.error("Skipping decoding for malformed query param: "+n)}return n.replace(/\+/g," ")};d4.cookie={get:function(e){for(var t=e+"=",r=Hh.cookie.split(";"),a=0;a<r.length;a++){for(var i=r[a];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}return null},parse:function(e){var t;try{t=d4.JSONDecode(d4.cookie.get(e))||{}}catch{}return t},set_seconds:function(e,t,r,a,i,n,o){var h="",u="",g="";if(o)h="; domain="+o;else if(a){var f=$P5(Hh.location.hostname);h=f?"; domain=."+f:""}if(r){var v=new Date;v.setTime(v.getTime()+r*1e3),u="; expires="+v.toGMTString()}n&&(i=!0,g="; SameSite=None"),i&&(g+="; secure"),Hh.cookie=e+"="+encodeURIComponent(t)+u+"; path=/"+h+g},set:function(e,t,r,a,i,n,o){var h="",u="",g="";if(o)h="; domain="+o;else if(a){var f=$P5(Hh.location.hostname);h=f?"; domain=."+f:""}if(r){var v=new Date;v.setTime(v.getTime()+r*24*60*60*1e3),u="; expires="+v.toGMTString()}n&&(i=!0,g="; SameSite=None"),i&&(g+="; secure");var C=e+"="+encodeURIComponent(t)+u+"; path=/"+h+g;return Hh.cookie=C,C},remove:function(e,t,r){d4.cookie.set(e,"",-1,t,!1,!1,r)}};var IR5=function(e){var t=!0;try{var r="__mplss_"+$D4(8),a="xyz";e.setItem(r,a),e.getItem(r)!==a&&(t=!1),e.removeItem(r)}catch{t=!1}return t},KF4=null,rx2=function(e,t){return KF4!==null&&!t?KF4:KF4=IR5(e||n7.localStorage)},YF4=null,eP7=function(e,t){return YF4!==null&&!t?YF4:YF4=IR5(e||n7.sessionStorage)};function NR5(e,t,r){var a=function(i){jd.error(t+" error: "+i)};return{is_supported:function(i){var n=r(e,i);return n||jd.error(t+" unsupported"),n},error:a,get:function(i){try{return e.getItem(i)}catch(n){a(n)}return null},parse:function(i){try{return d4.JSONDecode(e.getItem(i))||{}}catch{}return null},set:function(i,n){try{e.setItem(i,n)}catch(o){a(o)}},remove:function(i){try{e.removeItem(i)}catch(n){a(n)}}}}var UR5=null,GR5=null;try{UR5=n7.localStorage,GR5=n7.sessionStorage}catch{}d4.localStorage=NR5(UR5,"localStorage",rx2);d4.sessionStorage=NR5(GR5,"sessionStorage",eP7);d4.register_event=(function(){var e=function(a,i,n,o,h){if(!a){jd.error("No valid element provided to register_event");return}if(a.addEventListener&&!o)a.addEventListener(i,n,!!h);else{var u="on"+i,g=a[u];a[u]=t(a,n,g)}};function t(a,i,n){var o=function(h){if(h=h||r(n7.event),!!h){var u=!0,g,f;return d4.isFunction(n)&&(g=n(h)),f=i.call(a,h),(g===!1||f===!1)&&(u=!1),u}};return o}function r(a){return a&&(a.preventDefault=r.preventDefault,a.stopPropagation=r.stopPropagation),a}return r.preventDefault=function(){this.returnValue=!1},r.stopPropagation=function(){this.cancelBubble=!0},e})();var rP7=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');d4.dom_query=(function(){function e(i){return i.all?i.all:i.getElementsByTagName("*")}var t=/[\t\r\n]/g;function r(i,n){var o=" "+n+" ";return(" "+i.className+" ").replace(t," ").indexOf(o)>=0}function a(i){if(!Hh.getElementsByTagName)return[];var n=i.split(" "),o,h,u,g,f,v,C,L,y,z,S=[Hh];for(v=0;v<n.length;v++){if(o=n[v].replace(/^\s+/,"").replace(/\s+$/,""),o.indexOf("#")>-1){h=o.split("#"),u=h[0];var B=h[1],R=Hh.getElementById(B);if(!R||u&&R.nodeName.toLowerCase()!=u)return[];S=[R];continue}if(o.indexOf(".")>-1){h=o.split("."),u=h[0];var F=h[1];for(u||(u="*"),g=[],f=0,C=0;C<S.length;C++)for(u=="*"?y=e(S[C]):y=S[C].getElementsByTagName(u),L=0;L<y.length;L++)g[f++]=y[L];for(S=[],z=0,C=0;C<g.length;C++)g[C].className&&d4.isString(g[C].className)&&r(g[C],F)&&(S[z++]=g[C]);continue}var N=o.match(rP7);if(N){u=N[1];var j=N[2],Y=N[3],t1=N[4];for(u||(u="*"),g=[],f=0,C=0;C<S.length;C++)for(u=="*"?y=e(S[C]):y=S[C].getElementsByTagName(u),L=0;L<y.length;L++)g[f++]=y[L];S=[],z=0;var n1;switch(Y){case"=":n1=function(a1){return a1.getAttribute(j)==t1};break;case"~":n1=function(a1){return a1.getAttribute(j).match(new RegExp("\\b"+t1+"\\b"))};break;case"|":n1=function(a1){return a1.getAttribute(j).match(new RegExp("^"+t1+"-?"))};break;case"^":n1=function(a1){return a1.getAttribute(j).indexOf(t1)===0};break;case"$":n1=function(a1){return a1.getAttribute(j).lastIndexOf(t1)==a1.getAttribute(j).length-t1.length};break;case"*":n1=function(a1){return a1.getAttribute(j).indexOf(t1)>-1};break;default:n1=function(a1){return a1.getAttribute(j)}}for(S=[],z=0,C=0;C<g.length;C++)n1(g[C])&&(S[z++]=g[C]);continue}for(u=o,g=[],f=0,C=0;C<S.length;C++)for(y=S[C].getElementsByTagName(u),L=0;L<y.length;L++)g[f++]=y[L];S=g}return S}return function(i){return d4.isElement(i)?[i]:d4.isObject(i)&&!d4.isUndefined(i.length)?i:a.call(this,i)}})();var aP7=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],iP7=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];d4.info={campaignParams:function(e){var t="",r={};return d4.each(aP7,function(a){t=d4.getQueryParam(Hh.URL,a),t.length?r[a]=t:e!==void 0&&(r[a]=e)}),r},clickParams:function(){var e="",t={};return d4.each(iP7,function(r){e=d4.getQueryParam(Hh.URL,r),e.length&&(t[r]=e)}),t},marketingParams:function(){return d4.extend(d4.info.campaignParams(),d4.info.clickParams())},searchEngine:function(e){return e.search("https?://(.*)google.([^/?]*)")===0?"google":e.search("https?://(.*)bing.com")===0?"bing":e.search("https?://(.*)yahoo.com")===0?"yahoo":e.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(e){var t=d4.info.searchEngine(e),r=t!="yahoo"?"q":"p",a={};if(t!==null){a.$search_engine=t;var i=d4.getQueryParam(e,r);i.length&&(a.mp_keyword=i)}return a},browser:function(e,t,r){return t=t||"",r||d4.includes(e," OPR/")?d4.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":d4.includes(e,"IEMobile")||d4.includes(e,"WPDesktop")?"Internet Explorer Mobile":d4.includes(e,"SamsungBrowser/")?"Samsung Internet":d4.includes(e,"Edge")||d4.includes(e,"Edg/")?"Microsoft Edge":d4.includes(e,"FBIOS")?"Facebook Mobile":d4.includes(e,"Whale/")?"Whale Browser":d4.includes(e,"Chrome")?"Chrome":d4.includes(e,"CriOS")?"Chrome iOS":d4.includes(e,"UCWEB")||d4.includes(e,"UCBrowser")?"UC Browser":d4.includes(e,"FxiOS")?"Firefox iOS":d4.includes(t,"Apple")?d4.includes(e,"Mobile")?"Mobile Safari":"Safari":d4.includes(e,"Android")?"Android Mobile":d4.includes(e,"Konqueror")?"Konqueror":d4.includes(e,"Firefox")?"Firefox":d4.includes(e,"MSIE")||d4.includes(e,"Trident/")?"Internet Explorer":d4.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,r){var a=d4.info.browser(e,t,r),i={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/,"Whale Browser":/Whale\/(\d+(\.\d+)?)/},n=i[a];if(n===void 0)return null;var o=e.match(n);return o?parseFloat(o[o.length-2]):null},os:function(){var e=F91;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":""},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)?"Android":""},referringDomain:function(e){var t=e.split("/");return t.length>=3?t[2]:""},currentUrl:function(){return n7.location.href},properties:function(e){return typeof e!="object"&&(e={}),d4.extend(d4.strip_empty_properties({$os:d4.info.os(),$browser:d4.info.browser(F91,Xh1.vendor,BM2),$referrer:Hh.referrer,$referring_domain:d4.info.referringDomain(Hh.referrer),$device:d4.info.device(F91)}),{$current_url:d4.info.currentUrl(),$browser_version:d4.info.browserVersion(F91,Xh1.vendor,BM2),$screen_height:UP5.height,$screen_width:UP5.width,mp_lib:"web",$lib_version:LW.LIB_VERSION,$insert_id:$D4(),time:d4.timestamp()/1e3},d4.strip_empty_properties(e))},people_properties:function(){return d4.extend(d4.strip_empty_properties({$os:d4.info.os(),$browser:d4.info.browser(F91,Xh1.vendor,BM2)}),{$browser_version:d4.info.browserVersion(F91,Xh1.vendor,BM2)})},mpPageViewProperties:function(){return d4.strip_empty_properties({current_page_title:Hh.title,current_domain:n7.location.hostname,current_url_path:n7.location.pathname,current_url_protocol:n7.location.protocol,current_url_search:n7.location.search})}};var nP7=function(e,t){var r=null,a=[];return function(i){var n=this;return a.push(i),r||(r=new hf(function(o){setTimeout(function(){var h=e.apply(n,[a]);r=null,a=[],o(h)},t)})),r}},$D4=function(e){var t=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return e?t.substring(0,e):t},jR5=function(){var e=d4.UUID().replace(/-/g,""),t=d4.UUID().replace(/-/g,"").substring(0,16),r="01";return"00-"+e+"-"+t+"-"+r},oP7=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,lP7=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,$P5=function(e){var t=lP7,r=e.split("."),a=r[r.length-1];(a.length>4||a==="com"||a==="org")&&(t=oP7);var i=e.match(t);return i?i[0]:""},cP7=function(){var e=n7.navigator.onLine;return d4.isUndefined(e)||e},zL1=function(){},g12=null,Xo0=null;typeof JSON<"u"&&(g12=JSON.stringify,Xo0=JSON.parse);g12=g12||d4.JSONEncode;Xo0=Xo0||d4.JSONDecode;var sP7=function(e,t,r){if(!n7.CompressionStream)return!1;var a=d4.info.browser(e,t,r),i=d4.info.browserVersion(e,t,r);return!((a==="Safari"||a==="Mobile Safari")&&i>=16.4&&i<16.6)};d4.info=d4.info;d4.info.browser=d4.info.browser;d4.info.browserVersion=d4.info.browserVersion;d4.info.device=d4.info.device;d4.info.properties=d4.info.properties;d4.isBlockedUA=d4.isBlockedUA;d4.isEmptyObject=d4.isEmptyObject;d4.isObject=d4.isObject;d4.JSONDecode=d4.JSONDecode;d4.JSONEncode=d4.JSONEncode;d4.toArray=d4.toArray;d4.NPO=EL1;var hP7="mixpanelBrowserDb",WR5="mixpanelRecordingEvents",KD4="mixpanelRecordingRegistry",dP7=1,uP7=[WR5,KD4],o61=function(e){this.dbPromise=null,this.storeName=e};o61.prototype._openDb=function(){return new hf(function(e,t){var r=n7.indexedDB.open(hP7,dP7);r.onerror=function(){t(r.error)},r.onsuccess=function(){e(r.result)},r.onupgradeneeded=function(a){var i=a.target.result;uP7.forEach(function(n){i.createObjectStore(n)})}})};o61.prototype.init=function(){return n7.indexedDB?(this.dbPromise||(this.dbPromise=this._openDb()),this.dbPromise.then(function(e){return e instanceof n7.IDBDatabase?hf.resolve():hf.reject(e)})):hf.reject("indexedDB is not supported in this browser")};o61.prototype.isInitialized=function(){return!!this.dbPromise};o61.prototype.makeTransaction=function(e,t){var r=this.storeName,a=function(i){return new hf(function(n,o){var h=i.transaction(r,e);h.oncomplete=function(){n(h)},h.onabort=h.onerror=function(){o(h.error)},t(h.objectStore(r))})};return this.dbPromise.then(a).catch(function(i){return i&&i.name==="InvalidStateError"?(this.dbPromise=this._openDb(),this.dbPromise.then(a)):hf.reject(i)}.bind(this))};o61.prototype.setItem=function(e,t){return this.makeTransaction("readwrite",function(r){r.put(t,e)})};o61.prototype.getItem=function(e){var t;return this.makeTransaction("readonly",function(r){t=r.get(e)}).then(function(){return t.result})};o61.prototype.removeItem=function(e){return this.makeTransaction("readwrite",function(t){t.delete(e)})};o61.prototype.getAll=function(){var e;return this.makeTransaction("readonly",function(t){e=t.getAll()}).then(function(){return e.result})};var gP7="__mp_opt_in_out_";function pP7(e,t){KR5(!0,e,t)}function fP7(e,t){KR5(!1,e,t)}function vP7(e,t){return $R5(e,t)==="1"}function qR5(e,t){if(CP7(t))return jd.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var r=$R5(e,t)==="0";return r&&jd.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),r}function RL1(e){return JD4(e,function(t){return this.get_config(t)})}function ZL1(e){return JD4(e,function(t){return this._get_config(t)})}function v12(e){return JD4(e,function(t){return this._get_config(t)})}function mP7(e,t){t=t||{},YD4(t).remove(XD4(e,t),!!t.crossSubdomainCookie,t.cookieDomain)}function YD4(e){return e=e||{},e.persistenceType==="localStorage"?d4.localStorage:d4.cookie}function XD4(e,t){return t=t||{},(t.persistencePrefix||gP7)+e}function $R5(e,t){return YD4(t).get(XD4(e,t))}function CP7(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||n7,r=t.navigator||{},a=!1;return d4.each([r.doNotTrack,r.msDoNotTrack,t.doNotTrack],function(i){d4.includes([!0,1,"1","yes"],i)&&(a=!0)}),a}function KR5(e,t,r){if(!d4.isString(t)||!t.length){jd.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token");return}r=r||{},YD4(r).set(XD4(t,r),e?1:0,d4.isNumber(r.cookieExpiration)?r.cookieExpiration:null,!!r.crossSubdomainCookie,!!r.secureCookie,!!r.crossSiteCookie,r.cookieDomain),r.track&&e&&r.track(r.trackEventName||"$opt_in",r.trackProperties,{send_immediately:!0})}function JD4(e,t){return function(){var r=!1;try{var a=t.call(this,"token"),i=t.call(this,"ignore_dnt"),n=t.call(this,"opt_out_tracking_persistence_type"),o=t.call(this,"opt_out_tracking_cookie_prefix"),h=t.call(this,"window");a&&(r=qR5(a,{ignoreDnt:i,persistenceType:n,persistencePrefix:o,window:h}))}catch(g){jd.error("Unexpected error when checking tracking opt-out status: "+g)}if(!r)return e.apply(this,arguments);var u=arguments[arguments.length-1];typeof u=="function"&&u(0)}}var MP7=J_1("lock"),YR5=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||n7.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3,this.promiseImpl=t.promiseImpl||hf};YR5.prototype.withLock=function(e,t){var r=this.promiseImpl;return new r(d4.bind(function(a,i){var n=t||new Date().getTime()+"|"+Math.random(),o=new Date().getTime(),h=this.storageKey,u=this.pollIntervalMS,g=this.timeoutMS,f=this.storage,v=h+":X",C=h+":Y",L=h+":Z",y=function(F){if(new Date().getTime()-o>g){MP7.error("Timeout waiting for mutex on "+h+"; clearing lock. ["+n+"]"),f.removeItem(L),f.removeItem(C),B();return}setTimeout(function(){try{F()}catch(N){i(N)}},u*(Math.random()+.1))},z=function(F,N){F()?N():y(function(){z(F,N)})},S=function(){var F=f.getItem(C);return F&&F!==n?!1:(f.setItem(C,n),f.getItem(C)===n?!0:(rx2(f,!0)||i(new Error("localStorage support dropped while acquiring lock")),!1))},B=function(){f.setItem(v,n),z(S,function(){if(f.getItem(v)===n){R();return}y(function(){if(f.getItem(C)!==n){B();return}z(function(){return!f.getItem(L)},R)})})},R=function(){f.setItem(L,"1");var F=function(){f.removeItem(L),f.getItem(C)===n&&f.removeItem(C),f.getItem(v)===n&&f.removeItem(v)};e().then(function(N){F(),a(N)}).catch(function(N){F(),i(N)})};try{if(rx2(f,!0))B();else throw new Error("localStorage support check failed")}catch(F){i(F)}},this))};var m12=function(e){this.storage=e||n7.localStorage};m12.prototype.init=function(){return hf.resolve()};m12.prototype.isInitialized=function(){return!0};m12.prototype.setItem=function(e,t){return new hf(d4.bind(function(r,a){try{this.storage.setItem(e,g12(t))}catch(i){a(i)}r()},this))};m12.prototype.getItem=function(e){return new hf(d4.bind(function(t,r){var a;try{a=Xo0(this.storage.getItem(e))}catch(i){r(i)}t(a)},this))};m12.prototype.removeItem=function(e){return new hf(d4.bind(function(t,r){try{this.storage.removeItem(e)}catch(a){r(a)}t()},this))};var KP5=J_1("batch"),N91=function(e,t){t=t||{},this.storageKey=e,this.usePersistence=t.usePersistence,this.usePersistence&&(this.queueStorage=t.queueStorage||new m12,this.lock=new YR5(e,{storage:t.sharedLockStorage||n7.localStorage,timeoutMS:t.sharedLockTimeoutMS})),this.reportError=t.errorReporter||d4.bind(KP5.error,KP5),this.pid=t.pid||null,this.memQueue=[],this.initialized=!1,t.enqueueThrottleMs?this.enqueuePersisted=nP7(d4.bind(this._enqueuePersisted,this),t.enqueueThrottleMs):this.enqueuePersisted=d4.bind(function(r){return this._enqueuePersisted([r])},this)};N91.prototype.ensureInit=function(){return this.initialized||!this.usePersistence?hf.resolve():this.queueStorage.init().then(d4.bind(function(){this.initialized=!0},this)).catch(d4.bind(function(e){this.reportError("Error initializing queue persistence. Disabling persistence",e),this.initialized=!0,this.usePersistence=!1},this))};N91.prototype.enqueue=function(e,t){var r={id:$D4(),flushAfter:new Date().getTime()+t*2,payload:e};return this.usePersistence?this.enqueuePersisted(r):(this.memQueue.push(r),hf.resolve(!0))};N91.prototype._enqueuePersisted=function(e){var t=d4.bind(function(){return this.ensureInit().then(d4.bind(function(){return this.readFromStorage()},this)).then(d4.bind(function(r){return this.saveToStorage(r.concat(e))},this)).then(d4.bind(function(r){return r&&(this.memQueue=this.memQueue.concat(e)),r},this)).catch(d4.bind(function(r){return this.reportError("Error enqueueing items",r,e),!1},this))},this);return this.lock.withLock(t,this.pid).catch(d4.bind(function(r){return this.reportError("Error acquiring storage lock",r),!1},this))};N91.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);return this.usePersistence&&t.length<e?this.ensureInit().then(d4.bind(function(){return this.readFromStorage()},this)).then(d4.bind(function(r){if(r.length){var a={};d4.each(t,function(o){a[o.id]=!0});for(var i=0;i<r.length;i++){var n=r[i];if(new Date().getTime()>n.flushAfter&&!a[n.id]&&(n.orphaned=!0,t.push(n),t.length>=e))break}}return t},this)):hf.resolve(t)};var YP5=function(e,t){var r=[];return d4.each(e,function(a){a.id&&!t[a.id]&&r.push(a)}),r};N91.prototype.removeItemsByID=function(e){var t={};if(d4.each(e,function(a){t[a]=!0}),this.memQueue=YP5(this.memQueue,t),this.usePersistence){var r=d4.bind(function(){return this.ensureInit().then(d4.bind(function(){return this.readFromStorage()},this)).then(d4.bind(function(a){return a=YP5(a,t),this.saveToStorage(a)},this)).then(d4.bind(function(){return this.readFromStorage()},this)).then(d4.bind(function(a){for(var i=0;i<a.length;i++){var n=a[i];if(n.id&&t[n.id])throw new Error("Item not removed from storage")}return!0},this)).catch(d4.bind(function(a){return this.reportError("Error removing items",a,e),!1},this))},this);return this.lock.withLock(r,this.pid).catch(d4.bind(function(a){return this.reportError("Error acquiring storage lock",a),rx2(this.lock.storage,!0)?!1:r().then(d4.bind(function(i){return i||this.queueStorage.removeItem(this.storageKey).then(function(){return i})},this)).catch(d4.bind(function(i){return this.reportError("Error clearing queue",i),!1},this))},this))}else return hf.resolve(!0)};var XP5=function(e,t){var r=[];return d4.each(e,function(a){var i=a.id;if(i in t){var n=t[i];n!==null&&(a.payload=n,r.push(a))}else r.push(a)}),r};N91.prototype.updatePayloads=function(e){return this.memQueue=XP5(this.memQueue,e),this.usePersistence?this.lock.withLock(d4.bind(function(){return this.ensureInit().then(d4.bind(function(){return this.readFromStorage()},this)).then(d4.bind(function(r){return r=XP5(r,e),this.saveToStorage(r)},this)).catch(d4.bind(function(r){return this.reportError("Error updating items",e,r),!1},this))},this),this.pid).catch(d4.bind(function(t){return this.reportError("Error acquiring storage lock",t),!1},this)):hf.resolve(!0)};N91.prototype.readFromStorage=function(){return this.ensureInit().then(d4.bind(function(){return this.queueStorage.getItem(this.storageKey)},this)).then(d4.bind(function(e){return e&&(d4.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null)),e||[]},this)).catch(d4.bind(function(e){return this.reportError("Error retrieving queue",e),[]},this))};N91.prototype.saveToStorage=function(e){return this.ensureInit().then(d4.bind(function(){return this.queueStorage.setItem(this.storageKey,e)},this)).then(function(){return!0}).catch(d4.bind(function(t){return this.reportError("Error saving queue",t),!1},this))};N91.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(d4.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):hf.resolve()};var xP7=600*1e3,ZM2=J_1("batch"),s21=function(e,t){this.errorReporter=t.errorReporter,this.queue=new N91(e,{errorReporter:d4.bind(this.reportError,this),queueStorage:t.queueStorage,sharedLockStorage:t.sharedLockStorage,sharedLockTimeoutMS:t.sharedLockTimeoutMS,usePersistence:t.usePersistence,enqueueThrottleMs:t.enqueueThrottleMs}),this.libConfig=t.libConfig,this.sendRequest=t.sendRequestFunc,this.beforeSendHook=t.beforeSendHook,this.stopAllBatching=t.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=t.flushOnlyOnInterval||!1,this._flushPromise=null};s21.prototype.enqueue=function(e){return this.queue.enqueue(e,this.flushInterval)};s21.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()};s21.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)};s21.prototype.clear=function(){return this.queue.clear()};s21.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size};s21.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)};s21.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(d4.bind(function(){this.stopped||(this._flushPromise=this.flush())},this),this.flushInterval))};s21.prototype.sendRequestPromise=function(e,t){return new hf(d4.bind(function(r){this.sendRequest(e,t,r)},this))};s21.prototype.flush=function(e){if(this.requestInProgress)return ZM2.log("Flush: Request already in progress"),hf.resolve();this.requestInProgress=!0,e=e||{};var t=this.libConfig.batch_request_timeout_ms,r=new Date().getTime(),a=this.batchSize;return this.queue.fillBatch(a).then(d4.bind(function(i){var n=i.length===a,o=[],h={};if(d4.each(i,function(v){var C=v.payload;if(this.beforeSendHook&&!v.orphaned&&(C=this.beforeSendHook(C)),C){C.event&&C.properties&&(C.properties=d4.extend({},C.properties,{mp_sent_by_lib_version:LW.LIB_VERSION}));var L=!0,y=v.id;y?(this.itemIdsSentSuccessfully[y]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:v,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[y]}),L=!1):this.reportError("[dupe] found item with no ID",{item:v}),L&&o.push(C)}h[v.id]=C},this),o.length<1)return this.requestInProgress=!1,this.resetFlush(),hf.resolve();var u=d4.bind(function(){return this.queue.removeItemsByID(d4.map(i,function(v){return v.id})).then(d4.bind(function(v){return d4.each(i,d4.bind(function(C){var L=C.id;L?(this.itemIdsSentSuccessfully[L]=this.itemIdsSentSuccessfully[L]||0,this.itemIdsSentSuccessfully[L]++,this.itemIdsSentSuccessfully[L]>5&&this.reportError("[dupe] item ID sent too many times",{item:C,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[L]})):this.reportError("[dupe] found item with no ID while removing",{item:C})},this)),v?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!n?(this.resetFlush(),hf.resolve()):this.flush()):(++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush(),hf.resolve())},this))},this),g=d4.bind(function(v){this.requestInProgress=!1;try{if(e.unloading)return this.queue.updatePayloads(h);if(d4.isObject(v)&&v.error==="timeout"&&new Date().getTime()-r>=t)return this.reportError("Network timeout; retrying"),this.flush();if(d4.isObject(v)&&(v.httpStatusCode>=500||v.httpStatusCode===429||v.httpStatusCode<=0&&!cP7()||v.error==="timeout")){var C=this.flushInterval*2;return v.retryAfter&&(C=parseInt(v.retryAfter,10)*1e3||C),C=Math.min(xP7,C),this.reportError("Error; retry in "+C+" ms"),this.scheduleFlush(C),hf.resolve()}else if(d4.isObject(v)&&v.httpStatusCode===413)if(i.length>1){var L=Math.max(1,Math.floor(a/2));return this.batchSize=Math.min(this.batchSize,L,i.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush(),hf.resolve()}else return this.reportError("Single-event request too large; dropping",i),this.resetBatchSize(),u();else return u()}catch(y){this.reportError("Error handling API response",y),this.resetFlush()}},this),f={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};return e.unloading&&(f.transport="sendBeacon"),ZM2.log("MIXPANEL REQUEST:",o),this.sendRequestPromise(o,f).then(g)},this)).catch(d4.bind(function(i){this.reportError("Error flushing request queue",i),this.resetFlush()},this))};s21.prototype.reportError=function(e,t){if(ZM2.error.apply(ZM2.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(r){ZM2.error(r)}};var QD4=function(e){var t=Date.now();return!e||t>e.maxExpires||t>e.idleExpires},LP7=250,ax2="change",rd1="click",eD4="hashchange",wP7="input",JP5="load",AL1="mp_locationchange",QP5="popstate",Hl0="scrollend",tI4="scroll",yP7="select",Jo0="submit",AP7="toggle",t_5="visibilitychange",zP7=["clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","x","y"],e_5=["mp-include"],rD4=["mp-no-track"],r_5=rD4.concat(["mp-sensitive"]),bP7=["aria-label","aria-labelledby","aria-describedby","href","name","role","title","type"],SP7={button:!0,checkbox:!0,combobox:!0,grid:!0,link:!0,listbox:!0,menu:!0,menubar:!0,menuitem:!0,menuitemcheckbox:!0,menuitemradio:!0,navigation:!0,option:!0,radio:!0,radiogroup:!0,searchbox:!0,slider:!0,spinbutton:!0,switch:!0,tab:!0,tablist:!0,textbox:!0,tree:!0,treegrid:!0,treeitem:!0},HP7={base:!0,head:!0,html:!0,link:!0,meta:!0,script:!0,style:!0,title:!0,br:!0,hr:!0,wbr:!0,noscript:!0,picture:!0,source:!0,template:!0,track:!0},kP7={article:!0,div:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,p:!0,section:!0,span:!0},a_5=["onclick","onmousedown","onmouseup","onpointerdown","onpointerup","ontouchend","ontouchstart"],TP7=5,Pw=J_1("autocapture");function aD4(e){for(var t={},r=XR5(e).split(" "),a=0;a<r.length;a++){var i=r[a];i&&(t[i]=!0)}return t}function XR5(e){switch(typeof e.className){case"string":return e.className;case"object":return e.className.baseVal||e.getAttribute("class")||"";default:return""}}function BP7(e){if(e.previousElementSibling)return e.previousElementSibling;do e=e.previousSibling;while(e&&!JR5(e));return e}function i_5(e,t,r,a,i,n){var o={$classes:XR5(e).split(" "),$tag_name:e.tagName.toLowerCase()},h=e.id;h&&(o.$id=h),eI4(e,t,i,n)&&d4.each(bP7.concat(a),function(v){if(e.hasAttribute(v)&&!r[v]){var C=e.getAttribute(v);Qo0(C)&&(o["$attr-"+v]=C)}});for(var u=1,g=1,f=e;f=BP7(f);)u++,f.tagName===e.tagName&&g++;return o.$nth_child=u,o.$nth_of_type=g,o}function VP7(e,t){var r=t.allowElementCallback,a=t.allowSelectors||[],i=t.blockAttrs||[],n=t.blockElementCallback,o=t.blockSelectors||[],h=t.captureTextContent||!1,u=t.captureExtraAttrs||[],g=t.capturedForHeatMap||!1,f={};d4.each(i,function(j){f[j]=!0});var v=null,C=typeof e.target>"u"?e.srcElement:e.target;if(QR5(C)&&(C=C.parentNode),RP7(C,e)&&iD4(C,e,r,a)&&!XF4(C,e,n,o)){for(var L=[C],y=C;y.parentNode&&!D91(y,"body");)L.push(y.parentNode),y=y.parentNode;var z=[],S,B=!1;if(d4.each(L,function(j){var Y=eI4(j,e,r,a);!f.href&&j.tagName.toLowerCase()==="a"&&(S=j.getAttribute("href"),S=Y&&Qo0(S)&&S),XF4(j,e,n,o)&&(B=!0),z.push(i_5(j,e,f,u,r,a))},this),!B){var R=Hh.documentElement;if(v={$event_type:e.type,$host:n7.location.host,$pathname:n7.location.pathname,$elements:z,$el_attr__href:S,$viewportHeight:Math.max(R.clientHeight,n7.innerHeight||0),$viewportWidth:Math.max(R.clientWidth,n7.innerWidth||0),$pageHeight:Hh.body.offsetHeight||0,$pageWidth:Hh.body.offsetWidth||0},d4.each(u,function(j){if(!f[j]&&C.hasAttribute(j)){var Y=C.getAttribute(j);Qo0(Y)&&(v["$el_attr__"+j]=Y)}}),h&&(F=n_5(C,e,r,a),F&&F.length&&(v.$el_text=F)),e.type===rd1&&(d4.each(zP7,function(j){j in e&&(v["$"+j]=e[j])}),g&&(v.$captured_for_heatmap=!0),C=PP7(e)),h){var F=n_5(C,e,r,a);F&&F.length&&(v.$el_text=F)}if(C){if(!iD4(C,e,r,a)||XF4(C,e,n,o))return null;var N=i_5(C,e,f,u,r,a);v.$target=N,v.$el_classes=N.$classes,d4.extend(v,d4.strip_empty_properties({$el_id:N.$id,$el_tag_name:N.$tag_name}))}}}return v}function n_5(e,t,r,a){var i="";return eI4(e,t,r,a)&&e.childNodes&&e.childNodes.length&&d4.each(e.childNodes,function(n){QR5(n)&&n.textContent&&(i+=d4.trim(n.textContent).split(/(\s+)/).filter(Qo0).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),d4.trim(i)}function PP7(e){for(var t=e.target,r=e.composedPath(),a=0;a<r.length;a++){var i=r[a];if(D91(i,"a")||D91(i,"button")||D91(i,"input")||D91(i,"select")||i.getAttribute&&i.getAttribute("role")==="button"){t=i;break}if(i===t)break}return t}function iD4(e,t,r,a){if(r)try{if(!r(e,t))return!1}catch(o){return Pw.critical("Error while checking element in allowElementCallback",o),!1}if(!a.length)return!0;for(var i=0;i<a.length;i++){var n=a[i];try{if(e.matches(n))return!0}catch(o){Pw.critical("Error while checking selector: "+n,o)}}return!1}function XF4(e,t,r,a){var i;if(r)try{if(r(e,t))return!0}catch(h){return Pw.critical("Error while checking element in blockElementCallback",h),!0}if(a&&a.length)for(i=0;i<a.length;i++){var n=a[i];try{if(e.matches(n))return!0}catch(h){Pw.critical("Error while checking selector: "+n,h)}}var o=aD4(e);for(i=0;i<rD4.length;i++)if(o[rD4[i]])return!0;return!1}function JR5(e){return e&&e.nodeType===1}function D91(e,t){return e&&e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function QR5(e){return e&&e.nodeType===3}function _P7(){try{var e=Hh.createElement("div");return!!e.matches}catch{return!1}}function EP7(){return typeof WeakSet<"u"}function RP7(e,t){if(!e||D91(e,"html")||!JR5(e))return!1;var r=e.tagName.toLowerCase();switch(r){case"form":return t.type===Jo0;case"input":return["button","submit"].indexOf(e.getAttribute("type"))===-1?t.type===ax2:t.type===rd1;case"select":case"textarea":return t.type===ax2;default:return t.type===rd1}}function tZ5(e){var t=(e.name||e.id||"").toString().toLowerCase();if(typeof t=="string"){var r=/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i;if(r.test(t.replace(/[^a-zA-Z0-9]/g,"")))return!0}return!1}function eI4(e,t,r,a){var i;if(!iD4(e,t,r,a))return!1;for(var n=e;n.parentNode&&!D91(n,"body");n=n.parentNode){var o=aD4(n);for(i=0;i<r_5.length;i++)if(o[r_5[i]])return!1}var h=aD4(e);for(i=0;i<e_5.length;i++)if(h[e_5[i]])return!0;if(D91(e,"input")||D91(e,"select")||D91(e,"textarea")||e.getAttribute("contenteditable")==="true")return!1;var u=e.type||"";if(typeof u=="string")switch(u.toLowerCase()){case"hidden":return!1;case"password":return!1}return!tZ5(e)}function Qo0(e){if(e===null||d4.isUndefined(e))return!1;if(typeof e=="string"){e=d4.trim(e);var t=/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/;if(t.test((e||"").replace(/[- ]/g,"")))return!1;var r=/(^\d{3}-?\d{2}-?\d{4}$)/;if(r.test(e))return!1}return!0}function eZ5(e){var t="onscrollend"in n7,r=ex2(e),a=Hl0;if(!t){var i=null,n=100;r=ex2(function(){clearTimeout(i),i=setTimeout(e,n)}),a=tI4}return{listener:r,eventType:a}}function ZP7(e){for(var t=0;t<a_5.length;t++)if(e.hasAttribute(a_5[t]))return!0;return!1}function FP7(e){var t=e.getAttribute("role");if(!t)return!1;var r=t.trim().split(/\s+/)[0].toLowerCase();return SP7[r]}function JF4(e){var t=e.tagName.toLowerCase();return!!(t==="button"||t==="input"||t==="select"||t==="textarea"||t==="details"||t==="dialog"||e.isContentEditable||e.onclick||e.onmousedown||e.onmouseup||e.ontouchstart||e.ontouchend||ZP7(e)||FP7(e)||t==="a"&&e.hasAttribute("href")||e.hasAttribute("tabindex"))}function rZ5(e){if(!e||!e.tagName)return!0;var t=e.tagName.toLowerCase();if(HP7[t])return!0;if(JF4(e))return!1;for(var r=e.parentElement,a=0;r&&a<TP7;){if(JF4(r))return!1;if(r.getRootNode&&r.getRootNode()!==Hh){var i=r.getRootNode();if(i.host&&JF4(i.host))return!1}r=r.parentElement,a++}return!!kP7[t]}function aZ5(e){return"composedPath"in e?e.composedPath():[]}function iZ5(e){var t=aZ5(e);return t&&t.length>0?t[0]:e.target||e.srcElement}var nZ5=".mp-mask, .fs-mask, .amp-mask, .rr-mask, .ph-mask",OP7="data-rr-is-password",DP7=["password","email","tel","hidden"];function xo0(e){return e?Array.isArray(e)?e:[e]:[]}function IP7(e){var t={input:{maskingSelector:"",unmaskingSelector:"",maskAll:!0},text:{maskingSelector:"",unmaskingSelector:"",maskAll:!0}},r=e.get_config("record_mask_input_selector"),a=e.get_config("record_unmask_input_selector"),i=e.get_config("record_mask_all_inputs");t.input.maskingSelector=xo0(r).join(","),t.input.unmaskingSelector=xo0(a).join(","),i!==void 0&&(t.input.maskAll=i);var n=e.get_config("record_mask_text_selector"),o=e.get_config("record_unmask_text_selector"),h=e.get_config("record_mask_all_text"),u=e.get_config("record_mask_text_class"),g=xo0(n);if(u)if(u instanceof RegExp)t.text._legacyClassRegex=u;else{var f="."+u;g.indexOf(f)===-1&&g.push(f)}return t.text.maskingSelector=g.join(","),t.text.unmaskingSelector=xo0(o).join(","),h===void 0&&n!==void 0?t.text.maskAll=!1:h!==void 0&&(t.text.maskAll=h),t}function t12(e,t){return t?!!e.closest(t):!1}function NP7(e,t){var r=(e.getAttribute("type")||"").toLowerCase();if(DP7.indexOf(r)!==-1)return!0;var a=(e.getAttribute("autocomplete")||"").toLowerCase();return a&&a!==""&&a!=="off"||e.hasAttribute(OP7)||tZ5(e)?!0:t.input.maskAll?!t12(e,t.input.unmaskingSelector):!!(t12(e,t.input.maskingSelector)||t12(e,nZ5))}function UP7(e,t){return e?t.text._legacyClassRegex&&EO4(e,t.text._legacyClassRegex)?!0:t.text.maskAll?!t12(e,t.text.unmaskingSelector):!!(t12(e,t.text.maskingSelector)||t12(e,nZ5)):!1}var e12=J_1("recorder"),GP7=n7.CompressionStream,jP7={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},WP7=new Set([Sh.MouseMove,Sh.MouseInteraction,Sh.Scroll,Sh.ViewportResize,Sh.Input,Sh.TouchMove,Sh.MediaInteraction,Sh.Drag,Sh.Selection]);function qP7(e){return e.type===sf.IncrementalSnapshot&&WP7.has(e.data.source)}var qT=function(e){this._mixpanel=e.mixpanelInstance,this._onIdleTimeout=e.onIdleTimeout||zL1,this._onMaxLengthReached=e.onMaxLengthReached||zL1,this._onBatchSent=e.onBatchSent||zL1,this._rrwebRecord=e.rrwebRecord||null,this._stopRecording=null,this.replayId=e.replayId,this.batchStartUrl=e.batchStartUrl||null,this.replayStartUrl=e.replayStartUrl||null,this.idleExpires=e.idleExpires||null,this.maxExpires=e.maxExpires||null,this.replayStartTime=e.replayStartTime||null,this.lastEventTimestamp=e.lastEventTimestamp||null,this.seqNo=e.seqNo||0,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=RM2,this.recordMinMs=0;var t=rx2(e.sharedLockStorage,!0)&&!this.getConfig("disable_persistence");this.batcherKey="__mprec_"+this.getConfig("name")+"_"+this.getConfig("token")+"_"+this.replayId,this.queueStorage=new o61(WR5),this.batcher=new s21(this.batcherKey,{errorReporter:this.reportError.bind(this),flushOnlyOnInterval:!0,libConfig:jP7,sendRequestFunc:this.flushEventsWithOptOut.bind(this),queueStorage:this.queueStorage,sharedLockStorage:e.sharedLockStorage,usePersistence:t,stopAllBatchingFunc:this.stopRecording.bind(this),enqueueThrottleMs:LP7,sharedLockTimeoutMS:10*1e3})};qT.prototype.getUserIdInfo=function(){if(this.finalFlushUserIdInfo)return this.finalFlushUserIdInfo;var e={distinct_id:String(this._mixpanel.get_distinct_id())},t=this._mixpanel.get_property("$device_id");t&&(e.$device_id=t);var r=this._mixpanel.get_property("$user_id");return r&&(e.$user_id=r),e};qT.prototype.unloadPersistedData=function(){return this.batcher.stop(),this.queueStorage.init().catch(function(){this.reportError("Error initializing IndexedDB storage for unloading persisted data.")}.bind(this)).then(function(){return this.getDurationMs()<this._getRecordMinMs()?this.queueStorage.removeItem(this.batcherKey):this.batcher.flush().then(function(){return this.queueStorage.removeItem(this.batcherKey)}.bind(this))}.bind(this))};qT.prototype.getConfig=function(e){return this._mixpanel.get_config(e)};qT.prototype.get_config=function(e){return this.getConfig(e)};qT.prototype.startRecording=function(e){if(this._rrwebRecord===null){this.reportError("rrweb record function not provided. ");return}if(this._stopRecording!==null){e12.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>RM2&&(this.recordMaxMs=RM2,e12.critical("record_max_ms cannot be greater than "+RM2+"ms. Capping value.")),this.maxExpires||(this.maxExpires=new Date().getTime()+this.recordMaxMs),this.recordMinMs=this._getRecordMinMs(),this.replayStartTime||(this.replayStartTime=new Date().getTime(),this.batchStartUrl=d4.info.currentUrl(),this.replayStartUrl=d4.info.currentUrl()),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=function(){clearTimeout(this.idleTimeoutId);var n=this.getConfig("record_idle_timeout_ms");this.idleTimeoutId=setTimeout(this._onIdleTimeout,n),this.idleExpires=new Date().getTime()+n}.bind(this);t();var r=this.getConfig("record_block_selector");(r===""||r===null)&&(r=void 0);var a=IP7(this._mixpanel);try{this._stopRecording=this._rrwebRecord({emit:function(n){if(this.idleExpires&&this.idleExpires<n.timestamp){this._onIdleTimeout();return}qP7(n)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),t()),this.__enqueuePromise=this.batcher.enqueue(n),(this.lastEventTimestamp===null||n.timestamp>this.lastEventTimestamp)&&(this.lastEventTimestamp=n.timestamp)}.bind(this),blockClass:this.getConfig("record_block_class"),blockSelector:r,collectFonts:this.getConfig("record_collect_fonts"),dataURLOptions:{type:"image/webp",quality:.6},maskAllInputs:!0,maskTextSelector:"*",maskInputFn:this._getMaskFn(NP7,a),maskTextFn:this._getMaskFn(UP7,a),recordCanvas:this.getConfig("record_canvas"),sampling:{canvas:15},plugins:this.getConfig("record_console")?[KV7({stringifyOptions:{stringLengthLimit:1e3,numOfKeysLimit:50,depthOfLimit:2}})]:[]})}catch(n){this.reportError("Unexpected error when starting rrweb recording.",n)}if(typeof this._stopRecording!="function"){this.reportError("rrweb failed to start, skipping this recording."),this._stopRecording=null,this.stopRecording();return}var i=this.maxExpires-new Date().getTime();this.maxTimeoutId=setTimeout(this._onMaxLengthReached.bind(this),i)};qT.prototype.stopRecording=function(e){if(this.finalFlushUserIdInfo=this.getUserIdInfo(),!this.isRrwebStopped()){try{this._stopRecording()}catch(r){this.reportError("Error with rrweb stopRecording",r)}this._stopRecording=null}var t;return this.batcher.stopped?t=this.batcher.clear():e||(t=this.batcher.flush()),this.batcher.stop(),clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId),t};qT.prototype.isRrwebStopped=function(){return this._stopRecording===null};qT.prototype.flushEventsWithOptOut=function(e,t,r){var a=function(i){i===0&&(this.stopRecording(),r({error:"Tracking has been opted out, stopping recording."}))}.bind(this);this._flushEvents(e,t,r,a)};qT.prototype.serialize=function(){var e;try{e=this._mixpanel.get_tab_id()}catch(t){this.reportError("Error getting tab ID for serialization ",t),e=null}return{replayId:this.replayId,seqNo:this.seqNo,replayStartTime:this.replayStartTime,batchStartUrl:this.batchStartUrl,replayStartUrl:this.replayStartUrl,lastEventTimestamp:this.lastEventTimestamp,idleExpires:this.idleExpires,maxExpires:this.maxExpires,tabId:e}};qT.deserialize=function(e,t){var r=new qT(d4.extend({},t,{replayId:e.replayId,batchStartUrl:e.batchStartUrl,replayStartUrl:e.replayStartUrl,idleExpires:e.idleExpires,maxExpires:e.maxExpires,replayStartTime:e.replayStartTime,lastEventTimestamp:e.lastEventTimestamp,seqNo:e.seqNo,sharedLockStorage:t.sharedLockStorage}));return r};qT.prototype._sendRequest=function(e,t,r,a){var i=function(o,h){o.status===200&&this.replayId===e&&(this.seqNo++,this.batchStartUrl=d4.info.currentUrl()),this._onBatchSent(),a({status:0,httpStatusCode:o.status,responseBody:h,retryAfter:o.headers.get("Retry-After")})}.bind(this),n=this._mixpanel.get_api_host&&this._mixpanel.get_api_host("record")||this.getConfig("api_host");n7.fetch(n+"/"+this.getConfig("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getConfig("token")+":"),"Content-Type":"application/octet-stream"},body:r}).then(function(o){o.json().then(function(h){i(o,h)}).catch(function(h){a({error:h})})}).catch(function(o){a({error:o,httpStatusCode:0})})};qT.prototype._flushEvents=RL1(function(e,t,r){var a=e.length;if(a>0){for(var i=this.replayId,n=1/0,o=-1/0,h=!1,u=0;u<a;u++)n=Math.min(n,e[u].timestamp),o=Math.max(o,e[u].timestamp),e[u].type===sf.FullSnapshot&&(h=!0);if(this.seqNo===0){if(!h){r({error:"First batch does not contain a full snapshot. Aborting recording."}),this.stopRecording(!0);return}this.replayStartTime=n}else this.replayStartTime||(this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=n);var g=o-this.replayStartTime,f={$current_url:this.batchStartUrl,$lib_version:LW.LIB_VERSION,batch_start_time:n/1e3,mp_lib:"web",replay_id:i,replay_length_ms:g,replay_start_time:this.replayStartTime/1e3,replay_start_url:this.replayStartUrl,seq:this.seqNo},v=JSON.stringify(e);if(Object.assign(f,this.getUserIdInfo()),sP7(F91,Xh1.vendor,BM2)){var C=new Blob([v],{type:"application/json"}).stream(),L=C.pipeThrough(new GP7("gzip"));new Response(L).blob().then(function(y){f.format="gzip",this._sendRequest(i,f,y,r)}.bind(this))}else f.format="body",this._sendRequest(i,f,v,r)}});qT.prototype.reportError=function(e,t){e12.error.apply(e12.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.getConfig("error_reporter")(e,t)}catch(r){e12.error(r)}};qT.prototype.getDurationMs=function(){return this.replayStartTime===null?0:this.lastEventTimestamp===null?new Date().getTime()-this.replayStartTime:this.lastEventTimestamp-this.replayStartTime};qT.prototype._getRecordMinMs=function(){var e=this.getConfig("record_min_ms");return e>WF4?(e12.critical("record_min_ms cannot be greater than "+WF4+"ms. Capping value."),WF4):e};qT.prototype._getMaskFn=function(e,t){return function(r,a){if(!r.trim().length)return"";var i=!0;try{i=e(a,t)}catch(o){this.reportError("Error checking if text should be masked, defaulting to masked",o)}if(i){var n=Math.min(r.length,1e4);return"*".repeat(n)}else return r}.bind(this)};var ad1=function(e){this.idb=new o61(KD4),this.errorReporter=e.errorReporter,this.mixpanelInstance=e.mixpanelInstance,this.sharedLockStorage=e.sharedLockStorage};ad1.prototype.isPersistenceEnabled=function(){return!this.mixpanelInstance.get_config("disable_persistence")};ad1.prototype.handleError=function(e){this.errorReporter("IndexedDB error: ",e)};ad1.prototype.setActiveRecording=function(e){if(!this.isPersistenceEnabled())return hf.resolve();var t=e.tabId;return t?this.idb.init().then(function(){return this.idb.setItem(t,e)}.bind(this)).catch(this.handleError.bind(this)):(console.warn("No tab ID is set, cannot persist recording metadata."),hf.resolve())};ad1.prototype.getActiveRecording=function(){return this.isPersistenceEnabled()?this.idb.init().then(function(){return this.idb.getItem(this.mixpanelInstance.get_tab_id())}.bind(this)).then(function(e){return QD4(e)?null:e}.bind(this)).catch(this.handleError.bind(this)):hf.resolve(null)};ad1.prototype.clearActiveRecording=function(){return this.isPersistenceEnabled()?this.markActiveRecordingExpired():this.deleteActiveRecording()};ad1.prototype.markActiveRecordingExpired=function(){return this.getActiveRecording().then(function(e){if(e)return e.maxExpires=0,this.setActiveRecording(e)}.bind(this)).catch(this.handleError.bind(this))};ad1.prototype.deleteActiveRecording=function(){return this.idb.isInitialized()?this.idb.removeItem(this.mixpanelInstance.get_tab_id()).catch(this.handleError.bind(this)):hf.resolve()};ad1.prototype.flushInactiveRecordings=function(){return this.isPersistenceEnabled()?this.idb.init().then(function(){return this.idb.getAll()}.bind(this)).then(function(e){var t=e.filter(function(r){return QD4(r)}).map(function(r){var a=qT.deserialize(r,{mixpanelInstance:this.mixpanelInstance,sharedLockStorage:this.sharedLockStorage});return a.unloadPersistedData().then(function(){return this.idb.removeItem(r.tabId)}.bind(this)).catch(this.handleError.bind(this))}.bind(this));return hf.all(t)}.bind(this)).catch(this.handleError.bind(this)):hf.resolve([])};var FM2=J_1("recorder"),id1=function(e,t,r){this.mixpanelInstance=e,this.rrwebRecord=t||VL1,this.sharedLockStorage=r,this.recordingRegistry=new ad1({mixpanelInstance:this.mixpanelInstance,errorReporter:FM2.error,sharedLockStorage:r}),this._flushInactivePromise=this.recordingRegistry.flushInactiveRecordings(),this.activeRecording=null,this.stopRecordingInProgress=!1};id1.prototype.startRecording=function(e){if(e=e||{},this.activeRecording&&!this.activeRecording.isRrwebStopped()){FM2.log("Recording already in progress, skipping startRecording.");return}var t=function(){FM2.log("Idle timeout reached, restarting recording."),this.resetRecording()}.bind(this),r=function(){FM2.log("Max recording length reached, stopping recording."),this.resetRecording()}.bind(this),a=function(){this.recordingRegistry.setActiveRecording(this.activeRecording.serialize()),this.__flushPromise=this.activeRecording.batcher._flushPromise}.bind(this),i={mixpanelInstance:this.mixpanelInstance,onBatchSent:a,onIdleTimeout:t,onMaxLengthReached:r,replayId:d4.UUID(),rrwebRecord:this.rrwebRecord,sharedLockStorage:this.sharedLockStorage};return e.activeSerializedRecording?this.activeRecording=qT.deserialize(e.activeSerializedRecording,i):this.activeRecording=new qT(i),this.activeRecording.startRecording(e.shouldStopBatcher),this.recordingRegistry.setActiveRecording(this.activeRecording.serialize())};id1.prototype.stopRecording=function(){return this.stopRecordingInProgress=!0,this._stopCurrentRecording(!1,!0).then(function(){return this.recordingRegistry.clearActiveRecording()}.bind(this)).then(function(){this.stopRecordingInProgress=!1}.bind(this))};id1.prototype.pauseRecording=function(){return this._stopCurrentRecording(!1)};id1.prototype._stopCurrentRecording=function(e,t){if(this.activeRecording){var r=this.activeRecording.stopRecording(e);return t&&(this.activeRecording=null),r}return hf.resolve()};id1.prototype.resumeRecording=function(e){return this.activeRecording&&this.activeRecording.isRrwebStopped()?(this.activeRecording.startRecording(!1),hf.resolve(null)):this.recordingRegistry.getActiveRecording().then(function(t){return t&&!this.stopRecordingInProgress?this.startRecording({activeSerializedRecording:t}):e?this.startRecording({shouldStopBatcher:!1}):(FM2.log("No resumable recording found."),null)}.bind(this))};id1.prototype.resetRecording=function(){this.stopRecording(),this.startRecording({shouldStopBatcher:!0})};id1.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null};Object.defineProperty(id1.prototype,"replayId",{get:function(){return this.getActiveReplayId()}});n7[QF4]=id1;function $P7(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var To0={exports:{}},KP7=To0.exports,o_5;function YP7(){return o_5||(o_5=1,(function(e,t){(function(r,a){e.exports=a()})(KP7,function(){Array.isArray||(Array.isArray=function(n){return Object.prototype.toString.call(n)==="[object Array]"});function r(n){for(var o=[],h=0,u=n.length;h<u;h++)o.indexOf(n[h])===-1&&o.push(n[h]);return o}var a={},i={"==":function(n,o){return n==o},"===":function(n,o){return n===o},"!=":function(n,o){return n!=o},"!==":function(n,o){return n!==o},">":function(n,o){return n>o},">=":function(n,o){return n>=o},"<":function(n,o,h){return h===void 0?n<o:n<o&&o<h},"<=":function(n,o,h){return h===void 0?n<=o:n<=o&&o<=h},"!!":function(n){return a.truthy(n)},"!":function(n){return!a.truthy(n)},"%":function(n,o){return n%o},log:function(n){return console.log(n),n},in:function(n,o){return!o||typeof o.indexOf>"u"?!1:o.indexOf(n)!==-1},cat:function(){return Array.prototype.join.call(arguments,"")},substr:function(n,o,h){if(h<0){var u=String(n).substr(o);return u.substr(0,u.length+h)}return String(n).substr(o,h)},"+":function(){return Array.prototype.reduce.call(arguments,function(n,o){return parseFloat(n,10)+parseFloat(o,10)},0)},"*":function(){return Array.prototype.reduce.call(arguments,function(n,o){return parseFloat(n,10)*parseFloat(o,10)})},"-":function(n,o){return o===void 0?-n:n-o},"/":function(n,o){return n/o},min:function(){return Math.min.apply(this,arguments)},max:function(){return Math.max.apply(this,arguments)},merge:function(){return Array.prototype.reduce.call(arguments,function(n,o){return n.concat(o)},[])},var:function(n,o){var h=o===void 0?null:o,u=this;if(typeof n>"u"||n===""||n===null)return u;for(var g=String(n).split("."),f=0;f<g.length;f++)if(u==null||(u=u[g[f]],u===void 0))return h;return u},missing:function(){for(var n=[],o=Array.isArray(arguments[0])?arguments[0]:arguments,h=0;h<o.length;h++){var u=o[h],g=a.apply({var:u},this);(g===null||g==="")&&n.push(u)}return n},missing_some:function(n,o){var h=a.apply({missing:o},this);return o.length-h.length>=n?[]:h}};return a.is_logic=function(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&Object.keys(n).length===1},a.truthy=function(n){return Array.isArray(n)&&n.length===0?!1:!!n},a.get_operator=function(n){return Object.keys(n)[0]},a.get_values=function(n){return n[a.get_operator(n)]},a.apply=function(n,o){if(Array.isArray(n))return n.map(function(S){return a.apply(S,o)});if(!a.is_logic(n))return n;var h=a.get_operator(n),u=n[h],g,f,v,C,L;if(Array.isArray(u)||(u=[u]),h==="if"||h=="?:"){for(g=0;g<u.length-1;g+=2)if(a.truthy(a.apply(u[g],o)))return a.apply(u[g+1],o);return u.length===g+1?a.apply(u[g],o):null}else if(h==="and"){for(g=0;g<u.length;g+=1)if(f=a.apply(u[g],o),!a.truthy(f))return f;return f}else if(h==="or"){for(g=0;g<u.length;g+=1)if(f=a.apply(u[g],o),a.truthy(f))return f;return f}else{if(h==="filter")return C=a.apply(u[0],o),v=u[1],Array.isArray(C)?C.filter(function(S){return a.truthy(a.apply(v,S))}):[];if(h==="map")return C=a.apply(u[0],o),v=u[1],Array.isArray(C)?C.map(function(S){return a.apply(v,S)}):[];if(h==="reduce")return C=a.apply(u[0],o),v=u[1],L=typeof u[2]<"u"?a.apply(u[2],o):null,Array.isArray(C)?C.reduce(function(S,B){return a.apply(v,{current:B,accumulator:S})},L):L;if(h==="all"){if(C=a.apply(u[0],o),v=u[1],!Array.isArray(C)||!C.length)return!1;for(g=0;g<C.length;g+=1)if(!a.truthy(a.apply(v,C[g])))return!1;return!0}else if(h==="none"){if(C=a.apply(u[0],o),v=u[1],!Array.isArray(C)||!C.length)return!0;for(g=0;g<C.length;g+=1)if(a.truthy(a.apply(v,C[g])))return!1;return!0}else if(h==="some"){if(C=a.apply(u[0],o),v=u[1],!Array.isArray(C)||!C.length)return!1;for(g=0;g<C.length;g+=1)if(a.truthy(a.apply(v,C[g])))return!0;return!1}}if(u=u.map(function(S){return a.apply(S,o)}),i.hasOwnProperty(h)&&typeof i[h]=="function")return i[h].apply(o,u);if(h.indexOf(".")>0){var y=String(h).split("."),z=i;for(g=0;g<y.length;g++){if(!z.hasOwnProperty(y[g]))throw new Error("Unrecognized operation "+h+" (failed at "+y.slice(0,g+1).join(".")+")");z=z[y[g]]}return z.apply(o,u)}throw new Error("Unrecognized operation "+h)},a.uses_data=function(n){var o=[];if(a.is_logic(n)){var h=a.get_operator(n),u=n[h];Array.isArray(u)||(u=[u]),h==="var"?o.push(u[0]):u.forEach(function(g){o.push.apply(o,a.uses_data(g))})}return r(o)},a.add_operation=function(n,o){i[n]=o},a.rm_operation=function(n){delete i[n]},a.rule_like=function(n,o){if(o===n||o==="@")return!0;if(o==="number")return typeof n=="number";if(o==="string")return typeof n=="string";if(o==="array")return Array.isArray(n)&&!a.is_logic(n);if(a.is_logic(o)){if(a.is_logic(n)){var h=a.get_operator(o),u=a.get_operator(n);if(h==="@"||h===u)return a.rule_like(a.get_values(n,!1),a.get_values(o,!1))}return!1}if(Array.isArray(o))if(Array.isArray(n)){if(o.length!==n.length)return!1;for(var g=0;g<o.length;g+=1)if(!a.rule_like(n[g],o[g]))return!1;return!0}else return!1;return!1},a})})(To0)),To0.exports}var XP7=YP7(),JP7=$P7(XP7),tl0=function(e,t){if(e==null)return e;if(typeof e=="string")return e.toLowerCase();if(Array.isArray(e))return e.map(function(n){return tl0(n,t)});if(e===Object(e)){var r={};for(var a in e)if(e.hasOwnProperty(a)){var i=t&&typeof a=="string"?a.toLowerCase():a;r[i]=tl0(e[a],t)}return r}else return e},QP7=function(e){return tl0(e,!0)},t_7=function(e){return tl0(e,!1)},e_7=function(e,t,r){if(e!==r.event_name)return{matches:!1};var a=r.property_filters,i=!0;if(a&&!d4.isEmptyObject(a))try{var n=QP7(t||{}),o=t_7(a);i=JP7.apply(o,n)}catch(h){return{matches:!1,error:h.toString()}}return{matches:i}},oZ5={};oZ5.eventMatchesCriteria=e_7;n7[i61]=Promise.resolve(oZ5);var r_7=30,a_7=1e3,i_7=4,n_7=!1;function lZ5(){this.clicks=[]}lZ5.prototype.isRageClick=function(e,t){t=t||{};var r=t.threshold_px||r_7,a=t.timeout_ms||a_7,i=t.click_count||i_7,n=t.interactive_elements_only||n_7;if(n){var o=iZ5(e);if(!o||rZ5(o))return!1}var h=Date.now(),u=e.pageX,g=e.pageY,f=this.clicks[this.clicks.length-1];if(f&&h-f.timestamp<a&&Math.sqrt(Math.pow(u-f.x,2)+Math.pow(g-f.y,2))<r){if(this.clicks.push({x:u,y:g,timestamp:h}),this.clicks.length>=i)return this.clicks=[],!0}else this.clicks=[{x:u,y:g,timestamp:h}];return!1};function C12(e,t){this.changeCallback=e||function(){},this.observerConfig=t,this.observedShadowRoots=null,this.shadowObservers=[]}C12.prototype.getEventTarget=function(e){if(this.observedShadowRoots)return iZ5(e)};C12.prototype.observeFromEvent=function(e){if(this.observedShadowRoots)for(var t=aZ5(e),r=0;r<t.length;r++){var a=t[r];a&&a.shadowRoot&&this.observeShadowRoot(a.shadowRoot)}};C12.prototype.observeShadowRoot=function(e){if(!(!this.observedShadowRoots||this.observedShadowRoots.has(e))){var t=this;try{this.observedShadowRoots.add(e);var r=new window.MutationObserver(function(){t.changeCallback()});r.observe(e,this.observerConfig),this.shadowObservers.push(r)}catch(a){Pw.critical("Error while observing shadow root",a)}}};C12.prototype.start=function(){if(!this.observedShadowRoots){if(!EP7()){Pw.critical("Shadow DOM observation unavailable: WeakSet not supported");return}this.observedShadowRoots=new WeakSet}};C12.prototype.stop=function(){if(this.observedShadowRoots){for(var e=0;e<this.shadowObservers.length;e++)try{this.shadowObservers[e].disconnect()}catch(t){Pw.critical("Error while disconnecting shadow DOM observer",t)}this.shadowObservers=[],this.observedShadowRoots=null}};var o_7=500,l_7=[ax2,wP7,Jo0,yP7,AP7],c_7=[Hl0],s_7=[eD4],l_5={characterData:!0,childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class","hidden","checked","selected","value","display","visibility"]};function U91(e){this.eventListeners=[],this.mutationObserver=null,this.shadowDOMObserver=null,this.isTracking=!1,this.lastChangeEventTimestamp=0,this.pendingClicks=[],this.onDeadClickCallback=e,this.processingActive=!1,this.processingTimeout=null}U91.prototype.addClick=function(e){var t=this.shadowDOMObserver&&this.shadowDOMObserver.getEventTarget(e);return t||(t=e.target||e.srcElement),!t||rZ5(t)?!1:(this.shadowDOMObserver&&this.shadowDOMObserver.observeFromEvent(e),this.pendingClicks.push({element:t,event:e,timestamp:Date.now()}),!0)};U91.prototype.trackClick=function(e,t){if(!this.isTracking)return!1;var r=this.addClick(e);return r&&this.triggerProcessing(t),r};U91.prototype.getDeadClicks=function(e){if(this.pendingClicks.length===0)return[];var t=e.timeout_ms,r=Date.now(),a=this.pendingClicks.slice();this.pendingClicks=[];for(var i=[],n=0;n<a.length;n++){var o=a[n];r-o.timestamp>=t?this.hasChangesAfter(o.timestamp)||i.push(o):this.pendingClicks.push(o)}return i};U91.prototype.hasChangesAfter=function(e){return this.lastChangeEventTimestamp>=e-100};U91.prototype.recordChangeEvent=function(){this.lastChangeEventTimestamp=Date.now()};U91.prototype.triggerProcessing=function(e){this.processingActive||(this.processingActive=!0,this.processRecursively(e))};U91.prototype.processRecursively=function(e){if(!this.isTracking||!this.onDeadClickCallback){this.processingActive=!1;return}var t=e.timeout_ms,r=this;this.processingTimeout=setTimeout(function(){if(r.processingActive){for(var a=r.getDeadClicks(e),i=0;i<a.length;i++)r.onDeadClickCallback(a[i].event);r.pendingClicks.length>0?r.processRecursively(e):r.processingActive=!1}},t)};U91.prototype.startTracking=function(){if(!this.isTracking){this.isTracking=!0;var e=this;l_7.forEach(function(r){var a=function(){e.recordChangeEvent()};document.addEventListener(r,a,{capture:!0,passive:!0}),e.eventListeners.push({target:document,event:r,handler:a,options:{capture:!0,passive:!0}})}),s_7.forEach(function(r){var a=function(){e.recordChangeEvent()};window.addEventListener(r,a),e.eventListeners.push({target:window,event:r,handler:a})}),c_7.forEach(function(r){var a=function(){e.recordChangeEvent()};window.addEventListener(r,a,{passive:!0}),e.eventListeners.push({target:window,event:r,handler:a,options:{passive:!0}})});var t=function(){e.recordChangeEvent()};if(document.addEventListener("selectionchange",t),e.eventListeners.push({target:document,event:"selectionchange",handler:t}),window.MutationObserver)try{this.mutationObserver=new window.MutationObserver(function(){e.recordChangeEvent()}),this.mutationObserver.observe(document.body||document.documentElement,l_5)}catch(r){Pw.critical("Error while setting up mutation observer",r)}if(window.customElements)try{this.shadowDOMObserver=new C12(function(){e.recordChangeEvent()},l_5),this.shadowDOMObserver.start()}catch(r){Pw.critical("Error while setting up shadow DOM observer",r),this.shadowDOMObserver=null}}};U91.prototype.stopTracking=function(){if(this.isTracking){this.isTracking=!1,this.pendingClicks=[],this.lastChangeEventTimestamp=0,this.processingActive=!1,this.processingTimeout&&(clearTimeout(this.processingTimeout),this.processingTimeout=null);for(var e=0;e<this.eventListeners.length;e++){var t=this.eventListeners[e];try{t.target.removeEventListener(t.event,t.handler,t.options)}catch(r){Pw.critical("Error while removing event listener",r)}}if(this.eventListeners=[],this.mutationObserver){try{this.mutationObserver.disconnect()}catch(r){Pw.critical("Error while disconnecting mutation observer",r)}this.mutationObserver=null}if(this.shadowDOMObserver){try{this.shadowDOMObserver.stop()}catch(r){Pw.critical("Error while stopping shadow DOM observer",r)}this.shadowDOMObserver=null}}};var cZ5="autocapture",h_7="track_pageview",sZ5="full-url",d_7="url-with-path-and-query-string",u_7="url-with-path",g_7="allow_element_callback",hZ5="allow_selectors",dZ5="allow_url_regexes",uZ5="block_attrs",gZ5="block_element_callback",pZ5="block_selectors",fZ5="block_url_regexes",vZ5="capture_extra_attrs",mZ5="capture_text_content",CZ5="scroll_capture_all",MZ5="scroll_depth_percent_checkpoints",el0="click",rl0="dead_click",nD4="input",xZ5="pageview",al0="rage_click",oD4="scroll",kl0="page_leave",lD4="submit",$T={};$T[hZ5]=[];$T[dZ5]=[];$T[uZ5]=[];$T[gZ5]=null;$T[pZ5]=[];$T[fZ5]=[];$T[vZ5]=[];$T[mZ5]=!1;$T[CZ5]=!1;$T[MZ5]=[25,50,75,100];$T[el0]=!0;$T[rl0]=!0;$T[nD4]=!0;$T[xZ5]=sZ5;$T[al0]=!0;$T[oD4]=!0;$T[kl0]=!1;$T[lD4]=!0;var ix2={$mp_autocapture:!0},LZ5="$mp_click",wZ5="$mp_dead_click",p_7="$mp_input_change",yZ5="$mp_rage_click",f_7="$mp_scroll",v_7="$mp_submit",m_7="$mp_page_leave",Sk=function(e){this.mp=e,this.maxScrollViewDepth=0,this.hasTrackedScrollSession=!1,this.previousScrollHeight=0};Sk.prototype.init=function(){if(!_P7()){Pw.critical("Autocapture unavailable: missing required DOM APIs");return}this.initPageListeners(),this.initPageviewTracking(),this.initClickTracking(),this.initDeadClickTracking(),this.initInputTracking(),this.initScrollTracking(),this.initSubmitTracking(),this.initRageClickTracking(),this.initPageLeaveTracking()};Sk.prototype.getFullConfig=function(){var e=this.mp.get_config(cZ5);return e?d4.isObject(e)?d4.extend({},$T,e):$T:{}};Sk.prototype.getConfig=function(e){return this.getFullConfig()[e]};Sk.prototype.currentUrlBlocked=function(){var e,t=d4.info.currentUrl(),r=this.getConfig(dZ5)||[];if(r.length){var a=!1;for(e=0;e<r.length;e++){var i=r[e];try{if(t.match(i)){a=!0;break}}catch(o){return Pw.critical("Error while checking block URL regex: "+i,o),!0}}if(!a)return!0}var n=this.getConfig(fZ5)||[];if(!n||!n.length)return!1;for(e=0;e<n.length;e++)try{if(t.match(n[e]))return!0}catch(o){return Pw.critical("Error while checking block URL regex: "+n[e],o),!0}return!1};Sk.prototype.pageviewTrackingConfig=function(){return this.mp.get_config(cZ5)?this.getConfig(xZ5):this.mp.get_config(h_7)};Sk.prototype.trackDomEvent=function(e,t){if(!this.currentUrlBlocked()){var r=this.mp.is_recording_heatmap_data()&&(t===LZ5&&!this.getConfig(el0)||t===yZ5&&!this._getClickTrackingConfig(al0)||t===wZ5&&!this._getClickTrackingConfig(rl0)),a=VP7(e,{allowElementCallback:this.getConfig(g_7),allowSelectors:this.getConfig(hZ5),blockAttrs:this.getConfig(uZ5),blockElementCallback:this.getConfig(gZ5),blockSelectors:this.getConfig(pZ5),captureExtraAttrs:this.getConfig(vZ5),captureTextContent:this.getConfig(mZ5),capturedForHeatMap:r});a&&(d4.extend(a,ix2),this.mp.track(t,a))}};Sk.prototype.initPageListeners=function(){if(n7.removeEventListener(QP5,this.listenerPopstate),n7.removeEventListener(eD4,this.listenerHashchange),!(!this.pageviewTrackingConfig()&&!this.getConfig(kl0)&&!this.mp.get_config("record_heatmap_data"))){this.listenerPopstate=function(){n7.dispatchEvent(new Event(AL1))},this.listenerHashchange=function(){n7.dispatchEvent(new Event(AL1))},n7.addEventListener(QP5,this.listenerPopstate),n7.addEventListener(eD4,this.listenerHashchange);var e=n7.history.pushState;typeof e=="function"&&(n7.history.pushState=function(r,a,i){e.call(n7.history,r,a,i),n7.dispatchEvent(new Event(AL1))});var t=n7.history.replaceState;typeof t=="function"&&(n7.history.replaceState=function(r,a,i){t.call(n7.history,r,a,i),n7.dispatchEvent(new Event(AL1))})}};Sk.prototype._getClickTrackingConfig=function(e){var t=this.getConfig(e);return t?t===!0?{}:typeof t=="object"?t:{}:null};Sk.prototype._trackPageLeave=function(e,t,r){if(!this.hasTrackedScrollSession&&!(!this.getConfig(kl0)&&!this.mp.is_recording_heatmap_data())){this.hasTrackedScrollSession=!0;var a=Math.max(Hh.documentElement.clientHeight,n7.innerHeight||0),i=Math.round(Math.max(this.maxScrollViewDepth-a,0)/(r-a)*100),n=Math.round(a/r*100);r<=a&&(i=100,n=100);var o=d4.extend({$max_scroll_view_depth:this.maxScrollViewDepth,$max_scroll_percentage:i,$fold_line_percentage:n,$scroll_height:r,$event_type:e.type,$current_url:t||d4.info.currentUrl(),$viewportHeight:a,$viewportWidth:Math.max(Hh.documentElement.clientWidth,n7.innerWidth||0),$captured_for_heatmap:this.mp.is_recording_heatmap_data()},ix2);this.mp.track(m_7,o,{transport:"sendBeacon"})}};Sk.prototype._initScrollDepthTracking=function(){if(n7.removeEventListener(tI4,this.listenerScrollDepth),n7.removeEventListener(Hl0,this.listenerScrollDepth),!!this.mp.get_config("record_heatmap_data")){Pw.log("Initializing scroll depth tracking"),this.maxScrollViewDepth=Math.max(Hh.documentElement.clientHeight,n7.innerHeight||0);var e=function(){if(!this.currentUrlBlocked()){var r=Math.max(Hh.documentElement.clientHeight,n7.innerHeight||0)+n7.scrollY;r>this.maxScrollViewDepth&&(this.maxScrollViewDepth=r),this.previousScrollHeight=Hh.body.scrollHeight}}.bind(this),t=eZ5(e);this.listenerScrollDepth=t.listener,n7.addEventListener(t.eventType,this.listenerScrollDepth)}};Sk.prototype.initClickTracking=function(){n7.removeEventListener(rd1,this.listenerClick),!(!this.getConfig(el0)&&!this.mp.get_config("record_heatmap_data"))&&(Pw.log("Initializing click tracking"),this.listenerClick=function(e){!this.getConfig(el0)&&!this.mp.is_recording_heatmap_data()||this.trackDomEvent(e,LZ5)}.bind(this),n7.addEventListener(rd1,this.listenerClick))};Sk.prototype.initDeadClickTracking=function(){var e=this._getClickTrackingConfig(rl0);if(!e&&!this.mp.get_config("record_heatmap_data")){this.stopDeadClickTracking();return}Pw.log("Initializing dead click tracking"),this._deadClickTracker||(this._deadClickTracker=new U91(function(t){this.trackDomEvent(t,wZ5)}.bind(this)),this._deadClickTracker.startTracking()),this.listenerDeadClick||(this.listenerDeadClick=function(t){var r=this._getClickTrackingConfig(rl0);if(!(!r&&!this.mp.is_recording_heatmap_data())&&!this.currentUrlBlocked()){var a=r||{};a.timeout_ms||(a.timeout_ms=o_7),this._deadClickTracker.trackClick(t,a)}}.bind(this),n7.addEventListener(rd1,this.listenerDeadClick))};Sk.prototype.initInputTracking=function(){n7.removeEventListener(ax2,this.listenerChange),this.getConfig(nD4)&&(Pw.log("Initializing input tracking"),this.listenerChange=function(e){this.getConfig(nD4)&&this.trackDomEvent(e,p_7)}.bind(this),n7.addEventListener(ax2,this.listenerChange))};Sk.prototype.initPageviewTracking=function(){if(n7.removeEventListener(AL1,this.listenerLocationchange),!!this.pageviewTrackingConfig()){Pw.log("Initializing pageview tracking");var e="",t=!1;this.currentUrlBlocked()||(t=this.mp.track_pageview(ix2)),t&&(e=d4.info.currentUrl()),this.listenerLocationchange=ex2(function(){if(!this.currentUrlBlocked()){var r=d4.info.currentUrl(),a=!1,i=r.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0],n=this.pageviewTrackingConfig();if(n===sZ5?a=r!==e:n===d_7?a=r.split("#")[0]!==e.split("#")[0]:n===u_7&&(a=i),a){var o=this.mp.track_pageview(ix2);o&&(e=r),i&&(this.lastScrollCheckpoint=0,Pw.log("Path change: re-initializing scroll depth checkpoints"))}}}.bind(this)),n7.addEventListener(AL1,this.listenerLocationchange)}};Sk.prototype.initRageClickTracking=function(){n7.removeEventListener(rd1,this.listenerRageClick);var e=this._getClickTrackingConfig(al0);!e&&!this.mp.get_config("record_heatmap_data")||(Pw.log("Initializing rage click tracking"),this._rageClickTracker||(this._rageClickTracker=new lZ5),this.listenerRageClick=function(t){var r=this._getClickTrackingConfig(al0);!r&&!this.mp.is_recording_heatmap_data()||this.currentUrlBlocked()||this._rageClickTracker.isRageClick(t,r)&&this.trackDomEvent(t,yZ5)}.bind(this),n7.addEventListener(rd1,this.listenerRageClick))};Sk.prototype.initScrollTracking=function(){if(n7.removeEventListener(Hl0,this.listenerScroll),n7.removeEventListener(tI4,this.listenerScroll),!!this.getConfig(oD4)){Pw.log("Initializing scroll tracking"),this.lastScrollCheckpoint=0;var e=function(){if(this.getConfig(oD4)&&!this.currentUrlBlocked()){var r=this.getConfig(CZ5),a=(this.getConfig(MZ5)||[]).slice().sort(function(f,v){return f-v}),i=n7.scrollY,n=d4.extend({$scroll_top:i},ix2);try{var o=Hh.body.scrollHeight,h=Math.round(i/(o-n7.innerHeight)*100);if(n.$scroll_height=o,n.$scroll_percentage=h,h>this.lastScrollCheckpoint)for(var u=0;u<a.length;u++){var g=a[u];h>=g&&this.lastScrollCheckpoint<g&&(n.$scroll_checkpoint=g,this.lastScrollCheckpoint=g,r=!0)}}catch(f){Pw.critical("Error while calculating scroll percentage",f)}r&&this.mp.track(f_7,n)}}.bind(this),t=eZ5(e);this.listenerScroll=t.listener,n7.addEventListener(t.eventType,this.listenerScroll)}};Sk.prototype.initSubmitTracking=function(){n7.removeEventListener(Jo0,this.listenerSubmit),this.getConfig(lD4)&&(Pw.log("Initializing submit tracking"),this.listenerSubmit=function(e){this.getConfig(lD4)&&this.trackDomEvent(e,v_7)}.bind(this),n7.addEventListener(Jo0,this.listenerSubmit))};Sk.prototype.initPageLeaveTracking=function(){if(Hh.removeEventListener(t_5,this.listenerPageLeaveVisibilitychange),n7.removeEventListener(AL1,this.listenerPageLeaveLocationchange),n7.removeEventListener(JP5,this.listenerPageLoad),!(!this.getConfig(kl0)&&!this.mp.get_config("record_heatmap_data"))){Pw.log("Initializing page visibility tracking."),this._initScrollDepthTracking();var e=d4.info.currentUrl();this.listenerPageLoad=function(){this.previousScrollHeight=Hh.body.scrollHeight}.bind(this),n7.addEventListener(JP5,this.listenerPageLoad),this.listenerPageLeaveLocationchange=ex2(function(t){if(!this.currentUrlBlocked()){var r=d4.info.currentUrl(),a=r!==e;a&&(this._trackPageLeave(t,e,this.previousScrollHeight),e=r,this.maxScrollViewDepth=Math.max(Hh.documentElement.clientHeight,n7.innerHeight||0),this.previousScrollHeight=Hh.body.scrollHeight,this.hasTrackedScrollSession=!1)}}.bind(this)),n7.addEventListener(AL1,this.listenerPageLeaveLocationchange),this.listenerPageLeaveVisibilitychange=function(t){Hh.hidden&&this._trackPageLeave(t,e,this.previousScrollHeight)}.bind(this),Hh.addEventListener(t_5,this.listenerPageLeaveVisibilitychange)}};Sk.prototype.stopDeadClickTracking=function(){this.listenerDeadClick&&(n7.removeEventListener(rd1,this.listenerDeadClick),this.listenerDeadClick=null),this._deadClickTracker&&(this._deadClickTracker.stopTracking(),this._deadClickTracker=null)};DR5(Sk);var C_7=function(e,t){return n7[i61]&&typeof n7[i61].then=="function"||(n7[i61]=new Promise(function(r){e(t,r)}).then(function(){var r=n7[i61];if(r&&typeof r.then=="function")return r;throw new Error("targeting failed to load")}).catch(function(r){throw delete n7[i61],r})),n7[i61]},qS=J_1("flags"),il0="flags",nl0="context",cD4={};cD4[nl0]={};var M_7=function(e,t){return e+":"+t},x_7=function(e){return e.split(":")[0]},ch=function(e){this.fetch=n7.fetch,this.getFullApiRoute=e.getFullApiRoute,this.getMpConfig=e.getConfigFunc,this.setMpConfig=e.setConfigFunc,this.getMpProperty=e.getPropertyFunc,this.track=e.trackingFunc,this.loadExtraBundle=e.loadExtraBundle||function(){},this.targetingSrc=e.targetingSrc||""};ch.prototype.init=function(){if(!this.minApisSupported()){qS.critical("Feature Flags unavailable: missing minimum required APIs");return}this.flags=null,this.fetchFlags(),this.trackedFeatures=new Set,this.pendingFirstTimeEvents={},this.activatedFirstTimeEvents={}};ch.prototype.getFullConfig=function(){var e=this.getMpConfig(il0);return e?d4.isObject(e)?d4.extend({},cD4,e):cD4:{}};ch.prototype.getConfig=function(e){return this.getFullConfig()[e]};ch.prototype.isSystemEnabled=function(){return!!this.getMpConfig(il0)};ch.prototype.updateContext=function(e,t){if(!this.isSystemEnabled())return qS.critical("Feature Flags not enabled, cannot update context"),Promise.resolve();var r=this.getMpConfig(il0);d4.isObject(r)||(r={});var a=t&&t.replace?{}:this.getConfig(nl0);return r[nl0]=d4.extend({},a,e),this.setMpConfig(il0,r),this.fetchFlags()};ch.prototype.areFlagsReady=function(){return this.isSystemEnabled()||qS.error("Feature Flags not enabled"),!!this.flags};ch.prototype.fetchFlags=function(){if(!this.isSystemEnabled())return Promise.resolve();var e=this.getMpProperty("distinct_id"),t=this.getMpProperty("$device_id"),r=jR5();qS.log("Fetching flags for distinct ID: "+e);var a=d4.extend({distinct_id:e,device_id:t},this.getConfig(nl0)),i=new URLSearchParams;i.set("context",JSON.stringify(a)),i.set("token",this.getMpConfig("token")),i.set("mp_lib","web"),i.set("$lib_version",LW.LIB_VERSION);var n=this.getFullApiRoute()+"?"+i.toString();return this._fetchInProgressStartTime=Date.now(),this.fetchPromise=this.fetch.call(n7,n,{method:"GET",headers:{Authorization:"Basic "+btoa(this.getMpConfig("token")+":"),traceparent:r}}).then(function(o){return this.markFetchComplete(),o.json().then(function(h){var u=h.flags;if(!u)throw new Error("No flags in API response");var g=new Map,f={};d4.each(u,function(C,L){var y=!1,z=L+":";if(d4.each(this.activatedFirstTimeEvents,function(B,R){R.startsWith(z)&&(y=!0)}),y){var S=this.flags&&this.flags.get(L);S&&g.set(L,S)}else g.set(L,{key:C.variant_key,value:C.variant_value,experiment_id:C.experiment_id,is_experiment_active:C.is_experiment_active,is_qa_tester:C.is_qa_tester})},this);var v=h.pending_first_time_events;v&&v.length>0&&d4.each(v,function(C){var L=C.flag_key,y=M_7(L,C.first_time_event_hash);this.activatedFirstTimeEvents[y]||(f[y]={flag_key:L,flag_id:C.flag_id,project_id:C.project_id,first_time_event_hash:C.first_time_event_hash,event_name:C.event_name,property_filters:C.property_filters,pending_variant:C.pending_variant})},this),this.activatedFirstTimeEvents&&d4.each(this.activatedFirstTimeEvents,function(C,L){var y=x_7(L);C&&!g.has(y)&&this.flags&&this.flags.has(y)&&g.set(y,this.flags.get(y))},this),this.flags=g,this.pendingFirstTimeEvents=f,this._traceparent=r,this._loadTargetingIfNeeded()}.bind(this)).catch(function(h){this.markFetchComplete(),qS.error(h)}.bind(this))}.bind(this)).catch(function(o){this.markFetchComplete(),qS.error(o)}.bind(this)),this.fetchPromise};ch.prototype.markFetchComplete=function(){if(!this._fetchInProgressStartTime){qS.error("Fetch in progress started time not set, cannot mark fetch complete");return}this._fetchStartTime=this._fetchInProgressStartTime,this._fetchCompleteTime=Date.now(),this._fetchLatency=this._fetchCompleteTime-this._fetchStartTime,this._fetchInProgressStartTime=null};ch.prototype._loadTargetingIfNeeded=function(){var e=!1;d4.each(this.pendingFirstTimeEvents,function(t){t.property_filters&&!d4.isEmptyObject(t.property_filters)&&(e=!0)}),e&&this.getTargeting().then(function(){qS.log("targeting loaded for property filter evaluation")})};ch.prototype.getTargeting=function(){return C_7(this.loadExtraBundle.bind(this),this.targetingSrc).catch(function(e){qS.error("Failed to load targeting: "+e)}.bind(this))};ch.prototype.checkFirstTimeEvents=function(e,t){!this.pendingFirstTimeEvents||d4.isEmptyObject(this.pendingFirstTimeEvents)||(n7[i61]&&d4.isFunction(n7[i61].then)?n7[i61].then(function(r){this._processFirstTimeEventCheck(e,t,r)}.bind(this)).catch(function(){this._processFirstTimeEventCheck(e,t,null)}.bind(this)):this._processFirstTimeEventCheck(e,t,null))};ch.prototype._processFirstTimeEventCheck=function(e,t,r){d4.each(this.pendingFirstTimeEvents,function(a,i){if(!this.activatedFirstTimeEvents[i]){var n=a.flag_key,o;if(!r&&a.property_filters&&!d4.isEmptyObject(a.property_filters)){qS.warn('Skipping event check for "'+n+'" - property filters require targeting library');return}if(!r)o={matches:e===a.event_name,error:null};else{var h={event_name:a.event_name,property_filters:a.property_filters};o=r.eventMatchesCriteria(e,t,h)}if(o.error){qS.error('Error checking first-time event for flag "'+n+'": '+o.error);return}if(o.matches){qS.log('First-time event matched for flag "'+n+'": '+e);var u={key:a.pending_variant.variant_key,value:a.pending_variant.variant_value,experiment_id:a.pending_variant.experiment_id,is_experiment_active:a.pending_variant.is_experiment_active};this.flags.set(n,u),this.activatedFirstTimeEvents[i]=!0,this.recordFirstTimeEvent(a.flag_id,a.project_id,a.first_time_event_hash)}}},this)};ch.prototype.getFirstTimeEventApiRoute=function(e){return this.getFullApiRoute()+"/"+e+"/first-time-events"};ch.prototype.recordFirstTimeEvent=function(e,t,r){var a=this.getMpProperty("distinct_id"),i=jR5(),n=new URLSearchParams;n.set("mp_lib","web"),n.set("$lib_version",LW.LIB_VERSION);var o=this.getFirstTimeEventApiRoute(e)+"?"+n.toString(),h={distinct_id:a,project_id:t,first_time_event_hash:r};qS.log("Recording first-time event for flag: "+e),this.fetch.call(n7,o,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Basic "+btoa(this.getMpConfig("token")+":"),traceparent:i},body:JSON.stringify(h)}).catch(function(u){qS.error("Failed to record first-time event for flag "+e+": "+u)})};ch.prototype.getVariant=function(e,t){return this.fetchPromise?this.fetchPromise.then(function(){return this.getVariantSync(e,t)}.bind(this)).catch(function(r){return qS.error(r),t}):new Promise(function(r){qS.critical("Feature Flags not initialized"),r(t)})};ch.prototype.getVariantSync=function(e,t){if(!this.areFlagsReady())return qS.log("Flags not loaded yet"),t;var r=this.flags.get(e);return r?(this.trackFeatureCheck(e,r),r):(qS.log('No flag found: "'+e+'"'),t)};ch.prototype.getVariantValue=function(e,t){return this.getVariant(e,{value:t}).then(function(r){return r.value}).catch(function(r){return qS.error(r),t})};ch.prototype.getFeatureData=function(e,t){return qS.critical("mixpanel.flags.get_feature_data() is deprecated and will be removed in a future release. Use mixpanel.flags.get_variant_value() instead."),this.getVariantValue(e,t)};ch.prototype.getVariantValueSync=function(e,t){return this.getVariantSync(e,{value:t}).value};ch.prototype.isEnabled=function(e,t){return this.getVariantValue(e).then(function(){return this.isEnabledSync(e,t)}.bind(this)).catch(function(r){return qS.error(r),t})};ch.prototype.isEnabledSync=function(e,t){t=t||!1;var r=this.getVariantValueSync(e,t);return r!==!0&&r!==!1&&(qS.error('Feature flag "'+e+'" value: '+r+" is not a boolean; returning fallback value: "+t),r=t),r};ch.prototype.trackFeatureCheck=function(e,t){if(!this.trackedFeatures.has(e)){this.trackedFeatures.add(e);var r={"Experiment name":e,"Variant name":t.key,$experiment_type:"feature_flag","Variant fetch start time":new Date(this._fetchStartTime).toISOString(),"Variant fetch complete time":new Date(this._fetchCompleteTime).toISOString(),"Variant fetch latency (ms)":this._fetchLatency,"Variant fetch traceparent":this._traceparent};t.experiment_id!=="undefined"&&(r.$experiment_id=t.experiment_id),t.is_experiment_active!=="undefined"&&(r.$is_experiment_active=t.is_experiment_active),t.is_qa_tester!=="undefined"&&(r.$is_qa_tester=t.is_qa_tester),this.track("$experiment_started",r)}};ch.prototype.minApisSupported=function(){return!!this.fetch&&typeof Promise<"u"&&typeof Map<"u"&&typeof Set<"u"};DR5(ch);ch.prototype.are_flags_ready=ch.prototype.areFlagsReady;ch.prototype.get_variant=ch.prototype.getVariant;ch.prototype.get_variant_sync=ch.prototype.getVariantSync;ch.prototype.get_variant_value=ch.prototype.getVariantValue;ch.prototype.get_variant_value_sync=ch.prototype.getVariantValueSync;ch.prototype.is_enabled=ch.prototype.isEnabled;ch.prototype.is_enabled_sync=ch.prototype.isEnabledSync;ch.prototype.update_context=ch.prototype.updateContext;ch.prototype.get_feature_data=ch.prototype.getFeatureData;ch.prototype.getTargeting=ch.prototype.getTargeting;var nd1=function(){};nd1.prototype.create_properties=function(){};nd1.prototype.event_handler=function(){};nd1.prototype.after_track_handler=function(){};nd1.prototype.init=function(e){return this.mp=e,this};nd1.prototype.track=function(e,t,r,a){var i=this,n=d4.dom_query(e);if(n.length===0){jd.error("The DOM query ("+e+") returned 0 elements");return}return d4.each(n,function(o){d4.register_event(o,this.override_event,function(h){var u={},g=i.create_properties(r,this),f=i.mp.get_config("track_links_timeout");i.event_handler(h,this,u),window.setTimeout(i.track_callback(a,g,u,!0),f),i.mp.track(t,g,i.track_callback(a,g,u))})},this),!0};nd1.prototype.track_callback=function(e,t,r,a){a=a||!1;var i=this;return function(){r.callback_fired||(r.callback_fired=!0,!(e&&e(a,t)===!1)&&i.after_track_handler(t,r,a))}};nd1.prototype.create_properties=function(e,t){var r;return typeof e=="function"?r=e(t):r=d4.extend({},e),r};var p12=function(){this.override_event="click"};d4.inherit(p12,nd1);p12.prototype.create_properties=function(e,t){var r=p12.superclass.create_properties.apply(this,arguments);return t.href&&(r.url=t.href),r};p12.prototype.event_handler=function(e,t,r){r.new_tab=e.which===2||e.metaKey||e.ctrlKey||t.target==="_blank",r.href=t.href,r.new_tab||e.preventDefault()};p12.prototype.after_track_handler=function(e,t){t.new_tab||setTimeout(function(){window.location=t.href},0)};var Tl0=function(){this.override_event="submit"};d4.inherit(Tl0,nd1);Tl0.prototype.event_handler=function(e,t,r){r.element=t,e.preventDefault()};Tl0.prototype.after_track_handler=function(e,t){setTimeout(function(){t.element.submit()},0)};var SL1="$set",f12="$set_once",n61="$unset",W_1="$add",I91="$append",q_1="$union",Jh1="$remove",L_7="$delete",AZ5={set_action:function(e,t){var r={},a={};return d4.isObject(e)?d4.each(e,function(i,n){this._is_reserved_property(n)||(a[n]=i)},this):a[e]=t,r[SL1]=a,r},unset_action:function(e){var t={},r=[];return d4.isArray(e)||(e=[e]),d4.each(e,function(a){this._is_reserved_property(a)||r.push(a)},this),t[n61]=r,t},set_once_action:function(e,t){var r={},a={};return d4.isObject(e)?d4.each(e,function(i,n){this._is_reserved_property(n)||(a[n]=i)},this):a[e]=t,r[f12]=a,r},union_action:function(e,t){var r={},a={};return d4.isObject(e)?d4.each(e,function(i,n){this._is_reserved_property(n)||(a[n]=d4.isArray(i)?i:[i])},this):a[e]=d4.isArray(t)?t:[t],r[q_1]=a,r},append_action:function(e,t){var r={},a={};return d4.isObject(e)?d4.each(e,function(i,n){this._is_reserved_property(n)||(a[n]=i)},this):a[e]=t,r[I91]=a,r},remove_action:function(e,t){var r={},a={};return d4.isObject(e)?d4.each(e,function(i,n){this._is_reserved_property(n)||(a[n]=i)},this):a[e]=t,r[Jh1]=a,r},delete_action:function(){var e={};return e[L_7]="",e}},Ry=function(){};d4.extend(Ry.prototype,AZ5);Ry.prototype._init=function(e,t,r){this._mixpanel=e,this._group_key=t,this._group_id=r};Ry.prototype.set=v12(function(e,t,r){var a=this.set_action(e,t);return d4.isObject(e)&&(r=t),this._send_request(a,r)});Ry.prototype.set_once=v12(function(e,t,r){var a=this.set_once_action(e,t);return d4.isObject(e)&&(r=t),this._send_request(a,r)});Ry.prototype.unset=v12(function(e,t){var r=this.unset_action(e);return this._send_request(r,t)});Ry.prototype.union=v12(function(e,t,r){d4.isObject(e)&&(r=t);var a=this.union_action(e,t);return this._send_request(a,r)});Ry.prototype.delete=v12(function(e){var t=this.delete_action();return this._send_request(t,e)});Ry.prototype.remove=v12(function(e,t,r){var a=this.remove_action(e,t);return this._send_request(a,r)});Ry.prototype._send_request=function(e,t){e.$group_key=this._group_key,e.$group_id=this._group_id,e.$token=this._get_config("token");var r=d4.encodeDates(e);return this._mixpanel._track_or_batch({type:"groups",data:r,endpoint:this._mixpanel.get_api_host("groups")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},t)};Ry.prototype._is_reserved_property=function(e){return e==="$group_key"||e==="$group_id"};Ry.prototype._get_config=function(e){return this._mixpanel.get_config(e)};Ry.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id};Ry.prototype.remove=Ry.prototype.remove;Ry.prototype.set=Ry.prototype.set;Ry.prototype.set_once=Ry.prototype.set_once;Ry.prototype.union=Ry.prototype.union;Ry.prototype.unset=Ry.prototype.unset;Ry.prototype.toString=Ry.prototype.toString;var Gh=function(){};d4.extend(Gh.prototype,AZ5);Gh.prototype._init=function(e){this._mixpanel=e};Gh.prototype.set=ZL1(function(e,t,r){var a=this.set_action(e,t);return d4.isObject(e)&&(r=t),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),a[SL1]=d4.extend({},d4.info.people_properties(),a[SL1]),this._send_request(a,r)});Gh.prototype.set_once=ZL1(function(e,t,r){var a=this.set_once_action(e,t);return d4.isObject(e)&&(r=t),this._send_request(a,r)});Gh.prototype.unset=ZL1(function(e,t){var r=this.unset_action(e);return this._send_request(r,t)});Gh.prototype.increment=ZL1(function(e,t,r){var a={},i={};return d4.isObject(e)?(d4.each(e,function(n,o){if(!this._is_reserved_property(o))if(isNaN(parseFloat(n))){jd.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else i[o]=n},this),r=t):(d4.isUndefined(t)&&(t=1),i[e]=t),a[W_1]=i,this._send_request(a,r)});Gh.prototype.append=ZL1(function(e,t,r){d4.isObject(e)&&(r=t);var a=this.append_action(e,t);return this._send_request(a,r)});Gh.prototype.remove=ZL1(function(e,t,r){d4.isObject(e)&&(r=t);var a=this.remove_action(e,t);return this._send_request(a,r)});Gh.prototype.union=ZL1(function(e,t,r){d4.isObject(e)&&(r=t);var a=this.union_action(e,t);return this._send_request(a,r)});Gh.prototype.track_charge=ZL1(function(){jd.error("mixpanel.people.track_charge() is deprecated and no longer has any effect.")});Gh.prototype.clear_charges=function(e){return this.set("$transactions",[],e)};Gh.prototype.delete_user=function(){if(!this._identify_called()){jd.error("mixpanel.people.delete_user() requires you to call identify() first");return}var e={$delete:this._mixpanel.get_distinct_id()};return this._send_request(e)};Gh.prototype.toString=function(){return this._mixpanel.toString()+".people"};Gh.prototype._send_request=function(e,t){e.$token=this._get_config("token"),e.$distinct_id=this._mixpanel.get_distinct_id();var r=this._mixpanel.get_property("$device_id"),a=this._mixpanel.get_property("$user_id"),i=this._mixpanel.get_property("$had_persisted_distinct_id");r&&(e.$device_id=r),a&&(e.$user_id=a),i&&(e.$had_persisted_distinct_id=i);var n=d4.encodeDates(e);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:n,endpoint:this._mixpanel.get_api_host("people")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},t):(this._enqueue(e),d4.isUndefined(t)||(this._get_config("verbose")?t({status:-1,error:null}):t(-1)),d4.truncate(n,255))};Gh.prototype._get_config=function(e){return this._mixpanel.get_config(e)};Gh.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0};Gh.prototype._enqueue=function(e){SL1 in e?this._mixpanel.persistence._add_to_people_queue(SL1,e):f12 in e?this._mixpanel.persistence._add_to_people_queue(f12,e):n61 in e?this._mixpanel.persistence._add_to_people_queue(n61,e):W_1 in e?this._mixpanel.persistence._add_to_people_queue(W_1,e):I91 in e?this._mixpanel.persistence._add_to_people_queue(I91,e):Jh1 in e?this._mixpanel.persistence._add_to_people_queue(Jh1,e):q_1 in e?this._mixpanel.persistence._add_to_people_queue(q_1,e):jd.error("Invalid call to _enqueue():",e)};Gh.prototype._flush_one_queue=function(e,t,r,a){var i=this,n=d4.extend({},this._mixpanel.persistence.load_queue(e)),o=n;!d4.isUndefined(n)&&d4.isObject(n)&&!d4.isEmptyObject(n)&&(i._mixpanel.persistence._pop_from_people_queue(e,n),i._mixpanel.persistence.save(),a&&(o=a(n)),t.call(i,o,function(h,u){h===0&&i._mixpanel.persistence._add_to_people_queue(e,n),d4.isUndefined(r)||r(h,u)}))};Gh.prototype._flush=function(e,t,r,a,i,n,o){var h=this;this._flush_one_queue(SL1,this.set,e),this._flush_one_queue(f12,this.set_once,a),this._flush_one_queue(n61,this.unset,n,function(S){return d4.keys(S)}),this._flush_one_queue(W_1,this.increment,t),this._flush_one_queue(q_1,this.union,i);var u=this._mixpanel.persistence.load_queue(I91);if(!d4.isUndefined(u)&&d4.isArray(u)&&u.length)for(var g,f=function(S,B){S===0&&h._mixpanel.persistence._add_to_people_queue(I91,g),d4.isUndefined(r)||r(S,B)},v=u.length-1;v>=0;v--)u=this._mixpanel.persistence.load_queue(I91),g=u.pop(),h._mixpanel.persistence.save(),d4.isEmptyObject(g)||h.append(g,f);var C=this._mixpanel.persistence.load_queue(Jh1);if(!d4.isUndefined(C)&&d4.isArray(C)&&C.length)for(var L,y=function(S,B){S===0&&h._mixpanel.persistence._add_to_people_queue(Jh1,L),d4.isUndefined(o)||o(S,B)},z=C.length-1;z>=0;z--)C=this._mixpanel.persistence.load_queue(Jh1),L=C.pop(),h._mixpanel.persistence.save(),d4.isEmptyObject(L)||h.remove(L,y)};Gh.prototype._is_reserved_property=function(e){return e==="$distinct_id"||e==="$token"||e==="$device_id"||e==="$user_id"||e==="$had_persisted_distinct_id"};Gh.prototype.set=Gh.prototype.set;Gh.prototype.set_once=Gh.prototype.set_once;Gh.prototype.unset=Gh.prototype.unset;Gh.prototype.increment=Gh.prototype.increment;Gh.prototype.append=Gh.prototype.append;Gh.prototype.remove=Gh.prototype.remove;Gh.prototype.union=Gh.prototype.union;Gh.prototype.track_charge=Gh.prototype.track_charge;Gh.prototype.clear_charges=Gh.prototype.clear_charges;Gh.prototype.delete_user=Gh.prototype.delete_user;Gh.prototype.toString=Gh.prototype.toString;var rI4="__mps",aI4="__mpso",iI4="__mpus",nI4="__mpa",oI4="__mpap",lI4="__mpr",cI4="__mpu",zZ5="$people_distinct_id",ol0="__alias",nx2="__timers",w_7=[rI4,aI4,iI4,nI4,oI4,lI4,cI4,zZ5,ol0,nx2],Lg=function(e){this.props={},this.campaign_params_saved=!1,e.persistence_name?this.name="mp_"+e.persistence_name:this.name="mp_"+e.token+"_mixpanel";var t=e.persistence;t!=="cookie"&&t!=="localStorage"&&(jd.critical("Unknown persistence type "+t+"; falling back to cookie"),t=e.persistence="cookie"),t==="localStorage"&&d4.localStorage.is_supported()?this.storage=d4.localStorage:this.storage=d4.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};Lg.prototype.properties=function(){var e={};return this.load(),d4.each(this.props,function(t,r){d4.include(w_7,r)||(e[r]=t)}),e};Lg.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=d4.extend({},e))}};Lg.prototype.upgrade=function(){var e,t;this.storage===d4.localStorage?(e=d4.cookie.parse(this.name),d4.cookie.remove(this.name),d4.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===d4.cookie&&(t=d4.localStorage.parse(this.name),d4.localStorage.remove(this.name),t&&this.register_once(t))};Lg.prototype.save=function(){this.disabled||this.storage.set(this.name,g12(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)};Lg.prototype.load_prop=function(e){return this.load(),this.props[e]};Lg.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)};Lg.prototype.clear=function(){this.remove(),this.props={}};Lg.prototype.register_once=function(e,t,r){return d4.isObject(e)?(typeof t>"u"&&(t="None"),this.expire_days=typeof r>"u"?this.default_expiry:r,this.load(),d4.each(e,function(a,i){(!this.props.hasOwnProperty(i)||this.props[i]===t)&&(this.props[i]=a)},this),this.save(),!0):!1};Lg.prototype.register=function(e,t){return d4.isObject(e)?(this.expire_days=typeof t>"u"?this.default_expiry:t,this.load(),d4.extend(this.props,e),this.save(),!0):!1};Lg.prototype.unregister=function(e){this.load(),e in this.props&&(delete this.props[e],this.save())};Lg.prototype.update_search_keyword=function(e){this.register(d4.info.searchInfo(e))};Lg.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:d4.info.referringDomain(e)||"$direct"},"")};Lg.prototype.get_referrer_info=function(){return d4.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})};Lg.prototype.update_config=function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cookie_domain(e.cookie_domain),this.set_cross_site(e.cross_site_cookie),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)};Lg.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()};Lg.prototype.set_cookie_domain=function(e){e!==this.cookie_domain&&(this.remove(),this.cookie_domain=e,this.save())};Lg.prototype.set_cross_site=function(e){e!==this.cross_site&&(this.cross_site=e,this.remove(),this.save())};Lg.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())};Lg.prototype.get_cross_subdomain=function(){return this.cross_subdomain};Lg.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())};Lg.prototype._add_to_people_queue=function(e,t){var r=this._get_queue_key(e),a=t[e],i=this._get_or_create_queue(SL1),n=this._get_or_create_queue(f12),o=this._get_or_create_queue(n61),h=this._get_or_create_queue(W_1),u=this._get_or_create_queue(q_1),g=this._get_or_create_queue(Jh1,[]),f=this._get_or_create_queue(I91,[]);r===rI4?(d4.extend(i,a),this._pop_from_people_queue(W_1,a),this._pop_from_people_queue(q_1,a),this._pop_from_people_queue(n61,a)):r===aI4?(d4.each(a,function(v,C){C in n||(n[C]=v)}),this._pop_from_people_queue(n61,a)):r===iI4?d4.each(a,function(v){d4.each([i,n,h,u],function(C){v in C&&delete C[v]}),d4.each(f,function(C){v in C&&delete C[v]}),o[v]=!0}):r===nI4?(d4.each(a,function(v,C){C in i?i[C]+=v:(C in h||(h[C]=0),h[C]+=v)},this),this._pop_from_people_queue(n61,a)):r===cI4?(d4.each(a,function(v,C){d4.isArray(v)&&(C in u||(u[C]=[]),d4.each(v,function(L){d4.include(u[C],L)||u[C].push(L)}))}),this._pop_from_people_queue(n61,a)):r===lI4?(g.push(a),this._pop_from_people_queue(I91,a)):r===oI4&&(f.push(a),this._pop_from_people_queue(n61,a)),jd.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),jd.log(t),this.save()};Lg.prototype._pop_from_people_queue=function(e,t){var r=this.props[this._get_queue_key(e)];d4.isUndefined(r)||d4.each(t,function(a,i){e===I91||e===Jh1?d4.each(r,function(n){n[i]===a&&delete n[i]}):delete r[i]},this)};Lg.prototype.load_queue=function(e){return this.load_prop(this._get_queue_key(e))};Lg.prototype._get_queue_key=function(e){if(e===SL1)return rI4;if(e===f12)return aI4;if(e===n61)return iI4;if(e===W_1)return nI4;if(e===I91)return oI4;if(e===Jh1)return lI4;if(e===q_1)return cI4;jd.error("Invalid queue:",e)};Lg.prototype._get_or_create_queue=function(e,t){var r=this._get_queue_key(e);return t=d4.isUndefined(t)?{}:t,this.props[r]||(this.props[r]=t)};Lg.prototype.set_event_timer=function(e,t){var r=this.load_prop(nx2)||{};r[e]=t,this.props[nx2]=r,this.save()};Lg.prototype.remove_event_timer=function(e){var t=this.load_prop(nx2)||{},r=t[e];return d4.isUndefined(r)||(delete this.props[nx2][e],this.save()),r};var ll0,sI4=function(e,t){throw new Error(e+" not available in this build.")},NO,sD4=0,y_7=1,c21="mixpanel",bZ5="base64",A_7="json",hI4="$device:",z_7="strict",b_7="fallback",S_7="disabled",r12=n7.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,SZ5=!r12&&F91.indexOf("MSIE")===-1&&F91.indexOf("Mozilla")===-1,cl0=null;Xh1.sendBeacon&&(cl0=function(){return Xh1.sendBeacon.apply(Xh1,arguments)});var HZ5={track:"track/",engage:"engage/",groups:"groups/",record:"record/",flags:"flags/",settings:"settings/"},hD4={api_host:"https://api-js.mixpanel.com",api_hosts:{},api_routes:HZ5,api_extra_query_params:{},api_method:"POST",api_transport:"XHR",api_payload_format:bZ5,app_host:"https://mixpanel.com",autocapture:!1,cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:zL1,flags:!1,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:zL1,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video, audio",record_canvas:!1,record_collect_fonts:!1,record_console:!0,record_heatmap_data:!1,record_idle_timeout_ms:1800*1e3,record_mask_inputs:!0,record_max_ms:RM2,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js",targeting_src:"https://cdn.mxpnl.com/libs/mixpanel-targeting.min.js",remote_settings_mode:S_7},kZ5=!1,K6=function(){},dD4=function(e,t,r){var a,i=r===c21?NO:NO[r];if(i&&ll0===sD4)a=i;else{if(i&&!d4.isArray(i)){jd.error("You have already initialized "+r);return}a=new K6}if(a._cached_groups={},a._init(e,t,r),a.people=new Gh,a.people._init(a),!a.get_config("skip_first_touch_marketing")){var n=d4.info.campaignParams(null),o={},h=!1;d4.each(n,function(g,f){o["initial_"+f]=g,g&&(h=!0)}),h&&a.people.set_once(o)}LW.DEBUG=LW.DEBUG||a.get_config("debug");var u=ll0===sD4?"module":"snippet";return n7.dispatchEvent(new n7.CustomEvent("$mp_sdk_to_extension_event",{detail:{instance:a,source:u,token:e,name:r,info:d4.info}})),!d4.isUndefined(i)&&d4.isArray(i)&&(a._execute_array.call(a.people,i.people),a._execute_array(i)),a};K6.prototype.init=function(e,t,r){if(d4.isUndefined(r)){this.report_error("You must name your new library: init(token, config, name)");return}if(r===c21){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var a=dD4(e,t,r);return NO[r]=a,a._loaded(),a};K6.prototype._init=function(e,t,r){t=t||{},this.__loaded=!0,this.config={};var a={};if(!("api_payload_format"in t)){var i=t.api_host||hD4.api_host;i.match(/\.mixpanel\.com/)&&(a.api_payload_format=A_7)}if(this.hooks={},this.set_config(d4.extend({},hD4,a,t,{name:r,token:e,callback_fn:(r===c21?r:c21+"."+r)+"._jsc"})),this._jsc=zL1,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests){if(!d4.localStorage.is_supported(!0)||!r12)this._batch_requests=!1,jd.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),d4.each(this.get_batcher_configs(),function(u){jd.log("Clearing batch queue "+u.queue_key),d4.localStorage.remove(u.queue_key)});else if(this.init_batchers(),cl0&&n7.addEventListener){var n=d4.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);n7.addEventListener("pagehide",function(u){u.persisted&&n()}),n7.addEventListener("visibilitychange",function(){Hh.visibilityState==="hidden"&&n()})}}this.persistence=this.cookie=new Lg(this.config),this.unpersisted_superprops={},this._gdpr_init();var o=d4.UUID();this.get_distinct_id()||this.register_once({distinct_id:hI4+o,$device_id:o},""),this.flags=new ch({getFullApiRoute:d4.bind(function(){return this.get_api_host("flags")+"/"+this.get_config("api_routes").flags},this),getConfigFunc:d4.bind(this.get_config,this),setConfigFunc:d4.bind(this.set_config,this),getPropertyFunc:d4.bind(this.get_property,this),trackingFunc:d4.bind(this.track,this),loadExtraBundle:sI4,targetingSrc:this.get_config("targeting_src")}),this.flags.init(),this.flags=this.flags,this.autocapture=new Sk(this),this.autocapture.init(),this._init_tab_id();var h=this.get_config("remote_settings_mode");h===z_7||h===b_7?this._fetch_remote_settings(h).then(d4.bind(function(){this._check_and_start_session_recording()},this)):this._check_and_start_session_recording()};K6.prototype._init_tab_id=function(){if(this.get_config("disable_persistence"))jd.log("Tab ID initialization skipped due to disable_persistence config");else if(d4.sessionStorage.is_supported())try{var e=this.get_config("name")+"_"+this.get_config("token"),t="mp_tab_id_"+e,r="mp_gen_new_tab_id_"+e;(d4.sessionStorage.get(r)||!d4.sessionStorage.get(t))&&d4.sessionStorage.set(t,"$tab-"+d4.UUID()),d4.sessionStorage.set(r,"1"),this.tab_id=d4.sessionStorage.get(t),n7.addEventListener("beforeunload",function(){d4.sessionStorage.remove(r)})}catch(a){this.report_error("Error initializing tab id",a)}else this.report_error("Session storage is not supported, cannot keep track of unique tab ID.")};K6.prototype.get_tab_id=function(){return this.tab_id||null};K6.prototype._should_load_recorder=function(){if(this.get_config("disable_persistence"))return jd.log("Load recorder check skipped due to disable_persistence config"),Promise.resolve(!1);var e=new o61(KD4),t=this.get_tab_id();return e.init().then(function(){return e.getAll()}).then(function(r){for(var a=0;a<r.length;a++)if(QD4(r[a])||r[a].tabId===t)return!0;return!1}).catch(d4.bind(function(r){this.report_error("Error checking recording registry",r)},this))};K6.prototype._check_and_start_session_recording=RL1(function(e){if(!n7.MutationObserver){jd.critical("Browser does not support MutationObserver; skipping session recording");return}var t=d4.bind(function(a){var i=d4.bind(function(){this._recorder=this._recorder||new n7[QF4](this),this._recorder.resumeRecording(a)},this);d4.isUndefined(n7[QF4])?sI4(this.get_config("recorder_src"),i):i()},this),r=this.get_config("record_sessions_percent")>0&&Math.random()*100<=this.get_config("record_sessions_percent");e||r?t(!0):this._should_load_recorder().then(function(a){a&&t(!1)})});K6.prototype.start_session_recording=function(){this._check_and_start_session_recording(!0)};K6.prototype.stop_session_recording=function(){return this._recorder?this._recorder.stopRecording():Promise.resolve()};K6.prototype.pause_session_recording=function(){return this._recorder?this._recorder.pauseRecording():Promise.resolve()};K6.prototype.resume_session_recording=function(){return this._recorder?this._recorder.resumeRecording():Promise.resolve()};K6.prototype.is_recording_heatmap_data=function(){return this._get_session_replay_id()&&this.get_config("record_heatmap_data")};K6.prototype.get_session_recording_properties=function(){var e={},t=this._get_session_replay_id();return t&&(e.$mp_replay_id=t),e};K6.prototype.get_session_replay_url=function(){var e=null,t=this._get_session_replay_id();if(t){var r=d4.HTTPBuildQuery({replay_id:t,distinct_id:this.get_distinct_id(),token:this.get_config("token")});e="https://mixpanel.com/projects/replay-redirect?"+r}return e};K6.prototype._get_session_replay_id=function(){var e=null;return this._recorder&&(e=this._recorder.replayId),e||null};K6.prototype.__get_recorder=function(){return this._recorder};K6.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var e=d4.info.campaignParams(null);d4.each(e,function(t,r){this.unregister(r)}.bind(this))}};K6.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(Hh.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(d4.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(Hh.referrer)};K6.prototype._dom_loaded=function(){d4.each(this.__dom_loaded_queue,function(e){this._track_dom.apply(this,e)},this),this.has_opted_out_tracking()||d4.each(this.__request_queue,function(e){this._send_request.apply(this,e)},this),delete this.__dom_loaded_queue,delete this.__request_queue};K6.prototype._track_dom=function(e,t){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!kZ5)return this.__dom_loaded_queue.push([e,t]),!1;var r=new e().init(this);return r.track.apply(r,t)};K6.prototype._prepare_callback=function(e,t){if(d4.isUndefined(e))return null;if(r12){var r=function(o){e(o,t)};return r}else{var a=this._jsc,i=""+Math.floor(Math.random()*1e8),n=this.get_config("callback_fn")+"["+i+"]";return a[i]=function(o){delete a[i],e(o,t)},n}};K6.prototype._send_request=function(e,t,r,a){var i=!0;if(SZ5)return this.__request_queue.push(arguments),i;var n={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},o=null;!a&&(d4.isFunction(r)||typeof r=="string")&&(a=r,r=null),r=d4.extend(n,r||{}),r12||(r.method="GET");var h=r.method==="POST",u=cl0&&h&&r.transport.toLowerCase()==="sendbeacon",g=r.verbose;t.verbose&&(g=!0),this.get_config("test")&&(t.test=1),g&&(t.verbose=1),this.get_config("img")&&(t.img=1),r12||(a?t.callback=a:(g||this.get_config("test"))&&(t.callback="(function(){})")),t.ip=this.get_config("ip")?1:0,t._=new Date().getTime().toString(),h&&(o="data="+encodeURIComponent(t.data),delete t.data),d4.extend(t,this.get_config("api_extra_query_params")),e+="?"+d4.HTTPBuildQuery(t);var f=this;if("img"in t){var v=Hh.createElement("img");v.src=e,Hh.body.appendChild(v)}else if(u){try{i=cl0(e,o)}catch(B){f.report_error(B),i=!1}try{a&&a(i?1:0)}catch(B){f.report_error(B)}}else if(r12)try{var C=new XMLHttpRequest;C.open(r.method,e,!0);var L=this.get_config("xhr_headers");if(h&&(L["Content-Type"]="application/x-www-form-urlencoded"),d4.each(L,function(B,R){C.setRequestHeader(R,B)}),r.timeout_ms&&typeof C.timeout<"u"){C.timeout=r.timeout_ms;var y=new Date().getTime()}C.withCredentials=!0,C.onreadystatechange=function(){if(C.readyState===4)if(C.status===200){if(a)if(g){var B;try{B=d4.JSONDecode(C.responseText)}catch(N){if(f.report_error(N),r.ignore_json_errors)B=C.responseText;else return}a(B)}else a(Number(C.responseText))}else{var R;if(C.timeout&&!C.status&&new Date().getTime()-y>=C.timeout?R="timeout":R="Bad HTTP status: "+C.status+" "+C.statusText,f.report_error(R),a)if(g){var F=C.responseHeaders||{};a({status:0,httpStatusCode:C.status,error:R,retryAfter:F["Retry-After"]})}else a(0)}},C.send(o)}catch(B){f.report_error(B),i=!1}else{var z=Hh.createElement("script");z.type="text/javascript",z.async=!0,z.defer=!0,z.src=e;var S=Hh.getElementsByTagName("script")[0];S.parentNode.insertBefore(z,S)}return i};K6.prototype._fetch_remote_settings=function(e){var t=function(){e==="strict"&&o.set_config({record_sessions_percent:0})};if(!n7.AbortController)return jd.critical("Remote settings unavailable: missing minimum required APIs"),t(),Promise.resolve();var r=this.get_api_host("settings")+"/"+this.get_config("api_routes").settings,a={$lib_version:LW.LIB_VERSION,mp_lib:"web",sdk_config:"1"},i=d4.HTTPBuildQuery(a),n=r+"?"+i,o=this,h=new AbortController,u=setTimeout(function(){h.abort()},500),g={method:"GET",headers:{Authorization:"Basic "+btoa(o.get_config("token")+":")},signal:h.signal};return n7.fetch(n,g).then(function(f){if(clearTimeout(u),!f.ok){jd.critical("Network response was not ok"),t();return}return f.json()}).then(function(f){if(f&&f.sdk_config&&f.sdk_config.config){var v=f.sdk_config.config,C={};d4.each(v,function(L,y){hD4.hasOwnProperty(y)&&(C[y]=L)}),d4.isEmptyObject(C)?(jd.critical("No valid config keys found in remote settings."),t()):o.set_config(C)}else t()}).catch(function(f){clearTimeout(u),jd.critical("Failed to fetch remote settings",f),t()})};K6.prototype._execute_array=function(e){var t,r=[],a=[],i=[];d4.each(e,function(o){o&&(t=o[0],d4.isArray(t)?i.push(o):typeof o=="function"?o.call(this):d4.isArray(o)&&t==="alias"?r.push(o):d4.isArray(o)&&t.indexOf("track")!==-1&&typeof this[t]=="function"?i.push(o):a.push(o))},this);var n=function(o,h){d4.each(o,function(u){if(d4.isArray(u[0])){var g=h;d4.each(u,function(f){g=g[f[0]].apply(g,f.slice(1))})}else this[u[0]].apply(this,u.slice(1))},h)};n(r,this),n(a,this),n(i,this)};K6.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events};K6.prototype.get_batcher_configs=function(){var e="__mpq_"+this.get_config("token");return this._batcher_configs=this._batcher_configs||{events:{type:"events",api_name:"track",queue_key:e+"_ev"},people:{type:"people",api_name:"engage",queue_key:e+"_pp"},groups:{type:"groups",api_name:"groups",queue_key:e+"_gr"}},this._batcher_configs};K6.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=d4.bind(function(r){return new s21(r.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:d4.bind(function(a,i,n){var o=this.get_config("api_routes");this._send_request(this.get_api_host(r.api_name)+"/"+o[r.api_name],this._encode_data_for_request(a),i,this._prepare_callback(n,a))},this),beforeSendHook:d4.bind(function(a){var i=this._run_hook("before_send_"+r.type,a);return i?i[0]:null},this),stopAllBatchingFunc:d4.bind(this.stop_batch_senders,this),usePersistence:!0})},this),t=this.get_batcher_configs();this.request_batchers={events:e(t.events),people:e(t.people),groups:e(t.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()};K6.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,d4.each(this.request_batchers,function(e){e.start()}))};K6.prototype.stop_batch_senders=function(){this._batch_requests=!1,d4.each(this.request_batchers,function(e){e.stop(),e.clear()})};K6.prototype.push=function(e){this._execute_array([e])};K6.prototype.disable=function(e){typeof e>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(e)};K6.prototype._encode_data_for_request=function(e){var t=g12(e);return this.get_config("api_payload_format")===bZ5&&(t=d4.base64Encode(t)),{data:t}};K6.prototype._track_or_batch=function(e,t){var r=d4.truncate(e.data,255),a=e.endpoint,i=e.batcher,n=e.should_send_immediately,o=e.send_request_options||{};t=t||zL1;var h=!0,u=d4.bind(function(){return o.skip_hooks||(r=this._run_hook("before_send_"+e.type,r),r&&(r=r[0])),r?(jd.log("MIXPANEL REQUEST:"),jd.log(r),this._send_request(a,this._encode_data_for_request(r),o,this._prepare_callback(t,r))):null},this);return this._batch_requests&&!n?i.enqueue(r).then(function(g){g?t(1,r):u()}):h=u(),h&&r};K6.prototype.track=RL1(function(e,t,r,a){var i;if(!(r&&r.skip_hooks)){if(i=this._run_hook("before_track",e,t),i===null)return;e=i[0],t=i[1]}!a&&typeof r=="function"&&(a=r,r=null),r=r||{};var n=r.transport;n&&(r.transport=n);var o=r.send_immediately;if(typeof a!="function"&&(a=zL1),d4.isUndefined(e)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(e)){a(0);return}t=d4.extend({},t),t.token=this.get_config("token");var h=this.persistence.remove_event_timer(e);if(!d4.isUndefined(h)){var u=new Date().getTime()-h;t.$duration=parseFloat((u/1e3).toFixed(3))}this._set_default_superprops();var g=this.get_config("track_marketing")?d4.info.marketingParams():{};t=d4.extend({},d4.info.properties({mp_loader:this.get_config("mp_loader")}),g,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),t);var f=this.get_config("property_blacklist");d4.isArray(f)?d4.each(f,function(C){delete t[C]}):this.report_error("Invalid value for property_blacklist config: "+f);var v={event:e,properties:t};return i=this._track_or_batch({type:"events",data:v,endpoint:this.get_api_host("events")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:o,send_request_options:r},a),this.flags&&this.flags.checkFirstTimeEvents&&this.flags.checkFirstTimeEvents(e,t),i});K6.prototype.set_group=RL1(function(e,t,r){d4.isArray(t)||(t=[t]);var a={};return a[e]=t,this.register(a),this.people.set(e,t,r)});K6.prototype.add_group=RL1(function(e,t,r){var a=this.get_property(e),i={};return a===void 0?(i[e]=[t],this.register(i)):a.indexOf(t)===-1&&(a.push(t),i[e]=a,this.register(i)),this.people.union(e,t,r)});K6.prototype.remove_group=RL1(function(e,t,r){var a=this.get_property(e);if(a!==void 0){var i=a.indexOf(t);i>-1&&(a.splice(i,1),this.register({group_key:a})),a.length===0&&this.unregister(e)}return this.people.remove(e,t,r)});K6.prototype.track_with_groups=RL1(function(e,t,r,a){var i=d4.extend({},t||{});return d4.each(r,function(n,o){n!=null&&(i[o]=n)}),this.track(e,i,a)});K6.prototype._create_map_key=function(e,t){return e+"_"+JSON.stringify(t)};K6.prototype._remove_group_from_cache=function(e,t){delete this._cached_groups[this._create_map_key(e,t)]};K6.prototype.get_group=function(e,t){var r=this._create_map_key(e,t),a=this._cached_groups[r];return(a===void 0||a._group_key!==e||a._group_id!==t)&&(a=new Ry,a._init(this,e,t),this._cached_groups[r]=a),a};K6.prototype.track_pageview=RL1(function(e,t){typeof e!="object"&&(e={}),t=t||{};var r=t.event_name||"$mp_web_page_view",a=d4.extend(d4.info.mpPageViewProperties(),d4.info.campaignParams(),d4.info.clickParams()),i=d4.extend({},a,e);return this.track(r,i)});K6.prototype.track_links=function(){return this._track_dom.call(this,p12,arguments)};K6.prototype.track_forms=function(){return this._track_dom.call(this,Tl0,arguments)};K6.prototype.time_event=function(e){if(d4.isUndefined(e)){this.report_error("No event name provided to mixpanel.time_event");return}this._event_is_disabled(e)||this.persistence.set_event_timer(e,new Date().getTime())};var H_7={persistent:!0},dI4=function(e){var t;return d4.isObject(e)?t=e:d4.isUndefined(e)?t={}:t={days:e},d4.extend({},H_7,t)};K6.prototype.register=function(e,t){var r=this._run_hook("before_register",e,t);if(r!==null){e=r[0],t=r[1];var a=dI4(t);a.persistent?this.persistence.register(e,a.days):d4.extend(this.unpersisted_superprops,e)}};K6.prototype.register_once=function(e,t,r){var a=this._run_hook("before_register_once",e,t,r);if(a!==null){e=a[0],t=a[1],r=a[2];var i=dI4(r);i.persistent?this.persistence.register_once(e,t,i.days):(typeof t>"u"&&(t="None"),d4.each(e,function(n,o){(!this.unpersisted_superprops.hasOwnProperty(o)||this.unpersisted_superprops[o]===t)&&(this.unpersisted_superprops[o]=n)},this))}};K6.prototype.unregister=function(e,t){var r=this._run_hook("before_unregister",e,t);r!==null&&(e=r[0],t=r[1],t=dI4(t),t.persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e])};K6.prototype._register_single=function(e,t){var r={};r[e]=t,this.register(r)};K6.prototype.identify=function(e,t,r,a,i,n,o,h){var u=this._run_hook("before_identify",e);if(u===null)return-1;e=u[0];var g=this.get_distinct_id();if(e&&g!==e){if(typeof e=="string"&&e.indexOf(hI4)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var f=g;this.register_once({$had_persisted_distinct_id:!0,$device_id:f},"")}e!==g&&e!==this.get_property(ol0)&&(this.unregister(ol0),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,r,a,i,n,o,h),e!==g&&this.track("$identify",{distinct_id:e,$anon_distinct_id:g},{skip_hooks:!0}),e!==g&&this.flags.fetchFlags()};K6.prototype.reset=function(){this.stop_session_recording(),this.persistence.clear(),this._flags.identify_called=!1;var e=d4.UUID();this.register_once({distinct_id:hI4+e,$device_id:e},""),this._check_and_start_session_recording()};K6.prototype.get_distinct_id=function(){return this.get_property("distinct_id")};K6.prototype.alias=function(e,t){if(e===this.get_property(zZ5))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var r=this;return d4.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(ol0,e),this.track("$create_alias",{alias:e,distinct_id:t},{skip_hooks:!0},function(){r.identify(e)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)};K6.prototype.name_tag=function(e){this._register_single("mp_name_tag",e)};K6.prototype.set_config=function(e){if(d4.isObject(e)){d4.extend(this.config,e);var t=e.batch_size;t&&d4.each(this.request_batchers,function(r){r.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),LW.DEBUG=LW.DEBUG||this.get_config("debug"),("autocapture"in e||"record_heatmap_data"in e)&&this.autocapture&&this.autocapture.init(),d4.isObject(e.hooks)&&(this.hooks={},d4.each(e.hooks,function(r,a){if(d4.isFunction(r))this.hooks[a]=[r];else if(d4.isArray(r)){this.hooks[a]=[];for(var i=0;i<r.length;i++)d4.isFunction(r[i])||jd.critical("Invalid hook added. Hook is not a function"),this.hooks[a].push(r[i])}else jd.critical("Invalid hooks added. Ensure that the hook values passed into config.hooks are functions or arrays of functions.")},this))}};K6.prototype.get_config=function(e){return this.config[e]};K6.prototype._run_hook=function(e){var t=yL1.call(arguments,1);return d4.each(this.hooks[e],function(r){if(t===null)return null;var a=r.apply(this,t);typeof a>"u"?(this.report_error(e+" hook did not return a valid value"),t=null):(d4.isArray(a)||(a=[a]),t.splice.apply(t,[0,a.length].concat(a)))},this),t};K6.prototype.get_property=function(e){return this.persistence.load_prop([e])};K6.prototype.get_api_host=function(e){return this.get_config("api_hosts")[e]||this.get_config("api_host")};K6.prototype.toString=function(){var e=this.get_config("name");return e!==c21&&(e=c21+"."+e),e};K6.prototype._event_is_disabled=function(e){return d4.isBlockedUA(F91)||this._flags.disable_all_events||d4.include(this.__disabled_events,e)};K6.prototype._gdpr_init=function(){var e=this.get_config("opt_out_tracking_persistence_type")==="localStorage";e&&d4.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_tracking()&&(this.get_config("opt_out_tracking_by_default")||d4.cookie.get("mp_optout"))&&(d4.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))};K6.prototype._gdpr_update_persistence=function(e){var t;if(e&&e.clear_persistence)t=!0;else if(e&&e.enable_persistence)t=!1;else return;!this.get_config("disable_persistence")&&this.persistence.disabled!==t&&this.persistence.set_disabled(t),t?(this.stop_batch_senders(),this.stop_session_recording()):this._batchers_were_started&&this.start_batch_senders()};K6.prototype._gdpr_call_func=function(e,t){return t=d4.extend({track:d4.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},t),d4.localStorage.is_supported()||(t.persistence_type="cookie"),e(this.get_config("token"),{track:t.track,trackEventName:t.track_event_name,trackProperties:t.track_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieDomain:t.cookie_domain,cookieExpiration:t.cookie_expiration,crossSiteCookie:t.cross_site_cookie,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie,ignoreDnt:t.ignore_dnt})};K6.prototype.opt_in_tracking=function(e){e=d4.extend({enable_persistence:!0},e),this._gdpr_call_func(pP7,e),this._gdpr_update_persistence(e)};K6.prototype.opt_out_tracking=function(e){e=d4.extend({clear_persistence:!0,delete_user:!0},e),e.delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(fP7,e),this._gdpr_update_persistence(e)};K6.prototype.has_opted_in_tracking=function(e){return this._gdpr_call_func(vP7,e)};K6.prototype.has_opted_out_tracking=function(e){return this._gdpr_call_func(qR5,e)};K6.prototype.clear_opt_in_out_tracking=function(e){e=d4.extend({enable_persistence:!0},e),this._gdpr_call_func(mP7,e),this._gdpr_update_persistence(e)};K6.prototype.report_error=function(e,t){jd.error.apply(jd.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(r){jd.error(r)}};K6.prototype.add_hook=function(e,t){this.hooks[e]||(this.hooks[e]=[]),this.hooks[e].push(t)};K6.prototype.remove_hook=function(e,t){var r;this.hooks[e]&&(r=this.hooks[e].indexOf(t),r!==-1?this.hooks[e].splice(r,1):jd.log("remove_hook failed. Matching hook was not found"))};K6.prototype.init=K6.prototype.init;K6.prototype.reset=K6.prototype.reset;K6.prototype.disable=K6.prototype.disable;K6.prototype.time_event=K6.prototype.time_event;K6.prototype.track=K6.prototype.track;K6.prototype.track_links=K6.prototype.track_links;K6.prototype.track_forms=K6.prototype.track_forms;K6.prototype.track_pageview=K6.prototype.track_pageview;K6.prototype.register=K6.prototype.register;K6.prototype.register_once=K6.prototype.register_once;K6.prototype.unregister=K6.prototype.unregister;K6.prototype.identify=K6.prototype.identify;K6.prototype.alias=K6.prototype.alias;K6.prototype.name_tag=K6.prototype.name_tag;K6.prototype.set_config=K6.prototype.set_config;K6.prototype.get_config=K6.prototype.get_config;K6.prototype.get_api_host=K6.prototype.get_api_host;K6.prototype.get_property=K6.prototype.get_property;K6.prototype.get_distinct_id=K6.prototype.get_distinct_id;K6.prototype.toString=K6.prototype.toString;K6.prototype.opt_out_tracking=K6.prototype.opt_out_tracking;K6.prototype.opt_in_tracking=K6.prototype.opt_in_tracking;K6.prototype.has_opted_out_tracking=K6.prototype.has_opted_out_tracking;K6.prototype.has_opted_in_tracking=K6.prototype.has_opted_in_tracking;K6.prototype.clear_opt_in_out_tracking=K6.prototype.clear_opt_in_out_tracking;K6.prototype.get_group=K6.prototype.get_group;K6.prototype.set_group=K6.prototype.set_group;K6.prototype.add_group=K6.prototype.add_group;K6.prototype.remove_group=K6.prototype.remove_group;K6.prototype.add_hook=K6.prototype.add_hook;K6.prototype.remove_hook=K6.prototype.remove_hook;K6.prototype.track_with_groups=K6.prototype.track_with_groups;K6.prototype.start_batch_senders=K6.prototype.start_batch_senders;K6.prototype.stop_batch_senders=K6.prototype.stop_batch_senders;K6.prototype.start_session_recording=K6.prototype.start_session_recording;K6.prototype.stop_session_recording=K6.prototype.stop_session_recording;K6.prototype.pause_session_recording=K6.prototype.pause_session_recording;K6.prototype.resume_session_recording=K6.prototype.resume_session_recording;K6.prototype.get_session_recording_properties=K6.prototype.get_session_recording_properties;K6.prototype.get_session_replay_url=K6.prototype.get_session_replay_url;K6.prototype.get_tab_id=K6.prototype.get_tab_id;K6.prototype.DEFAULT_API_ROUTES=HZ5;K6.prototype.__get_recorder=K6.prototype.__get_recorder;Lg.prototype.properties=Lg.prototype.properties;Lg.prototype.update_search_keyword=Lg.prototype.update_search_keyword;Lg.prototype.update_referrer_info=Lg.prototype.update_referrer_info;Lg.prototype.get_cross_subdomain=Lg.prototype.get_cross_subdomain;Lg.prototype.clear=Lg.prototype.clear;var QQ1={},k_7=function(){d4.each(QQ1,function(e,t){t!==c21&&(NO[t]=e)}),NO._=d4},T_7=function(){NO.init=function(e,t,r){if(r)return NO[r]||(NO[r]=QQ1[r]=dD4(e,t,r),NO[r]._loaded()),NO[r];var a=NO;QQ1[c21]?a=QQ1[c21]:e&&(a=dD4(e,t,c21),a._loaded(),QQ1[c21]=a),NO=a,ll0===y_7&&(n7[c21]=NO),k_7()}},B_7=function(){function e(){e.done||(e.done=!0,kZ5=!0,SZ5=!1,d4.each(QQ1,function(a){a._dom_loaded()}))}function t(){try{Hh.documentElement.doScroll("left")}catch{setTimeout(t,1);return}e()}if(Hh.addEventListener)Hh.readyState==="complete"?e():Hh.addEventListener("DOMContentLoaded",e,!1);else if(Hh.attachEvent){Hh.attachEvent("onreadystatechange",e);var r=!1;try{r=n7.frameElement===null}catch{}Hh.documentElement.doScroll&&r&&t()}d4.register_event(n7,"load",e,!0)};function V_7(e){return sI4=e,ll0=sD4,NO=new K6,T_7(),NO.init(),B_7(),NO}function P_7(e,t){t()}var __7=V_7(P_7);TZ5.exports=__7});function wW(e){return e.type==="local"}function M12(e){return e.type!=="local"}var Q_1=C1(()=>{oR4();D90()});function VZ5(e){if(!e)return!1;let t=e.trim().toLowerCase();return t==="1"||t==="true"}var uI4,PZ5=C1(()=>{Q_1();uI4="DELEGATE_TELEMETRY_DISABLED"});function E_7(){return(0,EZ5.create)((e,t)=>({executions:{},addToolExecution:r=>e(a=>({executions:{...a.executions,[r.payload.id]:{id:r.payload.id,sessionId:r.sessionId,header:r.header??"Autopilot Tool",subHeader:r.subHeader,status:r.status??"idle",isRevertible:r.isRevertible??!1,currentPayload:r.currentPayload??r.payload,toolMessages:r.toolMessages??{},externalMessages:r.externalMessages??{},isReadOnly:r.isReadOnly,autoExecute:r.autoExecute,executionStartedAt:r.executionStartedAt}}})),setToolExecutionStatus:(r,a)=>e(i=>{let n=i.executions[r];return n?{executions:{...i.executions,[r]:{...n,status:a}}}:i}),markToolExecutionStarted:(r,a=Date.now())=>e(i=>{let n=i.executions[r];return!n||n.executionStartedAt!==void 0?i:{executions:{...i.executions,[r]:{...n,executionStartedAt:a}}}}),restoreToolExecution:r=>e(a=>({executions:{...a.executions,[r.id]:{...r}}})),addToolMessage:(r,a)=>e(i=>{let n=i.executions[r];return n?{executions:{...i.executions,[r]:{...n,toolMessages:{...n.toolMessages,[a.id]:a}}}}:i}),addExternalMessage:(r,a)=>e(i=>{let n=i.executions[r];return n?{executions:{...i.executions,[r]:{...n,externalMessages:{...n.externalMessages,[a.id]:a}}}}:i}),clearMessages:r=>e(a=>{let i=a.executions[r];return i?{executions:{...a.executions,[r]:{...i,toolMessages:{}}}}:a}),askConfirmation:r=>e(a=>{let i=a.executions[r];return i?{executions:{...a.executions,[r]:{...i,status:"pending"}}}:a}),setToolExecutionResponse:(r,a)=>{e(n=>{let o=n.executions[r];if(!o)return n;let h=a?.attachments?.length?{...a,attachments:a.attachments.map(u=>({...u,timestamp:u.timestamp??Date.now()}))}:a;return{executions:{...n.executions,[r]:{...o,response:h}}}});let i=t().executions[r]?.sessionId;i&&t().pruneOldScreenshots(i)},setHeader:(r,a)=>e(i=>{if(!a)return i;let n=i.executions[r];return n?{executions:{...i.executions,[r]:{...n,header:a}}}:i}),setSubHeader:(r,a)=>e(i=>{if(!a)return i;let n=i.executions[r];return n?{executions:{...i.executions,[r]:{...n,subHeader:a}}}:i}),setIsRevertible:(r,a)=>e(i=>{let n=i.executions[r];return n?{executions:{...i.executions,[r]:{...n,isRevertible:a}}}:i}),addExternalMessages:(r,a)=>e(i=>{let n=i.executions[r];return n?{executions:{...i.executions,[r]:{...n,externalMessages:{...n.externalMessages,...Object.fromEntries(a.map(o=>[o.id,o]))}}}}:i}),setCurrentPayload:(r,a)=>e(i=>{let n=i.executions[r];return n?{executions:{...i.executions,[r]:{...n,currentPayload:a}}}:i}),setSubAgentMessageCount:(r,a)=>e(i=>{let n=i.executions[r];return n?{executions:{...i.executions,[r]:{...n,subAgentMessageCount:a}}}:i}),deleteExecution:r=>e(a=>{if(!a.executions[r])return a;let{[r]:i,...n}=a.executions;return{executions:n}}),deleteSession:r=>e(a=>{let i={};for(let[n,o]of Object.entries(a.executions))o.sessionId!==r&&(i[n]=o);return{executions:i}}),pruneOldScreenshots:r=>e(a=>{let i=Object.entries(a.executions).filter(([,h])=>h.sessionId===r&&h.response?.attachments?.some(u=>u.content?.base64)).map(([h])=>h);if(i.length<=_Z5)return a;let n=new Set(i.slice(0,i.length-_Z5));if(n.size===0)return a;let o={};for(let[h,u]of Object.entries(a.executions))n.has(h)&&u.response?.attachments?o[h]={...u,response:{...u.response,attachments:u.response.attachments.map(g=>g.content?.base64?{...g,content:{...g.content,base64:null}}:g)}}:o[h]=u;return{executions:o}}),selectExecutionState:r=>t().executions[r],selectExecutionStatePayload:r=>t().executions[r]?.currentPayload,selectSessionId:r=>t().executions[r]?.sessionId,selectResponse:r=>t().executions[r]?.response,selectStatus:r=>t().executions[r]?.status,selectMessages:r=>t().executions[r]?.toolMessages??{},selectHeader:r=>t().executions[r]?.header,selectSubHeader:r=>t().executions[r]?.subHeader,selectExternalMessage:r=>t().executions[r]?.externalMessages??{},selectIsRevertible:r=>t().executions[r]?.isRevertible,getSessionsWithPendingApproval:()=>{let r=new Set;for(let a of Object.values(t().executions))(a.status==="pending"||a.status==="pending_restored")&&r.add(a.sessionId);return r}}))}var EZ5,_Z5,A7,Y_=C1(()=>{a7();EZ5=w4(Lu(),1),_Z5=20;A7=import.meta.hot?.data?.toolExecutionStore??E_7();import.meta.hot&&import.meta.hot.dispose(e=>{e.toolExecutionStore=A7})});var OZ5={};qr(OZ5,{cloudEnvFromUrl:()=>vI4,environmentFromBackendUrl:()=>mI4,getRuntimePlatform:()=>pI4,isSdkRuntime:()=>Bl0,mixpanelService:()=>Kr,parseEnvironment:()=>gI4,resolveToolCategory:()=>dx2,sumSessionTotals:()=>FZ5});function vI4(e){return e?e.includes("alpha.uipath")?"alpha":e.includes("staging.uipath")?"staging":e.includes("cloud.uipath")?"production":null:null}function Bl0(){return typeof process<"u"&&process.env?.DELEGATE_SDK_RUNTIME==="1"}function mI4(e){return e.includes("nst.kubefabric")?"alpha":vI4(e)??"local"}function gI4(){if(process.env.VITE_USE_CLOUD_URL==="true"){let e=vI4(FM);if(e)return e}return mI4(T91())}function pI4(){let e=typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:"";return e.includes("Mac")?"darwin":e.includes("Linux")?"linux":typeof process<"u"&&(process.platform==="darwin"||process.platform==="linux")?process.platform:"win32"}function ZZ5(e){let r=e?.operations?.[0]?.endpoint;return!r||typeof r!="string"?null:r.replace(/^\//,"").split("/")[0]||null}function R_7(e,t){if(e!=="ExecuteSkillApi")return e;let r=ZZ5(t);return r?`ExecuteSkillApi.${RZ5[r]?.suffix??r}`:e}function dx2(e,t){if(e==="ExecuteSkillApi"){let a=ZZ5(t);return a?RZ5[a]?.category??a:null}return{AppAct:"UI Automation",AppFind:"UI Automation",AppFindTabs:"UI Automation",AppGetDescriptor:"UI Automation",AppOpenAttach:"UI Automation",WebSearch:"Web",WebReader:"Web",ImageSearch:"Web",ExecuteBashCommand:"Shell",ExecuteOsaScript:"Shell",ExecutePowershellCommand:"Shell",ReadFile:"File System",WriteFile:"File System",EditFile:"File System",Search:"File System",DownloadFile:"File System",ExcelGeneratorExecutor:"Excel",DocGeneratorExecutor:"Word",PptGeneratorExecutor:"PowerPoint",SendUiPathRequest:"UiPath API",ImageGenerate:"Image Generation"}[e]??null}function Z_7(e,t){let r={},a=t?.app?.identifier??t?.identifier;if(a&&typeof a=="string"){let n=a.split(":"),o=["win","tab","app"];n.length>=2&&o.includes(n[0])&&(r.targetApp=n[1])}!r.targetApp&&e==="AppFindTabs"&&t?.browserType&&(r.targetApp=String(t.browserType));let i=t?.app?.url??t?.url;if(i&&typeof i=="string")try{r.targetUrl=new URL(i).hostname}catch{}return r}function F_7(e){let t={};for(let[r,a]of Object.entries(e))gR4.includes(r)||(t[`tool_${r}`]=a);return t}function O_7(e){return{mcpServerCount:e.length,mcpServers:e.map(t=>({url:M12(t)?t.url:`local:${t.serverId}`,title:t.title??null,enabled:t.enabled}))}}function FZ5(e){if(e.length!==0)return e.reduce((t,r)=>({total_prompt_tokens:t.total_prompt_tokens+r.total_prompt_tokens,total_prompt_tokens_cached:t.total_prompt_tokens_cached+r.total_prompt_tokens_cached,total_cache_creation_tokens:t.total_cache_creation_tokens+r.total_cache_creation_tokens,total_completion_tokens:t.total_completion_tokens+r.total_completion_tokens,total_token_units:t.total_token_units+r.total_token_units}),D_7)}var h21,RZ5,D_7,fI4,Kr,X_=C1(()=>{h21=w4(BZ5());PZ5();Q_1();wu();wd();Y_();$C2();dj();HZ4();xL1();RZ5={excel:{suffix:"Excel",category:"Excel"},"excel-gen":{suffix:"ExcelGen",category:"Excel"},word:{suffix:"Word",category:"Word"},"doc-gen":{suffix:"DocGen",category:"Word"},ppt:{suffix:"Ppt",category:"PowerPoint"},"ppt-gen":{suffix:"Ppt",category:"PowerPoint"},powerpoint:{suffix:"Ppt",category:"PowerPoint"},pdf:{suffix:"Pdf",category:"PDF"},slack:{suffix:"Slack",category:"Slack"},"ms-teams":{suffix:"Teams",category:"Teams"},"recorded-task":{suffix:"Recording",category:"Recording"},"ui-scripting":{suffix:"UiScripting",category:"UI Scripting"},diagram:{suffix:"Diagram",category:"Diagram"}};D_7={total_prompt_tokens:0,total_prompt_tokens_cached:0,total_cache_creation_tokens:0,total_completion_tokens:0,total_token_units:0};fI4=class{_isInitialized=!1;_isIdentified=!1;_analyticsEnabled=!0;_userTrackingAllowed=!0;_environmentOverride=null;_resolveEnvironment(){return this._environmentOverride??gI4()}_sessionCategories=new Map;_taskStartTimes=new Map;_taskStartCosts=new Map;_terminalOutcomeTracked=new Set;_deferredTaskFailures=new Map;_deferredTaskCancellations=new Set;initialize(t,r){if(this._isInitialized)return;if(Bl0()&&VZ5(process.env[uI4])){console.warn(`[MixpanelService] Telemetry disabled via ${uI4}`);return}let a=r?mI4(r):gI4();this._environmentOverride=r?a:null;let i=Bl0()?`sdk${a}`:a,n=t||{}.MIXPANEL_PROJECT_TOKEN||_b5[i]||null;if(!n||xn){console.warn("[MixpanelService] No project token provided or mock UI mode, Mixpanel disabled");return}try{h21.default.init(n,{api_host:"https://api-eu.mixpanel.com",autocapture:!1,record_sessions_percent:0,persistence:"localStorage",ip:!1,...Bl0()?{batch_requests:!1}:{}});let o=pI4();h21.default.register({appVersion:"0.1.3",platform:o,environment:a}),this._isInitialized=!0,console.log("[MixpanelService] Initialized successfully")}catch(o){console.error("[MixpanelService] Failed to initialize:",o)}}identify(t,r){if(!this._isInitialized||!this._analyticsEnabled)return;let a=["ibabencu01@gmail.com"];if(r.email&&a.includes(r.email.toLowerCase())){this._userTrackingAllowed=!1;return}if(this._resolveEnvironment()==="local"){let i=process.env.VITE_MIXPANEL_ALLOWED_EMAIL;if(!i||r.email?.toLowerCase()!==i.toLowerCase()){this._userTrackingAllowed=!1;return}}try{h21.default.identify(t);let i={uipathUserId:t,platform:pI4(),appVersion:"0.1.3"},n=this._resolveEnvironment()==="production";if(r.email&&!n&&(i.$email=r.email,i.isInternalUser=r.email.endsWith("@uipath.com")),!n){let o=[r.firstName,r.lastName].filter(Boolean).join(" ");i.$name=o||r.name||void 0,i.$first_name=r.firstName||void 0,i.$last_name=r.lastName||void 0}r.organizationId&&(i.organizationId=r.organizationId),r.organizationName&&(i.organizationName=r.organizationName),r.tenantId&&(i.tenantId=r.tenantId),r.tenantName&&(i.tenantName=r.tenantName),h21.default.people.set(i),h21.default.people.set_once({$created:new Date().toISOString()}),this._isIdentified=!0}catch(i){console.error("[MixpanelService] Failed to identify user:",i)}}identifyUser(t){this.identify(t.profile.sub,{email:t.profile.email,name:t.profile.name,firstName:t.profile.first_name,lastName:t.profile.last_name,organizationId:t.organization?.id,organizationName:t.organization?.name,tenantId:t.tenant?.id,tenantName:t.tenant?.name})}track(t,r){if(!(!this._isInitialized||!this._analyticsEnabled||!this._userTrackingAllowed))try{h21.default.track(t,{shellApp:this._resolveShellApp(r),...r})}catch(a){console.error("[MixpanelService] Failed to track event:",a)}}_shellAppResolver=null;setShellAppResolver(t){this._shellAppResolver=t}_resolveShellApp(t){try{let r=t?.taskId;return this._shellAppResolver?.(typeof r=="string"?r:void 0)??"delegate"}catch{return"delegate"}}setAnalyticsEnabled(t){if(this._analyticsEnabled=t,!!this._isInitialized)try{t?h21.default.opt_in_tracking():h21.default.opt_out_tracking()}catch(r){cn0("mixpanel").warn("Failed to flip SDK opt-state; internal gate still applies:",r)}}timeEvent(t){if(!(!this._isInitialized||!this._analyticsEnabled||!this._userTrackingAllowed))try{h21.default.time_event(t)}catch(r){console.error("[MixpanelService] Failed to start time_event:",r)}}startTaskTimer(t){this._taskStartTimes.set(t,Date.now());let r=this._resolveTaskTotals(t)?.total_token_units??0;this._taskStartCosts.set(t,r),this._terminalOutcomeTracked.delete(t),this._deferredTaskFailures.delete(t),this._deferredTaskCancellations.delete(t)}getTaskDuration(t){let r=this._taskStartTimes.get(t);if(r!=null)return(Date.now()-r)/1e3}trackTaskOutcome(t,r,a){if(this._terminalOutcomeTracked.has(t))return;this._terminalOutcomeTracked.add(t);let i=this.getSessionCategories(t),n=this.getTaskDuration(t);this.track(`Task.${r}`,{taskId:t,runnerMode:st.getState().sessions[t]?.runnerMode??"local",...i.length>0?{categories:i}:{},...n!=null?{$duration:n}:{},...this.getSessionCostProps(t),...a}),this.clearSessionCategories(t)}recordDeferredTaskFailure(t,r){this._deferredTaskFailures.set(t,r)}takeDeferredTaskFailure(t){let r=this._deferredTaskFailures.get(t);return this._deferredTaskFailures.delete(t),r}recordDeferredTaskCancellation(t){this._deferredTaskCancellations.add(t)}takeDeferredTaskCancellation(t){return this._deferredTaskCancellations.delete(t)}reset(){if(this._isInitialized)try{h21.default.reset(),this._isIdentified=!1}catch(t){console.error("[MixpanelService] Failed to reset:",t)}}setUserProperties(t){if(!(!this._isInitialized||!this._analyticsEnabled||!this._userTrackingAllowed))try{h21.default.people.set(t)}catch(r){console.error("[MixpanelService] Failed to set user properties:",r)}}trackToolExecution(t,r,a,i,n=!1,o){let h=R_7(r,a),u=dx2(r,a);if(u){let v=this._sessionCategories.get(t);v||(v=new Set,this._sessionCategories.set(t,v)),v.add(u)}let g={...o,taskId:t,toolName:h,isMcp:n};u&&(g.category=u);let f=Z_7(r,a);f.targetApp&&(g.targetApp=f.targetApp),f.targetUrl&&(g.targetUrl=f.targetUrl),i!=null&&(g.duration=Math.round(i/100)/10),this.track("Tool.Executed",g)}getSessionCategories(t){let r=this._sessionCategories.get(t);return r?[...r]:[]}clearSessionCategories(t){this._sessionCategories.delete(t)}forgetTask(t){this.clearSessionCategories(t),this._taskStartTimes.delete(t),this._taskStartCosts.delete(t),this._terminalOutcomeTracked.delete(t),this._deferredTaskFailures.delete(t),this._deferredTaskCancellations.delete(t)}syncToolSettings(t){this._isInitialized&&this.setUserProperties(F_7(t))}syncMcpServers(t){this._isInitialized&&this.setUserProperties(O_7(t))}syncBehaviorPreferences(t){this._isInitialized&&this.setUserProperties({workProfile:t})}syncKnowledgeCount(t){this._isInitialized&&this.setUserProperties({knowledgeCount:t})}setupProfileSync(t){if(console.log(`[MixpanelService] setupProfileSync called: isInit=${this._isInitialized}, syncActive=${this._profileSyncActive}`),!this._isInitialized||this._profileSyncActive)return;this._profileSyncActive=!0;let{authStore:r,settingsStore:a,appStore:i,mcpStore:n,memoriesStore:o}=t,h=r.getState();h.user&&!this._isIdentified&&this.identifyUser({profile:h.user.profile,organization:h.organization,tenant:h.tenant});let u=i.getState();this.setUserProperties({selectedModel:a.selectModelId(),agentType:a.selectAgentType(),securityMode:u.toolExecutionPolicy.securityMode??"recommended"}),this.syncToolSettings(u.toolSettings),this.syncMcpServers(n.getState().servers),this.syncBehaviorPreferences(u.behaviorPreferences.workProfile);let g=u.toolSettings,f=u.behaviorPreferences?.workProfile,v=u.toolExecutionPolicy?.securityMode,C=n.getState().servers,L=o.getState().memories;i.subscribe(y=>{y.toolSettings!==g&&(g=y.toolSettings,this.syncToolSettings(y.toolSettings)),y.behaviorPreferences?.workProfile!==f&&(f=y.behaviorPreferences.workProfile,this.syncBehaviorPreferences(y.behaviorPreferences.workProfile)),y.toolExecutionPolicy?.securityMode!==v&&(v=y.toolExecutionPolicy.securityMode,this.setUserProperties({securityMode:v??"recommended"}))}),n.subscribe(y=>{y.servers!==C&&(C=y.servers,this.syncMcpServers(y.servers))}),o.subscribe(y=>{if(y.memories!==L){L=y.memories;let z=y.memories.filter(S=>!S.path.toLowerCase().includes("/sessions/")).length;this.syncKnowledgeCount(z)}})}_profileSyncActive=!1;trackTool(t,r){let a=A7.getState(),i=a.selectExecutionStatePayload(r)?.name,n=a.selectSessionId(r);this.track(`Tool.${t}`,{taskId:n,toolName:i})}get isEnabled(){return this._isInitialized}get isIdentified(){return this._isIdentified}_resolveTaskTotals(t){let r=st.getState();return FZ5([t,...r.getChildSessionIds(t)].map(a=>r.sessions[a]?.sessionTotals).filter(a=>a!=null))}getSessionCostProps(t){let a=st.getState().sessionUsage,i=t?this._resolveTaskTotals(t):null,n={},o=C=>Math.round(C)/1e3;a?.turnTokenUnits&&(n.turnTokenUnits=o(a.turnTokenUnits));let h=i?.total_token_units??a?.sessionTotals?.totalTokenUnits,u=i?.total_prompt_tokens??a?.sessionTotals?.totalPromptTokens,g=i?.total_completion_tokens??a?.sessionTotals?.totalCompletionTokens,f=i?.total_prompt_tokens_cached??a?.sessionTotals?.totalPromptTokensCached;if(h!=null&&(n.totalTokenUnits=o(h),n.totalPromptTokens=u,n.totalCompletionTokens=g,n.totalPromptTokensCached=f,t)){let C=this._taskStartCosts.get(t)??0,L=h-C;n.taskTokenUnits=o(Math.max(0,L))}let v=Object.entries(a?.usageByModel||{});if(v.length>0){n.models=v.map(([L])=>L);let C={};for(let[L,y]of v){let z=y.token_units??y.tokenUnits??0;z>0&&(C[L]=o(z))}Object.keys(C).length>0&&(n.costByModel=C)}return n}},Kr=new fI4;process.env.NODE_ENV==="development"&&(window.__mixpanelService=Kr)});var CI4,MI4=C1(()=>{X_();CI4={started:e=>{Kr.track("Onboarding.Started",{source:e})},goalsReached:()=>{Kr.track("Onboarding.GoalsReached")},goalsCaptured:(e,t,r)=>{let a={goals:e,count:e.length,source:t};r&&r.length>0&&(a.matchedPhrases=r),Kr.track("Onboarding.GoalsCaptured",a)},scanPermissionReached:()=>{Kr.track("Onboarding.ScanPermissionReached")},scanRun:(e,t)=>{Kr.track("Onboarding.ScanRun",{choice:e,categoriesIncluded:t})},scanSkipped:()=>{Kr.track("Onboarding.ScanSkipped")},scanPhase2BrowserAvailable:(e,t,r)=>{Kr.track("Onboarding.ScanPhase2BrowserAvailable",{browser:e,tabCount:t,latencyMs:r})},scanPhase2BrowserEmpty:e=>{Kr.track("Onboarding.ScanPhase2BrowserEmpty",{browser:e})},scanPhase2BrowserFailure:(e,t,r)=>{Kr.track("Onboarding.ScanPhase2BrowserFailure",{browser:e,failureClass:t,latencyMs:r})},scanPhase2Failure:e=>{Kr.track("Onboarding.ScanPhase2Failure",{failureClasses:e})},scanFailed:(e,t)=>{Kr.track("Onboarding.ScanFailed",{phase:e,errorClass:t})},scanProgressReached:()=>{Kr.track("Onboarding.ScanProgressReached")},scanHandoffSent:e=>{Kr.track("Onboarding.ScanHandoffSent",{success:e})},scanHandoffStuck:()=>{Kr.track("Onboarding.ScanHandoffStuck")},scanHandoffDeduped:()=>{Kr.track("Onboarding.ScanHandoffDeduped")},roleInferred:(e,t,r)=>{Kr.track("Onboarding.RoleInferred",{role:e,confidence:t,path:r})},curationOpened:()=>{Kr.track("Onboarding.CurationOpened")},curationItemRemoved:e=>{Kr.track("Onboarding.CurationItemRemoved",{category:e})},roleCommitted:(e,t,r)=>{Kr.track("Onboarding.RoleCommitted",{path:e,curated:t,droppedBrowser:r})},routinesReached:()=>{Kr.track("Onboarding.RoutinesReached")},routinesRegenerationFallback:e=>{Kr.track("Onboarding.RoutinesRegenerationFallback",{reason:e})},routinesHardFailure:()=>{Kr.track("Onboarding.RoutinesHardFailure")},routinesPicked:e=>{Kr.track("Onboarding.RoutinesPicked",{count:e})},completed:e=>{Kr.track("Onboarding.Completed",{routineCount:e.routineCount,durationSeconds:e.durationSec,outcome:e.outcome})},handoffPartialFailure:(e,t,r)=>{Kr.track("Onboarding.HandoffPartialFailure",{totalRequested:e,succeeded:t,failed:r})},reRunSetup:()=>{Kr.track("Onboarding.ReRunSetup")},driftDetected:(e,t)=>{Kr.track("Onboarding.DriftDetected",{kind:e,detail:t})},testcloudAutoActivated:e=>{Kr.track("Onboarding.TestcloudAutoActivated",{sessionId:e})}}});function xI4(e,t){return e?t.some(r=>r.id===e||r.model===e):!1}function DZ5(e){return{id:e.id,name:e.name??e.id,model:e.model??e.id,description:e.description??null}}function N_7(e){return typeof e=="object"&&e!==null&&e.attachmentSource==="Screenshot"}function U_7(e){if(!e?.Attachments)return e;let{Attachments:t,...r}=e,a=t.filter(N_7);return a.length===0?r:{...r,Attachments:a}}function G_7(e){let t=b5.getState(),r=t.availableModels;if(xI4(Vl0,r))return I_7;let a=e.operatingModel?.id;if(a&&xI4(a,r))return e.operatingModel??null;let i=t.selectedModel;return i&&xI4(i.id,r)?DZ5(i):r.length>0?DZ5(r[0]):null}var Vl0,I_7,IZ5,NZ5=C1(()=>{yF4();qU1();If();Vl0="kimi_k2_7_code",I_7={id:Vl0,name:Vl0,model:Vl0,description:null};IZ5={name:"onboardingApiClamp",decorate(e,t){if(t.sessionMetadata?.isOnboarding!==!0)return e;let r=Fn0(e);r.context=U_7(r.context),r.skillsPreamble="";let a=G_7(e);return a&&(r.operatingModel=a),r}}});function GZ5(e,t,r){_l0=e,Pl0=t,El0=r;let a=UZ5;UZ5=[];for(let i of a)i()}function rM(){if(!Pl0)throw new Error("ServiceAccessor not initialized: frameworkServices");return Pl0}function Rl0(){if(!_l0)throw new Error("ServiceAccessor not initialized: services");return _l0}function j_7(){if(!El0)throw new Error("ServiceAccessor not initialized: frameworkId");return El0}function Zl0(e,t){tE1.set(e,t)}function jZ5(e){tE1.delete(e)}function J_(e){return tE1.get(e)?.frameworkServices??rM()}function G91(e){return tE1.get(e)?.services??Rl0()}function j91(e){return tE1.get(e)?.frameworkId??j_7()}function Fl0(e){return tE1.get(e)?.autoExecuteTools??!1}var Pl0,_l0,El0,UZ5,tE1,l61=C1(()=>{Pl0=import.meta.hot?.data?._frameworkServices,_l0=import.meta.hot?.data?._services,El0=import.meta.hot?.data?._frameworkId,UZ5=[];tE1=import.meta.hot?.data?._sessionServices??new Map;import.meta.hot&&import.meta.hot.dispose(e=>{e._frameworkServices=Pl0,e._services=_l0,e._frameworkId=El0,e._sessionServices=tE1})});var Fa,Ol0,Dl0,GO,W_7,q_7,$_7,K_7,Y_7,X_7,J_7,Q_7,tE7,eE7,rE7,aE7,iE7,nE7,oE7,lE7,Il0,Nl0=C1(()=>{"use strict";Fa=w4(li()),Ol0=Fa.z.enum(["maximum","recommended","unrestricted"]),Dl0=Fa.z.discriminatedUnion("kind",[Fa.z.object({kind:Fa.z.literal("uipath_user"),tenantId:Fa.z.string(),userId:Fa.z.string()}),Fa.z.object({kind:Fa.z.literal("slack_user"),workspaceId:Fa.z.string(),userId:Fa.z.string()}),Fa.z.object({kind:Fa.z.literal("service"),serviceId:Fa.z.string()}),Fa.z.object({kind:Fa.z.literal("job"),correlationId:Fa.z.string()})]),GO=Fa.z.object({v:Fa.z.literal(1),id:Fa.z.string().optional(),ref:Fa.z.string().optional(),type:Fa.z.string(),ts:Fa.z.string()}),W_7=GO.extend({type:Fa.z.literal("chat.create"),id:Fa.z.string(),kind:Fa.z.enum(["chat","job"]).optional(),securityMode:Ol0.optional(),requester:Dl0.optional()}),q_7=GO.extend({type:Fa.z.literal("chat.send"),id:Fa.z.string(),ref:Fa.z.string(),payload:Fa.z.string()}),$_7=GO.extend({type:Fa.z.literal("chat.decision"),id:Fa.z.string(),ref:Fa.z.string(),executionId:Fa.z.string(),choice:Fa.z.enum(["accept","reject"])}),K_7=GO.extend({type:Fa.z.literal("chat.end"),id:Fa.z.string(),ref:Fa.z.string()}),Y_7=GO.extend({type:Fa.z.literal("job.submit"),id:Fa.z.string(),payload:Fa.z.unknown(),securityMode:Ol0.optional(),requester:Dl0.optional()}),X_7=GO.extend({type:Fa.z.literal("job.cancel"),id:Fa.z.string(),ref:Fa.z.string()}),J_7=GO.extend({type:Fa.z.literal("resume"),id:Fa.z.string(),ref:Fa.z.string()}),Q_7=GO.extend({type:Fa.z.literal("ping"),id:Fa.z.string()}),tE7=GO.extend({type:Fa.z.literal("ack"),id:Fa.z.string(),ref:Fa.z.string().optional(),snapshot:Fa.z.unknown().optional()}),eE7=GO.extend({type:Fa.z.literal("error"),code:Fa.z.enum(["bad_request","unauthenticated","forbidden","no_pool_for_request","capacity_exceeded","session_not_found","session_not_ready","worker_boot_failed","frame_too_large","unsupported_type","internal_error"]),message:Fa.z.string()}),rE7=GO.extend({type:Fa.z.literal("chat.output"),ref:Fa.z.string(),chunk:Fa.z.unknown()}),aE7=GO.extend({type:Fa.z.literal("chat.decision.request"),ref:Fa.z.string(),executionId:Fa.z.string(),toolName:Fa.z.string(),args:Fa.z.record(Fa.z.unknown())}),iE7=GO.extend({type:Fa.z.literal("chat.ended"),ref:Fa.z.string(),reason:Fa.z.string()}),nE7=GO.extend({type:Fa.z.literal("job.state"),ref:Fa.z.string(),state:Fa.z.enum(["accepted","running","completed","failed","canceled"]),detail:Fa.z.unknown().optional()}),oE7=GO.extend({type:Fa.z.literal("job.deliverable"),ref:Fa.z.string(),attachmentUri:Fa.z.string(),expiresAt:Fa.z.string()}),lE7=GO.extend({type:Fa.z.literal("pong"),id:Fa.z.string()}),Il0=Fa.z.discriminatedUnion("type",[W_7,q_7,$_7,K_7,Y_7,X_7,J_7,Q_7,tE7,eE7,rE7,aE7,iE7,nE7,oE7,lE7])});var ux2,LI4=C1(()=>{"use strict";Nl0();ux2={NORMAL:1e3,POLICY_VIOLATION:1008,INTERNAL_ERROR:1011,AUTH_EXPIRED:4401,FRAME_TOO_LARGE:4413,CAPACITY_EXCEEDED_CONNECTION:4429}});var wI4,yI4=C1(()=>{"use strict";wI4="uipath-delegate.v1"});function OL1(){let e=globalThis.crypto;return e?.randomUUID?e.randomUUID():Math.random().toString(36).slice(2,10)+Math.random().toString(36).slice(2,10)}var FL1,Vb,x12,Ul0=C1(()=>{"use strict";Nl0();LI4();yI4();FL1=class extends Error{constructor(t,r){super(`WS transport closed (code=${t}): ${r}`),this.name="TransportClosedError",this.code=t,this.closeReason=r}},Vb=class extends Error{constructor(t,r,a){super(r),this.name="RemoteError",this.code=t,this.ref=a}},x12=class{constructor(t){this.state="idle";this.ws=null;this.reconnectAttempt=0;this.explicitDisconnect=!1;this.connectInFlight=null;this.pingTimer=null;this.deadlineTimer=null;this.reconnectTimer=null;this.lastInboundAt=0;this.gaveUp=!1;this.pending=new Map;this.frameListeners=new Set;this.closeListeners=new Set;this.openListeners=new Set;this.unknownFrameListeners=new Set;let r=t.webSocketCtor??globalThis.WebSocket;if(r===void 0)throw new Error('WsClient: no WebSocket constructor available. Pass options.webSocketCtor \u2014 in Node use `import WebSocket from "ws"; new WsClient({ webSocketCtor: WebSocket as never, \u2026 })`.');this.opts={url:t.url,getToken:t.getToken,webSocketCtor:r,pingIntervalMs:t.pingIntervalMs??3e4,inactivityDeadlineMs:t.inactivityDeadlineMs??6e4,reconnect:t.reconnect??!0,reconnectMinMs:t.reconnectMinMs??1e3,reconnectMaxMs:t.reconnectMaxMs??3e4,reconnectMaxAttempts:t.reconnectMaxAttempts??20,onGiveUp:t.onGiveUp,logger:t.logger??{warn:(...a)=>console.warn(...a),error:(...a)=>console.error(...a)},now:t.now??Date.now,setTimeoutFn:t.setTimeoutFn??setTimeout.bind(globalThis),clearTimeoutFn:t.clearTimeoutFn??clearTimeout.bind(globalThis)}}async connect(){if(this.state!=="open")return this.connectInFlight!==null?this.connectInFlight:(this.explicitDisconnect=!1,this.gaveUp=!1,this.openOnce())}disconnect(t=ux2.NORMAL,r="client disconnect"){if(this.explicitDisconnect=!0,this.cancelReconnect(),this.cancelTimers(),this.state==="open"||this.state==="connecting"){this.state="closing";try{this.ws?.close(t,r)}catch{}}this.failPending(new FL1(t,r))}send(t){if(this.state!=="open"||this.ws===null)throw new FL1(0,"WS not open");this.ws.send(JSON.stringify(t))}request(t){return new Promise((r,a)=>{this.pending.set(t.id,{resolve:r,reject:a,frameType:t.type});try{this.send(t)}catch(i){this.pending.delete(t.id),a(i)}})}onFrame(t){return this.frameListeners.add(t),()=>this.frameListeners.delete(t)}onClose(t){return this.closeListeners.add(t),()=>this.closeListeners.delete(t)}onOpen(t){return this.openListeners.add(t),()=>this.openListeners.delete(t)}onUnknownFrame(t){return this.unknownFrameListeners.add(t),()=>this.unknownFrameListeners.delete(t)}getState(){return this.state}openOnce(){this.state="connecting";let t=(async()=>{let r;try{r=await this.opts.getToken()}catch(a){throw this.state="closed",a}if(this.explicitDisconnect)throw this.state="closed",new FL1(ux2.NORMAL,"connect aborted by disconnect");return new Promise((a,i)=>{let n=!1,o=this.opts.webSocketCtor,h;try{h=new o(this.opts.url,[wI4],{headers:{Authorization:`Bearer ${r}`}})}catch(u){this.state="closed",i(u);return}this.ws=h,h.addEventListener("open",()=>{this.state="open",this.reconnectAttempt=0,this.lastInboundAt=this.opts.now(),this.armHeartbeat();for(let u of this.openListeners)try{u()}catch(g){this.opts.logger.warn("[WsClient] onOpen handler threw:",g)}n||(n=!0,a())}),h.addEventListener("message",u=>{this.lastInboundAt=this.opts.now(),this.handleMessage(u.data)}),h.addEventListener("close",u=>{let g=this.state==="connecting";this.state="closed",this.cancelTimers(),this.failPending(new FL1(u.code,u.reason));for(let f of this.closeListeners)try{f({code:u.code,reason:u.reason})}catch(v){this.opts.logger.warn("[WsClient] onClose handler threw:",v)}if(g&&!n){n=!0,i(new FL1(u.code,u.reason));return}!this.explicitDisconnect&&this.opts.reconnect&&this.scheduleReconnect(u.reason)}),h.addEventListener("error",()=>{})})})();return this.connectInFlight=t,t.catch(()=>{}).finally(()=>{this.connectInFlight===t&&(this.connectInFlight=null)}),t}handleMessage(t){if(typeof t!="string"){this.opts.logger.warn("[WsClient] dropping non-string frame");return}let r;try{r=JSON.parse(t)}catch{this.opts.logger.warn("[WsClient] dropping non-JSON frame");return}let a=Il0.safeParse(r);if(!a.success){this.opts.logger.warn("[WsClient] dropping schema-invalid frame",a.error.issues[0]?.message);let n=r?.type;for(let o of this.unknownFrameListeners)try{o({raw:r,type:typeof n=="string"?n:void 0})}catch(h){this.opts.logger.warn("[WsClient] onUnknownFrame handler threw:",h)}return}let i=a.data;if(i.type==="ping"){this.send({v:1,id:i.id,type:"pong",ts:new Date().toISOString()});return}if(i.type==="ack"&&i.id!==void 0){let n=this.pending.get(i.id);n!==void 0&&(this.pending.delete(i.id),n.resolve(i))}else if(i.type==="error"&&i.id!==void 0){let n=this.pending.get(i.id);n!==void 0&&(this.pending.delete(i.id),n.reject(new Vb(i.code,i.message,i.ref)))}for(let n of this.frameListeners)try{n(i)}catch(o){this.opts.logger.warn("[WsClient] onFrame handler threw:",o)}}armHeartbeat(){this.cancelTimers();let t=()=>{if(this.state==="open"){if(this.opts.now()-this.lastInboundAt>this.opts.inactivityDeadlineMs){try{this.ws?.close(ux2.INTERNAL_ERROR,"inactivity deadline")}catch{}return}try{this.send({v:1,id:OL1(),type:"ping",ts:new Date().toISOString()})}catch{return}this.pingTimer=this.opts.setTimeoutFn(t,this.opts.pingIntervalMs)}};this.pingTimer=this.opts.setTimeoutFn(t,this.opts.pingIntervalMs)}cancelTimers(){this.pingTimer!==null&&(this.opts.clearTimeoutFn(this.pingTimer),this.pingTimer=null),this.deadlineTimer!==null&&(this.opts.clearTimeoutFn(this.deadlineTimer),this.deadlineTimer=null)}scheduleReconnect(t=""){if(this.gaveUp)return;if(this.reconnectAttempt++,this.reconnectAttempt>this.opts.reconnectMaxAttempts){this.gaveUp=!0;let n=this.opts.onGiveUp;if(n!==void 0)try{n({attempts:this.reconnectAttempt-1,lastReason:t})}catch(o){this.opts.logger.warn("[WsClient] onGiveUp handler threw:",o)}return}let r=Math.min(this.opts.reconnectMaxMs,this.opts.reconnectMinMs*2**(this.reconnectAttempt-1)),a=Math.floor(this.opts.reconnectMinMs/2),i=a+Math.floor(Math.random()*Math.max(1,r-a));this.reconnectTimer=this.opts.setTimeoutFn(()=>{this.reconnectTimer=null,this.openOnce().catch(n=>{if(this.reconnectTimer===null&&!this.explicitDisconnect&&this.opts.reconnect){let o=n instanceof Error?n.message:"pre-socket failure";this.scheduleReconnect(o)}})},i)}cancelReconnect(){this.reconnectTimer!==null&&(this.opts.clearTimeoutFn(this.reconnectTimer),this.reconnectTimer=null),this.reconnectAttempt=0}failPending(t){for(let[,r]of this.pending)try{r.reject(t)}catch(a){this.opts.logger.warn("[WsClient] pending.reject threw:",a)}this.pending.clear()}}});function gx2(e){if(e instanceof Vb)switch(e.code){case"capacity_exceeded":throw new eE1(e.message,e.ref);case"session_not_found":throw new ld1(e.message,e.ref);case"no_pool_for_request":throw new rE1(e.message,e.ref);case"bad_request":throw new px2(e.message,e.ref);case"unauthenticated":throw new fx2(e.message,e.ref);case"forbidden":throw new vx2(e.message,e.ref);case"session_not_ready":throw new mx2(e.message,e.ref);case"worker_boot_failed":throw new Cx2(e.message,e.ref);case"frame_too_large":throw new Mx2(e.message,e.ref);case"unsupported_type":throw new xx2(e.message,e.ref);case"internal_error":throw new Lx2(e.message,e.ref);default:throw e}throw e}var eE1,ld1,rE1,px2,fx2,vx2,mx2,Cx2,Mx2,xx2,Lx2,wx2,aE1,AI4=C1(()=>{"use strict";Ul0();eE1=class extends Vb{constructor(t,r){super("capacity_exceeded",t,r),this.name="CapacityExceededError"}},ld1=class extends Vb{constructor(t,r){super("session_not_found",t,r),this.name="SessionNotFoundError"}},rE1=class extends Vb{constructor(t,r){super("no_pool_for_request",t,r),this.name="NoPoolForRequestError"}},px2=class extends Vb{constructor(t,r){super("bad_request",t,r),this.name="BadRequestError"}},fx2=class extends Vb{constructor(t,r){super("unauthenticated",t,r),this.name="UnauthenticatedError"}},vx2=class extends Vb{constructor(t,r){super("forbidden",t,r),this.name="ForbiddenError"}},mx2=class extends Vb{constructor(t,r){super("session_not_ready",t,r),this.name="SessionNotReadyError"}},Cx2=class extends Vb{constructor(t,r){super("worker_boot_failed",t,r),this.name="WorkerBootFailedError"}},Mx2=class extends Vb{constructor(t,r){super("frame_too_large",t,r),this.name="FrameTooLargeError"}},xx2=class extends Vb{constructor(t,r){super("unsupported_type",t,r),this.name="UnsupportedTypeError"}},Lx2=class extends Vb{constructor(t,r){super("internal_error",t,r),this.name="InternalServerError"}};wx2="Cloud desktops are at capacity, try again in a minute.",aE1=class{constructor(t){this.outputListeners=new Set;this.decisionRequestListeners=new Set;this.endedListeners=new Set;this.phaseChangeListeners=new Set;this.detachFrameListener=null;this.client=t,this.detachFrameListener=this.client.onFrame(r=>this.handleFrame(r))}get ref(){return this._ref}get phase(){return this._phase}async createChat(t={}){if(this._ref!==void 0)throw new Error(`RunnerSession already attached to ref=${this._ref}; create a new instance for another session`);let r=OL1(),a;try{a=await this.client.request({v:1,id:r,type:"chat.create",ts:new Date().toISOString(),...t.securityMode!==void 0?{securityMode:t.securityMode}:{},...t.requester!==void 0?{requester:t.requester}:{}})}catch(i){gx2(i)}if(a.ref===void 0)throw console.warn("[RunnerSession] chat.create ack without ref \u2014 server-side session leak",{id:r}),new Error("runner ack to chat.create did not carry a ref");return this._ref=a.ref,{ref:a.ref}}async resume(t){if(this._ref!==void 0&&this._ref!==t.ref)throw new Error(`RunnerSession already attached to ref=${this._ref}; cannot resume a different ref`);let r=OL1(),a;try{a=await this.client.request({v:1,id:r,ref:t.ref,type:"resume",ts:new Date().toISOString()})}catch(n){gx2(n)}this._ref=t.ref;let i=a.snapshot;if(i!==void 0&&i.kind==="chat"){this._phase=i.phase;for(let n of this.phaseChangeListeners)try{n(i.phase,t.ref)}catch(o){console.warn("[RunnerSession] onPhaseChange threw:",o)}}return{snapshot:i}}async send(t){let r=this.requireRef("send"),a=OL1();try{await this.client.request({v:1,id:a,ref:r,type:"chat.send",ts:new Date().toISOString(),payload:t})}catch(i){gx2(i)}}async decide(t){let r=this.requireRef("decide"),a=OL1();try{await this.client.request({v:1,id:a,ref:r,type:"chat.decision",ts:new Date().toISOString(),executionId:t.executionId,choice:t.choice})}catch(i){gx2(i)}}async end(){let t=this.requireRef("end"),r=OL1();return new Promise((i,n)=>{let o=!1,h=f=>{o||(o=!0,u(),g(),f())},u=this.client.onFrame(f=>{if(f.type==="ack"&&f.id===r)h(()=>i());else if(f.type==="error"&&f.id===r){let v=f;h(()=>n(new Vb(v.code,v.message,v.ref)))}else f.type==="chat.ended"&&f.ref===t&&h(()=>i())}),g=this.client.onClose(f=>{h(()=>n(new Vb("internal_error",`transport closed before chat.ended (code=${f.code}: ${f.reason})`,t)))});try{this.client.send({v:1,id:r,ref:t,type:"chat.end",ts:new Date().toISOString()})}catch(f){h(()=>n(f))}}).finally(()=>{this._ref=void 0}).catch(gx2)}onOutput(t){return this.outputListeners.add(t),()=>this.outputListeners.delete(t)}onDecisionRequest(t){return this.decisionRequestListeners.add(t),()=>this.decisionRequestListeners.delete(t)}onEnded(t){return this.endedListeners.add(t),()=>this.endedListeners.delete(t)}onPhaseChange(t){return this.phaseChangeListeners.add(t),()=>this.phaseChangeListeners.delete(t)}dispose(){this.detachFrameListener!==null&&(this.detachFrameListener(),this.detachFrameListener=null),this.outputListeners.clear(),this.decisionRequestListeners.clear(),this.endedListeners.clear(),this.phaseChangeListeners.clear()}handleFrame(t){let r=t.ref;if(!(r===void 0||r!==this._ref))switch(t.type){case"chat.output":{let a=t;for(let i of this.outputListeners)try{i(a.chunk,a.ref)}catch(n){console.warn("[RunnerSession] onOutput threw:",n)}return}case"chat.decision.request":{let a=t;for(let i of this.decisionRequestListeners)try{i({executionId:a.executionId,toolName:a.toolName,args:a.args},a.ref)}catch(n){console.warn("[RunnerSession] onDecisionRequest threw:",n)}return}case"chat.ended":{let a=t;for(let i of this.endedListeners)try{i(a.reason,a.ref)}catch(n){console.warn("[RunnerSession] onEnded threw:",n)}return}default:return}}requireRef(t){if(this._ref===void 0)throw new Error(`RunnerSession.${t}() requires an attached session; call createChat() or resume() first`);return this._ref}}});var WZ5=C1(()=>{"use strict";Ul0();AI4()});var zI4=C1(()=>{"use strict";Ul0();AI4();WZ5();Nl0();LI4();yI4()});var qZ5,$Z5,KZ5=C1(()=>{qZ5=w4(Lu(),1),$Z5=(0,qZ5.create)(e=>({cards:{},ensureCard:(t,r)=>e(a=>a.cards[t]?a:{cards:{...a.cards,[t]:{expanded:r,userInteracted:!1}}}),toggle:t=>e(r=>{let a=r.cards[t]??{expanded:!1,userInteracted:!1};return{cards:{...r.cards,[t]:{expanded:!a.expanded,userInteracted:!0}}}}),autoCollapse:t=>e(r=>{let a=r.cards[t];return!a||a.userInteracted||!a.expanded?r:{cards:{...r.cards,[t]:{...a,expanded:!1}}}}),removeCards:t=>e(r=>{if(t.length===0)return r;let a=new Set(t),i=Object.entries(r.cards).filter(([n])=>!a.has(n));return i.length===Object.keys(r.cards).length?r:{cards:Object.fromEntries(i)}})}))});function YZ5(e,t,r,a){let i=[],n=[];if(!e||e.length===0)return{toPreload:i,toEvict:n};let o=new Set(t.map(u=>u.name)),h=new Set(a);for(let u of e){if(!o.has(u)){n.push(u);continue}h.has(u)||r[u]!==!1&&i.push(u)}return{toPreload:i,toEvict:n}}var XZ5=C1(()=>{});var JZ5,KT,L12=C1(()=>{JZ5=w4(Lu(),1);wd();KT=(0,JZ5.create)((e,t)=>({pendingElevations:{},sandboxDisabledSessionIds:new Set,foregroundControlAllowedSessionIds:new Set,unrestrictedSessionIds:new Set,pendingNewChatUnrestricted:!1,addPending:(r,a,i)=>e(n=>({pendingElevations:{...n.pendingElevations,[r]:{request:a,resolve:i}}})),removePending:r=>e(a=>{let{[r]:i,...n}=a.pendingElevations;return{pendingElevations:n}}),resolvePending:(r,a)=>{let i=t().pendingElevations[r];i&&(t().removePending(r),i.resolve(a))},disableSandboxForSession:(r,a)=>{let i=new Set(t().sandboxDisabledSessionIds);i.add(a),e({sandboxDisabledSessionIds:i});let n=t().pendingElevations[r];n&&(t().removePending(r),n.resolve(!0))},allowForegroundControlForSession:(r,a)=>{let i=new Set(t().foregroundControlAllowedSessionIds);i.add(a),e({foregroundControlAllowedSessionIds:i});let n=t().pendingElevations[r];n&&(t().removePending(r),n.resolve(!0))},isSandboxDisabledForSession:r=>t().sandboxDisabledSessionIds.has(r),isForegroundControlAllowedForSession:r=>t().foregroundControlAllowedSessionIds.has(r),setSandboxDisabledForSession:(r,a)=>{let i=new Set(t().sandboxDisabledSessionIds);a?i.add(r):i.delete(r),e({sandboxDisabledSessionIds:i})},setUnrestrictedForSession:(r,a)=>{let i=new Set(t().unrestrictedSessionIds);a?i.add(r):i.delete(r),e({unrestrictedSessionIds:i})},isUnrestrictedForSession:r=>t().unrestrictedSessionIds.has(r),isSandboxDisabledForSessionOrAncestor:r=>{let a=t().sandboxDisabledSessionIds;return(st.getState().selectSessionAncestry?.(r)??[r]).some(n=>a.has(n))},isForegroundControlAllowedForSessionOrAncestor:r=>{let a=t().foregroundControlAllowedSessionIds;return(st.getState().selectSessionAncestry?.(r)??[r]).some(n=>a.has(n))},isUnrestrictedForSessionOrAncestor:r=>{let a=t().unrestrictedSessionIds;return(st.getState().selectSessionAncestry?.(r)??[r]).some(n=>a.has(n))},setPendingNewChatUnrestricted:r=>{e({pendingNewChatUnrestricted:r})},consumePendingNewChatUnrestricted:()=>{let r=t().pendingNewChatUnrestricted;return r&&e({pendingNewChatUnrestricted:!1}),r},clearForSession:r=>{let{unrestrictedSessionIds:a,sandboxDisabledSessionIds:i,foregroundControlAllowedSessionIds:n}=t(),o=a.has(r),h=i.has(r),u=n.has(r);if(!o&&!h&&!u)return;let g=o?new Set(a):a;o&&g.delete(r);let f=h?new Set(i):i;h&&f.delete(r);let v=u?new Set(n):n;u&&v.delete(r),e({unrestrictedSessionIds:g,sandboxDisabledSessionIds:f,foregroundControlAllowedSessionIds:v})}}))});var aF5={};qr(aF5,{getAuthProfile:()=>TI4,getChatHistoryStore:()=>w12,getProjectStore:()=>aM,registerAuthProfile:()=>HI4,registerChatHistoryStore:()=>SI4,registerProjectStore:()=>bI4,registerSessionShellAppResolver:()=>kI4,resolveSessionShellApp:()=>yx2});function bI4(e){QZ5=e}function SI4(e){tF5=e}function HI4(e){eF5=e}function kI4(e){rF5=e}function aM(){return QZ5?.()??null}function w12(){return tF5?.()??null}function TI4(){return eF5?.()??null}function yx2(e){return rF5?.(e)??null}var QZ5,tF5,eF5,rF5,jO=C1(()=>{QZ5=null,tF5=null,eF5=null,rF5=null});function BI4(e,t){if(typeof e=="string"){if(e==="power_user")return T5.RECOMMENDED;if(e===T5.MAXIMUM||e===T5.RECOMMENDED||e===T5.UNRESTRICTED)return e;if(e===T5.ADAPTIVE){let r=t!==void 0?t:SS5();return wE4(r)?T5.ADAPTIVE:void 0}}}function Gl0(e){if(!e)return;let t=aM();if(!t)return;let a=(st.getState().selectSessionAncestry?.(e)??[e]).find(n=>t.taskProjectMap[n]);if(!a)return;let i=t.projects.find(n=>n.id===t.taskProjectMap[a]);return BI4(i?.metadata?.securityMode)}function cd1(e,t){let r=Gl0(e);return r?M91[r].executionPolicy:t}function iF5(e,t){return Gl0(e)??t}var iE1=C1(()=>{wd();jO();Q11();fQ1()});function Ax2(e){return e.requiresUiAutomation===!0||e.capabilityCategory==="screen"}function PI4(e,t=!1){return e.capabilityCategory==="mcp"||t}function uE7(e){try{return new URL(e,"https://delegate.invalid").pathname.toLowerCase()}catch{return e.split(/[?#]/,1)[0].toLowerCase()}}function gE7(e){if(!e)return!1;let t=uE7(e).replace(/^\/+/,"");return dE7.some(r=>t===r||t.startsWith(`${r}/`))}function nF5(e,t){if(e==="ExecuteSkillApi"){let r=t.operations,a=r;if(typeof r=="string")try{a=JSON.parse(r)}catch{return!1}return Array.isArray(a)?a.some(i=>{if(!i||typeof i!="object")return!1;let n=i.endpoint;return typeof n=="string"&&gE7(n)}):!1}return!1}var hE7,dE7,VI4,Ox,DL1=C1(()=>{z_1();hE7=!0,dE7=["computer-act","computer-state","cursor","recorder",yv.validateUia.replace(/^\/+/,""),"screenshot","ui-scripting"];VI4=class{constructor(t){this.options=t}decide(t,r){return this.isRestricted(r)?t==="mcp"?this.options.mcpEnabled?"allow":"deny":t==="screen-observation"||t==="execution-approval"||t==="elevation"||t==="host-discovery"?"deny":"allow":"allow"}isRestricted(t){return t?.accessMode==="project_restricted"}canExposeTool(t,r,a=!1){return!(Ax2(t)&&this.decide("screen-observation",r)==="deny"||PI4(t,a)&&this.decide("mcp",r)==="deny"||t.restrictedCapability==="host-discovery"&&this.decide("host-discovery",r)==="deny")}constrainExecutionDecision(t,r){return t==="ask"&&this.decide("execution-approval",r)==="deny"?"deny":t}promptGuidance(t){if(!this.isRestricted(t))return;let r=[...new Set(t?.grantSources?t.grants.filter(i=>Object.prototype.hasOwnProperty.call(t.grantSources,i.id)).map(i=>i.path):[])];return["This is a restricted project turn. Local access is fixed by the immutable turn policy.","Use only the allowed paths below and use ListAccessibleFiles to discover accessible user-data files; do not probe arbitrary locations.",r.length>0?r.map(i=>`- ${i}`).join(`
|
|
9999
|
+
`);var t="",r,a,i=0,n;for(r=a=0,i=e.length,n=0;n<i;n++){var o=e.charCodeAt(n),h=null;o<128?a++:o>127&&o<2048?h=String.fromCharCode(o>>6|192,o&63|128):h=String.fromCharCode(o>>12|224,o>>6&63|128,o&63|128),h!==null&&(a>r&&(t+=e.substring(r,a)),t+=h,r=a=n+1)}return a>r&&(t+=e.substring(r,e.length)),t};d4.UUID=function(){try{return n7.crypto.randomUUID()}catch{for(var e=new Array(36),t=0;t<36;t++)e[t]=Math.floor(Math.random()*16);return e[14]=4,e[19]=e[19]&=-5,e[19]=e[19]|=8,e[8]=e[13]=e[18]=e[23]="-",d4.map(e,function(a){return a.toString(16)}).join("")}};var qP5=["ahrefsbot","ahrefssiteaudit","amazonbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandex","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];d4.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<qP5.length;t++)if(e.indexOf(qP5[t])!==-1)return!0;return!1};d4.HTTPBuildQuery=function(e,t){var r,a,i=[];return d4.isUndefined(t)&&(t="&"),d4.each(e,function(n,o){r=encodeURIComponent(n.toString()),a=encodeURIComponent(o),i[i.length]=a+"="+r}),i.join(t)};d4.getQueryParam=function(e,t){t=t.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var r="[\\?&]"+t+"=([^&#]*)",a=new RegExp(r),i=a.exec(e);if(i===null||i&&typeof i[1]!="string"&&i[1].length)return"";var n=i[1];try{n=decodeURIComponent(n)}catch{jd.error("Skipping decoding for malformed query param: "+n)}return n.replace(/\+/g," ")};d4.cookie={get:function(e){for(var t=e+"=",r=Hh.cookie.split(";"),a=0;a<r.length;a++){for(var i=r[a];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}return null},parse:function(e){var t;try{t=d4.JSONDecode(d4.cookie.get(e))||{}}catch{}return t},set_seconds:function(e,t,r,a,i,n,o){var h="",u="",g="";if(o)h="; domain="+o;else if(a){var f=$P5(Hh.location.hostname);h=f?"; domain=."+f:""}if(r){var v=new Date;v.setTime(v.getTime()+r*1e3),u="; expires="+v.toGMTString()}n&&(i=!0,g="; SameSite=None"),i&&(g+="; secure"),Hh.cookie=e+"="+encodeURIComponent(t)+u+"; path=/"+h+g},set:function(e,t,r,a,i,n,o){var h="",u="",g="";if(o)h="; domain="+o;else if(a){var f=$P5(Hh.location.hostname);h=f?"; domain=."+f:""}if(r){var v=new Date;v.setTime(v.getTime()+r*24*60*60*1e3),u="; expires="+v.toGMTString()}n&&(i=!0,g="; SameSite=None"),i&&(g+="; secure");var C=e+"="+encodeURIComponent(t)+u+"; path=/"+h+g;return Hh.cookie=C,C},remove:function(e,t,r){d4.cookie.set(e,"",-1,t,!1,!1,r)}};var IR5=function(e){var t=!0;try{var r="__mplss_"+$D4(8),a="xyz";e.setItem(r,a),e.getItem(r)!==a&&(t=!1),e.removeItem(r)}catch{t=!1}return t},KF4=null,rx2=function(e,t){return KF4!==null&&!t?KF4:KF4=IR5(e||n7.localStorage)},YF4=null,eP7=function(e,t){return YF4!==null&&!t?YF4:YF4=IR5(e||n7.sessionStorage)};function NR5(e,t,r){var a=function(i){jd.error(t+" error: "+i)};return{is_supported:function(i){var n=r(e,i);return n||jd.error(t+" unsupported"),n},error:a,get:function(i){try{return e.getItem(i)}catch(n){a(n)}return null},parse:function(i){try{return d4.JSONDecode(e.getItem(i))||{}}catch{}return null},set:function(i,n){try{e.setItem(i,n)}catch(o){a(o)}},remove:function(i){try{e.removeItem(i)}catch(n){a(n)}}}}var UR5=null,GR5=null;try{UR5=n7.localStorage,GR5=n7.sessionStorage}catch{}d4.localStorage=NR5(UR5,"localStorage",rx2);d4.sessionStorage=NR5(GR5,"sessionStorage",eP7);d4.register_event=(function(){var e=function(a,i,n,o,h){if(!a){jd.error("No valid element provided to register_event");return}if(a.addEventListener&&!o)a.addEventListener(i,n,!!h);else{var u="on"+i,g=a[u];a[u]=t(a,n,g)}};function t(a,i,n){var o=function(h){if(h=h||r(n7.event),!!h){var u=!0,g,f;return d4.isFunction(n)&&(g=n(h)),f=i.call(a,h),(g===!1||f===!1)&&(u=!1),u}};return o}function r(a){return a&&(a.preventDefault=r.preventDefault,a.stopPropagation=r.stopPropagation),a}return r.preventDefault=function(){this.returnValue=!1},r.stopPropagation=function(){this.cancelBubble=!0},e})();var rP7=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');d4.dom_query=(function(){function e(i){return i.all?i.all:i.getElementsByTagName("*")}var t=/[\t\r\n]/g;function r(i,n){var o=" "+n+" ";return(" "+i.className+" ").replace(t," ").indexOf(o)>=0}function a(i){if(!Hh.getElementsByTagName)return[];var n=i.split(" "),o,h,u,g,f,v,C,L,y,z,S=[Hh];for(v=0;v<n.length;v++){if(o=n[v].replace(/^\s+/,"").replace(/\s+$/,""),o.indexOf("#")>-1){h=o.split("#"),u=h[0];var B=h[1],R=Hh.getElementById(B);if(!R||u&&R.nodeName.toLowerCase()!=u)return[];S=[R];continue}if(o.indexOf(".")>-1){h=o.split("."),u=h[0];var F=h[1];for(u||(u="*"),g=[],f=0,C=0;C<S.length;C++)for(u=="*"?y=e(S[C]):y=S[C].getElementsByTagName(u),L=0;L<y.length;L++)g[f++]=y[L];for(S=[],z=0,C=0;C<g.length;C++)g[C].className&&d4.isString(g[C].className)&&r(g[C],F)&&(S[z++]=g[C]);continue}var N=o.match(rP7);if(N){u=N[1];var j=N[2],Y=N[3],t1=N[4];for(u||(u="*"),g=[],f=0,C=0;C<S.length;C++)for(u=="*"?y=e(S[C]):y=S[C].getElementsByTagName(u),L=0;L<y.length;L++)g[f++]=y[L];S=[],z=0;var n1;switch(Y){case"=":n1=function(a1){return a1.getAttribute(j)==t1};break;case"~":n1=function(a1){return a1.getAttribute(j).match(new RegExp("\\b"+t1+"\\b"))};break;case"|":n1=function(a1){return a1.getAttribute(j).match(new RegExp("^"+t1+"-?"))};break;case"^":n1=function(a1){return a1.getAttribute(j).indexOf(t1)===0};break;case"$":n1=function(a1){return a1.getAttribute(j).lastIndexOf(t1)==a1.getAttribute(j).length-t1.length};break;case"*":n1=function(a1){return a1.getAttribute(j).indexOf(t1)>-1};break;default:n1=function(a1){return a1.getAttribute(j)}}for(S=[],z=0,C=0;C<g.length;C++)n1(g[C])&&(S[z++]=g[C]);continue}for(u=o,g=[],f=0,C=0;C<S.length;C++)for(y=S[C].getElementsByTagName(u),L=0;L<y.length;L++)g[f++]=y[L];S=g}return S}return function(i){return d4.isElement(i)?[i]:d4.isObject(i)&&!d4.isUndefined(i.length)?i:a.call(this,i)}})();var aP7=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],iP7=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];d4.info={campaignParams:function(e){var t="",r={};return d4.each(aP7,function(a){t=d4.getQueryParam(Hh.URL,a),t.length?r[a]=t:e!==void 0&&(r[a]=e)}),r},clickParams:function(){var e="",t={};return d4.each(iP7,function(r){e=d4.getQueryParam(Hh.URL,r),e.length&&(t[r]=e)}),t},marketingParams:function(){return d4.extend(d4.info.campaignParams(),d4.info.clickParams())},searchEngine:function(e){return e.search("https?://(.*)google.([^/?]*)")===0?"google":e.search("https?://(.*)bing.com")===0?"bing":e.search("https?://(.*)yahoo.com")===0?"yahoo":e.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(e){var t=d4.info.searchEngine(e),r=t!="yahoo"?"q":"p",a={};if(t!==null){a.$search_engine=t;var i=d4.getQueryParam(e,r);i.length&&(a.mp_keyword=i)}return a},browser:function(e,t,r){return t=t||"",r||d4.includes(e," OPR/")?d4.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":d4.includes(e,"IEMobile")||d4.includes(e,"WPDesktop")?"Internet Explorer Mobile":d4.includes(e,"SamsungBrowser/")?"Samsung Internet":d4.includes(e,"Edge")||d4.includes(e,"Edg/")?"Microsoft Edge":d4.includes(e,"FBIOS")?"Facebook Mobile":d4.includes(e,"Whale/")?"Whale Browser":d4.includes(e,"Chrome")?"Chrome":d4.includes(e,"CriOS")?"Chrome iOS":d4.includes(e,"UCWEB")||d4.includes(e,"UCBrowser")?"UC Browser":d4.includes(e,"FxiOS")?"Firefox iOS":d4.includes(t,"Apple")?d4.includes(e,"Mobile")?"Mobile Safari":"Safari":d4.includes(e,"Android")?"Android Mobile":d4.includes(e,"Konqueror")?"Konqueror":d4.includes(e,"Firefox")?"Firefox":d4.includes(e,"MSIE")||d4.includes(e,"Trident/")?"Internet Explorer":d4.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,r){var a=d4.info.browser(e,t,r),i={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/,"Whale Browser":/Whale\/(\d+(\.\d+)?)/},n=i[a];if(n===void 0)return null;var o=e.match(n);return o?parseFloat(o[o.length-2]):null},os:function(){var e=F91;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":""},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)?"Android":""},referringDomain:function(e){var t=e.split("/");return t.length>=3?t[2]:""},currentUrl:function(){return n7.location.href},properties:function(e){return typeof e!="object"&&(e={}),d4.extend(d4.strip_empty_properties({$os:d4.info.os(),$browser:d4.info.browser(F91,Xh1.vendor,BM2),$referrer:Hh.referrer,$referring_domain:d4.info.referringDomain(Hh.referrer),$device:d4.info.device(F91)}),{$current_url:d4.info.currentUrl(),$browser_version:d4.info.browserVersion(F91,Xh1.vendor,BM2),$screen_height:UP5.height,$screen_width:UP5.width,mp_lib:"web",$lib_version:LW.LIB_VERSION,$insert_id:$D4(),time:d4.timestamp()/1e3},d4.strip_empty_properties(e))},people_properties:function(){return d4.extend(d4.strip_empty_properties({$os:d4.info.os(),$browser:d4.info.browser(F91,Xh1.vendor,BM2)}),{$browser_version:d4.info.browserVersion(F91,Xh1.vendor,BM2)})},mpPageViewProperties:function(){return d4.strip_empty_properties({current_page_title:Hh.title,current_domain:n7.location.hostname,current_url_path:n7.location.pathname,current_url_protocol:n7.location.protocol,current_url_search:n7.location.search})}};var nP7=function(e,t){var r=null,a=[];return function(i){var n=this;return a.push(i),r||(r=new hf(function(o){setTimeout(function(){var h=e.apply(n,[a]);r=null,a=[],o(h)},t)})),r}},$D4=function(e){var t=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return e?t.substring(0,e):t},jR5=function(){var e=d4.UUID().replace(/-/g,""),t=d4.UUID().replace(/-/g,"").substring(0,16),r="01";return"00-"+e+"-"+t+"-"+r},oP7=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,lP7=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,$P5=function(e){var t=lP7,r=e.split("."),a=r[r.length-1];(a.length>4||a==="com"||a==="org")&&(t=oP7);var i=e.match(t);return i?i[0]:""},cP7=function(){var e=n7.navigator.onLine;return d4.isUndefined(e)||e},zL1=function(){},g12=null,Xo0=null;typeof JSON<"u"&&(g12=JSON.stringify,Xo0=JSON.parse);g12=g12||d4.JSONEncode;Xo0=Xo0||d4.JSONDecode;var sP7=function(e,t,r){if(!n7.CompressionStream)return!1;var a=d4.info.browser(e,t,r),i=d4.info.browserVersion(e,t,r);return!((a==="Safari"||a==="Mobile Safari")&&i>=16.4&&i<16.6)};d4.info=d4.info;d4.info.browser=d4.info.browser;d4.info.browserVersion=d4.info.browserVersion;d4.info.device=d4.info.device;d4.info.properties=d4.info.properties;d4.isBlockedUA=d4.isBlockedUA;d4.isEmptyObject=d4.isEmptyObject;d4.isObject=d4.isObject;d4.JSONDecode=d4.JSONDecode;d4.JSONEncode=d4.JSONEncode;d4.toArray=d4.toArray;d4.NPO=EL1;var hP7="mixpanelBrowserDb",WR5="mixpanelRecordingEvents",KD4="mixpanelRecordingRegistry",dP7=1,uP7=[WR5,KD4],o61=function(e){this.dbPromise=null,this.storeName=e};o61.prototype._openDb=function(){return new hf(function(e,t){var r=n7.indexedDB.open(hP7,dP7);r.onerror=function(){t(r.error)},r.onsuccess=function(){e(r.result)},r.onupgradeneeded=function(a){var i=a.target.result;uP7.forEach(function(n){i.createObjectStore(n)})}})};o61.prototype.init=function(){return n7.indexedDB?(this.dbPromise||(this.dbPromise=this._openDb()),this.dbPromise.then(function(e){return e instanceof n7.IDBDatabase?hf.resolve():hf.reject(e)})):hf.reject("indexedDB is not supported in this browser")};o61.prototype.isInitialized=function(){return!!this.dbPromise};o61.prototype.makeTransaction=function(e,t){var r=this.storeName,a=function(i){return new hf(function(n,o){var h=i.transaction(r,e);h.oncomplete=function(){n(h)},h.onabort=h.onerror=function(){o(h.error)},t(h.objectStore(r))})};return this.dbPromise.then(a).catch(function(i){return i&&i.name==="InvalidStateError"?(this.dbPromise=this._openDb(),this.dbPromise.then(a)):hf.reject(i)}.bind(this))};o61.prototype.setItem=function(e,t){return this.makeTransaction("readwrite",function(r){r.put(t,e)})};o61.prototype.getItem=function(e){var t;return this.makeTransaction("readonly",function(r){t=r.get(e)}).then(function(){return t.result})};o61.prototype.removeItem=function(e){return this.makeTransaction("readwrite",function(t){t.delete(e)})};o61.prototype.getAll=function(){var e;return this.makeTransaction("readonly",function(t){e=t.getAll()}).then(function(){return e.result})};var gP7="__mp_opt_in_out_";function pP7(e,t){KR5(!0,e,t)}function fP7(e,t){KR5(!1,e,t)}function vP7(e,t){return $R5(e,t)==="1"}function qR5(e,t){if(CP7(t))return jd.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var r=$R5(e,t)==="0";return r&&jd.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),r}function RL1(e){return JD4(e,function(t){return this.get_config(t)})}function ZL1(e){return JD4(e,function(t){return this._get_config(t)})}function v12(e){return JD4(e,function(t){return this._get_config(t)})}function mP7(e,t){t=t||{},YD4(t).remove(XD4(e,t),!!t.crossSubdomainCookie,t.cookieDomain)}function YD4(e){return e=e||{},e.persistenceType==="localStorage"?d4.localStorage:d4.cookie}function XD4(e,t){return t=t||{},(t.persistencePrefix||gP7)+e}function $R5(e,t){return YD4(t).get(XD4(e,t))}function CP7(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||n7,r=t.navigator||{},a=!1;return d4.each([r.doNotTrack,r.msDoNotTrack,t.doNotTrack],function(i){d4.includes([!0,1,"1","yes"],i)&&(a=!0)}),a}function KR5(e,t,r){if(!d4.isString(t)||!t.length){jd.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token");return}r=r||{},YD4(r).set(XD4(t,r),e?1:0,d4.isNumber(r.cookieExpiration)?r.cookieExpiration:null,!!r.crossSubdomainCookie,!!r.secureCookie,!!r.crossSiteCookie,r.cookieDomain),r.track&&e&&r.track(r.trackEventName||"$opt_in",r.trackProperties,{send_immediately:!0})}function JD4(e,t){return function(){var r=!1;try{var a=t.call(this,"token"),i=t.call(this,"ignore_dnt"),n=t.call(this,"opt_out_tracking_persistence_type"),o=t.call(this,"opt_out_tracking_cookie_prefix"),h=t.call(this,"window");a&&(r=qR5(a,{ignoreDnt:i,persistenceType:n,persistencePrefix:o,window:h}))}catch(g){jd.error("Unexpected error when checking tracking opt-out status: "+g)}if(!r)return e.apply(this,arguments);var u=arguments[arguments.length-1];typeof u=="function"&&u(0)}}var MP7=J_1("lock"),YR5=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||n7.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3,this.promiseImpl=t.promiseImpl||hf};YR5.prototype.withLock=function(e,t){var r=this.promiseImpl;return new r(d4.bind(function(a,i){var n=t||new Date().getTime()+"|"+Math.random(),o=new Date().getTime(),h=this.storageKey,u=this.pollIntervalMS,g=this.timeoutMS,f=this.storage,v=h+":X",C=h+":Y",L=h+":Z",y=function(F){if(new Date().getTime()-o>g){MP7.error("Timeout waiting for mutex on "+h+"; clearing lock. ["+n+"]"),f.removeItem(L),f.removeItem(C),B();return}setTimeout(function(){try{F()}catch(N){i(N)}},u*(Math.random()+.1))},z=function(F,N){F()?N():y(function(){z(F,N)})},S=function(){var F=f.getItem(C);return F&&F!==n?!1:(f.setItem(C,n),f.getItem(C)===n?!0:(rx2(f,!0)||i(new Error("localStorage support dropped while acquiring lock")),!1))},B=function(){f.setItem(v,n),z(S,function(){if(f.getItem(v)===n){R();return}y(function(){if(f.getItem(C)!==n){B();return}z(function(){return!f.getItem(L)},R)})})},R=function(){f.setItem(L,"1");var F=function(){f.removeItem(L),f.getItem(C)===n&&f.removeItem(C),f.getItem(v)===n&&f.removeItem(v)};e().then(function(N){F(),a(N)}).catch(function(N){F(),i(N)})};try{if(rx2(f,!0))B();else throw new Error("localStorage support check failed")}catch(F){i(F)}},this))};var m12=function(e){this.storage=e||n7.localStorage};m12.prototype.init=function(){return hf.resolve()};m12.prototype.isInitialized=function(){return!0};m12.prototype.setItem=function(e,t){return new hf(d4.bind(function(r,a){try{this.storage.setItem(e,g12(t))}catch(i){a(i)}r()},this))};m12.prototype.getItem=function(e){return new hf(d4.bind(function(t,r){var a;try{a=Xo0(this.storage.getItem(e))}catch(i){r(i)}t(a)},this))};m12.prototype.removeItem=function(e){return new hf(d4.bind(function(t,r){try{this.storage.removeItem(e)}catch(a){r(a)}t()},this))};var KP5=J_1("batch"),N91=function(e,t){t=t||{},this.storageKey=e,this.usePersistence=t.usePersistence,this.usePersistence&&(this.queueStorage=t.queueStorage||new m12,this.lock=new YR5(e,{storage:t.sharedLockStorage||n7.localStorage,timeoutMS:t.sharedLockTimeoutMS})),this.reportError=t.errorReporter||d4.bind(KP5.error,KP5),this.pid=t.pid||null,this.memQueue=[],this.initialized=!1,t.enqueueThrottleMs?this.enqueuePersisted=nP7(d4.bind(this._enqueuePersisted,this),t.enqueueThrottleMs):this.enqueuePersisted=d4.bind(function(r){return this._enqueuePersisted([r])},this)};N91.prototype.ensureInit=function(){return this.initialized||!this.usePersistence?hf.resolve():this.queueStorage.init().then(d4.bind(function(){this.initialized=!0},this)).catch(d4.bind(function(e){this.reportError("Error initializing queue persistence. Disabling persistence",e),this.initialized=!0,this.usePersistence=!1},this))};N91.prototype.enqueue=function(e,t){var r={id:$D4(),flushAfter:new Date().getTime()+t*2,payload:e};return this.usePersistence?this.enqueuePersisted(r):(this.memQueue.push(r),hf.resolve(!0))};N91.prototype._enqueuePersisted=function(e){var t=d4.bind(function(){return this.ensureInit().then(d4.bind(function(){return this.readFromStorage()},this)).then(d4.bind(function(r){return this.saveToStorage(r.concat(e))},this)).then(d4.bind(function(r){return r&&(this.memQueue=this.memQueue.concat(e)),r},this)).catch(d4.bind(function(r){return this.reportError("Error enqueueing items",r,e),!1},this))},this);return this.lock.withLock(t,this.pid).catch(d4.bind(function(r){return this.reportError("Error acquiring storage lock",r),!1},this))};N91.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);return this.usePersistence&&t.length<e?this.ensureInit().then(d4.bind(function(){return this.readFromStorage()},this)).then(d4.bind(function(r){if(r.length){var a={};d4.each(t,function(o){a[o.id]=!0});for(var i=0;i<r.length;i++){var n=r[i];if(new Date().getTime()>n.flushAfter&&!a[n.id]&&(n.orphaned=!0,t.push(n),t.length>=e))break}}return t},this)):hf.resolve(t)};var YP5=function(e,t){var r=[];return d4.each(e,function(a){a.id&&!t[a.id]&&r.push(a)}),r};N91.prototype.removeItemsByID=function(e){var t={};if(d4.each(e,function(a){t[a]=!0}),this.memQueue=YP5(this.memQueue,t),this.usePersistence){var r=d4.bind(function(){return this.ensureInit().then(d4.bind(function(){return this.readFromStorage()},this)).then(d4.bind(function(a){return a=YP5(a,t),this.saveToStorage(a)},this)).then(d4.bind(function(){return this.readFromStorage()},this)).then(d4.bind(function(a){for(var i=0;i<a.length;i++){var n=a[i];if(n.id&&t[n.id])throw new Error("Item not removed from storage")}return!0},this)).catch(d4.bind(function(a){return this.reportError("Error removing items",a,e),!1},this))},this);return this.lock.withLock(r,this.pid).catch(d4.bind(function(a){return this.reportError("Error acquiring storage lock",a),rx2(this.lock.storage,!0)?!1:r().then(d4.bind(function(i){return i||this.queueStorage.removeItem(this.storageKey).then(function(){return i})},this)).catch(d4.bind(function(i){return this.reportError("Error clearing queue",i),!1},this))},this))}else return hf.resolve(!0)};var XP5=function(e,t){var r=[];return d4.each(e,function(a){var i=a.id;if(i in t){var n=t[i];n!==null&&(a.payload=n,r.push(a))}else r.push(a)}),r};N91.prototype.updatePayloads=function(e){return this.memQueue=XP5(this.memQueue,e),this.usePersistence?this.lock.withLock(d4.bind(function(){return this.ensureInit().then(d4.bind(function(){return this.readFromStorage()},this)).then(d4.bind(function(r){return r=XP5(r,e),this.saveToStorage(r)},this)).catch(d4.bind(function(r){return this.reportError("Error updating items",e,r),!1},this))},this),this.pid).catch(d4.bind(function(t){return this.reportError("Error acquiring storage lock",t),!1},this)):hf.resolve(!0)};N91.prototype.readFromStorage=function(){return this.ensureInit().then(d4.bind(function(){return this.queueStorage.getItem(this.storageKey)},this)).then(d4.bind(function(e){return e&&(d4.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null)),e||[]},this)).catch(d4.bind(function(e){return this.reportError("Error retrieving queue",e),[]},this))};N91.prototype.saveToStorage=function(e){return this.ensureInit().then(d4.bind(function(){return this.queueStorage.setItem(this.storageKey,e)},this)).then(function(){return!0}).catch(d4.bind(function(t){return this.reportError("Error saving queue",t),!1},this))};N91.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(d4.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):hf.resolve()};var xP7=600*1e3,ZM2=J_1("batch"),s21=function(e,t){this.errorReporter=t.errorReporter,this.queue=new N91(e,{errorReporter:d4.bind(this.reportError,this),queueStorage:t.queueStorage,sharedLockStorage:t.sharedLockStorage,sharedLockTimeoutMS:t.sharedLockTimeoutMS,usePersistence:t.usePersistence,enqueueThrottleMs:t.enqueueThrottleMs}),this.libConfig=t.libConfig,this.sendRequest=t.sendRequestFunc,this.beforeSendHook=t.beforeSendHook,this.stopAllBatching=t.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=t.flushOnlyOnInterval||!1,this._flushPromise=null};s21.prototype.enqueue=function(e){return this.queue.enqueue(e,this.flushInterval)};s21.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()};s21.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)};s21.prototype.clear=function(){return this.queue.clear()};s21.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size};s21.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)};s21.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(d4.bind(function(){this.stopped||(this._flushPromise=this.flush())},this),this.flushInterval))};s21.prototype.sendRequestPromise=function(e,t){return new hf(d4.bind(function(r){this.sendRequest(e,t,r)},this))};s21.prototype.flush=function(e){if(this.requestInProgress)return ZM2.log("Flush: Request already in progress"),hf.resolve();this.requestInProgress=!0,e=e||{};var t=this.libConfig.batch_request_timeout_ms,r=new Date().getTime(),a=this.batchSize;return this.queue.fillBatch(a).then(d4.bind(function(i){var n=i.length===a,o=[],h={};if(d4.each(i,function(v){var C=v.payload;if(this.beforeSendHook&&!v.orphaned&&(C=this.beforeSendHook(C)),C){C.event&&C.properties&&(C.properties=d4.extend({},C.properties,{mp_sent_by_lib_version:LW.LIB_VERSION}));var L=!0,y=v.id;y?(this.itemIdsSentSuccessfully[y]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:v,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[y]}),L=!1):this.reportError("[dupe] found item with no ID",{item:v}),L&&o.push(C)}h[v.id]=C},this),o.length<1)return this.requestInProgress=!1,this.resetFlush(),hf.resolve();var u=d4.bind(function(){return this.queue.removeItemsByID(d4.map(i,function(v){return v.id})).then(d4.bind(function(v){return d4.each(i,d4.bind(function(C){var L=C.id;L?(this.itemIdsSentSuccessfully[L]=this.itemIdsSentSuccessfully[L]||0,this.itemIdsSentSuccessfully[L]++,this.itemIdsSentSuccessfully[L]>5&&this.reportError("[dupe] item ID sent too many times",{item:C,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[L]})):this.reportError("[dupe] found item with no ID while removing",{item:C})},this)),v?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!n?(this.resetFlush(),hf.resolve()):this.flush()):(++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush(),hf.resolve())},this))},this),g=d4.bind(function(v){this.requestInProgress=!1;try{if(e.unloading)return this.queue.updatePayloads(h);if(d4.isObject(v)&&v.error==="timeout"&&new Date().getTime()-r>=t)return this.reportError("Network timeout; retrying"),this.flush();if(d4.isObject(v)&&(v.httpStatusCode>=500||v.httpStatusCode===429||v.httpStatusCode<=0&&!cP7()||v.error==="timeout")){var C=this.flushInterval*2;return v.retryAfter&&(C=parseInt(v.retryAfter,10)*1e3||C),C=Math.min(xP7,C),this.reportError("Error; retry in "+C+" ms"),this.scheduleFlush(C),hf.resolve()}else if(d4.isObject(v)&&v.httpStatusCode===413)if(i.length>1){var L=Math.max(1,Math.floor(a/2));return this.batchSize=Math.min(this.batchSize,L,i.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush(),hf.resolve()}else return this.reportError("Single-event request too large; dropping",i),this.resetBatchSize(),u();else return u()}catch(y){this.reportError("Error handling API response",y),this.resetFlush()}},this),f={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};return e.unloading&&(f.transport="sendBeacon"),ZM2.log("MIXPANEL REQUEST:",o),this.sendRequestPromise(o,f).then(g)},this)).catch(d4.bind(function(i){this.reportError("Error flushing request queue",i),this.resetFlush()},this))};s21.prototype.reportError=function(e,t){if(ZM2.error.apply(ZM2.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(r){ZM2.error(r)}};var QD4=function(e){var t=Date.now();return!e||t>e.maxExpires||t>e.idleExpires},LP7=250,ax2="change",rd1="click",eD4="hashchange",wP7="input",JP5="load",AL1="mp_locationchange",QP5="popstate",Hl0="scrollend",tI4="scroll",yP7="select",Jo0="submit",AP7="toggle",t_5="visibilitychange",zP7=["clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","x","y"],e_5=["mp-include"],rD4=["mp-no-track"],r_5=rD4.concat(["mp-sensitive"]),bP7=["aria-label","aria-labelledby","aria-describedby","href","name","role","title","type"],SP7={button:!0,checkbox:!0,combobox:!0,grid:!0,link:!0,listbox:!0,menu:!0,menubar:!0,menuitem:!0,menuitemcheckbox:!0,menuitemradio:!0,navigation:!0,option:!0,radio:!0,radiogroup:!0,searchbox:!0,slider:!0,spinbutton:!0,switch:!0,tab:!0,tablist:!0,textbox:!0,tree:!0,treegrid:!0,treeitem:!0},HP7={base:!0,head:!0,html:!0,link:!0,meta:!0,script:!0,style:!0,title:!0,br:!0,hr:!0,wbr:!0,noscript:!0,picture:!0,source:!0,template:!0,track:!0},kP7={article:!0,div:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,p:!0,section:!0,span:!0},a_5=["onclick","onmousedown","onmouseup","onpointerdown","onpointerup","ontouchend","ontouchstart"],TP7=5,Pw=J_1("autocapture");function aD4(e){for(var t={},r=XR5(e).split(" "),a=0;a<r.length;a++){var i=r[a];i&&(t[i]=!0)}return t}function XR5(e){switch(typeof e.className){case"string":return e.className;case"object":return e.className.baseVal||e.getAttribute("class")||"";default:return""}}function BP7(e){if(e.previousElementSibling)return e.previousElementSibling;do e=e.previousSibling;while(e&&!JR5(e));return e}function i_5(e,t,r,a,i,n){var o={$classes:XR5(e).split(" "),$tag_name:e.tagName.toLowerCase()},h=e.id;h&&(o.$id=h),eI4(e,t,i,n)&&d4.each(bP7.concat(a),function(v){if(e.hasAttribute(v)&&!r[v]){var C=e.getAttribute(v);Qo0(C)&&(o["$attr-"+v]=C)}});for(var u=1,g=1,f=e;f=BP7(f);)u++,f.tagName===e.tagName&&g++;return o.$nth_child=u,o.$nth_of_type=g,o}function VP7(e,t){var r=t.allowElementCallback,a=t.allowSelectors||[],i=t.blockAttrs||[],n=t.blockElementCallback,o=t.blockSelectors||[],h=t.captureTextContent||!1,u=t.captureExtraAttrs||[],g=t.capturedForHeatMap||!1,f={};d4.each(i,function(j){f[j]=!0});var v=null,C=typeof e.target>"u"?e.srcElement:e.target;if(QR5(C)&&(C=C.parentNode),RP7(C,e)&&iD4(C,e,r,a)&&!XF4(C,e,n,o)){for(var L=[C],y=C;y.parentNode&&!D91(y,"body");)L.push(y.parentNode),y=y.parentNode;var z=[],S,B=!1;if(d4.each(L,function(j){var Y=eI4(j,e,r,a);!f.href&&j.tagName.toLowerCase()==="a"&&(S=j.getAttribute("href"),S=Y&&Qo0(S)&&S),XF4(j,e,n,o)&&(B=!0),z.push(i_5(j,e,f,u,r,a))},this),!B){var R=Hh.documentElement;if(v={$event_type:e.type,$host:n7.location.host,$pathname:n7.location.pathname,$elements:z,$el_attr__href:S,$viewportHeight:Math.max(R.clientHeight,n7.innerHeight||0),$viewportWidth:Math.max(R.clientWidth,n7.innerWidth||0),$pageHeight:Hh.body.offsetHeight||0,$pageWidth:Hh.body.offsetWidth||0},d4.each(u,function(j){if(!f[j]&&C.hasAttribute(j)){var Y=C.getAttribute(j);Qo0(Y)&&(v["$el_attr__"+j]=Y)}}),h&&(F=n_5(C,e,r,a),F&&F.length&&(v.$el_text=F)),e.type===rd1&&(d4.each(zP7,function(j){j in e&&(v["$"+j]=e[j])}),g&&(v.$captured_for_heatmap=!0),C=PP7(e)),h){var F=n_5(C,e,r,a);F&&F.length&&(v.$el_text=F)}if(C){if(!iD4(C,e,r,a)||XF4(C,e,n,o))return null;var N=i_5(C,e,f,u,r,a);v.$target=N,v.$el_classes=N.$classes,d4.extend(v,d4.strip_empty_properties({$el_id:N.$id,$el_tag_name:N.$tag_name}))}}}return v}function n_5(e,t,r,a){var i="";return eI4(e,t,r,a)&&e.childNodes&&e.childNodes.length&&d4.each(e.childNodes,function(n){QR5(n)&&n.textContent&&(i+=d4.trim(n.textContent).split(/(\s+)/).filter(Qo0).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),d4.trim(i)}function PP7(e){for(var t=e.target,r=e.composedPath(),a=0;a<r.length;a++){var i=r[a];if(D91(i,"a")||D91(i,"button")||D91(i,"input")||D91(i,"select")||i.getAttribute&&i.getAttribute("role")==="button"){t=i;break}if(i===t)break}return t}function iD4(e,t,r,a){if(r)try{if(!r(e,t))return!1}catch(o){return Pw.critical("Error while checking element in allowElementCallback",o),!1}if(!a.length)return!0;for(var i=0;i<a.length;i++){var n=a[i];try{if(e.matches(n))return!0}catch(o){Pw.critical("Error while checking selector: "+n,o)}}return!1}function XF4(e,t,r,a){var i;if(r)try{if(r(e,t))return!0}catch(h){return Pw.critical("Error while checking element in blockElementCallback",h),!0}if(a&&a.length)for(i=0;i<a.length;i++){var n=a[i];try{if(e.matches(n))return!0}catch(h){Pw.critical("Error while checking selector: "+n,h)}}var o=aD4(e);for(i=0;i<rD4.length;i++)if(o[rD4[i]])return!0;return!1}function JR5(e){return e&&e.nodeType===1}function D91(e,t){return e&&e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function QR5(e){return e&&e.nodeType===3}function _P7(){try{var e=Hh.createElement("div");return!!e.matches}catch{return!1}}function EP7(){return typeof WeakSet<"u"}function RP7(e,t){if(!e||D91(e,"html")||!JR5(e))return!1;var r=e.tagName.toLowerCase();switch(r){case"form":return t.type===Jo0;case"input":return["button","submit"].indexOf(e.getAttribute("type"))===-1?t.type===ax2:t.type===rd1;case"select":case"textarea":return t.type===ax2;default:return t.type===rd1}}function tZ5(e){var t=(e.name||e.id||"").toString().toLowerCase();if(typeof t=="string"){var r=/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i;if(r.test(t.replace(/[^a-zA-Z0-9]/g,"")))return!0}return!1}function eI4(e,t,r,a){var i;if(!iD4(e,t,r,a))return!1;for(var n=e;n.parentNode&&!D91(n,"body");n=n.parentNode){var o=aD4(n);for(i=0;i<r_5.length;i++)if(o[r_5[i]])return!1}var h=aD4(e);for(i=0;i<e_5.length;i++)if(h[e_5[i]])return!0;if(D91(e,"input")||D91(e,"select")||D91(e,"textarea")||e.getAttribute("contenteditable")==="true")return!1;var u=e.type||"";if(typeof u=="string")switch(u.toLowerCase()){case"hidden":return!1;case"password":return!1}return!tZ5(e)}function Qo0(e){if(e===null||d4.isUndefined(e))return!1;if(typeof e=="string"){e=d4.trim(e);var t=/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/;if(t.test((e||"").replace(/[- ]/g,"")))return!1;var r=/(^\d{3}-?\d{2}-?\d{4}$)/;if(r.test(e))return!1}return!0}function eZ5(e){var t="onscrollend"in n7,r=ex2(e),a=Hl0;if(!t){var i=null,n=100;r=ex2(function(){clearTimeout(i),i=setTimeout(e,n)}),a=tI4}return{listener:r,eventType:a}}function ZP7(e){for(var t=0;t<a_5.length;t++)if(e.hasAttribute(a_5[t]))return!0;return!1}function FP7(e){var t=e.getAttribute("role");if(!t)return!1;var r=t.trim().split(/\s+/)[0].toLowerCase();return SP7[r]}function JF4(e){var t=e.tagName.toLowerCase();return!!(t==="button"||t==="input"||t==="select"||t==="textarea"||t==="details"||t==="dialog"||e.isContentEditable||e.onclick||e.onmousedown||e.onmouseup||e.ontouchstart||e.ontouchend||ZP7(e)||FP7(e)||t==="a"&&e.hasAttribute("href")||e.hasAttribute("tabindex"))}function rZ5(e){if(!e||!e.tagName)return!0;var t=e.tagName.toLowerCase();if(HP7[t])return!0;if(JF4(e))return!1;for(var r=e.parentElement,a=0;r&&a<TP7;){if(JF4(r))return!1;if(r.getRootNode&&r.getRootNode()!==Hh){var i=r.getRootNode();if(i.host&&JF4(i.host))return!1}r=r.parentElement,a++}return!!kP7[t]}function aZ5(e){return"composedPath"in e?e.composedPath():[]}function iZ5(e){var t=aZ5(e);return t&&t.length>0?t[0]:e.target||e.srcElement}var nZ5=".mp-mask, .fs-mask, .amp-mask, .rr-mask, .ph-mask",OP7="data-rr-is-password",DP7=["password","email","tel","hidden"];function xo0(e){return e?Array.isArray(e)?e:[e]:[]}function IP7(e){var t={input:{maskingSelector:"",unmaskingSelector:"",maskAll:!0},text:{maskingSelector:"",unmaskingSelector:"",maskAll:!0}},r=e.get_config("record_mask_input_selector"),a=e.get_config("record_unmask_input_selector"),i=e.get_config("record_mask_all_inputs");t.input.maskingSelector=xo0(r).join(","),t.input.unmaskingSelector=xo0(a).join(","),i!==void 0&&(t.input.maskAll=i);var n=e.get_config("record_mask_text_selector"),o=e.get_config("record_unmask_text_selector"),h=e.get_config("record_mask_all_text"),u=e.get_config("record_mask_text_class"),g=xo0(n);if(u)if(u instanceof RegExp)t.text._legacyClassRegex=u;else{var f="."+u;g.indexOf(f)===-1&&g.push(f)}return t.text.maskingSelector=g.join(","),t.text.unmaskingSelector=xo0(o).join(","),h===void 0&&n!==void 0?t.text.maskAll=!1:h!==void 0&&(t.text.maskAll=h),t}function t12(e,t){return t?!!e.closest(t):!1}function NP7(e,t){var r=(e.getAttribute("type")||"").toLowerCase();if(DP7.indexOf(r)!==-1)return!0;var a=(e.getAttribute("autocomplete")||"").toLowerCase();return a&&a!==""&&a!=="off"||e.hasAttribute(OP7)||tZ5(e)?!0:t.input.maskAll?!t12(e,t.input.unmaskingSelector):!!(t12(e,t.input.maskingSelector)||t12(e,nZ5))}function UP7(e,t){return e?t.text._legacyClassRegex&&EO4(e,t.text._legacyClassRegex)?!0:t.text.maskAll?!t12(e,t.text.unmaskingSelector):!!(t12(e,t.text.maskingSelector)||t12(e,nZ5)):!1}var e12=J_1("recorder"),GP7=n7.CompressionStream,jP7={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},WP7=new Set([Sh.MouseMove,Sh.MouseInteraction,Sh.Scroll,Sh.ViewportResize,Sh.Input,Sh.TouchMove,Sh.MediaInteraction,Sh.Drag,Sh.Selection]);function qP7(e){return e.type===sf.IncrementalSnapshot&&WP7.has(e.data.source)}var qT=function(e){this._mixpanel=e.mixpanelInstance,this._onIdleTimeout=e.onIdleTimeout||zL1,this._onMaxLengthReached=e.onMaxLengthReached||zL1,this._onBatchSent=e.onBatchSent||zL1,this._rrwebRecord=e.rrwebRecord||null,this._stopRecording=null,this.replayId=e.replayId,this.batchStartUrl=e.batchStartUrl||null,this.replayStartUrl=e.replayStartUrl||null,this.idleExpires=e.idleExpires||null,this.maxExpires=e.maxExpires||null,this.replayStartTime=e.replayStartTime||null,this.lastEventTimestamp=e.lastEventTimestamp||null,this.seqNo=e.seqNo||0,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=RM2,this.recordMinMs=0;var t=rx2(e.sharedLockStorage,!0)&&!this.getConfig("disable_persistence");this.batcherKey="__mprec_"+this.getConfig("name")+"_"+this.getConfig("token")+"_"+this.replayId,this.queueStorage=new o61(WR5),this.batcher=new s21(this.batcherKey,{errorReporter:this.reportError.bind(this),flushOnlyOnInterval:!0,libConfig:jP7,sendRequestFunc:this.flushEventsWithOptOut.bind(this),queueStorage:this.queueStorage,sharedLockStorage:e.sharedLockStorage,usePersistence:t,stopAllBatchingFunc:this.stopRecording.bind(this),enqueueThrottleMs:LP7,sharedLockTimeoutMS:10*1e3})};qT.prototype.getUserIdInfo=function(){if(this.finalFlushUserIdInfo)return this.finalFlushUserIdInfo;var e={distinct_id:String(this._mixpanel.get_distinct_id())},t=this._mixpanel.get_property("$device_id");t&&(e.$device_id=t);var r=this._mixpanel.get_property("$user_id");return r&&(e.$user_id=r),e};qT.prototype.unloadPersistedData=function(){return this.batcher.stop(),this.queueStorage.init().catch(function(){this.reportError("Error initializing IndexedDB storage for unloading persisted data.")}.bind(this)).then(function(){return this.getDurationMs()<this._getRecordMinMs()?this.queueStorage.removeItem(this.batcherKey):this.batcher.flush().then(function(){return this.queueStorage.removeItem(this.batcherKey)}.bind(this))}.bind(this))};qT.prototype.getConfig=function(e){return this._mixpanel.get_config(e)};qT.prototype.get_config=function(e){return this.getConfig(e)};qT.prototype.startRecording=function(e){if(this._rrwebRecord===null){this.reportError("rrweb record function not provided. ");return}if(this._stopRecording!==null){e12.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>RM2&&(this.recordMaxMs=RM2,e12.critical("record_max_ms cannot be greater than "+RM2+"ms. Capping value.")),this.maxExpires||(this.maxExpires=new Date().getTime()+this.recordMaxMs),this.recordMinMs=this._getRecordMinMs(),this.replayStartTime||(this.replayStartTime=new Date().getTime(),this.batchStartUrl=d4.info.currentUrl(),this.replayStartUrl=d4.info.currentUrl()),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=function(){clearTimeout(this.idleTimeoutId);var n=this.getConfig("record_idle_timeout_ms");this.idleTimeoutId=setTimeout(this._onIdleTimeout,n),this.idleExpires=new Date().getTime()+n}.bind(this);t();var r=this.getConfig("record_block_selector");(r===""||r===null)&&(r=void 0);var a=IP7(this._mixpanel);try{this._stopRecording=this._rrwebRecord({emit:function(n){if(this.idleExpires&&this.idleExpires<n.timestamp){this._onIdleTimeout();return}qP7(n)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),t()),this.__enqueuePromise=this.batcher.enqueue(n),(this.lastEventTimestamp===null||n.timestamp>this.lastEventTimestamp)&&(this.lastEventTimestamp=n.timestamp)}.bind(this),blockClass:this.getConfig("record_block_class"),blockSelector:r,collectFonts:this.getConfig("record_collect_fonts"),dataURLOptions:{type:"image/webp",quality:.6},maskAllInputs:!0,maskTextSelector:"*",maskInputFn:this._getMaskFn(NP7,a),maskTextFn:this._getMaskFn(UP7,a),recordCanvas:this.getConfig("record_canvas"),sampling:{canvas:15},plugins:this.getConfig("record_console")?[KV7({stringifyOptions:{stringLengthLimit:1e3,numOfKeysLimit:50,depthOfLimit:2}})]:[]})}catch(n){this.reportError("Unexpected error when starting rrweb recording.",n)}if(typeof this._stopRecording!="function"){this.reportError("rrweb failed to start, skipping this recording."),this._stopRecording=null,this.stopRecording();return}var i=this.maxExpires-new Date().getTime();this.maxTimeoutId=setTimeout(this._onMaxLengthReached.bind(this),i)};qT.prototype.stopRecording=function(e){if(this.finalFlushUserIdInfo=this.getUserIdInfo(),!this.isRrwebStopped()){try{this._stopRecording()}catch(r){this.reportError("Error with rrweb stopRecording",r)}this._stopRecording=null}var t;return this.batcher.stopped?t=this.batcher.clear():e||(t=this.batcher.flush()),this.batcher.stop(),clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId),t};qT.prototype.isRrwebStopped=function(){return this._stopRecording===null};qT.prototype.flushEventsWithOptOut=function(e,t,r){var a=function(i){i===0&&(this.stopRecording(),r({error:"Tracking has been opted out, stopping recording."}))}.bind(this);this._flushEvents(e,t,r,a)};qT.prototype.serialize=function(){var e;try{e=this._mixpanel.get_tab_id()}catch(t){this.reportError("Error getting tab ID for serialization ",t),e=null}return{replayId:this.replayId,seqNo:this.seqNo,replayStartTime:this.replayStartTime,batchStartUrl:this.batchStartUrl,replayStartUrl:this.replayStartUrl,lastEventTimestamp:this.lastEventTimestamp,idleExpires:this.idleExpires,maxExpires:this.maxExpires,tabId:e}};qT.deserialize=function(e,t){var r=new qT(d4.extend({},t,{replayId:e.replayId,batchStartUrl:e.batchStartUrl,replayStartUrl:e.replayStartUrl,idleExpires:e.idleExpires,maxExpires:e.maxExpires,replayStartTime:e.replayStartTime,lastEventTimestamp:e.lastEventTimestamp,seqNo:e.seqNo,sharedLockStorage:t.sharedLockStorage}));return r};qT.prototype._sendRequest=function(e,t,r,a){var i=function(o,h){o.status===200&&this.replayId===e&&(this.seqNo++,this.batchStartUrl=d4.info.currentUrl()),this._onBatchSent(),a({status:0,httpStatusCode:o.status,responseBody:h,retryAfter:o.headers.get("Retry-After")})}.bind(this),n=this._mixpanel.get_api_host&&this._mixpanel.get_api_host("record")||this.getConfig("api_host");n7.fetch(n+"/"+this.getConfig("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getConfig("token")+":"),"Content-Type":"application/octet-stream"},body:r}).then(function(o){o.json().then(function(h){i(o,h)}).catch(function(h){a({error:h})})}).catch(function(o){a({error:o,httpStatusCode:0})})};qT.prototype._flushEvents=RL1(function(e,t,r){var a=e.length;if(a>0){for(var i=this.replayId,n=1/0,o=-1/0,h=!1,u=0;u<a;u++)n=Math.min(n,e[u].timestamp),o=Math.max(o,e[u].timestamp),e[u].type===sf.FullSnapshot&&(h=!0);if(this.seqNo===0){if(!h){r({error:"First batch does not contain a full snapshot. Aborting recording."}),this.stopRecording(!0);return}this.replayStartTime=n}else this.replayStartTime||(this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=n);var g=o-this.replayStartTime,f={$current_url:this.batchStartUrl,$lib_version:LW.LIB_VERSION,batch_start_time:n/1e3,mp_lib:"web",replay_id:i,replay_length_ms:g,replay_start_time:this.replayStartTime/1e3,replay_start_url:this.replayStartUrl,seq:this.seqNo},v=JSON.stringify(e);if(Object.assign(f,this.getUserIdInfo()),sP7(F91,Xh1.vendor,BM2)){var C=new Blob([v],{type:"application/json"}).stream(),L=C.pipeThrough(new GP7("gzip"));new Response(L).blob().then(function(y){f.format="gzip",this._sendRequest(i,f,y,r)}.bind(this))}else f.format="body",this._sendRequest(i,f,v,r)}});qT.prototype.reportError=function(e,t){e12.error.apply(e12.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.getConfig("error_reporter")(e,t)}catch(r){e12.error(r)}};qT.prototype.getDurationMs=function(){return this.replayStartTime===null?0:this.lastEventTimestamp===null?new Date().getTime()-this.replayStartTime:this.lastEventTimestamp-this.replayStartTime};qT.prototype._getRecordMinMs=function(){var e=this.getConfig("record_min_ms");return e>WF4?(e12.critical("record_min_ms cannot be greater than "+WF4+"ms. Capping value."),WF4):e};qT.prototype._getMaskFn=function(e,t){return function(r,a){if(!r.trim().length)return"";var i=!0;try{i=e(a,t)}catch(o){this.reportError("Error checking if text should be masked, defaulting to masked",o)}if(i){var n=Math.min(r.length,1e4);return"*".repeat(n)}else return r}.bind(this)};var ad1=function(e){this.idb=new o61(KD4),this.errorReporter=e.errorReporter,this.mixpanelInstance=e.mixpanelInstance,this.sharedLockStorage=e.sharedLockStorage};ad1.prototype.isPersistenceEnabled=function(){return!this.mixpanelInstance.get_config("disable_persistence")};ad1.prototype.handleError=function(e){this.errorReporter("IndexedDB error: ",e)};ad1.prototype.setActiveRecording=function(e){if(!this.isPersistenceEnabled())return hf.resolve();var t=e.tabId;return t?this.idb.init().then(function(){return this.idb.setItem(t,e)}.bind(this)).catch(this.handleError.bind(this)):(console.warn("No tab ID is set, cannot persist recording metadata."),hf.resolve())};ad1.prototype.getActiveRecording=function(){return this.isPersistenceEnabled()?this.idb.init().then(function(){return this.idb.getItem(this.mixpanelInstance.get_tab_id())}.bind(this)).then(function(e){return QD4(e)?null:e}.bind(this)).catch(this.handleError.bind(this)):hf.resolve(null)};ad1.prototype.clearActiveRecording=function(){return this.isPersistenceEnabled()?this.markActiveRecordingExpired():this.deleteActiveRecording()};ad1.prototype.markActiveRecordingExpired=function(){return this.getActiveRecording().then(function(e){if(e)return e.maxExpires=0,this.setActiveRecording(e)}.bind(this)).catch(this.handleError.bind(this))};ad1.prototype.deleteActiveRecording=function(){return this.idb.isInitialized()?this.idb.removeItem(this.mixpanelInstance.get_tab_id()).catch(this.handleError.bind(this)):hf.resolve()};ad1.prototype.flushInactiveRecordings=function(){return this.isPersistenceEnabled()?this.idb.init().then(function(){return this.idb.getAll()}.bind(this)).then(function(e){var t=e.filter(function(r){return QD4(r)}).map(function(r){var a=qT.deserialize(r,{mixpanelInstance:this.mixpanelInstance,sharedLockStorage:this.sharedLockStorage});return a.unloadPersistedData().then(function(){return this.idb.removeItem(r.tabId)}.bind(this)).catch(this.handleError.bind(this))}.bind(this));return hf.all(t)}.bind(this)).catch(this.handleError.bind(this)):hf.resolve([])};var FM2=J_1("recorder"),id1=function(e,t,r){this.mixpanelInstance=e,this.rrwebRecord=t||VL1,this.sharedLockStorage=r,this.recordingRegistry=new ad1({mixpanelInstance:this.mixpanelInstance,errorReporter:FM2.error,sharedLockStorage:r}),this._flushInactivePromise=this.recordingRegistry.flushInactiveRecordings(),this.activeRecording=null,this.stopRecordingInProgress=!1};id1.prototype.startRecording=function(e){if(e=e||{},this.activeRecording&&!this.activeRecording.isRrwebStopped()){FM2.log("Recording already in progress, skipping startRecording.");return}var t=function(){FM2.log("Idle timeout reached, restarting recording."),this.resetRecording()}.bind(this),r=function(){FM2.log("Max recording length reached, stopping recording."),this.resetRecording()}.bind(this),a=function(){this.recordingRegistry.setActiveRecording(this.activeRecording.serialize()),this.__flushPromise=this.activeRecording.batcher._flushPromise}.bind(this),i={mixpanelInstance:this.mixpanelInstance,onBatchSent:a,onIdleTimeout:t,onMaxLengthReached:r,replayId:d4.UUID(),rrwebRecord:this.rrwebRecord,sharedLockStorage:this.sharedLockStorage};return e.activeSerializedRecording?this.activeRecording=qT.deserialize(e.activeSerializedRecording,i):this.activeRecording=new qT(i),this.activeRecording.startRecording(e.shouldStopBatcher),this.recordingRegistry.setActiveRecording(this.activeRecording.serialize())};id1.prototype.stopRecording=function(){return this.stopRecordingInProgress=!0,this._stopCurrentRecording(!1,!0).then(function(){return this.recordingRegistry.clearActiveRecording()}.bind(this)).then(function(){this.stopRecordingInProgress=!1}.bind(this))};id1.prototype.pauseRecording=function(){return this._stopCurrentRecording(!1)};id1.prototype._stopCurrentRecording=function(e,t){if(this.activeRecording){var r=this.activeRecording.stopRecording(e);return t&&(this.activeRecording=null),r}return hf.resolve()};id1.prototype.resumeRecording=function(e){return this.activeRecording&&this.activeRecording.isRrwebStopped()?(this.activeRecording.startRecording(!1),hf.resolve(null)):this.recordingRegistry.getActiveRecording().then(function(t){return t&&!this.stopRecordingInProgress?this.startRecording({activeSerializedRecording:t}):e?this.startRecording({shouldStopBatcher:!1}):(FM2.log("No resumable recording found."),null)}.bind(this))};id1.prototype.resetRecording=function(){this.stopRecording(),this.startRecording({shouldStopBatcher:!0})};id1.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null};Object.defineProperty(id1.prototype,"replayId",{get:function(){return this.getActiveReplayId()}});n7[QF4]=id1;function $P7(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var To0={exports:{}},KP7=To0.exports,o_5;function YP7(){return o_5||(o_5=1,(function(e,t){(function(r,a){e.exports=a()})(KP7,function(){Array.isArray||(Array.isArray=function(n){return Object.prototype.toString.call(n)==="[object Array]"});function r(n){for(var o=[],h=0,u=n.length;h<u;h++)o.indexOf(n[h])===-1&&o.push(n[h]);return o}var a={},i={"==":function(n,o){return n==o},"===":function(n,o){return n===o},"!=":function(n,o){return n!=o},"!==":function(n,o){return n!==o},">":function(n,o){return n>o},">=":function(n,o){return n>=o},"<":function(n,o,h){return h===void 0?n<o:n<o&&o<h},"<=":function(n,o,h){return h===void 0?n<=o:n<=o&&o<=h},"!!":function(n){return a.truthy(n)},"!":function(n){return!a.truthy(n)},"%":function(n,o){return n%o},log:function(n){return console.log(n),n},in:function(n,o){return!o||typeof o.indexOf>"u"?!1:o.indexOf(n)!==-1},cat:function(){return Array.prototype.join.call(arguments,"")},substr:function(n,o,h){if(h<0){var u=String(n).substr(o);return u.substr(0,u.length+h)}return String(n).substr(o,h)},"+":function(){return Array.prototype.reduce.call(arguments,function(n,o){return parseFloat(n,10)+parseFloat(o,10)},0)},"*":function(){return Array.prototype.reduce.call(arguments,function(n,o){return parseFloat(n,10)*parseFloat(o,10)})},"-":function(n,o){return o===void 0?-n:n-o},"/":function(n,o){return n/o},min:function(){return Math.min.apply(this,arguments)},max:function(){return Math.max.apply(this,arguments)},merge:function(){return Array.prototype.reduce.call(arguments,function(n,o){return n.concat(o)},[])},var:function(n,o){var h=o===void 0?null:o,u=this;if(typeof n>"u"||n===""||n===null)return u;for(var g=String(n).split("."),f=0;f<g.length;f++)if(u==null||(u=u[g[f]],u===void 0))return h;return u},missing:function(){for(var n=[],o=Array.isArray(arguments[0])?arguments[0]:arguments,h=0;h<o.length;h++){var u=o[h],g=a.apply({var:u},this);(g===null||g==="")&&n.push(u)}return n},missing_some:function(n,o){var h=a.apply({missing:o},this);return o.length-h.length>=n?[]:h}};return a.is_logic=function(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&Object.keys(n).length===1},a.truthy=function(n){return Array.isArray(n)&&n.length===0?!1:!!n},a.get_operator=function(n){return Object.keys(n)[0]},a.get_values=function(n){return n[a.get_operator(n)]},a.apply=function(n,o){if(Array.isArray(n))return n.map(function(S){return a.apply(S,o)});if(!a.is_logic(n))return n;var h=a.get_operator(n),u=n[h],g,f,v,C,L;if(Array.isArray(u)||(u=[u]),h==="if"||h=="?:"){for(g=0;g<u.length-1;g+=2)if(a.truthy(a.apply(u[g],o)))return a.apply(u[g+1],o);return u.length===g+1?a.apply(u[g],o):null}else if(h==="and"){for(g=0;g<u.length;g+=1)if(f=a.apply(u[g],o),!a.truthy(f))return f;return f}else if(h==="or"){for(g=0;g<u.length;g+=1)if(f=a.apply(u[g],o),a.truthy(f))return f;return f}else{if(h==="filter")return C=a.apply(u[0],o),v=u[1],Array.isArray(C)?C.filter(function(S){return a.truthy(a.apply(v,S))}):[];if(h==="map")return C=a.apply(u[0],o),v=u[1],Array.isArray(C)?C.map(function(S){return a.apply(v,S)}):[];if(h==="reduce")return C=a.apply(u[0],o),v=u[1],L=typeof u[2]<"u"?a.apply(u[2],o):null,Array.isArray(C)?C.reduce(function(S,B){return a.apply(v,{current:B,accumulator:S})},L):L;if(h==="all"){if(C=a.apply(u[0],o),v=u[1],!Array.isArray(C)||!C.length)return!1;for(g=0;g<C.length;g+=1)if(!a.truthy(a.apply(v,C[g])))return!1;return!0}else if(h==="none"){if(C=a.apply(u[0],o),v=u[1],!Array.isArray(C)||!C.length)return!0;for(g=0;g<C.length;g+=1)if(a.truthy(a.apply(v,C[g])))return!1;return!0}else if(h==="some"){if(C=a.apply(u[0],o),v=u[1],!Array.isArray(C)||!C.length)return!1;for(g=0;g<C.length;g+=1)if(a.truthy(a.apply(v,C[g])))return!0;return!1}}if(u=u.map(function(S){return a.apply(S,o)}),i.hasOwnProperty(h)&&typeof i[h]=="function")return i[h].apply(o,u);if(h.indexOf(".")>0){var y=String(h).split("."),z=i;for(g=0;g<y.length;g++){if(!z.hasOwnProperty(y[g]))throw new Error("Unrecognized operation "+h+" (failed at "+y.slice(0,g+1).join(".")+")");z=z[y[g]]}return z.apply(o,u)}throw new Error("Unrecognized operation "+h)},a.uses_data=function(n){var o=[];if(a.is_logic(n)){var h=a.get_operator(n),u=n[h];Array.isArray(u)||(u=[u]),h==="var"?o.push(u[0]):u.forEach(function(g){o.push.apply(o,a.uses_data(g))})}return r(o)},a.add_operation=function(n,o){i[n]=o},a.rm_operation=function(n){delete i[n]},a.rule_like=function(n,o){if(o===n||o==="@")return!0;if(o==="number")return typeof n=="number";if(o==="string")return typeof n=="string";if(o==="array")return Array.isArray(n)&&!a.is_logic(n);if(a.is_logic(o)){if(a.is_logic(n)){var h=a.get_operator(o),u=a.get_operator(n);if(h==="@"||h===u)return a.rule_like(a.get_values(n,!1),a.get_values(o,!1))}return!1}if(Array.isArray(o))if(Array.isArray(n)){if(o.length!==n.length)return!1;for(var g=0;g<o.length;g+=1)if(!a.rule_like(n[g],o[g]))return!1;return!0}else return!1;return!1},a})})(To0)),To0.exports}var XP7=YP7(),JP7=$P7(XP7),tl0=function(e,t){if(e==null)return e;if(typeof e=="string")return e.toLowerCase();if(Array.isArray(e))return e.map(function(n){return tl0(n,t)});if(e===Object(e)){var r={};for(var a in e)if(e.hasOwnProperty(a)){var i=t&&typeof a=="string"?a.toLowerCase():a;r[i]=tl0(e[a],t)}return r}else return e},QP7=function(e){return tl0(e,!0)},t_7=function(e){return tl0(e,!1)},e_7=function(e,t,r){if(e!==r.event_name)return{matches:!1};var a=r.property_filters,i=!0;if(a&&!d4.isEmptyObject(a))try{var n=QP7(t||{}),o=t_7(a);i=JP7.apply(o,n)}catch(h){return{matches:!1,error:h.toString()}}return{matches:i}},oZ5={};oZ5.eventMatchesCriteria=e_7;n7[i61]=Promise.resolve(oZ5);var r_7=30,a_7=1e3,i_7=4,n_7=!1;function lZ5(){this.clicks=[]}lZ5.prototype.isRageClick=function(e,t){t=t||{};var r=t.threshold_px||r_7,a=t.timeout_ms||a_7,i=t.click_count||i_7,n=t.interactive_elements_only||n_7;if(n){var o=iZ5(e);if(!o||rZ5(o))return!1}var h=Date.now(),u=e.pageX,g=e.pageY,f=this.clicks[this.clicks.length-1];if(f&&h-f.timestamp<a&&Math.sqrt(Math.pow(u-f.x,2)+Math.pow(g-f.y,2))<r){if(this.clicks.push({x:u,y:g,timestamp:h}),this.clicks.length>=i)return this.clicks=[],!0}else this.clicks=[{x:u,y:g,timestamp:h}];return!1};function C12(e,t){this.changeCallback=e||function(){},this.observerConfig=t,this.observedShadowRoots=null,this.shadowObservers=[]}C12.prototype.getEventTarget=function(e){if(this.observedShadowRoots)return iZ5(e)};C12.prototype.observeFromEvent=function(e){if(this.observedShadowRoots)for(var t=aZ5(e),r=0;r<t.length;r++){var a=t[r];a&&a.shadowRoot&&this.observeShadowRoot(a.shadowRoot)}};C12.prototype.observeShadowRoot=function(e){if(!(!this.observedShadowRoots||this.observedShadowRoots.has(e))){var t=this;try{this.observedShadowRoots.add(e);var r=new window.MutationObserver(function(){t.changeCallback()});r.observe(e,this.observerConfig),this.shadowObservers.push(r)}catch(a){Pw.critical("Error while observing shadow root",a)}}};C12.prototype.start=function(){if(!this.observedShadowRoots){if(!EP7()){Pw.critical("Shadow DOM observation unavailable: WeakSet not supported");return}this.observedShadowRoots=new WeakSet}};C12.prototype.stop=function(){if(this.observedShadowRoots){for(var e=0;e<this.shadowObservers.length;e++)try{this.shadowObservers[e].disconnect()}catch(t){Pw.critical("Error while disconnecting shadow DOM observer",t)}this.shadowObservers=[],this.observedShadowRoots=null}};var o_7=500,l_7=[ax2,wP7,Jo0,yP7,AP7],c_7=[Hl0],s_7=[eD4],l_5={characterData:!0,childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class","hidden","checked","selected","value","display","visibility"]};function U91(e){this.eventListeners=[],this.mutationObserver=null,this.shadowDOMObserver=null,this.isTracking=!1,this.lastChangeEventTimestamp=0,this.pendingClicks=[],this.onDeadClickCallback=e,this.processingActive=!1,this.processingTimeout=null}U91.prototype.addClick=function(e){var t=this.shadowDOMObserver&&this.shadowDOMObserver.getEventTarget(e);return t||(t=e.target||e.srcElement),!t||rZ5(t)?!1:(this.shadowDOMObserver&&this.shadowDOMObserver.observeFromEvent(e),this.pendingClicks.push({element:t,event:e,timestamp:Date.now()}),!0)};U91.prototype.trackClick=function(e,t){if(!this.isTracking)return!1;var r=this.addClick(e);return r&&this.triggerProcessing(t),r};U91.prototype.getDeadClicks=function(e){if(this.pendingClicks.length===0)return[];var t=e.timeout_ms,r=Date.now(),a=this.pendingClicks.slice();this.pendingClicks=[];for(var i=[],n=0;n<a.length;n++){var o=a[n];r-o.timestamp>=t?this.hasChangesAfter(o.timestamp)||i.push(o):this.pendingClicks.push(o)}return i};U91.prototype.hasChangesAfter=function(e){return this.lastChangeEventTimestamp>=e-100};U91.prototype.recordChangeEvent=function(){this.lastChangeEventTimestamp=Date.now()};U91.prototype.triggerProcessing=function(e){this.processingActive||(this.processingActive=!0,this.processRecursively(e))};U91.prototype.processRecursively=function(e){if(!this.isTracking||!this.onDeadClickCallback){this.processingActive=!1;return}var t=e.timeout_ms,r=this;this.processingTimeout=setTimeout(function(){if(r.processingActive){for(var a=r.getDeadClicks(e),i=0;i<a.length;i++)r.onDeadClickCallback(a[i].event);r.pendingClicks.length>0?r.processRecursively(e):r.processingActive=!1}},t)};U91.prototype.startTracking=function(){if(!this.isTracking){this.isTracking=!0;var e=this;l_7.forEach(function(r){var a=function(){e.recordChangeEvent()};document.addEventListener(r,a,{capture:!0,passive:!0}),e.eventListeners.push({target:document,event:r,handler:a,options:{capture:!0,passive:!0}})}),s_7.forEach(function(r){var a=function(){e.recordChangeEvent()};window.addEventListener(r,a),e.eventListeners.push({target:window,event:r,handler:a})}),c_7.forEach(function(r){var a=function(){e.recordChangeEvent()};window.addEventListener(r,a,{passive:!0}),e.eventListeners.push({target:window,event:r,handler:a,options:{passive:!0}})});var t=function(){e.recordChangeEvent()};if(document.addEventListener("selectionchange",t),e.eventListeners.push({target:document,event:"selectionchange",handler:t}),window.MutationObserver)try{this.mutationObserver=new window.MutationObserver(function(){e.recordChangeEvent()}),this.mutationObserver.observe(document.body||document.documentElement,l_5)}catch(r){Pw.critical("Error while setting up mutation observer",r)}if(window.customElements)try{this.shadowDOMObserver=new C12(function(){e.recordChangeEvent()},l_5),this.shadowDOMObserver.start()}catch(r){Pw.critical("Error while setting up shadow DOM observer",r),this.shadowDOMObserver=null}}};U91.prototype.stopTracking=function(){if(this.isTracking){this.isTracking=!1,this.pendingClicks=[],this.lastChangeEventTimestamp=0,this.processingActive=!1,this.processingTimeout&&(clearTimeout(this.processingTimeout),this.processingTimeout=null);for(var e=0;e<this.eventListeners.length;e++){var t=this.eventListeners[e];try{t.target.removeEventListener(t.event,t.handler,t.options)}catch(r){Pw.critical("Error while removing event listener",r)}}if(this.eventListeners=[],this.mutationObserver){try{this.mutationObserver.disconnect()}catch(r){Pw.critical("Error while disconnecting mutation observer",r)}this.mutationObserver=null}if(this.shadowDOMObserver){try{this.shadowDOMObserver.stop()}catch(r){Pw.critical("Error while stopping shadow DOM observer",r)}this.shadowDOMObserver=null}}};var cZ5="autocapture",h_7="track_pageview",sZ5="full-url",d_7="url-with-path-and-query-string",u_7="url-with-path",g_7="allow_element_callback",hZ5="allow_selectors",dZ5="allow_url_regexes",uZ5="block_attrs",gZ5="block_element_callback",pZ5="block_selectors",fZ5="block_url_regexes",vZ5="capture_extra_attrs",mZ5="capture_text_content",CZ5="scroll_capture_all",MZ5="scroll_depth_percent_checkpoints",el0="click",rl0="dead_click",nD4="input",xZ5="pageview",al0="rage_click",oD4="scroll",kl0="page_leave",lD4="submit",$T={};$T[hZ5]=[];$T[dZ5]=[];$T[uZ5]=[];$T[gZ5]=null;$T[pZ5]=[];$T[fZ5]=[];$T[vZ5]=[];$T[mZ5]=!1;$T[CZ5]=!1;$T[MZ5]=[25,50,75,100];$T[el0]=!0;$T[rl0]=!0;$T[nD4]=!0;$T[xZ5]=sZ5;$T[al0]=!0;$T[oD4]=!0;$T[kl0]=!1;$T[lD4]=!0;var ix2={$mp_autocapture:!0},LZ5="$mp_click",wZ5="$mp_dead_click",p_7="$mp_input_change",yZ5="$mp_rage_click",f_7="$mp_scroll",v_7="$mp_submit",m_7="$mp_page_leave",Sk=function(e){this.mp=e,this.maxScrollViewDepth=0,this.hasTrackedScrollSession=!1,this.previousScrollHeight=0};Sk.prototype.init=function(){if(!_P7()){Pw.critical("Autocapture unavailable: missing required DOM APIs");return}this.initPageListeners(),this.initPageviewTracking(),this.initClickTracking(),this.initDeadClickTracking(),this.initInputTracking(),this.initScrollTracking(),this.initSubmitTracking(),this.initRageClickTracking(),this.initPageLeaveTracking()};Sk.prototype.getFullConfig=function(){var e=this.mp.get_config(cZ5);return e?d4.isObject(e)?d4.extend({},$T,e):$T:{}};Sk.prototype.getConfig=function(e){return this.getFullConfig()[e]};Sk.prototype.currentUrlBlocked=function(){var e,t=d4.info.currentUrl(),r=this.getConfig(dZ5)||[];if(r.length){var a=!1;for(e=0;e<r.length;e++){var i=r[e];try{if(t.match(i)){a=!0;break}}catch(o){return Pw.critical("Error while checking block URL regex: "+i,o),!0}}if(!a)return!0}var n=this.getConfig(fZ5)||[];if(!n||!n.length)return!1;for(e=0;e<n.length;e++)try{if(t.match(n[e]))return!0}catch(o){return Pw.critical("Error while checking block URL regex: "+n[e],o),!0}return!1};Sk.prototype.pageviewTrackingConfig=function(){return this.mp.get_config(cZ5)?this.getConfig(xZ5):this.mp.get_config(h_7)};Sk.prototype.trackDomEvent=function(e,t){if(!this.currentUrlBlocked()){var r=this.mp.is_recording_heatmap_data()&&(t===LZ5&&!this.getConfig(el0)||t===yZ5&&!this._getClickTrackingConfig(al0)||t===wZ5&&!this._getClickTrackingConfig(rl0)),a=VP7(e,{allowElementCallback:this.getConfig(g_7),allowSelectors:this.getConfig(hZ5),blockAttrs:this.getConfig(uZ5),blockElementCallback:this.getConfig(gZ5),blockSelectors:this.getConfig(pZ5),captureExtraAttrs:this.getConfig(vZ5),captureTextContent:this.getConfig(mZ5),capturedForHeatMap:r});a&&(d4.extend(a,ix2),this.mp.track(t,a))}};Sk.prototype.initPageListeners=function(){if(n7.removeEventListener(QP5,this.listenerPopstate),n7.removeEventListener(eD4,this.listenerHashchange),!(!this.pageviewTrackingConfig()&&!this.getConfig(kl0)&&!this.mp.get_config("record_heatmap_data"))){this.listenerPopstate=function(){n7.dispatchEvent(new Event(AL1))},this.listenerHashchange=function(){n7.dispatchEvent(new Event(AL1))},n7.addEventListener(QP5,this.listenerPopstate),n7.addEventListener(eD4,this.listenerHashchange);var e=n7.history.pushState;typeof e=="function"&&(n7.history.pushState=function(r,a,i){e.call(n7.history,r,a,i),n7.dispatchEvent(new Event(AL1))});var t=n7.history.replaceState;typeof t=="function"&&(n7.history.replaceState=function(r,a,i){t.call(n7.history,r,a,i),n7.dispatchEvent(new Event(AL1))})}};Sk.prototype._getClickTrackingConfig=function(e){var t=this.getConfig(e);return t?t===!0?{}:typeof t=="object"?t:{}:null};Sk.prototype._trackPageLeave=function(e,t,r){if(!this.hasTrackedScrollSession&&!(!this.getConfig(kl0)&&!this.mp.is_recording_heatmap_data())){this.hasTrackedScrollSession=!0;var a=Math.max(Hh.documentElement.clientHeight,n7.innerHeight||0),i=Math.round(Math.max(this.maxScrollViewDepth-a,0)/(r-a)*100),n=Math.round(a/r*100);r<=a&&(i=100,n=100);var o=d4.extend({$max_scroll_view_depth:this.maxScrollViewDepth,$max_scroll_percentage:i,$fold_line_percentage:n,$scroll_height:r,$event_type:e.type,$current_url:t||d4.info.currentUrl(),$viewportHeight:a,$viewportWidth:Math.max(Hh.documentElement.clientWidth,n7.innerWidth||0),$captured_for_heatmap:this.mp.is_recording_heatmap_data()},ix2);this.mp.track(m_7,o,{transport:"sendBeacon"})}};Sk.prototype._initScrollDepthTracking=function(){if(n7.removeEventListener(tI4,this.listenerScrollDepth),n7.removeEventListener(Hl0,this.listenerScrollDepth),!!this.mp.get_config("record_heatmap_data")){Pw.log("Initializing scroll depth tracking"),this.maxScrollViewDepth=Math.max(Hh.documentElement.clientHeight,n7.innerHeight||0);var e=function(){if(!this.currentUrlBlocked()){var r=Math.max(Hh.documentElement.clientHeight,n7.innerHeight||0)+n7.scrollY;r>this.maxScrollViewDepth&&(this.maxScrollViewDepth=r),this.previousScrollHeight=Hh.body.scrollHeight}}.bind(this),t=eZ5(e);this.listenerScrollDepth=t.listener,n7.addEventListener(t.eventType,this.listenerScrollDepth)}};Sk.prototype.initClickTracking=function(){n7.removeEventListener(rd1,this.listenerClick),!(!this.getConfig(el0)&&!this.mp.get_config("record_heatmap_data"))&&(Pw.log("Initializing click tracking"),this.listenerClick=function(e){!this.getConfig(el0)&&!this.mp.is_recording_heatmap_data()||this.trackDomEvent(e,LZ5)}.bind(this),n7.addEventListener(rd1,this.listenerClick))};Sk.prototype.initDeadClickTracking=function(){var e=this._getClickTrackingConfig(rl0);if(!e&&!this.mp.get_config("record_heatmap_data")){this.stopDeadClickTracking();return}Pw.log("Initializing dead click tracking"),this._deadClickTracker||(this._deadClickTracker=new U91(function(t){this.trackDomEvent(t,wZ5)}.bind(this)),this._deadClickTracker.startTracking()),this.listenerDeadClick||(this.listenerDeadClick=function(t){var r=this._getClickTrackingConfig(rl0);if(!(!r&&!this.mp.is_recording_heatmap_data())&&!this.currentUrlBlocked()){var a=r||{};a.timeout_ms||(a.timeout_ms=o_7),this._deadClickTracker.trackClick(t,a)}}.bind(this),n7.addEventListener(rd1,this.listenerDeadClick))};Sk.prototype.initInputTracking=function(){n7.removeEventListener(ax2,this.listenerChange),this.getConfig(nD4)&&(Pw.log("Initializing input tracking"),this.listenerChange=function(e){this.getConfig(nD4)&&this.trackDomEvent(e,p_7)}.bind(this),n7.addEventListener(ax2,this.listenerChange))};Sk.prototype.initPageviewTracking=function(){if(n7.removeEventListener(AL1,this.listenerLocationchange),!!this.pageviewTrackingConfig()){Pw.log("Initializing pageview tracking");var e="",t=!1;this.currentUrlBlocked()||(t=this.mp.track_pageview(ix2)),t&&(e=d4.info.currentUrl()),this.listenerLocationchange=ex2(function(){if(!this.currentUrlBlocked()){var r=d4.info.currentUrl(),a=!1,i=r.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0],n=this.pageviewTrackingConfig();if(n===sZ5?a=r!==e:n===d_7?a=r.split("#")[0]!==e.split("#")[0]:n===u_7&&(a=i),a){var o=this.mp.track_pageview(ix2);o&&(e=r),i&&(this.lastScrollCheckpoint=0,Pw.log("Path change: re-initializing scroll depth checkpoints"))}}}.bind(this)),n7.addEventListener(AL1,this.listenerLocationchange)}};Sk.prototype.initRageClickTracking=function(){n7.removeEventListener(rd1,this.listenerRageClick);var e=this._getClickTrackingConfig(al0);!e&&!this.mp.get_config("record_heatmap_data")||(Pw.log("Initializing rage click tracking"),this._rageClickTracker||(this._rageClickTracker=new lZ5),this.listenerRageClick=function(t){var r=this._getClickTrackingConfig(al0);!r&&!this.mp.is_recording_heatmap_data()||this.currentUrlBlocked()||this._rageClickTracker.isRageClick(t,r)&&this.trackDomEvent(t,yZ5)}.bind(this),n7.addEventListener(rd1,this.listenerRageClick))};Sk.prototype.initScrollTracking=function(){if(n7.removeEventListener(Hl0,this.listenerScroll),n7.removeEventListener(tI4,this.listenerScroll),!!this.getConfig(oD4)){Pw.log("Initializing scroll tracking"),this.lastScrollCheckpoint=0;var e=function(){if(this.getConfig(oD4)&&!this.currentUrlBlocked()){var r=this.getConfig(CZ5),a=(this.getConfig(MZ5)||[]).slice().sort(function(f,v){return f-v}),i=n7.scrollY,n=d4.extend({$scroll_top:i},ix2);try{var o=Hh.body.scrollHeight,h=Math.round(i/(o-n7.innerHeight)*100);if(n.$scroll_height=o,n.$scroll_percentage=h,h>this.lastScrollCheckpoint)for(var u=0;u<a.length;u++){var g=a[u];h>=g&&this.lastScrollCheckpoint<g&&(n.$scroll_checkpoint=g,this.lastScrollCheckpoint=g,r=!0)}}catch(f){Pw.critical("Error while calculating scroll percentage",f)}r&&this.mp.track(f_7,n)}}.bind(this),t=eZ5(e);this.listenerScroll=t.listener,n7.addEventListener(t.eventType,this.listenerScroll)}};Sk.prototype.initSubmitTracking=function(){n7.removeEventListener(Jo0,this.listenerSubmit),this.getConfig(lD4)&&(Pw.log("Initializing submit tracking"),this.listenerSubmit=function(e){this.getConfig(lD4)&&this.trackDomEvent(e,v_7)}.bind(this),n7.addEventListener(Jo0,this.listenerSubmit))};Sk.prototype.initPageLeaveTracking=function(){if(Hh.removeEventListener(t_5,this.listenerPageLeaveVisibilitychange),n7.removeEventListener(AL1,this.listenerPageLeaveLocationchange),n7.removeEventListener(JP5,this.listenerPageLoad),!(!this.getConfig(kl0)&&!this.mp.get_config("record_heatmap_data"))){Pw.log("Initializing page visibility tracking."),this._initScrollDepthTracking();var e=d4.info.currentUrl();this.listenerPageLoad=function(){this.previousScrollHeight=Hh.body.scrollHeight}.bind(this),n7.addEventListener(JP5,this.listenerPageLoad),this.listenerPageLeaveLocationchange=ex2(function(t){if(!this.currentUrlBlocked()){var r=d4.info.currentUrl(),a=r!==e;a&&(this._trackPageLeave(t,e,this.previousScrollHeight),e=r,this.maxScrollViewDepth=Math.max(Hh.documentElement.clientHeight,n7.innerHeight||0),this.previousScrollHeight=Hh.body.scrollHeight,this.hasTrackedScrollSession=!1)}}.bind(this)),n7.addEventListener(AL1,this.listenerPageLeaveLocationchange),this.listenerPageLeaveVisibilitychange=function(t){Hh.hidden&&this._trackPageLeave(t,e,this.previousScrollHeight)}.bind(this),Hh.addEventListener(t_5,this.listenerPageLeaveVisibilitychange)}};Sk.prototype.stopDeadClickTracking=function(){this.listenerDeadClick&&(n7.removeEventListener(rd1,this.listenerDeadClick),this.listenerDeadClick=null),this._deadClickTracker&&(this._deadClickTracker.stopTracking(),this._deadClickTracker=null)};DR5(Sk);var C_7=function(e,t){return n7[i61]&&typeof n7[i61].then=="function"||(n7[i61]=new Promise(function(r){e(t,r)}).then(function(){var r=n7[i61];if(r&&typeof r.then=="function")return r;throw new Error("targeting failed to load")}).catch(function(r){throw delete n7[i61],r})),n7[i61]},qS=J_1("flags"),il0="flags",nl0="context",cD4={};cD4[nl0]={};var M_7=function(e,t){return e+":"+t},x_7=function(e){return e.split(":")[0]},ch=function(e){this.fetch=n7.fetch,this.getFullApiRoute=e.getFullApiRoute,this.getMpConfig=e.getConfigFunc,this.setMpConfig=e.setConfigFunc,this.getMpProperty=e.getPropertyFunc,this.track=e.trackingFunc,this.loadExtraBundle=e.loadExtraBundle||function(){},this.targetingSrc=e.targetingSrc||""};ch.prototype.init=function(){if(!this.minApisSupported()){qS.critical("Feature Flags unavailable: missing minimum required APIs");return}this.flags=null,this.fetchFlags(),this.trackedFeatures=new Set,this.pendingFirstTimeEvents={},this.activatedFirstTimeEvents={}};ch.prototype.getFullConfig=function(){var e=this.getMpConfig(il0);return e?d4.isObject(e)?d4.extend({},cD4,e):cD4:{}};ch.prototype.getConfig=function(e){return this.getFullConfig()[e]};ch.prototype.isSystemEnabled=function(){return!!this.getMpConfig(il0)};ch.prototype.updateContext=function(e,t){if(!this.isSystemEnabled())return qS.critical("Feature Flags not enabled, cannot update context"),Promise.resolve();var r=this.getMpConfig(il0);d4.isObject(r)||(r={});var a=t&&t.replace?{}:this.getConfig(nl0);return r[nl0]=d4.extend({},a,e),this.setMpConfig(il0,r),this.fetchFlags()};ch.prototype.areFlagsReady=function(){return this.isSystemEnabled()||qS.error("Feature Flags not enabled"),!!this.flags};ch.prototype.fetchFlags=function(){if(!this.isSystemEnabled())return Promise.resolve();var e=this.getMpProperty("distinct_id"),t=this.getMpProperty("$device_id"),r=jR5();qS.log("Fetching flags for distinct ID: "+e);var a=d4.extend({distinct_id:e,device_id:t},this.getConfig(nl0)),i=new URLSearchParams;i.set("context",JSON.stringify(a)),i.set("token",this.getMpConfig("token")),i.set("mp_lib","web"),i.set("$lib_version",LW.LIB_VERSION);var n=this.getFullApiRoute()+"?"+i.toString();return this._fetchInProgressStartTime=Date.now(),this.fetchPromise=this.fetch.call(n7,n,{method:"GET",headers:{Authorization:"Basic "+btoa(this.getMpConfig("token")+":"),traceparent:r}}).then(function(o){return this.markFetchComplete(),o.json().then(function(h){var u=h.flags;if(!u)throw new Error("No flags in API response");var g=new Map,f={};d4.each(u,function(C,L){var y=!1,z=L+":";if(d4.each(this.activatedFirstTimeEvents,function(B,R){R.startsWith(z)&&(y=!0)}),y){var S=this.flags&&this.flags.get(L);S&&g.set(L,S)}else g.set(L,{key:C.variant_key,value:C.variant_value,experiment_id:C.experiment_id,is_experiment_active:C.is_experiment_active,is_qa_tester:C.is_qa_tester})},this);var v=h.pending_first_time_events;v&&v.length>0&&d4.each(v,function(C){var L=C.flag_key,y=M_7(L,C.first_time_event_hash);this.activatedFirstTimeEvents[y]||(f[y]={flag_key:L,flag_id:C.flag_id,project_id:C.project_id,first_time_event_hash:C.first_time_event_hash,event_name:C.event_name,property_filters:C.property_filters,pending_variant:C.pending_variant})},this),this.activatedFirstTimeEvents&&d4.each(this.activatedFirstTimeEvents,function(C,L){var y=x_7(L);C&&!g.has(y)&&this.flags&&this.flags.has(y)&&g.set(y,this.flags.get(y))},this),this.flags=g,this.pendingFirstTimeEvents=f,this._traceparent=r,this._loadTargetingIfNeeded()}.bind(this)).catch(function(h){this.markFetchComplete(),qS.error(h)}.bind(this))}.bind(this)).catch(function(o){this.markFetchComplete(),qS.error(o)}.bind(this)),this.fetchPromise};ch.prototype.markFetchComplete=function(){if(!this._fetchInProgressStartTime){qS.error("Fetch in progress started time not set, cannot mark fetch complete");return}this._fetchStartTime=this._fetchInProgressStartTime,this._fetchCompleteTime=Date.now(),this._fetchLatency=this._fetchCompleteTime-this._fetchStartTime,this._fetchInProgressStartTime=null};ch.prototype._loadTargetingIfNeeded=function(){var e=!1;d4.each(this.pendingFirstTimeEvents,function(t){t.property_filters&&!d4.isEmptyObject(t.property_filters)&&(e=!0)}),e&&this.getTargeting().then(function(){qS.log("targeting loaded for property filter evaluation")})};ch.prototype.getTargeting=function(){return C_7(this.loadExtraBundle.bind(this),this.targetingSrc).catch(function(e){qS.error("Failed to load targeting: "+e)}.bind(this))};ch.prototype.checkFirstTimeEvents=function(e,t){!this.pendingFirstTimeEvents||d4.isEmptyObject(this.pendingFirstTimeEvents)||(n7[i61]&&d4.isFunction(n7[i61].then)?n7[i61].then(function(r){this._processFirstTimeEventCheck(e,t,r)}.bind(this)).catch(function(){this._processFirstTimeEventCheck(e,t,null)}.bind(this)):this._processFirstTimeEventCheck(e,t,null))};ch.prototype._processFirstTimeEventCheck=function(e,t,r){d4.each(this.pendingFirstTimeEvents,function(a,i){if(!this.activatedFirstTimeEvents[i]){var n=a.flag_key,o;if(!r&&a.property_filters&&!d4.isEmptyObject(a.property_filters)){qS.warn('Skipping event check for "'+n+'" - property filters require targeting library');return}if(!r)o={matches:e===a.event_name,error:null};else{var h={event_name:a.event_name,property_filters:a.property_filters};o=r.eventMatchesCriteria(e,t,h)}if(o.error){qS.error('Error checking first-time event for flag "'+n+'": '+o.error);return}if(o.matches){qS.log('First-time event matched for flag "'+n+'": '+e);var u={key:a.pending_variant.variant_key,value:a.pending_variant.variant_value,experiment_id:a.pending_variant.experiment_id,is_experiment_active:a.pending_variant.is_experiment_active};this.flags.set(n,u),this.activatedFirstTimeEvents[i]=!0,this.recordFirstTimeEvent(a.flag_id,a.project_id,a.first_time_event_hash)}}},this)};ch.prototype.getFirstTimeEventApiRoute=function(e){return this.getFullApiRoute()+"/"+e+"/first-time-events"};ch.prototype.recordFirstTimeEvent=function(e,t,r){var a=this.getMpProperty("distinct_id"),i=jR5(),n=new URLSearchParams;n.set("mp_lib","web"),n.set("$lib_version",LW.LIB_VERSION);var o=this.getFirstTimeEventApiRoute(e)+"?"+n.toString(),h={distinct_id:a,project_id:t,first_time_event_hash:r};qS.log("Recording first-time event for flag: "+e),this.fetch.call(n7,o,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Basic "+btoa(this.getMpConfig("token")+":"),traceparent:i},body:JSON.stringify(h)}).catch(function(u){qS.error("Failed to record first-time event for flag "+e+": "+u)})};ch.prototype.getVariant=function(e,t){return this.fetchPromise?this.fetchPromise.then(function(){return this.getVariantSync(e,t)}.bind(this)).catch(function(r){return qS.error(r),t}):new Promise(function(r){qS.critical("Feature Flags not initialized"),r(t)})};ch.prototype.getVariantSync=function(e,t){if(!this.areFlagsReady())return qS.log("Flags not loaded yet"),t;var r=this.flags.get(e);return r?(this.trackFeatureCheck(e,r),r):(qS.log('No flag found: "'+e+'"'),t)};ch.prototype.getVariantValue=function(e,t){return this.getVariant(e,{value:t}).then(function(r){return r.value}).catch(function(r){return qS.error(r),t})};ch.prototype.getFeatureData=function(e,t){return qS.critical("mixpanel.flags.get_feature_data() is deprecated and will be removed in a future release. Use mixpanel.flags.get_variant_value() instead."),this.getVariantValue(e,t)};ch.prototype.getVariantValueSync=function(e,t){return this.getVariantSync(e,{value:t}).value};ch.prototype.isEnabled=function(e,t){return this.getVariantValue(e).then(function(){return this.isEnabledSync(e,t)}.bind(this)).catch(function(r){return qS.error(r),t})};ch.prototype.isEnabledSync=function(e,t){t=t||!1;var r=this.getVariantValueSync(e,t);return r!==!0&&r!==!1&&(qS.error('Feature flag "'+e+'" value: '+r+" is not a boolean; returning fallback value: "+t),r=t),r};ch.prototype.trackFeatureCheck=function(e,t){if(!this.trackedFeatures.has(e)){this.trackedFeatures.add(e);var r={"Experiment name":e,"Variant name":t.key,$experiment_type:"feature_flag","Variant fetch start time":new Date(this._fetchStartTime).toISOString(),"Variant fetch complete time":new Date(this._fetchCompleteTime).toISOString(),"Variant fetch latency (ms)":this._fetchLatency,"Variant fetch traceparent":this._traceparent};t.experiment_id!=="undefined"&&(r.$experiment_id=t.experiment_id),t.is_experiment_active!=="undefined"&&(r.$is_experiment_active=t.is_experiment_active),t.is_qa_tester!=="undefined"&&(r.$is_qa_tester=t.is_qa_tester),this.track("$experiment_started",r)}};ch.prototype.minApisSupported=function(){return!!this.fetch&&typeof Promise<"u"&&typeof Map<"u"&&typeof Set<"u"};DR5(ch);ch.prototype.are_flags_ready=ch.prototype.areFlagsReady;ch.prototype.get_variant=ch.prototype.getVariant;ch.prototype.get_variant_sync=ch.prototype.getVariantSync;ch.prototype.get_variant_value=ch.prototype.getVariantValue;ch.prototype.get_variant_value_sync=ch.prototype.getVariantValueSync;ch.prototype.is_enabled=ch.prototype.isEnabled;ch.prototype.is_enabled_sync=ch.prototype.isEnabledSync;ch.prototype.update_context=ch.prototype.updateContext;ch.prototype.get_feature_data=ch.prototype.getFeatureData;ch.prototype.getTargeting=ch.prototype.getTargeting;var nd1=function(){};nd1.prototype.create_properties=function(){};nd1.prototype.event_handler=function(){};nd1.prototype.after_track_handler=function(){};nd1.prototype.init=function(e){return this.mp=e,this};nd1.prototype.track=function(e,t,r,a){var i=this,n=d4.dom_query(e);if(n.length===0){jd.error("The DOM query ("+e+") returned 0 elements");return}return d4.each(n,function(o){d4.register_event(o,this.override_event,function(h){var u={},g=i.create_properties(r,this),f=i.mp.get_config("track_links_timeout");i.event_handler(h,this,u),window.setTimeout(i.track_callback(a,g,u,!0),f),i.mp.track(t,g,i.track_callback(a,g,u))})},this),!0};nd1.prototype.track_callback=function(e,t,r,a){a=a||!1;var i=this;return function(){r.callback_fired||(r.callback_fired=!0,!(e&&e(a,t)===!1)&&i.after_track_handler(t,r,a))}};nd1.prototype.create_properties=function(e,t){var r;return typeof e=="function"?r=e(t):r=d4.extend({},e),r};var p12=function(){this.override_event="click"};d4.inherit(p12,nd1);p12.prototype.create_properties=function(e,t){var r=p12.superclass.create_properties.apply(this,arguments);return t.href&&(r.url=t.href),r};p12.prototype.event_handler=function(e,t,r){r.new_tab=e.which===2||e.metaKey||e.ctrlKey||t.target==="_blank",r.href=t.href,r.new_tab||e.preventDefault()};p12.prototype.after_track_handler=function(e,t){t.new_tab||setTimeout(function(){window.location=t.href},0)};var Tl0=function(){this.override_event="submit"};d4.inherit(Tl0,nd1);Tl0.prototype.event_handler=function(e,t,r){r.element=t,e.preventDefault()};Tl0.prototype.after_track_handler=function(e,t){setTimeout(function(){t.element.submit()},0)};var SL1="$set",f12="$set_once",n61="$unset",W_1="$add",I91="$append",q_1="$union",Jh1="$remove",L_7="$delete",AZ5={set_action:function(e,t){var r={},a={};return d4.isObject(e)?d4.each(e,function(i,n){this._is_reserved_property(n)||(a[n]=i)},this):a[e]=t,r[SL1]=a,r},unset_action:function(e){var t={},r=[];return d4.isArray(e)||(e=[e]),d4.each(e,function(a){this._is_reserved_property(a)||r.push(a)},this),t[n61]=r,t},set_once_action:function(e,t){var r={},a={};return d4.isObject(e)?d4.each(e,function(i,n){this._is_reserved_property(n)||(a[n]=i)},this):a[e]=t,r[f12]=a,r},union_action:function(e,t){var r={},a={};return d4.isObject(e)?d4.each(e,function(i,n){this._is_reserved_property(n)||(a[n]=d4.isArray(i)?i:[i])},this):a[e]=d4.isArray(t)?t:[t],r[q_1]=a,r},append_action:function(e,t){var r={},a={};return d4.isObject(e)?d4.each(e,function(i,n){this._is_reserved_property(n)||(a[n]=i)},this):a[e]=t,r[I91]=a,r},remove_action:function(e,t){var r={},a={};return d4.isObject(e)?d4.each(e,function(i,n){this._is_reserved_property(n)||(a[n]=i)},this):a[e]=t,r[Jh1]=a,r},delete_action:function(){var e={};return e[L_7]="",e}},Ry=function(){};d4.extend(Ry.prototype,AZ5);Ry.prototype._init=function(e,t,r){this._mixpanel=e,this._group_key=t,this._group_id=r};Ry.prototype.set=v12(function(e,t,r){var a=this.set_action(e,t);return d4.isObject(e)&&(r=t),this._send_request(a,r)});Ry.prototype.set_once=v12(function(e,t,r){var a=this.set_once_action(e,t);return d4.isObject(e)&&(r=t),this._send_request(a,r)});Ry.prototype.unset=v12(function(e,t){var r=this.unset_action(e);return this._send_request(r,t)});Ry.prototype.union=v12(function(e,t,r){d4.isObject(e)&&(r=t);var a=this.union_action(e,t);return this._send_request(a,r)});Ry.prototype.delete=v12(function(e){var t=this.delete_action();return this._send_request(t,e)});Ry.prototype.remove=v12(function(e,t,r){var a=this.remove_action(e,t);return this._send_request(a,r)});Ry.prototype._send_request=function(e,t){e.$group_key=this._group_key,e.$group_id=this._group_id,e.$token=this._get_config("token");var r=d4.encodeDates(e);return this._mixpanel._track_or_batch({type:"groups",data:r,endpoint:this._mixpanel.get_api_host("groups")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},t)};Ry.prototype._is_reserved_property=function(e){return e==="$group_key"||e==="$group_id"};Ry.prototype._get_config=function(e){return this._mixpanel.get_config(e)};Ry.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id};Ry.prototype.remove=Ry.prototype.remove;Ry.prototype.set=Ry.prototype.set;Ry.prototype.set_once=Ry.prototype.set_once;Ry.prototype.union=Ry.prototype.union;Ry.prototype.unset=Ry.prototype.unset;Ry.prototype.toString=Ry.prototype.toString;var Gh=function(){};d4.extend(Gh.prototype,AZ5);Gh.prototype._init=function(e){this._mixpanel=e};Gh.prototype.set=ZL1(function(e,t,r){var a=this.set_action(e,t);return d4.isObject(e)&&(r=t),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),a[SL1]=d4.extend({},d4.info.people_properties(),a[SL1]),this._send_request(a,r)});Gh.prototype.set_once=ZL1(function(e,t,r){var a=this.set_once_action(e,t);return d4.isObject(e)&&(r=t),this._send_request(a,r)});Gh.prototype.unset=ZL1(function(e,t){var r=this.unset_action(e);return this._send_request(r,t)});Gh.prototype.increment=ZL1(function(e,t,r){var a={},i={};return d4.isObject(e)?(d4.each(e,function(n,o){if(!this._is_reserved_property(o))if(isNaN(parseFloat(n))){jd.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else i[o]=n},this),r=t):(d4.isUndefined(t)&&(t=1),i[e]=t),a[W_1]=i,this._send_request(a,r)});Gh.prototype.append=ZL1(function(e,t,r){d4.isObject(e)&&(r=t);var a=this.append_action(e,t);return this._send_request(a,r)});Gh.prototype.remove=ZL1(function(e,t,r){d4.isObject(e)&&(r=t);var a=this.remove_action(e,t);return this._send_request(a,r)});Gh.prototype.union=ZL1(function(e,t,r){d4.isObject(e)&&(r=t);var a=this.union_action(e,t);return this._send_request(a,r)});Gh.prototype.track_charge=ZL1(function(){jd.error("mixpanel.people.track_charge() is deprecated and no longer has any effect.")});Gh.prototype.clear_charges=function(e){return this.set("$transactions",[],e)};Gh.prototype.delete_user=function(){if(!this._identify_called()){jd.error("mixpanel.people.delete_user() requires you to call identify() first");return}var e={$delete:this._mixpanel.get_distinct_id()};return this._send_request(e)};Gh.prototype.toString=function(){return this._mixpanel.toString()+".people"};Gh.prototype._send_request=function(e,t){e.$token=this._get_config("token"),e.$distinct_id=this._mixpanel.get_distinct_id();var r=this._mixpanel.get_property("$device_id"),a=this._mixpanel.get_property("$user_id"),i=this._mixpanel.get_property("$had_persisted_distinct_id");r&&(e.$device_id=r),a&&(e.$user_id=a),i&&(e.$had_persisted_distinct_id=i);var n=d4.encodeDates(e);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:n,endpoint:this._mixpanel.get_api_host("people")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},t):(this._enqueue(e),d4.isUndefined(t)||(this._get_config("verbose")?t({status:-1,error:null}):t(-1)),d4.truncate(n,255))};Gh.prototype._get_config=function(e){return this._mixpanel.get_config(e)};Gh.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0};Gh.prototype._enqueue=function(e){SL1 in e?this._mixpanel.persistence._add_to_people_queue(SL1,e):f12 in e?this._mixpanel.persistence._add_to_people_queue(f12,e):n61 in e?this._mixpanel.persistence._add_to_people_queue(n61,e):W_1 in e?this._mixpanel.persistence._add_to_people_queue(W_1,e):I91 in e?this._mixpanel.persistence._add_to_people_queue(I91,e):Jh1 in e?this._mixpanel.persistence._add_to_people_queue(Jh1,e):q_1 in e?this._mixpanel.persistence._add_to_people_queue(q_1,e):jd.error("Invalid call to _enqueue():",e)};Gh.prototype._flush_one_queue=function(e,t,r,a){var i=this,n=d4.extend({},this._mixpanel.persistence.load_queue(e)),o=n;!d4.isUndefined(n)&&d4.isObject(n)&&!d4.isEmptyObject(n)&&(i._mixpanel.persistence._pop_from_people_queue(e,n),i._mixpanel.persistence.save(),a&&(o=a(n)),t.call(i,o,function(h,u){h===0&&i._mixpanel.persistence._add_to_people_queue(e,n),d4.isUndefined(r)||r(h,u)}))};Gh.prototype._flush=function(e,t,r,a,i,n,o){var h=this;this._flush_one_queue(SL1,this.set,e),this._flush_one_queue(f12,this.set_once,a),this._flush_one_queue(n61,this.unset,n,function(S){return d4.keys(S)}),this._flush_one_queue(W_1,this.increment,t),this._flush_one_queue(q_1,this.union,i);var u=this._mixpanel.persistence.load_queue(I91);if(!d4.isUndefined(u)&&d4.isArray(u)&&u.length)for(var g,f=function(S,B){S===0&&h._mixpanel.persistence._add_to_people_queue(I91,g),d4.isUndefined(r)||r(S,B)},v=u.length-1;v>=0;v--)u=this._mixpanel.persistence.load_queue(I91),g=u.pop(),h._mixpanel.persistence.save(),d4.isEmptyObject(g)||h.append(g,f);var C=this._mixpanel.persistence.load_queue(Jh1);if(!d4.isUndefined(C)&&d4.isArray(C)&&C.length)for(var L,y=function(S,B){S===0&&h._mixpanel.persistence._add_to_people_queue(Jh1,L),d4.isUndefined(o)||o(S,B)},z=C.length-1;z>=0;z--)C=this._mixpanel.persistence.load_queue(Jh1),L=C.pop(),h._mixpanel.persistence.save(),d4.isEmptyObject(L)||h.remove(L,y)};Gh.prototype._is_reserved_property=function(e){return e==="$distinct_id"||e==="$token"||e==="$device_id"||e==="$user_id"||e==="$had_persisted_distinct_id"};Gh.prototype.set=Gh.prototype.set;Gh.prototype.set_once=Gh.prototype.set_once;Gh.prototype.unset=Gh.prototype.unset;Gh.prototype.increment=Gh.prototype.increment;Gh.prototype.append=Gh.prototype.append;Gh.prototype.remove=Gh.prototype.remove;Gh.prototype.union=Gh.prototype.union;Gh.prototype.track_charge=Gh.prototype.track_charge;Gh.prototype.clear_charges=Gh.prototype.clear_charges;Gh.prototype.delete_user=Gh.prototype.delete_user;Gh.prototype.toString=Gh.prototype.toString;var rI4="__mps",aI4="__mpso",iI4="__mpus",nI4="__mpa",oI4="__mpap",lI4="__mpr",cI4="__mpu",zZ5="$people_distinct_id",ol0="__alias",nx2="__timers",w_7=[rI4,aI4,iI4,nI4,oI4,lI4,cI4,zZ5,ol0,nx2],Lg=function(e){this.props={},this.campaign_params_saved=!1,e.persistence_name?this.name="mp_"+e.persistence_name:this.name="mp_"+e.token+"_mixpanel";var t=e.persistence;t!=="cookie"&&t!=="localStorage"&&(jd.critical("Unknown persistence type "+t+"; falling back to cookie"),t=e.persistence="cookie"),t==="localStorage"&&d4.localStorage.is_supported()?this.storage=d4.localStorage:this.storage=d4.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};Lg.prototype.properties=function(){var e={};return this.load(),d4.each(this.props,function(t,r){d4.include(w_7,r)||(e[r]=t)}),e};Lg.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=d4.extend({},e))}};Lg.prototype.upgrade=function(){var e,t;this.storage===d4.localStorage?(e=d4.cookie.parse(this.name),d4.cookie.remove(this.name),d4.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===d4.cookie&&(t=d4.localStorage.parse(this.name),d4.localStorage.remove(this.name),t&&this.register_once(t))};Lg.prototype.save=function(){this.disabled||this.storage.set(this.name,g12(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)};Lg.prototype.load_prop=function(e){return this.load(),this.props[e]};Lg.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)};Lg.prototype.clear=function(){this.remove(),this.props={}};Lg.prototype.register_once=function(e,t,r){return d4.isObject(e)?(typeof t>"u"&&(t="None"),this.expire_days=typeof r>"u"?this.default_expiry:r,this.load(),d4.each(e,function(a,i){(!this.props.hasOwnProperty(i)||this.props[i]===t)&&(this.props[i]=a)},this),this.save(),!0):!1};Lg.prototype.register=function(e,t){return d4.isObject(e)?(this.expire_days=typeof t>"u"?this.default_expiry:t,this.load(),d4.extend(this.props,e),this.save(),!0):!1};Lg.prototype.unregister=function(e){this.load(),e in this.props&&(delete this.props[e],this.save())};Lg.prototype.update_search_keyword=function(e){this.register(d4.info.searchInfo(e))};Lg.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:d4.info.referringDomain(e)||"$direct"},"")};Lg.prototype.get_referrer_info=function(){return d4.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})};Lg.prototype.update_config=function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cookie_domain(e.cookie_domain),this.set_cross_site(e.cross_site_cookie),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)};Lg.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()};Lg.prototype.set_cookie_domain=function(e){e!==this.cookie_domain&&(this.remove(),this.cookie_domain=e,this.save())};Lg.prototype.set_cross_site=function(e){e!==this.cross_site&&(this.cross_site=e,this.remove(),this.save())};Lg.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())};Lg.prototype.get_cross_subdomain=function(){return this.cross_subdomain};Lg.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())};Lg.prototype._add_to_people_queue=function(e,t){var r=this._get_queue_key(e),a=t[e],i=this._get_or_create_queue(SL1),n=this._get_or_create_queue(f12),o=this._get_or_create_queue(n61),h=this._get_or_create_queue(W_1),u=this._get_or_create_queue(q_1),g=this._get_or_create_queue(Jh1,[]),f=this._get_or_create_queue(I91,[]);r===rI4?(d4.extend(i,a),this._pop_from_people_queue(W_1,a),this._pop_from_people_queue(q_1,a),this._pop_from_people_queue(n61,a)):r===aI4?(d4.each(a,function(v,C){C in n||(n[C]=v)}),this._pop_from_people_queue(n61,a)):r===iI4?d4.each(a,function(v){d4.each([i,n,h,u],function(C){v in C&&delete C[v]}),d4.each(f,function(C){v in C&&delete C[v]}),o[v]=!0}):r===nI4?(d4.each(a,function(v,C){C in i?i[C]+=v:(C in h||(h[C]=0),h[C]+=v)},this),this._pop_from_people_queue(n61,a)):r===cI4?(d4.each(a,function(v,C){d4.isArray(v)&&(C in u||(u[C]=[]),d4.each(v,function(L){d4.include(u[C],L)||u[C].push(L)}))}),this._pop_from_people_queue(n61,a)):r===lI4?(g.push(a),this._pop_from_people_queue(I91,a)):r===oI4&&(f.push(a),this._pop_from_people_queue(n61,a)),jd.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),jd.log(t),this.save()};Lg.prototype._pop_from_people_queue=function(e,t){var r=this.props[this._get_queue_key(e)];d4.isUndefined(r)||d4.each(t,function(a,i){e===I91||e===Jh1?d4.each(r,function(n){n[i]===a&&delete n[i]}):delete r[i]},this)};Lg.prototype.load_queue=function(e){return this.load_prop(this._get_queue_key(e))};Lg.prototype._get_queue_key=function(e){if(e===SL1)return rI4;if(e===f12)return aI4;if(e===n61)return iI4;if(e===W_1)return nI4;if(e===I91)return oI4;if(e===Jh1)return lI4;if(e===q_1)return cI4;jd.error("Invalid queue:",e)};Lg.prototype._get_or_create_queue=function(e,t){var r=this._get_queue_key(e);return t=d4.isUndefined(t)?{}:t,this.props[r]||(this.props[r]=t)};Lg.prototype.set_event_timer=function(e,t){var r=this.load_prop(nx2)||{};r[e]=t,this.props[nx2]=r,this.save()};Lg.prototype.remove_event_timer=function(e){var t=this.load_prop(nx2)||{},r=t[e];return d4.isUndefined(r)||(delete this.props[nx2][e],this.save()),r};var ll0,sI4=function(e,t){throw new Error(e+" not available in this build.")},NO,sD4=0,y_7=1,c21="mixpanel",bZ5="base64",A_7="json",hI4="$device:",z_7="strict",b_7="fallback",S_7="disabled",r12=n7.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,SZ5=!r12&&F91.indexOf("MSIE")===-1&&F91.indexOf("Mozilla")===-1,cl0=null;Xh1.sendBeacon&&(cl0=function(){return Xh1.sendBeacon.apply(Xh1,arguments)});var HZ5={track:"track/",engage:"engage/",groups:"groups/",record:"record/",flags:"flags/",settings:"settings/"},hD4={api_host:"https://api-js.mixpanel.com",api_hosts:{},api_routes:HZ5,api_extra_query_params:{},api_method:"POST",api_transport:"XHR",api_payload_format:bZ5,app_host:"https://mixpanel.com",autocapture:!1,cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:zL1,flags:!1,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:zL1,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video, audio",record_canvas:!1,record_collect_fonts:!1,record_console:!0,record_heatmap_data:!1,record_idle_timeout_ms:1800*1e3,record_mask_inputs:!0,record_max_ms:RM2,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js",targeting_src:"https://cdn.mxpnl.com/libs/mixpanel-targeting.min.js",remote_settings_mode:S_7},kZ5=!1,K6=function(){},dD4=function(e,t,r){var a,i=r===c21?NO:NO[r];if(i&&ll0===sD4)a=i;else{if(i&&!d4.isArray(i)){jd.error("You have already initialized "+r);return}a=new K6}if(a._cached_groups={},a._init(e,t,r),a.people=new Gh,a.people._init(a),!a.get_config("skip_first_touch_marketing")){var n=d4.info.campaignParams(null),o={},h=!1;d4.each(n,function(g,f){o["initial_"+f]=g,g&&(h=!0)}),h&&a.people.set_once(o)}LW.DEBUG=LW.DEBUG||a.get_config("debug");var u=ll0===sD4?"module":"snippet";return n7.dispatchEvent(new n7.CustomEvent("$mp_sdk_to_extension_event",{detail:{instance:a,source:u,token:e,name:r,info:d4.info}})),!d4.isUndefined(i)&&d4.isArray(i)&&(a._execute_array.call(a.people,i.people),a._execute_array(i)),a};K6.prototype.init=function(e,t,r){if(d4.isUndefined(r)){this.report_error("You must name your new library: init(token, config, name)");return}if(r===c21){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var a=dD4(e,t,r);return NO[r]=a,a._loaded(),a};K6.prototype._init=function(e,t,r){t=t||{},this.__loaded=!0,this.config={};var a={};if(!("api_payload_format"in t)){var i=t.api_host||hD4.api_host;i.match(/\.mixpanel\.com/)&&(a.api_payload_format=A_7)}if(this.hooks={},this.set_config(d4.extend({},hD4,a,t,{name:r,token:e,callback_fn:(r===c21?r:c21+"."+r)+"._jsc"})),this._jsc=zL1,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests){if(!d4.localStorage.is_supported(!0)||!r12)this._batch_requests=!1,jd.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),d4.each(this.get_batcher_configs(),function(u){jd.log("Clearing batch queue "+u.queue_key),d4.localStorage.remove(u.queue_key)});else if(this.init_batchers(),cl0&&n7.addEventListener){var n=d4.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);n7.addEventListener("pagehide",function(u){u.persisted&&n()}),n7.addEventListener("visibilitychange",function(){Hh.visibilityState==="hidden"&&n()})}}this.persistence=this.cookie=new Lg(this.config),this.unpersisted_superprops={},this._gdpr_init();var o=d4.UUID();this.get_distinct_id()||this.register_once({distinct_id:hI4+o,$device_id:o},""),this.flags=new ch({getFullApiRoute:d4.bind(function(){return this.get_api_host("flags")+"/"+this.get_config("api_routes").flags},this),getConfigFunc:d4.bind(this.get_config,this),setConfigFunc:d4.bind(this.set_config,this),getPropertyFunc:d4.bind(this.get_property,this),trackingFunc:d4.bind(this.track,this),loadExtraBundle:sI4,targetingSrc:this.get_config("targeting_src")}),this.flags.init(),this.flags=this.flags,this.autocapture=new Sk(this),this.autocapture.init(),this._init_tab_id();var h=this.get_config("remote_settings_mode");h===z_7||h===b_7?this._fetch_remote_settings(h).then(d4.bind(function(){this._check_and_start_session_recording()},this)):this._check_and_start_session_recording()};K6.prototype._init_tab_id=function(){if(this.get_config("disable_persistence"))jd.log("Tab ID initialization skipped due to disable_persistence config");else if(d4.sessionStorage.is_supported())try{var e=this.get_config("name")+"_"+this.get_config("token"),t="mp_tab_id_"+e,r="mp_gen_new_tab_id_"+e;(d4.sessionStorage.get(r)||!d4.sessionStorage.get(t))&&d4.sessionStorage.set(t,"$tab-"+d4.UUID()),d4.sessionStorage.set(r,"1"),this.tab_id=d4.sessionStorage.get(t),n7.addEventListener("beforeunload",function(){d4.sessionStorage.remove(r)})}catch(a){this.report_error("Error initializing tab id",a)}else this.report_error("Session storage is not supported, cannot keep track of unique tab ID.")};K6.prototype.get_tab_id=function(){return this.tab_id||null};K6.prototype._should_load_recorder=function(){if(this.get_config("disable_persistence"))return jd.log("Load recorder check skipped due to disable_persistence config"),Promise.resolve(!1);var e=new o61(KD4),t=this.get_tab_id();return e.init().then(function(){return e.getAll()}).then(function(r){for(var a=0;a<r.length;a++)if(QD4(r[a])||r[a].tabId===t)return!0;return!1}).catch(d4.bind(function(r){this.report_error("Error checking recording registry",r)},this))};K6.prototype._check_and_start_session_recording=RL1(function(e){if(!n7.MutationObserver){jd.critical("Browser does not support MutationObserver; skipping session recording");return}var t=d4.bind(function(a){var i=d4.bind(function(){this._recorder=this._recorder||new n7[QF4](this),this._recorder.resumeRecording(a)},this);d4.isUndefined(n7[QF4])?sI4(this.get_config("recorder_src"),i):i()},this),r=this.get_config("record_sessions_percent")>0&&Math.random()*100<=this.get_config("record_sessions_percent");e||r?t(!0):this._should_load_recorder().then(function(a){a&&t(!1)})});K6.prototype.start_session_recording=function(){this._check_and_start_session_recording(!0)};K6.prototype.stop_session_recording=function(){return this._recorder?this._recorder.stopRecording():Promise.resolve()};K6.prototype.pause_session_recording=function(){return this._recorder?this._recorder.pauseRecording():Promise.resolve()};K6.prototype.resume_session_recording=function(){return this._recorder?this._recorder.resumeRecording():Promise.resolve()};K6.prototype.is_recording_heatmap_data=function(){return this._get_session_replay_id()&&this.get_config("record_heatmap_data")};K6.prototype.get_session_recording_properties=function(){var e={},t=this._get_session_replay_id();return t&&(e.$mp_replay_id=t),e};K6.prototype.get_session_replay_url=function(){var e=null,t=this._get_session_replay_id();if(t){var r=d4.HTTPBuildQuery({replay_id:t,distinct_id:this.get_distinct_id(),token:this.get_config("token")});e="https://mixpanel.com/projects/replay-redirect?"+r}return e};K6.prototype._get_session_replay_id=function(){var e=null;return this._recorder&&(e=this._recorder.replayId),e||null};K6.prototype.__get_recorder=function(){return this._recorder};K6.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var e=d4.info.campaignParams(null);d4.each(e,function(t,r){this.unregister(r)}.bind(this))}};K6.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(Hh.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(d4.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(Hh.referrer)};K6.prototype._dom_loaded=function(){d4.each(this.__dom_loaded_queue,function(e){this._track_dom.apply(this,e)},this),this.has_opted_out_tracking()||d4.each(this.__request_queue,function(e){this._send_request.apply(this,e)},this),delete this.__dom_loaded_queue,delete this.__request_queue};K6.prototype._track_dom=function(e,t){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!kZ5)return this.__dom_loaded_queue.push([e,t]),!1;var r=new e().init(this);return r.track.apply(r,t)};K6.prototype._prepare_callback=function(e,t){if(d4.isUndefined(e))return null;if(r12){var r=function(o){e(o,t)};return r}else{var a=this._jsc,i=""+Math.floor(Math.random()*1e8),n=this.get_config("callback_fn")+"["+i+"]";return a[i]=function(o){delete a[i],e(o,t)},n}};K6.prototype._send_request=function(e,t,r,a){var i=!0;if(SZ5)return this.__request_queue.push(arguments),i;var n={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},o=null;!a&&(d4.isFunction(r)||typeof r=="string")&&(a=r,r=null),r=d4.extend(n,r||{}),r12||(r.method="GET");var h=r.method==="POST",u=cl0&&h&&r.transport.toLowerCase()==="sendbeacon",g=r.verbose;t.verbose&&(g=!0),this.get_config("test")&&(t.test=1),g&&(t.verbose=1),this.get_config("img")&&(t.img=1),r12||(a?t.callback=a:(g||this.get_config("test"))&&(t.callback="(function(){})")),t.ip=this.get_config("ip")?1:0,t._=new Date().getTime().toString(),h&&(o="data="+encodeURIComponent(t.data),delete t.data),d4.extend(t,this.get_config("api_extra_query_params")),e+="?"+d4.HTTPBuildQuery(t);var f=this;if("img"in t){var v=Hh.createElement("img");v.src=e,Hh.body.appendChild(v)}else if(u){try{i=cl0(e,o)}catch(B){f.report_error(B),i=!1}try{a&&a(i?1:0)}catch(B){f.report_error(B)}}else if(r12)try{var C=new XMLHttpRequest;C.open(r.method,e,!0);var L=this.get_config("xhr_headers");if(h&&(L["Content-Type"]="application/x-www-form-urlencoded"),d4.each(L,function(B,R){C.setRequestHeader(R,B)}),r.timeout_ms&&typeof C.timeout<"u"){C.timeout=r.timeout_ms;var y=new Date().getTime()}C.withCredentials=!0,C.onreadystatechange=function(){if(C.readyState===4)if(C.status===200){if(a)if(g){var B;try{B=d4.JSONDecode(C.responseText)}catch(N){if(f.report_error(N),r.ignore_json_errors)B=C.responseText;else return}a(B)}else a(Number(C.responseText))}else{var R;if(C.timeout&&!C.status&&new Date().getTime()-y>=C.timeout?R="timeout":R="Bad HTTP status: "+C.status+" "+C.statusText,f.report_error(R),a)if(g){var F=C.responseHeaders||{};a({status:0,httpStatusCode:C.status,error:R,retryAfter:F["Retry-After"]})}else a(0)}},C.send(o)}catch(B){f.report_error(B),i=!1}else{var z=Hh.createElement("script");z.type="text/javascript",z.async=!0,z.defer=!0,z.src=e;var S=Hh.getElementsByTagName("script")[0];S.parentNode.insertBefore(z,S)}return i};K6.prototype._fetch_remote_settings=function(e){var t=function(){e==="strict"&&o.set_config({record_sessions_percent:0})};if(!n7.AbortController)return jd.critical("Remote settings unavailable: missing minimum required APIs"),t(),Promise.resolve();var r=this.get_api_host("settings")+"/"+this.get_config("api_routes").settings,a={$lib_version:LW.LIB_VERSION,mp_lib:"web",sdk_config:"1"},i=d4.HTTPBuildQuery(a),n=r+"?"+i,o=this,h=new AbortController,u=setTimeout(function(){h.abort()},500),g={method:"GET",headers:{Authorization:"Basic "+btoa(o.get_config("token")+":")},signal:h.signal};return n7.fetch(n,g).then(function(f){if(clearTimeout(u),!f.ok){jd.critical("Network response was not ok"),t();return}return f.json()}).then(function(f){if(f&&f.sdk_config&&f.sdk_config.config){var v=f.sdk_config.config,C={};d4.each(v,function(L,y){hD4.hasOwnProperty(y)&&(C[y]=L)}),d4.isEmptyObject(C)?(jd.critical("No valid config keys found in remote settings."),t()):o.set_config(C)}else t()}).catch(function(f){clearTimeout(u),jd.critical("Failed to fetch remote settings",f),t()})};K6.prototype._execute_array=function(e){var t,r=[],a=[],i=[];d4.each(e,function(o){o&&(t=o[0],d4.isArray(t)?i.push(o):typeof o=="function"?o.call(this):d4.isArray(o)&&t==="alias"?r.push(o):d4.isArray(o)&&t.indexOf("track")!==-1&&typeof this[t]=="function"?i.push(o):a.push(o))},this);var n=function(o,h){d4.each(o,function(u){if(d4.isArray(u[0])){var g=h;d4.each(u,function(f){g=g[f[0]].apply(g,f.slice(1))})}else this[u[0]].apply(this,u.slice(1))},h)};n(r,this),n(a,this),n(i,this)};K6.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events};K6.prototype.get_batcher_configs=function(){var e="__mpq_"+this.get_config("token");return this._batcher_configs=this._batcher_configs||{events:{type:"events",api_name:"track",queue_key:e+"_ev"},people:{type:"people",api_name:"engage",queue_key:e+"_pp"},groups:{type:"groups",api_name:"groups",queue_key:e+"_gr"}},this._batcher_configs};K6.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=d4.bind(function(r){return new s21(r.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:d4.bind(function(a,i,n){var o=this.get_config("api_routes");this._send_request(this.get_api_host(r.api_name)+"/"+o[r.api_name],this._encode_data_for_request(a),i,this._prepare_callback(n,a))},this),beforeSendHook:d4.bind(function(a){var i=this._run_hook("before_send_"+r.type,a);return i?i[0]:null},this),stopAllBatchingFunc:d4.bind(this.stop_batch_senders,this),usePersistence:!0})},this),t=this.get_batcher_configs();this.request_batchers={events:e(t.events),people:e(t.people),groups:e(t.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()};K6.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,d4.each(this.request_batchers,function(e){e.start()}))};K6.prototype.stop_batch_senders=function(){this._batch_requests=!1,d4.each(this.request_batchers,function(e){e.stop(),e.clear()})};K6.prototype.push=function(e){this._execute_array([e])};K6.prototype.disable=function(e){typeof e>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(e)};K6.prototype._encode_data_for_request=function(e){var t=g12(e);return this.get_config("api_payload_format")===bZ5&&(t=d4.base64Encode(t)),{data:t}};K6.prototype._track_or_batch=function(e,t){var r=d4.truncate(e.data,255),a=e.endpoint,i=e.batcher,n=e.should_send_immediately,o=e.send_request_options||{};t=t||zL1;var h=!0,u=d4.bind(function(){return o.skip_hooks||(r=this._run_hook("before_send_"+e.type,r),r&&(r=r[0])),r?(jd.log("MIXPANEL REQUEST:"),jd.log(r),this._send_request(a,this._encode_data_for_request(r),o,this._prepare_callback(t,r))):null},this);return this._batch_requests&&!n?i.enqueue(r).then(function(g){g?t(1,r):u()}):h=u(),h&&r};K6.prototype.track=RL1(function(e,t,r,a){var i;if(!(r&&r.skip_hooks)){if(i=this._run_hook("before_track",e,t),i===null)return;e=i[0],t=i[1]}!a&&typeof r=="function"&&(a=r,r=null),r=r||{};var n=r.transport;n&&(r.transport=n);var o=r.send_immediately;if(typeof a!="function"&&(a=zL1),d4.isUndefined(e)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(e)){a(0);return}t=d4.extend({},t),t.token=this.get_config("token");var h=this.persistence.remove_event_timer(e);if(!d4.isUndefined(h)){var u=new Date().getTime()-h;t.$duration=parseFloat((u/1e3).toFixed(3))}this._set_default_superprops();var g=this.get_config("track_marketing")?d4.info.marketingParams():{};t=d4.extend({},d4.info.properties({mp_loader:this.get_config("mp_loader")}),g,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),t);var f=this.get_config("property_blacklist");d4.isArray(f)?d4.each(f,function(C){delete t[C]}):this.report_error("Invalid value for property_blacklist config: "+f);var v={event:e,properties:t};return i=this._track_or_batch({type:"events",data:v,endpoint:this.get_api_host("events")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:o,send_request_options:r},a),this.flags&&this.flags.checkFirstTimeEvents&&this.flags.checkFirstTimeEvents(e,t),i});K6.prototype.set_group=RL1(function(e,t,r){d4.isArray(t)||(t=[t]);var a={};return a[e]=t,this.register(a),this.people.set(e,t,r)});K6.prototype.add_group=RL1(function(e,t,r){var a=this.get_property(e),i={};return a===void 0?(i[e]=[t],this.register(i)):a.indexOf(t)===-1&&(a.push(t),i[e]=a,this.register(i)),this.people.union(e,t,r)});K6.prototype.remove_group=RL1(function(e,t,r){var a=this.get_property(e);if(a!==void 0){var i=a.indexOf(t);i>-1&&(a.splice(i,1),this.register({group_key:a})),a.length===0&&this.unregister(e)}return this.people.remove(e,t,r)});K6.prototype.track_with_groups=RL1(function(e,t,r,a){var i=d4.extend({},t||{});return d4.each(r,function(n,o){n!=null&&(i[o]=n)}),this.track(e,i,a)});K6.prototype._create_map_key=function(e,t){return e+"_"+JSON.stringify(t)};K6.prototype._remove_group_from_cache=function(e,t){delete this._cached_groups[this._create_map_key(e,t)]};K6.prototype.get_group=function(e,t){var r=this._create_map_key(e,t),a=this._cached_groups[r];return(a===void 0||a._group_key!==e||a._group_id!==t)&&(a=new Ry,a._init(this,e,t),this._cached_groups[r]=a),a};K6.prototype.track_pageview=RL1(function(e,t){typeof e!="object"&&(e={}),t=t||{};var r=t.event_name||"$mp_web_page_view",a=d4.extend(d4.info.mpPageViewProperties(),d4.info.campaignParams(),d4.info.clickParams()),i=d4.extend({},a,e);return this.track(r,i)});K6.prototype.track_links=function(){return this._track_dom.call(this,p12,arguments)};K6.prototype.track_forms=function(){return this._track_dom.call(this,Tl0,arguments)};K6.prototype.time_event=function(e){if(d4.isUndefined(e)){this.report_error("No event name provided to mixpanel.time_event");return}this._event_is_disabled(e)||this.persistence.set_event_timer(e,new Date().getTime())};var H_7={persistent:!0},dI4=function(e){var t;return d4.isObject(e)?t=e:d4.isUndefined(e)?t={}:t={days:e},d4.extend({},H_7,t)};K6.prototype.register=function(e,t){var r=this._run_hook("before_register",e,t);if(r!==null){e=r[0],t=r[1];var a=dI4(t);a.persistent?this.persistence.register(e,a.days):d4.extend(this.unpersisted_superprops,e)}};K6.prototype.register_once=function(e,t,r){var a=this._run_hook("before_register_once",e,t,r);if(a!==null){e=a[0],t=a[1],r=a[2];var i=dI4(r);i.persistent?this.persistence.register_once(e,t,i.days):(typeof t>"u"&&(t="None"),d4.each(e,function(n,o){(!this.unpersisted_superprops.hasOwnProperty(o)||this.unpersisted_superprops[o]===t)&&(this.unpersisted_superprops[o]=n)},this))}};K6.prototype.unregister=function(e,t){var r=this._run_hook("before_unregister",e,t);r!==null&&(e=r[0],t=r[1],t=dI4(t),t.persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e])};K6.prototype._register_single=function(e,t){var r={};r[e]=t,this.register(r)};K6.prototype.identify=function(e,t,r,a,i,n,o,h){var u=this._run_hook("before_identify",e);if(u===null)return-1;e=u[0];var g=this.get_distinct_id();if(e&&g!==e){if(typeof e=="string"&&e.indexOf(hI4)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var f=g;this.register_once({$had_persisted_distinct_id:!0,$device_id:f},"")}e!==g&&e!==this.get_property(ol0)&&(this.unregister(ol0),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,r,a,i,n,o,h),e!==g&&this.track("$identify",{distinct_id:e,$anon_distinct_id:g},{skip_hooks:!0}),e!==g&&this.flags.fetchFlags()};K6.prototype.reset=function(){this.stop_session_recording(),this.persistence.clear(),this._flags.identify_called=!1;var e=d4.UUID();this.register_once({distinct_id:hI4+e,$device_id:e},""),this._check_and_start_session_recording()};K6.prototype.get_distinct_id=function(){return this.get_property("distinct_id")};K6.prototype.alias=function(e,t){if(e===this.get_property(zZ5))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var r=this;return d4.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(ol0,e),this.track("$create_alias",{alias:e,distinct_id:t},{skip_hooks:!0},function(){r.identify(e)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)};K6.prototype.name_tag=function(e){this._register_single("mp_name_tag",e)};K6.prototype.set_config=function(e){if(d4.isObject(e)){d4.extend(this.config,e);var t=e.batch_size;t&&d4.each(this.request_batchers,function(r){r.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),LW.DEBUG=LW.DEBUG||this.get_config("debug"),("autocapture"in e||"record_heatmap_data"in e)&&this.autocapture&&this.autocapture.init(),d4.isObject(e.hooks)&&(this.hooks={},d4.each(e.hooks,function(r,a){if(d4.isFunction(r))this.hooks[a]=[r];else if(d4.isArray(r)){this.hooks[a]=[];for(var i=0;i<r.length;i++)d4.isFunction(r[i])||jd.critical("Invalid hook added. Hook is not a function"),this.hooks[a].push(r[i])}else jd.critical("Invalid hooks added. Ensure that the hook values passed into config.hooks are functions or arrays of functions.")},this))}};K6.prototype.get_config=function(e){return this.config[e]};K6.prototype._run_hook=function(e){var t=yL1.call(arguments,1);return d4.each(this.hooks[e],function(r){if(t===null)return null;var a=r.apply(this,t);typeof a>"u"?(this.report_error(e+" hook did not return a valid value"),t=null):(d4.isArray(a)||(a=[a]),t.splice.apply(t,[0,a.length].concat(a)))},this),t};K6.prototype.get_property=function(e){return this.persistence.load_prop([e])};K6.prototype.get_api_host=function(e){return this.get_config("api_hosts")[e]||this.get_config("api_host")};K6.prototype.toString=function(){var e=this.get_config("name");return e!==c21&&(e=c21+"."+e),e};K6.prototype._event_is_disabled=function(e){return d4.isBlockedUA(F91)||this._flags.disable_all_events||d4.include(this.__disabled_events,e)};K6.prototype._gdpr_init=function(){var e=this.get_config("opt_out_tracking_persistence_type")==="localStorage";e&&d4.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_tracking()&&(this.get_config("opt_out_tracking_by_default")||d4.cookie.get("mp_optout"))&&(d4.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))};K6.prototype._gdpr_update_persistence=function(e){var t;if(e&&e.clear_persistence)t=!0;else if(e&&e.enable_persistence)t=!1;else return;!this.get_config("disable_persistence")&&this.persistence.disabled!==t&&this.persistence.set_disabled(t),t?(this.stop_batch_senders(),this.stop_session_recording()):this._batchers_were_started&&this.start_batch_senders()};K6.prototype._gdpr_call_func=function(e,t){return t=d4.extend({track:d4.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},t),d4.localStorage.is_supported()||(t.persistence_type="cookie"),e(this.get_config("token"),{track:t.track,trackEventName:t.track_event_name,trackProperties:t.track_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieDomain:t.cookie_domain,cookieExpiration:t.cookie_expiration,crossSiteCookie:t.cross_site_cookie,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie,ignoreDnt:t.ignore_dnt})};K6.prototype.opt_in_tracking=function(e){e=d4.extend({enable_persistence:!0},e),this._gdpr_call_func(pP7,e),this._gdpr_update_persistence(e)};K6.prototype.opt_out_tracking=function(e){e=d4.extend({clear_persistence:!0,delete_user:!0},e),e.delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(fP7,e),this._gdpr_update_persistence(e)};K6.prototype.has_opted_in_tracking=function(e){return this._gdpr_call_func(vP7,e)};K6.prototype.has_opted_out_tracking=function(e){return this._gdpr_call_func(qR5,e)};K6.prototype.clear_opt_in_out_tracking=function(e){e=d4.extend({enable_persistence:!0},e),this._gdpr_call_func(mP7,e),this._gdpr_update_persistence(e)};K6.prototype.report_error=function(e,t){jd.error.apply(jd.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(r){jd.error(r)}};K6.prototype.add_hook=function(e,t){this.hooks[e]||(this.hooks[e]=[]),this.hooks[e].push(t)};K6.prototype.remove_hook=function(e,t){var r;this.hooks[e]&&(r=this.hooks[e].indexOf(t),r!==-1?this.hooks[e].splice(r,1):jd.log("remove_hook failed. Matching hook was not found"))};K6.prototype.init=K6.prototype.init;K6.prototype.reset=K6.prototype.reset;K6.prototype.disable=K6.prototype.disable;K6.prototype.time_event=K6.prototype.time_event;K6.prototype.track=K6.prototype.track;K6.prototype.track_links=K6.prototype.track_links;K6.prototype.track_forms=K6.prototype.track_forms;K6.prototype.track_pageview=K6.prototype.track_pageview;K6.prototype.register=K6.prototype.register;K6.prototype.register_once=K6.prototype.register_once;K6.prototype.unregister=K6.prototype.unregister;K6.prototype.identify=K6.prototype.identify;K6.prototype.alias=K6.prototype.alias;K6.prototype.name_tag=K6.prototype.name_tag;K6.prototype.set_config=K6.prototype.set_config;K6.prototype.get_config=K6.prototype.get_config;K6.prototype.get_api_host=K6.prototype.get_api_host;K6.prototype.get_property=K6.prototype.get_property;K6.prototype.get_distinct_id=K6.prototype.get_distinct_id;K6.prototype.toString=K6.prototype.toString;K6.prototype.opt_out_tracking=K6.prototype.opt_out_tracking;K6.prototype.opt_in_tracking=K6.prototype.opt_in_tracking;K6.prototype.has_opted_out_tracking=K6.prototype.has_opted_out_tracking;K6.prototype.has_opted_in_tracking=K6.prototype.has_opted_in_tracking;K6.prototype.clear_opt_in_out_tracking=K6.prototype.clear_opt_in_out_tracking;K6.prototype.get_group=K6.prototype.get_group;K6.prototype.set_group=K6.prototype.set_group;K6.prototype.add_group=K6.prototype.add_group;K6.prototype.remove_group=K6.prototype.remove_group;K6.prototype.add_hook=K6.prototype.add_hook;K6.prototype.remove_hook=K6.prototype.remove_hook;K6.prototype.track_with_groups=K6.prototype.track_with_groups;K6.prototype.start_batch_senders=K6.prototype.start_batch_senders;K6.prototype.stop_batch_senders=K6.prototype.stop_batch_senders;K6.prototype.start_session_recording=K6.prototype.start_session_recording;K6.prototype.stop_session_recording=K6.prototype.stop_session_recording;K6.prototype.pause_session_recording=K6.prototype.pause_session_recording;K6.prototype.resume_session_recording=K6.prototype.resume_session_recording;K6.prototype.get_session_recording_properties=K6.prototype.get_session_recording_properties;K6.prototype.get_session_replay_url=K6.prototype.get_session_replay_url;K6.prototype.get_tab_id=K6.prototype.get_tab_id;K6.prototype.DEFAULT_API_ROUTES=HZ5;K6.prototype.__get_recorder=K6.prototype.__get_recorder;Lg.prototype.properties=Lg.prototype.properties;Lg.prototype.update_search_keyword=Lg.prototype.update_search_keyword;Lg.prototype.update_referrer_info=Lg.prototype.update_referrer_info;Lg.prototype.get_cross_subdomain=Lg.prototype.get_cross_subdomain;Lg.prototype.clear=Lg.prototype.clear;var QQ1={},k_7=function(){d4.each(QQ1,function(e,t){t!==c21&&(NO[t]=e)}),NO._=d4},T_7=function(){NO.init=function(e,t,r){if(r)return NO[r]||(NO[r]=QQ1[r]=dD4(e,t,r),NO[r]._loaded()),NO[r];var a=NO;QQ1[c21]?a=QQ1[c21]:e&&(a=dD4(e,t,c21),a._loaded(),QQ1[c21]=a),NO=a,ll0===y_7&&(n7[c21]=NO),k_7()}},B_7=function(){function e(){e.done||(e.done=!0,kZ5=!0,SZ5=!1,d4.each(QQ1,function(a){a._dom_loaded()}))}function t(){try{Hh.documentElement.doScroll("left")}catch{setTimeout(t,1);return}e()}if(Hh.addEventListener)Hh.readyState==="complete"?e():Hh.addEventListener("DOMContentLoaded",e,!1);else if(Hh.attachEvent){Hh.attachEvent("onreadystatechange",e);var r=!1;try{r=n7.frameElement===null}catch{}Hh.documentElement.doScroll&&r&&t()}d4.register_event(n7,"load",e,!0)};function V_7(e){return sI4=e,ll0=sD4,NO=new K6,T_7(),NO.init(),B_7(),NO}function P_7(e,t){t()}var __7=V_7(P_7);TZ5.exports=__7});function wW(e){return e.type==="local"}function M12(e){return e.type!=="local"}var Q_1=C1(()=>{oR4();D90()});function VZ5(e){if(!e)return!1;let t=e.trim().toLowerCase();return t==="1"||t==="true"}var uI4,PZ5=C1(()=>{Q_1();uI4="DELEGATE_TELEMETRY_DISABLED"});function E_7(){return(0,EZ5.create)((e,t)=>({executions:{},addToolExecution:r=>e(a=>({executions:{...a.executions,[r.payload.id]:{id:r.payload.id,sessionId:r.sessionId,header:r.header??"Autopilot Tool",subHeader:r.subHeader,status:r.status??"idle",isRevertible:r.isRevertible??!1,currentPayload:r.currentPayload??r.payload,toolMessages:r.toolMessages??{},externalMessages:r.externalMessages??{},isReadOnly:r.isReadOnly,autoExecute:r.autoExecute,executionStartedAt:r.executionStartedAt}}})),setToolExecutionStatus:(r,a)=>e(i=>{let n=i.executions[r];return n?{executions:{...i.executions,[r]:{...n,status:a}}}:i}),markToolExecutionStarted:(r,a=Date.now())=>e(i=>{let n=i.executions[r];return!n||n.executionStartedAt!==void 0?i:{executions:{...i.executions,[r]:{...n,executionStartedAt:a}}}}),restoreToolExecution:r=>e(a=>({executions:{...a.executions,[r.id]:{...r}}})),addToolMessage:(r,a)=>e(i=>{let n=i.executions[r];return n?{executions:{...i.executions,[r]:{...n,toolMessages:{...n.toolMessages,[a.id]:a}}}}:i}),addExternalMessage:(r,a)=>e(i=>{let n=i.executions[r];return n?{executions:{...i.executions,[r]:{...n,externalMessages:{...n.externalMessages,[a.id]:a}}}}:i}),clearMessages:r=>e(a=>{let i=a.executions[r];return i?{executions:{...a.executions,[r]:{...i,toolMessages:{}}}}:a}),askConfirmation:r=>e(a=>{let i=a.executions[r];return i?{executions:{...a.executions,[r]:{...i,status:"pending"}}}:a}),setToolExecutionResponse:(r,a)=>{e(n=>{let o=n.executions[r];if(!o)return n;let h=a?.attachments?.length?{...a,attachments:a.attachments.map(u=>({...u,timestamp:u.timestamp??Date.now()}))}:a;return{executions:{...n.executions,[r]:{...o,response:h}}}});let i=t().executions[r]?.sessionId;i&&t().pruneOldScreenshots(i)},setHeader:(r,a)=>e(i=>{if(!a)return i;let n=i.executions[r];return n?{executions:{...i.executions,[r]:{...n,header:a}}}:i}),setSubHeader:(r,a)=>e(i=>{if(!a)return i;let n=i.executions[r];return n?{executions:{...i.executions,[r]:{...n,subHeader:a}}}:i}),setIsRevertible:(r,a)=>e(i=>{let n=i.executions[r];return n?{executions:{...i.executions,[r]:{...n,isRevertible:a}}}:i}),addExternalMessages:(r,a)=>e(i=>{let n=i.executions[r];return n?{executions:{...i.executions,[r]:{...n,externalMessages:{...n.externalMessages,...Object.fromEntries(a.map(o=>[o.id,o]))}}}}:i}),setCurrentPayload:(r,a)=>e(i=>{let n=i.executions[r];return n?{executions:{...i.executions,[r]:{...n,currentPayload:a}}}:i}),setSubAgentMessageCount:(r,a)=>e(i=>{let n=i.executions[r];return n?{executions:{...i.executions,[r]:{...n,subAgentMessageCount:a}}}:i}),deleteExecution:r=>e(a=>{if(!a.executions[r])return a;let{[r]:i,...n}=a.executions;return{executions:n}}),deleteSession:r=>e(a=>{let i={};for(let[n,o]of Object.entries(a.executions))o.sessionId!==r&&(i[n]=o);return{executions:i}}),pruneOldScreenshots:r=>e(a=>{let i=Object.entries(a.executions).filter(([,h])=>h.sessionId===r&&h.response?.attachments?.some(u=>u.content?.base64)).map(([h])=>h);if(i.length<=_Z5)return a;let n=new Set(i.slice(0,i.length-_Z5));if(n.size===0)return a;let o={};for(let[h,u]of Object.entries(a.executions))n.has(h)&&u.response?.attachments?o[h]={...u,response:{...u.response,attachments:u.response.attachments.map(g=>g.content?.base64?{...g,content:{...g.content,base64:null}}:g)}}:o[h]=u;return{executions:o}}),selectExecutionState:r=>t().executions[r],selectExecutionStatePayload:r=>t().executions[r]?.currentPayload,selectSessionId:r=>t().executions[r]?.sessionId,selectResponse:r=>t().executions[r]?.response,selectStatus:r=>t().executions[r]?.status,selectMessages:r=>t().executions[r]?.toolMessages??{},selectHeader:r=>t().executions[r]?.header,selectSubHeader:r=>t().executions[r]?.subHeader,selectExternalMessage:r=>t().executions[r]?.externalMessages??{},selectIsRevertible:r=>t().executions[r]?.isRevertible,getSessionsWithPendingApproval:()=>{let r=new Set;for(let a of Object.values(t().executions))(a.status==="pending"||a.status==="pending_restored")&&r.add(a.sessionId);return r}}))}var EZ5,_Z5,A7,Y_=C1(()=>{a7();EZ5=w4(Lu(),1),_Z5=20;A7=import.meta.hot?.data?.toolExecutionStore??E_7();import.meta.hot&&import.meta.hot.dispose(e=>{e.toolExecutionStore=A7})});var OZ5={};qr(OZ5,{cloudEnvFromUrl:()=>vI4,environmentFromBackendUrl:()=>mI4,getRuntimePlatform:()=>pI4,isSdkRuntime:()=>Bl0,mixpanelService:()=>Kr,parseEnvironment:()=>gI4,resolveToolCategory:()=>dx2,sumSessionTotals:()=>FZ5});function vI4(e){return e?e.includes("alpha.uipath")?"alpha":e.includes("staging.uipath")?"staging":e.includes("cloud.uipath")?"production":null:null}function Bl0(){return typeof process<"u"&&process.env?.DELEGATE_SDK_RUNTIME==="1"}function mI4(e){return e.includes("nst.kubefabric")?"alpha":vI4(e)??"local"}function gI4(){if(process.env.VITE_USE_CLOUD_URL==="true"){let e=vI4(FM);if(e)return e}return mI4(T91())}function pI4(){let e=typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:"";return e.includes("Mac")?"darwin":e.includes("Linux")?"linux":typeof process<"u"&&(process.platform==="darwin"||process.platform==="linux")?process.platform:"win32"}function ZZ5(e){let r=e?.operations?.[0]?.endpoint;return!r||typeof r!="string"?null:r.replace(/^\//,"").split("/")[0]||null}function R_7(e,t){if(e!=="ExecuteSkillApi")return e;let r=ZZ5(t);return r?`ExecuteSkillApi.${RZ5[r]?.suffix??r}`:e}function dx2(e,t){if(e==="ExecuteSkillApi"){let a=ZZ5(t);return a?RZ5[a]?.category??a:null}return{AppAct:"UI Automation",AppFind:"UI Automation",AppFindTabs:"UI Automation",AppGetDescriptor:"UI Automation",AppOpenAttach:"UI Automation",WebSearch:"Web",WebReader:"Web",ImageSearch:"Web",ExecuteBashCommand:"Shell",ExecuteOsaScript:"Shell",ExecutePowershellCommand:"Shell",ReadFile:"File System",WriteFile:"File System",EditFile:"File System",Search:"File System",DownloadFile:"File System",ExcelGeneratorExecutor:"Excel",DocGeneratorExecutor:"Word",PptGeneratorExecutor:"PowerPoint",SendUiPathRequest:"UiPath API",ImageGenerate:"Image Generation"}[e]??null}function Z_7(e,t){let r={},a=t?.app?.identifier??t?.identifier;if(a&&typeof a=="string"){let n=a.split(":"),o=["win","tab","app"];n.length>=2&&o.includes(n[0])&&(r.targetApp=n[1])}!r.targetApp&&e==="AppFindTabs"&&t?.browserType&&(r.targetApp=String(t.browserType));let i=t?.app?.url??t?.url;if(i&&typeof i=="string")try{r.targetUrl=new URL(i).hostname}catch{}return r}function F_7(e){let t={};for(let[r,a]of Object.entries(e))gR4.includes(r)||(t[`tool_${r}`]=a);return t}function O_7(e){return{mcpServerCount:e.length,mcpServers:e.map(t=>({url:M12(t)?t.url:`local:${t.serverId}`,title:t.title??null,enabled:t.enabled}))}}function FZ5(e){if(e.length!==0)return e.reduce((t,r)=>({total_prompt_tokens:t.total_prompt_tokens+r.total_prompt_tokens,total_prompt_tokens_cached:t.total_prompt_tokens_cached+r.total_prompt_tokens_cached,total_cache_creation_tokens:t.total_cache_creation_tokens+r.total_cache_creation_tokens,total_completion_tokens:t.total_completion_tokens+r.total_completion_tokens,total_token_units:t.total_token_units+r.total_token_units}),D_7)}var h21,RZ5,D_7,fI4,Kr,X_=C1(()=>{h21=w4(BZ5());PZ5();Q_1();wu();wd();Y_();$C2();dj();HZ4();xL1();RZ5={excel:{suffix:"Excel",category:"Excel"},"excel-gen":{suffix:"ExcelGen",category:"Excel"},word:{suffix:"Word",category:"Word"},"doc-gen":{suffix:"DocGen",category:"Word"},ppt:{suffix:"Ppt",category:"PowerPoint"},"ppt-gen":{suffix:"Ppt",category:"PowerPoint"},powerpoint:{suffix:"Ppt",category:"PowerPoint"},pdf:{suffix:"Pdf",category:"PDF"},slack:{suffix:"Slack",category:"Slack"},"ms-teams":{suffix:"Teams",category:"Teams"},"recorded-task":{suffix:"Recording",category:"Recording"},"ui-scripting":{suffix:"UiScripting",category:"UI Scripting"},diagram:{suffix:"Diagram",category:"Diagram"}};D_7={total_prompt_tokens:0,total_prompt_tokens_cached:0,total_cache_creation_tokens:0,total_completion_tokens:0,total_token_units:0};fI4=class{_isInitialized=!1;_isIdentified=!1;_analyticsEnabled=!0;_userTrackingAllowed=!0;_environmentOverride=null;_resolveEnvironment(){return this._environmentOverride??gI4()}_sessionCategories=new Map;_taskStartTimes=new Map;_taskStartCosts=new Map;_terminalOutcomeTracked=new Set;_deferredTaskFailures=new Map;_deferredTaskCancellations=new Set;initialize(t,r){if(this._isInitialized)return;if(Bl0()&&VZ5(process.env[uI4])){console.warn(`[MixpanelService] Telemetry disabled via ${uI4}`);return}let a=r?mI4(r):gI4();this._environmentOverride=r?a:null;let i=Bl0()?`sdk${a}`:a,n=t||{}.MIXPANEL_PROJECT_TOKEN||_b5[i]||null;if(!n||xn){console.warn("[MixpanelService] No project token provided or mock UI mode, Mixpanel disabled");return}try{h21.default.init(n,{api_host:"https://api-eu.mixpanel.com",autocapture:!1,record_sessions_percent:0,persistence:"localStorage",ip:!1,...Bl0()?{batch_requests:!1}:{}});let o=pI4();h21.default.register({appVersion:"0.1.4",platform:o,environment:a}),this._isInitialized=!0,console.log("[MixpanelService] Initialized successfully")}catch(o){console.error("[MixpanelService] Failed to initialize:",o)}}identify(t,r){if(!this._isInitialized||!this._analyticsEnabled)return;let a=["ibabencu01@gmail.com"];if(r.email&&a.includes(r.email.toLowerCase())){this._userTrackingAllowed=!1;return}if(this._resolveEnvironment()==="local"){let i=process.env.VITE_MIXPANEL_ALLOWED_EMAIL;if(!i||r.email?.toLowerCase()!==i.toLowerCase()){this._userTrackingAllowed=!1;return}}try{h21.default.identify(t);let i={uipathUserId:t,platform:pI4(),appVersion:"0.1.4"},n=this._resolveEnvironment()==="production";if(r.email&&!n&&(i.$email=r.email,i.isInternalUser=r.email.endsWith("@uipath.com")),!n){let o=[r.firstName,r.lastName].filter(Boolean).join(" ");i.$name=o||r.name||void 0,i.$first_name=r.firstName||void 0,i.$last_name=r.lastName||void 0}r.organizationId&&(i.organizationId=r.organizationId),r.organizationName&&(i.organizationName=r.organizationName),r.tenantId&&(i.tenantId=r.tenantId),r.tenantName&&(i.tenantName=r.tenantName),h21.default.people.set(i),h21.default.people.set_once({$created:new Date().toISOString()}),this._isIdentified=!0}catch(i){console.error("[MixpanelService] Failed to identify user:",i)}}identifyUser(t){this.identify(t.profile.sub,{email:t.profile.email,name:t.profile.name,firstName:t.profile.first_name,lastName:t.profile.last_name,organizationId:t.organization?.id,organizationName:t.organization?.name,tenantId:t.tenant?.id,tenantName:t.tenant?.name})}track(t,r){if(!(!this._isInitialized||!this._analyticsEnabled||!this._userTrackingAllowed))try{h21.default.track(t,{shellApp:this._resolveShellApp(r),...r})}catch(a){console.error("[MixpanelService] Failed to track event:",a)}}_shellAppResolver=null;setShellAppResolver(t){this._shellAppResolver=t}_resolveShellApp(t){try{let r=t?.taskId;return this._shellAppResolver?.(typeof r=="string"?r:void 0)??"delegate"}catch{return"delegate"}}setAnalyticsEnabled(t){if(this._analyticsEnabled=t,!!this._isInitialized)try{t?h21.default.opt_in_tracking():h21.default.opt_out_tracking()}catch(r){cn0("mixpanel").warn("Failed to flip SDK opt-state; internal gate still applies:",r)}}timeEvent(t){if(!(!this._isInitialized||!this._analyticsEnabled||!this._userTrackingAllowed))try{h21.default.time_event(t)}catch(r){console.error("[MixpanelService] Failed to start time_event:",r)}}startTaskTimer(t){this._taskStartTimes.set(t,Date.now());let r=this._resolveTaskTotals(t)?.total_token_units??0;this._taskStartCosts.set(t,r),this._terminalOutcomeTracked.delete(t),this._deferredTaskFailures.delete(t),this._deferredTaskCancellations.delete(t)}getTaskDuration(t){let r=this._taskStartTimes.get(t);if(r!=null)return(Date.now()-r)/1e3}trackTaskOutcome(t,r,a){if(this._terminalOutcomeTracked.has(t))return;this._terminalOutcomeTracked.add(t);let i=this.getSessionCategories(t),n=this.getTaskDuration(t);this.track(`Task.${r}`,{taskId:t,runnerMode:st.getState().sessions[t]?.runnerMode??"local",...i.length>0?{categories:i}:{},...n!=null?{$duration:n}:{},...this.getSessionCostProps(t),...a}),this.clearSessionCategories(t)}recordDeferredTaskFailure(t,r){this._deferredTaskFailures.set(t,r)}takeDeferredTaskFailure(t){let r=this._deferredTaskFailures.get(t);return this._deferredTaskFailures.delete(t),r}recordDeferredTaskCancellation(t){this._deferredTaskCancellations.add(t)}takeDeferredTaskCancellation(t){return this._deferredTaskCancellations.delete(t)}reset(){if(this._isInitialized)try{h21.default.reset(),this._isIdentified=!1}catch(t){console.error("[MixpanelService] Failed to reset:",t)}}setUserProperties(t){if(!(!this._isInitialized||!this._analyticsEnabled||!this._userTrackingAllowed))try{h21.default.people.set(t)}catch(r){console.error("[MixpanelService] Failed to set user properties:",r)}}trackToolExecution(t,r,a,i,n=!1,o){let h=R_7(r,a),u=dx2(r,a);if(u){let v=this._sessionCategories.get(t);v||(v=new Set,this._sessionCategories.set(t,v)),v.add(u)}let g={...o,taskId:t,toolName:h,isMcp:n};u&&(g.category=u);let f=Z_7(r,a);f.targetApp&&(g.targetApp=f.targetApp),f.targetUrl&&(g.targetUrl=f.targetUrl),i!=null&&(g.duration=Math.round(i/100)/10),this.track("Tool.Executed",g)}getSessionCategories(t){let r=this._sessionCategories.get(t);return r?[...r]:[]}clearSessionCategories(t){this._sessionCategories.delete(t)}forgetTask(t){this.clearSessionCategories(t),this._taskStartTimes.delete(t),this._taskStartCosts.delete(t),this._terminalOutcomeTracked.delete(t),this._deferredTaskFailures.delete(t),this._deferredTaskCancellations.delete(t)}syncToolSettings(t){this._isInitialized&&this.setUserProperties(F_7(t))}syncMcpServers(t){this._isInitialized&&this.setUserProperties(O_7(t))}syncBehaviorPreferences(t){this._isInitialized&&this.setUserProperties({workProfile:t})}syncKnowledgeCount(t){this._isInitialized&&this.setUserProperties({knowledgeCount:t})}setupProfileSync(t){if(console.log(`[MixpanelService] setupProfileSync called: isInit=${this._isInitialized}, syncActive=${this._profileSyncActive}`),!this._isInitialized||this._profileSyncActive)return;this._profileSyncActive=!0;let{authStore:r,settingsStore:a,appStore:i,mcpStore:n,memoriesStore:o}=t,h=r.getState();h.user&&!this._isIdentified&&this.identifyUser({profile:h.user.profile,organization:h.organization,tenant:h.tenant});let u=i.getState();this.setUserProperties({selectedModel:a.selectModelId(),agentType:a.selectAgentType(),securityMode:u.toolExecutionPolicy.securityMode??"recommended"}),this.syncToolSettings(u.toolSettings),this.syncMcpServers(n.getState().servers),this.syncBehaviorPreferences(u.behaviorPreferences.workProfile);let g=u.toolSettings,f=u.behaviorPreferences?.workProfile,v=u.toolExecutionPolicy?.securityMode,C=n.getState().servers,L=o.getState().memories;i.subscribe(y=>{y.toolSettings!==g&&(g=y.toolSettings,this.syncToolSettings(y.toolSettings)),y.behaviorPreferences?.workProfile!==f&&(f=y.behaviorPreferences.workProfile,this.syncBehaviorPreferences(y.behaviorPreferences.workProfile)),y.toolExecutionPolicy?.securityMode!==v&&(v=y.toolExecutionPolicy.securityMode,this.setUserProperties({securityMode:v??"recommended"}))}),n.subscribe(y=>{y.servers!==C&&(C=y.servers,this.syncMcpServers(y.servers))}),o.subscribe(y=>{if(y.memories!==L){L=y.memories;let z=y.memories.filter(S=>!S.path.toLowerCase().includes("/sessions/")).length;this.syncKnowledgeCount(z)}})}_profileSyncActive=!1;trackTool(t,r){let a=A7.getState(),i=a.selectExecutionStatePayload(r)?.name,n=a.selectSessionId(r);this.track(`Tool.${t}`,{taskId:n,toolName:i})}get isEnabled(){return this._isInitialized}get isIdentified(){return this._isIdentified}_resolveTaskTotals(t){let r=st.getState();return FZ5([t,...r.getChildSessionIds(t)].map(a=>r.sessions[a]?.sessionTotals).filter(a=>a!=null))}getSessionCostProps(t){let a=st.getState().sessionUsage,i=t?this._resolveTaskTotals(t):null,n={},o=C=>Math.round(C)/1e3;a?.turnTokenUnits&&(n.turnTokenUnits=o(a.turnTokenUnits));let h=i?.total_token_units??a?.sessionTotals?.totalTokenUnits,u=i?.total_prompt_tokens??a?.sessionTotals?.totalPromptTokens,g=i?.total_completion_tokens??a?.sessionTotals?.totalCompletionTokens,f=i?.total_prompt_tokens_cached??a?.sessionTotals?.totalPromptTokensCached;if(h!=null&&(n.totalTokenUnits=o(h),n.totalPromptTokens=u,n.totalCompletionTokens=g,n.totalPromptTokensCached=f,t)){let C=this._taskStartCosts.get(t)??0,L=h-C;n.taskTokenUnits=o(Math.max(0,L))}let v=Object.entries(a?.usageByModel||{});if(v.length>0){n.models=v.map(([L])=>L);let C={};for(let[L,y]of v){let z=y.token_units??y.tokenUnits??0;z>0&&(C[L]=o(z))}Object.keys(C).length>0&&(n.costByModel=C)}return n}},Kr=new fI4;process.env.NODE_ENV==="development"&&(window.__mixpanelService=Kr)});var CI4,MI4=C1(()=>{X_();CI4={started:e=>{Kr.track("Onboarding.Started",{source:e})},goalsReached:()=>{Kr.track("Onboarding.GoalsReached")},goalsCaptured:(e,t,r)=>{let a={goals:e,count:e.length,source:t};r&&r.length>0&&(a.matchedPhrases=r),Kr.track("Onboarding.GoalsCaptured",a)},scanPermissionReached:()=>{Kr.track("Onboarding.ScanPermissionReached")},scanRun:(e,t)=>{Kr.track("Onboarding.ScanRun",{choice:e,categoriesIncluded:t})},scanSkipped:()=>{Kr.track("Onboarding.ScanSkipped")},scanPhase2BrowserAvailable:(e,t,r)=>{Kr.track("Onboarding.ScanPhase2BrowserAvailable",{browser:e,tabCount:t,latencyMs:r})},scanPhase2BrowserEmpty:e=>{Kr.track("Onboarding.ScanPhase2BrowserEmpty",{browser:e})},scanPhase2BrowserFailure:(e,t,r)=>{Kr.track("Onboarding.ScanPhase2BrowserFailure",{browser:e,failureClass:t,latencyMs:r})},scanPhase2Failure:e=>{Kr.track("Onboarding.ScanPhase2Failure",{failureClasses:e})},scanFailed:(e,t)=>{Kr.track("Onboarding.ScanFailed",{phase:e,errorClass:t})},scanProgressReached:()=>{Kr.track("Onboarding.ScanProgressReached")},scanHandoffSent:e=>{Kr.track("Onboarding.ScanHandoffSent",{success:e})},scanHandoffStuck:()=>{Kr.track("Onboarding.ScanHandoffStuck")},scanHandoffDeduped:()=>{Kr.track("Onboarding.ScanHandoffDeduped")},roleInferred:(e,t,r)=>{Kr.track("Onboarding.RoleInferred",{role:e,confidence:t,path:r})},curationOpened:()=>{Kr.track("Onboarding.CurationOpened")},curationItemRemoved:e=>{Kr.track("Onboarding.CurationItemRemoved",{category:e})},roleCommitted:(e,t,r)=>{Kr.track("Onboarding.RoleCommitted",{path:e,curated:t,droppedBrowser:r})},routinesReached:()=>{Kr.track("Onboarding.RoutinesReached")},routinesRegenerationFallback:e=>{Kr.track("Onboarding.RoutinesRegenerationFallback",{reason:e})},routinesHardFailure:()=>{Kr.track("Onboarding.RoutinesHardFailure")},routinesPicked:e=>{Kr.track("Onboarding.RoutinesPicked",{count:e})},completed:e=>{Kr.track("Onboarding.Completed",{routineCount:e.routineCount,durationSeconds:e.durationSec,outcome:e.outcome})},handoffPartialFailure:(e,t,r)=>{Kr.track("Onboarding.HandoffPartialFailure",{totalRequested:e,succeeded:t,failed:r})},reRunSetup:()=>{Kr.track("Onboarding.ReRunSetup")},driftDetected:(e,t)=>{Kr.track("Onboarding.DriftDetected",{kind:e,detail:t})},testcloudAutoActivated:e=>{Kr.track("Onboarding.TestcloudAutoActivated",{sessionId:e})}}});function xI4(e,t){return e?t.some(r=>r.id===e||r.model===e):!1}function DZ5(e){return{id:e.id,name:e.name??e.id,model:e.model??e.id,description:e.description??null}}function N_7(e){return typeof e=="object"&&e!==null&&e.attachmentSource==="Screenshot"}function U_7(e){if(!e?.Attachments)return e;let{Attachments:t,...r}=e,a=t.filter(N_7);return a.length===0?r:{...r,Attachments:a}}function G_7(e){let t=b5.getState(),r=t.availableModels;if(xI4(Vl0,r))return I_7;let a=e.operatingModel?.id;if(a&&xI4(a,r))return e.operatingModel??null;let i=t.selectedModel;return i&&xI4(i.id,r)?DZ5(i):r.length>0?DZ5(r[0]):null}var Vl0,I_7,IZ5,NZ5=C1(()=>{yF4();qU1();If();Vl0="kimi_k2_7_code",I_7={id:Vl0,name:Vl0,model:Vl0,description:null};IZ5={name:"onboardingApiClamp",decorate(e,t){if(t.sessionMetadata?.isOnboarding!==!0)return e;let r=Fn0(e);r.context=U_7(r.context),r.skillsPreamble="";let a=G_7(e);return a&&(r.operatingModel=a),r}}});function GZ5(e,t,r){_l0=e,Pl0=t,El0=r;let a=UZ5;UZ5=[];for(let i of a)i()}function rM(){if(!Pl0)throw new Error("ServiceAccessor not initialized: frameworkServices");return Pl0}function Rl0(){if(!_l0)throw new Error("ServiceAccessor not initialized: services");return _l0}function j_7(){if(!El0)throw new Error("ServiceAccessor not initialized: frameworkId");return El0}function Zl0(e,t){tE1.set(e,t)}function jZ5(e){tE1.delete(e)}function J_(e){return tE1.get(e)?.frameworkServices??rM()}function G91(e){return tE1.get(e)?.services??Rl0()}function j91(e){return tE1.get(e)?.frameworkId??j_7()}function Fl0(e){return tE1.get(e)?.autoExecuteTools??!1}var Pl0,_l0,El0,UZ5,tE1,l61=C1(()=>{Pl0=import.meta.hot?.data?._frameworkServices,_l0=import.meta.hot?.data?._services,El0=import.meta.hot?.data?._frameworkId,UZ5=[];tE1=import.meta.hot?.data?._sessionServices??new Map;import.meta.hot&&import.meta.hot.dispose(e=>{e._frameworkServices=Pl0,e._services=_l0,e._frameworkId=El0,e._sessionServices=tE1})});var Fa,Ol0,Dl0,GO,W_7,q_7,$_7,K_7,Y_7,X_7,J_7,Q_7,tE7,eE7,rE7,aE7,iE7,nE7,oE7,lE7,Il0,Nl0=C1(()=>{"use strict";Fa=w4(li()),Ol0=Fa.z.enum(["maximum","recommended","unrestricted"]),Dl0=Fa.z.discriminatedUnion("kind",[Fa.z.object({kind:Fa.z.literal("uipath_user"),tenantId:Fa.z.string(),userId:Fa.z.string()}),Fa.z.object({kind:Fa.z.literal("slack_user"),workspaceId:Fa.z.string(),userId:Fa.z.string()}),Fa.z.object({kind:Fa.z.literal("service"),serviceId:Fa.z.string()}),Fa.z.object({kind:Fa.z.literal("job"),correlationId:Fa.z.string()})]),GO=Fa.z.object({v:Fa.z.literal(1),id:Fa.z.string().optional(),ref:Fa.z.string().optional(),type:Fa.z.string(),ts:Fa.z.string()}),W_7=GO.extend({type:Fa.z.literal("chat.create"),id:Fa.z.string(),kind:Fa.z.enum(["chat","job"]).optional(),securityMode:Ol0.optional(),requester:Dl0.optional()}),q_7=GO.extend({type:Fa.z.literal("chat.send"),id:Fa.z.string(),ref:Fa.z.string(),payload:Fa.z.string()}),$_7=GO.extend({type:Fa.z.literal("chat.decision"),id:Fa.z.string(),ref:Fa.z.string(),executionId:Fa.z.string(),choice:Fa.z.enum(["accept","reject"])}),K_7=GO.extend({type:Fa.z.literal("chat.end"),id:Fa.z.string(),ref:Fa.z.string()}),Y_7=GO.extend({type:Fa.z.literal("job.submit"),id:Fa.z.string(),payload:Fa.z.unknown(),securityMode:Ol0.optional(),requester:Dl0.optional()}),X_7=GO.extend({type:Fa.z.literal("job.cancel"),id:Fa.z.string(),ref:Fa.z.string()}),J_7=GO.extend({type:Fa.z.literal("resume"),id:Fa.z.string(),ref:Fa.z.string()}),Q_7=GO.extend({type:Fa.z.literal("ping"),id:Fa.z.string()}),tE7=GO.extend({type:Fa.z.literal("ack"),id:Fa.z.string(),ref:Fa.z.string().optional(),snapshot:Fa.z.unknown().optional()}),eE7=GO.extend({type:Fa.z.literal("error"),code:Fa.z.enum(["bad_request","unauthenticated","forbidden","no_pool_for_request","capacity_exceeded","session_not_found","session_not_ready","worker_boot_failed","frame_too_large","unsupported_type","internal_error"]),message:Fa.z.string()}),rE7=GO.extend({type:Fa.z.literal("chat.output"),ref:Fa.z.string(),chunk:Fa.z.unknown()}),aE7=GO.extend({type:Fa.z.literal("chat.decision.request"),ref:Fa.z.string(),executionId:Fa.z.string(),toolName:Fa.z.string(),args:Fa.z.record(Fa.z.unknown())}),iE7=GO.extend({type:Fa.z.literal("chat.ended"),ref:Fa.z.string(),reason:Fa.z.string()}),nE7=GO.extend({type:Fa.z.literal("job.state"),ref:Fa.z.string(),state:Fa.z.enum(["accepted","running","completed","failed","canceled"]),detail:Fa.z.unknown().optional()}),oE7=GO.extend({type:Fa.z.literal("job.deliverable"),ref:Fa.z.string(),attachmentUri:Fa.z.string(),expiresAt:Fa.z.string()}),lE7=GO.extend({type:Fa.z.literal("pong"),id:Fa.z.string()}),Il0=Fa.z.discriminatedUnion("type",[W_7,q_7,$_7,K_7,Y_7,X_7,J_7,Q_7,tE7,eE7,rE7,aE7,iE7,nE7,oE7,lE7])});var ux2,LI4=C1(()=>{"use strict";Nl0();ux2={NORMAL:1e3,POLICY_VIOLATION:1008,INTERNAL_ERROR:1011,AUTH_EXPIRED:4401,FRAME_TOO_LARGE:4413,CAPACITY_EXCEEDED_CONNECTION:4429}});var wI4,yI4=C1(()=>{"use strict";wI4="uipath-delegate.v1"});function OL1(){let e=globalThis.crypto;return e?.randomUUID?e.randomUUID():Math.random().toString(36).slice(2,10)+Math.random().toString(36).slice(2,10)}var FL1,Vb,x12,Ul0=C1(()=>{"use strict";Nl0();LI4();yI4();FL1=class extends Error{constructor(t,r){super(`WS transport closed (code=${t}): ${r}`),this.name="TransportClosedError",this.code=t,this.closeReason=r}},Vb=class extends Error{constructor(t,r,a){super(r),this.name="RemoteError",this.code=t,this.ref=a}},x12=class{constructor(t){this.state="idle";this.ws=null;this.reconnectAttempt=0;this.explicitDisconnect=!1;this.connectInFlight=null;this.pingTimer=null;this.deadlineTimer=null;this.reconnectTimer=null;this.lastInboundAt=0;this.gaveUp=!1;this.pending=new Map;this.frameListeners=new Set;this.closeListeners=new Set;this.openListeners=new Set;this.unknownFrameListeners=new Set;let r=t.webSocketCtor??globalThis.WebSocket;if(r===void 0)throw new Error('WsClient: no WebSocket constructor available. Pass options.webSocketCtor \u2014 in Node use `import WebSocket from "ws"; new WsClient({ webSocketCtor: WebSocket as never, \u2026 })`.');this.opts={url:t.url,getToken:t.getToken,webSocketCtor:r,pingIntervalMs:t.pingIntervalMs??3e4,inactivityDeadlineMs:t.inactivityDeadlineMs??6e4,reconnect:t.reconnect??!0,reconnectMinMs:t.reconnectMinMs??1e3,reconnectMaxMs:t.reconnectMaxMs??3e4,reconnectMaxAttempts:t.reconnectMaxAttempts??20,onGiveUp:t.onGiveUp,logger:t.logger??{warn:(...a)=>console.warn(...a),error:(...a)=>console.error(...a)},now:t.now??Date.now,setTimeoutFn:t.setTimeoutFn??setTimeout.bind(globalThis),clearTimeoutFn:t.clearTimeoutFn??clearTimeout.bind(globalThis)}}async connect(){if(this.state!=="open")return this.connectInFlight!==null?this.connectInFlight:(this.explicitDisconnect=!1,this.gaveUp=!1,this.openOnce())}disconnect(t=ux2.NORMAL,r="client disconnect"){if(this.explicitDisconnect=!0,this.cancelReconnect(),this.cancelTimers(),this.state==="open"||this.state==="connecting"){this.state="closing";try{this.ws?.close(t,r)}catch{}}this.failPending(new FL1(t,r))}send(t){if(this.state!=="open"||this.ws===null)throw new FL1(0,"WS not open");this.ws.send(JSON.stringify(t))}request(t){return new Promise((r,a)=>{this.pending.set(t.id,{resolve:r,reject:a,frameType:t.type});try{this.send(t)}catch(i){this.pending.delete(t.id),a(i)}})}onFrame(t){return this.frameListeners.add(t),()=>this.frameListeners.delete(t)}onClose(t){return this.closeListeners.add(t),()=>this.closeListeners.delete(t)}onOpen(t){return this.openListeners.add(t),()=>this.openListeners.delete(t)}onUnknownFrame(t){return this.unknownFrameListeners.add(t),()=>this.unknownFrameListeners.delete(t)}getState(){return this.state}openOnce(){this.state="connecting";let t=(async()=>{let r;try{r=await this.opts.getToken()}catch(a){throw this.state="closed",a}if(this.explicitDisconnect)throw this.state="closed",new FL1(ux2.NORMAL,"connect aborted by disconnect");return new Promise((a,i)=>{let n=!1,o=this.opts.webSocketCtor,h;try{h=new o(this.opts.url,[wI4],{headers:{Authorization:`Bearer ${r}`}})}catch(u){this.state="closed",i(u);return}this.ws=h,h.addEventListener("open",()=>{this.state="open",this.reconnectAttempt=0,this.lastInboundAt=this.opts.now(),this.armHeartbeat();for(let u of this.openListeners)try{u()}catch(g){this.opts.logger.warn("[WsClient] onOpen handler threw:",g)}n||(n=!0,a())}),h.addEventListener("message",u=>{this.lastInboundAt=this.opts.now(),this.handleMessage(u.data)}),h.addEventListener("close",u=>{let g=this.state==="connecting";this.state="closed",this.cancelTimers(),this.failPending(new FL1(u.code,u.reason));for(let f of this.closeListeners)try{f({code:u.code,reason:u.reason})}catch(v){this.opts.logger.warn("[WsClient] onClose handler threw:",v)}if(g&&!n){n=!0,i(new FL1(u.code,u.reason));return}!this.explicitDisconnect&&this.opts.reconnect&&this.scheduleReconnect(u.reason)}),h.addEventListener("error",()=>{})})})();return this.connectInFlight=t,t.catch(()=>{}).finally(()=>{this.connectInFlight===t&&(this.connectInFlight=null)}),t}handleMessage(t){if(typeof t!="string"){this.opts.logger.warn("[WsClient] dropping non-string frame");return}let r;try{r=JSON.parse(t)}catch{this.opts.logger.warn("[WsClient] dropping non-JSON frame");return}let a=Il0.safeParse(r);if(!a.success){this.opts.logger.warn("[WsClient] dropping schema-invalid frame",a.error.issues[0]?.message);let n=r?.type;for(let o of this.unknownFrameListeners)try{o({raw:r,type:typeof n=="string"?n:void 0})}catch(h){this.opts.logger.warn("[WsClient] onUnknownFrame handler threw:",h)}return}let i=a.data;if(i.type==="ping"){this.send({v:1,id:i.id,type:"pong",ts:new Date().toISOString()});return}if(i.type==="ack"&&i.id!==void 0){let n=this.pending.get(i.id);n!==void 0&&(this.pending.delete(i.id),n.resolve(i))}else if(i.type==="error"&&i.id!==void 0){let n=this.pending.get(i.id);n!==void 0&&(this.pending.delete(i.id),n.reject(new Vb(i.code,i.message,i.ref)))}for(let n of this.frameListeners)try{n(i)}catch(o){this.opts.logger.warn("[WsClient] onFrame handler threw:",o)}}armHeartbeat(){this.cancelTimers();let t=()=>{if(this.state==="open"){if(this.opts.now()-this.lastInboundAt>this.opts.inactivityDeadlineMs){try{this.ws?.close(ux2.INTERNAL_ERROR,"inactivity deadline")}catch{}return}try{this.send({v:1,id:OL1(),type:"ping",ts:new Date().toISOString()})}catch{return}this.pingTimer=this.opts.setTimeoutFn(t,this.opts.pingIntervalMs)}};this.pingTimer=this.opts.setTimeoutFn(t,this.opts.pingIntervalMs)}cancelTimers(){this.pingTimer!==null&&(this.opts.clearTimeoutFn(this.pingTimer),this.pingTimer=null),this.deadlineTimer!==null&&(this.opts.clearTimeoutFn(this.deadlineTimer),this.deadlineTimer=null)}scheduleReconnect(t=""){if(this.gaveUp)return;if(this.reconnectAttempt++,this.reconnectAttempt>this.opts.reconnectMaxAttempts){this.gaveUp=!0;let n=this.opts.onGiveUp;if(n!==void 0)try{n({attempts:this.reconnectAttempt-1,lastReason:t})}catch(o){this.opts.logger.warn("[WsClient] onGiveUp handler threw:",o)}return}let r=Math.min(this.opts.reconnectMaxMs,this.opts.reconnectMinMs*2**(this.reconnectAttempt-1)),a=Math.floor(this.opts.reconnectMinMs/2),i=a+Math.floor(Math.random()*Math.max(1,r-a));this.reconnectTimer=this.opts.setTimeoutFn(()=>{this.reconnectTimer=null,this.openOnce().catch(n=>{if(this.reconnectTimer===null&&!this.explicitDisconnect&&this.opts.reconnect){let o=n instanceof Error?n.message:"pre-socket failure";this.scheduleReconnect(o)}})},i)}cancelReconnect(){this.reconnectTimer!==null&&(this.opts.clearTimeoutFn(this.reconnectTimer),this.reconnectTimer=null),this.reconnectAttempt=0}failPending(t){for(let[,r]of this.pending)try{r.reject(t)}catch(a){this.opts.logger.warn("[WsClient] pending.reject threw:",a)}this.pending.clear()}}});function gx2(e){if(e instanceof Vb)switch(e.code){case"capacity_exceeded":throw new eE1(e.message,e.ref);case"session_not_found":throw new ld1(e.message,e.ref);case"no_pool_for_request":throw new rE1(e.message,e.ref);case"bad_request":throw new px2(e.message,e.ref);case"unauthenticated":throw new fx2(e.message,e.ref);case"forbidden":throw new vx2(e.message,e.ref);case"session_not_ready":throw new mx2(e.message,e.ref);case"worker_boot_failed":throw new Cx2(e.message,e.ref);case"frame_too_large":throw new Mx2(e.message,e.ref);case"unsupported_type":throw new xx2(e.message,e.ref);case"internal_error":throw new Lx2(e.message,e.ref);default:throw e}throw e}var eE1,ld1,rE1,px2,fx2,vx2,mx2,Cx2,Mx2,xx2,Lx2,wx2,aE1,AI4=C1(()=>{"use strict";Ul0();eE1=class extends Vb{constructor(t,r){super("capacity_exceeded",t,r),this.name="CapacityExceededError"}},ld1=class extends Vb{constructor(t,r){super("session_not_found",t,r),this.name="SessionNotFoundError"}},rE1=class extends Vb{constructor(t,r){super("no_pool_for_request",t,r),this.name="NoPoolForRequestError"}},px2=class extends Vb{constructor(t,r){super("bad_request",t,r),this.name="BadRequestError"}},fx2=class extends Vb{constructor(t,r){super("unauthenticated",t,r),this.name="UnauthenticatedError"}},vx2=class extends Vb{constructor(t,r){super("forbidden",t,r),this.name="ForbiddenError"}},mx2=class extends Vb{constructor(t,r){super("session_not_ready",t,r),this.name="SessionNotReadyError"}},Cx2=class extends Vb{constructor(t,r){super("worker_boot_failed",t,r),this.name="WorkerBootFailedError"}},Mx2=class extends Vb{constructor(t,r){super("frame_too_large",t,r),this.name="FrameTooLargeError"}},xx2=class extends Vb{constructor(t,r){super("unsupported_type",t,r),this.name="UnsupportedTypeError"}},Lx2=class extends Vb{constructor(t,r){super("internal_error",t,r),this.name="InternalServerError"}};wx2="Cloud desktops are at capacity, try again in a minute.",aE1=class{constructor(t){this.outputListeners=new Set;this.decisionRequestListeners=new Set;this.endedListeners=new Set;this.phaseChangeListeners=new Set;this.detachFrameListener=null;this.client=t,this.detachFrameListener=this.client.onFrame(r=>this.handleFrame(r))}get ref(){return this._ref}get phase(){return this._phase}async createChat(t={}){if(this._ref!==void 0)throw new Error(`RunnerSession already attached to ref=${this._ref}; create a new instance for another session`);let r=OL1(),a;try{a=await this.client.request({v:1,id:r,type:"chat.create",ts:new Date().toISOString(),...t.securityMode!==void 0?{securityMode:t.securityMode}:{},...t.requester!==void 0?{requester:t.requester}:{}})}catch(i){gx2(i)}if(a.ref===void 0)throw console.warn("[RunnerSession] chat.create ack without ref \u2014 server-side session leak",{id:r}),new Error("runner ack to chat.create did not carry a ref");return this._ref=a.ref,{ref:a.ref}}async resume(t){if(this._ref!==void 0&&this._ref!==t.ref)throw new Error(`RunnerSession already attached to ref=${this._ref}; cannot resume a different ref`);let r=OL1(),a;try{a=await this.client.request({v:1,id:r,ref:t.ref,type:"resume",ts:new Date().toISOString()})}catch(n){gx2(n)}this._ref=t.ref;let i=a.snapshot;if(i!==void 0&&i.kind==="chat"){this._phase=i.phase;for(let n of this.phaseChangeListeners)try{n(i.phase,t.ref)}catch(o){console.warn("[RunnerSession] onPhaseChange threw:",o)}}return{snapshot:i}}async send(t){let r=this.requireRef("send"),a=OL1();try{await this.client.request({v:1,id:a,ref:r,type:"chat.send",ts:new Date().toISOString(),payload:t})}catch(i){gx2(i)}}async decide(t){let r=this.requireRef("decide"),a=OL1();try{await this.client.request({v:1,id:a,ref:r,type:"chat.decision",ts:new Date().toISOString(),executionId:t.executionId,choice:t.choice})}catch(i){gx2(i)}}async end(){let t=this.requireRef("end"),r=OL1();return new Promise((i,n)=>{let o=!1,h=f=>{o||(o=!0,u(),g(),f())},u=this.client.onFrame(f=>{if(f.type==="ack"&&f.id===r)h(()=>i());else if(f.type==="error"&&f.id===r){let v=f;h(()=>n(new Vb(v.code,v.message,v.ref)))}else f.type==="chat.ended"&&f.ref===t&&h(()=>i())}),g=this.client.onClose(f=>{h(()=>n(new Vb("internal_error",`transport closed before chat.ended (code=${f.code}: ${f.reason})`,t)))});try{this.client.send({v:1,id:r,ref:t,type:"chat.end",ts:new Date().toISOString()})}catch(f){h(()=>n(f))}}).finally(()=>{this._ref=void 0}).catch(gx2)}onOutput(t){return this.outputListeners.add(t),()=>this.outputListeners.delete(t)}onDecisionRequest(t){return this.decisionRequestListeners.add(t),()=>this.decisionRequestListeners.delete(t)}onEnded(t){return this.endedListeners.add(t),()=>this.endedListeners.delete(t)}onPhaseChange(t){return this.phaseChangeListeners.add(t),()=>this.phaseChangeListeners.delete(t)}dispose(){this.detachFrameListener!==null&&(this.detachFrameListener(),this.detachFrameListener=null),this.outputListeners.clear(),this.decisionRequestListeners.clear(),this.endedListeners.clear(),this.phaseChangeListeners.clear()}handleFrame(t){let r=t.ref;if(!(r===void 0||r!==this._ref))switch(t.type){case"chat.output":{let a=t;for(let i of this.outputListeners)try{i(a.chunk,a.ref)}catch(n){console.warn("[RunnerSession] onOutput threw:",n)}return}case"chat.decision.request":{let a=t;for(let i of this.decisionRequestListeners)try{i({executionId:a.executionId,toolName:a.toolName,args:a.args},a.ref)}catch(n){console.warn("[RunnerSession] onDecisionRequest threw:",n)}return}case"chat.ended":{let a=t;for(let i of this.endedListeners)try{i(a.reason,a.ref)}catch(n){console.warn("[RunnerSession] onEnded threw:",n)}return}default:return}}requireRef(t){if(this._ref===void 0)throw new Error(`RunnerSession.${t}() requires an attached session; call createChat() or resume() first`);return this._ref}}});var WZ5=C1(()=>{"use strict";Ul0();AI4()});var zI4=C1(()=>{"use strict";Ul0();AI4();WZ5();Nl0();LI4();yI4()});var qZ5,$Z5,KZ5=C1(()=>{qZ5=w4(Lu(),1),$Z5=(0,qZ5.create)(e=>({cards:{},ensureCard:(t,r)=>e(a=>a.cards[t]?a:{cards:{...a.cards,[t]:{expanded:r,userInteracted:!1}}}),toggle:t=>e(r=>{let a=r.cards[t]??{expanded:!1,userInteracted:!1};return{cards:{...r.cards,[t]:{expanded:!a.expanded,userInteracted:!0}}}}),autoCollapse:t=>e(r=>{let a=r.cards[t];return!a||a.userInteracted||!a.expanded?r:{cards:{...r.cards,[t]:{...a,expanded:!1}}}}),removeCards:t=>e(r=>{if(t.length===0)return r;let a=new Set(t),i=Object.entries(r.cards).filter(([n])=>!a.has(n));return i.length===Object.keys(r.cards).length?r:{cards:Object.fromEntries(i)}})}))});function YZ5(e,t,r,a){let i=[],n=[];if(!e||e.length===0)return{toPreload:i,toEvict:n};let o=new Set(t.map(u=>u.name)),h=new Set(a);for(let u of e){if(!o.has(u)){n.push(u);continue}h.has(u)||r[u]!==!1&&i.push(u)}return{toPreload:i,toEvict:n}}var XZ5=C1(()=>{});var JZ5,KT,L12=C1(()=>{JZ5=w4(Lu(),1);wd();KT=(0,JZ5.create)((e,t)=>({pendingElevations:{},sandboxDisabledSessionIds:new Set,foregroundControlAllowedSessionIds:new Set,unrestrictedSessionIds:new Set,pendingNewChatUnrestricted:!1,addPending:(r,a,i)=>e(n=>({pendingElevations:{...n.pendingElevations,[r]:{request:a,resolve:i}}})),removePending:r=>e(a=>{let{[r]:i,...n}=a.pendingElevations;return{pendingElevations:n}}),resolvePending:(r,a)=>{let i=t().pendingElevations[r];i&&(t().removePending(r),i.resolve(a))},disableSandboxForSession:(r,a)=>{let i=new Set(t().sandboxDisabledSessionIds);i.add(a),e({sandboxDisabledSessionIds:i});let n=t().pendingElevations[r];n&&(t().removePending(r),n.resolve(!0))},allowForegroundControlForSession:(r,a)=>{let i=new Set(t().foregroundControlAllowedSessionIds);i.add(a),e({foregroundControlAllowedSessionIds:i});let n=t().pendingElevations[r];n&&(t().removePending(r),n.resolve(!0))},isSandboxDisabledForSession:r=>t().sandboxDisabledSessionIds.has(r),isForegroundControlAllowedForSession:r=>t().foregroundControlAllowedSessionIds.has(r),setSandboxDisabledForSession:(r,a)=>{let i=new Set(t().sandboxDisabledSessionIds);a?i.add(r):i.delete(r),e({sandboxDisabledSessionIds:i})},setUnrestrictedForSession:(r,a)=>{let i=new Set(t().unrestrictedSessionIds);a?i.add(r):i.delete(r),e({unrestrictedSessionIds:i})},isUnrestrictedForSession:r=>t().unrestrictedSessionIds.has(r),isSandboxDisabledForSessionOrAncestor:r=>{let a=t().sandboxDisabledSessionIds;return(st.getState().selectSessionAncestry?.(r)??[r]).some(n=>a.has(n))},isForegroundControlAllowedForSessionOrAncestor:r=>{let a=t().foregroundControlAllowedSessionIds;return(st.getState().selectSessionAncestry?.(r)??[r]).some(n=>a.has(n))},isUnrestrictedForSessionOrAncestor:r=>{let a=t().unrestrictedSessionIds;return(st.getState().selectSessionAncestry?.(r)??[r]).some(n=>a.has(n))},setPendingNewChatUnrestricted:r=>{e({pendingNewChatUnrestricted:r})},consumePendingNewChatUnrestricted:()=>{let r=t().pendingNewChatUnrestricted;return r&&e({pendingNewChatUnrestricted:!1}),r},clearForSession:r=>{let{unrestrictedSessionIds:a,sandboxDisabledSessionIds:i,foregroundControlAllowedSessionIds:n}=t(),o=a.has(r),h=i.has(r),u=n.has(r);if(!o&&!h&&!u)return;let g=o?new Set(a):a;o&&g.delete(r);let f=h?new Set(i):i;h&&f.delete(r);let v=u?new Set(n):n;u&&v.delete(r),e({unrestrictedSessionIds:g,sandboxDisabledSessionIds:f,foregroundControlAllowedSessionIds:v})}}))});var aF5={};qr(aF5,{getAuthProfile:()=>TI4,getChatHistoryStore:()=>w12,getProjectStore:()=>aM,registerAuthProfile:()=>HI4,registerChatHistoryStore:()=>SI4,registerProjectStore:()=>bI4,registerSessionShellAppResolver:()=>kI4,resolveSessionShellApp:()=>yx2});function bI4(e){QZ5=e}function SI4(e){tF5=e}function HI4(e){eF5=e}function kI4(e){rF5=e}function aM(){return QZ5?.()??null}function w12(){return tF5?.()??null}function TI4(){return eF5?.()??null}function yx2(e){return rF5?.(e)??null}var QZ5,tF5,eF5,rF5,jO=C1(()=>{QZ5=null,tF5=null,eF5=null,rF5=null});function BI4(e,t){if(typeof e=="string"){if(e==="power_user")return T5.RECOMMENDED;if(e===T5.MAXIMUM||e===T5.RECOMMENDED||e===T5.UNRESTRICTED)return e;if(e===T5.ADAPTIVE){let r=t!==void 0?t:SS5();return wE4(r)?T5.ADAPTIVE:void 0}}}function Gl0(e){if(!e)return;let t=aM();if(!t)return;let a=(st.getState().selectSessionAncestry?.(e)??[e]).find(n=>t.taskProjectMap[n]);if(!a)return;let i=t.projects.find(n=>n.id===t.taskProjectMap[a]);return BI4(i?.metadata?.securityMode)}function cd1(e,t){let r=Gl0(e);return r?M91[r].executionPolicy:t}function iF5(e,t){return Gl0(e)??t}var iE1=C1(()=>{wd();jO();Q11();fQ1()});function Ax2(e){return e.requiresUiAutomation===!0||e.capabilityCategory==="screen"}function PI4(e,t=!1){return e.capabilityCategory==="mcp"||t}function uE7(e){try{return new URL(e,"https://delegate.invalid").pathname.toLowerCase()}catch{return e.split(/[?#]/,1)[0].toLowerCase()}}function gE7(e){if(!e)return!1;let t=uE7(e).replace(/^\/+/,"");return dE7.some(r=>t===r||t.startsWith(`${r}/`))}function nF5(e,t){if(e==="ExecuteSkillApi"){let r=t.operations,a=r;if(typeof r=="string")try{a=JSON.parse(r)}catch{return!1}return Array.isArray(a)?a.some(i=>{if(!i||typeof i!="object")return!1;let n=i.endpoint;return typeof n=="string"&&gE7(n)}):!1}return!1}var hE7,dE7,VI4,Ox,DL1=C1(()=>{z_1();hE7=!0,dE7=["computer-act","computer-state","cursor","recorder",yv.validateUia.replace(/^\/+/,""),"screenshot","ui-scripting"];VI4=class{constructor(t){this.options=t}decide(t,r){return this.isRestricted(r)?t==="mcp"?this.options.mcpEnabled?"allow":"deny":t==="screen-observation"||t==="execution-approval"||t==="elevation"||t==="host-discovery"?"deny":"allow":"allow"}isRestricted(t){return t?.accessMode==="project_restricted"}canExposeTool(t,r,a=!1){return!(Ax2(t)&&this.decide("screen-observation",r)==="deny"||PI4(t,a)&&this.decide("mcp",r)==="deny"||t.restrictedCapability==="host-discovery"&&this.decide("host-discovery",r)==="deny")}constrainExecutionDecision(t,r){return t==="ask"&&this.decide("execution-approval",r)==="deny"?"deny":t}promptGuidance(t){if(!this.isRestricted(t))return;let r=[...new Set(t?.grantSources?t.grants.filter(i=>Object.prototype.hasOwnProperty.call(t.grantSources,i.id)).map(i=>i.path):[])];return["This is a restricted project turn. Local access is fixed by the immutable turn policy.","Use only the allowed paths below and use ListAccessibleFiles to discover accessible user-data files; do not probe arbitrary locations.",r.length>0?r.map(i=>`- ${i}`).join(`
|
|
10000
10000
|
`):"- None","In restricted sandbox mode, edit exact-file resources in place: deleting one may prevent you from recreating it.","General UI automation, UI scripting, computer-state inspection, and screenshots are unavailable.","Word, Excel, and PowerPoint document endpoints are the exception: they may activate their app and move its window.","Operations that require user execution approval, credential injection, OS permission, or elevation are denied. Adapt after a denial instead of retrying the same operation.","Terminal and local code run in the project sandbox. Executables already reachable inside that sandbox may be used.","Restricted terminal runs a minimal runtime (Windows: inbox PowerShell 5.1, no PS7 module-backed cmdlets). If a command or runtime is unavailable, use an in-sandbox alternative.","MCP, skills, plugins, connector authentication, business choices, and normal clarification questions remain available. MCP servers are an external trust boundary and may not share the local project sandbox."].join(`
|
|
10001
10001
|
`)}},Ox=new VI4({mcpEnabled:hE7})});function jl0(e){c61=e}function kh(e){return c61?.getSnapshot(e)}function Wl0(e){return c61?.getRootTurnId?.(e)}function DV(e){return c61?.getOwnerSessionId?.(e)}async function ql0(e){return c61?.beginRootTurn?await c61.beginRootTurn(e):{kind:"denied",code:"missing_snapshot",retryable:!0,message:"Turn policy coordinator is not initialized"}}async function oF5(e,t){await c61?.endRootTurn?.(e,t)}async function $l0(e,t){return c61?.runWithTransientSnapshot?await c61.runWithTransientSnapshot(e,t):await t({kind:"denied",code:"missing_snapshot",retryable:!0,message:"Turn policy coordinator is not initialized"})}function lF5(){c61=void 0}function sd1(){return c61!==void 0}var c61,uz=C1(()=>{});function cF5(e){let t=KT.getState(),r=kh?.(e),a=Ox?.isRestricted?.(r)===!0,i=t.isUnrestrictedForSessionOrAncestor??t.isUnrestrictedForSession;if(!a&&typeof i=="function"&&i(e))return"unrestricted";let n=pQ1();switch(cd1(e,n)){case"ask_always":return"maximum";case"run_everything":return a?"recommended":"unrestricted";case"smart":return"recommended";case"adaptive":return"recommended"}}var sF5=C1(()=>{L12();fQ1();iE1();DL1();uz()});function pE7(e){return cF5(e)}function Kl0(e){return{sessionId:e,permissionMode:pE7(e)}}function zx2(e,t){return{...Kl0(e),turnId:t}}function bx2(e,t,r){let a={...Kl0(e),toolUseId:t.id,toolName:t.name,toolInput:t.args};return r.source==="manual"?{...a,invocationSource:"manual"}:r.source==="agent"?{...a,invocationSource:"agent",turnId:r.turnId}:{...a,invocationSource:"nonAgent"}}var Sx2=C1(()=>{sF5()});function hF5(e){return e?e.title_summarization_disabled===!0||e.isOnboarding===!0:!1}function dF5(e){return e?.imported_source!=null}function vE7(e,t,r){if(!e)return t;let a=r?.imported_at;if(typeof a!="string")return e;let i=Date.parse(a),n=Date.parse(t);return Number.isNaN(i)||Number.isNaN(n)?e:n>i+fE7?t:e}function uF5(e,t){let r=Date.parse(e.timestamp),a=Date.parse(t.timestamp);return(Number.isNaN(a)?0:a)-(Number.isNaN(r)?0:r)}async function mE7(){if(typeof window>"u"||!window.settingsApi)return new Set;try{let e=await window.settingsApi.get();return new Set(e?.pinnedConversationIds??[])}catch{return new Set}}function gF5(e){if(typeof window>"u"||!window.settingsApi)return;let t=e.filter(r=>r.pinned).map(r=>r.id);window.settingsApi.updatePartial({pinnedConversationIds:t}).catch(r=>{console.error("[chatHistoryStore] Failed to save pinned IDs:",r)})}function CE7(e){return Array.isArray(e)?new Set(e):e instanceof Set?e:new Set}var _I4,Yl0,fE7,pF5,Au,s61=C1(()=>{_I4=w4(Lu()),Yl0=w4(vW());wu();Dh1();iY();jO();fE7=300*1e3;pF5=(e,t)=>({history:[],historyOpen:!1,manuallyRenamed:new Set,setHistory:r=>{let a=new Map(t().history.map(o=>[o.id,o])),i=t().manuallyRenamed??new Set,n=r.map(o=>{let h=a.get(o.id),u=i.has(o.id)||hF5(o.metadata)||hF5(h?.metadata),g=dF5(o.metadata)||dF5(h?.metadata);return{...o,name:u&&h?.name?h.name:o.name,timestamp:g?vE7(h?.timestamp,o.timestamp,{...h?.metadata,...o.metadata}):o.timestamp,project_id:o.project_id??h?.project_id,pinned:o.pinned??h?.pinned??!1,runner_mode:o.runner_mode??h?.runner_mode,remote_ref:o.remote_ref??h?.remote_ref,metadata:{...h?.metadata,...o.metadata}}});n.sort(uF5),e({history:n}),mE7().then(o=>{if(o.size===0)return;let h=t().history.map(u=>({...u,pinned:o.has(u.id)||u.pinned||!1}));e({history:h})})},getHistory:()=>t().history,clearHistory:()=>e({history:[]}),setHistoryOpen:r=>e({historyOpen:r}),togglePin:r=>{let i=t().history.map(n=>n.id===r?{...n,pinned:!n.pinned}:n);e({history:i}),gF5(i)},addToHistory:r=>{let a=t().history;a.some(i=>i.id===r.id)||e({history:[r,...a].sort(uF5)})},renameConversation:(r,a)=>{let n=t().history.map(o=>o.id===r?{...o,name:a}:o);e({history:n})},markManuallyRenamed:r=>{let a=t().manuallyRenamed??new Set,i=new Set(a);i.add(r),e({manuallyRenamed:i})},isManuallyRenamed:r=>t().manuallyRenamed?.has(r)??!1,deleteFromHistory:r=>{let i=t().history.filter(n=>n.id!==r);e({history:i}),gF5(i)},clearProjectIds:r=>{let i=t().history.map(n=>r.has(n.id)?{...n,project_id:null}:n);e({history:i})},updateChatMetadata:(r,a)=>{let n=t().history.map(o=>o.id===r?{...o,metadata:{...o.metadata,...a}}:o);e({history:n})},findById:r=>t().history.find(a=>a.id===r),hasFixedTitle:r=>{let i=t().history.find(n=>n.id===r)?.metadata;return i?.title_summarization_disabled===!0||i?.isOnboarding===!0}});Au=Fx.persistStore&&!xn?(0,_I4.create)()((0,Yl0.persist)(pF5,{name:"chat-history",storage:(0,Yl0.createJSONStorage)(()=>DO),partialize:e=>({history:e.history,historyOpen:e.historyOpen,manuallyRenamed:Array.from(e.manuallyRenamed??new Set)}),merge:(e,t)=>{let r=e;return{...t,...r,manuallyRenamed:CE7(r.manuallyRenamed)}}})):(0,_I4.create)()(pF5);lz(Au,"chat-history-sync");SI4(()=>Au.getState())});var EI4,J4,bp,IV=C1(()=>{EI4=0,J4=e=>(EI4+=e,new Date(Date.now()-EI4*1e3)),bp=()=>{EI4=0}});var Q_,ME7,xE7,LE7,wE7,yE7,AE7,zE7,bE7,SE7,HE7,kE7,TE7,BE7,VE7,Hx2,RI4=C1(()=>{IV();Q_={WORD:"mock-agent-word",EXCEL:"mock-agent-excel",PPT:"mock-agent-ppt",PDF:"mock-agent-pdf",OUTLOOK:"mock-agent-outlook",TEAMS:"mock-agent-teams",SLACK:"mock-agent-slack",SALESFORCE:"mock-agent-salesforce",GOOGLE:"mock-agent-google"},ME7={[Q_.WORD]:[{id:"word-msg-1",type:"ai",content:"Starting document analysis..."},{id:"word-msg-2",type:"ai",content:"Document has 15 pages, 3 sections, and 2 appendices."}],[Q_.EXCEL]:[{id:"excel-msg-1",type:"ai",content:JSON.stringify({thought:"I need to analyze the sales data. Let me read the spreadsheet first.",current_task:"Analyzing sales patterns"}),widget:"thoughtRenderer"},{id:"excel-msg-2",type:"ai",content:JSON.stringify({executionId:"nested-excel-read",toolName:"ExcelReadRange",toolHeader:"Read Excel Range",status:"completed",args:{range:"A1:D100",sheet:"Sales"},response:{rows:100,columns:4}}),widget:"cardRenderer"},{id:"excel-msg-3",type:"ai",content:"Found 100 sales records with total revenue of $1.2M."},{id:"excel-msg-4",type:"ai",content:"Thinking...",widget:"thinking-spinner"}],[Q_.PPT]:[{id:"ppt-msg-1",type:"ai",content:"Creating presentation with Q4 results..."},{id:"ppt-msg-2",type:"ai",content:"Added 5 slides: Title, Revenue, Growth, Highlights, Summary."}],[Q_.PDF]:[{id:"pdf-msg-1",type:"ai",content:"Reading contract PDF..."},{id:"pdf-msg-2",type:"ai",content:"Extracted 15 pages of text. Key sections: Terms, Conditions, Signatures."}],[Q_.OUTLOOK]:[{id:"outlook-msg-1",type:"ai",content:"Preparing email draft..."},{id:"outlook-msg-2",type:"ai",content:"Thinking...",widget:"thinking-spinner"}],[Q_.TEAMS]:[{id:"teams-msg-1",type:"ai",content:"Reading the engineering update..."},{id:"teams-msg-2",type:"ai",content:JSON.stringify({executionId:"nested-review-read",toolName:"ReadFile",toolHeader:"Read File",status:"completed",args:{path:"engineering-update.md"},response:{success:!0}}),widget:"cardRenderer"},{id:"teams-msg-3",type:"ai",content:"Review complete. Document looks good with minor suggestions."}],[Q_.SLACK]:[{id:"slack-msg-1",type:"ai",content:"Searching for latest automation tools..."},{id:"slack-msg-2",type:"ai",content:"Thinking...",widget:"thinking-spinner"}],[Q_.SALESFORCE]:[{id:"sf-msg-1",type:"ai",content:JSON.stringify({thought:"I need to query Salesforce for open opportunities. Let me search by account name first.",current_task:"Querying Salesforce opportunities"}),widget:"thoughtRenderer"},{id:"sf-msg-2",type:"ai",content:"Found 3 open opportunities for Acme Corp totaling $150,000."}],[Q_.GOOGLE]:[{id:"google-msg-1",type:"ai",content:"Searching for best practices..."},{id:"google-msg-2",type:"ai",content:JSON.stringify({executionId:"nested-web-search",toolName:"WebSearch",toolHeader:"Web Search",status:"pending",args:{query:"quarterly review best practices 2026"}}),widget:"cardRenderer"},{id:"google-msg-3",type:"ai",content:"Waiting for your approval to proceed."}]},xE7=()=>[{id:"agent-user-word",content:"Analyze this document for me.",sender:"user",timestamp:J4(10)},{id:"agent-card-word",content:JSON.stringify({executionId:"exec-word-001",toolName:"Agent",agentName:"Review Assistant",status:"completed",subAgentSessionId:Q_.WORD,frameworkId:"Agent-exec-word-001"}),sender:"ai",timestamp:J4(5),widget:"cardRenderer"}],LE7=()=>[{id:"agent-user-excel",content:"Analyze the sales data in my spreadsheet.",sender:"user",timestamp:J4(10)},{id:"agent-card-excel",content:JSON.stringify({executionId:"exec-excel-001",toolName:"Agent",agentName:"Review Assistant",status:"in_progress",subAgentSessionId:Q_.EXCEL,frameworkId:"Agent-exec-excel-001"}),sender:"ai",timestamp:J4(5),widget:"cardRenderer"}],wE7=()=>[{id:"agent-user-ppt",content:"Create a presentation about our Q4 results.",sender:"user",timestamp:J4(10)},{id:"agent-card-ppt",content:JSON.stringify({executionId:"exec-ppt-001",toolName:"Agent",agentName:"Explore Assistant",status:"completed",subAgentSessionId:Q_.PPT,frameworkId:"Agent-exec-ppt-001"}),sender:"ai",timestamp:J4(5),widget:"cardRenderer"}],yE7=()=>[{id:"agent-user-pdf",content:"Extract text from the contract PDF.",sender:"user",timestamp:J4(10)},{id:"agent-card-pdf",content:JSON.stringify({executionId:"exec-pdf-001",toolName:"Agent",agentName:"Review Assistant",status:"completed",subAgentSessionId:Q_.PDF,frameworkId:"Agent-exec-pdf-001"}),sender:"ai",timestamp:J4(5),widget:"cardRenderer"}],AE7=()=>[{id:"agent-user-outlook",content:"Send the summary report to the team.",sender:"user",timestamp:J4(10)},{id:"agent-card-outlook",content:JSON.stringify({executionId:"exec-outlook-001",toolName:"Microsoft365",agentName:"Microsoft 365 Assistant",status:"pending",subAgentSessionId:Q_.OUTLOOK,frameworkId:"Agent-exec-outlook-001"}),sender:"ai",timestamp:J4(5),widget:"cardRenderer"}],zE7=()=>[{id:"agent-user-teams",content:"Review the engineering update document.",sender:"user",timestamp:J4(10)},{id:"agent-card-teams",content:JSON.stringify({executionId:"exec-teams-001",toolName:"Agent",agentName:"Review Assistant",status:"completed",subAgentSessionId:Q_.TEAMS,frameworkId:"Agent-exec-teams-001"}),sender:"ai",timestamp:J4(5),widget:"cardRenderer"}],bE7=()=>[{id:"agent-user-slack",content:"Research the latest automation tools.",sender:"user",timestamp:J4(10)},{id:"agent-card-slack",content:JSON.stringify({executionId:"exec-slack-001",toolName:"Agent",agentName:"Explore Assistant",status:"in_progress",subAgentSessionId:Q_.SLACK,frameworkId:"Agent-exec-slack-001"}),sender:"ai",timestamp:J4(5),widget:"cardRenderer"}],SE7=()=>[{id:"agent-user-salesforce",content:"Find all open opportunities for Acme Corp.",sender:"user",timestamp:J4(10)},{id:"agent-card-salesforce",content:JSON.stringify({executionId:"exec-salesforce-001",toolName:"SalesforceAgent",agentName:"Salesforce CRM Assistant",status:"in_progress",subAgentSessionId:Q_.SALESFORCE,frameworkId:"Agent-exec-salesforce-001"}),sender:"ai",timestamp:J4(5),widget:"cardRenderer"}],HE7=()=>[{id:"agent-user-google",content:"Research quarterly review best practices.",sender:"user",timestamp:J4(10)},{id:"agent-card-google",content:JSON.stringify({executionId:"exec-google-001",toolName:"Agent",agentName:"Explore Assistant",status:"in_progress",description:"I've found some resources. Please review.",subAgentSessionId:Q_.GOOGLE,frameworkId:"Agent-exec-google-001"}),sender:"ai",timestamp:J4(5),widget:"cardRenderer"}],kE7=()=>[{id:"normal-user-text",content:"What is the status of my project?",sender:"user",timestamp:J4(10)},{id:"normal-ai-text",content:`Your project is progressing well! Here is a quick summary:
|
|
10002
10002
|
|
|
@@ -10887,7 +10887,7 @@ Use ReadFileTool to read this file.`,binary:null,base64:null}};if(u){if(o.length
|
|
|
10887
10887
|
[Content truncated - full file (${o.length} chars) available at: ${i}]`:`
|
|
10888
10888
|
|
|
10889
10889
|
[Content truncated - original file was ${o.length} chars]`;return{...a,type:"text/plain",content:{text:o.slice(0,HF5)+C,binary:null,base64:null}}}if(!i)return a;let f=t.name.toLowerCase().split(".").pop()??"",v=IF7.has(f)?"Use PowerShell (Expand-Archive, tar) or Bash to extract and inspect contents.":"Use ReadFileTool or PowerShell/Bash to process this file.";return{...a,type:"text/plain",content:{text:`[File: ${t.name} (${r}, ${t.size} bytes) at: ${i}]
|
|
10890
|
-
${v}`,binary:null,base64:null}}})}var HF5,DF7,IF7,Wx2=C1(()=>{SF5();nE1();HF5=16e3,DF7=new Set(["image/png","image/jpeg","image/webp","image/gif","image/bmp","image/tiff","image/svg+xml","application/pdf"]),IF7=new Set(["zip","7z","rar","tar","gz","bz2","xz","tgz"])});function NF7(e,t=xg){let{sessionsBasePath:r,separator:a}=e;return{resolvePath:(i,n)=>[r,i,"attachments",n].join(a),exists:(i,n)=>t.exists(i,n),write:(i,n,o)=>t.writeFile(i,n,void 0,o)}}function jF7(e,t){let r=t.lastIndexOf(".");if(r!==-1){let a=t.slice(r);if(GF7.test(a))return a}return VF5.get(e)??".bin"}function gN4(e){let t=e.content;if(!t)return null;if(t.binary)return t.binary;if(t.base64)try{let r=t.base64.includes(",")?t.base64.split(",")[1]:t.base64;return xc1(r)}catch{return null}return t.text?new TextEncoder().encode(t.text):null}function $x2(e){let t=e;return!(t.oneShot||t.attachmentSource&&UF7.has(t.attachmentSource))}async function WF7(e,t,r,a){return Promise.all(t.map(async i=>{if(i.localPath||!$x2(i)||i.isDirectory||!i.uploadId)return i;let n=jF7(i.type,i.name),o=r.resolvePath(e,`${i.uploadId}${n}`);try{if(!await r.exists(o,a)){let u=gN4(i);if(!u)return Bt.warn(`[materializeAttachments] No bytes for attachment "${i.name}", skipping materialization.`),i;await r.write(o,u,a)}}catch(h){return Bt.error(`[materializeAttachments] Failed to write attachment "${i.name}" to ${o}: ${h instanceof Error?h.message:String(h)}`),i}return{...i,localPath:o}}))}async function ac0(e,t){if(t.length===0)return[];let r=qx2??(S12?await qF7(S12):null),a=kh(e),i=a?{sessionId:e,turnPolicyOwnerSessionId:DV(e),turnPolicySnapshot:a}:void 0,n=r?await WF7(e,t,r,i):t;return rc0([...n])}async function qF7(e){try{let t=await e.resolvePaths();return S12!==e?null:(qx2=NF7(t),qx2)}catch(t){return e.onError?.(t instanceof Error?t.message:String(t)),null}}function PF5(e,t){let r={resolvePaths:e,onError:t};return S12=r,qx2=null,()=>{S12===r&&(S12=null,qx2=null)}}var qx2,S12,UF7,VF5,GF7,Kx2=C1(()=>{kl2();WW2();qU1();t21();uz();Wx2();Lp();qx2=null,S12=null;UF7=new Set(["Screenshot"]),VF5=new Map;for(let[e,[t]]of Object.entries(NW2))t&&VF5.set(e,t);GF7=/^\.[A-Za-z0-9]{1,16}$/});function _F5(e){let t=e.replaceAll("\\","/"),r=t.startsWith("/"),a=t.split("/"),i=[],o=/^[a-z]:$/i.test(a[0]??"")?1:0;for(let h of a)if(!(!h||h===".")){if(h===".."){i.length>o&&i.pop();continue}i.push(h)}return i.length===0?"":`${r?"/":""}${i.join("/")}`}function $F7(){return typeof window<"u"&&window.electronAPI?.isMacOS===!0?"macos":"windows"}function gz(e,t=$F7()){let r=_F5(e);return t==="macos"?r.normalize("NFD"):r}function NL1(e){return _F5(e).toLowerCase()}var Yx2=C1(()=>{});var L9,ZF5,ic0,KF7,YF7,pN4,FF5,XF7,JF7,QF7,tO7,eO7,rO7,aO7,iO7,fN4,nO7,EF5,oO7,OF5,lO7,cO7,sO7,vN4,DF5,IF5,hO7,dO7,uO7,gO7,pO7,mN4,RF5,fO7,NF5,CN4=C1(()=>{L9=w4(li()),ZF5=L9.z.enum(["read","list","write","create","delete","execute"]),ic0=L9.z.number().int().nonnegative().safe(),KF7={id:L9.z.string(),kind:L9.z.literal("exact_file"),path:L9.z.string(),operations:L9.z.array(ZF5)},YF7={id:L9.z.string(),kind:L9.z.literal("recursive_directory"),path:L9.z.string(),operations:L9.z.array(ZF5)},pN4=L9.z.discriminatedUnion("kind",[L9.z.object(KF7),L9.z.object(YF7)]),FF5={userId:L9.z.string(),organizationId:L9.z.string(),tenantId:L9.z.string().nullable()},XF7=L9.z.object(FF5),JF7={...FF5,projectId:L9.z.string()},QF7=L9.z.object(JF7),tO7={grantId:L9.z.string(),category:L9.z.string()},eO7=L9.z.object(tO7),rO7=L9.z.preprocess(e=>e===null?void 0:e,L9.z.string().optional()),aO7=L9.z.preprocess(e=>e===null?void 0:e,L9.z.array(eO7).optional()),iO7={state:L9.z.enum(["not_started","recreating","active","inactive"]),retryable:L9.z.boolean(),message:rO7,failedGrants:aO7},fN4=L9.z.object(iO7),nO7={generationId:L9.z.string(),policyVersion:ic0,createdAt:L9.z.string(),status:fN4.optional(),composedPolicyVersion:L9.z.number().int().nonnegative().optional()},EF5=L9.z.object(nO7),oO7={current:EF5.optional(),pending:EF5.optional()},OF5=L9.z.object(oO7),lO7={logicalResourceId:L9.z.string(),displayName:L9.z.string(),grantId:L9.z.string(),resourceKind:L9.z.enum(["linked_project_file","owned_attachment_copy"]),grantOwnership:L9.z.enum(["resource_owned","independently_managed"])},cO7=L9.z.object(lO7),sO7={identity:XF7,grants:L9.z.array(pN4),denies:L9.z.array(pN4),policyVersion:ic0,generations:OF5},vN4=L9.z.object(sO7),DF5={identity:QF7,grants:L9.z.array(pN4),resources:L9.z.record(L9.z.string(),cO7),policyVersion:ic0,generations:OF5,deletedAt:L9.z.string().optional()},IF5=L9.z.object(DF5),hO7=L9.z.object(DF5).superRefine((e,t)=>{for(let r of Object.values(e.resources))e.grants.some(a=>a.id===r.grantId&&a.kind==="exact_file")||t.addIssue({code:L9.z.ZodIssueCode.custom,message:"Resource grant is missing or is not an exact file"})}),dO7={projectKey:L9.z.string(),markedAt:L9.z.string(),kind:L9.z.never().optional()},uO7=L9.z.object(dO7),gO7={kind:L9.z.literal("project_resource"),projectKey:L9.z.string(),markedAt:L9.z.string(),logicalResourceId:L9.z.string(),localPath:L9.z.string()},pO7=L9.z.object(gO7),mN4=L9.z.union([pO7,uO7]),RF5=e=>JSON.stringify(e),fO7={schemaVersion:L9.z.literal(2),installationId:L9.z.string(),policyVersion:ic0,globalScopes:L9.z.record(L9.z.string(),vN4),projectScopes:L9.z.record(L9.z.string(),hO7),cleanupQueue:L9.z.array(mN4)},NF5=L9.z.object(fO7).superRefine((e,t)=>{for(let[r,a]of Object.entries(e.globalScopes))r!==RF5([a.identity.userId,a.identity.organizationId,a.identity.tenantId])&&t.addIssue({code:L9.z.ZodIssueCode.custom,message:"Global policy key does not match its identity"});for(let[r,a]of Object.entries(e.projectScopes))r!==RF5([a.identity.userId,a.identity.organizationId,a.identity.tenantId,a.identity.projectId])&&t.addIssue({code:L9.z.ZodIssueCode.custom,message:"Project policy key does not match its identity"})})});function H12(e){if(e.kind!=="exact_file")return;let t=vO7.filter(r=>e.operations.includes(r));return t.length>0?{code:"exact_file_directory_operations",invalidOperations:t}:void 0}function Xx2(e){for(let t of e){let r=H12(t);if(r)throw new Error(`Exact-file grant "${t.id}" cannot include directory-only operations: ${r.invalidOperations.join(", ")}`)}}var MN4,vO7,nc0=C1(()=>{MN4=["read","write","delete","execute"],vO7=["list","create"]});function UF5(e){return e.composedPolicyVersion===wo2}function WF5(e){return JSON.stringify(e)}function lc0(e){return WF5([e.userId,e.organizationId,e.tenantId])}function h61(e){return WF5([e.userId,e.organizationId,e.tenantId,e.projectId])}function oc0(e){return"kind"in e&&e.kind==="project_resource"}function GF5(e,t){let r=NF5.safeParse(e);if(r.success&&r.data.installationId===t)return r.data;if(!e||typeof e!="object"||Array.isArray(e))return JU2(t);let a=e;if(a.schemaVersion!==2||a.installationId!==t)return JU2(t);let i={};if(a.globalScopes&&typeof a.globalScopes=="object"&&!Array.isArray(a.globalScopes))for(let[u,g]of Object.entries(a.globalScopes)){let f=vN4.safeParse(g);f.success&&lc0(f.data.identity)===u&&(i[u]=f.data)}let n={};if(a.projectScopes&&typeof a.projectScopes=="object"&&!Array.isArray(a.projectScopes))for(let[u,g]of Object.entries(a.projectScopes)){let f=IF5.safeParse(g);if(!f.success||h61(f.data.identity)!==u)continue;let v=new Set(f.data.grants.filter(C=>C.kind==="exact_file").map(C=>C.id));n[u]={...f.data,resources:Object.fromEntries(Object.entries(f.data.resources).filter(([,C])=>v.has(C.grantId)))}}let o=Array.isArray(a.cleanupQueue)?a.cleanupQueue.flatMap(u=>{let g=mN4.safeParse(u);return g.success?[g.data]:[]}):[],h=typeof a.policyVersion=="number"&&Number.isSafeInteger(a.policyVersion)&&a.policyVersion>=0?a.policyVersion:0;return{schemaVersion:2,installationId:t,policyVersion:h,globalScopes:i,projectScopes:n,cleanupQueue:o}}function xN4(e,t){return e.find(r=>r.id===t.grantId)}function mO7(e,t){let r=gz(t);return e.find(a=>a.kind==="exact_file"&&gz(a.path)===r)}function CO7(e,t){let r=`project-resource:${t}`;if(!e.some(i=>i.id===r))return r;let a=2;for(;e.some(i=>i.id===`${r}:${a}`);)a+=1;return`${r}:${a}`}function jF5(e){let t=r=>{let a=i=>i?{generationId:i.generationId,policyVersion:i.policyVersion,createdAt:i.createdAt}:void 0;return!r.current?.status&&!r.pending?.status?r:{...r.current?{current:a(r.current)}:{},...r.pending?{pending:a(r.pending)}:{}}};return{...e,globalScopes:Object.fromEntries(Object.entries(e.globalScopes).map(([r,a])=>[r,{...a,generations:t(a.generations)}])),projectScopes:Object.fromEntries(Object.entries(e.projectScopes).map(([r,a])=>[r,{...a,generations:t(a.generations)}]))}}function MO7(){return{get:async()=>typeof window>"u"||!window.settingsApi?{}:await window.settingsApi.get(),updatePartial:async e=>{typeof window>"u"||!window.settingsApi||await window.settingsApi.updatePartial(e)},compareAndSwapProjectAccessPolicy:async(e,t)=>typeof window>"u"||!window.settingsApi?!1:await window.settingsApi.compareAndSwapProjectAccessPolicy(e,t)}}function xO7(){return globalThis.crypto?.randomUUID?.()??`ephemeral-${Date.now()}`}function eE(e){return{projectId:e.id,userId:e.user_id,organizationId:e.organization_id,tenantId:e.tenant_id??null}}var cc0,LN4,W91,sc0=C1(()=>{fj();CN4();nc0();Yx2();fj();cc0=class extends Error{};LN4=class{constructor(t=MO7()){this.persistence=t}state=null;persistedState=null;installationId=null;initializePromise=null;pendingPersistence=Promise.resolve();pendingMutation=Promise.resolve();listeners=new Set;initialize(){return this.initializePromise||(this.initializePromise=this.persistence.get().then(t=>{let r=t.installationId??xO7();this.installationId=r;let a=GF5(t.projectAccessPolicy,r);this.persistedState=a,this.state=jF5(a)})),this.initializePromise}async getInstallationId(){if(await this.initialize(),!this.installationId)throw new Error("Project access policy store failed to initialize");return this.installationId}async getState(){if(await this.initialize(),!this.state)throw new Error("Project access policy store failed to initialize");return this.state}async getProjectPolicy(t){return(await this.getState()).projectScopes[h61(t)]}async getGlobalPolicy(t){return(await this.getState()).globalScopes[lc0(t)]}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}async ensureProjectPolicy(t){return await this.mutate(()=>this.ensureProjectPolicyCore(t))}async ensureProjectPolicyCore(t){let r=await this.getProjectPolicy(t);return r&&!r.deletedAt?r:await this.replaceProjectGrantsCore(t,[])}async replaceProjectGrants(t,r){return await this.mutate(()=>this.replaceProjectGrantsCore(t,r))}async replaceProjectGrantsCore(t,r){let a=await this.getState(),i=h61(t),n=a.projectScopes[i],o=n?.deletedAt?void 0:n,h=new Map((o?.grants??[]).map(f=>[f.id,f]));for(let f of r)JSON.stringify(h.get(f.id))!==JSON.stringify(f)&&Xx2([f]);if(o&&JSON.stringify(o.grants)===JSON.stringify(r))return o;let u=a.policyVersion+1,g={identity:t,grants:r.map(f=>({...f,operations:[...f.operations]})),resources:Object.fromEntries(Object.entries(o?.resources??{}).filter(([,f])=>r.some(v=>v.id===f.grantId&&v.kind==="exact_file"))),policyVersion:u,generations:this.nextPendingGenerations(o,u)};return await this.commitProjectPolicy(a,i,g,n?.deletedAt===void 0),g}async queueProjectGeneration(t){return await this.mutate(()=>this.queueProjectGenerationCore(t))}async queueProjectGenerationCore(t){let r=await this.getState(),a=h61(t),i=r.projectScopes[a],n=i?.deletedAt?void 0:i,o=r.policyVersion+1,h={identity:t,grants:n?.grants??[],resources:n?.resources??{},policyVersion:o,generations:this.nextPendingGenerations(n,o)};return await this.commitProjectPolicy(r,a,h,i?.deletedAt===void 0),h}async recordProjectGenerationStatus(t,r,a){return await this.mutate(()=>this.recordProjectGenerationStatusCore(t,r,a))}async recordProjectGenerationStatusCore(t,r,a){let i=await this.getState(),n=h61(t),o=i.projectScopes[n],h=o?.generations.current;if(!o||o.deletedAt||h?.generationId!==r||JSON.stringify(h.status)===JSON.stringify(a))return o;let u={...o,generations:{...o.generations,current:{...h,status:{...a}}}},g={...i,projectScopes:{...i.projectScopes,[n]:u}};return await this.commit(i,g),u}async registerExactReadResources(t,r){return await this.mutate(()=>this.registerExactReadResourcesCore(t,r))}async registerExactReadResourcesCore(t,r){if(r.length===0)return await this.getProjectPolicy(t);let a=await this.getState(),i=h61(t),n=a.projectScopes[i],o=n?.deletedAt?void 0:n,h={...o?.resources??{}},u=[...o?.grants??[]],g=!1;for(let L of r){let y=gz(L.localPath),z=Object.values(h).find(t1=>{let n1=xN4(u,t1);return n1?.kind==="exact_file"&&gz(n1.path)===y});if(z&&!L.replaceExisting)continue;let S=z?xN4(u,z):mO7(u,L.localPath),B=h[L.logicalResourceId],R=B!==void 0&&Object.values(h).some(t1=>t1.logicalResourceId!==L.logicalResourceId&&t1.grantId===B.grantId),F=L.replaceExisting&&B?.grantOwnership==="resource_owned"&&!R,N=S?.id??(F?B?.grantId??`project-resource:${L.logicalResourceId}`:CO7(u,L.logicalResourceId));if(!S){let t1={id:N,kind:"exact_file",path:L.localPath,operations:["read"]},n1=F?u.findIndex(a1=>a1.id===B?.grantId):-1;n1>=0?JSON.stringify(u[n1])!==JSON.stringify(t1)&&(u[n1]=t1,g=!0):(u.push(t1),g=!0)}let j=Object.values(h).some(t1=>t1.grantId===N&&t1.grantOwnership==="resource_owned"),Y={logicalResourceId:L.logicalResourceId,displayName:L.displayName,grantId:N,resourceKind:L.resourceKind,grantOwnership:!S||j?"resource_owned":"independently_managed"};if(JSON.stringify(h[L.logicalResourceId])!==JSON.stringify(Y)&&(h[L.logicalResourceId]=Y,g=!0),B?.grantOwnership==="resource_owned"&&B.grantId!==N&&!Object.values(h).some(t1=>t1.grantId===B.grantId)){let t1=u.findIndex(n1=>n1.id===B.grantId);t1>=0&&u.splice(t1,1)}}if(!g&&o)return o;let f=a.policyVersion+1,v={identity:t,grants:u,resources:h,policyVersion:f,generations:this.nextPendingGenerations(o,f)},C={...a,policyVersion:f,projectScopes:{...a.projectScopes,[i]:v},cleanupQueue:n?.deletedAt?a.cleanupQueue.filter(L=>L.projectKey!==i):a.cleanupQueue};return await this.commit(a,C),v}async removeProjectResources(t,r,a=new Date().toISOString()){return await this.mutate(()=>this.removeProjectResourcesCore(t,r,a))}async removeProjectResourcesCore(t,r,a){if(r.length===0)return await this.getProjectPolicy(t);let i=await this.getState(),n=h61(t),o=i.projectScopes[n];if(!o||o.deletedAt)return o;let h=new Set(r),u=Object.values(o.resources).filter(B=>h.has(B.logicalResourceId));if(u.length===0)return o;let g=Object.fromEntries(Object.entries(o.resources).filter(([B])=>!h.has(B))),f=Object.values(g),v=new Set(u.filter(B=>B.grantOwnership==="resource_owned"&&!f.some(R=>R.grantId===B.grantId)).map(B=>B.grantId)),C=o.grants.filter(B=>!v.has(B.id)),L=i.policyVersion+1,y={...o,grants:C,resources:g,policyVersion:L,generations:this.nextPendingGenerations(o,L)},z=[...i.cleanupQueue];for(let B of u.filter(R=>R.resourceKind==="owned_attachment_copy")){let R=xN4(o.grants,B)?.path;if(!R)continue;z.some(N=>"kind"in N&&N.kind==="project_resource"&&N.projectKey===n&&N.logicalResourceId===B.logicalResourceId&&N.localPath===R)||z.push({kind:"project_resource",projectKey:n,logicalResourceId:B.logicalResourceId,localPath:R,markedAt:a})}let S={...i,policyVersion:L,projectScopes:{...i.projectScopes,[n]:y},cleanupQueue:z};return await this.commit(i,S),y}async restoreProjectPolicyContents(t,r){return await this.mutate(()=>this.restoreProjectPolicyContentsCore(t,r))}async restoreProjectPolicyContentsCore(t,r){let a=(r?.grants??[]).map(L=>({...L,operations:[...L.operations]}));Xx2(a);let i=await this.getState(),n=h61(t),o=i.projectScopes[n],h=o?.deletedAt?void 0:o,u=Object.fromEntries(Object.entries(r?.resources??{}).map(([L,y])=>[L,{...y}])),g=new Set(Object.keys(u)),f=i.policyVersion+1,v={identity:t,grants:a,resources:u,policyVersion:f,generations:this.nextPendingGenerations(h,f)},C={...i,policyVersion:f,projectScopes:{...i.projectScopes,[n]:v},cleanupQueue:i.cleanupQueue.filter(L=>!oc0(L)||L.projectKey!==n||!g.has(L.logicalResourceId))};return await this.commit(i,C),v}async activateGlobalPolicyAtTurnBoundary(t){return await this.mutate(()=>this.activateGlobalPolicyAtTurnBoundaryCore(t))}async activateGlobalPolicyAtTurnBoundaryCore(t){let r=await this.getState(),a=lc0(t),i=r.globalScopes[a];if(i?.generations.current&&!i.generations.pending)return i;let n=i?.policyVersion??0,o=i?.generations.pending??i?.generations.current??{generationId:globalThis.crypto?.randomUUID?.()??`global-${Date.now()}`,policyVersion:n,createdAt:new Date().toISOString()},h={identity:t,grants:i?.grants??[],denies:i?.denies??[],policyVersion:n,generations:{current:o}},u={...r,globalScopes:{...r.globalScopes,[a]:h}};return await this.commit(r,u),h}async activateProjectPolicyAtTurnBoundary(t,r){return await this.mutate(()=>this.activateProjectPolicyAtTurnBoundaryCore(t,r))}async describeProjectPolicyPresence(t){let r=await this.getState(),a=h61(t),i=r.projectScopes[a],n=Object.keys(r.projectScopes).filter(h=>h!==a&&h.includes(JSON.stringify(t.projectId))).length;return`policy entry: ${i?i.deletedAt?`present but soft-deleted at ${i.deletedAt}`:`present (grants: ${i.grants.length}; current generation: ${i.generations.current?"yes":"no"}; pending: ${i.generations.pending?"yes":"no"})`:"absent"}; entries for this project under a different account identity: ${n}; project entries in state: ${Object.keys(r.projectScopes).length}`}async activateProjectPolicyAtTurnBoundaryCore(t,r){let a=await this.getState(),i=h61(t),n=a.projectScopes[i];if((!n||n.deletedAt)&&!r)return;let o=n?.deletedAt?void 0:n;if(o?.generations.current&&!o.generations.pending&&UF5(o.generations.current))return o;let h=o?.generations.pending??(o?.generations.current&&UF5(o.generations.current)?o.generations.current:void 0),u=o?.generations.current!==void 0&&h===void 0,g=u?a.policyVersion+1:o?.policyVersion??0,f=h??{generationId:globalThis.crypto?.randomUUID?.()??`project-${Date.now()}`,policyVersion:g,createdAt:new Date().toISOString(),composedPolicyVersion:wo2},v={identity:t,grants:o?.grants??[],resources:o?.resources??{},policyVersion:g,generations:{current:f}},C={...a,...u?{policyVersion:g}:{},projectScopes:{...a.projectScopes,[i]:v},cleanupQueue:n?.deletedAt?a.cleanupQueue.filter(L=>L.projectKey!==i):a.cleanupQueue};return await this.commit(a,C),v}async replaceGlobalPolicy(t,r){await this.mutate(()=>this.replaceGlobalPolicyCore(t,r))}async replaceGlobalPolicyCore(t,r){Xx2(r.grants),Xx2(r.denies);let a=await this.getState(),i=lc0(t),n=a.globalScopes[i],o=!n||n.policyVersion!==r.policyVersion||JSON.stringify(n.grants)!==JSON.stringify(r.grants)||JSON.stringify(n.denies)!==JSON.stringify(r.denies),h=(v,C)=>({generationId:globalThis.crypto?.randomUUID?.()??`${C}-${Date.now()}`,policyVersion:v,createdAt:new Date().toISOString(),composedPolicyVersion:wo2}),u={...r,identity:t,generations:o&&n?.generations.current?{current:n.generations.current,pending:h(r.policyVersion,"global")}:r.generations},g=o?Object.fromEntries(Object.entries(a.projectScopes).map(([v,C])=>!(C.identity.userId===t.userId&&C.identity.organizationId===t.organizationId&&C.identity.tenantId===t.tenantId)||C.deletedAt?[v,C]:[v,{...C,generations:{current:C.generations.current,pending:h(Math.max(C.policyVersion,r.policyVersion),"project")}}])):a.projectScopes,f={...a,policyVersion:Math.max(a.policyVersion,r.policyVersion),globalScopes:{...a.globalScopes,[i]:u},projectScopes:g};await this.commit(a,f)}async markProjectDeleted(t,r=new Date().toISOString()){await this.mutate(()=>this.markProjectDeletedCore(t,r))}async markProjectDeletedCore(t,r){let a=await this.getState(),i=h61(t),n=a.projectScopes[i],o=a.cleanupQueue.some(u=>u.projectKey===i&&!("kind"in u&&u.kind==="project_resource"))?a.cleanupQueue:[...a.cleanupQueue,{projectKey:i,markedAt:r}],h={...a,projectScopes:n?{...a.projectScopes,[i]:{...n,deletedAt:r}}:a.projectScopes,cleanupQueue:o};await this.commit(a,h)}async completeResourceCleanup(t){return await this.mutate(()=>this.completeResourceCleanupCore(t))}async completeResourceCleanupCore(t){let r=await this.getState();if(!r.cleanupQueue.some(h=>oc0(h)&&h.projectKey===t.projectKey&&h.logicalResourceId===t.logicalResourceId&&h.localPath===t.localPath&&h.markedAt===t.markedAt))return!1;let i=r.projectScopes[t.projectKey];if(i!==void 0&&!i.deletedAt&&Object.values(i.resources).some(h=>h.logicalResourceId===t.logicalResourceId))return!1;let o={...r,cleanupQueue:r.cleanupQueue.filter(h=>!(oc0(h)&&h.projectKey===t.projectKey&&h.logicalResourceId===t.logicalResourceId&&h.localPath===t.localPath&&h.markedAt===t.markedAt))};return await this.commit(r,o),!0}async completeProjectCleanup(t){return await this.mutate(()=>this.completeProjectCleanupCore(t))}async completeProjectCleanupCore(t){let r=await this.getState();if(!r.cleanupQueue.some(h=>!oc0(h)&&h.projectKey===t.projectKey&&h.markedAt===t.markedAt))return!1;let i=r.projectScopes[t.projectKey];if(i&&i.deletedAt!==t.markedAt)return!1;let n={...r.projectScopes};delete n[t.projectKey];let o={...r,projectScopes:n,cleanupQueue:r.cleanupQueue.filter(h=>h.projectKey!==t.projectKey)};return await this.commit(r,o),!0}async persist(t){let r=()=>this.persistence.updatePartial({projectAccessPolicy:t});this.pendingPersistence=this.pendingPersistence.then(r,r),await this.pendingPersistence}async mutate(t){let r=async()=>{for(let i=0;;i+=1)try{return await t()}catch(n){if(!(n instanceof cc0)||i>=7)throw n}},a=this.pendingMutation.then(r,r);return this.pendingMutation=a.then(()=>{},()=>{}),await a}async commit(t,r){let a=this.persistedState??t;this.state=r;try{if(this.persistence.compareAndSwapProjectAccessPolicy){if(!await this.persistence.compareAndSwapProjectAccessPolicy(a,r)){let n=await this.persistence.get();if(!this.installationId)throw new Error("Project access policy store failed to initialize");this.installationId=n.installationId??this.installationId;let o=GF5(n.projectAccessPolicy,this.installationId);throw this.persistedState=o,this.state=jF5(o),new cc0("Project access policy changed concurrently")}}else await this.persist(r);this.persistedState=r,this.publish()}catch(i){throw this.state===r&&(this.state=t),i}}async commitProjectPolicy(t,r,a,i){let n={...t,policyVersion:a.policyVersion,projectScopes:{...t.projectScopes,[r]:a},cleanupQueue:i?t.cleanupQueue:t.cleanupQueue.filter(o=>o.projectKey!==r)};await this.commit(t,n)}publish(){for(let t of this.listeners)t()}nextPendingGenerations(t,r){let a=t?.generations.pending?{generationId:t.generations.pending.generationId,createdAt:t.generations.pending.createdAt,policyVersion:r,...t.generations.pending.composedPolicyVersion!==void 0?{composedPolicyVersion:t.generations.pending.composedPolicyVersion}:{}}:{generationId:globalThis.crypto?.randomUUID?.()??`project-${Date.now()}`,policyVersion:r,createdAt:new Date().toISOString(),composedPolicyVersion:wo2};return{...t?.generations.current?{current:t.generations.current}:{},pending:a}}},W91=new LN4});function qO(e){if(e===null||typeof e!="object")return!1;let t=e;return typeof t.logicalResourceId=="string"&&t.logicalResourceId.length>0&&typeof t.displayName=="string"&&t.displayName.length>0}function UL1(e){if(!Array.isArray(e?.contextFiles))return[];let t=[];for(let r of e.contextFiles)typeof r=="string"?t.push(r):qO(r)&&t.push({logicalResourceId:r.logicalResourceId,displayName:r.displayName});return t}function qF5(e){if(e==="standard"||e==="project_restricted")return e;throw new hc0(e)}function k12(e){return!e||!Object.prototype.hasOwnProperty.call(e,"accessMode")?"standard":qF5(e.accessMode)}function wN4(e,t){let r=t.sandboxEnabled&&e.metadata?.accessMode?qF5(e.metadata.accessMode):void 0;return{...e,metadata:{...e.metadata??{},accessMode:t.sandboxEnabled?r??t.defaultMode:"standard"}}}function $F5(e){return e?e.screenContextDisabled===!0||e.screenContextDefault==="off":!1}function KF5(e){let t=e?.executionMode;return t==="autonomous"||t==="guided"||t==="background"?t:null}function q91(e){return e?.metadata?.template}function YF5(e){return LO7.has(e)}function uY(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):e&&typeof e=="object"?Object.keys(e):[]}function dc0(e){return uY(e)}var dY,hc0,LO7,d21=C1(()=>{dY=w4(F31());hc0=class extends Error{persistedValue;constructor(t){super("Invalid project accessMode in project metadata"),this.name="ProjectAccessModeConfigurationError",this.persistedValue=t}};LO7=new Set(["business-analysis","business-task"])});function T12(e){return ic("restrictedProjectAccess")?k12(e):"standard"}var yN4=C1(()=>{OO();d21()});function GL1(e,t){try{yO7(e,t)}catch{}}function yO7(e,t){wO7?.(e,{...t.scope?{scope:t.scope}:{},...t.accessMode?{accessMode:t.accessMode}:{},...t.policyVersion!==void 0?{policyVersion:t.policyVersion}:{},...t.generationState?{generationState:t.generationState}:{},...t.category?{category:t.category}:{},outcome:t.outcome,...t.retryable!==void 0?{retryable:t.retryable}:{},...t.itemKind?{itemKind:t.itemKind}:{},...t.itemCount!==void 0?{itemCount:t.itemCount}:{}},t.sessionId)}function AN4(e){if(e.kind==="denied"){GL1(Ur.ProjectAccessPolicySnapshot,{category:e.code,outcome:e.retryable?"retryable":"denied",retryable:e.retryable});return}let{snapshot:t}=e;GL1(Ur.ProjectAccessPolicySnapshot,{scope:t.scope.kind,accessMode:t.accessMode??"global",policyVersion:t.policyVersion,generationState:t.sandboxGeneration.status?.state??"not_started",outcome:"selected"})}function zN4(e,t){let r=t?.accessMode??"unknown";if(r==="project_restricted"){GL1(Ur.ProjectAccessCapabilityDecision,{scope:t?.scope.kind,accessMode:r,policyVersion:t?.policyVersion,category:e,outcome:"denied",retryable:!1});return}GL1(Ur.SandboxCapabilityDecision,{scope:t?.scope.kind,accessMode:r,policyVersion:t?.policyVersion,category:e,outcome:"denied",retryable:!1})}function bN4(e,t,r){GL1(Ur.SandboxCapabilityDecision,{accessMode:t?.accessMode??"unknown",category:e,outcome:"denied",retryable:!1,sessionId:r})}function dd1(e,t,r){GL1(Ur.ProjectAccessResourceLifecycle,{category:e,outcome:t,itemKind:"project_resource",itemCount:r})}function JF5(e){let t=AO7(e);return t===XF5?!1:(XF5=t,GL1(Ur.SandboxAvailability,{scope:"global",category:t,outcome:t==="kernel_isolation_active"||t==="validation_only"?"succeeded":"failed"}),!0)}function AO7(e){return e.isAvailable===void 0?"status_unavailable":e.isAvailable?e.isKernelIsolationActive?"kernel_isolation_active":"validation_only":"sandbox_unavailable"}function QF5(e){for(let[t,r]of e)GL1(Ur.SandboxFilesystemDecision,{scope:"project",category:t,outcome:"denied",itemCount:r,retryable:XU2(t)})}var wO7,XF5,B12=C1(()=>{fj();MW()});function bO7(e){return e.length===1&&e[0]==="read"}function eO5(e,t,r=[],a=new Set){if(r.some(o=>!H12(o)&&tO5(o,e)))return{operations:[],writeGrantSources:[]};let i=new Set,n=[];for(let o of t)if(!(a.has(o.id)||H12(o)||!tO5(o,e))){for(let h of o.operations)zO7.has(h)&&i.add(h);o.operations.includes("write")&&n.push({id:o.id,kind:o.kind,path:o.path})}return{operations:MN4.filter(o=>i.has(o)),writeGrantSources:n}}function rO5(e,t){return bO7(e.operations)?t.writeGrantSources.filter(r=>r.id!==e.id):[]}var zO7,tO5,aO5=C1(()=>{nc0();Yx2();zO7=new Set(MN4),tO5=(e,t)=>{if(e.kind==="exact_file")return gz(t)===gz(e.path);let r=NL1(e.path),a=NL1(t);return a===r||a.startsWith(`${r}/`)}});function iO5(e){SN4=e}async function uc0(){return SN4?SN4():{}}var SN4,gc0=C1(()=>{SN4=null});function kO7(e){try{let t=new URL(e);return t.port?Number(t.port):null}catch{return null}}function nO5(e,t,r){clearTimeout(t.timer),t.abortHandler&&r?.removeEventListener("abort",t.abortHandler);let a=pc0.get(e);a?.delete(t),a?.size===0&&pc0.delete(e)}function TO7(e){return!!(e&&ia.getState().backgroundPipDismissedBySession[e])}function oO5(){if(typeof window>"u")return;let e=window;e.__ariaWaitForPipPreviewReady=({baseUrl:t,sessionId:r,timeoutMs:a,abortSignal:i})=>{let n=kO7(t);if(!n||TO7(r))return Promise.resolve();let o=HO7.get(n)??0;return Date.now()-o<=SO7?Promise.resolve():new Promise((h,u)=>{let g={resolve:h,reject:u,timer:setTimeout(()=>{nO5(n,g,i),u(new Error(`Timed out waiting for PiP preview stream at ${t}`))},a)};g.abortHandler=()=>{nO5(n,g,i),u(new DOMException("Operation aborted","AbortError"))},i?.addEventListener("abort",g.abortHandler,{once:!0});let f=pc0.get(n)??new Set;f.add(g),pc0.set(n,f)})}}var SO7,HO7,pc0,lO5=C1(()=>{wu();WO();SO7=2e3,HO7=new Map,pc0=new Map});function HN4(e){return $04(e)}var cO5=C1(()=>{eG1()});var Jx2,kN4=C1(()=>{wu();Jx2=class{constructor(t,r,a){this.subMode=t;this.appStore=r;this.localSessionStore=a;this.previewSurface="pip-frames"}resolveUrl(t,r){return this.ensurePipStarted(r),`http://localhost:${FC2}`}ensurePipStarted(t){let r=this.appStore.getState(),a="ChildSession";if(r.pipModePreference!==a&&r.setPipModePreference(a),r.usePip&&r.pipState.status!=="off"&&r.pipState.status!=="error"){t&&this.localSessionStore.getState().backgroundPipDismissedBySession[t]?this.appStore.setState({isPipMiniWindowVisible:!1}):this.appStore.setState({isPipMiniWindowVisible:!0});return}this.appStore.getState().setUsePip(!0).finally(()=>{t&&this.localSessionStore.getState().backgroundPipDismissedBySession[t]&&this.appStore.setState({isPipMiniWindowVisible:!1})})}}});var Qx2,TN4=C1(()=>{wu();If();Qx2=class{constructor(){this.subMode="web-only";this.previewSurface="cdp-screenshots"}resolveUrl(t,r){return`http://localhost:${b5.getState().interopPort??N90}`}}});var tL2,BN4=C1(()=>{wu();tL2=class{constructor(t){this.getInteropPort=t;this.subMode="windows-native";this.previewSurface="cdp-screenshots"}resolveUrl(t,r){return`http://localhost:${this.getInteropPort()??N90}`}}});function VN4(e){let t=ia.getState(),r=e?t.sessionExecutionSettings[e]:void 0,a=b5.getState(),i=!!(e&&e===a.sessionId),n=!!(e&&(r||i));if((n?t.resolveExecutionMode(e):"guided")!=="background")return sO5;let h=n?t.resolveBackgroundSubMode(e):a.backgroundSubMode;return h==="windows-native"?VO7:h==="local-rdp"?BO7:sO5}var sO5,BO7,VO7,hO5=C1(()=>{If();WO();kN4();TN4();BN4();sO5=new Qx2,BO7=new Jx2("local-rdp",b5,ia),VO7=new tL2(()=>b5.getState().interopPort)});var dO5=C1(()=>{cO5();hO5();kN4();TN4();BN4()});function _N4(e){if(!e)return;let{backgroundOwnerSessionId:t}=b5.getState();if(t&&t!==e)throw new Error(PO7);t||(b5.setState({backgroundOwnerSessionId:e}),window.remotingApi?.pipSetSessionOwner?.(e))}function _O7(e,t){return t?e.subMode==="local-rdp":!1}function uO5(e,t,r){let a=ia.getState(),i=!!a.backgroundPipActiveBySession[e];r&&t==="native-host"&&a.markBackgroundSurfaceActive(e,"native-host"),a.markBackgroundPipActive(e),a.backgroundPipDismissedBySession[e]||b5.setState(n=>({isPipMiniWindowVisible:!0,pipState:{...n.pipState,...i?{}:{isExpanded:!0}}}))}var PN4,PO7,EN4,YT,oE1=C1(()=>{wu();If();pR4();WO();ii0();lO5();dO5();oO5();PN4=`http://localhost:${FC2}`,PO7="PiP background desktop is already in use by another conversation. Switch back to that conversation, stop its Offscreen RDP session, or use Web only for parallel browser work.";EN4=class{getToolsUrl(t,r){let a=r?.kind??HN4(r?.identifier),i=VN4(t),n=r?.activateSurface!==!1,o=b5.getState(),h=!!(t&&ia.getState().sessionExecutionSettings[t]),u=!!(t&&t===o.sessionId),g=i.subMode==="local-rdp",f=i.subMode==="web-only"&&!h&&!u&&o.backgroundOwnerSessionId===t;if(KC2.getState().context==="pip"&&a!=="cdp-browser"&&(g||f))return g&&(_N4(t),uO5(t,a,n)),PN4;_O7(i,t)&&_N4(t);let v=i.resolveUrl(r,t);return t&&n&&a==="cdp-browser"&&v!==PN4?ia.getState().markBackgroundSurfaceActive(t,"cdp-browser"):t&&n&&a==="native-host"&&i.subMode==="windows-native"&&ia.getState().clearBackgroundSurfaceActive(t),t&&v===PN4&&(_N4(t),uO5(t,a,n)),v}},YT=new EN4});var gO5={};qr(gO5,{getSecurityPolicy:()=>RO7,getSecurityService:()=>jL1,requestElevationToken:()=>ZN4,syncSecurityConfig:()=>EO7});function jL1(){return RN4||(RN4=new eQ1(YT,{getHeaders:uc0})),RN4}async function EO7(e){let t=jL1(),r=await t.syncPolicy(e),a=r?(await t.getPolicy())?.sandbox:void 0;return JF5({isAvailable:a?.isAvailable,isKernelIsolationActive:a?.isKernelIsolationActive}),r}async function RO7(e=!1){return jL1().getPolicy(e)}async function ZN4(e){return jL1().requestElevationToken(e)}var RN4,eL2=C1(()=>{ZO();gc0();B12();oE1();RN4=null});function ZO7(e,t){let r=[...e?[vO5]:[],...t?[WL1]:[]];return r.length>0?r.join(" "):void 0}function FO7(e,t,r){let a=[...e?[vO5]:[],...t?[t]:[],...r?[WL1]:[]],i=[...new Set(a)];return i.length>0?i.join(" "):void 0}function FN4(e,t){return e?.grants.find(r=>r.id===t.grantId)}function rL2(e,t){return FN4(e,t)?.path}function fO5(e){return e.split(/[/\\]/).pop()??"resource.bin"}function ON4(e){let{localPath:t,...r}=e;return{...r,oneShot:!0}}function DN4(e){let t=e.some(i=>i.isDirectory),r=e.some(i=>!i.isDirectory&&(i.localPath||$x2(i))),a=ZO7(t,r);return{value:e.map(i=>i.localPath||$x2(i)?ON4(i):i),...a?{warning:a}:{}}}function vc0(e,t){let r=aM(),a=r?.taskProjectMap[e],i=a?r?.projects.find(n=>n.id===a):void 0;if(!i)return{value:[...t]};try{if(T12(i.metadata)!=="project_restricted")return{value:[...t]}}catch{return DN4(t)}return UO7.prepareAttachments(i,t).catch(()=>DN4(t))}var WL1,vO5,pO5,fc0,OO7,DO7,IO7,NO7,IN4,UO7,NN4=C1(()=>{p31();Kx2();Yx2();sc0();jO();d21();yN4();B12();aO5();nc0();WL1="One or more files could not be added as durable project resources. Inline content was kept where available, but no local source path was shared.",vO5="Folders cannot be attached to restricted projects. Add the folder as an explicit project access grant instead.",pO5="This file location does not support secure linked-file access for restricted projects. Copy or move the file to an internal disk, then add it again.",fc0="Linked file";OO7=()=>window.projectResourceApi,DO7=()=>globalThis.crypto?.randomUUID?.()??`resource-${Date.now()}`,IO7=async e=>(await Promise.resolve().then(()=>(eL2(),gO5))).getSecurityService().validateLinkedResource(e),NO7=async(e,t)=>await aM()?.updateProject?.(e.id,{metadata:{...e.metadata,contextFiles:[...t]}})??!1;IN4=class{constructor(t=W91,r=OO7,a=DO7,i=IO7,n=NO7){this.policyStore=t;this.getApi=r;this.createResourceId=a;this.validateLinkedResource=i;this.persistContextFiles=n}async prepareAttachments(t,r){if(T12(t.metadata)!=="project_restricted")return{value:[...r]};let a;try{a=await this.policyStore.getProjectPolicy(eE(t))}catch{return DN4(r)}let i=UL1(t.metadata),n=new Set(i.map(j=>qO(j)?j.logicalResourceId:j)),o=new Set(Object.values(a?.resources??{}).flatMap(j=>{if(j.resourceKind!=="linked_project_file"||!n.has(j.logicalResourceId))return[];let Y=rL2(a,j);return Y?[gz(Y)]:[]})),h=new Set(Object.values(a?.resources??{}).flatMap(j=>{if(j.resourceKind!=="owned_attachment_copy")return[];let Y=rL2(a,j);return Y?[gz(Y)]:[]})),u=[],g=[],f=new Set,v=new Set,C=!1,L=!1;for(let j of r){if(!$x2(j)){f.add(j);continue}if(j.localPath&&h.has(gz(j.localPath))){f.add(j),v.add(j);continue}if(j.isDirectory){C=!0;continue}if(j.localPath){g.push(j);continue}let Y=this.createResourceId(),t1=gN4(j);t1?u.push({logicalResourceId:Y,request:{projectId:t.id,resourceId:Y,fileName:j.name,content:t1},source:j}):L=!0}let y=new Set,z;if(g.length>0){let j=[...i.map(t1=>qO(t1)?t1.logicalResourceId:t1),...g.flatMap(t1=>t1.localPath?[t1.localPath]:[])],Y=await this.syncContextFilesDetailed(t,j,{allowRemovals:!0});if(z=Y.warning,y=new Set(Y.linkedPathIdentities),JSON.stringify(Y.value)!==JSON.stringify(i)){let t1=!1;try{t1=await this.persistContextFiles(t,Y.value)}catch{t1=!1}if(!t1&&(z=WL1,y=o,Y.addedLogicalResourceIds.length>0))try{await this.policyStore.removeProjectResources(eE(t),Y.addedLogicalResourceIds)}catch{}}}let S=this.getApi(),B=[],R=L;if(u.length>0)if(!S)R=!0,dd1("resource_api_unavailable","failed",u.length);else{let j=await this.materializeCandidates(S,u);B=await this.registerMaterialized(t,S,j.successes),R||=B.length!==u.length}let F=new Map(B.map(j=>[j.source,j.localPath])),N=FO7(C,z,R);return{value:r.map(j=>{if(j.localPath&&y.has(gz(j.localPath)))return j;if(f.has(j))return j.localPath&&!v.has(j)?ON4(j):j;let Y=F.get(j);return Y?{...j,localPath:Y}:ON4(j)}),...N?{warning:N}:{}}}async currentContextReferences(t){let r=UL1(t.metadata);if(r.length===0)return[];let a=r.filter(h=>typeof h=="string"),i=r.filter(qO);if(i.length===0)return[...a];let n;try{n=await this.policyStore.getProjectPolicy(eE(t))}catch{n=void 0}let o=i.map(h=>{let u=n?.resources[h.logicalResourceId];return(u?rL2(n,u):void 0)??h.logicalResourceId});return[...a,...o]}async applyContextFileIntent(t,r){let a=r.mode==="reconcile"?[...r.desiredPaths]:r.mode==="add"?[...await this.currentContextReferences(t),...r.paths]:await this.currentContextReferences(t),i=await this.syncContextFilesDetailed(t,a,{allowRemovals:r.mode==="reconcile"});return{value:i.value,...i.warning?{warning:i.warning}:{}}}async syncContextFilesDetailed(t,r,{allowRemovals:a}){let i=UL1(t.metadata),n=!0;try{n=T12(t.metadata)==="project_restricted"}catch{n=!0}let o=[...new Map(r.map(p1=>[gz(p1),p1])).values()],h;try{h=await this.policyStore.getProjectPolicy(eE(t))}catch{return n?{value:[...i],warning:WL1,linkedPathIdentities:[],addedLogicalResourceIds:[]}:{value:[...o],linkedPathIdentities:[],addedLogicalResourceIds:[]}}let u=Object.values(h?.resources??{}).filter(p1=>p1.resourceKind==="linked_project_file"),g=new Map(u.map(p1=>[p1.logicalResourceId,p1])),f=new Map(u.flatMap(p1=>{let u1=rL2(h,p1);return u1?[[gz(u1),p1]]:[]})),v=i.filter(p1=>!qO(p1)&&s_(p1)&&!g.has(p1)&&!f.has(gz(p1))),C=i.flatMap(p1=>{if(qO(p1))return[p1];let u1=g.get(p1)??f.get(gz(p1));return!u1&&s_(p1)?[]:[{logicalResourceId:u1?.logicalResourceId??p1,displayName:u1?.displayName??fc0}]}),L=new Map(C.map(p1=>[p1.logicalResourceId,p1.displayName])),y=o.flatMap(p1=>{let u1=g.get(p1)??f.get(gz(p1));return u1?[u1]:[]}),z=new Set(y.map(p1=>p1.logicalResourceId)),S=C.filter(p1=>!g.has(p1.logicalResourceId)),B=y.map(p1=>({logicalResourceId:p1.logicalResourceId,displayName:L.get(p1.logicalResourceId)??p1.displayName})),R=o.filter(p1=>s_(p1)&&!g.has(p1)&&!f.has(gz(p1))),F=a?u.filter(p1=>!z.has(p1.logicalResourceId)):[],N=await this.validateAndRegisterLinkedResources(t,R.map(p1=>({sourcePath:p1,displayName:fO5(p1)}))),j=N.descriptors,Y=new Set(j.map(p1=>p1.logicalResourceId)),t1=F.filter(p1=>!Y.has(p1.logicalResourceId));if(t1.length>0)try{await this.policyStore.removeProjectResources(eE(t),t1.map(p1=>p1.logicalResourceId)),dd1("removal","succeeded",t1.length)}catch{return dd1("removal","failed",t1.length),{value:[...C,...j,...n?[]:v],warning:WL1,linkedPathIdentities:[],addedLogicalResourceIds:N.descriptors.filter(p1=>!g.has(p1.logicalResourceId)).map(p1=>p1.logicalResourceId)}}let n1=[...S,...B,...j].filter((p1,u1,v1)=>v1.findIndex(h1=>h1.logicalResourceId===p1.logicalResourceId)===u1),a1=n?[]:N.failedSourcePaths;return{value:[...n1,...a1],linkedPathIdentities:[...new Set([...y.flatMap(p1=>{let u1=rL2(h,p1);return u1?[gz(u1)]:[]}),...N.linkedPathIdentities])],addedLogicalResourceIds:N.descriptors.filter(p1=>!g.has(p1.logicalResourceId)).map(p1=>p1.logicalResourceId),...n&&(N.unsupportedFailure||N.otherFailure)?{warning:N.unsupportedFailure?pO5:WL1}:{}}}async resolveContextResourcesDetailed(t){let r=UL1(t.metadata);try{return{resources:await this.resolveContextResourcesOrThrow(t,r),degraded:!1}}catch{return{resources:r.map(a=>({reference:qO(a)?a.logicalResourceId:a,displayName:qO(a)?a.displayName:fc0,available:!1})),degraded:!0}}}async resolveContextResources(t){return(await this.resolveContextResourcesDetailed(t)).resources}async resolveContextResourcesOrThrow(t,r){{let a=eE(t),[i,n]=await Promise.all([this.policyStore.getProjectPolicy(a),this.policyStore.getGlobalPolicy(a)]),o=new Set([...(n?.generations.current?.status?.failedGrants??[]).map(u=>u.grantId),...(i?.generations.current?.status?.failedGrants??[]).map(u=>u.grantId)]),h=new Map((i?.generations.current?.status?.failedGrants??[]).map(u=>[u.grantId,u]));return r.map(u=>{let g=qO(u)?u.logicalResourceId:u,f=i?.resources[g],v=f?FN4(i,f):void 0,C=v?.path,L=v?H12(v):void 0,y=v?h.get(v.id):void 0,z=qO(u)?u.displayName:f?.displayName??fc0;if(!C)return!qO(u)&&s_(u)?{reference:u,localPath:u,displayName:fO5(u),available:!0}:{reference:g,displayName:z,available:!1};let S=eO5(C,[...n?.grants??[],...i?.grants??[]],n?.denies??[],o);return{reference:g,localPath:C,displayName:z,available:!0,access:{grantId:v.id,operations:[...v.operations],effectiveOperations:S.operations,conflictingWriteGrants:rO5(v,S)},...L?{validationIssue:L}:{},...y?{materializationFailureCategory:y.category}:{}}})}}async removeContextResource(t,r){let a=UL1(t.metadata).filter(i=>(qO(i)?i.logicalResourceId:i)!==r);try{return await this.policyStore.removeProjectResources(eE(t),[r]),{value:[...a]}}catch{return{value:[...UL1(t.metadata)],warning:WL1}}}async relinkContextResource(t,r,a){let i=UL1(t.metadata),n=i.find(u=>(qO(u)?u.logicalResourceId:u)===r);if(!n)throw new Error("The linked project resource does not exist");let o=qO(n)?n.displayName:fc0,h=await this.validateAndRegisterLinkedResources(t,[{sourcePath:a,logicalResourceId:r,displayName:o,replaceExisting:!0}]);return h.unsupportedFailure?{value:[...i],warning:pO5}:h.otherFailure?{value:[...i],warning:WL1}:{value:i.map(u=>(qO(u)?u.logicalResourceId:u)===r?{logicalResourceId:r,displayName:o}:u)}}async validateAndRegisterLinkedResources(t,r){let a=await Promise.allSettled(r.map(async u=>({candidate:u,validation:await this.validateLinkedResource(u.sourcePath)}))),i=!1,n=!1,o=[],h=[];for(let[u,g]of a.entries())if(g.status==="rejected")n=!0,o.push(r[u].sourcePath);else if(!g.value.validation.supported)i=!0,o.push(r[u].sourcePath);else{let{candidate:f,validation:v}=g.value;h.push({sourcePath:f.sourcePath,registration:{logicalResourceId:f.logicalResourceId??this.createResourceId(),localPath:v.canonicalPath??f.sourcePath,displayName:f.displayName,resourceKind:"linked_project_file",...f.replaceExisting?{replaceExisting:!0}:{}}})}if(h.length===0)return{descriptors:[],linkedPathIdentities:[],failedSourcePaths:o,unsupportedFailure:i,otherFailure:n};try{let u=await this.policyStore.registerExactReadResources(eE(t),h.map(f=>f.registration)),g=h.flatMap(({sourcePath:f,registration:v})=>{let C=Object.values(u?.resources??{}).find(L=>{let y=FN4(u,L);return L.resourceKind==="linked_project_file"&&y?.kind==="exact_file"&&gz(y.path)===gz(v.localPath)});return C?[{descriptor:{logicalResourceId:C.logicalResourceId,displayName:C.displayName},sourcePathIdentity:gz(f)}]:[]});if(g.length!==h.length){n=!0;let f=new Set(g.map(v=>v.sourcePathIdentity));o.push(...h.filter(v=>!f.has(gz(v.sourcePath))).map(v=>v.sourcePath))}return dd1("registration","succeeded",h.length),{descriptors:g.map(f=>f.descriptor),linkedPathIdentities:g.map(f=>f.sourcePathIdentity),failedSourcePaths:o,unsupportedFailure:i,otherFailure:n}}catch{return dd1("registration","failed",h.length),{descriptors:[],linkedPathIdentities:[],failedSourcePaths:[...o,...h.map(u=>u.sourcePath)],unsupportedFailure:i,otherFailure:!0}}}async materializeCandidates(t,r){let i=(await Promise.allSettled(r.map(async n=>{let{localPath:o}=await t.materialize(n.request);return{logicalResourceId:n.logicalResourceId,localPath:o,displayName:n.request.fileName,source:n.source}}))).flatMap(n=>n.status==="fulfilled"?[n.value]:[]);return dd1("materialization",i.length===r.length?"succeeded":"failed",r.length),{successes:i}}async registerMaterialized(t,r,a){if(a.length===0)return[];try{return await this.policyStore.registerExactReadResources(eE(t),a.map(i=>({logicalResourceId:i.logicalResourceId,localPath:i.localPath,displayName:i.displayName,resourceKind:"owned_attachment_copy"}))),dd1("registration","succeeded",a.length),[...a]}catch{return dd1("registration","failed",a.length),await Promise.allSettled(a.map(i=>r.remove({projectId:t.id,localPath:i.localPath}))),[]}}},UO7=new IN4});function qO7(){return QE4?{storageKinds:new Set(["cloud-vfs-v1"]),capabilities:new Set(["cloud-project-files"])}:{storageKinds:new Set(["desktop-local-v1"]),capabilities:new Set(["desktop-project-files"])}}function $O7(e){if(!e||typeof e!="object")return!1;let t=e;return t.version===1&&typeof t.storageKind=="string"&&jO7.has(t.storageKind)&&Array.isArray(t.requiredCapabilities)&&t.requiredCapabilities.every(r=>typeof r=="string"&&WO7.has(r))}function KO7(e){let t=e?.[mc0];return t===void 0?UN4:$O7(t)?t:null}function YO7(){let e=QE4?GO7:UN4;return{...e,requiredCapabilities:[...e.requiredCapabilities]}}function $91(e){let t=KO7(e.metadata);if(!t)return!1;let r=qO7();return r.storageKinds.has(t.storageKind)&&t.requiredCapabilities.every(a=>r.capabilities.has(a))}function mO5({sessionId:e,projectId:t,projects:r,taskProjectMap:a}){let i=t??a[e];if(!i)return!0;let n=r.find(o=>o.id===i);return!n||$91(n)}function CO5(e){return{...e,[mc0]:YO7()}}function MO5(e,t){let r=e?.[mc0];return{...t,[mc0]:r??UN4}}var mc0,UN4,GO7,jO7,WO7,GN4=C1(()=>{WN();mc0="workspaceManifest",UN4={version:1,storageKind:"desktop-local-v1",requiredCapabilities:["desktop-project-files"]},GO7={version:1,storageKind:"cloud-vfs-v1",requiredCapabilities:["cloud-project-files"]},jO7=new Set(["desktop-local-v1","cloud-vfs-v1"]),WO7=new Set(["desktop-project-files","cloud-project-files"])});function LO5(e){xO5=e}function wO5(){return xO5}var xO5,jN4=C1(()=>{xO5=null});function zO5(){let e=typeof window<"u"?window.localConvApi:void 0;return!!e&&typeof e.mirrorRemote=="function"&&typeof e.getMirrorSessions=="function"&&typeof e.getMirrorProjects=="function"&&typeof e.getMirrorProjectAssignments=="function"&&typeof e.getMirrorMessages=="function"&&typeof e.getMirrorCachedSessionIds=="function"}async function Cc0(e){try{let t=await e();if(typeof t!="string")return null;let r=t.trim();return r.length===0||XO7.has(r.toLowerCase())?null:r}catch{return null}}async function bO5(){let e=wO5();if(!e)return null;let[t,r,a,i]=await Promise.all([Cc0(()=>e.getEnvironment()),Cc0(()=>e.getOrganizationId()),Cc0(()=>e.getTenantId()),Cc0(()=>e.getUserId())]),n=Oh1;return!t||!r||!a||!i||!n?null:{scopeKey:[t,r,a,i,n].map(encodeURIComponent).join("|"),environment:t,organizationId:r,tenantId:a,userId:i,productId:n}}function yO5(e){let t=e.storage_mode==="local"?"local":"remote";return{id:e._id,title:e.title??null,created_at:e.created_at??null,updated_at:e.updated_at??null,project_id:e.project_id??null,storage_mode:t,runner_mode:e.runner_mode??null,metadata:e.metadata??null,raw:e}}function AO5(e){return{...e,raw:e}}function JO7(e){let t=e.raw??{};return{...t,_id:String(t._id??e.id),title:t.title??e.title??void 0,created_at:t.created_at??e.created_at??void 0,updated_at:t.updated_at??e.updated_at??void 0,storage_mode:e.storage_mode==="local"?"local":"remote",runner_mode:t.runner_mode??e.runner_mode??void 0,metadata:t.metadata??e.metadata??void 0,project_id:e.project_id??void 0}}async function SO5(){return!ic("offlineMode")||!zO5()?null:(await bO5())?.scopeKey??null}async function HO5(){let e=await SO5();return e?(await window.localConvApi.getMirrorSessions(e)).map(JO7):[]}async function kO5(e){let t=await SO5();return t?window.localConvApi.getMirrorMessages(t,e):[]}async function WN4(e){if(!ic("offlineMode")||!zO5())return;let t=await bO5();if(t)switch(e.type){case"sessions.refresh":{let r={remote:[],local:[]};for(let a of e.sessions){let i=a.storage_mode==="local"?"local":"remote";r[i].push(yO5(a))}await Promise.all(["remote","local"].map(a=>window.localConvApi.mirrorRemote({type:"sessions.refresh",scope:t,mode:a,items:r[a],conversationLimit:aL2,authoritative:e.authoritativeMode===a})));return}case"session.upsert":{let r=e.session.storage_mode==="local"?"local":"remote";await window.localConvApi.mirrorRemote({type:"session.upsert",scope:t,mode:r,item:yO5(e.session),conversationLimit:aL2});return}case"session.patch":await window.localConvApi.mirrorRemote({type:"session.patch",scope:t,sessionId:e.sessionId,patch:e.patch});return;case"session.delete":await window.localConvApi.mirrorRemote({type:"session.delete",scope:t,sessionId:e.sessionId});return;case"projects.refresh":await window.localConvApi.mirrorRemote({type:"projects.refresh",scope:t,items:e.projects.map(AO5),conversationLimit:aL2,authoritative:!0});return;case"project.upsert":await window.localConvApi.mirrorRemote({type:"project.upsert",scope:t,item:AO5(e.project),conversationLimit:aL2});return;case"project.delete":await window.localConvApi.mirrorRemote({type:"project.delete",scope:t,projectId:e.projectId});return;case"project.assignment.set":await window.localConvApi.mirrorRemote({type:"project.assignment.set",scope:t,sessionId:e.sessionId,projectId:e.projectId});return;case"messages.replace":await window.localConvApi.mirrorRemote({type:"messages.replace",scope:t,sessionId:e.sessionId,messages:e.messages,conversationLimit:aL2,authoritative:e.authoritative??!1});return;default:{let r=e;throw new Error(`Unknown remote mirror command: ${JSON.stringify(r)}`)}}}function ud1(e){WN4(e).catch(t=>{console.warn(`[mirror] ${e.type} failed:`,t)})}async function u21(e,t){let r=await e();return ud1(t(r)),r}var aL2,XO7,lE1=C1(()=>{OO();wu();jN4();aL2=20;XO7=new Set(["unknown","unknown-environment","unknown-organization","unknown-tenant","unknown-user","unknown-user-id"])});function Mc0(e){return e?yx2(e)==="cartographer"?{[QO7]:lS5}:{}:{}}var QO7,qN4=C1(()=>{WN();jO();QO7="X-UiPath-CostAttributionProductId"});function BO5(){return TO5}function $N4(){return Promise.resolve(TO5)}var TO5,KN4=C1(()=>{});function eD7(e){if(!e?.access_token)return!1;let t=typeof e.expires_at=="number"&&e.expires_at>0?e.expires_at:e.profile?.exp;return typeof t=="number"&&t>Math.floor(Date.now()/1e3)}var tD7,xc0,AW,cE1,V12=C1(()=>{xM2();wu();qN4();gc0();jN4();n21();dj();KN4();tD7=e=>e.startsWith("Bearer ")?e:`Bearer ${e}`;xc0=class{async getHeaders(t){let{tenant:r,organization:a}=Mr.getState(),i=await this.getAccessToken(),n={"x-uipath-tenantid":r?.id??"","x-uipath-organizationid":a?.id??"","x-uipath-tenantname":r?.name??"","x-uipath-organizationname":a?.logicalName??"","x-uipath-cloud-url":FM,"X-UiPath-ConsumingProductId":Oh1,...Mc0(t)};i&&(n.Authorization=i);let o=await $N4();return o&&(n["X-UiPath-License"]=o),n}getLicenseType(){return $N4()}async getUserId(){let{user:t}=Mr.getState();return t.profile?.sub||"unknown-user-id"}async getUserName(){let{user:t}=Mr.getState();return t.profile?.name||"Unknown User"}async getUserEmail(){let{user:t}=Mr.getState();return t.profile?.email??t.profile?.name??"Unknown email"}async getTenantName(){let{tenant:t}=Mr.getState();return t?.name??""}async getOrganizationName(){let{organization:t}=Mr.getState();return t?.logicalName??""}async getEnvironment(){return FM}async getAccessToken(){if(typeof window<"u"&&window.assistantServicesApi?.isAssistantFirst)return this.getRobotAccessToken(window.assistantServicesApi);try{let t=await e61().getValidAccessToken();return t?`Bearer ${t}`:""}catch{let{user:t}=Mr.getState();return eD7(t)?`Bearer ${t.access_token}`:""}}async getRobotAccessToken(t){try{let r=await t.getAccessToken();return r?tD7(r):""}catch{return""}}async refreshAccessToken(){if(typeof window<"u"&&window.assistantServicesApi?.isAssistantFirst){let t=await window.assistantServicesApi.getAccessToken().catch(()=>"");t&&Mr.getState().reseedRobotToken(t);return}await e61().refreshAccessToken()}async getTenantId(){let{tenant:t}=Mr.getState();return t?.id??""}async getOrganizationId(){let{organization:t}=Mr.getState();return t?.id??""}},AW=new xc0,cE1=new xc0;LO5(AW);iO5(()=>cE1.getHeaders())});var YN4,Lc0,XN4=C1(()=>{L12();fQ1();iE1();DL1();eL2();uz();YN4=class{async requestApproval(t){let r=t.sessionId?kh(t.sessionId):void 0;if(Ox.decide("execution-approval",r)==="deny")return{approved:!1};if(t.sessionId){let a=KT.getState(),i=cd1(t.sessionId,pQ1());if(t.approvalKind==="foreground-control"){if(a.isForegroundControlAllowedForSessionOrAncestor(t.sessionId))return{approved:!0}}else if(t.approvalKind==="credential-injection"){if(a.isUnrestrictedForSessionOrAncestor(t.sessionId))return{approved:!0}}else if(i==="run_everything"||a.isSandboxDisabledForSessionOrAncestor(t.sessionId)||a.isUnrestrictedForSessionOrAncestor(t.sessionId))return{approved:!0}}return new Promise(a=>{let i=n=>{a({approved:n})};KT.getState().addPending(t.executionId,t,i)})}async requestElevationToken(t){let r=t?kh(t):void 0;return Ox.decide("elevation",r)==="deny"?null:ZN4(t&&r?{sessionId:t,turnPolicyOwnerSessionId:DV(t),turnPolicySnapshot:r}:void 0)}},Lc0=new YN4});function tU4(){return typeof window<"u"&&window.runnerWsApi!==void 0}var JN4,QN4,VO5=C1(()=>{JN4=class e{static CONNECTING=0;static OPEN=1;static CLOSING=2;static CLOSED=3;readyState=e.CONNECTING;id;disposers=[];openListeners=new Set;messageListeners=new Set;closeListeners=new Set;errorListeners=new Set;constructor(t,r,a){let i=window.runnerWsApi;if(i===void 0){queueMicrotask(()=>{this.readyState=e.CLOSED,this.dispatchError(new Error("runnerWsApi not available \u2014 preload script failed to expose the bridge")),this.dispatchClose(1006,"runnerWsApi unavailable")}),this.id="";return}this.id=`ws-${Date.now().toString(36)}-${crypto.randomUUID().slice(0,8)}`,this.disposers.push(i.onOpen(this.id,()=>this.handleOpen())),this.disposers.push(i.onMessage(this.id,o=>this.handleMessage(o))),this.disposers.push(i.onClose(this.id,(o,h)=>this.handleClose(o,h))),this.disposers.push(i.onError(this.id,o=>this.dispatchError(new Error(o)))),i.open(this.id,{url:t,protocols:r,headers:a?.headers}).catch(o=>{this.readyState!==e.CLOSED&&(this.dispatchError(o),this.handleClose(1006,o.message||"open failed"))})}send(t){if(window.runnerWsApi!==void 0){if(this.readyState!==e.OPEN){console.warn(`[IpcWebSocket] send() called in state=${this.readyState}; dropping ${t.length} bytes`);return}window.runnerWsApi.send(this.id,t).catch(r=>{this.dispatchError(r),this.handleClose(1006,r.message||"IPC send failed")})}}close(t,r){this.readyState===e.CLOSED||this.readyState===e.CLOSING||(this.readyState=e.CLOSING,window.runnerWsApi!==void 0&&window.runnerWsApi.close(this.id,t,r).catch(()=>{}))}addEventListener(t,r){switch(t){case"open":this.openListeners.add(r);return;case"message":this.messageListeners.add(r);return;case"close":this.closeListeners.add(r);return;case"error":this.errorListeners.add(r);return;default:console.warn(`[IpcWebSocket] addEventListener: unknown type ${t}`)}}removeEventListener(t,r){switch(t){case"open":this.openListeners.delete(r);return;case"message":this.messageListeners.delete(r);return;case"close":this.closeListeners.delete(r);return;case"error":this.errorListeners.delete(r);return}}handleOpen(){if(this.readyState===e.CONNECTING){this.readyState=e.OPEN;for(let t of this.openListeners)try{t()}catch(r){console.warn("[IpcWebSocket] open listener threw:",r)}}}handleMessage(t){for(let r of this.messageListeners)try{r({data:t})}catch(a){console.warn("[IpcWebSocket] message listener threw:",a)}}handleClose(t,r){if(this.readyState!==e.CLOSED){this.readyState=e.CLOSED,this.dispatchClose(t,r);for(let a of this.disposers)try{a()}catch(i){console.warn("[IpcWebSocket] disposer threw on close:",i)}}}dispatchClose(t,r){for(let a of this.closeListeners)try{a({code:t,reason:r})}catch(i){console.warn("[IpcWebSocket] close listener threw:",i)}}dispatchError(t){for(let r of this.errorListeners)try{r(t)}catch(a){console.warn("[IpcWebSocket] error listener threw:",a)}}},QN4=JN4});function gY(e,t){zW.setState(r=>({phases:{...r.phases,[e]:t}}))}function P12(e,t){zW.setState(r=>({errors:{...r.errors,[e]:t}}))}function sE1(e){zW.setState(t=>{if(t.errors[e]===void 0)return t;let r={...t.errors};return delete r[e],{errors:r}})}function eU4(e){zW.setState(t=>{if(t.allowedToolsBySession[e]===void 0)return t;let r={...t.allowedToolsBySession};return delete r[e],{allowedToolsBySession:r}})}function rU4(e){zW.setState(t=>({steerCancelIssuedAt:{...t.steerCancelIssuedAt,[e]:Date.now()}}))}function aU4(e){let t=zW.getState().steerCancelIssuedAt[e];return t!==void 0&&Date.now()-t<rD7}function _O5(e,t){zW.setState(r=>({decisionContexts:{...r.decisionContexts,[e]:t}}))}function iU4(e){zW.setState(t=>{if(t.decisionContexts[e]===void 0)return t;let r={...t.decisionContexts};return delete r[e],{decisionContexts:r}})}var PO5,zW,rD7,wc0=C1(()=>{PO5=w4(Lu(),1),zW=(0,PO5.create)(()=>({phases:{},errors:{},allowedToolsBySession:{},decisionContexts:{},steerCancelIssuedAt:{}}));rD7=15e3});function yc0(){let e={}.VITE_RUNNER_WS_URL??"",t=e.length>0?e:typeof process<"u"?process.env?.VITE_RUNNER_WS_URL??"":"";if(t.length===0)return"";if(t.includes(EO5))return t;let r=t;for(;r.endsWith("/");)r=r.slice(0,-1);return`${r}${EO5}`}var EO5,RO5=C1(()=>{EO5="/v1/control-plane/client-ws"});function _12(){return aD7}var aD7,nU4=C1(()=>{aD7=!1});function FO5(e){return lU4.add(e),()=>{lU4.delete(e)}}function nD7(e){let t=iL2.get(e);t!==void 0&&clearTimeout(t);let r=setTimeout(()=>{iL2.delete(e);for(let a of lU4)try{a(e)}catch(i){console.warn("[remoteRunnerService] output listener threw:",i)}},iD7);iL2.set(e,r)}function sU4(e,t,r){if(typeof window>"u"||(r??b5.getState().conversationStorageMode)!=="local")return;let i=window.localConvApi;i?.addMessages&&i.addMessages(e,[{id:t.id,type:t.type,content:t.content,created_at:t.created_at,visibility:10,committed:!0,created_by_user:t.type==="human"}]).catch(n=>{window.debugApi?.logWarn?.(`[remoteRunnerService] localConv mirror failed (${e}): ${n instanceof Error?n.message:String(n)}`)})}function oD7(e){let t=KT.getState(),r=t.pendingElevations??{},a=[];for(let[i,n]of Object.entries(r))n.request.sessionId===e&&a.push(i);for(let i of a)t.removePending(i),iU4(i)}function gd1(e,t){if(typeof window>"u")return;let r=t instanceof Error?t.message:String(t);window.debugApi?.logWarn?.(`[remoteRunnerService] cleanup (${e}) failed: ${r}`)}function ZO5(e){return e.startsWith("Bearer ")?e.slice(7):e}function lD7(e){if(typeof e!="object"||e===null)return;let t=e;if(t.kind==="message"&&typeof t.text=="string")return t.text}function oU4(e){return e instanceof eE1?new Error(wx2):e instanceof ld1?new Error("The remote session is no longer available."):e instanceof rE1?new Error("Remote desktops are not available for this request."):e instanceof Vb?new Error(e.message||"Remote runner returned an error."):e instanceof Error?e:new Error(String(e))}var lU4,iD7,iL2,cU4,d61,OO5=C1(()=>{zI4();V12();wd();XN4();VO5();X_();wc0();RO5();If();s61();L12();wc0();nU4();lU4=new Set;iD7=750,iL2=new Map;cU4=class{constructor(){this.entries=new Map;this.startsInFlight=new Map}isConfigured(){return yc0().length>0}getRemoteRef(t){return this.entries.get(t)?.remoteRef}getStorageMode(t){return this.entries.get(t)?.storageMode}getPhase(t){return zW.getState().phases[t]}async start(t,r){if(!this.isConfigured())throw new Error("Remote runner WS URL is not configured (VITE_RUNNER_WS_URL).");let a=this.entries.get(t);if(a?.remoteRef!==void 0)return{remoteRef:a.remoteRef};let i=this.startsInFlight.get(t);if(i!==void 0)return i;let n=this.startInternal(t,r);this.startsInFlight.set(t,n);try{return await n}finally{this.startsInFlight.delete(t)}}async send(t,r){let a=this.startsInFlight.get(t);a!==void 0&&await a;let i=this.requireEntry(t);try{await this.sendWithReadyRetry(i,r)}catch(n){throw(n instanceof ld1||n instanceof Error&&n.message.includes("no longer available"))&&this.tearDownEntry(i,"ended"),n}}async sendWithReadyRetry(t,r){let a=Date.now(),i=18e4,n=[500,1e3,2e3,4e3,8e3,8e3],o=0,h=!1;for(;;)try{await t.runner.send(r),h&&gY(t.sessionId,"connected");return}catch(u){let g=u instanceof Vb&&u.code==="session_not_ready",f=Date.now()-a;if(!g||f>=i)throw oU4(u);h||(h=!0,gY(t.sessionId,"provisioning"));let v=n[Math.min(o,n.length-1)];o+=1,window.debugApi?.log?.(`[remoteRunnerService] session_not_ready (${t.sessionId}); retrying in ${v}ms (attempt ${o})`),await new Promise(C=>setTimeout(C,v))}}async resume(t,r){if(!this.isConfigured())throw new Error("Remote runner WS URL is not configured (VITE_RUNNER_WS_URL).");if(this.entries.get(t)?.remoteRef===r)return;gY(t,"provisioning");let i=this.buildClient(t);await i.connect();let n=new aE1(i),o=Au.getState().history.find(u=>u.id===t)?.storage_mode,h={sessionId:t,remoteRef:r,client:i,runner:n,disposers:[],storageMode:o??b5.getState().conversationStorageMode};this.entries.set(t,h),this.wireListeners(h);try{let{snapshot:u}=await n.resume({ref:r});if(gY(t,"connected"),u!==void 0&&u.kind==="chat"&&u.pendingDecision!==void 0){let g=u.pendingDecision;this.handleDecisionRequest(h,g)}return u}catch(u){throw this.tearDownEntry(h,"ended"),oU4(u)}}async end(t){let r=this.entries.get(t);if(r){for(let i of r.disposers)try{i()}catch(n){gd1("disposer",n)}r.disposers.length=0;try{await r.runner.end()}catch(i){gd1("runner.end",i)}this.tearDownEntry(r,"ended");return}let a=Au.getState().history.find(i=>i.id===t)?.remote_ref;a!==void 0&&await this.sendOneShotChatEnd(a)}async sendOneShotChatEnd(t){if(!this.isConfigured())return;let r=new x12({url:yc0(),getToken:async()=>ZO5(await AW.getAccessToken()),...tU4()?{webSocketCtor:QN4}:{},reconnect:!1});try{await r.connect();let a=new aE1(r);try{await a.resume({ref:t})}catch(i){gd1("oneShot.resume",i);return}try{await a.end()}catch(i){gd1("oneShot.end",i)}}catch(a){gd1("oneShot.connect",a)}finally{try{r.disconnect()}catch(a){gd1("oneShot.disconnect",a)}}}disposeAll(){for(let t of Array.from(this.entries.values()))this.tearDownEntry(t,"ended");this.startsInFlight.clear()}async startInternal(t,r){gY(t,"provisioning");let a=this.buildClient(t);await a.connect();let i=new aE1(a),n={sessionId:t,client:a,runner:i,disposers:[],storageMode:b5.getState().conversationStorageMode};this.entries.set(t,n),this.wireListeners(n);try{let{ref:o}=await i.createChat({securityMode:r.securityMode});return n.remoteRef=o,this.persistRef(t,o,r.securityMode,n.storageMode),gY(t,"connected"),{remoteRef:o}}catch(o){throw this.tearDownEntry(n,"ended"),oU4(o)}}buildClient(t){let r=new x12({url:yc0(),getToken:async()=>ZO5(await AW.getAccessToken()),...tU4()?{webSocketCtor:QN4}:{}});return r.onClose(()=>{this.entries.has(t)&&zW.getState().phases[t]!=="ended"&&gY(t,"disconnected")}),r.onOpen(()=>{let a=this.entries.get(t);a===void 0||a.remoteRef===void 0||this.resumeAfterReconnect(t,a.remoteRef).catch(i=>{window.debugApi?.logWarn?.(`[remoteRunnerService] resume after reconnect failed (${t}): ${i instanceof Error?i.message:String(i)}`)})}),r}async resumeAfterReconnect(t,r){let a=this.entries.get(t);if(a!==void 0){gY(t,"provisioning");try{let{snapshot:i}=await a.runner.resume({ref:r});if(gY(t,"connected"),i!==void 0&&i.kind==="chat"&&i.pendingDecision!==void 0){let n=i.pendingDecision;this.handleDecisionRequest(a,n)}}catch(i){throw i instanceof ld1?this.tearDownEntry(a,"ended"):gY(t,"disconnected"),i}}}wireListeners(t){let r=t.runner.onOutput(n=>this.handleOutput(t,n)),a=t.runner.onDecisionRequest(n=>this.handleDecisionRequest(t,n)),i=t.runner.onEnded(n=>this.handleEnded(t,n));t.disposers.push(r,a,i)}handleOutput(t,r){let a=lD7(r);if(a===void 0)return;zW.getState().phases[t.sessionId]!=="connected"&&gY(t.sessionId,"connected");let i={id:`remote-${Date.now()}-${crypto.randomUUID().slice(0,8)}`,type:"ai",content:a,created_at:new Date().toISOString()};st.getState().addMessage(t.sessionId,i),sU4(t.sessionId,{id:i.id,type:"ai",content:a,created_at:i.created_at},t.storageMode),st.getState().setWaiting(!1,void 0,t.sessionId),st.getState().setLoading(t.sessionId,!1),nD7(t.sessionId)}handleDecisionRequest(t,r){if(zW.getState().allowedToolsBySession[t.sessionId]?.has(r.toolName)){t.runner.decide({executionId:r.executionId,choice:"accept"}).catch(n=>{window.debugApi?.logError?.(`[remoteRunnerService] auto-accept decide(${r.executionId}) failed: ${n instanceof Error?n.message:String(n)}`)});return}let i={executionId:r.executionId,toolName:r.toolName,command:typeof r.args.command=="string"?r.args.command:"",reason:typeof r.args.reason=="string"?r.args.reason:"",sessionId:t.sessionId};_O5(r.executionId,{toolName:r.toolName,args:r.args}),this.forwardElevationDecision(t,i)}async forwardElevationDecision(t,r){try{let a=await Lc0.requestApproval(r);await t.runner.decide({executionId:r.executionId,choice:a.approved?"accept":"reject"})}catch(a){window.debugApi?.logError?.(`[remoteRunnerService] decide(${r.executionId}) failed: ${a instanceof Error?a.message:String(a)}`)}finally{iU4(r.executionId)}}handleEnded(t,r){st.getState().setLoading(t.sessionId,!1);let a={id:`remote-end-${Date.now()}`,type:"system",content:`Remote session ended: ${r}`,created_at:new Date().toISOString()};st.getState().addMessage(t.sessionId,a);let i=r==="error"||r==="boot_failed"?"Task.Failed":"Task.Completed",n=Kr.getTaskDuration(t.sessionId);Kr.track(i,{taskId:t.sessionId,runnerMode:"remote",endedReason:r,...n!=null?{$duration:n}:{}}),Kr.clearSessionCategories(t.sessionId),this.tearDownEntry(t,"ended")}requireEntry(t){let r=this.entries.get(t);if(r===void 0)throw new Error(`No remote runner session for ${t}. Call start() first.`);return r}persistRef(t,r,a,i){st.getState().setRemoteRunnerInfo(t,{runnerMode:"remote",remoteRef:r,securityMode:a});let o=Au.getState().history.map(h=>h.id===t?{...h,runner_mode:"remote",remote_ref:r,storage_mode:i}:h);Au.setState({history:o})}tearDownEntry(t,r){for(let i of t.disposers)try{i()}catch(n){gd1("disposer",n)}try{t.runner.dispose()}catch(i){gd1("runner.dispose",i)}try{t.client.disconnect()}catch(i){gd1("client.disconnect",i)}let a=iL2.get(t.sessionId);a!==void 0&&(clearTimeout(a),iL2.delete(t.sessionId)),this.entries.delete(t.sessionId),gY(t.sessionId,r),sE1(t.sessionId),eU4(t.sessionId),oD7(t.sessionId)}};d61=new cU4});function Ac0(e,t){cD7.dispatch(e,t)}var hU4,cD7,DO5=C1(()=>{hU4=class{constructor(){this.middlewares=new Set}use(t){return this.middlewares.add(t),()=>this.middlewares.delete(t)}dispatch(t,r){let a={type:t,data:r};for(let i of this.middlewares)try{i(a)}catch{}}},cD7=new hU4});var IO5,NO5,UO5,GO5=C1(()=>{IO5=w4(Lu(),1),NO5=w4(vW(),1),UO5=(0,IO5.create)()((0,NO5.persist)((e,t)=>({notifications:[],addNotification:r=>{let a=`notif-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,i={...r,id:a,timestamp:Date.now(),read:!1,dismissable:r.dismissable??!0};return e(n=>({notifications:[i,...n.notifications].slice(0,50)})),r.autoDismissMs&&r.autoDismissMs>0&&setTimeout(()=>{t().removeNotification(a)},r.autoDismissMs),a},markAsRead:r=>{e(a=>({notifications:a.notifications.map(i=>i.id===r?{...i,read:!0}:i)}))},markAllAsRead:()=>{e(r=>({notifications:r.notifications.map(a=>({...a,read:!0}))}))},removeNotification:r=>{e(a=>({notifications:a.notifications.filter(i=>i.id!==r)}))},clearAll:()=>{e({notifications:[]})},getUnreadCount:()=>t().notifications.filter(r=>!r.read).length,getPendingActionsCount:()=>t().notifications.filter(r=>r.action&&!r.read).length}),{name:"aria-notifications",partialize:e=>({notifications:e.notifications.filter(t=>t.type!=="action")})}))});function hD7(e,t,r){let a=`${t}:${r?"timeout":"error"}`,i=nL2.get(e);if(!i){if(nL2.size>=sD7){let n=nL2.keys().next().value;n!==void 0&&nL2.delete(n)}i=new Set,nL2.set(e,i)}return i.has(a)?!1:(i.add(a),!0)}function dD7(e){let t=e.replace(/\s+/g," ").trim();return t.length>jO5?`${t.slice(0,jO5)}...`:t}function uD7(e,{timedOut:t,reason:r}){return t?`${e} hook timed out and was skipped.${e==="PreToolUse"||e==="PostToolUse"?" The tool call proceeded.":""}`:`${e} hook failed: ${dD7(r)||"unknown error"}.`}function oL2(e,t,r){if(!hD7(e,t,r.timedOut))return;let a=uD7(t,r);st.getState().addMessage(e,{id:(0,WO5.v4)(),type:"system",content:a,created_at:new Date().toISOString(),widget:"systemMessageRenderer"})}function hE1(e){let t=e.trim();return{timedOut:t.toLowerCase().includes("timed out"),reason:t}}var WO5,jO5,nL2,sD7,zc0=C1(()=>{WO5=w4(Km(),1);wd();jO5=200,nL2=new Map,sD7=32});function lL2(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function bc0(e,t=gD7){return typeof e=="string"&&e.trim()?e.trim():t}function qO5(e){return typeof e=="string"&&e.trim()?e.trim():void 0}var gD7,$O5=C1(()=>{gD7="Blocked by hook"});function Sc0(e){return e.startsWith(pD7)}var pD7,dU4=C1(()=>{pD7="plugin-hook:"});function KO5(e){uU4=e}async function YO5(e){if(!uU4)return null;try{return await uU4(e)}catch{return null}}var uU4,gU4=C1(()=>{uU4=null});function JO5(e){for(let t of XO5.values())if(t.routesInProcess?.(e))return!0;return!1}function QO5(){let e=fD7??window.hooksApi;for(let{layer:t}of XO5.values())e=t(e);return e}var fD7,XO5,tD5=C1(()=>{XO5=new Map});function rD5(){return{timedOut:!1,reason:eD5}}function vD7(e,t){return t?t.ownerSessionId??e:DV(e)??e}function mD7(e){let t={...e},r={hook_event_name:e.eventName};return typeof t.toolName=="string"&&(r.tool_name=t.toolName),t.toolInput!==void 0&&(r.tool_input=t.toolInput),typeof t.toolResult=="string"&&(r.tool_response={output:t.toolResult}),typeof t.sessionId=="string"&&(r.session_id=t.sessionId),typeof t.toolUseId=="string"&&(r.tool_use_id=t.toolUseId),typeof t.permissionMode=="string"&&(r.permission_mode=t.permissionMode),JSON.stringify({...t,...r})}async function pU4(e,t,r,a){let{command:i}=t,n=JO5(i);if(!n){let u=await YO5(i);if(u)return window.debugApi?.logWarn(`[LifecycleHooks] ${e} hook command blocked by policy: ${u.reason}`),{kind:"hookError",hookError:u}}let o=a?.snapshot??kh(r.sessionId),h=t.id!==void 0&&Sc0(t.id);if(o?.accessMode==="project_restricted"&&!n&&!h)return{kind:"restricted"};try{let u={hookId:t.id,command:i,stdinData:n?JSON.stringify(r):mD7(r),timeoutMs:t.timeoutMs,env:t.env,policySnapshotIdentity:o?g31(o):void 0,turnPolicyOwnerSessionId:o?vD7(r.sessionId,a):void 0};return{kind:"result",result:await QO5().execute(u)}}catch(u){let g=hE1(u instanceof Error?u.message:String(u));return window.debugApi?.logWarn(`[LifecycleHooks] Failed to execute ${e} hook: ${g.reason}`),{kind:"hookError",hookError:g}}}function fU4(e,t){return window.debugApi?.logWarn(`[LifecycleHooks] ${e} hook exited with code ${t.exitCode}: ${t.stderr.trim()}`),hE1(t.stderr||`exited with code ${t.exitCode}`)}function vU4(e){let t=e.trim();if(t)try{return JSON.parse(t)}catch{window.debugApi?.logWarn("[LifecycleHooks] Hook stdout was not valid JSON, using the neutral result");return}}async function aD5(e,t){let r=await pU4("PreToolUse",e,t);if(r.kind==="restricted")return{decision:"deny",reason:eD5};if(r.kind==="hookError")return{decision:"allow",hookError:r.hookError};let{result:a}=r;if(a.exitCode===2)return{decision:"deny",reason:bc0(a.stderr)};if(a.exitCode!==0)return{decision:"allow",hookError:fU4("PreToolUse",a)};let i=vU4(a.stdout);if(!lL2(i))return{decision:"allow"};let n=i;return n.decision==="deny"?{decision:"deny",reason:bc0(n.reason)}:n.decision!=="allow"?{decision:"allow"}:{decision:"allow",modifiedInput:lL2(n.modifiedInput)?n.modifiedInput:void 0}}async function iD5(e,t){let r=await pU4("PermissionRequest",e,t);if(r.kind==="restricted")return{decision:"defer",hookError:rD5()};if(r.kind==="hookError")return{decision:"defer",hookError:r.hookError};let{result:a}=r;if(a.exitCode===2)return{decision:"deny",reason:bc0(a.stderr)};if(a.exitCode!==0)return{decision:"defer",hookError:fU4("PermissionRequest",a)};let i=vU4(a.stdout);if(!lL2(i))return{decision:"defer"};let n=i;return{decision:n.decision==="allow"||n.decision==="deny"||n.decision==="defer"?n.decision:"defer",reason:qO5(n.reason)}}async function dE1(e,t,r,a){let i=await pU4(e,t,r,a);if(i.kind==="restricted")return{hookError:rD5()};if(i.kind==="hookError")return{hookError:i.hookError};let{result:n}=i;if(n.exitCode!==0)return{hookError:fU4(e,n)};let o=vU4(n.stdout);if(!lL2(o))return{};let h=o.message;return typeof h=="string"?{message:h}:{}}function nD5(e,t){return dE1("PermissionResolved",e,t)}function oD5(e,t,r){return dE1("PostToolUse",e,t,r)}function lD5(e,t,r){return dE1("PostToolUseFailure",e,t,r)}function cD5(e,t,r){return dE1("SessionStart",e,t,r)}function sD5(e,t,r){return dE1("UserPromptSubmit",e,t,r)}function hD5(e,t,r){return dE1("Stop",e,t,r)}function dD5(e,t,r){return dE1("AgentTurnEnd",e,t,r)}var eD5,uD5=C1(()=>{fj();$O5();dU4();uz();zc0();gU4();tD5();eD5="Local lifecycle hook commands are unavailable in restricted projects."});var E12,Hc0,cL2=C1(()=>{GO5();zc0();uD5();E12=3e3,Hc0=class{_regexCache=new Map;_detachedHooks=new Map;_ranOnce=new Set;_isOnceExhausted(t){return t.once===!0&&this._ranOnce.has(t.id)}_reserveOnce(t){for(let r of t)r.once&&this._ranOnce.add(r.id)}_releaseOnce(t){for(let r of t)r.once&&this._ranOnce.delete(r.id)}async runPreToolUse(t,r){let a=this._matchingHooks(t,r.eventName,r.toolName);if(a.length===0)return{decision:"allow"};this._reserveOnce(a);let i=r.toolInput,n;for(let[o,h]of a.entries())try{let u=await aD5(h,{...r,toolInput:i});if(n??=u.hookError,u.decision==="deny")return this._releaseOnce(a.slice(o+1)),{...u,hookError:u.hookError??n};u.modifiedInput&&(i=u.modifiedInput)}catch(u){window.debugApi?.logWarn(`[HookRegistry] PreToolUse hook "${h.name}" failed: ${u}`),n??=hE1(u instanceof Error?u.message:String(u))}return{decision:"allow",modifiedInput:i!==r.toolInput?i:void 0,hookError:n}}async runPermissionRequest(t,r){let a=this._matchingHooks(t,r.eventName,r.toolName);if(a.length===0)return{decision:"defer"};this._reserveOnce(a);let i="defer",n,o;for(let[h,u]of a.entries())try{let g=await iD5(u,r);if(o??=g.hookError,g.decision==="deny")return this._releaseOnce(a.slice(h+1)),{decision:"deny",reason:g.reason,hookError:g.hookError??o};g.decision==="allow"&&(i="allow",n??=g.reason)}catch(g){window.debugApi?.logWarn(`[HookRegistry] PermissionRequest hook "${u.name}" failed: ${g}`),o??=hE1(g instanceof Error?g.message:String(g))}return{decision:i,reason:n,hookError:o}}async runPermissionResolved(t,r){await this._runObservationalHooks(t,r,nD5)}async runPostToolUse(t,r,a){await this._runObservationalHooks(t,r,(i,n)=>oD5(i,n,a))}async runPostToolUseFailure(t,r,a){await this._runObservationalHooks(t,r,(i,n)=>lD5(i,n,a))}async runSessionStart(t,r,a){await this._runObservationalHooks(t,r,(i,n)=>cD5(i,n,a))}async runUserPromptSubmit(t,r,a){await this._runObservationalHooks(t,r,(i,n)=>sD5(i,n,a))}async runStop(t,r,a){await this._runObservationalHooks(t,r,(i,n)=>hD5(i,n,a))}async runAgentTurnEnd(t,r,a){await this._runObservationalHooks(t,r,(i,n)=>dD5(i,n,a))}async _runObservationalHooks(t,r,a){let i="toolName"in r&&typeof r.toolName=="string"?r.toolName:null,n=this._matchingHooks(t,r.eventName,i);if(n.length===0)return;this._reserveOnce(n);let o=async h=>{try{let u=await a(h,r);if(u.hookError){this._surfaceObservationalFailure(h,r.eventName,i,r.sessionId,u.hookError);return}h.silent||UO5.getState().addNotification({type:"success",title:h.name,message:u.message||`Hook "${h.name}" ran successfully`})}catch(u){let g=hE1(u instanceof Error?u.message:String(u));this._surfaceObservationalFailure(h,r.eventName,i,r.sessionId,g)}};for(let h of n){if(h.async){this._trackDetachedHook(r.sessionId,o(h));continue}await o(h)}}_trackDetachedHook(t,r){let a=this._detachedHooks.get(t)??new Set;a.add(r),this._detachedHooks.set(t,a),r.finally(()=>{a.delete(r),a.size===0&&this._detachedHooks.get(t)===a&&this._detachedHooks.delete(t)})}async settleDetachedHooks(t,r){let a=this._detachedHooks.get(t);if(!a?.size)return;let i,n=new Promise(o=>{i=setTimeout(o,r)});try{await Promise.race([Promise.all([...a]).then(()=>{}),n])}finally{i!==void 0&&clearTimeout(i)}}_surfaceObservationalFailure(t,r,a,i,n){let o=a===null?"":` for ${a}`;window.debugApi?.logWarn(`[HookRegistry] ${r} hook "${t.name}" failed${o}: ${n.reason}`),r!=="SessionStart"&&oL2(i,r,n)}_matchingHooks(t,r,a){return t.filter(i=>i.enabled&&i.eventName===r&&(a===null||this._matchesTool(i,a))&&!this._isOnceExhausted(i))}_matchesTool(t,r){let{matcher:a}=t;if(!a||a==="*")return!0;let i=this._regexCache.get(a);if(!i)try{i=new RegExp(a),this._regexCache.set(a,i)}catch{return r===a}return i.test(r)}}});function mU4(e){return typeof e=="string"&&CD7.has(e)}function MD7(e){return typeof e=="object"&&e!==null&&mU4(e.eventName)}function xD7(e){return{hooks:e.hooks.filter(t=>!t.transient&&mU4(t.eventName))}}function LD7(e){let t=typeof e=="object"&&e!==null?e:{};return{hooks:Array.isArray(t.hooks)?t.hooks.filter(MD7):[]}}function fD5(e){$O.setState(t=>({hooks:[...t.hooks.filter(r=>!Sc0(r.id)),...e.map(r=>({...r,transient:!0}))]}))}var gD5,pD5,Hk,CD7,$O,pd1=C1(()=>{gD5=w4(Lu(),1),pD5=w4(vW(),1);dU4();cL2();Hk=new Hc0,CD7=new Set(["SessionStart","UserPromptSubmit","PreToolUse","PermissionRequest","PermissionResolved","PostToolUse","PostToolUseFailure","Stop","AgentTurnEnd"]);$O=(0,gD5.create)()((0,pD5.persist)((e,t)=>({hooks:[],addHook:r=>{if(!mU4(r.eventName))return;let a=t().hooks,i=a.findIndex(n=>n.id===r.id);if(i>=0){let n=a.slice();n[i]=r,e({hooks:n})}else e({hooks:[...a,r]})},removeHook:r=>{e({hooks:t().hooks.filter(a=>a.id!==r)})},updateHook:(r,a)=>{e({hooks:t().hooks.map(i=>i.id===r?{...i,...a}:i)})}}),{name:"aria-hooks",version:1,migrate:LD7,partialize:e=>xD7(e)}))});async function sL2(e,t){try{await Hk.settleDetachedHooks(e,E12)}catch(r){window.debugApi?.logWarn(`[LifecycleHooks] Failed to settle detached hooks: ${r}`)}await oF5(e,t)}var CU4=C1(()=>{cL2();pd1();uz()});var vD5,R12,MU4=C1(()=>{vD5=w4(Lu(),1);iY();R12=(0,vD5.create)((e,t)=>({contextBySession:{},setApplicationContext:(r,a)=>e(i=>({contextBySession:{...i.contextBySession,[r]:a}})),clearApplicationContext:r=>e(a=>{let{[r]:i,...n}=a.contextBySession;return{contextBySession:n}}),getApplicationContext:r=>t().contextBySession[r]??[]}));lz(R12,"application-context-sync")});function kc0(e){let t=Yi0({skills:e.skills,enabledSkills:e.enabledSkills,lastEnabledByName:e.lastEnabledByName}).enabledSkills,r={};for(let a of e.skills){let i=t[a.location];i!==void 0&&(r[a.name]=i)}return r}var xU4=C1(()=>{hZ4()});function wD7(){let e={};try{let t=globalThis.localStorage?.getItem(CD5);if(t){let r=JSON.parse(t);if(r&&typeof r=="object")for(let[a,i]of Object.entries(r)){let n=i;n&&typeof n.goal=="string"&&typeof n.startedAt=="number"&&(e[a]={goal:n.goal,startedAt:n.startedAt,pausedMs:typeof n.pausedMs=="number"?n.pausedMs:0,pausedAt:typeof n.pausedAt=="number"?n.pausedAt:null})}}}catch{}return e}function hL2(e){try{globalThis.localStorage?.setItem(CD5,JSON.stringify(e))}catch{}}var mD5,CD5,_w,fd1=C1(()=>{mD5=w4(Lu(),1),CD5="delegate.goalSessions";_w=(0,mD5.create)((e,t)=>({sessions:wD7(),getGoal:r=>t().sessions[r]?.goal??null,getElapsedMs:r=>{let a=t().sessions[r];return a?(a.pausedAt??Date.now())-a.startedAt-a.pausedMs:null},setLocal:(r,a)=>e(i=>{let n={...i.sessions};if(a===null){if(!(r in n))return i;delete n[r]}else n[r]={goal:a,startedAt:Date.now(),pausedMs:0,pausedAt:null};return hL2(n),{sessions:n}}),suppressGoalCheck:r=>e(a=>{let i=a.sessions[r];if(!i||i.pausedAt!=null)return a;let n={...a.sessions,[r]:{...i,pausedAt:Date.now()}};return hL2(n),{sessions:n}}),resumeGoalCheck:r=>e(a=>{let i=a.sessions[r];if(!i||i.pausedAt==null)return a;let n={...a.sessions,[r]:{...i,pausedMs:i.pausedMs+(Date.now()-i.pausedAt),pausedAt:null}};return hL2(n),{sessions:n}}),isGoalCheckSuppressed:r=>t().sessions[r]?.pausedAt!=null,removeSessionState:r=>e(a=>{if(!(r in a.sessions))return a;let i={...a.sessions};return delete i[r],hL2(i),{sessions:i}}),clear:()=>{hL2({}),e({sessions:{}})}}))});function kk(){return{selectedGoals:[],selectedRole:null,scanResults:null,tabsAvailable:!1,curationPanelOpen:!1,curationActiveTab:"apps",curationRemoved:new Set,phase2Loading:!1,hasFiredFirstUserAction:!1,includedCategories:["apps","browser","files"],selectedRoutineTitles:new Set,hasFiredStarted:!1,hasFiredGoalsReached:!1,hasFiredScanPermissionReached:!1,hasFiredScanProgressReached:!1,hasFiredRoleInferred:!1,hasFiredRoutinesReached:!1,hasFiredScanRun:!1,scanRunIntent:null,scanHandoffAcked:!1,scanHandoffSent:!1,hasFiredCompleted:!1,hasFiredImportConversations:!1,firedPluginEvents:new Set,pendingInstallTriggerId:null,processedTriggerIds:new Set,hasShownTestcloudActivation:!1}}function xD5(e){dL2.getState().clearOnboardingState(e)}var MD5,kqi,dL2,Tc0=C1(()=>{MD5=w4(Lu());kqi=Object.freeze(kk()),dL2=(0,MD5.create)((e,t)=>{let r=a=>i=>{let n=t().slices[i]??kk();n[a]||e(o=>({slices:{...o.slices,[i]:{...n,[a]:!0}}}))};return{slices:{},setSelectedGoals:(a,i)=>{let n=t().slices[a]??kk();e(o=>({slices:{...o.slices,[a]:{...n,selectedGoals:i}}}))},setSelectedRole:(a,i)=>{let n=t().slices[a]??kk();n.selectedRole!==i&&e(o=>({slices:{...o.slices,[a]:{...n,selectedRole:i}}}))},setScanResults:(a,i)=>{let n=t().slices[a]??kk();e(o=>({slices:{...o.slices,[a]:{...n,scanResults:i}}}))},setTabsAvailable:(a,i)=>{let n=t().slices[a]??kk();e(o=>({slices:{...o.slices,[a]:{...n,tabsAvailable:i}}}))},setCurationPanelOpen:(a,i)=>{let n=t().slices[a]??kk();e(o=>({slices:{...o.slices,[a]:{...n,curationPanelOpen:i}}}))},setCurationActiveTab:(a,i)=>{let n=t().slices[a]??kk();e(o=>({slices:{...o.slices,[a]:{...n,curationActiveTab:i}}}))},toggleCurationRemoved:(a,i)=>{let n=t().slices[a]??kk(),o=new Set(n.curationRemoved);o.has(i)?o.delete(i):o.add(i),e(h=>({slices:{...h.slices,[a]:{...n,curationRemoved:o}}}))},setPhase2Loading:(a,i)=>{let n=t().slices[a]??kk();e(o=>({slices:{...o.slices,[a]:{...n,phase2Loading:i}}}))},markFiredFirstUserAction:a=>{let i=t().slices[a]??kk();i.hasFiredFirstUserAction||e(n=>({slices:{...n.slices,[a]:{...i,hasFiredFirstUserAction:!0}}}))},setIncludedCategories:(a,i)=>{let n=t().slices[a]??kk();e(o=>({slices:{...o.slices,[a]:{...n,includedCategories:i}}}))},toggleRoutineSelection:(a,i)=>{let n=t().slices[a]??kk(),o=new Set(n.selectedRoutineTitles);o.has(i)?o.delete(i):o.add(i),e(h=>({slices:{...h.slices,[a]:{...n,selectedRoutineTitles:o}}}))},markFiredStarted:r("hasFiredStarted"),markFiredGoalsReached:r("hasFiredGoalsReached"),markFiredScanPermissionReached:r("hasFiredScanPermissionReached"),markFiredScanProgressReached:r("hasFiredScanProgressReached"),markFiredRoleInferred:r("hasFiredRoleInferred"),markFiredRoutinesReached:r("hasFiredRoutinesReached"),markFiredScanRun:r("hasFiredScanRun"),markFiredCompleted:r("hasFiredCompleted"),markFiredImportConversations:a=>{let i=t().slices[a]??kk();i.hasFiredImportConversations||e(n=>({slices:{...n.slices,[a]:{...i,hasFiredImportConversations:!0}}}))},markPluginEventFired:(a,i)=>{let n=t().slices[a]??kk();if(n.firedPluginEvents.has(i))return;let o=new Set(n.firedPluginEvents);o.add(i),e(h=>({slices:{...h.slices,[a]:{...n,firedPluginEvents:o}}}))},hasPluginEventFired:(a,i)=>{let n=t().slices[a];return n?n.firedPluginEvents.has(i):!1},setPendingInstallTriggerId:(a,i)=>{let n=t().slices[a]??kk();n.pendingInstallTriggerId!==i&&e(o=>({slices:{...o.slices,[a]:{...n,pendingInstallTriggerId:i}}}))},markTriggerProcessed:(a,i)=>{let n=t().slices[a]??kk();if(n.processedTriggerIds.has(i))return;let o=new Set(n.processedTriggerIds);o.add(i),e(h=>({slices:{...h.slices,[a]:{...n,processedTriggerIds:o}}}))},hasTriggerBeenProcessed:(a,i)=>{let n=t().slices[a];return n?n.processedTriggerIds.has(i):!1},unmarkPluginEventFired:(a,i)=>{let n=t().slices[a];if(!n||!n.firedPluginEvents.has(i))return;let o=new Set(n.firedPluginEvents);o.delete(i),e(h=>({slices:{...h.slices,[a]:{...n,firedPluginEvents:o}}}))},setScanRunIntent:(a,i)=>{let n=t().slices[a]??kk();e(o=>({slices:{...o.slices,[a]:{...n,scanRunIntent:i}}}))},setScanHandoffAcked:(a,i)=>{let n=t().slices[a]??kk();n.scanHandoffAcked!==i&&e(o=>({slices:{...o.slices,[a]:{...n,scanHandoffAcked:i}}}))},setScanHandoffSent:(a,i)=>{let n=t().slices[a]??kk();n.scanHandoffSent!==i&&e(o=>({slices:{...o.slices,[a]:{...n,scanHandoffSent:i}}}))},clearOnboardingState:a=>{e(i=>{let{[a]:n,...o}=i.slices;return{slices:o}})},markTestcloudActivationShown:a=>{let i=t().slices[a]??kk();i.hasShownTestcloudActivation||e(n=>({slices:{...n.slices,[a]:{...i,hasShownTestcloudActivation:!0}}}))}}})});var Sp,vd1=C1(()=>{Sp=class e{constructor(t){this.value=t}static of(t){return new e(t)}get isAbsolute(){return this.value?this.value.startsWith("/")||/^[A-Za-z]:[\\/]/.test(this.value):!1}join(...t){let r=[this.value,...t],a=[];for(let u of r){let g=u.replace(/\\/g,"/");for(let f of g.split("/"))a.push(f)}let i=this.isAbsolute,n=this.value.replace(/\\/g,"/"),h=a.filter(Boolean).join("/");return i&&n.startsWith("/")?new e("/"+h):new e(h)}dirname(){let t=this.value.replace(/\\/g,"/").replace(/\/+$/,""),r=t.lastIndexOf("/");if(r===-1)return new e(".");if(r===0)return new e("/");let a=t.substring(0,r);return/^[A-Za-z]:$/.test(a)?new e(a+"/"):new e(a)}relativeTo(t){let r=(typeof t=="string"?t:t.toString()).replace(/\\/g,"/").replace(/\/$/,""),a=this.value.replace(/\\/g,"/").replace(/\/$/,"");if(a.startsWith(r+"/"))return new e(a.slice(r.length+1));let i=a.lastIndexOf("/");return new e(i>=0?a.slice(i+1):a)}requireAbsolute(t){if(!this.isAbsolute)throw new Error(t);return this}toString(){return this.value}}});function yD7(e){return e.replace(/\\/g,"/")}function LD5(e){return typeof e!="string"||e==="."||e===".."||e.includes("/")||e.includes("\\")}function AD7(e,t,r,a){return t&&a?LD5(t)?null:`${e}/projects/${t}`:t||LD5(r)?null:`${e}/sessions/${r}`}function u61(e,t,r,a){let i=AD7(e,t,r,a);return i===null?null:`${i}/wiki`}function wD5(e){let t=yD7(e).replace(/\/+$/,"");return!Sp.of(t).isAbsolute||!/\/wiki$/.test(t)?null:t.replace(/\/wiki$/,"/drafts")}var uE1=C1(()=>{vd1()});var Uf=M1(fZ=>{"use strict";var LU4=Symbol.for("yaml.alias"),yD5=Symbol.for("yaml.document"),Bc0=Symbol.for("yaml.map"),AD5=Symbol.for("yaml.pair"),wU4=Symbol.for("yaml.scalar"),Vc0=Symbol.for("yaml.seq"),md1=Symbol.for("yaml.node.type"),zD7=e=>!!e&&typeof e=="object"&&e[md1]===LU4,bD7=e=>!!e&&typeof e=="object"&&e[md1]===yD5,SD7=e=>!!e&&typeof e=="object"&&e[md1]===Bc0,HD7=e=>!!e&&typeof e=="object"&&e[md1]===AD5,zD5=e=>!!e&&typeof e=="object"&&e[md1]===wU4,kD7=e=>!!e&&typeof e=="object"&&e[md1]===Vc0;function bD5(e){if(e&&typeof e=="object")switch(e[md1]){case Bc0:case Vc0:return!0}return!1}function TD7(e){if(e&&typeof e=="object")switch(e[md1]){case LU4:case Bc0:case wU4:case Vc0:return!0}return!1}var BD7=e=>(zD5(e)||bD5(e))&&!!e.anchor;fZ.ALIAS=LU4;fZ.DOC=yD5;fZ.MAP=Bc0;fZ.NODE_TYPE=md1;fZ.PAIR=AD5;fZ.SCALAR=wU4;fZ.SEQ=Vc0;fZ.hasAnchor=BD7;fZ.isAlias=zD7;fZ.isCollection=bD5;fZ.isDocument=bD7;fZ.isMap=SD7;fZ.isNode=TD7;fZ.isPair=HD7;fZ.isScalar=zD5;fZ.isSeq=kD7});var uL2=M1(yU4=>{"use strict";var NV=Uf(),bW=Symbol("break visit"),SD5=Symbol("skip children"),K91=Symbol("remove node");function Pc0(e,t){let r=HD5(t);NV.isDocument(e)?Z12(null,e.contents,r,Object.freeze([e]))===K91&&(e.contents=null):Z12(null,e,r,Object.freeze([]))}Pc0.BREAK=bW;Pc0.SKIP=SD5;Pc0.REMOVE=K91;function Z12(e,t,r,a){let i=kD5(e,t,r,a);if(NV.isNode(i)||NV.isPair(i))return TD5(e,a,i),Z12(e,i,r,a);if(typeof i!="symbol"){if(NV.isCollection(t)){a=Object.freeze(a.concat(t));for(let n=0;n<t.items.length;++n){let o=Z12(n,t.items[n],r,a);if(typeof o=="number")n=o-1;else{if(o===bW)return bW;o===K91&&(t.items.splice(n,1),n-=1)}}}else if(NV.isPair(t)){a=Object.freeze(a.concat(t));let n=Z12("key",t.key,r,a);if(n===bW)return bW;n===K91&&(t.key=null);let o=Z12("value",t.value,r,a);if(o===bW)return bW;o===K91&&(t.value=null)}}return i}async function _c0(e,t){let r=HD5(t);NV.isDocument(e)?await F12(null,e.contents,r,Object.freeze([e]))===K91&&(e.contents=null):await F12(null,e,r,Object.freeze([]))}_c0.BREAK=bW;_c0.SKIP=SD5;_c0.REMOVE=K91;async function F12(e,t,r,a){let i=await kD5(e,t,r,a);if(NV.isNode(i)||NV.isPair(i))return TD5(e,a,i),F12(e,i,r,a);if(typeof i!="symbol"){if(NV.isCollection(t)){a=Object.freeze(a.concat(t));for(let n=0;n<t.items.length;++n){let o=await F12(n,t.items[n],r,a);if(typeof o=="number")n=o-1;else{if(o===bW)return bW;o===K91&&(t.items.splice(n,1),n-=1)}}}else if(NV.isPair(t)){a=Object.freeze(a.concat(t));let n=await F12("key",t.key,r,a);if(n===bW)return bW;n===K91&&(t.key=null);let o=await F12("value",t.value,r,a);if(o===bW)return bW;o===K91&&(t.value=null)}}return i}function HD5(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function kD5(e,t,r,a){if(typeof r=="function")return r(e,t,a);if(NV.isMap(t))return r.Map?.(e,t,a);if(NV.isSeq(t))return r.Seq?.(e,t,a);if(NV.isPair(t))return r.Pair?.(e,t,a);if(NV.isScalar(t))return r.Scalar?.(e,t,a);if(NV.isAlias(t))return r.Alias?.(e,t,a)}function TD5(e,t,r){let a=t[t.length-1];if(NV.isCollection(a))a.items[e]=r;else if(NV.isPair(a))e==="key"?a.key=r:a.value=r;else if(NV.isDocument(a))a.contents=r;else{let i=NV.isAlias(a)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}yU4.visit=Pc0;yU4.visitAsync=_c0});var AU4=M1(VD5=>{"use strict";var BD5=Uf(),VD7=uL2(),PD7={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},_D7=e=>e.replace(/[!,[\]{}]/g,t=>PD7[t]),gL2=class e{constructor(t,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,r)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,r){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let a=t.trim().split(/[ \t]+/),i=a.shift();switch(i){case"%TAG":{if(a.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),a.length<2))return!1;let[n,o]=a;return this.tags[n]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,a.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[n]=a;if(n==="1.1"||n==="1.2")return this.yaml.version=n,!0;{let o=/^\d+\.\d+$/.test(n);return r(6,`Unsupported YAML version ${n}`,o),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(t,r){if(t==="!")return"!";if(t[0]!=="!")return r(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(r(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&r("Verbatim tags must end with a >"),o)}let[,a,i]=t.match(/^(.*!)([^!]*)$/s);i||r(`The ${t} tag has no suffix`);let n=this.tags[a];if(n)try{return n+decodeURIComponent(i)}catch(o){return r(String(o)),null}return a==="!"?t:(r(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[r,a]of Object.entries(this.tags))if(t.startsWith(a))return r+_D7(t.substring(a.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],a=Object.entries(this.tags),i;if(t&&a.length>0&&BD5.isNode(t.contents)){let n={};VD7.visit(t.contents,(o,h)=>{BD5.isNode(h)&&h.tag&&(n[h.tag]=!0)}),i=Object.keys(n)}else i=[];for(let[n,o]of a)n==="!!"&&o==="tag:yaml.org,2002:"||(!t||i.some(h=>h.startsWith(o)))&&r.push(`%TAG ${n} ${o}`);return r.join(`
|
|
10890
|
+
${v}`,binary:null,base64:null}}})}var HF5,DF7,IF7,Wx2=C1(()=>{SF5();nE1();HF5=16e3,DF7=new Set(["image/png","image/jpeg","image/webp","image/gif","image/bmp","image/tiff","image/svg+xml","application/pdf"]),IF7=new Set(["zip","7z","rar","tar","gz","bz2","xz","tgz"])});function NF7(e,t=xg){let{sessionsBasePath:r,separator:a}=e;return{resolvePath:(i,n)=>[r,i,"attachments",n].join(a),exists:(i,n)=>t.exists(i,n),write:(i,n,o)=>t.writeFile(i,n,void 0,o)}}function jF7(e,t){let r=t.lastIndexOf(".");if(r!==-1){let a=t.slice(r);if(GF7.test(a))return a}return VF5.get(e)??".bin"}function gN4(e){let t=e.content;if(!t)return null;if(t.binary)return t.binary;if(t.base64)try{let r=t.base64.includes(",")?t.base64.split(",")[1]:t.base64;return xc1(r)}catch{return null}return t.text?new TextEncoder().encode(t.text):null}function $x2(e){let t=e;return!(t.oneShot||t.attachmentSource&&UF7.has(t.attachmentSource))}async function WF7(e,t,r,a){return Promise.all(t.map(async i=>{if(i.localPath||!$x2(i)||i.isDirectory||!i.uploadId)return i;let n=jF7(i.type,i.name),o=r.resolvePath(e,`${i.uploadId}${n}`);try{if(!await r.exists(o,a)){let u=gN4(i);if(!u)return Bt.warn(`[materializeAttachments] No bytes for attachment "${i.name}", skipping materialization.`),i;await r.write(o,u,a)}}catch(h){return Bt.error(`[materializeAttachments] Failed to write attachment "${i.name}" to ${o}: ${h instanceof Error?h.message:String(h)}`),i}return{...i,localPath:o}}))}async function ac0(e,t){if(t.length===0)return[];let r=qx2??(S12?await qF7(S12):null),a=kh(e),i=a?{sessionId:e,turnPolicyOwnerSessionId:DV(e),turnPolicySnapshot:a}:void 0,n=r?await WF7(e,t,r,i):t;return rc0([...n])}async function qF7(e){try{let t=await e.resolvePaths();return S12!==e?null:(qx2=NF7(t),qx2)}catch(t){return e.onError?.(t instanceof Error?t.message:String(t)),null}}function PF5(e,t){let r={resolvePaths:e,onError:t};return S12=r,qx2=null,()=>{S12===r&&(S12=null,qx2=null)}}var qx2,S12,UF7,VF5,GF7,Kx2=C1(()=>{kl2();WW2();qU1();t21();uz();Wx2();Lp();qx2=null,S12=null;UF7=new Set(["Screenshot"]),VF5=new Map;for(let[e,[t]]of Object.entries(NW2))t&&VF5.set(e,t);GF7=/^\.[A-Za-z0-9]{1,16}$/});function _F5(e){let t=e.replaceAll("\\","/"),r=t.startsWith("/"),a=t.split("/"),i=[],o=/^[a-z]:$/i.test(a[0]??"")?1:0;for(let h of a)if(!(!h||h===".")){if(h===".."){i.length>o&&i.pop();continue}i.push(h)}return i.length===0?"":`${r?"/":""}${i.join("/")}`}function $F7(){return typeof window<"u"&&window.electronAPI?.isMacOS===!0?"macos":"windows"}function gz(e,t=$F7()){let r=_F5(e);return t==="macos"?r.normalize("NFD"):r}function NL1(e){return _F5(e).toLowerCase()}var Yx2=C1(()=>{});var L9,ZF5,ic0,KF7,YF7,pN4,FF5,XF7,JF7,QF7,tO7,eO7,rO7,aO7,iO7,fN4,nO7,EF5,oO7,OF5,lO7,cO7,sO7,vN4,DF5,IF5,hO7,dO7,uO7,gO7,pO7,mN4,RF5,fO7,NF5,CN4=C1(()=>{L9=w4(li()),ZF5=L9.z.enum(["read","list","write","create","delete","execute"]),ic0=L9.z.number().int().nonnegative().safe(),KF7={id:L9.z.string(),kind:L9.z.literal("exact_file"),path:L9.z.string(),operations:L9.z.array(ZF5)},YF7={id:L9.z.string(),kind:L9.z.literal("recursive_directory"),path:L9.z.string(),operations:L9.z.array(ZF5)},pN4=L9.z.discriminatedUnion("kind",[L9.z.object(KF7),L9.z.object(YF7)]),FF5={userId:L9.z.string(),organizationId:L9.z.string(),tenantId:L9.z.string().nullable()},XF7=L9.z.object(FF5),JF7={...FF5,projectId:L9.z.string()},QF7=L9.z.object(JF7),tO7={grantId:L9.z.string(),category:L9.z.string()},eO7=L9.z.object(tO7),rO7=L9.z.preprocess(e=>e===null?void 0:e,L9.z.string().optional()),aO7=L9.z.preprocess(e=>e===null?void 0:e,L9.z.array(eO7).optional()),iO7={state:L9.z.enum(["not_started","recreating","active","inactive"]),retryable:L9.z.boolean(),message:rO7,failedGrants:aO7},fN4=L9.z.object(iO7),nO7={generationId:L9.z.string(),policyVersion:ic0,createdAt:L9.z.string(),status:fN4.optional(),composedPolicyVersion:L9.z.number().int().nonnegative().optional()},EF5=L9.z.object(nO7),oO7={current:EF5.optional(),pending:EF5.optional()},OF5=L9.z.object(oO7),lO7={logicalResourceId:L9.z.string(),displayName:L9.z.string(),grantId:L9.z.string(),resourceKind:L9.z.enum(["linked_project_file","owned_attachment_copy"]),grantOwnership:L9.z.enum(["resource_owned","independently_managed"])},cO7=L9.z.object(lO7),sO7={identity:XF7,grants:L9.z.array(pN4),denies:L9.z.array(pN4),policyVersion:ic0,generations:OF5},vN4=L9.z.object(sO7),DF5={identity:QF7,grants:L9.z.array(pN4),resources:L9.z.record(L9.z.string(),cO7),policyVersion:ic0,generations:OF5,deletedAt:L9.z.string().optional()},IF5=L9.z.object(DF5),hO7=L9.z.object(DF5).superRefine((e,t)=>{for(let r of Object.values(e.resources))e.grants.some(a=>a.id===r.grantId&&a.kind==="exact_file")||t.addIssue({code:L9.z.ZodIssueCode.custom,message:"Resource grant is missing or is not an exact file"})}),dO7={projectKey:L9.z.string(),markedAt:L9.z.string(),kind:L9.z.never().optional()},uO7=L9.z.object(dO7),gO7={kind:L9.z.literal("project_resource"),projectKey:L9.z.string(),markedAt:L9.z.string(),logicalResourceId:L9.z.string(),localPath:L9.z.string()},pO7=L9.z.object(gO7),mN4=L9.z.union([pO7,uO7]),RF5=e=>JSON.stringify(e),fO7={schemaVersion:L9.z.literal(2),installationId:L9.z.string(),policyVersion:ic0,globalScopes:L9.z.record(L9.z.string(),vN4),projectScopes:L9.z.record(L9.z.string(),hO7),cleanupQueue:L9.z.array(mN4)},NF5=L9.z.object(fO7).superRefine((e,t)=>{for(let[r,a]of Object.entries(e.globalScopes))r!==RF5([a.identity.userId,a.identity.organizationId,a.identity.tenantId])&&t.addIssue({code:L9.z.ZodIssueCode.custom,message:"Global policy key does not match its identity"});for(let[r,a]of Object.entries(e.projectScopes))r!==RF5([a.identity.userId,a.identity.organizationId,a.identity.tenantId,a.identity.projectId])&&t.addIssue({code:L9.z.ZodIssueCode.custom,message:"Project policy key does not match its identity"})})});function H12(e){if(e.kind!=="exact_file")return;let t=vO7.filter(r=>e.operations.includes(r));return t.length>0?{code:"exact_file_directory_operations",invalidOperations:t}:void 0}function Xx2(e){for(let t of e){let r=H12(t);if(r)throw new Error(`Exact-file grant "${t.id}" cannot include directory-only operations: ${r.invalidOperations.join(", ")}`)}}var MN4,vO7,nc0=C1(()=>{MN4=["read","write","delete","execute"],vO7=["list","create"]});function UF5(e){return e.composedPolicyVersion===wo2}function WF5(e){return JSON.stringify(e)}function lc0(e){return WF5([e.userId,e.organizationId,e.tenantId])}function h61(e){return WF5([e.userId,e.organizationId,e.tenantId,e.projectId])}function oc0(e){return"kind"in e&&e.kind==="project_resource"}function GF5(e,t){let r=NF5.safeParse(e);if(r.success&&r.data.installationId===t)return r.data;if(!e||typeof e!="object"||Array.isArray(e))return JU2(t);let a=e;if(a.schemaVersion!==2||a.installationId!==t)return JU2(t);let i={};if(a.globalScopes&&typeof a.globalScopes=="object"&&!Array.isArray(a.globalScopes))for(let[u,g]of Object.entries(a.globalScopes)){let f=vN4.safeParse(g);f.success&&lc0(f.data.identity)===u&&(i[u]=f.data)}let n={};if(a.projectScopes&&typeof a.projectScopes=="object"&&!Array.isArray(a.projectScopes))for(let[u,g]of Object.entries(a.projectScopes)){let f=IF5.safeParse(g);if(!f.success||h61(f.data.identity)!==u)continue;let v=new Set(f.data.grants.filter(C=>C.kind==="exact_file").map(C=>C.id));n[u]={...f.data,resources:Object.fromEntries(Object.entries(f.data.resources).filter(([,C])=>v.has(C.grantId)))}}let o=Array.isArray(a.cleanupQueue)?a.cleanupQueue.flatMap(u=>{let g=mN4.safeParse(u);return g.success?[g.data]:[]}):[],h=typeof a.policyVersion=="number"&&Number.isSafeInteger(a.policyVersion)&&a.policyVersion>=0?a.policyVersion:0;return{schemaVersion:2,installationId:t,policyVersion:h,globalScopes:i,projectScopes:n,cleanupQueue:o}}function xN4(e,t){return e.find(r=>r.id===t.grantId)}function mO7(e,t){let r=gz(t);return e.find(a=>a.kind==="exact_file"&&gz(a.path)===r)}function CO7(e,t){let r=`project-resource:${t}`;if(!e.some(i=>i.id===r))return r;let a=2;for(;e.some(i=>i.id===`${r}:${a}`);)a+=1;return`${r}:${a}`}function jF5(e){let t=r=>{let a=i=>i?{generationId:i.generationId,policyVersion:i.policyVersion,createdAt:i.createdAt}:void 0;return!r.current?.status&&!r.pending?.status?r:{...r.current?{current:a(r.current)}:{},...r.pending?{pending:a(r.pending)}:{}}};return{...e,globalScopes:Object.fromEntries(Object.entries(e.globalScopes).map(([r,a])=>[r,{...a,generations:t(a.generations)}])),projectScopes:Object.fromEntries(Object.entries(e.projectScopes).map(([r,a])=>[r,{...a,generations:t(a.generations)}]))}}function MO7(){return{get:async()=>typeof window>"u"||!window.settingsApi?{}:await window.settingsApi.get(),updatePartial:async e=>{typeof window>"u"||!window.settingsApi||await window.settingsApi.updatePartial(e)},compareAndSwapProjectAccessPolicy:async(e,t)=>typeof window>"u"||!window.settingsApi?!1:await window.settingsApi.compareAndSwapProjectAccessPolicy(e,t)}}function xO7(){return globalThis.crypto?.randomUUID?.()??`ephemeral-${Date.now()}`}function eE(e){return{projectId:e.id,userId:e.user_id,organizationId:e.organization_id,tenantId:e.tenant_id??null}}var cc0,LN4,W91,sc0=C1(()=>{fj();CN4();nc0();Yx2();fj();cc0=class extends Error{};LN4=class{constructor(t=MO7()){this.persistence=t}state=null;persistedState=null;installationId=null;initializePromise=null;pendingPersistence=Promise.resolve();pendingMutation=Promise.resolve();listeners=new Set;initialize(){return this.initializePromise||(this.initializePromise=this.persistence.get().then(t=>{let r=t.installationId??xO7();this.installationId=r;let a=GF5(t.projectAccessPolicy,r);this.persistedState=a,this.state=jF5(a)})),this.initializePromise}async getInstallationId(){if(await this.initialize(),!this.installationId)throw new Error("Project access policy store failed to initialize");return this.installationId}async getState(){if(await this.initialize(),!this.state)throw new Error("Project access policy store failed to initialize");return this.state}async getProjectPolicy(t){return(await this.getState()).projectScopes[h61(t)]}async getGlobalPolicy(t){return(await this.getState()).globalScopes[lc0(t)]}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}async ensureProjectPolicy(t){return await this.mutate(()=>this.ensureProjectPolicyCore(t))}async ensureProjectPolicyCore(t){let r=await this.getProjectPolicy(t);return r&&!r.deletedAt?r:await this.replaceProjectGrantsCore(t,[])}async replaceProjectGrants(t,r){return await this.mutate(()=>this.replaceProjectGrantsCore(t,r))}async replaceProjectGrantsCore(t,r){let a=await this.getState(),i=h61(t),n=a.projectScopes[i],o=n?.deletedAt?void 0:n,h=new Map((o?.grants??[]).map(f=>[f.id,f]));for(let f of r)JSON.stringify(h.get(f.id))!==JSON.stringify(f)&&Xx2([f]);if(o&&JSON.stringify(o.grants)===JSON.stringify(r))return o;let u=a.policyVersion+1,g={identity:t,grants:r.map(f=>({...f,operations:[...f.operations]})),resources:Object.fromEntries(Object.entries(o?.resources??{}).filter(([,f])=>r.some(v=>v.id===f.grantId&&v.kind==="exact_file"))),policyVersion:u,generations:this.nextPendingGenerations(o,u)};return await this.commitProjectPolicy(a,i,g,n?.deletedAt===void 0),g}async queueProjectGeneration(t){return await this.mutate(()=>this.queueProjectGenerationCore(t))}async queueProjectGenerationCore(t){let r=await this.getState(),a=h61(t),i=r.projectScopes[a],n=i?.deletedAt?void 0:i,o=r.policyVersion+1,h={identity:t,grants:n?.grants??[],resources:n?.resources??{},policyVersion:o,generations:this.nextPendingGenerations(n,o)};return await this.commitProjectPolicy(r,a,h,i?.deletedAt===void 0),h}async recordProjectGenerationStatus(t,r,a){return await this.mutate(()=>this.recordProjectGenerationStatusCore(t,r,a))}async recordProjectGenerationStatusCore(t,r,a){let i=await this.getState(),n=h61(t),o=i.projectScopes[n],h=o?.generations.current;if(!o||o.deletedAt||h?.generationId!==r||JSON.stringify(h.status)===JSON.stringify(a))return o;let u={...o,generations:{...o.generations,current:{...h,status:{...a}}}},g={...i,projectScopes:{...i.projectScopes,[n]:u}};return await this.commit(i,g),u}async registerExactReadResources(t,r){return await this.mutate(()=>this.registerExactReadResourcesCore(t,r))}async registerExactReadResourcesCore(t,r){if(r.length===0)return await this.getProjectPolicy(t);let a=await this.getState(),i=h61(t),n=a.projectScopes[i],o=n?.deletedAt?void 0:n,h={...o?.resources??{}},u=[...o?.grants??[]],g=!1;for(let L of r){let y=gz(L.localPath),z=Object.values(h).find(t1=>{let n1=xN4(u,t1);return n1?.kind==="exact_file"&&gz(n1.path)===y});if(z&&!L.replaceExisting)continue;let S=z?xN4(u,z):mO7(u,L.localPath),B=h[L.logicalResourceId],R=B!==void 0&&Object.values(h).some(t1=>t1.logicalResourceId!==L.logicalResourceId&&t1.grantId===B.grantId),F=L.replaceExisting&&B?.grantOwnership==="resource_owned"&&!R,N=S?.id??(F?B?.grantId??`project-resource:${L.logicalResourceId}`:CO7(u,L.logicalResourceId));if(!S){let t1={id:N,kind:"exact_file",path:L.localPath,operations:["read"]},n1=F?u.findIndex(a1=>a1.id===B?.grantId):-1;n1>=0?JSON.stringify(u[n1])!==JSON.stringify(t1)&&(u[n1]=t1,g=!0):(u.push(t1),g=!0)}let j=Object.values(h).some(t1=>t1.grantId===N&&t1.grantOwnership==="resource_owned"),Y={logicalResourceId:L.logicalResourceId,displayName:L.displayName,grantId:N,resourceKind:L.resourceKind,grantOwnership:!S||j?"resource_owned":"independently_managed"};if(JSON.stringify(h[L.logicalResourceId])!==JSON.stringify(Y)&&(h[L.logicalResourceId]=Y,g=!0),B?.grantOwnership==="resource_owned"&&B.grantId!==N&&!Object.values(h).some(t1=>t1.grantId===B.grantId)){let t1=u.findIndex(n1=>n1.id===B.grantId);t1>=0&&u.splice(t1,1)}}if(!g&&o)return o;let f=a.policyVersion+1,v={identity:t,grants:u,resources:h,policyVersion:f,generations:this.nextPendingGenerations(o,f)},C={...a,policyVersion:f,projectScopes:{...a.projectScopes,[i]:v},cleanupQueue:n?.deletedAt?a.cleanupQueue.filter(L=>L.projectKey!==i):a.cleanupQueue};return await this.commit(a,C),v}async removeProjectResources(t,r,a=new Date().toISOString()){return await this.mutate(()=>this.removeProjectResourcesCore(t,r,a))}async removeProjectResourcesCore(t,r,a){if(r.length===0)return await this.getProjectPolicy(t);let i=await this.getState(),n=h61(t),o=i.projectScopes[n];if(!o||o.deletedAt)return o;let h=new Set(r),u=Object.values(o.resources).filter(B=>h.has(B.logicalResourceId));if(u.length===0)return o;let g=Object.fromEntries(Object.entries(o.resources).filter(([B])=>!h.has(B))),f=Object.values(g),v=new Set(u.filter(B=>B.grantOwnership==="resource_owned"&&!f.some(R=>R.grantId===B.grantId)).map(B=>B.grantId)),C=o.grants.filter(B=>!v.has(B.id)),L=i.policyVersion+1,y={...o,grants:C,resources:g,policyVersion:L,generations:this.nextPendingGenerations(o,L)},z=[...i.cleanupQueue];for(let B of u.filter(R=>R.resourceKind==="owned_attachment_copy")){let R=xN4(o.grants,B)?.path;if(!R)continue;z.some(N=>"kind"in N&&N.kind==="project_resource"&&N.projectKey===n&&N.logicalResourceId===B.logicalResourceId&&N.localPath===R)||z.push({kind:"project_resource",projectKey:n,logicalResourceId:B.logicalResourceId,localPath:R,markedAt:a})}let S={...i,policyVersion:L,projectScopes:{...i.projectScopes,[n]:y},cleanupQueue:z};return await this.commit(i,S),y}async restoreProjectPolicyContents(t,r){return await this.mutate(()=>this.restoreProjectPolicyContentsCore(t,r))}async restoreProjectPolicyContentsCore(t,r){let a=(r?.grants??[]).map(L=>({...L,operations:[...L.operations]}));Xx2(a);let i=await this.getState(),n=h61(t),o=i.projectScopes[n],h=o?.deletedAt?void 0:o,u=Object.fromEntries(Object.entries(r?.resources??{}).map(([L,y])=>[L,{...y}])),g=new Set(Object.keys(u)),f=i.policyVersion+1,v={identity:t,grants:a,resources:u,policyVersion:f,generations:this.nextPendingGenerations(h,f)},C={...i,policyVersion:f,projectScopes:{...i.projectScopes,[n]:v},cleanupQueue:i.cleanupQueue.filter(L=>!oc0(L)||L.projectKey!==n||!g.has(L.logicalResourceId))};return await this.commit(i,C),v}async activateGlobalPolicyAtTurnBoundary(t){return await this.mutate(()=>this.activateGlobalPolicyAtTurnBoundaryCore(t))}async activateGlobalPolicyAtTurnBoundaryCore(t){let r=await this.getState(),a=lc0(t),i=r.globalScopes[a];if(i?.generations.current&&!i.generations.pending)return i;let n=i?.policyVersion??0,o=i?.generations.pending??i?.generations.current??{generationId:globalThis.crypto?.randomUUID?.()??`global-${Date.now()}`,policyVersion:n,createdAt:new Date().toISOString()},h={identity:t,grants:i?.grants??[],denies:i?.denies??[],policyVersion:n,generations:{current:o}},u={...r,globalScopes:{...r.globalScopes,[a]:h}};return await this.commit(r,u),h}async activateProjectPolicyAtTurnBoundary(t,r){return await this.mutate(()=>this.activateProjectPolicyAtTurnBoundaryCore(t,r))}async describeProjectPolicyPresence(t){let r=await this.getState(),a=h61(t),i=r.projectScopes[a],n=Object.keys(r.projectScopes).filter(h=>h!==a&&h.includes(JSON.stringify(t.projectId))).length;return`policy entry: ${i?i.deletedAt?`present but soft-deleted at ${i.deletedAt}`:`present (grants: ${i.grants.length}; current generation: ${i.generations.current?"yes":"no"}; pending: ${i.generations.pending?"yes":"no"})`:"absent"}; entries for this project under a different account identity: ${n}; project entries in state: ${Object.keys(r.projectScopes).length}`}async activateProjectPolicyAtTurnBoundaryCore(t,r){let a=await this.getState(),i=h61(t),n=a.projectScopes[i];if((!n||n.deletedAt)&&!r)return;let o=n?.deletedAt?void 0:n;if(o?.generations.current&&!o.generations.pending&&UF5(o.generations.current))return o;let h=o?.generations.pending??(o?.generations.current&&UF5(o.generations.current)?o.generations.current:void 0),u=o?.generations.current!==void 0&&h===void 0,g=u?a.policyVersion+1:o?.policyVersion??0,f=h??{generationId:globalThis.crypto?.randomUUID?.()??`project-${Date.now()}`,policyVersion:g,createdAt:new Date().toISOString(),composedPolicyVersion:wo2},v={identity:t,grants:o?.grants??[],resources:o?.resources??{},policyVersion:g,generations:{current:f}},C={...a,...u?{policyVersion:g}:{},projectScopes:{...a.projectScopes,[i]:v},cleanupQueue:n?.deletedAt?a.cleanupQueue.filter(L=>L.projectKey!==i):a.cleanupQueue};return await this.commit(a,C),v}async replaceGlobalPolicy(t,r){await this.mutate(()=>this.replaceGlobalPolicyCore(t,r))}async replaceGlobalPolicyCore(t,r){Xx2(r.grants),Xx2(r.denies);let a=await this.getState(),i=lc0(t),n=a.globalScopes[i],o=!n||n.policyVersion!==r.policyVersion||JSON.stringify(n.grants)!==JSON.stringify(r.grants)||JSON.stringify(n.denies)!==JSON.stringify(r.denies),h=(v,C)=>({generationId:globalThis.crypto?.randomUUID?.()??`${C}-${Date.now()}`,policyVersion:v,createdAt:new Date().toISOString(),composedPolicyVersion:wo2}),u={...r,identity:t,generations:o&&n?.generations.current?{current:n.generations.current,pending:h(r.policyVersion,"global")}:r.generations},g=o?Object.fromEntries(Object.entries(a.projectScopes).map(([v,C])=>!(C.identity.userId===t.userId&&C.identity.organizationId===t.organizationId&&C.identity.tenantId===t.tenantId)||C.deletedAt?[v,C]:[v,{...C,generations:{current:C.generations.current,pending:h(Math.max(C.policyVersion,r.policyVersion),"project")}}])):a.projectScopes,f={...a,policyVersion:Math.max(a.policyVersion,r.policyVersion),globalScopes:{...a.globalScopes,[i]:u},projectScopes:g};await this.commit(a,f)}async markProjectDeleted(t,r=new Date().toISOString()){await this.mutate(()=>this.markProjectDeletedCore(t,r))}async markProjectDeletedCore(t,r){let a=await this.getState(),i=h61(t),n=a.projectScopes[i],o=a.cleanupQueue.some(u=>u.projectKey===i&&!("kind"in u&&u.kind==="project_resource"))?a.cleanupQueue:[...a.cleanupQueue,{projectKey:i,markedAt:r}],h={...a,projectScopes:n?{...a.projectScopes,[i]:{...n,deletedAt:r}}:a.projectScopes,cleanupQueue:o};await this.commit(a,h)}async completeResourceCleanup(t){return await this.mutate(()=>this.completeResourceCleanupCore(t))}async completeResourceCleanupCore(t){let r=await this.getState();if(!r.cleanupQueue.some(h=>oc0(h)&&h.projectKey===t.projectKey&&h.logicalResourceId===t.logicalResourceId&&h.localPath===t.localPath&&h.markedAt===t.markedAt))return!1;let i=r.projectScopes[t.projectKey];if(i!==void 0&&!i.deletedAt&&Object.values(i.resources).some(h=>h.logicalResourceId===t.logicalResourceId))return!1;let o={...r,cleanupQueue:r.cleanupQueue.filter(h=>!(oc0(h)&&h.projectKey===t.projectKey&&h.logicalResourceId===t.logicalResourceId&&h.localPath===t.localPath&&h.markedAt===t.markedAt))};return await this.commit(r,o),!0}async completeProjectCleanup(t){return await this.mutate(()=>this.completeProjectCleanupCore(t))}async completeProjectCleanupCore(t){let r=await this.getState();if(!r.cleanupQueue.some(h=>!oc0(h)&&h.projectKey===t.projectKey&&h.markedAt===t.markedAt))return!1;let i=r.projectScopes[t.projectKey];if(i&&i.deletedAt!==t.markedAt)return!1;let n={...r.projectScopes};delete n[t.projectKey];let o={...r,projectScopes:n,cleanupQueue:r.cleanupQueue.filter(h=>h.projectKey!==t.projectKey)};return await this.commit(r,o),!0}async persist(t){let r=()=>this.persistence.updatePartial({projectAccessPolicy:t});this.pendingPersistence=this.pendingPersistence.then(r,r),await this.pendingPersistence}async mutate(t){let r=async()=>{for(let i=0;;i+=1)try{return await t()}catch(n){if(!(n instanceof cc0)||i>=7)throw n}},a=this.pendingMutation.then(r,r);return this.pendingMutation=a.then(()=>{},()=>{}),await a}async commit(t,r){let a=this.persistedState??t;this.state=r;try{if(this.persistence.compareAndSwapProjectAccessPolicy){if(!await this.persistence.compareAndSwapProjectAccessPolicy(a,r)){let n=await this.persistence.get();if(!this.installationId)throw new Error("Project access policy store failed to initialize");this.installationId=n.installationId??this.installationId;let o=GF5(n.projectAccessPolicy,this.installationId);throw this.persistedState=o,this.state=jF5(o),new cc0("Project access policy changed concurrently")}}else await this.persist(r);this.persistedState=r,this.publish()}catch(i){throw this.state===r&&(this.state=t),i}}async commitProjectPolicy(t,r,a,i){let n={...t,policyVersion:a.policyVersion,projectScopes:{...t.projectScopes,[r]:a},cleanupQueue:i?t.cleanupQueue:t.cleanupQueue.filter(o=>o.projectKey!==r)};await this.commit(t,n)}publish(){for(let t of this.listeners)t()}nextPendingGenerations(t,r){let a=t?.generations.pending?{generationId:t.generations.pending.generationId,createdAt:t.generations.pending.createdAt,policyVersion:r,...t.generations.pending.composedPolicyVersion!==void 0?{composedPolicyVersion:t.generations.pending.composedPolicyVersion}:{}}:{generationId:globalThis.crypto?.randomUUID?.()??`project-${Date.now()}`,policyVersion:r,createdAt:new Date().toISOString(),composedPolicyVersion:wo2};return{...t?.generations.current?{current:t.generations.current}:{},pending:a}}},W91=new LN4});function qO(e){if(e===null||typeof e!="object")return!1;let t=e;return typeof t.logicalResourceId=="string"&&t.logicalResourceId.length>0&&typeof t.displayName=="string"&&t.displayName.length>0}function UL1(e){if(!Array.isArray(e?.contextFiles))return[];let t=[];for(let r of e.contextFiles)typeof r=="string"?t.push(r):qO(r)&&t.push({logicalResourceId:r.logicalResourceId,displayName:r.displayName});return t}function qF5(e){if(e==="standard"||e==="project_restricted")return e;throw new hc0(e)}function k12(e){return!e||!Object.prototype.hasOwnProperty.call(e,"accessMode")?"standard":qF5(e.accessMode)}function wN4(e,t){let r=t.sandboxEnabled&&e.metadata?.accessMode?qF5(e.metadata.accessMode):void 0;return{...e,metadata:{...e.metadata??{},accessMode:t.sandboxEnabled?r??t.defaultMode:"standard"}}}function $F5(e){return e?e.screenContextDisabled===!0||e.screenContextDefault==="off":!1}function KF5(e){let t=e?.executionMode;return t==="autonomous"||t==="guided"||t==="background"?t:null}function q91(e){return e?.metadata?.template}function YF5(e){return LO7.has(e)}function uY(e){return Array.isArray(e)?e.filter(t=>typeof t=="string"):e&&typeof e=="object"?Object.keys(e):[]}function dc0(e){return uY(e)}var dY,hc0,LO7,d21=C1(()=>{dY=w4(F31());hc0=class extends Error{persistedValue;constructor(t){super("Invalid project accessMode in project metadata"),this.name="ProjectAccessModeConfigurationError",this.persistedValue=t}};LO7=new Set(["business-analysis","business-task"])});function T12(e){return ic("restrictedProjectAccess")?k12(e):"standard"}var yN4=C1(()=>{OO();d21()});function GL1(e,t){try{yO7(e,t)}catch{}}function yO7(e,t){wO7?.(e,{...t.scope?{scope:t.scope}:{},...t.accessMode?{accessMode:t.accessMode}:{},...t.policyVersion!==void 0?{policyVersion:t.policyVersion}:{},...t.generationState?{generationState:t.generationState}:{},...t.category?{category:t.category}:{},outcome:t.outcome,...t.retryable!==void 0?{retryable:t.retryable}:{},...t.itemKind?{itemKind:t.itemKind}:{},...t.itemCount!==void 0?{itemCount:t.itemCount}:{}},t.sessionId)}function AN4(e){if(e.kind==="denied"){GL1(Ur.ProjectAccessPolicySnapshot,{category:e.code,outcome:e.retryable?"retryable":"denied",retryable:e.retryable});return}let{snapshot:t}=e;GL1(Ur.ProjectAccessPolicySnapshot,{scope:t.scope.kind,accessMode:t.accessMode??"global",policyVersion:t.policyVersion,generationState:t.sandboxGeneration.status?.state??"not_started",outcome:"selected"})}function zN4(e,t){let r=t?.accessMode??"unknown";if(r==="project_restricted"){GL1(Ur.ProjectAccessCapabilityDecision,{scope:t?.scope.kind,accessMode:r,policyVersion:t?.policyVersion,category:e,outcome:"denied",retryable:!1});return}GL1(Ur.SandboxCapabilityDecision,{scope:t?.scope.kind,accessMode:r,policyVersion:t?.policyVersion,category:e,outcome:"denied",retryable:!1})}function bN4(e,t,r){GL1(Ur.SandboxCapabilityDecision,{accessMode:t?.accessMode??"unknown",category:e,outcome:"denied",retryable:!1,sessionId:r})}function dd1(e,t,r){GL1(Ur.ProjectAccessResourceLifecycle,{category:e,outcome:t,itemKind:"project_resource",itemCount:r})}function JF5(e){let t=AO7(e);return t===XF5?!1:(XF5=t,GL1(Ur.SandboxAvailability,{scope:"global",category:t,outcome:t==="kernel_isolation_active"||t==="validation_only"?"succeeded":"failed"}),!0)}function AO7(e){return e.isAvailable===void 0?"status_unavailable":e.isAvailable?e.isKernelIsolationActive?"kernel_isolation_active":"validation_only":"sandbox_unavailable"}function QF5(e){for(let[t,r]of e)GL1(Ur.SandboxFilesystemDecision,{scope:"project",category:t,outcome:"denied",itemCount:r,retryable:XU2(t)})}var wO7,XF5,B12=C1(()=>{fj();MW()});function bO7(e){return e.length===1&&e[0]==="read"}function eO5(e,t,r=[],a=new Set){if(r.some(o=>!H12(o)&&tO5(o,e)))return{operations:[],writeGrantSources:[]};let i=new Set,n=[];for(let o of t)if(!(a.has(o.id)||H12(o)||!tO5(o,e))){for(let h of o.operations)zO7.has(h)&&i.add(h);o.operations.includes("write")&&n.push({id:o.id,kind:o.kind,path:o.path})}return{operations:MN4.filter(o=>i.has(o)),writeGrantSources:n}}function rO5(e,t){return bO7(e.operations)?t.writeGrantSources.filter(r=>r.id!==e.id):[]}var zO7,tO5,aO5=C1(()=>{nc0();Yx2();zO7=new Set(MN4),tO5=(e,t)=>{if(e.kind==="exact_file")return gz(t)===gz(e.path);let r=NL1(e.path),a=NL1(t);return a===r||a.startsWith(`${r}/`)}});function iO5(e){SN4=e}async function uc0(){return SN4?SN4():{}}var SN4,gc0=C1(()=>{SN4=null});function kO7(e){try{let t=new URL(e);return t.port?Number(t.port):null}catch{return null}}function nO5(e,t,r){clearTimeout(t.timer),t.abortHandler&&r?.removeEventListener("abort",t.abortHandler);let a=pc0.get(e);a?.delete(t),a?.size===0&&pc0.delete(e)}function TO7(e){return!!(e&&ia.getState().backgroundPipDismissedBySession[e])}function oO5(){if(typeof window>"u")return;let e=window;e.__ariaWaitForPipPreviewReady=({baseUrl:t,sessionId:r,timeoutMs:a,abortSignal:i})=>{let n=kO7(t);if(!n||TO7(r))return Promise.resolve();let o=HO7.get(n)??0;return Date.now()-o<=SO7?Promise.resolve():new Promise((h,u)=>{let g={resolve:h,reject:u,timer:setTimeout(()=>{nO5(n,g,i),u(new Error(`Timed out waiting for PiP preview stream at ${t}`))},a)};g.abortHandler=()=>{nO5(n,g,i),u(new DOMException("Operation aborted","AbortError"))},i?.addEventListener("abort",g.abortHandler,{once:!0});let f=pc0.get(n)??new Set;f.add(g),pc0.set(n,f)})}}var SO7,HO7,pc0,lO5=C1(()=>{wu();WO();SO7=2e3,HO7=new Map,pc0=new Map});function HN4(e){return $04(e)}var cO5=C1(()=>{eG1()});var Jx2,kN4=C1(()=>{wu();Jx2=class{constructor(t,r,a){this.subMode=t;this.appStore=r;this.localSessionStore=a;this.previewSurface="pip-frames"}resolveUrl(t,r){return this.ensurePipStarted(r),`http://localhost:${FC2}`}ensurePipStarted(t){let r=this.appStore.getState(),a="ChildSession";if(r.pipModePreference!==a&&r.setPipModePreference(a),r.usePip&&r.pipState.status!=="off"&&r.pipState.status!=="error"){t&&this.localSessionStore.getState().backgroundPipDismissedBySession[t]?this.appStore.setState({isPipMiniWindowVisible:!1}):this.appStore.setState({isPipMiniWindowVisible:!0});return}this.appStore.getState().setUsePip(!0).finally(()=>{t&&this.localSessionStore.getState().backgroundPipDismissedBySession[t]&&this.appStore.setState({isPipMiniWindowVisible:!1})})}}});var Qx2,TN4=C1(()=>{wu();If();Qx2=class{constructor(){this.subMode="web-only";this.previewSurface="cdp-screenshots"}resolveUrl(t,r){return`http://localhost:${b5.getState().interopPort??N90}`}}});var tL2,BN4=C1(()=>{wu();tL2=class{constructor(t){this.getInteropPort=t;this.subMode="windows-native";this.previewSurface="cdp-screenshots"}resolveUrl(t,r){return`http://localhost:${this.getInteropPort()??N90}`}}});function VN4(e){let t=ia.getState(),r=e?t.sessionExecutionSettings[e]:void 0,a=b5.getState(),i=!!(e&&e===a.sessionId),n=!!(e&&(r||i));if((n?t.resolveExecutionMode(e):"guided")!=="background")return sO5;let h=n?t.resolveBackgroundSubMode(e):a.backgroundSubMode;return h==="windows-native"?VO7:h==="local-rdp"?BO7:sO5}var sO5,BO7,VO7,hO5=C1(()=>{If();WO();kN4();TN4();BN4();sO5=new Qx2,BO7=new Jx2("local-rdp",b5,ia),VO7=new tL2(()=>b5.getState().interopPort)});var dO5=C1(()=>{cO5();hO5();kN4();TN4();BN4()});function _N4(e){if(!e)return;let{backgroundOwnerSessionId:t}=b5.getState();if(t&&t!==e)throw new Error(PO7);t||(b5.setState({backgroundOwnerSessionId:e}),window.remotingApi?.pipSetSessionOwner?.(e))}function _O7(e,t){return t?e.subMode==="local-rdp":!1}function uO5(e,t,r){let a=ia.getState(),i=!!a.backgroundPipActiveBySession[e];r&&t==="native-host"&&a.markBackgroundSurfaceActive(e,"native-host"),a.markBackgroundPipActive(e),a.backgroundPipDismissedBySession[e]||b5.setState(n=>({isPipMiniWindowVisible:!0,pipState:{...n.pipState,...i?{}:{isExpanded:!0}}}))}var PN4,PO7,EN4,YT,oE1=C1(()=>{wu();If();pR4();WO();ii0();lO5();dO5();oO5();PN4=`http://localhost:${FC2}`,PO7="PiP background desktop is already in use by another conversation. Switch back to that conversation, stop its Offscreen RDP session, or use Web only for parallel browser work.";EN4=class{getToolsUrl(t,r){let a=r?.kind??HN4(r?.identifier),i=VN4(t),n=r?.activateSurface!==!1,o=b5.getState(),h=!!(t&&ia.getState().sessionExecutionSettings[t]),u=!!(t&&t===o.sessionId),g=i.subMode==="local-rdp",f=i.subMode==="web-only"&&!h&&!u&&o.backgroundOwnerSessionId===t;if(KC2.getState().context==="pip"&&a!=="cdp-browser"&&(g||f))return g&&(_N4(t),uO5(t,a,n)),PN4;_O7(i,t)&&_N4(t);let v=i.resolveUrl(r,t);return t&&n&&a==="cdp-browser"&&v!==PN4?ia.getState().markBackgroundSurfaceActive(t,"cdp-browser"):t&&n&&a==="native-host"&&i.subMode==="windows-native"&&ia.getState().clearBackgroundSurfaceActive(t),t&&v===PN4&&(_N4(t),uO5(t,a,n)),v}},YT=new EN4});var gO5={};qr(gO5,{getSecurityPolicy:()=>RO7,getSecurityService:()=>jL1,requestElevationToken:()=>ZN4,syncSecurityConfig:()=>EO7});function jL1(){return RN4||(RN4=new eQ1(YT,{getHeaders:uc0})),RN4}async function EO7(e){let t=jL1(),r=await t.syncPolicy(e),a=r?(await t.getPolicy())?.sandbox:void 0;return JF5({isAvailable:a?.isAvailable,isKernelIsolationActive:a?.isKernelIsolationActive}),r}async function RO7(e=!1){return jL1().getPolicy(e)}async function ZN4(e){return jL1().requestElevationToken(e)}var RN4,eL2=C1(()=>{ZO();gc0();B12();oE1();RN4=null});function ZO7(e,t){let r=[...e?[vO5]:[],...t?[WL1]:[]];return r.length>0?r.join(" "):void 0}function FO7(e,t,r){let a=[...e?[vO5]:[],...t?[t]:[],...r?[WL1]:[]],i=[...new Set(a)];return i.length>0?i.join(" "):void 0}function FN4(e,t){return e?.grants.find(r=>r.id===t.grantId)}function rL2(e,t){return FN4(e,t)?.path}function fO5(e){return e.split(/[/\\]/).pop()??"resource.bin"}function ON4(e){let{localPath:t,...r}=e;return{...r,oneShot:!0}}function DN4(e){let t=e.some(i=>i.isDirectory),r=e.some(i=>!i.isDirectory&&(i.localPath||$x2(i))),a=ZO7(t,r);return{value:e.map(i=>i.localPath||$x2(i)?ON4(i):i),...a?{warning:a}:{}}}function vc0(e,t){let r=aM(),a=r?.taskProjectMap[e],i=a?r?.projects.find(n=>n.id===a):void 0;if(!i)return{value:[...t]};try{if(T12(i.metadata)!=="project_restricted")return{value:[...t]}}catch{return DN4(t)}return UO7.prepareAttachments(i,t).catch(()=>DN4(t))}var WL1,vO5,pO5,fc0,OO7,DO7,IO7,NO7,IN4,UO7,NN4=C1(()=>{p31();Kx2();Yx2();sc0();jO();d21();yN4();B12();aO5();nc0();WL1="One or more files could not be added as durable project resources. Inline content was kept where available, but no local source path was shared.",vO5="Folders cannot be attached to restricted projects. Add the folder as an explicit project access grant instead.",pO5="This file location does not support secure linked-file access for restricted projects. Copy or move the file to an internal disk, then add it again.",fc0="Linked file";OO7=()=>window.projectResourceApi,DO7=()=>globalThis.crypto?.randomUUID?.()??`resource-${Date.now()}`,IO7=async e=>(await Promise.resolve().then(()=>(eL2(),gO5))).getSecurityService().validateLinkedResource(e),NO7=async(e,t)=>await aM()?.updateProject?.(e.id,{metadata:{...e.metadata,contextFiles:[...t]}})??!1;IN4=class{constructor(t=W91,r=OO7,a=DO7,i=IO7,n=NO7){this.policyStore=t;this.getApi=r;this.createResourceId=a;this.validateLinkedResource=i;this.persistContextFiles=n}async prepareAttachments(t,r){if(T12(t.metadata)!=="project_restricted")return{value:[...r]};let a;try{a=await this.policyStore.getProjectPolicy(eE(t))}catch{return DN4(r)}let i=UL1(t.metadata),n=new Set(i.map(j=>qO(j)?j.logicalResourceId:j)),o=new Set(Object.values(a?.resources??{}).flatMap(j=>{if(j.resourceKind!=="linked_project_file"||!n.has(j.logicalResourceId))return[];let Y=rL2(a,j);return Y?[gz(Y)]:[]})),h=new Set(Object.values(a?.resources??{}).flatMap(j=>{if(j.resourceKind!=="owned_attachment_copy")return[];let Y=rL2(a,j);return Y?[gz(Y)]:[]})),u=[],g=[],f=new Set,v=new Set,C=!1,L=!1;for(let j of r){if(!$x2(j)){f.add(j);continue}if(j.localPath&&h.has(gz(j.localPath))){f.add(j),v.add(j);continue}if(j.isDirectory){C=!0;continue}if(j.localPath){g.push(j);continue}let Y=this.createResourceId(),t1=gN4(j);t1?u.push({logicalResourceId:Y,request:{projectId:t.id,resourceId:Y,fileName:j.name,content:t1},source:j}):L=!0}let y=new Set,z;if(g.length>0){let j=[...i.map(t1=>qO(t1)?t1.logicalResourceId:t1),...g.flatMap(t1=>t1.localPath?[t1.localPath]:[])],Y=await this.syncContextFilesDetailed(t,j,{allowRemovals:!0});if(z=Y.warning,y=new Set(Y.linkedPathIdentities),JSON.stringify(Y.value)!==JSON.stringify(i)){let t1=!1;try{t1=await this.persistContextFiles(t,Y.value)}catch{t1=!1}if(!t1&&(z=WL1,y=o,Y.addedLogicalResourceIds.length>0))try{await this.policyStore.removeProjectResources(eE(t),Y.addedLogicalResourceIds)}catch{}}}let S=this.getApi(),B=[],R=L;if(u.length>0)if(!S)R=!0,dd1("resource_api_unavailable","failed",u.length);else{let j=await this.materializeCandidates(S,u);B=await this.registerMaterialized(t,S,j.successes),R||=B.length!==u.length}let F=new Map(B.map(j=>[j.source,j.localPath])),N=FO7(C,z,R);return{value:r.map(j=>{if(j.localPath&&y.has(gz(j.localPath)))return j;if(f.has(j))return j.localPath&&!v.has(j)?ON4(j):j;let Y=F.get(j);return Y?{...j,localPath:Y}:ON4(j)}),...N?{warning:N}:{}}}async currentContextReferences(t){let r=UL1(t.metadata);if(r.length===0)return[];let a=r.filter(h=>typeof h=="string"),i=r.filter(qO);if(i.length===0)return[...a];let n;try{n=await this.policyStore.getProjectPolicy(eE(t))}catch{n=void 0}let o=i.map(h=>{let u=n?.resources[h.logicalResourceId];return(u?rL2(n,u):void 0)??h.logicalResourceId});return[...a,...o]}async applyContextFileIntent(t,r){let a=r.mode==="reconcile"?[...r.desiredPaths]:r.mode==="add"?[...await this.currentContextReferences(t),...r.paths]:await this.currentContextReferences(t),i=await this.syncContextFilesDetailed(t,a,{allowRemovals:r.mode==="reconcile"});return{value:i.value,...i.warning?{warning:i.warning}:{}}}async syncContextFilesDetailed(t,r,{allowRemovals:a}){let i=UL1(t.metadata),n=!0;try{n=T12(t.metadata)==="project_restricted"}catch{n=!0}let o=[...new Map(r.map(p1=>[gz(p1),p1])).values()],h;try{h=await this.policyStore.getProjectPolicy(eE(t))}catch{return n?{value:[...i],warning:WL1,linkedPathIdentities:[],addedLogicalResourceIds:[]}:{value:[...o],linkedPathIdentities:[],addedLogicalResourceIds:[]}}let u=Object.values(h?.resources??{}).filter(p1=>p1.resourceKind==="linked_project_file"),g=new Map(u.map(p1=>[p1.logicalResourceId,p1])),f=new Map(u.flatMap(p1=>{let u1=rL2(h,p1);return u1?[[gz(u1),p1]]:[]})),v=i.filter(p1=>!qO(p1)&&s_(p1)&&!g.has(p1)&&!f.has(gz(p1))),C=i.flatMap(p1=>{if(qO(p1))return[p1];let u1=g.get(p1)??f.get(gz(p1));return!u1&&s_(p1)?[]:[{logicalResourceId:u1?.logicalResourceId??p1,displayName:u1?.displayName??fc0}]}),L=new Map(C.map(p1=>[p1.logicalResourceId,p1.displayName])),y=o.flatMap(p1=>{let u1=g.get(p1)??f.get(gz(p1));return u1?[u1]:[]}),z=new Set(y.map(p1=>p1.logicalResourceId)),S=C.filter(p1=>!g.has(p1.logicalResourceId)),B=y.map(p1=>({logicalResourceId:p1.logicalResourceId,displayName:L.get(p1.logicalResourceId)??p1.displayName})),R=o.filter(p1=>s_(p1)&&!g.has(p1)&&!f.has(gz(p1))),F=a?u.filter(p1=>!z.has(p1.logicalResourceId)):[],N=await this.validateAndRegisterLinkedResources(t,R.map(p1=>({sourcePath:p1,displayName:fO5(p1)}))),j=N.descriptors,Y=new Set(j.map(p1=>p1.logicalResourceId)),t1=F.filter(p1=>!Y.has(p1.logicalResourceId));if(t1.length>0)try{await this.policyStore.removeProjectResources(eE(t),t1.map(p1=>p1.logicalResourceId)),dd1("removal","succeeded",t1.length)}catch{return dd1("removal","failed",t1.length),{value:[...C,...j,...n?[]:v],warning:WL1,linkedPathIdentities:[],addedLogicalResourceIds:N.descriptors.filter(p1=>!g.has(p1.logicalResourceId)).map(p1=>p1.logicalResourceId)}}let n1=[...S,...B,...j].filter((p1,u1,v1)=>v1.findIndex(h1=>h1.logicalResourceId===p1.logicalResourceId)===u1),a1=n?[]:N.failedSourcePaths;return{value:[...n1,...a1],linkedPathIdentities:[...new Set([...y.flatMap(p1=>{let u1=rL2(h,p1);return u1?[gz(u1)]:[]}),...N.linkedPathIdentities])],addedLogicalResourceIds:N.descriptors.filter(p1=>!g.has(p1.logicalResourceId)).map(p1=>p1.logicalResourceId),...n&&(N.unsupportedFailure||N.otherFailure)?{warning:N.unsupportedFailure?pO5:WL1}:{}}}async resolveContextResourcesDetailed(t){let r=UL1(t.metadata);try{return{resources:await this.resolveContextResourcesOrThrow(t,r),degraded:!1}}catch{return{resources:r.map(a=>({reference:qO(a)?a.logicalResourceId:a,displayName:qO(a)?a.displayName:fc0,available:!1})),degraded:!0}}}async resolveContextResources(t){return(await this.resolveContextResourcesDetailed(t)).resources}async resolveContextResourcesOrThrow(t,r){{let a=eE(t),[i,n]=await Promise.all([this.policyStore.getProjectPolicy(a),this.policyStore.getGlobalPolicy(a)]),o=new Set([...(n?.generations.current?.status?.failedGrants??[]).map(u=>u.grantId),...(i?.generations.current?.status?.failedGrants??[]).map(u=>u.grantId)]),h=new Map((i?.generations.current?.status?.failedGrants??[]).map(u=>[u.grantId,u]));return r.map(u=>{let g=qO(u)?u.logicalResourceId:u,f=i?.resources[g],v=f?FN4(i,f):void 0,C=v?.path,L=v?H12(v):void 0,y=v?h.get(v.id):void 0,z=qO(u)?u.displayName:f?.displayName??fc0;if(!C)return!qO(u)&&s_(u)?{reference:u,localPath:u,displayName:fO5(u),available:!0}:{reference:g,displayName:z,available:!1};let S=eO5(C,[...n?.grants??[],...i?.grants??[]],n?.denies??[],o);return{reference:g,localPath:C,displayName:z,available:!0,access:{grantId:v.id,operations:[...v.operations],effectiveOperations:S.operations,conflictingWriteGrants:rO5(v,S)},...L?{validationIssue:L}:{},...y?{materializationFailureCategory:y.category}:{}}})}}async removeContextResource(t,r){let a=UL1(t.metadata).filter(i=>(qO(i)?i.logicalResourceId:i)!==r);try{return await this.policyStore.removeProjectResources(eE(t),[r]),{value:[...a]}}catch{return{value:[...UL1(t.metadata)],warning:WL1}}}async relinkContextResource(t,r,a){let i=UL1(t.metadata),n=i.find(u=>(qO(u)?u.logicalResourceId:u)===r);if(!n)throw new Error("The linked project resource does not exist");let o=qO(n)?n.displayName:fc0,h=await this.validateAndRegisterLinkedResources(t,[{sourcePath:a,logicalResourceId:r,displayName:o,replaceExisting:!0}]);return h.unsupportedFailure?{value:[...i],warning:pO5}:h.otherFailure?{value:[...i],warning:WL1}:{value:i.map(u=>(qO(u)?u.logicalResourceId:u)===r?{logicalResourceId:r,displayName:o}:u)}}async validateAndRegisterLinkedResources(t,r){let a=await Promise.allSettled(r.map(async u=>({candidate:u,validation:await this.validateLinkedResource(u.sourcePath)}))),i=!1,n=!1,o=[],h=[];for(let[u,g]of a.entries())if(g.status==="rejected")n=!0,o.push(r[u].sourcePath);else if(!g.value.validation.supported)i=!0,o.push(r[u].sourcePath);else{let{candidate:f,validation:v}=g.value;h.push({sourcePath:f.sourcePath,registration:{logicalResourceId:f.logicalResourceId??this.createResourceId(),localPath:v.canonicalPath??f.sourcePath,displayName:f.displayName,resourceKind:"linked_project_file",...f.replaceExisting?{replaceExisting:!0}:{}}})}if(h.length===0)return{descriptors:[],linkedPathIdentities:[],failedSourcePaths:o,unsupportedFailure:i,otherFailure:n};try{let u=await this.policyStore.registerExactReadResources(eE(t),h.map(f=>f.registration)),g=h.flatMap(({sourcePath:f,registration:v})=>{let C=Object.values(u?.resources??{}).find(L=>{let y=FN4(u,L);return L.resourceKind==="linked_project_file"&&y?.kind==="exact_file"&&gz(y.path)===gz(v.localPath)});return C?[{descriptor:{logicalResourceId:C.logicalResourceId,displayName:C.displayName},sourcePathIdentity:gz(f)}]:[]});if(g.length!==h.length){n=!0;let f=new Set(g.map(v=>v.sourcePathIdentity));o.push(...h.filter(v=>!f.has(gz(v.sourcePath))).map(v=>v.sourcePath))}return dd1("registration","succeeded",h.length),{descriptors:g.map(f=>f.descriptor),linkedPathIdentities:g.map(f=>f.sourcePathIdentity),failedSourcePaths:o,unsupportedFailure:i,otherFailure:n}}catch{return dd1("registration","failed",h.length),{descriptors:[],linkedPathIdentities:[],failedSourcePaths:[...o,...h.map(u=>u.sourcePath)],unsupportedFailure:i,otherFailure:!0}}}async materializeCandidates(t,r){let i=(await Promise.allSettled(r.map(async n=>{let{localPath:o}=await t.materialize(n.request);return{logicalResourceId:n.logicalResourceId,localPath:o,displayName:n.request.fileName,source:n.source}}))).flatMap(n=>n.status==="fulfilled"?[n.value]:[]);return dd1("materialization",i.length===r.length?"succeeded":"failed",r.length),{successes:i}}async registerMaterialized(t,r,a){if(a.length===0)return[];try{return await this.policyStore.registerExactReadResources(eE(t),a.map(i=>({logicalResourceId:i.logicalResourceId,localPath:i.localPath,displayName:i.displayName,resourceKind:"owned_attachment_copy"}))),dd1("registration","succeeded",a.length),[...a]}catch{return dd1("registration","failed",a.length),await Promise.allSettled(a.map(i=>r.remove({projectId:t.id,localPath:i.localPath}))),[]}}},UO7=new IN4});function qO7(){return QE4?{storageKinds:new Set(["cloud-vfs-v1"]),capabilities:new Set(["cloud-project-files"])}:{storageKinds:new Set(["desktop-local-v1"]),capabilities:new Set(["desktop-project-files"])}}function $O7(e){if(!e||typeof e!="object")return!1;let t=e;return t.version===1&&typeof t.storageKind=="string"&&jO7.has(t.storageKind)&&Array.isArray(t.requiredCapabilities)&&t.requiredCapabilities.every(r=>typeof r=="string"&&WO7.has(r))}function KO7(e){let t=e?.[mc0];return t===void 0?UN4:$O7(t)?t:null}function YO7(){let e=QE4?GO7:UN4;return{...e,requiredCapabilities:[...e.requiredCapabilities]}}function $91(e){let t=KO7(e.metadata);if(!t)return!1;let r=qO7();return r.storageKinds.has(t.storageKind)&&t.requiredCapabilities.every(a=>r.capabilities.has(a))}function mO5({sessionId:e,projectId:t,projects:r,taskProjectMap:a}){let i=t??a[e];if(!i)return!0;let n=r.find(o=>o.id===i);return!n||$91(n)}function CO5(e){return{...e,[mc0]:YO7()}}function MO5(e,t){let r=e?.[mc0];return{...t,[mc0]:r??UN4}}var mc0,UN4,GO7,jO7,WO7,GN4=C1(()=>{WN();mc0="workspaceManifest",UN4={version:1,storageKind:"desktop-local-v1",requiredCapabilities:["desktop-project-files"]},GO7={version:1,storageKind:"cloud-vfs-v1",requiredCapabilities:["cloud-project-files"]},jO7=new Set(["desktop-local-v1","cloud-vfs-v1"]),WO7=new Set(["desktop-project-files","cloud-project-files"])});function LO5(e){xO5=e}function wO5(){return xO5}var xO5,jN4=C1(()=>{xO5=null});function zO5(){let e=typeof window<"u"?window.localConvApi:void 0;return!!e&&typeof e.mirrorRemote=="function"&&typeof e.getMirrorSessions=="function"&&typeof e.getMirrorProjects=="function"&&typeof e.getMirrorProjectAssignments=="function"&&typeof e.getMirrorMessages=="function"&&typeof e.getMirrorCachedSessionIds=="function"}async function Cc0(e){try{let t=await e();if(typeof t!="string")return null;let r=t.trim();return r.length===0||XO7.has(r.toLowerCase())?null:r}catch{return null}}async function bO5(){let e=wO5();if(!e)return null;let[t,r,a,i]=await Promise.all([Cc0(()=>e.getEnvironment()),Cc0(()=>e.getOrganizationId()),Cc0(()=>e.getTenantId()),Cc0(()=>e.getUserId())]),n=Oh1;return!t||!r||!a||!i||!n?null:{scopeKey:[t,r,a,i,n].map(encodeURIComponent).join("|"),environment:t,organizationId:r,tenantId:a,userId:i,productId:n}}function yO5(e){let t=e.storage_mode==="local"?"local":"remote";return{id:e._id,title:e.title??null,created_at:e.created_at??null,updated_at:e.updated_at??null,project_id:e.project_id??null,storage_mode:t,runner_mode:e.runner_mode??null,metadata:e.metadata??null,raw:e}}function AO5(e){return{...e,raw:e}}function JO7(e){let t=e.raw??{};return{...t,_id:String(t._id??e.id),title:t.title??e.title??void 0,created_at:t.created_at??e.created_at??void 0,updated_at:t.updated_at??e.updated_at??void 0,storage_mode:e.storage_mode==="local"?"local":"remote",runner_mode:t.runner_mode??e.runner_mode??void 0,metadata:t.metadata??e.metadata??void 0,project_id:e.project_id??void 0}}async function SO5(){return!ic("offlineMode")||!zO5()?null:(await bO5())?.scopeKey??null}async function HO5(){let e=await SO5();return e?(await window.localConvApi.getMirrorSessions(e)).map(JO7):[]}async function kO5(e){let t=await SO5();return t?window.localConvApi.getMirrorMessages(t,e):[]}async function WN4(e){if(!ic("offlineMode")||!zO5())return;let t=await bO5();if(t)switch(e.type){case"sessions.refresh":{let r={remote:[],local:[]};for(let a of e.sessions){let i=a.storage_mode==="local"?"local":"remote";r[i].push(yO5(a))}await Promise.all(["remote","local"].map(a=>window.localConvApi.mirrorRemote({type:"sessions.refresh",scope:t,mode:a,items:r[a],conversationLimit:aL2,authoritative:e.authoritativeMode===a})));return}case"session.upsert":{let r=e.session.storage_mode==="local"?"local":"remote";await window.localConvApi.mirrorRemote({type:"session.upsert",scope:t,mode:r,item:yO5(e.session),conversationLimit:aL2});return}case"session.patch":await window.localConvApi.mirrorRemote({type:"session.patch",scope:t,sessionId:e.sessionId,patch:e.patch});return;case"session.delete":await window.localConvApi.mirrorRemote({type:"session.delete",scope:t,sessionId:e.sessionId});return;case"projects.refresh":await window.localConvApi.mirrorRemote({type:"projects.refresh",scope:t,items:e.projects.map(AO5),conversationLimit:aL2,authoritative:!0});return;case"project.upsert":await window.localConvApi.mirrorRemote({type:"project.upsert",scope:t,item:AO5(e.project),conversationLimit:aL2});return;case"project.delete":await window.localConvApi.mirrorRemote({type:"project.delete",scope:t,projectId:e.projectId});return;case"project.assignment.set":await window.localConvApi.mirrorRemote({type:"project.assignment.set",scope:t,sessionId:e.sessionId,projectId:e.projectId});return;case"messages.replace":await window.localConvApi.mirrorRemote({type:"messages.replace",scope:t,sessionId:e.sessionId,messages:e.messages,conversationLimit:aL2,authoritative:e.authoritative??!1});return;default:{let r=e;throw new Error(`Unknown remote mirror command: ${JSON.stringify(r)}`)}}}function ud1(e){WN4(e).catch(t=>{console.warn(`[mirror] ${e.type} failed:`,t)})}async function u21(e,t){let r=await e();return ud1(t(r)),r}var aL2,XO7,lE1=C1(()=>{OO();wu();jN4();aL2=20;XO7=new Set(["unknown","unknown-environment","unknown-organization","unknown-tenant","unknown-user","unknown-user-id"])});function Mc0(e){return e?yx2(e)==="cartographer"?{[QO7]:lS5}:{}:{}}var QO7,qN4=C1(()=>{WN();jO();QO7="X-UiPath-CostAttributionProductId"});function BO5(){return TO5}function $N4(){return Promise.resolve(TO5)}var TO5,KN4=C1(()=>{});function eD7(e){if(!e?.access_token)return!1;let t=typeof e.expires_at=="number"&&e.expires_at>0?e.expires_at:e.profile?.exp;return typeof t=="number"&&t>Math.floor(Date.now()/1e3)}var tD7,xc0,AW,cE1,V12=C1(()=>{xM2();wu();qN4();gc0();jN4();n21();dj();KN4();tD7=e=>e.startsWith("Bearer ")?e:`Bearer ${e}`;xc0=class{async getHeaders(t){let{tenant:r,organization:a}=Mr.getState(),i=await this.getAccessToken(),n={"x-uipath-tenantid":r?.id??"","x-uipath-organizationid":a?.id??"","x-uipath-tenantname":r?.name??"","x-uipath-organizationname":a?.logicalName??"","x-uipath-cloud-url":FM,"X-UiPath-ConsumingProductId":Oh1,...Mc0(t)};i&&(n.Authorization=i);let o=await $N4();return o&&(n["X-UiPath-License"]=o),n}getLicenseType(){return $N4()}async getUserId(){let{user:t}=Mr.getState();return t.profile?.sub||"unknown-user-id"}async getUserName(){let{user:t}=Mr.getState();return t.profile?.name||"Unknown User"}async getUserEmail(){let{user:t}=Mr.getState();return t.profile?.email??t.profile?.name??"Unknown email"}async getTenantName(){let{tenant:t}=Mr.getState();return t?.name??""}async getOrganizationName(){let{organization:t}=Mr.getState();return t?.logicalName??""}async getEnvironment(){return FM}async getAccessToken(){if(typeof window<"u"&&window.assistantServicesApi?.isAssistantFirst)return this.getRobotAccessToken(window.assistantServicesApi);try{let t=await e61().getValidAccessToken();return t?`Bearer ${t}`:""}catch{let{user:t}=Mr.getState();return eD7(t)?`Bearer ${t.access_token}`:""}}async getRobotAccessToken(t){try{let r=await t.getAccessToken();return r?tD7(r):""}catch{return""}}async refreshAccessToken(){if(typeof window<"u"&&window.assistantServicesApi?.isAssistantFirst){let t=await window.assistantServicesApi.getAccessToken().catch(()=>"");t&&Mr.getState().reseedRobotToken(t);return}await e61().refreshAccessToken()}async getTenantId(){let{tenant:t}=Mr.getState();return t?.id??""}async getOrganizationId(){let{organization:t}=Mr.getState();return t?.id??""}},AW=new xc0,cE1=new xc0;LO5(AW);iO5(()=>cE1.getHeaders())});var YN4,Lc0,XN4=C1(()=>{L12();fQ1();iE1();DL1();eL2();uz();YN4=class{async requestApproval(t){let r=t.sessionId?kh(t.sessionId):void 0;if(Ox.decide("execution-approval",r)==="deny")return{approved:!1};if(t.sessionId){let a=KT.getState(),i=cd1(t.sessionId,pQ1());if(t.approvalKind==="foreground-control"){if(a.isForegroundControlAllowedForSessionOrAncestor(t.sessionId))return{approved:!0}}else if(t.approvalKind==="credential-injection"){if(a.isUnrestrictedForSessionOrAncestor(t.sessionId))return{approved:!0}}else if(i==="run_everything"||a.isSandboxDisabledForSessionOrAncestor(t.sessionId)||a.isUnrestrictedForSessionOrAncestor(t.sessionId))return{approved:!0}}return new Promise(a=>{let i=n=>{a({approved:n})};KT.getState().addPending(t.executionId,t,i)})}async requestElevationToken(t){let r=t?kh(t):void 0;return Ox.decide("elevation",r)==="deny"?null:ZN4(t&&r?{sessionId:t,turnPolicyOwnerSessionId:DV(t),turnPolicySnapshot:r}:void 0)}},Lc0=new YN4});function tU4(){return typeof window<"u"&&window.runnerWsApi!==void 0}var JN4,QN4,VO5=C1(()=>{JN4=class e{static CONNECTING=0;static OPEN=1;static CLOSING=2;static CLOSED=3;readyState=e.CONNECTING;id;disposers=[];openListeners=new Set;messageListeners=new Set;closeListeners=new Set;errorListeners=new Set;constructor(t,r,a){let i=window.runnerWsApi;if(i===void 0){queueMicrotask(()=>{this.readyState=e.CLOSED,this.dispatchError(new Error("runnerWsApi not available \u2014 preload script failed to expose the bridge")),this.dispatchClose(1006,"runnerWsApi unavailable")}),this.id="";return}this.id=`ws-${Date.now().toString(36)}-${crypto.randomUUID().slice(0,8)}`,this.disposers.push(i.onOpen(this.id,()=>this.handleOpen())),this.disposers.push(i.onMessage(this.id,o=>this.handleMessage(o))),this.disposers.push(i.onClose(this.id,(o,h)=>this.handleClose(o,h))),this.disposers.push(i.onError(this.id,o=>this.dispatchError(new Error(o)))),i.open(this.id,{url:t,protocols:r,headers:a?.headers}).catch(o=>{this.readyState!==e.CLOSED&&(this.dispatchError(o),this.handleClose(1006,o.message||"open failed"))})}send(t){if(window.runnerWsApi!==void 0){if(this.readyState!==e.OPEN){console.warn(`[IpcWebSocket] send() called in state=${this.readyState}; dropping ${t.length} bytes`);return}window.runnerWsApi.send(this.id,t).catch(r=>{this.dispatchError(r),this.handleClose(1006,r.message||"IPC send failed")})}}close(t,r){this.readyState===e.CLOSED||this.readyState===e.CLOSING||(this.readyState=e.CLOSING,window.runnerWsApi!==void 0&&window.runnerWsApi.close(this.id,t,r).catch(()=>{}))}addEventListener(t,r){switch(t){case"open":this.openListeners.add(r);return;case"message":this.messageListeners.add(r);return;case"close":this.closeListeners.add(r);return;case"error":this.errorListeners.add(r);return;default:console.warn(`[IpcWebSocket] addEventListener: unknown type ${t}`)}}removeEventListener(t,r){switch(t){case"open":this.openListeners.delete(r);return;case"message":this.messageListeners.delete(r);return;case"close":this.closeListeners.delete(r);return;case"error":this.errorListeners.delete(r);return}}handleOpen(){if(this.readyState===e.CONNECTING){this.readyState=e.OPEN;for(let t of this.openListeners)try{t()}catch(r){console.warn("[IpcWebSocket] open listener threw:",r)}}}handleMessage(t){for(let r of this.messageListeners)try{r({data:t})}catch(a){console.warn("[IpcWebSocket] message listener threw:",a)}}handleClose(t,r){if(this.readyState!==e.CLOSED){this.readyState=e.CLOSED,this.dispatchClose(t,r);for(let a of this.disposers)try{a()}catch(i){console.warn("[IpcWebSocket] disposer threw on close:",i)}}}dispatchClose(t,r){for(let a of this.closeListeners)try{a({code:t,reason:r})}catch(i){console.warn("[IpcWebSocket] close listener threw:",i)}}dispatchError(t){for(let r of this.errorListeners)try{r(t)}catch(a){console.warn("[IpcWebSocket] error listener threw:",a)}}},QN4=JN4});function gY(e,t){zW.setState(r=>({phases:{...r.phases,[e]:t}}))}function P12(e,t){zW.setState(r=>({errors:{...r.errors,[e]:t}}))}function sE1(e){zW.setState(t=>{if(t.errors[e]===void 0)return t;let r={...t.errors};return delete r[e],{errors:r}})}function eU4(e){zW.setState(t=>{if(t.allowedToolsBySession[e]===void 0)return t;let r={...t.allowedToolsBySession};return delete r[e],{allowedToolsBySession:r}})}function rU4(e){zW.setState(t=>({steerCancelIssuedAt:{...t.steerCancelIssuedAt,[e]:Date.now()}}))}function aU4(e){let t=zW.getState().steerCancelIssuedAt[e];return t!==void 0&&Date.now()-t<rD7}function _O5(e,t){zW.setState(r=>({decisionContexts:{...r.decisionContexts,[e]:t}}))}function iU4(e){zW.setState(t=>{if(t.decisionContexts[e]===void 0)return t;let r={...t.decisionContexts};return delete r[e],{decisionContexts:r}})}var PO5,zW,rD7,wc0=C1(()=>{PO5=w4(Lu(),1),zW=(0,PO5.create)(()=>({phases:{},errors:{},allowedToolsBySession:{},decisionContexts:{},steerCancelIssuedAt:{}}));rD7=15e3});function yc0(){let e={}.VITE_RUNNER_WS_URL??"",t=e.length>0?e:typeof process<"u"?process.env?.VITE_RUNNER_WS_URL??"":"";if(t.length===0)return"";if(t.includes(EO5))return t;let r=t;for(;r.endsWith("/");)r=r.slice(0,-1);return`${r}${EO5}`}var EO5,RO5=C1(()=>{EO5="/v1/control-plane/client-ws"});function _12(){return aD7}var aD7,nU4=C1(()=>{aD7=!1});function FO5(e){return lU4.add(e),()=>{lU4.delete(e)}}function nD7(e){let t=iL2.get(e);t!==void 0&&clearTimeout(t);let r=setTimeout(()=>{iL2.delete(e);for(let a of lU4)try{a(e)}catch(i){console.warn("[remoteRunnerService] output listener threw:",i)}},iD7);iL2.set(e,r)}function sU4(e,t,r){if(typeof window>"u"||(r??b5.getState().conversationStorageMode)!=="local")return;let i=window.localConvApi;i?.addMessages&&i.addMessages(e,[{id:t.id,type:t.type,content:t.content,created_at:t.created_at,visibility:10,committed:!0,created_by_user:t.type==="human"}]).catch(n=>{window.debugApi?.logWarn?.(`[remoteRunnerService] localConv mirror failed (${e}): ${n instanceof Error?n.message:String(n)}`)})}function oD7(e){let t=KT.getState(),r=t.pendingElevations??{},a=[];for(let[i,n]of Object.entries(r))n.request.sessionId===e&&a.push(i);for(let i of a)t.removePending(i),iU4(i)}function gd1(e,t){if(typeof window>"u")return;let r=t instanceof Error?t.message:String(t);window.debugApi?.logWarn?.(`[remoteRunnerService] cleanup (${e}) failed: ${r}`)}function ZO5(e){return e.startsWith("Bearer ")?e.slice(7):e}function lD7(e){if(typeof e!="object"||e===null)return;let t=e;if(t.kind==="message"&&typeof t.text=="string")return t.text}function oU4(e){return e instanceof eE1?new Error(wx2):e instanceof ld1?new Error("The remote session is no longer available."):e instanceof rE1?new Error("Remote desktops are not available for this request."):e instanceof Vb?new Error(e.message||"Remote runner returned an error."):e instanceof Error?e:new Error(String(e))}var lU4,iD7,iL2,cU4,d61,OO5=C1(()=>{zI4();V12();wd();XN4();VO5();X_();wc0();RO5();If();s61();L12();wc0();nU4();lU4=new Set;iD7=750,iL2=new Map;cU4=class{constructor(){this.entries=new Map;this.startsInFlight=new Map}isConfigured(){return yc0().length>0}getRemoteRef(t){return this.entries.get(t)?.remoteRef}getStorageMode(t){return this.entries.get(t)?.storageMode}getPhase(t){return zW.getState().phases[t]}async start(t,r){if(!this.isConfigured())throw new Error("Remote runner WS URL is not configured (VITE_RUNNER_WS_URL).");let a=this.entries.get(t);if(a?.remoteRef!==void 0)return{remoteRef:a.remoteRef};let i=this.startsInFlight.get(t);if(i!==void 0)return i;let n=this.startInternal(t,r);this.startsInFlight.set(t,n);try{return await n}finally{this.startsInFlight.delete(t)}}async send(t,r){let a=this.startsInFlight.get(t);a!==void 0&&await a;let i=this.requireEntry(t);try{await this.sendWithReadyRetry(i,r)}catch(n){throw(n instanceof ld1||n instanceof Error&&n.message.includes("no longer available"))&&this.tearDownEntry(i,"ended"),n}}async sendWithReadyRetry(t,r){let a=Date.now(),i=18e4,n=[500,1e3,2e3,4e3,8e3,8e3],o=0,h=!1;for(;;)try{await t.runner.send(r),h&&gY(t.sessionId,"connected");return}catch(u){let g=u instanceof Vb&&u.code==="session_not_ready",f=Date.now()-a;if(!g||f>=i)throw oU4(u);h||(h=!0,gY(t.sessionId,"provisioning"));let v=n[Math.min(o,n.length-1)];o+=1,window.debugApi?.log?.(`[remoteRunnerService] session_not_ready (${t.sessionId}); retrying in ${v}ms (attempt ${o})`),await new Promise(C=>setTimeout(C,v))}}async resume(t,r){if(!this.isConfigured())throw new Error("Remote runner WS URL is not configured (VITE_RUNNER_WS_URL).");if(this.entries.get(t)?.remoteRef===r)return;gY(t,"provisioning");let i=this.buildClient(t);await i.connect();let n=new aE1(i),o=Au.getState().history.find(u=>u.id===t)?.storage_mode,h={sessionId:t,remoteRef:r,client:i,runner:n,disposers:[],storageMode:o??b5.getState().conversationStorageMode};this.entries.set(t,h),this.wireListeners(h);try{let{snapshot:u}=await n.resume({ref:r});if(gY(t,"connected"),u!==void 0&&u.kind==="chat"&&u.pendingDecision!==void 0){let g=u.pendingDecision;this.handleDecisionRequest(h,g)}return u}catch(u){throw this.tearDownEntry(h,"ended"),oU4(u)}}async end(t){let r=this.entries.get(t);if(r){for(let i of r.disposers)try{i()}catch(n){gd1("disposer",n)}r.disposers.length=0;try{await r.runner.end()}catch(i){gd1("runner.end",i)}this.tearDownEntry(r,"ended");return}let a=Au.getState().history.find(i=>i.id===t)?.remote_ref;a!==void 0&&await this.sendOneShotChatEnd(a)}async sendOneShotChatEnd(t){if(!this.isConfigured())return;let r=new x12({url:yc0(),getToken:async()=>ZO5(await AW.getAccessToken()),...tU4()?{webSocketCtor:QN4}:{},reconnect:!1});try{await r.connect();let a=new aE1(r);try{await a.resume({ref:t})}catch(i){gd1("oneShot.resume",i);return}try{await a.end()}catch(i){gd1("oneShot.end",i)}}catch(a){gd1("oneShot.connect",a)}finally{try{r.disconnect()}catch(a){gd1("oneShot.disconnect",a)}}}disposeAll(){for(let t of Array.from(this.entries.values()))this.tearDownEntry(t,"ended");this.startsInFlight.clear()}async startInternal(t,r){gY(t,"provisioning");let a=this.buildClient(t);await a.connect();let i=new aE1(a),n={sessionId:t,client:a,runner:i,disposers:[],storageMode:b5.getState().conversationStorageMode};this.entries.set(t,n),this.wireListeners(n);try{let{ref:o}=await i.createChat({securityMode:r.securityMode});return n.remoteRef=o,this.persistRef(t,o,r.securityMode,n.storageMode),gY(t,"connected"),{remoteRef:o}}catch(o){throw this.tearDownEntry(n,"ended"),oU4(o)}}buildClient(t){let r=new x12({url:yc0(),getToken:async()=>ZO5(await AW.getAccessToken()),...tU4()?{webSocketCtor:QN4}:{}});return r.onClose(()=>{this.entries.has(t)&&zW.getState().phases[t]!=="ended"&&gY(t,"disconnected")}),r.onOpen(()=>{let a=this.entries.get(t);a===void 0||a.remoteRef===void 0||this.resumeAfterReconnect(t,a.remoteRef).catch(i=>{window.debugApi?.logWarn?.(`[remoteRunnerService] resume after reconnect failed (${t}): ${i instanceof Error?i.message:String(i)}`)})}),r}async resumeAfterReconnect(t,r){let a=this.entries.get(t);if(a!==void 0){gY(t,"provisioning");try{let{snapshot:i}=await a.runner.resume({ref:r});if(gY(t,"connected"),i!==void 0&&i.kind==="chat"&&i.pendingDecision!==void 0){let n=i.pendingDecision;this.handleDecisionRequest(a,n)}}catch(i){throw i instanceof ld1?this.tearDownEntry(a,"ended"):gY(t,"disconnected"),i}}}wireListeners(t){let r=t.runner.onOutput(n=>this.handleOutput(t,n)),a=t.runner.onDecisionRequest(n=>this.handleDecisionRequest(t,n)),i=t.runner.onEnded(n=>this.handleEnded(t,n));t.disposers.push(r,a,i)}handleOutput(t,r){let a=lD7(r);if(a===void 0)return;zW.getState().phases[t.sessionId]!=="connected"&&gY(t.sessionId,"connected");let i={id:`remote-${Date.now()}-${crypto.randomUUID().slice(0,8)}`,type:"ai",content:a,created_at:new Date().toISOString()};st.getState().addMessage(t.sessionId,i),sU4(t.sessionId,{id:i.id,type:"ai",content:a,created_at:i.created_at},t.storageMode),st.getState().setWaiting(!1,void 0,t.sessionId),st.getState().setLoading(t.sessionId,!1),nD7(t.sessionId)}handleDecisionRequest(t,r){if(zW.getState().allowedToolsBySession[t.sessionId]?.has(r.toolName)){t.runner.decide({executionId:r.executionId,choice:"accept"}).catch(n=>{window.debugApi?.logError?.(`[remoteRunnerService] auto-accept decide(${r.executionId}) failed: ${n instanceof Error?n.message:String(n)}`)});return}let i={executionId:r.executionId,toolName:r.toolName,command:typeof r.args.command=="string"?r.args.command:"",reason:typeof r.args.reason=="string"?r.args.reason:"",sessionId:t.sessionId};_O5(r.executionId,{toolName:r.toolName,args:r.args}),this.forwardElevationDecision(t,i)}async forwardElevationDecision(t,r){try{let a=await Lc0.requestApproval(r);await t.runner.decide({executionId:r.executionId,choice:a.approved?"accept":"reject"})}catch(a){window.debugApi?.logError?.(`[remoteRunnerService] decide(${r.executionId}) failed: ${a instanceof Error?a.message:String(a)}`)}finally{iU4(r.executionId)}}handleEnded(t,r){st.getState().setLoading(t.sessionId,!1);let a={id:`remote-end-${Date.now()}`,type:"system",content:`Remote session ended: ${r}`,created_at:new Date().toISOString()};st.getState().addMessage(t.sessionId,a);let i=r==="error"||r==="boot_failed"?"Task.Failed":"Task.Completed",n=Kr.getTaskDuration(t.sessionId);Kr.track(i,{taskId:t.sessionId,runnerMode:"remote",endedReason:r,...n!=null?{$duration:n}:{}}),Kr.clearSessionCategories(t.sessionId),this.tearDownEntry(t,"ended")}requireEntry(t){let r=this.entries.get(t);if(r===void 0)throw new Error(`No remote runner session for ${t}. Call start() first.`);return r}persistRef(t,r,a,i){st.getState().setRemoteRunnerInfo(t,{runnerMode:"remote",remoteRef:r,securityMode:a});let o=Au.getState().history.map(h=>h.id===t?{...h,runner_mode:"remote",remote_ref:r,storage_mode:i}:h);Au.setState({history:o})}tearDownEntry(t,r){for(let i of t.disposers)try{i()}catch(n){gd1("disposer",n)}try{t.runner.dispose()}catch(i){gd1("runner.dispose",i)}try{t.client.disconnect()}catch(i){gd1("client.disconnect",i)}let a=iL2.get(t.sessionId);a!==void 0&&(clearTimeout(a),iL2.delete(t.sessionId)),this.entries.delete(t.sessionId),gY(t.sessionId,r),sE1(t.sessionId),eU4(t.sessionId),oD7(t.sessionId)}};d61=new cU4});function Ac0(e,t){cD7.dispatch(e,t)}var hU4,cD7,DO5=C1(()=>{hU4=class{constructor(){this.middlewares=new Set}use(t){return this.middlewares.add(t),()=>this.middlewares.delete(t)}dispatch(t,r){let a={type:t,data:r};for(let i of this.middlewares)try{i(a)}catch{}}},cD7=new hU4});var IO5,NO5,UO5,GO5=C1(()=>{IO5=w4(Lu(),1),NO5=w4(vW(),1),UO5=(0,IO5.create)()((0,NO5.persist)((e,t)=>({notifications:[],addNotification:r=>{let a=`notif-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,i={...r,id:a,timestamp:Date.now(),read:!1,dismissable:r.dismissable??!0};return e(n=>({notifications:[i,...n.notifications].slice(0,50)})),r.autoDismissMs&&r.autoDismissMs>0&&setTimeout(()=>{t().removeNotification(a)},r.autoDismissMs),a},markAsRead:r=>{e(a=>({notifications:a.notifications.map(i=>i.id===r?{...i,read:!0}:i)}))},markAllAsRead:()=>{e(r=>({notifications:r.notifications.map(a=>({...a,read:!0}))}))},removeNotification:r=>{e(a=>({notifications:a.notifications.filter(i=>i.id!==r)}))},clearAll:()=>{e({notifications:[]})},getUnreadCount:()=>t().notifications.filter(r=>!r.read).length,getPendingActionsCount:()=>t().notifications.filter(r=>r.action&&!r.read).length}),{name:"aria-notifications",partialize:e=>({notifications:e.notifications.filter(t=>t.type!=="action")})}))});function hD7(e,t,r){let a=`${t}:${r?"timeout":"error"}`,i=nL2.get(e);if(!i){if(nL2.size>=sD7){let n=nL2.keys().next().value;n!==void 0&&nL2.delete(n)}i=new Set,nL2.set(e,i)}return i.has(a)?!1:(i.add(a),!0)}function dD7(e){let t=e.replace(/\s+/g," ").trim();return t.length>jO5?`${t.slice(0,jO5)}...`:t}function uD7(e,{timedOut:t,reason:r}){return t?`${e} hook timed out and was skipped.${e==="PreToolUse"||e==="PostToolUse"?" The tool call proceeded.":""}`:`${e} hook failed: ${dD7(r)||"unknown error"}.`}function oL2(e,t,r){if(!hD7(e,t,r.timedOut))return;let a=uD7(t,r);st.getState().addMessage(e,{id:(0,WO5.v4)(),type:"system",content:a,created_at:new Date().toISOString(),widget:"systemMessageRenderer"})}function hE1(e){let t=e.trim();return{timedOut:t.toLowerCase().includes("timed out"),reason:t}}var WO5,jO5,nL2,sD7,zc0=C1(()=>{WO5=w4(Km(),1);wd();jO5=200,nL2=new Map,sD7=32});function lL2(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function bc0(e,t=gD7){return typeof e=="string"&&e.trim()?e.trim():t}function qO5(e){return typeof e=="string"&&e.trim()?e.trim():void 0}var gD7,$O5=C1(()=>{gD7="Blocked by hook"});function Sc0(e){return e.startsWith(pD7)}var pD7,dU4=C1(()=>{pD7="plugin-hook:"});function KO5(e){uU4=e}async function YO5(e){if(!uU4)return null;try{return await uU4(e)}catch{return null}}var uU4,gU4=C1(()=>{uU4=null});function JO5(e){for(let t of XO5.values())if(t.routesInProcess?.(e))return!0;return!1}function QO5(){let e=fD7??window.hooksApi;for(let{layer:t}of XO5.values())e=t(e);return e}var fD7,XO5,tD5=C1(()=>{XO5=new Map});function rD5(){return{timedOut:!1,reason:eD5}}function vD7(e,t){return t?t.ownerSessionId??e:DV(e)??e}function mD7(e){let t={...e},r={hook_event_name:e.eventName};return typeof t.toolName=="string"&&(r.tool_name=t.toolName),t.toolInput!==void 0&&(r.tool_input=t.toolInput),typeof t.toolResult=="string"&&(r.tool_response={output:t.toolResult}),typeof t.sessionId=="string"&&(r.session_id=t.sessionId),typeof t.toolUseId=="string"&&(r.tool_use_id=t.toolUseId),typeof t.permissionMode=="string"&&(r.permission_mode=t.permissionMode),JSON.stringify({...t,...r})}async function pU4(e,t,r,a){let{command:i}=t,n=JO5(i);if(!n){let u=await YO5(i);if(u)return window.debugApi?.logWarn(`[LifecycleHooks] ${e} hook command blocked by policy: ${u.reason}`),{kind:"hookError",hookError:u}}let o=a?.snapshot??kh(r.sessionId),h=t.id!==void 0&&Sc0(t.id);if(o?.accessMode==="project_restricted"&&!n&&!h)return{kind:"restricted"};try{let u={hookId:t.id,command:i,stdinData:n?JSON.stringify(r):mD7(r),timeoutMs:t.timeoutMs,env:t.env,policySnapshotIdentity:o?g31(o):void 0,turnPolicyOwnerSessionId:o?vD7(r.sessionId,a):void 0};return{kind:"result",result:await QO5().execute(u)}}catch(u){let g=hE1(u instanceof Error?u.message:String(u));return window.debugApi?.logWarn(`[LifecycleHooks] Failed to execute ${e} hook: ${g.reason}`),{kind:"hookError",hookError:g}}}function fU4(e,t){return window.debugApi?.logWarn(`[LifecycleHooks] ${e} hook exited with code ${t.exitCode}: ${t.stderr.trim()}`),hE1(t.stderr||`exited with code ${t.exitCode}`)}function vU4(e){let t=e.trim();if(t)try{return JSON.parse(t)}catch{window.debugApi?.logWarn("[LifecycleHooks] Hook stdout was not valid JSON, using the neutral result");return}}async function aD5(e,t){let r=await pU4("PreToolUse",e,t);if(r.kind==="restricted")return{decision:"deny",reason:eD5};if(r.kind==="hookError")return{decision:"allow",hookError:r.hookError};let{result:a}=r;if(a.exitCode===2)return{decision:"deny",reason:bc0(a.stderr)};if(a.exitCode!==0)return{decision:"allow",hookError:fU4("PreToolUse",a)};let i=vU4(a.stdout);if(!lL2(i))return{decision:"allow"};let n=i;return n.decision==="deny"?{decision:"deny",reason:bc0(n.reason)}:n.decision!=="allow"?{decision:"allow"}:{decision:"allow",modifiedInput:lL2(n.modifiedInput)?n.modifiedInput:void 0}}async function iD5(e,t){let r=await pU4("PermissionRequest",e,t);if(r.kind==="restricted")return{decision:"defer",hookError:rD5()};if(r.kind==="hookError")return{decision:"defer",hookError:r.hookError};let{result:a}=r;if(a.exitCode===2)return{decision:"deny",reason:bc0(a.stderr)};if(a.exitCode!==0)return{decision:"defer",hookError:fU4("PermissionRequest",a)};let i=vU4(a.stdout);if(!lL2(i))return{decision:"defer"};let n=i;return{decision:n.decision==="allow"||n.decision==="deny"||n.decision==="defer"?n.decision:"defer",reason:qO5(n.reason)}}async function dE1(e,t,r,a){let i=await pU4(e,t,r,a);if(i.kind==="restricted")return{hookError:rD5()};if(i.kind==="hookError")return{hookError:i.hookError};let{result:n}=i;if(n.exitCode!==0)return{hookError:fU4(e,n)};let o=vU4(n.stdout);if(!lL2(o))return{};let h=o.message;return typeof h=="string"?{message:h}:{}}function nD5(e,t){return dE1("PermissionResolved",e,t)}function oD5(e,t,r){return dE1("PostToolUse",e,t,r)}function lD5(e,t,r){return dE1("PostToolUseFailure",e,t,r)}function cD5(e,t,r){return dE1("SessionStart",e,t,r)}function sD5(e,t,r){return dE1("UserPromptSubmit",e,t,r)}function hD5(e,t,r){return dE1("Stop",e,t,r)}function dD5(e,t,r){return dE1("AgentTurnEnd",e,t,r)}var eD5,uD5=C1(()=>{fj();$O5();dU4();uz();zc0();gU4();tD5();eD5="Local lifecycle hook commands are unavailable in restricted projects."});var E12,Hc0,cL2=C1(()=>{GO5();zc0();uD5();E12=3e3,Hc0=class{_regexCache=new Map;_detachedHooks=new Map;_ranOnce=new Set;_isOnceExhausted(t){return t.once===!0&&this._ranOnce.has(t.id)}_reserveOnce(t){for(let r of t)r.once&&this._ranOnce.add(r.id)}_releaseOnce(t){for(let r of t)r.once&&this._ranOnce.delete(r.id)}async runPreToolUse(t,r){let a=this._matchingHooks(t,r.eventName,r.toolName);if(a.length===0)return{decision:"allow"};this._reserveOnce(a);let i=r.toolInput,n;for(let[o,h]of a.entries())try{let u=await aD5(h,{...r,toolInput:i});if(n??=u.hookError,u.decision==="deny")return this._releaseOnce(a.slice(o+1)),{...u,hookError:u.hookError??n};u.modifiedInput&&(i=u.modifiedInput)}catch(u){window.debugApi?.logWarn(`[HookRegistry] PreToolUse hook "${h.name}" failed: ${u}`),n??=hE1(u instanceof Error?u.message:String(u))}return{decision:"allow",modifiedInput:i!==r.toolInput?i:void 0,hookError:n}}async runPermissionRequest(t,r){let a=this._matchingHooks(t,r.eventName,r.toolName);if(a.length===0)return{decision:"defer"};this._reserveOnce(a);let i="defer",n,o;for(let[h,u]of a.entries())try{let g=await iD5(u,r);if(o??=g.hookError,g.decision==="deny")return this._releaseOnce(a.slice(h+1)),{decision:"deny",reason:g.reason,hookError:g.hookError??o};g.decision==="allow"&&(i="allow",n??=g.reason)}catch(g){window.debugApi?.logWarn(`[HookRegistry] PermissionRequest hook "${u.name}" failed: ${g}`),o??=hE1(g instanceof Error?g.message:String(g))}return{decision:i,reason:n,hookError:o}}async runPermissionResolved(t,r){await this._runObservationalHooks(t,r,nD5)}async runPostToolUse(t,r,a){await this._runObservationalHooks(t,r,(i,n)=>oD5(i,n,a))}async runPostToolUseFailure(t,r,a){await this._runObservationalHooks(t,r,(i,n)=>lD5(i,n,a))}async runSessionStart(t,r,a){await this._runObservationalHooks(t,r,(i,n)=>cD5(i,n,a))}async runUserPromptSubmit(t,r,a){await this._runObservationalHooks(t,r,(i,n)=>sD5(i,n,a))}async runStop(t,r,a){await this._runObservationalHooks(t,r,(i,n)=>hD5(i,n,a))}async runAgentTurnEnd(t,r,a){await this._runObservationalHooks(t,r,(i,n)=>dD5(i,n,a))}async _runObservationalHooks(t,r,a){let i="toolName"in r&&typeof r.toolName=="string"?r.toolName:null,n=this._matchingHooks(t,r.eventName,i);if(n.length===0)return;this._reserveOnce(n);let o=async h=>{try{let u=await a(h,r);if(u.hookError){this._surfaceObservationalFailure(h,r.eventName,i,r.sessionId,u.hookError);return}h.silent||UO5.getState().addNotification({type:"success",title:h.name,message:u.message||`Hook "${h.name}" ran successfully`})}catch(u){let g=hE1(u instanceof Error?u.message:String(u));this._surfaceObservationalFailure(h,r.eventName,i,r.sessionId,g)}};for(let h of n){if(h.async){this._trackDetachedHook(r.sessionId,o(h));continue}await o(h)}}_trackDetachedHook(t,r){let a=this._detachedHooks.get(t)??new Set;a.add(r),this._detachedHooks.set(t,a),r.finally(()=>{a.delete(r),a.size===0&&this._detachedHooks.get(t)===a&&this._detachedHooks.delete(t)})}async settleDetachedHooks(t,r){let a=this._detachedHooks.get(t);if(!a?.size)return;let i,n=new Promise(o=>{i=setTimeout(o,r)});try{await Promise.race([Promise.all([...a]).then(()=>{}),n])}finally{i!==void 0&&clearTimeout(i)}}_surfaceObservationalFailure(t,r,a,i,n){let o=a===null?"":` for ${a}`;window.debugApi?.logWarn(`[HookRegistry] ${r} hook "${t.name}" failed${o}: ${n.reason}`),r!=="SessionStart"&&oL2(i,r,n)}_matchingHooks(t,r,a){return t.filter(i=>i.enabled&&i.eventName===r&&(a===null||this._matchesTool(i,a))&&!this._isOnceExhausted(i))}_matchesTool(t,r){let{matcher:a}=t;if(!a||a==="*")return!0;let i=this._regexCache.get(a);if(!i)try{i=new RegExp(a),this._regexCache.set(a,i)}catch{return r===a}return i.test(r)}}});function mU4(e){return typeof e=="string"&&CD7.has(e)}function MD7(e){return typeof e=="object"&&e!==null&&mU4(e.eventName)}function xD7(e){return{hooks:e.hooks.filter(t=>!t.transient&&mU4(t.eventName))}}function LD7(e){let t=typeof e=="object"&&e!==null?e:{};return{hooks:Array.isArray(t.hooks)?t.hooks.filter(MD7):[]}}function fD5(e){$O.setState(t=>({hooks:[...t.hooks.filter(r=>!Sc0(r.id)),...e.map(r=>({...r,transient:!0}))]}))}var gD5,pD5,Hk,CD7,$O,pd1=C1(()=>{gD5=w4(Lu(),1),pD5=w4(vW(),1);dU4();cL2();Hk=new Hc0,CD7=new Set(["SessionStart","UserPromptSubmit","PreToolUse","PermissionRequest","PermissionResolved","PostToolUse","PostToolUseFailure","Stop","AgentTurnEnd"]);$O=(0,gD5.create)()((0,pD5.persist)((e,t)=>({hooks:[],addHook:r=>{if(!mU4(r.eventName))return;let a=t().hooks,i=a.findIndex(n=>n.id===r.id);if(i>=0){let n=a.slice();n[i]=r,e({hooks:n})}else e({hooks:[...a,r]})},removeHook:r=>{e({hooks:t().hooks.filter(a=>a.id!==r)})},updateHook:(r,a)=>{e({hooks:t().hooks.map(i=>i.id===r?{...i,...a}:i)})}}),{name:"aria-hooks",version:1,migrate:LD7,partialize:e=>xD7(e)}))});async function sL2(e,t){try{await Hk.settleDetachedHooks(e,E12)}catch(r){window.debugApi?.logWarn(`[LifecycleHooks] Failed to settle detached hooks: ${r}`)}await oF5(e,t)}var CU4=C1(()=>{cL2();pd1();uz()});var vD5,R12,MU4=C1(()=>{vD5=w4(Lu(),1);iY();R12=(0,vD5.create)((e,t)=>({contextBySession:{},setApplicationContext:(r,a)=>e(i=>({contextBySession:{...i.contextBySession,[r]:a}})),clearApplicationContext:r=>e(a=>{let{[r]:i,...n}=a.contextBySession;return{contextBySession:n}}),getApplicationContext:r=>t().contextBySession[r]??[]}));lz(R12,"application-context-sync")});function kc0(e){let t=Yi0({skills:e.skills,enabledSkills:e.enabledSkills,lastEnabledByName:e.lastEnabledByName}).enabledSkills,r={};for(let a of e.skills){let i=t[a.location];i!==void 0&&(r[a.name]=i)}return r}var xU4=C1(()=>{hZ4()});function wD7(){let e={};try{let t=globalThis.localStorage?.getItem(CD5);if(t){let r=JSON.parse(t);if(r&&typeof r=="object")for(let[a,i]of Object.entries(r)){let n=i;n&&typeof n.goal=="string"&&typeof n.startedAt=="number"&&(e[a]={goal:n.goal,startedAt:n.startedAt,pausedMs:typeof n.pausedMs=="number"?n.pausedMs:0,pausedAt:typeof n.pausedAt=="number"?n.pausedAt:null})}}}catch{}return e}function hL2(e){try{globalThis.localStorage?.setItem(CD5,JSON.stringify(e))}catch{}}var mD5,CD5,_w,fd1=C1(()=>{mD5=w4(Lu(),1),CD5="delegate.goalSessions";_w=(0,mD5.create)((e,t)=>({sessions:wD7(),getGoal:r=>t().sessions[r]?.goal??null,getElapsedMs:r=>{let a=t().sessions[r];return a?(a.pausedAt??Date.now())-a.startedAt-a.pausedMs:null},setLocal:(r,a)=>e(i=>{let n={...i.sessions};if(a===null){if(!(r in n))return i;delete n[r]}else n[r]={goal:a,startedAt:Date.now(),pausedMs:0,pausedAt:null};return hL2(n),{sessions:n}}),suppressGoalCheck:r=>e(a=>{let i=a.sessions[r];if(!i||i.pausedAt!=null)return a;let n={...a.sessions,[r]:{...i,pausedAt:Date.now()}};return hL2(n),{sessions:n}}),resumeGoalCheck:r=>e(a=>{let i=a.sessions[r];if(!i||i.pausedAt==null)return a;let n={...a.sessions,[r]:{...i,pausedMs:i.pausedMs+(Date.now()-i.pausedAt),pausedAt:null}};return hL2(n),{sessions:n}}),isGoalCheckSuppressed:r=>t().sessions[r]?.pausedAt!=null,removeSessionState:r=>e(a=>{if(!(r in a.sessions))return a;let i={...a.sessions};return delete i[r],hL2(i),{sessions:i}}),clear:()=>{hL2({}),e({sessions:{}})}}))});function kk(){return{selectedGoals:[],selectedRole:null,scanResults:null,tabsAvailable:!1,curationPanelOpen:!1,curationActiveTab:"apps",curationRemoved:new Set,phase2Loading:!1,hasFiredFirstUserAction:!1,includedCategories:["apps","browser","files"],selectedRoutineTitles:new Set,hasFiredStarted:!1,hasFiredGoalsReached:!1,hasFiredScanPermissionReached:!1,hasFiredScanProgressReached:!1,hasFiredRoleInferred:!1,hasFiredRoutinesReached:!1,hasFiredScanRun:!1,scanRunIntent:null,scanHandoffAcked:!1,scanHandoffSent:!1,hasFiredCompleted:!1,hasFiredImportConversations:!1,firedPluginEvents:new Set,pendingInstallTriggerId:null,processedTriggerIds:new Set,hasShownTestcloudActivation:!1}}function xD5(e){dL2.getState().clearOnboardingState(e)}var MD5,kqi,dL2,Tc0=C1(()=>{MD5=w4(Lu(),1);kqi=Object.freeze(kk()),dL2=(0,MD5.create)((e,t)=>{let r=a=>i=>{let n=t().slices[i]??kk();n[a]||e(o=>({slices:{...o.slices,[i]:{...n,[a]:!0}}}))};return{slices:{},setSelectedGoals:(a,i)=>{let n=t().slices[a]??kk();e(o=>({slices:{...o.slices,[a]:{...n,selectedGoals:i}}}))},setSelectedRole:(a,i)=>{let n=t().slices[a]??kk();n.selectedRole!==i&&e(o=>({slices:{...o.slices,[a]:{...n,selectedRole:i}}}))},setScanResults:(a,i)=>{let n=t().slices[a]??kk();e(o=>({slices:{...o.slices,[a]:{...n,scanResults:i}}}))},setTabsAvailable:(a,i)=>{let n=t().slices[a]??kk();e(o=>({slices:{...o.slices,[a]:{...n,tabsAvailable:i}}}))},setCurationPanelOpen:(a,i)=>{let n=t().slices[a]??kk();e(o=>({slices:{...o.slices,[a]:{...n,curationPanelOpen:i}}}))},setCurationActiveTab:(a,i)=>{let n=t().slices[a]??kk();e(o=>({slices:{...o.slices,[a]:{...n,curationActiveTab:i}}}))},toggleCurationRemoved:(a,i)=>{let n=t().slices[a]??kk(),o=new Set(n.curationRemoved);o.has(i)?o.delete(i):o.add(i),e(h=>({slices:{...h.slices,[a]:{...n,curationRemoved:o}}}))},setPhase2Loading:(a,i)=>{let n=t().slices[a]??kk();e(o=>({slices:{...o.slices,[a]:{...n,phase2Loading:i}}}))},markFiredFirstUserAction:a=>{let i=t().slices[a]??kk();i.hasFiredFirstUserAction||e(n=>({slices:{...n.slices,[a]:{...i,hasFiredFirstUserAction:!0}}}))},setIncludedCategories:(a,i)=>{let n=t().slices[a]??kk();e(o=>({slices:{...o.slices,[a]:{...n,includedCategories:i}}}))},toggleRoutineSelection:(a,i)=>{let n=t().slices[a]??kk(),o=new Set(n.selectedRoutineTitles);o.has(i)?o.delete(i):o.add(i),e(h=>({slices:{...h.slices,[a]:{...n,selectedRoutineTitles:o}}}))},markFiredStarted:r("hasFiredStarted"),markFiredGoalsReached:r("hasFiredGoalsReached"),markFiredScanPermissionReached:r("hasFiredScanPermissionReached"),markFiredScanProgressReached:r("hasFiredScanProgressReached"),markFiredRoleInferred:r("hasFiredRoleInferred"),markFiredRoutinesReached:r("hasFiredRoutinesReached"),markFiredScanRun:r("hasFiredScanRun"),markFiredCompleted:r("hasFiredCompleted"),markFiredImportConversations:a=>{let i=t().slices[a]??kk();i.hasFiredImportConversations||e(n=>({slices:{...n.slices,[a]:{...i,hasFiredImportConversations:!0}}}))},markPluginEventFired:(a,i)=>{let n=t().slices[a]??kk();if(n.firedPluginEvents.has(i))return;let o=new Set(n.firedPluginEvents);o.add(i),e(h=>({slices:{...h.slices,[a]:{...n,firedPluginEvents:o}}}))},hasPluginEventFired:(a,i)=>{let n=t().slices[a];return n?n.firedPluginEvents.has(i):!1},setPendingInstallTriggerId:(a,i)=>{let n=t().slices[a]??kk();n.pendingInstallTriggerId!==i&&e(o=>({slices:{...o.slices,[a]:{...n,pendingInstallTriggerId:i}}}))},markTriggerProcessed:(a,i)=>{let n=t().slices[a]??kk();if(n.processedTriggerIds.has(i))return;let o=new Set(n.processedTriggerIds);o.add(i),e(h=>({slices:{...h.slices,[a]:{...n,processedTriggerIds:o}}}))},hasTriggerBeenProcessed:(a,i)=>{let n=t().slices[a];return n?n.processedTriggerIds.has(i):!1},unmarkPluginEventFired:(a,i)=>{let n=t().slices[a];if(!n||!n.firedPluginEvents.has(i))return;let o=new Set(n.firedPluginEvents);o.delete(i),e(h=>({slices:{...h.slices,[a]:{...n,firedPluginEvents:o}}}))},setScanRunIntent:(a,i)=>{let n=t().slices[a]??kk();e(o=>({slices:{...o.slices,[a]:{...n,scanRunIntent:i}}}))},setScanHandoffAcked:(a,i)=>{let n=t().slices[a]??kk();n.scanHandoffAcked!==i&&e(o=>({slices:{...o.slices,[a]:{...n,scanHandoffAcked:i}}}))},setScanHandoffSent:(a,i)=>{let n=t().slices[a]??kk();n.scanHandoffSent!==i&&e(o=>({slices:{...o.slices,[a]:{...n,scanHandoffSent:i}}}))},clearOnboardingState:a=>{e(i=>{let{[a]:n,...o}=i.slices;return{slices:o}})},markTestcloudActivationShown:a=>{let i=t().slices[a]??kk();i.hasShownTestcloudActivation||e(n=>({slices:{...n.slices,[a]:{...i,hasShownTestcloudActivation:!0}}}))}}})});var Sp,vd1=C1(()=>{Sp=class e{constructor(t){this.value=t}static of(t){return new e(t)}get isAbsolute(){return this.value?this.value.startsWith("/")||/^[A-Za-z]:[\\/]/.test(this.value):!1}join(...t){let r=[this.value,...t],a=[];for(let u of r){let g=u.replace(/\\/g,"/");for(let f of g.split("/"))a.push(f)}let i=this.isAbsolute,n=this.value.replace(/\\/g,"/"),h=a.filter(Boolean).join("/");return i&&n.startsWith("/")?new e("/"+h):new e(h)}dirname(){let t=this.value.replace(/\\/g,"/").replace(/\/+$/,""),r=t.lastIndexOf("/");if(r===-1)return new e(".");if(r===0)return new e("/");let a=t.substring(0,r);return/^[A-Za-z]:$/.test(a)?new e(a+"/"):new e(a)}relativeTo(t){let r=(typeof t=="string"?t:t.toString()).replace(/\\/g,"/").replace(/\/$/,""),a=this.value.replace(/\\/g,"/").replace(/\/$/,"");if(a.startsWith(r+"/"))return new e(a.slice(r.length+1));let i=a.lastIndexOf("/");return new e(i>=0?a.slice(i+1):a)}requireAbsolute(t){if(!this.isAbsolute)throw new Error(t);return this}toString(){return this.value}}});function yD7(e){return e.replace(/\\/g,"/")}function LD5(e){return typeof e!="string"||e==="."||e===".."||e.includes("/")||e.includes("\\")}function AD7(e,t,r,a){return t&&a?LD5(t)?null:`${e}/projects/${t}`:t||LD5(r)?null:`${e}/sessions/${r}`}function u61(e,t,r,a){let i=AD7(e,t,r,a);return i===null?null:`${i}/wiki`}function wD5(e){let t=yD7(e).replace(/\/+$/,"");return!Sp.of(t).isAbsolute||!/\/wiki$/.test(t)?null:t.replace(/\/wiki$/,"/drafts")}var uE1=C1(()=>{vd1()});var Uf=M1(fZ=>{"use strict";var LU4=Symbol.for("yaml.alias"),yD5=Symbol.for("yaml.document"),Bc0=Symbol.for("yaml.map"),AD5=Symbol.for("yaml.pair"),wU4=Symbol.for("yaml.scalar"),Vc0=Symbol.for("yaml.seq"),md1=Symbol.for("yaml.node.type"),zD7=e=>!!e&&typeof e=="object"&&e[md1]===LU4,bD7=e=>!!e&&typeof e=="object"&&e[md1]===yD5,SD7=e=>!!e&&typeof e=="object"&&e[md1]===Bc0,HD7=e=>!!e&&typeof e=="object"&&e[md1]===AD5,zD5=e=>!!e&&typeof e=="object"&&e[md1]===wU4,kD7=e=>!!e&&typeof e=="object"&&e[md1]===Vc0;function bD5(e){if(e&&typeof e=="object")switch(e[md1]){case Bc0:case Vc0:return!0}return!1}function TD7(e){if(e&&typeof e=="object")switch(e[md1]){case LU4:case Bc0:case wU4:case Vc0:return!0}return!1}var BD7=e=>(zD5(e)||bD5(e))&&!!e.anchor;fZ.ALIAS=LU4;fZ.DOC=yD5;fZ.MAP=Bc0;fZ.NODE_TYPE=md1;fZ.PAIR=AD5;fZ.SCALAR=wU4;fZ.SEQ=Vc0;fZ.hasAnchor=BD7;fZ.isAlias=zD7;fZ.isCollection=bD5;fZ.isDocument=bD7;fZ.isMap=SD7;fZ.isNode=TD7;fZ.isPair=HD7;fZ.isScalar=zD5;fZ.isSeq=kD7});var uL2=M1(yU4=>{"use strict";var NV=Uf(),bW=Symbol("break visit"),SD5=Symbol("skip children"),K91=Symbol("remove node");function Pc0(e,t){let r=HD5(t);NV.isDocument(e)?Z12(null,e.contents,r,Object.freeze([e]))===K91&&(e.contents=null):Z12(null,e,r,Object.freeze([]))}Pc0.BREAK=bW;Pc0.SKIP=SD5;Pc0.REMOVE=K91;function Z12(e,t,r,a){let i=kD5(e,t,r,a);if(NV.isNode(i)||NV.isPair(i))return TD5(e,a,i),Z12(e,i,r,a);if(typeof i!="symbol"){if(NV.isCollection(t)){a=Object.freeze(a.concat(t));for(let n=0;n<t.items.length;++n){let o=Z12(n,t.items[n],r,a);if(typeof o=="number")n=o-1;else{if(o===bW)return bW;o===K91&&(t.items.splice(n,1),n-=1)}}}else if(NV.isPair(t)){a=Object.freeze(a.concat(t));let n=Z12("key",t.key,r,a);if(n===bW)return bW;n===K91&&(t.key=null);let o=Z12("value",t.value,r,a);if(o===bW)return bW;o===K91&&(t.value=null)}}return i}async function _c0(e,t){let r=HD5(t);NV.isDocument(e)?await F12(null,e.contents,r,Object.freeze([e]))===K91&&(e.contents=null):await F12(null,e,r,Object.freeze([]))}_c0.BREAK=bW;_c0.SKIP=SD5;_c0.REMOVE=K91;async function F12(e,t,r,a){let i=await kD5(e,t,r,a);if(NV.isNode(i)||NV.isPair(i))return TD5(e,a,i),F12(e,i,r,a);if(typeof i!="symbol"){if(NV.isCollection(t)){a=Object.freeze(a.concat(t));for(let n=0;n<t.items.length;++n){let o=await F12(n,t.items[n],r,a);if(typeof o=="number")n=o-1;else{if(o===bW)return bW;o===K91&&(t.items.splice(n,1),n-=1)}}}else if(NV.isPair(t)){a=Object.freeze(a.concat(t));let n=await F12("key",t.key,r,a);if(n===bW)return bW;n===K91&&(t.key=null);let o=await F12("value",t.value,r,a);if(o===bW)return bW;o===K91&&(t.value=null)}}return i}function HD5(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function kD5(e,t,r,a){if(typeof r=="function")return r(e,t,a);if(NV.isMap(t))return r.Map?.(e,t,a);if(NV.isSeq(t))return r.Seq?.(e,t,a);if(NV.isPair(t))return r.Pair?.(e,t,a);if(NV.isScalar(t))return r.Scalar?.(e,t,a);if(NV.isAlias(t))return r.Alias?.(e,t,a)}function TD5(e,t,r){let a=t[t.length-1];if(NV.isCollection(a))a.items[e]=r;else if(NV.isPair(a))e==="key"?a.key=r:a.value=r;else if(NV.isDocument(a))a.contents=r;else{let i=NV.isAlias(a)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}yU4.visit=Pc0;yU4.visitAsync=_c0});var AU4=M1(VD5=>{"use strict";var BD5=Uf(),VD7=uL2(),PD7={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},_D7=e=>e.replace(/[!,[\]{}]/g,t=>PD7[t]),gL2=class e{constructor(t,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,r)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,r){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let a=t.trim().split(/[ \t]+/),i=a.shift();switch(i){case"%TAG":{if(a.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),a.length<2))return!1;let[n,o]=a;return this.tags[n]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,a.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[n]=a;if(n==="1.1"||n==="1.2")return this.yaml.version=n,!0;{let o=/^\d+\.\d+$/.test(n);return r(6,`Unsupported YAML version ${n}`,o),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(t,r){if(t==="!")return"!";if(t[0]!=="!")return r(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(r(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&r("Verbatim tags must end with a >"),o)}let[,a,i]=t.match(/^(.*!)([^!]*)$/s);i||r(`The ${t} tag has no suffix`);let n=this.tags[a];if(n)try{return n+decodeURIComponent(i)}catch(o){return r(String(o)),null}return a==="!"?t:(r(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[r,a]of Object.entries(this.tags))if(t.startsWith(a))return r+_D7(t.substring(a.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],a=Object.entries(this.tags),i;if(t&&a.length>0&&BD5.isNode(t.contents)){let n={};VD7.visit(t.contents,(o,h)=>{BD5.isNode(h)&&h.tag&&(n[h.tag]=!0)}),i=Object.keys(n)}else i=[];for(let[n,o]of a)n==="!!"&&o==="tag:yaml.org,2002:"||(!t||i.some(h=>h.startsWith(o)))&&r.push(`%TAG ${n} ${o}`);return r.join(`
|
|
10891
10891
|
`)}};gL2.defaultYaml={explicit:!1,version:"1.2"};gL2.defaultTags={"!!":"tag:yaml.org,2002:"};VD5.Directives=gL2});var Ec0=M1(pL2=>{"use strict";var PD5=Uf(),ED7=uL2();function RD7(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(r)}return!0}function _D5(e){let t=new Set;return ED7.visit(e,{Value(r,a){a.anchor&&t.add(a.anchor)}}),t}function ED5(e,t){for(let r=1;;++r){let a=`${e}${r}`;if(!t.has(a))return a}}function ZD7(e,t){let r=[],a=new Map,i=null;return{onAnchor:n=>{r.push(n),i??(i=_D5(e));let o=ED5(t,i);return i.add(o),o},setAnchors:()=>{for(let n of r){let o=a.get(n);if(typeof o=="object"&&o.anchor&&(PD5.isScalar(o.node)||PD5.isCollection(o.node)))o.node.anchor=o.anchor;else{let h=new Error("Failed to resolve repeated object (this should not happen)");throw h.source=n,h}}},sourceObjects:a}}pL2.anchorIsValid=RD7;pL2.anchorNames=_D5;pL2.createNodeAnchors=ZD7;pL2.findNewAnchor=ED5});var zU4=M1(RD5=>{"use strict";function fL2(e,t,r,a){if(a&&typeof a=="object")if(Array.isArray(a))for(let i=0,n=a.length;i<n;++i){let o=a[i],h=fL2(e,a,String(i),o);h===void 0?delete a[i]:h!==o&&(a[i]=h)}else if(a instanceof Map)for(let i of Array.from(a.keys())){let n=a.get(i),o=fL2(e,a,i,n);o===void 0?a.delete(i):o!==n&&a.set(i,o)}else if(a instanceof Set)for(let i of Array.from(a)){let n=fL2(e,a,i,i);n===void 0?a.delete(i):n!==i&&(a.delete(i),a.add(n))}else for(let[i,n]of Object.entries(a)){let o=fL2(e,a,i,n);o===void 0?delete a[i]:o!==n&&(a[i]=o)}return e.call(t,r,a)}RD5.applyReviver=fL2});var qL1=M1(FD5=>{"use strict";var FD7=Uf();function ZD5(e,t,r){if(Array.isArray(e))return e.map((a,i)=>ZD5(a,String(i),r));if(e&&typeof e.toJSON=="function"){if(!r||!FD7.hasAnchor(e))return e.toJSON(t,r);let a={aliasCount:0,count:1,res:void 0};r.anchors.set(e,a),r.onCreate=n=>{a.res=n,delete r.onCreate};let i=e.toJSON(t,r);return r.onCreate&&r.onCreate(i),i}return typeof e=="bigint"&&!r?.keep?Number(e):e}FD5.toJS=ZD5});var Rc0=M1(DD5=>{"use strict";var OD7=zU4(),OD5=Uf(),DD7=qL1(),bU4=class{constructor(t){Object.defineProperty(this,OD5.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:r,maxAliasCount:a,onAnchor:i,reviver:n}={}){if(!OD5.isDocument(t))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:t,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof a=="number"?a:100},h=DD7.toJS(this,"",o);if(typeof i=="function")for(let{count:u,res:g}of o.anchors.values())i(g,u);return typeof n=="function"?OD7.applyReviver(n,{"":h},"",h):h}};DD5.NodeBase=bU4});var vL2=M1(ID5=>{"use strict";var ID7=Ec0(),ND7=uL2(),O12=Uf(),UD7=Rc0(),GD7=qL1(),SU4=class extends UD7.NodeBase{constructor(t){super(O12.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,r){let a;r?.aliasResolveCache?a=r.aliasResolveCache:(a=[],ND7.visit(t,{Node:(n,o)=>{(O12.isAlias(o)||O12.hasAnchor(o))&&a.push(o)}}),r&&(r.aliasResolveCache=a));let i;for(let n of a){if(n===this)break;n.anchor===this.source&&(i=n)}return i}toJSON(t,r){if(!r)return{source:this.source};let{anchors:a,doc:i,maxAliasCount:n}=r,o=this.resolve(i,r);if(!o){let u=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(u)}let h=a.get(o);if(h||(GD7.toJS(o,null,r),h=a.get(o)),h?.res===void 0){let u="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(u)}if(n>=0&&(h.count+=1,h.aliasCount===0&&(h.aliasCount=Zc0(i,o,a)),h.count*h.aliasCount>n)){let u="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(u)}return h.res}toString(t,r,a){let i=`*${this.source}`;if(t){if(ID7.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let n=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(n)}if(t.implicitKey)return`${i} `}return i}};function Zc0(e,t,r){if(O12.isAlias(t)){let a=t.resolve(e),i=r&&a&&r.get(a);return i?i.count*i.aliasCount:0}else if(O12.isCollection(t)){let a=0;for(let i of t.items){let n=Zc0(e,i,r);n>a&&(a=n)}return a}else if(O12.isPair(t)){let a=Zc0(e,t.key,r),i=Zc0(e,t.value,r);return Math.max(a,i)}return 1}ID5.Alias=SU4});var XT=M1(HU4=>{"use strict";var jD7=Uf(),WD7=Rc0(),qD7=qL1(),$D7=e=>!e||typeof e!="function"&&typeof e!="object",$L1=class extends WD7.NodeBase{constructor(t){super(jD7.SCALAR),this.value=t}toJSON(t,r){return r?.keep?this.value:qD7.toJS(this.value,t,r)}toString(){return String(this.value)}};$L1.BLOCK_FOLDED="BLOCK_FOLDED";$L1.BLOCK_LITERAL="BLOCK_LITERAL";$L1.PLAIN="PLAIN";$L1.QUOTE_DOUBLE="QUOTE_DOUBLE";$L1.QUOTE_SINGLE="QUOTE_SINGLE";HU4.Scalar=$L1;HU4.isScalarValue=$D7});var mL2=M1(UD5=>{"use strict";var KD7=vL2(),gE1=Uf(),ND5=XT(),YD7="tag:yaml.org,2002:";function XD7(e,t,r){if(t){let a=r.filter(n=>n.tag===t),i=a.find(n=>!n.format)??a[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return r.find(a=>a.identify?.(e)&&!a.format)}function JD7(e,t,r){if(gE1.isDocument(e)&&(e=e.contents),gE1.isNode(e))return e;if(gE1.isPair(e)){let v=r.schema[gE1.MAP].createNode?.(r.schema,null,r);return v.items.push(e),v}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:a,onAnchor:i,onTagObj:n,schema:o,sourceObjects:h}=r,u;if(a&&e&&typeof e=="object"){if(u=h.get(e),u)return u.anchor??(u.anchor=i(e)),new KD7.Alias(u.anchor);u={anchor:null,node:null},h.set(e,u)}t?.startsWith("!!")&&(t=YD7+t.slice(2));let g=XD7(e,t,o.tags);if(!g){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let v=new ND5.Scalar(e);return u&&(u.node=v),v}g=e instanceof Map?o[gE1.MAP]:Symbol.iterator in Object(e)?o[gE1.SEQ]:o[gE1.MAP]}n&&(n(g),delete r.onTagObj);let f=g?.createNode?g.createNode(r.schema,e,r):typeof g?.nodeClass?.from=="function"?g.nodeClass.from(r.schema,e,r):new ND5.Scalar(e);return t?f.tag=t:g.default||(f.tag=g.tag),u&&(u.node=f),f}UD5.createNode=JD7});var Oc0=M1(Fc0=>{"use strict";var QD7=mL2(),Y91=Uf(),tI7=Rc0();function kU4(e,t,r){let a=r;for(let i=t.length-1;i>=0;--i){let n=t[i];if(typeof n=="number"&&Number.isInteger(n)&&n>=0){let o=[];o[n]=a,a=o}else a=new Map([[n,a]])}return QD7.createNode(a,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var GD5=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,TU4=class extends tI7.NodeBase{constructor(t,r){super(t),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(t){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(r.schema=t),r.items=r.items.map(a=>Y91.isNode(a)||Y91.isPair(a)?a.clone(t):a),this.range&&(r.range=this.range.slice()),r}addIn(t,r){if(GD5(t))this.add(r);else{let[a,...i]=t,n=this.get(a,!0);if(Y91.isCollection(n))n.addIn(i,r);else if(n===void 0&&this.schema)this.set(a,kU4(this.schema,i,r));else throw new Error(`Expected YAML collection at ${a}. Remaining path: ${i}`)}}deleteIn(t){let[r,...a]=t;if(a.length===0)return this.delete(r);let i=this.get(r,!0);if(Y91.isCollection(i))return i.deleteIn(a);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${a}`)}getIn(t,r){let[a,...i]=t,n=this.get(a,!0);return i.length===0?!r&&Y91.isScalar(n)?n.value:n:Y91.isCollection(n)?n.getIn(i,r):void 0}hasAllNullValues(t){return this.items.every(r=>{if(!Y91.isPair(r))return!1;let a=r.value;return a==null||t&&Y91.isScalar(a)&&a.value==null&&!a.commentBefore&&!a.comment&&!a.tag})}hasIn(t){let[r,...a]=t;if(a.length===0)return this.has(r);let i=this.get(r,!0);return Y91.isCollection(i)?i.hasIn(a):!1}setIn(t,r){let[a,...i]=t;if(i.length===0)this.set(a,r);else{let n=this.get(a,!0);if(Y91.isCollection(n))n.setIn(i,r);else if(n===void 0&&this.schema)this.set(a,kU4(this.schema,i,r));else throw new Error(`Expected YAML collection at ${a}. Remaining path: ${i}`)}}};Fc0.Collection=TU4;Fc0.collectionFromPath=kU4;Fc0.isEmptyPath=GD5});var CL2=M1(Dc0=>{"use strict";var eI7=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function BU4(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var rI7=(e,t,r)=>e.endsWith(`
|
|
10892
10892
|
`)?BU4(r,t):r.includes(`
|
|
10893
10893
|
`)?`
|
|
@@ -12291,7 +12291,7 @@ ${n}
|
|
|
12291
12291
|
`+z),R}e.getSdkLoaderScript=v,e.webSnippet=u,e.webSnippetCs=g,e.webSnippetVersion=f}))});var d08=M1(Yh=>{"use strict";Object.defineProperty(Yh,"__esModule",{value:!0});Yh.isContentTypeHeaderHtml=Yh.insertBrowserSdkLoaderByIndex=Yh.getContentEncodingFromHeaders=Yh.isSupportedContentEncoding=Yh.findBufferEncodingType=Yh.isBufferType=Yh.getBrotliDecompressSync=Yh.getBrotliDecompressAsync=Yh.getBrotliCompressSync=Yh.getBrotliCompressAsync=Yh.inflateAsync=Yh.deflateAsync=Yh.gunzipAsync=Yh.gzipAsync=Yh.isBrotliSupported=Yh.bufferEncodingTypes=Yh.contentEncodingMethod=void 0;var dba=Wd(),dV0=dba.__importStar(Z4("zlib")),a82=Z4("node:util"),fT2;(function(e){e.GZIP="gzip",e.DEFLATE="deflate",e.BR="br"})(fT2||(Yh.contentEncodingMethod=fT2={}));Yh.bufferEncodingTypes=["utf8","utf16le","latin1","base64","hex","ascii","binary","ucs2"];var uba=()=>{let e=process.versions.node.split(".")[0];return parseInt(e)>=10};Yh.isBrotliSupported=uba;Yh.gzipAsync=(0,a82.promisify)(dV0.gzip);Yh.gunzipAsync=(0,a82.promisify)(dV0.gunzip);Yh.deflateAsync=(0,a82.promisify)(dV0.deflate);Yh.inflateAsync=(0,a82.promisify)(dV0.inflate);var gba=e=>(0,Yh.isBrotliSupported)()&&typeof e.brotliCompress=="function"?(0,a82.promisify)(e.brotliCompress):null;Yh.getBrotliCompressAsync=gba;var pba=e=>(0,Yh.isBrotliSupported)()&&typeof e.brotliCompressSync=="function"?e.brotliCompressSync:null;Yh.getBrotliCompressSync=pba;var fba=e=>(0,Yh.isBrotliSupported)()&&typeof e.brotliDecompress=="function"?(0,a82.promisify)(e.brotliDecompress):null;Yh.getBrotliDecompressAsync=fba;var vba=e=>(0,Yh.isBrotliSupported)()&&typeof e.brotliDecompressSync=="function"?e.brotliDecompressSync:null;Yh.getBrotliDecompressSync=vba;var mba=(e,t)=>{let r=t||"utf8",a=!1;return Buffer.isEncoding(r)&&(a=Buffer.from(e.toString(r),r).toJSON().data.toString()===e.toJSON().data.toString()),a};Yh.isBufferType=mba;var Cba=e=>{let t=null;for(let r of Yh.bufferEncodingTypes)if(Buffer.isEncoding(r)&&(0,Yh.isBufferType)(e,r)){t=r;break}return t};Yh.findBufferEncodingType=Cba;var Mba=e=>{let t=null;switch(e){case"gzip":t=fT2.GZIP;break;case"br":t=fT2.BR;break;case"deflate":t=fT2.DEFLATE;break;default:}return t};Yh.isSupportedContentEncoding=Mba;var xba=e=>{let t=[],r=e.getHeader("Content-Encoding");if(!r)return null;if(typeof r=="string"){let a=(0,Yh.isSupportedContentEncoding)(r);a&&t.push(a)}return t};Yh.getContentEncodingFromHeaders=xba;var Lba=(e,t,r)=>{if(e<0)return null;let a=null,i=t.substring(0,e),n=t.substring(e);return a=i+'<script type="text/javascript">'+r+"</script>"+n,a};Yh.insertBrowserSdkLoaderByIndex=Lba;var wba=e=>{let t=!1,r=e.getHeader("Content-Type");return r&&(typeof r=="string"?t=r.indexOf("html")>=0:t=r.toString().indexOf("html")>=0),t};Yh.isContentTypeHeaderHtml=wba});var f08=M1(uV0=>{"use strict";Object.defineProperty(uV0,"__esModule",{value:!0});uV0.BrowserSdkLoader=void 0;var vT2=Wd(),u08=vT2.__importDefault(Z4("node:http")),g08=vT2.__importDefault(Z4("node:https")),yba=h08(),G01=vT2.__importStar(d08()),p08=vT2.__importStar(EF1()),i82=vT2.__importStar(Z4("zlib")),vvt=Qpt(),Ig1=d62(),Aba=Rn1(),zba=E8(),mvt=class e{static _instance;static _sdkLoader;static _aiUrl;_isIkeyValid=!0;_isInitialized=!1;_browserSdkLoaderIkey;constructor(t){e._instance&&zba.diag.warn("Browser SDK Loader should be configured from the applicationInsights object"),e._instance=this,e._aiUrl=Aba.BROWSER_SDK_LOADER_DEFAULT_SOURCE;let r;t.browserSdkLoaderOptions?.connectionString&&(r=this._getBrowserSdkLoaderIkey(t?.browserSdkLoaderOptions?.connectionString)),this._browserSdkLoaderIkey=r||vvt.ConnectionStringParser.parse(t.azureMonitorExporterOptions.connectionString).instrumentationkey,this._isIkeyValid&&this._initialize()}isInitialized(){return this._isInitialized}static getInstance(){return e._instance}_getBrowserSdkLoaderIkey(t){let r=null;try{let i=vvt.ConnectionStringParser.parse(t).instrumentationkey||"";vvt.ConnectionStringParser.validateInstrumentationKey(i)?(this._isIkeyValid=!0,r=i):(this._isIkeyValid=!1,Ig1.Logger.getInstance().info("Invalid browser SDK loader connection string, browser SDK loader is not enabled."))}catch(a){Ig1.Logger.getInstance().info(`get browser SDK loader ikey error: ${a}`)}return r}_getBrowserSdkLoaderReplacedStr(){let t=p08.getOsPrefix(),r=p08.getResourceProvider(),a=`${this._browserSdkLoaderIkey}",\r
|
|
12292
12292
|
disableIkeyDeprecationMessage: true,\r
|
|
12293
12293
|
sdkExtension: "${r}${t}d_n_`;return yba.webSnippet.replace("INSTRUMENTATION_KEY",a)}_initialize(){this._isInitialized=!0,e._sdkLoader=this._getBrowserSdkLoaderReplacedStr();let t=u08.default.createServer,r=g08.default.createServer;u08.default.createServer=a=>{let i=a;return i&&(a=(n,o)=>{let h=o.write,u=n.method==="GET";o.write=function(v,C){try{if(u){let L=G01.getContentEncodingFromHeaders(o),y;if(typeof C=="string"&&(y=C),L==null)e._instance?.ValidateInjection(o,v)&&(arguments[0]=e._instance.InjectSdkLoader(o,v,void 0,y));else if(L.length){let z=L[0];arguments[0]=e._instance?.InjectSdkLoader(o,v,z)}}}catch(L){Ig1.Logger.getInstance().warn(`Inject browser sdk loader error: ${L}`)}return h.apply(o,arguments)};let g=o.end;return o.end=function(v,C){if(u)try{if(u){let L=G01.getContentEncodingFromHeaders(o),y;if(typeof C=="string"&&(y=C),L==null)e._instance?.ValidateInjection(o,v)&&(arguments[0]=e._instance.InjectSdkLoader(o,v,void 0,y));else if(L.length){let z=L[0];arguments[0]=e._instance?.InjectSdkLoader(o,v,z)}}}catch(L){Ig1.Logger.getInstance().warn(`Inject browser sdk loader error: ${L}`)}return g.apply(o,arguments)},i(n,o)}),t(a)},g08.default.createServer=function(a,i){let n=i;if(n)return i=function(o,h){let u=o.method==="GET",g=h.write,f=h.end;return h.write=function(C,L){try{if(u){let y=G01.getContentEncodingFromHeaders(h),z;if(typeof L=="string"&&(z=L),y==null)e._instance?.ValidateInjection(h,C)&&(arguments[0]=this.InjectSdkLoader(h,C,void 0,z));else if(y.length){let S=y[0];arguments[0]=e._instance?.InjectSdkLoader(h,C,S)}}}catch(y){Ig1.Logger.getInstance().warn(`Inject SDK loader error: ${y}`)}return g.apply(h,arguments)},h.end=function(C,L){try{if(u){let y=G01.getContentEncodingFromHeaders(h),z;if(typeof L=="string"&&(z=L),y==null)e._instance?.ValidateInjection(h,C)&&(arguments[0]=e._instance.InjectSdkLoader(h,C,void 0,z));else if(y.length){let S=y[0];arguments[0]=e._instance?.InjectSdkLoader(h,C,S)}}}catch(y){Ig1.Logger.getInstance().warn(`Inject SDK loader error: ${y}`)}return f.apply(h,arguments)},n(o,h)},r(a,i)}}ValidateInjection(t,r){try{if(!t||!r||t.statusCode!==200||!G01.isContentTypeHeaderHtml(t))return!1;let i=r.slice().toString();if(i.indexOf("<head>")>=0&&i.indexOf("</head>")>=0&&i.indexOf(e._aiUrl)<0)return!0}catch(a){Ig1.Logger.getInstance().info(`validate injections error: ${a}`)}return!1}InjectSdkLoader(t,r,a,i){try{if(!!a)t.removeHeader("Content-Length"),r=this._getInjectedCompressBuffer(t,r,a),t.setHeader("Content-Length",r.length);else{let o=r.toString(),h=o.indexOf("</head>");if(h<0)return r;let u=G01.insertBrowserSdkLoaderByIndex(h,o,e._sdkLoader);if(typeof r=="string")t.removeHeader("Content-Length"),u&&(r=u),t.setHeader("Content-Length",Buffer.byteLength(r));else if(Buffer.isBuffer(r)){let g=i||"utf8";if(G01.isBufferType(r,g)&&u){t.removeHeader("Content-Length");let v=Buffer.from(u).toString(g);r=Buffer.from(v,g),t.setHeader("Content-Length",r.length)}}}}catch(n){Ig1.Logger.getInstance().warn(`Failed to inject browser sdk loader and change content-length headers. Exception:${n}`)}return r}_getInjectedCompressBuffer(t,r,a){try{switch(a){case G01.contentEncodingMethod.GZIP:{let i=i82.gunzipSync(r);if(this.ValidateInjection(t,i)){let n=this.InjectSdkLoader(t,i);r=i82.gzipSync(n)}break}case G01.contentEncodingMethod.DEFLATE:{let i=i82.inflateSync(r);if(this.ValidateInjection(t,i)){let n=this.InjectSdkLoader(t,i);r=i82.deflateSync(n)}break}case G01.contentEncodingMethod.BR:{let i=G01.getBrotliDecompressSync(i82),n=G01.getBrotliCompressSync(i82);if(i&&n){let o=i(r);if(this.ValidateInjection(t,o)){let h=this.InjectSdkLoader(t,o);r=n(h)}break}}}}catch(i){Ig1.Logger.getInstance().info(`get browser SDK loader compress buffer error: ${i}`)}return r}dispose(){e._instance=null,this._isInitialized=!1}};uV0.BrowserSdkLoader=mvt});var v08=M1(Mvt=>{"use strict";Object.defineProperty(Mvt,"__esModule",{value:!0});Mvt.patchOpenTelemetryInstrumentationEnable=Sba;var Cvt=Rn1(),bba=B01();function Sba(){let e=JSON.stringify({instrumentation:0,feature:0});try{Z4.resolve("@opentelemetry/instrumentation");let t=vit(),r=t.enableInstrumentations;t.enableInstrumentations=function(a){try{let i=JSON.parse(process.env[Cvt.AZURE_MONITOR_STATSBEAT_FEATURES]||e),n={};for(let o=0;o<a.length;o++)n={instrumentation:i.instrumentation|=Cvt.StatsbeatInstrumentationMap.get(a[o].instrumentationName)||0,feature:i.feature};process.env[Cvt.AZURE_MONITOR_STATSBEAT_FEATURES]=JSON.stringify(n)}catch{bba.Logger.getInstance().warn("Failed to parse the statsbeat environment variable")}return r.apply(this,arguments)}}catch{}}});var L08=M1(mT2=>{"use strict";Object.defineProperty(mT2,"__esModule",{value:!0});mT2.useAzureMonitor=Iba;mT2.shutdownAzureMonitor=Nba;mT2._getSdkInstance=Uba;var m08=E8(),Hba=TZ(),kba=bN6(),Tba=MU6(),Bba=IQ6(),Vba=L28(),Pba=c08(),C08=Rn1(),_ba=f08(),Eba=_g1(),Rba=ift(),Zba=v08(),M08=EF1(),Fba=B01(),Oba=Rn1();process.env.AZURE_MONITOR_DISTRO_VERSION=C08.AZURE_MONITOR_OPENTELEMETRY_VERSION;var gV0,x08;function Dba(){if(process.env[Oba.AZURE_MONITOR_AUTO_ATTACH]==="true"&&!(0,M08.isFunctionApp)()){let e="Distro detected that automatic instrumentation may have occurred. Only use autoinstrumentation if you are not using manual instrumentation of OpenTelemetry in your code, such as with @azure/monitor-opentelemetry or @azure/monitor-opentelemetry-exporter. For App Service resources, disable autoinstrumentation in the Application Insights experience on your App Service resource or by setting the ApplicationInsightsAgent_EXTENSION_VERSION app setting to 'disabled'.";console.warn(e),Fba.Logger.getInstance().warn(e)}}function Iba(e){let t=new Tba.InternalConfig(e);(0,Zba.patchOpenTelemetryInstrumentationEnable)();let r={azureSdk:t.instrumentationOptions?.azureSdk?.enabled,mongoDb:t.instrumentationOptions?.mongoDb?.enabled,mySql:t.instrumentationOptions?.mySql?.enabled,postgreSql:t.instrumentationOptions?.postgreSql?.enabled,redis:t.instrumentationOptions?.redis?.enabled,bunyan:t.instrumentationOptions?.bunyan?.enabled,winston:t.instrumentationOptions?.winston?.enabled},a={browserSdkLoader:t.browserSdkLoaderOptions.enabled,aadHandling:!!t.azureMonitorExporterOptions?.credential,diskRetry:!t.azureMonitorExporterOptions?.disableOfflineStorage,customerSdkStats:process.env[C08.APPLICATIONINSIGHTS_SDKSTATS_DISABLED]?.toLowerCase()==="true"};(0,Rba.getInstance)().setStatsbeatFeatures(r,a),t.browserSdkLoaderOptions.enabled&&(x08=new _ba.BrowserSdkLoader(t)),m08.metrics.disable(),m08.trace.disable(),Hba.logs.disable();let i=Symbol.for("opentelemetry.js.api.1");delete globalThis[i];let n=new Bba.MetricHandler(t),o=new Vba.TraceHandler(t,n),h=new Pba.LogHandler(t,n),u=o.getInstrumentations().concat(h.getInstrumentations()),g=(0,M08.parseResourceDetectorsFromEnvVar)(),f=e?.spanProcessors||[],v=e?.logRecordProcessors||[],C=e?.views||[],L=[n.getMetricReader(),...e?.metricReaders||[]],y=n.getViews().concat(C),z={autoDetectResources:!0,metricReaders:L,views:y,instrumentations:u,logRecordProcessors:[h.getAzureLogRecordProcessor(),...v,h.getBatchLogRecordProcessor()],resource:t.resource,sampler:o.getSampler(),spanProcessors:[o.getAzureMonitorSpanProcessor(),...f,o.getBatchSpanProcessor()],resourceDetectors:g};gV0=new kba.NodeSDK(z),(0,Eba.setSdkPrefix)(),Dba(),gV0.start()}function Nba(){return x08?.dispose(),gV0?.shutdown()}function Uba(){return gV0}});var CT2=M1((Y0o,w08)=>{var Gba="2.0.0",jba=Number.MAX_SAFE_INTEGER||9007199254740991,Wba=16,qba=250,$ba=["major","premajor","minor","preminor","patch","prepatch","prerelease"];w08.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Wba,MAX_SAFE_BUILD_LENGTH:qba,MAX_SAFE_INTEGER:jba,RELEASE_TYPES:$ba,SEMVER_SPEC_VERSION:Gba,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var MT2=M1((X0o,y08)=>{var Kba=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};y08.exports=Kba});var n82=M1((Ng1,A08)=>{var{MAX_SAFE_COMPONENT_LENGTH:xvt,MAX_SAFE_BUILD_LENGTH:Yba,MAX_LENGTH:Xba}=CT2(),Jba=MT2();Ng1=A08.exports={};var Qba=Ng1.re=[],tSa=Ng1.safeRe=[],Q9=Ng1.src=[],ti=Ng1.t={},eSa=0,Lvt="[a-zA-Z0-9-]",rSa=[["\\s",1],["\\d",Xba],[Lvt,Yba]],aSa=e=>{for(let[t,r]of rSa)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},Xh=(e,t,r)=>{let a=aSa(t),i=eSa++;Jba(e,i,t),ti[e]=i,Q9[i]=t,Qba[i]=new RegExp(t,r?"g":void 0),tSa[i]=new RegExp(a,r?"g":void 0)};Xh("NUMERICIDENTIFIER","0|[1-9]\\d*");Xh("NUMERICIDENTIFIERLOOSE","\\d+");Xh("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${Lvt}*`);Xh("MAINVERSION",`(${Q9[ti.NUMERICIDENTIFIER]})\\.(${Q9[ti.NUMERICIDENTIFIER]})\\.(${Q9[ti.NUMERICIDENTIFIER]})`);Xh("MAINVERSIONLOOSE",`(${Q9[ti.NUMERICIDENTIFIERLOOSE]})\\.(${Q9[ti.NUMERICIDENTIFIERLOOSE]})\\.(${Q9[ti.NUMERICIDENTIFIERLOOSE]})`);Xh("PRERELEASEIDENTIFIER",`(?:${Q9[ti.NUMERICIDENTIFIER]}|${Q9[ti.NONNUMERICIDENTIFIER]})`);Xh("PRERELEASEIDENTIFIERLOOSE",`(?:${Q9[ti.NUMERICIDENTIFIERLOOSE]}|${Q9[ti.NONNUMERICIDENTIFIER]})`);Xh("PRERELEASE",`(?:-(${Q9[ti.PRERELEASEIDENTIFIER]}(?:\\.${Q9[ti.PRERELEASEIDENTIFIER]})*))`);Xh("PRERELEASELOOSE",`(?:-?(${Q9[ti.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${Q9[ti.PRERELEASEIDENTIFIERLOOSE]})*))`);Xh("BUILDIDENTIFIER",`${Lvt}+`);Xh("BUILD",`(?:\\+(${Q9[ti.BUILDIDENTIFIER]}(?:\\.${Q9[ti.BUILDIDENTIFIER]})*))`);Xh("FULLPLAIN",`v?${Q9[ti.MAINVERSION]}${Q9[ti.PRERELEASE]}?${Q9[ti.BUILD]}?`);Xh("FULL",`^${Q9[ti.FULLPLAIN]}$`);Xh("LOOSEPLAIN",`[v=\\s]*${Q9[ti.MAINVERSIONLOOSE]}${Q9[ti.PRERELEASELOOSE]}?${Q9[ti.BUILD]}?`);Xh("LOOSE",`^${Q9[ti.LOOSEPLAIN]}$`);Xh("GTLT","((?:<|>)?=?)");Xh("XRANGEIDENTIFIERLOOSE",`${Q9[ti.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);Xh("XRANGEIDENTIFIER",`${Q9[ti.NUMERICIDENTIFIER]}|x|X|\\*`);Xh("XRANGEPLAIN",`[v=\\s]*(${Q9[ti.XRANGEIDENTIFIER]})(?:\\.(${Q9[ti.XRANGEIDENTIFIER]})(?:\\.(${Q9[ti.XRANGEIDENTIFIER]})(?:${Q9[ti.PRERELEASE]})?${Q9[ti.BUILD]}?)?)?`);Xh("XRANGEPLAINLOOSE",`[v=\\s]*(${Q9[ti.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Q9[ti.XRANGEIDENTIFIERLOOSE]})(?:\\.(${Q9[ti.XRANGEIDENTIFIERLOOSE]})(?:${Q9[ti.PRERELEASELOOSE]})?${Q9[ti.BUILD]}?)?)?`);Xh("XRANGE",`^${Q9[ti.GTLT]}\\s*${Q9[ti.XRANGEPLAIN]}$`);Xh("XRANGELOOSE",`^${Q9[ti.GTLT]}\\s*${Q9[ti.XRANGEPLAINLOOSE]}$`);Xh("COERCEPLAIN",`(^|[^\\d])(\\d{1,${xvt}})(?:\\.(\\d{1,${xvt}}))?(?:\\.(\\d{1,${xvt}}))?`);Xh("COERCE",`${Q9[ti.COERCEPLAIN]}(?:$|[^\\d])`);Xh("COERCEFULL",Q9[ti.COERCEPLAIN]+`(?:${Q9[ti.PRERELEASE]})?(?:${Q9[ti.BUILD]})?(?:$|[^\\d])`);Xh("COERCERTL",Q9[ti.COERCE],!0);Xh("COERCERTLFULL",Q9[ti.COERCEFULL],!0);Xh("LONETILDE","(?:~>?)");Xh("TILDETRIM",`(\\s*)${Q9[ti.LONETILDE]}\\s+`,!0);Ng1.tildeTrimReplace="$1~";Xh("TILDE",`^${Q9[ti.LONETILDE]}${Q9[ti.XRANGEPLAIN]}$`);Xh("TILDELOOSE",`^${Q9[ti.LONETILDE]}${Q9[ti.XRANGEPLAINLOOSE]}$`);Xh("LONECARET","(?:\\^)");Xh("CARETTRIM",`(\\s*)${Q9[ti.LONECARET]}\\s+`,!0);Ng1.caretTrimReplace="$1^";Xh("CARET",`^${Q9[ti.LONECARET]}${Q9[ti.XRANGEPLAIN]}$`);Xh("CARETLOOSE",`^${Q9[ti.LONECARET]}${Q9[ti.XRANGEPLAINLOOSE]}$`);Xh("COMPARATORLOOSE",`^${Q9[ti.GTLT]}\\s*(${Q9[ti.LOOSEPLAIN]})$|^$`);Xh("COMPARATOR",`^${Q9[ti.GTLT]}\\s*(${Q9[ti.FULLPLAIN]})$|^$`);Xh("COMPARATORTRIM",`(\\s*)${Q9[ti.GTLT]}\\s*(${Q9[ti.LOOSEPLAIN]}|${Q9[ti.XRANGEPLAIN]})`,!0);Ng1.comparatorTrimReplace="$1$2$3";Xh("HYPHENRANGE",`^\\s*(${Q9[ti.XRANGEPLAIN]})\\s+-\\s+(${Q9[ti.XRANGEPLAIN]})\\s*$`);Xh("HYPHENRANGELOOSE",`^\\s*(${Q9[ti.XRANGEPLAINLOOSE]})\\s+-\\s+(${Q9[ti.XRANGEPLAINLOOSE]})\\s*$`);Xh("STAR","(<|>)?=?\\s*\\*");Xh("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");Xh("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var pV0=M1((J0o,z08)=>{var iSa=Object.freeze({loose:!0}),nSa=Object.freeze({}),oSa=e=>e?typeof e!="object"?iSa:e:nSa;z08.exports=oSa});var wvt=M1((Q0o,H08)=>{var b08=/^[0-9]+$/,S08=(e,t)=>{let r=b08.test(e),a=b08.test(t);return r&&a&&(e=+e,t=+t),e===t?0:r&&!a?-1:a&&!r?1:e<t?-1:1},lSa=(e,t)=>S08(t,e);H08.exports={compareIdentifiers:S08,rcompareIdentifiers:lSa}});var kD=M1((t4o,V08)=>{var fV0=MT2(),{MAX_LENGTH:k08,MAX_SAFE_INTEGER:vV0}=CT2(),{safeRe:T08,t:B08}=n82(),cSa=pV0(),{compareIdentifiers:o82}=wvt(),yvt=class e{constructor(t,r){if(r=cSa(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>k08)throw new TypeError(`version is longer than ${k08} characters`);fV0("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let a=t.trim().match(r.loose?T08[B08.LOOSE]:T08[B08.FULL]);if(!a)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+a[1],this.minor=+a[2],this.patch=+a[3],this.major>vV0||this.major<0)throw new TypeError("Invalid major version");if(this.minor>vV0||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>vV0||this.patch<0)throw new TypeError("Invalid patch version");a[4]?this.prerelease=a[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let n=+i;if(n>=0&&n<vV0)return n}return i}):this.prerelease=[],this.build=a[5]?a[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(fV0("SemVer.compare",this.version,this.options,t),!(t instanceof e)){if(typeof t=="string"&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),o82(this.major,t.major)||o82(this.minor,t.minor)||o82(this.patch,t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let a=this.prerelease[r],i=t.prerelease[r];if(fV0("prerelease compare",r,a,i),a===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(a===void 0)return-1;if(a===i)continue;return o82(a,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let a=this.build[r],i=t.build[r];if(fV0("build compare",r,a,i),a===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(a===void 0)return-1;if(a===i)continue;return o82(a,i)}while(++r)}inc(t,r,a){switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,a);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,a);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,a),this.inc("pre",r,a);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,a),this.inc("pre",r,a);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(a)?1:0;if(!r&&a===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[i];else{let n=this.prerelease.length;for(;--n>=0;)typeof this.prerelease[n]=="number"&&(this.prerelease[n]++,n=-2);if(n===-1){if(r===this.prerelease.join(".")&&a===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let n=[r,i];a===!1&&(n=[r]),o82(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};V08.exports=yvt});var eO1=M1((e4o,_08)=>{var P08=kD(),sSa=(e,t,r=!1)=>{if(e instanceof P08)return e;try{return new P08(e,t)}catch(a){if(!r)return null;throw a}};_08.exports=sSa});var R08=M1((r4o,E08)=>{var hSa=eO1(),dSa=(e,t)=>{let r=hSa(e,t);return r?r.version:null};E08.exports=dSa});var F08=M1((a4o,Z08)=>{var uSa=eO1(),gSa=(e,t)=>{let r=uSa(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};Z08.exports=gSa});var I08=M1((i4o,D08)=>{var O08=kD(),pSa=(e,t,r,a,i)=>{typeof r=="string"&&(i=a,a=r,r=void 0);try{return new O08(e instanceof O08?e.version:e,r).inc(t,a,i).version}catch{return null}};D08.exports=pSa});var G08=M1((n4o,U08)=>{var N08=eO1(),fSa=(e,t)=>{let r=N08(e,null,!0),a=N08(t,null,!0),i=r.compare(a);if(i===0)return null;let n=i>0,o=n?r:a,h=n?a:r,u=!!o.prerelease.length;if(!!h.prerelease.length&&!u)return!h.patch&&!h.minor?"major":o.patch?"patch":o.minor?"minor":"major";let f=u?"pre":"";return r.major!==a.major?f+"major":r.minor!==a.minor?f+"minor":r.patch!==a.patch?f+"patch":"prerelease"};U08.exports=fSa});var W08=M1((o4o,j08)=>{var vSa=kD(),mSa=(e,t)=>new vSa(e,t).major;j08.exports=mSa});var $08=M1((l4o,q08)=>{var CSa=kD(),MSa=(e,t)=>new CSa(e,t).minor;q08.exports=MSa});var Y08=M1((c4o,K08)=>{var xSa=kD(),LSa=(e,t)=>new xSa(e,t).patch;K08.exports=LSa});var J08=M1((s4o,X08)=>{var wSa=eO1(),ySa=(e,t)=>{let r=wSa(e,t);return r&&r.prerelease.length?r.prerelease:null};X08.exports=ySa});var j01=M1((h4o,t48)=>{var Q08=kD(),ASa=(e,t,r)=>new Q08(e,r).compare(new Q08(t,r));t48.exports=ASa});var r48=M1((d4o,e48)=>{var zSa=j01(),bSa=(e,t,r)=>zSa(t,e,r);e48.exports=bSa});var i48=M1((u4o,a48)=>{var SSa=j01(),HSa=(e,t)=>SSa(e,t,!0);a48.exports=HSa});var mV0=M1((g4o,o48)=>{var n48=kD(),kSa=(e,t,r)=>{let a=new n48(e,r),i=new n48(t,r);return a.compare(i)||a.compareBuild(i)};o48.exports=kSa});var c48=M1((p4o,l48)=>{var TSa=mV0(),BSa=(e,t)=>e.sort((r,a)=>TSa(r,a,t));l48.exports=BSa});var h48=M1((f4o,s48)=>{var VSa=mV0(),PSa=(e,t)=>e.sort((r,a)=>VSa(a,r,t));s48.exports=PSa});var xT2=M1((v4o,d48)=>{var _Sa=j01(),ESa=(e,t,r)=>_Sa(e,t,r)>0;d48.exports=ESa});var CV0=M1((m4o,u48)=>{var RSa=j01(),ZSa=(e,t,r)=>RSa(e,t,r)<0;u48.exports=ZSa});var Avt=M1((C4o,g48)=>{var FSa=j01(),OSa=(e,t,r)=>FSa(e,t,r)===0;g48.exports=OSa});var zvt=M1((M4o,p48)=>{var DSa=j01(),ISa=(e,t,r)=>DSa(e,t,r)!==0;p48.exports=ISa});var MV0=M1((x4o,f48)=>{var NSa=j01(),USa=(e,t,r)=>NSa(e,t,r)>=0;f48.exports=USa});var xV0=M1((L4o,v48)=>{var GSa=j01(),jSa=(e,t,r)=>GSa(e,t,r)<=0;v48.exports=jSa});var bvt=M1((w4o,m48)=>{var WSa=Avt(),qSa=zvt(),$Sa=xT2(),KSa=MV0(),YSa=CV0(),XSa=xV0(),JSa=(e,t,r,a)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return WSa(e,r,a);case"!=":return qSa(e,r,a);case">":return $Sa(e,r,a);case">=":return KSa(e,r,a);case"<":return YSa(e,r,a);case"<=":return XSa(e,r,a);default:throw new TypeError(`Invalid operator: ${t}`)}};m48.exports=JSa});var M48=M1((y4o,C48)=>{var QSa=kD(),tHa=eO1(),{safeRe:LV0,t:wV0}=n82(),eHa=(e,t)=>{if(e instanceof QSa)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?LV0[wV0.COERCEFULL]:LV0[wV0.COERCE]);else{let u=t.includePrerelease?LV0[wV0.COERCERTLFULL]:LV0[wV0.COERCERTL],g;for(;(g=u.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||g.index+g[0].length!==r.index+r[0].length)&&(r=g),u.lastIndex=g.index+g[1].length+g[2].length;u.lastIndex=-1}if(r===null)return null;let a=r[2],i=r[3]||"0",n=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",h=t.includePrerelease&&r[6]?`+${r[6]}`:"";return tHa(`${a}.${i}.${n}${o}${h}`,t)};C48.exports=eHa});var L48=M1((A4o,x48)=>{var Svt=class{constructor(){this.max=1e3,this.map=new Map}get(t){let r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(t,r)}return this}};x48.exports=Svt});var W01=M1((z4o,z48)=>{var rHa=/\s+/g,Hvt=class e{constructor(t,r){if(r=iHa(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof kvt)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(rHa," "),this.set=this.raw.split("||").map(a=>this.parseRange(a.trim())).filter(a=>a.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let a=this.set[0];if(this.set=this.set.filter(i=>!y48(i[0])),this.set.length===0)this.set=[a];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&dHa(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let t=0;t<this.set.length;t++){t>0&&(this.formatted+="||");let r=this.set[t];for(let a=0;a<r.length;a++)a>0&&(this.formatted+=" "),this.formatted+=r[a].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(t){let a=((this.options.includePrerelease&&sHa)|(this.options.loose&&hHa))+":"+t,i=w48.get(a);if(i)return i;let n=this.options.loose,o=n?Hq[AU.HYPHENRANGELOOSE]:Hq[AU.HYPHENRANGE];t=t.replace(o,LHa(this.options.includePrerelease)),Yy("hyphen replace",t),t=t.replace(Hq[AU.COMPARATORTRIM],oHa),Yy("comparator trim",t),t=t.replace(Hq[AU.TILDETRIM],lHa),Yy("tilde trim",t),t=t.replace(Hq[AU.CARETTRIM],cHa),Yy("caret trim",t);let h=t.split(" ").map(v=>uHa(v,this.options)).join(" ").split(/\s+/).map(v=>xHa(v,this.options));n&&(h=h.filter(v=>(Yy("loose invalid filter",v,this.options),!!v.match(Hq[AU.COMPARATORLOOSE])))),Yy("range list",h);let u=new Map,g=h.map(v=>new kvt(v,this.options));for(let v of g){if(y48(v))return[v];u.set(v.value,v)}u.size>1&&u.has("")&&u.delete("");let f=[...u.values()];return w48.set(a,f),f}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some(a=>A48(a,r)&&t.set.some(i=>A48(i,r)&&a.every(n=>i.every(o=>n.intersects(o,r)))))}test(t){if(!t)return!1;if(typeof t=="string")try{t=new nHa(t,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(wHa(this.set[r],t,this.options))return!0;return!1}};z48.exports=Hvt;var aHa=L48(),w48=new aHa,iHa=pV0(),kvt=LT2(),Yy=MT2(),nHa=kD(),{safeRe:Hq,t:AU,comparatorTrimReplace:oHa,tildeTrimReplace:lHa,caretTrimReplace:cHa}=n82(),{FLAG_INCLUDE_PRERELEASE:sHa,FLAG_LOOSE:hHa}=CT2(),y48=e=>e.value==="<0.0.0-0",dHa=e=>e.value==="",A48=(e,t)=>{let r=!0,a=e.slice(),i=a.pop();for(;r&&a.length;)r=a.every(n=>i.intersects(n,t)),i=a.pop();return r},uHa=(e,t)=>(Yy("comp",e,t),e=fHa(e,t),Yy("caret",e),e=gHa(e,t),Yy("tildes",e),e=mHa(e,t),Yy("xrange",e),e=MHa(e,t),Yy("stars",e),e),zU=e=>!e||e.toLowerCase()==="x"||e==="*",gHa=(e,t)=>e.trim().split(/\s+/).map(r=>pHa(r,t)).join(" "),pHa=(e,t)=>{let r=t.loose?Hq[AU.TILDELOOSE]:Hq[AU.TILDE];return e.replace(r,(a,i,n,o,h)=>{Yy("tilde",e,a,i,n,o,h);let u;return zU(i)?u="":zU(n)?u=`>=${i}.0.0 <${+i+1}.0.0-0`:zU(o)?u=`>=${i}.${n}.0 <${i}.${+n+1}.0-0`:h?(Yy("replaceTilde pr",h),u=`>=${i}.${n}.${o}-${h} <${i}.${+n+1}.0-0`):u=`>=${i}.${n}.${o} <${i}.${+n+1}.0-0`,Yy("tilde return",u),u})},fHa=(e,t)=>e.trim().split(/\s+/).map(r=>vHa(r,t)).join(" "),vHa=(e,t)=>{Yy("caret",e,t);let r=t.loose?Hq[AU.CARETLOOSE]:Hq[AU.CARET],a=t.includePrerelease?"-0":"";return e.replace(r,(i,n,o,h,u)=>{Yy("caret",e,i,n,o,h,u);let g;return zU(n)?g="":zU(o)?g=`>=${n}.0.0${a} <${+n+1}.0.0-0`:zU(h)?n==="0"?g=`>=${n}.${o}.0${a} <${n}.${+o+1}.0-0`:g=`>=${n}.${o}.0${a} <${+n+1}.0.0-0`:u?(Yy("replaceCaret pr",u),n==="0"?o==="0"?g=`>=${n}.${o}.${h}-${u} <${n}.${o}.${+h+1}-0`:g=`>=${n}.${o}.${h}-${u} <${n}.${+o+1}.0-0`:g=`>=${n}.${o}.${h}-${u} <${+n+1}.0.0-0`):(Yy("no pr"),n==="0"?o==="0"?g=`>=${n}.${o}.${h}${a} <${n}.${o}.${+h+1}-0`:g=`>=${n}.${o}.${h}${a} <${n}.${+o+1}.0-0`:g=`>=${n}.${o}.${h} <${+n+1}.0.0-0`),Yy("caret return",g),g})},mHa=(e,t)=>(Yy("replaceXRanges",e,t),e.split(/\s+/).map(r=>CHa(r,t)).join(" ")),CHa=(e,t)=>{e=e.trim();let r=t.loose?Hq[AU.XRANGELOOSE]:Hq[AU.XRANGE];return e.replace(r,(a,i,n,o,h,u)=>{Yy("xRange",e,a,i,n,o,h,u);let g=zU(n),f=g||zU(o),v=f||zU(h),C=v;return i==="="&&C&&(i=""),u=t.includePrerelease?"-0":"",g?i===">"||i==="<"?a="<0.0.0-0":a="*":i&&C?(f&&(o=0),h=0,i===">"?(i=">=",f?(n=+n+1,o=0,h=0):(o=+o+1,h=0)):i==="<="&&(i="<",f?n=+n+1:o=+o+1),i==="<"&&(u="-0"),a=`${i+n}.${o}.${h}${u}`):f?a=`>=${n}.0.0${u} <${+n+1}.0.0-0`:v&&(a=`>=${n}.${o}.0${u} <${n}.${+o+1}.0-0`),Yy("xRange return",a),a})},MHa=(e,t)=>(Yy("replaceStars",e,t),e.trim().replace(Hq[AU.STAR],"")),xHa=(e,t)=>(Yy("replaceGTE0",e,t),e.trim().replace(Hq[t.includePrerelease?AU.GTE0PRE:AU.GTE0],"")),LHa=e=>(t,r,a,i,n,o,h,u,g,f,v,C)=>(zU(a)?r="":zU(i)?r=`>=${a}.0.0${e?"-0":""}`:zU(n)?r=`>=${a}.${i}.0${e?"-0":""}`:o?r=`>=${r}`:r=`>=${r}${e?"-0":""}`,zU(g)?u="":zU(f)?u=`<${+g+1}.0.0-0`:zU(v)?u=`<${g}.${+f+1}.0-0`:C?u=`<=${g}.${f}.${v}-${C}`:e?u=`<${g}.${f}.${+v+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),wHa=(e,t,r)=>{for(let a=0;a<e.length;a++)if(!e[a].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let a=0;a<e.length;a++)if(Yy(e[a].semver),e[a].semver!==kvt.ANY&&e[a].semver.prerelease.length>0){let i=e[a].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0}});var LT2=M1((b4o,B48)=>{var wT2=Symbol("SemVer ANY"),Vvt=class e{static get ANY(){return wT2}constructor(t,r){if(r=b48(r),t instanceof e){if(t.loose===!!r.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(" "),Bvt("comparator",t,r),this.options=r,this.loose=!!r.loose,this.parse(t),this.semver===wT2?this.value="":this.value=this.operator+this.semver.version,Bvt("comp",this)}parse(t){let r=this.options.loose?S48[H48.COMPARATORLOOSE]:S48[H48.COMPARATOR],a=t.match(r);if(!a)throw new TypeError(`Invalid comparator: ${t}`);this.operator=a[1]!==void 0?a[1]:"",this.operator==="="&&(this.operator=""),a[2]?this.semver=new k48(a[2],this.options.loose):this.semver=wT2}toString(){return this.value}test(t){if(Bvt("Comparator.test",t,this.options.loose),this.semver===wT2||t===wT2)return!0;if(typeof t=="string")try{t=new k48(t,this.options)}catch{return!1}return Tvt(t,this.operator,this.semver,this.options)}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new T48(t.value,r).test(this.value):t.operator===""?t.value===""?!0:new T48(this.value,r).test(t.semver):(r=b48(r),r.includePrerelease&&(this.value==="<0.0.0-0"||t.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||t.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&t.operator.startsWith(">")||this.operator.startsWith("<")&&t.operator.startsWith("<")||this.semver.version===t.semver.version&&this.operator.includes("=")&&t.operator.includes("=")||Tvt(this.semver,"<",t.semver,r)&&this.operator.startsWith(">")&&t.operator.startsWith("<")||Tvt(this.semver,">",t.semver,r)&&this.operator.startsWith("<")&&t.operator.startsWith(">")))}};B48.exports=Vvt;var b48=pV0(),{safeRe:S48,t:H48}=n82(),Tvt=bvt(),Bvt=MT2(),k48=kD(),T48=W01()});var yT2=M1((S4o,V48)=>{var yHa=W01(),AHa=(e,t,r)=>{try{t=new yHa(t,r)}catch{return!1}return t.test(e)};V48.exports=AHa});var _48=M1((H4o,P48)=>{var zHa=W01(),bHa=(e,t)=>new zHa(e,t).set.map(r=>r.map(a=>a.value).join(" ").trim().split(" "));P48.exports=bHa});var R48=M1((k4o,E48)=>{var SHa=kD(),HHa=W01(),kHa=(e,t,r)=>{let a=null,i=null,n=null;try{n=new HHa(t,r)}catch{return null}return e.forEach(o=>{n.test(o)&&(!a||i.compare(o)===-1)&&(a=o,i=new SHa(a,r))}),a};E48.exports=kHa});var F48=M1((T4o,Z48)=>{var THa=kD(),BHa=W01(),VHa=(e,t,r)=>{let a=null,i=null,n=null;try{n=new BHa(t,r)}catch{return null}return e.forEach(o=>{n.test(o)&&(!a||i.compare(o)===1)&&(a=o,i=new THa(a,r))}),a};Z48.exports=VHa});var I48=M1((B4o,D48)=>{var Pvt=kD(),PHa=W01(),O48=xT2(),_Ha=(e,t)=>{e=new PHa(e,t);let r=new Pvt("0.0.0");if(e.test(r)||(r=new Pvt("0.0.0-0"),e.test(r)))return r;r=null;for(let a=0;a<e.set.length;++a){let i=e.set[a],n=null;i.forEach(o=>{let h=new Pvt(o.semver.version);switch(o.operator){case">":h.prerelease.length===0?h.patch++:h.prerelease.push(0),h.raw=h.format();case"":case">=":(!n||O48(h,n))&&(n=h);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),n&&(!r||O48(r,n))&&(r=n)}return r&&e.test(r)?r:null};D48.exports=_Ha});var U48=M1((V4o,N48)=>{var EHa=W01(),RHa=(e,t)=>{try{return new EHa(e,t).range||"*"}catch{return null}};N48.exports=RHa});var yV0=M1((P4o,q48)=>{var ZHa=kD(),W48=LT2(),{ANY:FHa}=W48,OHa=W01(),DHa=yT2(),G48=xT2(),j48=CV0(),IHa=xV0(),NHa=MV0(),UHa=(e,t,r,a)=>{e=new ZHa(e,a),t=new OHa(t,a);let i,n,o,h,u;switch(r){case">":i=G48,n=IHa,o=j48,h=">",u=">=";break;case"<":i=j48,n=NHa,o=G48,h="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(DHa(e,t,a))return!1;for(let g=0;g<t.set.length;++g){let f=t.set[g],v=null,C=null;if(f.forEach(L=>{L.semver===FHa&&(L=new W48(">=0.0.0")),v=v||L,C=C||L,i(L.semver,v.semver,a)?v=L:o(L.semver,C.semver,a)&&(C=L)}),v.operator===h||v.operator===u||(!C.operator||C.operator===h)&&n(e,C.semver))return!1;if(C.operator===u&&o(e,C.semver))return!1}return!0};q48.exports=UHa});var K48=M1((_4o,$48)=>{var GHa=yV0(),jHa=(e,t,r)=>GHa(e,t,">",r);$48.exports=jHa});var X48=M1((E4o,Y48)=>{var WHa=yV0(),qHa=(e,t,r)=>WHa(e,t,"<",r);Y48.exports=qHa});var tt8=M1((R4o,Q48)=>{var J48=W01(),$Ha=(e,t,r)=>(e=new J48(e,r),t=new J48(t,r),e.intersects(t,r));Q48.exports=$Ha});var rt8=M1((Z4o,et8)=>{var KHa=yT2(),YHa=j01();et8.exports=(e,t,r)=>{let a=[],i=null,n=null,o=e.sort((f,v)=>YHa(f,v,r));for(let f of o)KHa(f,t,r)?(n=f,i||(i=f)):(n&&a.push([i,n]),n=null,i=null);i&&a.push([i,null]);let h=[];for(let[f,v]of a)f===v?h.push(f):!v&&f===o[0]?h.push("*"):v?f===o[0]?h.push(`<=${v}`):h.push(`${f} - ${v}`):h.push(`>=${f}`);let u=h.join(" || "),g=typeof t.raw=="string"?t.raw:String(t);return u.length<g.length?u:t}});var ct8=M1((F4o,lt8)=>{var at8=W01(),Evt=LT2(),{ANY:_vt}=Evt,AT2=yT2(),Rvt=j01(),XHa=(e,t,r={})=>{if(e===t)return!0;e=new at8(e,r),t=new at8(t,r);let a=!1;t:for(let i of e.set){for(let n of t.set){let o=QHa(i,n,r);if(a=a||o!==null,o)continue t}if(a)return!1}return!0},JHa=[new Evt(">=0.0.0-0")],it8=[new Evt(">=0.0.0")],QHa=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===_vt){if(t.length===1&&t[0].semver===_vt)return!0;r.includePrerelease?e=JHa:e=it8}if(t.length===1&&t[0].semver===_vt){if(r.includePrerelease)return!0;t=it8}let a=new Set,i,n;for(let L of e)L.operator===">"||L.operator===">="?i=nt8(i,L,r):L.operator==="<"||L.operator==="<="?n=ot8(n,L,r):a.add(L.semver);if(a.size>1)return null;let o;if(i&&n){if(o=Rvt(i.semver,n.semver,r),o>0)return null;if(o===0&&(i.operator!==">="||n.operator!=="<="))return null}for(let L of a){if(i&&!AT2(L,String(i),r)||n&&!AT2(L,String(n),r))return null;for(let y of t)if(!AT2(L,String(y),r))return!1;return!0}let h,u,g,f,v=n&&!r.includePrerelease&&n.semver.prerelease.length?n.semver:!1,C=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;v&&v.prerelease.length===1&&n.operator==="<"&&v.prerelease[0]===0&&(v=!1);for(let L of t){if(f=f||L.operator===">"||L.operator===">=",g=g||L.operator==="<"||L.operator==="<=",i){if(C&&L.semver.prerelease&&L.semver.prerelease.length&&L.semver.major===C.major&&L.semver.minor===C.minor&&L.semver.patch===C.patch&&(C=!1),L.operator===">"||L.operator===">="){if(h=nt8(i,L,r),h===L&&h!==i)return!1}else if(i.operator===">="&&!AT2(i.semver,String(L),r))return!1}if(n){if(v&&L.semver.prerelease&&L.semver.prerelease.length&&L.semver.major===v.major&&L.semver.minor===v.minor&&L.semver.patch===v.patch&&(v=!1),L.operator==="<"||L.operator==="<="){if(u=ot8(n,L,r),u===L&&u!==n)return!1}else if(n.operator==="<="&&!AT2(n.semver,String(L),r))return!1}if(!L.operator&&(n||i)&&o!==0)return!1}return!(i&&g&&!n&&o!==0||n&&f&&!i&&o!==0||C||v)},nt8=(e,t,r)=>{if(!e)return t;let a=Rvt(e.semver,t.semver,r);return a>0?e:a<0||t.operator===">"&&e.operator===">="?t:e},ot8=(e,t,r)=>{if(!e)return t;let a=Rvt(e.semver,t.semver,r);return a<0?e:a>0||t.operator==="<"&&e.operator==="<="?t:e};lt8.exports=XHa});var ut8=M1((O4o,dt8)=>{var Zvt=n82(),st8=CT2(),tka=kD(),ht8=wvt(),eka=eO1(),rka=R08(),aka=F08(),ika=I08(),nka=G08(),oka=W08(),lka=$08(),cka=Y08(),ska=J08(),hka=j01(),dka=r48(),uka=i48(),gka=mV0(),pka=c48(),fka=h48(),vka=xT2(),mka=CV0(),Cka=Avt(),Mka=zvt(),xka=MV0(),Lka=xV0(),wka=bvt(),yka=M48(),Aka=LT2(),zka=W01(),bka=yT2(),Ska=_48(),Hka=R48(),kka=F48(),Tka=I48(),Bka=U48(),Vka=yV0(),Pka=K48(),_ka=X48(),Eka=tt8(),Rka=rt8(),Zka=ct8();dt8.exports={parse:eka,valid:rka,clean:aka,inc:ika,diff:nka,major:oka,minor:lka,patch:cka,prerelease:ska,compare:hka,rcompare:dka,compareLoose:uka,compareBuild:gka,sort:pka,rsort:fka,gt:vka,lt:mka,eq:Cka,neq:Mka,gte:xka,lte:Lka,cmp:wka,coerce:yka,Comparator:Aka,Range:zka,satisfies:bka,toComparators:Ska,maxSatisfying:Hka,minSatisfying:kka,minVersion:Tka,validRange:Bka,outside:Vka,gtr:Pka,ltr:_ka,intersects:Eka,simplifyRange:Rka,subset:Zka,SemVer:tka,re:Zvt.re,src:Zvt.src,tokens:Zvt.t,SEMVER_SPEC_VERSION:st8.SEMVER_SPEC_VERSION,RELEASE_TYPES:st8.RELEASE_TYPES,compareIdentifiers:ht8.compareIdentifiers,rcompareIdentifiers:ht8.rcompareIdentifiers}});var Fvt=M1(AV0=>{"use strict";Object.defineProperty(AV0,"__esModule",{value:!0});AV0.makePatchingRequire=void 0;var Fka=Z4("path"),Oka=ut8(),gt8=kq(),ft8=Z4("module"),Dka=Object.keys(process.binding("natives")),pt8=ft8.prototype.require;function Ika(e){var t={};return function(a){var i=pt8.apply(this,arguments);if(e[a]){var n=ft8._resolveFilename(a,this);if(t.hasOwnProperty(n))return t[n];var o=void 0;if(Dka.indexOf(a)<0)try{o=pt8.call(this,Fka.join(a,"package.json")).version}catch{return i}else o=process.version.substring(1);var h=o.indexOf("-");h>=0&&(o=o.substring(0,h));for(var u=i,g=0,f=e[a];g<f.length;g++){var v=f[g];if(Oka.satisfies(o,v.versionSpecifier)&&(u=v.patch(u,n),gt8.channel)){var C=v.publisherName||a;gt8.channel.addPatchedModule(C,o)}}return t[n]=u}return i}}AV0.makePatchingRequire=Ika});var vt8=M1((I4o,Nka)=>{Nka.exports={name:"diagnostic-channel",version:"1.1.1",main:"./dist/src/channel.js",types:"./dist/src/channel.d.ts",scripts:{build:"tsc",lint:"eslint ./ --fix",clean:"rimraf ./dist",test:"mocha ./dist/tests/**/*.js",debug:"mocha --inspect-brk ./dist/tests/**/*.js"},homepage:"https://github.com/Microsoft/node-diagnostic-channel",bugs:{url:"https://github.com/Microsoft/node-diagnostic-channel/issues"},repository:{type:"git",url:"https://github.com/Microsoft/node-diagnostic-channel.git"},description:"Provides a context-saving pub/sub channel to connect diagnostic event publishers and subscribers",dependencies:{semver:"^7.5.3"},devDependencies:{"@types/mocha":"^2.2.40","@types/node":"~8.0.0",mocha:"^3.2.0",rimraf:"^2.6.1",sinon:"1.17.6",typescript:"4.1.2"},files:["dist/src/**/*.d.ts","dist/src/**/*.js","LICENSE","README.md","package.json"],license:"MIT"}});var kq=M1(q01=>{"use strict";Object.defineProperty(q01,"__esModule",{value:!0});q01.channel=q01.ContextPreservingEventEmitter=q01.trueFilter=q01.makePatchingRequire=void 0;var Uka=Fvt(),Gka=Fvt();Object.defineProperty(q01,"makePatchingRequire",{enumerable:!0,get:function(){return Gka.makePatchingRequire}});var jka=function(e){return!0};q01.trueFilter=jka;var Ct8=(function(){function e(){this.version=vt8().version,this.subscribers={},this.contextPreservationFunction=function(t){return t},this.knownPatches={},this.modulesPatched=[],this.currentlyPublishing=!1}return e.prototype.shouldPublish=function(t){var r=this.subscribers[t];return r?r.some(function(a){var i=a.filter;return!i||i(!1)}):!1},e.prototype.publish=function(t,r){if(!this.currentlyPublishing){var a=this.subscribers[t];if(a){var i={timestamp:Date.now(),data:r};this.currentlyPublishing=!0,a.forEach(function(n){var o=n.listener,h=n.filter;try{h&&h(!0)&&o(i)}catch{}}),this.currentlyPublishing=!1}}},e.prototype.subscribe=function(t,r,a,i){a===void 0&&(a=q01.trueFilter),this.subscribers[t]||(this.subscribers[t]=[]),this.subscribers[t].push({listener:r,filter:a,patchCallback:i});var n=this.checkIfModuleIsAlreadyPatched(t);n&&i&&i(n.name,n.version)},e.prototype.unsubscribe=function(t,r,a){a===void 0&&(a=q01.trueFilter);var i=this.subscribers[t];if(i){for(var n=0;n<i.length;++n)if(i[n].listener===r&&i[n].filter===a)return i.splice(n,1),!0}return!1},e.prototype.reset=function(){var t=this;this.subscribers={},this.contextPreservationFunction=function(r){return r},Object.getOwnPropertyNames(this.knownPatches).forEach(function(r){return delete t.knownPatches[r]})},e.prototype.bindToContext=function(t){return this.contextPreservationFunction(t)},e.prototype.addContextPreservation=function(t){var r=this.contextPreservationFunction;this.contextPreservationFunction=(function(a){return t(r(a))})},e.prototype.registerMonkeyPatch=function(t,r){this.knownPatches[t]||(this.knownPatches[t]=[]),this.knownPatches[t].push(r)},e.prototype.getPatchesObject=function(){return this.knownPatches},e.prototype.addPatchedModule=function(t,r){for(var a=0,i=this.modulesPatched;a<i.length;a++){var n=i[a];if(n.name===t)return}this.modulesPatched.push({name:t,version:r});var o=this.subscribers[t];o&&o.forEach(function(h){h.patchCallback&&h.patchCallback(t,r)})},e.prototype.checkIfModuleIsAlreadyPatched=function(t){for(var r=0,a=this.modulesPatched;r<a.length;r++){var i=a[r];if(i.name===t)return i}return null},e})();q01.ContextPreservingEventEmitter=Ct8;global.diagnosticsSource||(global.diagnosticsSource=new Ct8,mt8=Z4("module"),mt8.prototype.require=Uka.makePatchingRequire(global.diagnosticsSource.getPatchesObject()));var mt8;q01.channel=global.diagnosticsSource});var xt8=M1($01=>{"use strict";Object.defineProperty($01,"__esModule",{value:!0});$01.enable=$01.azureCoreTracing=$01.AzureMonitorSymbol=void 0;var Ovt=kq();$01.AzureMonitorSymbol="Azure_Monitor_Tracer";var Dvt="azure-coretracing",Mt8=!1,Wka=function(e){if(Mt8)return e;try{var t=fU(),r=E8(),a=new t.BasicTracerProvider,i=a.getTracer("applicationinsights tracer");if(e.setTracer){var n=e.setTracer;e.setTracer=function(g){var f=g.startSpan;g.startSpan=function(v,C,L){var y=f.call(this,v,C,L),z=y.end;return y.end=function(){var S=z.apply(this,arguments);return Ovt.channel.publish(Dvt,y),S},y},g[$01.AzureMonitorSymbol]=!0,n.call(this,g)},r.trace.getSpan(r.context.active()),e.setTracer(i)}else{var o=r.trace.setGlobalTracerProvider;r.trace.setGlobalTracerProvider=function(g){var f=g.getTracer;return g.getTracer=function(v,C){var L=f.call(this,v,C);if(!L[$01.AzureMonitorSymbol]){var y=L.startSpan;L.startSpan=function(z,S,B){var R=y.call(this,z,S,B),F=R.end;return R.end=function(){var N=F.apply(this,arguments);return Ovt.channel.publish(Dvt,R),N},R},L[$01.AzureMonitorSymbol]=!0}return L},o.call(this,g)},a.register(),r.trace.getSpan(r.context.active());var h=xD(),u=yft();h.registerInstrumentations({instrumentations:[u.createAzureSdkInstrumentation()]})}Mt8=!0}catch{}return e};$01.azureCoreTracing={versionSpecifier:">= 1.0.0 < 2.0.0",patch:Wka,publisherName:Dvt};function qka(){Ovt.channel.registerMonkeyPatch("@azure/core-tracing",$01.azureCoreTracing)}$01.enable=qka});var wt8=M1(rO1=>{"use strict";Object.defineProperty(rO1,"__esModule",{value:!0});rO1.enable=rO1.bunyan=void 0;var Lt8=kq(),$ka=function(e){var t=e.prototype._emit;return e.prototype._emit=function(r,a){var i=t.apply(this,arguments);if(!a){var n=i;n||(n=t.call(this,r,!0)),Lt8.channel.publish("bunyan",{level:r.level,result:n})}return i},e};rO1.bunyan={versionSpecifier:">= 1.0.0 < 2.0.0",patch:$ka};function Kka(){Lt8.channel.registerMonkeyPatch("bunyan",rO1.bunyan)}rO1.enable=Kka});var At8=M1(aO1=>{"use strict";Object.defineProperty(aO1,"__esModule",{value:!0});aO1.enable=aO1.console=void 0;var Ivt=kq(),yt8=Z4("stream"),Yka=function(e){var t=new yt8.Writable,r=new yt8.Writable;t.write=function(g){if(!g)return!0;var f=g.toString();return Ivt.channel.publish("console",{message:f}),!0},r.write=function(g){if(!g)return!0;var f=g.toString();return Ivt.channel.publish("console",{message:f,stderr:!0}),!0};for(var a=new e.Console(t,r),i=["log","info","warn","error","dir","time","timeEnd","trace","assert"],n=function(g){var f=e[g];f&&(e[g]=function(){if(a[g])try{a[g].apply(a,arguments)}catch{}return f.apply(e,arguments)})},o=0,h=i;o<h.length;o++){var u=h[o];n(u)}return e};aO1.console={versionSpecifier:">= 4.0.0",patch:Yka};function Xka(){Ivt.channel.registerMonkeyPatch("console",aO1.console),Z4("console")}aO1.enable=Xka});var zt8=M1(iO1=>{"use strict";Object.defineProperty(iO1,"__esModule",{value:!0});iO1.enable=iO1.mongoCore=void 0;var Nvt=kq(),Jka=function(e){var t=e.Server.prototype.connect;return e.Server.prototype.connect=function(){var a=t.apply(this,arguments),i=this.s.pool.write;this.s.pool.write=function(){var h=typeof arguments[1]=="function"?1:2;return typeof arguments[h]=="function"&&(arguments[h]=Nvt.channel.bindToContext(arguments[h])),i.apply(this,arguments)};var n=this.s.pool.logout;return this.s.pool.logout=function(){return typeof arguments[1]=="function"&&(arguments[1]=Nvt.channel.bindToContext(arguments[1])),n.apply(this,arguments)},a},e};iO1.mongoCore={versionSpecifier:">= 2.0.0 < 4.0.0",patch:Jka};function Qka(){Nvt.channel.registerMonkeyPatch("mongodb-core",iO1.mongoCore)}iO1.enable=Qka});var bt8=M1(bU=>{"use strict";var l82=bU&&bU.__assign||function(){return l82=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},l82.apply(this,arguments)};Object.defineProperty(bU,"__esModule",{value:!0});bU.enable=bU.mongo330=bU.mongo3=bU.mongo2=void 0;var TD=kq(),tTa=function(e){var t=e.instrument({operationIdGenerator:{next:function(){return TD.channel.bindToContext(function(a){return a()})}}}),r={};return t.on("started",function(a){r[a.requestId]||(r[a.requestId]=l82(l82({},a),{time:new Date}))}),t.on("succeeded",function(a){var i=r[a.requestId];i&&delete r[a.requestId],typeof a.operationId=="function"?a.operationId(function(){return TD.channel.publish("mongodb",{startedData:i,event:a,succeeded:!0})}):TD.channel.publish("mongodb",{startedData:i,event:a,succeeded:!0})}),t.on("failed",function(a){var i=r[a.requestId];i&&delete r[a.requestId],typeof a.operationId=="function"?a.operationId(function(){return TD.channel.publish("mongodb",{startedData:i,event:a,succeeded:!1})}):TD.channel.publish("mongodb",{startedData:i,event:a,succeeded:!1})}),e},eTa=function(e){var t=e.instrument(),r={},a={};return t.on("started",function(i){r[i.requestId]||(a[i.requestId]=TD.channel.bindToContext(function(n){return n()}),r[i.requestId]=l82(l82({},i),{time:new Date}))}),t.on("succeeded",function(i){var n=r[i.requestId];n&&delete r[i.requestId],typeof i=="object"&&typeof a[i.requestId]=="function"&&(a[i.requestId](function(){return TD.channel.publish("mongodb",{startedData:n,event:i,succeeded:!0})}),delete a[i.requestId])}),t.on("failed",function(i){var n=r[i.requestId];n&&delete r[i.requestId],typeof i=="object"&&typeof a[i.requestId]=="function"&&(a[i.requestId](function(){return TD.channel.publish("mongodb",{startedData:n,event:i,succeeded:!1})}),delete a[i.requestId])}),e},rTa=function(e){var t=e.Server.prototype.connect;return e.Server.prototype.connect=function(){var a=t.apply(this,arguments),i=this.s.coreTopology.s.pool.write;this.s.coreTopology.s.pool.write=function(){var h=typeof arguments[1]=="function"?1:2;return typeof arguments[h]=="function"&&(arguments[h]=TD.channel.bindToContext(arguments[h])),i.apply(this,arguments)};var n=this.s.coreTopology.s.pool.logout;return this.s.coreTopology.s.pool.logout=function(){return typeof arguments[1]=="function"&&(arguments[1]=TD.channel.bindToContext(arguments[1])),n.apply(this,arguments)},a},e},aTa=function(e){rTa(e);var t=e.instrument(),r={},a={};return t.on("started",function(i){r[i.requestId]||(a[i.requestId]=TD.channel.bindToContext(function(n){return n()}),r[i.requestId]=i)}),t.on("succeeded",function(i){var n=r[i.requestId];n&&delete r[i.requestId],typeof i=="object"&&typeof a[i.requestId]=="function"&&(a[i.requestId](function(){return TD.channel.publish("mongodb",{startedData:n,event:i,succeeded:!0})}),delete a[i.requestId])}),t.on("failed",function(i){var n=r[i.requestId];n&&delete r[i.requestId],typeof i=="object"&&typeof a[i.requestId]=="function"&&(a[i.requestId](function(){return TD.channel.publish("mongodb",{startedData:n,event:i,succeeded:!1})}),delete a[i.requestId])}),e};bU.mongo2={versionSpecifier:">= 2.0.0 <= 3.0.5",patch:tTa};bU.mongo3={versionSpecifier:"> 3.0.5 < 3.3.0",patch:eTa};bU.mongo330={versionSpecifier:">= 3.3.0 < 4.0.0",patch:aTa};function iTa(){TD.channel.registerMonkeyPatch("mongodb",bU.mongo2),TD.channel.registerMonkeyPatch("mongodb",bU.mongo3),TD.channel.registerMonkeyPatch("mongodb",bU.mongo330)}bU.enable=iTa});var Ht8=M1(nO1=>{"use strict";Object.defineProperty(nO1,"__esModule",{value:!0});nO1.enable=nO1.mysql=void 0;var zV0=kq(),St8=Z4("path"),nTa=function(e,t){var r=function(u,g){return function(f,v){var C=u[f];C&&(u[f]=function(){for(var y=arguments.length-1,z=arguments.length-1;z>=0;--z)if(typeof arguments[z]=="function"){y=z;break}else if(typeof arguments[z]<"u")break;var S=arguments[y],B={result:null,startTime:null,startDate:null};typeof S=="function"&&(v?(B.startTime=process.hrtime(),B.startDate=new Date,arguments[y]=zV0.channel.bindToContext(v(B,S))):arguments[y]=zV0.channel.bindToContext(S));var R=C.apply(this,arguments);return B.result=R,R})}},a=function(u,g){return r(u.prototype,g+".prototype")},i=["connect","changeUser","ping","statistics","end"],n=Z4(St8.dirname(t)+"/lib/Connection");i.forEach(function(u){return a(n,"Connection")(u)}),r(n,"Connection")("createQuery",function(u,g){return function(f){var v=process.hrtime(u.startTime),C=v[0]*1e3+v[1]/1e6|0;zV0.channel.publish("mysql",{query:u.result,callbackArgs:arguments,err:f,duration:C,time:u.startDate}),g.apply(this,arguments)}});var o=["_enqueueCallback"],h=Z4(St8.dirname(t)+"/lib/Pool");return o.forEach(function(u){return a(h,"Pool")(u)}),e};nO1.mysql={versionSpecifier:">= 2.0.0 < 3.0.0",patch:nTa};function oTa(){zV0.channel.registerMonkeyPatch("mysql",nO1.mysql)}nO1.enable=oTa});var Tt8=M1(oO1=>{"use strict";Object.defineProperty(oO1,"__esModule",{value:!0});oO1.enable=oO1.postgresPool1=void 0;var kt8=kq();function lTa(e){var t=e.prototype.connect;return e.prototype.connect=function(a){return a&&(arguments[0]=kt8.channel.bindToContext(a)),t.apply(this,arguments)},e}oO1.postgresPool1={versionSpecifier:">= 1.0.0 < 3.0.0",patch:lTa};function cTa(){kt8.channel.registerMonkeyPatch("pg-pool",oO1.postgresPool1)}oO1.enable=cTa});var Vt8=M1(Un1=>{"use strict";Object.defineProperty(Un1,"__esModule",{value:!0});Un1.enable=Un1.postgres=Un1.postgres6=void 0;var c82=kq(),Bt8=Z4("events"),Uvt="postgres";function sTa(e,t){var r=e.Client.prototype.query,a="__diagnosticOriginalFunc";return e.Client.prototype.query=function(n,o,h){var u={query:{},database:{host:this.connectionParameters.host,port:this.connectionParameters.port},result:null,error:null,duration:0,time:new Date},g=process.hrtime(),f;function v(C){C&&C[a]&&(C=C[a]);var L=c82.channel.bindToContext(function(y,z){var S=process.hrtime(g);if(u.result=z&&{rowCount:z.rowCount,command:z.command},u.error=y,u.duration=Math.ceil(S[0]*1e3+S[1]/1e6),c82.channel.publish(Uvt,u),y){if(C)return C.apply(this,arguments);f&&f instanceof Bt8.EventEmitter&&f.emit("error",y)}else C&&C.apply(this,arguments)});try{return Object.defineProperty(L,a,{value:C}),L}catch{return C}}try{typeof n=="string"?o instanceof Array?(u.query.preparable={text:n,args:o},h=v(h)):(u.query.text=n,h?h=v(h):o=v(o)):(typeof n.name=="string"?u.query.plan=n.name:n.values instanceof Array?u.query.preparable={text:n.text,args:n.values}:u.query.text=n.text,h?h=v(h):o?o=v(o):n.callback=v(n.callback))}catch{return r.apply(this,arguments)}return arguments[0]=n,arguments[1]=o,arguments[2]=h,arguments.length=arguments.length>3?arguments.length:3,f=r.apply(this,arguments),f},e}function hTa(e,t){var r=e.Client.prototype.query,a="__diagnosticOriginalFunc";return e.Client.prototype.query=function(n,o,h){var u=this,g,f,v=!!h,C={query:{},database:{host:this.connectionParameters.host,port:this.connectionParameters.port},result:null,error:null,duration:0,time:new Date},L,y=process.hrtime();function z(R){R&&R[a]&&(R=R[a]);var F=c82.channel.bindToContext(function(N,j){var Y=process.hrtime(y);if(C.result=j&&{rowCount:j.rowCount,command:j.command},C.error=N,C.duration=Math.ceil(Y[0]*1e3+Y[1]/1e6),c82.channel.publish(Uvt,C),N){if(R)return R.apply(this,arguments);L&&L instanceof Bt8.EventEmitter&&L.emit("error",N)}else R&&R.apply(this,arguments)});try{return Object.defineProperty(F,a,{value:R}),F}catch{return R}}try{typeof n=="string"?o instanceof Array?(C.query.preparable={text:n,args:o},v=typeof h=="function",h=v?z(h):h):(C.query.text=n,h?(v=typeof h=="function",h=v?z(h):h):(v=typeof o=="function",o=v?z(o):o)):(typeof n.name=="string"?C.query.plan=n.name:n.values instanceof Array?C.query.preparable={text:n.text,args:n.values}:n.cursor?C.query.text=(g=n.cursor)===null||g===void 0?void 0:g.text:C.query.text=n.text,h?(v=typeof h=="function",h=z(h)):o?(v=typeof o=="function",o=v?z(o):o):(v=typeof n.callback=="function",n.callback=v?z(n.callback):n.callback))}catch{return r.apply(this,arguments)}arguments[0]=n,arguments[1]=o,arguments[2]=h,arguments.length=arguments.length>3?arguments.length:3;try{L=r.apply(this,arguments)}catch(R){throw z()(R,void 0),R}if(!v){if(L instanceof Promise)return L.then(function(R){return z()(void 0,R),new u._Promise(function(F,N){F(R)})}).catch(function(R){return z()(R,void 0),new u._Promise(function(F,N){N(R)})});var S=L.text?L.text:"";if(L.cursor&&(S=(f=L.cursor)===null||f===void 0?void 0:f.text),S){var B={command:S,rowCount:0};z()(void 0,B)}}return L},e}Un1.postgres6={versionSpecifier:"6.*",patch:sTa};Un1.postgres={versionSpecifier:">=7.* <=8.*",patch:hTa,publisherName:Uvt};function dTa(){c82.channel.registerMonkeyPatch("pg",Un1.postgres6),c82.channel.registerMonkeyPatch("pg",Un1.postgres)}Un1.enable=dTa});var Pt8=M1(lO1=>{"use strict";Object.defineProperty(lO1,"__esModule",{value:!0});lO1.enable=lO1.redis=void 0;var Gvt=kq(),uTa=function(e){var t=e.RedisClient.prototype.internal_send_command;return e.RedisClient.prototype.internal_send_command=function(r){if(r){var a=r.callback;if(!a||!a.pubsubBound){var i=this.address,n=process.hrtime(),o=new Date;r.callback=Gvt.channel.bindToContext(function(h,u){var g=process.hrtime(n),f=g[0]*1e3+g[1]/1e6|0;Gvt.channel.publish("redis",{duration:f,address:i,commandObj:r,err:h,result:u,time:o}),typeof a=="function"&&a.apply(this,arguments)}),r.callback.pubsubBound=!0}}return t.call(this,r)},e};lO1.redis={versionSpecifier:">= 2.0.0 < 4.0.0",patch:uTa};function gTa(){Gvt.channel.registerMonkeyPatch("redis",lO1.redis)}lO1.enable=gTa});var _t8=M1(Ug1=>{"use strict";var bV0=Ug1&&Ug1.__assign||function(){return bV0=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},bV0.apply(this,arguments)};Object.defineProperty(Ug1,"__esModule",{value:!0});Ug1.enable=Ug1.tedious=void 0;var jvt=kq(),pTa=function(e){var t=e.Connection.prototype.makeRequest;return e.Connection.prototype.makeRequest=function(){function a(n){var o=process.hrtime(),h={query:{},database:{host:null,port:null},result:null,error:null,duration:0};return jvt.channel.bindToContext(function(u,g,f){var v=process.hrtime(o);h=bV0(bV0({},h),{database:{host:this.connection.config.server,port:this.connection.config.options.port},result:!u&&{rowCount:g,rows:f},query:{text:this.parametersByName.statement.value},error:u,duration:Math.ceil(v[0]*1e3+v[1]/1e6)}),jvt.channel.publish("tedious",h),n.call(this,u,g,f)})}var i=arguments[0];arguments[0].callback=a(i.callback),t.apply(this,arguments)},e};Ug1.tedious={versionSpecifier:">= 6.0.0 < 9.0.0",patch:pTa};function fTa(){jvt.channel.registerMonkeyPatch("tedious",Ug1.tedious)}Ug1.enable=fTa});var Et8=M1(Tq=>{"use strict";var vTa=Tq&&Tq.__extends||(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,i){a.__proto__=i}||function(a,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(a[n]=i[n])},e(t,r)};return function(t,r){e(t,r);function a(){this.constructor=t}t.prototype=r===null?Object.create(r):(a.prototype=r.prototype,new a)}})(),mTa=Tq&&Tq.__rest||function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,a=Object.getOwnPropertySymbols(e);i<a.length;i++)t.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(r[a[i]]=e[a[i]]);return r};Object.defineProperty(Tq,"__esModule",{value:!0});Tq.enable=Tq.winston2=Tq.winston3=void 0;var SV0=kq(),CTa=function(e){var t=e.Logger.prototype.log,r,a=function(i,n,o){var h;return r===e.config.npm.levels?h="npm":r===e.config.syslog.levels?h="syslog":h="unknown",SV0.channel.publish("winston",{level:i,message:n,meta:o,levelKind:h}),n};return e.Logger.prototype.log=function(){return r=this.levels,!this.filters||this.filters.length===0?this.filters=[a]:this.filters[this.filters.length-1]!==a&&(this.filters=this.filters.filter(function(n){return n!==a}),this.filters.push(a)),t.apply(this,arguments)},e},MTa=function(e){var t=function(h,u){var g;return h.config.npm.levels[u]!=null?g="npm":h.config.syslog.levels[u]!=null?g="syslog":g="unknown",g},r=(function(h){vTa(u,h);function u(g,f){var v=h.call(this,f)||this;return v.winston=g,v}return u.prototype.log=function(g,f){var v=g.message,C=g.level,L=g.meta,y=mTa(g,["message","level","meta"]);C=typeof Symbol.for=="function"?g[Symbol.for("level")]:C,v=g instanceof Error?g:v;var z=t(this.winston,C);L=L||{};for(var S in y)y.hasOwnProperty(S)&&(L[S]=y[S]);SV0.channel.publish("winston",{message:v,level:C,levelKind:z,meta:L}),f()},u})(e.Transport);function a(h){var u;if(h?.level)return h.level;var g=(u=h?.levels)!==null&&u!==void 0?u:e.config.npm.levels,f;for(var v in g)g.hasOwnProperty(v)&&(f=f===void 0||g[v]>g[f]?v:f);return f}function i(h){this.add(new r(e,{level:a(h)}))}var n=e.createLogger;e.createLogger=function(u){var g=n.call(this,u);g.add(new r(e,{level:a(u)}));var f=g.configure;return g.configure=function(){f.apply(this,arguments),i.apply(this,arguments)},g};var o=e.configure;return e.configure=function(){o.apply(this,arguments),i.apply(this,arguments)},e.add(new r(e)),e};Tq.winston3={versionSpecifier:"3.x",patch:MTa};Tq.winston2={versionSpecifier:"2.x",patch:CTa};function xTa(){SV0.channel.registerMonkeyPatch("winston",Tq.winston2),SV0.channel.registerMonkeyPatch("winston",Tq.winston3)}Tq.enable=xTa});var qt8=M1(jw=>{"use strict";Object.defineProperty(jw,"__esModule",{value:!0});jw.enable=jw.tedious=jw.pgPool=jw.pg=jw.winston=jw.redis=jw.mysql=jw.mongodb=jw.mongodbCore=jw.console=jw.bunyan=jw.azuresdk=void 0;var Rt8=xt8();jw.azuresdk=Rt8;var Zt8=wt8();jw.bunyan=Zt8;var Ft8=At8();jw.console=Ft8;var Ot8=zt8();jw.mongodbCore=Ot8;var Dt8=bt8();jw.mongodb=Dt8;var It8=Ht8();jw.mysql=It8;var Nt8=Tt8();jw.pgPool=Nt8;var Ut8=Vt8();jw.pg=Ut8;var Gt8=Pt8();jw.redis=Gt8;var jt8=_t8();jw.tedious=jt8;var Wt8=Et8();jw.winston=Wt8;function LTa(){Zt8.enable(),Ft8.enable(),Ot8.enable(),Dt8.enable(),It8.enable(),Ut8.enable(),Nt8.enable(),Gt8.enable(),Wt8.enable(),Rt8.enable(),jt8.enable()}jw.enable=LTa});var Kt8=M1(HV0=>{"use strict";Object.defineProperty(HV0,"__esModule",{value:!0});HV0.enablePublishers=void 0;var wTa=E8(),yTa="DiagnosticChannel",$t8=!1;function ATa(){if(!$t8){$t8=!0;let t={console:qt8().console};for(let r in t)t[r].enable(),wTa.diag.info(yTa,`Subscribed to ${r} events`)}}HV0.enablePublishers=ATa});var bT2=M1(s82=>{"use strict";Object.defineProperty(s82,"__esModule",{value:!0});s82.dispose=s82.enable=void 0;var zT2=TZ(),Wvt=kq(),Yt8,Xt8,Jt8=e=>{let t=e.data.message.indexOf("Error:")>-1?zT2.SeverityNumber.ERROR:e.data.stderr?zT2.SeverityNumber.WARN:zT2.SeverityNumber.INFO;if(Xt8<=t){let r=e.data.message.toString();r.lastIndexOf(`
|
|
12294
|
-
`)===r.length-1&&(r=r.substring(0,r.length-1));let a={body:r,severityNumber:t};Yt8.emit(a)}};function zTa(e){e?.enabled&&(Yt8=zT2.logs.getLogger("ApplicationInsightsConsoleLogger"),Xt8=e.logSendingLevel||zT2.SeverityNumber.UNSPECIFIED,Wvt.channel.subscribe("console",Jt8,Wvt.trueFilter))}s82.enable=zTa;function bTa(){Wvt.channel.unsubscribe("console",Jt8)}s82.dispose=bTa});var Qt8=M1(kV0=>{"use strict";Object.defineProperty(kV0,"__esModule",{value:!0});kV0.AutoCollectLogs=void 0;var STa=Kt8();(0,STa.enablePublishers)();var qvt=class{enable(t){try{bT2().enable(t.console)}catch{bT2().enable(t.console)}}shutdown(){try{bT2().dispose()}catch{bT2().dispose()}}};kV0.AutoCollectLogs=qvt});var r38=M1(Gn1=>{"use strict";var HTa=Gn1&&Gn1.__createBinding||(Object.create?(function(e,t,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,a,i)}):(function(e,t,r,a){a===void 0&&(a=r),e[a]=t[r]})),kTa=Gn1&&Gn1.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),e38=Gn1&&Gn1.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&HTa(t,e,r);return kTa(t,e),t};Object.defineProperty(Gn1,"__esModule",{value:!0});Gn1.JsonConfig=void 0;var TTa=e38(Z4("fs")),TV0=e38(Z4("path")),t38=E8(),BTa="APPLICATIONINSIGHTS_CONFIGURATION_FILE",VTa="APPLICATIONINSIGHTS_CONFIGURATION_CONTENT",$vt=class e{constructor(){this._loadJsonFile()}static getInstance(){return e._instance||(e._instance=new e),e._instance}_loadJsonFile(){let t="",r=process.env[VTa];if(r)t=r;else{let a="applicationinsights.json",i=TV0.join(__dirname,"../../../"),n=TV0.join(i,a),o=process.env[BTa];o&&(TV0.isAbsolute(o)?n=o:n=TV0.join(i,o));try{t=TTa.readFileSync(n,"utf8")}catch(h){t38.diag.info("Failed to read JSON config file: ",h)}}try{let a=JSON.parse(t);this.enableAutoCollectExceptions=a.enableAutoCollectExceptions,this.otlpLogExporterConfig=a.otlpLogExporterConfig,this.otlpMetricExporterConfig=a.otlpMetricExporterConfig,this.otlpTraceExporterConfig=a.otlpTraceExporterConfig,this.enableAutoCollectPerformance=a.enableAutoCollectPerformance,this.azureMonitorExporterOptions=a.azureMonitorExporterOptions,this.samplingRatio=a.samplingRatio,this.instrumentationOptions=a.instrumentationOptions}catch(a){t38.diag.info("Missing or invalid JSON config file: ",a)}}};Gn1.JsonConfig=$vt});var a38=M1(VV0=>{"use strict";Object.defineProperty(VV0,"__esModule",{value:!0});VV0.logLevelParser=void 0;var BV0=TZ();function PTa(e){switch(e){case"ERROR":return BV0.SeverityNumber.ERROR;case"WARN":return BV0.SeverityNumber.WARN;case"INFO":return BV0.SeverityNumber.INFO;default:return BV0.SeverityNumber.UNSPECIFIED}}VV0.logLevelParser=PTa});var n38=M1(PV0=>{"use strict";Object.defineProperty(PV0,"__esModule",{value:!0});PV0.ApplicationInsightsConfig=void 0;var _Ta=E8(),ETa=J61(),RTa=r38(),ZTa=a38(),i38="APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL",Kvt=class{constructor(t){this.otlpLogExporterConfig={},this.otlpMetricExporterConfig={},this.otlpTraceExporterConfig={},this.enableAutoCollectPerformance=!0,this.enableAutoCollectExceptions=!0,this.azureMonitorExporterOptions={},this.samplingRatio=1,this.instrumentationOptions={http:{enabled:!0},azureSdk:{enabled:!1},mongoDb:{enabled:!1},mySql:{enabled:!1},postgreSql:{enabled:!1},redis:{enabled:!1},redis4:{enabled:!1},console:{enabled:!1},bunyan:{enabled:!1},winston:{enabled:!1}},this._resource=this._getDefaultResource(),t&&(typeof t.enableAutoCollectExceptions=="boolean"&&(this.enableAutoCollectExceptions=t.enableAutoCollectExceptions),typeof t.enableAutoCollectPerformance=="boolean"&&(this.enableAutoCollectPerformance=t.enableAutoCollectPerformance),this.otlpTraceExporterConfig=Object.assign(this.otlpTraceExporterConfig,t.otlpTraceExporterConfig),this.otlpMetricExporterConfig=Object.assign(this.otlpMetricExporterConfig,t.otlpMetricExporterConfig),this.otlpLogExporterConfig=Object.assign(this.otlpLogExporterConfig,t.otlpLogExporterConfig),this.azureMonitorExporterOptions=Object.assign(this.azureMonitorExporterOptions,t.azureMonitorExporterOptions),this.instrumentationOptions=Object.assign(this.instrumentationOptions,t.instrumentationOptions),this.resource=Object.assign(this.resource,t.resource),this.samplingRatio=t.samplingRatio!==void 0?t.samplingRatio:this.samplingRatio,process.env[i38]&&(this.instrumentationOptions=Object.assign(Object.assign({},this.instrumentationOptions),{console:Object.assign(Object.assign({},this.instrumentationOptions.console),{logSendingLevel:(0,ZTa.logLevelParser)(process.env[i38])})})),this._mergeConfig())}set resource(t){this._resource=this._resource.merge(t)}get resource(){return this._resource}_mergeConfig(){try{let t=RTa.JsonConfig.getInstance();this.enableAutoCollectPerformance=t.enableAutoCollectPerformance!==void 0?t.enableAutoCollectPerformance:this.enableAutoCollectPerformance,this.enableAutoCollectExceptions=t.enableAutoCollectExceptions!==void 0?t.enableAutoCollectExceptions:this.enableAutoCollectExceptions,this.otlpTraceExporterConfig=Object.assign(this.otlpTraceExporterConfig,t.otlpTraceExporterConfig),this.otlpMetricExporterConfig=Object.assign(this.otlpMetricExporterConfig,t.otlpMetricExporterConfig),this.otlpLogExporterConfig=Object.assign(this.otlpLogExporterConfig,t.otlpLogExporterConfig),this.samplingRatio=t.samplingRatio!==void 0?t.samplingRatio:this.samplingRatio,this.azureMonitorExporterOptions=Object.assign(this.azureMonitorExporterOptions,t.azureMonitorExporterOptions),this.instrumentationOptions=Object.assign(this.instrumentationOptions,t.instrumentationOptions)}catch(t){_Ta.diag.error("Failed to load JSON config file values.",t)}}_getDefaultResource(){return(0,ETa.defaultResource)()}};PV0.ApplicationInsightsConfig=Kvt});var o38=M1(iz1=>{"use strict";Object.defineProperty(iz1,"__esModule",{value:!0});iz1.AZURE_MONITOR_STATSBEAT_FEATURES=iz1.DEFAULT_ROLE_NAME=iz1.APPLICATION_INSIGHTS_OPENTELEMETRY_VERSION=void 0;iz1.APPLICATION_INSIGHTS_OPENTELEMETRY_VERSION="3.14.0";iz1.DEFAULT_ROLE_NAME="Web";iz1.AZURE_MONITOR_STATSBEAT_FEATURES="AZURE_MONITOR_STATSBEAT_FEATURES"});var Jvt=M1(_V0=>{"use strict";Object.defineProperty(_V0,"__esModule",{value:!0});_V0.StatsbeatFeaturesManager=void 0;var Yvt=o38(),h82=w32(),Xvt=class e{static getInstance(){return e.instance||(e.instance=new e),e.instance}getCurrentConfig(){let t=process.env[Yvt.AZURE_MONITOR_STATSBEAT_FEATURES];if(t)try{return JSON.parse(t)}catch{return{instrumentation:h82.StatsbeatInstrumentation.NONE,feature:h82.StatsbeatFeature.SHIM}}return{instrumentation:h82.StatsbeatInstrumentation.NONE,feature:h82.StatsbeatFeature.SHIM}}setConfig(t){process.env[Yvt.AZURE_MONITOR_STATSBEAT_FEATURES]=JSON.stringify(t)}enableFeature(t){let r=this.getCurrentConfig();r.feature|=t,this.setConfig(r)}disableFeature(t){let r=this.getCurrentConfig();r.feature&=~t,this.setConfig(r)}isFeatureEnabled(t){return(this.getCurrentConfig().feature&t)!==0}enableInstrumentation(t){let r=this.getCurrentConfig();r.instrumentation|=t,this.setConfig(r)}disableInstrumentation(t){let r=this.getCurrentConfig();r.instrumentation&=~t,this.setConfig(r)}isInstrumentationEnabled(t){return(this.getCurrentConfig().instrumentation&t)!==0}initialize(){process.env[Yvt.AZURE_MONITOR_STATSBEAT_FEATURES]||this.setConfig({instrumentation:h82.StatsbeatInstrumentation.NONE,feature:h82.StatsbeatFeature.SHIM})}};_V0.StatsbeatFeaturesManager=Xvt});var emt=M1(nz1=>{"use strict";Object.defineProperty(nz1,"__esModule",{value:!0});nz1.flushAzureMonitor=nz1.shutdownAzureMonitor=nz1.useAzureMonitor=void 0;var c38=L08(),Qvt=E8(),s38=TZ(),FTa=N32(),OTa=PS2(),DTa=gb0(),ITa=KH0(),NTa=Qt8(),UTa=jat(),GTa=n38(),jTa=qat(),WTa=w32(),l38=Jvt(),tmt,EV0;function qTa(e){l38.StatsbeatFeaturesManager.getInstance().initialize(),l38.StatsbeatFeaturesManager.getInstance().enableFeature(WTa.StatsbeatFeature.SHIM);let t=new GTa.ApplicationInsightsConfig(e),r=YTa(t),a=XTa(t);e||(e={}),r&&(e.spanProcessors||(e.spanProcessors=[]),e.spanProcessors.push(r)),a&&(e.logRecordProcessors||(e.logRecordProcessors=[]),e.logRecordProcessors.push(a)),(0,c38.useAzureMonitor)(e);let i=new jTa.LogApi(s38.logs.getLogger("ApplicationInsightsLogger"));tmt=new NTa.AutoCollectLogs,t.enableAutoCollectExceptions&&(EV0=new UTa.AutoCollectExceptions(i)),tmt.enable(t.instrumentationOptions)}nz1.useAzureMonitor=qTa;async function $Ta(){await(0,c38.shutdownAzureMonitor)(),tmt.shutdown(),EV0?.shutdown()}nz1.shutdownAzureMonitor=$Ta;async function KTa(){try{await Qvt.metrics.getMeterProvider().forceFlush(),await Qvt.trace.getTracerProvider().getDelegate().forceFlush(),await s38.logs.getLoggerProvider().forceFlush()}catch(e){Qvt.diag.error("Failed to flush telemetry",e)}}nz1.flushAzureMonitor=KTa;function YTa(e){var t;if(!((t=e.otlpTraceExporterConfig)===null||t===void 0)&&t.enabled){let r=new ITa.OTLPTraceExporter(e.otlpTraceExporterConfig);return new OTa.BatchSpanProcessor(r)}}function XTa(e){var t;if(!((t=e.otlpLogExporterConfig)===null||t===void 0)&&t.enabled){let r=new DTa.OTLPLogExporter(e.otlpLogExporterConfig);return new FTa.BatchLogRecordProcessor(r)}}});var h38=M1(ZV0=>{"use strict";Object.defineProperty(ZV0,"__esModule",{value:!0});ZV0.TelemetryClientProvider=void 0;var cO1=E8(),rmt=WF1(),JTa=gb0(),QTa=YH2(),tBa=KH0(),amt=N32(),imt=gB(),RV0=fU(),eBa=PS2(),rBa=J61(),nmt=class{constructor(t){var r;this._options=t,this._metricReaders=[],this._spanProcessors=[],this._logProcessors=[];let a=(r=this._options.resource)!==null&&r!==void 0?r:(0,rBa.defaultResource)();this._spanProcessors=this._setupTracing(),this._logProcessors=this._setupLogging(),this._metricReaders=this._setupMetrics(),this._tracerProvider=new eBa.NodeTracerProvider({resource:a,sampler:this._createSampler(),spanProcessors:this._spanProcessors}),this._meterProvider=new imt.MeterProvider({resource:a,readers:this._metricReaders}),this._loggerProvider=new amt.LoggerProvider({resource:a,processors:this._logProcessors})}getTracer(t){return this._tracerProvider.getTracer(t)}getMeter(t){return this._meterProvider.getMeter(t)}getLogger(t){return this._loggerProvider.getLogger(t)}async flush(){await Promise.all([this._runWithErrorHandling(this._meterProvider.forceFlush(),"Failed to flush metrics"),this._runWithErrorHandling(this._tracerProvider.forceFlush(),"Failed to flush traces"),this._runWithErrorHandling(this._loggerProvider.forceFlush(),"Failed to flush logs")])}async shutdown(){await Promise.all([...this._metricReaders.map(t=>this._runWithErrorHandling(t.shutdown(),"Failed to shutdown metric reader")),...this._spanProcessors.map(t=>this._runWithErrorHandling(t.shutdown(),"Failed to shutdown span processor")),...this._logProcessors.map(t=>this._runWithErrorHandling(t.shutdown(),"Failed to shutdown log processor")),this._runWithErrorHandling(this._meterProvider.shutdown(),"Failed to shutdown meter provider"),this._runWithErrorHandling(this._tracerProvider.shutdown(),"Failed to shutdown tracer provider"),this._runWithErrorHandling(this._loggerProvider.shutdown(),"Failed to shutdown logger provider")])}_createSampler(){var t;if(((t=this._options)===null||t===void 0?void 0:t.samplingRatio)!==void 0)return new RV0.ParentBasedSampler({root:new RV0.TraceIdRatioBasedSampler(this._options.samplingRatio)})}_setupTracing(){var t;let r=[];try{let a=new rmt.AzureMonitorTraceExporter(this._options.azureMonitorExporterOptions);r.push(new RV0.BatchSpanProcessor(a))}catch(a){cO1.diag.error("Failed to configure Azure Monitor trace exporter",a)}if(!((t=this._options.otlpTraceExporterConfig)===null||t===void 0)&&t.enabled)try{let a=new tBa.OTLPTraceExporter(this._options.otlpTraceExporterConfig);r.push(new RV0.BatchSpanProcessor(a))}catch(a){cO1.diag.error("Failed to configure OTLP trace exporter",a)}if(this._options.spanProcessors)for(let a of this._options.spanProcessors)r.push(a);return r}_setupLogging(){var t;let r=[];try{let a=new rmt.AzureMonitorLogExporter(this._options.azureMonitorExporterOptions);r.push(new amt.BatchLogRecordProcessor(a))}catch(a){cO1.diag.error("Failed to configure Azure Monitor log exporter",a)}if(!((t=this._options.otlpLogExporterConfig)===null||t===void 0)&&t.enabled)try{let a=new JTa.OTLPLogExporter(this._options.otlpLogExporterConfig);r.push(new amt.BatchLogRecordProcessor(a))}catch(a){cO1.diag.error("Failed to configure OTLP log exporter",a)}if(this._options.logRecordProcessors)for(let a of this._options.logRecordProcessors)r.push(a);return r}_setupMetrics(){var t;let r=[];try{let a=new rmt.AzureMonitorMetricExporter(this._options.azureMonitorExporterOptions);r.push(new imt.PeriodicExportingMetricReader({exporter:a}))}catch(a){cO1.diag.error("Failed to configure Azure Monitor metric exporter",a)}if(!((t=this._options.otlpMetricExporterConfig)===null||t===void 0)&&t.enabled)try{let a=new QTa.OTLPMetricExporter(this._options.otlpMetricExporterConfig);r.push(new imt.PeriodicExportingMetricReader({exporter:a}))}catch(a){cO1.diag.error("Failed to configure OTLP metric exporter",a)}return r}async _runWithErrorHandling(t,r){try{await t}catch(a){cO1.diag.error(r,a)}}};ZV0.TelemetryClientProvider=nmt});var lmt=M1(DV0=>{"use strict";Object.defineProperty(DV0,"__esModule",{value:!0});DV0.TelemetryClient=void 0;var jk=E8(),aBa=TZ(),z81=Wx(),iBa=jk6(),nBa=L32(),oBa=aT6(),lBa=iT6(),cBa=nT6(),sBa=qat(),omt=emt(),hBa=h38(),FV0=w32(),dBa=Jvt(),OV0=class e{constructor(t,r){var a;this._configWarnings=[],e._instanceCount++,e._instanceCount>=2&&dBa.StatsbeatFeaturesManager.getInstance().enableFeature(FV0.StatsbeatFeature.MULTI_IKEY);let i=new oBa(t,this._configWarnings);this.config=i,this.commonProperties={},this.context=new iBa.Context,this._isInitialized=!1,this._useGlobalProviders=(a=r?.useGlobalProviders)!==null&&a!==void 0?a:!0}initialize(){if(!this._isInitialized){this._isInitialized=!0,this._options=this.config.parseConfig();try{this._attributeSpanProcessor=new lBa.AttributeSpanProcessor(Object.assign(Object.assign({},this.context.tags),this.commonProperties)),this._attributeLogProcessor=new cBa.AttributeLogProcessor(Object.assign(Object.assign({},this.context.tags),this.commonProperties)),this._options.spanProcessors=[...this._options.spanProcessors||[],this._attributeSpanProcessor],this._options.logRecordProcessors=[...this._options.logRecordProcessors||[],this._attributeLogProcessor],this._useGlobalProviders?(0,omt.useAzureMonitor)(this._options):this._telemetryClientProvider=new hBa.TelemetryClientProvider(this._options);let t=this._useGlobalProviders?aBa.logs.getLogger("ApplicationInsightsLogger"):this._telemetryClientProvider.getLogger("ApplicationInsightsLogger");this._logApi=new sBa.LogApi(t);for(let r=0;r<this._configWarnings.length;r++)jk.diag.warn(this._configWarnings[r])}catch(t){jk.diag.error(`Failed to initialize TelemetryClient ${t}`)}}}trackAvailability(t){this._isInitialized||this.initialize(),this._logApi.trackAvailability(t)}trackPageView(t){this._isInitialized||this.initialize(),this._logApi.trackPageView(t)}trackTrace(t){this._isInitialized||this.initialize(),this._logApi.trackTrace(t)}trackException(t){this._isInitialized||this.initialize(),this._logApi.trackException(t)}trackEvent(t){this._isInitialized||this.initialize(),this._logApi.trackEvent(t)}trackMetric(t){this._isInitialized||this.initialize();try{this._getMeterInstance().createHistogram(t.name).record(t.value,Object.assign(Object.assign(Object.assign({},t.properties),this.commonProperties),this.context.tags))}catch(r){jk.diag.error(`Failed to record metric: ${r}`)}}_getTracerInstance(){return this._telemetryClientProvider?(this._manualTracer||(this._manualTracer=this._telemetryClientProvider.getTracer("ApplicationInsightsTracer")),this._manualTracer):jk.trace.getTracer("ApplicationInsightsTracer")}_getMeterInstance(){return this._telemetryClientProvider?(this._manualMeter||(this._manualMeter=this._telemetryClientProvider.getMeter("ApplicationInsightsMetrics")),this._manualMeter):jk.metrics.getMeterProvider().getMeter("ApplicationInsightsMetrics")}trackRequest(t){this._isInitialized||this.initialize();let r=t.time?t.time.getTime()+t.duration:Date.now(),a=t.time||new Date(r-t.duration),i=jk.context.active(),n=Object.assign({},t.properties);t.name||(n[z81.SEMATTRS_HTTP_METHOD]="HTTP"),t.url&&(n[z81.SEMATTRS_HTTP_URL]=t.url),t.resultCode&&(n[z81.SEMATTRS_HTTP_STATUS_CODE]=t.resultCode);let o={kind:jk.SpanKind.SERVER,attributes:n,startTime:a},h=this._getTracerInstance().startSpan(t.name,o,i);if(t.id)try{h._spanContext&&(h._spanContext.traceId=t.id)}catch(u){jk.diag.warn("Unable to set custom traceId on span:",u)}h.setStatus({code:t.success?jk.SpanStatusCode.OK:jk.SpanStatusCode.ERROR}),h.end(r)}trackDependency(t){this._isInitialized||this.initialize();let r=t.time?t.time.getTime()+t.duration:Date.now(),a=t.time||new Date(r-t.duration);if(t&&!t.target&&t.data)try{t.target=new URL(t.data).host}catch(u){t.target=null,jk.diag.warn(this.constructor.name,"Failed to create URL.",u)}let i=jk.context.active(),n=Object.assign({},t.properties);t.dependencyTypeName&&(t.dependencyTypeName.toLowerCase().indexOf("http")>-1?(t.data&&(n[z81.SEMATTRS_HTTP_URL]=t.data),t.resultCode&&(n[z81.SEMATTRS_HTTP_STATUS_CODE]=t.resultCode)):nBa.Util.getInstance().isDbDependency(t.dependencyTypeName)?(n[z81.SEMATTRS_DB_SYSTEM]=t.dependencyTypeName,n[z81.SEMATTRS_DB_STATEMENT]=t.data):t.dependencyTypeName.toLowerCase().indexOf("rpc")>-1&&(n[z81.SEMATTRS_RPC_SYSTEM]=t.dependencyTypeName,n[z81.SEMATTRS_RPC_METHOD]=t.data,n[z81.SEMATTRS_RPC_GRPC_STATUS_CODE]=t.resultCode)),t.target&&(n[z81.SEMATTRS_PEER_SERVICE]=t.target);let o={kind:jk.SpanKind.CLIENT,attributes:n,startTime:a},h=this._getTracerInstance().startSpan(t.name,o,i);if(t.id)try{h._spanContext&&(h._spanContext.traceId=t.id)}catch(u){jk.diag.warn("Unable to set custom traceId on span:",u)}h.setStatus({code:t.success?jk.SpanStatusCode.OK:jk.SpanStatusCode.ERROR}),h.end(r)}track(t,r){throw new Error(`Not implemented. Please use the specific track method for the type of telemetry you are tracking. ${FV0.UNSUPPORTED_MSG}`)}setAutoPopulateAzureProperties(){}getAuthorizationHandler(t){jk.diag.warn(`getAuthorizationHandler is not supported in ApplicationInsights any longer. ${FV0.UNSUPPORTED_MSG}`)}getStatsbeat(){return null}setUseDiskRetryCaching(t,r,a){throw new Error("Not implemented")}addTelemetryProcessor(t){jk.diag.warn(`addTelemetryProcessor is not supported in ApplicationInsights any longer. ${FV0.UNSUPPORTED_MSG}`)}clearTelemetryProcessors(){throw new Error("Not implemented")}trackNodeHttpRequestSync(t){jk.diag.warn("trackNodeHttpRequestSync is not implemented and is a no-op. Please use trackRequest instead.")}trackNodeHttpRequest(t){jk.diag.warn("trackNodeHttpRequest is not implemented and is a no-op. Please use trackRequest instead.")}trackNodeHttpDependency(t){jk.diag.warn("trackNodeHttpDependency is not implemented and is a no-op. Please use trackDependency instead.")}async flush(){return this._telemetryClientProvider?this._telemetryClientProvider.flush():(0,omt.flushAzureMonitor)()}async shutdown(){return this._telemetryClientProvider?this._telemetryClientProvider.shutdown():(0,omt.shutdownAzureMonitor)()}pushWarningToLog(t){this._configWarnings.push(t)}};DV0.TelemetryClient=OV0;OV0._instanceCount=0});var g38=M1(UV0=>{"use strict";Object.defineProperty(UV0,"__esModule",{value:!0});UV0.CorrelationContextManager=void 0;var Ww=E8(),d38=U9(),IV0=L32(),u38="ApplicationInsights-Context",NV0=class{static spanToContextObject(t,r,a,i){var n;let o={legacyRootId:"",traceId:t?.traceId,spanId:t?.spanId,traceFlag:(n=t?.traceFlags)===null||n===void 0?void 0:n.toString(),parentId:r,version:"00"};return this.generateContextObject(o.traceId,o.parentId,a,o,i)}static getCurrentContext(){var t,r;if(!this._isDisabled){let a=Ww.trace.getSpan(Ww.context.active());a||(a=Ww.trace.getTracer(u38).startSpan(u38));let i=new d38.TraceState((r=(t=a?.spanContext())===null||t===void 0?void 0:t.traceState)===null||r===void 0?void 0:r.serialize()),n=this._getParentSpanId(a);return this.spanToContextObject(a?.spanContext(),n,a?.name,i)}return null}static _getParentSpanId(t){var r,a;if(!t)return;let i=t;return typeof i.parentSpanContext=="function"?(r=i.parentSpanContext())===null||r===void 0?void 0:r.spanId:i.parentSpanId||((a=i.parentSpanContext)===null||a===void 0?void 0:a.spanId)}static generateContextObject(t,r,a,i,n){var o;let h={fieldmap:(o=n?.serialize())===null||o===void 0?void 0:o.split(",")};return{operation:{name:a,id:t,parentId:r,traceparent:i,tracestate:h},customProperties:{getProperty(u){return""},setProperty(u){return""}}}}static runWithContext(t,r){try{let a=Ww.trace.setSpanContext(Ww.context.active(),this._contextObjectToSpanContext(t));return Ww.context.with(a,r)}catch(a){Ww.diag.warn("Error binding to session context",IV0.Util.getInstance().dumpObj(a))}return r()}static wrapEmitter(t){try{Ww.context.bind(Ww.context.active(),t)}catch(r){Ww.diag.warn("Error binding to session context",IV0.Util.getInstance().dumpObj(r))}}static wrapCallback(t,r){try{if(r){let a=Ww.trace.setSpanContext(Ww.context.active(),this._contextObjectToSpanContext(r));return Ww.context.bind(a,t)}return Ww.context.bind(Ww.context.active(),t)}catch(a){return Ww.diag.error("Error binding to session context",IV0.Util.getInstance().dumpObj(a)),t}}static enable(t){Ww.diag.info("Enabling the context manager is no longer necessary and this method is a no-op.")}static startOperation(t,r){let a=t&&t.traceContext||null,i=t&&t.spanContext?t:null,n=t&&t.traceId?t:null,o=t&&t.headers;if(i){Ww.trace.setSpanContext(Ww.context.active(),i.spanContext());let h=this._getParentSpanId(i);return this.spanToContextObject(i.spanContext(),h)}if(n)return Ww.trace.setSpanContext(Ww.context.active(),n),this.spanToContextObject(n);if(a||o){let h=null,u=null;if(a){let v=r;v?.headers&&v?.headers.get?(h=v.headers.get("traceparent")||v.headers.get("request-id"),u=v.headers.get("tracestate")):v?.headers&&(h=v.headers.traceparent?v.headers.traceparent:v.headers["request-id"],u=v.headers.tracestate),!h&&a.traceparent?h=a.traceparent:!h&&a.traceParent&&(h=a.traceParent),!u&&a.tracestate?u=a.tracestate:!u&&a.traceState&&(u=a.traceState)}o&&o.traceparent?(h=o.traceparent?o.traceparent.toString():null,u=o.tracestate?o.tracestate.toString():u):o&&o.get&&(h=o.get("traceparent")||o.get("request-id"),u=o.get("tracestate"));let g=h?.split("-"),f=new d38.TraceState;u?.split(",").forEach(v=>{let C=v.split("=");f.set(C[0],C[1])});try{return this.generateContextObject(g[1],g[2],null,{legacyRootId:"",parentId:"",spanId:g[2],traceFlag:"",traceId:g[1],version:"00"},f)}catch(v){Ww.diag.warn("Error creating context object",IV0.Util.getInstance().dumpObj(v))}}return Ww.diag.warn("startOperation was called with invalid arguments"),null}static disable(){Ww.diag.warn("It will not be possible to re-enable the current context manager after disabling it!"),this._isDisabled=!0,Ww.context.disable()}static reset(){Ww.diag.info("This is a no-op and exists only for compatibility reasons.")}static _contextObjectToSpanContext(t){var r,a,i,n;return{traceId:t.operation.id,spanId:(a=(r=t.operation.traceparent)===null||r===void 0?void 0:r.spanId)!==null&&a!==void 0?a:"",traceFlags:!((i=t.operation.traceparent)===null||i===void 0)&&i.traceFlag?Number((n=t.operation.traceparent)===null||n===void 0?void 0:n.traceFlag):void 0}}};UV0.CorrelationContextManager=NV0;NV0._isDisabled=!1});var f38=M1(p38=>{"use strict";Object.defineProperty(p38,"__esModule",{value:!0})});var m38=M1(v38=>{"use strict";Object.defineProperty(v38,"__esModule",{value:!0})});var M38=M1(C38=>{"use strict";Object.defineProperty(C38,"__esModule",{value:!0})});var L38=M1(x38=>{"use strict";Object.defineProperty(x38,"__esModule",{value:!0})});var y38=M1(w38=>{"use strict";Object.defineProperty(w38,"__esModule",{value:!0})});var z38=M1(A38=>{"use strict";Object.defineProperty(A38,"__esModule",{value:!0})});var S38=M1(b38=>{"use strict";Object.defineProperty(b38,"__esModule",{value:!0})});var k38=M1(H38=>{"use strict";Object.defineProperty(H38,"__esModule",{value:!0})});var B38=M1(T38=>{"use strict";Object.defineProperty(T38,"__esModule",{value:!0})});var P38=M1(V38=>{"use strict";Object.defineProperty(V38,"__esModule",{value:!0})});var E38=M1(_38=>{"use strict";Object.defineProperty(_38,"__esModule",{value:!0})});var R38=M1(ST2=>{"use strict";Object.defineProperty(ST2,"__esModule",{value:!0});ST2.TelemetryType=void 0;var uBa;(function(e){e[e.Event=0]="Event",e[e.Exception=1]="Exception",e[e.Trace=2]="Trace",e[e.Metric=3]="Metric",e[e.Request=4]="Request",e[e.Dependency=5]="Dependency",e[e.Availability=6]="Availability",e[e.PageView=7]="PageView"})(uBa=ST2.TelemetryType||(ST2.TelemetryType={}))});var Z38=M1(yE=>{"use strict";var gBa=yE&&yE.__createBinding||(Object.create?(function(e,t,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,a,i)}):(function(e,t,r,a){a===void 0&&(a=r),e[a]=t[r]})),K01=yE&&yE.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&gBa(t,e,r)};Object.defineProperty(yE,"__esModule",{value:!0});K01(f38(),yE);K01(m38(),yE);K01(M38(),yE);K01(L38(),yE);K01(y38(),yE);K01(z38(),yE);K01(S38(),yE);K01(k38(),yE);K01(B38(),yE);K01(P38(),yE);K01(E38(),yE);K01(R38(),yE)});var F38=M1(sO1=>{"use strict";var pBa=sO1&&sO1.__createBinding||(Object.create?(function(e,t,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,a,i)}):(function(e,t,r,a){a===void 0&&(a=r),e[a]=t[r]})),fBa=sO1&&sO1.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&pBa(t,e,r)};Object.defineProperty(sO1,"__esModule",{value:!0});fBa(Z38(),sO1)});var I38=M1(o9=>{"use strict";var vBa=o9&&o9.__createBinding||(Object.create?(function(e,t,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,a,i)}):(function(e,t,r,a){a===void 0&&(a=r),e[a]=t[r]})),mBa=o9&&o9.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),CBa=o9&&o9.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&vBa(t,e,r);return mBa(t,e),t};Object.defineProperty(o9,"__esModule",{value:!0});o9.dispose=o9.Configuration=o9.wrapWithCorrelationContext=o9.startOperation=o9.getCorrelationContext=o9.start=o9.setup=o9.defaultClient=o9.TelemetryClient=o9.DistributedTracingModes=o9.Contracts=void 0;var GV0=E8(),cmt=g38(),MBa=w32();Object.defineProperty(o9,"DistributedTracingModes",{enumerable:!0,get:function(){return MBa.DistributedTracingModes}});var O38=lmt();Object.defineProperty(o9,"TelemetryClient",{enumerable:!0,get:function(){return O38.TelemetryClient}});var xBa=CBa(F38());o9.Contracts=xBa;var LBa=L32();function wBa(e){return o9.defaultClient?o9.defaultClient.pushWarningToLog("Setup has already been called once. To set up a new client, please use TelemetryClient instead."):o9.defaultClient=new O38.TelemetryClient(e,{useGlobalProviders:!0}),d82}o9.setup=wBa;function D38(){try{return o9.defaultClient?o9.defaultClient.initialize():(GV0.diag.setLogger(new GV0.DiagConsoleLogger),GV0.diag.warn("Start cannot be called before setup. Please call setup() first.")),d82}catch(e){GV0.diag.warn(`Failed to start default client: ${LBa.Util.getInstance().dumpObj(e)}`)}}o9.start=D38;function yBa(){return cmt.CorrelationContextManager.getCurrentContext()}o9.getCorrelationContext=yBa;function ABa(e,t){return cmt.CorrelationContextManager.startOperation(e,t)}o9.startOperation=ABa;function zBa(e,t){return cmt.CorrelationContextManager.wrapCallback(e,t)}o9.wrapWithCorrelationContext=zBa;var d82=class e{static setDistributedTracingMode(t){return o9.defaultClient&&(o9.defaultClient.config.distributedTracingMode=t),e}static setAutoCollectConsole(t,r=!1){return o9.defaultClient&&(o9.defaultClient.config.enableAutoCollectExternalLoggers=t,o9.defaultClient.config.enableAutoCollectConsole=r),e}static setAutoCollectExceptions(t){return o9.defaultClient&&(o9.defaultClient.config.enableAutoCollectExceptions=t),e}static setAutoCollectPerformance(t,r){return o9.defaultClient&&(o9.defaultClient.config.enableAutoCollectPerformance=t,o9.defaultClient.config.enableAutoCollectExtendedMetrics=r),e}static setAutoCollectPreAggregatedMetrics(t){return o9.defaultClient&&(o9.defaultClient.config.enableAutoCollectPreAggregatedMetrics=t),e}static setAutoCollectHeartbeat(t){return o9.defaultClient&&(o9.defaultClient.config.enableAutoCollectHeartbeat=t),e}static enableWebInstrumentation(t,r){return o9.defaultClient&&(o9.defaultClient.config.enableWebInstrumentation=t,o9.defaultClient.config.webInstrumentationConnectionString=r),e}static setAutoCollectRequests(t){return o9.defaultClient&&(o9.defaultClient.config.enableAutoCollectRequests=t),e}static setAutoCollectDependencies(t){return o9.defaultClient&&(o9.defaultClient.config.enableAutoCollectDependencies=t),e}static setAutoDependencyCorrelation(t,r){return o9.defaultClient&&(o9.defaultClient.config.enableAutoDependencyCorrelation=t,o9.defaultClient.config.enableUseAsyncHooks=r),e}static setUseDiskRetryCaching(t,r,a){return o9.defaultClient&&(o9.defaultClient.config.enableUseDiskRetryCaching=t,o9.defaultClient.config.enableResendInterval=r,o9.defaultClient.config.enableMaxBytesOnDisk=a),e}static setInternalLogging(t=!1,r=!0){return o9.defaultClient&&(o9.defaultClient.config.enableInternalDebugLogging=t,o9.defaultClient.config.enableInternalWarningLogging=r),e}static setAutoCollectIncomingRequestAzureFunctions(t){return o9.defaultClient&&(o9.defaultClient.config.enableAutoCollectIncomingRequestAzureFunctions=t),e}static setSendLiveMetrics(t=!1){return o9.defaultClient&&(o9.defaultClient.config.enableSendLiveMetrics=t),e}static setAzureMonitorOptions(t){return o9.defaultClient&&(o9.defaultClient.config.azureMonitorOpenTelemetryOptions=t),e}};o9.Configuration=d82;d82.start=D38;function bBa(){o9.defaultClient&&o9.defaultClient.shutdown(),o9.defaultClient=null}o9.dispose=bBa});var N38=M1(FZ=>{"use strict";var SBa=FZ&&FZ.__createBinding||(Object.create?(function(e,t,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,a,i)}):(function(e,t,r,a){a===void 0&&(a=r),e[a]=t[r]})),HBa=FZ&&FZ.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&SBa(t,e,r)};Object.defineProperty(FZ,"__esModule",{value:!0});FZ.flushAzureMonitor=FZ.shutdownAzureMonitor=FZ.useAzureMonitor=FZ.KnownSeverityLevel=FZ.TelemetryClient=void 0;var kBa=lmt();Object.defineProperty(FZ,"TelemetryClient",{enumerable:!0,get:function(){return kBa.TelemetryClient}});var TBa=Dat();Object.defineProperty(FZ,"KnownSeverityLevel",{enumerable:!0,get:function(){return TBa.KnownSeverityLevel}});var smt=emt();Object.defineProperty(FZ,"useAzureMonitor",{enumerable:!0,get:function(){return smt.useAzureMonitor}});Object.defineProperty(FZ,"shutdownAzureMonitor",{enumerable:!0,get:function(){return smt.shutdownAzureMonitor}});Object.defineProperty(FZ,"flushAzureMonitor",{enumerable:!0,get:function(){return smt.flushAzureMonitor}});HBa(I38(),FZ)});var U38=M1((Tto,BBa)=>{BBa.exports={name:"@uipath/delegate-sdk",version:"0.1.3",description:"UiPath Delegate SDK - Programmatic agent interface",license:"Apache-2.0",type:"commonjs",main:"dist/index.mjs",exports:{".":{import:"./dist/index.mjs"}},publishConfig:{registry:"https://npm.pkg.github.com/"},files:["dist","!dist/sdk.meta.json","README.md","LICENSE"],scripts:{build:"LIB_MODE=1 node esbuild.config.mjs",prepublishOnly:"npm run build",login:"npx tsx scripts/login.ts",start:"node esbuild.config.mjs && node dist/sdk.mjs","start:headless":"node esbuild.config.mjs && node dist/sdk.mjs --disable-computer-use --disable-connections",continue:"node esbuild.config.mjs && node dist/sdk.mjs --continue","start:tools":"ENTRY=examples/with-tools.ts node esbuild.config.mjs && node dist/sdk.mjs","start:eval":"ENTRY=examples/eval.ts node esbuild.config.mjs && node dist/sdk.mjs","start:dev":"node --require ./register.cjs --import tsx --import ./esm-register.mjs examples/basic.ts",test:"node --require ./register.cjs --import tsx --import ./esm-register.mjs src/test.ts",bundle:"node esbuild.config.mjs","bundle:eval":"ENTRY=examples/eval.ts node esbuild.config.mjs",smoke:"ENTRY=examples/smoke.ts node esbuild.config.mjs && node dist/sdk.mjs","smoke:executor":"ENTRY=examples/smoke-executor.ts node esbuild.config.mjs && node dist/sdk.mjs","start:executor":"ENTRY=execution-layer/scripts/run-executor.ts node esbuild.config.mjs && node dist/sdk.mjs","test:cli":"ENTRY=examples/integration-test.ts node esbuild.config.mjs && node dist/sdk.mjs","publish:internal":"npm publish --@uipath:registry=https://npm.pkg.github.com/ --ignore-scripts","publish:npmjs":"npm publish --@uipath:registry=https://registry.npmjs.org/ --access public --ignore-scripts"},dependencies:{"@napi-rs/canvas":"^0.1.65",jszip:"^3.10.1",loglevel:"^1.9.2",pathe:"^2.0.3","tsconfig-paths":"^4.2.0",uuid:"^10.0.0",zod:"3.25.76","zod-to-json-schema":"^3.25.1"},optionalDependencies:{"@uipath/delegate-runtime-darwin-arm64":"0.1.3","@uipath/delegate-runtime-win32-x64":"0.1.3","@uipath/delegate-runtime-linux-x64":"0.1.3"},devDependencies:{"@types/node":"^22.0.0",tsx:"^4.21.0",typescript:"^5.6.0"}}});var DM6=w4(eU2());hv0();wd();Y_();oB();l61();J11();sL1();lo2();a7();xU2();C21();hL1();Q11();uL1();ZO();VT();import{EventEmitter as jRr}from"events";QH();mj();GW2();TS();function iM6(e){if(typeof e!="object"||e===null)return;let t=e.response;if(typeof t!="object"||t===null)return;let r=t.data;if(typeof r!="object"||r===null)return;let a=r;if(a.success===!1&&!(a.error!==void 0&&typeof a.error!="string")&&!(a.errorCode!==void 0&&typeof a.errorCode!="string")&&!(a.category!==void 0&&typeof a.category!="string")&&!(a.retryable!==void 0&&typeof a.retryable!="boolean"))return a}function gU(e,t,r){let a=e.error??`Unknown error from ${t}`;if(r?.includePdfErrors){let n=ho3(e.errorCode);if(n===Jm.MaxPagesExceeded)throw new UW2(e.pageCount??0,a);if(n)throw new Mc1(n,a)}let i=MQ(e.errorCode);if(i){let o=e.totalLines!==void 0||e.category!==void 0||e.retryable!==void 0?{...e.totalLines!==void 0?{totalLines:e.totalLines}:{},...e.category!==void 0?{accessCategory:e.category}:{},...e.retryable!==void 0?{retryable:e.retryable}:{}}:void 0;throw new Yc(i,a,o)}throw new Error(a)}function yb2(e,t){return t?(t.throwIfAborted(),new Promise((r,a)=>{let i=()=>a(t.reason);t.addEventListener("abort",i,{once:!0}),e.then(r,a).finally(()=>t.removeEventListener("abort",i))})):e}var Ni1=class e{constructor(t,r,a){this.toolsUrlProvider=t;this.getHttpClient=r;this.getAuthProvider=a}static{this.governedEndpointPrefixes=["bash/execute","download","excel","file","office","pdf","powershell/execute","ppt","recorded-task","word"]}async post(t,r,a){let i=await this.postRaw(t,r,a);if(!i.success)throw new Error(i.error??`Unknown error from ${t}`);return i}async postRaw(t,r,a,i){this.assertCompleteContext(t,a);let n=this.getHttpClient(),o=this.getAuthProvider(),u=`${this.toolsUrlProvider.getToolsUrl(NF(a))}/${t}`,g=await yb2(a?s9(o,a):wk1(o,"",""),i),f;try{f=await n.post(u,r,g,void 0,i)}catch(v){let C=iM6(v);if(!C)throw v;f=C}if(!f)throw new Error(`No response from ${t}`);return f}async get(t,r){this.assertCompleteContext(t,r);let a=this.getHttpClient(),i=this.getAuthProvider(),o=`${this.toolsUrlProvider.getToolsUrl(NF(r))}/${t}`,h=r?await s9(i,r):await wk1(i,"",""),u=await a.get(o,h);if(!u)throw new Error(`No response from ${t}`);return u}assertCompleteContext(t,r){let a=t.replace(/^\/+/,"").toLowerCase();if((e.governedEndpointPrefixes.some(n=>a===n||a.startsWith(`${n}/`))||r)&&!r?.turnPolicySnapshot)throw new Error("A turn policy snapshot is required for governed interop access.")}};var $Er=120,Gt2=class extends Ni1{constructor(r,a,i,n){super(r,a,i);this.pathsResolver=n}supportsAbortSignal=!0;platformPromise=null;homeDirPromise=null;async execute(r,a,i){i?.throwIfAborted();let n=await yb2(this.getPlatform(),i);i?.throwIfAborted();let o=n==="windows"?"powershell/execute":"bash/execute",h={command:r,timeoutSeconds:a?.timeoutSeconds??$Er,captureOutput:a?.captureOutput??!0,variables:a?.variables??{}};a?.workingDirectory&&(h.workingDirectory=a.workingDirectory),a?.environmentProfile&&(h.environmentProfile=a.environmentProfile),a?.elevationToken&&(h.elevationApproved=!0,h.elevationToken=a.elevationToken);let u=await this.postRaw(o,h,a?.requestContext,i);return KEr(u)}async getPlatform(){return this.platformPromise||(this.platformPromise=this.get("health/details").then(r=>r.platform==="Win32NT"?"windows":"unix").catch(()=>(this.platformPromise=null,this.fallbackPlatform()))),this.platformPromise}async getHomeDirectory(){return this.homeDirPromise||(this.homeDirPromise=this.resolveHomeDirectory().catch(r=>{throw this.homeDirPromise=null,r})),this.homeDirPromise}async resolveHomeDirectory(){if(this.pathsResolver)try{let a=await this.pathsResolver.resolve();if(a.homeDir)return a.homeDir}catch{}try{let a=await this.post("system/info",{query:"os"});if(a.homeDirectory)return a.homeDirectory}catch{}return await this.getPlatform()==="windows"?"C:\\Users":"/home"}fallbackPlatform(){if(typeof globalThis.navigator<"u"){let r=globalThis.navigator?.userAgent?.toLowerCase()??"";if(r.includes("windows"))return"windows";if(r)return"unix"}return typeof process<"u"&&process.platform&&process.platform==="win32"?"windows":"unix"}};function KEr(e){return{stdout:e.output??"",stderr:e.errorOutput??"",exitCode:e.exitCode,error:e.error,executionTimeMs:e.executionTimeMs,workingDirectory:e.workingDirectory,sandbox:YEr(e)}}function YEr(e){if(!(e.blockedBySandbox===!0||(e.warnings?.length??0)>0||e.isolationDegraded===!0))return;let r=e.validationResult;return{blocked:e.blockedBySandbox===!0,...e.blockedBySandbox===!0?{denialSource:e.denialSource==="OperatingSystem"?"operating_system":"harness_policy"}:{},canElevate:r?.canRequestElevation??!1,reason:r?.reason,suggestedElevationReason:r?.suggestedElevationReason,requiresAdmin:r?.requiresAdmin,warnings:e.warnings,isolationDegraded:e.isolationDegraded,degradationReason:e.degradationReason}}tF4();S90();wQ();U4t();uz();var lM6=(i=>(i[i.SILENT=0]="SILENT",i[i.ERROR=1]="ERROR",i[i.INFO=2]="INFO",i[i.VERBOSE=3]="VERBOSE",i))(lM6||{}),CZ1=typeof process<"u"&&process.stdout?.isTTY===!0,rx={dim:CZ1?"\x1B[2m":"",bold:CZ1?"\x1B[1m":"",red:CZ1?"\x1B[31m":"",yellow:CZ1?"\x1B[33m":"",cyan:CZ1?"\x1B[36m":"",green:CZ1?"\x1B[32m":"",reset:CZ1?"\x1B[0m":""};function nM6(e,t){return e.length<=t?e:e.slice(0,t)+`... (${e.length} chars)`}function oM6(){let e=new Date,t=String(e.getHours()).padStart(2,"0"),r=String(e.getMinutes()).padStart(2,"0"),a=String(e.getSeconds()).padStart(2,"0");return`${t}:${r}:${a}`}var Ab2=class{level;maxArgLength;maxResultLength;timestamps;output;streamingType=null;streamBuffer="";constructor(t){this.level=t.level,this.maxArgLength=t.maxArgLength??200,this.maxResultLength=t.maxResultLength??300,this.timestamps=t.timestamps??!0,this.output=t.output??(r=>console.log(r))}handleEvent(t){switch(t.type){case"session_start":this.level>=2&&this.log(`${rx.cyan}[session]${rx.reset} ${t.sessionId||"unknown"}`);break;case"thinking":this.level>=3&&this.stream("thinking",`${rx.dim}[thinking]${rx.reset} `,t.content||"");break;case"tool_call":if(this.level>=2&&(this.log(`${rx.cyan}[tool_call]${rx.reset} ${rx.bold}${t.toolName}${rx.reset}`),t.toolArgs)){let r=this.level>=3?1/0:this.maxArgLength,a=r===1/0?JSON.stringify(t.toolArgs,null,2):nM6(JSON.stringify(t.toolArgs),r);this.log(` ${rx.dim}args: ${a}${rx.reset}`)}break;case"tool_result":{if(this.level>=2){let r=t.toolStatus==="failed"||t.toolStatus==="interrupted",a=r?`${rx.red}[tool_failure]${rx.reset}`:`${rx.green}[tool_result]${rx.reset}`;if(this.log(`${a} ${rx.bold}${t.toolName}${rx.reset} (${t.toolStatus||"completed"})`),t.toolResult!=null){let i=typeof t.toolResult=="string"?t.toolResult:JSON.stringify(t.toolResult,null,2),n=r||this.level>=3?1/0:this.maxResultLength,o=n===1/0?i:nM6(i,n),h=r?rx.red:rx.dim;this.log(` ${h}result: ${o}${rx.reset}`)}}break}case"message":this.level>=2&&this.stream("message",`${rx.yellow}[agent]${rx.reset} `,t.content||"");break;case"done":this.level>=2&&this.log(`${rx.green}[done]${rx.reset} session: ${t.sessionId||"unknown"}`);break;case"error":this.level>=1&&this.log(`${rx.red}[error]${rx.reset} ${t.error||t.content||"Unknown error"}`);break}}stream(t,r,a){if(this.streamingType&&this.streamingType!==t&&this.endStream(),this.streamingType)this.streamBuffer+=a;else{let i=this.timestamps?`${rx.dim}[${oM6()}]${rx.reset} `:"";this.streamBuffer=`${i}${r}${a}`,this.streamingType=t}}endStream(){this.streamingType&&(this.output(this.streamBuffer),this.streamBuffer="",this.streamingType=null)}log(t){this.endStream();let r=this.timestamps?`${rx.dim}[${oM6()}]${rx.reset} `:"";this.output(`${r}${t}`)}};function cM6(e){if(e===!0)return 2;if(e===!1)return 0;switch(e){case"error":return 1;case"info":return 2;case"verbose":return 3;default:return 0}}TS();import MZ1 from"fs";import XEr from"node:path";function _et(e){if(typeof global.requestAnimationFrame>"u"&&(global.requestAnimationFrame=r=>setTimeout(r,0),global.cancelAnimationFrame=r=>clearTimeout(r)),typeof window<"u"&&typeof document<"u"){typeof localStorage<"u"&&localStorage.setItem("UIPATH_AUTOPILOT_CHAT_URL",e);return}global.navigator=global.navigator||{userAgent:process.platform==="win32"?"Windows":"node",platform:process.platform==="darwin"?"MacIntel":process.platform==="win32"?"Win32":"Linux x86_64"},global.document=global.document||{createElement:()=>({appendChild:()=>{},setAttribute:()=>{},style:{},classList:{add:()=>{},remove:()=>{}}}),body:{appendChild:()=>{},classList:{add:()=>{},remove:()=>{},toString:()=>""}},documentElement:{lang:"en"},getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],addEventListener:()=>{},removeEventListener:()=>{}},global.localStorage=global.localStorage||{_data:{},getItem(r){return this._data[r]||null},setItem(r,a){this._data[r]=a},removeItem(r){delete this._data[r]},clear(){this._data={}}};let t=new URL(e);global.window=global.window||{dispatchEvent:()=>{},addEventListener:()=>{},removeEventListener:()=>{},document:global.document,localStorage:global.localStorage,setTimeout:globalThis.setTimeout,clearTimeout:globalThis.clearTimeout,setInterval:globalThis.setInterval,clearInterval:globalThis.clearInterval,fetch:globalThis.fetch,PortalShell:{initialize:()=>{}},location:{href:e,hostname:"sdk.local",protocol:t.protocol,host:t.host,port:t.port,pathname:"/",search:"",hash:""},navigator:{userAgent:"node"},secureStoreApi:{getToolSettings:async()=>null,setToolSettings:async()=>{},getToolExecutionPolicy:async()=>null,setToolExecutionPolicy:async()=>{},getSecuritySettings:async()=>null,setSecuritySettings:async()=>{},onSettingsChanged:()=>()=>{}},settingsApi:{getAppSettings:async()=>({}),setAppSettings:async()=>{},onSettingsChanged:()=>()=>{}},fsServiceApi:{readFile:async(r,a)=>{let i;try{i=MZ1.statSync(r)}catch(h){throw h.code==="ENOENT"?new Yc(Xn.FileNotFound,`File not found: ${r}`):h}let n=a?.encoding??"utf-8",o={mtimeMs:i.mtimeMs,sizeBytes:i.size};return n==="binary"?{...o,bytes:new Uint8Array(MZ1.readFileSync(r)),encoding:n}:{...o,content:MZ1.readFileSync(r,n),encoding:n}},writeFile:async(r,a)=>{let i=XEr.dirname(r);MZ1.mkdirSync(i,{recursive:!0}),MZ1.writeFileSync(r,a,"utf-8")},exists:async r=>MZ1.existsSync(r),stat:async r=>{let a;try{a=MZ1.statSync(r)}catch(i){throw i.code==="ENOENT"?new Yc(Xn.FileNotFound,`File not found: ${r}`):i}return{isFile:a.isFile(),isDirectory:a.isDirectory(),isSymbolicLink:a.isSymbolicLink(),sizeBytes:a.size,mtimeMs:a.mtimeMs,birthtimeMs:a.birthtimeMs}}}},localStorage.setItem("UIPATH_AUTOPILOT_CHAT_URL",e)}var dM6=w4(Km());fj();wd();Y_();U0t();uz();var hM6=w4(Km());z_1();var JEr="delegate-headless-global",sM6=0,QEr="delegate-headless",tRr="delegate-headless-user",eRr=1e4;function rRr(e){if(e===null||typeof e!="object")return!1;let t=e.selection;return t!==null&&typeof t=="object"&&t.kind==="selected"}function aRr(e){return Object.freeze({...e,account:Object.freeze({...e.account}),scope:Object.freeze({...e.scope}),grants:Object.freeze([...e.grants]),denies:Object.freeze([...e.denies]),resources:Object.freeze({...e.resources}),sandboxGeneration:Object.freeze({...e.sandboxGeneration})})}var xZ1=class{constructor(t){this.authProvider=t;this.generation={generationId:JEr,policyVersion:sM6,createdAt:new Date().toISOString()}}generation;async compose(t,r){let[a,i,n]=await Promise.all([this.authProvider.getUserId(),this.authProvider.getOrganizationId(),this.authProvider.getTenantId()]);if(!i)return{kind:"denied",code:"missing_snapshot",retryable:!0,message:"Headless turn policy requires an organization id from the auth provider"};let o={userId:a||tRr,organizationId:i,tenantId:n||null};return{kind:"selected",snapshot:aRr({snapshotId:(0,hM6.v4)(),rootTurnId:r,installationId:QEr,account:o,scope:{kind:"global"},baseline:"legacy_global",grants:[],denies:[],resources:{},policyVersion:sM6,sandboxGeneration:this.generation})}}},LZ1=class{constructor(t,r){this.httpClient=t;this.interopUrl=r}async register(t,r){let a={snapshot:r},i=await this.httpClient.post(`${this.interopUrl}${yv.turnPolicySnapshots}`,a,void 0,eRr);if(!rRr(i))throw new Error("Interop rejected the headless turn policy snapshot registration")}async deactivate(t,r){await this.httpClient.post(`${this.interopUrl}${z90(r)}`)}};function uM6(e){let t=new b42(new xZ1(e.authProvider),new LZ1(e.httpClient,e.interopUrl),r=>st.getState().sessions[r]?.parentSessionId,()=>({kind:"global"}));jl0({getSnapshot:r=>t.getSnapshot(r),getSelection:r=>t.getSelection(r),getRootTurnId:r=>t.getRootTurnId(r),getSnapshotForExecution:r=>{let a=A7.getState().selectSessionId(r);return a?t.getSnapshot(a):void 0},beginRootTurn:r=>t.beginRootTurn(r),endRootTurn:(r,a)=>t.endRootTurn(r,a)})}var gM6="sdk-ambient",Ret={},Eet;function pM6(){return Ret}async function fM6(e){await Zet();try{let r=await new xZ1(e.authProvider).compose({kind:"global"},`sdk-ambient-${(0,dM6.v4)()}`);if(r.kind!=="selected")return console.warn(`[DelegateAgent] Ambient turn policy snapshot unavailable: ${r.message}`),!1;let a=new LZ1(e.httpClient,e.interopUrl);return await a.register(gM6,r.snapshot),Eet={snapshotId:r.snapshot.snapshotId,registrar:a},Ret[Lk1]=g31(r.snapshot),!0}catch(t){return console.warn(`[DelegateAgent] Ambient turn policy snapshot registration failed: ${t instanceof Error?t.message:String(t)}`),!1}}async function Zet(){delete Ret[Lk1];let e=Eet;if(Eet=void 0,!!e)try{await e.registrar.deactivate(gM6,e.snapshotId)}catch{}}var Fet=w4(cr1()),zb2={},bb2=[],Jy1=null,Ux0=null;function iRr(e){if(typeof e=="string")return e;if(e instanceof URL)return e.href;let t=e;return typeof t.url=="string"?t.url:null}function nRr(e,t){if(t?.headers!==void 0)return t.headers;let r=e;if(typeof r=="object"&&r!==null&&typeof r.headers?.forEach=="function")return r.headers}function oRr(e){if(Ux0===null)return!1;let t=iRr(e);if(t===null)return!1;try{return new URL(t).origin===Ux0}catch{return!1}}function lRr(){if(Jy1!==null)return;Jy1=globalThis.fetch.bind(globalThis);let e=(r,a)=>{if(!oRr(r))return Jy1(r,a);let i=new Headers(nRr(r,a));for(let[n,o]of Object.entries(zb2))i.set(n,o);return Jy1(r,{...a,headers:i})};globalThis.fetch=e;let t=globalThis.window;t&&(t.fetch=e)}function cRr(e){if(!e)return null;try{return new URL(e).origin}catch{return null}}function vM6(e,t){Ux0=cRr(t);let r=Fet.default.defaults.headers.common;for(let a of bb2)delete r[a];zb2={...e??{}},bb2=Object.keys(zb2);for(let[a,i]of Object.entries(zb2))r[a]=i;bb2.length>0&&lRr()}function Oet(){let e=Fet.default.defaults.headers.common;for(let t of bb2)delete e[t];if(zb2={},bb2=[],Ux0=null,Jy1!==null){globalThis.fetch=Jy1;let t=globalThis.window;t&&(t.fetch=Jy1),Jy1=null}}import{spawn as sRr}from"child_process";import*as pU from"fs";import*as MM6 from"net";import*as xM6 from"os";import*as j61 from"node:path";var LM6=j61.join(xM6.homedir(),".delegate-sdk"),Det=j61.join(LM6,"interop.pid"),mM6=3e4,hRr=250,CM6=2e3,dRr={"darwin-arm64":"@uipath/delegate-runtime-darwin-arm64","win32-x64":"@uipath/delegate-runtime-win32-x64","linux-x64":"@uipath/delegate-runtime-linux-x64"};function uRr(e){return dRr[e]}var jt2=class e{child;spawnedPort;async start(t={}){let r=await this.tryAttachToRunning();if(r)return{url:`http://localhost:${r.port}`,reused:!0};let a=this.resolveBinary();await this.unquarantineMac(a),this.ensureExecutable(a);let i=e.rgBinaryPath();i&&this.ensureExecutable(i);let n=await fRr(),o=t.keepAlive===!0;this.child=sRr(a,[`--urls=http://localhost:${n}`],{stdio:o?"ignore":["ignore","pipe","pipe"],detached:o,env:{...process.env,ASPNETCORE_ENVIRONMENT:"Production"}}),this.spawnedPort=n,o&&this.child.unref(),o||(this.child.stderr?.on("data",h=>{process.stderr.write(`[interop] ${h.toString()}`)}),this.child.on("exit",(h,u)=>{h!==0&&h!==null&&process.stderr.write(`[interop] exited with code ${h} (signal ${u})
|
|
12294
|
+
`)===r.length-1&&(r=r.substring(0,r.length-1));let a={body:r,severityNumber:t};Yt8.emit(a)}};function zTa(e){e?.enabled&&(Yt8=zT2.logs.getLogger("ApplicationInsightsConsoleLogger"),Xt8=e.logSendingLevel||zT2.SeverityNumber.UNSPECIFIED,Wvt.channel.subscribe("console",Jt8,Wvt.trueFilter))}s82.enable=zTa;function bTa(){Wvt.channel.unsubscribe("console",Jt8)}s82.dispose=bTa});var Qt8=M1(kV0=>{"use strict";Object.defineProperty(kV0,"__esModule",{value:!0});kV0.AutoCollectLogs=void 0;var STa=Kt8();(0,STa.enablePublishers)();var qvt=class{enable(t){try{bT2().enable(t.console)}catch{bT2().enable(t.console)}}shutdown(){try{bT2().dispose()}catch{bT2().dispose()}}};kV0.AutoCollectLogs=qvt});var r38=M1(Gn1=>{"use strict";var HTa=Gn1&&Gn1.__createBinding||(Object.create?(function(e,t,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,a,i)}):(function(e,t,r,a){a===void 0&&(a=r),e[a]=t[r]})),kTa=Gn1&&Gn1.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),e38=Gn1&&Gn1.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&HTa(t,e,r);return kTa(t,e),t};Object.defineProperty(Gn1,"__esModule",{value:!0});Gn1.JsonConfig=void 0;var TTa=e38(Z4("fs")),TV0=e38(Z4("path")),t38=E8(),BTa="APPLICATIONINSIGHTS_CONFIGURATION_FILE",VTa="APPLICATIONINSIGHTS_CONFIGURATION_CONTENT",$vt=class e{constructor(){this._loadJsonFile()}static getInstance(){return e._instance||(e._instance=new e),e._instance}_loadJsonFile(){let t="",r=process.env[VTa];if(r)t=r;else{let a="applicationinsights.json",i=TV0.join(__dirname,"../../../"),n=TV0.join(i,a),o=process.env[BTa];o&&(TV0.isAbsolute(o)?n=o:n=TV0.join(i,o));try{t=TTa.readFileSync(n,"utf8")}catch(h){t38.diag.info("Failed to read JSON config file: ",h)}}try{let a=JSON.parse(t);this.enableAutoCollectExceptions=a.enableAutoCollectExceptions,this.otlpLogExporterConfig=a.otlpLogExporterConfig,this.otlpMetricExporterConfig=a.otlpMetricExporterConfig,this.otlpTraceExporterConfig=a.otlpTraceExporterConfig,this.enableAutoCollectPerformance=a.enableAutoCollectPerformance,this.azureMonitorExporterOptions=a.azureMonitorExporterOptions,this.samplingRatio=a.samplingRatio,this.instrumentationOptions=a.instrumentationOptions}catch(a){t38.diag.info("Missing or invalid JSON config file: ",a)}}};Gn1.JsonConfig=$vt});var a38=M1(VV0=>{"use strict";Object.defineProperty(VV0,"__esModule",{value:!0});VV0.logLevelParser=void 0;var BV0=TZ();function PTa(e){switch(e){case"ERROR":return BV0.SeverityNumber.ERROR;case"WARN":return BV0.SeverityNumber.WARN;case"INFO":return BV0.SeverityNumber.INFO;default:return BV0.SeverityNumber.UNSPECIFIED}}VV0.logLevelParser=PTa});var n38=M1(PV0=>{"use strict";Object.defineProperty(PV0,"__esModule",{value:!0});PV0.ApplicationInsightsConfig=void 0;var _Ta=E8(),ETa=J61(),RTa=r38(),ZTa=a38(),i38="APPLICATIONINSIGHTS_INSTRUMENTATION_LOGGING_LEVEL",Kvt=class{constructor(t){this.otlpLogExporterConfig={},this.otlpMetricExporterConfig={},this.otlpTraceExporterConfig={},this.enableAutoCollectPerformance=!0,this.enableAutoCollectExceptions=!0,this.azureMonitorExporterOptions={},this.samplingRatio=1,this.instrumentationOptions={http:{enabled:!0},azureSdk:{enabled:!1},mongoDb:{enabled:!1},mySql:{enabled:!1},postgreSql:{enabled:!1},redis:{enabled:!1},redis4:{enabled:!1},console:{enabled:!1},bunyan:{enabled:!1},winston:{enabled:!1}},this._resource=this._getDefaultResource(),t&&(typeof t.enableAutoCollectExceptions=="boolean"&&(this.enableAutoCollectExceptions=t.enableAutoCollectExceptions),typeof t.enableAutoCollectPerformance=="boolean"&&(this.enableAutoCollectPerformance=t.enableAutoCollectPerformance),this.otlpTraceExporterConfig=Object.assign(this.otlpTraceExporterConfig,t.otlpTraceExporterConfig),this.otlpMetricExporterConfig=Object.assign(this.otlpMetricExporterConfig,t.otlpMetricExporterConfig),this.otlpLogExporterConfig=Object.assign(this.otlpLogExporterConfig,t.otlpLogExporterConfig),this.azureMonitorExporterOptions=Object.assign(this.azureMonitorExporterOptions,t.azureMonitorExporterOptions),this.instrumentationOptions=Object.assign(this.instrumentationOptions,t.instrumentationOptions),this.resource=Object.assign(this.resource,t.resource),this.samplingRatio=t.samplingRatio!==void 0?t.samplingRatio:this.samplingRatio,process.env[i38]&&(this.instrumentationOptions=Object.assign(Object.assign({},this.instrumentationOptions),{console:Object.assign(Object.assign({},this.instrumentationOptions.console),{logSendingLevel:(0,ZTa.logLevelParser)(process.env[i38])})})),this._mergeConfig())}set resource(t){this._resource=this._resource.merge(t)}get resource(){return this._resource}_mergeConfig(){try{let t=RTa.JsonConfig.getInstance();this.enableAutoCollectPerformance=t.enableAutoCollectPerformance!==void 0?t.enableAutoCollectPerformance:this.enableAutoCollectPerformance,this.enableAutoCollectExceptions=t.enableAutoCollectExceptions!==void 0?t.enableAutoCollectExceptions:this.enableAutoCollectExceptions,this.otlpTraceExporterConfig=Object.assign(this.otlpTraceExporterConfig,t.otlpTraceExporterConfig),this.otlpMetricExporterConfig=Object.assign(this.otlpMetricExporterConfig,t.otlpMetricExporterConfig),this.otlpLogExporterConfig=Object.assign(this.otlpLogExporterConfig,t.otlpLogExporterConfig),this.samplingRatio=t.samplingRatio!==void 0?t.samplingRatio:this.samplingRatio,this.azureMonitorExporterOptions=Object.assign(this.azureMonitorExporterOptions,t.azureMonitorExporterOptions),this.instrumentationOptions=Object.assign(this.instrumentationOptions,t.instrumentationOptions)}catch(t){_Ta.diag.error("Failed to load JSON config file values.",t)}}_getDefaultResource(){return(0,ETa.defaultResource)()}};PV0.ApplicationInsightsConfig=Kvt});var o38=M1(iz1=>{"use strict";Object.defineProperty(iz1,"__esModule",{value:!0});iz1.AZURE_MONITOR_STATSBEAT_FEATURES=iz1.DEFAULT_ROLE_NAME=iz1.APPLICATION_INSIGHTS_OPENTELEMETRY_VERSION=void 0;iz1.APPLICATION_INSIGHTS_OPENTELEMETRY_VERSION="3.14.0";iz1.DEFAULT_ROLE_NAME="Web";iz1.AZURE_MONITOR_STATSBEAT_FEATURES="AZURE_MONITOR_STATSBEAT_FEATURES"});var Jvt=M1(_V0=>{"use strict";Object.defineProperty(_V0,"__esModule",{value:!0});_V0.StatsbeatFeaturesManager=void 0;var Yvt=o38(),h82=w32(),Xvt=class e{static getInstance(){return e.instance||(e.instance=new e),e.instance}getCurrentConfig(){let t=process.env[Yvt.AZURE_MONITOR_STATSBEAT_FEATURES];if(t)try{return JSON.parse(t)}catch{return{instrumentation:h82.StatsbeatInstrumentation.NONE,feature:h82.StatsbeatFeature.SHIM}}return{instrumentation:h82.StatsbeatInstrumentation.NONE,feature:h82.StatsbeatFeature.SHIM}}setConfig(t){process.env[Yvt.AZURE_MONITOR_STATSBEAT_FEATURES]=JSON.stringify(t)}enableFeature(t){let r=this.getCurrentConfig();r.feature|=t,this.setConfig(r)}disableFeature(t){let r=this.getCurrentConfig();r.feature&=~t,this.setConfig(r)}isFeatureEnabled(t){return(this.getCurrentConfig().feature&t)!==0}enableInstrumentation(t){let r=this.getCurrentConfig();r.instrumentation|=t,this.setConfig(r)}disableInstrumentation(t){let r=this.getCurrentConfig();r.instrumentation&=~t,this.setConfig(r)}isInstrumentationEnabled(t){return(this.getCurrentConfig().instrumentation&t)!==0}initialize(){process.env[Yvt.AZURE_MONITOR_STATSBEAT_FEATURES]||this.setConfig({instrumentation:h82.StatsbeatInstrumentation.NONE,feature:h82.StatsbeatFeature.SHIM})}};_V0.StatsbeatFeaturesManager=Xvt});var emt=M1(nz1=>{"use strict";Object.defineProperty(nz1,"__esModule",{value:!0});nz1.flushAzureMonitor=nz1.shutdownAzureMonitor=nz1.useAzureMonitor=void 0;var c38=L08(),Qvt=E8(),s38=TZ(),FTa=N32(),OTa=PS2(),DTa=gb0(),ITa=KH0(),NTa=Qt8(),UTa=jat(),GTa=n38(),jTa=qat(),WTa=w32(),l38=Jvt(),tmt,EV0;function qTa(e){l38.StatsbeatFeaturesManager.getInstance().initialize(),l38.StatsbeatFeaturesManager.getInstance().enableFeature(WTa.StatsbeatFeature.SHIM);let t=new GTa.ApplicationInsightsConfig(e),r=YTa(t),a=XTa(t);e||(e={}),r&&(e.spanProcessors||(e.spanProcessors=[]),e.spanProcessors.push(r)),a&&(e.logRecordProcessors||(e.logRecordProcessors=[]),e.logRecordProcessors.push(a)),(0,c38.useAzureMonitor)(e);let i=new jTa.LogApi(s38.logs.getLogger("ApplicationInsightsLogger"));tmt=new NTa.AutoCollectLogs,t.enableAutoCollectExceptions&&(EV0=new UTa.AutoCollectExceptions(i)),tmt.enable(t.instrumentationOptions)}nz1.useAzureMonitor=qTa;async function $Ta(){await(0,c38.shutdownAzureMonitor)(),tmt.shutdown(),EV0?.shutdown()}nz1.shutdownAzureMonitor=$Ta;async function KTa(){try{await Qvt.metrics.getMeterProvider().forceFlush(),await Qvt.trace.getTracerProvider().getDelegate().forceFlush(),await s38.logs.getLoggerProvider().forceFlush()}catch(e){Qvt.diag.error("Failed to flush telemetry",e)}}nz1.flushAzureMonitor=KTa;function YTa(e){var t;if(!((t=e.otlpTraceExporterConfig)===null||t===void 0)&&t.enabled){let r=new ITa.OTLPTraceExporter(e.otlpTraceExporterConfig);return new OTa.BatchSpanProcessor(r)}}function XTa(e){var t;if(!((t=e.otlpLogExporterConfig)===null||t===void 0)&&t.enabled){let r=new DTa.OTLPLogExporter(e.otlpLogExporterConfig);return new FTa.BatchLogRecordProcessor(r)}}});var h38=M1(ZV0=>{"use strict";Object.defineProperty(ZV0,"__esModule",{value:!0});ZV0.TelemetryClientProvider=void 0;var cO1=E8(),rmt=WF1(),JTa=gb0(),QTa=YH2(),tBa=KH0(),amt=N32(),imt=gB(),RV0=fU(),eBa=PS2(),rBa=J61(),nmt=class{constructor(t){var r;this._options=t,this._metricReaders=[],this._spanProcessors=[],this._logProcessors=[];let a=(r=this._options.resource)!==null&&r!==void 0?r:(0,rBa.defaultResource)();this._spanProcessors=this._setupTracing(),this._logProcessors=this._setupLogging(),this._metricReaders=this._setupMetrics(),this._tracerProvider=new eBa.NodeTracerProvider({resource:a,sampler:this._createSampler(),spanProcessors:this._spanProcessors}),this._meterProvider=new imt.MeterProvider({resource:a,readers:this._metricReaders}),this._loggerProvider=new amt.LoggerProvider({resource:a,processors:this._logProcessors})}getTracer(t){return this._tracerProvider.getTracer(t)}getMeter(t){return this._meterProvider.getMeter(t)}getLogger(t){return this._loggerProvider.getLogger(t)}async flush(){await Promise.all([this._runWithErrorHandling(this._meterProvider.forceFlush(),"Failed to flush metrics"),this._runWithErrorHandling(this._tracerProvider.forceFlush(),"Failed to flush traces"),this._runWithErrorHandling(this._loggerProvider.forceFlush(),"Failed to flush logs")])}async shutdown(){await Promise.all([...this._metricReaders.map(t=>this._runWithErrorHandling(t.shutdown(),"Failed to shutdown metric reader")),...this._spanProcessors.map(t=>this._runWithErrorHandling(t.shutdown(),"Failed to shutdown span processor")),...this._logProcessors.map(t=>this._runWithErrorHandling(t.shutdown(),"Failed to shutdown log processor")),this._runWithErrorHandling(this._meterProvider.shutdown(),"Failed to shutdown meter provider"),this._runWithErrorHandling(this._tracerProvider.shutdown(),"Failed to shutdown tracer provider"),this._runWithErrorHandling(this._loggerProvider.shutdown(),"Failed to shutdown logger provider")])}_createSampler(){var t;if(((t=this._options)===null||t===void 0?void 0:t.samplingRatio)!==void 0)return new RV0.ParentBasedSampler({root:new RV0.TraceIdRatioBasedSampler(this._options.samplingRatio)})}_setupTracing(){var t;let r=[];try{let a=new rmt.AzureMonitorTraceExporter(this._options.azureMonitorExporterOptions);r.push(new RV0.BatchSpanProcessor(a))}catch(a){cO1.diag.error("Failed to configure Azure Monitor trace exporter",a)}if(!((t=this._options.otlpTraceExporterConfig)===null||t===void 0)&&t.enabled)try{let a=new tBa.OTLPTraceExporter(this._options.otlpTraceExporterConfig);r.push(new RV0.BatchSpanProcessor(a))}catch(a){cO1.diag.error("Failed to configure OTLP trace exporter",a)}if(this._options.spanProcessors)for(let a of this._options.spanProcessors)r.push(a);return r}_setupLogging(){var t;let r=[];try{let a=new rmt.AzureMonitorLogExporter(this._options.azureMonitorExporterOptions);r.push(new amt.BatchLogRecordProcessor(a))}catch(a){cO1.diag.error("Failed to configure Azure Monitor log exporter",a)}if(!((t=this._options.otlpLogExporterConfig)===null||t===void 0)&&t.enabled)try{let a=new JTa.OTLPLogExporter(this._options.otlpLogExporterConfig);r.push(new amt.BatchLogRecordProcessor(a))}catch(a){cO1.diag.error("Failed to configure OTLP log exporter",a)}if(this._options.logRecordProcessors)for(let a of this._options.logRecordProcessors)r.push(a);return r}_setupMetrics(){var t;let r=[];try{let a=new rmt.AzureMonitorMetricExporter(this._options.azureMonitorExporterOptions);r.push(new imt.PeriodicExportingMetricReader({exporter:a}))}catch(a){cO1.diag.error("Failed to configure Azure Monitor metric exporter",a)}if(!((t=this._options.otlpMetricExporterConfig)===null||t===void 0)&&t.enabled)try{let a=new QTa.OTLPMetricExporter(this._options.otlpMetricExporterConfig);r.push(new imt.PeriodicExportingMetricReader({exporter:a}))}catch(a){cO1.diag.error("Failed to configure OTLP metric exporter",a)}return r}async _runWithErrorHandling(t,r){try{await t}catch(a){cO1.diag.error(r,a)}}};ZV0.TelemetryClientProvider=nmt});var lmt=M1(DV0=>{"use strict";Object.defineProperty(DV0,"__esModule",{value:!0});DV0.TelemetryClient=void 0;var jk=E8(),aBa=TZ(),z81=Wx(),iBa=jk6(),nBa=L32(),oBa=aT6(),lBa=iT6(),cBa=nT6(),sBa=qat(),omt=emt(),hBa=h38(),FV0=w32(),dBa=Jvt(),OV0=class e{constructor(t,r){var a;this._configWarnings=[],e._instanceCount++,e._instanceCount>=2&&dBa.StatsbeatFeaturesManager.getInstance().enableFeature(FV0.StatsbeatFeature.MULTI_IKEY);let i=new oBa(t,this._configWarnings);this.config=i,this.commonProperties={},this.context=new iBa.Context,this._isInitialized=!1,this._useGlobalProviders=(a=r?.useGlobalProviders)!==null&&a!==void 0?a:!0}initialize(){if(!this._isInitialized){this._isInitialized=!0,this._options=this.config.parseConfig();try{this._attributeSpanProcessor=new lBa.AttributeSpanProcessor(Object.assign(Object.assign({},this.context.tags),this.commonProperties)),this._attributeLogProcessor=new cBa.AttributeLogProcessor(Object.assign(Object.assign({},this.context.tags),this.commonProperties)),this._options.spanProcessors=[...this._options.spanProcessors||[],this._attributeSpanProcessor],this._options.logRecordProcessors=[...this._options.logRecordProcessors||[],this._attributeLogProcessor],this._useGlobalProviders?(0,omt.useAzureMonitor)(this._options):this._telemetryClientProvider=new hBa.TelemetryClientProvider(this._options);let t=this._useGlobalProviders?aBa.logs.getLogger("ApplicationInsightsLogger"):this._telemetryClientProvider.getLogger("ApplicationInsightsLogger");this._logApi=new sBa.LogApi(t);for(let r=0;r<this._configWarnings.length;r++)jk.diag.warn(this._configWarnings[r])}catch(t){jk.diag.error(`Failed to initialize TelemetryClient ${t}`)}}}trackAvailability(t){this._isInitialized||this.initialize(),this._logApi.trackAvailability(t)}trackPageView(t){this._isInitialized||this.initialize(),this._logApi.trackPageView(t)}trackTrace(t){this._isInitialized||this.initialize(),this._logApi.trackTrace(t)}trackException(t){this._isInitialized||this.initialize(),this._logApi.trackException(t)}trackEvent(t){this._isInitialized||this.initialize(),this._logApi.trackEvent(t)}trackMetric(t){this._isInitialized||this.initialize();try{this._getMeterInstance().createHistogram(t.name).record(t.value,Object.assign(Object.assign(Object.assign({},t.properties),this.commonProperties),this.context.tags))}catch(r){jk.diag.error(`Failed to record metric: ${r}`)}}_getTracerInstance(){return this._telemetryClientProvider?(this._manualTracer||(this._manualTracer=this._telemetryClientProvider.getTracer("ApplicationInsightsTracer")),this._manualTracer):jk.trace.getTracer("ApplicationInsightsTracer")}_getMeterInstance(){return this._telemetryClientProvider?(this._manualMeter||(this._manualMeter=this._telemetryClientProvider.getMeter("ApplicationInsightsMetrics")),this._manualMeter):jk.metrics.getMeterProvider().getMeter("ApplicationInsightsMetrics")}trackRequest(t){this._isInitialized||this.initialize();let r=t.time?t.time.getTime()+t.duration:Date.now(),a=t.time||new Date(r-t.duration),i=jk.context.active(),n=Object.assign({},t.properties);t.name||(n[z81.SEMATTRS_HTTP_METHOD]="HTTP"),t.url&&(n[z81.SEMATTRS_HTTP_URL]=t.url),t.resultCode&&(n[z81.SEMATTRS_HTTP_STATUS_CODE]=t.resultCode);let o={kind:jk.SpanKind.SERVER,attributes:n,startTime:a},h=this._getTracerInstance().startSpan(t.name,o,i);if(t.id)try{h._spanContext&&(h._spanContext.traceId=t.id)}catch(u){jk.diag.warn("Unable to set custom traceId on span:",u)}h.setStatus({code:t.success?jk.SpanStatusCode.OK:jk.SpanStatusCode.ERROR}),h.end(r)}trackDependency(t){this._isInitialized||this.initialize();let r=t.time?t.time.getTime()+t.duration:Date.now(),a=t.time||new Date(r-t.duration);if(t&&!t.target&&t.data)try{t.target=new URL(t.data).host}catch(u){t.target=null,jk.diag.warn(this.constructor.name,"Failed to create URL.",u)}let i=jk.context.active(),n=Object.assign({},t.properties);t.dependencyTypeName&&(t.dependencyTypeName.toLowerCase().indexOf("http")>-1?(t.data&&(n[z81.SEMATTRS_HTTP_URL]=t.data),t.resultCode&&(n[z81.SEMATTRS_HTTP_STATUS_CODE]=t.resultCode)):nBa.Util.getInstance().isDbDependency(t.dependencyTypeName)?(n[z81.SEMATTRS_DB_SYSTEM]=t.dependencyTypeName,n[z81.SEMATTRS_DB_STATEMENT]=t.data):t.dependencyTypeName.toLowerCase().indexOf("rpc")>-1&&(n[z81.SEMATTRS_RPC_SYSTEM]=t.dependencyTypeName,n[z81.SEMATTRS_RPC_METHOD]=t.data,n[z81.SEMATTRS_RPC_GRPC_STATUS_CODE]=t.resultCode)),t.target&&(n[z81.SEMATTRS_PEER_SERVICE]=t.target);let o={kind:jk.SpanKind.CLIENT,attributes:n,startTime:a},h=this._getTracerInstance().startSpan(t.name,o,i);if(t.id)try{h._spanContext&&(h._spanContext.traceId=t.id)}catch(u){jk.diag.warn("Unable to set custom traceId on span:",u)}h.setStatus({code:t.success?jk.SpanStatusCode.OK:jk.SpanStatusCode.ERROR}),h.end(r)}track(t,r){throw new Error(`Not implemented. Please use the specific track method for the type of telemetry you are tracking. ${FV0.UNSUPPORTED_MSG}`)}setAutoPopulateAzureProperties(){}getAuthorizationHandler(t){jk.diag.warn(`getAuthorizationHandler is not supported in ApplicationInsights any longer. ${FV0.UNSUPPORTED_MSG}`)}getStatsbeat(){return null}setUseDiskRetryCaching(t,r,a){throw new Error("Not implemented")}addTelemetryProcessor(t){jk.diag.warn(`addTelemetryProcessor is not supported in ApplicationInsights any longer. ${FV0.UNSUPPORTED_MSG}`)}clearTelemetryProcessors(){throw new Error("Not implemented")}trackNodeHttpRequestSync(t){jk.diag.warn("trackNodeHttpRequestSync is not implemented and is a no-op. Please use trackRequest instead.")}trackNodeHttpRequest(t){jk.diag.warn("trackNodeHttpRequest is not implemented and is a no-op. Please use trackRequest instead.")}trackNodeHttpDependency(t){jk.diag.warn("trackNodeHttpDependency is not implemented and is a no-op. Please use trackDependency instead.")}async flush(){return this._telemetryClientProvider?this._telemetryClientProvider.flush():(0,omt.flushAzureMonitor)()}async shutdown(){return this._telemetryClientProvider?this._telemetryClientProvider.shutdown():(0,omt.shutdownAzureMonitor)()}pushWarningToLog(t){this._configWarnings.push(t)}};DV0.TelemetryClient=OV0;OV0._instanceCount=0});var g38=M1(UV0=>{"use strict";Object.defineProperty(UV0,"__esModule",{value:!0});UV0.CorrelationContextManager=void 0;var Ww=E8(),d38=U9(),IV0=L32(),u38="ApplicationInsights-Context",NV0=class{static spanToContextObject(t,r,a,i){var n;let o={legacyRootId:"",traceId:t?.traceId,spanId:t?.spanId,traceFlag:(n=t?.traceFlags)===null||n===void 0?void 0:n.toString(),parentId:r,version:"00"};return this.generateContextObject(o.traceId,o.parentId,a,o,i)}static getCurrentContext(){var t,r;if(!this._isDisabled){let a=Ww.trace.getSpan(Ww.context.active());a||(a=Ww.trace.getTracer(u38).startSpan(u38));let i=new d38.TraceState((r=(t=a?.spanContext())===null||t===void 0?void 0:t.traceState)===null||r===void 0?void 0:r.serialize()),n=this._getParentSpanId(a);return this.spanToContextObject(a?.spanContext(),n,a?.name,i)}return null}static _getParentSpanId(t){var r,a;if(!t)return;let i=t;return typeof i.parentSpanContext=="function"?(r=i.parentSpanContext())===null||r===void 0?void 0:r.spanId:i.parentSpanId||((a=i.parentSpanContext)===null||a===void 0?void 0:a.spanId)}static generateContextObject(t,r,a,i,n){var o;let h={fieldmap:(o=n?.serialize())===null||o===void 0?void 0:o.split(",")};return{operation:{name:a,id:t,parentId:r,traceparent:i,tracestate:h},customProperties:{getProperty(u){return""},setProperty(u){return""}}}}static runWithContext(t,r){try{let a=Ww.trace.setSpanContext(Ww.context.active(),this._contextObjectToSpanContext(t));return Ww.context.with(a,r)}catch(a){Ww.diag.warn("Error binding to session context",IV0.Util.getInstance().dumpObj(a))}return r()}static wrapEmitter(t){try{Ww.context.bind(Ww.context.active(),t)}catch(r){Ww.diag.warn("Error binding to session context",IV0.Util.getInstance().dumpObj(r))}}static wrapCallback(t,r){try{if(r){let a=Ww.trace.setSpanContext(Ww.context.active(),this._contextObjectToSpanContext(r));return Ww.context.bind(a,t)}return Ww.context.bind(Ww.context.active(),t)}catch(a){return Ww.diag.error("Error binding to session context",IV0.Util.getInstance().dumpObj(a)),t}}static enable(t){Ww.diag.info("Enabling the context manager is no longer necessary and this method is a no-op.")}static startOperation(t,r){let a=t&&t.traceContext||null,i=t&&t.spanContext?t:null,n=t&&t.traceId?t:null,o=t&&t.headers;if(i){Ww.trace.setSpanContext(Ww.context.active(),i.spanContext());let h=this._getParentSpanId(i);return this.spanToContextObject(i.spanContext(),h)}if(n)return Ww.trace.setSpanContext(Ww.context.active(),n),this.spanToContextObject(n);if(a||o){let h=null,u=null;if(a){let v=r;v?.headers&&v?.headers.get?(h=v.headers.get("traceparent")||v.headers.get("request-id"),u=v.headers.get("tracestate")):v?.headers&&(h=v.headers.traceparent?v.headers.traceparent:v.headers["request-id"],u=v.headers.tracestate),!h&&a.traceparent?h=a.traceparent:!h&&a.traceParent&&(h=a.traceParent),!u&&a.tracestate?u=a.tracestate:!u&&a.traceState&&(u=a.traceState)}o&&o.traceparent?(h=o.traceparent?o.traceparent.toString():null,u=o.tracestate?o.tracestate.toString():u):o&&o.get&&(h=o.get("traceparent")||o.get("request-id"),u=o.get("tracestate"));let g=h?.split("-"),f=new d38.TraceState;u?.split(",").forEach(v=>{let C=v.split("=");f.set(C[0],C[1])});try{return this.generateContextObject(g[1],g[2],null,{legacyRootId:"",parentId:"",spanId:g[2],traceFlag:"",traceId:g[1],version:"00"},f)}catch(v){Ww.diag.warn("Error creating context object",IV0.Util.getInstance().dumpObj(v))}}return Ww.diag.warn("startOperation was called with invalid arguments"),null}static disable(){Ww.diag.warn("It will not be possible to re-enable the current context manager after disabling it!"),this._isDisabled=!0,Ww.context.disable()}static reset(){Ww.diag.info("This is a no-op and exists only for compatibility reasons.")}static _contextObjectToSpanContext(t){var r,a,i,n;return{traceId:t.operation.id,spanId:(a=(r=t.operation.traceparent)===null||r===void 0?void 0:r.spanId)!==null&&a!==void 0?a:"",traceFlags:!((i=t.operation.traceparent)===null||i===void 0)&&i.traceFlag?Number((n=t.operation.traceparent)===null||n===void 0?void 0:n.traceFlag):void 0}}};UV0.CorrelationContextManager=NV0;NV0._isDisabled=!1});var f38=M1(p38=>{"use strict";Object.defineProperty(p38,"__esModule",{value:!0})});var m38=M1(v38=>{"use strict";Object.defineProperty(v38,"__esModule",{value:!0})});var M38=M1(C38=>{"use strict";Object.defineProperty(C38,"__esModule",{value:!0})});var L38=M1(x38=>{"use strict";Object.defineProperty(x38,"__esModule",{value:!0})});var y38=M1(w38=>{"use strict";Object.defineProperty(w38,"__esModule",{value:!0})});var z38=M1(A38=>{"use strict";Object.defineProperty(A38,"__esModule",{value:!0})});var S38=M1(b38=>{"use strict";Object.defineProperty(b38,"__esModule",{value:!0})});var k38=M1(H38=>{"use strict";Object.defineProperty(H38,"__esModule",{value:!0})});var B38=M1(T38=>{"use strict";Object.defineProperty(T38,"__esModule",{value:!0})});var P38=M1(V38=>{"use strict";Object.defineProperty(V38,"__esModule",{value:!0})});var E38=M1(_38=>{"use strict";Object.defineProperty(_38,"__esModule",{value:!0})});var R38=M1(ST2=>{"use strict";Object.defineProperty(ST2,"__esModule",{value:!0});ST2.TelemetryType=void 0;var uBa;(function(e){e[e.Event=0]="Event",e[e.Exception=1]="Exception",e[e.Trace=2]="Trace",e[e.Metric=3]="Metric",e[e.Request=4]="Request",e[e.Dependency=5]="Dependency",e[e.Availability=6]="Availability",e[e.PageView=7]="PageView"})(uBa=ST2.TelemetryType||(ST2.TelemetryType={}))});var Z38=M1(yE=>{"use strict";var gBa=yE&&yE.__createBinding||(Object.create?(function(e,t,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,a,i)}):(function(e,t,r,a){a===void 0&&(a=r),e[a]=t[r]})),K01=yE&&yE.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&gBa(t,e,r)};Object.defineProperty(yE,"__esModule",{value:!0});K01(f38(),yE);K01(m38(),yE);K01(M38(),yE);K01(L38(),yE);K01(y38(),yE);K01(z38(),yE);K01(S38(),yE);K01(k38(),yE);K01(B38(),yE);K01(P38(),yE);K01(E38(),yE);K01(R38(),yE)});var F38=M1(sO1=>{"use strict";var pBa=sO1&&sO1.__createBinding||(Object.create?(function(e,t,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,a,i)}):(function(e,t,r,a){a===void 0&&(a=r),e[a]=t[r]})),fBa=sO1&&sO1.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&pBa(t,e,r)};Object.defineProperty(sO1,"__esModule",{value:!0});fBa(Z38(),sO1)});var I38=M1(o9=>{"use strict";var vBa=o9&&o9.__createBinding||(Object.create?(function(e,t,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,a,i)}):(function(e,t,r,a){a===void 0&&(a=r),e[a]=t[r]})),mBa=o9&&o9.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),CBa=o9&&o9.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&vBa(t,e,r);return mBa(t,e),t};Object.defineProperty(o9,"__esModule",{value:!0});o9.dispose=o9.Configuration=o9.wrapWithCorrelationContext=o9.startOperation=o9.getCorrelationContext=o9.start=o9.setup=o9.defaultClient=o9.TelemetryClient=o9.DistributedTracingModes=o9.Contracts=void 0;var GV0=E8(),cmt=g38(),MBa=w32();Object.defineProperty(o9,"DistributedTracingModes",{enumerable:!0,get:function(){return MBa.DistributedTracingModes}});var O38=lmt();Object.defineProperty(o9,"TelemetryClient",{enumerable:!0,get:function(){return O38.TelemetryClient}});var xBa=CBa(F38());o9.Contracts=xBa;var LBa=L32();function wBa(e){return o9.defaultClient?o9.defaultClient.pushWarningToLog("Setup has already been called once. To set up a new client, please use TelemetryClient instead."):o9.defaultClient=new O38.TelemetryClient(e,{useGlobalProviders:!0}),d82}o9.setup=wBa;function D38(){try{return o9.defaultClient?o9.defaultClient.initialize():(GV0.diag.setLogger(new GV0.DiagConsoleLogger),GV0.diag.warn("Start cannot be called before setup. Please call setup() first.")),d82}catch(e){GV0.diag.warn(`Failed to start default client: ${LBa.Util.getInstance().dumpObj(e)}`)}}o9.start=D38;function yBa(){return cmt.CorrelationContextManager.getCurrentContext()}o9.getCorrelationContext=yBa;function ABa(e,t){return cmt.CorrelationContextManager.startOperation(e,t)}o9.startOperation=ABa;function zBa(e,t){return cmt.CorrelationContextManager.wrapCallback(e,t)}o9.wrapWithCorrelationContext=zBa;var d82=class e{static setDistributedTracingMode(t){return o9.defaultClient&&(o9.defaultClient.config.distributedTracingMode=t),e}static setAutoCollectConsole(t,r=!1){return o9.defaultClient&&(o9.defaultClient.config.enableAutoCollectExternalLoggers=t,o9.defaultClient.config.enableAutoCollectConsole=r),e}static setAutoCollectExceptions(t){return o9.defaultClient&&(o9.defaultClient.config.enableAutoCollectExceptions=t),e}static setAutoCollectPerformance(t,r){return o9.defaultClient&&(o9.defaultClient.config.enableAutoCollectPerformance=t,o9.defaultClient.config.enableAutoCollectExtendedMetrics=r),e}static setAutoCollectPreAggregatedMetrics(t){return o9.defaultClient&&(o9.defaultClient.config.enableAutoCollectPreAggregatedMetrics=t),e}static setAutoCollectHeartbeat(t){return o9.defaultClient&&(o9.defaultClient.config.enableAutoCollectHeartbeat=t),e}static enableWebInstrumentation(t,r){return o9.defaultClient&&(o9.defaultClient.config.enableWebInstrumentation=t,o9.defaultClient.config.webInstrumentationConnectionString=r),e}static setAutoCollectRequests(t){return o9.defaultClient&&(o9.defaultClient.config.enableAutoCollectRequests=t),e}static setAutoCollectDependencies(t){return o9.defaultClient&&(o9.defaultClient.config.enableAutoCollectDependencies=t),e}static setAutoDependencyCorrelation(t,r){return o9.defaultClient&&(o9.defaultClient.config.enableAutoDependencyCorrelation=t,o9.defaultClient.config.enableUseAsyncHooks=r),e}static setUseDiskRetryCaching(t,r,a){return o9.defaultClient&&(o9.defaultClient.config.enableUseDiskRetryCaching=t,o9.defaultClient.config.enableResendInterval=r,o9.defaultClient.config.enableMaxBytesOnDisk=a),e}static setInternalLogging(t=!1,r=!0){return o9.defaultClient&&(o9.defaultClient.config.enableInternalDebugLogging=t,o9.defaultClient.config.enableInternalWarningLogging=r),e}static setAutoCollectIncomingRequestAzureFunctions(t){return o9.defaultClient&&(o9.defaultClient.config.enableAutoCollectIncomingRequestAzureFunctions=t),e}static setSendLiveMetrics(t=!1){return o9.defaultClient&&(o9.defaultClient.config.enableSendLiveMetrics=t),e}static setAzureMonitorOptions(t){return o9.defaultClient&&(o9.defaultClient.config.azureMonitorOpenTelemetryOptions=t),e}};o9.Configuration=d82;d82.start=D38;function bBa(){o9.defaultClient&&o9.defaultClient.shutdown(),o9.defaultClient=null}o9.dispose=bBa});var N38=M1(FZ=>{"use strict";var SBa=FZ&&FZ.__createBinding||(Object.create?(function(e,t,r,a){a===void 0&&(a=r);var i=Object.getOwnPropertyDescriptor(t,r);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,a,i)}):(function(e,t,r,a){a===void 0&&(a=r),e[a]=t[r]})),HBa=FZ&&FZ.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&SBa(t,e,r)};Object.defineProperty(FZ,"__esModule",{value:!0});FZ.flushAzureMonitor=FZ.shutdownAzureMonitor=FZ.useAzureMonitor=FZ.KnownSeverityLevel=FZ.TelemetryClient=void 0;var kBa=lmt();Object.defineProperty(FZ,"TelemetryClient",{enumerable:!0,get:function(){return kBa.TelemetryClient}});var TBa=Dat();Object.defineProperty(FZ,"KnownSeverityLevel",{enumerable:!0,get:function(){return TBa.KnownSeverityLevel}});var smt=emt();Object.defineProperty(FZ,"useAzureMonitor",{enumerable:!0,get:function(){return smt.useAzureMonitor}});Object.defineProperty(FZ,"shutdownAzureMonitor",{enumerable:!0,get:function(){return smt.shutdownAzureMonitor}});Object.defineProperty(FZ,"flushAzureMonitor",{enumerable:!0,get:function(){return smt.flushAzureMonitor}});HBa(I38(),FZ)});var U38=M1((Tto,BBa)=>{BBa.exports={name:"@uipath/delegate-sdk",version:"0.1.4",description:"UiPath Delegate SDK - Programmatic agent interface",license:"Apache-2.0",type:"commonjs",main:"dist/index.mjs",exports:{".":{import:"./dist/index.mjs"}},publishConfig:{registry:"https://npm.pkg.github.com/"},files:["dist","!dist/sdk.meta.json","README.md","LICENSE"],scripts:{build:"LIB_MODE=1 node esbuild.config.mjs",prepublishOnly:"npm run build",login:"npx tsx scripts/login.ts",start:"node esbuild.config.mjs && node dist/sdk.mjs","start:headless":"node esbuild.config.mjs && node dist/sdk.mjs --disable-computer-use --disable-connections",continue:"node esbuild.config.mjs && node dist/sdk.mjs --continue","start:tools":"ENTRY=examples/with-tools.ts node esbuild.config.mjs && node dist/sdk.mjs","start:eval":"ENTRY=examples/eval.ts node esbuild.config.mjs && node dist/sdk.mjs","start:dev":"node --require ./register.cjs --import tsx --import ./esm-register.mjs examples/basic.ts",test:"node --require ./register.cjs --import tsx --import ./esm-register.mjs src/test.ts",bundle:"node esbuild.config.mjs","bundle:eval":"ENTRY=examples/eval.ts node esbuild.config.mjs",smoke:"ENTRY=examples/smoke.ts node esbuild.config.mjs && node dist/sdk.mjs","smoke:executor":"ENTRY=examples/smoke-executor.ts node esbuild.config.mjs && node dist/sdk.mjs","start:executor":"ENTRY=execution-layer/scripts/run-executor.ts node esbuild.config.mjs && node dist/sdk.mjs","test:cli":"ENTRY=examples/integration-test.ts node esbuild.config.mjs && node dist/sdk.mjs","publish:internal":"npm publish --@uipath:registry=https://npm.pkg.github.com/ --ignore-scripts","publish:npmjs":"npm publish --@uipath:registry=https://registry.npmjs.org/ --access public --ignore-scripts"},dependencies:{"@napi-rs/canvas":"^0.1.65",jszip:"^3.10.1",loglevel:"^1.9.2",pathe:"^2.0.3","tsconfig-paths":"^4.2.0",uuid:"^10.0.0",zod:"3.25.76","zod-to-json-schema":"^3.25.1"},optionalDependencies:{"@uipath/delegate-runtime-darwin-arm64":"0.1.4","@uipath/delegate-runtime-win32-x64":"0.1.4","@uipath/delegate-runtime-linux-x64":"0.1.4"},devDependencies:{"@types/node":"^22.0.0",tsx:"^4.21.0",typescript:"^5.6.0"}}});var DM6=w4(eU2());hv0();wd();Y_();oB();l61();J11();sL1();lo2();a7();xU2();C21();hL1();Q11();uL1();ZO();VT();import{EventEmitter as jRr}from"events";QH();mj();GW2();TS();function iM6(e){if(typeof e!="object"||e===null)return;let t=e.response;if(typeof t!="object"||t===null)return;let r=t.data;if(typeof r!="object"||r===null)return;let a=r;if(a.success===!1&&!(a.error!==void 0&&typeof a.error!="string")&&!(a.errorCode!==void 0&&typeof a.errorCode!="string")&&!(a.category!==void 0&&typeof a.category!="string")&&!(a.retryable!==void 0&&typeof a.retryable!="boolean"))return a}function gU(e,t,r){let a=e.error??`Unknown error from ${t}`;if(r?.includePdfErrors){let n=ho3(e.errorCode);if(n===Jm.MaxPagesExceeded)throw new UW2(e.pageCount??0,a);if(n)throw new Mc1(n,a)}let i=MQ(e.errorCode);if(i){let o=e.totalLines!==void 0||e.category!==void 0||e.retryable!==void 0?{...e.totalLines!==void 0?{totalLines:e.totalLines}:{},...e.category!==void 0?{accessCategory:e.category}:{},...e.retryable!==void 0?{retryable:e.retryable}:{}}:void 0;throw new Yc(i,a,o)}throw new Error(a)}function yb2(e,t){return t?(t.throwIfAborted(),new Promise((r,a)=>{let i=()=>a(t.reason);t.addEventListener("abort",i,{once:!0}),e.then(r,a).finally(()=>t.removeEventListener("abort",i))})):e}var Ni1=class e{constructor(t,r,a){this.toolsUrlProvider=t;this.getHttpClient=r;this.getAuthProvider=a}static{this.governedEndpointPrefixes=["bash/execute","download","excel","file","office","pdf","powershell/execute","ppt","recorded-task","word"]}async post(t,r,a){let i=await this.postRaw(t,r,a);if(!i.success)throw new Error(i.error??`Unknown error from ${t}`);return i}async postRaw(t,r,a,i){this.assertCompleteContext(t,a);let n=this.getHttpClient(),o=this.getAuthProvider(),u=`${this.toolsUrlProvider.getToolsUrl(NF(a))}/${t}`,g=await yb2(a?s9(o,a):wk1(o,"",""),i),f;try{f=await n.post(u,r,g,void 0,i)}catch(v){let C=iM6(v);if(!C)throw v;f=C}if(!f)throw new Error(`No response from ${t}`);return f}async get(t,r){this.assertCompleteContext(t,r);let a=this.getHttpClient(),i=this.getAuthProvider(),o=`${this.toolsUrlProvider.getToolsUrl(NF(r))}/${t}`,h=r?await s9(i,r):await wk1(i,"",""),u=await a.get(o,h);if(!u)throw new Error(`No response from ${t}`);return u}assertCompleteContext(t,r){let a=t.replace(/^\/+/,"").toLowerCase();if((e.governedEndpointPrefixes.some(n=>a===n||a.startsWith(`${n}/`))||r)&&!r?.turnPolicySnapshot)throw new Error("A turn policy snapshot is required for governed interop access.")}};var $Er=120,Gt2=class extends Ni1{constructor(r,a,i,n){super(r,a,i);this.pathsResolver=n}supportsAbortSignal=!0;platformPromise=null;homeDirPromise=null;async execute(r,a,i){i?.throwIfAborted();let n=await yb2(this.getPlatform(),i);i?.throwIfAborted();let o=n==="windows"?"powershell/execute":"bash/execute",h={command:r,timeoutSeconds:a?.timeoutSeconds??$Er,captureOutput:a?.captureOutput??!0,variables:a?.variables??{}};a?.workingDirectory&&(h.workingDirectory=a.workingDirectory),a?.environmentProfile&&(h.environmentProfile=a.environmentProfile),a?.elevationToken&&(h.elevationApproved=!0,h.elevationToken=a.elevationToken);let u=await this.postRaw(o,h,a?.requestContext,i);return KEr(u)}async getPlatform(){return this.platformPromise||(this.platformPromise=this.get("health/details").then(r=>r.platform==="Win32NT"?"windows":"unix").catch(()=>(this.platformPromise=null,this.fallbackPlatform()))),this.platformPromise}async getHomeDirectory(){return this.homeDirPromise||(this.homeDirPromise=this.resolveHomeDirectory().catch(r=>{throw this.homeDirPromise=null,r})),this.homeDirPromise}async resolveHomeDirectory(){if(this.pathsResolver)try{let a=await this.pathsResolver.resolve();if(a.homeDir)return a.homeDir}catch{}try{let a=await this.post("system/info",{query:"os"});if(a.homeDirectory)return a.homeDirectory}catch{}return await this.getPlatform()==="windows"?"C:\\Users":"/home"}fallbackPlatform(){if(typeof globalThis.navigator<"u"){let r=globalThis.navigator?.userAgent?.toLowerCase()??"";if(r.includes("windows"))return"windows";if(r)return"unix"}return typeof process<"u"&&process.platform&&process.platform==="win32"?"windows":"unix"}};function KEr(e){return{stdout:e.output??"",stderr:e.errorOutput??"",exitCode:e.exitCode,error:e.error,executionTimeMs:e.executionTimeMs,workingDirectory:e.workingDirectory,sandbox:YEr(e)}}function YEr(e){if(!(e.blockedBySandbox===!0||(e.warnings?.length??0)>0||e.isolationDegraded===!0))return;let r=e.validationResult;return{blocked:e.blockedBySandbox===!0,...e.blockedBySandbox===!0?{denialSource:e.denialSource==="OperatingSystem"?"operating_system":"harness_policy"}:{},canElevate:r?.canRequestElevation??!1,reason:r?.reason,suggestedElevationReason:r?.suggestedElevationReason,requiresAdmin:r?.requiresAdmin,warnings:e.warnings,isolationDegraded:e.isolationDegraded,degradationReason:e.degradationReason}}tF4();S90();wQ();U4t();uz();var lM6=(i=>(i[i.SILENT=0]="SILENT",i[i.ERROR=1]="ERROR",i[i.INFO=2]="INFO",i[i.VERBOSE=3]="VERBOSE",i))(lM6||{}),CZ1=typeof process<"u"&&process.stdout?.isTTY===!0,rx={dim:CZ1?"\x1B[2m":"",bold:CZ1?"\x1B[1m":"",red:CZ1?"\x1B[31m":"",yellow:CZ1?"\x1B[33m":"",cyan:CZ1?"\x1B[36m":"",green:CZ1?"\x1B[32m":"",reset:CZ1?"\x1B[0m":""};function nM6(e,t){return e.length<=t?e:e.slice(0,t)+`... (${e.length} chars)`}function oM6(){let e=new Date,t=String(e.getHours()).padStart(2,"0"),r=String(e.getMinutes()).padStart(2,"0"),a=String(e.getSeconds()).padStart(2,"0");return`${t}:${r}:${a}`}var Ab2=class{level;maxArgLength;maxResultLength;timestamps;output;streamingType=null;streamBuffer="";constructor(t){this.level=t.level,this.maxArgLength=t.maxArgLength??200,this.maxResultLength=t.maxResultLength??300,this.timestamps=t.timestamps??!0,this.output=t.output??(r=>console.log(r))}handleEvent(t){switch(t.type){case"session_start":this.level>=2&&this.log(`${rx.cyan}[session]${rx.reset} ${t.sessionId||"unknown"}`);break;case"thinking":this.level>=3&&this.stream("thinking",`${rx.dim}[thinking]${rx.reset} `,t.content||"");break;case"tool_call":if(this.level>=2&&(this.log(`${rx.cyan}[tool_call]${rx.reset} ${rx.bold}${t.toolName}${rx.reset}`),t.toolArgs)){let r=this.level>=3?1/0:this.maxArgLength,a=r===1/0?JSON.stringify(t.toolArgs,null,2):nM6(JSON.stringify(t.toolArgs),r);this.log(` ${rx.dim}args: ${a}${rx.reset}`)}break;case"tool_result":{if(this.level>=2){let r=t.toolStatus==="failed"||t.toolStatus==="interrupted",a=r?`${rx.red}[tool_failure]${rx.reset}`:`${rx.green}[tool_result]${rx.reset}`;if(this.log(`${a} ${rx.bold}${t.toolName}${rx.reset} (${t.toolStatus||"completed"})`),t.toolResult!=null){let i=typeof t.toolResult=="string"?t.toolResult:JSON.stringify(t.toolResult,null,2),n=r||this.level>=3?1/0:this.maxResultLength,o=n===1/0?i:nM6(i,n),h=r?rx.red:rx.dim;this.log(` ${h}result: ${o}${rx.reset}`)}}break}case"message":this.level>=2&&this.stream("message",`${rx.yellow}[agent]${rx.reset} `,t.content||"");break;case"done":this.level>=2&&this.log(`${rx.green}[done]${rx.reset} session: ${t.sessionId||"unknown"}`);break;case"error":this.level>=1&&this.log(`${rx.red}[error]${rx.reset} ${t.error||t.content||"Unknown error"}`);break}}stream(t,r,a){if(this.streamingType&&this.streamingType!==t&&this.endStream(),this.streamingType)this.streamBuffer+=a;else{let i=this.timestamps?`${rx.dim}[${oM6()}]${rx.reset} `:"";this.streamBuffer=`${i}${r}${a}`,this.streamingType=t}}endStream(){this.streamingType&&(this.output(this.streamBuffer),this.streamBuffer="",this.streamingType=null)}log(t){this.endStream();let r=this.timestamps?`${rx.dim}[${oM6()}]${rx.reset} `:"";this.output(`${r}${t}`)}};function cM6(e){if(e===!0)return 2;if(e===!1)return 0;switch(e){case"error":return 1;case"info":return 2;case"verbose":return 3;default:return 0}}TS();import MZ1 from"fs";import XEr from"node:path";function _et(e){if(typeof global.requestAnimationFrame>"u"&&(global.requestAnimationFrame=r=>setTimeout(r,0),global.cancelAnimationFrame=r=>clearTimeout(r)),typeof window<"u"&&typeof document<"u"){typeof localStorage<"u"&&localStorage.setItem("UIPATH_AUTOPILOT_CHAT_URL",e);return}global.navigator=global.navigator||{userAgent:process.platform==="win32"?"Windows":"node",platform:process.platform==="darwin"?"MacIntel":process.platform==="win32"?"Win32":"Linux x86_64"},global.document=global.document||{createElement:()=>({appendChild:()=>{},setAttribute:()=>{},style:{},classList:{add:()=>{},remove:()=>{}}}),body:{appendChild:()=>{},classList:{add:()=>{},remove:()=>{},toString:()=>""}},documentElement:{lang:"en"},getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],addEventListener:()=>{},removeEventListener:()=>{}},global.localStorage=global.localStorage||{_data:{},getItem(r){return this._data[r]||null},setItem(r,a){this._data[r]=a},removeItem(r){delete this._data[r]},clear(){this._data={}}};let t=new URL(e);global.window=global.window||{dispatchEvent:()=>{},addEventListener:()=>{},removeEventListener:()=>{},document:global.document,localStorage:global.localStorage,setTimeout:globalThis.setTimeout,clearTimeout:globalThis.clearTimeout,setInterval:globalThis.setInterval,clearInterval:globalThis.clearInterval,fetch:globalThis.fetch,PortalShell:{initialize:()=>{}},location:{href:e,hostname:"sdk.local",protocol:t.protocol,host:t.host,port:t.port,pathname:"/",search:"",hash:""},navigator:{userAgent:"node"},secureStoreApi:{getToolSettings:async()=>null,setToolSettings:async()=>{},getToolExecutionPolicy:async()=>null,setToolExecutionPolicy:async()=>{},getSecuritySettings:async()=>null,setSecuritySettings:async()=>{},onSettingsChanged:()=>()=>{}},settingsApi:{getAppSettings:async()=>({}),setAppSettings:async()=>{},onSettingsChanged:()=>()=>{}},fsServiceApi:{readFile:async(r,a)=>{let i;try{i=MZ1.statSync(r)}catch(h){throw h.code==="ENOENT"?new Yc(Xn.FileNotFound,`File not found: ${r}`):h}let n=a?.encoding??"utf-8",o={mtimeMs:i.mtimeMs,sizeBytes:i.size};return n==="binary"?{...o,bytes:new Uint8Array(MZ1.readFileSync(r)),encoding:n}:{...o,content:MZ1.readFileSync(r,n),encoding:n}},writeFile:async(r,a)=>{let i=XEr.dirname(r);MZ1.mkdirSync(i,{recursive:!0}),MZ1.writeFileSync(r,a,"utf-8")},exists:async r=>MZ1.existsSync(r),stat:async r=>{let a;try{a=MZ1.statSync(r)}catch(i){throw i.code==="ENOENT"?new Yc(Xn.FileNotFound,`File not found: ${r}`):i}return{isFile:a.isFile(),isDirectory:a.isDirectory(),isSymbolicLink:a.isSymbolicLink(),sizeBytes:a.size,mtimeMs:a.mtimeMs,birthtimeMs:a.birthtimeMs}}}},localStorage.setItem("UIPATH_AUTOPILOT_CHAT_URL",e)}var dM6=w4(Km());fj();wd();Y_();U0t();uz();var hM6=w4(Km());z_1();var JEr="delegate-headless-global",sM6=0,QEr="delegate-headless",tRr="delegate-headless-user",eRr=1e4;function rRr(e){if(e===null||typeof e!="object")return!1;let t=e.selection;return t!==null&&typeof t=="object"&&t.kind==="selected"}function aRr(e){return Object.freeze({...e,account:Object.freeze({...e.account}),scope:Object.freeze({...e.scope}),grants:Object.freeze([...e.grants]),denies:Object.freeze([...e.denies]),resources:Object.freeze({...e.resources}),sandboxGeneration:Object.freeze({...e.sandboxGeneration})})}var xZ1=class{constructor(t){this.authProvider=t;this.generation={generationId:JEr,policyVersion:sM6,createdAt:new Date().toISOString()}}generation;async compose(t,r){let[a,i,n]=await Promise.all([this.authProvider.getUserId(),this.authProvider.getOrganizationId(),this.authProvider.getTenantId()]);if(!i)return{kind:"denied",code:"missing_snapshot",retryable:!0,message:"Headless turn policy requires an organization id from the auth provider"};let o={userId:a||tRr,organizationId:i,tenantId:n||null};return{kind:"selected",snapshot:aRr({snapshotId:(0,hM6.v4)(),rootTurnId:r,installationId:QEr,account:o,scope:{kind:"global"},baseline:"legacy_global",grants:[],denies:[],resources:{},policyVersion:sM6,sandboxGeneration:this.generation})}}},LZ1=class{constructor(t,r){this.httpClient=t;this.interopUrl=r}async register(t,r){let a={snapshot:r},i=await this.httpClient.post(`${this.interopUrl}${yv.turnPolicySnapshots}`,a,void 0,eRr);if(!rRr(i))throw new Error("Interop rejected the headless turn policy snapshot registration")}async deactivate(t,r){await this.httpClient.post(`${this.interopUrl}${z90(r)}`)}};function uM6(e){let t=new b42(new xZ1(e.authProvider),new LZ1(e.httpClient,e.interopUrl),r=>st.getState().sessions[r]?.parentSessionId,()=>({kind:"global"}));jl0({getSnapshot:r=>t.getSnapshot(r),getSelection:r=>t.getSelection(r),getRootTurnId:r=>t.getRootTurnId(r),getSnapshotForExecution:r=>{let a=A7.getState().selectSessionId(r);return a?t.getSnapshot(a):void 0},beginRootTurn:r=>t.beginRootTurn(r),endRootTurn:(r,a)=>t.endRootTurn(r,a)})}var gM6="sdk-ambient",Ret={},Eet;function pM6(){return Ret}async function fM6(e){await Zet();try{let r=await new xZ1(e.authProvider).compose({kind:"global"},`sdk-ambient-${(0,dM6.v4)()}`);if(r.kind!=="selected")return console.warn(`[DelegateAgent] Ambient turn policy snapshot unavailable: ${r.message}`),!1;let a=new LZ1(e.httpClient,e.interopUrl);return await a.register(gM6,r.snapshot),Eet={snapshotId:r.snapshot.snapshotId,registrar:a},Ret[Lk1]=g31(r.snapshot),!0}catch(t){return console.warn(`[DelegateAgent] Ambient turn policy snapshot registration failed: ${t instanceof Error?t.message:String(t)}`),!1}}async function Zet(){delete Ret[Lk1];let e=Eet;if(Eet=void 0,!!e)try{await e.registrar.deactivate(gM6,e.snapshotId)}catch{}}var Fet=w4(cr1()),zb2={},bb2=[],Jy1=null,Ux0=null;function iRr(e){if(typeof e=="string")return e;if(e instanceof URL)return e.href;let t=e;return typeof t.url=="string"?t.url:null}function nRr(e,t){if(t?.headers!==void 0)return t.headers;let r=e;if(typeof r=="object"&&r!==null&&typeof r.headers?.forEach=="function")return r.headers}function oRr(e){if(Ux0===null)return!1;let t=iRr(e);if(t===null)return!1;try{return new URL(t).origin===Ux0}catch{return!1}}function lRr(){if(Jy1!==null)return;Jy1=globalThis.fetch.bind(globalThis);let e=(r,a)=>{if(!oRr(r))return Jy1(r,a);let i=new Headers(nRr(r,a));for(let[n,o]of Object.entries(zb2))i.set(n,o);return Jy1(r,{...a,headers:i})};globalThis.fetch=e;let t=globalThis.window;t&&(t.fetch=e)}function cRr(e){if(!e)return null;try{return new URL(e).origin}catch{return null}}function vM6(e,t){Ux0=cRr(t);let r=Fet.default.defaults.headers.common;for(let a of bb2)delete r[a];zb2={...e??{}},bb2=Object.keys(zb2);for(let[a,i]of Object.entries(zb2))r[a]=i;bb2.length>0&&lRr()}function Oet(){let e=Fet.default.defaults.headers.common;for(let t of bb2)delete e[t];if(zb2={},bb2=[],Ux0=null,Jy1!==null){globalThis.fetch=Jy1;let t=globalThis.window;t&&(t.fetch=Jy1),Jy1=null}}import{spawn as sRr}from"child_process";import*as pU from"fs";import*as MM6 from"net";import*as xM6 from"os";import*as j61 from"node:path";var LM6=j61.join(xM6.homedir(),".delegate-sdk"),Det=j61.join(LM6,"interop.pid"),mM6=3e4,hRr=250,CM6=2e3,dRr={"darwin-arm64":"@uipath/delegate-runtime-darwin-arm64","win32-x64":"@uipath/delegate-runtime-win32-x64","linux-x64":"@uipath/delegate-runtime-linux-x64"};function uRr(e){return dRr[e]}var jt2=class e{child;spawnedPort;async start(t={}){let r=await this.tryAttachToRunning();if(r)return{url:`http://localhost:${r.port}`,reused:!0};let a=this.resolveBinary();await this.unquarantineMac(a),this.ensureExecutable(a);let i=e.rgBinaryPath();i&&this.ensureExecutable(i);let n=await fRr(),o=t.keepAlive===!0;this.child=sRr(a,[`--urls=http://localhost:${n}`],{stdio:o?"ignore":["ignore","pipe","pipe"],detached:o,env:{...process.env,ASPNETCORE_ENVIRONMENT:"Production"}}),this.spawnedPort=n,o&&this.child.unref(),o||(this.child.stderr?.on("data",h=>{process.stderr.write(`[interop] ${h.toString()}`)}),this.child.on("exit",(h,u)=>{h!==0&&h!==null&&process.stderr.write(`[interop] exited with code ${h} (signal ${u})
|
|
12295
12295
|
`)}));try{await vRr(`http://localhost:${n}/health`)}catch(h){try{this.child.kill("SIGKILL")}catch{}throw this.child=void 0,this.spawnedPort=void 0,h}return this.writePidFile({pid:this.child.pid,port:n,startedAt:new Date().toISOString()}),{url:`http://localhost:${n}`,reused:!1}}async stop(t={}){if(this.child){await gRr(this.child,CM6),this.child=void 0,this.spawnedPort=void 0,this.removePidFile();return}if(!t.force)return;let r=this.readPidFile();if(!r)return;if(!await Iet(`http://localhost:${r.port}/health`)){this.removePidFile();return}await pRr(r.pid,CM6),this.removePidFile()}async tryAttachToRunning(){let t=this.readPidFile();return t?Gx0(t.pid)?await Iet(`http://localhost:${t.port}/health`)?t:null:(this.removePidFile(),null):null}resolveBinary(){let t=process.platform==="win32"?"UiPath.Aria.ComputerUse.Api.exe":"UiPath.Aria.ComputerUse.Api",r=j61.join(e.resolveInteropDir(),t);if(!pU.existsSync(r))throw new Error(`Interop binary not found at ${r}`);return r}static resolveInteropDir(){let t=`${process.platform}-${process.arch}`,r=uRr(t);if(!r)throw new Error(`Unsupported platform ${t}. Supported: darwin-arm64, win32-x64, linux-x64.`);let a;try{a=Z4.resolve(`${r}/package.json`)}catch{throw new Error(`Missing native runtime package "${r}". Reinstall with: npm install @uipath/delegate-sdk`)}return j61.join(j61.dirname(a),"interop")}static rgBinaryPath(){let t;try{t=e.resolveInteropDir()}catch{return}let r=process.platform==="win32",a=(r?j61.win32:j61.posix).join(t,r?"rg.exe":"rg");return pU.existsSync(a)?a:void 0}ensureExecutable(t){if(process.platform!=="win32")try{let r=pU.statSync(t);(r.mode&73)===0&&pU.chmodSync(t,r.mode|493)}catch(r){throw new Error(`Cannot chmod +x ${t}: ${r.message}`)}}async unquarantineMac(t){if(process.platform!=="darwin")return;let{execFile:r}=await import("child_process"),{promisify:a}=await import("util");try{await a(r)("xattr",["-d","com.apple.quarantine",t])}catch{}}readPidFile(){try{return JSON.parse(pU.readFileSync(Det,"utf-8"))}catch{return null}}writePidFile(t){pU.mkdirSync(LM6,{recursive:!0}),pU.writeFileSync(Det,JSON.stringify(t,null,2))}removePidFile(){try{pU.rmSync(Det)}catch{}}};function jx0(e,t){if(process.platform==="linux")try{process.kill(-e,t);return}catch{}try{process.kill(e,t)}catch{}}async function gRr(e,t){if(e.exitCode!==null||e.signalCode!==null)return;let r=e.pid,a=new Promise(n=>e.once("exit",()=>n()));if(r!=null)jx0(r,"SIGTERM");else try{e.kill("SIGTERM")}catch{}if(!await Promise.race([a.then(()=>!0),Sb2(t).then(()=>!1)])){if(r!=null)jx0(r,"SIGKILL");else try{e.kill("SIGKILL")}catch{}await Promise.race([a,Sb2(1e3)])}}async function pRr(e,t){if(!Gx0(e))return;jx0(e,"SIGTERM");let r=Date.now();for(;Date.now()-r<t;){if(!Gx0(e))return;await Sb2(100)}jx0(e,"SIGKILL");let a=Date.now();for(;Date.now()-a<1e3;){if(!Gx0(e))return;await Sb2(50)}}function fRr(){return new Promise((e,t)=>{let r=MM6.createServer();r.unref(),r.on("error",t),r.listen(0,()=>{let a=r.address().port;r.close(()=>e(a))})})}function Gx0(e){try{return process.kill(e,0),!0}catch(t){return t.code==="EPERM"}}async function Iet(e){try{return(await fetch(e,{signal:AbortSignal.timeout(1e3)})).ok}catch{return!1}}async function vRr(e){let t=Date.now();for(;Date.now()-t<mM6;){if(await Iet(e))return;await Sb2(hRr)}throw new Error(`Interop health check timed out after ${mM6}ms (${e})`)}var Sb2=e=>new Promise(t=>setTimeout(t,e));import*as Wx0 from"fs";import*as Hb2 from"node:path";function wM6(e){let t=[];e&&t.push(e);let r=process.env.DELEGATE_BUNDLED_SKILLS_PATH;r&&t.push(r),t.push(...CRr());let a=new Set,i=[];for(let n of t){if(!Wx0.existsSync(n))continue;let o=mRr(n);a.has(o)||(a.add(o),i.push(n))}return i}function mRr(e){try{return Wx0.realpathSync(e)}catch{return Hb2.resolve(e)}}function CRr(){if(process.platform==="darwin")return["/Applications/UiPath Delegate.app/Contents/Resources/skills","/Applications/UiPath Assistant.app/Contents/Resources/skills"];if(process.platform==="win32"){let e=[],t=process.env.LOCALAPPDATA;t&&e.push(Hb2.join(t,"Programs","UiPath","UiPath.Delegate","resources","skills"));let r=process.env.PROGRAMFILES;return r&&e.push(Hb2.join(r,"UiPath","UiPath.Delegate","resources","skills")),e}return[]}function AM6(e){return e==="windows"?";":":"}function Net(e){if(!Array.isArray(e))return[];let t=[];for(let r of e){if(typeof r!="string")continue;let a=r.trim();a.length>0&&t.push(a)}return t}function yM6(e,t){let r=e.length;for(;r>0&&(e[r-1]==="/"||e[r-1]==="\\");)r--;let a=e.slice(0,r);return t==="windows"?a.toLowerCase():a}function MRr(e,t,r){let a=AM6(r);if(t.length===0)return e.join(a);let i=new Set(e.map(o=>yM6(o,r))),n=t.split(a).filter(o=>o.length===0||!i.has(yM6(o,r)));return[...e,...n].join(a)}function qx0(e,t){let r=Net(e);if(r.length===0)return{getEnv:async()=>({})};let a=process.platform==="win32"?"windows":"unix",i={PATH:MRr(r,process.env.PATH??"",a)};return t?.(`[shellPathPrepend] PATH prepend active: ${r.join(AM6(a))}`),{getEnv:async()=>i}}a7();ZO();hG2();tc1();ic1();I04();TS();t21();uz();import Pb2 from"os";import Wet from"node:path";import ARr from"https";var Bb2=w4(GA2());import*as wZ1 from"fs";import*as zM6 from"https";import*as gD from"fs";import*as Wt2 from"node:path";function kb2(e,t){let r=Wt2.dirname(e),a=Wt2.join(r,`.${Wt2.basename(e)}.${process.pid}.${Date.now()}.tmp`),i=gD.openSync(a,"wx",384);try{gD.writeFileSync(i,t),gD.fchmodSync(i,384),gD.fsyncSync(i)}catch(n){gD.closeSync(i);try{gD.unlinkSync(a)}catch{}throw n}gD.closeSync(i);try{gD.renameSync(a,e)}catch(n){try{gD.unlinkSync(a)}catch{}throw n}}var Uet="1119a927-10ab-4543-bd1a-ad6bfbbc27f4";function $x0(e){let t=e?.trim();return t||void 0}function Qy1(e={},t=process.env){let r=$x0(e.clientId)??$x0(t.UIPATH_CLIENT_ID),a=$x0(e.clientSecret),i=a??$x0(t.UIPATH_CLIENT_SECRET);if(i&&!r)throw new Error("A client secret was supplied without a client id. The built-in SDK client is a public (PKCE) client and has no secret \u2014 set UIPATH_CLIENT_ID (or auth.clientId) to your own confidential client, or drop the secret.");if(r===Uet&&i){if(a)throw new Error("A client secret was supplied for the built-in SDK client, which is a public (PKCE) client with no secret. Set clientId to your own confidential client, or drop the secret.");return{clientId:Uet}}return i?{clientId:r,clientSecret:i}:{clientId:r??Uet}}function tA1(e){return e.clientSecret?{client_id:e.clientId,client_secret:e.clientSecret}:{client_id:e.clientId}}var Kx0=Bb2.join(process.env.HOME||process.env.USERPROFILE||"",".aria","sdk-auth.json"),xRr=Bb2.join(process.env.HOME||process.env.USERPROFILE||"",".aria","auth.json"),Tb2=null;function LRr(e,t){return new Promise((r,a)=>{let i=new URL(e),n=zM6.request({hostname:i.hostname,port:443,path:i.pathname,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","Content-Length":Buffer.byteLength(t)}},o=>{let h="";o.on("data",u=>h+=u),o.on("end",()=>{if(o.statusCode&&o.statusCode>=200&&o.statusCode<300)try{r(JSON.parse(h))}catch{r(h)}else a(new Error(`HTTP ${o.statusCode}: ${h}`))})});n.on("error",a),n.write(t),n.end()})}function Yx0(e){if(!e.expiresAt)return!1;let t=Math.floor(Date.now()/1e3),r=e.expiresAt-t;return r<=0?!0:e.expiresIn&&e.expiresIn>0?r<e.expiresIn*.3:r<300}async function Xx0(e){return e.refreshToken?e.baseUrl?Tb2||(Tb2=(async()=>{try{let t=`${e.baseUrl}/identity_/connect/token`,r=Qy1({clientId:e.clientId}),a=new URLSearchParams({grant_type:"refresh_token",refresh_token:e.refreshToken,...tA1(r)}).toString(),i=await LRr(t,a);if(!i.access_token)return console.error("[SDK Auth] Refresh failed: no access_token in response"),null;let n=JSON.parse(Buffer.from(i.access_token.split(".")[1],"base64").toString()),o={...e,accessToken:i.access_token,refreshToken:i.refresh_token||e.refreshToken,expiresAt:n.exp||Math.floor(Date.now()/1e3)+i.expires_in,expiresIn:i.expires_in,clientId:r.clientId};return qt2(o),console.log("[SDK Auth] Token refreshed successfully"),o}catch(t){return t.message?.includes("invalid_grant")?console.error("[SDK Auth] Refresh token invalid/expired. Please run: npm run login"):console.error("[SDK Auth] Token refresh failed:",t.message),null}finally{Tb2=null}})(),Tb2):(console.error("[SDK Auth] Saved auth has no baseUrl \u2014 cannot refresh. Re-run `delegate-cli login --env <alpha|staging|production>`."),null):(console.error("[SDK Auth] No refresh token available"),null)}function qt2(e){try{let t=Bb2.dirname(Kx0);wZ1.existsSync(t)||wZ1.mkdirSync(t,{recursive:!0}),kb2(Kx0,JSON.stringify(e,null,2))}catch(t){console.error("[SDK Auth] Failed to save auth data:",t)}}async function wRr(){for(let e of[Kx0,xRr])if(wZ1.existsSync(e))try{let t=JSON.parse(wZ1.readFileSync(e,"utf-8"));if(!t.accessToken||!t.tenantId||!t.organizationId)continue;let r={accessToken:t.accessToken,refreshToken:t.refreshToken,expiresAt:t.expiresAt,expiresIn:t.expiresIn,organizationId:t.organizationId,orgLogicalName:t.orgLogicalName,tenantId:t.tenantId,tenantName:t.tenantName,baseUrl:t.baseUrl,clientId:t.clientId};if(!Yx0(r))return r;console.log("[SDK Auth] Token expired, attempting refresh...");let a=await Xx0(r);if(a)return a;console.log(`[SDK Auth] Refresh failed for ${e}, trying next...`)}catch{}return null}function yZ1(){return Kx0}WN();import Get from"fs";import yRr from"node:path";import IFn from"os";var jet=new Map;function W61(e){let t=jet.get(e);return t||(t={planningPhase:"idle",planFilePath:"",currentStepNumber:0,progressContent:"",planContent:""},jet.set(e,t)),t}var Vb2={getPlanningPhase(e){return W61(e).planningPhase},enterPlanningMode(e,t){let r=W61(e);r.planningPhase="planning",r.planFilePath=t,r.currentStepNumber=0,r.progressContent="",r.planContent=""},setPendingPlan(e,t){W61(e).planningPhase="awaiting_approval"},approvePlan(e){let t=W61(e);t.planningPhase="executing",t.currentStepNumber=1},rejectPlan(e){W61(e).planningPhase="idle"},applyProgressEdit(e,t,r){let a=W61(e);r!==void 0&&(a.currentStepNumber=r),t.mode==="append"?a.progressContent+=t.new_string:t.mode==="replace"&&t.old_string&&(a.progressContent=a.progressContent.replace(t.old_string,t.new_string))},updateProgress(e,t){W61(e).currentStepNumber=t},completePlan(e){let t=W61(e);t.planningPhase="idle"},writePlan(e,t){let r=W61(e);r.planContent=t;let a=r.planFilePath;if(a)try{let i=yRr.dirname(a);Get.mkdirSync(i,{recursive:!0}),Get.writeFileSync(a,t,"utf-8")}catch(i){console.error("[SdkLocalSessionStore] Failed to write plan file:",a,i)}},addPendingUserQuestionSet(e,t){},cancelPendingUserQuestionSet(e,t){},getPendingUserQuestionSet(e,t){},subscribePendingUserQuestionSet(e,t,r){return()=>{}}};function bM6(e){let t=jet.get(e);if(t?.planContent)return t.planContent;if(t?.planFilePath)try{return Get.readFileSync(t.planFilePath,"utf-8")}catch{}}function Jx0(e){return W61(e).planningPhase}function SM6(e){return W61(e)}Q90();var $t2=class{config;refreshInProgress=null;constructor(t){this.config=t}updateToken(t){this.config.accessToken=t}updateConfig(t){this.config={...this.config,...t}}isTokenExpired(){if(!this.config.expiresAt)return!1;let t=Math.floor(Date.now()/1e3);return this.config.expiresAt-60<t}getRefreshToken(){return this.config.refreshToken}async refreshAccessToken(){if(!this.config.refreshToken)return console.error("[TokenAuthProvider] No refresh token available"),null;let t=this.config.baseUrl||this.config.environment;return t?this.refreshInProgress?this.refreshInProgress:(this.refreshInProgress=(async()=>{try{let r=`${t}/identity_/connect/token`,a=Qy1({clientId:this.config.clientId,clientSecret:this.config.clientSecret}),i=new URLSearchParams({grant_type:"refresh_token",refresh_token:this.config.refreshToken,...tA1(a)}).toString(),n=await this.httpsPost(r,i);if(!n.access_token)return console.error("[TokenAuthProvider] Refresh failed: no access_token in response"),null;let o=JSON.parse(Buffer.from(n.access_token.split(".")[1],"base64").toString());this.config.accessToken=n.access_token,this.config.refreshToken=n.refresh_token||this.config.refreshToken,this.config.expiresAt=o.exp||Math.floor(Date.now()/1e3)+n.expires_in;let h={accessToken:this.config.accessToken,refreshToken:this.config.refreshToken,expiresAt:this.config.expiresAt,expiresIn:n.expires_in,organizationId:this.config.organizationId,tenantId:this.config.tenantId,baseUrl:this.config.baseUrl||this.config.environment,clientId:a.clientId};return qt2(h),console.log("[TokenAuthProvider] Token refreshed successfully"),this.config.accessToken}catch(r){return r.message?.includes("invalid_grant")?console.error("[TokenAuthProvider] Refresh token invalid/expired. Please run: npm run login"):console.error("[TokenAuthProvider] Token refresh failed:",r.message),null}finally{this.refreshInProgress=null}})(),this.refreshInProgress):(console.error("[TokenAuthProvider] No baseUrl (or environment) in the auth config \u2014 cannot refresh token"),null)}httpsPost(t,r){return new Promise((a,i)=>{let n=new URL(t),o=ARr.request({hostname:n.hostname,port:443,path:n.pathname,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","Content-Length":Buffer.byteLength(r)}},h=>{let u="";h.on("data",g=>u+=g),h.on("end",()=>{if(h.statusCode&&h.statusCode>=200&&h.statusCode<300)try{a(JSON.parse(u))}catch{a(u)}else i(new Error(`HTTP ${h.statusCode}: ${u}`))})});o.on("error",i),o.write(r),o.end()})}async getAccessToken(){return`Bearer ${this.config.accessToken}`}async getIdToken(){}async getOrganizationUrl(){return this.config.organizationUrl||""}async getTenantName(){return this.config.tenantName||""}async getUserId(){return this.config.userId||""}async getUserName(){return this.config.userName||""}async getUserEmail(){return this.config.userEmail||""}async getTenantId(){return this.config.tenantId}async getOrganizationId(){return this.config.organizationId}async getOrganizationName(){return this.config.organizationName||""}async getEnvironment(){return this.config.environment||"http://localhost:5002"}async getAccountId(){return this.config.accountId||""}async isServiceTenant(){return!1}async getHeaders(){return{Authorization:`Bearer ${this.config.accessToken}`,"X-Uipath-Tenantid":this.config.tenantId,"X-Uipath-Organizationid":this.config.organizationId,"X-UiPath-ConsumingProductId":dL1}}},_b2=class{constructor(t="http://localhost:5002",r="http://localhost:5055"){this.backendUrl=t;this.interopUrl=r}getToolsUrl(){return this.interopUrl}getBackendUrl(){return this.backendUrl}getComputerUseUrl(){return this.interopUrl}getExcelUrl(){return this.interopUrl}getWordUrl(){return this.interopUrl}getPowerPointUrl(){return this.interopUrl}getPdfUrl(){return this.interopUrl}getMailUrl(){return this.interopUrl}getCalendarUrl(){return this.interopUrl}getFileSystemUrl(){return this.interopUrl}getSkillsUrl(){return this.interopUrl}},Eb2=class{constructor(t="claude_sonnet_4_5"){this.model=t}getModelConfig(){return{model_name:this.model}}setModel(t){this.model=t}},Kt2=class{constructor(t){this.userDataPath=t}resolveUserDataPath(){let t=this.userDataPath?.trim();return t&&Wet.isAbsolute(t)?t:(t&&console.warn(`[SdkOsService] Ignoring non-absolute workingDirectory "${t}"; using default user-data root.`),Wet.join(Pb2.homedir(),".aria-sdk"))}async getWellKnownPath(t){if(t==="userData")return this.resolveUserDataPath();let r={documents:Wet.join(Pb2.homedir(),"Documents"),tmp:Pb2.tmpdir()};return fU2(r,t)}async getTimezone(){return Intl.DateTimeFormat().resolvedOptions().timeZone}async openFile(){}async openUrl(){}async setAppContentProtection(){}async getAppContentProtection(){return!1}async ignoreMouseEvents(){}async minifyWindow(){}async getDisplayCount(){return 1}async getAriaWindowScreenId(){return 0}async smartMinifyWindow(){return!1}async showActionOverlay(){}async hideActionOverlay(){}async isPipStreaming(){return!1}isAutoMinimizeEnabled(){return!0}isMaximizeTargetAppEnabled(){return sG2()}useVdiTyping(){return!1}},Rb2=class e{constructor(t="aria-delegate"){this.agentName=t}productId="799f56b8-4aed-4a0f-8640-659dae4a9e0e";osService=new Kt2;customContext=null;httpClient=null;authProvider=null;toolsUrlProvider=null;setServices(t,r,a){this.httpClient=t,this.authProvider=r,this.toolsUrlProvider=a}setContext(t){this.customContext=t}getPlatform(){return this.agentName.includes("delegate")?"Delegate":"General"}getOsInfo(){switch(process.platform){case"darwin":return{name:"macOS",description:"Apple macOS"};case"win32":return{name:"Windows",description:"Microsoft Windows"};case"linux":return{name:"Linux",description:"Linux Desktop Machine"};default:return{name:process.platform,description:process.platform}}}static _compactWindowsContext(t,r){let a={format:"identifier | title",windows:t.map(i=>`${i.identifier} | ${i.title??""}`)};return r?{...a,updates:r}:a}screenshotsToAttachments(t){return t.map(r=>({name:`Screenshot_of_screen_${r.screenId}.jpg`,type:"image/jpeg",lastModified:Date.now(),content:{base64:r.base64Image,text:null,binary:null},size:0,preamble:`<automatically_attached_to_the_user_request>A screenshot of screen with screenId ${r.screenId} (0-based index). Original resolution: ${r.screenWidth}x${r.screenHeight}${"screenshotWidth"in r?`, screenshot resolution: ${r.screenshotWidth}x${r.screenshotHeight}`:""}. Note: On macOS, the menu bar (if visible) indicates the application is open on this screen.</automatically_attached_to_the_user_request>`,attachmentSource:"Screenshot"}))}async getPlatformContext(t){return this.customContext?this.buildContextFromManual():this.httpClient&&this.authProvider&&this.toolsUrlProvider?this.buildContextFromComputerState(t?.sessionId):this.buildContextFromManual()}async buildContextFromComputerState(t){let r=this.getOsInfo(),a=this.getPlatform(),i=await this.osService.getWellKnownPath("documents")??"",n=await this.osService.getTimezone(),o=i.replace(/Documents$/,"Desktop"),h=[],u,g=null,f=[],v=!1,C=new wG1(this.httpClient,this.authProvider,this.toolsUrlProvider,t||"",t?kh(t):void 0),L,y=new Promise(B=>{L=setTimeout(()=>B("timeout"),15e3)});try{let B=()=>C.getComputerState({includeWindows:!0,includeAttachedApplication:!1,includeFocusedElement:!0,includeScreenshot:!0}),R=await Promise.race([this._getComputerStateWithRetry(B,t||""),y]);R==="timeout"?(console.error("[SdkPlatformContext] getBatch timed out after 15 seconds"),v=!0):(v=!!R._unavailable,h=R.windows??[],u=R.windowUpdatesSinceLastTurn??void 0,g=R.focusedElement,f=R.screenshots??[]),vV.setScreenshotCache(f),f.length===0&&console.warn("[SdkPlatformContext] No screenshots received from batch endpoint.")}catch(B){console.error("[SdkPlatformContext] getBatch error:",B instanceof Error?B.message:B),v=!0}finally{clearTimeout(L)}let z;if(t){let B=SM6(t),R=bM6(t);if(!R&&B.planFilePath&&window.fsServiceApi?.readFile)try{R=(await xg.readFile(B.planFilePath)).content}catch(N){if(!(N instanceof Yc)||N.code!==Xn.FileNotFound&&N.code!==Xn.DirectoryNotFound)throw N}let F=J90(B.planningPhase,R,B.currentStepNumber,B.progressContent,B.planFilePath);F&&(z=F)}let S={PlatformType:{Description:a,Value:a},PlatformContextType:{Description:r.description,Value:r.name},PlatformSubContextType:{Description:r.description,Value:r.name},ContextData:{UserDocumentsFolder:i,UserDesktopFolder:o,UserTimeZone:n,KeyboardShortcutModifier:r.name==="macOS"?"Use Cmd (\u2318) as the primary modifier key for keyboard shortcuts (e.g. Cmd+A to select all, Cmd+C to copy, Cmd+V to paste).":"Use Ctrl as the primary modifier key for keyboard shortcuts (e.g. Ctrl+A to select all, Ctrl+C to copy, Ctrl+V to paste).",LocalSkillsPath:tm1(Pb2.homedir(),r.name).localSkillsPath,AvailableApplicationWindows:e._compactWindowsContext(h,u),FocusedElement:g||"None",UserLocalTime:D04(),RecentFiles:{system:[],excel:{recent:[],opened:[]},word:{recent:[],opened:[]},powerPoint:{recent:[],opened:[]},description:"Recently accessed files from various sources: system (Windows Recent folder or macOS Spotlight), Office applications (Excel, Word, PowerPoint) recent files from Windows Jump Lists, and currently opened Office documents."},SelectedFlows:[],planSteering:z,BlockedUiaSites:void 0,TrustedApps:void 0,TrustedSites:void 0},Attachments:this.screenshotsToAttachments(f)};return v&&(S.ContextData.ComputerUseUnavailable="Computer use is currently unavailable. The platform service could not be reached. Check that the interop service is running and accessible."),S}async _getComputerStateWithRetry(t,r){let n=Math.ceil(30),o=0,h=Date.now();for(let f=0;f<n;f++){o=f+1;try{return await t()}catch(v){if(!(v instanceof TypeError))throw v;let C=Date.now()-h;if(console.warn(`[SdkPlatformContext] getComputerState network error (attempt ${o}, ${C}ms): ${v.message}`),f===n-1)break;await new Promise(L=>setTimeout(L,500))}}let u=Date.now()-h;console.error(`[SdkPlatformContext] getComputerState failed after ${o} attempts (${u}ms)`);let g={windows:[],screenshots:[]};return g._unavailable=!0,g}async buildContextFromManual(){let t=this.getOsInfo(),r=this.getPlatform(),a=this.customContext?.documentsFolder||await this.osService.getWellKnownPath("documents")||"",i=this.customContext?.timezone||await this.osService.getTimezone(),n=this.customContext?.desktopFolder||a.replace(/Documents$/,"Desktop"),o=this.customContext?.screenshots||[],h=this.customContext?.windows||[],u=this.customContext?.focusedElement||null;return{PlatformType:{Description:r,Value:r},PlatformContextType:{Description:t.description,Value:t.name},PlatformSubContextType:{Description:t.description,Value:t.name},ContextData:{UserDocumentsFolder:a,UserDesktopFolder:n,UserTimeZone:i,KeyboardShortcutModifier:t.name==="macOS"?"Use Cmd (\u2318) as the primary modifier key for keyboard shortcuts (e.g. Cmd+A to select all, Cmd+C to copy, Cmd+V to paste).":"Use Ctrl as the primary modifier key for keyboard shortcuts (e.g. Ctrl+A to select all, Ctrl+C to copy, Ctrl+V to paste).",LocalSkillsPath:tm1(Pb2.homedir(),t.name).localSkillsPath,AvailableApplicationWindows:e._compactWindowsContext(h),FocusedElement:u||"None",UserLocalTime:D04(),RecentFiles:{system:[],excel:{recent:[],opened:[]},word:{recent:[],opened:[]},powerPoint:{recent:[],opened:[]},description:"Recently accessed files from various sources."},SelectedFlows:[]},Attachments:this.screenshotsToAttachments(o)}}async getProductId(){return this.productId}};var Zb2=class{async initializeTelemetry(){}async trackEvent(){}async trackTrace(){}async trackError(){}async trackApplicationStart(){}async updateTrackerLanguage(){}},Fb2=class{async readText(){return""}async writeText(){return!1}};function zRr(e){let t=e?.split(".")[1];if(!t)return{};try{let r=JSON.parse(Buffer.from(t,"base64").toString("utf-8"));return r&&typeof r=="object"?r:{}}catch{return{}}}async function HM6(e){let t=async g=>{if(typeof g=="function")try{let f=await g.call(e);return typeof f=="string"&&f.length>0?f:void 0}catch{return}},r=await t(e.getUserId);if(!r)return null;let[a,i,n,o,h,u]=await Promise.all([t(e.getUserEmail),t(e.getUserName),t(e.getOrganizationId),t(e.getOrganizationName),t(e.getTenantId),t(e.getTenantName)]);return{userId:r,properties:{email:a,name:i,organizationId:n,organizationName:o,tenantId:h,tenantName:u}}}function kM6(e){let t=zRr(e.accessToken),r=i=>{let n=t[i];return typeof n=="string"&&n.length>0?n:void 0},a=e.userId||r("sub");return a?{userId:a,properties:{email:e.userEmail??r("email"),name:e.userName??r("name"),firstName:r("first_name")??r("given_name"),lastName:r("last_name")??r("family_name"),organizationId:e.organizationId||void 0,organizationName:e.organizationName??e.orgLogicalName,tenantId:e.tenantId||void 0,tenantName:e.tenantName}}:null}ZO();_W2();jG1();ph0();WN();TS();WW2();function bRr(e){return e==="a"?"append":e==="wx"?"create":"overwrite"}var Yt2=class extends Ni1{async readFile(t,r,a){let i={filePath:t};if(r?.offset!=null&&(i.startLine=r.offset),r?.limit!=null&&(i.lines=r.limit),r?.encoding==="base64"&&(i.encoding="base64"),r?.encoding==="binary"){i.encoding="base64";let h=await this.postRaw("file/read",i,a);return h.success||gU(h,"file/read",{includePdfErrors:!0}),{bytes:xc1(h.content??""),encoding:"binary",mtimeMs:h.lastModified,sizeBytes:h.totalBytes||h.size}}let n=await this.postRaw("file/read",i,a);return n.success||gU(n,"file/read",{includePdfErrors:!0}),{content:n.content??"",sizeBytes:n.totalBytes||n.size,mtimeMs:n.lastModified,...n.encoding==="base64"?{encoding:"base64"}:{},...n.startLine>0||n.hasMore||n.totalLines!=null?{pagination:{startLine:n.startLine,endLine:n.endLine,totalLines:n.totalLines??void 0,hasMore:n.hasMore}}:{}}}async stat(t,r){let a=await this.postRaw("file/read",{filePath:t,metadataOnly:!0},r);if(!a.success){if(MQ(a.errorCode)===Xn.IsADirectory)return this._directoryStat();gU(a,"file/read")}return{isFile:!0,isDirectory:!1,isSymbolicLink:!1,sizeBytes:a.totalBytes||a.size,mtimeMs:a.lastModified,birthtimeMs:0}}_directoryStat(){return{isFile:!1,isDirectory:!0,isSymbolicLink:!1,sizeBytes:0,mtimeMs:0,birthtimeMs:0}}async exists(t,r){try{return await this.stat(t,r),!0}catch(a){if(a instanceof Yc&&a.code===Xn.FileNotFound)return!1;throw a}}async writeFile(t,r,a,i){let n=r instanceof Uint8Array,o={filePath:t,content:n?fo3(r):r};(n||a?.encoding==="base64")&&(o.encoding="base64"),a?.flag&&(o.mode=bRr(a.flag)),a?.createDirectories!=null&&(o.createDirectories=a.createDirectories),a?.expectedMtimeMs!=null&&(o.expectedLastModified=a.expectedMtimeMs);let h=await this.postRaw("file/write",o,i);h.success||gU(h,"file/write")}async edit(t,r,a,i,n){let o={filePath:t,oldContent:r,newContent:a,expectedReplacements:i?.replaceAll?0:1};i?.expectedMtimeMs!=null&&(o.expectedLastModified=i.expectedMtimeMs);let h=await this.postRaw("file/edit",o,n);return h.success||gU(h,"file/edit"),{replacementsCount:h.replacementsCount,mtimeMs:h.lastModified??0}}async rm(t,r,a){let i=await this.postRaw("file/delete",{path:t},a);i.success||gU(i,"file/delete")}async readdir(t,r){let a=await this.postRaw("file/list",{directoryPath:t},r);return a.success||gU(a,"file/list"),(a.files??[]).map(i=>({name:i.name,isFile:i.isFile,isDirectory:i.isDirectory,isSymbolicLink:!1}))}async realpath(t,r){throw new Error("realpath is not supported by the Delegate interop filesystem")}async mkdir(t,r,a){let i=r?.recursive??!1,n=await this.postRaw("file/create-directory",{directoryPath:t,createParents:i,ignoreExisting:i},a);n.success||gU(n,"file/create-directory")}async rename(t,r,a){let i=await this.postRaw("file/move",{sourcePath:t,destinationPath:r},a);i.success||gU(i,"file/move")}async copyFile(t,r,a){let i=await this.postRaw("file/batch",{operations:[{type:"copy",source:t,destination:r}]},a);i.success||gU(i,"file/batch");let n=i.results?.[0];n&&!n.success&&gU({success:!1,error:n.error,errorCode:void 0},"file/batch")}async cp(t,r,a,i){throw new Error("cp (recursive copy) is not supported by the Delegate interop filesystem")}};var Xt2=class extends Ni1{async getPathSuggestions(t,r=5,a,i){try{let n={filePath:t,maxSuggestions:r};return a&&(n.kind=a),(await this.post("file/path-suggestions",n,i)).suggestions??[]}catch{return[]}}};var Jt2=class extends Ni1{async extractPdfPages(t,r,a,i,n){let o={filePath:t,pageNumber:r,endPage:a};i&&(o.password=i);let h=await this.postRaw("pdf/export-page-image",o,n);h.success||gU(h,"pdf/export-page-image",{includePdfErrors:!0});let u=h.attachments??[];return u.length>0&&h.totalPages!=null&&(u[0]={...u[0],totalPages:h.totalPages}),u}async readPdfPages(t,r,a,i,n){let o={filePath:t,startPage:r,endPage:a};i&&(o.password=i);let h=await this.postRaw("pdf/read-pages",o,n);return h.success||gU(h,"pdf/read-pages",{includePdfErrors:!0}),{content:h.content??"",contentBytes:h.contentBytes??0,pagesReturned:h.pagesReturned??0,totalPages:h.totalPages??0,lastModified:h.lastModified??0}}};QH();mj();Tx();function Qx0(e,t){return e==="~"?t:e.startsWith("~/")||e.startsWith("~\\")?t+e.slice(1):e}var qet="GREP_PATH_NOT_FOUND";function Ui1(e){return`'${e.replace(/'/g,"'\\''")}'`}function Ob2(e){return`'${e.replace(/'/g,"''")}'`}function Db2(e,t,r=!1,a=qet){if(t){let o=`if (-not (Test-Path -LiteralPath ${e})) { [Console]::Error.WriteLine('${a}'); $parent = Split-Path -LiteralPath ${e} -Parent; if ($parent -and (Test-Path -LiteralPath $parent)) { $listing = (Get-ChildItem -LiteralPath $parent -Name 2>$null) -join "\`n"; if ($listing.Length -gt 393216) { $listing.Substring(0, 393216) } else { $listing } }; exit 2 }; `;return r&&(o+=`if (-not (Test-Path -LiteralPath ${e} -PathType Container)) { [Console]::Error.WriteLine('${a}_NOT_DIR'); exit 2 }; `),o}let n=`if [ ! -e ${e} ]; then echo '${a}' >&2; parent=$(dirname ${e}); if [ -d "$parent" ]; then ls -1 "$parent" 2>/dev/null | head -c 393216; fi; exit 2; fi; `;return r&&(n+=`if [ ! -d ${e} ]; then echo '${a}_NOT_DIR' >&2; exit 2; fi; `),n}function Ib2(e,t,r){let a="";return r?(e>0&&(a+=` | Select-Object -Skip ${e}`),t>0&&(a+=` | Select-Object -First ${t}`)):(e>0&&(a+=` | tail -n +${e+1}`),t>0&&(a+=` | head -n ${t}`)),a}function Nb2(e){return e?" | Out-String -Stream | & { $sz = 0; foreach ($line in $input) { $sz += $line.Length + 2; if ($sz -le 393216) { $line } else { break } } }":" | head -c 393216"}function TM6(e){return/\bos error 11\b/.test(e)||e.includes("Resource temporarily unavailable")}function $et(e){return e===127}function Ket(e,t=393216){let a=new TextEncoder().encode(e).length>=t,i=e;if(a){let n=i.lastIndexOf(`
|
|
12296
12296
|
`);n>0&&(i=i.substring(0,n))}return{content:i,truncated:a}}function Ub2(e,t){if(!t)return e;let a=t.replace(/[/\\]+$/,"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return e.replace(new RegExp(`^${a}[/\\\\]`,"gm"),"")}var Yet="GLOB_PATH_NOT_FOUND",SRr="GLOB_PATH_NOT_FOUND_NOT_DIR",HRr={files_with_matches:100,content:150,count:100},kRr="minimal",TRr={BASH_ENV:""},BM6="ripgrep (rg) is not available. Please install ripgrep to use the Grep tool.",Qt2=class{_bash;_rgBinary;_pathValidator;constructor(t,r,a){this._bash=t,this._rgBinary=r||"rg",this._pathValidator=a}async grep(t,r){let i=await this._bash.getPlatform()==="windows",n=await this._expandTildeInGrepArgs(t),o=await this._resolvePolicyBlock(n.path,i,r);if(o)return{blockedByPolicy:!0,policyBlockReason:o};let h=this._buildGrepCommand(n,i),u=await this._executeWithEagainRetry(h,()=>this._buildGrepCommand(n,i,{singleThreaded:!0}),t.elevationToken,r);return u.sandbox?.blocked?DRr(u):this._parseGrepResult(u,n)}async glob(t,r){let i=await this._bash.getPlatform()==="windows",n=await this._expandTildeInGlobArgs(t),o=await this._resolvePolicyBlock(n.path,i,r);if(o)return{blockedByPolicy:!0,policyBlockReason:o};let h=this._buildGlobCommand(n,i),u=await this._executeWithEagainRetry(h,()=>this._buildGlobCommand(n,i,{singleThreaded:!0}),t.elevationToken,r);return u.sandbox?.blocked?IRr(u):this._parseGlobResult(u,n)}async _expandTildeInGrepArgs(t){if(!t.path?.startsWith("~"))return t;let r=await this._bash.getHomeDirectory();return{...t,path:Qx0(t.path,r)}}async _expandTildeInGlobArgs(t){if(!(t.path?.startsWith("~")||t.pattern.startsWith("~")))return t;let a=await this._bash.getHomeDirectory();return{...t,pattern:Qx0(t.pattern,a),...t.path!=null&&{path:Qx0(t.path,a)}}}async _resolvePolicyBlock(t,r,a){if(!this._pathValidator)return null;let i=await this._resolveAbsolutePath(t,r,a);if(i==null)return"Could not resolve the search directory to validate it against your security policy; refused.";try{let n=a?await this._pathValidator.validateRead(i,a):await this._pathValidator.validateRead(i);return n.blocked?n.reason||`Access to "${i}" is blocked by your security policy.`:null}catch{return`Could not verify "${i}" against your security policy; refused.`}}async _resolveAbsolutePath(t,r,a){if(t&&ERr(t,r))return t;let i=r?"(Get-Location).Path":"pwd",n=await this._bash.execute(i,this._getBashOptions(void 0,a));if(n.exitCode!==0)return null;let o=n.stdout.trim();return o?t?RRr(o,t,r):o:null}async _executeWithEagainRetry(t,r,a,i){let n=await this._bash.execute(t,this._getBashOptions(a,i));return n.sandbox?.blocked||n.exitCode===0||!TM6(n.stderr||"")?n:this._bash.execute(r(),this._getBashOptions(a,i))}_getBashOptions(t,r){return{...t?{elevationToken:t}:{},...r?{requestContext:kx(r)}:{},environmentProfile:kRr,variables:TRr}}_buildGrepCommand(t,r,a={}){let i=VRr(t);return a.singleThreaded&&i.push("-j","1"),r?this._buildWindowsGrepPipeline(i,t):this._buildUnixGrepPipeline(i,t)}_buildUnixGrepPipeline(t,r){let a=PM6(r),i=r.offset||0,n=r.output_mode||"files_with_matches",o=new TextEncoder().encode(r.pattern),h=btoa(String.fromCharCode(...o)),u=t.map(Ui1).join(" "),g=r.path?` -- ${Ui1(r.path)}`:"",f=Ui1(this._rgBinary),v="set -o pipefail; ";return r.path&&(v+=Db2(Ui1(r.path),!1)),v+=`printf '%s' '${h}' | perl -MMIME::Base64 -0777 -ne 'print decode_base64($_)' | ${f} -f - ${u}${g}`,n==="files_with_matches"&&(v+=" | perl -e '@f=map{chomp;[$_,(stat$_)[9]||0]}<>;print $$_[0],$/for sort{$$b[1]<=>$$a[1]||$$a[0]cmp$$b[0]}@f'"),n!=="count"&&(v+=Ib2(i,a,!1)),v+=Nb2(!1),v}_buildWindowsGrepPipeline(t,r){let a=PM6(r),i=r.offset||0,n=r.output_mode||"files_with_matches",o=[...t,"-e",r.pattern];r.path&&o.push("--",r.path);let h="$ProgressPreference = 'SilentlyContinue'; ";return r.path&&(h+=Db2(Ob2(r.path),!0)),h+=VM6(this._rgBinary,o),n==="files_with_matches"&&(h+=" | Sort-Object { (Get-Item -LiteralPath $_ -ErrorAction SilentlyContinue).LastWriteTimeUtc } -Descending"),n!=="count"&&(h+=Ib2(i,a,!0)),h+=Nb2(!0),h+="; exit $global:LASTEXITCODE",h}_buildGlobCommand(t,r,a={}){return r?this._buildWindowsGlobPipeline(t,a.singleThreaded??!1):this._buildUnixGlobPipeline(t,a.singleThreaded??!1)}_buildUnixGlobPipeline(t,r){let a=t.sort_by||"none",i=t.output_mode||"files",n=t.head_limit||0,o=t.offset||0,h=Ui1(this._rgBinary),u=Ui1(t.pattern),g=` -- ${Ui1(t.path)}`,f="set -o pipefail; ";f+=Db2(Ui1(t.path),!1,!0,Yet);let v=r?" -j 1":"",C=`--files --glob ${u}`;return t.exclude&&(C+=` --glob ${Ui1("!"+t.exclude)}`),t.include_hidden?C+=" --glob '!.git/' --no-ignore --hidden":C+=" --glob '!.*'",t.max_depth!=null&&(C+=` --max-depth ${t.max_depth}`),a==="name"&&i!=="count"&&(C+=" --sort path"),C+=` --no-messages --color never${v}`,f+=`${h} ${C}${g}`,i==="count"?(f+=" | wc -l",f):(a==="modified"?f+=" | perl -e '@f=map{chomp;[$_,(stat$_)[9]||0]}<>;print $$_[0],$/for sort{$$b[1]<=>$$a[1]||$$a[0]cmp$$b[0]}@f'":a==="size"&&(f+=` | perl -e '@f=map{chomp;[$_,(stat$_)[7]||0]}<>;for(sort{$$b[1]<=>$$a[1]||$$a[0]cmp$$b[0]}@f){print $$_[1]," ",$$_[0],$/}'`),f+=Ib2(o,n,!1),f+=Nb2(!1),f)}_buildWindowsGlobPipeline(t,r){let a=t.sort_by||"none",i=t.output_mode||"files",n=t.head_limit||0,o=t.offset||0,h="$ProgressPreference = 'SilentlyContinue'; ";h+=Db2(Ob2(t.path),!0,!0,Yet);let u=["--files","--glob",t.pattern];return t.exclude&&u.push("--glob","!"+t.exclude),t.include_hidden?u.push("--glob","!.git/","--no-ignore","--hidden"):u.push("--glob","!.*"),t.max_depth!=null&&u.push("--max-depth",String(t.max_depth)),u.push("--no-messages","--color","never"),r&&u.push("-j","1"),u.push("--",t.path),h+=VM6(this._rgBinary,u),i==="count"?(h+=" | Measure-Object -Line | ForEach-Object { $_.Lines }",h+="; exit $global:LASTEXITCODE",h):(a==="modified"?h+=" | Sort-Object { (Get-Item -LiteralPath $_ -ErrorAction SilentlyContinue).LastWriteTimeUtc } -Descending":a==="name"?h+=" | Sort-Object":a==="size"&&(h+=" | Sort-Object { (Get-Item -LiteralPath $_ -ErrorAction SilentlyContinue).Length } -Descending",h+=' | ForEach-Object { "$((Get-Item -LiteralPath $_ -ErrorAction SilentlyContinue).Length) $_" }'),h+=Ib2(o,n,!0),h+=Nb2(!0),h+="; exit $global:LASTEXITCODE",h)}_parseGrepResult(t,r){let a=t.exitCode,i=t.stdout||"",n=t.stderr||"";if($et(a))throw new Error(BM6);let{content:o,truncated:h}=Ket(i);if(a===2&&n.includes(qet))return{notFound:!0};let u=o.trim().length>0;if(!(a===0||a===141&&u||a===2&&u||a===2&&!n.trim()&&!u||a===1&&u)){if(a===1&&!u&&!n.trim()||a===2&&!u&&!n.trim())return Xet(r);let f=n.trim()||`ripgrep exited with code ${a}`;throw new Error(f)}return this._materializeGrepResult(o,r,h)}_materializeGrepResult(t,r,a){let i=r.output_mode||"files_with_matches",o=(r.path?Ub2(t,r.path):t).trimEnd().split(`
|
|
12297
12297
|
`).filter(u=>u.length>0),h=a?{truncated:!0,truncationReason:"byte-cap"}:{};return o.length===0?{...Xet(r),...h}:i==="files_with_matches"?{files:o.map(u=>({path:u})),...h}:i==="count"?{counts:ZRr(o),...h}:{matches:FRr(o),...h}}_parseGlobResult(t,r){let a=t.exitCode,i=t.stdout||"",n=t.stderr||"",o=r.output_mode||"files";if($et(a))throw new Error(BM6);if(o==="count"){let v=this._parseGlobCountResult(a,i,n);if(v)return v}let{content:h,truncated:u}=Ket(i);if(a===2&&n.includes(SRr))return{notFound:!0};if(a===2&&n.includes(Yet))return{notFound:!0};let g=h.trim().length>0;if(!(a===0||a===141&&g||a===2&&g&&o!=="count"||a===2&&!n.trim()&&!g||a===1&&g)){if(a===1&&!g&&!n.trim())return{files:[]};if(a===2&&!g&&!n.trim())return{files:[]};let v=n.trim()||`ripgrep exited with code ${a}`;throw new Error(v)}return this._materializeGlobResult(h,r,u)}_parseGlobCountResult(t,r,a){if(t===1&&!r.trim()){if(a.trim())throw new Error(a.trim());return{counts:[{path:"",count:0}]}}if(!(t===0||t===1||t===2&&!a.trim()))return null;let n=parseInt(r.trim(),10);return Number.isNaN(n)?null:{counts:[{path:"",count:n}]}}_materializeGlobResult(t,r,a){let i=r.sort_by||"none",n=a?{truncated:!0,truncationReason:"byte-cap"}:{};if(i==="size"){let u=t.trimEnd().split(`
|