@5minds/processcube_app_sdk 5.1.0-develop-bd907c-ls8y3h2e → 5.1.0-develop-15b57f-ltcx14zw

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/processcube_app_sdk",
3
- "version": "5.1.0-develop-bd907c-ls8y3h2e",
3
+ "version": "5.1.0-develop-15b57f-ltcx14zw",
4
4
  "description": "The SDK for ProcessCube Apps",
5
5
  "type": "module",
6
6
  "main": "common/index.cjs",
package/server/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var S=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var ee=Object.prototype.hasOwnProperty;var te=(e,t)=>{for(var s in t)S(e,s,{get:t[s],enumerable:!0})},se=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Q(t))!ee.call(e,n)&&n!==s&&S(e,n,{get:()=>t[n],enumerable:!(r=z(t,n))||r.enumerable});return e};var re=e=>se(S({},"__esModule",{value:!0}),e);var Pe={};te(Pe,{finishUserTask:()=>Re,finishUserTaskAndGetNext:()=>me,getActiveProcessInstances:()=>ke,getAssignedUserTasksByIdentity:()=>xe,getEngineClient:()=>fe,getIdentity:()=>Ie,getReservedUserTasksByIdentity:()=>Ce,getUserTasks:()=>H,getWaitingUserTaskByFlowNodeInstanceId:()=>j,getWaitingUserTasks:()=>ge,getWaitingUserTasksByCorrelationId:()=>ye,getWaitingUserTasksByFlowNodeId:()=>we,getWaitingUserTasksByProcessInstanceId:()=>Ee,navigateToUrl:()=>Se,startProcess:()=>Ne,waitForUserTask:()=>Te,withApplicationSdk:()=>_e});module.exports=re(Pe);var lt=require("only-server");var A=require("@5minds/processcube_engine_sdk"),O=require("@5minds/processcube_engine_client"),i=require("node:path"),b=require("esbuild"),m=require("node:fs"),v=require("openid-client"),L=require("jwt-decode"),D=require("chokidar");var F=require("@5minds/processcube_engine_client"),N=process.env.PROCESSCUBE_ENGINE_URL??"http://localhost:10560",o=new F.EngineClient(N);var ne={token:"ZHVtbXlfdG9rZW4=",userId:"dummy_token"},oe=.85,w=["external_task.ts","external_task.js"],c=new A.Logger("processcube_app_sdk:external_task_adapter"),P=process.env.PROCESSCUBE_AUTHORITY_URL!==void 0,f={};async function M(e){if(e&&!(0,m.existsSync)(e))throw new Error(`Invalid customExternalTasksDirPath. The given path '${e}' does not exist`);let t=ue(e);(0,D.watch)(t).on("add",async s=>{if(!w.includes((0,i.basename)(s)))return;await W(s,t);let r=(0,i.dirname)(s),n=(0,i.relative)(t,r),a=y(n);c.info(`Started external task ${f[s].workerId} for topic ${a}`)}).on("change",async s=>{if(!w.includes((0,i.basename)(s)))return;await ae(s,t);let r=(0,i.dirname)(s),n=(0,i.relative)(t,r),a=y(n);c.info(`Restarted external task ${f[s].workerId} for topic ${a}`)}).on("unlink",async s=>{if(!w.includes((0,i.basename)(s)))return;B(s);let r=(0,i.dirname)(s),n=(0,i.relative)(t,r),a=y(n);c.info(`Stopped external task ${f[s].workerId} for topic '${a}'`,{reason:`External Task for topic '${a}' was removed`,workerId:f[s].workerId,topic:a}),delete f[s]}).on("error",s=>c.info(`Watcher error: ${s}`))}async function W(e,t,s){let r=(0,i.dirname)(e);if(!ie(r)){c.error(`Could not find external task file in directory '${r}'`);return}let a=await ce(e),d=await le(a,e);if(d.default===void 0){c.info(`External task file recognized at ${e}. Please export a default handler function. For more information see https://processcube.io/docs/app-sdk/samples/external-task-adapter#external-tasks-entwickeln`);return}let k=await q(),U=K(k),g=(0,i.relative)(t,r),u=y(g),x=d.default,_={identity:U,...s,...d?.config},I=new O.ExternalTaskWorker(N,u,x,_);I.onWorkerError((E,T,Z)=>{c.error(`Intercepted "${E}"-type error: ${T.message}`,{err:T,type:E,externalTask:Z})}),I.start(),await R(k,I),f[e]=I}async function ae(e,t){let s=f[e]?.workerId;B(e),await W(e,t,{workerId:s})}function B(e){let t=f[e];t&&(t.stop(),t.dispose())}async function ie(e){let s=(await m.promises.readdir(e)).filter(r=>w.includes(r));if(s.length===0)return null;if(s.length>1)throw new Error(`Found more than one external task file in directory '${e}'`);return s[0]}async function q(){if(!P)return null;if(!process.env.PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_ID||!process.env.PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_SECRET){let r=new Error("Required environment variables PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_ID and PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_SECRET are missing. For help, please refer to our documentation on environment variables at: https://processcube.io/docs/app-sdk/samples/external-task-adapter#authority");throw c.error("Required environment variables PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_ID and PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_SECRET are missing",{err:r}),r}let e=await v.Issuer.discover(process.env.PROCESSCUBE_AUTHORITY_URL);return await new e.Client({client_id:process.env.PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_ID,client_secret:process.env.PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_SECRET}).grant({grant_type:"client_credentials",scope:"engine_etw"})}function K(e){if(!P||e===null)return ne;let t=e.access_token,s=(0,L.jwtDecode)(t);return{token:e.access_token,userId:s.sub}}async function R(e,t,s=5){try{if(!P||e===null||!t.pollingIsActive)return;let n=await de(e)*oe*1e3;setTimeout(async()=>{if(!t.pollingIsActive)return;let a=await q(),d=K(a);t.identity=d,await R(a,t)},n)}catch(r){if(s===0)throw r;c.error(`Could not refresh identity for external task worker ${t.workerId}`,{err:r,workerId:t.workerId,retryCount:s});let n=2*1e3;setTimeout(async()=>await R(e,t,s-1),n)}}async function ce(e){let t=await(0,b.build)({entryPoints:[e],write:!1,bundle:!0,platform:"node",target:"node18",format:"cjs"});if(t.errors.length>0)throw c.error(`Could not transpile file at '${e}'`,{errors:t.errors}),new Error(`Could not transpile file at '${e}'`);return t.warnings.length>0&&c.warn(`Transpiled file at '${e}' with warnings`,{warnings:t.warnings}),t.outputFiles[0].text}async function le(e,t){try{var s=module.constructor,r=new s;return r._compile(e,t),r.exports}catch(n){throw c.error("Could not require module from string",{err:n}),n}}async function de(e){let t=e.expires_in;if(!t&&e.expires_at&&(t=Math.floor(e.expires_at-Date.now()/1e3)),t===void 0)throw new Error("Could not determine the time until the access token for external task workers expires");return t}function y(e){return e.replace(/^\.\/+|\([^)]+\)|^\/*|\/*$/g,"").replace(/[\/]{2,}/g,"/")}function ue(e){let t,s=[e,(0,i.join)(process.cwd(),"app"),(0,i.join)(process.cwd(),"src","app")];for(let r of s)if(r&&(0,m.existsSync)(r)){t=r;break}if(!t)throw new Error("Could not find external tasks directory");return t}function fe(){return o}var p=require("next/headers"),X=require("next/dist/compiled/@edge-runtime/cookies"),h=require("next-auth/jwt"),pe=process.env.NEXTAUTH_URL?.startsWith("https://"),$=`${pe?"__Secure-":""}next-auth.session-token`;async function Ie(){let e=await(0,h.getToken)({req:{cookies:(0,p.cookies)(),headers:(0,p.headers)()}});if(e?.expiresAt&&Date.now()>=e.expiresAt*1e3){let s=await fetch(`${process.env.NEXTAUTH_URL}/api/auth/session`,{method:"GET",headers:{"Content-Type":"application/json",cookie:(0,p.cookies)().toString()}}),r=new X.ResponseCookies(s.headers),n=r.get($);if(n){let a=!1;try{(0,p.cookies)().set($,n.value,{...n})}catch{a=!0}if(e=await(0,h.getToken)({req:{cookies:a?r:(0,p.cookies)(),headers:(0,p.headers)()}}),e?.error)throw e.error}}if(!e?.accessToken||!e?.sub)throw new Error("AccessToken or Sub could not be determined!");return{token:e?.accessToken,userId:e?.sub}}var G=require("@5minds/processcube_engine_client");async function ke(e){return await o.processInstances.query({...e?.query,state:G.DataModels.ProcessInstances.ProcessInstanceState.running},e?.options)}var l=require("@5minds/processcube_engine_client");async function Te(e={},t){let{correlationId:s,processInstanceId:r,flowNodeId:n}=e;return new Promise(async(a,d)=>{let k=await o.userTasks.onUserTaskWaiting(async u=>{let x=s!==void 0&&u.correlationId!==s,_=u.flowNodeInstanceId===void 0,I=r!==void 0&&u.processInstanceId!==r,E=n!==void 0&&u.flowNodeId!==n;if(x||_||I||E)return;let T=await j(u.flowNodeInstanceId,{identity:t});return o.notification.removeSubscription(k,t),T===null?d(new Error(`UserTask with instance ID "${u.flowNodeInstanceId}" does not exist.`)):a(T)},{identity:t}),g=(await H({correlationId:s,processInstanceId:r,flowNodeId:n,state:l.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:t})).userTasks[0];g&&(o.notification.removeSubscription(k,t),a(g))})}async function me(e,t={},s={},r){await o.userTasks.finishUserTask(e,s,r);let n={state:l.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended,...t};return(await o.userTasks.query(n,{identity:r})).userTasks[0]}async function H(...e){return await o.userTasks.query(...e)}async function ge(e){return await o.userTasks.query({state:l.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},e)}async function Ee(e,t){return await o.userTasks.query({processInstanceId:e,state:l.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},t)}async function we(e,t){return await o.userTasks.query({flowNodeId:e,state:l.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},t)}async function j(e,t){let s=await o.userTasks.query({flowNodeInstanceId:e,state:l.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},{...t,limit:1});return s.userTasks.length===0?null:s.userTasks[0]}async function ye(e,t){return await o.userTasks.query({correlationId:e,state:l.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},t)}async function Ce(e,t){let s=await o.userTasks.query({state:l.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:e,...t}),r=s.userTasks.filter(n=>n.actualOwnerId===e.userId);return s.userTasks=r,s}async function xe(e,t){let s=await o.userTasks.query({state:l.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:e,...t}),r=s.userTasks.filter(n=>n.assignedUserIds?.includes(e.userId));return s.userTasks=r,s}var C=require("next/dist/shared/lib/constants");var Y=!1;function _e(e={}){let{applicationSdk:t,...s}=e;return async(r,n)=>{let a=r===C.PHASE_DEVELOPMENT_SERVER||r===C.PHASE_PRODUCTION_SERVER;return t?.useExternalTasks&&a&&!Y&&(Y=!0,await M(t?.customExternalTasksDirPath)),s}}var V=require("next/cache"),J=require("next/navigation");function Se(e){(0,V.revalidatePath)(e),(0,J.redirect)(e)}async function Ne(...e){return await o.processModels.startProcessInstance(...e)}async function Re(...e){await o.userTasks.finishUserTask(...e)}0&&(module.exports={finishUserTask,finishUserTaskAndGetNext,getActiveProcessInstances,getAssignedUserTasksByIdentity,getEngineClient,getIdentity,getReservedUserTasksByIdentity,getUserTasks,getWaitingUserTaskByFlowNodeInstanceId,getWaitingUserTasks,getWaitingUserTasksByCorrelationId,getWaitingUserTasksByFlowNodeId,getWaitingUserTasksByProcessInstanceId,navigateToUrl,startProcess,waitForUserTask,withApplicationSdk});
1
+ "use strict";var S=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var ee=Object.prototype.hasOwnProperty;var te=(e,t)=>{for(var s in t)S(e,s,{get:t[s],enumerable:!0})},se=(e,t,s,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Q(t))!ee.call(e,n)&&n!==s&&S(e,n,{get:()=>t[n],enumerable:!(r=z(t,n))||r.enumerable});return e};var re=e=>se(S({},"__esModule",{value:!0}),e);var Pe={};te(Pe,{finishUserTask:()=>Re,finishUserTaskAndGetNext:()=>me,getActiveProcessInstances:()=>ke,getAssignedUserTasksByIdentity:()=>Ce,getEngineClient:()=>fe,getIdentity:()=>Ie,getReservedUserTasksByIdentity:()=>xe,getUserTasks:()=>G,getWaitingUserTaskByFlowNodeInstanceId:()=>H,getWaitingUserTasks:()=>ge,getWaitingUserTasksByCorrelationId:()=>ye,getWaitingUserTasksByFlowNodeId:()=>we,getWaitingUserTasksByProcessInstanceId:()=>Ee,navigateToUrl:()=>Se,startProcess:()=>Ne,waitForUserTask:()=>Te,withApplicationSdk:()=>_e});module.exports=re(Pe);var lt=require("only-server");var A=require("@5minds/processcube_engine_sdk"),O=require("@5minds/processcube_engine_client"),i=require("node:path"),b=require("esbuild"),m=require("node:fs"),v=require("openid-client"),L=require("jwt-decode"),D=require("chokidar");var F=require("@5minds/processcube_engine_client"),N=process.env.PROCESSCUBE_ENGINE_URL??"http://localhost:10560",o=new F.EngineClient(N);var ne={token:"ZHVtbXlfdG9rZW4=",userId:"dummy_token"},oe=.85,w=["external_task.ts","external_task.js"],c=new A.Logger("processcube_app_sdk:external_task_adapter"),P=process.env.PROCESSCUBE_AUTHORITY_URL!==void 0,f={};async function M(e){if(e&&!(0,m.existsSync)(e))throw new Error(`Invalid customExternalTasksDirPath. The given path '${e}' does not exist`);let t=ue(e);(0,D.watch)(t).on("add",async s=>{if(!w.includes((0,i.basename)(s)))return;await W(s,t);let r=(0,i.dirname)(s),n=(0,i.relative)(t,r),a=y(n);c.info(`Started external task ${f[s].workerId} for topic ${a}`)}).on("change",async s=>{if(!w.includes((0,i.basename)(s)))return;await ae(s,t);let r=(0,i.dirname)(s),n=(0,i.relative)(t,r),a=y(n);c.info(`Restarted external task ${f[s].workerId} for topic ${a}`)}).on("unlink",async s=>{if(!w.includes((0,i.basename)(s)))return;B(s);let r=(0,i.dirname)(s),n=(0,i.relative)(t,r),a=y(n);c.info(`Stopped external task ${f[s].workerId} for topic '${a}'`,{reason:`External Task for topic '${a}' was removed`,workerId:f[s].workerId,topic:a}),delete f[s]}).on("error",s=>c.info(`Watcher error: ${s}`))}async function W(e,t,s){let r=(0,i.dirname)(e);if(!ie(r)){c.error(`Could not find external task file in directory '${r}'`);return}let a=await ce(e),d=await le(a,e);if(d.default===void 0){c.info(`External task file recognized at ${e}. Please export a default handler function. For more information see https://processcube.io/docs/app-sdk/samples/nextjs/external-task-adapter-with-nextjs#external-tasks-entwickeln`);return}let k=await q(),U=K(k),g=(0,i.relative)(t,r),u=y(g),C=d.default,_={identity:U,...s,...d?.config},I=new O.ExternalTaskWorker(N,u,C,_);I.onWorkerError((E,T,Z)=>{c.error(`Intercepted "${E}"-type error: ${T.message}`,{err:T,type:E,externalTask:Z})}),I.start(),await R(k,I),f[e]=I}async function ae(e,t){let s=f[e]?.workerId;B(e),await W(e,t,{workerId:s})}function B(e){let t=f[e];t&&(t.stop(),t.dispose())}async function ie(e){let s=(await m.promises.readdir(e)).filter(r=>w.includes(r));if(s.length===0)return null;if(s.length>1)throw new Error(`Found more than one external task file in directory '${e}'`);return s[0]}async function q(){if(!P)return null;if(!process.env.PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_ID||!process.env.PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_SECRET){let r=new Error("Required environment variables PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_ID and PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_SECRET are missing. For help, please refer to our documentation on environment variables at: https://processcube.io/docs/app-sdk/samples/nextjs/external-task-adapter-with-nextjs#authority");throw c.error("Required environment variables PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_ID and PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_SECRET are missing",{err:r}),r}let e=await v.Issuer.discover(process.env.PROCESSCUBE_AUTHORITY_URL);return await new e.Client({client_id:process.env.PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_ID,client_secret:process.env.PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_SECRET}).grant({grant_type:"client_credentials",scope:"engine_etw"})}function K(e){if(!P||e===null)return ne;let t=e.access_token,s=(0,L.jwtDecode)(t);return{token:e.access_token,userId:s.sub}}async function R(e,t,s=5){try{if(!P||e===null||!t.pollingIsActive)return;let n=await de(e)*oe*1e3;setTimeout(async()=>{if(!t.pollingIsActive)return;let a=await q(),d=K(a);t.identity=d,await R(a,t)},n)}catch(r){if(s===0)throw r;c.error(`Could not refresh identity for external task worker ${t.workerId}`,{err:r,workerId:t.workerId,retryCount:s});let n=2*1e3;setTimeout(async()=>await R(e,t,s-1),n)}}async function ce(e){let t=await(0,b.build)({entryPoints:[e],write:!1,bundle:!0,platform:"node",target:"node18",format:"cjs"});if(t.errors.length>0)throw c.error(`Could not transpile file at '${e}'`,{errors:t.errors}),new Error(`Could not transpile file at '${e}'`);return t.warnings.length>0&&c.warn(`Transpiled file at '${e}' with warnings`,{warnings:t.warnings}),t.outputFiles[0].text}async function le(e,t){try{var s=module.constructor,r=new s;return r._compile(e,t),r.exports}catch(n){throw c.error("Could not require module from string",{err:n}),n}}async function de(e){let t=e.expires_in;if(!t&&e.expires_at&&(t=Math.floor(e.expires_at-Date.now()/1e3)),t===void 0)throw new Error("Could not determine the time until the access token for external task workers expires");return t}function y(e){return e.replace(/^\.\/+|\([^)]+\)|^\/*|\/*$/g,"").replace(/[\/]{2,}/g,"/")}function ue(e){let t,s=[e,(0,i.join)(process.cwd(),"app"),(0,i.join)(process.cwd(),"src","app")];for(let r of s)if(r&&(0,m.existsSync)(r)){t=r;break}if(!t)throw new Error("Could not find external tasks directory");return t}function fe(){return o}var p=require("next/headers"),X=require("next/dist/compiled/@edge-runtime/cookies"),h=require("next-auth/jwt"),pe=process.env.NEXTAUTH_URL?.startsWith("https://"),$=`${pe?"__Secure-":""}next-auth.session-token`;async function Ie(){let e=await(0,h.getToken)({req:{cookies:(0,p.cookies)(),headers:(0,p.headers)()}});if(e?.expiresAt&&Date.now()>=e.expiresAt*1e3){let s=await fetch(`${process.env.NEXTAUTH_URL}/api/auth/session`,{method:"GET",headers:{"Content-Type":"application/json",cookie:(0,p.cookies)().toString()}}),r=new X.ResponseCookies(s.headers),n=r.get($);if(n){let a=!1;try{(0,p.cookies)().set($,n.value,{...n})}catch{a=!0}if(e=await(0,h.getToken)({req:{cookies:a?r:(0,p.cookies)(),headers:(0,p.headers)()}}),e?.error)throw e.error}}if(!e?.accessToken||!e?.sub)throw new Error("AccessToken or Sub could not be determined!");return{token:e?.accessToken,userId:e?.sub}}var j=require("@5minds/processcube_engine_client");async function ke(e){return await o.processInstances.query({...e?.query,state:j.DataModels.ProcessInstances.ProcessInstanceState.running},e?.options)}var l=require("@5minds/processcube_engine_client");async function Te(e={},t){let{correlationId:s,processInstanceId:r,flowNodeId:n}=e;return new Promise(async(a,d)=>{let k=await o.userTasks.onUserTaskWaiting(async u=>{let C=s!==void 0&&u.correlationId!==s,_=u.flowNodeInstanceId===void 0,I=r!==void 0&&u.processInstanceId!==r,E=n!==void 0&&u.flowNodeId!==n;if(C||_||I||E)return;let T=await H(u.flowNodeInstanceId,{identity:t});return o.notification.removeSubscription(k,t),T===null?d(new Error(`UserTask with instance ID "${u.flowNodeInstanceId}" does not exist.`)):a(T)},{identity:t}),g=(await G({correlationId:s,processInstanceId:r,flowNodeId:n,state:l.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:t})).userTasks[0];g&&(o.notification.removeSubscription(k,t),a(g))})}async function me(e,t={},s={},r){await o.userTasks.finishUserTask(e,s,r);let n={state:l.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended,...t};return(await o.userTasks.query(n,{identity:r})).userTasks[0]}async function G(...e){return await o.userTasks.query(...e)}async function ge(e){return await o.userTasks.query({state:l.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},e)}async function Ee(e,t){return await o.userTasks.query({processInstanceId:e,state:l.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},t)}async function we(e,t){return await o.userTasks.query({flowNodeId:e,state:l.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},t)}async function H(e,t){let s=await o.userTasks.query({flowNodeInstanceId:e,state:l.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},{...t,limit:1});return s.userTasks.length===0?null:s.userTasks[0]}async function ye(e,t){return await o.userTasks.query({correlationId:e,state:l.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},t)}async function xe(e,t){let s=await o.userTasks.query({state:l.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:e,...t}),r=s.userTasks.filter(n=>n.actualOwnerId===e.userId);return s.userTasks=r,s}async function Ce(e,t){let s=await o.userTasks.query({state:l.DataModels.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:e,...t}),r=s.userTasks.filter(n=>n.assignedUserIds?.includes(e.userId));return s.userTasks=r,s}var x=require("next/dist/shared/lib/constants");var Y=!1;function _e(e={}){let{applicationSdk:t,...s}=e;return async(r,n)=>{let a=r===x.PHASE_DEVELOPMENT_SERVER||r===x.PHASE_PRODUCTION_SERVER;return t?.useExternalTasks&&a&&!Y&&(Y=!0,await M(t?.customExternalTasksDirPath)),s}}var V=require("next/cache"),J=require("next/navigation");function Se(e){(0,V.revalidatePath)(e),(0,J.redirect)(e)}async function Ne(...e){return await o.processModels.startProcessInstance(...e)}async function Re(...e){await o.userTasks.finishUserTask(...e)}0&&(module.exports={finishUserTask,finishUserTaskAndGetNext,getActiveProcessInstances,getAssignedUserTasksByIdentity,getEngineClient,getIdentity,getReservedUserTasksByIdentity,getUserTasks,getWaitingUserTaskByFlowNodeInstanceId,getWaitingUserTasks,getWaitingUserTasksByCorrelationId,getWaitingUserTasksByFlowNodeId,getWaitingUserTasksByProcessInstanceId,navigateToUrl,startProcess,waitForUserTask,withApplicationSdk});
package/server/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- var Rn=Object.create;var as=Object.defineProperty;var An=Object.getOwnPropertyDescriptor;var Sn=Object.getOwnPropertyNames;var Tn=Object.getPrototypeOf,Cn=Object.prototype.hasOwnProperty;var L=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,s)=>(typeof require<"u"?require:e)[s]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var xn=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Sn(e))!Cn.call(t,n)&&n!==s&&as(t,n,{get:()=>e[n],enumerable:!(r=An(e,n))||r.enumerable});return t};var bn=(t,e,s)=>(s=t!=null?Rn(Tn(t)):{},xn(e||!t||!t.__esModule?as(s,"default",{value:t,enumerable:!0}):s,t));var we=v((cc,ds)=>{"use strict";var In=L("path"),ne="\\\\/",cs=`[^${ne}]`,ie="\\.",vn="\\+",kn="\\?",He="\\/",Nn="(?=.)",ls="[^/]",ot=`(?:${He}|$)`,us=`(?:^|${He})`,at=`${ie}{1,2}${ot}`,On=`(?!${ie})`,Pn=`(?!${us}${at})`,Ln=`(?!${ie}{0,1}${ot})`,Hn=`(?!${at})`,Dn=`[^.${He}]`,Fn=`${ls}*?`,fs={DOT_LITERAL:ie,PLUS_LITERAL:vn,QMARK_LITERAL:kn,SLASH_LITERAL:He,ONE_CHAR:Nn,QMARK:ls,END_ANCHOR:ot,DOTS_SLASH:at,NO_DOT:On,NO_DOTS:Pn,NO_DOT_SLASH:Ln,NO_DOTS_SLASH:Hn,QMARK_NO_DOT:Dn,STAR:Fn,START_ANCHOR:us},$n={...fs,SLASH_LITERAL:`[${ne}]`,QMARK:cs,STAR:`${cs}*?`,DOTS_SLASH:`${ie}{1,2}(?:[${ne}]|$)`,NO_DOT:`(?!${ie})`,NO_DOTS:`(?!(?:^|[${ne}])${ie}{1,2}(?:[${ne}]|$))`,NO_DOT_SLASH:`(?!${ie}{0,1}(?:[${ne}]|$))`,NO_DOTS_SLASH:`(?!${ie}{1,2}(?:[${ne}]|$))`,QMARK_NO_DOT:`[^.${ne}]`,START_ANCHOR:`(?:^|[${ne}])`,END_ANCHOR:`(?:[${ne}]|$)`},Mn={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};ds.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Mn,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:In.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?$n:fs}}});var De=v(Y=>{"use strict";var Un=L("path"),Wn=process.platform==="win32",{REGEX_BACKSLASH:Bn,REGEX_REMOVE_BACKSLASH:Gn,REGEX_SPECIAL_CHARS:qn,REGEX_SPECIAL_CHARS_GLOBAL:Kn}=we();Y.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Y.hasRegexChars=t=>qn.test(t);Y.isRegexChar=t=>t.length===1&&Y.hasRegexChars(t);Y.escapeRegex=t=>t.replace(Kn,"\\$1");Y.toPosixSlashes=t=>t.replace(Bn,"/");Y.removeBackslashes=t=>t.replace(Gn,e=>e==="\\"?"":e);Y.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Y.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:Wn===!0||Un.sep==="\\";Y.escapeLast=(t,e,s)=>{let r=t.lastIndexOf(e,s);return r===-1?t:t[r-1]==="\\"?Y.escapeLast(t,e,r-1):`${t.slice(0,r)}\\${t.slice(r)}`};Y.removePrefix=(t,e={})=>{let s=t;return s.startsWith("./")&&(s=s.slice(2),e.prefix="./"),s};Y.wrapOutput=(t,e={},s={})=>{let r=s.contains?"":"^",n=s.contains?"":"$",o=`${r}(?:${t})${n}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o}});var ws=v((uc,ys)=>{"use strict";var hs=De(),{CHAR_ASTERISK:ct,CHAR_AT:Vn,CHAR_BACKWARD_SLASH:Re,CHAR_COMMA:jn,CHAR_DOT:lt,CHAR_EXCLAMATION_MARK:ut,CHAR_FORWARD_SLASH:ms,CHAR_LEFT_CURLY_BRACE:ft,CHAR_LEFT_PARENTHESES:dt,CHAR_LEFT_SQUARE_BRACKET:Yn,CHAR_PLUS:zn,CHAR_QUESTION_MARK:ps,CHAR_RIGHT_CURLY_BRACE:Xn,CHAR_RIGHT_PARENTHESES:_s,CHAR_RIGHT_SQUARE_BRACKET:Qn}=we(),Es=t=>t===ms||t===Re,gs=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Zn=(t,e)=>{let s=e||{},r=t.length-1,n=s.parts===!0||s.scanToEnd===!0,o=[],i=[],a=[],c=t,d=-1,u=0,f=0,l=!1,m=!1,y=!1,w=!1,S=!1,x=!1,H=!1,F=!1,te=!1,q=!1,ce=0,K,A,I={value:"",depth:0,isGlob:!1},G=()=>d>=r,_=()=>c.charCodeAt(d+1),P=()=>(K=A,c.charCodeAt(++d));for(;d<r;){A=P();let V;if(A===Re){H=I.backslashes=!0,A=P(),A===ft&&(x=!0);continue}if(x===!0||A===ft){for(ce++;G()!==!0&&(A=P());){if(A===Re){H=I.backslashes=!0,P();continue}if(A===ft){ce++;continue}if(x!==!0&&A===lt&&(A=P())===lt){if(l=I.isBrace=!0,y=I.isGlob=!0,q=!0,n===!0)continue;break}if(x!==!0&&A===jn){if(l=I.isBrace=!0,y=I.isGlob=!0,q=!0,n===!0)continue;break}if(A===Xn&&(ce--,ce===0)){x=!1,l=I.isBrace=!0,q=!0;break}}if(n===!0)continue;break}if(A===ms){if(o.push(d),i.push(I),I={value:"",depth:0,isGlob:!1},q===!0)continue;if(K===lt&&d===u+1){u+=2;continue}f=d+1;continue}if(s.noext!==!0&&(A===zn||A===Vn||A===ct||A===ps||A===ut)===!0&&_()===dt){if(y=I.isGlob=!0,w=I.isExtglob=!0,q=!0,A===ut&&d===u&&(te=!0),n===!0){for(;G()!==!0&&(A=P());){if(A===Re){H=I.backslashes=!0,A=P();continue}if(A===_s){y=I.isGlob=!0,q=!0;break}}continue}break}if(A===ct){if(K===ct&&(S=I.isGlobstar=!0),y=I.isGlob=!0,q=!0,n===!0)continue;break}if(A===ps){if(y=I.isGlob=!0,q=!0,n===!0)continue;break}if(A===Yn){for(;G()!==!0&&(V=P());){if(V===Re){H=I.backslashes=!0,P();continue}if(V===Qn){m=I.isBracket=!0,y=I.isGlob=!0,q=!0;break}}if(n===!0)continue;break}if(s.nonegate!==!0&&A===ut&&d===u){F=I.negated=!0,u++;continue}if(s.noparen!==!0&&A===dt){if(y=I.isGlob=!0,n===!0){for(;G()!==!0&&(A=P());){if(A===dt){H=I.backslashes=!0,A=P();continue}if(A===_s){q=!0;break}}continue}break}if(y===!0){if(q=!0,n===!0)continue;break}}s.noext===!0&&(w=!1,y=!1);let N=c,le="",h="";u>0&&(le=c.slice(0,u),c=c.slice(u),f-=u),N&&y===!0&&f>0?(N=c.slice(0,f),h=c.slice(f)):y===!0?(N="",h=c):N=c,N&&N!==""&&N!=="/"&&N!==c&&Es(N.charCodeAt(N.length-1))&&(N=N.slice(0,-1)),s.unescape===!0&&(h&&(h=hs.removeBackslashes(h)),N&&H===!0&&(N=hs.removeBackslashes(N)));let p={prefix:le,input:t,start:u,base:N,glob:h,isBrace:l,isBracket:m,isGlob:y,isExtglob:w,isGlobstar:S,negated:F,negatedExtglob:te};if(s.tokens===!0&&(p.maxDepth=0,Es(A)||i.push(I),p.tokens=i),s.parts===!0||s.tokens===!0){let V;for(let b=0;b<o.length;b++){let se=V?V+1:u,re=o[b],z=t.slice(se,re);s.tokens&&(b===0&&u!==0?(i[b].isPrefix=!0,i[b].value=le):i[b].value=z,gs(i[b]),p.maxDepth+=i[b].depth),(b!==0||z!=="")&&a.push(z),V=re}if(V&&V+1<t.length){let b=t.slice(V+1);a.push(b),s.tokens&&(i[i.length-1].value=b,gs(i[i.length-1]),p.maxDepth+=i[i.length-1].depth)}p.slashes=o,p.parts=a}return p};ys.exports=Zn});var Ss=v((fc,As)=>{"use strict";var Fe=we(),X=De(),{MAX_LENGTH:$e,POSIX_REGEX_SOURCE:Jn,REGEX_NON_SPECIAL_CHARS:ei,REGEX_SPECIAL_CHARS_BACKREF:ti,REPLACEMENTS:Rs}=Fe,si=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let s=`[${t.join("-")}]`;try{new RegExp(s)}catch{return t.map(n=>X.escapeRegex(n)).join("..")}return s},_e=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,ht=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=Rs[t]||t;let s={...e},r=typeof s.maxLength=="number"?Math.min($e,s.maxLength):$e,n=t.length;if(n>r)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${r}`);let o={type:"bos",value:"",output:s.prepend||""},i=[o],a=s.capture?"":"?:",c=X.isWindows(e),d=Fe.globChars(c),u=Fe.extglobChars(d),{DOT_LITERAL:f,PLUS_LITERAL:l,SLASH_LITERAL:m,ONE_CHAR:y,DOTS_SLASH:w,NO_DOT:S,NO_DOT_SLASH:x,NO_DOTS_SLASH:H,QMARK:F,QMARK_NO_DOT:te,STAR:q,START_ANCHOR:ce}=d,K=g=>`(${a}(?:(?!${ce}${g.dot?w:f}).)*?)`,A=s.dot?"":S,I=s.dot?F:te,G=s.bash===!0?K(s):q;s.capture&&(G=`(${G})`),typeof s.noext=="boolean"&&(s.noextglob=s.noext);let _={input:t,index:-1,start:0,dot:s.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};t=X.removePrefix(t,_),n=t.length;let P=[],N=[],le=[],h=o,p,V=()=>_.index===n-1,b=_.peek=(g=1)=>t[_.index+g],se=_.advance=()=>t[++_.index]||"",re=()=>t.slice(_.index+1),z=(g="",O=0)=>{_.consumed+=g,_.index+=O},Ne=g=>{_.output+=g.output!=null?g.output:g.value,z(g.value)},yn=()=>{let g=1;for(;b()==="!"&&(b(2)!=="("||b(3)==="?");)se(),_.start++,g++;return g%2===0?!1:(_.negated=!0,_.start++,!0)},Oe=g=>{_[g]++,le.push(g)},fe=g=>{_[g]--,le.pop()},C=g=>{if(h.type==="globstar"){let O=_.braces>0&&(g.type==="comma"||g.type==="brace"),E=g.extglob===!0||P.length&&(g.type==="pipe"||g.type==="paren");g.type!=="slash"&&g.type!=="paren"&&!O&&!E&&(_.output=_.output.slice(0,-h.output.length),h.type="star",h.value="*",h.output=G,_.output+=h.output)}if(P.length&&g.type!=="paren"&&(P[P.length-1].inner+=g.value),(g.value||g.output)&&Ne(g),h&&h.type==="text"&&g.type==="text"){h.value+=g.value,h.output=(h.output||"")+g.value;return}g.prev=h,i.push(g),h=g},Pe=(g,O)=>{let E={...u[O],conditions:1,inner:""};E.prev=h,E.parens=_.parens,E.output=_.output;let T=(s.capture?"(":"")+E.open;Oe("parens"),C({type:g,value:O,output:_.output?"":y}),C({type:"paren",extglob:!0,value:se(),output:T}),P.push(E)},wn=g=>{let O=g.close+(s.capture?")":""),E;if(g.type==="negate"){let T=G;if(g.inner&&g.inner.length>1&&g.inner.includes("/")&&(T=K(s)),(T!==G||V()||/^\)+$/.test(re()))&&(O=g.close=`)$))${T}`),g.inner.includes("*")&&(E=re())&&/^\.[^\\/.]+$/.test(E)){let D=ht(E,{...e,fastpaths:!1}).output;O=g.close=`)${D})${T})`}g.prev.type==="bos"&&(_.negatedExtglob=!0)}C({type:"paren",extglob:!0,value:p,output:O}),fe("parens")};if(s.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let g=!1,O=t.replace(ti,(E,T,D,j,U,it)=>j==="\\"?(g=!0,E):j==="?"?T?T+j+(U?F.repeat(U.length):""):it===0?I+(U?F.repeat(U.length):""):F.repeat(D.length):j==="."?f.repeat(D.length):j==="*"?T?T+j+(U?G:""):G:T?E:`\\${E}`);return g===!0&&(s.unescape===!0?O=O.replace(/\\/g,""):O=O.replace(/\\+/g,E=>E.length%2===0?"\\\\":E?"\\":"")),O===t&&s.contains===!0?(_.output=t,_):(_.output=X.wrapOutput(O,_,e),_)}for(;!V();){if(p=se(),p==="\0")continue;if(p==="\\"){let E=b();if(E==="/"&&s.bash!==!0||E==="."||E===";")continue;if(!E){p+="\\",C({type:"text",value:p});continue}let T=/^\\+/.exec(re()),D=0;if(T&&T[0].length>2&&(D=T[0].length,_.index+=D,D%2!==0&&(p+="\\")),s.unescape===!0?p=se():p+=se(),_.brackets===0){C({type:"text",value:p});continue}}if(_.brackets>0&&(p!=="]"||h.value==="["||h.value==="[^")){if(s.posix!==!1&&p===":"){let E=h.value.slice(1);if(E.includes("[")&&(h.posix=!0,E.includes(":"))){let T=h.value.lastIndexOf("["),D=h.value.slice(0,T),j=h.value.slice(T+2),U=Jn[j];if(U){h.value=D+U,_.backtrack=!0,se(),!o.output&&i.indexOf(h)===1&&(o.output=y);continue}}}(p==="["&&b()!==":"||p==="-"&&b()==="]")&&(p=`\\${p}`),p==="]"&&(h.value==="["||h.value==="[^")&&(p=`\\${p}`),s.posix===!0&&p==="!"&&h.value==="["&&(p="^"),h.value+=p,Ne({value:p});continue}if(_.quotes===1&&p!=='"'){p=X.escapeRegex(p),h.value+=p,Ne({value:p});continue}if(p==='"'){_.quotes=_.quotes===1?0:1,s.keepQuotes===!0&&C({type:"text",value:p});continue}if(p==="("){Oe("parens"),C({type:"paren",value:p});continue}if(p===")"){if(_.parens===0&&s.strictBrackets===!0)throw new SyntaxError(_e("opening","("));let E=P[P.length-1];if(E&&_.parens===E.parens+1){wn(P.pop());continue}C({type:"paren",value:p,output:_.parens?")":"\\)"}),fe("parens");continue}if(p==="["){if(s.nobracket===!0||!re().includes("]")){if(s.nobracket!==!0&&s.strictBrackets===!0)throw new SyntaxError(_e("closing","]"));p=`\\${p}`}else Oe("brackets");C({type:"bracket",value:p});continue}if(p==="]"){if(s.nobracket===!0||h&&h.type==="bracket"&&h.value.length===1){C({type:"text",value:p,output:`\\${p}`});continue}if(_.brackets===0){if(s.strictBrackets===!0)throw new SyntaxError(_e("opening","["));C({type:"text",value:p,output:`\\${p}`});continue}fe("brackets");let E=h.value.slice(1);if(h.posix!==!0&&E[0]==="^"&&!E.includes("/")&&(p=`/${p}`),h.value+=p,Ne({value:p}),s.literalBrackets===!1||X.hasRegexChars(E))continue;let T=X.escapeRegex(h.value);if(_.output=_.output.slice(0,-h.value.length),s.literalBrackets===!0){_.output+=T,h.value=T;continue}h.value=`(${a}${T}|${h.value})`,_.output+=h.value;continue}if(p==="{"&&s.nobrace!==!0){Oe("braces");let E={type:"brace",value:p,output:"(",outputIndex:_.output.length,tokensIndex:_.tokens.length};N.push(E),C(E);continue}if(p==="}"){let E=N[N.length-1];if(s.nobrace===!0||!E){C({type:"text",value:p,output:p});continue}let T=")";if(E.dots===!0){let D=i.slice(),j=[];for(let U=D.length-1;U>=0&&(i.pop(),D[U].type!=="brace");U--)D[U].type!=="dots"&&j.unshift(D[U].value);T=si(j,s),_.backtrack=!0}if(E.comma!==!0&&E.dots!==!0){let D=_.output.slice(0,E.outputIndex),j=_.tokens.slice(E.tokensIndex);E.value=E.output="\\{",p=T="\\}",_.output=D;for(let U of j)_.output+=U.output||U.value}C({type:"brace",value:p,output:T}),fe("braces"),N.pop();continue}if(p==="|"){P.length>0&&P[P.length-1].conditions++,C({type:"text",value:p});continue}if(p===","){let E=p,T=N[N.length-1];T&&le[le.length-1]==="braces"&&(T.comma=!0,E="|"),C({type:"comma",value:p,output:E});continue}if(p==="/"){if(h.type==="dot"&&_.index===_.start+1){_.start=_.index+1,_.consumed="",_.output="",i.pop(),h=o;continue}C({type:"slash",value:p,output:m});continue}if(p==="."){if(_.braces>0&&h.type==="dot"){h.value==="."&&(h.output=f);let E=N[N.length-1];h.type="dots",h.output+=p,h.value+=p,E.dots=!0;continue}if(_.braces+_.parens===0&&h.type!=="bos"&&h.type!=="slash"){C({type:"text",value:p,output:f});continue}C({type:"dot",value:p,output:f});continue}if(p==="?"){if(!(h&&h.value==="(")&&s.noextglob!==!0&&b()==="("&&b(2)!=="?"){Pe("qmark",p);continue}if(h&&h.type==="paren"){let T=b(),D=p;if(T==="<"&&!X.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(h.value==="("&&!/[!=<:]/.test(T)||T==="<"&&!/<([!=]|\w+>)/.test(re()))&&(D=`\\${p}`),C({type:"text",value:p,output:D});continue}if(s.dot!==!0&&(h.type==="slash"||h.type==="bos")){C({type:"qmark",value:p,output:te});continue}C({type:"qmark",value:p,output:F});continue}if(p==="!"){if(s.noextglob!==!0&&b()==="("&&(b(2)!=="?"||!/[!=<:]/.test(b(3)))){Pe("negate",p);continue}if(s.nonegate!==!0&&_.index===0){yn();continue}}if(p==="+"){if(s.noextglob!==!0&&b()==="("&&b(2)!=="?"){Pe("plus",p);continue}if(h&&h.value==="("||s.regex===!1){C({type:"plus",value:p,output:l});continue}if(h&&(h.type==="bracket"||h.type==="paren"||h.type==="brace")||_.parens>0){C({type:"plus",value:p});continue}C({type:"plus",value:l});continue}if(p==="@"){if(s.noextglob!==!0&&b()==="("&&b(2)!=="?"){C({type:"at",extglob:!0,value:p,output:""});continue}C({type:"text",value:p});continue}if(p!=="*"){(p==="$"||p==="^")&&(p=`\\${p}`);let E=ei.exec(re());E&&(p+=E[0],_.index+=E[0].length),C({type:"text",value:p});continue}if(h&&(h.type==="globstar"||h.star===!0)){h.type="star",h.star=!0,h.value+=p,h.output=G,_.backtrack=!0,_.globstar=!0,z(p);continue}let g=re();if(s.noextglob!==!0&&/^\([^?]/.test(g)){Pe("star",p);continue}if(h.type==="star"){if(s.noglobstar===!0){z(p);continue}let E=h.prev,T=E.prev,D=E.type==="slash"||E.type==="bos",j=T&&(T.type==="star"||T.type==="globstar");if(s.bash===!0&&(!D||g[0]&&g[0]!=="/")){C({type:"star",value:p,output:""});continue}let U=_.braces>0&&(E.type==="comma"||E.type==="brace"),it=P.length&&(E.type==="pipe"||E.type==="paren");if(!D&&E.type!=="paren"&&!U&&!it){C({type:"star",value:p,output:""});continue}for(;g.slice(0,3)==="/**";){let Le=t[_.index+4];if(Le&&Le!=="/")break;g=g.slice(3),z("/**",3)}if(E.type==="bos"&&V()){h.type="globstar",h.value+=p,h.output=K(s),_.output=h.output,_.globstar=!0,z(p);continue}if(E.type==="slash"&&E.prev.type!=="bos"&&!j&&V()){_.output=_.output.slice(0,-(E.output+h.output).length),E.output=`(?:${E.output}`,h.type="globstar",h.output=K(s)+(s.strictSlashes?")":"|$)"),h.value+=p,_.globstar=!0,_.output+=E.output+h.output,z(p);continue}if(E.type==="slash"&&E.prev.type!=="bos"&&g[0]==="/"){let Le=g[1]!==void 0?"|$":"";_.output=_.output.slice(0,-(E.output+h.output).length),E.output=`(?:${E.output}`,h.type="globstar",h.output=`${K(s)}${m}|${m}${Le})`,h.value+=p,_.output+=E.output+h.output,_.globstar=!0,z(p+se()),C({type:"slash",value:"/",output:""});continue}if(E.type==="bos"&&g[0]==="/"){h.type="globstar",h.value+=p,h.output=`(?:^|${m}|${K(s)}${m})`,_.output=h.output,_.globstar=!0,z(p+se()),C({type:"slash",value:"/",output:""});continue}_.output=_.output.slice(0,-h.output.length),h.type="globstar",h.output=K(s),h.value+=p,_.output+=h.output,_.globstar=!0,z(p);continue}let O={type:"star",value:p,output:G};if(s.bash===!0){O.output=".*?",(h.type==="bos"||h.type==="slash")&&(O.output=A+O.output),C(O);continue}if(h&&(h.type==="bracket"||h.type==="paren")&&s.regex===!0){O.output=p,C(O);continue}(_.index===_.start||h.type==="slash"||h.type==="dot")&&(h.type==="dot"?(_.output+=x,h.output+=x):s.dot===!0?(_.output+=H,h.output+=H):(_.output+=A,h.output+=A),b()!=="*"&&(_.output+=y,h.output+=y)),C(O)}for(;_.brackets>0;){if(s.strictBrackets===!0)throw new SyntaxError(_e("closing","]"));_.output=X.escapeLast(_.output,"["),fe("brackets")}for(;_.parens>0;){if(s.strictBrackets===!0)throw new SyntaxError(_e("closing",")"));_.output=X.escapeLast(_.output,"("),fe("parens")}for(;_.braces>0;){if(s.strictBrackets===!0)throw new SyntaxError(_e("closing","}"));_.output=X.escapeLast(_.output,"{"),fe("braces")}if(s.strictSlashes!==!0&&(h.type==="star"||h.type==="bracket")&&C({type:"maybe_slash",value:"",output:`${m}?`}),_.backtrack===!0){_.output="";for(let g of _.tokens)_.output+=g.output!=null?g.output:g.value,g.suffix&&(_.output+=g.suffix)}return _};ht.fastpaths=(t,e)=>{let s={...e},r=typeof s.maxLength=="number"?Math.min($e,s.maxLength):$e,n=t.length;if(n>r)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${r}`);t=Rs[t]||t;let o=X.isWindows(e),{DOT_LITERAL:i,SLASH_LITERAL:a,ONE_CHAR:c,DOTS_SLASH:d,NO_DOT:u,NO_DOTS:f,NO_DOTS_SLASH:l,STAR:m,START_ANCHOR:y}=Fe.globChars(o),w=s.dot?f:u,S=s.dot?l:u,x=s.capture?"":"?:",H={negated:!1,prefix:""},F=s.bash===!0?".*?":m;s.capture&&(F=`(${F})`);let te=A=>A.noglobstar===!0?F:`(${x}(?:(?!${y}${A.dot?d:i}).)*?)`,q=A=>{switch(A){case"*":return`${w}${c}${F}`;case".*":return`${i}${c}${F}`;case"*.*":return`${w}${F}${i}${c}${F}`;case"*/*":return`${w}${F}${a}${c}${S}${F}`;case"**":return w+te(s);case"**/*":return`(?:${w}${te(s)}${a})?${S}${c}${F}`;case"**/*.*":return`(?:${w}${te(s)}${a})?${S}${F}${i}${c}${F}`;case"**/.*":return`(?:${w}${te(s)}${a})?${i}${c}${F}`;default:{let I=/^(.*?)\.(\w+)$/.exec(A);if(!I)return;let G=q(I[1]);return G?G+i+I[2]:void 0}}},ce=X.removePrefix(t,H),K=q(ce);return K&&s.strictSlashes!==!0&&(K+=`${a}?`),K};As.exports=ht});var Cs=v((dc,Ts)=>{"use strict";var ri=L("path"),ni=ws(),pt=Ss(),_t=De(),ii=we(),oi=t=>t&&typeof t=="object"&&!Array.isArray(t),M=(t,e,s=!1)=>{if(Array.isArray(t)){let u=t.map(l=>M(l,e,s));return l=>{for(let m of u){let y=m(l);if(y)return y}return!1}}let r=oi(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!r)throw new TypeError("Expected pattern to be a non-empty string");let n=e||{},o=_t.isWindows(e),i=r?M.compileRe(t,e):M.makeRe(t,e,!1,!0),a=i.state;delete i.state;let c=()=>!1;if(n.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=M(n.ignore,u,s)}let d=(u,f=!1)=>{let{isMatch:l,match:m,output:y}=M.test(u,i,e,{glob:t,posix:o}),w={glob:t,state:a,regex:i,posix:o,input:u,output:y,match:m,isMatch:l};return typeof n.onResult=="function"&&n.onResult(w),l===!1?(w.isMatch=!1,f?w:!1):c(u)?(typeof n.onIgnore=="function"&&n.onIgnore(w),w.isMatch=!1,f?w:!1):(typeof n.onMatch=="function"&&n.onMatch(w),f?w:!0)};return s&&(d.state=a),d};M.test=(t,e,s,{glob:r,posix:n}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=s||{},i=o.format||(n?_t.toPosixSlashes:null),a=t===r,c=a&&i?i(t):t;return a===!1&&(c=i?i(t):t,a=c===r),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=M.matchBase(t,e,s,n):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};M.matchBase=(t,e,s,r=_t.isWindows(s))=>(e instanceof RegExp?e:M.makeRe(e,s)).test(ri.basename(t));M.isMatch=(t,e,s)=>M(e,s)(t);M.parse=(t,e)=>Array.isArray(t)?t.map(s=>M.parse(s,e)):pt(t,{...e,fastpaths:!1});M.scan=(t,e)=>ni(t,e);M.compileRe=(t,e,s=!1,r=!1)=>{if(s===!0)return t.output;let n=e||{},o=n.contains?"":"^",i=n.contains?"":"$",a=`${o}(?:${t.output})${i}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=M.toRegex(a,e);return r===!0&&(c.state=t),c};M.makeRe=(t,e={},s=!1,r=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(n.output=pt.fastpaths(t,e)),n.output||(n=pt(t,e)),M.compileRe(n,e,s,r)};M.toRegex=(t,e)=>{try{let s=e||{};return new RegExp(t,s.flags||(s.nocase?"i":""))}catch(s){if(e&&e.debug===!0)throw s;return/$^/}};M.constants=ii;Ts.exports=M});var Et=v((hc,xs)=>{"use strict";xs.exports=Cs()});var Ls=v((pc,Ps)=>{"use strict";var Se=L("fs"),{Readable:ai}=L("stream"),Ae=L("path"),{promisify:Be}=L("util"),gt=Et(),ci=Be(Se.readdir),li=Be(Se.stat),bs=Be(Se.lstat),ui=Be(Se.realpath),fi="!",Ns="READDIRP_RECURSIVE_ERROR",di=new Set(["ENOENT","EPERM","EACCES","ELOOP",Ns]),mt="files",Os="directories",Ue="files_directories",Me="all",Is=[mt,Os,Ue,Me],hi=t=>di.has(t.code),[vs,pi]=process.versions.node.split(".").slice(0,2).map(t=>Number.parseInt(t,10)),_i=process.platform==="win32"&&(vs>10||vs===10&&pi>=5),ks=t=>{if(t!==void 0){if(typeof t=="function")return t;if(typeof t=="string"){let e=gt(t.trim());return s=>e(s.basename)}if(Array.isArray(t)){let e=[],s=[];for(let r of t){let n=r.trim();n.charAt(0)===fi?s.push(gt(n.slice(1))):e.push(gt(n))}return s.length>0?e.length>0?r=>e.some(n=>n(r.basename))&&!s.some(n=>n(r.basename)):r=>!s.some(n=>n(r.basename)):r=>e.some(n=>n(r.basename))}}},We=class t extends ai{static get defaultOptions(){return{root:".",fileFilter:e=>!0,directoryFilter:e=>!0,type:mt,lstat:!1,depth:2147483648,alwaysStat:!1}}constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark||4096});let s={...t.defaultOptions,...e},{root:r,type:n}=s;this._fileFilter=ks(s.fileFilter),this._directoryFilter=ks(s.directoryFilter);let o=s.lstat?bs:li;_i?this._stat=i=>o(i,{bigint:!0}):this._stat=o,this._maxDepth=s.depth,this._wantsDir=[Os,Ue,Me].includes(n),this._wantsFile=[mt,Ue,Me].includes(n),this._wantsEverything=n===Me,this._root=Ae.resolve(r),this._isDirent="Dirent"in Se&&!s.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(r,1)],this.reading=!1,this.parent=void 0}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let{path:s,depth:r,files:n=[]}=this.parent||{};if(n.length>0){let o=n.splice(0,e).map(i=>this._formatEntry(i,s));for(let i of await Promise.all(o)){if(this.destroyed)return;let a=await this._getEntryType(i);a==="directory"&&this._directoryFilter(i)?(r<=this._maxDepth&&this.parents.push(this._exploreDir(i.fullPath,r+1)),this._wantsDir&&(this.push(i),e--)):(a==="file"||this._includeAsFile(i))&&this._fileFilter(i)&&this._wantsFile&&(this.push(i),e--)}}else{let o=this.parents.pop();if(!o){this.push(null);break}if(this.parent=await o,this.destroyed)return}}}catch(s){this.destroy(s)}finally{this.reading=!1}}}async _exploreDir(e,s){let r;try{r=await ci(e,this._rdOptions)}catch(n){this._onError(n)}return{files:r,depth:s,path:e}}async _formatEntry(e,s){let r;try{let n=this._isDirent?e.name:e,o=Ae.resolve(Ae.join(s,n));r={path:Ae.relative(this._root,o),fullPath:o,basename:n},r[this._statsProp]=this._isDirent?e:await this._stat(o)}catch(n){this._onError(n)}return r}_onError(e){hi(e)&&!this.destroyed?this.emit("warn",e):this.destroy(e)}async _getEntryType(e){let s=e&&e[this._statsProp];if(s){if(s.isFile())return"file";if(s.isDirectory())return"directory";if(s&&s.isSymbolicLink()){let r=e.fullPath;try{let n=await ui(r),o=await bs(n);if(o.isFile())return"file";if(o.isDirectory()){let i=n.length;if(r.startsWith(n)&&r.substr(i,1)===Ae.sep){let a=new Error(`Circular symlink detected: "${r}" points to "${n}"`);return a.code=Ns,this._onError(a)}return"directory"}}catch(n){this._onError(n)}}}}_includeAsFile(e){let s=e&&e[this._statsProp];return s&&this._wantsEverything&&!s.isDirectory()}},Ee=(t,e={})=>{let s=e.entryType||e.type;if(s==="both"&&(s=Ue),s&&(e.type=s),t){if(typeof t!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(s&&!Is.includes(s))throw new Error(`readdirp: Invalid type passed. Use one of ${Is.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return e.root=t,new We(e)},Ei=(t,e={})=>new Promise((s,r)=>{let n=[];Ee(t,e).on("data",o=>n.push(o)).on("end",()=>s(n)).on("error",o=>r(o))});Ee.promise=Ei;Ee.ReaddirpStream=We;Ee.default=Ee;Ps.exports=Ee});var yt=v((_c,Hs)=>{Hs.exports=function(t,e){if(typeof t!="string")throw new TypeError("expected path to be a string");if(t==="\\"||t==="/")return"/";var s=t.length;if(s<=1)return t;var r="";if(s>4&&t[3]==="\\"){var n=t[2];(n==="?"||n===".")&&t.slice(0,2)==="\\\\"&&(t=t.slice(2),r="//")}var o=t.split(/[/\\]+/);return e!==!1&&o[o.length-1]===""&&o.pop(),r+o.join("/")}});var Ws=v((Ms,Us)=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0});var $s=Et(),gi=yt(),Ds="!",mi={returnIndex:!1},yi=t=>Array.isArray(t)?t:[t],wi=(t,e)=>{if(typeof t=="function")return t;if(typeof t=="string"){let s=$s(t,e);return r=>t===r||s(r)}return t instanceof RegExp?s=>t.test(s):s=>!1},Fs=(t,e,s,r)=>{let n=Array.isArray(s),o=n?s[0]:s;if(!n&&typeof o!="string")throw new TypeError("anymatch: second argument must be a string: got "+Object.prototype.toString.call(o));let i=gi(o,!1);for(let c=0;c<e.length;c++){let d=e[c];if(d(i))return r?-1:!1}let a=n&&[i].concat(s.slice(1));for(let c=0;c<t.length;c++){let d=t[c];if(n?d(...a):d(i))return r?c:!0}return r?-1:!1},wt=(t,e,s=mi)=>{if(t==null)throw new TypeError("anymatch: specify first argument");let r=typeof s=="boolean"?{returnIndex:s}:s,n=r.returnIndex||!1,o=yi(t),i=o.filter(c=>typeof c=="string"&&c.charAt(0)===Ds).map(c=>c.slice(1)).map(c=>$s(c,r)),a=o.filter(c=>typeof c!="string"||typeof c=="string"&&c.charAt(0)!==Ds).map(c=>wi(c,r));return e==null?(c,d=!1)=>Fs(a,i,c,typeof d=="boolean"?d:!1):Fs(a,i,e,n)};wt.default=wt;Us.exports=wt});var Gs=v((Ec,Bs)=>{Bs.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var s;s=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(s[2])return!0;e=e.slice(s.index+s[0].length)}return!1}});var Rt=v((gc,Ks)=>{var Ri=Gs(),qs={"{":"}","(":")","[":"]"},Ai=function(t){if(t[0]==="!")return!0;for(var e=0,s=-2,r=-2,n=-2,o=-2,i=-2;e<t.length;){if(t[e]==="*"||t[e+1]==="?"&&/[\].+)]/.test(t[e])||r!==-1&&t[e]==="["&&t[e+1]!=="]"&&(r<e&&(r=t.indexOf("]",e)),r>e&&(i===-1||i>r||(i=t.indexOf("\\",e),i===-1||i>r)))||n!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(n=t.indexOf("}",e),n>e&&(i=t.indexOf("\\",e),i===-1||i>n))||o!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(o=t.indexOf(")",e),o>e&&(i=t.indexOf("\\",e),i===-1||i>o))||s!==-1&&t[e]==="("&&t[e+1]!=="|"&&(s<e&&(s=t.indexOf("|",e)),s!==-1&&t[s+1]!==")"&&(o=t.indexOf(")",s),o>s&&(i=t.indexOf("\\",s),i===-1||i>o))))return!0;if(t[e]==="\\"){var a=t[e+1];e+=2;var c=qs[a];if(c){var d=t.indexOf(c,e);d!==-1&&(e=d+1)}if(t[e]==="!")return!0}else e++}return!1},Si=function(t){if(t[0]==="!")return!0;for(var e=0;e<t.length;){if(/[*?{}()[\]]/.test(t[e]))return!0;if(t[e]==="\\"){var s=t[e+1];e+=2;var r=qs[s];if(r){var n=t.indexOf(r,e);n!==-1&&(e=n+1)}if(t[e]==="!")return!0}else e++}return!1};Ks.exports=function(e,s){if(typeof e!="string"||e==="")return!1;if(Ri(e))return!0;var r=Ai;return s&&s.strict===!1&&(r=Si),r(e)}});var js=v((mc,Vs)=>{"use strict";var Ti=Rt(),Ci=L("path").posix.dirname,xi=L("os").platform()==="win32",At="/",bi=/\\/g,Ii=/[\{\[].*[\}\]]$/,vi=/(^|[^\\])([\{\[]|\([^\)]+$)/,ki=/\\([\!\*\?\|\[\]\(\)\{\}])/g;Vs.exports=function(e,s){var r=Object.assign({flipBackslashes:!0},s);r.flipBackslashes&&xi&&e.indexOf(At)<0&&(e=e.replace(bi,At)),Ii.test(e)&&(e+=At),e+="a";do e=Ci(e);while(Ti(e)||vi.test(e));return e.replace(ki,"$1")}});var Ge=v(Z=>{"use strict";Z.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;Z.find=(t,e)=>t.nodes.find(s=>s.type===e);Z.exceedsLimit=(t,e,s=1,r)=>r===!1||!Z.isInteger(t)||!Z.isInteger(e)?!1:(Number(e)-Number(t))/Number(s)>=r;Z.escapeNode=(t,e=0,s)=>{let r=t.nodes[e];r&&(s&&r.type===s||r.type==="open"||r.type==="close")&&r.escaped!==!0&&(r.value="\\"+r.value,r.escaped=!0)};Z.encloseBrace=t=>t.type!=="brace"||t.commas>>0+t.ranges>>0?!1:(t.invalid=!0,!0);Z.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:!(t.commas>>0+t.ranges>>0)||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;Z.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;Z.reduce=t=>t.reduce((e,s)=>(s.type==="text"&&e.push(s.value),s.type==="range"&&(s.type="text"),e),[]);Z.flatten=(...t)=>{let e=[],s=r=>{for(let n=0;n<r.length;n++){let o=r[n];Array.isArray(o)?s(o,e):o!==void 0&&e.push(o)}return e};return s(t),e}});var qe=v((wc,zs)=>{"use strict";var Ys=Ge();zs.exports=(t,e={})=>{let s=(r,n={})=>{let o=e.escapeInvalid&&Ys.isInvalidBrace(n),i=r.invalid===!0&&e.escapeInvalid===!0,a="";if(r.value)return(o||i)&&Ys.isOpenOrClose(r)?"\\"+r.value:r.value;if(r.value)return r.value;if(r.nodes)for(let c of r.nodes)a+=s(c);return a};return s(t)}});var Qs=v((Rc,Xs)=>{"use strict";Xs.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var or=v((Ac,ir)=>{"use strict";var Zs=Qs(),de=(t,e,s)=>{if(Zs(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(Zs(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let r={relaxZeros:!0,...s};typeof r.strictZeros=="boolean"&&(r.relaxZeros=r.strictZeros===!1);let n=String(r.relaxZeros),o=String(r.shorthand),i=String(r.capture),a=String(r.wrap),c=t+":"+e+"="+n+o+i+a;if(de.cache.hasOwnProperty(c))return de.cache[c].result;let d=Math.min(t,e),u=Math.max(t,e);if(Math.abs(d-u)===1){let w=t+"|"+e;return r.capture?`(${w})`:r.wrap===!1?w:`(?:${w})`}let f=nr(t)||nr(e),l={min:t,max:e,a:d,b:u},m=[],y=[];if(f&&(l.isPadded=f,l.maxLen=String(l.max).length),d<0){let w=u<0?Math.abs(u):1;y=Js(w,Math.abs(d),l,r),d=l.a=0}return u>=0&&(m=Js(d,u,l,r)),l.negatives=y,l.positives=m,l.result=Ni(y,m,r),r.capture===!0?l.result=`(${l.result})`:r.wrap!==!1&&m.length+y.length>1&&(l.result=`(?:${l.result})`),de.cache[c]=l,l.result};function Ni(t,e,s){let r=St(t,e,"-",!1,s)||[],n=St(e,t,"",!1,s)||[],o=St(t,e,"-?",!0,s)||[];return r.concat(o).concat(n).join("|")}function Oi(t,e){let s=1,r=1,n=tr(t,s),o=new Set([e]);for(;t<=n&&n<=e;)o.add(n),s+=1,n=tr(t,s);for(n=sr(e+1,r)-1;t<n&&n<=e;)o.add(n),r+=1,n=sr(e+1,r)-1;return o=[...o],o.sort(Hi),o}function Pi(t,e,s){if(t===e)return{pattern:t,count:[],digits:0};let r=Li(t,e),n=r.length,o="",i=0;for(let a=0;a<n;a++){let[c,d]=r[a];c===d?o+=c:c!=="0"||d!=="9"?o+=Di(c,d,s):i++}return i&&(o+=s.shorthand===!0?"\\d":"[0-9]"),{pattern:o,count:[i],digits:n}}function Js(t,e,s,r){let n=Oi(t,e),o=[],i=t,a;for(let c=0;c<n.length;c++){let d=n[c],u=Pi(String(i),String(d),r),f="";if(!s.isPadded&&a&&a.pattern===u.pattern){a.count.length>1&&a.count.pop(),a.count.push(u.count[0]),a.string=a.pattern+rr(a.count),i=d+1;continue}s.isPadded&&(f=Fi(d,s,r)),u.string=f+u.pattern+rr(u.count),o.push(u),i=d+1,a=u}return o}function St(t,e,s,r,n){let o=[];for(let i of t){let{string:a}=i;!r&&!er(e,"string",a)&&o.push(s+a),r&&er(e,"string",a)&&o.push(s+a)}return o}function Li(t,e){let s=[];for(let r=0;r<t.length;r++)s.push([t[r],e[r]]);return s}function Hi(t,e){return t>e?1:e>t?-1:0}function er(t,e,s){return t.some(r=>r[e]===s)}function tr(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function sr(t,e){return t-t%Math.pow(10,e)}function rr(t){let[e=0,s=""]=t;return s||e>1?`{${e+(s?","+s:"")}}`:""}function Di(t,e,s){return`[${t}${e-t===1?"":"-"}${e}]`}function nr(t){return/^-?(0+)\d/.test(t)}function Fi(t,e,s){if(!e.isPadded)return t;let r=Math.abs(e.maxLen-String(t).length),n=s.relaxZeros!==!1;switch(r){case 0:return"";case 1:return n?"0?":"0";case 2:return n?"0{0,2}":"00";default:return n?`0{0,${r}}`:`0{${r}}`}}de.cache={};de.clearCache=()=>de.cache={};ir.exports=de});var xt=v((Sc,pr)=>{"use strict";var $i=L("util"),lr=or(),ar=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Mi=t=>e=>t===!0?Number(e):String(e),Tt=t=>typeof t=="number"||typeof t=="string"&&t!=="",Te=t=>Number.isInteger(+t),Ct=t=>{let e=`${t}`,s=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++s]==="0";);return s>0},Ui=(t,e,s)=>typeof t=="string"||typeof e=="string"?!0:s.stringify===!0,Wi=(t,e,s)=>{if(e>0){let r=t[0]==="-"?"-":"";r&&(t=t.slice(1)),t=r+t.padStart(r?e-1:e,"0")}return s===!1?String(t):t},cr=(t,e)=>{let s=t[0]==="-"?"-":"";for(s&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return s?"-"+t:t},Bi=(t,e)=>{t.negatives.sort((i,a)=>i<a?-1:i>a?1:0),t.positives.sort((i,a)=>i<a?-1:i>a?1:0);let s=e.capture?"":"?:",r="",n="",o;return t.positives.length&&(r=t.positives.join("|")),t.negatives.length&&(n=`-(${s}${t.negatives.join("|")})`),r&&n?o=`${r}|${n}`:o=r||n,e.wrap?`(${s}${o})`:o},ur=(t,e,s,r)=>{if(s)return lr(t,e,{wrap:!1,...r});let n=String.fromCharCode(t);if(t===e)return n;let o=String.fromCharCode(e);return`[${n}-${o}]`},fr=(t,e,s)=>{if(Array.isArray(t)){let r=s.wrap===!0,n=s.capture?"":"?:";return r?`(${n}${t.join("|")})`:t.join("|")}return lr(t,e,s)},dr=(...t)=>new RangeError("Invalid range arguments: "+$i.inspect(...t)),hr=(t,e,s)=>{if(s.strictRanges===!0)throw dr([t,e]);return[]},Gi=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},qi=(t,e,s=1,r={})=>{let n=Number(t),o=Number(e);if(!Number.isInteger(n)||!Number.isInteger(o)){if(r.strictRanges===!0)throw dr([t,e]);return[]}n===0&&(n=0),o===0&&(o=0);let i=n>o,a=String(t),c=String(e),d=String(s);s=Math.max(Math.abs(s),1);let u=Ct(a)||Ct(c)||Ct(d),f=u?Math.max(a.length,c.length,d.length):0,l=u===!1&&Ui(t,e,r)===!1,m=r.transform||Mi(l);if(r.toRegex&&s===1)return ur(cr(t,f),cr(e,f),!0,r);let y={negatives:[],positives:[]},w=H=>y[H<0?"negatives":"positives"].push(Math.abs(H)),S=[],x=0;for(;i?n>=o:n<=o;)r.toRegex===!0&&s>1?w(n):S.push(Wi(m(n,x),f,l)),n=i?n-s:n+s,x++;return r.toRegex===!0?s>1?Bi(y,r):fr(S,null,{wrap:!1,...r}):S},Ki=(t,e,s=1,r={})=>{if(!Te(t)&&t.length>1||!Te(e)&&e.length>1)return hr(t,e,r);let n=r.transform||(l=>String.fromCharCode(l)),o=`${t}`.charCodeAt(0),i=`${e}`.charCodeAt(0),a=o>i,c=Math.min(o,i),d=Math.max(o,i);if(r.toRegex&&s===1)return ur(c,d,!1,r);let u=[],f=0;for(;a?o>=i:o<=i;)u.push(n(o,f)),o=a?o-s:o+s,f++;return r.toRegex===!0?fr(u,null,{wrap:!1,options:r}):u},Ke=(t,e,s,r={})=>{if(e==null&&Tt(t))return[t];if(!Tt(t)||!Tt(e))return hr(t,e,r);if(typeof s=="function")return Ke(t,e,1,{transform:s});if(ar(s))return Ke(t,e,0,s);let n={...r};return n.capture===!0&&(n.wrap=!0),s=s||n.step||1,Te(s)?Te(t)&&Te(e)?qi(t,e,s,n):Ki(t,e,Math.max(Math.abs(s),1),n):s!=null&&!ar(s)?Gi(s,n):Ke(t,e,1,s)};pr.exports=Ke});var gr=v((Tc,Er)=>{"use strict";var Vi=xt(),_r=Ge(),ji=(t,e={})=>{let s=(r,n={})=>{let o=_r.isInvalidBrace(n),i=r.invalid===!0&&e.escapeInvalid===!0,a=o===!0||i===!0,c=e.escapeInvalid===!0?"\\":"",d="";if(r.isOpen===!0||r.isClose===!0)return c+r.value;if(r.type==="open")return a?c+r.value:"(";if(r.type==="close")return a?c+r.value:")";if(r.type==="comma")return r.prev.type==="comma"?"":a?r.value:"|";if(r.value)return r.value;if(r.nodes&&r.ranges>0){let u=_r.reduce(r.nodes),f=Vi(...u,{...e,wrap:!1,toRegex:!0});if(f.length!==0)return u.length>1&&f.length>1?`(${f})`:f}if(r.nodes)for(let u of r.nodes)d+=s(u,r);return d};return s(t)};Er.exports=ji});var wr=v((Cc,yr)=>{"use strict";var Yi=xt(),mr=qe(),ge=Ge(),he=(t="",e="",s=!1)=>{let r=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return s?ge.flatten(e).map(n=>`{${n}}`):e;for(let n of t)if(Array.isArray(n))for(let o of n)r.push(he(o,e,s));else for(let o of e)s===!0&&typeof o=="string"&&(o=`{${o}}`),r.push(Array.isArray(o)?he(n,o,s):n+o);return ge.flatten(r)},zi=(t,e={})=>{let s=e.rangeLimit===void 0?1e3:e.rangeLimit,r=(n,o={})=>{n.queue=[];let i=o,a=o.queue;for(;i.type!=="brace"&&i.type!=="root"&&i.parent;)i=i.parent,a=i.queue;if(n.invalid||n.dollar){a.push(he(a.pop(),mr(n,e)));return}if(n.type==="brace"&&n.invalid!==!0&&n.nodes.length===2){a.push(he(a.pop(),["{}"]));return}if(n.nodes&&n.ranges>0){let f=ge.reduce(n.nodes);if(ge.exceedsLimit(...f,e.step,s))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let l=Yi(...f,e);l.length===0&&(l=mr(n,e)),a.push(he(a.pop(),l)),n.nodes=[];return}let c=ge.encloseBrace(n),d=n.queue,u=n;for(;u.type!=="brace"&&u.type!=="root"&&u.parent;)u=u.parent,d=u.queue;for(let f=0;f<n.nodes.length;f++){let l=n.nodes[f];if(l.type==="comma"&&n.type==="brace"){f===1&&d.push(""),d.push("");continue}if(l.type==="close"){a.push(he(a.pop(),d,c));continue}if(l.value&&l.type!=="open"){d.push(he(d.pop(),l.value));continue}l.nodes&&r(l,n)}return d};return ge.flatten(r(t))};yr.exports=zi});var Ar=v((xc,Rr)=>{"use strict";Rr.exports={MAX_LENGTH:1024*64,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
2
- `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var br=v((bc,xr)=>{"use strict";var Xi=qe(),{MAX_LENGTH:Sr,CHAR_BACKSLASH:bt,CHAR_BACKTICK:Qi,CHAR_COMMA:Zi,CHAR_DOT:Ji,CHAR_LEFT_PARENTHESES:eo,CHAR_RIGHT_PARENTHESES:to,CHAR_LEFT_CURLY_BRACE:so,CHAR_RIGHT_CURLY_BRACE:ro,CHAR_LEFT_SQUARE_BRACKET:Tr,CHAR_RIGHT_SQUARE_BRACKET:Cr,CHAR_DOUBLE_QUOTE:no,CHAR_SINGLE_QUOTE:io,CHAR_NO_BREAK_SPACE:oo,CHAR_ZERO_WIDTH_NOBREAK_SPACE:ao}=Ar(),co=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let s=e||{},r=typeof s.maxLength=="number"?Math.min(Sr,s.maxLength):Sr;if(t.length>r)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${r})`);let n={type:"root",input:t,nodes:[]},o=[n],i=n,a=n,c=0,d=t.length,u=0,f=0,l,m={},y=()=>t[u++],w=S=>{if(S.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&S.type==="text"){a.value+=S.value;return}return i.nodes.push(S),S.parent=i,S.prev=a,a=S,S};for(w({type:"bos"});u<d;)if(i=o[o.length-1],l=y(),!(l===ao||l===oo)){if(l===bt){w({type:"text",value:(e.keepEscaping?l:"")+y()});continue}if(l===Cr){w({type:"text",value:"\\"+l});continue}if(l===Tr){c++;let S=!0,x;for(;u<d&&(x=y());){if(l+=x,x===Tr){c++;continue}if(x===bt){l+=y();continue}if(x===Cr&&(c--,c===0))break}w({type:"text",value:l});continue}if(l===eo){i=w({type:"paren",nodes:[]}),o.push(i),w({type:"text",value:l});continue}if(l===to){if(i.type!=="paren"){w({type:"text",value:l});continue}i=o.pop(),w({type:"text",value:l}),i=o[o.length-1];continue}if(l===no||l===io||l===Qi){let S=l,x;for(e.keepQuotes!==!0&&(l="");u<d&&(x=y());){if(x===bt){l+=x+y();continue}if(x===S){e.keepQuotes===!0&&(l+=x);break}l+=x}w({type:"text",value:l});continue}if(l===so){f++;let x={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||i.dollar===!0,depth:f,commas:0,ranges:0,nodes:[]};i=w(x),o.push(i),w({type:"open",value:l});continue}if(l===ro){if(i.type!=="brace"){w({type:"text",value:l});continue}let S="close";i=o.pop(),i.close=!0,w({type:S,value:l}),f--,i=o[o.length-1];continue}if(l===Zi&&f>0){if(i.ranges>0){i.ranges=0;let S=i.nodes.shift();i.nodes=[S,{type:"text",value:Xi(i)}]}w({type:"comma",value:l}),i.commas++;continue}if(l===Ji&&f>0&&i.commas===0){let S=i.nodes;if(f===0||S.length===0){w({type:"text",value:l});continue}if(a.type==="dot"){if(i.range=[],a.value+=l,a.type="range",i.nodes.length!==3&&i.nodes.length!==5){i.invalid=!0,i.ranges=0,a.type="text";continue}i.ranges++,i.args=[];continue}if(a.type==="range"){S.pop();let x=S[S.length-1];x.value+=a.value+l,a=x,i.ranges--;continue}w({type:"dot",value:l});continue}w({type:"text",value:l})}do if(i=o.pop(),i.type!=="root"){i.nodes.forEach(H=>{H.nodes||(H.type==="open"&&(H.isOpen=!0),H.type==="close"&&(H.isClose=!0),H.nodes||(H.type="text"),H.invalid=!0)});let S=o[o.length-1],x=S.nodes.indexOf(i);S.nodes.splice(x,1,...i.nodes)}while(o.length>0);return w({type:"eos"}),n};xr.exports=co});var kr=v((Ic,vr)=>{"use strict";var Ir=qe(),lo=gr(),uo=wr(),fo=br(),Q=(t,e={})=>{let s=[];if(Array.isArray(t))for(let r of t){let n=Q.create(r,e);Array.isArray(n)?s.push(...n):s.push(n)}else s=[].concat(Q.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(s=[...new Set(s)]),s};Q.parse=(t,e={})=>fo(t,e);Q.stringify=(t,e={})=>Ir(typeof t=="string"?Q.parse(t,e):t,e);Q.compile=(t,e={})=>(typeof t=="string"&&(t=Q.parse(t,e)),lo(t,e));Q.expand=(t,e={})=>{typeof t=="string"&&(t=Q.parse(t,e));let s=uo(t,e);return e.noempty===!0&&(s=s.filter(Boolean)),e.nodupes===!0&&(s=[...new Set(s)]),s};Q.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Q.compile(t,e):Q.expand(t,e);vr.exports=Q});var Nr=v((vc,ho)=>{ho.exports=["3dm","3ds","3g2","3gp","7z","a","aac","adp","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]});var Pr=v((kc,Or)=>{Or.exports=Nr()});var Hr=v((Nc,Lr)=>{"use strict";var po=L("path"),_o=Pr(),Eo=new Set(_o);Lr.exports=t=>Eo.has(po.extname(t).slice(1).toLowerCase())});var Ve=v(R=>{"use strict";var{sep:go}=L("path"),{platform:It}=process,mo=L("os");R.EV_ALL="all";R.EV_READY="ready";R.EV_ADD="add";R.EV_CHANGE="change";R.EV_ADD_DIR="addDir";R.EV_UNLINK="unlink";R.EV_UNLINK_DIR="unlinkDir";R.EV_RAW="raw";R.EV_ERROR="error";R.STR_DATA="data";R.STR_END="end";R.STR_CLOSE="close";R.FSEVENT_CREATED="created";R.FSEVENT_MODIFIED="modified";R.FSEVENT_DELETED="deleted";R.FSEVENT_MOVED="moved";R.FSEVENT_CLONED="cloned";R.FSEVENT_UNKNOWN="unknown";R.FSEVENT_TYPE_FILE="file";R.FSEVENT_TYPE_DIRECTORY="directory";R.FSEVENT_TYPE_SYMLINK="symlink";R.KEY_LISTENERS="listeners";R.KEY_ERR="errHandlers";R.KEY_RAW="rawEmitters";R.HANDLER_KEYS=[R.KEY_LISTENERS,R.KEY_ERR,R.KEY_RAW];R.DOT_SLASH=`.${go}`;R.BACK_SLASH_RE=/\\/g;R.DOUBLE_SLASH_RE=/\/\//;R.SLASH_OR_BACK_SLASH_RE=/[/\\]/;R.DOT_RE=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/;R.REPLACER_RE=/^\.[/\\]/;R.SLASH="/";R.SLASH_SLASH="//";R.BRACE_START="{";R.BANG="!";R.ONE_DOT=".";R.TWO_DOTS="..";R.STAR="*";R.GLOBSTAR="**";R.ROOT_GLOBSTAR="/**/*";R.SLASH_GLOBSTAR="/**";R.DIR_SUFFIX="Dir";R.ANYMATCH_OPTS={dot:!0};R.STRING_TYPE="string";R.FUNCTION_TYPE="function";R.EMPTY_STR="";R.EMPTY_FN=()=>{};R.IDENTITY_FN=t=>t;R.isWindows=It==="win32";R.isMacos=It==="darwin";R.isLinux=It==="linux";R.isIBMi=mo.type()==="OS400"});var Wr=v((Pc,Ur)=>{"use strict";var oe=L("fs"),W=L("path"),{promisify:Ie}=L("util"),yo=Hr(),{isWindows:wo,isLinux:Ro,EMPTY_FN:Ao,EMPTY_STR:So,KEY_LISTENERS:me,KEY_ERR:vt,KEY_RAW:Ce,HANDLER_KEYS:To,EV_CHANGE:Ye,EV_ADD:je,EV_ADD_DIR:Co,EV_ERROR:Fr,STR_DATA:xo,STR_END:bo,BRACE_START:Io,STAR:vo}=Ve(),ko="watch",No=Ie(oe.open),$r=Ie(oe.stat),Oo=Ie(oe.lstat),Po=Ie(oe.close),kt=Ie(oe.realpath),Lo={lstat:Oo,stat:$r},Ot=(t,e)=>{t instanceof Set?t.forEach(e):e(t)},xe=(t,e,s)=>{let r=t[e];r instanceof Set||(t[e]=r=new Set([r])),r.add(s)},Ho=t=>e=>{let s=t[e];s instanceof Set?s.clear():delete t[e]},be=(t,e,s)=>{let r=t[e];r instanceof Set?r.delete(s):r===s&&delete t[e]},Mr=t=>t instanceof Set?t.size===0:!t,ze=new Map;function Dr(t,e,s,r,n){let o=(i,a)=>{s(t),n(i,a,{watchedPath:t}),a&&t!==a&&Xe(W.resolve(t,a),me,W.join(t,a))};try{return oe.watch(t,e,o)}catch(i){r(i)}}var Xe=(t,e,s,r,n)=>{let o=ze.get(t);o&&Ot(o[e],i=>{i(s,r,n)})},Do=(t,e,s,r)=>{let{listener:n,errHandler:o,rawEmitter:i}=r,a=ze.get(e),c;if(!s.persistent)return c=Dr(t,s,n,o,i),c.close.bind(c);if(a)xe(a,me,n),xe(a,vt,o),xe(a,Ce,i);else{if(c=Dr(t,s,Xe.bind(null,e,me),o,Xe.bind(null,e,Ce)),!c)return;c.on(Fr,async d=>{let u=Xe.bind(null,e,vt);if(a.watcherUnusable=!0,wo&&d.code==="EPERM")try{let f=await No(t,"r");await Po(f),u(d)}catch{}else u(d)}),a={listeners:n,errHandlers:o,rawEmitters:i,watcher:c},ze.set(e,a)}return()=>{be(a,me,n),be(a,vt,o),be(a,Ce,i),Mr(a.listeners)&&(a.watcher.close(),ze.delete(e),To.forEach(Ho(a)),a.watcher=void 0,Object.freeze(a))}},Nt=new Map,Fo=(t,e,s,r)=>{let{listener:n,rawEmitter:o}=r,i=Nt.get(e),a=new Set,c=new Set,d=i&&i.options;return d&&(d.persistent<s.persistent||d.interval>s.interval)&&(a=i.listeners,c=i.rawEmitters,oe.unwatchFile(e),i=void 0),i?(xe(i,me,n),xe(i,Ce,o)):(i={listeners:n,rawEmitters:o,options:s,watcher:oe.watchFile(e,s,(u,f)=>{Ot(i.rawEmitters,m=>{m(Ye,e,{curr:u,prev:f})});let l=u.mtimeMs;(u.size!==f.size||l>f.mtimeMs||l===0)&&Ot(i.listeners,m=>m(t,u))})},Nt.set(e,i)),()=>{be(i,me,n),be(i,Ce,o),Mr(i.listeners)&&(Nt.delete(e),oe.unwatchFile(e),i.options=i.watcher=void 0,Object.freeze(i))}},Pt=class{constructor(e){this.fsw=e,this._boundHandleError=s=>e._handleError(s)}_watchWithNodeFs(e,s){let r=this.fsw.options,n=W.dirname(e),o=W.basename(e);this.fsw._getWatchedDir(n).add(o);let a=W.resolve(e),c={persistent:r.persistent};s||(s=Ao);let d;return r.usePolling?(c.interval=r.enableBinaryInterval&&yo(o)?r.binaryInterval:r.interval,d=Fo(e,a,c,{listener:s,rawEmitter:this.fsw._emitRaw})):d=Do(e,a,c,{listener:s,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw}),d}_handleFile(e,s,r){if(this.fsw.closed)return;let n=W.dirname(e),o=W.basename(e),i=this.fsw._getWatchedDir(n),a=s;if(i.has(o))return;let c=async(u,f)=>{if(this.fsw._throttle(ko,e,5)){if(!f||f.mtimeMs===0)try{let l=await $r(e);if(this.fsw.closed)return;let m=l.atimeMs,y=l.mtimeMs;(!m||m<=y||y!==a.mtimeMs)&&this.fsw._emit(Ye,e,l),Ro&&a.ino!==l.ino?(this.fsw._closeFile(u),a=l,this.fsw._addPathCloser(u,this._watchWithNodeFs(e,c))):a=l}catch{this.fsw._remove(n,o)}else if(i.has(o)){let l=f.atimeMs,m=f.mtimeMs;(!l||l<=m||m!==a.mtimeMs)&&this.fsw._emit(Ye,e,f),a=f}}},d=this._watchWithNodeFs(e,c);if(!(r&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(e)){if(!this.fsw._throttle(je,e,0))return;this.fsw._emit(je,e,s)}return d}async _handleSymlink(e,s,r,n){if(this.fsw.closed)return;let o=e.fullPath,i=this.fsw._getWatchedDir(s);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let a;try{a=await kt(r)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(i.has(n)?this.fsw._symlinkPaths.get(o)!==a&&(this.fsw._symlinkPaths.set(o,a),this.fsw._emit(Ye,r,e.stats)):(i.add(n),this.fsw._symlinkPaths.set(o,a),this.fsw._emit(je,r,e.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(o))return!0;this.fsw._symlinkPaths.set(o,!0)}_handleRead(e,s,r,n,o,i,a){if(e=W.join(e,So),!r.hasGlob&&(a=this.fsw._throttle("readdir",e,1e3),!a))return;let c=this.fsw._getWatchedDir(r.path),d=new Set,u=this.fsw._readdirp(e,{fileFilter:f=>r.filterPath(f),directoryFilter:f=>r.filterDir(f),depth:0}).on(xo,async f=>{if(this.fsw.closed){u=void 0;return}let l=f.path,m=W.join(e,l);if(d.add(l),!(f.stats.isSymbolicLink()&&await this._handleSymlink(f,e,m,l))){if(this.fsw.closed){u=void 0;return}(l===n||!n&&!c.has(l))&&(this.fsw._incrReadyCount(),m=W.join(o,W.relative(o,m)),this._addToNodeFs(m,s,r,i+1))}}).on(Fr,this._boundHandleError);return new Promise(f=>u.once(bo,()=>{if(this.fsw.closed){u=void 0;return}let l=a?a.clear():!1;f(),c.getChildren().filter(m=>m!==e&&!d.has(m)&&(!r.hasGlob||r.filterPath({fullPath:W.resolve(e,m)}))).forEach(m=>{this.fsw._remove(e,m)}),u=void 0,l&&this._handleRead(e,!1,r,n,o,i,a)}))}async _handleDir(e,s,r,n,o,i,a){let c=this.fsw._getWatchedDir(W.dirname(e)),d=c.has(W.basename(e));!(r&&this.fsw.options.ignoreInitial)&&!o&&!d&&(!i.hasGlob||i.globFilter(e))&&this.fsw._emit(Co,e,s),c.add(W.basename(e)),this.fsw._getWatchedDir(e);let u,f,l=this.fsw.options.depth;if((l==null||n<=l)&&!this.fsw._symlinkPaths.has(a)){if(!o&&(await this._handleRead(e,r,i,o,e,n,u),this.fsw.closed))return;f=this._watchWithNodeFs(e,(m,y)=>{y&&y.mtimeMs===0||this._handleRead(m,!1,i,o,e,n,u)})}return f}async _addToNodeFs(e,s,r,n,o){let i=this.fsw._emitReady;if(this.fsw._isIgnored(e)||this.fsw.closed)return i(),!1;let a=this.fsw._getWatchHelpers(e,n);!a.hasGlob&&r&&(a.hasGlob=r.hasGlob,a.globFilter=r.globFilter,a.filterPath=c=>r.filterPath(c),a.filterDir=c=>r.filterDir(c));try{let c=await Lo[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,c))return i(),!1;let d=this.fsw.options.followSymlinks&&!e.includes(vo)&&!e.includes(Io),u;if(c.isDirectory()){let f=W.resolve(e),l=d?await kt(e):e;if(this.fsw.closed||(u=await this._handleDir(a.watchPath,c,s,n,o,a,l),this.fsw.closed))return;f!==l&&l!==void 0&&this.fsw._symlinkPaths.set(f,l)}else if(c.isSymbolicLink()){let f=d?await kt(e):e;if(this.fsw.closed)return;let l=W.dirname(a.watchPath);if(this.fsw._getWatchedDir(l).add(a.watchPath),this.fsw._emit(je,a.watchPath,c),u=await this._handleDir(l,c,s,n,e,a,f),this.fsw.closed)return;f!==void 0&&this.fsw._symlinkPaths.set(W.resolve(e),f)}else u=this._handleFile(a.watchPath,c,s);return i(),this.fsw._addPathCloser(e,u),!1}catch(c){if(this.fsw._handleError(c))return i(),e}}};Ur.exports=Pt});var Yr=v((Lc,Wt)=>{"use strict";var Mt=L("fs"),B=L("path"),{promisify:Ut}=L("util"),ye;try{ye=L("fsevents")}catch{process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR}if(ye){let t=process.version.match(/v(\d+)\.(\d+)/);if(t&&t[1]&&t[2]){let e=Number.parseInt(t[1],10),s=Number.parseInt(t[2],10);e===8&&s<16&&(ye=void 0)}}var{EV_ADD:Lt,EV_CHANGE:$o,EV_ADD_DIR:Br,EV_UNLINK:Qe,EV_ERROR:Mo,STR_DATA:Uo,STR_END:Wo,FSEVENT_CREATED:Bo,FSEVENT_MODIFIED:Go,FSEVENT_DELETED:qo,FSEVENT_MOVED:Ko,FSEVENT_UNKNOWN:Vo,FSEVENT_TYPE_FILE:jo,FSEVENT_TYPE_DIRECTORY:ve,FSEVENT_TYPE_SYMLINK:jr,ROOT_GLOBSTAR:Gr,DIR_SUFFIX:Yo,DOT_SLASH:qr,FUNCTION_TYPE:Ht,EMPTY_FN:zo,IDENTITY_FN:Xo}=Ve(),Qo=t=>isNaN(t)?{}:{depth:t},Ft=Ut(Mt.stat),Zo=Ut(Mt.lstat),Kr=Ut(Mt.realpath),Jo={stat:Ft,lstat:Zo},pe=new Map,ea=10,ta=new Set([69888,70400,71424,72704,73472,131328,131840,262912]),sa=(t,e)=>({stop:ye.watch(t,e)});function ra(t,e,s,r){let n=B.extname(e)?B.dirname(e):e,o=B.dirname(n),i=pe.get(n);na(o)&&(n=o);let a=B.resolve(t),c=a!==e,d=(f,l,m)=>{c&&(f=f.replace(e,a)),(f===a||!f.indexOf(a+B.sep))&&s(f,l,m)},u=!1;for(let f of pe.keys())if(e.indexOf(B.resolve(f)+B.sep)===0){n=f,i=pe.get(n),u=!0;break}return i||u?i.listeners.add(d):(i={listeners:new Set([d]),rawEmitter:r,watcher:sa(n,(f,l)=>{if(!i.listeners.size)return;let m=ye.getInfo(f,l);i.listeners.forEach(y=>{y(f,l,m)}),i.rawEmitter(m.event,f,m)})},pe.set(n,i)),()=>{let f=i.listeners;if(f.delete(d),!f.size&&(pe.delete(n),i.watcher))return i.watcher.stop().then(()=>{i.rawEmitter=i.watcher=void 0,Object.freeze(i)})}}var na=t=>{let e=0;for(let s of pe.keys())if(s.indexOf(t)===0&&(e++,e>=ea))return!0;return!1},ia=()=>ye&&pe.size<128,Dt=(t,e)=>{let s=0;for(;!t.indexOf(e)&&(t=B.dirname(t))!==e;)s++;return s},Vr=(t,e)=>t.type===ve&&e.isDirectory()||t.type===jr&&e.isSymbolicLink()||t.type===jo&&e.isFile(),$t=class{constructor(e){this.fsw=e}checkIgnored(e,s){let r=this.fsw._ignoredPaths;if(this.fsw._isIgnored(e,s))return r.add(e),s&&s.isDirectory()&&r.add(e+Gr),!0;r.delete(e),r.delete(e+Gr)}addOrChange(e,s,r,n,o,i,a,c){let d=o.has(i)?$o:Lt;this.handleEvent(d,e,s,r,n,o,i,a,c)}async checkExists(e,s,r,n,o,i,a,c){try{let d=await Ft(e);if(this.fsw.closed)return;Vr(a,d)?this.addOrChange(e,s,r,n,o,i,a,c):this.handleEvent(Qe,e,s,r,n,o,i,a,c)}catch(d){d.code==="EACCES"?this.addOrChange(e,s,r,n,o,i,a,c):this.handleEvent(Qe,e,s,r,n,o,i,a,c)}}handleEvent(e,s,r,n,o,i,a,c,d){if(!(this.fsw.closed||this.checkIgnored(s)))if(e===Qe){let u=c.type===ve;(u||i.has(a))&&this.fsw._remove(o,a,u)}else{if(e===Lt){if(c.type===ve&&this.fsw._getWatchedDir(s),c.type===jr&&d.followSymlinks){let f=d.depth===void 0?void 0:Dt(r,n)+1;return this._addToFsEvents(s,!1,!0,f)}this.fsw._getWatchedDir(o).add(a)}let u=c.type===ve?e+Yo:e;this.fsw._emit(u,s),u===Br&&this._addToFsEvents(s,!1,!0)}}_watchWithFsEvents(e,s,r,n){if(this.fsw.closed||this.fsw._isIgnored(e))return;let o=this.fsw.options,a=ra(e,s,async(c,d,u)=>{if(this.fsw.closed||o.depth!==void 0&&Dt(c,s)>o.depth)return;let f=r(B.join(e,B.relative(e,c)));if(n&&!n(f))return;let l=B.dirname(f),m=B.basename(f),y=this.fsw._getWatchedDir(u.type===ve?f:l);if(ta.has(d)||u.event===Vo)if(typeof o.ignored===Ht){let w;try{w=await Ft(f)}catch{}if(this.fsw.closed||this.checkIgnored(f,w))return;Vr(u,w)?this.addOrChange(f,c,s,l,y,m,u,o):this.handleEvent(Qe,f,c,s,l,y,m,u,o)}else this.checkExists(f,c,s,l,y,m,u,o);else switch(u.event){case Bo:case Go:return this.addOrChange(f,c,s,l,y,m,u,o);case qo:case Ko:return this.checkExists(f,c,s,l,y,m,u,o)}},this.fsw._emitRaw);return this.fsw._emitReady(),a}async _handleFsEventsSymlink(e,s,r,n){if(!(this.fsw.closed||this.fsw._symlinkPaths.has(s))){this.fsw._symlinkPaths.set(s,!0),this.fsw._incrReadyCount();try{let o=await Kr(e);if(this.fsw.closed)return;if(this.fsw._isIgnored(o))return this.fsw._emitReady();this.fsw._incrReadyCount(),this._addToFsEvents(o||e,i=>{let a=e;return o&&o!==qr?a=i.replace(o,e):i!==qr&&(a=B.join(e,i)),r(a)},!1,n)}catch(o){if(this.fsw._handleError(o))return this.fsw._emitReady()}}}emitAdd(e,s,r,n,o){let i=r(e),a=s.isDirectory(),c=this.fsw._getWatchedDir(B.dirname(i)),d=B.basename(i);a&&this.fsw._getWatchedDir(i),!c.has(d)&&(c.add(d),(!n.ignoreInitial||o===!0)&&this.fsw._emit(a?Br:Lt,i,s))}initWatch(e,s,r,n){if(this.fsw.closed)return;let o=this._watchWithFsEvents(r.watchPath,B.resolve(e||r.watchPath),n,r.globFilter);this.fsw._addPathCloser(s,o)}async _addToFsEvents(e,s,r,n){if(this.fsw.closed)return;let o=this.fsw.options,i=typeof s===Ht?s:Xo,a=this.fsw._getWatchHelpers(e);try{let c=await Jo[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,c))throw null;if(c.isDirectory()){if(a.globFilter||this.emitAdd(i(e),c,i,o,r),n&&n>o.depth)return;this.fsw._readdirp(a.watchPath,{fileFilter:d=>a.filterPath(d),directoryFilter:d=>a.filterDir(d),...Qo(o.depth-(n||0))}).on(Uo,d=>{if(this.fsw.closed||d.stats.isDirectory()&&!a.filterPath(d))return;let u=B.join(a.watchPath,d.path),{fullPath:f}=d;if(a.followSymlinks&&d.stats.isSymbolicLink()){let l=o.depth===void 0?void 0:Dt(u,B.resolve(a.watchPath))+1;this._handleFsEventsSymlink(u,f,i,l)}else this.emitAdd(u,d.stats,i,o,r)}).on(Mo,zo).on(Wo,()=>{this.fsw._emitReady()})}else this.emitAdd(a.watchPath,c,i,o,r),this.fsw._emitReady()}catch(c){(!c||this.fsw._handleError(c))&&(this.fsw._emitReady(),this.fsw._emitReady())}if(o.persistent&&r!==!0)if(typeof s===Ht)this.initWatch(void 0,e,a,i);else{let c;try{c=await Kr(a.watchPath)}catch{}this.initWatch(c,e,a,i)}}};Wt.exports=$t;Wt.exports.canUse=ia});var on=v(ss=>{"use strict";var{EventEmitter:oa}=L("events"),es=L("fs"),k=L("path"),{promisify:tn}=L("util"),aa=Ls(),jt=Ws().default,ca=js(),Bt=Rt(),la=kr(),ua=yt(),fa=Wr(),zr=Yr(),{EV_ALL:Gt,EV_READY:da,EV_ADD:Ze,EV_CHANGE:ke,EV_UNLINK:Xr,EV_ADD_DIR:ha,EV_UNLINK_DIR:pa,EV_RAW:_a,EV_ERROR:qt,STR_CLOSE:Ea,STR_END:ga,BACK_SLASH_RE:ma,DOUBLE_SLASH_RE:Qr,SLASH_OR_BACK_SLASH_RE:ya,DOT_RE:wa,REPLACER_RE:Ra,SLASH:Kt,SLASH_SLASH:Aa,BRACE_START:Sa,BANG:Yt,ONE_DOT:sn,TWO_DOTS:Ta,GLOBSTAR:Ca,SLASH_GLOBSTAR:Vt,ANYMATCH_OPTS:zt,STRING_TYPE:ts,FUNCTION_TYPE:xa,EMPTY_STR:Xt,EMPTY_FN:ba,isWindows:Ia,isMacos:va,isIBMi:ka}=Ve(),Na=tn(es.stat),Oa=tn(es.readdir),Qt=(t=[])=>Array.isArray(t)?t:[t],rn=(t,e=[])=>(t.forEach(s=>{Array.isArray(s)?rn(s,e):e.push(s)}),e),Zr=t=>{let e=rn(Qt(t));if(!e.every(s=>typeof s===ts))throw new TypeError(`Non-string provided as watch path: ${e}`);return e.map(nn)},Jr=t=>{let e=t.replace(ma,Kt),s=!1;for(e.startsWith(Aa)&&(s=!0);e.match(Qr);)e=e.replace(Qr,Kt);return s&&(e=Kt+e),e},nn=t=>Jr(k.normalize(Jr(t))),en=(t=Xt)=>e=>typeof e!==ts?e:nn(k.isAbsolute(e)?e:k.join(t,e)),Pa=(t,e)=>k.isAbsolute(t)?t:t.startsWith(Yt)?Yt+k.join(e,t.slice(1)):k.join(e,t),ee=(t,e)=>t[e]===void 0,Zt=class{constructor(e,s){this.path=e,this._removeWatcher=s,this.items=new Set}add(e){let{items:s}=this;s&&e!==sn&&e!==Ta&&s.add(e)}async remove(e){let{items:s}=this;if(!s||(s.delete(e),s.size>0))return;let r=this.path;try{await Oa(r)}catch{this._removeWatcher&&this._removeWatcher(k.dirname(r),k.basename(r))}}has(e){let{items:s}=this;if(s)return s.has(e)}getChildren(){let{items:e}=this;if(e)return[...e.values()]}dispose(){this.items.clear(),delete this.path,delete this._removeWatcher,delete this.items,Object.freeze(this)}},La="stat",Ha="lstat",Jt=class{constructor(e,s,r,n){this.fsw=n,this.path=e=e.replace(Ra,Xt),this.watchPath=s,this.fullWatchPath=k.resolve(s),this.hasGlob=s!==e,e===Xt&&(this.hasGlob=!1),this.globSymlink=this.hasGlob&&r?void 0:!1,this.globFilter=this.hasGlob?jt(e,void 0,zt):!1,this.dirParts=this.getDirParts(e),this.dirParts.forEach(o=>{o.length>1&&o.pop()}),this.followSymlinks=r,this.statMethod=r?La:Ha}checkGlobSymlink(e){return this.globSymlink===void 0&&(this.globSymlink=e.fullParentDir===this.fullWatchPath?!1:{realPath:e.fullParentDir,linkPath:this.fullWatchPath}),this.globSymlink?e.fullPath.replace(this.globSymlink.realPath,this.globSymlink.linkPath):e.fullPath}entryPath(e){return k.join(this.watchPath,k.relative(this.watchPath,this.checkGlobSymlink(e)))}filterPath(e){let{stats:s}=e;if(s&&s.isSymbolicLink())return this.filterDir(e);let r=this.entryPath(e);return(this.hasGlob&&typeof this.globFilter===xa?this.globFilter(r):!0)&&this.fsw._isntIgnored(r,s)&&this.fsw._hasReadPermissions(s)}getDirParts(e){if(!this.hasGlob)return[];let s=[];return(e.includes(Sa)?la.expand(e):[e]).forEach(n=>{s.push(k.relative(this.watchPath,n).split(ya))}),s}filterDir(e){if(this.hasGlob){let s=this.getDirParts(this.checkGlobSymlink(e)),r=!1;this.unmatchedGlob=!this.dirParts.some(n=>n.every((o,i)=>(o===Ca&&(r=!0),r||!s[0][i]||jt(o,s[0][i],zt))))}return!this.unmatchedGlob&&this.fsw._isntIgnored(this.entryPath(e),e.stats)}},Je=class extends oa{constructor(e){super();let s={};e&&Object.assign(s,e),this._watched=new Map,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._symlinkPaths=new Map,this._streams=new Set,this.closed=!1,ee(s,"persistent")&&(s.persistent=!0),ee(s,"ignoreInitial")&&(s.ignoreInitial=!1),ee(s,"ignorePermissionErrors")&&(s.ignorePermissionErrors=!1),ee(s,"interval")&&(s.interval=100),ee(s,"binaryInterval")&&(s.binaryInterval=300),ee(s,"disableGlobbing")&&(s.disableGlobbing=!1),s.enableBinaryInterval=s.binaryInterval!==s.interval,ee(s,"useFsEvents")&&(s.useFsEvents=!s.usePolling),zr.canUse()||(s.useFsEvents=!1),ee(s,"usePolling")&&!s.useFsEvents&&(s.usePolling=va),ka&&(s.usePolling=!0);let n=process.env.CHOKIDAR_USEPOLLING;if(n!==void 0){let c=n.toLowerCase();c==="false"||c==="0"?s.usePolling=!1:c==="true"||c==="1"?s.usePolling=!0:s.usePolling=!!c}let o=process.env.CHOKIDAR_INTERVAL;o&&(s.interval=Number.parseInt(o,10)),ee(s,"atomic")&&(s.atomic=!s.usePolling&&!s.useFsEvents),s.atomic&&(this._pendingUnlinks=new Map),ee(s,"followSymlinks")&&(s.followSymlinks=!0),ee(s,"awaitWriteFinish")&&(s.awaitWriteFinish=!1),s.awaitWriteFinish===!0&&(s.awaitWriteFinish={});let i=s.awaitWriteFinish;i&&(i.stabilityThreshold||(i.stabilityThreshold=2e3),i.pollInterval||(i.pollInterval=100),this._pendingWrites=new Map),s.ignored&&(s.ignored=Qt(s.ignored));let a=0;this._emitReady=()=>{a++,a>=this._readyCount&&(this._emitReady=ba,this._readyEmitted=!0,process.nextTick(()=>this.emit(da)))},this._emitRaw=(...c)=>this.emit(_a,...c),this._readyEmitted=!1,this.options=s,s.useFsEvents?this._fsEventsHandler=new zr(this):this._nodeFsHandler=new fa(this),Object.freeze(s)}add(e,s,r){let{cwd:n,disableGlobbing:o}=this.options;this.closed=!1;let i=Zr(e);return n&&(i=i.map(a=>{let c=Pa(a,n);return o||!Bt(a)?c:ua(c)})),i=i.filter(a=>a.startsWith(Yt)?(this._ignoredPaths.add(a.slice(1)),!1):(this._ignoredPaths.delete(a),this._ignoredPaths.delete(a+Vt),this._userIgnored=void 0,!0)),this.options.useFsEvents&&this._fsEventsHandler?(this._readyCount||(this._readyCount=i.length),this.options.persistent&&(this._readyCount*=2),i.forEach(a=>this._fsEventsHandler._addToFsEvents(a))):(this._readyCount||(this._readyCount=0),this._readyCount+=i.length,Promise.all(i.map(async a=>{let c=await this._nodeFsHandler._addToNodeFs(a,!r,0,0,s);return c&&this._emitReady(),c})).then(a=>{this.closed||a.filter(c=>c).forEach(c=>{this.add(k.dirname(c),k.basename(s||c))})})),this}unwatch(e){if(this.closed)return this;let s=Zr(e),{cwd:r}=this.options;return s.forEach(n=>{!k.isAbsolute(n)&&!this._closers.has(n)&&(r&&(n=k.join(r,n)),n=k.resolve(n)),this._closePath(n),this._ignoredPaths.add(n),this._watched.has(n)&&this._ignoredPaths.add(n+Vt),this._userIgnored=void 0}),this}close(){if(this.closed)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach(s=>s.forEach(r=>{let n=r();n instanceof Promise&&e.push(n)})),this._streams.forEach(s=>s.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(s=>s.dispose()),["closers","watched","streams","symlinkPaths","throttled"].forEach(s=>{this[`_${s}`].clear()}),this._closePromise=e.length?Promise.all(e).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let e={};return this._watched.forEach((s,r)=>{let n=this.options.cwd?k.relative(this.options.cwd,r):r;e[n||sn]=s.getChildren().sort()}),e}emitWithAll(e,s){this.emit(...s),e!==qt&&this.emit(Gt,...s)}async _emit(e,s,r,n,o){if(this.closed)return;let i=this.options;Ia&&(s=k.normalize(s)),i.cwd&&(s=k.relative(i.cwd,s));let a=[e,s];o!==void 0?a.push(r,n,o):n!==void 0?a.push(r,n):r!==void 0&&a.push(r);let c=i.awaitWriteFinish,d;if(c&&(d=this._pendingWrites.get(s)))return d.lastChange=new Date,this;if(i.atomic){if(e===Xr)return this._pendingUnlinks.set(s,a),setTimeout(()=>{this._pendingUnlinks.forEach((u,f)=>{this.emit(...u),this.emit(Gt,...u),this._pendingUnlinks.delete(f)})},typeof i.atomic=="number"?i.atomic:100),this;e===Ze&&this._pendingUnlinks.has(s)&&(e=a[0]=ke,this._pendingUnlinks.delete(s))}if(c&&(e===Ze||e===ke)&&this._readyEmitted){let u=(f,l)=>{f?(e=a[0]=qt,a[1]=f,this.emitWithAll(e,a)):l&&(a.length>2?a[2]=l:a.push(l),this.emitWithAll(e,a))};return this._awaitWriteFinish(s,c.stabilityThreshold,e,u),this}if(e===ke&&!this._throttle(ke,s,50))return this;if(i.alwaysStat&&r===void 0&&(e===Ze||e===ha||e===ke)){let u=i.cwd?k.join(i.cwd,s):s,f;try{f=await Na(u)}catch{}if(!f||this.closed)return;a.push(f)}return this.emitWithAll(e,a),this}_handleError(e){let s=e&&e.code;return e&&s!=="ENOENT"&&s!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||s!=="EPERM"&&s!=="EACCES")&&this.emit(qt,e),e||this.closed}_throttle(e,s,r){this._throttled.has(e)||this._throttled.set(e,new Map);let n=this._throttled.get(e),o=n.get(s);if(o)return o.count++,!1;let i,a=()=>{let d=n.get(s),u=d?d.count:0;return n.delete(s),clearTimeout(i),d&&clearTimeout(d.timeoutObject),u};i=setTimeout(a,r);let c={timeoutObject:i,clear:a,count:0};return n.set(s,c),c}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(e,s,r,n){let o,i=e;this.options.cwd&&!k.isAbsolute(e)&&(i=k.join(this.options.cwd,e));let a=new Date,c=d=>{es.stat(i,(u,f)=>{if(u||!this._pendingWrites.has(e)){u&&u.code!=="ENOENT"&&n(u);return}let l=Number(new Date);d&&f.size!==d.size&&(this._pendingWrites.get(e).lastChange=l);let m=this._pendingWrites.get(e);l-m.lastChange>=s?(this._pendingWrites.delete(e),n(void 0,f)):o=setTimeout(c,this.options.awaitWriteFinish.pollInterval,f)})};this._pendingWrites.has(e)||(this._pendingWrites.set(e,{lastChange:a,cancelWait:()=>(this._pendingWrites.delete(e),clearTimeout(o),r)}),o=setTimeout(c,this.options.awaitWriteFinish.pollInterval))}_getGlobIgnored(){return[...this._ignoredPaths.values()]}_isIgnored(e,s){if(this.options.atomic&&wa.test(e))return!0;if(!this._userIgnored){let{cwd:r}=this.options,n=this.options.ignored,o=n&&n.map(en(r)),i=Qt(o).filter(c=>typeof c===ts&&!Bt(c)).map(c=>c+Vt),a=this._getGlobIgnored().map(en(r)).concat(o,i);this._userIgnored=jt(a,void 0,zt)}return this._userIgnored([e,s])}_isntIgnored(e,s){return!this._isIgnored(e,s)}_getWatchHelpers(e,s){let r=s||this.options.disableGlobbing||!Bt(e)?e:ca(e),n=this.options.followSymlinks;return new Jt(e,r,n,this)}_getWatchedDir(e){this._boundRemove||(this._boundRemove=this._remove.bind(this));let s=k.resolve(e);return this._watched.has(s)||this._watched.set(s,new Zt(s,this._boundRemove)),this._watched.get(s)}_hasReadPermissions(e){if(this.options.ignorePermissionErrors)return!0;let r=(e&&Number.parseInt(e.mode,10))&511;return!!(4&Number.parseInt(r.toString(8)[0],10))}_remove(e,s,r){let n=k.join(e,s),o=k.resolve(n);if(r=r??(this._watched.has(n)||this._watched.has(o)),!this._throttle("remove",n,100))return;!r&&!this.options.useFsEvents&&this._watched.size===1&&this.add(e,s,!0),this._getWatchedDir(n).getChildren().forEach(l=>this._remove(n,l));let c=this._getWatchedDir(e),d=c.has(s);c.remove(s),this._symlinkPaths.has(o)&&this._symlinkPaths.delete(o);let u=n;if(this.options.cwd&&(u=k.relative(this.options.cwd,n)),this.options.awaitWriteFinish&&this._pendingWrites.has(u)&&this._pendingWrites.get(u).cancelWait()===Ze)return;this._watched.delete(n),this._watched.delete(o);let f=r?pa:Xr;d&&!this._isIgnored(n)&&this._emit(f,n),this.options.useFsEvents||this._closePath(n)}_closePath(e){this._closeFile(e);let s=k.dirname(e);this._getWatchedDir(s).remove(k.basename(e))}_closeFile(e){let s=this._closers.get(e);s&&(s.forEach(r=>r()),this._closers.delete(e))}_addPathCloser(e,s){if(!s)return;let r=this._closers.get(e);r||(r=[],this._closers.set(e,r)),r.push(s)}_readdirp(e,s){if(this.closed)return;let r={type:Gt,alwaysStat:!0,lstat:!0,...s},n=aa(e,r);return this._streams.add(n),n.once(Ea,()=>{n=void 0}),n.once(ga,()=>{n&&(this._streams.delete(n),n=void 0)}),n}};ss.FSWatcher=Je;var Da=(t,e)=>{let s=new Je(e);return s.add(t),s};ss.watch=Da});var ln=bn(on(),1);import{Logger as $a}from"@5minds/processcube_engine_sdk";import{ExternalTaskWorker as Ma}from"@5minds/processcube_engine_client";import{basename as ns,dirname as et,join as an,relative as tt}from"node:path";import{build as Ua}from"esbuild";import{promises as Wa,existsSync as cn}from"node:fs";import{Issuer as Ba}from"openid-client";import{jwtDecode as Ga}from"jwt-decode";import{EngineClient as Fa}from"@5minds/processcube_engine_client";var rs=process.env.PROCESSCUBE_ENGINE_URL??"http://localhost:10560",$=new Fa(rs);var qa={token:"ZHVtbXlfdG9rZW4=",userId:"dummy_token"},Ka=.85,st=["external_task.ts","external_task.js"],J=new $a("processcube_app_sdk:external_task_adapter"),os=process.env.PROCESSCUBE_AUTHORITY_URL!==void 0,ue={};async function un(t){if(t&&!cn(t))throw new Error(`Invalid customExternalTasksDirPath. The given path '${t}' does not exist`);let e=Qa(t);(0,ln.watch)(e).on("add",async s=>{if(!st.includes(ns(s)))return;await fn(s,e);let r=et(s),n=tt(e,r),o=rt(n);J.info(`Started external task ${ue[s].workerId} for topic ${o}`)}).on("change",async s=>{if(!st.includes(ns(s)))return;await Va(s,e);let r=et(s),n=tt(e,r),o=rt(n);J.info(`Restarted external task ${ue[s].workerId} for topic ${o}`)}).on("unlink",async s=>{if(!st.includes(ns(s)))return;dn(s);let r=et(s),n=tt(e,r),o=rt(n);J.info(`Stopped external task ${ue[s].workerId} for topic '${o}'`,{reason:`External Task for topic '${o}' was removed`,workerId:ue[s].workerId,topic:o}),delete ue[s]}).on("error",s=>J.info(`Watcher error: ${s}`))}async function fn(t,e,s){let r=et(t);if(!ja(r)){J.error(`Could not find external task file in directory '${r}'`);return}let o=await Ya(t),i=await za(o,t);if(i.default===void 0){J.info(`External task file recognized at ${t}. Please export a default handler function. For more information see https://processcube.io/docs/app-sdk/samples/external-task-adapter#external-tasks-entwickeln`);return}let a=await hn(),c=pn(a),d=tt(e,r),u=rt(d),f=i.default,l={identity:c,...s,...i?.config},m=new Ma(rs,u,f,l);m.onWorkerError((y,w,S)=>{J.error(`Intercepted "${y}"-type error: ${w.message}`,{err:w,type:y,externalTask:S})}),m.start(),await is(a,m),ue[t]=m}async function Va(t,e){let s=ue[t]?.workerId;dn(t),await fn(t,e,{workerId:s})}function dn(t){let e=ue[t];e&&(e.stop(),e.dispose())}async function ja(t){let s=(await Wa.readdir(t)).filter(r=>st.includes(r));if(s.length===0)return null;if(s.length>1)throw new Error(`Found more than one external task file in directory '${t}'`);return s[0]}async function hn(){if(!os)return null;if(!process.env.PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_ID||!process.env.PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_SECRET){let r=new Error("Required environment variables PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_ID and PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_SECRET are missing. For help, please refer to our documentation on environment variables at: https://processcube.io/docs/app-sdk/samples/external-task-adapter#authority");throw J.error("Required environment variables PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_ID and PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_SECRET are missing",{err:r}),r}let t=await Ba.discover(process.env.PROCESSCUBE_AUTHORITY_URL);return await new t.Client({client_id:process.env.PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_ID,client_secret:process.env.PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_SECRET}).grant({grant_type:"client_credentials",scope:"engine_etw"})}function pn(t){if(!os||t===null)return qa;let e=t.access_token,s=Ga(e);return{token:t.access_token,userId:s.sub}}async function is(t,e,s=5){try{if(!os||t===null||!e.pollingIsActive)return;let n=await Xa(t)*Ka*1e3;setTimeout(async()=>{if(!e.pollingIsActive)return;let o=await hn(),i=pn(o);e.identity=i,await is(o,e)},n)}catch(r){if(s===0)throw r;J.error(`Could not refresh identity for external task worker ${e.workerId}`,{err:r,workerId:e.workerId,retryCount:s});let n=2*1e3;setTimeout(async()=>await is(t,e,s-1),n)}}async function Ya(t){let e=await Ua({entryPoints:[t],write:!1,bundle:!0,platform:"node",target:"node18",format:"cjs"});if(e.errors.length>0)throw J.error(`Could not transpile file at '${t}'`,{errors:e.errors}),new Error(`Could not transpile file at '${t}'`);return e.warnings.length>0&&J.warn(`Transpiled file at '${t}' with warnings`,{warnings:e.warnings}),e.outputFiles[0].text}async function za(t,e){try{var s=module.constructor,r=new s;return r._compile(t,e),r.exports}catch(n){throw J.error("Could not require module from string",{err:n}),n}}async function Xa(t){let e=t.expires_in;if(!e&&t.expires_at&&(e=Math.floor(t.expires_at-Date.now()/1e3)),e===void 0)throw new Error("Could not determine the time until the access token for external task workers expires");return e}function rt(t){return t.replace(/^\.\/+|\([^)]+\)|^\/*|\/*$/g,"").replace(/[\/]{2,}/g,"/")}function Qa(t){let e,s=[t,an(process.cwd(),"app"),an(process.cwd(),"src","app")];for(let r of s)if(r&&cn(r)){e=r;break}if(!e)throw new Error("Could not find external tasks directory");return e}function Qc(){return $}import{cookies as nt,headers as _n}from"next/headers";import{ResponseCookies as Za}from"next/dist/compiled/@edge-runtime/cookies";import{getToken as En}from"next-auth/jwt";var Ja=process.env.NEXTAUTH_URL?.startsWith("https://"),gn=`${Ja?"__Secure-":""}next-auth.session-token`;async function sl(){let t=await En({req:{cookies:nt(),headers:_n()}});if(t?.expiresAt&&Date.now()>=t.expiresAt*1e3){let s=await fetch(`${process.env.NEXTAUTH_URL}/api/auth/session`,{method:"GET",headers:{"Content-Type":"application/json",cookie:nt().toString()}}),r=new Za(s.headers),n=r.get(gn);if(n){let o=!1;try{nt().set(gn,n.value,{...n})}catch{o=!0}if(t=await En({req:{cookies:o?r:nt(),headers:_n()}}),t?.error)throw t.error}}if(!t?.accessToken||!t?.sub)throw new Error("AccessToken or Sub could not be determined!");return{token:t?.accessToken,userId:t?.sub}}import{DataModels as ec}from"@5minds/processcube_engine_client";async function ol(t){return await $.processInstances.query({...t?.query,state:ec.ProcessInstances.ProcessInstanceState.running},t?.options)}import{DataModels as ae}from"@5minds/processcube_engine_client";async function ul(t={},e){let{correlationId:s,processInstanceId:r,flowNodeId:n}=t;return new Promise(async(o,i)=>{let a=await $.userTasks.onUserTaskWaiting(async u=>{let f=s!==void 0&&u.correlationId!==s,l=u.flowNodeInstanceId===void 0,m=r!==void 0&&u.processInstanceId!==r,y=n!==void 0&&u.flowNodeId!==n;if(f||l||m||y)return;let w=await sc(u.flowNodeInstanceId,{identity:e});return $.notification.removeSubscription(a,e),w===null?i(new Error(`UserTask with instance ID "${u.flowNodeInstanceId}" does not exist.`)):o(w)},{identity:e}),d=(await tc({correlationId:s,processInstanceId:r,flowNodeId:n,state:ae.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:e})).userTasks[0];d&&($.notification.removeSubscription(a,e),o(d))})}async function fl(t,e={},s={},r){await $.userTasks.finishUserTask(t,s,r);let n={state:ae.FlowNodeInstances.FlowNodeInstanceState.suspended,...e};return(await $.userTasks.query(n,{identity:r})).userTasks[0]}async function tc(...t){return await $.userTasks.query(...t)}async function dl(t){return await $.userTasks.query({state:ae.FlowNodeInstances.FlowNodeInstanceState.suspended},t)}async function hl(t,e){return await $.userTasks.query({processInstanceId:t,state:ae.FlowNodeInstances.FlowNodeInstanceState.suspended},e)}async function pl(t,e){return await $.userTasks.query({flowNodeId:t,state:ae.FlowNodeInstances.FlowNodeInstanceState.suspended},e)}async function sc(t,e){let s=await $.userTasks.query({flowNodeInstanceId:t,state:ae.FlowNodeInstances.FlowNodeInstanceState.suspended},{...e,limit:1});return s.userTasks.length===0?null:s.userTasks[0]}async function _l(t,e){return await $.userTasks.query({correlationId:t,state:ae.FlowNodeInstances.FlowNodeInstanceState.suspended},e)}async function El(t,e){let s=await $.userTasks.query({state:ae.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:t,...e}),r=s.userTasks.filter(n=>n.actualOwnerId===t.userId);return s.userTasks=r,s}async function gl(t,e){let s=await $.userTasks.query({state:ae.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:t,...e}),r=s.userTasks.filter(n=>n.assignedUserIds?.includes(t.userId));return s.userTasks=r,s}import{PHASE_DEVELOPMENT_SERVER as rc,PHASE_PRODUCTION_SERVER as nc}from"next/dist/shared/lib/constants";var mn=!1;function Il(t={}){let{applicationSdk:e,...s}=t;return async(r,n)=>{let o=r===rc||r===nc;return e?.useExternalTasks&&o&&!mn&&(mn=!0,await un(e?.customExternalTasksDirPath)),s}}import{revalidatePath as ic}from"next/cache";import{redirect as oc}from"next/navigation";function Ll(t){ic(t),oc(t)}async function Fl(...t){return await $.processModels.startProcessInstance(...t)}async function Ul(...t){await $.userTasks.finishUserTask(...t)}export{Ul as finishUserTask,fl as finishUserTaskAndGetNext,ol as getActiveProcessInstances,gl as getAssignedUserTasksByIdentity,Qc as getEngineClient,sl as getIdentity,El as getReservedUserTasksByIdentity,tc as getUserTasks,sc as getWaitingUserTaskByFlowNodeInstanceId,dl as getWaitingUserTasks,_l as getWaitingUserTasksByCorrelationId,pl as getWaitingUserTasksByFlowNodeId,hl as getWaitingUserTasksByProcessInstanceId,Ll as navigateToUrl,Fl as startProcess,ul as waitForUserTask,Il as withApplicationSdk};
1
+ var Rn=Object.create;var as=Object.defineProperty;var An=Object.getOwnPropertyDescriptor;var Sn=Object.getOwnPropertyNames;var Tn=Object.getPrototypeOf,Cn=Object.prototype.hasOwnProperty;var L=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,s)=>(typeof require<"u"?require:e)[s]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var xn=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Sn(e))!Cn.call(t,n)&&n!==s&&as(t,n,{get:()=>e[n],enumerable:!(r=An(e,n))||r.enumerable});return t};var bn=(t,e,s)=>(s=t!=null?Rn(Tn(t)):{},xn(e||!t||!t.__esModule?as(s,"default",{value:t,enumerable:!0}):s,t));var we=v((cc,ds)=>{"use strict";var In=L("path"),ne="\\\\/",cs=`[^${ne}]`,ie="\\.",vn="\\+",kn="\\?",He="\\/",Nn="(?=.)",ls="[^/]",ot=`(?:${He}|$)`,us=`(?:^|${He})`,at=`${ie}{1,2}${ot}`,On=`(?!${ie})`,Pn=`(?!${us}${at})`,Ln=`(?!${ie}{0,1}${ot})`,Hn=`(?!${at})`,Dn=`[^.${He}]`,Fn=`${ls}*?`,fs={DOT_LITERAL:ie,PLUS_LITERAL:vn,QMARK_LITERAL:kn,SLASH_LITERAL:He,ONE_CHAR:Nn,QMARK:ls,END_ANCHOR:ot,DOTS_SLASH:at,NO_DOT:On,NO_DOTS:Pn,NO_DOT_SLASH:Ln,NO_DOTS_SLASH:Hn,QMARK_NO_DOT:Dn,STAR:Fn,START_ANCHOR:us},$n={...fs,SLASH_LITERAL:`[${ne}]`,QMARK:cs,STAR:`${cs}*?`,DOTS_SLASH:`${ie}{1,2}(?:[${ne}]|$)`,NO_DOT:`(?!${ie})`,NO_DOTS:`(?!(?:^|[${ne}])${ie}{1,2}(?:[${ne}]|$))`,NO_DOT_SLASH:`(?!${ie}{0,1}(?:[${ne}]|$))`,NO_DOTS_SLASH:`(?!${ie}{1,2}(?:[${ne}]|$))`,QMARK_NO_DOT:`[^.${ne}]`,START_ANCHOR:`(?:^|[${ne}])`,END_ANCHOR:`(?:[${ne}]|$)`},Mn={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};ds.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Mn,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:In.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?$n:fs}}});var De=v(Y=>{"use strict";var Un=L("path"),Wn=process.platform==="win32",{REGEX_BACKSLASH:Bn,REGEX_REMOVE_BACKSLASH:Gn,REGEX_SPECIAL_CHARS:qn,REGEX_SPECIAL_CHARS_GLOBAL:Kn}=we();Y.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Y.hasRegexChars=t=>qn.test(t);Y.isRegexChar=t=>t.length===1&&Y.hasRegexChars(t);Y.escapeRegex=t=>t.replace(Kn,"\\$1");Y.toPosixSlashes=t=>t.replace(Bn,"/");Y.removeBackslashes=t=>t.replace(Gn,e=>e==="\\"?"":e);Y.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Y.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:Wn===!0||Un.sep==="\\";Y.escapeLast=(t,e,s)=>{let r=t.lastIndexOf(e,s);return r===-1?t:t[r-1]==="\\"?Y.escapeLast(t,e,r-1):`${t.slice(0,r)}\\${t.slice(r)}`};Y.removePrefix=(t,e={})=>{let s=t;return s.startsWith("./")&&(s=s.slice(2),e.prefix="./"),s};Y.wrapOutput=(t,e={},s={})=>{let r=s.contains?"":"^",n=s.contains?"":"$",o=`${r}(?:${t})${n}`;return e.negated===!0&&(o=`(?:^(?!${o}).*$)`),o}});var ws=v((uc,ys)=>{"use strict";var hs=De(),{CHAR_ASTERISK:ct,CHAR_AT:jn,CHAR_BACKWARD_SLASH:Re,CHAR_COMMA:Vn,CHAR_DOT:lt,CHAR_EXCLAMATION_MARK:ut,CHAR_FORWARD_SLASH:ms,CHAR_LEFT_CURLY_BRACE:ft,CHAR_LEFT_PARENTHESES:dt,CHAR_LEFT_SQUARE_BRACKET:Yn,CHAR_PLUS:zn,CHAR_QUESTION_MARK:ps,CHAR_RIGHT_CURLY_BRACE:Xn,CHAR_RIGHT_PARENTHESES:_s,CHAR_RIGHT_SQUARE_BRACKET:Qn}=we(),Es=t=>t===ms||t===Re,gs=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},Zn=(t,e)=>{let s=e||{},r=t.length-1,n=s.parts===!0||s.scanToEnd===!0,o=[],i=[],a=[],c=t,d=-1,u=0,f=0,l=!1,m=!1,y=!1,w=!1,S=!1,x=!1,H=!1,F=!1,te=!1,q=!1,ce=0,K,A,I={value:"",depth:0,isGlob:!1},G=()=>d>=r,_=()=>c.charCodeAt(d+1),P=()=>(K=A,c.charCodeAt(++d));for(;d<r;){A=P();let j;if(A===Re){H=I.backslashes=!0,A=P(),A===ft&&(x=!0);continue}if(x===!0||A===ft){for(ce++;G()!==!0&&(A=P());){if(A===Re){H=I.backslashes=!0,P();continue}if(A===ft){ce++;continue}if(x!==!0&&A===lt&&(A=P())===lt){if(l=I.isBrace=!0,y=I.isGlob=!0,q=!0,n===!0)continue;break}if(x!==!0&&A===Vn){if(l=I.isBrace=!0,y=I.isGlob=!0,q=!0,n===!0)continue;break}if(A===Xn&&(ce--,ce===0)){x=!1,l=I.isBrace=!0,q=!0;break}}if(n===!0)continue;break}if(A===ms){if(o.push(d),i.push(I),I={value:"",depth:0,isGlob:!1},q===!0)continue;if(K===lt&&d===u+1){u+=2;continue}f=d+1;continue}if(s.noext!==!0&&(A===zn||A===jn||A===ct||A===ps||A===ut)===!0&&_()===dt){if(y=I.isGlob=!0,w=I.isExtglob=!0,q=!0,A===ut&&d===u&&(te=!0),n===!0){for(;G()!==!0&&(A=P());){if(A===Re){H=I.backslashes=!0,A=P();continue}if(A===_s){y=I.isGlob=!0,q=!0;break}}continue}break}if(A===ct){if(K===ct&&(S=I.isGlobstar=!0),y=I.isGlob=!0,q=!0,n===!0)continue;break}if(A===ps){if(y=I.isGlob=!0,q=!0,n===!0)continue;break}if(A===Yn){for(;G()!==!0&&(j=P());){if(j===Re){H=I.backslashes=!0,P();continue}if(j===Qn){m=I.isBracket=!0,y=I.isGlob=!0,q=!0;break}}if(n===!0)continue;break}if(s.nonegate!==!0&&A===ut&&d===u){F=I.negated=!0,u++;continue}if(s.noparen!==!0&&A===dt){if(y=I.isGlob=!0,n===!0){for(;G()!==!0&&(A=P());){if(A===dt){H=I.backslashes=!0,A=P();continue}if(A===_s){q=!0;break}}continue}break}if(y===!0){if(q=!0,n===!0)continue;break}}s.noext===!0&&(w=!1,y=!1);let N=c,le="",h="";u>0&&(le=c.slice(0,u),c=c.slice(u),f-=u),N&&y===!0&&f>0?(N=c.slice(0,f),h=c.slice(f)):y===!0?(N="",h=c):N=c,N&&N!==""&&N!=="/"&&N!==c&&Es(N.charCodeAt(N.length-1))&&(N=N.slice(0,-1)),s.unescape===!0&&(h&&(h=hs.removeBackslashes(h)),N&&H===!0&&(N=hs.removeBackslashes(N)));let p={prefix:le,input:t,start:u,base:N,glob:h,isBrace:l,isBracket:m,isGlob:y,isExtglob:w,isGlobstar:S,negated:F,negatedExtglob:te};if(s.tokens===!0&&(p.maxDepth=0,Es(A)||i.push(I),p.tokens=i),s.parts===!0||s.tokens===!0){let j;for(let b=0;b<o.length;b++){let se=j?j+1:u,re=o[b],z=t.slice(se,re);s.tokens&&(b===0&&u!==0?(i[b].isPrefix=!0,i[b].value=le):i[b].value=z,gs(i[b]),p.maxDepth+=i[b].depth),(b!==0||z!=="")&&a.push(z),j=re}if(j&&j+1<t.length){let b=t.slice(j+1);a.push(b),s.tokens&&(i[i.length-1].value=b,gs(i[i.length-1]),p.maxDepth+=i[i.length-1].depth)}p.slashes=o,p.parts=a}return p};ys.exports=Zn});var Ss=v((fc,As)=>{"use strict";var Fe=we(),X=De(),{MAX_LENGTH:$e,POSIX_REGEX_SOURCE:Jn,REGEX_NON_SPECIAL_CHARS:ei,REGEX_SPECIAL_CHARS_BACKREF:ti,REPLACEMENTS:Rs}=Fe,si=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let s=`[${t.join("-")}]`;try{new RegExp(s)}catch{return t.map(n=>X.escapeRegex(n)).join("..")}return s},_e=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,ht=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=Rs[t]||t;let s={...e},r=typeof s.maxLength=="number"?Math.min($e,s.maxLength):$e,n=t.length;if(n>r)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${r}`);let o={type:"bos",value:"",output:s.prepend||""},i=[o],a=s.capture?"":"?:",c=X.isWindows(e),d=Fe.globChars(c),u=Fe.extglobChars(d),{DOT_LITERAL:f,PLUS_LITERAL:l,SLASH_LITERAL:m,ONE_CHAR:y,DOTS_SLASH:w,NO_DOT:S,NO_DOT_SLASH:x,NO_DOTS_SLASH:H,QMARK:F,QMARK_NO_DOT:te,STAR:q,START_ANCHOR:ce}=d,K=g=>`(${a}(?:(?!${ce}${g.dot?w:f}).)*?)`,A=s.dot?"":S,I=s.dot?F:te,G=s.bash===!0?K(s):q;s.capture&&(G=`(${G})`),typeof s.noext=="boolean"&&(s.noextglob=s.noext);let _={input:t,index:-1,start:0,dot:s.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:i};t=X.removePrefix(t,_),n=t.length;let P=[],N=[],le=[],h=o,p,j=()=>_.index===n-1,b=_.peek=(g=1)=>t[_.index+g],se=_.advance=()=>t[++_.index]||"",re=()=>t.slice(_.index+1),z=(g="",O=0)=>{_.consumed+=g,_.index+=O},Ne=g=>{_.output+=g.output!=null?g.output:g.value,z(g.value)},yn=()=>{let g=1;for(;b()==="!"&&(b(2)!=="("||b(3)==="?");)se(),_.start++,g++;return g%2===0?!1:(_.negated=!0,_.start++,!0)},Oe=g=>{_[g]++,le.push(g)},fe=g=>{_[g]--,le.pop()},C=g=>{if(h.type==="globstar"){let O=_.braces>0&&(g.type==="comma"||g.type==="brace"),E=g.extglob===!0||P.length&&(g.type==="pipe"||g.type==="paren");g.type!=="slash"&&g.type!=="paren"&&!O&&!E&&(_.output=_.output.slice(0,-h.output.length),h.type="star",h.value="*",h.output=G,_.output+=h.output)}if(P.length&&g.type!=="paren"&&(P[P.length-1].inner+=g.value),(g.value||g.output)&&Ne(g),h&&h.type==="text"&&g.type==="text"){h.value+=g.value,h.output=(h.output||"")+g.value;return}g.prev=h,i.push(g),h=g},Pe=(g,O)=>{let E={...u[O],conditions:1,inner:""};E.prev=h,E.parens=_.parens,E.output=_.output;let T=(s.capture?"(":"")+E.open;Oe("parens"),C({type:g,value:O,output:_.output?"":y}),C({type:"paren",extglob:!0,value:se(),output:T}),P.push(E)},wn=g=>{let O=g.close+(s.capture?")":""),E;if(g.type==="negate"){let T=G;if(g.inner&&g.inner.length>1&&g.inner.includes("/")&&(T=K(s)),(T!==G||j()||/^\)+$/.test(re()))&&(O=g.close=`)$))${T}`),g.inner.includes("*")&&(E=re())&&/^\.[^\\/.]+$/.test(E)){let D=ht(E,{...e,fastpaths:!1}).output;O=g.close=`)${D})${T})`}g.prev.type==="bos"&&(_.negatedExtglob=!0)}C({type:"paren",extglob:!0,value:p,output:O}),fe("parens")};if(s.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let g=!1,O=t.replace(ti,(E,T,D,V,U,it)=>V==="\\"?(g=!0,E):V==="?"?T?T+V+(U?F.repeat(U.length):""):it===0?I+(U?F.repeat(U.length):""):F.repeat(D.length):V==="."?f.repeat(D.length):V==="*"?T?T+V+(U?G:""):G:T?E:`\\${E}`);return g===!0&&(s.unescape===!0?O=O.replace(/\\/g,""):O=O.replace(/\\+/g,E=>E.length%2===0?"\\\\":E?"\\":"")),O===t&&s.contains===!0?(_.output=t,_):(_.output=X.wrapOutput(O,_,e),_)}for(;!j();){if(p=se(),p==="\0")continue;if(p==="\\"){let E=b();if(E==="/"&&s.bash!==!0||E==="."||E===";")continue;if(!E){p+="\\",C({type:"text",value:p});continue}let T=/^\\+/.exec(re()),D=0;if(T&&T[0].length>2&&(D=T[0].length,_.index+=D,D%2!==0&&(p+="\\")),s.unescape===!0?p=se():p+=se(),_.brackets===0){C({type:"text",value:p});continue}}if(_.brackets>0&&(p!=="]"||h.value==="["||h.value==="[^")){if(s.posix!==!1&&p===":"){let E=h.value.slice(1);if(E.includes("[")&&(h.posix=!0,E.includes(":"))){let T=h.value.lastIndexOf("["),D=h.value.slice(0,T),V=h.value.slice(T+2),U=Jn[V];if(U){h.value=D+U,_.backtrack=!0,se(),!o.output&&i.indexOf(h)===1&&(o.output=y);continue}}}(p==="["&&b()!==":"||p==="-"&&b()==="]")&&(p=`\\${p}`),p==="]"&&(h.value==="["||h.value==="[^")&&(p=`\\${p}`),s.posix===!0&&p==="!"&&h.value==="["&&(p="^"),h.value+=p,Ne({value:p});continue}if(_.quotes===1&&p!=='"'){p=X.escapeRegex(p),h.value+=p,Ne({value:p});continue}if(p==='"'){_.quotes=_.quotes===1?0:1,s.keepQuotes===!0&&C({type:"text",value:p});continue}if(p==="("){Oe("parens"),C({type:"paren",value:p});continue}if(p===")"){if(_.parens===0&&s.strictBrackets===!0)throw new SyntaxError(_e("opening","("));let E=P[P.length-1];if(E&&_.parens===E.parens+1){wn(P.pop());continue}C({type:"paren",value:p,output:_.parens?")":"\\)"}),fe("parens");continue}if(p==="["){if(s.nobracket===!0||!re().includes("]")){if(s.nobracket!==!0&&s.strictBrackets===!0)throw new SyntaxError(_e("closing","]"));p=`\\${p}`}else Oe("brackets");C({type:"bracket",value:p});continue}if(p==="]"){if(s.nobracket===!0||h&&h.type==="bracket"&&h.value.length===1){C({type:"text",value:p,output:`\\${p}`});continue}if(_.brackets===0){if(s.strictBrackets===!0)throw new SyntaxError(_e("opening","["));C({type:"text",value:p,output:`\\${p}`});continue}fe("brackets");let E=h.value.slice(1);if(h.posix!==!0&&E[0]==="^"&&!E.includes("/")&&(p=`/${p}`),h.value+=p,Ne({value:p}),s.literalBrackets===!1||X.hasRegexChars(E))continue;let T=X.escapeRegex(h.value);if(_.output=_.output.slice(0,-h.value.length),s.literalBrackets===!0){_.output+=T,h.value=T;continue}h.value=`(${a}${T}|${h.value})`,_.output+=h.value;continue}if(p==="{"&&s.nobrace!==!0){Oe("braces");let E={type:"brace",value:p,output:"(",outputIndex:_.output.length,tokensIndex:_.tokens.length};N.push(E),C(E);continue}if(p==="}"){let E=N[N.length-1];if(s.nobrace===!0||!E){C({type:"text",value:p,output:p});continue}let T=")";if(E.dots===!0){let D=i.slice(),V=[];for(let U=D.length-1;U>=0&&(i.pop(),D[U].type!=="brace");U--)D[U].type!=="dots"&&V.unshift(D[U].value);T=si(V,s),_.backtrack=!0}if(E.comma!==!0&&E.dots!==!0){let D=_.output.slice(0,E.outputIndex),V=_.tokens.slice(E.tokensIndex);E.value=E.output="\\{",p=T="\\}",_.output=D;for(let U of V)_.output+=U.output||U.value}C({type:"brace",value:p,output:T}),fe("braces"),N.pop();continue}if(p==="|"){P.length>0&&P[P.length-1].conditions++,C({type:"text",value:p});continue}if(p===","){let E=p,T=N[N.length-1];T&&le[le.length-1]==="braces"&&(T.comma=!0,E="|"),C({type:"comma",value:p,output:E});continue}if(p==="/"){if(h.type==="dot"&&_.index===_.start+1){_.start=_.index+1,_.consumed="",_.output="",i.pop(),h=o;continue}C({type:"slash",value:p,output:m});continue}if(p==="."){if(_.braces>0&&h.type==="dot"){h.value==="."&&(h.output=f);let E=N[N.length-1];h.type="dots",h.output+=p,h.value+=p,E.dots=!0;continue}if(_.braces+_.parens===0&&h.type!=="bos"&&h.type!=="slash"){C({type:"text",value:p,output:f});continue}C({type:"dot",value:p,output:f});continue}if(p==="?"){if(!(h&&h.value==="(")&&s.noextglob!==!0&&b()==="("&&b(2)!=="?"){Pe("qmark",p);continue}if(h&&h.type==="paren"){let T=b(),D=p;if(T==="<"&&!X.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(h.value==="("&&!/[!=<:]/.test(T)||T==="<"&&!/<([!=]|\w+>)/.test(re()))&&(D=`\\${p}`),C({type:"text",value:p,output:D});continue}if(s.dot!==!0&&(h.type==="slash"||h.type==="bos")){C({type:"qmark",value:p,output:te});continue}C({type:"qmark",value:p,output:F});continue}if(p==="!"){if(s.noextglob!==!0&&b()==="("&&(b(2)!=="?"||!/[!=<:]/.test(b(3)))){Pe("negate",p);continue}if(s.nonegate!==!0&&_.index===0){yn();continue}}if(p==="+"){if(s.noextglob!==!0&&b()==="("&&b(2)!=="?"){Pe("plus",p);continue}if(h&&h.value==="("||s.regex===!1){C({type:"plus",value:p,output:l});continue}if(h&&(h.type==="bracket"||h.type==="paren"||h.type==="brace")||_.parens>0){C({type:"plus",value:p});continue}C({type:"plus",value:l});continue}if(p==="@"){if(s.noextglob!==!0&&b()==="("&&b(2)!=="?"){C({type:"at",extglob:!0,value:p,output:""});continue}C({type:"text",value:p});continue}if(p!=="*"){(p==="$"||p==="^")&&(p=`\\${p}`);let E=ei.exec(re());E&&(p+=E[0],_.index+=E[0].length),C({type:"text",value:p});continue}if(h&&(h.type==="globstar"||h.star===!0)){h.type="star",h.star=!0,h.value+=p,h.output=G,_.backtrack=!0,_.globstar=!0,z(p);continue}let g=re();if(s.noextglob!==!0&&/^\([^?]/.test(g)){Pe("star",p);continue}if(h.type==="star"){if(s.noglobstar===!0){z(p);continue}let E=h.prev,T=E.prev,D=E.type==="slash"||E.type==="bos",V=T&&(T.type==="star"||T.type==="globstar");if(s.bash===!0&&(!D||g[0]&&g[0]!=="/")){C({type:"star",value:p,output:""});continue}let U=_.braces>0&&(E.type==="comma"||E.type==="brace"),it=P.length&&(E.type==="pipe"||E.type==="paren");if(!D&&E.type!=="paren"&&!U&&!it){C({type:"star",value:p,output:""});continue}for(;g.slice(0,3)==="/**";){let Le=t[_.index+4];if(Le&&Le!=="/")break;g=g.slice(3),z("/**",3)}if(E.type==="bos"&&j()){h.type="globstar",h.value+=p,h.output=K(s),_.output=h.output,_.globstar=!0,z(p);continue}if(E.type==="slash"&&E.prev.type!=="bos"&&!V&&j()){_.output=_.output.slice(0,-(E.output+h.output).length),E.output=`(?:${E.output}`,h.type="globstar",h.output=K(s)+(s.strictSlashes?")":"|$)"),h.value+=p,_.globstar=!0,_.output+=E.output+h.output,z(p);continue}if(E.type==="slash"&&E.prev.type!=="bos"&&g[0]==="/"){let Le=g[1]!==void 0?"|$":"";_.output=_.output.slice(0,-(E.output+h.output).length),E.output=`(?:${E.output}`,h.type="globstar",h.output=`${K(s)}${m}|${m}${Le})`,h.value+=p,_.output+=E.output+h.output,_.globstar=!0,z(p+se()),C({type:"slash",value:"/",output:""});continue}if(E.type==="bos"&&g[0]==="/"){h.type="globstar",h.value+=p,h.output=`(?:^|${m}|${K(s)}${m})`,_.output=h.output,_.globstar=!0,z(p+se()),C({type:"slash",value:"/",output:""});continue}_.output=_.output.slice(0,-h.output.length),h.type="globstar",h.output=K(s),h.value+=p,_.output+=h.output,_.globstar=!0,z(p);continue}let O={type:"star",value:p,output:G};if(s.bash===!0){O.output=".*?",(h.type==="bos"||h.type==="slash")&&(O.output=A+O.output),C(O);continue}if(h&&(h.type==="bracket"||h.type==="paren")&&s.regex===!0){O.output=p,C(O);continue}(_.index===_.start||h.type==="slash"||h.type==="dot")&&(h.type==="dot"?(_.output+=x,h.output+=x):s.dot===!0?(_.output+=H,h.output+=H):(_.output+=A,h.output+=A),b()!=="*"&&(_.output+=y,h.output+=y)),C(O)}for(;_.brackets>0;){if(s.strictBrackets===!0)throw new SyntaxError(_e("closing","]"));_.output=X.escapeLast(_.output,"["),fe("brackets")}for(;_.parens>0;){if(s.strictBrackets===!0)throw new SyntaxError(_e("closing",")"));_.output=X.escapeLast(_.output,"("),fe("parens")}for(;_.braces>0;){if(s.strictBrackets===!0)throw new SyntaxError(_e("closing","}"));_.output=X.escapeLast(_.output,"{"),fe("braces")}if(s.strictSlashes!==!0&&(h.type==="star"||h.type==="bracket")&&C({type:"maybe_slash",value:"",output:`${m}?`}),_.backtrack===!0){_.output="";for(let g of _.tokens)_.output+=g.output!=null?g.output:g.value,g.suffix&&(_.output+=g.suffix)}return _};ht.fastpaths=(t,e)=>{let s={...e},r=typeof s.maxLength=="number"?Math.min($e,s.maxLength):$e,n=t.length;if(n>r)throw new SyntaxError(`Input length: ${n}, exceeds maximum allowed length: ${r}`);t=Rs[t]||t;let o=X.isWindows(e),{DOT_LITERAL:i,SLASH_LITERAL:a,ONE_CHAR:c,DOTS_SLASH:d,NO_DOT:u,NO_DOTS:f,NO_DOTS_SLASH:l,STAR:m,START_ANCHOR:y}=Fe.globChars(o),w=s.dot?f:u,S=s.dot?l:u,x=s.capture?"":"?:",H={negated:!1,prefix:""},F=s.bash===!0?".*?":m;s.capture&&(F=`(${F})`);let te=A=>A.noglobstar===!0?F:`(${x}(?:(?!${y}${A.dot?d:i}).)*?)`,q=A=>{switch(A){case"*":return`${w}${c}${F}`;case".*":return`${i}${c}${F}`;case"*.*":return`${w}${F}${i}${c}${F}`;case"*/*":return`${w}${F}${a}${c}${S}${F}`;case"**":return w+te(s);case"**/*":return`(?:${w}${te(s)}${a})?${S}${c}${F}`;case"**/*.*":return`(?:${w}${te(s)}${a})?${S}${F}${i}${c}${F}`;case"**/.*":return`(?:${w}${te(s)}${a})?${i}${c}${F}`;default:{let I=/^(.*?)\.(\w+)$/.exec(A);if(!I)return;let G=q(I[1]);return G?G+i+I[2]:void 0}}},ce=X.removePrefix(t,H),K=q(ce);return K&&s.strictSlashes!==!0&&(K+=`${a}?`),K};As.exports=ht});var Cs=v((dc,Ts)=>{"use strict";var ri=L("path"),ni=ws(),pt=Ss(),_t=De(),ii=we(),oi=t=>t&&typeof t=="object"&&!Array.isArray(t),M=(t,e,s=!1)=>{if(Array.isArray(t)){let u=t.map(l=>M(l,e,s));return l=>{for(let m of u){let y=m(l);if(y)return y}return!1}}let r=oi(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!r)throw new TypeError("Expected pattern to be a non-empty string");let n=e||{},o=_t.isWindows(e),i=r?M.compileRe(t,e):M.makeRe(t,e,!1,!0),a=i.state;delete i.state;let c=()=>!1;if(n.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=M(n.ignore,u,s)}let d=(u,f=!1)=>{let{isMatch:l,match:m,output:y}=M.test(u,i,e,{glob:t,posix:o}),w={glob:t,state:a,regex:i,posix:o,input:u,output:y,match:m,isMatch:l};return typeof n.onResult=="function"&&n.onResult(w),l===!1?(w.isMatch=!1,f?w:!1):c(u)?(typeof n.onIgnore=="function"&&n.onIgnore(w),w.isMatch=!1,f?w:!1):(typeof n.onMatch=="function"&&n.onMatch(w),f?w:!0)};return s&&(d.state=a),d};M.test=(t,e,s,{glob:r,posix:n}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let o=s||{},i=o.format||(n?_t.toPosixSlashes:null),a=t===r,c=a&&i?i(t):t;return a===!1&&(c=i?i(t):t,a=c===r),(a===!1||o.capture===!0)&&(o.matchBase===!0||o.basename===!0?a=M.matchBase(t,e,s,n):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};M.matchBase=(t,e,s,r=_t.isWindows(s))=>(e instanceof RegExp?e:M.makeRe(e,s)).test(ri.basename(t));M.isMatch=(t,e,s)=>M(e,s)(t);M.parse=(t,e)=>Array.isArray(t)?t.map(s=>M.parse(s,e)):pt(t,{...e,fastpaths:!1});M.scan=(t,e)=>ni(t,e);M.compileRe=(t,e,s=!1,r=!1)=>{if(s===!0)return t.output;let n=e||{},o=n.contains?"":"^",i=n.contains?"":"$",a=`${o}(?:${t.output})${i}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=M.toRegex(a,e);return r===!0&&(c.state=t),c};M.makeRe=(t,e={},s=!1,r=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let n={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(n.output=pt.fastpaths(t,e)),n.output||(n=pt(t,e)),M.compileRe(n,e,s,r)};M.toRegex=(t,e)=>{try{let s=e||{};return new RegExp(t,s.flags||(s.nocase?"i":""))}catch(s){if(e&&e.debug===!0)throw s;return/$^/}};M.constants=ii;Ts.exports=M});var Et=v((hc,xs)=>{"use strict";xs.exports=Cs()});var Ls=v((pc,Ps)=>{"use strict";var Se=L("fs"),{Readable:ai}=L("stream"),Ae=L("path"),{promisify:Be}=L("util"),gt=Et(),ci=Be(Se.readdir),li=Be(Se.stat),bs=Be(Se.lstat),ui=Be(Se.realpath),fi="!",Ns="READDIRP_RECURSIVE_ERROR",di=new Set(["ENOENT","EPERM","EACCES","ELOOP",Ns]),mt="files",Os="directories",Ue="files_directories",Me="all",Is=[mt,Os,Ue,Me],hi=t=>di.has(t.code),[vs,pi]=process.versions.node.split(".").slice(0,2).map(t=>Number.parseInt(t,10)),_i=process.platform==="win32"&&(vs>10||vs===10&&pi>=5),ks=t=>{if(t!==void 0){if(typeof t=="function")return t;if(typeof t=="string"){let e=gt(t.trim());return s=>e(s.basename)}if(Array.isArray(t)){let e=[],s=[];for(let r of t){let n=r.trim();n.charAt(0)===fi?s.push(gt(n.slice(1))):e.push(gt(n))}return s.length>0?e.length>0?r=>e.some(n=>n(r.basename))&&!s.some(n=>n(r.basename)):r=>!s.some(n=>n(r.basename)):r=>e.some(n=>n(r.basename))}}},We=class t extends ai{static get defaultOptions(){return{root:".",fileFilter:e=>!0,directoryFilter:e=>!0,type:mt,lstat:!1,depth:2147483648,alwaysStat:!1}}constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark||4096});let s={...t.defaultOptions,...e},{root:r,type:n}=s;this._fileFilter=ks(s.fileFilter),this._directoryFilter=ks(s.directoryFilter);let o=s.lstat?bs:li;_i?this._stat=i=>o(i,{bigint:!0}):this._stat=o,this._maxDepth=s.depth,this._wantsDir=[Os,Ue,Me].includes(n),this._wantsFile=[mt,Ue,Me].includes(n),this._wantsEverything=n===Me,this._root=Ae.resolve(r),this._isDirent="Dirent"in Se&&!s.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(r,1)],this.reading=!1,this.parent=void 0}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let{path:s,depth:r,files:n=[]}=this.parent||{};if(n.length>0){let o=n.splice(0,e).map(i=>this._formatEntry(i,s));for(let i of await Promise.all(o)){if(this.destroyed)return;let a=await this._getEntryType(i);a==="directory"&&this._directoryFilter(i)?(r<=this._maxDepth&&this.parents.push(this._exploreDir(i.fullPath,r+1)),this._wantsDir&&(this.push(i),e--)):(a==="file"||this._includeAsFile(i))&&this._fileFilter(i)&&this._wantsFile&&(this.push(i),e--)}}else{let o=this.parents.pop();if(!o){this.push(null);break}if(this.parent=await o,this.destroyed)return}}}catch(s){this.destroy(s)}finally{this.reading=!1}}}async _exploreDir(e,s){let r;try{r=await ci(e,this._rdOptions)}catch(n){this._onError(n)}return{files:r,depth:s,path:e}}async _formatEntry(e,s){let r;try{let n=this._isDirent?e.name:e,o=Ae.resolve(Ae.join(s,n));r={path:Ae.relative(this._root,o),fullPath:o,basename:n},r[this._statsProp]=this._isDirent?e:await this._stat(o)}catch(n){this._onError(n)}return r}_onError(e){hi(e)&&!this.destroyed?this.emit("warn",e):this.destroy(e)}async _getEntryType(e){let s=e&&e[this._statsProp];if(s){if(s.isFile())return"file";if(s.isDirectory())return"directory";if(s&&s.isSymbolicLink()){let r=e.fullPath;try{let n=await ui(r),o=await bs(n);if(o.isFile())return"file";if(o.isDirectory()){let i=n.length;if(r.startsWith(n)&&r.substr(i,1)===Ae.sep){let a=new Error(`Circular symlink detected: "${r}" points to "${n}"`);return a.code=Ns,this._onError(a)}return"directory"}}catch(n){this._onError(n)}}}}_includeAsFile(e){let s=e&&e[this._statsProp];return s&&this._wantsEverything&&!s.isDirectory()}},Ee=(t,e={})=>{let s=e.entryType||e.type;if(s==="both"&&(s=Ue),s&&(e.type=s),t){if(typeof t!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(s&&!Is.includes(s))throw new Error(`readdirp: Invalid type passed. Use one of ${Is.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return e.root=t,new We(e)},Ei=(t,e={})=>new Promise((s,r)=>{let n=[];Ee(t,e).on("data",o=>n.push(o)).on("end",()=>s(n)).on("error",o=>r(o))});Ee.promise=Ei;Ee.ReaddirpStream=We;Ee.default=Ee;Ps.exports=Ee});var yt=v((_c,Hs)=>{Hs.exports=function(t,e){if(typeof t!="string")throw new TypeError("expected path to be a string");if(t==="\\"||t==="/")return"/";var s=t.length;if(s<=1)return t;var r="";if(s>4&&t[3]==="\\"){var n=t[2];(n==="?"||n===".")&&t.slice(0,2)==="\\\\"&&(t=t.slice(2),r="//")}var o=t.split(/[/\\]+/);return e!==!1&&o[o.length-1]===""&&o.pop(),r+o.join("/")}});var Ws=v((Ms,Us)=>{"use strict";Object.defineProperty(Ms,"__esModule",{value:!0});var $s=Et(),gi=yt(),Ds="!",mi={returnIndex:!1},yi=t=>Array.isArray(t)?t:[t],wi=(t,e)=>{if(typeof t=="function")return t;if(typeof t=="string"){let s=$s(t,e);return r=>t===r||s(r)}return t instanceof RegExp?s=>t.test(s):s=>!1},Fs=(t,e,s,r)=>{let n=Array.isArray(s),o=n?s[0]:s;if(!n&&typeof o!="string")throw new TypeError("anymatch: second argument must be a string: got "+Object.prototype.toString.call(o));let i=gi(o,!1);for(let c=0;c<e.length;c++){let d=e[c];if(d(i))return r?-1:!1}let a=n&&[i].concat(s.slice(1));for(let c=0;c<t.length;c++){let d=t[c];if(n?d(...a):d(i))return r?c:!0}return r?-1:!1},wt=(t,e,s=mi)=>{if(t==null)throw new TypeError("anymatch: specify first argument");let r=typeof s=="boolean"?{returnIndex:s}:s,n=r.returnIndex||!1,o=yi(t),i=o.filter(c=>typeof c=="string"&&c.charAt(0)===Ds).map(c=>c.slice(1)).map(c=>$s(c,r)),a=o.filter(c=>typeof c!="string"||typeof c=="string"&&c.charAt(0)!==Ds).map(c=>wi(c,r));return e==null?(c,d=!1)=>Fs(a,i,c,typeof d=="boolean"?d:!1):Fs(a,i,e,n)};wt.default=wt;Us.exports=wt});var Gs=v((Ec,Bs)=>{Bs.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var s;s=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(s[2])return!0;e=e.slice(s.index+s[0].length)}return!1}});var Rt=v((gc,Ks)=>{var Ri=Gs(),qs={"{":"}","(":")","[":"]"},Ai=function(t){if(t[0]==="!")return!0;for(var e=0,s=-2,r=-2,n=-2,o=-2,i=-2;e<t.length;){if(t[e]==="*"||t[e+1]==="?"&&/[\].+)]/.test(t[e])||r!==-1&&t[e]==="["&&t[e+1]!=="]"&&(r<e&&(r=t.indexOf("]",e)),r>e&&(i===-1||i>r||(i=t.indexOf("\\",e),i===-1||i>r)))||n!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(n=t.indexOf("}",e),n>e&&(i=t.indexOf("\\",e),i===-1||i>n))||o!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(o=t.indexOf(")",e),o>e&&(i=t.indexOf("\\",e),i===-1||i>o))||s!==-1&&t[e]==="("&&t[e+1]!=="|"&&(s<e&&(s=t.indexOf("|",e)),s!==-1&&t[s+1]!==")"&&(o=t.indexOf(")",s),o>s&&(i=t.indexOf("\\",s),i===-1||i>o))))return!0;if(t[e]==="\\"){var a=t[e+1];e+=2;var c=qs[a];if(c){var d=t.indexOf(c,e);d!==-1&&(e=d+1)}if(t[e]==="!")return!0}else e++}return!1},Si=function(t){if(t[0]==="!")return!0;for(var e=0;e<t.length;){if(/[*?{}()[\]]/.test(t[e]))return!0;if(t[e]==="\\"){var s=t[e+1];e+=2;var r=qs[s];if(r){var n=t.indexOf(r,e);n!==-1&&(e=n+1)}if(t[e]==="!")return!0}else e++}return!1};Ks.exports=function(e,s){if(typeof e!="string"||e==="")return!1;if(Ri(e))return!0;var r=Ai;return s&&s.strict===!1&&(r=Si),r(e)}});var Vs=v((mc,js)=>{"use strict";var Ti=Rt(),Ci=L("path").posix.dirname,xi=L("os").platform()==="win32",At="/",bi=/\\/g,Ii=/[\{\[].*[\}\]]$/,vi=/(^|[^\\])([\{\[]|\([^\)]+$)/,ki=/\\([\!\*\?\|\[\]\(\)\{\}])/g;js.exports=function(e,s){var r=Object.assign({flipBackslashes:!0},s);r.flipBackslashes&&xi&&e.indexOf(At)<0&&(e=e.replace(bi,At)),Ii.test(e)&&(e+=At),e+="a";do e=Ci(e);while(Ti(e)||vi.test(e));return e.replace(ki,"$1")}});var Ge=v(Z=>{"use strict";Z.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;Z.find=(t,e)=>t.nodes.find(s=>s.type===e);Z.exceedsLimit=(t,e,s=1,r)=>r===!1||!Z.isInteger(t)||!Z.isInteger(e)?!1:(Number(e)-Number(t))/Number(s)>=r;Z.escapeNode=(t,e=0,s)=>{let r=t.nodes[e];r&&(s&&r.type===s||r.type==="open"||r.type==="close")&&r.escaped!==!0&&(r.value="\\"+r.value,r.escaped=!0)};Z.encloseBrace=t=>t.type!=="brace"||t.commas>>0+t.ranges>>0?!1:(t.invalid=!0,!0);Z.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:!(t.commas>>0+t.ranges>>0)||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;Z.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;Z.reduce=t=>t.reduce((e,s)=>(s.type==="text"&&e.push(s.value),s.type==="range"&&(s.type="text"),e),[]);Z.flatten=(...t)=>{let e=[],s=r=>{for(let n=0;n<r.length;n++){let o=r[n];Array.isArray(o)?s(o,e):o!==void 0&&e.push(o)}return e};return s(t),e}});var qe=v((wc,zs)=>{"use strict";var Ys=Ge();zs.exports=(t,e={})=>{let s=(r,n={})=>{let o=e.escapeInvalid&&Ys.isInvalidBrace(n),i=r.invalid===!0&&e.escapeInvalid===!0,a="";if(r.value)return(o||i)&&Ys.isOpenOrClose(r)?"\\"+r.value:r.value;if(r.value)return r.value;if(r.nodes)for(let c of r.nodes)a+=s(c);return a};return s(t)}});var Qs=v((Rc,Xs)=>{"use strict";Xs.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var or=v((Ac,ir)=>{"use strict";var Zs=Qs(),de=(t,e,s)=>{if(Zs(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(Zs(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let r={relaxZeros:!0,...s};typeof r.strictZeros=="boolean"&&(r.relaxZeros=r.strictZeros===!1);let n=String(r.relaxZeros),o=String(r.shorthand),i=String(r.capture),a=String(r.wrap),c=t+":"+e+"="+n+o+i+a;if(de.cache.hasOwnProperty(c))return de.cache[c].result;let d=Math.min(t,e),u=Math.max(t,e);if(Math.abs(d-u)===1){let w=t+"|"+e;return r.capture?`(${w})`:r.wrap===!1?w:`(?:${w})`}let f=nr(t)||nr(e),l={min:t,max:e,a:d,b:u},m=[],y=[];if(f&&(l.isPadded=f,l.maxLen=String(l.max).length),d<0){let w=u<0?Math.abs(u):1;y=Js(w,Math.abs(d),l,r),d=l.a=0}return u>=0&&(m=Js(d,u,l,r)),l.negatives=y,l.positives=m,l.result=Ni(y,m,r),r.capture===!0?l.result=`(${l.result})`:r.wrap!==!1&&m.length+y.length>1&&(l.result=`(?:${l.result})`),de.cache[c]=l,l.result};function Ni(t,e,s){let r=St(t,e,"-",!1,s)||[],n=St(e,t,"",!1,s)||[],o=St(t,e,"-?",!0,s)||[];return r.concat(o).concat(n).join("|")}function Oi(t,e){let s=1,r=1,n=tr(t,s),o=new Set([e]);for(;t<=n&&n<=e;)o.add(n),s+=1,n=tr(t,s);for(n=sr(e+1,r)-1;t<n&&n<=e;)o.add(n),r+=1,n=sr(e+1,r)-1;return o=[...o],o.sort(Hi),o}function Pi(t,e,s){if(t===e)return{pattern:t,count:[],digits:0};let r=Li(t,e),n=r.length,o="",i=0;for(let a=0;a<n;a++){let[c,d]=r[a];c===d?o+=c:c!=="0"||d!=="9"?o+=Di(c,d,s):i++}return i&&(o+=s.shorthand===!0?"\\d":"[0-9]"),{pattern:o,count:[i],digits:n}}function Js(t,e,s,r){let n=Oi(t,e),o=[],i=t,a;for(let c=0;c<n.length;c++){let d=n[c],u=Pi(String(i),String(d),r),f="";if(!s.isPadded&&a&&a.pattern===u.pattern){a.count.length>1&&a.count.pop(),a.count.push(u.count[0]),a.string=a.pattern+rr(a.count),i=d+1;continue}s.isPadded&&(f=Fi(d,s,r)),u.string=f+u.pattern+rr(u.count),o.push(u),i=d+1,a=u}return o}function St(t,e,s,r,n){let o=[];for(let i of t){let{string:a}=i;!r&&!er(e,"string",a)&&o.push(s+a),r&&er(e,"string",a)&&o.push(s+a)}return o}function Li(t,e){let s=[];for(let r=0;r<t.length;r++)s.push([t[r],e[r]]);return s}function Hi(t,e){return t>e?1:e>t?-1:0}function er(t,e,s){return t.some(r=>r[e]===s)}function tr(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function sr(t,e){return t-t%Math.pow(10,e)}function rr(t){let[e=0,s=""]=t;return s||e>1?`{${e+(s?","+s:"")}}`:""}function Di(t,e,s){return`[${t}${e-t===1?"":"-"}${e}]`}function nr(t){return/^-?(0+)\d/.test(t)}function Fi(t,e,s){if(!e.isPadded)return t;let r=Math.abs(e.maxLen-String(t).length),n=s.relaxZeros!==!1;switch(r){case 0:return"";case 1:return n?"0?":"0";case 2:return n?"0{0,2}":"00";default:return n?`0{0,${r}}`:`0{${r}}`}}de.cache={};de.clearCache=()=>de.cache={};ir.exports=de});var xt=v((Sc,pr)=>{"use strict";var $i=L("util"),lr=or(),ar=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),Mi=t=>e=>t===!0?Number(e):String(e),Tt=t=>typeof t=="number"||typeof t=="string"&&t!=="",Te=t=>Number.isInteger(+t),Ct=t=>{let e=`${t}`,s=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++s]==="0";);return s>0},Ui=(t,e,s)=>typeof t=="string"||typeof e=="string"?!0:s.stringify===!0,Wi=(t,e,s)=>{if(e>0){let r=t[0]==="-"?"-":"";r&&(t=t.slice(1)),t=r+t.padStart(r?e-1:e,"0")}return s===!1?String(t):t},cr=(t,e)=>{let s=t[0]==="-"?"-":"";for(s&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return s?"-"+t:t},Bi=(t,e)=>{t.negatives.sort((i,a)=>i<a?-1:i>a?1:0),t.positives.sort((i,a)=>i<a?-1:i>a?1:0);let s=e.capture?"":"?:",r="",n="",o;return t.positives.length&&(r=t.positives.join("|")),t.negatives.length&&(n=`-(${s}${t.negatives.join("|")})`),r&&n?o=`${r}|${n}`:o=r||n,e.wrap?`(${s}${o})`:o},ur=(t,e,s,r)=>{if(s)return lr(t,e,{wrap:!1,...r});let n=String.fromCharCode(t);if(t===e)return n;let o=String.fromCharCode(e);return`[${n}-${o}]`},fr=(t,e,s)=>{if(Array.isArray(t)){let r=s.wrap===!0,n=s.capture?"":"?:";return r?`(${n}${t.join("|")})`:t.join("|")}return lr(t,e,s)},dr=(...t)=>new RangeError("Invalid range arguments: "+$i.inspect(...t)),hr=(t,e,s)=>{if(s.strictRanges===!0)throw dr([t,e]);return[]},Gi=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},qi=(t,e,s=1,r={})=>{let n=Number(t),o=Number(e);if(!Number.isInteger(n)||!Number.isInteger(o)){if(r.strictRanges===!0)throw dr([t,e]);return[]}n===0&&(n=0),o===0&&(o=0);let i=n>o,a=String(t),c=String(e),d=String(s);s=Math.max(Math.abs(s),1);let u=Ct(a)||Ct(c)||Ct(d),f=u?Math.max(a.length,c.length,d.length):0,l=u===!1&&Ui(t,e,r)===!1,m=r.transform||Mi(l);if(r.toRegex&&s===1)return ur(cr(t,f),cr(e,f),!0,r);let y={negatives:[],positives:[]},w=H=>y[H<0?"negatives":"positives"].push(Math.abs(H)),S=[],x=0;for(;i?n>=o:n<=o;)r.toRegex===!0&&s>1?w(n):S.push(Wi(m(n,x),f,l)),n=i?n-s:n+s,x++;return r.toRegex===!0?s>1?Bi(y,r):fr(S,null,{wrap:!1,...r}):S},Ki=(t,e,s=1,r={})=>{if(!Te(t)&&t.length>1||!Te(e)&&e.length>1)return hr(t,e,r);let n=r.transform||(l=>String.fromCharCode(l)),o=`${t}`.charCodeAt(0),i=`${e}`.charCodeAt(0),a=o>i,c=Math.min(o,i),d=Math.max(o,i);if(r.toRegex&&s===1)return ur(c,d,!1,r);let u=[],f=0;for(;a?o>=i:o<=i;)u.push(n(o,f)),o=a?o-s:o+s,f++;return r.toRegex===!0?fr(u,null,{wrap:!1,options:r}):u},Ke=(t,e,s,r={})=>{if(e==null&&Tt(t))return[t];if(!Tt(t)||!Tt(e))return hr(t,e,r);if(typeof s=="function")return Ke(t,e,1,{transform:s});if(ar(s))return Ke(t,e,0,s);let n={...r};return n.capture===!0&&(n.wrap=!0),s=s||n.step||1,Te(s)?Te(t)&&Te(e)?qi(t,e,s,n):Ki(t,e,Math.max(Math.abs(s),1),n):s!=null&&!ar(s)?Gi(s,n):Ke(t,e,1,s)};pr.exports=Ke});var gr=v((Tc,Er)=>{"use strict";var ji=xt(),_r=Ge(),Vi=(t,e={})=>{let s=(r,n={})=>{let o=_r.isInvalidBrace(n),i=r.invalid===!0&&e.escapeInvalid===!0,a=o===!0||i===!0,c=e.escapeInvalid===!0?"\\":"",d="";if(r.isOpen===!0||r.isClose===!0)return c+r.value;if(r.type==="open")return a?c+r.value:"(";if(r.type==="close")return a?c+r.value:")";if(r.type==="comma")return r.prev.type==="comma"?"":a?r.value:"|";if(r.value)return r.value;if(r.nodes&&r.ranges>0){let u=_r.reduce(r.nodes),f=ji(...u,{...e,wrap:!1,toRegex:!0});if(f.length!==0)return u.length>1&&f.length>1?`(${f})`:f}if(r.nodes)for(let u of r.nodes)d+=s(u,r);return d};return s(t)};Er.exports=Vi});var wr=v((Cc,yr)=>{"use strict";var Yi=xt(),mr=qe(),ge=Ge(),he=(t="",e="",s=!1)=>{let r=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return s?ge.flatten(e).map(n=>`{${n}}`):e;for(let n of t)if(Array.isArray(n))for(let o of n)r.push(he(o,e,s));else for(let o of e)s===!0&&typeof o=="string"&&(o=`{${o}}`),r.push(Array.isArray(o)?he(n,o,s):n+o);return ge.flatten(r)},zi=(t,e={})=>{let s=e.rangeLimit===void 0?1e3:e.rangeLimit,r=(n,o={})=>{n.queue=[];let i=o,a=o.queue;for(;i.type!=="brace"&&i.type!=="root"&&i.parent;)i=i.parent,a=i.queue;if(n.invalid||n.dollar){a.push(he(a.pop(),mr(n,e)));return}if(n.type==="brace"&&n.invalid!==!0&&n.nodes.length===2){a.push(he(a.pop(),["{}"]));return}if(n.nodes&&n.ranges>0){let f=ge.reduce(n.nodes);if(ge.exceedsLimit(...f,e.step,s))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let l=Yi(...f,e);l.length===0&&(l=mr(n,e)),a.push(he(a.pop(),l)),n.nodes=[];return}let c=ge.encloseBrace(n),d=n.queue,u=n;for(;u.type!=="brace"&&u.type!=="root"&&u.parent;)u=u.parent,d=u.queue;for(let f=0;f<n.nodes.length;f++){let l=n.nodes[f];if(l.type==="comma"&&n.type==="brace"){f===1&&d.push(""),d.push("");continue}if(l.type==="close"){a.push(he(a.pop(),d,c));continue}if(l.value&&l.type!=="open"){d.push(he(d.pop(),l.value));continue}l.nodes&&r(l,n)}return d};return ge.flatten(r(t))};yr.exports=zi});var Ar=v((xc,Rr)=>{"use strict";Rr.exports={MAX_LENGTH:1024*64,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
2
+ `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var br=v((bc,xr)=>{"use strict";var Xi=qe(),{MAX_LENGTH:Sr,CHAR_BACKSLASH:bt,CHAR_BACKTICK:Qi,CHAR_COMMA:Zi,CHAR_DOT:Ji,CHAR_LEFT_PARENTHESES:eo,CHAR_RIGHT_PARENTHESES:to,CHAR_LEFT_CURLY_BRACE:so,CHAR_RIGHT_CURLY_BRACE:ro,CHAR_LEFT_SQUARE_BRACKET:Tr,CHAR_RIGHT_SQUARE_BRACKET:Cr,CHAR_DOUBLE_QUOTE:no,CHAR_SINGLE_QUOTE:io,CHAR_NO_BREAK_SPACE:oo,CHAR_ZERO_WIDTH_NOBREAK_SPACE:ao}=Ar(),co=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let s=e||{},r=typeof s.maxLength=="number"?Math.min(Sr,s.maxLength):Sr;if(t.length>r)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${r})`);let n={type:"root",input:t,nodes:[]},o=[n],i=n,a=n,c=0,d=t.length,u=0,f=0,l,m={},y=()=>t[u++],w=S=>{if(S.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&S.type==="text"){a.value+=S.value;return}return i.nodes.push(S),S.parent=i,S.prev=a,a=S,S};for(w({type:"bos"});u<d;)if(i=o[o.length-1],l=y(),!(l===ao||l===oo)){if(l===bt){w({type:"text",value:(e.keepEscaping?l:"")+y()});continue}if(l===Cr){w({type:"text",value:"\\"+l});continue}if(l===Tr){c++;let S=!0,x;for(;u<d&&(x=y());){if(l+=x,x===Tr){c++;continue}if(x===bt){l+=y();continue}if(x===Cr&&(c--,c===0))break}w({type:"text",value:l});continue}if(l===eo){i=w({type:"paren",nodes:[]}),o.push(i),w({type:"text",value:l});continue}if(l===to){if(i.type!=="paren"){w({type:"text",value:l});continue}i=o.pop(),w({type:"text",value:l}),i=o[o.length-1];continue}if(l===no||l===io||l===Qi){let S=l,x;for(e.keepQuotes!==!0&&(l="");u<d&&(x=y());){if(x===bt){l+=x+y();continue}if(x===S){e.keepQuotes===!0&&(l+=x);break}l+=x}w({type:"text",value:l});continue}if(l===so){f++;let x={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||i.dollar===!0,depth:f,commas:0,ranges:0,nodes:[]};i=w(x),o.push(i),w({type:"open",value:l});continue}if(l===ro){if(i.type!=="brace"){w({type:"text",value:l});continue}let S="close";i=o.pop(),i.close=!0,w({type:S,value:l}),f--,i=o[o.length-1];continue}if(l===Zi&&f>0){if(i.ranges>0){i.ranges=0;let S=i.nodes.shift();i.nodes=[S,{type:"text",value:Xi(i)}]}w({type:"comma",value:l}),i.commas++;continue}if(l===Ji&&f>0&&i.commas===0){let S=i.nodes;if(f===0||S.length===0){w({type:"text",value:l});continue}if(a.type==="dot"){if(i.range=[],a.value+=l,a.type="range",i.nodes.length!==3&&i.nodes.length!==5){i.invalid=!0,i.ranges=0,a.type="text";continue}i.ranges++,i.args=[];continue}if(a.type==="range"){S.pop();let x=S[S.length-1];x.value+=a.value+l,a=x,i.ranges--;continue}w({type:"dot",value:l});continue}w({type:"text",value:l})}do if(i=o.pop(),i.type!=="root"){i.nodes.forEach(H=>{H.nodes||(H.type==="open"&&(H.isOpen=!0),H.type==="close"&&(H.isClose=!0),H.nodes||(H.type="text"),H.invalid=!0)});let S=o[o.length-1],x=S.nodes.indexOf(i);S.nodes.splice(x,1,...i.nodes)}while(o.length>0);return w({type:"eos"}),n};xr.exports=co});var kr=v((Ic,vr)=>{"use strict";var Ir=qe(),lo=gr(),uo=wr(),fo=br(),Q=(t,e={})=>{let s=[];if(Array.isArray(t))for(let r of t){let n=Q.create(r,e);Array.isArray(n)?s.push(...n):s.push(n)}else s=[].concat(Q.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(s=[...new Set(s)]),s};Q.parse=(t,e={})=>fo(t,e);Q.stringify=(t,e={})=>Ir(typeof t=="string"?Q.parse(t,e):t,e);Q.compile=(t,e={})=>(typeof t=="string"&&(t=Q.parse(t,e)),lo(t,e));Q.expand=(t,e={})=>{typeof t=="string"&&(t=Q.parse(t,e));let s=uo(t,e);return e.noempty===!0&&(s=s.filter(Boolean)),e.nodupes===!0&&(s=[...new Set(s)]),s};Q.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Q.compile(t,e):Q.expand(t,e);vr.exports=Q});var Nr=v((vc,ho)=>{ho.exports=["3dm","3ds","3g2","3gp","7z","a","aac","adp","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]});var Pr=v((kc,Or)=>{Or.exports=Nr()});var Hr=v((Nc,Lr)=>{"use strict";var po=L("path"),_o=Pr(),Eo=new Set(_o);Lr.exports=t=>Eo.has(po.extname(t).slice(1).toLowerCase())});var je=v(R=>{"use strict";var{sep:go}=L("path"),{platform:It}=process,mo=L("os");R.EV_ALL="all";R.EV_READY="ready";R.EV_ADD="add";R.EV_CHANGE="change";R.EV_ADD_DIR="addDir";R.EV_UNLINK="unlink";R.EV_UNLINK_DIR="unlinkDir";R.EV_RAW="raw";R.EV_ERROR="error";R.STR_DATA="data";R.STR_END="end";R.STR_CLOSE="close";R.FSEVENT_CREATED="created";R.FSEVENT_MODIFIED="modified";R.FSEVENT_DELETED="deleted";R.FSEVENT_MOVED="moved";R.FSEVENT_CLONED="cloned";R.FSEVENT_UNKNOWN="unknown";R.FSEVENT_TYPE_FILE="file";R.FSEVENT_TYPE_DIRECTORY="directory";R.FSEVENT_TYPE_SYMLINK="symlink";R.KEY_LISTENERS="listeners";R.KEY_ERR="errHandlers";R.KEY_RAW="rawEmitters";R.HANDLER_KEYS=[R.KEY_LISTENERS,R.KEY_ERR,R.KEY_RAW];R.DOT_SLASH=`.${go}`;R.BACK_SLASH_RE=/\\/g;R.DOUBLE_SLASH_RE=/\/\//;R.SLASH_OR_BACK_SLASH_RE=/[/\\]/;R.DOT_RE=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/;R.REPLACER_RE=/^\.[/\\]/;R.SLASH="/";R.SLASH_SLASH="//";R.BRACE_START="{";R.BANG="!";R.ONE_DOT=".";R.TWO_DOTS="..";R.STAR="*";R.GLOBSTAR="**";R.ROOT_GLOBSTAR="/**/*";R.SLASH_GLOBSTAR="/**";R.DIR_SUFFIX="Dir";R.ANYMATCH_OPTS={dot:!0};R.STRING_TYPE="string";R.FUNCTION_TYPE="function";R.EMPTY_STR="";R.EMPTY_FN=()=>{};R.IDENTITY_FN=t=>t;R.isWindows=It==="win32";R.isMacos=It==="darwin";R.isLinux=It==="linux";R.isIBMi=mo.type()==="OS400"});var Wr=v((Pc,Ur)=>{"use strict";var oe=L("fs"),W=L("path"),{promisify:Ie}=L("util"),yo=Hr(),{isWindows:wo,isLinux:Ro,EMPTY_FN:Ao,EMPTY_STR:So,KEY_LISTENERS:me,KEY_ERR:vt,KEY_RAW:Ce,HANDLER_KEYS:To,EV_CHANGE:Ye,EV_ADD:Ve,EV_ADD_DIR:Co,EV_ERROR:Fr,STR_DATA:xo,STR_END:bo,BRACE_START:Io,STAR:vo}=je(),ko="watch",No=Ie(oe.open),$r=Ie(oe.stat),Oo=Ie(oe.lstat),Po=Ie(oe.close),kt=Ie(oe.realpath),Lo={lstat:Oo,stat:$r},Ot=(t,e)=>{t instanceof Set?t.forEach(e):e(t)},xe=(t,e,s)=>{let r=t[e];r instanceof Set||(t[e]=r=new Set([r])),r.add(s)},Ho=t=>e=>{let s=t[e];s instanceof Set?s.clear():delete t[e]},be=(t,e,s)=>{let r=t[e];r instanceof Set?r.delete(s):r===s&&delete t[e]},Mr=t=>t instanceof Set?t.size===0:!t,ze=new Map;function Dr(t,e,s,r,n){let o=(i,a)=>{s(t),n(i,a,{watchedPath:t}),a&&t!==a&&Xe(W.resolve(t,a),me,W.join(t,a))};try{return oe.watch(t,e,o)}catch(i){r(i)}}var Xe=(t,e,s,r,n)=>{let o=ze.get(t);o&&Ot(o[e],i=>{i(s,r,n)})},Do=(t,e,s,r)=>{let{listener:n,errHandler:o,rawEmitter:i}=r,a=ze.get(e),c;if(!s.persistent)return c=Dr(t,s,n,o,i),c.close.bind(c);if(a)xe(a,me,n),xe(a,vt,o),xe(a,Ce,i);else{if(c=Dr(t,s,Xe.bind(null,e,me),o,Xe.bind(null,e,Ce)),!c)return;c.on(Fr,async d=>{let u=Xe.bind(null,e,vt);if(a.watcherUnusable=!0,wo&&d.code==="EPERM")try{let f=await No(t,"r");await Po(f),u(d)}catch{}else u(d)}),a={listeners:n,errHandlers:o,rawEmitters:i,watcher:c},ze.set(e,a)}return()=>{be(a,me,n),be(a,vt,o),be(a,Ce,i),Mr(a.listeners)&&(a.watcher.close(),ze.delete(e),To.forEach(Ho(a)),a.watcher=void 0,Object.freeze(a))}},Nt=new Map,Fo=(t,e,s,r)=>{let{listener:n,rawEmitter:o}=r,i=Nt.get(e),a=new Set,c=new Set,d=i&&i.options;return d&&(d.persistent<s.persistent||d.interval>s.interval)&&(a=i.listeners,c=i.rawEmitters,oe.unwatchFile(e),i=void 0),i?(xe(i,me,n),xe(i,Ce,o)):(i={listeners:n,rawEmitters:o,options:s,watcher:oe.watchFile(e,s,(u,f)=>{Ot(i.rawEmitters,m=>{m(Ye,e,{curr:u,prev:f})});let l=u.mtimeMs;(u.size!==f.size||l>f.mtimeMs||l===0)&&Ot(i.listeners,m=>m(t,u))})},Nt.set(e,i)),()=>{be(i,me,n),be(i,Ce,o),Mr(i.listeners)&&(Nt.delete(e),oe.unwatchFile(e),i.options=i.watcher=void 0,Object.freeze(i))}},Pt=class{constructor(e){this.fsw=e,this._boundHandleError=s=>e._handleError(s)}_watchWithNodeFs(e,s){let r=this.fsw.options,n=W.dirname(e),o=W.basename(e);this.fsw._getWatchedDir(n).add(o);let a=W.resolve(e),c={persistent:r.persistent};s||(s=Ao);let d;return r.usePolling?(c.interval=r.enableBinaryInterval&&yo(o)?r.binaryInterval:r.interval,d=Fo(e,a,c,{listener:s,rawEmitter:this.fsw._emitRaw})):d=Do(e,a,c,{listener:s,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw}),d}_handleFile(e,s,r){if(this.fsw.closed)return;let n=W.dirname(e),o=W.basename(e),i=this.fsw._getWatchedDir(n),a=s;if(i.has(o))return;let c=async(u,f)=>{if(this.fsw._throttle(ko,e,5)){if(!f||f.mtimeMs===0)try{let l=await $r(e);if(this.fsw.closed)return;let m=l.atimeMs,y=l.mtimeMs;(!m||m<=y||y!==a.mtimeMs)&&this.fsw._emit(Ye,e,l),Ro&&a.ino!==l.ino?(this.fsw._closeFile(u),a=l,this.fsw._addPathCloser(u,this._watchWithNodeFs(e,c))):a=l}catch{this.fsw._remove(n,o)}else if(i.has(o)){let l=f.atimeMs,m=f.mtimeMs;(!l||l<=m||m!==a.mtimeMs)&&this.fsw._emit(Ye,e,f),a=f}}},d=this._watchWithNodeFs(e,c);if(!(r&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(e)){if(!this.fsw._throttle(Ve,e,0))return;this.fsw._emit(Ve,e,s)}return d}async _handleSymlink(e,s,r,n){if(this.fsw.closed)return;let o=e.fullPath,i=this.fsw._getWatchedDir(s);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let a;try{a=await kt(r)}catch{return this.fsw._emitReady(),!0}return this.fsw.closed?void 0:(i.has(n)?this.fsw._symlinkPaths.get(o)!==a&&(this.fsw._symlinkPaths.set(o,a),this.fsw._emit(Ye,r,e.stats)):(i.add(n),this.fsw._symlinkPaths.set(o,a),this.fsw._emit(Ve,r,e.stats)),this.fsw._emitReady(),!0)}if(this.fsw._symlinkPaths.has(o))return!0;this.fsw._symlinkPaths.set(o,!0)}_handleRead(e,s,r,n,o,i,a){if(e=W.join(e,So),!r.hasGlob&&(a=this.fsw._throttle("readdir",e,1e3),!a))return;let c=this.fsw._getWatchedDir(r.path),d=new Set,u=this.fsw._readdirp(e,{fileFilter:f=>r.filterPath(f),directoryFilter:f=>r.filterDir(f),depth:0}).on(xo,async f=>{if(this.fsw.closed){u=void 0;return}let l=f.path,m=W.join(e,l);if(d.add(l),!(f.stats.isSymbolicLink()&&await this._handleSymlink(f,e,m,l))){if(this.fsw.closed){u=void 0;return}(l===n||!n&&!c.has(l))&&(this.fsw._incrReadyCount(),m=W.join(o,W.relative(o,m)),this._addToNodeFs(m,s,r,i+1))}}).on(Fr,this._boundHandleError);return new Promise(f=>u.once(bo,()=>{if(this.fsw.closed){u=void 0;return}let l=a?a.clear():!1;f(),c.getChildren().filter(m=>m!==e&&!d.has(m)&&(!r.hasGlob||r.filterPath({fullPath:W.resolve(e,m)}))).forEach(m=>{this.fsw._remove(e,m)}),u=void 0,l&&this._handleRead(e,!1,r,n,o,i,a)}))}async _handleDir(e,s,r,n,o,i,a){let c=this.fsw._getWatchedDir(W.dirname(e)),d=c.has(W.basename(e));!(r&&this.fsw.options.ignoreInitial)&&!o&&!d&&(!i.hasGlob||i.globFilter(e))&&this.fsw._emit(Co,e,s),c.add(W.basename(e)),this.fsw._getWatchedDir(e);let u,f,l=this.fsw.options.depth;if((l==null||n<=l)&&!this.fsw._symlinkPaths.has(a)){if(!o&&(await this._handleRead(e,r,i,o,e,n,u),this.fsw.closed))return;f=this._watchWithNodeFs(e,(m,y)=>{y&&y.mtimeMs===0||this._handleRead(m,!1,i,o,e,n,u)})}return f}async _addToNodeFs(e,s,r,n,o){let i=this.fsw._emitReady;if(this.fsw._isIgnored(e)||this.fsw.closed)return i(),!1;let a=this.fsw._getWatchHelpers(e,n);!a.hasGlob&&r&&(a.hasGlob=r.hasGlob,a.globFilter=r.globFilter,a.filterPath=c=>r.filterPath(c),a.filterDir=c=>r.filterDir(c));try{let c=await Lo[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,c))return i(),!1;let d=this.fsw.options.followSymlinks&&!e.includes(vo)&&!e.includes(Io),u;if(c.isDirectory()){let f=W.resolve(e),l=d?await kt(e):e;if(this.fsw.closed||(u=await this._handleDir(a.watchPath,c,s,n,o,a,l),this.fsw.closed))return;f!==l&&l!==void 0&&this.fsw._symlinkPaths.set(f,l)}else if(c.isSymbolicLink()){let f=d?await kt(e):e;if(this.fsw.closed)return;let l=W.dirname(a.watchPath);if(this.fsw._getWatchedDir(l).add(a.watchPath),this.fsw._emit(Ve,a.watchPath,c),u=await this._handleDir(l,c,s,n,e,a,f),this.fsw.closed)return;f!==void 0&&this.fsw._symlinkPaths.set(W.resolve(e),f)}else u=this._handleFile(a.watchPath,c,s);return i(),this.fsw._addPathCloser(e,u),!1}catch(c){if(this.fsw._handleError(c))return i(),e}}};Ur.exports=Pt});var Yr=v((Lc,Wt)=>{"use strict";var Mt=L("fs"),B=L("path"),{promisify:Ut}=L("util"),ye;try{ye=L("fsevents")}catch{process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR}if(ye){let t=process.version.match(/v(\d+)\.(\d+)/);if(t&&t[1]&&t[2]){let e=Number.parseInt(t[1],10),s=Number.parseInt(t[2],10);e===8&&s<16&&(ye=void 0)}}var{EV_ADD:Lt,EV_CHANGE:$o,EV_ADD_DIR:Br,EV_UNLINK:Qe,EV_ERROR:Mo,STR_DATA:Uo,STR_END:Wo,FSEVENT_CREATED:Bo,FSEVENT_MODIFIED:Go,FSEVENT_DELETED:qo,FSEVENT_MOVED:Ko,FSEVENT_UNKNOWN:jo,FSEVENT_TYPE_FILE:Vo,FSEVENT_TYPE_DIRECTORY:ve,FSEVENT_TYPE_SYMLINK:Vr,ROOT_GLOBSTAR:Gr,DIR_SUFFIX:Yo,DOT_SLASH:qr,FUNCTION_TYPE:Ht,EMPTY_FN:zo,IDENTITY_FN:Xo}=je(),Qo=t=>isNaN(t)?{}:{depth:t},Ft=Ut(Mt.stat),Zo=Ut(Mt.lstat),Kr=Ut(Mt.realpath),Jo={stat:Ft,lstat:Zo},pe=new Map,ea=10,ta=new Set([69888,70400,71424,72704,73472,131328,131840,262912]),sa=(t,e)=>({stop:ye.watch(t,e)});function ra(t,e,s,r){let n=B.extname(e)?B.dirname(e):e,o=B.dirname(n),i=pe.get(n);na(o)&&(n=o);let a=B.resolve(t),c=a!==e,d=(f,l,m)=>{c&&(f=f.replace(e,a)),(f===a||!f.indexOf(a+B.sep))&&s(f,l,m)},u=!1;for(let f of pe.keys())if(e.indexOf(B.resolve(f)+B.sep)===0){n=f,i=pe.get(n),u=!0;break}return i||u?i.listeners.add(d):(i={listeners:new Set([d]),rawEmitter:r,watcher:sa(n,(f,l)=>{if(!i.listeners.size)return;let m=ye.getInfo(f,l);i.listeners.forEach(y=>{y(f,l,m)}),i.rawEmitter(m.event,f,m)})},pe.set(n,i)),()=>{let f=i.listeners;if(f.delete(d),!f.size&&(pe.delete(n),i.watcher))return i.watcher.stop().then(()=>{i.rawEmitter=i.watcher=void 0,Object.freeze(i)})}}var na=t=>{let e=0;for(let s of pe.keys())if(s.indexOf(t)===0&&(e++,e>=ea))return!0;return!1},ia=()=>ye&&pe.size<128,Dt=(t,e)=>{let s=0;for(;!t.indexOf(e)&&(t=B.dirname(t))!==e;)s++;return s},jr=(t,e)=>t.type===ve&&e.isDirectory()||t.type===Vr&&e.isSymbolicLink()||t.type===Vo&&e.isFile(),$t=class{constructor(e){this.fsw=e}checkIgnored(e,s){let r=this.fsw._ignoredPaths;if(this.fsw._isIgnored(e,s))return r.add(e),s&&s.isDirectory()&&r.add(e+Gr),!0;r.delete(e),r.delete(e+Gr)}addOrChange(e,s,r,n,o,i,a,c){let d=o.has(i)?$o:Lt;this.handleEvent(d,e,s,r,n,o,i,a,c)}async checkExists(e,s,r,n,o,i,a,c){try{let d=await Ft(e);if(this.fsw.closed)return;jr(a,d)?this.addOrChange(e,s,r,n,o,i,a,c):this.handleEvent(Qe,e,s,r,n,o,i,a,c)}catch(d){d.code==="EACCES"?this.addOrChange(e,s,r,n,o,i,a,c):this.handleEvent(Qe,e,s,r,n,o,i,a,c)}}handleEvent(e,s,r,n,o,i,a,c,d){if(!(this.fsw.closed||this.checkIgnored(s)))if(e===Qe){let u=c.type===ve;(u||i.has(a))&&this.fsw._remove(o,a,u)}else{if(e===Lt){if(c.type===ve&&this.fsw._getWatchedDir(s),c.type===Vr&&d.followSymlinks){let f=d.depth===void 0?void 0:Dt(r,n)+1;return this._addToFsEvents(s,!1,!0,f)}this.fsw._getWatchedDir(o).add(a)}let u=c.type===ve?e+Yo:e;this.fsw._emit(u,s),u===Br&&this._addToFsEvents(s,!1,!0)}}_watchWithFsEvents(e,s,r,n){if(this.fsw.closed||this.fsw._isIgnored(e))return;let o=this.fsw.options,a=ra(e,s,async(c,d,u)=>{if(this.fsw.closed||o.depth!==void 0&&Dt(c,s)>o.depth)return;let f=r(B.join(e,B.relative(e,c)));if(n&&!n(f))return;let l=B.dirname(f),m=B.basename(f),y=this.fsw._getWatchedDir(u.type===ve?f:l);if(ta.has(d)||u.event===jo)if(typeof o.ignored===Ht){let w;try{w=await Ft(f)}catch{}if(this.fsw.closed||this.checkIgnored(f,w))return;jr(u,w)?this.addOrChange(f,c,s,l,y,m,u,o):this.handleEvent(Qe,f,c,s,l,y,m,u,o)}else this.checkExists(f,c,s,l,y,m,u,o);else switch(u.event){case Bo:case Go:return this.addOrChange(f,c,s,l,y,m,u,o);case qo:case Ko:return this.checkExists(f,c,s,l,y,m,u,o)}},this.fsw._emitRaw);return this.fsw._emitReady(),a}async _handleFsEventsSymlink(e,s,r,n){if(!(this.fsw.closed||this.fsw._symlinkPaths.has(s))){this.fsw._symlinkPaths.set(s,!0),this.fsw._incrReadyCount();try{let o=await Kr(e);if(this.fsw.closed)return;if(this.fsw._isIgnored(o))return this.fsw._emitReady();this.fsw._incrReadyCount(),this._addToFsEvents(o||e,i=>{let a=e;return o&&o!==qr?a=i.replace(o,e):i!==qr&&(a=B.join(e,i)),r(a)},!1,n)}catch(o){if(this.fsw._handleError(o))return this.fsw._emitReady()}}}emitAdd(e,s,r,n,o){let i=r(e),a=s.isDirectory(),c=this.fsw._getWatchedDir(B.dirname(i)),d=B.basename(i);a&&this.fsw._getWatchedDir(i),!c.has(d)&&(c.add(d),(!n.ignoreInitial||o===!0)&&this.fsw._emit(a?Br:Lt,i,s))}initWatch(e,s,r,n){if(this.fsw.closed)return;let o=this._watchWithFsEvents(r.watchPath,B.resolve(e||r.watchPath),n,r.globFilter);this.fsw._addPathCloser(s,o)}async _addToFsEvents(e,s,r,n){if(this.fsw.closed)return;let o=this.fsw.options,i=typeof s===Ht?s:Xo,a=this.fsw._getWatchHelpers(e);try{let c=await Jo[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,c))throw null;if(c.isDirectory()){if(a.globFilter||this.emitAdd(i(e),c,i,o,r),n&&n>o.depth)return;this.fsw._readdirp(a.watchPath,{fileFilter:d=>a.filterPath(d),directoryFilter:d=>a.filterDir(d),...Qo(o.depth-(n||0))}).on(Uo,d=>{if(this.fsw.closed||d.stats.isDirectory()&&!a.filterPath(d))return;let u=B.join(a.watchPath,d.path),{fullPath:f}=d;if(a.followSymlinks&&d.stats.isSymbolicLink()){let l=o.depth===void 0?void 0:Dt(u,B.resolve(a.watchPath))+1;this._handleFsEventsSymlink(u,f,i,l)}else this.emitAdd(u,d.stats,i,o,r)}).on(Mo,zo).on(Wo,()=>{this.fsw._emitReady()})}else this.emitAdd(a.watchPath,c,i,o,r),this.fsw._emitReady()}catch(c){(!c||this.fsw._handleError(c))&&(this.fsw._emitReady(),this.fsw._emitReady())}if(o.persistent&&r!==!0)if(typeof s===Ht)this.initWatch(void 0,e,a,i);else{let c;try{c=await Kr(a.watchPath)}catch{}this.initWatch(c,e,a,i)}}};Wt.exports=$t;Wt.exports.canUse=ia});var on=v(ss=>{"use strict";var{EventEmitter:oa}=L("events"),es=L("fs"),k=L("path"),{promisify:tn}=L("util"),aa=Ls(),Vt=Ws().default,ca=Vs(),Bt=Rt(),la=kr(),ua=yt(),fa=Wr(),zr=Yr(),{EV_ALL:Gt,EV_READY:da,EV_ADD:Ze,EV_CHANGE:ke,EV_UNLINK:Xr,EV_ADD_DIR:ha,EV_UNLINK_DIR:pa,EV_RAW:_a,EV_ERROR:qt,STR_CLOSE:Ea,STR_END:ga,BACK_SLASH_RE:ma,DOUBLE_SLASH_RE:Qr,SLASH_OR_BACK_SLASH_RE:ya,DOT_RE:wa,REPLACER_RE:Ra,SLASH:Kt,SLASH_SLASH:Aa,BRACE_START:Sa,BANG:Yt,ONE_DOT:sn,TWO_DOTS:Ta,GLOBSTAR:Ca,SLASH_GLOBSTAR:jt,ANYMATCH_OPTS:zt,STRING_TYPE:ts,FUNCTION_TYPE:xa,EMPTY_STR:Xt,EMPTY_FN:ba,isWindows:Ia,isMacos:va,isIBMi:ka}=je(),Na=tn(es.stat),Oa=tn(es.readdir),Qt=(t=[])=>Array.isArray(t)?t:[t],rn=(t,e=[])=>(t.forEach(s=>{Array.isArray(s)?rn(s,e):e.push(s)}),e),Zr=t=>{let e=rn(Qt(t));if(!e.every(s=>typeof s===ts))throw new TypeError(`Non-string provided as watch path: ${e}`);return e.map(nn)},Jr=t=>{let e=t.replace(ma,Kt),s=!1;for(e.startsWith(Aa)&&(s=!0);e.match(Qr);)e=e.replace(Qr,Kt);return s&&(e=Kt+e),e},nn=t=>Jr(k.normalize(Jr(t))),en=(t=Xt)=>e=>typeof e!==ts?e:nn(k.isAbsolute(e)?e:k.join(t,e)),Pa=(t,e)=>k.isAbsolute(t)?t:t.startsWith(Yt)?Yt+k.join(e,t.slice(1)):k.join(e,t),ee=(t,e)=>t[e]===void 0,Zt=class{constructor(e,s){this.path=e,this._removeWatcher=s,this.items=new Set}add(e){let{items:s}=this;s&&e!==sn&&e!==Ta&&s.add(e)}async remove(e){let{items:s}=this;if(!s||(s.delete(e),s.size>0))return;let r=this.path;try{await Oa(r)}catch{this._removeWatcher&&this._removeWatcher(k.dirname(r),k.basename(r))}}has(e){let{items:s}=this;if(s)return s.has(e)}getChildren(){let{items:e}=this;if(e)return[...e.values()]}dispose(){this.items.clear(),delete this.path,delete this._removeWatcher,delete this.items,Object.freeze(this)}},La="stat",Ha="lstat",Jt=class{constructor(e,s,r,n){this.fsw=n,this.path=e=e.replace(Ra,Xt),this.watchPath=s,this.fullWatchPath=k.resolve(s),this.hasGlob=s!==e,e===Xt&&(this.hasGlob=!1),this.globSymlink=this.hasGlob&&r?void 0:!1,this.globFilter=this.hasGlob?Vt(e,void 0,zt):!1,this.dirParts=this.getDirParts(e),this.dirParts.forEach(o=>{o.length>1&&o.pop()}),this.followSymlinks=r,this.statMethod=r?La:Ha}checkGlobSymlink(e){return this.globSymlink===void 0&&(this.globSymlink=e.fullParentDir===this.fullWatchPath?!1:{realPath:e.fullParentDir,linkPath:this.fullWatchPath}),this.globSymlink?e.fullPath.replace(this.globSymlink.realPath,this.globSymlink.linkPath):e.fullPath}entryPath(e){return k.join(this.watchPath,k.relative(this.watchPath,this.checkGlobSymlink(e)))}filterPath(e){let{stats:s}=e;if(s&&s.isSymbolicLink())return this.filterDir(e);let r=this.entryPath(e);return(this.hasGlob&&typeof this.globFilter===xa?this.globFilter(r):!0)&&this.fsw._isntIgnored(r,s)&&this.fsw._hasReadPermissions(s)}getDirParts(e){if(!this.hasGlob)return[];let s=[];return(e.includes(Sa)?la.expand(e):[e]).forEach(n=>{s.push(k.relative(this.watchPath,n).split(ya))}),s}filterDir(e){if(this.hasGlob){let s=this.getDirParts(this.checkGlobSymlink(e)),r=!1;this.unmatchedGlob=!this.dirParts.some(n=>n.every((o,i)=>(o===Ca&&(r=!0),r||!s[0][i]||Vt(o,s[0][i],zt))))}return!this.unmatchedGlob&&this.fsw._isntIgnored(this.entryPath(e),e.stats)}},Je=class extends oa{constructor(e){super();let s={};e&&Object.assign(s,e),this._watched=new Map,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._symlinkPaths=new Map,this._streams=new Set,this.closed=!1,ee(s,"persistent")&&(s.persistent=!0),ee(s,"ignoreInitial")&&(s.ignoreInitial=!1),ee(s,"ignorePermissionErrors")&&(s.ignorePermissionErrors=!1),ee(s,"interval")&&(s.interval=100),ee(s,"binaryInterval")&&(s.binaryInterval=300),ee(s,"disableGlobbing")&&(s.disableGlobbing=!1),s.enableBinaryInterval=s.binaryInterval!==s.interval,ee(s,"useFsEvents")&&(s.useFsEvents=!s.usePolling),zr.canUse()||(s.useFsEvents=!1),ee(s,"usePolling")&&!s.useFsEvents&&(s.usePolling=va),ka&&(s.usePolling=!0);let n=process.env.CHOKIDAR_USEPOLLING;if(n!==void 0){let c=n.toLowerCase();c==="false"||c==="0"?s.usePolling=!1:c==="true"||c==="1"?s.usePolling=!0:s.usePolling=!!c}let o=process.env.CHOKIDAR_INTERVAL;o&&(s.interval=Number.parseInt(o,10)),ee(s,"atomic")&&(s.atomic=!s.usePolling&&!s.useFsEvents),s.atomic&&(this._pendingUnlinks=new Map),ee(s,"followSymlinks")&&(s.followSymlinks=!0),ee(s,"awaitWriteFinish")&&(s.awaitWriteFinish=!1),s.awaitWriteFinish===!0&&(s.awaitWriteFinish={});let i=s.awaitWriteFinish;i&&(i.stabilityThreshold||(i.stabilityThreshold=2e3),i.pollInterval||(i.pollInterval=100),this._pendingWrites=new Map),s.ignored&&(s.ignored=Qt(s.ignored));let a=0;this._emitReady=()=>{a++,a>=this._readyCount&&(this._emitReady=ba,this._readyEmitted=!0,process.nextTick(()=>this.emit(da)))},this._emitRaw=(...c)=>this.emit(_a,...c),this._readyEmitted=!1,this.options=s,s.useFsEvents?this._fsEventsHandler=new zr(this):this._nodeFsHandler=new fa(this),Object.freeze(s)}add(e,s,r){let{cwd:n,disableGlobbing:o}=this.options;this.closed=!1;let i=Zr(e);return n&&(i=i.map(a=>{let c=Pa(a,n);return o||!Bt(a)?c:ua(c)})),i=i.filter(a=>a.startsWith(Yt)?(this._ignoredPaths.add(a.slice(1)),!1):(this._ignoredPaths.delete(a),this._ignoredPaths.delete(a+jt),this._userIgnored=void 0,!0)),this.options.useFsEvents&&this._fsEventsHandler?(this._readyCount||(this._readyCount=i.length),this.options.persistent&&(this._readyCount*=2),i.forEach(a=>this._fsEventsHandler._addToFsEvents(a))):(this._readyCount||(this._readyCount=0),this._readyCount+=i.length,Promise.all(i.map(async a=>{let c=await this._nodeFsHandler._addToNodeFs(a,!r,0,0,s);return c&&this._emitReady(),c})).then(a=>{this.closed||a.filter(c=>c).forEach(c=>{this.add(k.dirname(c),k.basename(s||c))})})),this}unwatch(e){if(this.closed)return this;let s=Zr(e),{cwd:r}=this.options;return s.forEach(n=>{!k.isAbsolute(n)&&!this._closers.has(n)&&(r&&(n=k.join(r,n)),n=k.resolve(n)),this._closePath(n),this._ignoredPaths.add(n),this._watched.has(n)&&this._ignoredPaths.add(n+jt),this._userIgnored=void 0}),this}close(){if(this.closed)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach(s=>s.forEach(r=>{let n=r();n instanceof Promise&&e.push(n)})),this._streams.forEach(s=>s.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(s=>s.dispose()),["closers","watched","streams","symlinkPaths","throttled"].forEach(s=>{this[`_${s}`].clear()}),this._closePromise=e.length?Promise.all(e).then(()=>{}):Promise.resolve(),this._closePromise}getWatched(){let e={};return this._watched.forEach((s,r)=>{let n=this.options.cwd?k.relative(this.options.cwd,r):r;e[n||sn]=s.getChildren().sort()}),e}emitWithAll(e,s){this.emit(...s),e!==qt&&this.emit(Gt,...s)}async _emit(e,s,r,n,o){if(this.closed)return;let i=this.options;Ia&&(s=k.normalize(s)),i.cwd&&(s=k.relative(i.cwd,s));let a=[e,s];o!==void 0?a.push(r,n,o):n!==void 0?a.push(r,n):r!==void 0&&a.push(r);let c=i.awaitWriteFinish,d;if(c&&(d=this._pendingWrites.get(s)))return d.lastChange=new Date,this;if(i.atomic){if(e===Xr)return this._pendingUnlinks.set(s,a),setTimeout(()=>{this._pendingUnlinks.forEach((u,f)=>{this.emit(...u),this.emit(Gt,...u),this._pendingUnlinks.delete(f)})},typeof i.atomic=="number"?i.atomic:100),this;e===Ze&&this._pendingUnlinks.has(s)&&(e=a[0]=ke,this._pendingUnlinks.delete(s))}if(c&&(e===Ze||e===ke)&&this._readyEmitted){let u=(f,l)=>{f?(e=a[0]=qt,a[1]=f,this.emitWithAll(e,a)):l&&(a.length>2?a[2]=l:a.push(l),this.emitWithAll(e,a))};return this._awaitWriteFinish(s,c.stabilityThreshold,e,u),this}if(e===ke&&!this._throttle(ke,s,50))return this;if(i.alwaysStat&&r===void 0&&(e===Ze||e===ha||e===ke)){let u=i.cwd?k.join(i.cwd,s):s,f;try{f=await Na(u)}catch{}if(!f||this.closed)return;a.push(f)}return this.emitWithAll(e,a),this}_handleError(e){let s=e&&e.code;return e&&s!=="ENOENT"&&s!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||s!=="EPERM"&&s!=="EACCES")&&this.emit(qt,e),e||this.closed}_throttle(e,s,r){this._throttled.has(e)||this._throttled.set(e,new Map);let n=this._throttled.get(e),o=n.get(s);if(o)return o.count++,!1;let i,a=()=>{let d=n.get(s),u=d?d.count:0;return n.delete(s),clearTimeout(i),d&&clearTimeout(d.timeoutObject),u};i=setTimeout(a,r);let c={timeoutObject:i,clear:a,count:0};return n.set(s,c),c}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(e,s,r,n){let o,i=e;this.options.cwd&&!k.isAbsolute(e)&&(i=k.join(this.options.cwd,e));let a=new Date,c=d=>{es.stat(i,(u,f)=>{if(u||!this._pendingWrites.has(e)){u&&u.code!=="ENOENT"&&n(u);return}let l=Number(new Date);d&&f.size!==d.size&&(this._pendingWrites.get(e).lastChange=l);let m=this._pendingWrites.get(e);l-m.lastChange>=s?(this._pendingWrites.delete(e),n(void 0,f)):o=setTimeout(c,this.options.awaitWriteFinish.pollInterval,f)})};this._pendingWrites.has(e)||(this._pendingWrites.set(e,{lastChange:a,cancelWait:()=>(this._pendingWrites.delete(e),clearTimeout(o),r)}),o=setTimeout(c,this.options.awaitWriteFinish.pollInterval))}_getGlobIgnored(){return[...this._ignoredPaths.values()]}_isIgnored(e,s){if(this.options.atomic&&wa.test(e))return!0;if(!this._userIgnored){let{cwd:r}=this.options,n=this.options.ignored,o=n&&n.map(en(r)),i=Qt(o).filter(c=>typeof c===ts&&!Bt(c)).map(c=>c+jt),a=this._getGlobIgnored().map(en(r)).concat(o,i);this._userIgnored=Vt(a,void 0,zt)}return this._userIgnored([e,s])}_isntIgnored(e,s){return!this._isIgnored(e,s)}_getWatchHelpers(e,s){let r=s||this.options.disableGlobbing||!Bt(e)?e:ca(e),n=this.options.followSymlinks;return new Jt(e,r,n,this)}_getWatchedDir(e){this._boundRemove||(this._boundRemove=this._remove.bind(this));let s=k.resolve(e);return this._watched.has(s)||this._watched.set(s,new Zt(s,this._boundRemove)),this._watched.get(s)}_hasReadPermissions(e){if(this.options.ignorePermissionErrors)return!0;let r=(e&&Number.parseInt(e.mode,10))&511;return!!(4&Number.parseInt(r.toString(8)[0],10))}_remove(e,s,r){let n=k.join(e,s),o=k.resolve(n);if(r=r??(this._watched.has(n)||this._watched.has(o)),!this._throttle("remove",n,100))return;!r&&!this.options.useFsEvents&&this._watched.size===1&&this.add(e,s,!0),this._getWatchedDir(n).getChildren().forEach(l=>this._remove(n,l));let c=this._getWatchedDir(e),d=c.has(s);c.remove(s),this._symlinkPaths.has(o)&&this._symlinkPaths.delete(o);let u=n;if(this.options.cwd&&(u=k.relative(this.options.cwd,n)),this.options.awaitWriteFinish&&this._pendingWrites.has(u)&&this._pendingWrites.get(u).cancelWait()===Ze)return;this._watched.delete(n),this._watched.delete(o);let f=r?pa:Xr;d&&!this._isIgnored(n)&&this._emit(f,n),this.options.useFsEvents||this._closePath(n)}_closePath(e){this._closeFile(e);let s=k.dirname(e);this._getWatchedDir(s).remove(k.basename(e))}_closeFile(e){let s=this._closers.get(e);s&&(s.forEach(r=>r()),this._closers.delete(e))}_addPathCloser(e,s){if(!s)return;let r=this._closers.get(e);r||(r=[],this._closers.set(e,r)),r.push(s)}_readdirp(e,s){if(this.closed)return;let r={type:Gt,alwaysStat:!0,lstat:!0,...s},n=aa(e,r);return this._streams.add(n),n.once(Ea,()=>{n=void 0}),n.once(ga,()=>{n&&(this._streams.delete(n),n=void 0)}),n}};ss.FSWatcher=Je;var Da=(t,e)=>{let s=new Je(e);return s.add(t),s};ss.watch=Da});var ln=bn(on(),1);import{Logger as $a}from"@5minds/processcube_engine_sdk";import{ExternalTaskWorker as Ma}from"@5minds/processcube_engine_client";import{basename as ns,dirname as et,join as an,relative as tt}from"node:path";import{build as Ua}from"esbuild";import{promises as Wa,existsSync as cn}from"node:fs";import{Issuer as Ba}from"openid-client";import{jwtDecode as Ga}from"jwt-decode";import{EngineClient as Fa}from"@5minds/processcube_engine_client";var rs=process.env.PROCESSCUBE_ENGINE_URL??"http://localhost:10560",$=new Fa(rs);var qa={token:"ZHVtbXlfdG9rZW4=",userId:"dummy_token"},Ka=.85,st=["external_task.ts","external_task.js"],J=new $a("processcube_app_sdk:external_task_adapter"),os=process.env.PROCESSCUBE_AUTHORITY_URL!==void 0,ue={};async function un(t){if(t&&!cn(t))throw new Error(`Invalid customExternalTasksDirPath. The given path '${t}' does not exist`);let e=Qa(t);(0,ln.watch)(e).on("add",async s=>{if(!st.includes(ns(s)))return;await fn(s,e);let r=et(s),n=tt(e,r),o=rt(n);J.info(`Started external task ${ue[s].workerId} for topic ${o}`)}).on("change",async s=>{if(!st.includes(ns(s)))return;await ja(s,e);let r=et(s),n=tt(e,r),o=rt(n);J.info(`Restarted external task ${ue[s].workerId} for topic ${o}`)}).on("unlink",async s=>{if(!st.includes(ns(s)))return;dn(s);let r=et(s),n=tt(e,r),o=rt(n);J.info(`Stopped external task ${ue[s].workerId} for topic '${o}'`,{reason:`External Task for topic '${o}' was removed`,workerId:ue[s].workerId,topic:o}),delete ue[s]}).on("error",s=>J.info(`Watcher error: ${s}`))}async function fn(t,e,s){let r=et(t);if(!Va(r)){J.error(`Could not find external task file in directory '${r}'`);return}let o=await Ya(t),i=await za(o,t);if(i.default===void 0){J.info(`External task file recognized at ${t}. Please export a default handler function. For more information see https://processcube.io/docs/app-sdk/samples/nextjs/external-task-adapter-with-nextjs#external-tasks-entwickeln`);return}let a=await hn(),c=pn(a),d=tt(e,r),u=rt(d),f=i.default,l={identity:c,...s,...i?.config},m=new Ma(rs,u,f,l);m.onWorkerError((y,w,S)=>{J.error(`Intercepted "${y}"-type error: ${w.message}`,{err:w,type:y,externalTask:S})}),m.start(),await is(a,m),ue[t]=m}async function ja(t,e){let s=ue[t]?.workerId;dn(t),await fn(t,e,{workerId:s})}function dn(t){let e=ue[t];e&&(e.stop(),e.dispose())}async function Va(t){let s=(await Wa.readdir(t)).filter(r=>st.includes(r));if(s.length===0)return null;if(s.length>1)throw new Error(`Found more than one external task file in directory '${t}'`);return s[0]}async function hn(){if(!os)return null;if(!process.env.PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_ID||!process.env.PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_SECRET){let r=new Error("Required environment variables PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_ID and PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_SECRET are missing. For help, please refer to our documentation on environment variables at: https://processcube.io/docs/app-sdk/samples/nextjs/external-task-adapter-with-nextjs#authority");throw J.error("Required environment variables PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_ID and PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_SECRET are missing",{err:r}),r}let t=await Ba.discover(process.env.PROCESSCUBE_AUTHORITY_URL);return await new t.Client({client_id:process.env.PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_ID,client_secret:process.env.PROCESSCUBE_EXTERNAL_TASK_WORKER_CLIENT_SECRET}).grant({grant_type:"client_credentials",scope:"engine_etw"})}function pn(t){if(!os||t===null)return qa;let e=t.access_token,s=Ga(e);return{token:t.access_token,userId:s.sub}}async function is(t,e,s=5){try{if(!os||t===null||!e.pollingIsActive)return;let n=await Xa(t)*Ka*1e3;setTimeout(async()=>{if(!e.pollingIsActive)return;let o=await hn(),i=pn(o);e.identity=i,await is(o,e)},n)}catch(r){if(s===0)throw r;J.error(`Could not refresh identity for external task worker ${e.workerId}`,{err:r,workerId:e.workerId,retryCount:s});let n=2*1e3;setTimeout(async()=>await is(t,e,s-1),n)}}async function Ya(t){let e=await Ua({entryPoints:[t],write:!1,bundle:!0,platform:"node",target:"node18",format:"cjs"});if(e.errors.length>0)throw J.error(`Could not transpile file at '${t}'`,{errors:e.errors}),new Error(`Could not transpile file at '${t}'`);return e.warnings.length>0&&J.warn(`Transpiled file at '${t}' with warnings`,{warnings:e.warnings}),e.outputFiles[0].text}async function za(t,e){try{var s=module.constructor,r=new s;return r._compile(t,e),r.exports}catch(n){throw J.error("Could not require module from string",{err:n}),n}}async function Xa(t){let e=t.expires_in;if(!e&&t.expires_at&&(e=Math.floor(t.expires_at-Date.now()/1e3)),e===void 0)throw new Error("Could not determine the time until the access token for external task workers expires");return e}function rt(t){return t.replace(/^\.\/+|\([^)]+\)|^\/*|\/*$/g,"").replace(/[\/]{2,}/g,"/")}function Qa(t){let e,s=[t,an(process.cwd(),"app"),an(process.cwd(),"src","app")];for(let r of s)if(r&&cn(r)){e=r;break}if(!e)throw new Error("Could not find external tasks directory");return e}function Qc(){return $}import{cookies as nt,headers as _n}from"next/headers";import{ResponseCookies as Za}from"next/dist/compiled/@edge-runtime/cookies";import{getToken as En}from"next-auth/jwt";var Ja=process.env.NEXTAUTH_URL?.startsWith("https://"),gn=`${Ja?"__Secure-":""}next-auth.session-token`;async function sl(){let t=await En({req:{cookies:nt(),headers:_n()}});if(t?.expiresAt&&Date.now()>=t.expiresAt*1e3){let s=await fetch(`${process.env.NEXTAUTH_URL}/api/auth/session`,{method:"GET",headers:{"Content-Type":"application/json",cookie:nt().toString()}}),r=new Za(s.headers),n=r.get(gn);if(n){let o=!1;try{nt().set(gn,n.value,{...n})}catch{o=!0}if(t=await En({req:{cookies:o?r:nt(),headers:_n()}}),t?.error)throw t.error}}if(!t?.accessToken||!t?.sub)throw new Error("AccessToken or Sub could not be determined!");return{token:t?.accessToken,userId:t?.sub}}import{DataModels as ec}from"@5minds/processcube_engine_client";async function ol(t){return await $.processInstances.query({...t?.query,state:ec.ProcessInstances.ProcessInstanceState.running},t?.options)}import{DataModels as ae}from"@5minds/processcube_engine_client";async function ul(t={},e){let{correlationId:s,processInstanceId:r,flowNodeId:n}=t;return new Promise(async(o,i)=>{let a=await $.userTasks.onUserTaskWaiting(async u=>{let f=s!==void 0&&u.correlationId!==s,l=u.flowNodeInstanceId===void 0,m=r!==void 0&&u.processInstanceId!==r,y=n!==void 0&&u.flowNodeId!==n;if(f||l||m||y)return;let w=await sc(u.flowNodeInstanceId,{identity:e});return $.notification.removeSubscription(a,e),w===null?i(new Error(`UserTask with instance ID "${u.flowNodeInstanceId}" does not exist.`)):o(w)},{identity:e}),d=(await tc({correlationId:s,processInstanceId:r,flowNodeId:n,state:ae.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:e})).userTasks[0];d&&($.notification.removeSubscription(a,e),o(d))})}async function fl(t,e={},s={},r){await $.userTasks.finishUserTask(t,s,r);let n={state:ae.FlowNodeInstances.FlowNodeInstanceState.suspended,...e};return(await $.userTasks.query(n,{identity:r})).userTasks[0]}async function tc(...t){return await $.userTasks.query(...t)}async function dl(t){return await $.userTasks.query({state:ae.FlowNodeInstances.FlowNodeInstanceState.suspended},t)}async function hl(t,e){return await $.userTasks.query({processInstanceId:t,state:ae.FlowNodeInstances.FlowNodeInstanceState.suspended},e)}async function pl(t,e){return await $.userTasks.query({flowNodeId:t,state:ae.FlowNodeInstances.FlowNodeInstanceState.suspended},e)}async function sc(t,e){let s=await $.userTasks.query({flowNodeInstanceId:t,state:ae.FlowNodeInstances.FlowNodeInstanceState.suspended},{...e,limit:1});return s.userTasks.length===0?null:s.userTasks[0]}async function _l(t,e){return await $.userTasks.query({correlationId:t,state:ae.FlowNodeInstances.FlowNodeInstanceState.suspended},e)}async function El(t,e){let s=await $.userTasks.query({state:ae.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:t,...e}),r=s.userTasks.filter(n=>n.actualOwnerId===t.userId);return s.userTasks=r,s}async function gl(t,e){let s=await $.userTasks.query({state:ae.FlowNodeInstances.FlowNodeInstanceState.suspended},{identity:t,...e}),r=s.userTasks.filter(n=>n.assignedUserIds?.includes(t.userId));return s.userTasks=r,s}import{PHASE_DEVELOPMENT_SERVER as rc,PHASE_PRODUCTION_SERVER as nc}from"next/dist/shared/lib/constants";var mn=!1;function Il(t={}){let{applicationSdk:e,...s}=t;return async(r,n)=>{let o=r===rc||r===nc;return e?.useExternalTasks&&o&&!mn&&(mn=!0,await un(e?.customExternalTasksDirPath)),s}}import{revalidatePath as ic}from"next/cache";import{redirect as oc}from"next/navigation";function Ll(t){ic(t),oc(t)}async function Fl(...t){return await $.processModels.startProcessInstance(...t)}async function Ul(...t){await $.userTasks.finishUserTask(...t)}export{Ul as finishUserTask,fl as finishUserTaskAndGetNext,ol as getActiveProcessInstances,gl as getAssignedUserTasksByIdentity,Qc as getEngineClient,sl as getIdentity,El as getReservedUserTasksByIdentity,tc as getUserTasks,sc as getWaitingUserTaskByFlowNodeInstanceId,dl as getWaitingUserTasks,_l as getWaitingUserTasksByCorrelationId,pl as getWaitingUserTasksByFlowNodeId,hl as getWaitingUserTasksByProcessInstanceId,Ll as navigateToUrl,Fl as startProcess,ul as waitForUserTask,Il as withApplicationSdk};
3
3
  /*! Bundled license information:
4
4
 
5
5
  normalize-path/index.js: